Exemple #1
0
 def action(self, req, body, tenant_id, id):
     LOG.debug("Committing Action Against Cluster for "
               "Tenant '%s'" % tenant_id)
     LOG.info(_("req : '%s'\n\n") % req)
     LOG.info(_("id : '%s'\n\n") % id)
     if not body:
         raise exception.BadRequest(_("Invalid request body."))
     context = req.environ[wsgi.CONTEXT_KEY]
     cluster = models.Cluster.load(context, id)
     manager = cluster.datastore_version.manager
     api_strategy = strategy.load_api_strategy(manager)
     _actions = api_strategy.cluster_controller_actions
     selected_action = None
     for key in body:
         if key in _actions:
             selected_action = _actions[key]
             break
     else:
         message = _(
             "No action '%(action)s' supplied "
             "by strategy for manager '%(manager)s'") % ({
                 'action': key,
                 'manager': manager
             })
         raise exception.TroveError(message)
     return selected_action(cluster, body)
Exemple #2
0
 def load(cls, context, cluster_id, clazz=None):
     try:
         db_info = DBCluster.find_by(context=context, id=cluster_id,
                                     deleted=False)
     except exception.ModelNotFoundError:
         raise exception.ClusterNotFound(cluster=cluster_id)
     if not clazz:
         ds_version = (datastore_models.DatastoreVersion.
                       load_by_uuid(db_info.datastore_version_id))
         manager = ds_version.manager
         clazz = strategy.load_api_strategy(manager).cluster_class
     return clazz(context, db_info)
Exemple #3
0
 def action(self, req, body, tenant_id, id):
     LOG.debug("Committing Action Against Cluster for "
               "Tenant '%s'" % tenant_id)
     LOG.info(_("req : '%s'\n\n") % req)
     LOG.info(_("id : '%s'\n\n") % id)
     if not body:
         raise exception.BadRequest(_("Invalid request body."))
     context = req.environ[wsgi.CONTEXT_KEY]
     cluster = models.Cluster.load(context, id)
     manager = cluster.datastore_version.manager
     api_strategy = strategy.load_api_strategy(manager)
     _actions = api_strategy.cluster_controller_actions
     selected_action = None
     for key in body:
         if key in _actions:
             selected_action = _actions[key]
             break
     else:
         message = _("No action '%(action)s' supplied "
                     "by strategy for manager '%(manager)s'") % (
                         {'action': key, 'manager': manager})
         raise exception.TroveError(message)
     return selected_action(cluster, body)
Exemple #4
0
def load_mgmt_view(cluster, req, load_servers=True):
    manager = cluster.datastore_version.manager
    return strategy.load_api_strategy(manager).mgmt_cluster_view_class(
        cluster, req, load_servers)
Exemple #5
0
def load_mgmt_view(cluster, req, load_servers=True):
    manager = cluster.datastore_version.manager
    return strategy.load_api_strategy(manager).mgmt_cluster_view_class(
        cluster, req, load_servers)
Exemple #6
0
 def create(cls, context, name, datastore, datastore_version, instances):
     api_strategy = strategy.load_api_strategy(datastore_version.manager)
     return api_strategy.cluster_class.create(context, name, datastore,
                                              datastore_version, instances)