diff mbox series

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

Message ID 20240604134933.220112-19-berrange@redhat.com (mailing list archive)
State New, archived
Headers show
Series qga: clean up command source locations and conditionals | expand

Commit Message

Daniel P. Berrangé June 4, 2024, 1:49 p.m. UTC
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(-)

Comments

Markus Armbruster June 11, 2024, 8:08 a.m. UTC | #1
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?
Daniel P. Berrangé June 11, 2024, 8:49 a.m. UTC | #2
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
Daniel P. Berrangé June 13, 2024, 11:48 a.m. UTC | #3
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
diff mbox series

Patch

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)) {