diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 13427edd5a..1e8450d3b7 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4079,8 +4079,7 @@ virQEMUCapsGetDefaultMachine(virQEMUCapsPtr qemuCaps) static int -virQEMUCapsFillDomainLoaderCaps(virQEMUCapsPtr qemuCaps, - virDomainCapsLoaderPtr capsLoader, +virQEMUCapsFillDomainLoaderCaps(virDomainCapsLoaderPtr capsLoader, char **loader, size_t nloader) { @@ -4112,25 +4111,22 @@ virQEMUCapsFillDomainLoaderCaps(virQEMUCapsPtr qemuCaps, VIR_DOMAIN_LOADER_TYPE_PFLASH); - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_READONLY)) - VIR_DOMAIN_CAPS_ENUM_SET(capsLoader->readonly, - VIR_TRISTATE_BOOL_YES, - VIR_TRISTATE_BOOL_NO); + VIR_DOMAIN_CAPS_ENUM_SET(capsLoader->readonly, + VIR_TRISTATE_BOOL_YES, + VIR_TRISTATE_BOOL_NO); return 0; } static int -virQEMUCapsFillDomainOSCaps(virQEMUCapsPtr qemuCaps, - virDomainCapsOSPtr os, +virQEMUCapsFillDomainOSCaps(virDomainCapsOSPtr os, char **loader, size_t nloader) { virDomainCapsLoaderPtr capsLoader = &os->loader; os->supported = true; - if (virQEMUCapsFillDomainLoaderCaps(qemuCaps, capsLoader, - loader, nloader) < 0) + if (virQEMUCapsFillDomainLoaderCaps(capsLoader, loader, nloader) < 0) return -1; return 0; } @@ -4358,8 +4354,7 @@ virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps, domCaps->maxvcpus = maxvcpus; - if (virQEMUCapsFillDomainOSCaps(qemuCaps, os, - loader, nloader) < 0 || + if (virQEMUCapsFillDomainOSCaps(os, loader, nloader) < 0 || virQEMUCapsFillDomainDeviceDiskCaps(qemuCaps, domCaps->machine, disk) < 0 || virQEMUCapsFillDomainDeviceGraphicsCaps(qemuCaps, graphics) < 0 || diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 8bcc08ce6b..102837bafb 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1393,8 +1393,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk, disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) && disk->bus != VIR_DOMAIN_DISK_BUS_IDE) virBufferAddLit(&opt, ",boot=on"); - if (disk->src->readonly && - virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_READONLY)) { + if (disk->src->readonly) { if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK) { if (disk->bus == VIR_DOMAIN_DISK_BUS_IDE) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -4608,8 +4607,7 @@ qemuBuildSCSIiSCSIHostdevDrvStr(virDomainHostdevDefPtr dev) } char * -qemuBuildSCSIHostdevDrvStr(virDomainHostdevDefPtr dev, - virQEMUCapsPtr qemuCaps) +qemuBuildSCSIHostdevDrvStr(virDomainHostdevDefPtr dev) { virBuffer buf = VIR_BUFFER_INITIALIZER; char *source = NULL; @@ -4628,16 +4626,8 @@ qemuBuildSCSIHostdevDrvStr(virDomainHostdevDefPtr dev, virDomainDeviceAddressTypeToString(dev->info->type), dev->info->alias); - if (dev->readonly) { - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_READONLY)) { - virBufferAddLit(&buf, ",readonly=on"); - } else { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("this qemu doesn't support 'readonly' " - "for -drive")); - goto error; - } - } + if (dev->readonly) + virBufferAddLit(&buf, ",readonly=on"); if (virBufferCheckError(&buf) < 0) goto error; @@ -5040,7 +5030,7 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd, char *drvstr; virCommandAddArg(cmd, "-drive"); - if (!(drvstr = qemuBuildSCSIHostdevDrvStr(hostdev, qemuCaps))) + if (!(drvstr = qemuBuildSCSIHostdevDrvStr(hostdev))) return -1; virCommandAddArg(cmd, drvstr); VIR_FREE(drvstr); @@ -8775,13 +8765,6 @@ qemuBuildDomainLoaderCommandLine(virCommandPtr cmd, unit++; if (loader->readonly) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_READONLY)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("this qemu doesn't support passing " - "readonly attribute")); - goto cleanup; - } - virBufferAsprintf(&buf, ",readonly=%s", virTristateSwitchTypeToString(loader->readonly)); } diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index c777701458..1c2270564c 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -161,8 +161,7 @@ char *qemuBuildUSBHostdevDevStr(const virDomainDef *def, virDomainHostdevDefPtr dev, virQEMUCapsPtr qemuCaps); -char *qemuBuildSCSIHostdevDrvStr(virDomainHostdevDefPtr dev, - virQEMUCapsPtr qemuCaps); +char *qemuBuildSCSIHostdevDrvStr(virDomainHostdevDefPtr dev); char *qemuBuildSCSIHostdevDevStr(const virDomainDef *def, virDomainHostdevDefPtr dev, diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index fc1bf6e5ea..5f34a768bd 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1928,7 +1928,7 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn, if (qemuDomainSecretHostdevPrepare(conn, priv, hostdev) < 0) goto cleanup; - if (!(drvstr = qemuBuildSCSIHostdevDrvStr(hostdev, priv->qemuCaps))) + if (!(drvstr = qemuBuildSCSIHostdevDrvStr(hostdev))) goto cleanup; if (!(devstr = qemuBuildSCSIHostdevDevStr(vm->def, hostdev, priv->qemuCaps)))