Here is another proposal how to handle vm snapshots:

QMP vm-snapshot-save:
    - { 'command': 'vm-snapshot-save',
        'data': { 'name': 'str' },
        'returns': 'SnapshotInfo' }
    - vm-snapshot-save returns an error if there is an existing
      snapshot with the same name
    - you cannot provide an id for a new snapshot
    - on success all information about created snapshot will be returned

QMP vm-snapshot-load
    - { 'command': 'vm-snapshot-load',
        'data': { '*name': 'str', '*id': 'int' },
        'returns': 'SnapshotInfo' }
    - one of the name or id must be provided
    - if both are provided they will match only the snapshot with the
      same name and id
    - returns SnapshotInfo only if the snapshot exists.

QMP vm-snapshot-delete:
    - { 'command': 'vm-snapshot-delete',
        'data': { '*name': 'str', '*id': 'int' },
        'returns': 'SnapshotInfo' }
    - same rules as vm-snapshot-load

HMP savevm:
    - args_type = "force:-f,name:s?",
    - if the name is not provided the HMP command will generates new
      one for QMP command
    - if there is already a snapshot with provided or generated name
      it will fails
    - there will be an optional -f parameter to force saving requested
      snapshot and it will internally use vm-snapshot-delete and then
      vm-snapshot-save
    - all information about created snapshot will be printed

HMP loadvm:
    - args_type = "name:s?,id:i?",
    - follow the same behavior as the QMP command

HMP delvm:
    - args_type = "name:s?,id:i?"
    - same rules as loadvm

Reply via email to