コード例 #1
0
    def show(self, req, minion_pool_id, id):
        context = req.environ["coriolis.context"]
        context.can(
            pool_execution_policies.get_minion_pool_executions_policy_label(
                "show"))
        execution = self._pool_tasks_execution_api.get(context, minion_pool_id,
                                                       id)
        if not execution:
            raise exc.HTTPNotFound()

        return minion_pool_tasks_execution_view.single(req, execution)
コード例 #2
0
 def _allocate_pool_machines(self, req, id, body):
     context = req.environ['coriolis.context']
     context.can(
         minion_pool_policies.get_minion_pools_policy_label(
             "allocate_machines"))
     try:
         return minion_pool_tasks_execution_view.single(
             req, self.minion_pool_api.allocate_machines(context, id))
     except exception.NotFound as ex:
         raise exc.HTTPNotFound(explanation=ex.msg)
     except exception.InvalidParameterValue as ex:
         raise exc.HTTPNotFound(explanation=ex.msg)
コード例 #3
0
 def _tear_down_shared_resources(self, req, id, body):
     context = req.environ['coriolis.context']
     context.can(
         minion_pool_policies.get_minion_pools_policy_label(
             "tear_down_shared_resources"))
     force = (body["tear-down-shared-resources"] or {}).get("force", False)
     try:
         return minion_pool_tasks_execution_view.single(
             req,
             self.minion_pool_api.tear_down_shared_pool_resources(
                 context, id, force=force))
     except exception.NotFound as ex:
         raise exc.HTTPNotFound(explanation=ex.msg)
     except exception.InvalidParameterValue as ex:
         raise exc.HTTPNotFound(explanation=ex.msg)