[PATCH 18/20] qga: add note about where to disable commands for a platform

Daniel P. Berrangé posted 20 patches 5 months, 3 weeks ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Thomas Huth <thuth@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Michael Roth <michael.roth@amd.com>, Konstantin Kostiuk <kkostiuk@redhat.com>
There is a newer version of this series
[PATCH 18/20] qga: add note about where to disable commands for a platform
Posted by Daniel P. Berrangé 5 months, 3 weeks ago
Any command that is known to be unimplemented on a given build target
must be disabled using a QAPI schema conditional. Only use dynamidc
disabling for commands that require a runtime feature check.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 qga/commands-posix.c | 8 +++++++-
 qga/commands-win32.c | 8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index f4104f2760..8f09162562 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -1136,7 +1136,13 @@ error:
 
 #endif /* HAVE_GETIFADDRS */
 
-/* add unsupported commands to the list of blocked RPCs */
+/*
+ * Add commands that cannot be supported based on the results of
+ * dynamic check of the running OS installation.
+ *
+ * Commands that cannot be supported at all on a given platform
+ * should be disabled with a condition in the QAPI schema.
+ */
 GList *ga_command_init_blockedrpcs(GList *blockedrpcs)
 {
     return blockedrpcs;
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index 2533e4c748..0198e37a96 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -1958,7 +1958,13 @@ done:
     g_free(rawpasswddata);
 }
 
-/* add unsupported commands to the list of blocked RPCs */
+/*
+ * Add commands that cannot be supported based on the results of
+ * dynamic check of the running OS installation.
+ *
+ * Commands that cannot be supported at all on Wnidows
+ * should be disabled with a condition in the QAPI schema.
+ */
 GList *ga_command_init_blockedrpcs(GList *blockedrpcs)
 {
     if (!vss_init(true)) {
-- 
2.45.1


Re: [PATCH 18/20] qga: add note about where to disable commands for a platform
Posted by Markus Armbruster 5 months, 2 weeks ago
Daniel P. Berrangé <berrange@redhat.com> writes:

> Any command that is known to be unimplemented on a given build target
> must be disabled using a QAPI schema conditional. Only use dynamidc

Suggest "should be disabled", for consistency with the comment below.

s/dynamidc/dynamic/

> disabling for commands that require a runtime feature check.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  qga/commands-posix.c | 8 +++++++-
>  qga/commands-win32.c | 8 +++++++-
>  2 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> index f4104f2760..8f09162562 100644
> --- a/qga/commands-posix.c
> +++ b/qga/commands-posix.c
> @@ -1136,7 +1136,13 @@ error:
>  
>  #endif /* HAVE_GETIFADDRS */
>  
> -/* add unsupported commands to the list of blocked RPCs */
> +/*
> + * Add commands that cannot be supported based on the results of
> + * dynamic check of the running OS installation.
> + *
> + * Commands that cannot be supported at all on a given platform
> + * should be disabled with a condition in the QAPI schema.
> + */
>  GList *ga_command_init_blockedrpcs(GList *blockedrpcs)
>  {
>      return blockedrpcs;
> diff --git a/qga/commands-win32.c b/qga/commands-win32.c
> index 2533e4c748..0198e37a96 100644
> --- a/qga/commands-win32.c
> +++ b/qga/commands-win32.c
> @@ -1958,7 +1958,13 @@ done:
>      g_free(rawpasswddata);
>  }
>  
> -/* add unsupported commands to the list of blocked RPCs */
> +/*
> + * Add commands that cannot be supported based on the results of
> + * dynamic check of the running OS installation.
> + *
> + * Commands that cannot be supported at all on Wnidows

s/Wnidows/Windows/

> + * should be disabled with a condition in the QAPI schema.
> + */
>  GList *ga_command_init_blockedrpcs(GList *blockedrpcs)
>  {
>      if (!vss_init(true)) {

Both functions will be unused after PATCH 20.  Remove them there, and
drop this patch?
Re: [PATCH 18/20] qga: add note about where to disable commands for a platform
Posted by Daniel P. Berrangé 5 months, 2 weeks ago
On Tue, Jun 11, 2024 at 10:08:20AM +0200, Markus Armbruster wrote:
> Daniel P. Berrangé <berrange@redhat.com> writes:
> 
> > Any command that is known to be unimplemented on a given build target
> > must be disabled using a QAPI schema conditional. Only use dynamidc
> 
> Suggest "should be disabled", for consistency with the comment below.
> 
> s/dynamidc/dynamic/
> 
> > disabling for commands that require a runtime feature check.
> >
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > ---
> >  qga/commands-posix.c | 8 +++++++-
> >  qga/commands-win32.c | 8 +++++++-
> >  2 files changed, 14 insertions(+), 2 deletions(-)
> >
> > diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> > index f4104f2760..8f09162562 100644
> > --- a/qga/commands-posix.c
> > +++ b/qga/commands-posix.c
> > @@ -1136,7 +1136,13 @@ error:
> >  
> >  #endif /* HAVE_GETIFADDRS */
> >  
> > -/* add unsupported commands to the list of blocked RPCs */
> > +/*
> > + * Add commands that cannot be supported based on the results of
> > + * dynamic check of the running OS installation.
> > + *
> > + * Commands that cannot be supported at all on a given platform
> > + * should be disabled with a condition in the QAPI schema.
> > + */
> >  GList *ga_command_init_blockedrpcs(GList *blockedrpcs)
> >  {
> >      return blockedrpcs;
> > diff --git a/qga/commands-win32.c b/qga/commands-win32.c
> > index 2533e4c748..0198e37a96 100644
> > --- a/qga/commands-win32.c
> > +++ b/qga/commands-win32.c
> > @@ -1958,7 +1958,13 @@ done:
> >      g_free(rawpasswddata);
> >  }
> >  
> > -/* add unsupported commands to the list of blocked RPCs */
> > +/*
> > + * Add commands that cannot be supported based on the results of
> > + * dynamic check of the running OS installation.
> > + *
> > + * Commands that cannot be supported at all on Wnidows
> 
> s/Wnidows/Windows/
> 
> > + * should be disabled with a condition in the QAPI schema.
> > + */
> >  GList *ga_command_init_blockedrpcs(GList *blockedrpcs)
> >  {
> >      if (!vss_init(true)) {
> 
> Both functions will be unused after PATCH 20.  Remove them there, and
> drop this patch?

Hmm, they shouldn't be unused. I've made a mistake in Patch 20.

We still need to run these methods, since the Windows impl has todo
a runtime check to determine whether snapshot APIs are supported by
the system or not - that's the vss_init() call just seen in the
diff context here.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


Re: [PATCH 18/20] qga: add note about where to disable commands for a platform
Posted by Daniel P. Berrangé 5 months, 2 weeks ago
On Tue, Jun 11, 2024 at 09:49:46AM +0100, Daniel P. Berrangé wrote:
> On Tue, Jun 11, 2024 at 10:08:20AM +0200, Markus Armbruster wrote:
> > Daniel P. Berrangé <berrange@redhat.com> writes:
> > 
> > > Any command that is known to be unimplemented on a given build target
> > > must be disabled using a QAPI schema conditional. Only use dynamidc
> > 
> > Suggest "should be disabled", for consistency with the comment below.
> > 
> > s/dynamidc/dynamic/
> > 
> > > disabling for commands that require a runtime feature check.
> > >
> > > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > > ---
> > >  qga/commands-posix.c | 8 +++++++-
> > >  qga/commands-win32.c | 8 +++++++-
> > >  2 files changed, 14 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> > > index f4104f2760..8f09162562 100644
> > > --- a/qga/commands-posix.c
> > > +++ b/qga/commands-posix.c
> > > @@ -1136,7 +1136,13 @@ error:
> > >  
> > >  #endif /* HAVE_GETIFADDRS */
> > >  
> > > -/* add unsupported commands to the list of blocked RPCs */
> > > +/*
> > > + * Add commands that cannot be supported based on the results of
> > > + * dynamic check of the running OS installation.
> > > + *
> > > + * Commands that cannot be supported at all on a given platform
> > > + * should be disabled with a condition in the QAPI schema.
> > > + */
> > >  GList *ga_command_init_blockedrpcs(GList *blockedrpcs)
> > >  {
> > >      return blockedrpcs;
> > > diff --git a/qga/commands-win32.c b/qga/commands-win32.c
> > > index 2533e4c748..0198e37a96 100644
> > > --- a/qga/commands-win32.c
> > > +++ b/qga/commands-win32.c
> > > @@ -1958,7 +1958,13 @@ done:
> > >      g_free(rawpasswddata);
> > >  }
> > >  
> > > -/* add unsupported commands to the list of blocked RPCs */
> > > +/*
> > > + * Add commands that cannot be supported based on the results of
> > > + * dynamic check of the running OS installation.
> > > + *
> > > + * Commands that cannot be supported at all on Wnidows
> > 
> > s/Wnidows/Windows/
> > 
> > > + * should be disabled with a condition in the QAPI schema.
> > > + */
> > >  GList *ga_command_init_blockedrpcs(GList *blockedrpcs)
> > >  {
> > >      if (!vss_init(true)) {
> > 
> > Both functions will be unused after PATCH 20.  Remove them there, and
> > drop this patch?
> 
> Hmm, they shouldn't be unused. I've made a mistake in Patch 20.
> 
> We still need to run these methods, since the Windows impl has todo
> a runtime check to determine whether snapshot APIs are supported by
> the system or not - that's the vss_init() call just seen in the
> diff context here.

Based on our discussion about vss_init() handling, these methods will
indeed end up unused, so I will delete them entirely in the last
patch which removes their only usage.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|