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.

Change-Id: I6daf1569cba2cfcb4e8da0b46c91d5251c9c6740
Related-Bug: #1694371
This commit is contained in:
Matt Riedemann 2017-06-06 15:52:50 -04:00
parent e01ae75d52
commit 82ecd93a20
2 changed files with 8 additions and 4 deletions

View File

@ -14384,7 +14384,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

@ -5160,9 +5160,12 @@ class LibvirtDriver(driver.ComputeDriver):
destroy_disks_on_failure)
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)
LOG.warning('Timeout waiting for vif plugging callback for '
'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,