public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu-server 1/2] test: add tests with multiple IDE CD-ROM drives
@ 2023-07-20  9:45 Fiona Ebner
  2023-07-20  9:45 ` [pve-devel] [PATCH qemu-server 2/2] fix #4620: cfg2cmd: drive device: correctly handle IDE for q35 Fiona Ebner
  2023-07-20 14:52 ` [pve-devel] applied: [PATCH qemu-server 1/2] test: add tests with multiple IDE CD-ROM drives Thomas Lamprecht
  0 siblings, 2 replies; 4+ messages in thread
From: Fiona Ebner @ 2023-07-20  9:45 UTC (permalink / raw)
  To: pve-devel

None of the configured test storages support the content type iso
right now, just add it to cifs-store.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 test/cfg2cmd/ide.conf            | 14 ++++++++++++
 test/cfg2cmd/ide.conf.cmd        | 39 ++++++++++++++++++++++++++++++++
 test/cfg2cmd/q35-ide.conf        | 15 ++++++++++++
 test/cfg2cmd/q35-ide.conf.cmd    | 38 +++++++++++++++++++++++++++++++
 test/run_config2command_tests.pl |  3 ++-
 5 files changed, 108 insertions(+), 1 deletion(-)
 create mode 100644 test/cfg2cmd/ide.conf
 create mode 100644 test/cfg2cmd/ide.conf.cmd
 create mode 100644 test/cfg2cmd/q35-ide.conf
 create mode 100644 test/cfg2cmd/q35-ide.conf.cmd

diff --git a/test/cfg2cmd/ide.conf b/test/cfg2cmd/ide.conf
new file mode 100644
index 00000000..0c48aac8
--- /dev/null
+++ b/test/cfg2cmd/ide.conf
@@ -0,0 +1,14 @@
+# TEST: Config with default machine type, Linux & four IDE CD-ROMs
+bootdisk: scsi0
+cores: 2
+ide0: cifs-store:iso/zero.iso,media=cdrom,size=112M
+ide1: cifs-store:iso/one.iso,media=cdrom,size=112M
+ide2: cifs-store:iso/two.iso,media=cdrom,size=112M
+ide3: cifs-store:iso/three.iso,media=cdrom,size=112M
+memory: 512
+net0: virtio=2E:01:68:F9:9C:87,bridge=vmbr0
+ostype: l26
+scsi0: local:100/vm-100-disk-2.qcow2,size=10G
+scsihw: virtio-scsi-pci
+smbios1: uuid=3dd750ce-d910-44d0-9493-525c0be4e687
+vmgenid: 54d1c06c-8f5b-440f-b5b2-6eab1380e13d
diff --git a/test/cfg2cmd/ide.conf.cmd b/test/cfg2cmd/ide.conf.cmd
new file mode 100644
index 00000000..ebe9bf63
--- /dev/null
+++ b/test/cfg2cmd/ide.conf.cmd
@@ -0,0 +1,39 @@
+/usr/bin/kvm \
+  -id 8006 \
+  -name 'vm8006,debug-threads=on' \
+  -no-shutdown \
+  -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \
+  -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=3dd750ce-d910-44d0-9493-525c0be4e687' \
+  -smp '2,sockets=1,cores=2,maxcpus=2' \
+  -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=on' \
+  -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \
+  -m 512 \
+  -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' \
+  -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' \
+  -device 'vmgenid,guid=54d1c06c-8f5b-440f-b5b2-6eab1380e13d' \
+  -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' \
+  -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' \
+  -device 'VGA,id=vga,bus=pci.0,addr=0x2' \
+  -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3,free-page-reporting=on' \
+  -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \
+  -drive 'file=/mnt/pve/cifs-store/template/iso/zero.iso,if=none,id=drive-ide0,media=cdrom,aio=threads' \
+  -device 'ide-cd,bus=ide.0,unit=0,drive=drive-ide0,id=ide0,bootindex=200' \
+  -drive 'file=/mnt/pve/cifs-store/template/iso/one.iso,if=none,id=drive-ide1,media=cdrom,aio=threads' \
+  -device 'ide-cd,bus=ide.0,unit=1,drive=drive-ide1,id=ide1,bootindex=201' \
+  -drive 'file=/mnt/pve/cifs-store/template/iso/two.iso,if=none,id=drive-ide2,media=cdrom,aio=threads' \
+  -device 'ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2,bootindex=202' \
+  -drive 'file=/mnt/pve/cifs-store/template/iso/three.iso,if=none,id=drive-ide3,media=cdrom,aio=threads' \
+  -device 'ide-cd,bus=ide.1,unit=1,drive=drive-ide3,id=ide3,bootindex=203' \
+  -device 'virtio-scsi-pci,id=scsihw0,bus=pci.0,addr=0x5' \
+  -drive 'file=/var/lib/vz/images/100/vm-100-disk-2.qcow2,if=none,id=drive-scsi0,format=qcow2,cache=none,aio=io_uring,detect-zeroes=on' \
+  -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=2E:01:68:F9:9C:87,netdev=net0,bus=pci.0,addr=0x12,id=net0,rx_queue_size=1024,tx_queue_size=1024,bootindex=300' \
+  -machine 'type=pc+pve0'
diff --git a/test/cfg2cmd/q35-ide.conf b/test/cfg2cmd/q35-ide.conf
new file mode 100644
index 00000000..bfef0a14
--- /dev/null
+++ b/test/cfg2cmd/q35-ide.conf
@@ -0,0 +1,15 @@
+# TEST: Config with q35, Linux & four IDE CD-ROMs
+bootdisk: scsi0
+cores: 2
+ide0: cifs-store:iso/zero.iso,media=cdrom,size=112M
+ide1: cifs-store:iso/one.iso,media=cdrom,size=112M
+ide2: cifs-store:iso/two.iso,media=cdrom,size=112M
+ide3: cifs-store:iso/three.iso,media=cdrom,size=112M
+machine: q35
+memory: 512
+net0: virtio=2E:01:68:F9:9C:87,bridge=vmbr0
+ostype: l26
+scsi0: local:100/vm-100-disk-2.qcow2,size=10G
+scsihw: virtio-scsi-pci
+smbios1: uuid=3dd750ce-d910-44d0-9493-525c0be4e687
+vmgenid: 54d1c06c-8f5b-440f-b5b2-6eab1380e13d
diff --git a/test/cfg2cmd/q35-ide.conf.cmd b/test/cfg2cmd/q35-ide.conf.cmd
new file mode 100644
index 00000000..7755fdb0
--- /dev/null
+++ b/test/cfg2cmd/q35-ide.conf.cmd
@@ -0,0 +1,38 @@
+/usr/bin/kvm \
+  -id 8006 \
+  -name 'vm8006,debug-threads=on' \
+  -no-shutdown \
+  -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \
+  -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=3dd750ce-d910-44d0-9493-525c0be4e687' \
+  -global 'ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off' \
+  -smp '2,sockets=1,cores=2,maxcpus=2' \
+  -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=on' \
+  -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \
+  -m 512 \
+  -readconfig /usr/share/qemu-server/pve-q35-4.0.cfg \
+  -device 'vmgenid,guid=54d1c06c-8f5b-440f-b5b2-6eab1380e13d' \
+  -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,free-page-reporting=on' \
+  -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \
+  -drive 'file=/mnt/pve/cifs-store/template/iso/zero.iso,if=none,id=drive-ide0,media=cdrom,aio=threads' \
+  -device 'ide-cd,bus=ide.0,unit=0,drive=drive-ide0,id=ide0,bootindex=200' \
+  -drive 'file=/mnt/pve/cifs-store/template/iso/one.iso,if=none,id=drive-ide1,media=cdrom,aio=threads' \
+  -device 'ide-cd,bus=ide.0,unit=1,drive=drive-ide1,id=ide1,bootindex=201' \
+  -drive 'file=/mnt/pve/cifs-store/template/iso/two.iso,if=none,id=drive-ide2,media=cdrom,aio=threads' \
+  -device 'ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2,bootindex=202' \
+  -drive 'file=/mnt/pve/cifs-store/template/iso/three.iso,if=none,id=drive-ide3,media=cdrom,aio=threads' \
+  -device 'ide-cd,bus=ide.1,unit=1,drive=drive-ide3,id=ide3,bootindex=203' \
+  -device 'virtio-scsi-pci,id=scsihw0,bus=pci.0,addr=0x5' \
+  -drive 'file=/var/lib/vz/images/100/vm-100-disk-2.qcow2,if=none,id=drive-scsi0,format=qcow2,cache=none,aio=io_uring,detect-zeroes=on' \
+  -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=2E:01:68:F9:9C:87,netdev=net0,bus=pci.0,addr=0x12,id=net0,rx_queue_size=1024,tx_queue_size=1024,bootindex=300' \
+  -machine 'type=q35+pve0'
diff --git a/test/run_config2command_tests.pl b/test/run_config2command_tests.pl
index 08718549..7212acc4 100755
--- a/test/run_config2command_tests.pl
+++ b/test/run_config2command_tests.pl
@@ -45,7 +45,8 @@ my $base_env = {
 		type => 'cifs',
 		share => 'CIFShare',
 		content => {
-		    images => 1
+		    images => 1,
+		    iso => 1,
 		},
 	    },
 	    'rbd-store' => {
-- 
2.39.2





^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] [PATCH qemu-server 2/2] fix #4620: cfg2cmd: drive device: correctly handle IDE for q35
  2023-07-20  9:45 [pve-devel] [PATCH qemu-server 1/2] test: add tests with multiple IDE CD-ROM drives Fiona Ebner
@ 2023-07-20  9:45 ` Fiona Ebner
  2023-07-20 14:53   ` [pve-devel] applied: " Thomas Lamprecht
  2023-07-20 14:52 ` [pve-devel] applied: [PATCH qemu-server 1/2] test: add tests with multiple IDE CD-ROM drives Thomas Lamprecht
  1 sibling, 1 reply; 4+ messages in thread
From: Fiona Ebner @ 2023-07-20  9:45 UTC (permalink / raw)
  To: pve-devel

Only unit 0 for IDE is supported with machine type q35. Currently,
QEMU will fail startup with machine type q35 with an error like
> Can't create IDE unit 1, bus supports only 1 units
when ide1 or ide3 is configured.

Make sure to keep backwards compat form migration by leaving ide0 and
ide2 fixed. Since starting with ide1 or ide3 never worked, they can be
moved to a controller with a higher ID without issue.

Reported in the community forum:
https://forum.proxmox.com/threads/124615/post-543127
https://forum.proxmox.com/threads/130815/

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---

For PVE 9, we could simplify the mapping to N -> controller=N,unit=0
while version guarding with running QEMU machine version. Might be
slightly nicer, but it'd add an extra conditional, so probably not
worth it.

 PVE/QemuServer.pm             | 11 +++++++++++
 test/cfg2cmd/q35-ide.conf.cmd |  4 ++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 430661a7..aff33728 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -1521,6 +1521,17 @@ sub print_drivedevice_full {
 	my $maxdev = ($drive->{interface} eq 'sata') ? $PVE::QemuServer::Drive::MAX_SATA_DISKS : 2;
 	my $controller = int($drive->{index} / $maxdev);
 	my $unit = $drive->{index} % $maxdev;
+
+	# machine type q35 only supports unit=0 for IDE rather than 2 units. This wasn't handled
+	# correctly before, so e.g. index=2 was mapped to controller=1,unit=0 rather than
+	# controller=2,unit=0. Note that odd indices never worked, as they would be mapped to
+	# unit=1, so to keep backwards compat for migration, it suffices to keep even ones as they
+	# were before. Move odd ones up by 2 where they don't clash.
+	if (PVE::QemuServer::Machine::machine_type_is_q35($conf) && $drive->{interface} eq 'ide') {
+	    $controller += 2 * ($unit % 2);
+	    $unit = 0;
+	}
+
 	my $devicetype = ($drive->{media} && $drive->{media} eq 'cdrom') ? "cd" : "hd";
 
 	$device = "ide-$devicetype";
diff --git a/test/cfg2cmd/q35-ide.conf.cmd b/test/cfg2cmd/q35-ide.conf.cmd
index 7755fdb0..f23d90f3 100644
--- a/test/cfg2cmd/q35-ide.conf.cmd
+++ b/test/cfg2cmd/q35-ide.conf.cmd
@@ -25,11 +25,11 @@
   -drive 'file=/mnt/pve/cifs-store/template/iso/zero.iso,if=none,id=drive-ide0,media=cdrom,aio=threads' \
   -device 'ide-cd,bus=ide.0,unit=0,drive=drive-ide0,id=ide0,bootindex=200' \
   -drive 'file=/mnt/pve/cifs-store/template/iso/one.iso,if=none,id=drive-ide1,media=cdrom,aio=threads' \
-  -device 'ide-cd,bus=ide.0,unit=1,drive=drive-ide1,id=ide1,bootindex=201' \
+  -device 'ide-cd,bus=ide.2,unit=0,drive=drive-ide1,id=ide1,bootindex=201' \
   -drive 'file=/mnt/pve/cifs-store/template/iso/two.iso,if=none,id=drive-ide2,media=cdrom,aio=threads' \
   -device 'ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2,bootindex=202' \
   -drive 'file=/mnt/pve/cifs-store/template/iso/three.iso,if=none,id=drive-ide3,media=cdrom,aio=threads' \
-  -device 'ide-cd,bus=ide.1,unit=1,drive=drive-ide3,id=ide3,bootindex=203' \
+  -device 'ide-cd,bus=ide.3,unit=0,drive=drive-ide3,id=ide3,bootindex=203' \
   -device 'virtio-scsi-pci,id=scsihw0,bus=pci.0,addr=0x5' \
   -drive 'file=/var/lib/vz/images/100/vm-100-disk-2.qcow2,if=none,id=drive-scsi0,format=qcow2,cache=none,aio=io_uring,detect-zeroes=on' \
   -device 'scsi-hd,bus=scsihw0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0,id=scsi0,bootindex=100' \
-- 
2.39.2





^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] applied: [PATCH qemu-server 1/2] test: add tests with multiple IDE CD-ROM drives
  2023-07-20  9:45 [pve-devel] [PATCH qemu-server 1/2] test: add tests with multiple IDE CD-ROM drives Fiona Ebner
  2023-07-20  9:45 ` [pve-devel] [PATCH qemu-server 2/2] fix #4620: cfg2cmd: drive device: correctly handle IDE for q35 Fiona Ebner
@ 2023-07-20 14:52 ` Thomas Lamprecht
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2023-07-20 14:52 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fiona Ebner

On 20/07/2023 11:45, Fiona Ebner wrote:
> None of the configured test storages support the content type iso
> right now, just add it to cifs-store.
> 
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
>  test/cfg2cmd/ide.conf            | 14 ++++++++++++
>  test/cfg2cmd/ide.conf.cmd        | 39 ++++++++++++++++++++++++++++++++
>  test/cfg2cmd/q35-ide.conf        | 15 ++++++++++++
>  test/cfg2cmd/q35-ide.conf.cmd    | 38 +++++++++++++++++++++++++++++++
>  test/run_config2command_tests.pl |  3 ++-
>  5 files changed, 108 insertions(+), 1 deletion(-)
>  create mode 100644 test/cfg2cmd/ide.conf
>  create mode 100644 test/cfg2cmd/ide.conf.cmd
>  create mode 100644 test/cfg2cmd/q35-ide.conf
>  create mode 100644 test/cfg2cmd/q35-ide.conf.cmd
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] applied: [PATCH qemu-server 2/2] fix #4620: cfg2cmd: drive device: correctly handle IDE for q35
  2023-07-20  9:45 ` [pve-devel] [PATCH qemu-server 2/2] fix #4620: cfg2cmd: drive device: correctly handle IDE for q35 Fiona Ebner
@ 2023-07-20 14:53   ` Thomas Lamprecht
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2023-07-20 14:53 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fiona Ebner

On 20/07/2023 11:45, Fiona Ebner wrote:
> Only unit 0 for IDE is supported with machine type q35. Currently,
> QEMU will fail startup with machine type q35 with an error like
>> Can't create IDE unit 1, bus supports only 1 units
> when ide1 or ide3 is configured.
> 
> Make sure to keep backwards compat form migration by leaving ide0 and
> ide2 fixed. Since starting with ide1 or ide3 never worked, they can be
> moved to a controller with a higher ID without issue.
> 
> Reported in the community forum:
> https://forum.proxmox.com/threads/124615/post-543127
> https://forum.proxmox.com/threads/130815/
> 
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
> 
> For PVE 9, we could simplify the mapping to N -> controller=N,unit=0
> while version guarding with running QEMU machine version. Might be
> slightly nicer, but it'd add an extra conditional, so probably not
> worth it.
> 
>  PVE/QemuServer.pm             | 11 +++++++++++
>  test/cfg2cmd/q35-ide.conf.cmd |  4 ++--
>  2 files changed, 13 insertions(+), 2 deletions(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-20 14:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-20  9:45 [pve-devel] [PATCH qemu-server 1/2] test: add tests with multiple IDE CD-ROM drives Fiona Ebner
2023-07-20  9:45 ` [pve-devel] [PATCH qemu-server 2/2] fix #4620: cfg2cmd: drive device: correctly handle IDE for q35 Fiona Ebner
2023-07-20 14:53   ` [pve-devel] applied: " Thomas Lamprecht
2023-07-20 14:52 ` [pve-devel] applied: [PATCH qemu-server 1/2] test: add tests with multiple IDE CD-ROM drives Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal