summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nova/virt/disk/mount.py6
-rw-r--r--nova/virt/libvirt/connection.py12
2 files changed, 12 insertions, 6 deletions
diff --git a/nova/virt/disk/mount.py b/nova/virt/disk/mount.py
index 4fb5dda54..11959b2f6 100644
--- a/nova/virt/disk/mount.py
+++ b/nova/virt/disk/mount.py
@@ -58,7 +58,9 @@ class Mount(object):
"""Map partitions of the device to the file system namespace."""
assert(os.path.exists(self.device))
- if self.partition:
+ if self.partition == -1:
+ self.error = _('partition search unsupported with %s') % self.mode
+ elif self.partition:
map_path = '/dev/mapper/%sp%s' % (os.path.basename(self.device),
self.partition)
assert(not os.path.exists(map_path))
@@ -73,7 +75,7 @@ class Mount(object):
# so given we only use it when we expect a partitioned image, fail
if not os.path.exists(map_path):
if not err:
- err = _('no partitions found')
+ err = _('partition %s not found') % self.partition
self.error = _('Failed to map partitions: %s') % err
else:
self.mapped_device = map_path
diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py
index 96c2b89e0..9592f9e73 100644
--- a/nova/virt/libvirt/connection.py
+++ b/nova/virt/libvirt/connection.py
@@ -105,6 +105,11 @@ libvirt_opts = [
cfg.BoolOpt('libvirt_inject_key',
default=True,
help='Inject the ssh public key at boot time'),
+ cfg.IntOpt('libvirt_inject_partition',
+ default=1,
+ help='The partition to inject to : '
+ '-1 => inspect (libguestfs only), 0 => not partitioned, '
+ '>0 => partition number'),
cfg.BoolOpt('use_usb_tablet',
default=True,
help='Sync virtual and real mouse cursors in Windows VMs'),
@@ -1253,12 +1258,11 @@ class LibvirtConnection(driver.ComputeDriver):
cow=FLAGS.use_cow_images,
swap_mb=swap_mb)
- # For now, we assume that if we're not using a kernel, we're using a
- # partitioned disk image where the target partition is the first
- # partition
target_partition = None
if not instance['kernel_id']:
- target_partition = "1"
+ target_partition = FLAGS.libvirt_inject_partition
+ if target_partition == 0:
+ target_partition = None
config_drive_id = instance.get('config_drive_id')
config_drive = instance.get('config_drive')