From nobody Mon Feb 9 03:17:16 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1606911347; cv=none; d=zohomail.com; s=zohoarc; b=PzODYmlfVzpCM6+oBbrLyJ5bTQegXWskWmKWjgfWYxwlHgDaxqtqBmqeK6GTmd8nQYQbIL7HSPZFRnAVWRBs5kvQoUrk7U6RgzoSZ5oU1kHdgQg9RT4hnqYl0nzo8P76YvROMy9HFFG25b4D3Ngw12TOuBP0iCbNRUk4Fn8D0gA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606911347; 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; bh=AGSqDOb9roGPS6i8Mtp4tHJWizohuiDMSMpKTLMiCfk=; b=AMahQ0CaORUVu1X0F41uKGgTOpM26AS246s3M1LppVRrEZhjD+Y696405IvQKpJejRBNvAHb7R62NtfexwU6QhzqXGIHSkHkFNoI9giwgfnSImnNvqsawGsi+b0fKThMfTVXDVYuwJC7gBZkdmEk9NQWMa/fG0pQw9nLZpFsJPY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1606911347460225.69061296861912; Wed, 2 Dec 2020 04:15:47 -0800 (PST) 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-390-t07AiVQ5P4KGVz1QznTRiw-1; Wed, 02 Dec 2020 07:15:43 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 74B249A22F; Wed, 2 Dec 2020 12:15:38 +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 4DD395D705; Wed, 2 Dec 2020 12:15: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 19CA01809CA1; Wed, 2 Dec 2020 12:15:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B2CFXvF032029 for ; Wed, 2 Dec 2020 07:15:33 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4C782189A5; Wed, 2 Dec 2020 12:15:33 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D35618AA1 for ; Wed, 2 Dec 2020 12:15:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606911346; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=AGSqDOb9roGPS6i8Mtp4tHJWizohuiDMSMpKTLMiCfk=; b=QGdIIe8ww4IqSYpE7rqThG915ZLakZF2RCIa+4iE8AsAr4uKCubC1UD+7y0Jwzx2pA8GVy ZFRsK91Bk7+UMmbbsyP9W9dpOvCVxu/eYA1/wY4LYv/xFHvfhE8anA18CQLBrNvp8+ooXW oo92wEYB1CTgO7BkN/gaH/1pxAyzsyA= X-MC-Unique: t07AiVQ5P4KGVz1QznTRiw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 11/11] virDomainSnapshotAlignDisks: Use virDomainDiskByName Date: Wed, 2 Dec 2020 13:15:01 +0100 Message-Id: <1198b29a5c46a32a59cbff30b383b35f6986ce03.1606911231.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" We don't need the index that virDomainDiskIndexByName returns. Signed-off-by: Peter Krempa --- src/conf/snapshot_conf.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index 8ef9708c72..f896fd1cf2 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -663,17 +663,14 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr s= napdef, /* Double check requested disks. */ for (i =3D 0; i < snapdef->ndisks; i++) { virDomainSnapshotDiskDefPtr snapdisk =3D &snapdef->disks[i]; - int idx =3D virDomainDiskIndexByName(domdef, snapdisk->name, false= ); - virDomainDiskDefPtr domdisk =3D NULL; + virDomainDiskDefPtr domdisk =3D virDomainDiskByName(domdef, snapdi= sk->name, false); - if (idx < 0) { + if (!domdisk) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("no disk named '%s'"), snapdisk->name); return -1; } - domdisk =3D domdef->disks[idx]; - if (virHashHasEntry(map, domdisk->dst)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("disk '%s' specified twice"), --=20 2.28.0