summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorRyu Ishimoto <ryu@midokura.jp>2011-08-19 10:22:24 +0900
committerRyu Ishimoto <ryu@midokura.jp>2011-08-19 10:22:24 +0900
commit93bf9b46a8ca28063752bc9e6c14ed59e91c50a9 (patch)
treeaf112b10f3e1a352afea8eea25cdcd59d9ce87b9 /nova/compute
parent54883a4ca07fe6b2f966a604f84e1127477d9a55 (diff)
parent862dc7acaf86bcfaebfce423c8198ea18b5e07c4 (diff)
Merged trunk
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/api.py12
-rw-r--r--nova/compute/manager.py6
2 files changed, 12 insertions, 6 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py
index e909e9959..b3932c644 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -1068,15 +1068,21 @@ class API(base.Base):
"""Unpause the given instance."""
self._cast_compute_message('unpause_instance', context, instance_id)
+ def _call_compute_message_for_host(self, action, context, host, params):
+ """Call method deliberately designed to make host/service only calls"""
+ queue = self.db.queue_get_for(context, FLAGS.compute_topic, host)
+ kwargs = {'method': action, 'args': params}
+ return rpc.call(context, queue, kwargs)
+
def set_host_enabled(self, context, host, enabled):
"""Sets the specified host's ability to accept new instances."""
- return self._call_compute_message("set_host_enabled", context,
+ return self._call_compute_message_for_host("set_host_enabled", context,
host=host, params={"enabled": enabled})
def host_power_action(self, context, host, action):
"""Reboots, shuts down or powers up the host."""
- return self._call_compute_message("host_power_action", context,
- host=host, params={"action": action})
+ return self._call_compute_message_for_host("host_power_action",
+ context, host=host, params={"action": action})
@scheduler_api.reroute_compute("diagnostics")
def get_diagnostics(self, context, instance_id):
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 66458fb36..091b3b6b2 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -392,12 +392,12 @@ class ComputeManager(manager.SchedulerDependentManager):
updates = {}
updates['host'] = self.host
updates['launched_on'] = self.host
- # NOTE(vish): used by virt but not in database
- updates['injected_files'] = kwargs.get('injected_files', [])
- updates['admin_pass'] = kwargs.get('admin_password', None)
instance = self.db.instance_update(context,
instance_id,
updates)
+ instance['injected_files'] = kwargs.get('injected_files', [])
+ instance['admin_pass'] = kwargs.get('admin_password', None)
+
self.db.instance_set_state(context,
instance_id,
power_state.NOSTATE,