Softreboot can be done when the instance not in active status

When the instance is not in active status, softreboot is not allowed.

Change-Id: I3fa13f0590b81de32e33708456b00828598009db
Close-Bug: #1671694
This commit is contained in:
zengrui 2017-03-10 00:09:51 -05:00
parent be94c29410
commit 3761256e37

View File

@ -171,6 +171,12 @@ class SoftRebootInstance(RebootInstance):
def action(self, request, obj_id):
api.nova.server_reboot(request, obj_id, soft_reboot=True)
def allowed(self, request, instance=None):
if instance is not None:
return instance.status in ACTIVE_STATES
else:
return True
class TogglePause(tables.BatchAction):
name = "pause"