Merge "Define "supported_instances" for fake compute"
This commit is contained in:
commit
11fe6780e7
@ -143,7 +143,7 @@ basis by running::
|
||||
$ tools/with_venv.sh <your command>
|
||||
|
||||
Using a remote debugger
|
||||
----------------------
|
||||
-----------------------
|
||||
|
||||
Some modern IDE such as pycharm (commercial) or Eclipse (open source) support remote debugging. In order to run nova with remote debugging, start the nova process
|
||||
with the following parameters
|
||||
@ -156,6 +156,26 @@ For Eclipse - http://pydev.org/manual_adv_remote_debugger.html
|
||||
|
||||
More detailed instructions are located here - http://novaremotedebug.blogspot.com
|
||||
|
||||
Using fake computes for tests
|
||||
-----------------------------
|
||||
|
||||
The number of instances supported by fake computes is not limited by physical
|
||||
constraints. It allows to perform stress tests on a deployment with few
|
||||
resources (typically a laptop). But you must avoid using scheduler filters
|
||||
limiting the number of instances per compute (like RamFilter, DiskFilter,
|
||||
AggregateCoreFilter), otherwise they will limit the number of instances per
|
||||
compute.
|
||||
|
||||
|
||||
Fake computes can also be used in multi hypervisor-type deployments in order to
|
||||
take advantage of fake and "real" computes during tests:
|
||||
|
||||
* create many fake instances for stress tests
|
||||
* create some "real" instances for functional tests
|
||||
|
||||
Fake computes can be used for testing Nova itself but also applications on top
|
||||
of it.
|
||||
|
||||
Contributing Your Work
|
||||
----------------------
|
||||
|
||||
|
@ -26,6 +26,7 @@ import six
|
||||
from nova.compute import manager
|
||||
from nova import exception
|
||||
from nova.openstack.common import importutils
|
||||
from nova.openstack.common import jsonutils
|
||||
from nova.openstack.common import log as logging
|
||||
from nova import test
|
||||
from nova.tests.image import fake as fake_image
|
||||
@ -567,7 +568,8 @@ class _VirtDriverTestCase(_FakeDriverBackendTestCase):
|
||||
def _check_available_resource_fields(self, host_status):
|
||||
keys = ['vcpus', 'memory_mb', 'local_gb', 'vcpus_used',
|
||||
'memory_mb_used', 'hypervisor_type', 'hypervisor_version',
|
||||
'hypervisor_hostname', 'cpu_info', 'disk_available_least']
|
||||
'hypervisor_hostname', 'cpu_info', 'disk_available_least',
|
||||
'supported_instances']
|
||||
for key in keys:
|
||||
self.assertIn(key, host_status)
|
||||
|
||||
@ -707,6 +709,19 @@ class FakeConnectionTestCase(_VirtDriverTestCase, test.TestCase):
|
||||
fake.set_nodes(['myhostname'])
|
||||
super(FakeConnectionTestCase, self).setUp()
|
||||
|
||||
def _check_available_resource_fields(self, host_status):
|
||||
super(FakeConnectionTestCase, self)._check_available_resource_fields(
|
||||
host_status)
|
||||
|
||||
hypervisor_type = host_status['hypervisor_type']
|
||||
supported_instances = host_status['supported_instances']
|
||||
try:
|
||||
# supported_instances could be JSON wrapped
|
||||
supported_instances = jsonutils.loads(supported_instances)
|
||||
except TypeError:
|
||||
pass
|
||||
self.assertTrue(any(hypervisor_type in x for x in supported_instances))
|
||||
|
||||
|
||||
class LibvirtConnTestCase(_VirtDriverTestCase, test.TestCase):
|
||||
def setUp(self):
|
||||
|
@ -33,6 +33,7 @@ from nova.compute import task_states
|
||||
from nova import db
|
||||
from nova import exception
|
||||
from nova.openstack.common.gettextutils import _
|
||||
from nova.openstack.common import jsonutils
|
||||
from nova.openstack.common import log as logging
|
||||
from nova import utils
|
||||
from nova.virt import driver
|
||||
@ -103,6 +104,7 @@ class FakeDriver(driver.ComputeDriver):
|
||||
'hypervisor_hostname': CONF.host,
|
||||
'cpu_info': {},
|
||||
'disk_available_least': 500000000000,
|
||||
'supported_instances': [(None, 'fake', None)],
|
||||
}
|
||||
self._mounts = {}
|
||||
self._interfaces = {}
|
||||
@ -360,7 +362,9 @@ class FakeDriver(driver.ComputeDriver):
|
||||
'hypervisor_version': '1.0',
|
||||
'hypervisor_hostname': nodename,
|
||||
'disk_available_least': 0,
|
||||
'cpu_info': '?'}
|
||||
'cpu_info': '?',
|
||||
'supported_instances': jsonutils.dumps([(None, 'fake', None)])
|
||||
}
|
||||
return dic
|
||||
|
||||
def ensure_filtering_rules_for_instance(self, instance_ref, network_info):
|
||||
|
Loading…
x
Reference in New Issue
Block a user