[pve-devel] [PATCH container] LXC::Config: make mountpoint_backup_enabled a class method

Wolfgang Bumiller w.bumiller at proxmox.com
Tue May 24 10:57:45 CEST 2016


All subs in there are defined as class method and the commit
which introduced this also used it as one in
PVE::VZDump::LXC and thereby broke vzdump on containers
as it passes wrong parameters to the function.
---
Fixes this error when tryin to backup a container:
ERROR: Backup of VM 404 failed - Can't use string ("rootfs") as a HASH ref while "strict refs" in use at /usr/share/perl5/PVE/LXC/Config.pm line 55.

 src/PVE/LXC/Config.pm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index 83e5728..0bc20d1 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -45,7 +45,7 @@ sub cfs_config_path {
 }
 
 sub mountpoint_backup_enabled {
-    my ($mp_key, $mountpoint) = @_;
+    my ($class, $mp_key, $mountpoint) = @_;
 
     return 1 if $mp_key eq 'rootfs';
 
@@ -62,7 +62,7 @@ sub has_feature {
 	my ($ms, $mountpoint) = @_;
 
 	return if $err; # skip further test
-	return if $backup_only && !mountpoint_backup_enabled($ms, $mountpoint);
+	return if $backup_only && !$class->mountpoint_backup_enabled($ms, $mountpoint);
 
 	$err = 1
 	    if !PVE::Storage::volume_has_feature($storecfg, $feature,
@@ -108,7 +108,7 @@ sub __snapshot_create_vol_snapshot {
     my $storecfg = PVE::Storage::config();
 
     return if $snapname eq 'vzdump' &&
-	!mountpoint_backup_enabled($ms, $mountpoint);
+	!$class->mountpoint_backup_enabled($ms, $mountpoint);
 
     PVE::Storage::volume_snapshot($storecfg, $mountpoint->{volume}, $snapname);
 }
-- 
2.1.4





More information about the pve-devel mailing list