]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: Handle MODEL_SCSI_{AUTO,DEFAULT} appropriately
authorAndrea Bolognani <abologna@redhat.com>
Fri, 26 Jan 2024 18:40:12 +0000 (19:40 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Thu, 1 Feb 2024 09:37:22 +0000 (10:37 +0100)
commit518e70158babfadb57ee33cd50375538f2f1c112
tree7b40698ada4b7b49f3c247c20f39d1d09b5aef3b
parent0d095c6d47dce854af07278ed5ec7062222eca2c
qemu: Handle MODEL_SCSI_{AUTO,DEFAULT} appropriately

The qemuDomainGetSCSIControllerModel() function, which is
responsible for choosing a model for a SCSI controller that
didn't have one provided by the user, considers values >0 to
mean "model has been set".

Since MODEL_SCSI_AUTO == 0, this means that such a value is
considered the same as MODEL_SCSI_DEFAULT (-1). This makes
sense, as not specifying a model name or explicitly asking for
one to be automatically chosen intuitively should result in
the same behavior.

Specifically, there is no case in which a value of
MODEL_SCSI_AUTO or MODEL_SCSI_DEFAULT is encountered after the
initial controller creation: it is either replaced with an
actual model, or an error is raised.

Despite this, there are a few places in the QEMU driver where
we incorrectly treat these values as if they were actual
model names. To reduce confusion, make sure that no longer
happens.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
src/qemu/qemu_command.c
src/qemu/qemu_domain_address.c
src/qemu/qemu_validate.c