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

Aaron Lauterer a.lauterer at proxmox.com
Mon Mar 16 16:44:48 CET 2020


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

v1->v2:
moved the determination of the reason to the same method that decides if
a mountpoint is included in the backup.

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 e88ba0b..00f4884 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