예제 #1
0
 def index(self, req, tenant_id):
     """
     Return all backups information for a tenant ID.
     """
     LOG.debug("Listing Backups for tenant '%s'" % tenant_id)
     context = req.environ[wsgi.CONTEXT_KEY]
     ## add customise conditions when list instance
     search_ops = {}
     search_ops.update(req.GET)
     search_ops = self._validate_search_ops(search_ops)
     op_chain = search_ops.get('chain', None)
     if op_chain:
         backups = KSC_Backup.get_chain_whole(context, op_chain)
     else:
         backups = Backup.list(context, conditions=search_ops)
     LOG.debug("index.backups: '%s'", backups)
     bks = []
     for backup in backups:
         try:
             #service = inst_models.ServiceImage.find_by(id=backup.service_image_id)
             #backup.db_type = service['service_name']
             ds,ds_version = ds_patch_models.find_datastore_by_image_id(backup['service_image_id'])
             backup.db_type = ds.name
         except Exception as ex:
             backup['db_type'] = ""
             LOG.warn("Failed get db type information of backup %s, %s"%(backup['id'], ex))
         bks.append(backup)
     backups = bks
     return wsgi.Result(views.BackupViews(backups).data(), 200)
예제 #2
0
파일: service.py 프로젝트: qingyufei/trove
    def index(self, req, tenant_id):
        """
        Return all backups information for a tenant ID.
        """
        LOG.debug("Listing backups for tenant %s", tenant_id)
        datastore = req.GET.get('datastore')
        instance_id = req.GET.get('instance_id')
        project_id = req.GET.get('project_id')
        all_projects = strutils.bool_from_string(req.GET.get('all_projects'))
        context = req.environ[wsgi.CONTEXT_KEY]

        if project_id or all_projects:
            policy.authorize_on_tenant(context, 'backup:index:all_projects')
        else:
            policy.authorize_on_tenant(context, 'backup:index')

        backups, marker = Backup.list(context,
                                      datastore=datastore,
                                      instance_id=instance_id,
                                      project_id=project_id,
                                      all_projects=all_projects)
        view = views.BackupViews(backups)
        paged = pagination.SimplePaginatedDataView(req.url, 'backups', view,
                                                   marker)
        return wsgi.Result(paged.data(), 200)
예제 #3
0
파일: service.py 프로젝트: dfecker/trove
 def index(self, req, tenant_id):
     """
     Return all backups information for a tenant ID.
     """
     LOG.debug("Listing Backups for tenant '%s'" % tenant_id)
     context = req.environ[wsgi.CONTEXT_KEY]
     backups = Backup.list(context)
     return wsgi.Result(views.BackupViews(backups).data(), 200)
예제 #4
0
파일: service.py 프로젝트: luccacabra/trove
 def index(self, req, tenant_id):
     """
     Return all backups information for a tenant ID.
     """
     LOG.debug("Listing Backups for tenant '%s'" % tenant_id)
     context = req.environ[wsgi.CONTEXT_KEY]
     backups = Backup.list(context)
     return wsgi.Result(views.BackupViews(backups).data(), 200)
예제 #5
0
파일: service.py 프로젝트: tattabbum/trove
 def index(self, req, tenant_id):
     """
     Return all backups information for a tenant ID.
     """
     LOG.debug("Listing Backups for tenant '%s'" % tenant_id)
     context = req.environ[wsgi.CONTEXT_KEY]
     backups, marker = Backup.list(context)
     view = views.BackupViews(backups)
     paged = pagination.SimplePaginatedDataView(req.url, 'backups', view,
                                                marker)
     return wsgi.Result(paged.data(), 200)
예제 #6
0
 def index(self, req, tenant_id):
     """
     Return all backups information for a tenant ID.
     """
     LOG.debug("Listing backups for tenant %s", tenant_id)
     datastore = req.GET.get('datastore')
     context = req.environ[wsgi.CONTEXT_KEY]
     policy.authorize_on_tenant(context, 'backup:index')
     backups, marker = Backup.list(context, datastore)
     view = views.BackupViews(backups)
     paged = pagination.SimplePaginatedDataView(req.url, 'backups', view,
                                                marker)
     return wsgi.Result(paged.data(), 200)
예제 #7
0
 def index(self, req, tenant_id):
     """
     Return all backups information for a tenant ID.
     """
     LOG.debug("Listing backups for tenant %s" % tenant_id)
     datastore = req.GET.get('datastore')
     context = req.environ[wsgi.CONTEXT_KEY]
     policy.authorize_on_tenant(context, 'backup:index')
     backups, marker = Backup.list(context, datastore)
     view = views.BackupViews(backups)
     paged = pagination.SimplePaginatedDataView(req.url, 'backups', view,
                                                marker)
     return wsgi.Result(paged.data(), 200)
예제 #8
0
 def index(self, req, tenant_id):
     """
     Return all backups information for a tenant ID.
     """
     LOG.debug("Listing backups for tenant %s" % tenant_id)
     datastore = req.GET.get('datastore')
     context = req.environ[wsgi.CONTEXT_KEY]
     backups, marker = Backup.list(context, datastore)
     for b in backups:
         instance = get_db_info(context, b.instance_id, None, True)
         b.instance_name = instance.name
     view = views.BackupViews(backups)
     paged = pagination.SimplePaginatedDataView(req.url, 'backups', view,
                                                marker)
     return wsgi.Result(paged.data(), 200)