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