summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-11-28 15:27:57 +0000
committerGerrit Code Review <review@openstack.org>2012-11-28 15:27:57 +0000
commite2c0174a76b7cdc9471a35a8a5d26cc6479b13e2 (patch)
tree6ad9f308831c1a7b172e0a0d8665cddf3b024dd1 /nova/tests
parentb424512f9f5a7b74103b68c21a48f2ad6b9aa79e (diff)
parent8a3c7d30914c7cd1f85583316980ece3c33ed3d1 (diff)
Merge "Make resize and multi-node work properly together"
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/compute/test_resource_tracker.py11
-rw-r--r--nova/tests/compute/test_rpcapi.py3
-rw-r--r--nova/tests/scheduler/test_filter_scheduler.py2
-rw-r--r--nova/tests/test_db_api.py32
4 files changed, 31 insertions, 17 deletions
diff --git a/nova/tests/compute/test_resource_tracker.py b/nova/tests/compute/test_resource_tracker.py
index 85d6c3dd6..ac18e9505 100644
--- a/nova/tests/compute/test_resource_tracker.py
+++ b/nova/tests/compute/test_resource_tracker.py
@@ -321,8 +321,8 @@ class BaseTrackerTestCase(BaseTestCase):
self._fake_compute_node_update)
self.stubs.Set(db, 'migration_update',
self._fake_migration_update)
- self.stubs.Set(db, 'migration_get_in_progress_by_host',
- self._fake_migration_get_in_progress_by_host)
+ self.stubs.Set(db, 'migration_get_in_progress_by_host_and_node',
+ self._fake_migration_get_in_progress_by_host_and_node)
self.tracker.update_available_resource(self.context)
self.limits = self._limits()
@@ -352,7 +352,8 @@ class BaseTrackerTestCase(BaseTestCase):
self.compute.update(values)
return self.compute
- def _fake_migration_get_in_progress_by_host(self, ctxt, host):
+ def _fake_migration_get_in_progress_by_host_and_node(self, ctxt, host,
+ node):
status = ['confirmed', 'reverted']
migrations = []
@@ -615,7 +616,9 @@ class ResizeClaimTestCase(BaseTrackerTestCase):
migration = {
'id': 1,
'source_compute': 'host1',
+ 'source_node': 'fakenode',
'dest_compute': 'host2',
+ 'dest_node': 'fakenode',
'dest_host': '127.0.0.1',
'old_instance_type_id': 1,
'new_instance_type_id': 2,
@@ -722,7 +725,7 @@ class ResizeClaimTestCase(BaseTrackerTestCase):
def test_revert_reserve_source(self):
# if a revert has started at the API and audit runs on
# the source compute before the instance flips back to source,
- # resources should still be help at the source based on the
+ # resources should still be held at the source based on the
# migration:
dest = "desthost"
dest_tracker = self._tracker(host=dest)
diff --git a/nova/tests/compute/test_rpcapi.py b/nova/tests/compute/test_rpcapi.py
index d0796a27d..54d8d47c7 100644
--- a/nova/tests/compute/test_rpcapi.py
+++ b/nova/tests/compute/test_rpcapi.py
@@ -228,7 +228,8 @@ class ComputeRpcAPITestCase(test.TestCase):
reservations=list('fake_res'),
request_spec='fake_spec',
filter_properties={'fakeprop': 'fakeval'},
- version='2.10')
+ node='node',
+ version='2.20')
def test_reboot_instance(self):
self.maxDiff = None
diff --git a/nova/tests/scheduler/test_filter_scheduler.py b/nova/tests/scheduler/test_filter_scheduler.py
index e9412ba60..d44c79b72 100644
--- a/nova/tests/scheduler/test_filter_scheduler.py
+++ b/nova/tests/scheduler/test_filter_scheduler.py
@@ -329,7 +329,7 @@ class FilterSchedulerTestCase(test_scheduler.SchedulerTestCase):
[instance['uuid']]).AndReturn(weighed_hosts)
sched.compute_rpcapi.prep_resize(self.context, image, instance,
instance_type, 'host', reservations, request_spec=request_spec,
- filter_properties=filter_properties)
+ filter_properties=filter_properties, node='node')
self.mox.ReplayAll()
sched.schedule_prep_resize(self.context, image, request_spec,
diff --git a/nova/tests/test_db_api.py b/nova/tests/test_db_api.py
index 21e37d609..7f28c9397 100644
--- a/nova/tests/test_db_api.py
+++ b/nova/tests/test_db_api.py
@@ -1164,19 +1164,20 @@ class MigrationTestCase(test.TestCase):
self._create()
self._create(status='reverted')
self._create(status='confirmed')
- self._create(source_compute='host2', dest_compute='host1')
+ self._create(source_compute='host2', source_node='b',
+ dest_compute='host1', dest_node='a')
self._create(source_compute='host2', dest_compute='host3')
self._create(source_compute='host3', dest_compute='host4')
def _create(self, status='migrating', source_compute='host1',
- dest_compute='host2'):
+ source_node='a', dest_compute='host2', dest_node='b'):
values = {'host': source_compute}
instance = db.instance_create(self.ctxt, values)
values = {'status': status, 'source_compute': source_compute,
- 'dest_compute': dest_compute,
- 'instance_uuid': instance['uuid']}
+ 'source_node': source_node, 'dest_compute': dest_compute,
+ 'dest_node': dest_node, 'instance_uuid': instance['uuid']}
db.migration_create(self.ctxt, values)
def _assert_in_progress(self, migrations):
@@ -1184,20 +1185,29 @@ class MigrationTestCase(test.TestCase):
self.assertNotEqual('confirmed', migration.status)
self.assertNotEqual('reverted', migration.status)
- def test_in_progress_host1(self):
- migrations = db.migration_get_in_progress_by_host(self.ctxt, 'host1')
+ def test_in_progress_host1_nodea(self):
+ migrations = db.migration_get_in_progress_by_host_and_node(self.ctxt,
+ 'host1', 'a')
# 2 as source + 1 as dest
self.assertEqual(3, len(migrations))
self._assert_in_progress(migrations)
- def test_in_progress_host2(self):
- migrations = db.migration_get_in_progress_by_host(self.ctxt, 'host2')
- # 2 as dest, 2 as source
- self.assertEqual(4, len(migrations))
+ def test_in_progress_host1_nodeb(self):
+ migrations = db.migration_get_in_progress_by_host_and_node(self.ctxt,
+ 'host1', 'b')
+ # some migrations are to/from host1, but none with a node 'b'
+ self.assertEqual(0, len(migrations))
+
+ def test_in_progress_host2_nodeb(self):
+ migrations = db.migration_get_in_progress_by_host_and_node(self.ctxt,
+ 'host2', 'b')
+ # 2 as dest, 1 as source
+ self.assertEqual(3, len(migrations))
self._assert_in_progress(migrations)
def test_instance_join(self):
- migrations = db.migration_get_in_progress_by_host(self.ctxt, 'host2')
+ migrations = db.migration_get_in_progress_by_host_and_node(self.ctxt,
+ 'host2', 'b')
for migration in migrations:
instance = migration['instance']
self.assertEqual(migration['instance_uuid'], instance['uuid'])