在 2018/8/27 下午1:48, Yi Min Zhao 写道:
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index a6e143dc33..d437c432e3 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5716,6 +5716,27 @@ qemuDomainDeviceDefValidateGraphics(const virDomainGraphicsDef
*graphics,
}
+static int
+qemuDomainZPCIAddressDefValidate(virDomainDeviceDef *dev,
+ virQEMUCapsPtr qemuCaps)
+{
+ virDomainDeviceInfoPtr info = virDomainDeviceGetInfo(dev);
+
+ if (!info || (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI))
+ return 0;
+
+ if (!virZPCIDeviceAddressIsEmpty(&info->addr.pci.zpci) &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_ZPCI)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ "%s",
+ _("This QEMU binary doesn't support zPCI."));
+ return -1;
+ }
+
+ return 0;
+}
+
+
static int
qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
const virDomainDef *def,
@@ -5729,6 +5750,10 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
def->emulator)))
return -1;
+ ret = qemuDomainZPCIAddressDefValidate((virDomainDeviceDef *)dev, qemuCaps);
+ if (ret < 0)
+ goto out;
+
switch ((virDomainDeviceType)dev->type) {
case VIR_DOMAIN_DEVICE_NET:
ret = qemuDomainDeviceDefValidateNetwork(dev->data.net);
@@ -5804,6 +5829,7 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
break;
}
+ out:
virObjectUnref(qemuCaps);
return ret;
}
I think this should be separated into single patch. Right?