From nobody Mon Apr 29 07:18:24 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1599034025; cv=none; d=zohomail.com; s=zohoarc; b=bk92DAlS72Cd22WeQX0ChKCyqIe+huA4Cg1oiKJbDvWHg1cwiIOAn4dPOZm2+419D6BnQD0Et5NEYyWVlhmmqVtv47ojgianMZ43fgvDNsIoVINRNewvWmx0xQOYY5MA7MrHKTmNWsFl0A+P6RXnzTdkV8Uu1qaEt9WL8IJ6bsc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599034025; 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; bh=SjQ+MoMC3kaxpWdlZTPfYp56jcnhP/Y8ZNn3z5oeRX8=; b=gGEw0UaaGpkmPld2sqCCYVJziXxVX2VL9bcpsxtrfdZQmLJvLSYupWF7o4SZOPUzrLsK28ZlNL3KfMlxPcDVHWqU04EUDWjtnDocR9dRJvkJK3Y04Iffg6L9AuWOZRji4AHSZxUudVEwLR1MzwMMfdD3AvMmLNF4R+UdXlOlW2s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1599034025262591.5330638729055; Wed, 2 Sep 2020 01:07:05 -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-475-UDrF1TGjMyu4aecRSll5ww-1; Wed, 02 Sep 2020 04:06:55 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id C173B107464A; Wed, 2 Sep 2020 08:06:49 +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 8F24E100EBB8; Wed, 2 Sep 2020 08:06:49 +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 30409180B657; Wed, 2 Sep 2020 08:06:49 +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 08286hi7032589 for ; Wed, 2 Sep 2020 04:06:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id E41CF1972A; Wed, 2 Sep 2020 08:06:43 +0000 (UTC) Received: from hansolo.redhat.com (ovpn-13-4.pek2.redhat.com [10.72.13.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF22D19C71; Wed, 2 Sep 2020 08:06:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599034024; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=SjQ+MoMC3kaxpWdlZTPfYp56jcnhP/Y8ZNn3z5oeRX8=; b=aggs/MVcyPl5Ef6E5hfDHaCosY9OPV6eraRfLo/2XKOtelR+Ze6ks8qCCszZM/OBvN168z Zley6OTrdldZQhVeClhpdXhZASKKx1ieaI2GNTBVPlnov3i91Cu4a2kOMNN+tFLZ6R0xKq UXzoYTcBs3M+OXs6IMOQKoiY10n+usg= X-MC-Unique: UDrF1TGjMyu4aecRSll5ww-1 From: Han Han To: libvir-list@redhat.com Subject: [PATCH v5 1/4] qemu_capabilities: Add QEMU_CAPS_RBD_NAMESPACE Date: Wed, 2 Sep 2020 16:05:18 +0800 Message-Id: <20200902080520.583944-2-hhan@redhat.com> In-Reply-To: <20200902080520.583944-1-hhan@redhat.com> References: <20200902080520.583944-1-hhan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, pkrempa@redhat.com, dillaman@redhat.com, Han Han 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.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The capability flag will be used for rbd namespace option. The rbd namespace is introduced since ceph Nautilus and qemu v5.0.0. Signed-off-by: Han Han --- src/qemu/qemu_capabilities.c | 4 ++++ src/qemu/qemu_capabilities.h | 3 +++ tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml | 1 + 8 files changed, 13 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 2cc0c61588..4d0dd23c9e 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -597,6 +597,9 @@ VIR_ENUM_IMPL(virQEMUCaps, "spapr-tpm-proxy", "numa.hmat", "blockdev-hostdev-scsi", + + /* 380 */ + "rbd.namespace", ); =20 =20 @@ -1526,6 +1529,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsQMPSc= hemaQueries[] =3D { { "migrate-set-parameters/arg-type/downtime-limit", QEMU_CAPS_MIGRATIO= N_PARAM_DOWNTIME }, { "migrate-set-parameters/arg-type/xbzrle-cache-size", QEMU_CAPS_MIGRA= TION_PARAM_XBZRLE_CACHE_SIZE }, { "set-numa-node/arg-type/+hmat-lb", QEMU_CAPS_NUMA_HMAT }, + { "blockdev-add/arg-type/+rbd/namespace", QEMU_CAPS_RBD_NAMESPACE }, }; =20 typedef struct _virQEMUCapsObjectTypeProps virQEMUCapsObjectTypeProps; diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 5d08941538..ef7ea9aa20 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -578,6 +578,9 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ QEMU_CAPS_NUMA_HMAT, /* -numa hmat */ QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI, /* -blockdev used for (i)SCSI hostdev= s */ =20 + /* 380 */ + QEMU_CAPS_RBD_NAMESPACE, /* -blockdev '{"driver":"rbd",...,"namespace"= :str}' */ + QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; =20 diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml b/tests/qemu= capabilitiesdata/caps_5.0.0.aarch64.xml index 928af2a01c..75622ca5fd 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml @@ -199,6 +199,7 @@ + 5000000 0 61700241 diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml b/tests/qemuca= pabilitiesdata/caps_5.0.0.ppc64.xml index e8668a25a9..1780c8a5bc 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml @@ -208,6 +208,7 @@ + 5000000 0 42900241 diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml b/tests/qemu= capabilitiesdata/caps_5.0.0.riscv64.xml index 85a8a46dac..d885bd9bb3 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml @@ -195,6 +195,7 @@ + 5000000 0 0 diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_5.0.0.x86_64.xml index 546b9b0422..e93483f0c6 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml @@ -243,6 +243,7 @@ + 5000000 0 43100241 diff --git a/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_5.1.0.x86_64.xml index 7496ff1379..d1bd5b29e4 100644 --- a/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml @@ -242,6 +242,7 @@ + 5001000 0 43100242 diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_5.2.0.x86_64.xml index 151bd18137..d00e255191 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml @@ -242,6 +242,7 @@ + 5001050 0 43100243 --=20 2.28.0 From nobody Mon Apr 29 07:18:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1599034086; cv=none; d=zohomail.com; s=zohoarc; b=g0RGPj7o0Rdr0oV0qmIMkmZMxKsxnAzTe/CNcrLBtnbt2R68oKxEhc2Cph5wKURwdIA/9MEkmq+XhKr2evXFtKZkAG6YxLMSGrqBk2zusQW/L2xbiWY3e/juxo+hAV0k2FZ158AKlXNlanZ5420p6NwE1829+DfL0KuivS9QgFQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599034086; 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; bh=KWk3/d4Mx/g5cx6jB14yZRgoz+PTlorUJ85M80v5yjw=; b=QGpzgRwoSWGODpUILX7X3Gg3lr4lCIQCarU2TxStafNc4DHxNDs/4hF3EbIfoY2lfVE0MxO9gSMujaec+zrfHL+8pFpngpcgq6lFKv4DoIWTr0z34mYCoOK3isHDCKHKPxXgkEn2GtK5+sfsMBtIP+mk8hsClceu5cJbcmYUfcM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1599034086143453.6395079781222; Wed, 2 Sep 2020 01:08:06 -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-59-kt7_u_UKN--d229lP0S-hg-1; Wed, 02 Sep 2020 04:06:59 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8895A10051A6; Wed, 2 Sep 2020 08:06: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 6727578374; Wed, 2 Sep 2020 08:06:54 +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 32D82180B791; Wed, 2 Sep 2020 08:06:54 +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 08286kAl032614 for ; Wed, 2 Sep 2020 04:06:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5ECCA19746; Wed, 2 Sep 2020 08:06:46 +0000 (UTC) Received: from hansolo.redhat.com (ovpn-13-4.pek2.redhat.com [10.72.13.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 73B7019C71; Wed, 2 Sep 2020 08:06:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599034085; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=KWk3/d4Mx/g5cx6jB14yZRgoz+PTlorUJ85M80v5yjw=; b=OV82VV6QLx6k4OVRPIfQvrkevqfL6pJZJfttvhueIyU2WFooUrZK+zvcajxkMPmwj4Ucgt vT+TGeOV/yfAM3+b1zqCGfGQ4RJV/yjffVmqJea+2OUngzj2shdonKtbB9m2aaS7/0Kbkp RAmO4K/vPFk1AkMz6Pgrekq46QiqDJM= X-MC-Unique: kt7_u_UKN--d229lP0S-hg-1 From: Han Han To: libvir-list@redhat.com Subject: [PATCH v5 2/4] conf: Support to parse rbd namespace from source name Date: Wed, 2 Sep 2020 16:05:19 +0800 Message-Id: <20200902080520.583944-3-hhan@redhat.com> In-Reply-To: <20200902080520.583944-1-hhan@redhat.com> References: <20200902080520.583944-1-hhan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, pkrempa@redhat.com, dillaman@redhat.com, Han Han 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.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Han Han --- docs/formatdomain.rst | 12 +++++++++--- src/conf/domain_conf.c | 35 +++++++++++++++++++++++++++++++---- src/util/virstoragefile.c | 1 + src/util/virstoragefile.h | 1 + 4 files changed, 42 insertions(+), 7 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 1979dfb8d3..4d730a4446 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -2256,7 +2256,7 @@ paravirtualized driver is specified via the ``disk`` = element. - + @@ -2485,8 +2485,8 @@ paravirtualized driver is specified via the ``disk`` = element. requested image. Possible values are "nbd", "iscsi", "rbd", "sheepdo= g", "gluster", "vxhs", "http", "https", "ftp", ftps", or "tftp". =20 - For any ``protocol`` other than ``nbd`` an additional attribute ``na= me`` - is mandatory to specify which volume/image will be used. + For any ``protocol`` other than ``nbd`` or ``rbd`` an additional att= ribute + ``name`` is mandatory to specify which volume/image will be used. =20 For "nbd", the ``name`` attribute is optional. TLS transport for NBD= can be enabled by setting the ``tls`` attribute to ``yes``. For the QEMU @@ -2494,6 +2494,12 @@ paravirtualized driver is specified via the ``disk``= element. the host by the ``nbd_tls`` and ``nbd_tls_x509_cert_dir`` in /etc/libvirt/qemu.conf. ('tls' :since:`Since 4.5.0` ) =20 + For "rbd", the ``name`` attribute could be two formats: the format of + ``pool_name/image_name`` includes the rbd pool name and image name w= ith + default rbd pool namespace; for the customized namespace, the format= is + ``pool_name/namespace/image_name``. The pool name, namespace and ima= ge are + separated by slash. + For protocols ``http`` and ``https`` an optional attribute ``query`` specifies the query string. ( :since:`Since 6.2.0` ) =20 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 72ac4f4191..5ece5f515d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9624,8 +9624,7 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node, /* for historical reasons we store the volume and image name in one XML * element although it complicates thing when attempting to access the= m. */ if (src->path && - (src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_GLUSTER || - src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_RBD)) { + src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_GLUSTER) { char *tmp; if (!(tmp =3D strchr(src->path, '/')) || tmp =3D=3D src->path) { @@ -9642,6 +9641,30 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node, tmp[0] =3D '\0'; } =20 + /* the name of rbd could be / or // */ + if (src->path && + src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_RBD) { + char *first_slash =3D strchr(src->path, '/'); + char *last_slash =3D strrchr(src->path, '/'); + if (!first_slash || + first_slash =3D=3D src->path || + !last_slash || + last_slash[1] =3D=3D '\0') { + virReportError(VIR_ERR_XML_ERROR, + _("can't split path '%s' into pool name, pool " + "namespace and image name"), src->path); + return -1; + } + + src->volume =3D src->path; + src->path =3D g_strdup(last_slash + 1); + src->ns =3D NULL; + first_slash[0] =3D '\0'; + last_slash[0] =3D '\0'; + if (first_slash !=3D last_slash) + src->ns =3D g_strdup(first_slash + 1); + } + /* snapshot currently works only for remote disks */ src->snapshot =3D virXPathString("string(./snapshot/@name)", ctxt); =20 @@ -25211,8 +25234,12 @@ virDomainDiskSourceFormatNetwork(virBufferPtr attr= Buf, virBufferAsprintf(attrBuf, " protocol=3D'%s'", virStorageNetProtocolTypeToString(src->protocol)); =20 - if (src->volume) - path =3D g_strdup_printf("%s/%s", src->volume, src->path); + if (src->volume) { + if (src->ns) + path =3D g_strdup_printf("%s/%s/%s", src->volume, src->ns, src= ->path); + else + path =3D g_strdup_printf("%s/%s", src->volume, src->path); + } =20 virBufferEscapeString(attrBuf, " name=3D'%s'", path ? path : src->path= ); virBufferEscapeString(attrBuf, " query=3D'%s'", src->query); diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 97a346db28..e7aaeebdb6 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -2666,6 +2666,7 @@ virStorageSourceClear(virStorageSourcePtr def) =20 VIR_FREE(def->path); VIR_FREE(def->volume); + VIR_FREE(def->ns); VIR_FREE(def->snapshot); VIR_FREE(def->configFile); VIR_FREE(def->query); diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index f73b3ee005..f027989462 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -284,6 +284,7 @@ struct _virStorageSource { char *snapshot; /* for storage systems supporting internal snapshots */ char *configFile; /* some storage systems use config file as part of the source definition */ + char *ns; /* for the storage systems supporting namespace */ char *query; /* query string for HTTP based protocols */ size_t nhosts; virStorageNetHostDefPtr hosts; --=20 2.28.0 From nobody Mon Apr 29 07:18:24 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1599034083; cv=none; d=zohomail.com; s=zohoarc; b=evhs0OsnbGm9SiHGCfr84i3+8peJO08rcGt3aHGan2wsXjOKti8Mjt5+AZItJKQtwLkp8jqdSl7VhxpEWOvL7ruu9T+7yTXtvjCQf5sJhaLronrzm6BF5aYxzHgVrWaMmDjzQzMztJU0QuOFXH25uLZEdwbXodcoWeF1k/CHv2k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599034083; 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; bh=On1w/rsYWrGtCYEbQONafTB1LcBk0UjP4DPC2TteEFU=; b=CPZF9PB+ZiB3AWOAXDHRiiS+lGJoZIdl4NC8IB9JMGj2opoJMd3VeSTNgIF6ygwxz6mBCA7RGGyVYu4tALo1qxf+EJJ9HIv3k7+79pTk/YyeLSBG0/JR+hQkJ6YfqJxikxaVWRzHQB2EZ3Hx34NrDR5uTp3KZB2/8LFoz4LGBCs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1599034083041203.64813252774172; Wed, 2 Sep 2020 01:08:03 -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-261--EuprtmpNlSVDJ8382i3wg-1; Wed, 02 Sep 2020 04:07:02 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0C2B21074647; Wed, 2 Sep 2020 08:06:57 +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 DE5625D9CD; Wed, 2 Sep 2020 08:06: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 AEDF579A3D; Wed, 2 Sep 2020 08:06:56 +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 08286m1L032631 for ; Wed, 2 Sep 2020 04:06:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id D09EB19746; Wed, 2 Sep 2020 08:06:48 +0000 (UTC) Received: from hansolo.redhat.com (ovpn-13-4.pek2.redhat.com [10.72.13.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id E1E8F19C71; Wed, 2 Sep 2020 08:06:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599034082; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=On1w/rsYWrGtCYEbQONafTB1LcBk0UjP4DPC2TteEFU=; b=JEBgxNxBWwgJ8tj2O1qdv8IQe0SBjEsH1rkl/RtQ1exo03AD8FIk0QZLm+YXWGIFO0O3lA 6fPRfQZZic38ro12dcngh/tXokEHkHMfEsDCutbNJzFE8qUsQKVxib4NNqhgSDQU1lXOdo KbCt/BGlMSR2Dfb81OhbUkJoA1heSaA= X-MC-Unique: -EuprtmpNlSVDJ8382i3wg-1 From: Han Han To: libvir-list@redhat.com Subject: [PATCH v5 3/4] qemu: Implement rbd namespace to the source name attribute Date: Wed, 2 Sep 2020 16:05:20 +0800 Message-Id: <20200902080520.583944-4-hhan@redhat.com> In-Reply-To: <20200902080520.583944-1-hhan@redhat.com> References: <20200902080520.583944-1-hhan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, pkrempa@redhat.com, dillaman@redhat.com, Han Han 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.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Since Nautilus ceph supports separate image namespaces within a pool for tenant isolation and QEMU adds it as a rbd blockdev options from 5.0.0. The source name with format "//" could be used to access a rbd image with namespace. Add unit tests for this attribute. https://bugzilla.redhat.com/show_bug.cgi?id=3D1816909 Signed-off-by: Han Han --- src/qemu/qemu_block.c | 1 + src/qemu/qemu_domain.c | 8 ++++ ...k-network-rbd-namespace.x86_64-latest.args | 41 +++++++++++++++++++ .../disk-network-rbd-namespace.xml | 33 +++++++++++++++ tests/qemuxml2argvtest.c | 1 + ...sk-network-rbd-namespace.x86_64-latest.xml | 41 +++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 7 files changed, 126 insertions(+) create mode 100644 tests/qemuxml2argvdata/disk-network-rbd-namespace.x86_6= 4-latest.args create mode 100644 tests/qemuxml2argvdata/disk-network-rbd-namespace.xml create mode 100644 tests/qemuxml2xmloutdata/disk-network-rbd-namespace.x86= _64-latest.xml diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 26c1b42428..d698bdec67 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -872,6 +872,7 @@ qemuBlockStorageSourceGetRBDProps(virStorageSourcePtr s= rc, "s:pool", src->volume, "s:image", src->path, "S:snapshot", src->snapshot, + "S:namespace", src->ns, "S:conf", src->configFile, "A:server", &servers, "S:user", username, diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index b1884b6c84..10e1afd586 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4683,6 +4683,14 @@ qemuDomainValidateStorageSource(virStorageSourcePtr = src, return -1; } =20 + if (src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_RBD && + src->ns && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_RBD_NAMESPACE)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("rbd namespace is not supported by this QEMU")); + return -1; + } + return 0; } =20 diff --git a/tests/qemuxml2argvdata/disk-network-rbd-namespace.x86_64-lates= t.args b/tests/qemuxml2argvdata/disk-network-rbd-namespace.x86_64-latest.ar= gs new file mode 100644 index 0000000000..a744805d74 --- /dev/null +++ b/tests/qemuxml2argvdata/disk-network-rbd-namespace.x86_64-latest.args @@ -0,0 +1,41 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-cpu qemu64 \ +-m 214 \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot strict=3Don \ +-device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ +-blockdev '{"driver":"rbd","pool":"pool","image":"image","namespace":"ns",\ +"server":[{"host":"mon1.example.org","port":"6321"},{"host":"mon2.example.= org",\ +"port":"6322"},{"host":"mon3.example.org","port":"6322"}],\ +"node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw= ",\ +"file":"libvirt-1-storage"}' \ +-device virtio-blk-pci,bus=3Dpci.0,addr=3D0x2,drive=3Dlibvirt-1-format,\ +id=3Dvirtio-disk0,bootindex=3D1 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/disk-network-rbd-namespace.xml b/tests/= qemuxml2argvdata/disk-network-rbd-namespace.xml new file mode 100644 index 0000000000..c451db186b --- /dev/null +++ b/tests/qemuxml2argvdata/disk-network-rbd-namespace.xml @@ -0,0 +1,33 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + + + + + + + + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index e93948e3fc..bfbb843458 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1174,6 +1174,7 @@ mymain(void) DO_TEST_CAPS_VER("disk-network-rbd", "2.5.0"); DO_TEST_CAPS_VER("disk-network-rbd", "2.12.0"); DO_TEST_CAPS_LATEST("disk-network-rbd"); + DO_TEST_CAPS_LATEST("disk-network-rbd-namespace"); DO_TEST_FAILURE("disk-network-rbd-no-colon", NONE); DO_TEST("disk-network-sheepdog", NONE); DO_TEST_CAPS_VER("disk-network-sheepdog", "2.12.0"); diff --git a/tests/qemuxml2xmloutdata/disk-network-rbd-namespace.x86_64-lat= est.xml b/tests/qemuxml2xmloutdata/disk-network-rbd-namespace.x86_64-latest= .xml new file mode 100644 index 0000000000..9840aae95c --- /dev/null +++ b/tests/qemuxml2xmloutdata/disk-network-rbd-namespace.x86_64-latest.xml @@ -0,0 +1,41 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + qemu64 + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + + + + + +
+ + +
+ + +
+ + + + + + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 6eb008c8d2..197a717b08 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -347,6 +347,7 @@ mymain(void) DO_TEST("disk-network-iscsi", QEMU_CAPS_VIRTIO_SCSI); DO_TEST("disk-network-gluster", NONE); DO_TEST("disk-network-rbd", NONE); + DO_TEST_CAPS_ARCH_LATEST("disk-network-rbd-namespace", "x86_64"); DO_TEST("disk-network-source-auth", NONE); DO_TEST("disk-network-sheepdog", NONE); DO_TEST("disk-network-vxhs", NONE); --=20 2.28.0 From nobody Mon Apr 29 07:18:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1599034040; cv=none; d=zohomail.com; s=zohoarc; b=Tx3ZoWopuYvHsuKkD2IsIvBlHlai/CJl9Ch0egpdrkSTWhYGOClVxA2x8jCAlAD5GfOMoAlZk90iKUOOSlRZhjMJ6aA9nCr0EoEsPJtTmKQ83SXftM7SFILgQt+7JKsEwTQd8kJwKcXm079JntpOqm3AJfMLgbKRFdriGx14qbM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599034040; 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; bh=9IxBjvmzmLpZT0QQLG7dXXiUrxhWKy7Kd7TG7GanmNQ=; b=hY8Jdf4Vnj1laRZMwqZlW448Lgp6STdrqrSA5xoJEpfiMV+QK6TH9GlAK39QEgzXbO/IQO6I1G/Es3ATEEjh0N+b5LYh+2UDWGOu982uDi7X2TI4KZo8ckqpzBJ+42lOPyYWqc5+I+DMPZOf8LO6n28plYugCuVbAKlAEDD7/cc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1599034040432863.2394746534354; Wed, 2 Sep 2020 01:07:20 -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-560-JciBDTewNbCZ4KaV4w_DJg-1; Wed, 02 Sep 2020 04:07:17 -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 677121074646; Wed, 2 Sep 2020 08:07:12 +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 46AC57E315; Wed, 2 Sep 2020 08:07:12 +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 1676D79DAB; Wed, 2 Sep 2020 08:07:12 +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 08287AgD032683 for ; Wed, 2 Sep 2020 04:07:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id E7D4B1974D; Wed, 2 Sep 2020 08:07:10 +0000 (UTC) Received: from hansolo.redhat.com (ovpn-13-4.pek2.redhat.com [10.72.13.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0BFF51972A; Wed, 2 Sep 2020 08:06:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599034039; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=9IxBjvmzmLpZT0QQLG7dXXiUrxhWKy7Kd7TG7GanmNQ=; b=A5OPQGp8ySpFn/MVo1v19VnTyO2cVLu98VxMMAuvDZwLixA05yHfWqlFDhBinENQ0F2nX2 VERxdcguBAPNr83TGxhzF798NO/BFnimVyWzp39oM79hx8H98JrTZDnJd04FJaXOJv9f8B CCW1PXpVgkuQorrzt1Q0uvKCNEbow6c= X-MC-Unique: JciBDTewNbCZ4KaV4w_DJg-1 From: Han Han To: libvir-list@redhat.com Subject: [PATCH v5 4/4] news: qemu: Support rbd namespace Date: Wed, 2 Sep 2020 16:05:21 +0800 Message-Id: <20200902080520.583944-5-hhan@redhat.com> In-Reply-To: <20200902080520.583944-1-hhan@redhat.com> References: <20200902080520.583944-1-hhan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, pkrempa@redhat.com, dillaman@redhat.com, Han Han 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Han Han --- NEWS.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/NEWS.rst b/NEWS.rst index e4b71e6563..8537da1747 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -20,6 +20,14 @@ v6.8.0 (unreleased) attribute of the device's ```` element can be used to disable = the filtering and allow all guest writes to the configuration space. =20 + * qemu: Support rbd pool namespace in the source name + + The namespaces is for the tenant isolation within a rbd pool, introduc= ed + from Ceph Nautilus, supported since ``QEMU 5.0.0``. In libvirt, the fo= rmat + of rbd source name like ``//`` could be used to + access a certain namespace of a rbd pool. And the format ``/`` + is reserved for the default namespace of a rbd pool. + * **Improvements** =20 * **Bug fixes** --=20 2.28.0