diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-01-11 22:45:35 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-01-11 22:45:35 +0000 |
| commit | 31ae0cf22ab7692039e17e3a534cf5db1fbfa4c7 (patch) | |
| tree | 82dffab2e648294898ce90662047d06af7bc312c | |
| parent | b7f80d017035b1b821a0f2deca9a6e2046882a2a (diff) | |
| parent | e988f431d86660318b46729dea6e772083f2248d (diff) | |
Merge "Fix libguestfs operation with specified partitions"
| -rw-r--r-- | nova/virt/disk/guestfs.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/nova/virt/disk/guestfs.py b/nova/virt/disk/guestfs.py index 6323dc8e3..20e3eda39 100644 --- a/nova/virt/disk/guestfs.py +++ b/nova/virt/disk/guestfs.py @@ -33,11 +33,17 @@ class Mount(mount.Mount): self.mapped = False def mnt_dev(self): + try: + partition = int(self.partition or 0) + except ValueError: + self.error = _('unsupported partition: %s') % self.partition + return False + args = ('guestmount', '--rw', '-a', self.image) - if self.partition == -1: + if partition == -1: args += ('-i',) # find the OS partition - elif self.partition: - args += ('-m', '/dev/sda%d' % self.partition) + elif partition: + args += ('-m', '/dev/sda%d' % partition) else: # We don't resort to -i for this case yet, # as some older versions of libguestfs |
