Exemplo n.º 1
0
    def tests_backup_get_all_by_filter(self):
        filters = {"status": self.created[1]["status"]}
        filtered_backups = db.backup_get_all(self.ctxt, filters=filters)
        self._assertEqualListsOfObjects([self.created[1]], filtered_backups)

        filters = {"display_name": self.created[1]["display_name"]}
        filtered_backups = db.backup_get_all(self.ctxt, filters=filters)
        self._assertEqualListsOfObjects([self.created[1]], filtered_backups)

        filters = {"volume_id": self.created[1]["volume_id"]}
        filtered_backups = db.backup_get_all(self.ctxt, filters=filters)
        self._assertEqualListsOfObjects([self.created[1]], filtered_backups)
Exemplo n.º 2
0
    def list(self):
        """List all backups (including ones in progress) and the host
        on which the backup operation is running.
        """
        ctxt = context.get_admin_context()
        backups = db.backup_get_all(ctxt)

        hdr = "%-32s\t%-32s\t%-32s\t%-24s\t%-24s\t%-12s\t%-12s\t%-12s\t%-12s"
        print(hdr % (_('ID'),
                     _('User ID'),
                     _('Project ID'),
                     _('Host'),
                     _('Name'),
                     _('Container'),
                     _('Status'),
                     _('Size'),
                     _('Object Count')))

        res = "%-32s\t%-32s\t%-32s\t%-24s\t%-24s\t%-12s\t%-12s\t%-12d\t%-12d"
        for backup in backups:
            object_count = 0
            if backup['object_count'] is not None:
                object_count = backup['object_count']
            print(res % (backup['id'],
                         backup['user_id'],
                         backup['project_id'],
                         backup['host'],
                         backup['display_name'],
                         backup['container'],
                         backup['status'],
                         backup['size'],
                         object_count))
Exemplo n.º 3
0
 def get_all(cls, context, filters=None, marker=None, limit=None,
             offset=None, sort_keys=None, sort_dirs=None):
     backups = db.backup_get_all(context, filters, marker, limit, offset,
                                 sort_keys, sort_dirs)
     expected_attrs = Backup._get_expected_attrs(context)
     return base.obj_make_list(context, cls(context), objects.Backup,
                               backups, expected_attrs=expected_attrs)
Exemplo n.º 4
0
    def list(self):
        """List all backups (including ones in progress) and the host
        on which the backup operation is running.
        """
        ctxt = context.get_admin_context()
        backups = db.backup_get_all(ctxt)

        hdr = "%-32s\t%-32s\t%-32s\t%-24s\t%-24s\t%-12s\t%-12s\t%-12s\t%-12s"
        print(
            hdr
            % (
                _("ID"),
                _("User ID"),
                _("Project ID"),
                _("Host"),
                _("Name"),
                _("Container"),
                _("Status"),
                _("Size"),
                _("Object Count"),
            )
        )

        res = "%-32s\t%-32s\t%-32s\t%-24s\t%-24s\t%-12s\t%-12s\t%-12d\t%-12d"
        for backup in backups:
            object_count = 0
            if backup["object_count"] is not None:
                object_count = backup["object_count"]
            print(
                res
                % (
                    backup["id"],
                    backup["user_id"],
                    backup["project_id"],
                    backup["host"],
                    backup["display_name"],
                    backup["container"],
                    backup["status"],
                    backup["size"],
                    object_count,
                )
            )
Exemplo n.º 5
0
    def list(self):
        """List all backups (including ones in progress) and the host
        on which the backup operation is running.
        """
        ctxt = context.get_admin_context()
        backups = db.backup_get_all(ctxt)

        hdr = "%-32s\t%-32s\t%-32s\t%-24s\t%-24s\t%-12s\t%-12s\t%-12s\t%-12s"
        print(hdr %
              (_('ID'), _('User ID'), _('Project ID'), _('Host'), _('Name'),
               _('Container'), _('Status'), _('Size'), _('Object Count')))

        res = "%-32s\t%-32s\t%-32s\t%-24s\t%-24s\t%-12s\t%-12s\t%-12d\t%-12d"
        for backup in backups:
            object_count = 0
            if backup['object_count'] is not None:
                object_count = backup['object_count']
            print(res %
                  (backup['id'], backup['user_id'], backup['project_id'],
                   backup['host'], backup['display_name'], backup['container'],
                   backup['status'], backup['size'], object_count))
Exemplo n.º 6
0
 def get_all(cls, context, filters=None):
     backups = db.backup_get_all(context, filters)
     return base.obj_make_list(context, cls(context), objects.Backup,
                               backups)
Exemplo n.º 7
0
 def test_backup_destroy(self):
     for backup in self.created:
         db.backup_destroy(self.ctxt, backup['id'])
     self.assertFalse(db.backup_get_all(self.ctxt))
Exemplo n.º 8
0
 def tests_backup_get_all(self):
     all_backups = db.backup_get_all(self.ctxt)
     self._assertEqualListsOfObjects(self.created, all_backups)
Exemplo n.º 9
0
 def test_backup_destroy(self):
     for backup in self.created:
         db.backup_destroy(self.ctxt, backup['id'])
     self.assertFalse(db.backup_get_all(self.ctxt))
Exemplo n.º 10
0
 def tests_backup_get_all(self):
     all_backups = db.backup_get_all(self.ctxt)
     self._assertEqualListsOfObjects(self.created, all_backups)