Le Wednesday 04 Dec 2013 à 17:11:26 (-0700), Eric Blake a écrit : > On 12/03/2013 06:26 AM, Benoît Canet wrote: > > Signed-off-by: Benoit Canet <ben...@irqsave.net> > > --- > > blockdev.c | 49 +++++++++++++++++++++++++++++++++++++++++-------- > > hmp.c | 4 +++- > > qapi-schema.json | 13 ++++++++++--- > > qmp-commands.hx | 11 ++++++++++- > > 4 files changed, 64 insertions(+), 13 deletions(-) > > > > > > > + if (has_node_name && !has_snapshot_node_name) { > > + error_setg(errp, "New snapshot node name missing"); > > + return; > > + } > > Why is it okay to omit the node name when passing a device name (which > creates an anonymous node as the new root of the device tree) but not > when passing a node name? Are you trying to guarantee that all > anonymous nodes can be reached from a device name, and that when taking > a snapshot from a node name the new node is not necessarily tied to a > device and must therefore be named?
Yes bs device living just under block backend will ever be accessible via device whereas other bs really need a node-name to be set to be manipulated. Also it avoid adding a new mandatory field for the device case which is good for compatibility with previous versions. Best regards Benoît > > > -# @device: the name of the device to generate the snapshot from. > > +# Either @device or @node-name must be set but not both. > > +# > > +# @device: #optional the name of the device to generate the snapshot from. > > +# > > +# @node-name: #optional graph node name to generate the snapshot from > > (Since 1.8) > > # > > # @snapshot-file: the target of the new image. A new file will be created. > > # > > +# @snapshot-node-name: the graph node name of the new image (Since 1.8) > > 2.0, also mark this one #optional > > > +# > > # @format: #optional the format of the snapshot image, default is 'qcow2'. > > Unrelated to this patch, but @format is another field worth turning into > an enum instead of an open-coded string. > > -- > Eric Blake eblake redhat com +1-919-301-3266 > Libvirt virtualization library http://libvirt.org >