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