Re: [PATCH 5/6] qemu: Add infrastructure for 'block-export-add' to export NBD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/14/20 5:04 AM, Peter Krempa wrote:
Add the monitor code, corresponding generator of properties for NBD and
tests validating it against the schema.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
  src/qemu/qemu_block.c        | 25 +++++++++++++++++++++++++
  src/qemu/qemu_block.h        |  7 +++++++
  src/qemu/qemu_monitor.c      | 10 ++++++++++
  src/qemu/qemu_monitor.h      |  4 ++++
  src/qemu/qemu_monitor_json.c | 21 +++++++++++++++++++++
  src/qemu/qemu_monitor_json.h |  4 ++++
  tests/qemumonitorjsontest.c  | 23 +++++++++++++++++++++++
  7 files changed, 94 insertions(+)



+virJSONValuePtr
+qemuBlockExportGetNBDProps(const char *nodename,
+                           const char *exportname,
+                           bool writable,
+                           const char *bitmap)
+{
+    g_autofree char *exportid = NULL;
+    virJSONValuePtr ret = NULL;
+
+    exportid = g_strdup_printf("libvirt-nbd-%s", nodename);
+
+    if (virJSONValueObjectCreate(&ret,
+                                 "s:type", "nbd",
+                                 "s:id", exportid,
+                                 "s:node-name", nodename,
+                                 "b:writable", writable,
+                                 "s:name", exportname,
+                                 "S:bitmap", bitmap,
+                                 NULL) < 0)

The plan is to upgrade to '*bitmaps':['str'], and retiring '*bitmap':'str' when nbd-server-add goes away:
https://lists.gnu.org/archive/html/qemu-devel/2020-10/msg02713.html

so you'll need to tweak this to match.

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux