summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorMasanori Itoh <itoumsn@nttdata.co.jp>2011-04-01 23:54:55 +0900
committerMasanori Itoh <itoumsn@nttdata.co.jp>2011-04-01 23:54:55 +0900
commit98f9e841f2a27e8e513dd833c164863b2aa993e3 (patch)
treeded8e424d11ace380e03bb53346a6dd343afaf88 /nova/api
parent4626744b12b299c7259973b07ff824bba8a54a49 (diff)
parentb09e6b7d7a6fb2966d6d215588ed45bd6003f345 (diff)
Rebased to trunk 930.
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/servers.py25
1 files changed, 21 insertions, 4 deletions
diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py
index f7696d918..4e2ebb2bd 100644
--- a/nova/api/openstack/servers.py
+++ b/nova/api/openstack/servers.py
@@ -288,11 +288,12 @@ class Controller(wsgi.Controller):
resize a server"""
actions = {
- 'reboot': self._action_reboot,
- 'resize': self._action_resize,
+ 'changePassword': self._action_change_password,
+ 'reboot': self._action_reboot,
+ 'resize': self._action_resize,
'confirmResize': self._action_confirm_resize,
- 'revertResize': self._action_revert_resize,
- 'rebuild': self._action_rebuild,
+ 'revertResize': self._action_revert_resize,
+ 'rebuild': self._action_rebuild,
}
input_dict = self._deserialize(req.body, req.get_content_type())
@@ -301,6 +302,9 @@ class Controller(wsgi.Controller):
return actions[key](input_dict, req, id)
return faults.Fault(exc.HTTPNotImplemented())
+ def _action_change_password(self, input_dict, req, id):
+ return exc.HTTPNotImplemented()
+
def _action_confirm_resize(self, input_dict, req, id):
try:
self.compute_api.confirm_resize(req.environ['nova.context'], id)
@@ -629,6 +633,19 @@ class ControllerV11(Controller):
def _get_addresses_view_builder(self, req):
return nova.api.openstack.views.addresses.ViewBuilderV11(req)
+ def _action_change_password(self, input_dict, req, id):
+ context = req.environ['nova.context']
+ if (not 'changePassword' in input_dict
+ or not 'adminPass' in input_dict['changePassword']):
+ msg = _("No adminPass was specified")
+ return exc.HTTPBadRequest(msg)
+ password = input_dict['changePassword']['adminPass']
+ if not isinstance(password, basestring) or password == '':
+ msg = _("Invalid adminPass")
+ return exc.HTTPBadRequest(msg)
+ self.compute_api.set_admin_password(context, id, password)
+ return exc.HTTPAccepted()
+
def _limit_items(self, items, req):
return common.limited_by_marker(items, req)