yeahuh / rpms / qemu-kvm

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