return 'rbd' if CONF.libvirt.images_type == 'rbd' else 'raw'
@staticmethod
- def _is_booted_from_volume(instance, disk_mapping):
+ def _is_booted_from_volume(block_device_info):
"""Determines whether the VM is booting from volume
- Determines whether the disk mapping indicates that the VM
+ Determines whether the block device info indicates that the VM
is booting from a volume.
"""
- return ((not bool(instance.get('image_ref')))
- or 'disk' not in disk_mapping)
+ block_device_mapping = driver.block_device_info_get_mapping(
+ block_device_info)
+ return bool(block_device.get_root_bdm(block_device_mapping))
- def _inject_data(self, injection_image, instance, network_info,
- admin_pass, files):
+ def _inject_data(self, disk, instance, injection_info):
"""Injects data in a disk image
Helper used for injecting data in a disk image file system.
# method doesn't fail if an image already exists but instead
# think that it will be reused (ie: (live)-migration/resize)
def _create_image(self, context, instance,
- disk_mapping, suffix='',
- disk_images=None, network_info=None,
- block_device_info=None, files=None,
- admin_pass=None, inject_files=True,
+ disk_mapping, injection_info=None, suffix='',
+ disk_images=None, block_device_info=None,
fallback_from_host=None,
ignore_bdi_for_swap=False):
- booted_from_volume = self._is_booted_from_volume(
- instance, disk_mapping)
+ booted_from_volume = self._is_booted_from_volume(block_device_info)
def image(fname, image_type=CONF.libvirt.images_type):
return self.image_backend.by_name(instance,