Commit d90e9949 by Szabolcs Gelencser

Implement basic operations

parent 896412ac
...@@ -319,8 +319,8 @@ class DestroyOperation(InstanceOperation): ...@@ -319,8 +319,8 @@ class DestroyOperation(InstanceOperation):
resultant_state = 'DESTROYED' resultant_state = 'DESTROYED'
os_policy_actions = (("compute", "compute:delete"),) os_policy_actions = (("compute", "compute:delete"),)
def _operation(self, activity, system): def _operation(self, request):
pass openstack_api.nova.server_delete(request, self.instance.id)
@register_operation @register_operation
...@@ -392,8 +392,8 @@ class RebootOperation(InstanceOperation): ...@@ -392,8 +392,8 @@ class RebootOperation(InstanceOperation):
accept_states = ('ACTIVE',) accept_states = ('ACTIVE',)
os_policy_actions = (("compute", "compute:reboot"),) os_policy_actions = (("compute", "compute:reboot"),)
def _operation(self, activity): def _operation(self, request):
pass openstack_api.nova.server_reboot(request, self.instance.id)
@register_operation @register_operation
...@@ -619,18 +619,8 @@ class SleepOperation(InstanceOperation): ...@@ -619,18 +619,8 @@ class SleepOperation(InstanceOperation):
accept_states = ('ACTIVE',) accept_states = ('ACTIVE',)
os_policy_actions = (("compute", "compute:suspend"),) os_policy_actions = (("compute", "compute:suspend"),)
def is_preferred(self): def _operation(self, request):
return (not self.instance.is_base and openstack_api.nova.server_suspend(request, self.instance.id)
self.instance.status == self.instance.STATUS.RUNNING)
def on_abort(self, activity, error):
if isinstance(error, TimeLimitExceeded):
activity.resultant_state = None
else:
activity.resultant_state = 'ERROR'
def _operation(self, activity, system):
pass
@register_operation @register_operation
...@@ -653,8 +643,8 @@ class WakeUpOperation(InstanceOperation): ...@@ -653,8 +643,8 @@ class WakeUpOperation(InstanceOperation):
else: else:
activity.resultant_state = 'ERROR' activity.resultant_state = 'ERROR'
def _operation(self, activity): def _operation(self, request):
pass openstack_api.nova.server_resume(request, self.instance.id)
@register_operation @register_operation
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment