Add backup create client support for freezer
Currently, freezer client doesnt support backup create command, it is not so convenient. This patch add this command for debug. Change-Id: I0313f431f066a59b6d57130b81e943bce300511b
This commit is contained in:
@ -59,6 +59,7 @@ class FreezerCommandManager(commandmanager.CommandManager):
|
||||
'backup-list': backups.BackupList,
|
||||
'backup-show': backups.BackupShow,
|
||||
'backup-delete': backups.BackupDelete,
|
||||
'backup-create': backups.BackupCreate,
|
||||
'session-list': sessions.SessionList,
|
||||
'session-show': sessions.SessionShow,
|
||||
'session-create': sessions.SessionCreate,
|
||||
|
@ -117,3 +117,19 @@ class BackupDelete(command.Command):
|
||||
def take_action(self, parsed_args):
|
||||
self.app.client.backups.delete(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))
|
||||
|
Reference in New Issue
Block a user