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