summaryrefslogtreecommitdiff
path: root/nova/virt
diff options
context:
space:
mode:
authorLee Yarwood <lyarwood@redhat.com>2018-07-20 16:02:49 +0100
committerLee Yarwood <lyarwood@redhat.com>2021-01-21 19:37:13 +0000
commitbe83c7ecc09fac5ef88e6624c9e026bf730a5ff3 (patch)
tree7d6e88df1acbb68094cc75a1d6a0308cac035e0b /nova/virt
parente2caea6cae13304c314fdd10ba78b689bb5a90d0 (diff)
downloadnova-be83c7ecc09fac5ef88e6624c9e026bf730a5ff3.tar.gz
libvirt: Remove reference to transient domain when detaching devices
When detaching a device from a domain we first attempt to remove the device from both the persistent and live configs before looping to ensure the device has really been detached from the running live config. Previously when this failed we logged an error message that suggested that this was due to issues detaching the device from a transient domain, however this is not the case as the domain is persistent. This change simply updates the error and associated comments to only reference the live config of the domain. Additionally a DEBUG line claiming that a device has been successfully detached is now only logged once the device is removed from the live config, hopefully avoiding any confusion from this line been logged each time an attempt is made to detach the device. Change-Id: If869470216600c303d47cf79f12c4fc88abcf813 (cherry picked from commit 636c7461dee4002571da6e99986eb17e9a28b0f4)
Diffstat (limited to 'nova/virt')
-rw-r--r--nova/virt/libvirt/guest.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/nova/virt/libvirt/guest.py b/nova/virt/libvirt/guest.py
index 86e9aa051b..573d800bf7 100644
--- a/nova/virt/libvirt/guest.py
+++ b/nova/virt/libvirt/guest.py
@@ -398,9 +398,11 @@ class Guest(object):
# Raise DeviceNotFound if the device isn't found during detach
try:
self.detach_device(conf, persistent=persistent, live=live)
- LOG.debug('Successfully detached device %s from guest. '
- 'Persistent? %s. Live? %s',
- device, persistent, live)
+ if get_device_conf_func(device) is None:
+ LOG.debug('Successfully detached device %s from guest. '
+ 'Persistent? %s. Live? %s',
+ device, persistent, live)
+
except libvirt.libvirtError as ex:
with excutils.save_and_reraise_exception():
errcode = ex.get_error_code()
@@ -452,11 +454,11 @@ class Guest(object):
def _do_wait_and_retry_detach():
config = get_device_conf_func(device)
if config is not None:
- # Device is already detached from persistent domain
- # and only transient domain needs update
+ # Device is already detached from persistent config
+ # and only the live config needs to be updated.
_try_detach_device(config, persistent=False, live=live)
- reason = _("Unable to detach from guest transient domain.")
+ reason = _("Unable to detach the device from the live config.")
raise exception.DeviceDetachFailed(
device=alternative_device_name, reason=reason)