nova/nova/virt/libvirt
Sahid Orentino Ferdjaoui 92bd7ea118 libvirt: disconnect volume from host during detach
Under certain failure scenarios it may be that although the libvirt
definition for the volume has been removed for the instance that the
associated storage lun on the compute server may not have been fully
cleaned up yet.

In case users try an other attempt to detach volume we should not stop
the process whether the device is not found in domain definition but
try to disconnect the logical device from host.

This commit makes the process to attempt a disconnect volume even if
the device is not attached to the guest.

Closes-Bug: #1727260
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@redhat.com>

(cherry picked from commit ce531dd1b7)
(cherry picked from commit d6a072b5c5)

Conflicts:
	nova/tests/unit/virt/libvirt/test_driver.py

NOTE: The conflicts were due to the newer testcase mocking
'nova.virt.libvirt.host.Host._get_domain' where the older code calls
'nova.virt.libvirt.host.Host.get_domain', and also dealing with the
fact that the older code doesn't pass 'encryption' to
self._disconnect_volume().

This latter issue means that we need to move the call to
encryptor.detach_volume() to ensure it gets called if we hit
exception.DeviceNotFound when detaching the device from
the guest.  This is similar to the original code proposed
in https://review.openstack.org/#/c/515008/9/nova/virt/libvirt/driver.py
but it requires special handling for the scenario where cryptsetup
tries to destroy a dm-crypt device that has already been destroyed.

Signed-off-by: Chris Friesen <chris.friesen@windriver.com>
Change-Id: I4182642aab3fd2ffb1c97d2de9bdca58982289d8
2018-04-19 20:04:45 +00:00
..
storage Remove translation of log messages 2017-06-13 11:20:28 +07:00
volume Vzstorage: synchronize volume connect 2017-12-01 17:46:19 +00:00
__init__.py Remove vi modelines 2014-02-03 14:19:44 +00:00
blockinfo.py Merge "Fix root_device_name for Xen" 2017-01-31 18:56:46 +00:00
compat.py Remove translation of log messages 2017-06-13 11:20:28 +07:00
config.py Add format_dom for PCI device addresses 2017-08-08 17:20:34 +03:00
designer.py libvirt: conditionally set script path for ethernet vif types 2017-03-21 14:12:39 -04:00
driver.py libvirt: disconnect volume from host during detach 2018-04-19 20:04:45 +00:00
firewall.py Remove translation of log messages 2017-06-13 11:20:28 +07:00
guest.py libvirt: Don't VIR_MIGRATE_NON_SHARED_INC without migrate_disks 2017-11-01 16:44:35 +00:00
host.py libvirt: Fix getting a wrong guest object 2017-08-28 19:40:56 +00:00
imagebackend.py imagebackend: cleanup constructor args to Rbd 2017-08-03 15:22:38 +01:00
imagecache.py Remove translation of log messages 2017-06-13 11:20:28 +07:00
instancejobtracker.py Remove translation of log messages 2017-06-13 11:20:28 +07:00
migration.py live-mig: keep disk device address same 2018-02-07 09:56:15 +00:00
utils.py Move the last_bytes util method to libvirt 2017-07-26 08:36:32 +10:00
vif.py Add VIFHostDevice support to libvirt driver 2017-07-25 21:15:30 +00:00