Re: [PATCH] qemu_block: Validate number of hosts for iSCSI disk device

On Thu, Jun 06, 2024 at 16:17:41 +0530, Rayhan Faizel wrote:
Hi,
Hi, please *always* keep replies on-list (use reply-all). I've re-added the mailing list again.
On Thu, Jun 6, 2024 at 4:12 PM Peter Krempa <pkrempa@redhat.com> wrote:
On Thu, Jun 06, 2024 at 15:45:16 +0530, Rayhan Faizel wrote:
An iSCSI device with zero hosts will result in a segmentation fault. This patch adds a check for the number of hosts, which must be one in the case of iSCSI.
Minimal reproducing XML:
<domain type='qemu'> <name>MyGuest</name> <uuid>4dea22b3-1d52-d8f3-2516-782e98ab3fa0</uuid> <os> <type arch='x86_64'>hvm</type> </os> <memory>4096</memory> <devices> <disk type='network'> <source name='dummy' protocol='iscsi'/> <target dev='vda'/> </disk> </devices> </domain>
Please transform this bit into a test case in qemuxmlconftest to see that it's properly rejected.
I did try to add a testcase but the schema tests fail on this particular XML because it expects one or more <hosts>. Is there a way to exclude schema validation for certain testcases or should I just modify the schema and change it from oneOrMore to zeroOrMore?
Schema test result can be inverted by naming the file with '-invalid.xml' suffix. In such case the test will require that the XML has invalid schema. Additionally it's also possible by adding an exception in virschematest, but we have more than a few tests with the suffix in qemuxmlconftest.
participants (1)
-
Peter Krempa