From nobody Sat Feb 7 06:54:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1654677125256519.9606223096234; Wed, 8 Jun 2022 01:32:05 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-108-EnDYqTzLP622LHn8AKEL7w-1; Wed, 08 Jun 2022 04:31:59 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 307E685A588; Wed, 8 Jun 2022 08:31:57 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id B48D340CF8E8; Wed, 8 Jun 2022 08:31:56 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 87BA8194704C; Wed, 8 Jun 2022 08:31:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id BB871194707F for ; Wed, 1 Jun 2022 22:07:05 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 9A1861415101; Wed, 1 Jun 2022 22:07:05 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 964871415100 for ; Wed, 1 Jun 2022 22:07:05 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7E66A833979 for ; Wed, 1 Jun 2022 22:07:05 +0000 (UTC) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.24]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-377-XYJs-mlyMqeezwmzZ50gwA-1; Wed, 01 Jun 2022 18:07:03 -0400 Received: from artex.ka.lesniak-it.de ([109.250.33.234]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MGQzj-1o1k203UFx-00Gt7l; Wed, 01 Jun 2022 23:54:25 +0200 X-MC-Unique: EnDYqTzLP622LHn8AKEL7w-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: XYJs-mlyMqeezwmzZ50gwA-1 From: Fabian Lesniak To: libvir-list@redhat.com Subject: [PATCH] storage: zfs: split pool and volume names properly Date: Wed, 1 Jun 2022 23:54:17 +0200 Message-Id: <20220601215417.4252-1-fabian@lesniak-it.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:Tmfc5/IQIeAQZcu8ix/uNVE7kfGqq7tEr1VkQgbGw1H8g9MXiZD 8JAxeO0bcJOoVi2x1RgMw5MBdV2y8CS4oyan+Pn/2iVvvXP+FNQzy9TCuFHX23txooJsMOt PKYxu+PDylGPeyQVbz11P2u5VYBKSVwQyTfBFxZTdZhnjhzB6FPqhQE+UH3u/ik1kosfSSr mfTqI003OSzCyVL5Bd+5g== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:SyWH01tblyQ=:Hyfm63lt1s6PgKTLdPwUfq 24tK/SrPO/U9JzeWfWMc34FAcFWsQSnp4TgMHIIfJVzdEg5SXHgOK1xldh0/l81UKnSlyCRja 9sxrvJjHkvwZk+y0rNCuShPxAjhmJkECMijy1IEzNzep7uMN7Np6eFAVamPFy+/rMQxTJ8vOU ji9PVIO9a6Ug4Qp7G9qQ1pqw1sIE/52wFJ0DHW73FPEh9FeQqEAx3YbETJWUMUpPPj9KpkECP NUXgpd4hgihnIU/pEx0vCZgGo043d2v6P10yq7jvwkRWrOFmQ/qWidHJJ1SGfsxK/kOjnBZY7 6WUld+xYSrUFzUzf0J7AtxTQOZeBPiN+y6eTShV/Uogn2QRzola7tIeJqq1V8ccdu+JuYQddM xCB4eRXIo8R+jJ2ReWqW3xfNjMXGyl2LmfxZrqccXE6jimFHD7jR7qpFZvDVlmaYevIl8dCBb Erxk/xqBb0LvqklNbvkJAcyeTNJlxNuhKuWn6Ztj074rpQMpmKMw3lAJI0nWDOtDofefor2Rb ELo9zhMGjrF4HiHxu2I2X3j1ceWxIf7VV+ivEzTf1InCEUcBRDuZPApXkbAKAYd75Nc6Rq7d2 cUsyAtrF/ygbhojpMFhNSxSZWP3bOmMyUVRdmEb+xkPsoMRukfmx554fiLZQnW+3eBKlXhBpm FnFqMo5PR0Py7TRU6BBV8oSerbtVNyv5bXf7KpPXbjAGP+oCCXz7iBTKRASCuwJxLE5c9+ufQ txgoFu55TqqIMwPAX0fNHAuwQhKNN6/1PLX3443mibxm01jF52Zwi46VaLc= 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.85 on 10.11.54.7 X-Mailman-Approved-At: Wed, 08 Jun 2022 08:31:54 +0000 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fabian Lesniak Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1654677126759100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Before, the volume name was determined as the last token after any / character. This does not work with zvols below the top level of the pool: /dev/zvols/pool/images/vm1 is truncated to /dev/zvols/pool/vm1. This patch removes the pool name only, so when using the pool "pool", the volume path "images/vm1" is used. --- src/storage/storage_backend_zfs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/storage/storage_backend_zfs.c b/src/storage/storage_backen= d_zfs.c index 2a5d74357d..397ea7f386 100644 --- a/src/storage/storage_backend_zfs.c +++ b/src/storage/storage_backend_zfs.c @@ -104,7 +104,7 @@ virStorageBackendZFSParseVol(virStoragePoolObj *pool, virStorageVolDef *volume =3D NULL; virStoragePoolDef *def =3D virStoragePoolObjGetDef(pool); g_auto(GStrv) tokens =3D NULL; - char *tmp; + char *pool_name =3D def->source.name; =20 if (!(tokens =3D g_strsplit(volume_string, "\t", 0))) return -1; @@ -113,8 +113,9 @@ virStorageBackendZFSParseVol(virStoragePoolObj *pool, goto cleanup; =20 vol_name =3D tokens[0]; - if ((tmp =3D strrchr(vol_name, '/'))) - vol_name =3D tmp + 1; + if (strlen(vol_name) > strlen(pool_name) && + STRPREFIX(vol_name, pool_name)) + vol_name +=3D strlen(pool_name) + 1; =20 if (vol =3D=3D NULL) volume =3D virStorageVolDefFindByName(pool, vol_name); --=20 2.36.1