For validation of explicitly configured addresses we already ported the
same style of checks to qemuValidateDomainDeviceDefAddress and implicit
address assignment should do the right thing in the first place, thus
the function is redundant and can be removed.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_command.c | 4 ----
src/qemu/qemu_domain.c | 38 ----------------------------------
src/qemu/qemu_domain.h | 6 ------
src/qemu/qemu_domain_address.c | 7 +------
src/qemu/qemu_domain_address.h | 3 +--
src/qemu/qemu_hotplug.c | 13 ++++++------
src/qemu/qemu_validate.c | 14 +------------
7 files changed, 9 insertions(+), 76 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index dde4c1ba4e..434101246b 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5449,10 +5449,6 @@ qemuBuildRNGDevStr(const virDomainDef *def,
{
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
- if (!qemuDomainCheckCCWS390AddressSupport(def, &dev->info, qemuCaps,
- dev->source.file))
- return NULL;
-
if (qemuBuildVirtioDevStr(&buf, "virtio-rng", qemuCaps,
VIR_DOMAIN_DEVICE_RNG, dev) < 0) {
return NULL;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index d0dd1ce995..1072996411 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -10637,44 +10637,6 @@ qemuDomainGetMachineName(virDomainObj *vm)
}
-/* Check whether the device address is using either 'ccw' or default s390
- * address format and whether that's "legal" for the current qemu and/or
- * guest os.machine type. This is the corollary to the code which doesn't
- * find the address type set using an emulator that supports either 'ccw'
- * or s390 and sets the address type based on the capabilities.
- *
- * If the address is using 'ccw' or s390 and it's not supported, generate
- * an error and return false; otherwise, return true.
- */
-bool
-qemuDomainCheckCCWS390AddressSupport(const virDomainDef *def,
- const virDomainDeviceInfo *info,
- virQEMUCaps *qemuCaps,
- const char *devicename)
-{
- if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
- if (!qemuDomainIsS390CCW(def)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("cannot use CCW address type for device "
- "'%s' using machine type '%s'"),
- devicename, def->os.machine);
- return false;
- } else if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CCW)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("CCW address type is not supported by "
- "this QEMU"));
- return false;
- }
- } else if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("virtio S390 address type is not supported by "
- "this QEMU"));
- return false;
- }
- return true;
-}
-
-
/**
* qemuDomainPrepareDiskSourceData:
*
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 9cebf9e426..6ae8af7635 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -955,12 +955,6 @@ int
qemuDomainObjPrivateXMLParseAllowReboot(xmlXPathContextPtr ctxt,
virTristateBool *allowReboot);
-bool
-qemuDomainCheckCCWS390AddressSupport(const virDomainDef *def,
- const virDomainDeviceInfo *info,
- virQEMUCaps *qemuCaps,
- const char *devicename);
-
void
qemuDomainPrepareDiskSourceData(virDomainDiskDef *disk,
virStorageSource *src);
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 8d52f1d884..6cd0cb8c84 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -3252,8 +3252,7 @@ qemuDomainReleaseDeviceAddress(virDomainObj *vm,
int
qemuDomainEnsureVirtioAddress(bool *releaseAddr,
virDomainObj *vm,
- virDomainDeviceDef *dev,
- const char *devicename)
+ virDomainDeviceDef *dev)
{
virDomainDeviceInfo *info = virDomainDeviceGetInfo(dev);
qemuDomainObjPrivate *priv = vm->privateData;
@@ -3265,10 +3264,6 @@ qemuDomainEnsureVirtioAddress(bool *releaseAddr,
if (qemuDomainIsS390CCW(vm->def) &&
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_CCW))
info->type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW;
- } else {
- if (!qemuDomainCheckCCWS390AddressSupport(vm->def, info, priv->qemuCaps,
- devicename))
- return -1;
}
if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
diff --git a/src/qemu/qemu_domain_address.h b/src/qemu/qemu_domain_address.h
index 85c71bfda5..df7e7fca99 100644
--- a/src/qemu/qemu_domain_address.h
+++ b/src/qemu/qemu_domain_address.h
@@ -65,5 +65,4 @@ void qemuDomainReleaseMemoryDeviceSlot(virDomainObj *vm,
int qemuDomainEnsureVirtioAddress(bool *releaseAddr,
virDomainObj *vm,
- virDomainDeviceDef *dev,
- const char *devicename);
+ virDomainDeviceDef *dev);
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 38eca0144d..8f7ac30114 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -869,7 +869,7 @@ int qemuDomainAttachControllerDevice(virQEMUDriver *driver,
return -1;
}
- if (qemuDomainEnsureVirtioAddress(&releaseaddr, vm, &dev,
"controller") < 0)
+ if (qemuDomainEnsureVirtioAddress(&releaseaddr, vm, &dev) < 0)
return -1;
if (qemuAssignDeviceControllerAlias(vm->def, controller) < 0)
@@ -1022,7 +1022,7 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriver *driver,
break;
case VIR_DOMAIN_DISK_BUS_VIRTIO:
- if (qemuDomainEnsureVirtioAddress(&releaseVirtio, vm, dev, disk->dst) <
0)
+ if (qemuDomainEnsureVirtioAddress(&releaseVirtio, vm, dev) < 0)
goto cleanup;
break;
@@ -2312,7 +2312,7 @@ qemuDomainAttachRNGDevice(virQEMUDriver *driver,
/* preallocate space for the device definition */
VIR_REALLOC_N(vm->def->rngs, vm->def->nrngs + 1);
- if (qemuDomainEnsureVirtioAddress(&releaseaddr, vm, &dev, "rng")
< 0)
+ if (qemuDomainEnsureVirtioAddress(&releaseaddr, vm, &dev) < 0)
return -1;
if (qemuDomainNamespaceSetupRNG(vm, rng) < 0)
@@ -2861,10 +2861,9 @@ qemuDomainAttachMediatedDevice(virQEMUDriver *driver,
return -1;
break;
case VIR_MDEV_MODEL_TYPE_VFIO_CCW: {
- const char *devName = hostdev->source.subsys.u.mdev.uuidstr;
bool releaseaddr = false;
- if (qemuDomainEnsureVirtioAddress(&releaseaddr, vm, &dev, devName) <
0)
+ if (qemuDomainEnsureVirtioAddress(&releaseaddr, vm, &dev) < 0)
return -1;
} break;
case VIR_MDEV_MODEL_TYPE_LAST:
@@ -3201,7 +3200,7 @@ qemuDomainAttachInputDevice(virQEMUDriver *driver,
}
if (input->bus == VIR_DOMAIN_INPUT_BUS_VIRTIO) {
- if (qemuDomainEnsureVirtioAddress(&releaseaddr, vm, &dev,
"input") < 0)
+ if (qemuDomainEnsureVirtioAddress(&releaseaddr, vm, &dev) < 0)
return -1;
} else if (input->bus == VIR_DOMAIN_INPUT_BUS_USB) {
if (virDomainUSBAddressEnsure(priv->usbaddrs, &input->info) < 0)
@@ -3298,7 +3297,7 @@ qemuDomainAttachVsockDevice(virQEMUDriver *driver,
return -1;
}
- if (qemuDomainEnsureVirtioAddress(&releaseaddr, vm, &dev, "vsock")
< 0)
+ if (qemuDomainEnsureVirtioAddress(&releaseaddr, vm, &dev) < 0)
return -1;
if (qemuAssignDeviceVsockAlias(vsock) < 0)
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index b4f012253b..357bb7c3fb 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -2853,9 +2853,6 @@ qemuValidateDomainDeviceDefDiskFrontend(const virDomainDiskDef
*disk,
qemuValidateDomainDeviceDefDiskSerial(disk->serial) < 0)
return -1;
- if (!qemuDomainCheckCCWS390AddressSupport(def, &disk->info, qemuCaps,
disk->dst))
- return -1;
-
if (disk->iothread && !qemuValidateDomainDeviceDefDiskIOThreads(def,
disk))
return -1;
@@ -3946,10 +3943,6 @@ qemuValidateDomainDeviceDefController(const virDomainControllerDef
*controller,
{
int ret = 0;
- if (!qemuDomainCheckCCWS390AddressSupport(def, &controller->info, qemuCaps,
- "controller"))
- return -1;
-
if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI &&
!qemuValidateCheckSCSIControllerModel(qemuCaps, controller->model))
return -1;
@@ -4491,7 +4484,6 @@ qemuValidateDomainDeviceDefSound(virDomainSoundDef *sound,
static int
qemuValidateDomainDeviceDefVsock(const virDomainVsockDef *vsock,
- const virDomainDef *def,
virQEMUCaps *qemuCaps)
{
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VHOST_VSOCK)) {
@@ -4501,10 +4493,6 @@ qemuValidateDomainDeviceDefVsock(const virDomainVsockDef *vsock,
return -1;
}
- if (!qemuDomainCheckCCWS390AddressSupport(def, &vsock->info, qemuCaps,
- "vsock"))
- return -1;
-
if (qemuValidateDomainVirtioOptions(vsock->virtio, qemuCaps) < 0)
return -1;
@@ -5069,7 +5057,7 @@ qemuValidateDomainDeviceDef(const virDomainDeviceDef *dev,
break;
case VIR_DOMAIN_DEVICE_VSOCK:
- ret = qemuValidateDomainDeviceDefVsock(dev->data.vsock, def, qemuCaps);
+ ret = qemuValidateDomainDeviceDefVsock(dev->data.vsock, qemuCaps);
break;
case VIR_DOMAIN_DEVICE_TPM:
--
2.31.1