summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJian Wen <jian.wen@canonical.com>2012-12-12 22:14:18 +0800
committerJian Wen <jian.wen@canonical.com>2012-12-19 10:56:47 +0800
commit51546e79f366d14f25bb5a933a3ab0ad033e7a3d (patch)
tree47c6ff99660837a6c7b1664de572d1a66cce68d0 /nova/tests
parent1d864329c6c5320bde0cd30e3b39f2f93bbe9196 (diff)
libvirt: Make vif_driver.plug() returns None
The return value of vif_driver.plug() was used only when nova wrote the libvirt.xml file on initial boot of the instance. Make it returns None, and add get_config() to get the configurations if needed. If LibvirtBridgeDriver is used when the nova-comptue inits, we call vif_driver.plug() without get the VIF configurations. By doing this plug doesn't raise if the instance has not yet got a fixed-ip. Fixes bug 1076309. Change-Id: I0fafb3d98e3139bce0ef2cee04cab428a0621696
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/fake_network.py5
-rw-r--r--nova/tests/test_libvirt_vif.py2
2 files changed, 5 insertions, 2 deletions
diff --git a/nova/tests/fake_network.py b/nova/tests/fake_network.py
index 1b96f95dd..4a04986ec 100644
--- a/nova/tests/fake_network.py
+++ b/nova/tests/fake_network.py
@@ -54,7 +54,7 @@ class FakeVIFDriver(object):
def setattr(self, key, val):
self.__setattr__(key, val)
- def plug(self, instance, vif):
+ def get_config(self, instance, network, mapping):
conf = libvirt_config.LibvirtConfigGuestInterface()
for attr, val in conf.__dict__.iteritems():
@@ -63,6 +63,9 @@ class FakeVIFDriver(object):
return conf
+ def plug(self, instance, vif):
+ pass
+
class FakeModel(dict):
"""Represent a model from the db"""
diff --git a/nova/tests/test_libvirt_vif.py b/nova/tests/test_libvirt_vif.py
index bd51bf01a..5cd2ea83c 100644
--- a/nova/tests/test_libvirt_vif.py
+++ b/nova/tests/test_libvirt_vif.py
@@ -74,7 +74,7 @@ class LibvirtVifTestCase(test.TestCase):
conf.memory = 100 * 1024
conf.vcpus = 4
- nic = driver.plug(self.instance, (self.net, self.mapping))
+ nic = driver.get_config(self.instance, self.net, self.mapping)
conf.add_device(nic)
return conf.to_xml()