[libvirt] [rebased][PATCH 2/4] build command line for pci-bridge device of qemu
li guang
lig.fnst at cn.fujitsu.com
Fri Feb 15 01:51:48 UTC 2013
在 2013-02-05二的 17:53 +0100,Ján Tomko写道:
> 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.
Yes, good catch!
>
> > @@ -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.
OK, will move to another patch for long line wraps.
>
> > @@ -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.
OK, Thanks!
>
> > + goto out;
> > + break;
> > case VIR_DOMAIN_CONTROLLER_TYPE_SCSI:
> > model = def->model;
> > if ((qemuSetScsiControllerModel(domainDef, caps, &model)) < 0)
>
> Jan
More information about the libvir-list
mailing list