From nobody Sat Feb 7 03:37:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1607359386; cv=none; d=zohomail.com; s=zohoarc; b=kLCdnIUHkyODLs7S4aIWQmzYmpc3HJkKq0zdiZyJc4M3ybdLqUtROyLLXoPeIJDJRw08ml3eDCQ8nQjzsKuVSEaMTUWhkGjrg1ofbVh8EHaRWM91G5ohcSTjMn37RQoVqK95QVUa5Uzqq7DBja2EVlv8IlqzLBC0A11QmeBQUjc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607359386; 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=ucS5GzOUVeQeKgvsa8FpyEO2tvHJTnFdHBSrb2EGMG4=; b=Cjmz9jWZg9Gi+is6XFxKpEmkWQaz1GlssKSgeUmNhRZQlRNQhrfd/V6sflxWdnNzffjUVws4exnpaQDmj/5dDuo7EKZ5AfsJiA2zWuj9r9cU4JnJbvo82mly973kzIRYnuLERRn+ENaTJyugbBC11RXAyHhq2TpMMBLSSnAcDWo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1607359385596603.8815711051564; Mon, 7 Dec 2020 08:43:05 -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-249-a6mglfHNMSytGJ2kvQtEfA-1; Mon, 07 Dec 2020 11:34:51 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C797C107ACE8; Mon, 7 Dec 2020 16:34:44 +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 57D9A5D9E8; Mon, 7 Dec 2020 16:34:44 +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 1EFFC5002D; Mon, 7 Dec 2020 16:34:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B7GYNUu029079 for ; Mon, 7 Dec 2020 11:34:23 -0500 Received: by smtp.corp.redhat.com (Postfix) id 758375D6AD; Mon, 7 Dec 2020 16:34:23 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB5D15D6AB for ; Mon, 7 Dec 2020 16:34:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607358894; 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=ucS5GzOUVeQeKgvsa8FpyEO2tvHJTnFdHBSrb2EGMG4=; b=cJxugTdQTvG189EMGmegVN1u2JEtrTFb+5NiJWuRzw+JKumTdujJwraL5JFw4xsopM9C2Z SKqiNECSiNH0GSR+ScOh4WbWGGCn4ukb99JoBgc0zJOMQQg0kmUODbaLx3XQaNT5tQrIaa 1cpiNGkzZLJR3AwwSlwyZgupk9qhC/0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607359139; 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=ucS5GzOUVeQeKgvsa8FpyEO2tvHJTnFdHBSrb2EGMG4=; b=O2/6CzRROKJpvpWdMurTMpnUdy+B5rf6RcPlJyRwmqCaQBUmhup7pw88IwxILFKBYIpFlt LlUn+g0VYJgcsMpjF3Nnq6NKGHPDYzQ74db9Tpk979ZhzsY26V5XLPYTWvOkrLtMW+ENmo SHQ9KK1VflUrbehwzQAzgBiVc+JpTi0= X-MC-Unique: a6mglfHNMSytGJ2kvQtEfA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/8] qemuDomainDiskLookupByNodename: Simplify node name lookup Date: Mon, 7 Dec 2020 17:34:10 +0100 Message-Id: <9d7be0eef1511211058bb0c1311777f8e62afc74.1607358804.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.14 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) (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Use dummy variable to fill 'src' so that access to it doesn't need to be conditionalized and use temporary variable for 'disk' rather than dereferencing the array multiple times. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 2275c83aa8..f5d4e468ce 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -9911,24 +9911,18 @@ qemuDomainDiskLookupByNodename(virDomainDefPtr def, size_t i; virStorageSourcePtr tmp =3D NULL; - if (src) - *src =3D NULL; + if (!src) + src =3D &tmp; for (i =3D 0; i < def->ndisks; i++) { - if ((tmp =3D virStorageSourceFindByNodeName(def->disks[i]->src, no= dename))) { - if (src) - *src =3D tmp; + virDomainDiskDefPtr domdisk =3D def->disks[i]; - return def->disks[i]; - } - - if (def->disks[i]->mirror && - (tmp =3D virStorageSourceFindByNodeName(def->disks[i]->mirror,= nodename))) { - if (src) - *src =3D tmp; + if ((*src =3D virStorageSourceFindByNodeName(domdisk->src, nodenam= e))) + return domdisk; - return def->disks[i]; - } + if (domdisk->mirror && + (*src =3D virStorageSourceFindByNodeName(domdisk->mirror, node= name))) + return domdisk; } return NULL; --=20 2.28.0 From nobody Sat Feb 7 03:37:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1607358881; cv=none; d=zohomail.com; s=zohoarc; b=TQ127LJQ8XSxrNt9ek6CtikYJYaG4J/anX8Q7Prlz9W7j/1RCKmw47WtGYZhpdf0zXqaR9IeFKOAYbl62SjpIwENkGgwSAX0Hc/kA6sh2ykZ6n++IucQS4hhoKwd3DMn50pwCvOJxge0PxCfCuy77QGf7N5WA98FGctSsWxX33c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607358881; 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=WeNZKeQf4rHwM+/UxkZWUtM/Fmcp9wPNRjWhKYXw1Bs=; b=HCFQEHPp2t4nWDjfy2T4zKDJegk/TlwwpuS5eODhALnJk7CXMNjcDKHAavp+Wq12ODqG9JO1QN73LMl+jcB9egxRvxfHZii/OkmbomaeEkVXbTjVLmkaGF9tP3qBQie+amalzIBMXt+P4BbTfVSJfTY4RfXuV1nYUdXAPo0daBY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1607358880850836.6119444843407; Mon, 7 Dec 2020 08:34:40 -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-179-UnKPYI9gNVimw7AC6aW5Qw-1; Mon, 07 Dec 2020 11:34:36 -0500 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 C338ABBEFC; Mon, 7 Dec 2020 16:34:29 +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 39A8B5C1A3; Mon, 7 Dec 2020 16:34:29 +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 A11CE4A7C7; Mon, 7 Dec 2020 16:34:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B7GYOG3029089 for ; Mon, 7 Dec 2020 11:34:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id AC8835D6AD; Mon, 7 Dec 2020 16:34:24 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id E96495D6AB for ; Mon, 7 Dec 2020 16:34:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607358878; 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=WeNZKeQf4rHwM+/UxkZWUtM/Fmcp9wPNRjWhKYXw1Bs=; b=UQZt4cJtC6wRwYJl5FfGoZSOfJJVC88C5/pw8FbFJNNbDM2CNC3k8YnBWJVbYqZ4iYw2l+ hk2oYWpLUJg8AkglQpBOUpXOEgMq6m+Fj1nHrMs+Tl8KNuphvpqQToURYUdOlnj4nWJV43 ueHTRNZ9/kQCJZ+v976RG3fXrHnekKE= X-MC-Unique: UnKPYI9gNVimw7AC6aW5Qw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/8] qemuDomainGetStorageSourceByDevstr: Use virDomainDiskByTarget Date: Mon, 7 Dec 2020 17:34:11 +0100 Message-Id: <6c86571b2c4aabaa13132a288835c5e44c145b03.1607358804.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.16 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" The function replaces the open-coded block. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index f5d4e468ce..e56351333c 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -9954,7 +9954,6 @@ qemuDomainGetStorageSourceByDevstr(const char *devstr, virStorageSourcePtr src =3D NULL; g_autofree char *target =3D NULL; unsigned int idx; - size_t i; if (virStorageFileParseBackingStoreStr(devstr, &target, &idx) < 0) { virReportError(VIR_ERR_INVALID_ARG, @@ -9962,14 +9961,7 @@ qemuDomainGetStorageSourceByDevstr(const char *devst= r, return NULL; } - for (i =3D 0; i < def->ndisks; i++) { - if (STREQ(target, def->disks[i]->dst)) { - disk =3D def->disks[i]; - break; - } - } - - if (!disk) { + if (!(disk =3D virDomainDiskByTarget(def, target))) { virReportError(VIR_ERR_INVALID_ARG, _("failed to find disk '%s'"), target); return NULL; --=20 2.28.0 From nobody Sat Feb 7 03:37:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1607359148; cv=none; d=zohomail.com; s=zohoarc; b=XyDw5D9Vwjm5q38reBwCAU6pYhp6Vuy273qeIwrBHG2teBflKl4u68Slx49bDkeNobzv52rpIPum1aZy1wb9lKOQQNNcVUsWJt91B5MZNl05u/xrB2x6o4T9RygvOhK9ROQtqZP7VJ6cdtwTunTVa9MOfw3V4d0GbSHJ9TSwH34= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607359148; 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=AHiU0lNW6xwZRY+SxdAZ0bXD5IDxFPKlRa3FiIY7WcI=; b=CbvvrBUs3yriVvJgv1sE2cW8bROMh74GfZNDpla9nAF8V4M+DdhVUXdJ5q4UeixR8/Nhwu7osnbBo0cPSQhblbED4SI2jUhmX6VoD04JYnkOm9M2FCeKcInG7TyfiDtWKI+MadCo5pGfb4VjNopmeandvbw2C8GGmfl3flH485M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1607359148109712.4787876282408; Mon, 7 Dec 2020 08:39:08 -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-175-x83zrc1-PU-v8SVGiZ71JA-1; Mon, 07 Dec 2020 11:34:59 -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 BA444BBF10; Mon, 7 Dec 2020 16:34:47 +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 917F15D6D5; Mon, 7 Dec 2020 16:34:47 +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 517101809CA4; Mon, 7 Dec 2020 16:34:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B7GYPir029105 for ; Mon, 7 Dec 2020 11:34:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id CEDFC5D6AD; Mon, 7 Dec 2020 16:34:25 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2F9F15D6AB for ; Mon, 7 Dec 2020 16:34:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607358902; 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=AHiU0lNW6xwZRY+SxdAZ0bXD5IDxFPKlRa3FiIY7WcI=; b=P+3Lw9lXkdhLuB+3gSDDXK22PSL8DSC4z8ZXGv7FXW7VpVh4GU3tsADMRoPfz61lvdXhdu mcLQZ3YD56olZp0o8OXmNt53m5xVpRGz99qvdXWa2O29Nzun0DbMgbHw23ePZUZRJze4bT JLzLIioJVkV0fxIs/o+n3zCfchj1kuk= X-MC-Unique: x83zrc1-PU-v8SVGiZ71JA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/8] qemuDomainGetStorageSourceByDevstr: Avoid logged errors Date: Mon, 7 Dec 2020 17:34:12 +0100 Message-Id: <60a9250ef11012cf09800ade69abfb6fe5b0defb.1607358804.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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" 'virStorageFileChainLookup' reports an error when the lookup of the backing chain entry is unsuccessful. Since we possibly use it multiple times when looking up backing for 'disk->mirror' the function can report error which won't be actually reported. Replace the call to virStorageFileChainLookup by lookup in the chain by index. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e56351333c..44abe0ce93 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -9951,7 +9951,7 @@ qemuDomainGetStorageSourceByDevstr(const char *devstr, virDomainDefPtr def) { virDomainDiskDefPtr disk =3D NULL; - virStorageSourcePtr src =3D NULL; + virStorageSourcePtr n; g_autofree char *target =3D NULL; unsigned int idx; @@ -9970,13 +9970,20 @@ qemuDomainGetStorageSourceByDevstr(const char *devs= tr, if (idx =3D=3D 0) return disk->src; - if ((src =3D virStorageFileChainLookup(disk->src, NULL, NULL, idx, NUL= L))) - return src; + for (n =3D disk->src; virStorageSourceIsBacking(n); n =3D n->backingSt= ore) { + if (n->id =3D=3D idx) + return n; + } - if (disk->mirror && - (src =3D virStorageFileChainLookup(disk->mirror, NULL, NULL, idx, = NULL))) - return src; + if (disk->mirror) { + for (n =3D disk->mirror; virStorageSourceIsBacking(n); n =3D n->ba= ckingStore) { + if (n->id =3D=3D idx) + return n; + } + } + virReportError(VIR_ERR_INVALID_ARG, + _("failed to find disk '%s'"), devstr); return NULL; } --=20 2.28.0 From nobody Sat Feb 7 03:37:20 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=1607358898; cv=none; d=zohomail.com; s=zohoarc; b=gDR5M1B11aTGQIKiFELno2Xa5NEzJ0WUlGegFXNW9nASjooqcgYDRLXzCd5RT5WkAqWmyiz4OnVWQpAxmKWfILhtBSALgxPQsM5ES1tLGznoBJwjb+O++Zgq45vK9B/Fn76ND0sM8ROc5VHg4n4I6GBVswdNJ+SSNxGe3DyOYnk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607358898; 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=cNNCgGjm3/ccCEx+FxHePBl/hqZNPu7SPPIIvMvLipk=; b=RtQBI7K1+D6L1dgnv2NGzG7zpuSOoRR5A17olBuR2Y+myELQYkdc6Yr1Fcxy4YjpFFO+PYg141c2Ub9hliNpPm5u+eZx9kcJbFSsfvCU1RekklmdgaeyR8mg8swZK+KnCRmZ/WLE+gsGsZVo9krEkkh2DD0CGw3ekM31OSsAb94= 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 1607358897676682.371450484526; Mon, 7 Dec 2020 08:34:57 -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-540-AwdIYJTVO1i3yCGJyp2-Jg-1; Mon, 07 Dec 2020 11:34:51 -0500 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 7C58A107ACE3; Mon, 7 Dec 2020 16:34:44 +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 56F415C233; Mon, 7 Dec 2020 16:34:44 +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 1C4CF1809CA1; Mon, 7 Dec 2020 16:34:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B7GYQo7029112 for ; Mon, 7 Dec 2020 11:34:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id E968C5D6AD; Mon, 7 Dec 2020 16:34:26 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 433B75D6AB for ; Mon, 7 Dec 2020 16:34:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607358894; 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=cNNCgGjm3/ccCEx+FxHePBl/hqZNPu7SPPIIvMvLipk=; b=AUKr765XWdAtRiSCnM62Jhgwpwi5COgHgeYKx9pD3gHdnDz32sTiURczeVjRaZi3jV9DCP yjCqzxquFD5Wv2PA5JuQPenvXnAXMlMBopsHq9L4ZMAVQMaS+E14PeG0BoCO5MT4qdnkQ0 dSQeMge+B5CVyk574B2m5GREdNepsoE= X-MC-Unique: AwdIYJTVO1i3yCGJyp2-Jg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 4/8] backup: Move file format check from parser to qemu driver Date: Mon, 7 Dec 2020 17:34:13 +0100 Message-Id: <48431fb16327e8e7f746cc01db70782682edf68f.1607358804.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.16 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" It's a technical detail in qemu that QCOW2 is needed for a pull-mode backup. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/backup_conf.c | 5 ----- src/qemu/qemu_backup.c | 10 +++++++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c index ea812cc432..47e3bc1d60 100644 --- a/src/conf/backup_conf.c +++ b/src/conf/backup_conf.c @@ -204,11 +204,6 @@ virDomainBackupDiskDefParseXML(xmlNodePtr node, virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown disk backup driver '%s'"), driver); return -1; - } else if (!push && def->store->format !=3D VIR_STORAGE_FILE_QCOW2= ) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("pull mode requires qcow2 driver, not '%s'"), - driver); - return -1; } } diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index 09f7921ea7..b2340eb1cf 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -266,8 +266,16 @@ qemuBackupDiskPrepareDataOne(virDomainObjPtr vm, if (!qemuDomainDiskBlockJobIsSupported(vm, dd->domdisk)) return -1; - if (!dd->store->format) + if (dd->store->format =3D=3D VIR_STORAGE_FILE_NONE) { dd->store->format =3D VIR_STORAGE_FILE_QCOW2; + } else if (dd->store->format !=3D VIR_STORAGE_FILE_QCOW2) { + if (pull) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("pull mode backup for disk '%s' requires qcow= 2 driver"), + dd->backupdisk->name); + return -1; + } + } /* calculate backing store to use: * push mode: --=20 2.28.0 From nobody Sat Feb 7 03:37:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1607358881; cv=none; d=zohomail.com; s=zohoarc; b=Ge6ieoPVM2IWrG73BkrFRG2+v+4Rl5/oqSySem5hKrDFkncs1CYJCFVyQE6W2LipGgJ0ogBxqK0hxvb+y+zNMUhyy9EESoK8ywVZmgXHfvT44wkiGb61GlSgeDlZXRlV8YN9/x0a0wfzO5QEyeLgze6Uf0vwhBnE073E6zdf88g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607358881; 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=dLhJgDHpEIJlALO9C0m9uYDgjjpCppuln5fNtrguiws=; b=Oq6d0MIlwD9ksxvIbgSv+Rh4ScgT6sgJaaljNto3FgPO+han9k3sPkUU0Y1ORD1t3Yfwwhqgd87j4KXXFH2biJQ5E90xphZjbvWaDJZkcRJOJhXS/Z2+dIqZYYDGVc71oqGt8zInsqnjddTpnnvd0iH2vOU2FkcKjHbr+ABFtLw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1607358881562249.02024354377568; Mon, 7 Dec 2020 08:34:41 -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-491-AcAT9lJLNz2k0z-Eb79QYg-1; Mon, 07 Dec 2020 11:34:36 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 728DB107ACE3; Mon, 7 Dec 2020 16:34:30 +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 51EA060BE2; Mon, 7 Dec 2020 16:34:30 +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 A39271809C9F; Mon, 7 Dec 2020 16:34:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B7GYSjE029128 for ; Mon, 7 Dec 2020 11:34:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 18A3B5D6AD; Mon, 7 Dec 2020 16:34:28 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6826B5D6AB for ; Mon, 7 Dec 2020 16:34:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607358880; 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=dLhJgDHpEIJlALO9C0m9uYDgjjpCppuln5fNtrguiws=; b=TN/+xSGgGHr5K4WiUh6QqasIDbrlGM2hZcKVZzXL9+O+p8cXNyY51ACAknwTwXg3uLGmqS og/w9P5IPa9j66vTeQ/cmifzui9nKIh+BP0ZR+6vRbm5mvycjch7Knj3eBAYv+OHd7M0GY E9XbvCIPgrZOQo8FPGYCaX7T6yCMSXg= X-MC-Unique: AcAT9lJLNz2k0z-Eb79QYg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 5/8] virDomainBackupDiskDefParseXML: Use virDomainStorageSourceParseBase Date: Mon, 7 Dec 2020 17:34:14 +0100 Message-Id: <7d4d64f5633c470e6a8ed0f6cc0fde5b7b5cebb9.1607358804.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.12 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" Don't duplicate code to parse the virStorageSource basics. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/backup_conf.c | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c index 47e3bc1d60..11d419ce2b 100644 --- a/src/conf/backup_conf.c +++ b/src/conf/backup_conf.c @@ -104,7 +104,7 @@ virDomainBackupDiskDefParseXML(xmlNodePtr node, { VIR_XPATH_NODE_AUTORESTORE(ctxt) g_autofree char *type =3D NULL; - g_autofree char *driver =3D NULL; + g_autofree char *format =3D NULL; g_autofree char *backup =3D NULL; g_autofree char *state =3D NULL; g_autofree char *backupmode =3D NULL; @@ -169,23 +169,17 @@ virDomainBackupDiskDefParseXML(xmlNodePtr node, def->state =3D tmp; } - def->store =3D virStorageSourceNew(); + type =3D virXMLPropString(node, "type"); + format =3D virXPathString("string(./driver/@type)", ctxt); - if ((type =3D virXMLPropString(node, "type"))) { - if ((def->store->type =3D virStorageTypeFromString(type)) <=3D 0) { - virReportError(VIR_ERR_XML_ERROR, - _("unknown disk backup type '%s'"), type); - return -1; - } + if (!(def->store =3D virDomainStorageSourceParseBase(type, format, NUL= L))) + return -1; - if (def->store->type !=3D VIR_STORAGE_TYPE_FILE && - def->store->type !=3D VIR_STORAGE_TYPE_BLOCK) { - virReportError(VIR_ERR_XML_ERROR, - _("unsupported disk backup type '%s'"), type); - return -1; - } - } else { - def->store->type =3D VIR_STORAGE_TYPE_FILE; + if (def->store->type !=3D VIR_STORAGE_TYPE_FILE && + def->store->type !=3D VIR_STORAGE_TYPE_BLOCK) { + virReportError(VIR_ERR_XML_ERROR, + _("unsupported disk backup type '%s'"), type); + return -1; } if (push) @@ -198,15 +192,6 @@ virDomainBackupDiskDefParseXML(xmlNodePtr node, storageSourceParseFlags, xmlopt) < 0) return -1; - if ((driver =3D virXPathString("string(./driver/@type)", ctxt))) { - def->store->format =3D virStorageFileFormatTypeFromString(driver); - if (def->store->format <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown disk backup driver '%s'"), driver); - return -1; - } - } - return 0; } --=20 2.28.0 From nobody Sat Feb 7 03:37:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1607358898; cv=none; d=zohomail.com; s=zohoarc; b=EZtuIzKSMaTIlkAQ12baAJvb4VfNXq+Tdm1xLVuSFbDr7D+8rlLJh+P6kD7ACW6nkYvAGoyAoDYz7DerzNdzizWwey/aN9Ciz3UvjRO879Mjawnno2fgerSdtGjOtqdL6mFGPa4gCKOxGslGGezJ7Z7aiH7ly952VqSi+kN/08M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607358898; 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=AvTEjAdaJZfvW7fsultgwf/UnJGiWoTHy0MonXoeyas=; b=PwNBVn+26xc0ZSeTntPhwXZ68xnFSV4n9nQmlizH4/lknEdiOqa01MEgH8hxrIJlfN/LP7Y71ZF8U3lAKCwv8oGtza4U3PxzRsAuMKu6Md+00yeCt4tJMlT6DgAyqjQ0VTr3Nxv9gLh7rGri05xQGdGGPFPBWJ2v8P8UyzdzdcA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1607358898319393.2525483269811; Mon, 7 Dec 2020 08:34:58 -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-179-st5pkLY_PrSXq965QFcTjQ-1; Mon, 07 Dec 2020 11:34:54 -0500 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 08ECD8144FA; Mon, 7 Dec 2020 16:34:48 +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 D40EB2BCDA; Mon, 7 Dec 2020 16:34:47 +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 95A4650033; Mon, 7 Dec 2020 16:34:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B7GYTNO029136 for ; Mon, 7 Dec 2020 11:34:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3B2AD5D6AD; Mon, 7 Dec 2020 16:34:29 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7EC565D6AB for ; Mon, 7 Dec 2020 16:34:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607358896; 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=AvTEjAdaJZfvW7fsultgwf/UnJGiWoTHy0MonXoeyas=; b=WLB+8AO2nvLIsEYb154/G4fHkhDe1R2+tik13U8BAgDpslV5CSP76tEM1VzNIhw/iO6H7C 2PRdjQjoafxgqTDDvP39xEvBWo0IodxvlHYpESGa25imJgwWYnSNJK6NRYjDuD3FNm5lNT QwK5/zPlyOpQqSiUKeABfDHBCTHUTfc= X-MC-Unique: st5pkLY_PrSXq965QFcTjQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 6/8] qemuDomainDiskLookupByNodename: Lookup also backup 'store' nodenames Date: Mon, 7 Dec 2020 17:34:15 +0100 Message-Id: <4d7f95213124cb9b4f00ade4618bb461073ed199.1607358804.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.84 on 10.5.11.23 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" Nodename may be asociated to a disk backup job, add support to looking up in that chain too. This is specifically useful for the BLOCK_WRITE_THRESHOLD event which can be registered for any nodename. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 12 ++++++++++++ src/qemu/qemu_domain.h | 1 + src/qemu/qemu_process.c | 7 +++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 44abe0ce93..7232b6131f 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -9896,6 +9896,7 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev, /** * qemuDomainDiskLookupByNodename: * @def: domain definition to look for the disk + * @backupdef: definition of the backup job of the domain (optional) * @nodename: block backend node name to find * @src: filled with the specific backing store element if provided * @@ -9905,6 +9906,7 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev, */ virDomainDiskDefPtr qemuDomainDiskLookupByNodename(virDomainDefPtr def, + virDomainBackupDefPtr backupdef, const char *nodename, virStorageSourcePtr *src) { @@ -9925,6 +9927,16 @@ qemuDomainDiskLookupByNodename(virDomainDefPtr def, return domdisk; } + if (backupdef) { + for (i =3D 0; i < backupdef->ndisks; i++) { + virDomainBackupDiskDefPtr backupdisk =3D backupdef->disks + i; + + if (backupdisk->store && + (*src =3D virStorageSourceFindByNodeName(backupdisk->store= , nodename))) + return virDomainDiskByTarget(def, backupdisk->name); + } + } + return NULL; } diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 9e870ff1e2..32f3586882 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -912,6 +912,7 @@ int qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev, int *perms); virDomainDiskDefPtr qemuDomainDiskLookupByNodename(virDomainDefPtr def, + virDomainBackupDefPtr b= ackupdef, const char *nodename, virStorageSourcePtr *sr= c); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 9d83825190..db77d8f1de 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -879,7 +879,7 @@ qemuProcessHandleIOError(qemuMonitorPtr mon G_GNUC_UNUS= ED, if (diskAlias) disk =3D qemuProcessFindDomainDiskByAliasOrQOM(vm, diskAlias, NULL= ); else if (nodename) - disk =3D qemuDomainDiskLookupByNodename(vm->def, nodename, NULL); + disk =3D qemuDomainDiskLookupByNodename(vm->def, NULL, nodename, N= ULL); else disk =3D NULL; @@ -1483,6 +1483,7 @@ qemuProcessHandleBlockThreshold(qemuMonitorPtr mon G_= GNUC_UNUSED, unsigned long long excess, void *opaque) { + qemuDomainObjPrivatePtr priv; virQEMUDriverPtr driver =3D opaque; virObjectEventPtr eventSource =3D NULL; virObjectEventPtr eventDevice =3D NULL; @@ -1492,11 +1493,13 @@ qemuProcessHandleBlockThreshold(qemuMonitorPtr mon = G_GNUC_UNUSED, virObjectLock(vm); + priv =3D vm->privateData; + VIR_DEBUG("BLOCK_WRITE_THRESHOLD event for block node '%s' in domain %= p %s:" "threshold '%llu' exceeded by '%llu'", nodename, vm, vm->def->name, threshold, excess); - if ((disk =3D qemuDomainDiskLookupByNodename(vm->def, nodename, &src))= ) { + if ((disk =3D qemuDomainDiskLookupByNodename(vm->def, priv->backup, no= dename, &src))) { if (virStorageSourceIsLocalStorage(src)) path =3D src->path; --=20 2.28.0 From nobody Sat Feb 7 03:37:20 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=1607358978; cv=none; d=zohomail.com; s=zohoarc; b=lHKQAUcK9UL5CPiTfNesVn/Jsj4ew7Xi8hlCQWIELMrnaOz6Gj2hKQ3hI3vEOVYR4+koHFfmiWwi9oqzWs7HJ1Ow6BO4FoodEq58/wUbODsTjUtqpEPejqpgbBVXjpy06tT229klM/X0GvCd106DcakhL0+VX4+20ZnkwuyiwLE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607358978; 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=FDZfiJLrRCPPWWT5LOhDWCjQmmU3m5KsGxvKKrOopa4=; b=Ua4d7vtpkqUYoWOJtEhOXzjY1I8KsieD5ColRhbJ4CUJQm9cZeKASwxNobP0CaMBlhTuipsnO5qYEzC2VJHvFsm1+Hx+hYHZpABEgdQ4Uo9dgAOjkLzw/3s95kAbkKOBrTvD4sESDt+Flm3ukcXffGDotegzHcfQtg9atlqfzwk= 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 1607358978479339.3616906238352; Mon, 7 Dec 2020 08:36:18 -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-266-ybr0U4jHMX2Ds9mcO4VlNg-1; Mon, 07 Dec 2020 11:34:51 -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 7B62E1005D62; Mon, 7 Dec 2020 16:34:44 +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 58F435D6AD; Mon, 7 Dec 2020 16:34:44 +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 1E99C5002C; Mon, 7 Dec 2020 16:34:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B7GYU5F029148 for ; Mon, 7 Dec 2020 11:34:30 -0500 Received: by smtp.corp.redhat.com (Postfix) id 584885D6B1; Mon, 7 Dec 2020 16:34:30 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id B4C325D6AB for ; Mon, 7 Dec 2020 16:34:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607358975; 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=FDZfiJLrRCPPWWT5LOhDWCjQmmU3m5KsGxvKKrOopa4=; b=fXk2q4yzy9hSbqnOqQnNVoRi/z0lLP2CVCkjwLmLz/+aLxpfkp/4CNmN77u48iOfYNLBRu ZRi9ShvR20xCw5xtoBo5NqQylJ5ye21615RXcInXRdFNwrmoTCdSgcJy3xN8tmIyHOFWJ6 6kCOVb51zxdPttxwjSsG6Yl0hgDkIIY= X-MC-Unique: ybr0U4jHMX2Ds9mcO4VlNg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 7/8] qemuDomainGetStorageSourceByDevstr: Lookup also backup 'store' nodenames Date: Mon, 7 Dec 2020 17:34:16 +0100 Message-Id: <46a78c5d8bc3fb5ec766bc2d7f3d94fa11bfea36.1607358804.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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" Nodename may be asociated to a disk backup job, add support to looking up in that chain too. This is specifically useful for the BLOCK_WRITE_THRESHOLD event which can be registered for any nodename. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 19 ++++++++++++++++++- src/qemu/qemu_domain.h | 3 ++- src/qemu/qemu_driver.c | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 7232b6131f..58119bee1a 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -9960,7 +9960,8 @@ qemuDomainDiskBackingStoreGetName(virDomainDiskDefPtr= disk, virStorageSourcePtr qemuDomainGetStorageSourceByDevstr(const char *devstr, - virDomainDefPtr def) + virDomainDefPtr def, + virDomainBackupDefPtr backupdef) { virDomainDiskDefPtr disk =3D NULL; virStorageSourcePtr n; @@ -9994,6 +9995,22 @@ qemuDomainGetStorageSourceByDevstr(const char *devst= r, } } + if (backupdef) { + size_t i; + + for (i =3D 0; i < backupdef->ndisks; i++) { + virDomainBackupDiskDefPtr backupdisk =3D backupdef->disks + i; + + if (STRNEQ(target, backupdisk->name)) + continue; + + for (n =3D backupdisk->store; virStorageSourceIsBacking(n); n = =3D n->backingStore) { + if (n->id =3D=3D idx) + return n; + } + } + } + virReportError(VIR_ERR_INVALID_ARG, _("failed to find disk '%s'"), devstr); return NULL; diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 32f3586882..154339ef8f 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -920,7 +920,8 @@ char *qemuDomainDiskBackingStoreGetName(virDomainDiskDe= fPtr disk, unsigned int idx); virStorageSourcePtr qemuDomainGetStorageSourceByDevstr(const char *devstr, - virDomainDefPtr def= ); + virDomainDefPtr def, + virDomainBackupDefP= tr backupdef); int qemuDomainUpdateCPU(virDomainObjPtr vm, diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 4fd70ed300..f8eb575628 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19575,7 +19575,7 @@ qemuDomainSetBlockThreshold(virDomainPtr dom, goto endjob; } - if (!(src =3D qemuDomainGetStorageSourceByDevstr(dev, vm->def))) + if (!(src =3D qemuDomainGetStorageSourceByDevstr(dev, vm->def, priv->b= ackup))) goto endjob; if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && --=20 2.28.0 From nobody Sat Feb 7 03:37:20 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=1607358901; cv=none; d=zohomail.com; s=zohoarc; b=a0oZfjrJuLZ2JIIjk5iuUyxMNnXoC2pAWTz4k4cbwZaOerHi8AZvHLgzlkuLn9fTBssKnofZsf+ilBfiYgqUzDK9GUq3n0S3P1Sz0iBht3mV2OoFEFs65a0nRW9L3+pnTn9sC89DH++vWbieRRmKOsoPK+U22KPDFg9/bV/DTy8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607358901; 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=M5MLGH6+cR1D4aqVYWiUTBr1GbBwvtEpygQaYd3Zqyk=; b=ZPeZNXeVlJU7DDjjWJMo6iT00vV5L/Em1+3FgoxUvXIslRWiMCX3ewWAkcXKE27UBRwiPHNW2VpKU9ADLxxXmFEa042ikCuczJi2GNbAltUzSfzzy3cLHqFC7slCmp2jKw+8EgrvGEG/vGaKpXbj10c5dOe+C8i6GcjWPoW77CI= 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 1607358901779741.9178796855665; Mon, 7 Dec 2020 08:35:01 -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-80-ZC7HBpsuNk2X9-FvNCSm9w-1; Mon, 07 Dec 2020 11:34:57 -0500 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 387B58581A1; Mon, 7 Dec 2020 16:34:51 +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 0CC6E5C230; Mon, 7 Dec 2020 16:34:51 +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 C325E5002D; Mon, 7 Dec 2020 16:34:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B7GYVTl029161 for ; Mon, 7 Dec 2020 11:34:31 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6C7BD5D6AD; Mon, 7 Dec 2020 16:34:31 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD3D75D6AB for ; Mon, 7 Dec 2020 16:34:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607358899; 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=M5MLGH6+cR1D4aqVYWiUTBr1GbBwvtEpygQaYd3Zqyk=; b=cX4oEW1/MW34YUzcrSuROUEft3+/csd4lpKd64Z33EwmTxuDyKYP5ecRPklWmdlB0dn3uN 7Ftc6kcVIjXT2toGXbBeQQQRRy7J6bLga8r5tlMie4s5y+mzcPYfLQdTLhaSm4bzkhPL/e bfjQtpjH06i82a8UKi/TXr7wsrlAum4= X-MC-Unique: ZC7HBpsuNk2X9-FvNCSm9w-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 8/8] conf: backup: Format index of 'store' Date: Mon, 7 Dec 2020 17:34:17 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.16 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" Similarly to other disk-related stuff, the index is useful when you want to refer to the image in APIs such as virDomainSetBlockThreshold. For internal use we also need to parse it inside of the status XML. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- docs/formatbackup.rst | 4 ++++ src/conf/backup_conf.c | 8 +++++++- tests/qemustatusxml2xmldata/backup-pull-in.xml | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/formatbackup.rst b/docs/formatbackup.rst index 1b9e6ebb22..c378ad9d9a 100644 --- a/docs/formatbackup.rst +++ b/docs/formatbackup.rst @@ -95,6 +95,10 @@ were supplied). The following child elements and attribu= tes are supported: Similar to a disk declaration for a domain, the choice of type co= ntrols what additional sub-elements are needed to describe the destinati= on. + ``index`` + Output only. The value can be used to refer to the scratch or out= put + file of the backup in APIs such as ``virDomainSetBlockThreshold``. + ``target`` Valid only for push mode backups, this is the primary sub-element= that describes the file name of the backup destination, similar to the diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c index 11d419ce2b..90ffcc51d1 100644 --- a/src/conf/backup_conf.c +++ b/src/conf/backup_conf.c @@ -105,6 +105,7 @@ virDomainBackupDiskDefParseXML(xmlNodePtr node, VIR_XPATH_NODE_AUTORESTORE(ctxt) g_autofree char *type =3D NULL; g_autofree char *format =3D NULL; + g_autofree char *idx =3D NULL; g_autofree char *backup =3D NULL; g_autofree char *state =3D NULL; g_autofree char *backupmode =3D NULL; @@ -171,8 +172,10 @@ virDomainBackupDiskDefParseXML(xmlNodePtr node, type =3D virXMLPropString(node, "type"); format =3D virXPathString("string(./driver/@type)", ctxt); + if (internal) + idx =3D virXMLPropString(node, "index"); - if (!(def->store =3D virDomainStorageSourceParseBase(type, format, NUL= L))) + if (!(def->store =3D virDomainStorageSourceParseBase(type, format, idx= ))) return -1; if (def->store->type !=3D VIR_STORAGE_TYPE_FILE && @@ -386,6 +389,9 @@ virDomainBackupDiskDefFormat(virBufferPtr buf, virBufferEscapeString(&attrBuf, " exportname=3D'%s'", disk->export= name); virBufferEscapeString(&attrBuf, " exportbitmap=3D'%s'", disk->expo= rtbitmap); + if (disk->store->id !=3D 0) + virBufferAsprintf(&attrBuf, " index=3D'%u'", disk->store->id); + if (disk->store->format > 0) virBufferEscapeString(&childBuf, "\n", virStorageFileFormatTypeToString(disk->s= tore->format)); diff --git a/tests/qemustatusxml2xmldata/backup-pull-in.xml b/tests/qemusta= tusxml2xmldata/backup-pull-in.xml index faaed67e38..bb322f94d3 100644 --- a/tests/qemustatusxml2xmldata/backup-pull-in.xml +++ b/tests/qemustatusxml2xmldata/backup-pull-in.xml @@ -256,7 +256,7 @@ 12345 - + --=20 2.28.0