From 90d9805f0397b28721043b23c7cf583aafe455a6 Mon Sep 17 00:00:00 2001 From: eldar nugaev Date: Thu, 3 Dec 2015 17:42:12 +0000 Subject: [PATCH] Removing obsolete parameters from freezer args (swift related). Resolves bug: 1522511 Change-Id: Ia01961e8236718bf75fe931bb8aa13c3fb8fe8ac --- README.rst | 158 ++++++++++++++++++++----------------------- freezer/arguments.py | 30 ++------ tests/commons.py | 3 - tests/test_job.py | 1 - 4 files changed, 77 insertions(+), 115 deletions(-) diff --git a/README.rst b/README.rst index e696f870..e4175841 100644 --- a/README.rst +++ b/README.rst @@ -720,8 +720,7 @@ Available options:: usage: freezerc [-h] [--config CONFIG] [--action {backup,restore,info,admin,exec}] [-F PATH_TO_BACKUP] [-N BACKUP_NAME] [-m MODE] [-C CONTAINER] - [-L] [-l] [-o GET_OBJECT] [-d DST_FILE] [-s] - [--lvm-auto-snap LVM_AUTO_SNAP] [--lvm-srcvol LVM_SRCVOL] + [-s] [--lvm-auto-snap LVM_AUTO_SNAP] [--lvm-srcvol LVM_SRCVOL] [--lvm-snapname LVM_SNAPNAME] [--lvm-snap-perm {ro,rw}] [--lvm-snapsize LVM_SNAPSIZE] [--lvm-dirmount LVM_DIRMOUNT] [--lvm-volgroup LVM_VOLGROUP] [--max-level MAX_LEVEL] @@ -731,7 +730,7 @@ Available options:: [--no-incremental] [--hostname HOSTNAME] [--mysql-conf MYSQL_CONF] [--metadata-out METADATA_OUT] [--log-file LOG_FILE] [--exclude EXCLUDE] - [--dereference-symlink {none,soft,hard,all}] [-U] + [--dereference-symlink {none,soft,hard,all}] [--encrypt-pass-file ENCRYPT_PASS_FILE] [-M MAX_SEGMENT_SIZE] [--restore-abs-path RESTORE_ABS_PATH] [--restore-from-host HOSTNAME] @@ -741,88 +740,77 @@ Available options:: [--cinder-vol-id CINDER_VOL_ID] [--nova-inst-id NOVA_INST_ID] [--cindernative-vol-id CINDERNATIVE_VOL_ID] [--download-limit DOWNLOAD_LIMIT] - [--sql-server-conf SQL_SERVER_CONF] [--vssadmin VSSADMIN] + [--sql-server-conf SQL_SERVER_CONF] [--vssadmin] [--command COMMAND] [--compression {gzip,bzip2,xz}] [--storage {local,swift,ssh}] [--ssh-key SSH_KEY] [--ssh-username SSH_USERNAME] [--ssh-host SSH_HOST] [--ssh-port SSH_PORT] - - optional arguments: - -h, --help show this help message and exit - --config CONFIG Config file abs path. Option arguments are provided - from config file. When config file is used any option - from command line provided take precedence. - --action {backup,restore,info,admin,exec} - Set the action to be taken. backup and restore are - self explanatory, info is used to retrieve info from - the storage media, exec is used to execute a script, - while admin is used to delete old backups and other - admin actions. Default backup. - -F PATH_TO_BACKUP, --path-to-backup PATH_TO_BACKUP, --file-to-backup PATH_TO_BACKUP - The file or directory you want to back up to Swift - -N BACKUP_NAME, --backup-name BACKUP_NAME - The backup name you want to use to identify your - backup on Swift - -m MODE, --mode MODE Set the technology to back from. Options are, fs - (filesystem), mongo (MongoDB), mysql (MySQL), - sqlserver (SQL Server) Default set to fs - -C CONTAINER, --container CONTAINER - The Swift container (or path to local storage) used to - upload files to - -L, --list-containers - List the Swift containers on remote Object Storage - Server - -l, --list-objects List the Swift objects stored in a container on remote - Object Storage Server. - -o GET_OBJECT, --get-object GET_OBJECT - The Object name you want to download on the local file - system. - -d DST_FILE, --dst-file DST_FILE - The file name used to save the object on your local - disk and upload file in swift - -s, --snapshot Create a snapshot of the fs containing the resource to - backup. When used, the lvm parameters will be guessed - and/or the default values will be used - --lvm-auto-snap LVM_AUTO_SNAP - Automatically guess the volume group and volume name - for given PATH. - --lvm-srcvol LVM_SRCVOL - Set the lvm volume you want to take a snaphost from. - Default no volume - --lvm-snapname LVM_SNAPNAME - Set the lvm snapshot name to use. If the snapshot name - already exists, the old one will be used a no new one - will be created. Default freezer_backup_snap. - --lvm-snap-perm {ro,rw} - Set the lvm snapshot permission to use. If the - permission is set to ro The snapshot will be immutable - - read only -. If the permission is set to rw it will - be mutable - --lvm-snapsize LVM_SNAPSIZE - Set the lvm snapshot size when creating a new - snapshot. Please add G for Gigabytes or M for - Megabytes, i.e. 500M or 8G. Default 1G. - --lvm-dirmount LVM_DIRMOUNT - Set the directory you want to mount the lvm snapshot - to. Default to /var/lib/freezer - --lvm-volgroup LVM_VOLGROUP - Specify the volume group of your logical volume. This - is important to mount your snapshot volume. Default - not set - --max-level MAX_LEVEL - Set the backup level used with tar to implement - incremental backup. If a level 1 is specified but no - level 0 is already available, a level 0 will be done - and subsequently backs to level 1. Default 0 (No - Incremental) - --always-level ALWAYS_LEVEL - Set backup maximum level used with tar to implement - incremental backup. If a level 3 is specified, the - backup will be executed from level 0 to level 3 and to - that point always a backup level 3 will be executed. - It will not restart from level 0. This option has - precedence over --max-backup-level. Default False - (Disabled) + + optional arguments: + -h, --help show this help message and exit + --config CONFIG Config file abs path. Option arguments are provided + from config file. When config file is used any option + from command line provided take precedence. + --action {backup,restore,info,admin,exec} + Set the action to be taken. backup and restore are + self explanatory, info is used to retrieve info from + the storage media, exec is used to execute a script, + while admin is used to delete old backups and other + admin actions. Default backup. + -F PATH_TO_BACKUP, --path-to-backup PATH_TO_BACKUP, --file-to-backup PATH_TO_BACKUP + The file or directory you want to back up to Swift + -N BACKUP_NAME, --backup-name BACKUP_NAME + The backup name you want to use to identify your + backup on Swift + -m MODE, --mode MODE Set the technology to back from. Options are, fs + (filesystem), mongo (MongoDB), mysql (MySQL), + sqlserver (SQL Server) Default set to fs + -C CONTAINER, --container CONTAINER + The Swift container (or path to local storage) used to + upload files to + -s, --snapshot Create a snapshot of the fs containing the resource to + backup. When used, the lvm parameters will be guessed + and/or the default values will be used + --lvm-auto-snap LVM_AUTO_SNAP + Automatically guess the volume group and volume name + for given PATH. + --lvm-srcvol LVM_SRCVOL + Set the lvm volume you want to take a snaphost from. + Default no volume + --lvm-snapname LVM_SNAPNAME + Set the lvm snapshot name to use. If the snapshot name + already exists, the old one will be used a no new one + will be created. Default freezer_backup_snap. + --lvm-snap-perm {ro,rw} + Set the lvm snapshot permission to use. If the + permission is set to ro The snapshot will be immutable + - read only -. If the permission is set to rw it will + be mutable + --lvm-snapsize LVM_SNAPSIZE + Set the lvm snapshot size when creating a new + snapshot. Please add G for Gigabytes or M for + Megabytes, i.e. 500M or 8G. Default 1G. + --lvm-dirmount LVM_DIRMOUNT + Set the directory you want to mount the lvm snapshot + to. Default to /var/lib/freezer + --lvm-volgroup LVM_VOLGROUP + Specify the volume group of your logical volume. This + is important to mount your snapshot volume. Default + not set + --max-level MAX_LEVEL + Set the backup level used with tar to implement + incremental backup. If a level 1 is specified but no + level 0 is already available, a level 0 will be done + and subsequently backs to level 1. Default 0 (No + Incremental) + --always-level ALWAYS_LEVEL + Set backup maximum level used with tar to implement + incremental backup. If a level 3 is specified, the + backup will be executed from level 0 to level 3 and to + that point always a backup level 3 will be executed. + It will not restart from level 0. This option has + precedence over --max-backup-level. Default False + (Disabled) --restart-always-level RESTART_ALWAYS_LEVEL Restart the backup from level 0 after n days. Valid only if --always-level option if set. If --always- @@ -868,15 +856,13 @@ Available options:: --dereference-symlink {none,soft,hard,all} Follow hard and soft links and archive and dump the files they refer to. Default False. - -U, --upload Upload to Swift the destination file passed to the -d - option. Default upload the data --encrypt-pass-file ENCRYPT_PASS_FILE Passing a private key to this option, allow you to encrypt the files before to be uploaded in Swift. Default do not encrypt. -M MAX_SEGMENT_SIZE, --max-segment-size MAX_SEGMENT_SIZE Set the maximum file chunk size in bytes to upload to - swift Default 67108864 bytes (64MB) + swift Default 33554432 bytes (32MB) --restore-abs-path RESTORE_ABS_PATH Set the absolute path where you want your data restored. Default False. @@ -886,7 +872,7 @@ Available options:: host where the backup was executed just type from your shell: "$ hostname" and the output is the value that needs to be passed to this option. Mandatory with - Restore Default False. (Deprecated use "hostname" + Restore Default False. (Deprecated use "hostname" instead) --restore-from-date RESTORE_FROM_DATE Set the absolute path where you want your data @@ -922,7 +908,7 @@ Available options:: Set the SQL Server configuration file where freezer retrieve the sql server instance. Following is an example of config file: instance = - --vssadmin VSSADMIN Create a backup using a snapshot on windows using + --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 --compression {gzip,bzip2,xz} diff --git a/freezer/arguments.py b/freezer/arguments.py index ac30ac4f..6453483c 100644 --- a/freezer/arguments.py +++ b/freezer/arguments.py @@ -41,27 +41,27 @@ DEFAULT_LVM_SNAPSIZE = '1G' DEFAULT_LVM_DIRMOUNT = '/var/lib/freezer' DEFAULT_PARAMS = { - 'os_identity_api_version': None, 'list_objects': False, - 'get_object': False, 'lvm_auto_snap': False, 'lvm_volgroup': False, + 'os_identity_api_version': None, + 'lvm_auto_snap': False, 'lvm_volgroup': False, 'exclude': False, 'sql_server_conf': False, 'backup_name': False, 'quiet': False, 'container': 'freezer_backups', 'no_incremental': False, 'max_segment_size': 67108864, 'lvm_srcvol': False, 'download_limit': None, 'hostname': False, 'remove_from_date': False, 'restart_always_level': False, 'lvm_dirmount': DEFAULT_LVM_DIRMOUNT, - 'dst_file': False, 'dereference_symlink': '', + 'dereference_symlink': '', 'restore_from_host': False, 'config': False, 'mysql_conf': False, 'insecure': False, 'lvm_snapname': DEFAULT_LVM_SNAPNAME, 'lvm_snapperm': 'ro', 'snapshot': False, 'max_priority': False, 'max_level': False, 'path_to_backup': False, 'encrypt_pass_file': False, 'volume': False, 'proxy': False, 'cinder_vol_id': '', 'cindernative_vol_id': '', - 'nova_inst_id': '', 'list_containers': False, + 'nova_inst_id': '', 'remove_older_than': None, 'restore_from_date': False, 'upload_limit': None, 'always_level': False, 'version': False, 'dry_run': False, 'lvm_snapsize': DEFAULT_LVM_SNAPSIZE, 'restore_abs_path': False, 'log_file': None, - 'upload': True, 'mode': 'fs', 'action': 'backup', + 'mode': 'fs', 'action': 'backup', 'vssadmin': False, 'shadow': '', 'shadow_path': '', 'windows_volume': '', 'command': None, 'metadata_out': False, 'storage': 'swift', 'ssh_key': '', 'ssh_username': '', 'ssh_host': '', @@ -141,22 +141,6 @@ def backup_arguments(args_dict={}): help="The Swift container (or path to local storage) " "used to upload files to", dest='container', default='freezer_backups') - arg_parser.add_argument( - '-L', '--list-containers', action='store_true', - help='''List the Swift containers on remote Object Storage Server''', - dest='list_containers', default=False) - arg_parser.add_argument( - '-l', '--list-objects', action='store_true', - help='''List the Swift objects stored in a container on remote Object\ - Storage Server.''', dest='list_objects', default=False) - arg_parser.add_argument( - '-o', '--get-object', action='store', - help="The Object name you want to download on the local file system.", - dest='get_object', default=False) - arg_parser.add_argument( - '-d', '--dst-file', action='store', - help="The file name used to save the object on your local disk and\ - upload file in swift", dest='dst_file', default=False) arg_parser.add_argument( '-s', '--snapshot', action='store_true', help=('Create a snapshot of the fs containing the resource to backup.' @@ -293,10 +277,6 @@ def backup_arguments(args_dict={}): "Follow hard and soft links and archive and dump the files they " " refer to. Default False."), dest='dereference_symlink', default='') - arg_parser.add_argument( - '-U', '--upload', action='store_true', - help="Upload to Swift the destination file passed to the -d option.\ - Default upload the data", dest='upload', default=True) arg_parser.add_argument( '--encrypt-pass-file', action='store', help="Passing a private key to this option, allow you to encrypt the \ diff --git a/tests/commons.py b/tests/commons.py index b3947ccb..365b7b3f 100644 --- a/tests/commons.py +++ b/tests/commons.py @@ -325,7 +325,6 @@ class BackupOpt1: self.time_stamp = 123456789 self.container = 'test-container' self.work_dir = '/tmp' - self.upload = 'true' self.sw_connector = fakeswclient self.max_level = '20' self.encrypt_pass_file = '/dev/random' @@ -333,8 +332,6 @@ class BackupOpt1: self.remove_from_date = '2014-12-03T23:23:23' self.restart_always_level = 100000 self.restore_abs_path = '/tmp' - self.list_containers = False - self.list_objects = False self.restore_from_date = '2014-12-03T23:23:23' self.restore_from_host = 'test-hostname' self.action = 'info' diff --git a/tests/test_job.py b/tests/test_job.py index 0f433784..418c7a7c 100644 --- a/tests/test_job.py +++ b/tests/test_job.py @@ -44,7 +44,6 @@ class TestInfoJob(TestJob): def test_execute_list_containers(self): backup_opt = BackupOpt1() - backup_opt.list_containers = True job = InfoJob(backup_opt, backup_opt.storage) job.execute()