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.
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 <email address hidden>
Change-Id: I4182642aab3fd2ffb1c97d2de9bdca58982289d8
Reviewed: https:/ /review. openstack. org/560690 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=92bd7ea118f ec4791b903871cd c95d0cd71583e2
Committed: https:/
Submitter: Zuul
Branch: stable/pike
commit 92bd7ea118fec47 91b903871cdc95d 0cd71583e2
Author: Sahid Orentino Ferdjaoui <email address hidden>
Date: Wed Oct 25 05:57:11 2017 -0400
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 <email address hidden>
(cherry picked from commit ce531dd1b763704 b9043ddde8e80ac 99cd193660) de7f4b42cda517e ad17efe561)
(cherry picked from commit d6a072b5c5a3ff9
Conflicts: tests/unit/ virt/libvirt/ test_driver. py
nova/
NOTE: The conflicts were due to the newer testcase mocking virt.libvirt. host.Host. _get_domain' where the older code calls virt.libvirt. host.Host. get_domain' , and also dealing with the _disconnect_ volume( ).
'nova.
'nova.
fact that the older code doesn't pass 'encryption' to
self.
This latter issue means that we need to move the call to detach_ volume( ) to ensure it gets called if we hit DeviceNotFound when detaching the device from /review. openstack. org/#/c/ 515008/ 9/nova/ virt/libvirt/ driver. py
encryptor.
exception.
the guest. This is similar to the original code proposed
in https:/
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 <email address hidden> ffb1c97d2de9bdc a58982289d8
Change-Id: I4182642aab3fd2