On 5/28/26 21:36, Denis V. Lunev wrote:
virDomainDefMaybeAddHostdevSCSIcontroller() already inherits the model of an existing SCSI controller when auto-adding peers driven by a hostdev whose drive address overflows the highest declared idx. virDomainDefAddDiskControllersForType(), called for the disk-driven analogue, does not -- it passes model=-1 unconditionally. The unspecified peers then arrive at qemuDomainDefaultSCSIControllerModel() and pick up whichever model the capability cascade settles on (typically lsilogic). A user-declared virtio-scsi controller at idx 0 ends up alongside auto-added lsilogic peers at idx 1+.
Plug the same inheritance into qemuDomainDefaultSCSIControllerModel() itself so it covers both the disk-driven path and any other caller that arrives with an unresolved model. The function already prefers architectural defaults (PSeries, ARM virt, RISC-V virt, LoongArch, s390, built-in ESP) over capabilities; peer inheritance slots in just before the capability cascade. A virtio-scsi domain keeps the new peers as virtio-scsi; an lsisas1068 domain stays lsisas1068; a fresh domain with no SCSI controllers still gets the cap-driven default. controller-scsi-auto, the only existing test that flows through this helper, is unaffected (it has no peers to inherit from). controller-scsi-inherit-model covers the new behavior.
Signed-off-by: Denis V. Lunev <den@openvz.org> --- src/qemu/qemu_domain.c | 15 +++++++ ...ller-scsi-inherit-model.x86_64-latest.args | 38 ++++++++++++++++ ...oller-scsi-inherit-model.x86_64-latest.xml | 45 +++++++++++++++++++ .../controller-scsi-inherit-model.xml | 20 +++++++++ tests/qemuxmlconftest.c | 1 + 5 files changed, 119 insertions(+) create mode 100644 tests/qemuxmlconfdata/controller-scsi-inherit-model.x86_64-latest.args create mode 100644 tests/qemuxmlconfdata/controller-scsi-inherit-model.x86_64-latest.xml create mode 100644 tests/qemuxmlconfdata/controller-scsi-inherit-model.xml
Reviewed-by: Michal Privoznik <mprivozn@redhat.com> and merged. Michal