From: Daniel Herzig <d.herzig@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server 9/12] test: cfg2cmd: add tests for testing the iso required parameter
Date: Fri, 25 Oct 2024 17:02:40 +0200 [thread overview]
Message-ID: <20241025150243.134466-10-d.herzig@proxmox.com> (raw)
In-Reply-To: <20241025150243.134466-1-d.herzig@proxmox.com>
This adds tests for the errors and warnings issued by
PVE::QemuServer::eject_unrequired_isos.
Empty cmd files were added for the test configurations that are not
expected to have any output (as they die before a command is prepared):
* ide-required-iso-missing.conf
* ide-required-iso-offline-nfs.conf
Signed-off-by: Daniel Herzig <d.herzig@proxmox.com>
---
test/cfg2cmd/ide-required-iso-missing.conf | 12 ++++++
.../cfg2cmd/ide-required-iso-missing.conf.cmd | 0
.../cfg2cmd/ide-required-iso-offline-nfs.conf | 12 ++++++
.../ide-required-iso-offline-nfs.conf.cmd | 0
test/cfg2cmd/ide-required.conf | 14 +++++++
test/cfg2cmd/ide-required.conf.cmd | 39 +++++++++++++++++++
test/cfg2cmd/ide-unrequired-iso-missing.conf | 12 ++++++
.../ide-unrequired-iso-missing.conf.cmd | 33 ++++++++++++++++
.../ide-unrequired-iso-offline-nfs.conf | 12 ++++++
.../ide-unrequired-iso-offline-nfs.conf.cmd | 33 ++++++++++++++++
10 files changed, 167 insertions(+)
create mode 100644 test/cfg2cmd/ide-required-iso-missing.conf
create mode 100644 test/cfg2cmd/ide-required-iso-missing.conf.cmd
create mode 100644 test/cfg2cmd/ide-required-iso-offline-nfs.conf
create mode 100644 test/cfg2cmd/ide-required-iso-offline-nfs.conf.cmd
create mode 100644 test/cfg2cmd/ide-required.conf
create mode 100644 test/cfg2cmd/ide-required.conf.cmd
create mode 100644 test/cfg2cmd/ide-unrequired-iso-missing.conf
create mode 100644 test/cfg2cmd/ide-unrequired-iso-missing.conf.cmd
create mode 100644 test/cfg2cmd/ide-unrequired-iso-offline-nfs.conf
create mode 100644 test/cfg2cmd/ide-unrequired-iso-offline-nfs.conf.cmd
diff --git a/test/cfg2cmd/ide-required-iso-missing.conf b/test/cfg2cmd/ide-required-iso-missing.conf
new file mode 100644
index 00000000..16ce79ab
--- /dev/null
+++ b/test/cfg2cmd/ide-required-iso-missing.conf
@@ -0,0 +1,12 @@
+# TEST: Config with default machine type, Linux & one IDE CD-ROM with online storage and missing required ISO file.
+# EXPECT_ERROR: required file does not exist: 'ide0: cifs-store:iso/I_DO_NOT_EXIST.iso'
+bootdisk: scsi0
+cores: 2
+ide0: cifs-store:iso/I_DO_NOT_EXIST.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-required-iso-missing.conf.cmd b/test/cfg2cmd/ide-required-iso-missing.conf.cmd
new file mode 100644
index 00000000..e69de29b
diff --git a/test/cfg2cmd/ide-required-iso-offline-nfs.conf b/test/cfg2cmd/ide-required-iso-offline-nfs.conf
new file mode 100644
index 00000000..47db264d
--- /dev/null
+++ b/test/cfg2cmd/ide-required-iso-offline-nfs.conf
@@ -0,0 +1,12 @@
+# TEST: Config with default machine type, Linux & one IDE CD-ROM with required ISO file on offline storage.
+# EXPECT_ERROR: cannot access required file: 'ide0: nfs-offline:iso/any.iso': storage 'nfs-offline' is not online
+bootdisk: scsi0
+cores: 2
+ide0: nfs-offline:iso/any.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-required-iso-offline-nfs.conf.cmd b/test/cfg2cmd/ide-required-iso-offline-nfs.conf.cmd
new file mode 100644
index 00000000..e69de29b
diff --git a/test/cfg2cmd/ide-required.conf b/test/cfg2cmd/ide-required.conf
new file mode 100644
index 00000000..cf56b724
--- /dev/null
+++ b/test/cfg2cmd/ide-required.conf
@@ -0,0 +1,14 @@
+# TEST: Config with default machine type, Linux & four IDE CD-ROMs marked as required
+bootdisk: scsi0
+cores: 2
+ide0: cifs-store:iso/zero.iso,media=cdrom,size=112M,required=1
+ide1: cifs-store:iso/one.iso,media=cdrom,size=112M,required=1
+ide2: cifs-store:iso/two.iso,media=cdrom,size=112M,required=1
+ide3: cifs-store:iso/three.iso,media=cdrom,size=112M,required=1
+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-required.conf.cmd b/test/cfg2cmd/ide-required.conf.cmd
new file mode 100644
index 00000000..7fd4888c
--- /dev/null
+++ b/test/cfg2cmd/ide-required.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=256,bootindex=300' \
+ -machine 'type=pc+pve0'
diff --git a/test/cfg2cmd/ide-unrequired-iso-missing.conf b/test/cfg2cmd/ide-unrequired-iso-missing.conf
new file mode 100644
index 00000000..d4393772
--- /dev/null
+++ b/test/cfg2cmd/ide-unrequired-iso-missing.conf
@@ -0,0 +1,12 @@
+# TEST: Config with default machine type, Linux & and one IDE CD-ROM with online storage and missing unrequired ISO file.
+# EXPECT_WARN: eject 'ide0: cifs-store:iso/I_DO_NOT_EXIST.iso': file does not exist
+bootdisk: scsi0
+cores: 2
+ide0: cifs-store:iso/I_DO_NOT_EXIST.iso,media=cdrom,size=112M,required=0
+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-unrequired-iso-missing.conf.cmd b/test/cfg2cmd/ide-unrequired-iso-missing.conf.cmd
new file mode 100644
index 00000000..e6efd8a9
--- /dev/null
+++ b/test/cfg2cmd/ide-unrequired-iso-missing.conf.cmd
@@ -0,0 +1,33 @@
+/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 'if=none,id=drive-ide0,media=cdrom,aio=io_uring' \
+ -device 'ide-cd,bus=ide.0,unit=0,drive=drive-ide0,id=ide0,bootindex=200' \
+ -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=256,bootindex=300' \
+ -machine 'type=pc+pve0'
diff --git a/test/cfg2cmd/ide-unrequired-iso-offline-nfs.conf b/test/cfg2cmd/ide-unrequired-iso-offline-nfs.conf
new file mode 100644
index 00000000..c7a59d0d
--- /dev/null
+++ b/test/cfg2cmd/ide-unrequired-iso-offline-nfs.conf
@@ -0,0 +1,12 @@
+# TEST: Config with default machine type, Linux & and one IDE CD-ROM with unrequired ISO file on offline storage.
+# EXPECT_WARN: eject 'ide0: nfs-offline:iso/any.iso': storage 'nfs-offline' is not online
+bootdisk: scsi0
+cores: 2
+ide0: nfs-offline:iso/any.iso,media=cdrom,size=112M,required=0
+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-unrequired-iso-offline-nfs.conf.cmd b/test/cfg2cmd/ide-unrequired-iso-offline-nfs.conf.cmd
new file mode 100644
index 00000000..e6efd8a9
--- /dev/null
+++ b/test/cfg2cmd/ide-unrequired-iso-offline-nfs.conf.cmd
@@ -0,0 +1,33 @@
+/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 'if=none,id=drive-ide0,media=cdrom,aio=io_uring' \
+ -device 'ide-cd,bus=ide.0,unit=0,drive=drive-ide0,id=ide0,bootindex=200' \
+ -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=256,bootindex=300' \
+ -machine 'type=pc+pve0'
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2024-10-25 15:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-25 15:02 [pve-devel] [PATCH qemu-server, manager 0/12] bugzilla #4225 -- improve handling of unavailable ISOs Daniel Herzig
2024-10-25 15:02 ` [pve-devel] [PATCH qemu-server 1/12] fix #4225: qemuserver: drive: add optional required parameter Daniel Herzig
2024-10-25 15:02 ` [pve-devel] [PATCH qemu-server 2/12] qemuserver: add helper function for mocking files Daniel Herzig
2024-10-25 15:02 ` [pve-devel] [PATCH qemu-server 3/12] fix #4225: qemuserver: add function to eject isofiles Daniel Herzig
2024-10-25 15:02 ` [pve-devel] [PATCH qemu-server 4/12] test: chomp all trailing newlines from errors and warnings Daniel Herzig
2024-10-25 15:02 ` [pve-devel] [PATCH qemu-server 5/12] test: mock cifs-store Daniel Herzig
2024-10-25 15:02 ` [pve-devel] [PATCH qemu-server 6/12] test: add nfs-offline storage Daniel Herzig
2024-10-25 15:02 ` [pve-devel] [PATCH qemu-server 7/12] test: mock existing files Daniel Herzig
2024-10-25 15:02 ` [pve-devel] [PATCH qemu-server 8/12] test: mock log_warn warnings Daniel Herzig
2024-10-25 15:02 ` Daniel Herzig [this message]
2024-10-25 15:02 ` [pve-devel] [PATCH manager 10/12] fix #4225: ui: form: isoselector: add optional required checkbox Daniel Herzig
2024-10-25 15:02 ` [pve-devel] [PATCH manager 11/12] fix #4225: ui: qemu: cdedit: enable required checkbox for isos Daniel Herzig
2024-10-25 15:02 ` [pve-devel] [PATCH manager 12/12] ui: qemu: hardware: add eject button for cdroms Daniel Herzig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241025150243.134466-10-d.herzig@proxmox.com \
--to=d.herzig@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox