]> git.proxmox.com Git - qemu.git/commitdiff
qmp: add interface blockdev-snapshot-internal-sync
authorWenchao Xia <xiawenc@linux.vnet.ibm.com>
Wed, 11 Sep 2013 06:04:35 +0000 (14:04 +0800)
committerKevin Wolf <kwolf@redhat.com>
Thu, 12 Sep 2013 08:12:47 +0000 (10:12 +0200)
Snapshot ID can't be specified in this interface.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
blockdev.c
qapi-schema.json
qmp-commands.hx

index 0fd30e2d8db04982c216bec5c0b41dc4a483b5d9..0f4a7b5d85b029e0e9ad0e57822e92b8d60c2d7c 100644 (file)
@@ -858,6 +858,19 @@ void qmp_blockdev_snapshot_sync(const char *device, const char *snapshot_file,
                        &snapshot, errp);
 }
 
+void qmp_blockdev_snapshot_internal_sync(const char *device,
+                                         const char *name,
+                                         Error **errp)
+{
+    BlockdevSnapshotInternal snapshot = {
+        .device = (char *) device,
+        .name = (char *) name
+    };
+
+    blockdev_do_action(TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_INTERNAL_SYNC,
+                       &snapshot, errp);
+}
+
 
 /* New and old BlockDriverState structs for group snapshots */
 
index 77bbbf59cfbdc7656dc68c56030209acbe291632..43faf9141055cd9235f6a4799701cebdf7d9e745 100644 (file)
 { 'command': 'blockdev-snapshot-sync',
   'data': 'BlockdevSnapshot' }
 
+##
+# @blockdev-snapshot-internal-sync
+#
+# Synchronously take an internal snapshot of a block device, when the format
+# of the image used supports it.
+#
+# For the arguments, see the documentation of BlockdevSnapshotInternal.
+#
+# Returns: nothing on success
+#          If @device is not a valid block device, DeviceNotFound
+#          If any snapshot matching @name exists, or @name is empty,
+#          GenericError
+#          If the format of the image used does not support it,
+#          BlockFormatFeatureNotSupported
+#
+# Since 1.7
+##
+{ 'command': 'blockdev-snapshot-internal-sync',
+  'data': 'BlockdevSnapshotInternal' }
+
 ##
 # @human-monitor-command:
 #
index 66701927af8b26eb3e26cf6dcbca0c5b656ef5f6..5c9ddef3a5f591c239c4b48bee8bf2decf5377ea 100644 (file)
@@ -1095,6 +1095,35 @@ Example:
                                                         "format": "qcow2" } }
 <- { "return": {} }
 
+EQMP
+
+    {
+        .name       = "blockdev-snapshot-internal-sync",
+        .args_type  = "device:B,name:s",
+        .mhandler.cmd_new = qmp_marshal_input_blockdev_snapshot_internal_sync,
+    },
+
+SQMP
+blockdev-snapshot-internal-sync
+-------------------------------
+
+Synchronously take an internal snapshot of a block device when the format of
+image used supports it.  If the name is an empty string, or a snapshot with
+name already exists, the operation will fail.
+
+Arguments:
+
+- "device": device name to snapshot (json-string)
+- "name": name of the new snapshot (json-string)
+
+Example:
+
+-> { "execute": "blockdev-snapshot-internal-sync",
+                "arguments": { "device": "ide-hd0",
+                               "name": "snapshot0" }
+   }
+<- { "return": {} }
+
 EQMP
 
     {