On Mon, 16 Jul 2012 10:12:08 +0200 Pavel Hrdina <phrd...@redhat.com> wrote:
> On 07/12/2012 07:53 PM, Eric Blake wrote: > > On 07/12/2012 10:55 AM, Pavel Hrdina wrote: > >> Signed-off-by: Pavel Hrdina<phrd...@redhat.com> > >> --- > >> +++ b/qapi-schema.json > >> @@ -1868,3 +1868,25 @@ > >> # Since: 0.14.0 > >> ## > >> { 'command': 'netdev_del', 'data': {'id': 'str'} } > >> + > >> +## > >> +# @savevm: > >> +# > >> +# Create a snapshot of the whole virtual machine. If 'tag' is provided, > >> +# it is used as human readable identifier. If there is already a snapshot > >> +# with the same tag or ID, it is replaced. > >> +# > >> +# @name: tag or id of new or existing snapshot > > Needs an #optional designation, given the syntax below. > > > >> +# > >> +# Returns: Nothing on success > >> +# If there is a writable device not supporting snapshots, > >> +# SnapshotNotSupported > >> +# If no block device can accept snapshots, SnapshotNotAccepted > >> +# If an error occures while creating a snapshot, > >> SnapshotCreateFailed > > s/occures/occurs/ > > > >> +# If open a block device for vm state fail, SnapshotOpenFailed > >> +# If an error uccures while writing vm state, SnapshotWriteFailed > > s/uccures/occurs/ > > > >> +# If delete snapshot with same 'name' fail, SnapshotDeleteFailed > > The notion of blindly overwriting the existing snapshot of the same name > > seems a bit dangerous; should we take this opportunity to enhance the > > command, and add a force flag, where things fail if the flag is false > > but the name already exists, and where the reuse only happens if the > > flag is present? (In fact, it would make my life in libvirt easier, as > > I have an action item to make libvirt reject attempts to create a > > snapshot with tag named '1' if an existing snapshot already has an id of > > '1'.) > This sounds reasonable and I think that this could be also good for HMP, > not only for QMP. > If there isn't anyone who disagree, I'll implement it. I agree with it. > > Pavel > >> +# > >> +# Since: 1.2 > >> +## > >> +{ 'command': 'savevm', 'data': {'*name': 'str'} } > >> \ No newline at end of file > > Fix that. > > > >> @@ -1061,6 +1061,32 @@ Example: > >> > >> EQMP > >> { > >> + .name = "savevm", > >> + .args_type = "name:s?", > >> + .params = "name", > >> + .help = "save a VM snapshot. If no tag or id are provided, > >> a new snapshot is created", > >> + .mhandler.cmd_new = qmp_marshal_input_savevm > >> + }, > >> + > >> +SQMP > >> +savevm > > I know the HMP command is short, for ease of typing; but since 'savevm' > > is not an English word, should we name the QMP command 'save-vm'? > > > > >