]> git.proxmox.com Git - pve-container.git/commitdiff
Refactor has_feature
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 26 Feb 2016 08:19:44 +0000 (09:19 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 26 Feb 2016 09:33:04 +0000 (10:33 +0100)
add unused running flag for signature compatibility to
QemuServer.pm
add backup_only flag to replace former feature workaround,
needed to skip backup=no mountpoints if called from VZDump.

src/PVE/LXC.pm
src/PVE/VZDump/LXC.pm

index 24800407f2edf86204933c9f5c20bf1d5b1effc9..503a57fb872ada093e83b101349afe851950baf3 100644 (file)
@@ -1824,10 +1824,8 @@ sub snapshot_prepare {
            if defined($conf->{snapshots}->{$snapname});
 
        my $storecfg = PVE::Storage::config();
-
-       # workaround until mp snapshots are implemented
-       my $feature = $snapname eq 'vzdump' ? 'vzdump' : 'snapshot';
-       die "snapshot feature is not available\n" if !has_feature($feature, $conf, $storecfg);
+       die "snapshot feature is not available\n"
+           if !has_feature('snapshot', $conf, $storecfg, undef, undef, $snapname eq 'vzdump');
 
        $snap = $conf->{snapshots}->{$snapname} = {};
 
@@ -1879,19 +1877,17 @@ sub snapshot_commit {
 }
 
 sub has_feature {
-    my ($feature, $conf, $storecfg, $snapname) = @_;
+    my ($feature, $conf, $storecfg, $snapname, $running, $backup_only) = @_;
     
     my $err;
-    my $vzdump = $feature eq 'vzdump';
-    $feature = 'snapshot' if $vzdump;
 
     foreach_mountpoint($conf, sub {
        my ($ms, $mountpoint) = @_;
 
        return if $err; # skip further test
-       return if $vzdump && $ms ne 'rootfs' && !$mountpoint->{backup};
+       return if $backup_only && $ms ne 'rootfs' && !$mountpoint->{backup};
        
-       $err = 1 if !PVE::Storage::volume_has_feature($storecfg, $feature, $mountpoint->{volume}, $snapname);
+       $err = 1 if !PVE::Storage::volume_has_feature($storecfg, $feature, $mountpoint->{volume}, $snapname, $running);
     });
 
     return $err ? 0 : 1;
index 7269ce8cf8b47dfbc78d4b387d397ff5ae0b20fa..effd0ec4855db914ce6247743900c9f6056b22b9 100644 (file)
@@ -131,7 +131,7 @@ sub prepare {
     });
 
     if ($mode eq 'snapshot') {
-       if (!PVE::LXC::has_feature('vzdump', $conf, $storage_cfg)) {
+       if (!PVE::LXC::has_feature('snapshot', $conf, $storage_cfg, undef, undef, 1)) {
            die "mode failure - some volumes do not support snapshots\n";
        }