libvirt: log vm and task state when vif plugging times out

This enhances the warning we log when we timeout waiting
for the network-vif-plugged event from Neutron. It includes
the vm_state and task_state for context on the instance operation
since this is done for more than just the initial create, it's
also for things like rebuild.

The explicit instance uuid is also removed from the message since
sending the instance kwarg to LOG.warning logs the instance uuid
automatically. And _LW is also dropped since we no longer translate
log messages.

Conflicts:
        nova/virt/libvirt/driver.py

NOTE(lyarwood): Conflict is the result of _LW being required in Ocata.

Change-Id: I6daf1569cba2cfcb4e8da0b46c91d5251c9c6740
Related-Bug: #1694371
(cherry picked from commit 82ecd93a20)
This commit is contained in:
Matt Riedemann 2017-06-06 15:52:50 -04:00 committed by Lee Yarwood
parent 781e7b3fcd
commit a0599e438a
2 changed files with 7 additions and 3 deletions

View File

@ -14578,7 +14578,8 @@ class LibvirtConnTestCase(test.NoDBTestCase):
prepare.side_effect = fake_prepare
drvr = libvirt_driver.LibvirtDriver(virtapi, False)
instance = objects.Instance(**self.test_instance)
instance = objects.Instance(vm_state=vm_states.BUILDING,
**self.test_instance)
vifs = [{'id': 'vif1', 'active': False},
{'id': 'vif2', 'active': False}]

View File

@ -5207,8 +5207,11 @@ class LibvirtDriver(driver.ComputeDriver):
except eventlet.timeout.Timeout:
# We never heard from Neutron
LOG.warning(_LW('Timeout waiting for vif plugging callback for '
'instance %(uuid)s'), {'uuid': instance.uuid},
instance=instance)
'instance with vm_state %(vm_state)s and '
'task_state %(task_state)s.'),
{'vm_state': instance.vm_state,
'task_state': instance.task_state},
instance=instance)
if CONF.vif_plugging_is_fatal:
self._cleanup_failed_start(context, instance, network_info,
block_device_info, guest,