Remove more checks that are no longer necessary. --- src/qemu/qemu_command.c | 2 +- src/qemu/qemu_domain.c | 6 +---- src/qemu/qemu_domain.h | 1 - src/qemu/qemu_hostdev.c | 4 +--- src/qemu/qemu_hotplug.c | 59 +++---------------------------------------------- src/qemu/qemu_process.c | 8 +++---- 6 files changed, 9 insertions(+), 71 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5590fb6..acee310 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7892,7 +7892,7 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd, goto cleanup; virCommandAddArgList(cmd, "-netdev", host, NULL); } - if (qemuDomainSupportsNicdev(def, qemuCaps, net)) { + if (qemuDomainSupportsNicdev(def, net)) { if (!(nic = qemuBuildNicDevStr(def, net, vlan, bootindex, vhostfdSize, qemuCaps))) goto cleanup; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 65dfa37..061683c 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5312,12 +5312,8 @@ qemuDomainDetectVcpuPids(virQEMUDriverPtr driver, bool qemuDomainSupportsNicdev(virDomainDefPtr def, - virQEMUCapsPtr qemuCaps, virDomainNetDefPtr net) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) - return false; - /* non-virtio ARM nics require legacy -net nic */ if (((def->os.arch == VIR_ARCH_ARMV7L) || (def->os.arch == VIR_ARCH_AARCH64)) && @@ -5333,7 +5329,7 @@ qemuDomainSupportsNetdev(virDomainDefPtr def, virQEMUCapsPtr qemuCaps, virDomainNetDefPtr net) { - if (!qemuDomainSupportsNicdev(def, qemuCaps, net)) + if (!qemuDomainSupportsNicdev(def, net)) return false; return virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV); } diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index baf8bd8..f99f0bb 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -618,7 +618,6 @@ int qemuDomainDetectVcpuPids(virQEMUDriverPtr driver, virDomainObjPtr vm, int asyncJob); bool qemuDomainSupportsNicdev(virDomainDefPtr def, - virQEMUCapsPtr qemuCaps, virDomainNetDefPtr net); bool qemuDomainSupportsNetdev(virDomainDefPtr def, diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c index ca38a06..e16d5fd 100644 --- a/src/qemu/qemu_hostdev.c +++ b/src/qemu/qemu_hostdev.c @@ -197,9 +197,7 @@ qemuHostdevPreparePCIDevicesCheckSupport(virDomainHostdevDefPtr *hostdevs, if (supportsPassthroughVFIO && virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) { *backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO; - } else if (supportsPassthroughKVM && - (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCIDEVICE) || - virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))) { + } else if (supportsPassthroughKVM) { *backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM; } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index aa897d2..fc1bf6e 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1334,12 +1334,6 @@ int qemuDomainAttachRedirdevDevice(virQEMUDriverPtr driver, char *charAlias = NULL; char *devstr = NULL; - if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("redirected devices are not supported by this QEMU")); - return ret; - } - if (qemuAssignDeviceRedirdevAlias(vm->def, redirdev, -1) < 0) goto cleanup; @@ -1537,12 +1531,6 @@ int qemuDomainAttachChrDevice(virQEMUDriverPtr driver, char *charAlias = NULL; bool need_release = false; - if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { - virReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("qemu does not support -device")); - goto cleanup; - } - if (qemuAssignDeviceChrAlias(vmdef, chr, -1) < 0) goto cleanup; @@ -1897,8 +1885,7 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn, bool teardowncgroup = false; bool teardownlabel = false; - if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) || - !virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_SCSI_GENERIC)) { + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_SCSI_GENERIC)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("SCSI passthrough is not supported by this version of qemu")); return -1; @@ -3092,8 +3079,7 @@ qemuDomainRemoveNetDevice(virQEMUDriverPtr driver, goto cleanup; qemuDomainObjEnterMonitor(driver, vm); - if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV) && - virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV)) { if (qemuMonitorRemoveNetdev(priv->mon, hostnet_name) < 0) { if (qemuDomainObjExitMonitor(driver, vm) < 0) goto cleanup; @@ -3472,13 +3458,6 @@ qemuDomainDetachDiskDevice(virQEMUDriverPtr driver, int ret = -1; qemuDomainObjPrivatePtr priv = vm->privateData; - if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { - virReportError(VIR_ERR_OPERATION_FAILED, - _("Underlying qemu does not support %s disk removal"), - virDomainDiskBusTypeToString(detach->bus)); - goto cleanup; - } - if (detach->mirror) { virReportError(VIR_ERR_BLOCK_COPY_ACTIVE, _("disk '%s' is in an active block job"), @@ -3729,12 +3708,6 @@ qemuDomainDetachHostUSBDevice(virQEMUDriverPtr driver, return -1; } - if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { - virReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("device cannot be detached with this QEMU version")); - return -1; - } - qemuDomainMarkDeviceForRemoval(vm, detach->info); qemuDomainObjEnterMonitor(driver, vm); @@ -3759,12 +3732,6 @@ qemuDomainDetachHostSCSIDevice(virQEMUDriverPtr driver, return -1; } - if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { - virReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("device cannot be detached with this QEMU version")); - return -1; - } - qemuDomainMarkDeviceForRemoval(vm, detach->info); qemuDomainObjEnterMonitor(driver, vm); @@ -3781,11 +3748,9 @@ qemuDomainDetachThisHostDevice(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainHostdevDefPtr detach) { - qemuDomainObjPrivatePtr priv = vm->privateData; int ret = -1; - if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) && - !detach->info->alias) { + if (!detach->info->alias) { if (qemuAssignDeviceHostdevAlias(vm->def, &detach->info->alias, -1) < 0) return -1; } @@ -4111,12 +4076,6 @@ int qemuDomainDetachChrDevice(virQEMUDriverPtr driver, return ret; } - if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { - virReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("qemu does not support -device")); - return ret; - } - if (!tmpChr->info.alias && qemuAssignDeviceChrAlias(vmdef, tmpChr, -1) < 0) return ret; @@ -4166,12 +4125,6 @@ qemuDomainDetachRNGDevice(virQEMUDriverPtr driver, tmpRNG = vm->def->rngs[idx]; - if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { - virReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("qemu does not support -device")); - return -1; - } - if (!tmpRNG->info.alias) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("alias not set for RNG device")); @@ -4205,12 +4158,6 @@ qemuDomainDetachMemoryDevice(virQEMUDriverPtr driver, int rc; int ret = -1; - if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { - virReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("qemu does not support -device")); - return -1; - } - qemuDomainMemoryDeviceAlignSize(vm->def, memdef); if ((idx = virDomainMemoryFindByDef(vm->def, memdef)) < 0) { diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 50a6f09..b2669c0 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4857,11 +4857,9 @@ qemuProcessPrepareDomain(virConnectPtr conn, * we also need to populate the PCI address set cache for later * use in hotplug */ - if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { - VIR_DEBUG("Assigning domain PCI addresses"); - if ((qemuDomainAssignAddresses(vm->def, priv->qemuCaps, vm)) < 0) - goto cleanup; - } + VIR_DEBUG("Assigning domain PCI addresses"); + if ((qemuDomainAssignAddresses(vm->def, priv->qemuCaps, vm)) < 0) + goto cleanup; if (qemuAssignDeviceAliases(vm->def, priv->qemuCaps) < 0) goto cleanup; -- 2.7.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list