From nobody Thu Apr 25 22:04:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1572690364; cv=none; d=zoho.com; s=zohoarc; b=U1c974sgpuVP5J1pOOo+kGZkOmUB4/VSVckngIhsRYu/aIWfowu3c2ZsmhIoirHIBa1MOSUWsZmL2FCs9mU5Zwvpeyra+6drhMo6bwG4NuPo0XBJlyPWMkc8DQq4emnvzPiH0OtX4X7jpc/7le/Brxxx5XIdcYyYv6og4k6sDFc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572690364; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=0WO36i9xdB0/x2FERjO3/71X1FiNZZtLuF5Tkr0j2sA=; b=kRs8v6Kn7kE6MPy+rEZsWkLX7vpbwWUiPZcyJKXfADz2bZMYgdMmvwWxD4yaUIm30RMRE0Ton40R75YIBMjoKTb7lSZrgIpnMkgdZSLM/PmtKzFekWg6+u2mww/95mTE1hpeYKXvCZFSvJsjsFxeZ+GOyPz1cdpZ6wS6NB2+VaU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1572690364556625.6664718977933; Sat, 2 Nov 2019 03:26:04 -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-292-8jKXXs2mNiyLvlLgfOEQLw-1; Sat, 02 Nov 2019 06:26:01 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4614B1005500; Sat, 2 Nov 2019 10:25:56 +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 0C89919C68; Sat, 2 Nov 2019 10:25: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 D03464BB65; Sat, 2 Nov 2019 10:25:48 +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 x9T40Uar009211 for ; Tue, 29 Oct 2019 00:00:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id 30D485D9C8; Tue, 29 Oct 2019 04:00:30 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 273035D9C3 for ; Tue, 29 Oct 2019 04:00:27 +0000 (UTC) Received: from regular1.263xmail.com (regular1.263xmail.com [211.150.70.206]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2B4488535D for ; Tue, 29 Oct 2019 04:00:24 +0000 (UTC) Received: from localhost (unknown [192.168.167.225]) by regular1.263xmail.com (Postfix) with ESMTP id E248820C for ; Tue, 29 Oct 2019 12:00:21 +0800 (CST) Received: from localhost.localdomain (unknown [14.18.236.69]) by smtp.263.net (postfix) whith ESMTP id P2342T140136902178560S1572321617264648_; Tue, 29 Oct 2019 12:00:22 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572690362; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=0WO36i9xdB0/x2FERjO3/71X1FiNZZtLuF5Tkr0j2sA=; b=LazEX2JTe4ttbe7lxO9WDQKmYjnhRaHJJ9URlJrlJnizEG/SXf83XEncKdMbbjMSrChazj +Ul9mGP5L8vkM20D+BlEnvwatPNs8s23q/h82xR3MXIo3SacU6vhv1G6Zp5Ts5KZWFbtQe wXPGrOn5tHg7sLx/D98OoxaCAPqpVaE= X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-SKE-CHECKED: 1 X-ABS-CHECKED: 1 X-IP-DOMAINF: 1 X-UNIQUE-TAG: <072cbfc8ee8ca6e7afbe3060253a9070> X-RL-SENDER: yili@winhong.com X-SENDER: yili@winhong.com X-LOGIN-NAME: yili@winhong.com X-FST-TO: libvir-list@redhat.com X-SENDER-IP: 14.18.236.69 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 From: Yi Li To: libvir-list@redhat.com Date: Tue, 29 Oct 2019 12:00:14 +0800 Message-Id: <1572321614-19346-1-git-send-email-yili@winhong.com> MIME-Version: 1.0 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 29 Oct 2019 04:00:25 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 29 Oct 2019 04:00:25 +0000 (UTC) for IP:'211.150.70.206' DOMAIN:'regular1.263xmail.com' HELO:'regular1.263xmail.com' FROM:'yili@winhong.com' RCPT:'' X-RedHat-Spam-Score: 0 (RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS) 211.150.70.206 regular1.263xmail.com 211.150.70.206 regular1.263xmail.com X-Scanned-By: MIMEDefang 2.83 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Sat, 02 Nov 2019 06:25:47 -0400 Cc: yili@winhong.com Subject: [libvirt] [PATCH] storage: Fix volStorageBackendRBDRefreshVolInfo 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.23 X-MC-Unique: 8jKXXs2mNiyLvlLgfOEQLw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Fix the return value status comparison checking for call to volStorageBackendRBDRefreshVolInfo introduced by commit id f46d137e. we only should fail when the return is < 0. -ENOENT, -ETIMEDOUT will ignore according commit id f46d137e. Signed-off-by: Yi Li --- src/storage/storage_backend_rbd.c | 40 ++++++++++++++++++++++++-----------= ---- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backen= d_rbd.c index 7ce26ed..1551cf4 100644 --- a/src/storage/storage_backend_rbd.c +++ b/src/storage/storage_backend_rbd.c @@ -411,6 +411,7 @@ volStorageBackendRBDGetFeatures(rbd_image_t image, int r, ret =3D -1; =20 if ((r =3D rbd_get_features(image, features)) < 0) { + ret =3D r; virReportSystemError(-r, _("failed to get the features of RBD imag= e " "%s"), volname); goto cleanup; @@ -427,16 +428,19 @@ volStorageBackendRBDGetFlags(rbd_image_t image, const char *volname, uint64_t *flags) { - int rc; + int r, ret =3D -1; =20 - if ((rc =3D rbd_get_flags(image, flags)) < 0) { - virReportSystemError(-rc, + if ((r =3D rbd_get_flags(image, flags)) < 0) { + ret =3D r; + virReportSystemError(-r, _("failed to get the flags of RBD image %s"), volname); - return -1; + goto cleanup; } + ret =3D 0; =20 - return 0; + cleanup: + return ret; } =20 static bool @@ -470,6 +474,7 @@ virStorageBackendRBDSetAllocation(virStorageVolDefPtr v= ol, if ((r =3D rbd_diff_iterate2(image, NULL, 0, info->size, 0, 1, &virStorageBackendRBDRefreshVolInfoCb, &allocation)) < 0) { + ret =3D r; virReportSystemError(-r, _("failed to iterate RBD image '%s'"), vol->name); goto cleanup; @@ -525,24 +530,28 @@ volStorageBackendRBDRefreshVolInfo(virStorageVolDefPt= r vol, uint64_t flags; =20 if ((r =3D rbd_open_read_only(ptr->ioctx, vol->name, &image, NULL)) < = 0) { - ret =3D -r; + ret =3D r; virReportSystemError(-r, _("failed to open the RBD image '%s'"), vol->name); goto cleanup; } =20 if ((r =3D rbd_stat(image, &info, sizeof(info))) < 0) { - ret =3D -r; + ret =3D r; virReportSystemError(-r, _("failed to stat the RBD image '%s'"), vol->name); goto cleanup; } =20 - if (volStorageBackendRBDGetFeatures(image, vol->name, &features) < 0) + if ((r =3D volStorageBackendRBDGetFeatures(image, vol->name, &features= )) < 0) { + ret =3D r; goto cleanup; + } =20 - if (volStorageBackendRBDGetFlags(image, vol->name, &flags) < 0) + if ((r =3D volStorageBackendRBDGetFlags(image, vol->name, &flags)) < 0= ) { + ret =3D r; goto cleanup; + } =20 vol->target.capacity =3D info.size; vol->type =3D VIR_STORAGE_VOL_NETWORK; @@ -555,8 +564,11 @@ volStorageBackendRBDRefreshVolInfo(virStorageVolDefPtr= vol, "Querying for actual allocation", def->source.name, vol->name); =20 - if (virStorageBackendRBDSetAllocation(vol, image, &info) < 0) + if ((r =3D virStorageBackendRBDSetAllocation(vol, image, &info) < = 0)) { + ret =3D r; goto cleanup; + } + } else { vol->target.allocation =3D info.obj_size * info.num_objs; } @@ -734,12 +746,10 @@ virStorageBackendRBDRefreshPool(virStoragePoolObjPtr = pool) * * Do not error out and simply ignore the volume */ - if (r < 0) { - if (r =3D=3D -ENOENT || r =3D=3D -ETIMEDOUT) - continue; - + if (r =3D=3D -ENOENT || r =3D=3D -ETIMEDOUT) + continue; + else if (r < 0) goto cleanup; - } =20 if (virStoragePoolObjAddVol(pool, vol) < 0) goto cleanup; --=20 2.7.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list