9ae3a8
From 8e79bb0e25c48354f895077b206ded171507ba55 Mon Sep 17 00:00:00 2001
9ae3a8
From: Jeffrey Cody <jcody@redhat.com>
9ae3a8
Date: Fri, 19 Sep 2014 03:18:59 +0200
9ae3a8
Subject: [PATCH 20/20] block: add __com.redhat_change-backing-file qmp command
9ae3a8
9ae3a8
Message-id: <c7fc7cefc7588dca2d02b0cc0051cdbdadbf20ac.1411096194.git.jcody@redhat.com>
9ae3a8
Patchwork-id: 61313
9ae3a8
O-Subject: [PATCH qemu-kvm-rhev RHEL7.0.z 4/4] block: add __com.redhat_change-backing-file qmp command
9ae3a8
Bugzilla: 1122925
9ae3a8
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
RH-Acked-by: Eric Blake <eblake@redhat.com>
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
9ae3a8
Upstream, the QAPI command 'change-backing-file' was added in a patch,
9ae3a8
as part of a series that allowed libvirt to specify backing file
9ae3a8
names in block-commit and block-stream.
9ae3a8
9ae3a8
This standalone QAPI (change-backing-file) is not currently in use by
9ae3a8
libvirt, except as a witness that QEMU has the ability to change backing
9ae3a8
files in block-commit and block-stream.
9ae3a8
9ae3a8
However, change-backing-file also relies on node-names functionality,
9ae3a8
which is not present in RHEL7.0.  The backport of node-names would also
9ae3a8
be fairly instrusive, especially for a command that is not going to be
9ae3a8
used beyond verifying its presence.
9ae3a8
9ae3a8
This downstream patch adds __com.redhat_change-backing-file, which
9ae3a8
accepts the same arguments as its upstream namesake.  However, no action
9ae3a8
is performed, and the command always returns QERR_UNSUPPORTED.
9ae3a8
9ae3a8
This is not placed inside the RHEL/RHEV differentiation commands, as it
9ae3a8
is not a live block operation (upstream or the dummy version), and
9ae3a8
returns synchronously.
9ae3a8
9ae3a8
Signed-off-by: Jeff Cody <jcody@redhat.com>
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 blockdev.c       |    8 ++++++++
9ae3a8
 qapi-schema.json |   16 ++++++++++++++++
9ae3a8
 qmp-commands.hx  |   22 ++++++++++++++++++++++
9ae3a8
 3 files changed, 46 insertions(+), 0 deletions(-)
9ae3a8
9ae3a8
diff --git a/blockdev.c b/blockdev.c
9ae3a8
index 09ef3f7..7d4a53f 100644
9ae3a8
--- a/blockdev.c
9ae3a8
+++ b/blockdev.c
9ae3a8
@@ -1782,6 +1782,14 @@ void qmp_block_job_complete(const char *device, Error **errp)
9ae3a8
     block_job_complete(job, errp);
9ae3a8
 }
9ae3a8
 
9ae3a8
+void qmp___com_redhat_change_backing_file(const char *device,
9ae3a8
+                                          const char *image_node_name,
9ae3a8
+                                          const char *backing_file,
9ae3a8
+                                          Error **errp)
9ae3a8
+{
9ae3a8
+    error_set(errp, QERR_UNSUPPORTED);
9ae3a8
+}
9ae3a8
+
9ae3a8
 void qmp_blockdev_add(BlockdevOptions *options, Error **errp)
9ae3a8
 {
9ae3a8
     QmpOutputVisitor *ov = qmp_output_visitor_new();
9ae3a8
diff --git a/qapi-schema.json b/qapi-schema.json
9ae3a8
index 40bd2a6..d3d4e57 100644
9ae3a8
--- a/qapi-schema.json
9ae3a8
+++ b/qapi-schema.json
9ae3a8
@@ -1832,6 +1832,22 @@
9ae3a8
   'data': {'command-line': 'str', '*cpu-index': 'int'},
9ae3a8
   'returns': 'str' }
9ae3a8
 
9ae3a8
+##
9ae3a8
+# @__com.redhat_change-backing-file
9ae3a8
+#
9ae3a8
+# This is a placeholder function, that exists as a witness for libvirt
9ae3a8
+# that the ability to specify backing files in block-commit and block-stream
9ae3a8
+# exists in this version of QEMU.
9ae3a8
+#
9ae3a8
+# It has the same argument requirements as the upstream 'change-backing-file',
9ae3a8
+# but performs no action.
9ae3a8
+#
9ae3a8
+# Returns: NotSupported
9ae3a8
+##
9ae3a8
+{ 'command': '__com.redhat_change-backing-file',
9ae3a8
+  'data': { 'device': 'str', 'image-node-name': 'str',
9ae3a8
+            'backing-file': 'str' } }
9ae3a8
+
9ae3a8
 #_rhev-only CONFIG_LIVE_BLOCK_OPS
9ae3a8
 ##
9ae3a8
 # @block-commit
9ae3a8
diff --git a/qmp-commands.hx b/qmp-commands.hx
9ae3a8
index c07cf8a..e164ff8 100644
9ae3a8
--- a/qmp-commands.hx
9ae3a8
+++ b/qmp-commands.hx
9ae3a8
@@ -1241,6 +1241,28 @@ EQMP
9ae3a8
 #endif
9ae3a8
 
9ae3a8
     {
9ae3a8
+        .name       = RFQDN_REDHAT "change-backing-file",
9ae3a8
+        .args_type  = "device:s,image-node-name:s,backing-file:s",
9ae3a8
+        .mhandler.cmd_new = qmp_marshal_input___com_redhat_change_backing_file,
9ae3a8
+    },
9ae3a8
+
9ae3a8
+SQMP
9ae3a8
+@__com.redhat_change-backing-file
9ae3a8
+-------------------
9ae3a8
+@__com.redhat_change-backing-file
9ae3a8
+
9ae3a8
+This is a placeholder function, that exists as a witness for libvirt
9ae3a8
+that the ability to specify backing files block-commit and block-stream
9ae3a8
+exists in this version of QEMU.
9ae3a8
+
9ae3a8
+It has the same argument requirements as the upstream 'change-backing-file',
9ae3a8
+but performs no action.
9ae3a8
+
9ae3a8
+Returns: NotSupported
9ae3a8
+
9ae3a8
+EQMP
9ae3a8
+
9ae3a8
+    {
9ae3a8
         .name       = "balloon",
9ae3a8
         .args_type  = "value:M",
9ae3a8
         .mhandler.cmd_new = qmp_marshal_input_balloon,
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8