From nobody Sat Apr 20 04:45:28 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=1572690382; cv=none; d=zoho.com; s=zohoarc; b=Aua15X43rAyx6Y7oy/4sgAVtDCB2KKWaUBTWp5AVVbZvl2yibzGgfRfhNMiiIYCLEacXA4cyI10hZjRsBBIjDJPnR6sowGEfTIdA4HgnSHYkohqpDyeRICRg2XBT7q9lgu/ZunzwJVVTVo9BsUqHuO1iHN6g/36TvROuWkUtoug= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572690382; 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=Vn0OQzDCJXUt/0Hb6bHJ9qhl6BrTxYczKIE3V3Tm2II=; b=EBvQNWOQ4HdezmymUeWLRWmNdfKMpKyx8NPHD9nzZ4glPkxjehN5ekhal2GmKIcxXgWQWf/DqPOuUyO+URELjigrT/+3qghLCllgO1FcA15OCZBz4qY0SGpywjN5kLgoMOrk4ZaZWKXd0ELlgB+n1fvHVVo+ZKkeQqUMMaf0iUU= 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 1572690381995934.8392039983207; Sat, 2 Nov 2019 03:26:21 -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-152-gzdV_QtaOdSWSIy-MS48Ug-1; Sat, 02 Nov 2019 06:26:19 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1E77C1005500; Sat, 2 Nov 2019 10:26:14 +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 E68445C1D4; Sat, 2 Nov 2019 10:26:13 +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 7A8D918089D0; Sat, 2 Nov 2019 10:26:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9T4Clh7009801 for ; Tue, 29 Oct 2019 00:12:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 06AF85C1D8; Tue, 29 Oct 2019 04:12:47 +0000 (UTC) Received: from mx1.redhat.com (ext-mx23.extmail.prod.ext.phx2.redhat.com [10.5.110.64]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 015FD5C1D6 for ; Tue, 29 Oct 2019 04:12:44 +0000 (UTC) Received: from regular1.263xmail.com (regular1.263xmail.com [211.150.70.204]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F32E31017C3C for ; Tue, 29 Oct 2019 04:12:41 +0000 (UTC) Received: from localhost (unknown [192.168.167.70]) by regular1.263xmail.com (Postfix) with ESMTP id D34B627E for ; Tue, 29 Oct 2019 12:12:39 +0800 (CST) Received: from localhost.localdomain (unknown [14.18.236.69]) by smtp.263.net (postfix) whith ESMTP id P2399T140387200325376S1572322355791626_; Tue, 29 Oct 2019 12:12:39 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572690380; 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=Vn0OQzDCJXUt/0Hb6bHJ9qhl6BrTxYczKIE3V3Tm2II=; b=IWpZp+Rf7g73sMf/p9XCknsL0mI1aagiD2WJTF4IWP6761uwrGrETBNpHEH9pZ+r+LEjR0 lSeVnCH6/cu7elKAfhctm4zro6dxhA6FyRdIcoTVH95CqjYskGgvkG/vZ5JqCkS7H2LYMY ObAicp9Qyjay4I/lGYPxH0RFh3zcE70= 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: <39ae16ffca777014d2ec4bb6e9b87a81> 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:12:33 +0800 Message-Id: <1572322353-19811-1-git-send-email-yili@winhong.com> In-Reply-To: <1572321614-19346-1-git-send-email-yili@winhong.com> References: <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.6.2 (mx1.redhat.com [10.5.110.64]); Tue, 29 Oct 2019 04:12:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.64]); Tue, 29 Oct 2019 04:12:43 +0000 (UTC) for IP:'211.150.70.204' 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.204 regular1.263xmail.com 211.150.70.204 regular1.263xmail.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.64 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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 v2] 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.79 on 10.5.11.16 X-MC-Unique: gzdV_QtaOdSWSIy-MS48Ug-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 | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backen= d_rbd.c index 7ce26ed..f7319d6 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; } --=20 2.7.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list