From nobody Thu Apr 25 08:52:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1559790151; cv=none; d=zoho.com; s=zohoarc; b=SiIcJvfPsPolD0AjgGnGmWXvGX01RE+epyusBdLyhYCN/VUJh8r7+tYd0nZRwBrDLXJ1gI8AxqdBo0b5mZoCgNNQG1GSYBJJIj7cMZ3TpK6gyTVYDgNu0dxcygJx+Qn6Tk6+o3gEFtLqQ5oRdpN2P7XOfUOJJlZ1y3elFIf3I3o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559790151; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=d14oq8ZfZX+1ho3xjyu218yOo4IAoZUoUofqlpA6gRY=; b=PjvY6ADqVhZRNzt7lD8N3Y/Pqe8vBCfrRB/BwmpYWu7R5e6cSQHm5GjBXwcgul0+l4VvhU3j7/Sfsa31n0nRwgb0asLvs34BLHrDIioCjKig8R6/l2ajDvXL8w3c4uaIA2q126LmBk882djQaNfvisIhWdzR03Z6CZhPrgJnIvY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1559790151788725.7554985692117; Wed, 5 Jun 2019 20:02:31 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BB050356DB; Thu, 6 Jun 2019 03:02:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 96B1758826; Thu, 6 Jun 2019 03:02:28 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7B23E8E1F; Thu, 6 Jun 2019 03:02:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5631E6p013413 for ; Wed, 5 Jun 2019 23:01:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 16B272E026; Thu, 6 Jun 2019 03:01:14 +0000 (UTC) Received: from blue.redhat.com (ovpn-116-85.phx2.redhat.com [10.3.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id AC3A92E025; Thu, 6 Jun 2019 03:01:13 +0000 (UTC) From: Eric Blake To: libvir-list@redhat.com Date: Wed, 5 Jun 2019 22:01:07 -0500 Message-Id: <20190606030110.4457-2-eblake@redhat.com> In-Reply-To: <20190606030110.4457-1-eblake@redhat.com> References: <20190606030110.4457-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: pkrempa@redhat.com Subject: [libvirt] [PATCH 1/4] backup: Prepare for Unix sockets in QMP nbd-server-start X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 06 Jun 2019 03:02:30 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Migration always uses a TCP socket for NBD servers, because we don't support same-host migration. But upcoming pull-mode incremental backup needs to also support a Unix socket, for retrieving the backup from the same host. Support this by plumbing virStorageNetHostDef through the monitor calls, since that is a nice reusable struct that can track both TCP and Unix sockets. Update qemumonitorjsontest to not only test the response to the command, but to actually verify that the command itself uses the two correct QMP forms. I'm actually a bit surprised that we are not utilizing qemuMonitorTestAddItemVerbatim more frequently. Signed-off-by: Eric Blake --- src/qemu/qemu_monitor.h | 6 ++-- src/qemu/qemu_monitor_json.h | 3 +- src/qemu/qemu_migration.c | 7 ++++- src/qemu/qemu_monitor.c | 13 +++++--- src/qemu/qemu_monitor_json.c | 23 ++++++++++---- tests/qemumonitorjsontest.c | 58 ++++++++++++++++++++++++++++++++++-- 6 files changed, 92 insertions(+), 18 deletions(-) diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index dee594fa66..fa84ff821e 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1094,9 +1094,9 @@ int qemuMonitorGetObjectProps(qemuMonitorPtr mon, char *qemuMonitorGetTargetArch(qemuMonitorPtr mon); int qemuMonitorNBDServerStart(qemuMonitorPtr mon, - const char *host, - unsigned int port, - const char *tls_alias); + const virStorageNetHostDef *server, + const char *tls_alias) + ATTRIBUTE_NONNULL(2); int qemuMonitorNBDServerAdd(qemuMonitorPtr mon, const char *deviceID, bool writable); diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index acef1a0a79..e41bdc8c4f 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -459,8 +459,7 @@ int qemuMonitorJSONGetObjectProps(qemuMonitorPtr mon, char *qemuMonitorJSONGetTargetArch(qemuMonitorPtr mon); int qemuMonitorJSONNBDServerStart(qemuMonitorPtr mon, - const char *host, - unsigned int port, + const virStorageNetHostDef *server, const char *tls_alias); int qemuMonitorJSONNBDServerAdd(qemuMonitorPtr mon, const char *deviceID, diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 32b3040473..267a729c6f 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -380,6 +380,10 @@ qemuMigrationDstStartNBDServer(virQEMUDriverPtr driver, unsigned short port =3D 0; char *diskAlias =3D NULL; size_t i; + virStorageNetHostDef server =3D { + .name =3D (char *)listenAddr, /* cast away const */ + .transport =3D VIR_STORAGE_NET_HOST_TRANS_TCP, + }; if (nbdPort < 0 || nbdPort > USHRT_MAX) { virReportError(VIR_ERR_INVALID_ARG, "%s", @@ -415,7 +419,8 @@ qemuMigrationDstStartNBDServer(virQEMUDriverPtr driver, else if (virPortAllocatorAcquire(driver->migrationPorts, &port= ) < 0) goto exit_monitor; - if (qemuMonitorNBDServerStart(priv->mon, listenAddr, port, tls= _alias) < 0) + server.port =3D port; + if (qemuMonitorNBDServerStart(priv->mon, &server, tls_alias) <= 0) goto exit_monitor; } diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 6b731cd91a..187513a986 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3925,15 +3925,20 @@ qemuMonitorGetSEVCapabilities(qemuMonitorPtr mon, int qemuMonitorNBDServerStart(qemuMonitorPtr mon, - const char *host, - unsigned int port, + const virStorageNetHostDef *server, const char *tls_alias) { - VIR_DEBUG("host=3D%s port=3D%u tls_alias=3D%s", host, port, NULLSTR(tl= s_alias)); + /* Peek inside the struct for nicer logging */ + if (server->transport =3D=3D VIR_STORAGE_NET_HOST_TRANS_TCP) + VIR_DEBUG("server=3D{tcp host=3D%s port=3D%u} tls_alias=3D%s", + NULLSTR(server->name), server->port, NULLSTR(tls_alias)); + else + VIR_DEBUG("server=3D{unix socket=3D%s} tls_alias=3D%s", + NULLSTR(server->socket), NULLSTR(tls_alias)); QEMU_CHECK_MONITOR(mon); - return qemuMonitorJSONNBDServerStart(mon, host, port, tls_alias); + return qemuMonitorJSONNBDServerStart(mon, server, tls_alias); } diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 53a7de8b77..93113d4e8a 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -6684,8 +6684,7 @@ qemuMonitorJSONBuildUnixSocketAddress(const char *pat= h) int qemuMonitorJSONNBDServerStart(qemuMonitorPtr mon, - const char *host, - unsigned int port, + const virStorageNetHostDef *server, const char *tls_alias) { int ret =3D -1; @@ -6694,10 +6693,22 @@ qemuMonitorJSONNBDServerStart(qemuMonitorPtr mon, virJSONValuePtr addr =3D NULL; char *port_str =3D NULL; - if (virAsprintf(&port_str, "%u", port) < 0) - return ret; - - if (!(addr =3D qemuMonitorJSONBuildInetSocketAddress(host, port_str))) + switch ((virStorageNetHostTransport)server->transport) { + case VIR_STORAGE_NET_HOST_TRANS_TCP: + if (virAsprintf(&port_str, "%u", server->port) < 0) + return ret; + addr =3D qemuMonitorJSONBuildInetSocketAddress(server->name, port_= str); + break; + case VIR_STORAGE_NET_HOST_TRANS_UNIX: + addr =3D qemuMonitorJSONBuildUnixSocketAddress(server->socket); + break; + case VIR_STORAGE_NET_HOST_TRANS_RDMA: + case VIR_STORAGE_NET_HOST_TRANS_LAST: + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("invalid server address")); + goto cleanup; + } + if (!addr) goto cleanup; if (!(cmd =3D qemuMonitorJSONMakeCommand("nbd-server-start", diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 0894e748ae..9d707fcc7c 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1348,7 +1348,6 @@ GEN_TEST_FUNC(qemuMonitorJSONBlockCommit, "vdb", "/fo= o/bar1", "/foo/bar2", "back GEN_TEST_FUNC(qemuMonitorJSONDrivePivot, "vdb") GEN_TEST_FUNC(qemuMonitorJSONScreendump, "devicename", 1, "/foo/bar") GEN_TEST_FUNC(qemuMonitorJSONOpenGraphics, "spice", "spicefd", false) -GEN_TEST_FUNC(qemuMonitorJSONNBDServerStart, "localhost", 12345, "test-ali= as") GEN_TEST_FUNC(qemuMonitorJSONNBDServerAdd, "vda", true) GEN_TEST_FUNC(qemuMonitorJSONDetachCharDev, "serial1") GEN_TEST_FUNC(qemuMonitorJSONBlockdevTrayOpen, "foodev", true) @@ -1356,6 +1355,61 @@ GEN_TEST_FUNC(qemuMonitorJSONBlockdevTrayClose, "foo= dev") GEN_TEST_FUNC(qemuMonitorJSONBlockdevMediumRemove, "foodev") GEN_TEST_FUNC(qemuMonitorJSONBlockdevMediumInsert, "foodev", "newnode") +static int +testQemuMonitorJSONqemuMonitorJSONNBDServerStart(const void *opaque) +{ + virDomainXMLOptionPtr xmlopt =3D (virDomainXMLOptionPtr) opaque; + qemuMonitorTestPtr test =3D qemuMonitorTestNewSimple(true, xmlopt); + int ret =3D -1; + virStorageNetHostDef server_tcp =3D { + .name =3D (char *)"localhost", + .port =3D 12345, + .transport =3D VIR_STORAGE_NET_HOST_TRANS_TCP, + }; + virStorageNetHostDef server_unix =3D { + .socket =3D (char *)"/tmp/sock", + .transport =3D VIR_STORAGE_NET_HOST_TRANS_UNIX, + }; + + if (!test) + return -1; + + if (qemuMonitorTestAddItemVerbatim(test, + "{\"execute\":\"nbd-server-start\"," + " \"arguments\":{\"addr\":{" + " \"type\":\"inet\",\"data\":{" + " \"host\":\"localhost\"," + " \"port\":\"12345\"}}," + " \"tls-creds\":\"test-alias\"}," + " \"id\":\"libvirt-1\"}", + NULL, "{\"return\":{}}") < 0) + goto cleanup; + + if (qemuMonitorTestAddItemVerbatim(test, + "{\"execute\":\"nbd-server-start\"," + " \"arguments\":{\"addr\":{" + " \"type\":\"unix\",\"data\":{" + " \"path\":\"/tmp/sock\"}}," + " \"tls-creds\":\"test-alias\"}," + " \"id\":\"libvirt-2\"}", + NULL, "{\"return\":{}}") < 0) + goto cleanup; + + if (qemuMonitorJSONNBDServerStart(qemuMonitorTestGetMonitor(test), + &server_tcp, "test-alias") < 0) + goto cleanup; + + if (qemuMonitorJSONNBDServerStart(qemuMonitorTestGetMonitor(test), + &server_unix, "test-alias") < 0) + goto cleanup; + + ret =3D 0; + + cleanup: + qemuMonitorTestFree(test); + return ret; +} + static bool testQemuMonitorJSONqemuMonitorJSONQueryCPUsEqual(struct qemuMonitorQueryCp= usEntry *a, struct qemuMonitorQueryCp= usEntry *b) @@ -3014,7 +3068,6 @@ mymain(void) DO_TEST_GEN(qemuMonitorJSONDrivePivot); DO_TEST_GEN(qemuMonitorJSONScreendump); DO_TEST_GEN(qemuMonitorJSONOpenGraphics); - DO_TEST_GEN(qemuMonitorJSONNBDServerStart); DO_TEST_GEN(qemuMonitorJSONNBDServerAdd); DO_TEST_GEN(qemuMonitorJSONDetachCharDev); DO_TEST_GEN(qemuMonitorJSONBlockdevTrayOpen); @@ -3036,6 +3089,7 @@ mymain(void) DO_TEST(qemuMonitorJSONGetDumpGuestMemoryCapability); DO_TEST(qemuMonitorJSONSendKeyHoldtime); DO_TEST(qemuMonitorSupportsActiveCommit); + DO_TEST(qemuMonitorJSONNBDServerStart); DO_TEST_CPU_DATA("host"); DO_TEST_CPU_DATA("full"); --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 08:52:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1559790130; cv=none; d=zoho.com; s=zohoarc; b=QyQVbU2uNMk/WffPyDg+RZOxKo5//wmL4hRH4UjaIbEjyUFB7uWEKdiWikUw1q2kIFY5SlwwsRGbetRWrtOQPPWdPvUGoJcQpOKp2r1du/JY24ktu9EOd1Wx+wBmb9RZBXwRQhydl4vTzqHbjdy+z49QUaR9STqkJLsbeDhRpNI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559790130; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=jgqQmSXCR3yG7/DGsfanOQHat2Ps0QJc/lXOvXMhRlo=; b=bU9lBujXf3xJ5fcabdrqWXo6bFr1JUkFQzm3FqZ/GlM3ZpAZvv4iZHNb44gZ6cyfWf2whAd/dV7J4tKPU0uh4+z1vLvDBctorAkZ0j5A0tbpsPr3feIzArziIuFnOomAXd7HOJi1N66SHUnIRuhhIFM7T9KZ5qd8CdYOQOFq0sI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1559790130625229.7405554300483; Wed, 5 Jun 2019 20:02:10 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 916E3C1EB1EE; Thu, 6 Jun 2019 03:01:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 875AC6837F; Thu, 6 Jun 2019 03:01:46 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E85A11806B16; Thu, 6 Jun 2019 03:01:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5631E13013418 for ; Wed, 5 Jun 2019 23:01:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8BFC62E026; Thu, 6 Jun 2019 03:01:14 +0000 (UTC) Received: from blue.redhat.com (ovpn-116-85.phx2.redhat.com [10.3.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E1532E029; Thu, 6 Jun 2019 03:01:14 +0000 (UTC) From: Eric Blake To: libvir-list@redhat.com Date: Wed, 5 Jun 2019 22:01:08 -0500 Message-Id: <20190606030110.4457-3-eblake@redhat.com> In-Reply-To: <20190606030110.4457-1-eblake@redhat.com> References: <20190606030110.4457-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: pkrempa@redhat.com Subject: [libvirt] [PATCH 2/4] backup: Add two new qemu capabilities X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 06 Jun 2019 03:02:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Add two capabilities for testing features required for the upcoming virDomainBackupBegin: use block-dirty-bitmap-merge as the generic witness of bitmap support needed for checkpoints (since all of the bitmap management functionalities were finalized in the same qemu 4.0 release), and the bitmap parameter to nbd-server-add for pull-mode backup support. Even though both capabilities are likely to be present or absent together (that is, it is unlikely to encounter a qemu that backports only one of the two), it still makes sense to keep two capabilities as the two uses are orthogonal (full backups don't require checkpoints, push mode backups don't require NBD bitmap support, and checkpoints can be used for more than just incremental backups). Signed-off-by: Eric Blake --- src/qemu/qemu_capabilities.h | 4 ++++ src/qemu/qemu_capabilities.c | 6 ++++++ tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml | 2 ++ tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml | 2 ++ tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml | 2 ++ tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml | 2 ++ tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml | 2 ++ tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml | 2 ++ 8 files changed, 22 insertions(+) diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 0f282ad239..3032d4edcd 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -509,6 +509,10 @@ typedef enum { /* virQEMUCapsFlags grouping marker for= syntax-check */ QEMU_CAPS_QUERY_CURRENT_MACHINE, /* query-current-machine command */ QEMU_CAPS_MACHINE_VIRT_IOMMU, /* -machine virt,iommu */ + /* 330 */ + QEMU_CAPS_BITMAP_MERGE, /* block-dirty-bitmap-merge */ + QEMU_CAPS_NBD_BITMAP, /* nbd-server-add supports bitmap */ + QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index c8d724aed5..d0fdd1da9f 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -526,6 +526,10 @@ VIR_ENUM_IMPL(virQEMUCaps, "overcommit", "query-current-machine", "machine.virt.iommu", + + /* 330 */ + "bitmap-merge", + "nbd-bitmap", ); @@ -970,6 +974,7 @@ struct virQEMUCapsStringFlags virQEMUCapsCommands[] =3D= { { "qom-list-properties", QEMU_CAPS_QOM_LIST_PROPERTIES }, { "blockdev-del", QEMU_CAPS_BLOCKDEV_DEL }, { "query-current-machine", QEMU_CAPS_QUERY_CURRENT_MACHINE }, + { "block-dirty-bitmap-merge", QEMU_CAPS_BITMAP_MERGE }, }; struct virQEMUCapsStringFlags virQEMUCapsMigration[] =3D { @@ -1264,6 +1269,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsQMPSc= hemaQueries[] =3D { { "block-commit/arg-type/*top", QEMU_CAPS_ACTIVE_COMMIT }, { "query-iothreads/ret-type/poll-max-ns", QEMU_CAPS_IOTHREAD_POLLING }, { "query-display-options/ret-type/+egl-headless/rendernode", QEMU_CAPS= _EGL_HEADLESS_RENDERNODE }, + { "nbd-server-add/arg-type/bitmap", QEMU_CAPS_NBD_BITMAP }, }; typedef struct _virQEMUCapsObjectTypeProps virQEMUCapsObjectTypeProps; diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml b/tests/qemu= capabilitiesdata/caps_4.0.0.aarch64.xml index e071bc0c8d..250b7edd52 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml @@ -161,6 +161,8 @@ + + 4000000 0 61700758 diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml b/tests/qemuca= pabilitiesdata/caps_4.0.0.ppc64.xml index 9c4e6583ec..24b55002a6 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml @@ -166,6 +166,8 @@ + + 4000000 0 42900758 diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml b/tests/qemu= capabilitiesdata/caps_4.0.0.riscv32.xml index e987cdd415..230e1e7c99 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml @@ -164,6 +164,8 @@ + + 4000000 0 0 diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml b/tests/qemu= capabilitiesdata/caps_4.0.0.riscv64.xml index e1a07dd945..4b2f4cf628 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml @@ -164,6 +164,8 @@ + + 4000000 0 0 diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml b/tests/qemuca= pabilitiesdata/caps_4.0.0.s390x.xml index 8cb537eaf4..a1ac2587a0 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml @@ -129,6 +129,8 @@ + + 4000000 0 39100758 diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_4.0.0.x86_64.xml index ca7174e3b9..68845cca74 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml @@ -202,6 +202,8 @@ + + 4000000 0 43100758 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 08:52:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1559790156; cv=none; d=zoho.com; s=zohoarc; b=VeGwAPvV+fy9qOWUgdpKj09HglJ9gMXDicNA1zclgI/kdINiP+Egt2E2pOAJzCmi8zvZ3P2XoFwbMOXYybHhjHqBB74xKISb+LcWqM7wlHBP3ieqfUMC/2+3S2noArdW037F2dTusWQXm4x4grfh8JQq4vGbfxKUcp+kqMSuGcU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559790156; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=hAcF2rjrDLfhzrsc3mHbJXpu9qHmzLFWYl0UCQifrys=; b=gUmAGo06diJuSSQPH3UOPNCw4nshPiqf50i4OSaiyaMJmCFp9BRWhEIslia1HGsokN2AaxQuPA7anUzNPZinAisxHEZjTKQYHPAfbsC5Eem7VvgpkiY2IRTt1IL3CkuSEiGIDikX4cAdpo4fWiY3uWZMuibJ7I2L7V4wSrE4biA= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1559790156799918.3033572098598; Wed, 5 Jun 2019 20:02:36 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2AB5A3082E71; Thu, 6 Jun 2019 03:02:35 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 042931057F32; Thu, 6 Jun 2019 03:02:35 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C027BC597; Thu, 6 Jun 2019 03:02:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5631FXw013424 for ; Wed, 5 Jun 2019 23:01:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 068BA2E026; Thu, 6 Jun 2019 03:01:15 +0000 (UTC) Received: from blue.redhat.com (ovpn-116-85.phx2.redhat.com [10.3.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id AE7832E025; Thu, 6 Jun 2019 03:01:14 +0000 (UTC) From: Eric Blake To: libvir-list@redhat.com Date: Wed, 5 Jun 2019 22:01:09 -0500 Message-Id: <20190606030110.4457-4-eblake@redhat.com> In-Reply-To: <20190606030110.4457-1-eblake@redhat.com> References: <20190606030110.4457-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: pkrempa@redhat.com Subject: [libvirt] [PATCH 3/4] backup: Add new qemu monitor bitmap X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 06 Jun 2019 03:02:35 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The upcoming virDomainBackup() API needs to take advantage of various qcow2 bitmap manipulations as the basis to virDomainCheckpoints and incremental backups. Add four functions to expose block-dirty-bitmap-{add,enable,disable,merge} (this is the recently-added QEMU_CAPS_BITMAP_MERGE capability). Signed-off-by: Eric Blake --- src/qemu/qemu_monitor.h | 19 ++++++ src/qemu/qemu_monitor_json.h | 17 +++++ src/qemu/qemu_monitor.c | 51 +++++++++++++++ src/qemu/qemu_monitor_json.c | 119 +++++++++++++++++++++++++++++++++++ 4 files changed, 206 insertions(+) diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index fa84ff821e..30474c325d 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -646,6 +646,25 @@ int qemuMonitorSetBalloon(qemuMonitorPtr mon, unsigned long long newmem); int qemuMonitorSetCPU(qemuMonitorPtr mon, int cpu, bool online); +int qemuMonitorAddBitmap(qemuMonitorPtr mon, + const char *node, + const char *bitmap, + bool persistent) + ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); +int qemuMonitorEnableBitmap(qemuMonitorPtr mon, + const char *node, + const char *bitmap) + ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); +int qemuMonitorMergeBitmaps(qemuMonitorPtr mon, + const char *node, + const char *dst, + virJSONValuePtr *src) + ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4); +int qemuMonitorDeleteBitmap(qemuMonitorPtr mon, + const char *node, + const char *bitmap) + ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); + /* XXX should we pass the virDomainDiskDefPtr instead * and hide dev_name details inside monitor. Reconsider diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index e41bdc8c4f..8f92e6de35 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -580,5 +580,22 @@ int qemuMonitorJSONGetCurrentMachineInfo(qemuMonitorPtr mon, qemuMonitorCurrentMachineInfoPtr info) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); +int qemuMonitorJSONAddBitmap(qemuMonitorPtr mon, + const char *node, + const char *bitmap, + bool persistent); + +int qemuMonitorJSONEnableBitmap(qemuMonitorPtr mon, + const char *node, + const char *bitmap); + +int qemuMonitorJSONMergeBitmaps(qemuMonitorPtr mon, + const char *node, + const char *dst, + virJSONValuePtr *src); + +int qemuMonitorJSONDeleteBitmap(qemuMonitorPtr mon, + const char *node, + const char *bitmap); #endif /* LIBVIRT_QEMU_MONITOR_JSON_H */ diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 187513a986..a371f7d425 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4488,3 +4488,54 @@ qemuMonitorGetCurrentMachineInfo(qemuMonitorPtr mon, return qemuMonitorJSONGetCurrentMachineInfo(mon, info); } + + +int +qemuMonitorAddBitmap(qemuMonitorPtr mon, + const char *node, + const char *bitmap, + bool persistent) +{ + VIR_DEBUG("node=3D%s bitmap=3D%s persistent=3D%d", node, bitmap, persi= stent); + + QEMU_CHECK_MONITOR(mon); + + return qemuMonitorJSONAddBitmap(mon, node, bitmap, persistent); +} + +int +qemuMonitorEnableBitmap(qemuMonitorPtr mon, + const char *node, + const char *bitmap) +{ + VIR_DEBUG("node=3D%s bitmap=3D%s", node, bitmap); + + QEMU_CHECK_MONITOR(mon); + + return qemuMonitorJSONEnableBitmap(mon, node, bitmap); +} + +int +qemuMonitorMergeBitmaps(qemuMonitorPtr mon, + const char *node, + const char *dst, + virJSONValuePtr *src) +{ + VIR_DEBUG("node=3D%s dst=3D%s", node, dst); + + QEMU_CHECK_MONITOR(mon); + + return qemuMonitorJSONMergeBitmaps(mon, node, dst, src); +} + +int +qemuMonitorDeleteBitmap(qemuMonitorPtr mon, + const char *node, + const char *bitmap) +{ + VIR_DEBUG("node=3D%s bitmap=3D%s", node, bitmap); + + QEMU_CHECK_MONITOR(mon); + + return qemuMonitorJSONDeleteBitmap(mon, node, bitmap); +} diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 93113d4e8a..41eef0c38c 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -8510,3 +8510,122 @@ qemuMonitorJSONGetCurrentMachineInfo(qemuMonitorPtr= mon, virJSONValueFree(reply); return ret; } + + +int +qemuMonitorJSONAddBitmap(qemuMonitorPtr mon, + const char *node, + const char *bitmap, + bool persistent) +{ + int ret =3D -1; + virJSONValuePtr cmd; + virJSONValuePtr reply =3D NULL; + + if (!(cmd =3D qemuMonitorJSONMakeCommand("block-dirty-bitmap-add", + "s:node", node, + "s:name", bitmap, + "b:persistent", persistent, + NULL))) + return -1; + + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + goto cleanup; + + if (qemuMonitorJSONCheckError(cmd, reply) < 0) + goto cleanup; + + ret =3D 0; + cleanup: + virJSONValueFree(cmd); + virJSONValueFree(reply); + return ret; +} + +int +qemuMonitorJSONEnableBitmap(qemuMonitorPtr mon, + const char *node, + const char *bitmap) +{ + int ret =3D -1; + virJSONValuePtr cmd; + virJSONValuePtr reply =3D NULL; + + if (!(cmd =3D qemuMonitorJSONMakeCommand("block-dirty-bitmap-enable", + "s:node", node, + "s:name", bitmap, + NULL))) + return -1; + + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + goto cleanup; + + if (qemuMonitorJSONCheckError(cmd, reply) < 0) + goto cleanup; + + ret =3D 0; + cleanup: + virJSONValueFree(cmd); + virJSONValueFree(reply); + return ret; +} + +int +qemuMonitorJSONMergeBitmaps(qemuMonitorPtr mon, + const char *node, + const char *dst, + virJSONValuePtr *src) +{ + int ret =3D -1; + virJSONValuePtr cmd; + virJSONValuePtr reply =3D NULL; + + if (!(cmd =3D qemuMonitorJSONMakeCommand("block-dirty-bitmap-merge", + "s:node", node, + "s:target", dst, + "a:bitmaps", src, + NULL))) + goto cleanup; + + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + goto cleanup; + + if (qemuMonitorJSONCheckError(cmd, reply) < 0) + goto cleanup; + + ret =3D 0; + cleanup: + virJSONValueFree(*src); + *src =3D NULL; + virJSONValueFree(cmd); + virJSONValueFree(reply); + return ret; +} + +int +qemuMonitorJSONDeleteBitmap(qemuMonitorPtr mon, + const char *node, + const char *bitmap) +{ + int ret =3D -1; + virJSONValuePtr cmd; + virJSONValuePtr reply =3D NULL; + + if (!(cmd =3D qemuMonitorJSONMakeCommand("block-dirty-bitmap-remove", + "s:node", node, + "s:name", bitmap, + NULL))) + return -1; + + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + goto cleanup; + + if (qemuMonitorJSONCheckError(cmd, reply) < 0) + goto cleanup; + + ret =3D 0; + cleanup: + virJSONValueFree(cmd); + virJSONValueFree(reply); + return ret; +} --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 08:52:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1559790127; cv=none; d=zoho.com; s=zohoarc; b=lmxRCQ8Kn6wBSPgqhEnO6vmaSfSS054mCuN3pliIK+6Y+ujLIvB0LvBbmfCEyhgMWeqhA/sHuaNXPxhemNcJzIYL+tdCOQ+N44iI+S+aksTpS9uHCaoGYoFKikm5PywmdoMYgA8du2YdWiUb/0c+rnv23i3+MlcoEsCLkalZYQ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559790127; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=SDIYRXod09Vamu/9plXC1w3VnIIF++lQRF8fVEfA31o=; b=AsbSLv5urtt6DnFz4zZqP4FVPUjgLOJ0QM9R1gfAxaZ2rDzIS/qBSfiNj0fRuioBUvmipAcffqOPSoeASKD99TP7Wa+iELSp4cecBQkGdle3vX5O+BuT8fyIvZe37ahaODSCxoeiup5jkayAk1/ljnUMWwwePsCX3vS3XkGTj5A= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1559790127700131.4197459141136; Wed, 5 Jun 2019 20:02:07 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A17BDC05001F; Thu, 6 Jun 2019 03:01:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5B17A620AF; Thu, 6 Jun 2019 03:01:42 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E4AF21806B11; Thu, 6 Jun 2019 03:01:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5631FKf013436 for ; Wed, 5 Jun 2019 23:01:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7550A2E026; Thu, 6 Jun 2019 03:01:15 +0000 (UTC) Received: from blue.redhat.com (ovpn-116-85.phx2.redhat.com [10.3.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B0ED2E025; Thu, 6 Jun 2019 03:01:15 +0000 (UTC) From: Eric Blake To: libvir-list@redhat.com Date: Wed, 5 Jun 2019 22:01:10 -0500 Message-Id: <20190606030110.4457-5-eblake@redhat.com> In-Reply-To: <20190606030110.4457-1-eblake@redhat.com> References: <20190606030110.4457-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: pkrempa@redhat.com Subject: [libvirt] [PATCH 4/4] backup: Add new parameters to qemu monitor nbd-server-add X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 06 Jun 2019 03:02:06 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The upcoming virDomainBackup() API needs to take advantage of the ability to expose a bitmap as part of nbd-server-add for a pull-mode backup (this is the recently-added QEMU_CAPS_NBD_BITMAP capability). Signed-off-by: Eric Blake --- src/qemu/qemu_monitor.h | 4 +++- src/qemu/qemu_monitor_json.h | 4 +++- src/qemu/qemu_migration.c | 2 +- src/qemu/qemu_monitor.c | 10 +++++++--- src/qemu/qemu_monitor_json.c | 7 ++++++- tests/qemumonitorjsontest.c | 2 +- 6 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 30474c325d..482d51c41d 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1118,7 +1118,9 @@ int qemuMonitorNBDServerStart(qemuMonitorPtr mon, ATTRIBUTE_NONNULL(2); int qemuMonitorNBDServerAdd(qemuMonitorPtr mon, const char *deviceID, - bool writable); + const char *export, + bool writable, + const char *bitmap); int qemuMonitorNBDServerStop(qemuMonitorPtr); int qemuMonitorGetTPMModels(qemuMonitorPtr mon, char ***tpmmodels); diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 8f92e6de35..85d8f00fc0 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -463,7 +463,9 @@ int qemuMonitorJSONNBDServerStart(qemuMonitorPtr mon, const char *tls_alias); int qemuMonitorJSONNBDServerAdd(qemuMonitorPtr mon, const char *deviceID, - bool writable); + const char *export, + bool writable, + const char *bitmap); int qemuMonitorJSONNBDServerStop(qemuMonitorPtr mon); int qemuMonitorJSONGetTPMModels(qemuMonitorPtr mon, char ***tpmmodels) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 267a729c6f..a62cb668fe 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -424,7 +424,7 @@ qemuMigrationDstStartNBDServer(virQEMUDriverPtr driver, goto exit_monitor; } - if (qemuMonitorNBDServerAdd(priv->mon, diskAlias, true) < 0) + if (qemuMonitorNBDServerAdd(priv->mon, diskAlias, NULL, true, NULL= ) < 0) goto exit_monitor; if (qemuDomainObjExitMonitor(driver, vm) < 0) goto cleanup; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index a371f7d425..39df201eca 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3945,13 +3945,17 @@ qemuMonitorNBDServerStart(qemuMonitorPtr mon, int qemuMonitorNBDServerAdd(qemuMonitorPtr mon, const char *deviceID, - bool writable) + const char *export, + bool writable, + const char *bitmap) { - VIR_DEBUG("deviceID=3D%s", deviceID); + VIR_DEBUG("deviceID=3D%s, export=3D%s, bitmap=3D%s", deviceID, NULLSTR= (export), + NULLSTR(bitmap)); QEMU_CHECK_MONITOR(mon); - return qemuMonitorJSONNBDServerAdd(mon, deviceID, writable); + return qemuMonitorJSONNBDServerAdd(mon, deviceID, export, writable, + bitmap); } diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 41eef0c38c..6b66f6ef55 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -6736,15 +6736,20 @@ qemuMonitorJSONNBDServerStart(qemuMonitorPtr mon, int qemuMonitorJSONNBDServerAdd(qemuMonitorPtr mon, const char *deviceID, - bool writable) + const char *export, + bool writable, + const char *bitmap) { int ret =3D -1; virJSONValuePtr cmd; virJSONValuePtr reply =3D NULL; + /* Note: bitmap must be NULL if QEMU_CAPS_NBD_BITMAP is lacking */ if (!(cmd =3D qemuMonitorJSONMakeCommand("nbd-server-add", "s:device", deviceID, + "S:name", export, "b:writable", writable, + "S:bitmap", bitmap, NULL))) return ret; diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 9d707fcc7c..2a9e6cc75f 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1348,7 +1348,7 @@ GEN_TEST_FUNC(qemuMonitorJSONBlockCommit, "vdb", "/fo= o/bar1", "/foo/bar2", "back GEN_TEST_FUNC(qemuMonitorJSONDrivePivot, "vdb") GEN_TEST_FUNC(qemuMonitorJSONScreendump, "devicename", 1, "/foo/bar") GEN_TEST_FUNC(qemuMonitorJSONOpenGraphics, "spice", "spicefd", false) -GEN_TEST_FUNC(qemuMonitorJSONNBDServerAdd, "vda", true) +GEN_TEST_FUNC(qemuMonitorJSONNBDServerAdd, "vda", NULL, true, NULL) GEN_TEST_FUNC(qemuMonitorJSONDetachCharDev, "serial1") GEN_TEST_FUNC(qemuMonitorJSONBlockdevTrayOpen, "foodev", true) GEN_TEST_FUNC(qemuMonitorJSONBlockdevTrayClose, "foodev") --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list