From nobody Thu Apr 25 20:10:37 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1553003011047224.07050126202307; Tue, 19 Mar 2019 06:43:31 -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 AEF0730842AA; Tue, 19 Mar 2019 13:43:28 +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 3A98460FAB; Tue, 19 Mar 2019 13:43:28 +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 E69FC181A13C; Tue, 19 Mar 2019 13:43:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2JDgaPQ011154 for ; Tue, 19 Mar 2019 09:42:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id EFA901001E71; Tue, 19 Mar 2019 13:42:35 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E9D381001DE7 for ; Tue, 19 Mar 2019 13:42:33 +0000 (UTC) Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DB38413AAE for ; Tue, 19 Mar 2019 13:42:32 +0000 (UTC) Received: by mail-qt1-f199.google.com with SMTP id f89so4153728qtb.4 for ; Tue, 19 Mar 2019 06:42:32 -0700 (PDT) Received: from cube-1.lan (pool-96-241-25-63.washdc.fios.verizon.net. [96.241.25.63]) by smtp.gmail.com with ESMTPSA id l123sm7037514qkf.90.2019.03.19.06.42.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Mar 2019 06:42:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wKi7WJpV1OZQo3TXrWSPh7OtZedcsrNBkcgtuYkWBak=; b=cYshO5hGgjoWWH4kpkYm++mtjSg2hFnAf5zd/BhSdCilCXjVsFM15cty0JAZcyyUMe EmcrJeHb7hqypivJFnDbNWM/qJaLXi/dCIELpUUZnqrxJsXBHwJnHQskZM4gD8g5Aob0 1a8sa5CHeciGirJXjJOEcr354/3/JjOkVg3QqW/BgjdS1bjNrhC0LVNY7DU7WqQPH6xf vlZm5P3Fl3e8rCNLWrIz9V6Pxs3C95Rvvrupmg227IITBepUk8WK9wpdnY4uF80gqzsX C7DBfQG7tQ1fGAhqB/l/cYw6tTgQxV/RrAtZs2sXDm8p2S3RORfCHbpQKIjYoJjGZ6U2 5/hQ== X-Gm-Message-State: APjAAAUFIrhYhrjrtx5c4Dczx6rEQETc1JOva91kwV2tM1ZAepZqe4/Z m9in5KwltxnQ2BJ6/ynfiTKfgCCxB4RQmzm3AKaVGpuxHB+fqGjnrv98IUmZwRVU2DcJTa0zQJX 0MP/eOWCN+hKz9llLO0A= X-Received: by 2002:a37:e212:: with SMTP id g18mr1872649qki.152.1553002951810; Tue, 19 Mar 2019 06:42:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqxe0J9f6WMQdzTXK8kdNX0oJsaw1Y/MiaIAmcWvdmTy/dg18luUVB0bCs9IikJmPnQdffQ0tQ== X-Received: by 2002:a37:e212:: with SMTP id g18mr1872637qki.152.1553002951567; Tue, 19 Mar 2019 06:42:31 -0700 (PDT) From: jdillama@redhat.com X-Google-Original-From: dillaman@redhat.com To: libvir-list@redhat.com Date: Tue, 19 Mar 2019 09:42:16 -0400 Message-Id: <20190319134218.13517-2-dillaman@redhat.com> In-Reply-To: <20190319134218.13517-1-dillaman@redhat.com> References: <20190319134218.13517-1-dillaman@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Jason Dillaman Subject: [libvirt] [PATCH v3 1/3] rbd: do not attempt to use fast-diff if it's marked invalid 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: , 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.40]); Tue, 19 Mar 2019 13:43:29 +0000 (UTC) Content-Type: text/plain; charset="utf-8" From: Jason Dillaman The librbd API will transparently revert to a slow disk usage calculation method if the fast-diff map is marked as invalid. Signed-off-by: Jason Dillaman --- src/storage/storage_backend_rbd.c | 41 ++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backen= d_rbd.c index 2b7af1db23..e67911f928 100644 --- a/src/storage/storage_backend_rbd.c +++ b/src/storage/storage_backend_rbd.c @@ -437,10 +437,29 @@ volStorageBackendRBDGetFeatures(rbd_image_t image, } =20 #if LIBRBD_VERSION_CODE > 265 +static int +volStorageBackendRBDGetFlags(rbd_image_t image, + const char *volname, + uint64_t *flags) +{ + int r, ret =3D -1; + + if ((r =3D rbd_get_flags(image, flags)) < 0) { + virReportSystemError(-r, _("failed to get the flags of RBD image " + "%s"), volname); + goto cleanup; + } + ret =3D 0; + + cleanup: + return ret; +} + static bool -volStorageBackendRBDUseFastDiff(uint64_t features) +volStorageBackendRBDUseFastDiff(uint64_t features, uint64_t flags) { - return features & RBD_FEATURE_FAST_DIFF; + return (((features & RBD_FEATURE_FAST_DIFF) !=3D 0ULL) && + ((flags & RBD_FLAG_FAST_DIFF_INVALID) =3D=3D 0ULL)); } =20 static int @@ -484,7 +503,17 @@ virStorageBackendRBDSetAllocation(virStorageVolDefPtr = vol, =20 #else static int -volStorageBackendRBDUseFastDiff(uint64_t features ATTRIBUTE_UNUSED) +volStorageBackendRBDGetFlags(rbd_image_t image, + const char *volname, + uint64_t *flags) +{ + *flags =3D 0; + return 0; +} + +static int +volStorageBackendRBDUseFastDiff(uint64_t features ATTRIBUTE_UNUSED, + uint64_t feature_flags ATTRIBUTE_UNUSED) { return false; } @@ -509,6 +538,7 @@ volStorageBackendRBDRefreshVolInfo(virStorageVolDefPtr = vol, rbd_image_t image =3D NULL; rbd_image_info_t info; uint64_t features; + uint64_t flags; =20 if ((r =3D rbd_open_read_only(ptr->ioctx, vol->name, &image, NULL)) < = 0) { ret =3D -r; @@ -527,11 +557,14 @@ volStorageBackendRBDRefreshVolInfo(virStorageVolDefPt= r vol, if (volStorageBackendRBDGetFeatures(image, vol->name, &features) < 0) goto cleanup; =20 + if (volStorageBackendRBDGetFlags(image, vol->name, &flags) < 0) + goto cleanup; + vol->target.capacity =3D info.size; vol->type =3D VIR_STORAGE_VOL_NETWORK; vol->target.format =3D VIR_STORAGE_FILE_RAW; =20 - if (volStorageBackendRBDUseFastDiff(features)) { + if (volStorageBackendRBDUseFastDiff(features, flags)) { VIR_DEBUG("RBD image %s/%s has fast-diff feature enabled. " "Querying for actual allocation", def->source.name, vol->name); --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 20:10:37 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1553003018027200.06036133815394; Tue, 19 Mar 2019 06:43:38 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id BA9226699D; Tue, 19 Mar 2019 13:43:35 +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 901801001E7F; Tue, 19 Mar 2019 13:43:35 +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 5735441F3D; Tue, 19 Mar 2019 13:43:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2JDgbgB011164 for ; Tue, 19 Mar 2019 09:42:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1C69160FAB; Tue, 19 Mar 2019 13:42:37 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 177DA60F94 for ; Tue, 19 Mar 2019 13:42:34 +0000 (UTC) Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B1C10C056793 for ; Tue, 19 Mar 2019 13:42:34 +0000 (UTC) Received: by mail-qk1-f199.google.com with SMTP id k21so17716610qkg.19 for ; Tue, 19 Mar 2019 06:42:34 -0700 (PDT) Received: from cube-1.lan (pool-96-241-25-63.washdc.fios.verizon.net. [96.241.25.63]) by smtp.gmail.com with ESMTPSA id l123sm7037514qkf.90.2019.03.19.06.42.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Mar 2019 06:42:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ibJIqGoB3hEoOGxGIEjtn2rrB3y8ggDdJjXWu4kAwMI=; b=Dzd4iA/ketHeVDvWTg0IA9Gj4a9iP3w8XcbsOdjREJJQTqpJ3qwJDBvJzHk/G2zJIx u6zJFMSHiVl2OiTekW1W5N5S8WDu1Kad0JGoOatdBvrIIFK0qeTWN1pO/8vriXPyv33O 5rEDXySB5bHPa6sMTmlL9v2feLmqHe2Kg7fOl161nqQ9TYe7GflrmTr06hK8Dmn0s5u3 aftVJ+NHWxmEOkR6yU1K6oCb6Cg0SnRT0Xshpz70PjYr9YBabxuFNIzoIeWlpUmrTkNG ofWwbsxOv3Vnb8Qhi5JbirBPCYgZAz1VCxQVIW+49eRE1VyvRC383lsnzty0BAZmffTO cYEg== X-Gm-Message-State: APjAAAUkCHRE8/NdRd/fW7XmdfSvVHP/XDEb9KAB4xQUdDBaCb7q/EBE PmKYt691LfXf0MZH9GSlCqMui5i9zBD4LBew0vIeE9sYsIXS2ddDbw0FbGFyauGU333gxCLP0VS nPyBBx1pInWs+u3pi+FE= X-Received: by 2002:ac8:3328:: with SMTP id t37mr2096515qta.246.1553002953697; Tue, 19 Mar 2019 06:42:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqzn+Pe35kyG8ue1uqD4Woh/v6Q9AqVMjkoFAanuLq0hkFQBYi1vIAZq970oiGUbltiU23MnSg== X-Received: by 2002:ac8:3328:: with SMTP id t37mr2096501qta.246.1553002953417; Tue, 19 Mar 2019 06:42:33 -0700 (PDT) From: jdillama@redhat.com X-Google-Original-From: dillaman@redhat.com To: libvir-list@redhat.com Date: Tue, 19 Mar 2019 09:42:17 -0400 Message-Id: <20190319134218.13517-3-dillaman@redhat.com> In-Reply-To: <20190319134218.13517-1-dillaman@redhat.com> References: <20190319134218.13517-1-dillaman@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Jason Dillaman Subject: [libvirt] [PATCH v3 2/3] storage: optional 'refresh' elemement on pool 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 19 Mar 2019 13:43:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" From: Jason Dillaman The new 'refresh' element can override the default refresh operations for a storage pool. The only currently supported override is to set the volume allocation size to the volume capacity. This can be specified by adding the following snippet: ... ... This is useful for certain backends where computing the actual allocation of a volume might be an expensive operation. Signed-off-by: Jason Dillaman --- docs/formatstorage.html.in | 27 +++++++++++++++++++ docs/schemas/storagecommon.rng | 7 +++++ docs/schemas/storagepool.rng | 23 ++++++++++++++++ src/conf/storage_conf.c | 27 +++++++++++++++++++ src/conf/storage_conf.h | 9 +++++++ .../pool-rbd-refresh-volume-allocation.xml | 15 +++++++++++ .../pool-rbd-refresh-volume-allocation.xml | 18 +++++++++++++ tests/storagepoolxml2xmltest.c | 1 + 8 files changed, 127 insertions(+) create mode 100644 tests/storagepoolxml2xmlin/pool-rbd-refresh-volume-allo= cation.xml create mode 100644 tests/storagepoolxml2xmlout/pool-rbd-refresh-volume-all= ocation.xml diff --git a/docs/formatstorage.html.in b/docs/formatstorage.html.in index 968651330f..680950ff20 100644 --- a/docs/formatstorage.html.in +++ b/docs/formatstorage.html.in @@ -508,6 +508,33 @@ device, measured in bytes. Since 0.4.1

=20 +

Refresh overrides

+ +

+ The optional refresh element can control how the pool a= nd + associated volumes are refreshed (pool type rbd). The + allocation attribute of the volume child e= lement + controls the method used for computing the allocation of a volume. T= he + valid attribute values are default to compute the actual + usage or capacity to use the logical capacity for cases= where + computing the allocation is too expensive. The following XML snippet + shows the syntax: +

+<pool type=3D"rbd">
+  <name>myrbdpool</name>
+...
+  <source>
+...
+  </source>
+...
+  <refresh>
+    <volume allocation=3D'capacity'/>
+  </refresh>
+</pool>
+...
+ Since 5.2.0 +

+

Storage Pool Namespaces

=20

diff --git a/docs/schemas/storagecommon.rng b/docs/schemas/storagecommon.rng index 63b51470a0..d837f92bc7 100644 --- a/docs/schemas/storagecommon.rng +++ b/docs/schemas/storagecommon.rng @@ -236,4 +236,11 @@ =20 + + + default + capacity + + + diff --git a/docs/schemas/storagepool.rng b/docs/schemas/storagepool.rng index 3907f70afe..3ca8e790ea 100644 --- a/docs/schemas/storagepool.rng +++ b/docs/schemas/storagepool.rng @@ -155,6 +155,7 @@ + @@ -691,6 +692,28 @@ =20 + + + + + + + + + + + + + + + + + + + + + +