Unable to delete vm in 12.04 with libvirt_images_type=lvm

Asked by Patrick Cheung on 2012-10-13

Hello,

I am running Ubuntu 12.04 and I installed OpenStack Folsom through Ubuntu Cloud Archive. The package version for nova-compute when I was testing this was 2012.2-0ubuntu3~cloud0.

I configured nova-compute to use LVM as instance storage backend and I put these two lines in nova.conf.

libvirt_images_type=lvm
libvirt_images_volume_group=nova-volumes

These two options are described in the blueprint here:
https://blueprints.launchpad.net/nova/+spec/lvm-disk-images

Deleting the VM using the dashboard failed. And I have this error in the nova-compute log:

2012-10-11 13:36:22 ERROR nova.openstack.common.rpc.amqp [-] Exception during message handling
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp Traceback (most recent call last):
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp File "/usr/lib/python2.7/dist-packages/nova/openstack/common/rpc/amqp.py", line 275, in _process_data
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp rval = self.proxy.dispatch(ctxt, version, method, **args)
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp File "/usr/lib/python2.7/dist-packages/nova/openstack/common/rpc/dispatcher.py", line 145, in dispatch
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp return getattr(proxyobj, method)(ctxt, **kwargs)
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp File "/usr/lib/python2.7/dist-packages/nova/exception.py", line 117, in wrapped
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp temp_level, payload)
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp self.gen.next()
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp File "/usr/lib/python2.7/dist-packages/nova/exception.py", line 92, in wrapped
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp return f(*args, **kw)
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 202, in decorated_function
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp kwargs['instance']['uuid'], e, sys.exc_info())
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp self.gen.next()
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 196, in decorated_function
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp return function(self, context, *args, **kwargs)
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 934, in terminate_instance
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp do_terminate_instance(instance)
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp File "/usr/lib/python2.7/dist-packages/nova/utils.py", line 752, in inner
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp retval = f(*args, **kwargs)
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 926, in do_terminate_instance
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp self._delete_instance(context, instance)
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 884, in _delete_instance
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp self._shutdown_instance(context, instance)
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 848, in _shutdown_instance
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp block_device_info)
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/driver.py", line 496, in destroy
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp self._cleanup(instance, network_info, block_device_info)
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/driver.py", line 570, in _cleanup
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp self._cleanup_lvm(instance)
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/driver.py", line 574, in _cleanup_lvm
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp disks = self._lvm_disks(instance)
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/driver.py", line 592, in _lvm_disks
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp logical_volumes = libvirt_utils.list_logical_volumes(vg)
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/utils.py", line 147, in list_logical_volumes
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp run_as_root=True)
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/utils.py", line 53, in execute
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp return utils.execute(*args, **kwargs)
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp File "/usr/lib/python2.7/dist-packages/nova/utils.py", line 198, in execute
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp cmd=' '.join(cmd))
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp ProcessExecutionError: Unexpected error while running command.
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp Command: sudo nova-rootwrap /etc/nova/rootwrap.conf lvs --noheadings -o lv_path /dev/nova-volumes
2012-10-11 13:36:22 TRACE nova.openstack.common.rpc.amqp Exit code: 5

Then I realise that nova-compute is calling the lvs command with "-o lv_path" option which isn’t supported in 12.04. How can I fix this problem apart from upgrading to 12.10, which seems to support the "-o lv_path" option?

Many thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
OpenStack Compute (nova) Edit question
Assignee:
No assignee Edit question
Solved by:
Patrick Cheung
Solved:
2012-10-21
Last query:
2012-10-21
Last reply:
Anthony Goddard (agoddard) said : #1

The above bug prevents instances being deleted. Their logical volume needs to be manually removed before nova delete works.

(out of interest - on 12.10, the lvs command with lv_path completes successfully, but the Logical Volume isn't deleted when the instance is deleted)

Patrick Cheung (cheungpat) said : #2

I patched list_logical_volumes in /usr/lib/python2.7/dist-packages/nova/virt/libvirt/utils.py:

- out, err = execute('lvs', '--noheadings', '-o', 'lv_path', vg,
+ out, err = execute('lvs', '--noheadings', '-o', 'lv_name', vg,

and restart nova-compute. The logical volume can be deleted successfully afterwards.

Stuart Stent (stuart-stent) said : #3

this is also the case on -- CentOS release 6.2 (Final)

Once I applied the patch above all worked properly