X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-remote.git/blobdiff_plain/9b2c6cb76b2935133c0c1ed1626d077614b460ec..refs/heads/dev:/host/usr/sbin/invirt-lvm diff --git a/host/usr/sbin/invirt-lvm b/host/usr/sbin/invirt-lvm index a042f0e..6860d9c 100755 --- a/host/usr/sbin/invirt-lvm +++ b/host/usr/sbin/invirt-lvm @@ -22,7 +22,7 @@ def ensureoff(machine): rv = call(["/usr/sbin/xm", "destroy", prefix + machine], stderr=PIPE) -machine_specific = subcommand not in ['lvcreate-all', 'vgcapacity']: +machine_specific = subcommand not in ['lvcreate-all', 'vgcapacity'] if machine_specific: machine = sys.argv[2] @@ -31,12 +31,12 @@ if machine_specific: lvpath = "/dev/" + vg + "/" + lvname if subcommand == "lvcreate-all": - from invirt import database + from invirt.database import models, connect import re - database.connect() - for d in Disk.select(): + connect() + for d in models.Disk.query().all(): check(re.match('^[A-Za-z0-9]+$', d.guest_device_name)) - machine = Machine.get(d.machine_id) + machine = models.Machine.query().filter_by(machine_id=d.machine_id).one() check(re.match('^[A-Za-z0-9][A-Za-z0-9._-]*$', machine.name)) lvname = prefix + machine.name + "_" + d.guest_device_name if not os.path.exists("/dev/%s/%s" % (vg, lvname)):