libvirt/tests/qemuxml2argvdata/shmem-invalid-size.x86_64-latest.err
Peter Krempa 7dd3d77940 qemu: Move 'shmem' device size validation to qemu_validate
The 'size' of a 'shmem' device is parsed and formatted as a "scaled"
value, stored in bytes, but the formatting scale is mebibytes. This
precission loss combined with the fact that the value was validated only
when starting and the size is formatted only when non-zero meant that
on first parse a value < 1 MiB would be accepted, but would be formatted
to the XML as 0 MiB as it was non-zero but truncated and a subsequent
parse would parse of such XML would parse it as 0 bytes, which in turn
would be interpreted as 'default' size.

Fix the issue by moving the validator, which ensures that the number is
a power of two and more than 1 MiB to the validator code so that it'll
be rejected at XML parsing time.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-01-17 17:31:12 +01:00

2 lines
73 B
Plaintext

XML error: shmem size must be a power of 2 and at least 1 MiB (1024 KiB)