On 07/31/2013 10:14 PM, Cole Robinson wrote: > Preferably what we'd do is not add any USB controller by default, > but that goes against how the QEMU driver has historically acted for > other architectures, so let's be consistent. > --- > src/conf/domain_conf.c | 18 ++++++++++++++++-- > 1 file changed, 16 insertions(+), 2 deletions(-) > > diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c > index e3aec69..2308580 100644 > --- a/src/conf/domain_conf.c > +++ b/src/conf/domain_conf.c > @@ -8801,6 +8801,16 @@ virDomainVideoDefaultRAM(virDomainDefPtr def, > } > } > > +static int > +virDomainDefaultUSBControllerModel(virDomainDefPtr def) > +{ > + /* Not entirely true, some ARM boards actually can support USB, > + * and even versatilepb supports the pci-ohci > + */ > + if (def->os.arch == VIR_ARCH_ARMV7L) > + return VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE; > + return -1; > +} > We've been trying to put arch-specific stuff like this in the post-parse callbacks that are defined in the hypervisors (e.g. qemuDomainDefPostParse(), qemuDomainDeviceDefPostParse(), and bits in qemu_command.c) rather than in the parser itself. > int > virDomainVideoDefaultType(virDomainDefPtr def) > @@ -11720,9 +11730,13 @@ virDomainDefParseXML(xmlDocPtr xml, > > if (def->virtType == VIR_DOMAIN_VIRT_QEMU || > def->virtType == VIR_DOMAIN_VIRT_KQEMU || > - def->virtType == VIR_DOMAIN_VIRT_KVM) > - if (virDomainDefMaybeAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_USB, 0, -1) < 0) I'm thinking that if this needs to be different for different arches, then it shouldn't be done here, it should be done in the hypervisor's post-parse callback. > + def->virtType == VIR_DOMAIN_VIRT_KVM) { > + if (virDomainDefMaybeAddController(def, > + VIR_DOMAIN_CONTROLLER_TYPE_USB, > + 0, > + virDomainDefaultUSBControllerModel(def)) < 0) > goto error; > + } > > /* analysis of the resource leases */ > if ((n = virXPathNodeSet("./devices/lease", ctxt, &nodes)) < 0) { -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list