[pve-devel] [PATCH container 1/2] vzdump: add reason for mountpoint backup inclusion

Aaron Lauterer a.lauterer at proxmox.com
Fri Apr 3 16:11:37 CEST 2020


Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---

v3 -> v4: nothing changed. in here for completness sake

 src/PVE/LXC/Config.pm | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index 6cc4e4a..e3be23c 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -49,13 +49,23 @@ sub cfs_config_path {
 sub mountpoint_backup_enabled {
     my ($class, $mp_key, $mountpoint) = @_;
 
-    return 1 if $mp_key eq 'rootfs';
-
-    return 0 if $mountpoint->{type} ne 'volume';
-
-    return 1 if $mountpoint->{backup};
-
-    return 0;
+    my $enabled;
+    my $reason;
+
+    if ($mp_key eq 'rootfs') {
+	$enabled = 1;
+	$reason = 'rootfs';
+    } elsif ($mountpoint->{type} ne 'volume') {
+	$enabled = 0;
+	$reason = 'not a volume';
+    } elsif ($mountpoint->{backup}) {
+	$enabled = 1;
+	$reason = 'enabled';
+    } else {
+	$enabled = 0;
+	$reason = 'disabled';
+    }
+    return wantarray ? ($enabled, $reason) : $enabled;
 }
 
 sub has_feature {
-- 
2.20.1





More information about the pve-devel mailing list