[PATCH v3 00/30] qapi/qom: QAPIfy --object and object-add
Kevin Wolf
kwolf at redhat.com
Thu Mar 11 08:37:11 UTC 2021
Am 11.03.2021 um 08:47 hat Peter Krempa geschrieben:
> On Wed, Mar 10, 2021 at 18:30:44 +0100, Kevin Wolf wrote:
> > Am 10.03.2021 um 15:31 hat Paolo Bonzini geschrieben:
> > > On 10/03/21 15:22, Peter Krempa wrote:
>
> [...]
>
> > The keyval parser would create a list if multiple values are given for
> > the same key. Some care needs to be taken to avoid mixing the magic
> > list feature with the normal indexed list options.
> >
> > The QAPI schema would then use an alternate between 'int' and ['int'],
> > with the the memory-backend-ram implementation changed accordingly.
> >
> > We could consider immediately deprecating the syntax and printing a
> > warning in the keyval parser when it automatically creates a list from
> > two values for a key, so that users don't start using this syntax
>
> By 'creating a list from two values for a key' you mean:
>
> host-nodes=0,host-nodes=1
>
> to be converted into [0, 1] ?
>
> > instead of the normal list syntax in other places. We'd probably still
> > leave the implementation around for -device and other users of the same
> > magic.
>
> There's three options actually that libvirt uses, visible in one our
> test files [1]
>
> For a single value we format:
>
> -object memory-backend-ram,id=ram-node0,size=20971520,host-nodes=3,policy=preferred
>
> For a contiguous list:
>
> -object memory-backend-ram,id=ram-node1,size=676331520,host-nodes=0-7,policy=bind
>
> And for an interleaved list:
>
> -object memory-backend-ram,id=ram-node2,size=24578621440,host-nodes=1-2,host-nodes=5,host-nodes=7,policy=bind
Oh, we have ranges, too... That makes the compatibility code even
nastier to write. I doubt that we can implement this in the keyval
parser alone without touching the visitor. :-/
> If any of the above is to be deprecated we'll need to adjust our
> JSON->commandline generator accordignly.
>
> Luckily the 'host-nodes' is storeable as a bitmap and the generator is
> actually modular to allow plugging an array interpretor which actually
> does the above conversion from a JSON array.
>
> So, what is the preferred syntax here? Additionally we might need a
> witness property to detect when to use the new syntax if basing it on
> the object-add qapification will not be enough.
The list syntax supported by the keyval parser is the one you know from
-blockdev: host-nodes.0=3,host-nodes.1=7, ...
Kevin
More information about the libvir-list
mailing list