summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/api.py18
-rw-r--r--nova/compute/manager.py19
2 files changed, 32 insertions, 5 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py
index 5b56d7865..e2692a42f 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -179,6 +179,9 @@ class API(base.Base):
os_type = None
if 'properties' in image and 'os_type' in image['properties']:
os_type = image['properties']['os_type']
+ architecture = None
+ if 'properties' in image and 'arch' in image['properties']:
+ architecture = image['properties']['arch']
vm_mode = None
if 'properties' in image and 'vm_mode' in image['properties']:
vm_mode = image['properties']['vm_mode']
@@ -247,6 +250,7 @@ class API(base.Base):
'metadata': metadata,
'availability_zone': availability_zone,
'os_type': os_type,
+ 'architecture': architecture,
'vm_mode': vm_mode,
'root_device_name': root_device_name}
@@ -346,8 +350,6 @@ class API(base.Base):
return instance
-
-
def _ask_scheduler_to_create_instance(self, context, base_options,
instance_type, zone_blob,
availability_zone, injected_files,
@@ -629,8 +631,15 @@ class API(base.Base):
def get(self, context, instance_id):
"""Get a single instance with the given instance_id."""
- rv = self.db.instance_get(context, instance_id)
- return dict(rv.iteritems())
+ # NOTE(sirp): id used to be exclusively integer IDs; now we're
+ # accepting both UUIDs and integer IDs. The handling of this
+ # is done in db/sqlalchemy/api/instance_get
+ if utils.is_uuid_like(instance_id):
+ uuid = instance_id
+ instance = self.db.instance_get_by_uuid(context, uuid)
+ else:
+ instance = self.db.instance_get(context, instance_id)
+ return dict(instance.iteritems())
@scheduler_api.reroute_compute("get")
def routing_get(self, context, instance_id):
@@ -646,6 +655,7 @@ class API(base.Base):
"""Get all instances with this reservation_id, across
all available Zones (if any).
"""
+ context = context.elevated()
instances = self.db.instance_get_all_by_reservation(
context, reservation_id)
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 146cdbb9f..34baa6d77 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -564,6 +564,24 @@ class ComputeManager(manager.SchedulerDependentManager):
@exception.wrap_exception
@checks_instance_lock
+ def agent_update(self, context, instance_id, url, md5hash):
+ """Update agent running on an instance on this host."""
+ context = context.elevated()
+ instance_ref = self.db.instance_get(context, instance_id)
+ instance_id = instance_ref['id']
+ instance_state = instance_ref['state']
+ expected_state = power_state.RUNNING
+ if instance_state != expected_state:
+ LOG.warn(_('trying to update agent on a non-running '
+ 'instance: %(instance_id)s (state: %(instance_state)s '
+ 'expected: %(expected_state)s)') % locals())
+ nm = instance_ref['name']
+ msg = _('instance %(nm)s: updating agent to %(url)s') % locals()
+ LOG.audit(msg)
+ self.driver.agent_update(instance_ref, url, md5hash)
+
+ @exception.wrap_exception
+ @checks_instance_lock
def rescue_instance(self, context, instance_id):
"""Rescue an instance on this host."""
context = context.elevated()
@@ -785,7 +803,6 @@ class ComputeManager(manager.SchedulerDependentManager):
def get_diagnostics(self, context, instance_id):
"""Retrieve diagnostics for an instance on this host."""
instance_ref = self.db.instance_get(context, instance_id)
-
if instance_ref["state"] == power_state.RUNNING:
LOG.audit(_("instance %s: retrieving diagnostics"), instance_id,
context=context)