Add debug log for device detach libvirt error

We see a new way of virDomainDetachDeviceFlags() to fail in bug 1931716.
This patch logs the libvirt error code and error message.

Change-Id: I7ec4ea68a933d1cb415c4adee97a508cf9611468
Related-Bug: #1931716
This commit is contained in:
Balazs Gibizer 2021-06-11 18:10:12 +02:00
parent 245433b826
commit 7c76821499

View File

@ -2499,6 +2499,11 @@ class LibvirtDriver(driver.ComputeDriver):
except libvirt.libvirtError as ex: except libvirt.libvirtError as ex:
code = ex.get_error_code() code = ex.get_error_code()
msg = ex.get_error_message() msg = ex.get_error_message()
LOG.debug(
"Libvirt returned error while detaching device %s from "
"instance %s. Libvirt error code: %d, error message: %s.",
device_name, instance_uuid, code, msg
)
if code == libvirt.VIR_ERR_DEVICE_MISSING: if code == libvirt.VIR_ERR_DEVICE_MISSING:
LOG.debug( LOG.debug(
'Libvirt failed to detach device %s from instance %s ' 'Libvirt failed to detach device %s from instance %s '