[pve-devel] [PATCH qemu-server 2/3] use special case for 'snapshot' disk parameter

Dominik Csapak d.csapak at proxmox.com
Thu Feb 8 12:09:23 CET 2018


since qemu expects on|off (not 1|0),
we have to do it different

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/QemuServer.pm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 4c04668..0011018 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -1622,10 +1622,17 @@ sub print_drive_full {
    }
 
     my $opts = '';
-    my @qemu_drive_options = qw(heads secs cyls trans media format cache snapshot rerror werror aio discard);
+    my @qemu_drive_options = qw(heads secs cyls trans media format cache rerror werror aio discard);
     foreach my $o (@qemu_drive_options) {
 	$opts .= ",$o=$drive->{$o}" if $drive->{$o};
     }
+
+    # snapshot only accepts on|off
+    if (defined($drive->{snapshot})) {
+	my $v = $drive->{snapshot} ? 'on' : 'off';
+	$opts .= ",snapshot=$v";
+    }
+
     foreach my $type (['', '-total'], [_rd => '-read'], [_wr => '-write']) {
 	my ($dir, $qmpname) = @$type;
 	if (my $v = $drive->{"mbps$dir"}) {
-- 
2.11.0





More information about the pve-devel mailing list