qemuDomainValidateStorageSource: Remove QEMU_CAPS_BLOCKDEV validation

While we assume that -blockdev is supported the validator had also some
corner cases for -drive. Since we use '-drive' exclusively for the
extremely rarely used SD cards it makes no sense to have the validation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2022-07-21 17:07:38 +02:00
parent 54c0669ff5
commit a60d76fc37

View File

@ -4720,13 +4720,9 @@ qemuDomainValidateActualNetDef(const virDomainNetDef *net,
int
qemuDomainValidateStorageSource(virStorageSource *src,
virQEMUCaps *qemuCaps,
bool maskBlockdev)
bool maskBlockdev G_GNUC_UNUSED)
{
virStorageType actualType = virStorageSourceGetActualType(src);
bool blockdev = virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV);
if (maskBlockdev)
blockdev = false;
if (src->format == VIR_STORAGE_FILE_COW) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@ -4779,17 +4775,6 @@ qemuDomainValidateStorageSource(virStorageSource *src,
return -1;
}
if (src->sliceStorage) {
/* In pre-blockdev era we can't configure the slice so we can allow them
* only for detected backing store entries as they are populated
* from a place that qemu would be able to read */
if (!src->detected && !blockdev) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("storage slice is not supported by this QEMU binary"));
return -1;
}
}
if (src->sslverify != VIR_TRISTATE_BOOL_ABSENT) {
if (actualType != VIR_STORAGE_TYPE_NETWORK ||
(src->protocol != VIR_STORAGE_NET_PROTOCOL_HTTPS &&
@ -4798,12 +4783,6 @@ qemuDomainValidateStorageSource(virStorageSource *src,
_("ssl verification is supported only with HTTPS/FTPS protocol"));
return -1;
}
if (!src->detected && !blockdev) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("ssl verification setting is not supported by this QEMU binary"));
return -1;
}
}
if (src->ncookies > 0) {
@ -4815,12 +4794,6 @@ qemuDomainValidateStorageSource(virStorageSource *src,
return -1;
}
if (!src->detected && !blockdev) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("http cookies are not supported by this QEMU binary"));
return -1;
}
if (virStorageSourceNetCookiesValidate(src) < 0)
return -1;
}
@ -4835,12 +4808,6 @@ qemuDomainValidateStorageSource(virStorageSource *src,
_("readahead is supported only with HTTP(S)/FTP(s) protocols"));
return -1;
}
if (!src->detected && !blockdev) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("readahead setting is not supported with this QEMU binary"));
return -1;
}
}
if (src->timeout > 0) {
@ -4853,12 +4820,6 @@ qemuDomainValidateStorageSource(virStorageSource *src,
_("timeout is supported only with HTTP(S)/FTP(s) protocols"));
return -1;
}
if (!src->detected && !blockdev) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("timeout setting is not supported with this QEMU binary"));
return -1;
}
}
if (src->query &&
@ -4870,11 +4831,9 @@ qemuDomainValidateStorageSource(virStorageSource *src,
return -1;
}
/* TFTP protocol was not supported for some time, lock it out at least with
* -blockdev */
/* TFTP protocol is not supported since QEMU 2.8.0 */
if (actualType == VIR_STORAGE_TYPE_NETWORK &&
src->protocol == VIR_STORAGE_NET_PROTOCOL_TFTP &&
blockdev) {
src->protocol == VIR_STORAGE_NET_PROTOCOL_TFTP) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("'tftp' protocol is not supported with this QEMU binary"));
return -1;
@ -4882,13 +4841,6 @@ qemuDomainValidateStorageSource(virStorageSource *src,
if (actualType == VIR_STORAGE_TYPE_NETWORK &&
src->protocol == VIR_STORAGE_NET_PROTOCOL_NFS) {
/* NFS protocol may only be used if current QEMU supports blockdev */
if (!blockdev) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("'nfs' protocol is not supported with this QEMU binary"));
return -1;
}
/* NFS protocol must have exactly one host */
if (src->nhosts != 1) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@ -4918,12 +4870,6 @@ qemuDomainValidateStorageSource(virStorageSource *src,
_("metadata cache max size control is supported only with qcow2 images"));
return -1;
}
if (!blockdev) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("metadata cache max size control is not supported with this QEMU binary"));
return -1;
}
}
if (src->encryption) {