From 40e4aa085fd7ccc84287afbcd42ba6d0953e4a57 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Fri, 16 Apr 2021 15:45:10 +0200 Subject: [PATCH 1/2] add --upload-(ratelimit|buffer), deprecate --remote-*, fixes #5611 --- src/borg/archiver.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/borg/archiver.py b/src/borg/archiver.py index 51f9bc7ff..02377d21c 100644 --- a/src/borg/archiver.py +++ b/src/borg/archiver.py @@ -2548,6 +2548,8 @@ def preprocess_args(self, args): ('--noatime', None, 'Warning: "--noatime" has been deprecated because it is the default now.'), ('--nobsdflags', None, 'Warning: "--nobsdflags" has been deprecated. Use --noflags instead.'), ('--numeric-owner', None, 'Warning: "--numeric-owner" has been deprecated. Use --numeric-ids instead.'), + ('--remote-ratelimit', None, 'Warning: "--remote-ratelimit" has been deprecated. Use --upload-ratelimit instead.'), + ('--remote-buffer', None, 'Warning: "--remote-buffer" has been deprecated. Use --upload-buffer instead.'), ] for i, arg in enumerate(args[:]): for old_name, new_name, warning in deprecations: @@ -2744,9 +2746,13 @@ def define_common_options(add_common_option): add_common_option('--remote-path', metavar='PATH', dest='remote_path', help='use PATH as borg executable on the remote (default: "borg")') add_common_option('--remote-ratelimit', metavar='RATE', dest='remote_ratelimit', type=int, - help='set remote network upload rate limit in kiByte/s (default: 0=unlimited)') + help='deprecated, use --upload-ratelimit') + add_common_option('--upload-ratelimit', metavar='RATE', dest='remote_ratelimit', type=int, + help='set network upload rate limit in kiByte/s (default: 0=unlimited)') add_common_option('--remote-buffer', metavar='UPLOAD_BUFFER', dest='remote_buffer', type=int, - help='set upload buffer size in MiB. (default: 0=no buffer)') + help='deprecated, use --upload-buffer') + add_common_option('--upload-buffer', metavar='UPLOAD_BUFFER', dest='remote_buffer', type=int, + help='set network upload buffer size in MiB. (default: 0=no buffer)') add_common_option('--consider-part-files', dest='consider_part_files', action='store_true', help='treat part files like normal files (e.g. to list/extract them)') add_common_option('--debug-profile', metavar='FILE', dest='debug_profile', default=None, From 6b838febe8581694a4880f6c5f4d700045495de4 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Fri, 16 Apr 2021 15:48:10 +0200 Subject: [PATCH 2/2] s/remote_(buffer|ratelimit)/upload_(buffer/ratelimit)/g --- src/borg/archiver.py | 8 ++++---- src/borg/remote.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/borg/archiver.py b/src/borg/archiver.py index 02377d21c..ba26171f1 100644 --- a/src/borg/archiver.py +++ b/src/borg/archiver.py @@ -2745,13 +2745,13 @@ def define_common_options(add_common_option): help='set umask to M (local only, default: %(default)04o)') add_common_option('--remote-path', metavar='PATH', dest='remote_path', help='use PATH as borg executable on the remote (default: "borg")') - add_common_option('--remote-ratelimit', metavar='RATE', dest='remote_ratelimit', type=int, + add_common_option('--remote-ratelimit', metavar='RATE', dest='upload_ratelimit', type=int, help='deprecated, use --upload-ratelimit') - add_common_option('--upload-ratelimit', metavar='RATE', dest='remote_ratelimit', type=int, + add_common_option('--upload-ratelimit', metavar='RATE', dest='upload_ratelimit', type=int, help='set network upload rate limit in kiByte/s (default: 0=unlimited)') - add_common_option('--remote-buffer', metavar='UPLOAD_BUFFER', dest='remote_buffer', type=int, + add_common_option('--remote-buffer', metavar='UPLOAD_BUFFER', dest='upload_buffer', type=int, help='deprecated, use --upload-buffer') - add_common_option('--upload-buffer', metavar='UPLOAD_BUFFER', dest='remote_buffer', type=int, + add_common_option('--upload-buffer', metavar='UPLOAD_BUFFER', dest='upload_buffer', type=int, help='set network upload buffer size in MiB. (default: 0=no buffer)') add_common_option('--consider-part-files', dest='consider_part_files', action='store_true', help='treat part files like normal files (e.g. to list/extract them)') diff --git a/src/borg/remote.py b/src/borg/remote.py index ab4d434d9..5d32a4ff6 100644 --- a/src/borg/remote.py +++ b/src/borg/remote.py @@ -543,8 +543,8 @@ def __init__(self, location, create=False, exclusive=False, lock_wait=None, lock self.responses = {} self.async_responses = {} self.shutdown_time = None - self.ratelimit = SleepingBandwidthLimiter(args.remote_ratelimit * 1024 if args and args.remote_ratelimit else 0) - self.upload_buffer_size_limit = args.remote_buffer * 1024 * 1024 if args and args.remote_buffer else 0 + self.ratelimit = SleepingBandwidthLimiter(args.upload_ratelimit * 1024 if args and args.upload_ratelimit else 0) + self.upload_buffer_size_limit = args.upload_buffer * 1024 * 1024 if args and args.upload_buffer else 0 self.unpacker = get_limited_unpacker('client') self.server_version = parse_version('1.0.8') # fallback version if server is too old to send version information self.p = None