From 2cf2b7ea6441c2eb73574a6e35ef10ae07550c6b Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Thu, 8 Jun 2017 14:28:50 -0400 Subject: [PATCH] libvirt: fix alternative_device_name for detaching interfaces There are two changes here: 1. Get the actual vif device name for logging, e.g. tap3e81295f-c1 2. Log that in detach_device_with_retry so we're not logging an LibvirtConfigGuestInterface object. Change-Id: I7588c17a9936eb765269c662cad4cbedc5f58fbf Related-Bug: #1696125 (cherry picked from commit fabfb347f51afbe9064a6d0061404316786140cb) (cherry picked from commit c04c5d57cc41deacec53e18abe3ba93a1d5b5ccf) --- nova/virt/libvirt/driver.py | 2 +- nova/virt/libvirt/guest.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index ea09dc94980d..82fa13c7cbab 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -1363,7 +1363,7 @@ class LibvirtDriver(driver.ComputeDriver): # timeout. wait_for_detach = guest.detach_device_with_retry( guest.get_interface_by_cfg, cfg, live=live, - alternative_device_name=vif.get('address')) + alternative_device_name=self.vif_driver.get_vif_devname(vif)) wait_for_detach() except exception.DeviceNotFound: # The interface is gone so just log it as a warning. diff --git a/nova/virt/libvirt/guest.py b/nova/virt/libvirt/guest.py index d2c4f7d5040b..3844d4dbf1c5 100644 --- a/nova/virt/libvirt/guest.py +++ b/nova/virt/libvirt/guest.py @@ -415,9 +415,11 @@ class Guest(object): persistent = self.has_persistent_configuration() - LOG.debug('Attempting initial detach for device %s', device) + LOG.debug('Attempting initial detach for device %s', + alternative_device_name) _try_detach_device(conf, persistent, live) - LOG.debug('Start retrying detach until device %s is gone.', device) + LOG.debug('Start retrying detach until device %s is gone.', + alternative_device_name) @loopingcall.RetryDecorator(max_retry_count=max_retry_count, inc_sleep_time=inc_sleep_time,