diff options
| author | Tushar Patil <tushar.vitthal.patil@gmail.com> | 2011-08-20 13:15:05 -0700 |
|---|---|---|
| committer | Tushar Patil <tushar.vitthal.patil@gmail.com> | 2011-08-20 13:15:05 -0700 |
| commit | 71ae1f16312371fee810221e81c2bcb0fcb5a4ef (patch) | |
| tree | a3831d99867136776f8a287fbc0dbb554cde4108 /nova/compute | |
| parent | c3ef50fd4b866ec6dc90ad114e36b16c857ca206 (diff) | |
| parent | 7924fb7899b02d3cb7420c916e035094d5c90194 (diff) | |
Merged from trunk
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/api.py | 15 | ||||
| -rw-r--r-- | nova/compute/manager.py | 6 |
2 files changed, 13 insertions, 8 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index e909e9959..efc9da79b 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -411,12 +411,11 @@ class API(base.Base): LOG.debug(_("Casting to scheduler for %(pid)s/%(uid)s's" " (all-at-once)") % locals()) - filter_class = 'nova.scheduler.host_filter.InstanceTypeFilter' request_spec = { 'image': image, 'instance_properties': base_options, 'instance_type': instance_type, - 'filter': filter_class, + 'filter': None, 'blob': zone_blob, 'num_instances': num_instances, } @@ -1068,15 +1067,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, |
