From nobody Sun Feb 8 23:41:56 2026 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 1522324295614557.2399997055828; Thu, 29 Mar 2018 04:51:35 -0700 (PDT) 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 D8A107D4EB; Thu, 29 Mar 2018 11:51:33 +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 92C6F60F8C; Thu, 29 Mar 2018 11:51:33 +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 410904CAA6; Thu, 29 Mar 2018 11:51:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2TBpKSl016304 for ; Thu, 29 Mar 2018 07:51:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 325C51102E2C; Thu, 29 Mar 2018 11:51:20 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id B0EC31102E2B; Thu, 29 Mar 2018 11:51:19 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 29 Mar 2018 13:51:02 +0200 Message-Id: <4234aead212e63d7e5bd35100ce8cfe9baeed883.1522323985.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 05/14] qemu: domain: Add helper to initialize detected parts of the backing chain 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.28]); Thu, 29 Mar 2018 11:51:34 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" It will be necessary to initialize various aspects for the detected members of the backing chain. Add a function that will handle it and call it from qemuDomainPrepareDiskSource and qemuDomainDetermineDiskChain Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 48 ++++++++++++++++++++++++++++++++++++++++++----= -- src/qemu/qemu_domain.h | 6 ++++++ 2 files changed, 48 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 580e0f830d..009fb9daf3 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -7399,6 +7399,7 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver, { virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); virStorageSourcePtr src =3D disk->src; + qemuDomainObjPrivatePtr priv =3D vm->privateData; int ret =3D -1; uid_t uid; gid_t gid; @@ -7467,6 +7468,10 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver, report_broken) < 0) goto cleanup; + /* fill in data for the rest of the chain */ + if (qemuDomainPrepareDiskSourceChain(disk, src, cfg, priv->qemuCaps) <= 0) + goto cleanup; + ret =3D 0; cleanup: @@ -11803,6 +11808,41 @@ qemuDomainCheckMigrationCapabilities(virQEMUDriver= Ptr driver, } +/** + * qemuDomainPrepareDiskSourceChain: + * + * @disk: Disk config object + * @src: source to start from + * @cfg: qemu driver config object + * + * Prepares various aspects of the disk source and it's backing chain. This + * function should be also called for detected backing chains. If @src is = NULL + * the root source is used. + */ +int +qemuDomainPrepareDiskSourceChain(virDomainDiskDefPtr disk, + virStorageSourcePtr src, + virQEMUDriverConfigPtr cfg, + virQEMUCapsPtr qemuCaps) +{ + virStorageSourcePtr n; + + if (!src) + src =3D disk->src; + + for (n =3D src; virStorageSourceIsBacking(n); n =3D n->backingStore) { + if (n->type =3D=3D VIR_STORAGE_TYPE_NETWORK && + n->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_GLUSTER && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_GLUSTER_DEBUG_LEVEL)) { + n->debug =3D true; + n->debugLevel =3D cfg->glusterDebugLevel; + } + } + + return 0; +} + + int qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk, qemuDomainObjPrivatePtr priv, @@ -11814,12 +11854,8 @@ qemuDomainPrepareDiskSource(virDomainDiskDefPtr di= sk, if (qemuDomainSecretDiskPrepare(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; - } + if (qemuDomainPrepareDiskSourceChain(disk, NULL, cfg, priv->qemuCaps) = < 0) + return -1; return 0; } diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 63d9fb6d21..21e12f6594 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -991,6 +991,12 @@ int qemuDomainCheckMigrationCapabilities(virQEMUDriverPtr driver, virDomainObjPtr vm, qemuDomainAsyncJob asyncJob); +int +qemuDomainPrepareDiskSourceChain(virDomainDiskDefPtr disk, + virStorageSourcePtr src, + virQEMUDriverConfigPtr cfg, + virQEMUCapsPtr qemuCaps) + ATTRIBUTE_RETURN_CHECK; int qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk, --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list