From 527834dea884d0663c1cf5f075c850e6f4a4eeaa Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Thu, 16 Mar 2017 11:35:04 -0400 Subject: [PATCH] libvirt: add debug logging in detach_device_with_retry When we hit failures in this method it can be hard to sort out from a traceback what actually happened, and if we failed from the intial detach or if we failed during the retry loop. This patch adds some simple debug logging statements to help give context to what's going on when we need to debug a failure in this operation. Change-Id: I392192f139ced077664e54469eead0b0df9ebf4a Related-Bug: #1673483 (cherry picked from commit 33d0b029f1927a455b6b00f41b4d83ed19a694ff) --- nova/virt/libvirt/guest.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nova/virt/libvirt/guest.py b/nova/virt/libvirt/guest.py index 2d483d599ea0..7a69cfd019de 100644 --- a/nova/virt/libvirt/guest.py +++ b/nova/virt/libvirt/guest.py @@ -395,6 +395,9 @@ 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) except libvirt.libvirtError as ex: with excutils.save_and_reraise_exception(): errcode = ex.get_error_code() @@ -417,7 +420,9 @@ class Guest(object): if conf is None: raise exception.DeviceNotFound(device=alternative_device_name) + LOG.debug('Attempting initial detach for device %s', device) _try_detach_device(conf, persistent, live) + LOG.debug('Start retrying detach until device %s is gone.', device) @loopingcall.RetryDecorator(max_retry_count=max_retry_count, inc_sleep_time=inc_sleep_time,