Am 29.03.2019 um 17:19 hat Markus Armbruster geschrieben: > Markus Armbruster <arm...@redhat.com> writes: > > > Markus Armbruster <arm...@redhat.com> writes: > > > >> Markus Armbruster <arm...@redhat.com> writes: > >> > >>> Kevin Wolf <kw...@redhat.com> writes: > >>> > >>>> auto-read-only=on changed its behaviour in file-posix for the 4.0 > >>>> release. > >>> > >>> Commit hash, please. > >> > >> I guess it's commit 23dece19da4 "file-posix: Make auto-read-only > >> dynamic". > >> > >>>> This change cannot be detected through the usual mechanisms > >>>> like schema introspection. Add a new feature to query-qemu-features to > >>>> allow libvirt to detect the presence of the new behaviour. > >>>> > >>>> Signed-off-by: Kevin Wolf <kw...@redhat.com> > > [...] > >> The "posix" in @file-posix-dynamic-auto-read-only feels weird. To make > >> sense of it, you need to know on what kind of host QEMU runs. If we > >> ever implement it for Windows hosts, we'd get do add > >> @file-windows-posix-dynamic-auto-read-only. > >> > >> What about instead adding @file-dynamic-auto-read-only with a suitable > >> compile-time conditional? > >> > >> [...] > > > > Incremental patch: > > Too fast, use this one. > > diff --git a/qapi/misc.json b/qapi/misc.json > index df23c54a65..36b5ceb595 100644 > --- a/qapi/misc.json > +++ b/qapi/misc.json > @@ -3058,7 +3058,7 @@ > # Information about support for QEMU features that isn't available through > # schema introspection. > # > -# @file-posix-dynamic-auto-read-only: > +# @file-dynamic-auto-read-only: > # true if auto-read-only=on means that the image file is dynamically > reopened > # read-only or read-write depending on whether any writers are attached to > # the node. > @@ -3066,7 +3066,9 @@ > # Since: 4.0 > ## > { 'struct': 'QemuFeatures', > - 'data': { 'file-posix-dynamic-auto-read-only': 'bool' } } > + 'data': { > + 'file-dynamic-auto-read-only': { 'type': 'bool', > + 'if': 'defined(CONFIG_POSIX)' } } }
I don't think there is a good reason to make the field conditional. What should be conditional is its value: diff --git a/qapi/misc.json b/qapi/misc.json index df23c54a65..a460fd2acc 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -3058,7 +3058,7 @@ # Information about support for QEMU features that isn't available through # schema introspection. # -# @file-posix-dynamic-auto-read-only: +# @file-dynamic-auto-read-only: # true if auto-read-only=on means that the image file is dynamically reopened # read-only or read-write depending on whether any writers are attached to # the node. @@ -3066,7 +3066,7 @@ # Since: 4.0 ## { 'struct': 'QemuFeatures', - 'data': { 'file-posix-dynamic-auto-read-only': 'bool' } } + 'data': { 'file-dynamic-auto-read-only': 'bool' } } ## # @query-qemu-features: diff --git a/qmp.c b/qmp.c index 2a887c1e7d..3d3c300dc6 100644 --- a/qmp.c +++ b/qmp.c @@ -723,7 +723,11 @@ QemuFeatures *qmp_query_qemu_features(Error **errp) QemuFeatures *caps = g_new(QemuFeatures, 1); *caps = (QemuFeatures) { - .file_posix_dynamic_auto_read_only = true, +#ifdef CONFIG_POSIX + .file_dynamic_auto_read_only = true, +#else + .file_dynamic_auto_read_only = false, +#endif }; return caps;