[libvirt] [PATCH v5 02/16] qemu: Introduce qemuDomainDeviceDefValidateControllerAttributes

Michal Privoznik mprivozn at redhat.com
Sun Jan 28 08:48:19 UTC 2018


On 01/06/2018 12:47 AM, John Ferlan wrote:
> Move the checks that various attributes are not set on any controller
> other than SCSI controller using virtio-scsi model into the common
> controller validate checks.
> 
> Need to also add a qemuDomainResetSCSIControllerModel call in order
> to ensure we get the "right" SCSI model if it's not set by default
> since it wouldn't be set during post parse processing.
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  src/qemu/qemu_command.c | 24 ------------------------
>  src/qemu/qemu_domain.c  | 41 +++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 41 insertions(+), 24 deletions(-)


The only problem I have with this approach is that while previously
we've checked for QEMU caps at domain start time, now we check for them
at define time. So I guess in general it's not a safe thing to do.

For instance, I'd be against moving all checks done at cmd line time to
DefPostParse as they introduce TOCTOU problem. However, some checks
(mostly semantic ones) can be done in post parse callbacks. For example,
trying to plug a disk onto ISA bus will fail regardless of qemu caps.
However, whether qemu supports VIRTIO_SCSI or not should not matter at
define time as this might change after domain is defined.

However, SCSI controllers have been around for quite some time, so
unless somebody is upgrading from ancient qemu, we are safe.

ACK

Michal




More information about the libvir-list mailing list