Re: [PATCH 72/80] qemuDomainValidateStorageSource: Remove QEMU_CAPS_BLOCKDEV validation

2022-08-05 Thread Pavel Hrdina
On Tue, Jul 26, 2022 at 04:37:50PM +0200, Peter Krempa wrote:
> 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 
> ---
>  src/qemu/qemu_domain.c | 60 +++---
>  1 file changed, 3 insertions(+), 57 deletions(-)
> 
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index 8997041b34..0839744660 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c

[...]

> @@ -4961,11 +4922,9 @@ qemuDomainValidateStorageSource(virStorageSource *src,
>  return -1;
>  }
> 
> -/* TFTP protocol was not supported for some time, lock it out at least 
> with
> - * -blockdev */
> +/* TFTP protocol was not supported */

I would change the comment to '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;

Reviewed-by: Pavel Hrdina 


signature.asc
Description: PGP signature


[PATCH 72/80] qemuDomainValidateStorageSource: Remove QEMU_CAPS_BLOCKDEV validation

2022-07-26 Thread Peter Krempa
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 
---
 src/qemu/qemu_domain.c | 60 +++---
 1 file changed, 3 insertions(+), 57 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 8997041b34..0839744660 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4811,13 +4811,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",
@@ -4870,17 +4866,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 &&
@@ -4889,12 +4874,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) {
@@ -4906,12 +4885,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;
 }
@@ -4926,12 +4899,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) {
@@ -4944,12 +4911,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 &&
@@ -4961,11 +4922,9 @@ qemuDomainValidateStorageSource(virStorageSource *src,
 return -1;
 }

-/* TFTP protocol was not supported for some time, lock it out at least with
- * -blockdev */
+/* TFTP protocol was not supported */
 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;
@@ -4973,13 +4932,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) {