From dd6aa2fc4d0b31e7a852529acd29ffe64bacad13 Mon Sep 17 00:00:00 2001 From: ma Date: Thu, 28 Nov 2024 17:10:11 +0100 Subject: [PATCH] show warning if auto mode attempts to backup raw devices incrementally #239 --- Changelog | 6 ++++++ libvirtnbdbackup/__init__.py | 2 +- man/virtnbdbackup.1 | 4 ++-- man/virtnbdmap.1 | 2 +- man/virtnbdrestore.1 | 4 ++-- virtnbdbackup | 14 +++++++------- 6 files changed, 19 insertions(+), 13 deletions(-) diff --git a/Changelog b/Changelog index 063f64c9..b83ef68a 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,9 @@ +Version 2.18 +--------- + * If auto backup mode is switched to incremental and --raw option + is passed, backup would fails instead of showing an warning that + raw devices are excluded (#239) + Version 2.17 --------- * Add rpm package build for fedora 41 (#234) diff --git a/libvirtnbdbackup/__init__.py b/libvirtnbdbackup/__init__.py index 9b9bbde2..edffb483 100644 --- a/libvirtnbdbackup/__init__.py +++ b/libvirtnbdbackup/__init__.py @@ -15,4 +15,4 @@ along with this program. If not, see . """ -__version__ = "2.17" +__version__ = "2.18" diff --git a/man/virtnbdbackup.1 b/man/virtnbdbackup.1 index 1bc8c7c8..3af6da98 100644 --- a/man/virtnbdbackup.1 +++ b/man/virtnbdbackup.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. -.TH VIRTNBDBACKUP "1" "November 2024" "virtnbdbackup 2.17" "User Commands" +.TH VIRTNBDBACKUP "1" "November 2024" "virtnbdbackup 2.18" "User Commands" .SH NAME virtnbdbackup \- backup utility for libvirt .SH DESCRIPTION @@ -52,7 +52,7 @@ Backup only disk with target dev name (\fB\-i\fR vda) Exclude disk(s) with target dev name (\fB\-x\fR vda,vdb) .TP \fB\-f\fR SOCKETFILE, \fB\-\-socketfile\fR SOCKETFILE -Use specified file for NBD Server socket (default: \fI\,/var/tmp/virtnbdbackup.174352\/\fP) +Use specified file for NBD Server socket (default: \fI\,/var/tmp/virtnbdbackup.1305388\/\fP) .TP \fB\-n\fR, \fB\-\-noprogress\fR Disable progress bar diff --git a/man/virtnbdmap.1 b/man/virtnbdmap.1 index d94c8dd4..b39e505d 100644 --- a/man/virtnbdmap.1 +++ b/man/virtnbdmap.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. -.TH VIRTNBDMAP "1" "November 2024" "virtnbdmap 2.17" "User Commands" +.TH VIRTNBDMAP "1" "November 2024" "virtnbdmap 2.18" "User Commands" .SH NAME virtnbdmap \- map virtnbdbackup image files to nbd devices .SH DESCRIPTION diff --git a/man/virtnbdrestore.1 b/man/virtnbdrestore.1 index c07ccd30..42c26236 100644 --- a/man/virtnbdrestore.1 +++ b/man/virtnbdrestore.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. -.TH VIRTNBDRESTORE "1" "November 2024" "virtnbdrestore 2.17" "User Commands" +.TH VIRTNBDRESTORE "1" "November 2024" "virtnbdrestore 2.18" "User Commands" .SH NAME virtnbdrestore \- restore utility for libvirt .SH DESCRIPTION @@ -41,7 +41,7 @@ Process only disk matching target dev name. (default: None) Disable progress bar .TP \fB\-f\fR SOCKETFILE, \fB\-\-socketfile\fR SOCKETFILE -Use specified file for NBD Server socket (default: \fI\,/var/tmp/virtnbdbackup.174357\/\fP) +Use specified file for NBD Server socket (default: \fI\,/var/tmp/virtnbdbackup.1305393\/\fP) .TP \fB\-r\fR, \fB\-\-raw\fR Copy raw images as is during restore. (default: False) diff --git a/virtnbdbackup b/virtnbdbackup index b6d1eeec..9e277b79 100755 --- a/virtnbdbackup +++ b/virtnbdbackup @@ -286,13 +286,6 @@ def main() -> None: if args.compress is not False: logging.info("Compression enabled, level [%s]", args.compress) - if args.raw is True and args.level in ("inc", "diff"): - logging.warning( - "Raw disks can't be included during incremental or differential backup." - ) - logging.warning("Excluding raw disks.") - args.raw = False - try: check.arguments(args) except exceptions.BackupException as e: @@ -364,6 +357,13 @@ def main() -> None: except exceptions.CheckpointException: sys.exit(1) + if args.raw is True and args.level in ("inc", "diff"): + logging.warning( + "Raw disks can't be included during incremental or differential backup." + ) + logging.warning("Excluding raw disks.") + args.raw = False + signal.signal( signal.SIGINT, partial(sighandle.Backup.catch, args, domObj, virtClient, logging),