Просмотр исходного кода

Expose `auto_deploy` execution option to transfer executions API

Exposes the auto deployment feature as `auto_deploy` option in the transfer
execution body.
Daniel Vincze 1 год назад
Родитель
Сommit
66b1d7ad37

+ 2 - 1
coriolis/api/v1/transfer_tasks_executions.py

@@ -53,10 +53,11 @@ class TransferTasksExecutionController(api_wsgi.Controller):
 
         execution_body = body.get("execution", {})
         shutdown_instances = execution_body.get("shutdown_instances", False)
+        auto_deploy = execution_body.get("auto_deploy", False)
 
         return transfer_tasks_execution_view.single(
             self._transfer_tasks_execution_api.create(
-                context, transfer_id, shutdown_instances))
+                context, transfer_id, shutdown_instances, auto_deploy))
 
     def delete(self, req, transfer_id, id):
         context = req.environ["coriolis.context"]

+ 2 - 2
coriolis/conductor/rpc/client.py

@@ -129,10 +129,10 @@ class ConductorClient(rpc.BaseRPCClient):
             provider_type=provider_type)
 
     def execute_transfer_tasks(self, ctxt, transfer_id,
-                               shutdown_instances=False):
+                               shutdown_instances=False, auto_deploy=False):
         return self._call(
             ctxt, 'execute_transfer_tasks', transfer_id=transfer_id,
-            shutdown_instances=shutdown_instances)
+            shutdown_instances=shutdown_instances, auto_deploy=auto_deploy)
 
     def get_transfer_tasks_executions(self, ctxt, transfer_id,
                                       include_tasks=False):

+ 5 - 3
coriolis/transfer_cron/rpc/server.py

@@ -17,10 +17,12 @@ LOG = logging.getLogger(__name__)
 VERSION = "1.0"
 
 
-def _trigger_transfer(ctxt, conductor_client, transfer_id, shutdown_instance):
+def _trigger_transfer(ctxt, conductor_client, transfer_id, shutdown_instance,
+                      auto_deploy):
     try:
         execution = conductor_client.execute_transfer_tasks(
-            ctxt, transfer_id, shutdown_instance)
+            ctxt, transfer_id, shutdown_instance=shutdown_instance,
+            auto_deploy=auto_deploy)
         result_msg = 'Execution %s for Transfer %s' % (
             execution.get('id'), execution.get('action_id'))
         return result_msg
@@ -63,7 +65,7 @@ class TransferCronServerEndpoint(object):
             sched["enabled"], sched["expiration_date"],
             None, None, _trigger_transfer, trust_ctxt,
             self._rpc_client, schedule["transfer_id"],
-            schedule["shutdown_instance"])
+            schedule["shutdown_instance"], schedule["auto_deploy"])
         self._cron.register(job)
 
     def _init_cron(self):

+ 2 - 2
coriolis/transfer_tasks_executions/api.py

@@ -8,9 +8,9 @@ class API(object):
     def __init__(self):
         self._rpc_client = rpc_client.ConductorClient()
 
-    def create(self, ctxt, transfer_id, shutdown_instances):
+    def create(self, ctxt, transfer_id, shutdown_instances, auto_deploy):
         return self._rpc_client.execute_transfer_tasks(
-            ctxt, transfer_id, shutdown_instances)
+            ctxt, transfer_id, shutdown_instances, auto_deploy)
 
     def delete(self, ctxt, transfer_id, execution_id):
         self._rpc_client.delete_transfer_tasks_execution(