-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
64 changed files
with
1,095 additions
and
1,364 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 10 additions & 10 deletions
20
coriolis/api/v1/replica_actions.py → coriolis/api/v1/transfer_actions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
# Copyright 2016 Cloudbase Solutions Srl | ||
# All Rights Reserved. | ||
|
||
from coriolis.api.v1.views import replica_tasks_execution_view | ||
from coriolis.api.v1.views import transfer_tasks_execution_view | ||
from coriolis.api import wsgi as api_wsgi | ||
from coriolis import exception | ||
from coriolis.policies import replicas as replica_policies | ||
from coriolis.replicas import api | ||
from coriolis.policies import transfers as transfer_policies | ||
from coriolis.transfers import api | ||
|
||
from webob import exc | ||
|
||
|
||
class ReplicaActionsController(api_wsgi.Controller): | ||
class TransferActionsController(api_wsgi.Controller): | ||
def __init__(self): | ||
self._replica_api = api.API() | ||
super(ReplicaActionsController, self).__init__() | ||
self._transfer_api = api.API() | ||
super(TransferActionsController, self).__init__() | ||
|
||
@api_wsgi.action('delete-disks') | ||
def _delete_disks(self, req, id, body): | ||
context = req.environ['coriolis.context'] | ||
context.can( | ||
replica_policies.get_replicas_policy_label("delete_disks")) | ||
transfer_policies.get_transfers_policy_label("delete_disks")) | ||
try: | ||
return replica_tasks_execution_view.single( | ||
self._replica_api.delete_disks(context, id)) | ||
return transfer_tasks_execution_view.single( | ||
self._transfer_api.delete_disks(context, id)) | ||
except exception.NotFound as ex: | ||
raise exc.HTTPNotFound(explanation=ex.msg) | ||
except exception.InvalidParameterValue as ex: | ||
raise exc.HTTPNotFound(explanation=ex.msg) | ||
|
||
|
||
def create_resource(): | ||
return api_wsgi.Resource(ReplicaActionsController()) | ||
return api_wsgi.Resource(TransferActionsController()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.