On Thu 03 May 2018 02:22:41 PM CEST, Kevin Wolf wrote: > A clean QMP command would probably apply the same defaults as > blockdev-add, so you just get to specify the full options again. > >> reopen: You call it like blockdev-add, that is: >> { "node-name": "overlay", >> "backing": "new-backing" } >> In theory every option you do not specify is unchanged, so I suppose >> you can leave out e.g. the "driver" option here. > > That already doesn't work because "driver" is the discriminator for > the QAPI union, so it must be mandatory. I'd go further and reuse > BlockdevOptions, which makes everything mandatory that is mandatory > when creating the image. > > blockdev-reopen would basically mean "replace the whole set of options > of this node".
There's at least one case which would need special consideration. Let's say we want to reopen an image ("top") that has a backing file ("base"). When specifying the options there are at least these alternatives for the backing image: 1) "backing" is a dict with the options of the backing image. { ..., "backing": { "driver": "qcow2", "node-name": "base", ... } In this case I suppose the backing image would be reopened with the new options. Any attempt to change the node name or the file name should fail. The graph itself doesn't change, only the options of each node. 2) "backing" is reference to another node. { ..., "backing": "base2" } In this case this should replace "base" with "base2" (which must have been opened already). 3) "backing" is null { ..., "backing": null } This is similar to (2). "base" would be removed from the backing chain and "top" would no longer have a backing image. 4) "backing" is omitted altogether In the case of 'blockdev-add' this means that the default backing image (specified in the header) is opened with the default options. What would it mean for 'blockdev-reopen' ? We keep the backing image with the current options (e.g we remove it from the BlockReopenQueue)? There are similar considerations with other children. In the case of "file" the child is mandatory and non-null, so options (3) and (4) are not possible. In the case of Quorum (where there are no default children) we should keep the children that are specified and remove all others. Berto