Review feedback.
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
# under the License.
|
||||
|
||||
import base64
|
||||
import eventlet
|
||||
import traceback
|
||||
|
||||
from webob import exc
|
||||
@@ -176,9 +175,8 @@ class Controller(common.OpenstackController):
|
||||
builder = self._get_view_builder(req)
|
||||
server = builder.build(inst, is_detail=True)
|
||||
server['server']['adminPass'] = password
|
||||
# We don't want this to block
|
||||
eventlet.spawn(self.compute_api.set_admin_password(
|
||||
context, server['server']['id'], password))
|
||||
self.compute_api.set_admin_password(context, server['server']['id'],
|
||||
password)
|
||||
return server
|
||||
|
||||
def _deserialize_create(self, request):
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"""Handles all requests relating to instances (guest vms)."""
|
||||
|
||||
import datetime
|
||||
import eventlet
|
||||
import re
|
||||
import time
|
||||
|
||||
@@ -495,6 +496,15 @@ class API(base.Base):
|
||||
raise exception.Error(_("Unable to find host for Instance %s")
|
||||
% instance_id)
|
||||
|
||||
def _set_admin_password(self, context, instance_id, password):
|
||||
"""Set the root/admin password for the given instance."""
|
||||
host = self._find_host(context, instance_id)
|
||||
|
||||
rpc.cast(context,
|
||||
self.db.queue_get_for(context, FLAGS.compute_topic, host),
|
||||
{"method": "set_admin_password",
|
||||
"args": {"instance_id": instance_id, "new_pass": password}})
|
||||
|
||||
def snapshot(self, context, instance_id, name):
|
||||
"""Snapshot the given instance.
|
||||
|
||||
@@ -648,12 +658,8 @@ class API(base.Base):
|
||||
|
||||
def set_admin_password(self, context, instance_id, password=None):
|
||||
"""Set the root/admin password for the given instance."""
|
||||
host = self._find_host(context, instance_id)
|
||||
|
||||
rpc.cast(context,
|
||||
self.db.queue_get_for(context, FLAGS.compute_topic, host),
|
||||
{"method": "set_admin_password",
|
||||
"args": {"instance_id": instance_id, "new_pass": password}})
|
||||
eventlet.spawn_n(self._set_admin_password(context, instance_id,
|
||||
password))
|
||||
|
||||
def inject_file(self, context, instance_id):
|
||||
"""Write a file to the given instance."""
|
||||
|
||||
Reference in New Issue
Block a user