From nobody Mon Sep 16 19:47:41 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 154049575331748.85967155624758; Thu, 25 Oct 2018 12:29:13 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 464F53082A3D; Thu, 25 Oct 2018 19:29:11 +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 DBF9B5D75D; Thu, 25 Oct 2018 19:29:10 +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 5BE0D4BB79; Thu, 25 Oct 2018 19:29:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w9PJKcTX027632 for ; Thu, 25 Oct 2018 15:20:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5314F60C60; Thu, 25 Oct 2018 19:20:38 +0000 (UTC) Received: from red.redhat.com (ovpn-122-116.rdu2.redhat.com [10.10.122.116]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA78F65F48; Thu, 25 Oct 2018 19:20:36 +0000 (UTC) From: Eric Blake To: libvir-list@redhat.com Date: Thu, 25 Oct 2018 20:20:04 +0100 Message-Id: <20181025192021.350438-4-eblake@redhat.com> In-Reply-To: <20181025192021.350438-1-eblake@redhat.com> References: <20181025192021.350438-1-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: amureini@redhat.com, derez@redhat.com, vsementsov@virtuozzo.com, ydary@redhat.com, nsoffer@redhat.com, jsnow@redhat.com Subject: [libvirt] [PATCH v3 03/20] qemu: Allow optional export name during NBD export 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: , MIME-Version: 1.0 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Thu, 25 Oct 2018 19:29:11 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Right now, we only use NBD exports during storage migration, where we control the NBD client and therefore don't care about the export name (qemu's default of naming the export after the device is fine). But upcoming patches for exposing backups over NBD wants to use a different export name (matching the libvirt domain XML rather than the qemu device name); so enhance the QMP glue code to allow this flexibility. Signed-off-by: Eric Blake --- src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.h | 1 + src/qemu/qemu_migration.c | 2 +- src/qemu/qemu_monitor.c | 5 +++-- src/qemu/qemu_monitor_json.c | 2 ++ tests/qemumonitorjsontest.c | 2 +- 6 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 48b142a4f4..b683d0f100 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1074,6 +1074,7 @@ int qemuMonitorNBDServerStart(qemuMonitorPtr mon, const char *tls_alias); int qemuMonitorNBDServerAdd(qemuMonitorPtr mon, const char *deviceID, + const char *export, bool writable); int qemuMonitorNBDServerStop(qemuMonitorPtr); int qemuMonitorGetTPMModels(qemuMonitorPtr mon, diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index da267b15b0..ac08bc21e0 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -468,6 +468,7 @@ int qemuMonitorJSONNBDServerStart(qemuMonitorPtr mon, const char *tls_alias); int qemuMonitorJSONNBDServerAdd(qemuMonitorPtr mon, const char *deviceID, + const char *export, bool writable); int qemuMonitorJSONNBDServerStop(qemuMonitorPtr mon); int qemuMonitorJSONGetTPMModels(qemuMonitorPtr mon, diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 67940330aa..5773fa816a 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -417,7 +417,7 @@ qemuMigrationDstStartNBDServer(virQEMUDriverPtr driver, goto exit_monitor; } - if (qemuMonitorNBDServerAdd(priv->mon, diskAlias, true) < 0) + if (qemuMonitorNBDServerAdd(priv->mon, diskAlias, NULL, true) < 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 7f7013e115..0c2e043fc9 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3925,13 +3925,14 @@ qemuMonitorNBDServerStart(qemuMonitorPtr mon, int qemuMonitorNBDServerAdd(qemuMonitorPtr mon, const char *deviceID, + const char *export, bool writable) { - VIR_DEBUG("deviceID=3D%s", deviceID); + VIR_DEBUG("deviceID=3D%s, export=3D%s", deviceID, NULLSTR(export)); QEMU_CHECK_MONITOR(mon); - return qemuMonitorJSONNBDServerAdd(mon, deviceID, writable); + return qemuMonitorJSONNBDServerAdd(mon, deviceID, export, writable); } diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 3de298c9e2..29d0395979 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -6727,6 +6727,7 @@ qemuMonitorJSONNBDServerStart(qemuMonitorPtr mon, int qemuMonitorJSONNBDServerAdd(qemuMonitorPtr mon, const char *deviceID, + const char *export, bool writable) { int ret =3D -1; @@ -6735,6 +6736,7 @@ qemuMonitorJSONNBDServerAdd(qemuMonitorPtr mon, if (!(cmd =3D qemuMonitorJSONMakeCommand("nbd-server-add", "s:device", deviceID, + "S:name", export, "b:writable", writable, NULL))) return ret; diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 5c77db337f..fa80878196 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1353,7 +1353,7 @@ 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(qemuMonitorJSONNBDServerAdd, "vda", NULL, true) GEN_TEST_FUNC(qemuMonitorJSONDetachCharDev, "serial1") GEN_TEST_FUNC(qemuMonitorJSONBlockdevTrayOpen, "foodev", true) GEN_TEST_FUNC(qemuMonitorJSONBlockdevTrayClose, "foodev") --=20 2.17.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list