On 01/30/13 03:30, liguang wrote: > @@ -974,8 +967,24 @@ static char *qemuPCIAddressAsString(virDomainDeviceInfoPtr dev) > return addr; > } > > +static int qemuPciBridgeSupport(virDomainDefPtr def) > +{ > + int i, c = 0; > + > + for (i = 0; i < def->ncontrollers; i++) { > + virDomainControllerDefPtr controller = def->controllers[i]; > + > + if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_PCIBRIDGE) > + c++; > + } > > -static int qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED, > + if (c > 1) > + return 0; > + else > + return -1; > +} > + This function is pointless if we're going to auto-add the bridges. > @@ -1002,7 +1025,8 @@ static int qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED, > if (info->addr.pci.function != 0) { > virReportError(VIR_ERR_XML_ERROR, > _("Attempted double use of PCI Address '%s' " > - "(may need \"multifunction='on'\" for device on function 0)"), > + "(may need \"multifunction='on'\" for " > + "device on function 0)"), > addr); > } else { > virReportError(VIR_ERR_XML_ERROR, > @@ -1037,7 +1061,8 @@ static int qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED, > goto cleanup; > } > > - VIR_DEBUG("Remembering PCI addr %s (multifunction=off for function 0)", addr); > + VIR_DEBUG("Remembering PCI addr %s (multifunction=off" > + " for function 0)", addr); > if (virHashAddEntry(addrs->used, addr, addr)) > goto cleanup; > addr = NULL; These two long-line wraps belong to a separate patch. > @@ -3072,6 +3090,12 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef, > int model; > > switch (def->type) { > + case VIR_DOMAIN_CONTROLLER_TYPE_PCIBRIDGE: > + virBufferAsprintf(&buf, "pci-bridge,chassis_nr=%d", def->idx+1); > + virBufferAsprintf(&buf, ",id=pci.%d", def->idx); > + if (def->idx == 0) We should report an error instead of creating a bridge with name 'pci.0' that can't be used. > + goto out; > + break; > case VIR_DOMAIN_CONTROLLER_TYPE_SCSI: > model = def->model; > if ((qemuSetScsiControllerModel(domainDef, caps, &model)) < 0) Jan -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list