diff options
| author | Joe Gordon <jogo@cloudscaling.com> | 2013-03-20 21:54:06 +0000 |
|---|---|---|
| committer | Joe Gordon <jogo@cloudscaling.com> | 2013-03-21 19:11:43 +0000 |
| commit | 03a2463be8034ee4764ac97e8020fc3d3a32f1fd (patch) | |
| tree | 76d7c0d66c6a94765fb5610c504183a47ecb6a63 | |
| parent | 5499640f639009f60fbf909786770654e1f1b5a0 (diff) | |
Make nova.virt.fake.FakeDriver useable in integration testing
With this change nova.virt.fake.FakeDriver can be used for scale testing
using devstack. By setting 'compute_driver = nova.virt.fake.FakeDriver'
in nova.conf and disabiling quota and other limits, we can load up nova
to think it is running 1000's of instances. This particular scenario is
analagous to how the baremetal driver will work (one machine managing
100's to 1000's of instances).
Make nova.virt.fake.FakeDriver use CONF.host for hostname.
Change-Id: I731ca2968176b4e39dd2fe7fc99f479cc568398b
| -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 = {} |
