yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #59529
[Bug 1587802] Re: libvirt resize down prevention is invalid when using rbd as backend
Reviewed: https://review.openstack.org/382024
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=ed994bb4d72b5f93cfb76a5f726264e4896ad4ed
Submitter: Jenkins
Branch: master
commit ed994bb4d72b5f93cfb76a5f726264e4896ad4ed
Author: Feodor Tersin <ftersin@xxxxxxxxxxx>
Date: Tue Oct 4 20:17:17 2016 +0300
libvirt: Improve _is_booted_from_volume implementation
Currently this method cannot be used widely due to its parameters. It
requires device_info - the dict which can not be easily obtained in many
cases. Since it is often needed to figure out if an instance is booted
from volume, and the method name is "appropriate", this sometimes leads
to errors (when string result of get_instance_disk_info is passed as an
argument to _is_booted_from_volume; see also Id5901254).
This patch makes _is_booted_from_volume to use standard
block_device_info structure, which is accessible in almost any driver
method.
Closes-bug: 1596957
Closes-bug: 1587802
Change-Id: Ie424d172ac9d6aeb42d83e512f2a18713134be3b
** Changed in: nova
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1587802
Title:
libvirt resize down prevention is invalid when using rbd as backend
Status in OpenStack Compute (nova):
Fix Released
Bug description:
when using ceph as backend, instance can resize to a smaller flavor
successfully without any exception, ResizeError failed to raise.
when using ceph as backend, xml file looks like this:
<disk type='network' device='disk'>
<driver name='qemu' type='raw' cache='writeback'/>
<auth username='cinder'>
<secret type='ceph' uuid='457eb676-33da-42ec-9a8c-9293d545c337'/>
</auth>
<source protocol='rbd' name='vms/e888e9c5-4c63-4ec3-a8fe-45a432cc82e0_disk'>
<host name='172.16.40.18' port='6789'/>
</source>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
As the disk type is network, so get_instance_disk_info cannot get disk_info
nova/virt/libvirt/driver.py:
def _get_instance_disk_info(self, instance_name, xml,
block_device_info=None):
......
for cnt, path_node in enumerate(path_nodes):
disk_type = disk_nodes[cnt].get('type')
path = path_node.get('file') or path_node.get('dev')
target = target_nodes[cnt].attrib['dev']
if not path:
LOG.debug('skipping disk for %s as it does not have a path',
instance_name)
continue
if disk_type not in ['file', 'block']:
LOG.debug('skipping disk because it looks like a volume', path)
continue
if target in volume_devices:
LOG.debug('skipping disk %(path)s (%(target)s) as it is a '
'volume', {'path': path, 'target': target})
continue
......
nova/virt/libvirt/driver.py:
@staticmethod
def _is_booted_from_volume(instance, disk_mapping):
"""Determines whether the VM is booting from volume
Determines whether the disk mapping indicates that the VM
is booting from a volume.
"""
return ((not bool(instance.get('image_ref')))
or 'disk' not in disk_mapping)
In the end when migrate_disk_and_power_off calling
is_booted_from_volume, disk_mapping = [] and treated as volume backed
instance.
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1587802/+subscriptions
References