libvirt: dump debug info when interface detach times out
The retry loop for detaching an interface is comparing the list of LibvirtConfigGuestInterfaces in the guest to the one we're trying to detach, so if we timeout waiting for the device to be gone from the guest it would be helpful to dump what is currently in the guest xml and the interface device we're looking for to compare. Change-Id: Id20a53812dbb1f888d8debc964418e79dd3e0a30 Related-Bug: #1696125
This commit is contained in:
parent
fabfb347f5
commit
a4e51d5c69
|
@ -1469,6 +1469,21 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||
guest.get_interface_by_cfg, cfg, live=live,
|
||||
alternative_device_name=self.vif_driver.get_vif_devname(vif))
|
||||
wait_for_detach()
|
||||
except exception.DeviceDetachFailed:
|
||||
# We failed to detach the device even with the retry loop, so let's
|
||||
# dump some debug information to the logs before raising back up.
|
||||
with excutils.save_and_reraise_exception():
|
||||
devname = self.vif_driver.get_vif_devname(vif)
|
||||
interface = guest.get_interface_by_cfg(cfg)
|
||||
if interface:
|
||||
LOG.warning(
|
||||
'Failed to detach interface %(devname)s after '
|
||||
'repeated attempts. Final interface xml:\n'
|
||||
'%(interface_xml)s\nFinal guest xml:\n%(guest_xml)s',
|
||||
{'devname': devname,
|
||||
'interface_xml': interface.to_xml(),
|
||||
'guest_xml': guest.get_xml_desc()},
|
||||
instance=instance)
|
||||
except exception.DeviceNotFound:
|
||||
# The interface is gone so just log it as a warning.
|
||||
LOG.warning(_LW('Detaching interface %(mac)s failed because '
|
||||
|
|
Loading…
Reference in New Issue