From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id D08FF74EE7 for ; Fri, 4 Jun 2021 11:48:45 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C67271B340 for ; Fri, 4 Jun 2021 11:48:15 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 6E8971B334 for ; Fri, 4 Jun 2021 11:48:13 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 47A9B46717 for ; Fri, 4 Jun 2021 11:48:13 +0200 (CEST) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pve-devel@lists.proxmox.com Date: Fri, 4 Jun 2021 11:47:47 +0200 Message-Id: <20210604094748.3383339-6-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210604094748.3383339-1-f.gruenbichler@proxmox.com> References: <20210604094748.3383339-1-f.gruenbichler@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.016 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [qemuserver.pm] Subject: [pve-devel] [PATCH qemu-server 5/6] template: add -snapshot to KVM command X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2021 09:48:45 -0000 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 --- PVE/QemuServer.pm | 5 +++++ test/cfg2cmd/efi-raw-template.conf.cmd | 3 ++- test/cfg2cmd/simple1-template.conf.cmd | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 3d996af..ce392f8 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -3765,6 +3765,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}); diff --git a/test/cfg2cmd/efi-raw-template.conf.cmd b/test/cfg2cmd/efi-raw-template.conf.cmd index 636f03e..d99862b 100644 --- a/test/cfg2cmd/efi-raw-template.conf.cmd +++ b/test/cfg2cmd/efi-raw-template.conf.cmd @@ -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 diff --git a/test/cfg2cmd/simple1-template.conf.cmd b/test/cfg2cmd/simple1-template.conf.cmd index 20a6dcf..7fb6fd1 100644 --- a/test/cfg2cmd/simple1-template.conf.cmd +++ b/test/cfg2cmd/simple1-template.conf.cmd @@ -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 -- 2.30.2