On Fri, Jul 12, 2024 at 10:07:34AM +0200, Markus Armbruster wrote: > Daniel P. Berrangé <berra...@redhat.com> writes: > > > The 'command-features' pragma allows for defining additional > > special features that are unique to a particular QAPI schema > > instance and its implementation. > > So far, we have special features (predefined, known to the generator and > treated specially), and normal features (user-defined, not known to the > generator). You create a new kind in between: user-defined, not known > to the generator, yet treated specially (I guess?). Hmm. > > Could you at least hint at indented use here? What special treatment do > you have in mind?
Essentially, these features are a way to attach metadata to commands that the server side impl can later query. This eliminates the need to hardcode lists of commands, such as in QGA which hardcodes a list of commands which are safe to use when filesystems are frozen. This is illustrated later in this series. > > > Signed-off-by: Daniel P. Berrangé <berra...@redhat.com> > > --- > > scripts/qapi/parser.py | 2 ++ > > scripts/qapi/source.py | 2 ++ > > 2 files changed, 4 insertions(+) > > > > diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py > > index 7b13a583ac..36a9046243 100644 > > --- a/scripts/qapi/parser.py > > +++ b/scripts/qapi/parser.py > > @@ -243,6 +243,8 @@ def check_list_str(name: str, value: object) -> > > List[str]: > > pragma.documentation_exceptions = check_list_str(name, value) > > elif name == 'member-name-exceptions': > > pragma.member_name_exceptions = check_list_str(name, value) > > + elif name == 'command-features': > > + pragma.command_features = check_list_str(name, value) > > else: > > raise QAPISemError(info, "unknown pragma '%s'" % name) > > > > diff --git a/scripts/qapi/source.py b/scripts/qapi/source.py > > index 7b379fdc92..07c2958ac4 100644 > > --- a/scripts/qapi/source.py > > +++ b/scripts/qapi/source.py > > @@ -28,6 +28,8 @@ def __init__(self) -> None: > > self.documentation_exceptions: List[str] = [] > > # Types whose member names may violate case conventions > > self.member_name_exceptions: List[str] = [] > > + # Arbitrary extra features recorded against commands > > + self.command_features: List[str] = [] > > > > > > class QAPISourceInfo: > 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 :|