Merge vssadmin argument with snapshot

Resolves bug: 1534177

Change-Id: I8cf24ccf473573e0299de1564540b892d4d578d8
This commit is contained in:
Memo García 2016-01-14 14:28:28 +00:00 committed by Fausto Marzi
parent 2ee22e041d
commit 0bb53773e3
3 changed files with 6 additions and 16 deletions

View File

@ -798,7 +798,7 @@ Available options::
[--cinder-vol-id CINDER_VOL_ID] [--nova-inst-id NOVA_INST_ID] [--cinder-vol-id CINDER_VOL_ID] [--nova-inst-id NOVA_INST_ID]
[--cindernative-vol-id CINDERNATIVE_VOL_ID] [--cindernative-vol-id CINDERNATIVE_VOL_ID]
[--download-limit DOWNLOAD_LIMIT] [--download-limit DOWNLOAD_LIMIT]
[--sql-server-conf SQL_SERVER_CONF] [--vssadmin] [--sql-server-conf SQL_SERVER_CONF]
[--command COMMAND] [--compression {gzip,bzip2,xz}] [--command COMMAND] [--compression {gzip,bzip2,xz}]
[--storage {local,swift,ssh}] [--ssh-key SSH_KEY] [--storage {local,swift,ssh}] [--ssh-key SSH_KEY]
[--ssh-username SSH_USERNAME] [--ssh-host SSH_HOST] [--ssh-username SSH_USERNAME] [--ssh-host SSH_HOST]
@ -966,8 +966,6 @@ Available options::
Set the SQL Server configuration file where freezer Set the SQL Server configuration file where freezer
retrieve the sql server instance. Following is an retrieve the sql server instance. Following is an
example of config file: instance = <db-instance> example of config file: instance = <db-instance>
--vssadmin Create a backup using a snapshot on windows using
vssadmin. Options are: True and False, default is True
--command COMMAND Command executed by exec action --command COMMAND Command executed by exec action
--compression {gzip,bzip2,xz} --compression {gzip,bzip2,xz}
compression algorithm to use. gzip is default compression algorithm to use. gzip is default

View File

@ -62,8 +62,7 @@ DEFAULT_PARAMS = {
'upload_limit': None, 'always_level': False, 'version': False, 'upload_limit': None, 'always_level': False, 'version': False,
'dry_run': False, 'lvm_snapsize': DEFAULT_LVM_SNAPSIZE, 'dry_run': False, 'lvm_snapsize': DEFAULT_LVM_SNAPSIZE,
'restore_abs_path': False, 'log_file': None, 'log_level': "info", 'restore_abs_path': False, 'log_file': None, 'log_level': "info",
'mode': 'fs', 'action': 'backup', 'mode': 'fs', 'action': 'backup', 'shadow': '', 'shadow_path': '',
'vssadmin': False, 'shadow': '', 'shadow_path': '',
'windows_volume': '', 'command': None, 'metadata_out': False, 'windows_volume': '', 'command': None, 'metadata_out': False,
'storage': 'swift', 'ssh_key': '', 'ssh_username': '', 'ssh_host': '', 'storage': 'swift', 'ssh_key': '', 'ssh_username': '', 'ssh_host': '',
'ssh_port': 22, 'compression': 'gzip' 'ssh_port': 22, 'compression': 'gzip'
@ -150,7 +149,8 @@ def backup_arguments():
'-s', '--snapshot', action='store_true', '-s', '--snapshot', action='store_true',
help=('Create a snapshot of the fs containing the resource to backup.' help=('Create a snapshot of the fs containing the resource to backup.'
' When used, the lvm parameters will be guessed and/or the ' ' When used, the lvm parameters will be guessed and/or the '
'default values will be used'), 'default values will be used, on windows it will invoke '
'vssadmin'),
dest='snapshot', default=False) dest='snapshot', default=False)
arg_parser.add_argument( arg_parser.add_argument(
'--lvm-auto-snap', action='store', '--lvm-auto-snap', action='store',
@ -385,11 +385,6 @@ def backup_arguments():
Following is an example of config file: Following is an example of config file:
instance = <db-instance>''', instance = <db-instance>''',
dest='sql_server_conf', default=False) dest='sql_server_conf', default=False)
arg_parser.add_argument(
'--vssadmin', action='store_true',
help='''Create a backup using a snapshot on windows
using vssadmin. Options are: True and False, default is True''',
dest='vssadmin', default=False)
arg_parser.add_argument( arg_parser.add_argument(
'--command', action='store', '--command', action='store',
help='Command executed by exec action', help='Command executed by exec action',

View File

@ -45,8 +45,8 @@ def backup_mode_sql_server(backup_opt_dict, storage):
winutils.stop_sql_server(sql_server_instance) winutils.stop_sql_server(sql_server_instance)
backup(backup_opt_dict, storage, backup_opt_dict.engine) backup(backup_opt_dict, storage, backup_opt_dict.engine)
finally: finally:
if not backup_opt_dict.vssadmin: if not backup_opt_dict.snapshot:
# if vssadmin is false, wait until the backup is complete # if snapshot is false, wait until the backup is complete
# to start sql server again # to start sql server again
winutils.start_sql_server(sql_server_instance) winutils.start_sql_server(sql_server_instance)
@ -213,10 +213,7 @@ def snapshot_create(backup_opt_dict):
""" """
if winutils.is_windows(): if winutils.is_windows():
# vssadmin is to be deprecated in favor of the --snapshot flag
if backup_opt_dict.snapshot: if backup_opt_dict.snapshot:
backup_opt_dict.vssadmin = True
if backup_opt_dict.vssadmin:
# Create a shadow copy. # Create a shadow copy.
backup_opt_dict.shadow_path, backup_opt_dict.shadow = \ backup_opt_dict.shadow_path, backup_opt_dict.shadow = \
vss.vss_create_shadow_copy(backup_opt_dict.windows_volume) vss.vss_create_shadow_copy(backup_opt_dict.windows_volume)