Skip to content

Commit

Permalink
actions: implement restart action
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarolopez committed Apr 29, 2015
1 parent 969937e commit 95074b7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ooi/api/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ def run_action(self, req, id, body):
elif action == "start":
scheme = {"category": compute.start}
req_body = {"os-start": None}
elif action == "restart":
scheme = {"category": compute.restart}
req_body = {"reboot": {"type": "SOFT"}}
else:
raise exception.NotImplemented

Expand Down
2 changes: 1 addition & 1 deletion ooi/tests/fakes.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def _do_post(self, req):
elif req.path_info.endswith("action"):
body = req.json_body.copy()
action = body.popitem()
if action[0] in ["os-start", "os-stop"]:
if action[0] in ["os-start", "os-stop", "reboot"]:
return self._get_from_routes(req)
raise Exception

Expand Down
2 changes: 1 addition & 1 deletion ooi/tests/middleware/test_compute_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def test_action_vm(self):
tenant = fakes.tenants["foo"]
app = self.get_app()

for action in ("stop", "start"):
for action in ("stop", "start", "restart"):
headers = {
'Category': (
'%s;'
Expand Down

0 comments on commit 95074b7

Please sign in to comment.