From 236bb54493385bcfe2034e8b0fd7a387fa66635a Mon Sep 17 00:00:00 2001 From: melanie witt Date: Thu, 1 Feb 2018 22:27:57 +0000 Subject: [PATCH] Don't wait for vif plug events during _hard_reboot Originally, in change Id188d48609f3d22d14e16c7f6114291d547a8986 we added a re-initialization of volumes, encryptors, and vifs to hard reboot. When creating the libvirt domain and network, we were waiting for vif plug events from neutron when we replugged the vifs. Then, we started seeing timeouts in the linuxbridge gate job because compute was timing out waiting for plug events from neutron during a hard reboot. It turns out that the behavior of neutron plug events depends on what vif type we're using and we're also using a stale network info_cache throughout the hard reboot code path, so we can't be 100% sure we know which vifs to wait for plug events from anyway. We coincidentally get some info_cache refreshes from network-changed events from neutron, but we shouldn't rely on that. Ideally, we could do something like wait for an unplug event after we unplug the vif, then refresh the network_info cache, then wait for the plug event. BUT, in the case of the os-vif linuxbridge unplug method, it is a no-op, so I don't think we could expect to get an unplug event for it (and we don't see any network-vif-unplugged events sent in the q-svc log for the linuxbridge job during a hard reboot). Closes-Bug: #1744361 Change-Id: Ib0cf5d55750f13d0499a570f14024dca551ed4d4 --- nova/tests/unit/virt/libvirt/test_driver.py | 2 +- nova/virt/libvirt/driver.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/nova/tests/unit/virt/libvirt/test_driver.py b/nova/tests/unit/virt/libvirt/test_driver.py index a58cd90958ec..cbd87fd5cf41 100644 --- a/nova/tests/unit/virt/libvirt/test_driver.py +++ b/nova/tests/unit/virt/libvirt/test_driver.py @@ -12608,7 +12608,7 @@ class LibvirtConnTestCase(test.NoDBTestCase, block_device_info=block_device_info, mdevs=[uuids.mdev1]) mock_create_domain_and_network.assert_called_once_with(self.context, dummyxml, instance, network_info, - block_device_info=block_device_info) + block_device_info=block_device_info, vifs_already_plugged=True) @mock.patch('oslo_utils.fileutils.ensure_tree') @mock.patch('oslo_service.loopingcall.FixedIntervalLoopingCall') diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index 1f921c1fefd0..fb1394e596f9 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -2708,8 +2708,14 @@ class LibvirtDriver(driver.ComputeDriver): # Initialize all the necessary networking, block devices and # start the instance. + # NOTE(melwitt): Pass vifs_already_plugged=True here even though we've + # unplugged vifs earlier. The behavior of neutron plug events depends + # on which vif type we're using and we are working with a stale network + # info cache here, so won't rely on waiting for neutron plug events. + # vifs_already_plugged=True means "do not wait for neutron plug events" self._create_domain_and_network(context, xml, instance, network_info, - block_device_info=block_device_info) + block_device_info=block_device_info, + vifs_already_plugged=True) self._prepare_pci_devices_for_use( pci_manager.get_instance_pci_devs(instance, 'all'))