Blame SOURCES/kvm-qapi-new-qmp-command-nbd-server-add-bitmap.patch

357786
From 9949f65ad44a273fabbf98591ef98b4742e6882f Mon Sep 17 00:00:00 2001
357786
From: John Snow <jsnow@redhat.com>
357786
Date: Wed, 18 Jul 2018 22:55:04 +0200
357786
Subject: [PATCH 79/89] qapi: new qmp command nbd-server-add-bitmap
357786
357786
RH-Author: John Snow <jsnow@redhat.com>
357786
Message-id: <20180718225511.14878-29-jsnow@redhat.com>
357786
Patchwork-id: 81408
357786
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 28/35] qapi: new qmp command nbd-server-add-bitmap
357786
Bugzilla: 1207657
357786
RH-Acked-by: Eric Blake <eblake@redhat.com>
357786
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
357786
RH-Acked-by: Fam Zheng <famz@redhat.com>
357786
357786
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
357786
357786
For now, the actual command ix x-nbd-server-add-bitmap, reflecting
357786
the fact that we are still working on libvirt code that proves the
357786
command works as needed, and also the fact that we may remove
357786
bitmap-export-name (and just require that the exported name be the
357786
bitmap name).
357786
357786
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
357786
Message-Id: <20180609151758.17343-6-vsementsov@virtuozzo.com>
357786
Reviewed-by: Eric Blake <eblake@redhat.com>
357786
[eblake: make the command experimental by adding x- prefix]
357786
Signed-off-by: Eric Blake <eblake@redhat.com>
357786
(cherry picked from commit 767f0c7d6cddedbc97ad700bd1e0229cc2ce5eb5)
357786
Signed-off-by: John Snow <jsnow@redhat.com>
357786
357786
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
357786
---
357786
 blockdev-nbd.c  | 23 +++++++++++++++++++++++
357786
 qapi/block.json | 23 +++++++++++++++++++++++
357786
 2 files changed, 46 insertions(+)
357786
357786
diff --git a/blockdev-nbd.c b/blockdev-nbd.c
357786
index 65a8473..1ef1104 100644
357786
--- a/blockdev-nbd.c
357786
+++ b/blockdev-nbd.c
357786
@@ -220,3 +220,26 @@ void qmp_nbd_server_stop(Error **errp)
357786
     nbd_server_free(nbd_server);
357786
     nbd_server = NULL;
357786
 }
357786
+
357786
+void qmp_x_nbd_server_add_bitmap(const char *name, const char *bitmap,
357786
+                                 bool has_bitmap_export_name,
357786
+                                 const char *bitmap_export_name,
357786
+                                 Error **errp)
357786
+{
357786
+    NBDExport *exp;
357786
+
357786
+    if (!nbd_server) {
357786
+        error_setg(errp, "NBD server not running");
357786
+        return;
357786
+    }
357786
+
357786
+    exp = nbd_export_find(name);
357786
+    if (exp == NULL) {
357786
+        error_setg(errp, "Export '%s' is not found", name);
357786
+        return;
357786
+    }
357786
+
357786
+    nbd_export_bitmap(exp, bitmap,
357786
+                      has_bitmap_export_name ? bitmap_export_name : bitmap,
357786
+                      errp);
357786
+}
357786
diff --git a/qapi/block.json b/qapi/block.json
357786
index f05b91a..ba85ceb 100644
357786
--- a/qapi/block.json
357786
+++ b/qapi/block.json
357786
@@ -364,6 +364,29 @@
357786
   'data': {'name': 'str', '*mode': 'NbdServerRemoveMode'} }
357786
 
357786
 ##
357786
+# @x-nbd-server-add-bitmap:
357786
+#
357786
+# Expose a dirty bitmap associated with the selected export. The bitmap search
357786
+# starts at the device attached to the export, and includes all backing files.
357786
+# The exported bitmap is then locked until the NBD export is removed.
357786
+#
357786
+# @name: Export name.
357786
+#
357786
+# @bitmap: Bitmap name to search for.
357786
+#
357786
+# @bitmap-export-name: How the bitmap will be seen by nbd clients
357786
+#                      (default @bitmap)
357786
+#
357786
+# Note: the client must use NBD_OPT_SET_META_CONTEXT with a query of
357786
+# "qemu:dirty-bitmap:NAME" (where NAME matches @bitmap-export-name) to access
357786
+# the exposed bitmap.
357786
+#
357786
+# Since: 3.0
357786
+##
357786
+  { 'command': 'x-nbd-server-add-bitmap',
357786
+    'data': {'name': 'str', 'bitmap': 'str', '*bitmap-export-name': 'str'} }
357786
+
357786
+##
357786
 # @nbd-server-stop:
357786
 #
357786
 # Stop QEMU's embedded NBD server, and unregister all devices previously
357786
-- 
357786
1.8.3.1
357786