From 4814e9126ec19a1edfa9c696138c4b3fec71aa0d Mon Sep 17 00:00:00 2001
From: Dan Smith <dansmith@redhat.com>
Date: Thu, 30 Apr 2015 13:23:07 -0700
Subject: [PATCH] Don't wait for an event on a resize-revert

Since we never unplugged, the event ain't comin'.

Sadly, the test that covers this was pretty wrong on multiple fronts,
which this patch fixes up.

Closes-Bug: #1450624
Change-Id: Id515137747a4b76e9b7057c95f80c8ae74017519
---
 nova/tests/unit/virt/libvirt/test_driver.py | 9 ++++++---
 nova/virt/libvirt/driver.py                 | 3 ++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/nova/tests/unit/virt/libvirt/test_driver.py b/nova/tests/unit/virt/libvirt/test_driver.py
index 88d72bd53e47..8d7a38514d3c 100644
--- a/nova/tests/unit/virt/libvirt/test_driver.py
+++ b/nova/tests/unit/virt/libvirt/test_driver.py
@@ -11760,10 +11760,13 @@ class LibvirtDriverTestCase(test.NoDBTestCase):
         def fake_plug_vifs(instance, network_info):
             pass
 
-        def fake_create_domain(xml, instance=None, launch_flags=0,
-                               power_on=True):
+        def fake_create_domain(context, xml, instance, network_info,
+                               disk_info, block_device_info=None,
+                               power_on=None,
+                               vifs_already_plugged=None):
             self.fake_create_domain_called = True
             self.assertEqual(powered_on, power_on)
+            self.assertTrue(vifs_already_plugged)
             return mock.MagicMock()
 
         def fake_enable_hairpin(instance):
@@ -11785,7 +11788,7 @@ class LibvirtDriverTestCase(test.NoDBTestCase):
         self.stubs.Set(utils, 'execute', fake_execute)
         fw = base_firewall.NoopFirewallDriver()
         self.stubs.Set(self.drvr, 'firewall_driver', fw)
-        self.stubs.Set(self.drvr, '_create_domain',
+        self.stubs.Set(self.drvr, '_create_domain_and_network',
                        fake_create_domain)
         self.stubs.Set(self.drvr, '_enable_hairpin',
                        fake_enable_hairpin)
diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py
index 76544b348de7..538a739bc8fe 100644
--- a/nova/virt/libvirt/driver.py
+++ b/nova/virt/libvirt/driver.py
@@ -6492,7 +6492,8 @@ class LibvirtDriver(driver.ComputeDriver):
         self._create_domain_and_network(context, xml, instance, network_info,
                                         disk_info,
                                         block_device_info=block_device_info,
-                                        power_on=power_on)
+                                        power_on=power_on,
+                                        vifs_already_plugged=True)
 
         if power_on:
             timer = loopingcall.FixedIntervalLoopingCall(