Add backup create for api v1

At present, freezer client only support
backup-create for v2, the patch add v1 support

Change-Id: If8e8b28705bf1b5ee8c0f01e1ad2a0f368753b42
This commit is contained in:
gecong1973 2018-11-05 22:54:37 -08:00
parent 026ae218b6
commit e4b0f8c035

View File

@ -117,3 +117,19 @@ class BackupDelete(command.Command):
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.app.client.backups.delete(parsed_args.backup_uuid) self.app.client.backups.delete(parsed_args.backup_uuid)
logging.info('Backup {0} deleted'.format(parsed_args.backup_uuid)) logging.info('Backup {0} deleted'.format(parsed_args.backup_uuid))
class BackupCreate(command.Command):
"""Create an backup from a file"""
def get_parser(self, prog_name):
parser = super(BackupCreate, self).get_parser(prog_name)
parser.add_argument('--file',
dest='file',
required=True,
help='Path to json file with the backup')
return parser
def take_action(self, parsed_args):
backup = utils.doc_from_json_file(parsed_args.file)
backup_id = self.app.client.backups.create(backup)
logging.info('Backup {0} created'.format(backup_id))