summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorDan Smith <danms@us.ibm.com>2012-09-13 12:06:09 -0700
committerDan Smith <danms@us.ibm.com>2012-09-13 13:53:48 -0700
commit423dbafd08ac3bb970bcb842fa6e7812d42ceb4e (patch)
tree69cd3ee95a3ca0ea7006e27478ac42e13e3cbab7 /nova
parent9d791c1225d4923a8e25060490b931c669e4424d (diff)
downloadnova-423dbafd08ac3bb970bcb842fa6e7812d42ceb4e.tar.gz
nova-423dbafd08ac3bb970bcb842fa6e7812d42ceb4e.tar.xz
nova-423dbafd08ac3bb970bcb842fa6e7812d42ceb4e.zip
Make compute/manager.py use self.host instead of FLAGS.host
This prevents the instances returned from getting a different instance['host'] than was supplied to the manager. This shows up during integrated testing of 'resize'. Change-Id: Ifa4316bf7099dc2c60c4e87cfaafa93a4bc2e5b1
Diffstat (limited to 'nova')
-rw-r--r--nova/compute/manager.py9
-rw-r--r--nova/tests/compute/test_compute.py2
2 files changed, 6 insertions, 5 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 6251027d7..2d5baafcf 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -233,7 +233,8 @@ class ComputeManager(manager.SchedulerDependentManager):
self.network_api = network.API()
self.volume_api = volume.API()
- self.network_manager = importutils.import_object(FLAGS.network_manager)
+ self.network_manager = importutils.import_object(
+ FLAGS.network_manager, host=kwargs.get('host', None))
self._last_host_check = 0
self._last_bw_usage_poll = 0
self._last_info_cache_heal = 0
@@ -1492,7 +1493,7 @@ class ComputeManager(manager.SchedulerDependentManager):
self._notify_about_instance_usage(
context, instance, "resize.prep.start")
- same_host = instance['host'] == FLAGS.host
+ same_host = instance['host'] == self.host
if same_host and not FLAGS.allow_resize_to_same_host:
self._set_instance_error_state(context, instance['uuid'])
msg = _('destination same as source!')
@@ -1507,7 +1508,7 @@ class ComputeManager(manager.SchedulerDependentManager):
migration_ref = self.db.migration_create(context,
{'instance_uuid': instance['uuid'],
'source_compute': instance['host'],
- 'dest_compute': FLAGS.host,
+ 'dest_compute': self.host,
'dest_host': self.driver.get_host_ip_addr(),
'old_instance_type_id': old_instance_type['id'],
'new_instance_type_id': instance_type['id'],
@@ -2397,7 +2398,7 @@ class ComputeManager(manager.SchedulerDependentManager):
def _poll_unconfirmed_resizes(self, context):
if FLAGS.resize_confirm_window > 0:
migrations = self.db.migration_get_unconfirmed_by_dest_compute(
- context, FLAGS.resize_confirm_window, FLAGS.host)
+ context, FLAGS.resize_confirm_window, self.host)
migrations_info = dict(migration_count=len(migrations),
confirm_window=FLAGS.resize_confirm_window)
diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py
index ca49a560a..4766ed034 100644
--- a/nova/tests/compute/test_compute.py
+++ b/nova/tests/compute/test_compute.py
@@ -1595,7 +1595,7 @@ class ComputeTestCase(BaseTestCase):
self.compute.run_instance(self.context, instance=instance)
new_instance = db.instance_update(self.context, instance['uuid'],
- {'host': 'foo'})
+ {'host': self.compute.host})
new_instance = jsonutils.to_primitive(new_instance)
instance_type = instance_types.get_default_instance_type()