[PATCH v2 1/2] qemu-options: define -spice only #ifdef CONFIG_SPICE

marcandre.lureau@redhat.com posted 2 patches 4 years, 2 months ago
[PATCH v2 1/2] qemu-options: define -spice only #ifdef CONFIG_SPICE
Posted by marcandre.lureau@redhat.com 4 years, 2 months ago
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1982600

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 softmmu/vl.c    | 2 ++
 qemu-options.hx | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/softmmu/vl.c b/softmmu/vl.c
index 1159a64bce4e..385465fbeb6d 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -3538,6 +3538,7 @@ void qemu_init(int argc, char **argv, char **envp)
             case QEMU_OPTION_readconfig:
                 qemu_read_config_file(optarg, qemu_parse_config_group, &error_fatal);
                 break;
+#ifdef CONFIG_SPICE
             case QEMU_OPTION_spice:
                 olist = qemu_find_opts_err("spice", NULL);
                 if (!olist) {
@@ -3550,6 +3551,7 @@ void qemu_init(int argc, char **argv, char **envp)
                 }
                 display_remote++;
                 break;
+#endif
             case QEMU_OPTION_writeconfig:
                 {
                     FILE *fp;
diff --git a/qemu-options.hx b/qemu-options.hx
index 7749f59300b5..323913945a5d 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2017,6 +2017,7 @@ SRST
     Enable SDL.
 ERST
 
+#ifdef CONFIG_SPICE
 DEF("spice", HAS_ARG, QEMU_OPTION_spice,
     "-spice [port=port][,tls-port=secured-port][,x509-dir=<dir>]\n"
     "       [,x509-key-file=<file>][,x509-key-password=<file>]\n"
@@ -2038,6 +2039,7 @@ DEF("spice", HAS_ARG, QEMU_OPTION_spice,
     "   enable spice\n"
     "   at least one of {port, tls-port} is mandatory\n",
     QEMU_ARCH_ALL)
+#endif
 SRST
 ``-spice option[,option[,...]]``
     Enable the spice remote desktop protocol. Valid options are
-- 
2.33.0.721.g106298f7f9


Re: [PATCH v2 1/2] qemu-options: define -spice only #ifdef CONFIG_SPICE
Posted by Markus Armbruster 4 years, 2 months ago
marcandre.lureau@redhat.com writes:

> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> Fixes:
> https://bugzilla.redhat.com/show_bug.cgi?id=1982600
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  softmmu/vl.c    | 2 ++
>  qemu-options.hx | 2 ++
>  2 files changed, 4 insertions(+)
>
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index 1159a64bce4e..385465fbeb6d 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -3538,6 +3538,7 @@ void qemu_init(int argc, char **argv, char **envp)
>              case QEMU_OPTION_readconfig:
>                  qemu_read_config_file(optarg, qemu_parse_config_group, &error_fatal);
>                  break;
> +#ifdef CONFIG_SPICE
>              case QEMU_OPTION_spice:
>                  olist = qemu_find_opts_err("spice", NULL);
>                  if (!olist) {
                       error_report("spice support is disabled");
                       exit(1);
                   }

Is this error still reachable?

> @@ -3550,6 +3551,7 @@ void qemu_init(int argc, char **argv, char **envp)
>                  }
>                  display_remote++;
>                  break;
> +#endif
>              case QEMU_OPTION_writeconfig:
>                  {
>                      FILE *fp;
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 7749f59300b5..323913945a5d 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -2017,6 +2017,7 @@ SRST
>      Enable SDL.
>  ERST
>  
> +#ifdef CONFIG_SPICE
>  DEF("spice", HAS_ARG, QEMU_OPTION_spice,
>      "-spice [port=port][,tls-port=secured-port][,x509-dir=<dir>]\n"
>      "       [,x509-key-file=<file>][,x509-key-password=<file>]\n"
> @@ -2038,6 +2039,7 @@ DEF("spice", HAS_ARG, QEMU_OPTION_spice,
>      "   enable spice\n"
>      "   at least one of {port, tls-port} is mandatory\n",
>      QEMU_ARCH_ALL)
> +#endif
>  SRST
>  ``-spice option[,option[,...]]``
>      Enable the spice remote desktop protocol. Valid options are


Re: [PATCH v2 1/2] qemu-options: define -spice only #ifdef CONFIG_SPICE
Posted by Marc-André Lureau 4 years, 2 months ago
Hi

On Thu, Nov 18, 2021 at 3:58 PM Markus Armbruster <armbru@redhat.com> wrote:
>
> marcandre.lureau@redhat.com writes:
>
> > From: Marc-André Lureau <marcandre.lureau@redhat.com>
> >
> > Fixes:
> > https://bugzilla.redhat.com/show_bug.cgi?id=1982600
> >
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >  softmmu/vl.c    | 2 ++
> >  qemu-options.hx | 2 ++
> >  2 files changed, 4 insertions(+)
> >
> > diff --git a/softmmu/vl.c b/softmmu/vl.c
> > index 1159a64bce4e..385465fbeb6d 100644
> > --- a/softmmu/vl.c
> > +++ b/softmmu/vl.c
> > @@ -3538,6 +3538,7 @@ void qemu_init(int argc, char **argv, char **envp)
> >              case QEMU_OPTION_readconfig:
> >                  qemu_read_config_file(optarg, qemu_parse_config_group, &error_fatal);
> >                  break;
> > +#ifdef CONFIG_SPICE
> >              case QEMU_OPTION_spice:
> >                  olist = qemu_find_opts_err("spice", NULL);
> >                  if (!olist) {
>                        error_report("spice support is disabled");
>                        exit(1);
>                    }
>
> Is this error still reachable?

I wonder if module loading failed, it's non fatal and will report this error.

>
> > @@ -3550,6 +3551,7 @@ void qemu_init(int argc, char **argv, char **envp)
> >                  }
> >                  display_remote++;
> >                  break;
> > +#endif
> >              case QEMU_OPTION_writeconfig:
> >                  {
> >                      FILE *fp;
> > diff --git a/qemu-options.hx b/qemu-options.hx
> > index 7749f59300b5..323913945a5d 100644
> > --- a/qemu-options.hx
> > +++ b/qemu-options.hx
> > @@ -2017,6 +2017,7 @@ SRST
> >      Enable SDL.
> >  ERST
> >
> > +#ifdef CONFIG_SPICE
> >  DEF("spice", HAS_ARG, QEMU_OPTION_spice,
> >      "-spice [port=port][,tls-port=secured-port][,x509-dir=<dir>]\n"
> >      "       [,x509-key-file=<file>][,x509-key-password=<file>]\n"
> > @@ -2038,6 +2039,7 @@ DEF("spice", HAS_ARG, QEMU_OPTION_spice,
> >      "   enable spice\n"
> >      "   at least one of {port, tls-port} is mandatory\n",
> >      QEMU_ARCH_ALL)
> > +#endif
> >  SRST
> >  ``-spice option[,option[,...]]``
> >      Enable the spice remote desktop protocol. Valid options are
>