From nobody Mon Feb 9 01:22:06 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; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565801981; cv=none; d=zoho.com; s=zohoarc; b=UOHCTIfZ/EWGqxToKE9jqpWhqGCfC0i38coW1a16MLV7q4EYN9q5dWmC2Ehx+GO3SeelkBCgBJyx8h4rtOwvUfhyYlA/J9LVcNU0NVh5eqQ1lfWf0L0QaW5TuesGCYwnBUWpPCnPt0MRA3/50A3NDr3DbGXDhRYfknBByqUg0CE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565801981; h=Content-Type:Content-Transfer-Encoding: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:ARC-Authentication-Results; bh=4BXovlf+7EzW3R8MmesFvpsW7777lwZ0BdEGN1aAp7Y=; b=IQ8o2z4QByfvvOXLT4jou5ZuABFc98NIH88a1EfGKSvDv9QgBUagT4lC5jTUDgNknM4VEzy8DemE7gJLyr6u3NsCUBm2JmLUYImkXbWFTQOj9zCTaWxhlFav5nGL5hpGxg0vgi+ycricGFW8bV9e8xVFiqj8g3UJ00NTQR1OLl4= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1565801981366547.4503508330723; Wed, 14 Aug 2019 09:59:41 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1E8B664127; Wed, 14 Aug 2019 16:59:39 +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 ECDBF80A3F; Wed, 14 Aug 2019 16:59:38 +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 AC5E4180BA9B; Wed, 14 Aug 2019 16:59:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7EGxTjV028606 for ; Wed, 14 Aug 2019 12:59:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id BB3208B161; Wed, 14 Aug 2019 16:59:29 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 458105D9DC for ; Wed, 14 Aug 2019 16:59:29 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 14 Aug 2019 18:59:20 +0200 Message-Id: <716c05679ceb2c0bca5cc637e40900421bb37dfb.1565801782.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/6] qemu: Allow suppressing errors from qemuStorageLimitsRefresh 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 14 Aug 2019 16:59:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" qemuStorageLimitsRefresh uses qemuDomainStorageOpenStat internally and there are callers which don't care about the error. Propagate the skipInaccessible flag so that we can log less errors. Callers currently don't care about the return value change. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2dffef9642..243a8ac4cf 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12363,6 +12363,7 @@ qemuDomainStorageUpdatePhysical(virQEMUDriverPtr dr= iver, * @cfg: driver configuration data * @vm: domain object * @src: storage source data + * @skipInaccessible: Suppress reporting of common errors when accessing @= src * * Refresh the capacity and allocation limits of a given storage source. * @@ -12384,22 +12385,27 @@ qemuDomainStorageUpdatePhysical(virQEMUDriverPtr = driver, * is sparse, but the amount of sparseness changes due to writes or * punching holes), and physical size of a non-raw file can change. * - * Returns 0 on success, -1 on failure + * Returns 1 if @src was successfully updated, 0 if @src can't be opened a= nd + * @skipInaccessible is true (no errors are reported) or -1 otherwise (err= ors + * are reported). */ static int qemuStorageLimitsRefresh(virQEMUDriverPtr driver, virQEMUDriverConfigPtr cfg, virDomainObjPtr vm, - virStorageSourcePtr src) + virStorageSourcePtr src, + bool skipInaccessible) { + int rc; int ret =3D -1; int fd =3D -1; struct stat sb; char *buf =3D NULL; ssize_t len; - if (qemuDomainStorageOpenStat(driver, cfg, vm, src, &fd, &sb, false) <= 0) - goto cleanup; + if ((rc =3D qemuDomainStorageOpenStat(driver, cfg, vm, src, &fd, &sb, + skipInaccessible)) <=3D 0) + return rc; if (virStorageSourceIsLocalStorage(src)) { if ((len =3D virFileReadHeaderFD(fd, VIR_STORAGE_MAX_HEADER, &buf)= ) < 0) { @@ -12427,7 +12433,7 @@ qemuStorageLimitsRefresh(virQEMUDriverPtr driver, S_ISBLK(sb.st_mode)) src->allocation =3D 0; - ret =3D 0; + ret =3D 1; cleanup: VIR_FREE(buf); @@ -12477,7 +12483,7 @@ qemuDomainGetBlockInfo(virDomainPtr dom, /* for inactive domains we have to peek into the files */ if (!virDomainObjIsActive(vm)) { - if ((qemuStorageLimitsRefresh(driver, cfg, vm, disk->src)) < 0) + if ((qemuStorageLimitsRefresh(driver, cfg, vm, disk->src, false)) = < 0) goto endjob; info->capacity =3D disk->src->capacity; @@ -21295,7 +21301,7 @@ qemuDomainGetStatsOneBlockFallback(virQEMUDriverPtr= driver, if (virStorageSourceIsEmpty(src)) return 0; - if (qemuStorageLimitsRefresh(driver, cfg, dom, src) < 0) { + if (qemuStorageLimitsRefresh(driver, cfg, dom, src, false) < 0) { virResetLastError(); return 0; } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list