[pve-devel] [PATCH qemu-server 2/2] Refactor has_feature

Fabian Grünbichler f.gruenbichler at proxmox.com
Thu Feb 25 15:51:02 CET 2016


backup_only is currently not used as snapshot backups are
handled by qemu, but this makes the signatures identical
to LXC.pm's has_feature.
---
 PVE/QemuServer.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 32b9343..a4476a8 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -5960,8 +5960,9 @@ sub snapshot_prepare {
 	    if defined($conf->{snapshots}->{$snapname});
 
 	my $storecfg = PVE::Storage::config();
-	die "snapshot feature is not available\n" if !has_feature('snapshot', $conf, $storecfg);
 	my $running = check_running($vmid);
+	die "snapshot feature is not available\n"
+	    if !has_feature('snapshot', $conf, $storecfg, undef, $running, $snapname eq 'vzdump');
 
 	$snap = $conf->{snapshots}->{$snapname} = {};
 
@@ -6364,13 +6365,14 @@ sub snapshot_delete {
 }
 
 sub has_feature {
-    my ($feature, $conf, $storecfg, $snapname, $running) = @_;
+    my ($feature, $conf, $storecfg, $snapname, $running, $backup_only) = @_;
 
     my $err;
     foreach_drive($conf, sub {
 	my ($ds, $drive) = @_;
 
 	return if drive_is_cdrom($drive);
+	return if $backup_only && !$drive->{backup};
 	my $volid = $drive->{file};
 	$err = 1 if !PVE::Storage::volume_has_feature($storecfg, $feature, $volid, $snapname, $running);
     });
-- 
2.1.4





More information about the pve-devel mailing list