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 A85997066C for ; Mon, 7 Jun 2021 11:30:02 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A1BC1F2CB for ; Mon, 7 Jun 2021 11:29:32 +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 6F1F2F26B for ; Mon, 7 Jun 2021 11:29:28 +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 4991942B43 for ; Mon, 7 Jun 2021 11:29:28 +0200 (CEST) To: Proxmox VE development discussion , =?UTF-8?Q?Fabian_Gr=c3=bcnbichler?= References: <20210604094748.3383339-1-f.gruenbichler@proxmox.com> <20210604094748.3383339-4-f.gruenbichler@proxmox.com> From: Stefan Reiter Message-ID: Date: Mon, 7 Jun 2021 11:29:22 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20210604094748.3383339-4-f.gruenbichler@proxmox.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.968 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment NICE_REPLY_A -0.001 Looks like a legit reply (A) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] [PATCH qemu-server 3/6] template: mark efidisk as read-only 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: Mon, 07 Jun 2021 09:30:02 -0000 High-level: If you make the $read_only_str contain the entire ",readonly=on" stanza, you can just leave it blank by default and avoid updating all the test cases. On 6/4/21 11:47 AM, Fabian Grünbichler wrote: > otherwise backups of templates using UEFI fail with storages like LVM > thin, where the volumes are not writable. disk controllers like IDE and > SATA that don't support being read-only are still broken for UEFI. > > Signed-off-by: Fabian Grünbichler > --- > PVE/QemuServer.pm | 5 ++++- > test/cfg2cmd/efi-raw-old.conf.cmd | 2 +- > test/cfg2cmd/efi-raw.conf.cmd | 2 +- > test/cfg2cmd/i440fx-win10-hostpci.conf.cmd | 2 +- > test/cfg2cmd/q35-linux-hostpci-multifunction.conf.cmd | 2 +- > test/cfg2cmd/q35-linux-hostpci.conf.cmd | 2 +- > test/cfg2cmd/q35-win10-hostpci.conf.cmd | 2 +- > 7 files changed, 10 insertions(+), 7 deletions(-) > > diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm > index 0d49415..3d996af 100644 > --- a/PVE/QemuServer.pm > +++ b/PVE/QemuServer.pm > @@ -3279,6 +3279,7 @@ sub config_to_command { > die "uefi base image '$ovmf_code' not found\n" if ! -f $ovmf_code; > > my ($path, $format); > + my $read_only_str = 'off'; > if (my $efidisk = $conf->{efidisk0}) { > my $d = parse_drive('efidisk0', $efidisk); > my ($storeid, $volname) = PVE::Storage::parse_volume_id($d->{file}, 1); > @@ -3294,6 +3295,8 @@ sub config_to_command { > die "efidisk format must be specified\n" > if !defined($format); > } > + > + $read_only_str = 'on' if drive_is_read_only($conf, $d); > } else { > warn "no efidisk configured! Using temporary efivars disk.\n"; > $path = "/tmp/$vmid-ovmf.fd"; > @@ -3308,7 +3311,7 @@ sub config_to_command { > } > > push @$cmd, '-drive', "if=pflash,unit=0,format=raw,readonly=on,file=$ovmf_code"; > - push @$cmd, '-drive', "if=pflash,unit=1,format=$format,id=drive-efidisk0$size_str,file=$path"; > + push @$cmd, '-drive', "if=pflash,unit=1,format=$format,id=drive-efidisk0$size_str,file=$path,readonly=$read_only_str"; > } > > # load q35 config > diff --git a/test/cfg2cmd/efi-raw-old.conf.cmd b/test/cfg2cmd/efi-raw-old.conf.cmd > index 0f8b7c7..622ade3 100644 > --- a/test/cfg2cmd/efi-raw-old.conf.cmd > +++ b/test/cfg2cmd/efi-raw-old.conf.cmd > @@ -10,7 +10,7 @@ > -daemonize \ > -smbios 'type=1,uuid=7b10d7af-b932-4c66-b2c3-3996152ec465' \ > -drive 'if=pflash,unit=0,format=raw,readonly=on,file=/usr/share/pve-edk2-firmware//OVMF_CODE.fd' \ > - -drive 'if=pflash,unit=1,format=raw,id=drive-efidisk0,file=/var/lib/vz/images/100/vm-disk-100-0.raw' \ > + -drive 'if=pflash,unit=1,format=raw,id=drive-efidisk0,file=/var/lib/vz/images/100/vm-disk-100-0.raw,readonly=off' \ > -smp '1,sockets=1,cores=1,maxcpus=1' \ > -nodefaults \ > -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \ > diff --git a/test/cfg2cmd/efi-raw.conf.cmd b/test/cfg2cmd/efi-raw.conf.cmd > index 8af615c..a7a7373 100644 > --- a/test/cfg2cmd/efi-raw.conf.cmd > +++ b/test/cfg2cmd/efi-raw.conf.cmd > @@ -10,7 +10,7 @@ > -daemonize \ > -smbios 'type=1,uuid=7b10d7af-b932-4c66-b2c3-3996152ec465' \ > -drive 'if=pflash,unit=0,format=raw,readonly=on,file=/usr/share/pve-edk2-firmware//OVMF_CODE.fd' \ > - -drive 'if=pflash,unit=1,format=raw,id=drive-efidisk0,size=131072,file=/var/lib/vz/images/100/vm-disk-100-0.raw' \ > + -drive 'if=pflash,unit=1,format=raw,id=drive-efidisk0,size=131072,file=/var/lib/vz/images/100/vm-disk-100-0.raw,readonly=off' \ > -smp '1,sockets=1,cores=1,maxcpus=1' \ > -nodefaults \ > -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \ > diff --git a/test/cfg2cmd/i440fx-win10-hostpci.conf.cmd b/test/cfg2cmd/i440fx-win10-hostpci.conf.cmd > index c79576f..1e11710 100644 > --- a/test/cfg2cmd/i440fx-win10-hostpci.conf.cmd > +++ b/test/cfg2cmd/i440fx-win10-hostpci.conf.cmd > @@ -10,7 +10,7 @@ > -daemonize \ > -smbios 'type=1,uuid=3dd750ce-d910-44d0-9493-525c0be4e687' \ > -drive 'if=pflash,unit=0,format=raw,readonly=on,file=/usr/share/pve-edk2-firmware//OVMF_CODE.fd' \ > - -drive 'if=pflash,unit=1,format=qcow2,id=drive-efidisk0,file=/var/lib/vz/images/100/vm-100-disk-1.qcow2' \ > + -drive 'if=pflash,unit=1,format=qcow2,id=drive-efidisk0,file=/var/lib/vz/images/100/vm-100-disk-1.qcow2,readonly=off' \ > -smp '2,sockets=2,cores=1,maxcpus=2' \ > -nodefaults \ > -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \ > diff --git a/test/cfg2cmd/q35-linux-hostpci-multifunction.conf.cmd b/test/cfg2cmd/q35-linux-hostpci-multifunction.conf.cmd > index 1f9beda..d140501 100644 > --- a/test/cfg2cmd/q35-linux-hostpci-multifunction.conf.cmd > +++ b/test/cfg2cmd/q35-linux-hostpci-multifunction.conf.cmd > @@ -10,7 +10,7 @@ > -daemonize \ > -smbios 'type=1,uuid=3dd750ce-d910-44d0-9493-525c0be4e687' \ > -drive 'if=pflash,unit=0,format=raw,readonly=on,file=/usr/share/pve-edk2-firmware//OVMF_CODE.fd' \ > - -drive 'if=pflash,unit=1,format=qcow2,id=drive-efidisk0,file=/var/lib/vz/images/100/vm-100-disk-1.qcow2' \ > + -drive 'if=pflash,unit=1,format=qcow2,id=drive-efidisk0,file=/var/lib/vz/images/100/vm-100-disk-1.qcow2,readonly=off' \ > -smp '2,sockets=2,cores=1,maxcpus=2' \ > -nodefaults \ > -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \ > diff --git a/test/cfg2cmd/q35-linux-hostpci.conf.cmd b/test/cfg2cmd/q35-linux-hostpci.conf.cmd > index dd1bece..7d69134 100644 > --- a/test/cfg2cmd/q35-linux-hostpci.conf.cmd > +++ b/test/cfg2cmd/q35-linux-hostpci.conf.cmd > @@ -10,7 +10,7 @@ > -daemonize \ > -smbios 'type=1,uuid=3dd750ce-d910-44d0-9493-525c0be4e687' \ > -drive 'if=pflash,unit=0,format=raw,readonly=on,file=/usr/share/pve-edk2-firmware//OVMF_CODE.fd' \ > - -drive 'if=pflash,unit=1,format=qcow2,id=drive-efidisk0,file=/var/lib/vz/images/100/vm-100-disk-1.qcow2' \ > + -drive 'if=pflash,unit=1,format=qcow2,id=drive-efidisk0,file=/var/lib/vz/images/100/vm-100-disk-1.qcow2,readonly=off' \ > -smp '2,sockets=2,cores=1,maxcpus=2' \ > -nodefaults \ > -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \ > diff --git a/test/cfg2cmd/q35-win10-hostpci.conf.cmd b/test/cfg2cmd/q35-win10-hostpci.conf.cmd > index 37ef8f7..87a847d 100644 > --- a/test/cfg2cmd/q35-win10-hostpci.conf.cmd > +++ b/test/cfg2cmd/q35-win10-hostpci.conf.cmd > @@ -10,7 +10,7 @@ > -daemonize \ > -smbios 'type=1,uuid=3dd750ce-d910-44d0-9493-525c0be4e687' \ > -drive 'if=pflash,unit=0,format=raw,readonly=on,file=/usr/share/pve-edk2-firmware//OVMF_CODE.fd' \ > - -drive 'if=pflash,unit=1,format=qcow2,id=drive-efidisk0,file=/var/lib/vz/images/100/vm-100-disk-1.qcow2' \ > + -drive 'if=pflash,unit=1,format=qcow2,id=drive-efidisk0,file=/var/lib/vz/images/100/vm-100-disk-1.qcow2,readonly=off' \ > -smp '2,sockets=2,cores=1,maxcpus=2' \ > -nodefaults \ > -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \ >