On Fri, Jan 26, 2024 at 09:37:54AM +0100, Peter Krempa wrote: > On Thu, Jan 25, 2024 at 10:03:52 -0800, Andrea Bolognani wrote: > > On Tue, Jan 16, 2024 at 05:12:42PM +0100, Peter Krempa wrote: > > > +# Recursively traverse the schema and print out the schema query strings for > > > +# the corresponding entries. In certain cases the schema references itself, > > > +# which is handled by passing a 'trace' list which contains the current path > > > +def dump_qmp_probe_strings_iter(name, cur, trace, schema): > > > + obj = schema[name] > > > + > > > + if name in trace: > > > + print('%s (recursion)' % cur) > > > + return > > > > I'll openly admit that I'm pretty much completely unfamiliar with > > this specific query DLS, so it might be a silly question, but what's > > the use of printing this line? AFAICT it's just the line above it, > > with ' (recursion)' appended. Wouldn't it make sense to skip it? > > This line isn't in fact a valid query even. In the query language we > don't care about the infinitely nesting types and you theoretically can > query arbitrarily deep into the recursion. > > For the dumper it obviously is a problem as it has to find all > possibilities. > > So it might be confusing for anyone looking for a query string, but on > the other hand it's useful when comparing two qemu versions against each > other. > > Additionally IIRC (I've wrote this code some time ago already) it's > needed to display the name of the entry, so that e.g. you know that the > object has a member named that way even if it refers to a part of the > schema that was already traversed. I've tried dropping the print and that doesn't seem to affect anything other than the print itself, as expected. For example: (qmp) blockdev-create/arg-type/options/+qcow2/data-file/+vmdk (qmp) blockdev-create/arg-type/options/+qcow2/data-file/+vmdk/backing -(qmp) blockdev-create/arg-type/options/+qcow2/data-file/+vmdk/backing (recursion) (qmp) blockdev-create/arg-type/options/+qcow2/data-file/+vmdk/backing/!str (qmp) blockdev-create/arg-type/options/+qcow2/data-file/+vmdk/backing/!null (qmp) blockdev-create/arg-type/options/+qcow2/data-file/+vmdk/file -(qmp) blockdev-create/arg-type/options/+qcow2/data-file/+vmdk/file (recursion) Anyway, as I said I don't really understand the query language and don't care enough to dig further into it. If you think that the additional lines are useful, keep them. Either way, Reviewed-by: Andrea Bolognani <abologna@xxxxxxxxxx> -- Andrea Bolognani / Red Hat / Virtualization _______________________________________________ Devel mailing list -- devel@xxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx