提交 a6936ec0 编写于 作者: P Peter Krempa

qemu: domain: Move hostdev validation into separate function

上级 577ccd07
...@@ -3684,6 +3684,23 @@ qemuDomainDeviceDefValidateNetwork(const virDomainNetDef *net) ...@@ -3684,6 +3684,23 @@ qemuDomainDeviceDefValidateNetwork(const virDomainNetDef *net)
} }
static int
qemuDomainDeviceDefValidateHostdev(const virDomainHostdevDef *hostdev,
const virDomainDef *def)
{
/* forbid capabilities mode hostdev in this kind of hypervisor */
if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("hostdev mode 'capabilities' is not "
"supported in %s"),
virDomainVirtTypeToString(def->virtType));
return -1;
}
return 0;
}
static int static int
qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev, qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
const virDomainDef *def, const virDomainDef *def,
...@@ -3709,15 +3726,8 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev, ...@@ -3709,15 +3726,8 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
} else if (dev->type == VIR_DOMAIN_DEVICE_WATCHDOG) { } else if (dev->type == VIR_DOMAIN_DEVICE_WATCHDOG) {
if (qemuDomainWatchdogDefValidate(dev->data.watchdog, def) < 0) if (qemuDomainWatchdogDefValidate(dev->data.watchdog, def) < 0)
goto cleanup; goto cleanup;
} } else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
if (qemuDomainDeviceDefValidateHostdev(dev->data.hostdev, def) < 0)
/* forbid capabilities mode hostdev in this kind of hypervisor */
if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV &&
dev->data.hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("hostdev mode 'capabilities' is not "
"supported in %s"),
virDomainVirtTypeToString(def->virtType));
goto cleanup; goto cleanup;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册