diff options
| author | Vishvananda Ishaya <vishvananda@gmail.com> | 2010-07-26 11:02:28 -0700 |
|---|---|---|
| committer | Vishvananda Ishaya <vishvananda@gmail.com> | 2010-07-26 11:02:28 -0700 |
| commit | b1bc1e2edc9fdafabfc27b5ea313dbb934c374eb (patch) | |
| tree | c51a31f5c90eba7935458c0052539799dc67937d /nova/compute | |
| parent | 3233f7a964564fba9ec88c277d566eebed50d12a (diff) | |
| parent | 340f9fc8d63ec931485aba1dcfeccdc1cb3849fa (diff) | |
| download | nova-b1bc1e2edc9fdafabfc27b5ea313dbb934c374eb.tar.gz nova-b1bc1e2edc9fdafabfc27b5ea313dbb934c374eb.tar.xz nova-b1bc1e2edc9fdafabfc27b5ea313dbb934c374eb.zip | |
merged trunk
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/disk.py | 7 | ||||
| -rw-r--r-- | nova/compute/node.py | 20 |
2 files changed, 16 insertions, 11 deletions
diff --git a/nova/compute/disk.py b/nova/compute/disk.py index 08a22556e..1ffcca685 100644 --- a/nova/compute/disk.py +++ b/nova/compute/disk.py @@ -40,7 +40,8 @@ def partition(infile, outfile, local_bytes=0, local_type='ext2', execute=None): formatted as ext2. In the diagram below, dashes represent drive sectors. - 0 a b c d e + +-----+------. . .-------+------. . .------+ + | 0 a| b c|d e| +-----+------. . .-------+------. . .------+ | mbr | primary partiton | local partition | +-----+------. . .-------+------. . .------+ @@ -64,8 +65,8 @@ def partition(infile, outfile, local_bytes=0, local_type='ext2', execute=None): last_sector = local_last # e # create an empty file - execute('dd if=/dev/zero of=%s count=1 seek=%d bs=%d' - % (outfile, last_sector, sector_size)) + yield execute('dd if=/dev/zero of=%s count=1 seek=%d bs=%d' + % (outfile, last_sector, sector_size)) # make mbr partition yield execute('parted --script %s mklabel msdos' % outfile) diff --git a/nova/compute/node.py b/nova/compute/node.py index 4683f1c8d..7cae86d02 100644 --- a/nova/compute/node.py +++ b/nova/compute/node.py @@ -223,16 +223,20 @@ class Node(object, service.Service): volume_id = None, mountpoint = None): volume = storage.get_volume(volume_id) yield self._init_aoe() - yield utils.runthis("Attached Volume: %s", - "sudo virsh attach-disk %s /dev/etherd/%s %s" - % (instance_id, volume['aoe_device'], mountpoint.split("/")[-1])) + yield process.simple_execute( + "sudo virsh attach-disk %s /dev/etherd/%s %s" % + (instance_id, + volume['aoe_device'], + mountpoint.rpartition('/dev/')[2])) volume.finish_attach() defer.returnValue(True) + @defer.inlineCallbacks def _init_aoe(self): - utils.runthis("Doin an AoE discover, returns %s", "sudo aoe-discover") - utils.runthis("Doin an AoE stat, returns %s", "sudo aoe-stat") + yield process.simple_execute("sudo aoe-discover") + yield process.simple_execute("sudo aoe-stat") + @defer.inlineCallbacks @exception.wrap_exception def detach_volume(self, instance_id, volume_id): """ detach a volume from an instance """ @@ -240,10 +244,10 @@ class Node(object, service.Service): # name without the leading /dev/ volume = storage.get_volume(volume_id) target = volume['mountpoint'].rpartition('/dev/')[2] - utils.runthis("Detached Volume: %s", "sudo virsh detach-disk %s %s " - % (instance_id, target)) + yield process.simple_execute( + "sudo virsh detach-disk %s %s " % (instance_id, target)) volume.finish_detach() - return defer.succeed(True) + defer.returnValue(True) class Group(object): |
