summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorEd Leafe <ed@leafe.com>2011-01-07 10:23:48 -0600
committerEd Leafe <ed@leafe.com>2011-01-07 10:23:48 -0600
commiteaa5b5994891eee0280b750dff221a4b54932eb9 (patch)
tree806a0911d288421933003ca22c8ee81ee9a38662 /nova/compute
parentb024dcf6f0c1e5a2735e84d21d6edef5ff38d1cf (diff)
getting ready to push for merge prop
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/api.py18
-rw-r--r--nova/compute/manager.py3
2 files changed, 10 insertions, 11 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py
index 78ffcca7a..106c3f7f0 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -61,7 +61,7 @@ class API(base.Base):
def get_network_topic(self, context, instance_id):
try:
- instance = self.get_instance(context, instance_id)
+ instance = self.get(context, instance_id)
except exception.NotFound, e:
logging.warning("Instance %d was not found in get_network_topic",
instance_id)
@@ -220,7 +220,7 @@ class API(base.Base):
def delete(self, context, instance_id):
logging.debug('Going to try and terminate %s' % instance_id)
try:
- instance = self.get_instance(context, instance_id)
+ instance = self.get(context, instance_id)
except exception.NotFound, e:
logging.warning(_('Instance % was not found during terminate'),
instance_id)
@@ -246,7 +246,7 @@ class API(base.Base):
else:
self.db.instance_destroy(context, instance_id)
- def get_instance(self, context, instance_id):
+ def get(self, context, instance_id):
"""Get a single instance with the given ID."""
return self.db.instance_get_by_id(context, instance_id)
@@ -272,7 +272,7 @@ class API(base.Base):
def _cast_compute_message(self, method, context, instance_id):
"""Generic handler for RPC calls to compute."""
- instance = self.get_instance(context, instance_id)
+ instance = self.get(context, instance_id)
host = instance['host']
rpc.cast(context,
self.db.queue_get_for(context, FLAGS.compute_topic, host),
@@ -328,7 +328,7 @@ class API(base.Base):
lock the instance with instance_id
"""
- instance = self.get_instance(context, instance_id)
+ instance = self.get(context, instance_id)
host = instance['host']
rpc.cast(context,
self.db.queue_get_for(context, FLAGS.compute_topic, host),
@@ -340,7 +340,7 @@ class API(base.Base):
unlock the instance with instance_id
"""
- instance = self.get_instance(context, instance_id)
+ instance = self.get(context, instance_id)
host = instance['host']
rpc.cast(context,
self.db.queue_get_for(context, FLAGS.compute_topic, host),
@@ -352,7 +352,7 @@ class API(base.Base):
return the boolean state of (instance with instance_id)'s lock
"""
- instance = self.get_instance(context, instance_id)
+ instance = self.get(context, instance_id)
return instance['locked']
def attach_volume(self, context, instance_id, volume_id, device):
@@ -360,7 +360,7 @@ class API(base.Base):
raise exception.ApiError(_("Invalid device specified: %s. "
"Example device: /dev/vdb") % device)
self.volume_api.check_attach(context, volume_id)
- instance = self.get_instance(context, instance_id)
+ instance = self.get(context, instance_id)
host = instance['host']
rpc.cast(context,
self.db.queue_get_for(context, FLAGS.compute_topic, host),
@@ -383,6 +383,6 @@ class API(base.Base):
return instance
def associate_floating_ip(self, context, instance_id, address):
- instance = self.get_instance(context, instance_id)
+ instance = self.get(context, instance_id)
self.network_api.associate_floating_ip(context, address,
instance['fixed_ip'])
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 10219833b..5d677b023 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -289,8 +289,6 @@ class ComputeManager(manager.Manager):
"""Set the root/admin password for an instance on this server."""
context = context.elevated()
instance_ref = self.db.instance_get(context, instance_id)
- self._update_state(context, instance_id)
-
if instance_ref['state'] != power_state.RUNNING:
logging.warn('trying to reset the password on a non-running '
'instance: %s (state: %s expected: %s)',
@@ -303,6 +301,7 @@ class ComputeManager(manager.Manager):
if new_pass is None:
# Generate a random password
new_pass = self._generate_password(FLAGS.password_length)
+
self.driver.set_admin_password(instance_ref, new_pass)
self._update_state(context, instance_id)