diff options
author | Jenkins <jenkins@review.openstack.org> | 2013-03-21 23:53:28 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2013-03-21 23:53:28 +0000 |
commit | 127b32c00ca5e99439431d30d03775fd0e462f0a (patch) | |
tree | 76ee826eaa685b1041ad2420c5728314557b3fee | |
parent | 2865a76c25a8f8801dcfb79e1d69b050ff3e188e (diff) | |
parent | 03a2463be8034ee4764ac97e8020fc3d3a32f1fd (diff) | |
download | nova-127b32c00ca5e99439431d30d03775fd0e462f0a.tar.gz nova-127b32c00ca5e99439431d30d03775fd0e462f0a.tar.xz nova-127b32c00ca5e99439431d30d03775fd0e462f0a.zip |
Merge "Make nova.virt.fake.FakeDriver useable in integration testing"
-rw-r--r-- | nova/tests/conf_fixture.py | 2 | ||||
-rwxr-xr-x | nova/virt/fake.py | 14 |
2 files changed, 11 insertions, 5 deletions
diff --git a/nova/tests/conf_fixture.py b/nova/tests/conf_fixture.py index e2ea18f98..697f4ed4b 100644 --- a/nova/tests/conf_fixture.py +++ b/nova/tests/conf_fixture.py @@ -26,6 +26,7 @@ from nova.tests import utils CONF = cfg.CONF CONF.import_opt('use_ipv6', 'nova.netconf') +CONF.import_opt('host', 'nova.netconf') CONF.import_opt('scheduler_driver', 'nova.scheduler.manager') CONF.import_opt('fake_network', 'nova.network.manager') CONF.import_opt('network_size', 'nova.network.manager') @@ -48,6 +49,7 @@ class ConfFixture(fixtures.Fixture): self.conf.set_default('api_paste_config', paths.state_path_def('etc/nova/api-paste.ini')) + self.conf.set_default('host', 'fake-mini') self.conf.set_default('compute_driver', 'nova.virt.fake.FakeDriver') self.conf.set_default('fake_network', True) self.conf.set_default('fake_rabbit', True) diff --git a/nova/virt/fake.py b/nova/virt/fake.py index b2b102486..e55fbb640 100755 --- a/nova/virt/fake.py +++ b/nova/virt/fake.py @@ -25,6 +25,8 @@ semantics of real hypervisor connections. """ +from oslo.config import cfg + from nova.compute import power_state from nova.compute import task_states from nova import db @@ -33,11 +35,13 @@ from nova.openstack.common import log as logging from nova.virt import driver from nova.virt import virtapi +CONF = cfg.CONF +CONF.import_opt('host', 'nova.netconf') LOG = logging.getLogger(__name__) -_FAKE_NODES = ['fake-mini'] +_FAKE_NODES = [CONF.host] def set_nodes(nodes): @@ -60,7 +64,7 @@ def restore_nodes(): Usually called from tearDown(). """ global _FAKE_NODES - _FAKE_NODES = ['fake-mini'] + _FAKE_NODES = [CONF.host] class FakeInstance(object): @@ -86,7 +90,7 @@ class FakeDriver(driver.ComputeDriver): self.instances = {} self.host_status_base = { 'host_name-description': 'Fake Host', - 'host_hostname': 'fake-mini', + 'host_hostname': CONF.host, 'host_memory_total': 8000000000, 'host_memory_overhead': 10000000, 'host_memory_free': 7900000000, @@ -98,8 +102,8 @@ class FakeDriver(driver.ComputeDriver): 'disk_total': 600000000000, 'disk_used': 100000000000, 'host_uuid': 'cedb9b39-9388-41df-8891-c5c9a0c0fe5f', - 'host_name_label': 'fake-mini', - 'hypervisor_hostname': 'fake-mini', + 'host_name_label': 'fake-host', + 'hypervisor_hostname': CONF.host, } self._mounts = {} self._interfaces = {} |