On Tue, Aug 19, 2025 at 18:22:29 +0200, Andrea Bolognani via Devel wrote: > In addition to the code in qemuDomainControllerDefPostParse(), > which we have just factored into its own function, we also have > some code in qemuDomainDefAddDefaultDevices() that deals with > choosing the USB controller model for a couple of specific > machine types. > > Once again, extract the logic to a dedicated helper. The > behavior is unchanged. > > Signed-off-by: Andrea Bolognani <abolo...@redhat.com> > --- > src/qemu/qemu_domain.c | 57 +++++++++++++++++++++++++++++++++++++++ > src/qemu/qemu_domain.h | 2 ++ > src/qemu/qemu_postparse.c | 27 +++++++------------ > 3 files changed, 69 insertions(+), 17 deletions(-) > > diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c > index f03624eda8..639506d22a 100644 > --- a/src/qemu/qemu_domain.c > +++ b/src/qemu/qemu_domain.c > @@ -4376,6 +4376,63 @@ qemuDomainDefaultUSBControllerModel(const virDomainDef > *def, > } > > > +/** > + * qemuDomainDefaultUSBControllerModelAutoAdded: > + * @def: domain definition > + * @qemuCaps: QEMU capabilities, or NULL > + * > + * Choose a reasonable model to use for a USB controller that is > + * being automatically added to a domain. > + * > + * The choice is based on a number of factors, including the guest's > + * architecture and machine type. @qemuCaps, if provided, might be > + * taken into consideration too.
Same comment about qemuCaps as in prior commit. Reviewed-by: Peter Krempa <pkre...@redhat.com>