From nobody Sun May 5 06:24:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599206890; cv=none; d=zohomail.com; s=zohoarc; b=VpcMrVLLOR2ahHD1l/g0RR7dNyuiHGZoMf3T+ZrcxKGMgiLIBdPc65iEp7IOnYauVyXRC61EBURZL3nOmSaVDelXFq0BTX+df163yB0sW/Hv659zCoruJe9xiKJFuf8RnHAhoZIDVK1CW13mipghbXDuH+kDpz+pi3epHJRVqns= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599206890; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=kjLfxF9zWXBGxaJ2kwUWabYam7POhnEmVo4Il7ajzfQ=; b=DbQTe/uCW3zeGvUrNZoNjlorGG16zuCMxzsnfegVrHOEbOITiw8uZ1BsOXzp3yJgoDxgS66ijGOnuicuQ5ubFJa239hxds1GMdq/yDV/HGhlas1x3QKiLvJ4c6xTqSSJIcGSt5wjEL3w8Ir3I3C69ybWkI2vxaGNnGlCY7FA8h8= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1599206890036593.667461323935; Fri, 4 Sep 2020 01:08:10 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-528-beZuQ0twPH6WPnnxG9udaw-1; Fri, 04 Sep 2020 04:08:04 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1CEB1107464E; Fri, 4 Sep 2020 08:07:58 +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 1446A811B1; Fri, 4 Sep 2020 08:07:55 +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 EBDFB1832FB6; Fri, 4 Sep 2020 08:07:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 083Ibq0f030756 for ; Thu, 3 Sep 2020 14:37:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 41243202450A; Thu, 3 Sep 2020 18:37:52 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3C2FF20244F7 for ; Thu, 3 Sep 2020 18:37:49 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 101F88F6E6A for ; Thu, 3 Sep 2020 18:37:49 +0000 (UTC) Received: from rhcavspool01.kulnet.kuleuven.be (rhcavspool01.kulnet.kuleuven.be [134.58.240.193]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-97-RU2EcXa3N5qPPkNZY8CEFQ-1; Thu, 03 Sep 2020 14:37:46 -0400 Received: from rhcavuit04.kulnet.kuleuven.be (rhcavuit04.kulnet.kuleuven.be [134.58.240.137]) by rhcavspool01.kulnet.kuleuven.be (Postfix) with ESMTP id B7B6660D8 for ; Thu, 3 Sep 2020 20:28:52 +0200 (CEST) Received: from icts-p-smtps-1.cc.kuleuven.be (icts-p-smtps-1e.kulnet.kuleuven.be [134.58.240.33]) by rhcavuit04.kulnet.kuleuven.be (Postfix) with ESMTP id 7CF58120336 for ; Thu, 3 Sep 2020 20:28:47 +0200 (CEST) Received: from flutterbat.volkihar.be (115.229-247-81.adsl-dyn.isp.belgacom.be [81.247.229.115]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by icts-p-smtps-1.cc.kuleuven.be (Postfix) with ESMTPSA id 623A540B2 for ; Thu, 3 Sep 2020 20:28:47 +0200 (CEST) Received: by flutterbat.volkihar.be (Postfix, from userid 1000) id 3FA53162274F; Thu, 3 Sep 2020 20:28:47 +0200 (CEST) X-MC-Unique: beZuQ0twPH6WPnnxG9udaw-1 X-MC-Unique: RU2EcXa3N5qPPkNZY8CEFQ-1 X-KULeuven-Envelope-From: libvirt@volkihar.be X-Spam-Status: not spam, SpamAssassin (not cached, score=-50.999, required 5, autolearn=disabled, ALL_TRUSTED -1.00, LOCAL_SMTPS -50.00, URIBL_BLOCKED 0.00) X-KULeuven-Scanned: Found to be clean X-KULeuven-ID: 7CF58120336.A9C9C X-KULeuven-Information: Katholieke Universiteit Leuven X-Kuleuven: This mail passed the K.U.Leuven mailcluster From: Vincent Vanlaer To: libvir-list@redhat.com Subject: [libvirt PATCH] conf: Add support for GlusterFS volumes as disk Date: Thu, 3 Sep 2020 20:28:47 +0200 Message-Id: <20200903182847.1369777-1-libvirt@volkihar.be> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false; X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 083Ibq0f030756 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Fri, 04 Sep 2020 04:03:42 -0400 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: , 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-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" While libvirt has support for GlusterFS pools and volumes, they cannot be added to a domain. This commit adds the necessary translation between the pool definition and the disk definition, allowing volumes in a domain to be backed by a gluster pool. Signed-off-by: Vincent Vanlaer --- src/conf/domain_conf.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 72ac4f4191..c872d02200 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -32620,6 +32620,32 @@ virDomainDiskTranslateISCSIDirect(virStorageSource= Ptr src, } =20 =20 +static int +virDomainDiskTranslateGluster(virStorageSourcePtr src, + virStoragePoolDefPtr pooldef) +{ + size_t i; + + src->srcpool->actualtype =3D VIR_STORAGE_TYPE_NETWORK; + src->protocol =3D VIR_STORAGE_NET_PROTOCOL_GLUSTER; + + src->nhosts =3D pooldef->source.nhost; + src->hosts =3D g_new0(virStorageNetHostDef, src->nhosts); + + for (i =3D 0; i < src->nhosts; i++) { + src->hosts[i].socket =3D NULL; + src->hosts[i].transport =3D VIR_STORAGE_NET_HOST_TRANS_TCP; + src->hosts[i].name =3D g_strdup(pooldef->source.hosts[i].name); + src->hosts[i].port =3D pooldef->source.hosts[i].port; + } + + src->volume =3D g_strdup(pooldef->source.name); + src->path =3D g_strdup_printf("%s/%s", pooldef->source.dir, src->srcpo= ol->volume); + + return 0; +} + + static int virDomainStorageSourceTranslateSourcePool(virStorageSourcePtr src, virConnectPtr conn) @@ -32736,10 +32762,14 @@ virDomainStorageSourceTranslateSourcePool(virStor= ageSourcePtr src, } break; =20 + case VIR_STORAGE_POOL_GLUSTER: + if (virDomainDiskTranslateGluster(src, pooldef) < 0) + return -1; + break; + case VIR_STORAGE_POOL_MPATH: case VIR_STORAGE_POOL_RBD: case VIR_STORAGE_POOL_SHEEPDOG: - case VIR_STORAGE_POOL_GLUSTER: case VIR_STORAGE_POOL_LAST: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("using '%s' pools for backing 'volume' disks " --=20 2.28.0