]> git.proxmox.com Git - qemu-server.git/commitdiff
template: add -snapshot to KVM command
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 4 Jun 2021 09:47:47 +0000 (11:47 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 23 Jun 2021 10:37:40 +0000 (12:37 +0200)
this allows effectively setting ALL volumes as read-only, even if the
disk controller does not support it. without it, IDE and SATA disks
with (base) volumes which are marked read-only/immutable on the storage
level prevent the template VM from starting for backup purposes.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
PVE/QemuServer.pm
test/cfg2cmd/efi-raw-template.conf.cmd
test/cfg2cmd/simple1-template.conf.cmd

index 2f0b2e8ec952c99a2c4e40f18c5800629e9ba320..25282b73b468d329c8cfd6c4995c481008c54580 100644 (file)
@@ -3782,6 +3782,11 @@ sub config_to_command {
        print "activating and using '$vmstate' as vmstate\n";
     }
 
+    if (PVE::QemuConfig->is_template($conf)) {
+       # needed to workaround base volumes being read-only
+       push @$cmd, '-snapshot';
+    }
+
     # add custom args
     if ($conf->{args}) {
        my $aa = PVE::Tools::split_args($conf->{args});
index 636f03ed79a76bc9b74987b07ebced192bf17056..d99862b482d537d39e8a6a6f40d133d59422bd0d 100644 (file)
@@ -24,4 +24,5 @@
   -device 'VGA,id=vga,bus=pci.0,addr=0x2' \
   -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' \
   -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \
-  -machine 'type=pc+pve0'
+  -machine 'type=pc+pve0' \
+  -snapshot
index 20a6dcf433f630e9dee936f78e7adf6ca0676ed3..7fb6fd129a27d371f8438350757a775cb23c41f6 100644 (file)
@@ -33,4 +33,5 @@
   -device 'ide-hd,bus=ahci0.0,drive=drive-sata0,id=sata0'
   -netdev 'type=tap,id=net0,ifname=tap8006i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' \
   -device 'virtio-net-pci,mac=A2:C0:43:77:08:A0,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300' \
-  -machine 'type=pc'
+  -machine 'type=pc' \
+  -snapshot