From nobody Sat Apr 27 18:59:17 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511454717491966.6001924217566; Thu, 23 Nov 2017 08:31:57 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 80A39DF23; Thu, 23 Nov 2017 16:31:56 +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 551832D34F; Thu, 23 Nov 2017 16:31:56 +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 07F211800BDB; Thu, 23 Nov 2017 16:31:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vANGPBxq006818 for ; Thu, 23 Nov 2017 11:25:11 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9EC751914D; Thu, 23 Nov 2017 16:25:11 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id F299C18B55; Thu, 23 Nov 2017 16:25:10 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 23 Nov 2017 17:24:38 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 1/6] qemu: command: Inject password-secret only when not using JSON props 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 23 Nov 2017 16:31:56 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The 'file.password-secret' injection should be used only if we are using the old formatter. When formatting the source string from the JSON properities, the property should be added there. Also drop the comment which refers to stuff that will not be used in libvirt sine -blockdev is the way to go. --- src/qemu/qemu_command.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 26d395d67c..667ac746e1 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1578,6 +1578,9 @@ qemuBuildDriveSourceStr(virDomainDiskDefPtr disk, } virQEMUBuildBufferEscapeComma(buf, source); + + if (secinfo && secinfo->type =3D=3D VIR_DOMAIN_SECRET_INFO_TYPE_AE= S) + virBufferAsprintf(buf, ",file.password-secret=3D%s", secinfo->= s.aes.alias); } else { if (!(source =3D virQEMUBuildDriveCommandlineFromJSON(srcprops))) goto cleanup; @@ -1592,16 +1595,6 @@ qemuBuildDriveSourceStr(virDomainDiskDefPtr disk, virBufferAsprintf(buf, "file.debug=3D%d,", cfg->glusterDebugLe= vel); } - if (secinfo && secinfo->type =3D=3D VIR_DOMAIN_SECRET_INFO_TYPE_AES) { - /* NB: If libvirt starts using the more modern option based - * syntax to build the command line (e.g., "-drive driver=3Drb= d, - * filename=3D%s,...") instead of the legacy model (e.g."-drive - * file=3D%s,..."), then the "file." prefix can be removed - */ - virBufferAsprintf(buf, "file.password-secret=3D%s,", - secinfo->s.aes.alias); - } - if (encinfo) virQEMUBuildLuksOpts(buf, &disk->src->encryption->encinfo, encinfo->s.aes.alias); --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 18:59:17 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511454720511691.3924336295054; Thu, 23 Nov 2017 08:32:00 -0800 (PST) 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 3F9BBB5BA; Thu, 23 Nov 2017 16:31:59 +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 1E67F18EE7; Thu, 23 Nov 2017 16:31:59 +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 DEFB74BB79; Thu, 23 Nov 2017 16:31:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vANGPDNk006828 for ; Thu, 23 Nov 2017 11:25:13 -0500 Received: by smtp.corp.redhat.com (Postfix) id 34B1418B55; Thu, 23 Nov 2017 16:25:13 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3784E19159; Thu, 23 Nov 2017 16:25:11 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 23 Nov 2017 17:24:39 +0100 Message-Id: <0a81e51afd5f86f8c65e24454cbfcae1440bf9da.1511454145.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 2/6] util: storage: Add fields for debug options for disk drivers 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 23 Nov 2017 16:31:59 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Some drive backends allow output of debugging information which can be configured using properities of the image. Add fields to virStorageSource which will allow carrying them. --- src/util/virstoragefile.c | 2 ++ src/util/virstoragefile.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 45a6dea8a0..6594715e5e 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -2061,6 +2061,8 @@ virStorageSourceCopy(const virStorageSource *src, ret->tlsFromConfig =3D src->tlsFromConfig; ret->tlsVerify =3D src->tlsVerify; ret->detected =3D src->detected; + ret->debugLevel =3D src->debugLevel; + ret->debug =3D src->debug; /* storage driver metadata are not copied */ ret->drv =3D NULL; diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index af8f56c8a1..24382a0a6b 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -303,6 +303,9 @@ struct _virStorageSource { bool tlsVerify; bool detected; /* true if this entry was not provided by the user */ + + unsigned int debugLevel; + bool debug; }; --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 18:59:17 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511454319763599.029835489712; Thu, 23 Nov 2017 08:25:19 -0800 (PST) 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 880AD267D8; Thu, 23 Nov 2017 16:25:18 +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 44C9B5D969; Thu, 23 Nov 2017 16:25:18 +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 D6A5D180474A; Thu, 23 Nov 2017 16:25:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vANGPGbn006844 for ; Thu, 23 Nov 2017 11:25:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id EC9C818B5B; Thu, 23 Nov 2017 16:25:16 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C3A26F43F; Thu, 23 Nov 2017 16:25:13 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 23 Nov 2017 17:24:40 +0100 Message-Id: <9eacca1a1043f9c4965323d3503c6044c21f86a0.1511454145.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 3/6] qemu: block: Add support for formatting gluster debug level via JSON 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 23 Nov 2017 16:25:18 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Improve the formatter so that we can use the 'debug' property straight away when using json. --- src/qemu/qemu_block.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 8b23df8227..3a48f60c00 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -639,6 +639,7 @@ static virJSONValuePtr qemuBlockStorageSourceGetGlusterProps(virStorageSourcePtr src) { virJSONValuePtr servers =3D NULL; + virJSONValuePtr props =3D NULL; virJSONValuePtr ret =3D NULL; if (!(servers =3D qemuBlockStorageSourceBuildHostsJSONSocketAddress(sr= c, true))) @@ -650,12 +651,24 @@ qemuBlockStorageSourceGetGlusterProps(virStorageSourc= ePtr src) * server :[{type:"tcp", host:"1.2.3.4", port:24007}, * {type:"unix", socket:"/tmp/glusterd.socket"}, ...]} */ - if (virJSONValueObjectCreate(&ret, + if (virJSONValueObjectCreate(&props, "s:driver", "gluster", "s:volume", src->volume, "s:path", src->path, "a:server", servers, NULL) < 0) - virJSONValueFree(servers); + goto cleanup; + + servers =3D NULL; + + if (src->debug && + virJSONValueObjectAdd(props, "u:debug", src->debugLevel, NULL) < 0) + goto cleanup; + + VIR_STEAL_PTR(ret, props); + + cleanup: + virJSONValueFree(servers); + virJSONValueFree(props); return ret; } --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 18:59:17 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511454328638879.1770588145932; Thu, 23 Nov 2017 08:25:28 -0800 (PST) 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 A8BF212122; Thu, 23 Nov 2017 16:25:27 +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 88F3718EE7; Thu, 23 Nov 2017 16:25:27 +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 522321800BDF; Thu, 23 Nov 2017 16:25:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vANGPQfU006855 for ; Thu, 23 Nov 2017 11:25:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1709618B55; Thu, 23 Nov 2017 16:25:26 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 74A8A18B61; Thu, 23 Nov 2017 16:25:17 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 23 Nov 2017 17:24:41 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 4/6] qemu: hotplug: Rename qemuDomainPrepareDisk to qemuHotplugPrepareDiskAccess 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 23 Nov 2017 16:25:28 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Match the prefix of the file and choose a name which better describes what happens. --- src/qemu/qemu_hotplug.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 72a57d89ed..a49480ecb4 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -70,7 +70,7 @@ unsigned long long qemuDomainRemoveDeviceWaitTime =3D 100= 0ull * 5; /** - * qemuDomainPrepareDisk: + * qemuHotplugPrepareDiskAccess: * @driver: qemu driver struct * @vm: domain object * @disk: disk to prepare @@ -85,11 +85,11 @@ unsigned long long qemuDomainRemoveDeviceWaitTime =3D 1= 000ull * 5; * Returns 0 on success and -1 on error. Reports libvirt error. */ static int -qemuDomainPrepareDisk(virQEMUDriverPtr driver, - virDomainObjPtr vm, - virDomainDiskDefPtr disk, - virStorageSourcePtr overridesrc, - bool teardown) +qemuHotplugPrepareDiskAccess(virQEMUDriverPtr driver, + virDomainObjPtr vm, + virDomainDiskDefPtr disk, + virStorageSourcePtr overridesrc, + bool teardown) { virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); int ret =3D -1; @@ -280,7 +280,7 @@ qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver, goto cleanup; } - if (qemuDomainPrepareDisk(driver, vm, disk, newsrc, false) < 0) + if (qemuHotplugPrepareDiskAccess(driver, vm, disk, newsrc, false) < 0) goto cleanup; if (!(driveAlias =3D qemuAliasFromDisk(disk))) @@ -331,7 +331,7 @@ qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver, /* remove the old source from shared device list */ ignore_value(qemuRemoveSharedDisk(driver, disk, vm->def->name)); - ignore_value(qemuDomainPrepareDisk(driver, vm, disk, NULL, true)); + ignore_value(qemuHotplugPrepareDiskAccess(driver, vm, disk, NULL, true= )); virStorageSourceFree(disk->src); disk->src =3D newsrc; @@ -345,7 +345,7 @@ qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver, error: virDomainAuditDisk(vm, disk->src, newsrc, "update", false); - ignore_value(qemuDomainPrepareDisk(driver, vm, disk, newsrc, true)); + ignore_value(qemuHotplugPrepareDiskAccess(driver, vm, disk, newsrc, tr= ue)); goto cleanup; } @@ -378,7 +378,7 @@ qemuDomainAttachDiskGeneric(virConnectPtr conn, qemuDomainSecretInfoPtr secinfo =3D NULL; qemuDomainSecretInfoPtr encinfo =3D NULL; - if (qemuDomainPrepareDisk(driver, vm, disk, NULL, false) < 0) + if (qemuHotplugPrepareDiskAccess(driver, vm, disk, NULL, false) < 0) goto cleanup; if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->qemuCaps) < 0) @@ -486,7 +486,7 @@ qemuDomainAttachDiskGeneric(virConnectPtr conn, error: qemuDomainDelDiskSrcTLSObject(driver, vm, disk->src); - ignore_value(qemuDomainPrepareDisk(driver, vm, disk, NULL, true)); + ignore_value(qemuHotplugPrepareDiskAccess(driver, vm, disk, NULL, true= )); goto cleanup; } --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 18:59:17 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511454668244642.0185628581202; Thu, 23 Nov 2017 08:31:08 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CC84D85A07; Thu, 23 Nov 2017 16:31:06 +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 480EC60F89; Thu, 23 Nov 2017 16:31:06 +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 6CB1A4BB79; Thu, 23 Nov 2017 16:31:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vANGPa3o006870 for ; Thu, 23 Nov 2017 11:25:36 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4FA5F620A2; Thu, 23 Nov 2017 16:25:36 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B19418B55; Thu, 23 Nov 2017 16:25:26 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 23 Nov 2017 17:24:42 +0100 Message-Id: <70bd61bc602cc57dc71521927daf6600e8eb4d6d.1511454145.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 5/6] qemu: domain: Unify disk source prepare steps 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 23 Nov 2017 16:31:07 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Aggregate setup of various aspects of a disk source (secrets, TLS, ...) into one function so that we don't need to call multiple across the code base. --- src/qemu/qemu_domain.c | 20 ++++++++++++++++++-- src/qemu/qemu_domain.h | 16 ++++++---------- src/qemu/qemu_hotplug.c | 5 +---- src/qemu/qemu_process.c | 5 +---- 4 files changed, 26 insertions(+), 20 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index f12450cc69..a5bfcfb48a 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1449,7 +1449,7 @@ qemuDomainSecretStorageSourcePrepare(virConnectPtr co= nn, * Returns 0 on success, -1 on failure */ -int +static int qemuDomainSecretDiskPrepare(virConnectPtr conn, qemuDomainObjPrivatePtr priv, virDomainDiskDefPtr disk) @@ -7927,7 +7927,7 @@ qemuDomainPrepareChardevSource(virDomainDefPtr def, * * Returns 0 on success, -1 on bad config/failure */ -int +static int qemuDomainPrepareDiskSourceTLS(virStorageSourcePtr src, virQEMUDriverConfigPtr cfg) { @@ -10425,3 +10425,19 @@ qemuDomainCheckMigrationCapabilities(virQEMUDriver= Ptr driver, virStringListFree(caps); return ret; } + + +int +qemuDomainPrepareDiskSource(virConnectPtr conn, + virDomainDiskDefPtr disk, + qemuDomainObjPrivatePtr priv, + virQEMUDriverConfigPtr cfg) +{ + if (qemuDomainPrepareDiskSourceTLS(disk->src, cfg) < 0) + return -1; + + if (qemuDomainSecretDiskPrepare(conn, priv, disk) < 0) + return -1; + + return 0; +} diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 9066f5d0f5..146b27dd57 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -839,11 +839,6 @@ qemuDomainSecretInfoTLSNew(virConnectPtr conn, const char *srcAlias, const char *secretUUID); -int qemuDomainSecretDiskPrepare(virConnectPtr conn, - qemuDomainObjPrivatePtr priv, - virDomainDiskDefPtr disk) - ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); - void qemuDomainSecretHostdevDestroy(virDomainHostdevDefPtr disk) ATTRIBUTE_NONNULL(1); @@ -886,11 +881,6 @@ void qemuDomainPrepareChardevSource(virDomainDefPtr de= f, virQEMUDriverConfigPtr cfg) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); -int -qemuDomainPrepareDiskSourceTLS(virStorageSourcePtr src, - virQEMUDriverConfigPtr cfg) - ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); - int qemuDomainPrepareShmemChardev(virDomainShmemDefPtr shmem) ATTRIBUTE_NONNULL(1); @@ -1011,4 +1001,10 @@ qemuDomainCheckMigrationCapabilities(virQEMUDriverPt= r driver, virDomainObjPtr vm, qemuDomainAsyncJob asyncJob); +int +qemuDomainPrepareDiskSource(virConnectPtr conn, + virDomainDiskDefPtr disk, + qemuDomainObjPrivatePtr priv, + virQEMUDriverConfigPtr cfg); + #endif /* __QEMU_DOMAIN_H__ */ diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index a49480ecb4..44d48ca95a 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -384,7 +384,7 @@ qemuDomainAttachDiskGeneric(virConnectPtr conn, if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->qemuCaps) < 0) goto error; - if (qemuDomainSecretDiskPrepare(conn, priv, disk) < 0) + if (qemuDomainPrepareDiskSource(conn, disk, priv, cfg) < 0) goto error; srcPriv =3D QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(disk->src); @@ -401,9 +401,6 @@ qemuDomainAttachDiskGeneric(virConnectPtr conn, if (encinfo && qemuBuildSecretInfoProps(encinfo, &encobjProps) < 0) goto error; - if (qemuDomainPrepareDiskSourceTLS(disk->src, cfg) < 0) - goto error; - if (disk->src->haveTLS && qemuDomainAddDiskSrcTLSObject(driver, vm, disk->src, disk->info.alias) < 0) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 6d242b1b51..d47c6d69be 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5362,10 +5362,7 @@ qemuProcessPrepareDomainStorage(virConnectPtr conn, continue; } - if (qemuDomainPrepareDiskSourceTLS(disk->src, cfg) < 0) - return -1; - - if (qemuDomainSecretDiskPrepare(conn, priv, disk) < 0) + if (qemuDomainPrepareDiskSource(conn, disk, priv, cfg) < 0) return -1; } --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 18:59:17 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511454723071116.93277527128805; Thu, 23 Nov 2017 08:32:03 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E2D3AC0467C4; Thu, 23 Nov 2017 16:32:01 +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 AECFC60634; Thu, 23 Nov 2017 16:32:01 +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 6956B1800BDC; Thu, 23 Nov 2017 16:32:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vANGPhP1006896 for ; Thu, 23 Nov 2017 11:25:43 -0500 Received: by smtp.corp.redhat.com (Postfix) id 30D52620BD; Thu, 23 Nov 2017 16:25:43 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1ABC4620A2; Thu, 23 Nov 2017 16:25:36 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 23 Nov 2017 17:24:43 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 6/6] qemu: command: Properly format disk 'debug' attribute 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 23 Nov 2017 16:32:02 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Move the setup of the disk attribute to the disk source prepare function which will allow proper usage with JSON props and move the fallback (legacy) generating code into the block which is executed with legacy options. As a side-effect of this change we can clean up propagation of 'cfg' into the command generator. Also it's nice to see that the test output is the same even when the value is generated in a different place. --- src/qemu/qemu_command.c | 21 +++++++-------------- src/qemu/qemu_command.h | 1 - src/qemu/qemu_domain.c | 7 +++++++ src/qemu/qemu_hotplug.c | 2 +- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 667ac746e1..26f86c74b5 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1509,9 +1509,7 @@ qemuDiskSourceGetProps(virStorageSourcePtr src) static int qemuBuildDriveSourceStr(virDomainDiskDefPtr disk, - virQEMUDriverConfigPtr cfg, - virBufferPtr buf, - virQEMUCapsPtr qemuCaps) + virBufferPtr buf) { int actualType =3D virStorageSourceGetActualType(disk->src); qemuDomainStorageSourcePrivatePtr srcpriv =3D QEMU_DOMAIN_STORAGE_SOUR= CE_PRIVATE(disk->src); @@ -1581,6 +1579,9 @@ qemuBuildDriveSourceStr(virDomainDiskDefPtr disk, if (secinfo && secinfo->type =3D=3D VIR_DOMAIN_SECRET_INFO_TYPE_AE= S) virBufferAsprintf(buf, ",file.password-secret=3D%s", secinfo->= s.aes.alias); + + if (disk->src->debug) + virBufferAsprintf(buf, ",file.debug=3D%d", disk->src->debugLev= el); } else { if (!(source =3D virQEMUBuildDriveCommandlineFromJSON(srcprops))) goto cleanup; @@ -1589,12 +1590,6 @@ qemuBuildDriveSourceStr(virDomainDiskDefPtr disk, } virBufferAddLit(buf, ","); - if (disk->src->type =3D=3D VIR_STORAGE_TYPE_NETWORK && - disk->src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_GLUSTER) { - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_GLUSTER_DEBUG_LEVEL)) - virBufferAsprintf(buf, "file.debug=3D%d,", cfg->glusterDebugLe= vel); - } - if (encinfo) virQEMUBuildLuksOpts(buf, &disk->src->encryption->encinfo, encinfo->s.aes.alias); @@ -1722,13 +1717,12 @@ qemuBuildDiskFrontendAttributes(virDomainDiskDefPtr= disk, char * qemuBuildDriveStr(virDomainDiskDefPtr disk, - virQEMUDriverConfigPtr cfg, bool bootable, virQEMUCapsPtr qemuCaps) { virBuffer opt =3D VIR_BUFFER_INITIALIZER; - if (qemuBuildDriveSourceStr(disk, cfg, &opt, qemuCaps) < 0) + if (qemuBuildDriveSourceStr(disk, &opt) < 0) goto error; if (qemuDiskBusNeedsDeviceArg(disk->bus)) { @@ -2209,7 +2203,6 @@ qemuBuildDriveDevStr(const virDomainDef *def, static int qemuBuildDiskDriveCommandLine(virCommandPtr cmd, - virQEMUDriverConfigPtr cfg, const virDomainDef *def, virQEMUCapsPtr qemuCaps) { @@ -2289,7 +2282,7 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd, virCommandAddArg(cmd, "-drive"); - if (!(optstr =3D qemuBuildDriveStr(disk, cfg, driveBoot, qemuCaps)= )) + if (!(optstr =3D qemuBuildDriveStr(disk, driveBoot, qemuCaps))) return -1; virCommandAddArg(cmd, optstr); @@ -10147,7 +10140,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver, if (qemuBuildHubCommandLine(cmd, def, qemuCaps) < 0) goto error; - if (qemuBuildDiskDriveCommandLine(cmd, cfg, def, qemuCaps) < 0) + if (qemuBuildDiskDriveCommandLine(cmd, def, qemuCaps) < 0) goto error; if (qemuBuildFSDevCommandLine(cmd, def, qemuCaps) < 0) diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index 2bcfc6c707..18e0894581 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -101,7 +101,6 @@ char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk= ); /* Both legacy & current support */ char *qemuBuildDriveStr(virDomainDiskDefPtr disk, - virQEMUDriverConfigPtr cfg, bool bootable, virQEMUCapsPtr qemuCaps); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index a5bfcfb48a..75482ac5e6 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -10439,5 +10439,12 @@ qemuDomainPrepareDiskSource(virConnectPtr conn, if (qemuDomainSecretDiskPrepare(conn, priv, disk) < 0) return -1; + if (disk->src->type =3D=3D VIR_STORAGE_TYPE_NETWORK && + disk->src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_GLUSTER && + virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_GLUSTER_DEBUG_LEVEL)) { + disk->src->debug =3D true; + disk->src->debugLevel =3D cfg->glusterDebugLevel; + } + return 0; } diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 44d48ca95a..a1a088af4b 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -406,7 +406,7 @@ qemuDomainAttachDiskGeneric(virConnectPtr conn, disk->info.alias) < 0) goto error; - if (!(drivestr =3D qemuBuildDriveStr(disk, cfg, false, priv->qemuCaps)= )) + if (!(drivestr =3D qemuBuildDriveStr(disk, false, priv->qemuCaps))) goto error; if (!(drivealias =3D qemuAliasFromDisk(disk))) --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list