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) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id D71EE7057A for ; Fri, 2 Apr 2021 20:58:12 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id BB8B3116E8 for ; Fri, 2 Apr 2021 20:58:12 +0200 (CEST) Received: from mo4-p00-ob.smtp.rzone.de (mo4-p00-ob.smtp.rzone.de [81.169.146.216]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 8E7C8116DD for ; Fri, 2 Apr 2021 20:58:10 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; t=1617389876; cv=none; d=strato.com; s=strato-dkim-0002; b=YC1VP1WRaGNlzBoR48J+UOErftQ5e6+9QgrLdxsDfSig2bRPcEYgIW2MMLPvVq1mKK 8uwNMJmF1ZI03FPPYNA7L/xARNbYuwekT31zPzANSs5+8qRg2FEh9UWlTwKwMZ/qGcSX df6krbz3hJ/SY6O1U7qe/F0XX18eRBwg0i2go70fGfFtSv8FcErJgVWQTjCqporuHzou IOr4vdL4HtsCiXe5d1/1zvZrq5tykpSN1QL5BkjAarRUn5orMSedodyHnPVejXylkQ5p oPtbqMzrdsTEr4R9KmdOeAbezVOq/803h7AEufBD/AxP/62cbL6RcIWT6QWhnGc4saFu Qorg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1617389876; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Cc:Date: From:Subject:Sender; bh=SMixdVGAeYrUlbzD/eje6v+upRoEsiFU/qFRO5Z/Vko=; b=ql8vXN8pc21WsKXif/jVvyuiH5gmDnLPUELRCAMlOZRhxzFFJUtsqzlGzh0QROE931 rtKEMc6U4ufz4aZR4MYdffu7fwLGy1TmH7wK9K5FXhk/vF/WTIR6xwBBeGjBMummpQKh xTKRP6NGJWJmng/7zHxAxqL5aqfwj11PMPn3JJ8IJMePngKkGRN5fZG/XGpNxqo9WSH5 1de5s2uQFgKsSQznxTe/aefSCYvubWECYThOfGPN1a410j/Jo6A+MEtvIXwcAD9VB/J+ 7kw6IqA/B4kHxctDTgJaUCJshkYmUunN1qb4/hDqsaHlCniNtHJ2mfZJGYgEfAgBjwmg w00A== ARC-Authentication-Results: i=1; strato.com; dkim=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1617389876; s=strato-dkim-0002; d=berneking.net; h=References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Cc:Date: From:Subject:Sender; bh=SMixdVGAeYrUlbzD/eje6v+upRoEsiFU/qFRO5Z/Vko=; b=E4XCeoHDvGVG/BMcyM3IOLtnJwbAMTKr0cHdsiGW/s6sWrAZqIUOx4WKwPwi27IZT9 wddR/65V2AoRvt4R/E5czrHNdAx6fxfeWDWicY88UTAahq65feTT4f+6dwKogbbGt97O 5ZeeeSuQUCksdE0yNemhrUHe8hf7ifWEz6qrhI6dJcJ45D/GuR9eBdwYOLqmdaPZ4bPm 0wvc6yeXE6HCHfFcNehOkpsmT8KwpLJr+9vr/P+60ygRYa6Qxe3FbjvdcfUbIATCXRnW Zdm88Z8hEA7qBv6TM/ajrZz8AmRiAICXbC7Yv1YEzDi/WFhcyCMMDFrKURRr/USY8rL9 uTEw== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":IHkHdGCqfu0qoeJoEbKVgTf+/O6Y0B1F6HvRpL2/zGZjqbyw7O2y3JwCAGFEg2oojfRIIvxC" X-RZG-CLASS-ID: mo00 Received: from [192.168.1.151] by smtp.strato.de (RZmta 47.23.1 DYNA|AUTH) with ESMTPSA id D0ae9ax32IvuAQs (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Fri, 2 Apr 2021 20:57:56 +0200 (CEST) Message-ID: <51da418c155fbc5dec53d1093530a6dc23e0cd35.camel@berneking.net> From: Luca Berneking To: pve-devel@lists.proxmox.com Date: Fri, 02 Apr 2021 20:56:56 +0200 In-Reply-To: <20210331143923.29006-1-s.reiter@proxmox.com> References: <20210331143923.29006-1-s.reiter@proxmox.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.4 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.350 Adjusted score from AWL reputation of From: address DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain RCVD_IN_DNSWL_LOW -0.7 Sender listed at https://www.dnswl.org/, low trust RCVD_IN_MSPIKE_H4 0.001 Very Good reputation (+4) RCVD_IN_MSPIKE_WL 0.001 Mailspike good senders SPF_HELO_PASS -0.001 SPF: HELO matches 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. [8006.pid, proxmox.com, qemuserver.pm, machine.pm, berneking.net] Subject: Re: [pve-devel] [PATCH qemu-server] cfg2cmd: fix +pveN machine types with pxe 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, 02 Apr 2021 18:58:12 -0000 Hi Stefan, yes, your patch works for me, i applied your patch to my proxmox instance and verified my vm is still booting with the custom rom file. I'm fine with being tagged as Co-developed and could sign the agreement if necessary. Tested-by: Luca Berneking On Wed, 2021-03-31 at 16:39 +0200, Stefan Reiter wrote: > Pinned machine versions like "pc-i440fx-4.2+pve2.pxe" would otherwise > get a second "+pve0" suffix, which is incorrect. > > Also deal with non-pve pinned versions correctly, i.e. > "pc-i440fx-5.2.pxe" becomes "pc-i440fx-5.2+pve0.pxe". > > Handle .pxe suffixes in Machine.pm as well, and add two test cases. > > Co-developed-by: Luca Berneking > Signed-off-by: Stefan Reiter > --- > > @Luca: First off, thanks for the contribution! I wanted to take a > closer look at > your patch and ended up with this diff - I thought I'd just send it out > and add > you as Co-dev, I hope that's fine with you. If you give this patch a > shot, let > me know if it does indeed fix your issue correctly as well - "Tested- > by:" is > always appreciated! > > Also, if you haven't already done so, to submit patches you need to > send us a > signed contributor license agreement, see our developer documentation > for more: > https://pve.proxmox.com/wiki/Developer_Documentation#Software_License_and_Copyright > - since this one doesn't actually include the changes you posted > verbatim, I've > signed off on it myself, so it shouldn't be required, but for the > future :) > >  PVE/QemuServer.pm                            |  7 ++++- >  PVE/QemuServer/Machine.pm                    |  6 ++-- >  test/cfg2cmd/pinned-version-pxe-pve.conf     | 17 ++++++++++ >  test/cfg2cmd/pinned-version-pxe-pve.conf.cmd | 33 ++++++++++++++++++++ >  test/cfg2cmd/pinned-version-pxe.conf         | 15 +++++++++ >  test/cfg2cmd/pinned-version-pxe.conf.cmd     | 31 ++++++++++++++++++ >  6 files changed, 106 insertions(+), 3 deletions(-) >  create mode 100644 test/cfg2cmd/pinned-version-pxe-pve.conf >  create mode 100644 test/cfg2cmd/pinned-version-pxe-pve.conf.cmd >  create mode 100644 test/cfg2cmd/pinned-version-pxe.conf >  create mode 100644 test/cfg2cmd/pinned-version-pxe.conf.cmd > > diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm > index 8c483e6..333d455 100644 > --- a/PVE/QemuServer.pm > +++ b/PVE/QemuServer.pm > @@ -2942,10 +2942,15 @@ sub get_vm_machine { >         } >      } >   > -    if ($add_pve_version && $machine !~ m/\+pve\d+$/) { > +    if ($add_pve_version && $machine !~ m/\+pve\d+?(?:\.pxe)?$/) { > +       my $is_pxe = $machine =~ m/^(.*?)\.pxe$/; > +       $machine = $1 if $is_pxe; > + >         # for version-pinned machines that do not include a pve-version > (e.g. >         # pc-q35-4.1), we assume 0 to keep them stable in case we bump >         $machine .= '+pve0'; > + > +       $machine .= '.pxe' if $is_pxe; >      } >   >      return $machine; > diff --git a/PVE/QemuServer/Machine.pm b/PVE/QemuServer/Machine.pm > index 0d17891..d9429ed 100644 > --- a/PVE/QemuServer/Machine.pm > +++ b/PVE/QemuServer/Machine.pm > @@ -49,7 +49,9 @@ sub get_current_qemu_machine { >  sub extract_version { >      my ($machine_type, $kvmversion) = @_; >   > -    if (defined($machine_type) && $machine_type =~ m/^(?:pc(?:- > i440fx|-q35)?|virt)-(\d+)\.(\d+)(?:\.(\d+))?(\+pve\d+)?/) { > +    if (defined($machine_type) && $machine_type =~ > +       m/^(?:pc(?:-i440fx|-q35)?|virt)- > (\d+)\.(\d+)(?:\.(\d+))?(\+pve\d+)?(?:\.pxe)?/) > +    { >         my $versionstr = "$1.$2"; >         $versionstr .= $4 if $4; >         return $versionstr; > @@ -83,7 +85,7 @@ sub get_pve_version { >  sub can_run_pve_machine_version { >      my ($machine_version, $kvmversion) = @_; >   > -    $machine_version =~ m/^(\d+)\.(\d+)(?:\+pve(\d+))?$/; > +    $machine_version =~ m/^(\d+)\.(\d+)(?:\+pve(\d+))?(?:\.pxe)?$/; >      my $major = $1; >      my $minor = $2; >      my $pvever = $3; > diff --git a/test/cfg2cmd/pinned-version-pxe-pve.conf > b/test/cfg2cmd/pinned-version-pxe-pve.conf > new file mode 100644 > index 0000000..36169d7 > --- /dev/null > +++ b/test/cfg2cmd/pinned-version-pxe-pve.conf > @@ -0,0 +1,17 @@ > +# TEST: for a basic configuration with a .pxe machine and +pve pinned > +bootdisk: scsi0 > +cores: 3 > +ide2: none,media=cdrom > +machine: pc-q35-4.1+pve2.pxe > +memory: 1024 > +name: pinned > +net0: virtio=A2:C0:43:77:08:A1,bridge=vmbr0 > +numa: 0 > +ostype: l26 > +scsi0: local:8006/vm-8006-disk-0.raw,discard=on,size=104858K > +scsihw: virtio-scsi-pci > +smbios1: uuid=c7fdd046-fefc-11e9-832e-770e1d5636a0 > +sockets: 1 > +vmgenid: bdd46b98-fefc-11e9-97b4-d72c378e0f96 > +# add rng0 to stress +pve2 version requirement > +rng0: source=/dev/urandom > diff --git a/test/cfg2cmd/pinned-version-pxe-pve.conf.cmd > b/test/cfg2cmd/pinned-version-pxe-pve.conf.cmd > new file mode 100644 > index 0000000..28b8b23 > --- /dev/null > +++ b/test/cfg2cmd/pinned-version-pxe-pve.conf.cmd > @@ -0,0 +1,33 @@ > +/usr/bin/kvm \ > +  -id 8006 \ > +  -name pinned \ > +  -no-shutdown \ > +  -chardev 'socket,id=qmp,path=/var/run/qemu- > server/8006.qmp,server,nowait' \ > +  -mon 'chardev=qmp,mode=control' \ > +  -chardev 'socket,id=qmp- > event,path=/var/run/qmeventd.sock,reconnect=5' \ > +  -mon 'chardev=qmp-event,mode=control' \ > +  -pidfile /var/run/qemu-server/8006.pid \ > +  -daemonize \ > +  -smbios 'type=1,uuid=c7fdd046-fefc-11e9-832e-770e1d5636a0' \ > +  -smp '3,sockets=1,cores=3,maxcpus=3' \ > +  -nodefaults \ > +  -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu- > server/bootsplash.jpg' \ > +  -vnc unix:/var/run/qemu-server/8006.vnc,password \ > +  -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \ > +  -m 1024 \ > +  -readconfig /usr/share/qemu-server/pve-q35-4.0.cfg \ > +  -device 'vmgenid,guid=bdd46b98-fefc-11e9-97b4-d72c378e0f96' \ > +  -device 'usb-tablet,id=tablet,bus=ehci.0,port=1' \ > +  -device 'VGA,id=vga,bus=pcie.0,addr=0x1' \ > +  -object 'rng-random,filename=/dev/urandom,id=rng0' \ > +  -device 'virtio-rng-pci,rng=rng0,max- > bytes=1024,period=1000,bus=pci.1,addr=0x1d' \ > +  -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' \ > +  -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \ > +  -drive 'if=none,id=drive-ide2,media=cdrom,aio=threads' \ > +  -device 'ide-cd,bus=ide.1,unit=0,drive=drive- > ide2,id=ide2,bootindex=200' \ > +  -device 'virtio-scsi-pci,id=scsihw0,bus=pci.0,addr=0x5' \ > +  -drive 'file=/var/lib/vz/images/8006/vm-8006-disk- > 0.raw,if=none,id=drive- > scsi0,discard=on,format=raw,cache=none,aio=native,detect-zeroes=unmap' > \ > +  -device 'scsi-hd,bus=scsihw0.0,channel=0,scsi- > id=0,lun=0,drive=drive-scsi0,id=scsi0,bootindex=100' \ > +  -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:A1,netdev=net0,bus=pci.0,addr=0x12,id=net0,booti > ndex=300,romfile=pxe-virtio.rom' \ > +  -machine 'type=pc-q35-4.1+pve2' > diff --git a/test/cfg2cmd/pinned-version-pxe.conf > b/test/cfg2cmd/pinned-version-pxe.conf > new file mode 100644 > index 0000000..738868f > --- /dev/null > +++ b/test/cfg2cmd/pinned-version-pxe.conf > @@ -0,0 +1,15 @@ > +# TEST: for a basic configuration with a .pxe machine > +bootdisk: scsi0 > +cores: 3 > +ide2: none,media=cdrom > +machine: pc-q35-5.1.pxe > +memory: 1024 > +name: pinned > +net0: virtio=A2:C0:43:77:08:A1,bridge=vmbr0 > +numa: 0 > +ostype: l26 > +scsi0: local:8006/vm-8006-disk-0.raw,discard=on,size=104858K > +scsihw: virtio-scsi-pci > +smbios1: uuid=c7fdd046-fefc-11e9-832e-770e1d5636a0 > +sockets: 1 > +vmgenid: bdd46b98-fefc-11e9-97b4-d72c378e0f96 > diff --git a/test/cfg2cmd/pinned-version-pxe.conf.cmd > b/test/cfg2cmd/pinned-version-pxe.conf.cmd > new file mode 100644 > index 0000000..ceb5473 > --- /dev/null > +++ b/test/cfg2cmd/pinned-version-pxe.conf.cmd > @@ -0,0 +1,31 @@ > +/usr/bin/kvm \ > +  -id 8006 \ > +  -name pinned \ > +  -no-shutdown \ > +  -chardev 'socket,id=qmp,path=/var/run/qemu- > server/8006.qmp,server,nowait' \ > +  -mon 'chardev=qmp,mode=control' \ > +  -chardev 'socket,id=qmp- > event,path=/var/run/qmeventd.sock,reconnect=5' \ > +  -mon 'chardev=qmp-event,mode=control' \ > +  -pidfile /var/run/qemu-server/8006.pid \ > +  -daemonize \ > +  -smbios 'type=1,uuid=c7fdd046-fefc-11e9-832e-770e1d5636a0' \ > +  -smp '3,sockets=1,cores=3,maxcpus=3' \ > +  -nodefaults \ > +  -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu- > server/bootsplash.jpg' \ > +  -vnc unix:/var/run/qemu-server/8006.vnc,password \ > +  -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \ > +  -m 1024 \ > +  -readconfig /usr/share/qemu-server/pve-q35-4.0.cfg \ > +  -device 'vmgenid,guid=bdd46b98-fefc-11e9-97b4-d72c378e0f96' \ > +  -device 'usb-tablet,id=tablet,bus=ehci.0,port=1' \ > +  -device 'VGA,id=vga,bus=pcie.0,addr=0x1' \ > +  -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' \ > +  -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \ > +  -drive 'if=none,id=drive-ide2,media=cdrom,aio=threads' \ > +  -device 'ide-cd,bus=ide.1,unit=0,drive=drive- > ide2,id=ide2,bootindex=200' \ > +  -device 'virtio-scsi-pci,id=scsihw0,bus=pci.0,addr=0x5' \ > +  -drive 'file=/var/lib/vz/images/8006/vm-8006-disk- > 0.raw,if=none,id=drive- > scsi0,discard=on,format=raw,cache=none,aio=native,detect-zeroes=unmap' > \ > +  -device 'scsi-hd,bus=scsihw0.0,channel=0,scsi- > id=0,lun=0,drive=drive-scsi0,id=scsi0,bootindex=100' \ > +  -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:A1,netdev=net0,bus=pci.0,addr=0x12,id=net0,booti > ndex=300,romfile=pxe-virtio.rom' \ > +  -machine 'type=pc-q35-5.1+pve0'