From nobody Mon May 6 04:14:05 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 ARC-Seal: i=1; a=rsa-sha256; t=1556549105; cv=none; d=zoho.com; s=zohoarc; b=K5ioQVAGgdQ+ogkCk4EsxeZ+bUkKfG4VGkqZ+zo1jKJwmIdsV1c2QCfVMff9kJygWqbBpw9yeVoHuOHYcj9qPIDHUKzKUSXjXPKPUnRlIQMdPXhummhquzCh6L2/E1zMqxLeTpm0nmHjmVEb5kBLAzI4UQF6lnKwJY8n732MimY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556549105; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=DZw1WvdB47rQO0bsEqxu0yntnIR2BtBoPnCRNvQ7e/k=; b=RH8OL6iygMEIaxZL2sJDhsMHmFvztI+macv+87IfINKY5Mhtrid2M6A6TIIPrZwDRB0RWgj+2V/CemLRr5Mut4CXclURna6iMa8PfD4nCnGu8O2U9WGfc0BTRO1Er7UPujwxc2+tmxmcM8KGSFJVgYYH1SGdJs/T1ITOvp4c6DM= 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 1556549105329749.7663657574694; Mon, 29 Apr 2019 07:45:05 -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 CD84D7EBBD; Mon, 29 Apr 2019 14:45:02 +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 68AF86F430; Mon, 29 Apr 2019 14:45:01 +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 836583FA48; Mon, 29 Apr 2019 14:44:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x3TEhsHw014388 for ; Mon, 29 Apr 2019 10:43:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id ABA35183FD; Mon, 29 Apr 2019 14:43:54 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 346224387 for ; Mon, 29 Apr 2019 14:43:50 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 29 Apr 2019 16:39:40 +0200 Message-Id: <4a9a9154e7f07322731ef62254aa3b811fce42d9.1556548704.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 for 5.3.0] storage_backend_rbd: Ignore rbd_diff_iterate error() if needed 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.27]); Mon, 29 Apr 2019 14:45:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" When cloning an RBD volume we try to find a snapshot which is not different to the image we're trying to clone. This boils down to calling rbd_diff_iterate() or rbd_diff_iterate2() on systems with newer ceph. These two are passed a callback - virStorageBackendRBDIterateCb() which sets @diff to 1 and returns -1. The idea is to stop iterating as soon as possible (i.e. we're iterating over a snapshot with some deltas). Unfortunately, returning a negative value from the callback means that iterate() function fails and thus we report an error: virsh # vol-clone --pool rbd_image_root coreos_2023 coreos00.disk error: Failed to clone vol from coreos_2023 error: failed to iterate RBD snapshot coreos_2023@base: Operation not permitted Therefore, report an error if and only if it doesn't originates in the callback. Reported on libvirt-users list: https://www.redhat.com/archives/libvirt-users/2019-April/msg00060.html Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- diff to v1: - Ignore error as suggested by Jason as it allows us to exit iteration early. src/storage/storage_backend_rbd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backen= d_rbd.c index f8c968e682..69f4fa2117 100644 --- a/src/storage/storage_backend_rbd.c +++ b/src/storage/storage_backend_rbd.c @@ -1101,7 +1101,9 @@ virStorageBackendRBDSnapshotFindNoDiff(rbd_image_t im= age, virStorageBackendRBDIterateCb, (void *)&diff); #endif =20 - if (r < 0) { + /* We care for errors only if the callback wasn't called at all. I= f it + * was, rbd_diff_iterate() returns an error which we have to ignor= e. */ + if (r < 0 && diff =3D=3D 0) { virReportSystemError(-r, _("failed to iterate RBD snapshot %s@= %s"), imgname, snaps[i].name); goto cleanup; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list