summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorJohannes Erdfelt <johannes.erdfelt@rackspace.com>2011-06-21 16:43:10 +0000
committerTarmac <>2011-06-21 16:43:10 +0000
commit29e2d55e9d47dd4abffdb871ee88af9083d022d1 (patch)
tree1c25bb5b5437a979e79a16b9e9e2bd84f59fe2aa /nova/compute
parenta62e0f3e10cae4938ca2fec047268064cab3bff2 (diff)
parentf94041278e22acc557dc878bbf3f1b1f70351446 (diff)
This branch adds support to the xenapi driver for updating the guest agent on creation of a new instance. This ensures that the guest agent is running the latest code before nova starts configuring networking, setting root password or injecting files.
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/api.py4
-rw-r--r--nova/compute/manager.py18
2 files changed, 22 insertions, 0 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py
index e6cffb6b3..a7ea88d51 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -178,6 +178,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']
@@ -243,6 +246,7 @@ class API(base.Base):
'metadata': metadata,
'availability_zone': availability_zone,
'os_type': os_type,
+ 'architecture': architecture,
'vm_mode': vm_mode}
return (num_instances, base_options, security_groups)
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index a7ec021b8..4e006e677 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -562,6 +562,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()