From nobody Fri Dec 19 17:32:55 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1678722176; cv=none; d=zohomail.com; s=zohoarc; b=V3/a/fIi5OLJY+3q0VfDxlSVDhHYcUJfhmDZVDsxX1moB0x6eVuIwZd1iFk+xl9XgYPntV/yLxsWZ/9gjTKENzELSu/juWubKU7jNgWgUbiMwLCArs4578oHpOuiXD5NAbiGNSiwew5rFm6Avjgn0vsdlCfOsj57hHv3GSVDgQE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678722176; 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=Zaag7pqnP0Gqk8Fw37MMe9Ey9cu17cy0AfX9XCdCc30=; b=K2mJr86CklPyKYAp15IxF1D99OJABjNlCdfGk1Vehag7sQrKcSHDQ0Do6FLD6ABl3VurXmSgYMgYnPmBzjGvMJF9vEXyn3qYOBMbUhaVvKUfgQy3RBxn5t9CxiIKUY3D52nIfAsiUGGtaqeggWTsUUfgLZgaVziJJLWNl2oYl+E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 167872217631221.037832339688862; Mon, 13 Mar 2023 08:42:56 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-458-Dl8IiDsHMdOoM0Lxteb2yw-1; Mon, 13 Mar 2023 11:42:50 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3DC9C2810C2D; Mon, 13 Mar 2023 15:42:31 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2978C40C6E69; Mon, 13 Mar 2023 15:42:31 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 7DC6119465BA; Mon, 13 Mar 2023 15:42:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6301E194658F for ; Mon, 13 Mar 2023 15:42:29 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 563462166B2A; Mon, 13 Mar 2023 15:42:29 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE3982166B29 for ; Mon, 13 Mar 2023 15:42:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678722175; 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=Zaag7pqnP0Gqk8Fw37MMe9Ey9cu17cy0AfX9XCdCc30=; b=fjPl/Ig9uuMJ2PEk6q4XUxdfvRnSoom2bsLGJXVE22uTADyNWoSe09k3tGlqqWF3zi8p5I 0tFMQvvU9uuDqYPC47TAUAO3Y8OnDPF0GzUbQzPP62JKg7W0Z6gPuPco36iZRT5kDc58PB sQoFvrEa1l5U6qTJi5GXaleHy40jbiQ= X-MC-Unique: Dl8IiDsHMdOoM0Lxteb2yw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 03/20] snapshot_conf: use alternate domain definition in virDomainSnapshotDefAssignExternalNames Date: Mon, 13 Mar 2023 16:42:04 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1678722176980100002 Content-Type: text/plain; charset="utf-8"; x-default="true" Commit introduced new argument for virDomainSnapshotAlignDisks() that allows passing alternate domain definition in case the snapshot parent.dom is NULL. In case of redefining snapshot it will not hit the part of code that unconditionally uses parent.dom as there will not be need to generate default external file names. It should be still fixed to make it safe. Future external snapshot revert code will use this to generate default file names and in this case it would crash. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/conf/snapshot_conf.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index 1329292293..da1c694cb9 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -489,12 +489,14 @@ virDomainSnapshotRedefineValidate(virDomainSnapshotDe= f *def, /** * virDomainSnapshotDefAssignExternalNames: * @def: snapshot def object + * @domdef: domain def object * * Generate default external file names for snapshot targets. Returns 0 on * success, -1 on error. */ static int -virDomainSnapshotDefAssignExternalNames(virDomainSnapshotDef *def) +virDomainSnapshotDefAssignExternalNames(virDomainSnapshotDef *def, + virDomainDef *domdef) { const char *origpath; char *tmppath; @@ -518,7 +520,7 @@ virDomainSnapshotDefAssignExternalNames(virDomainSnapsh= otDef *def) return -1; } =20 - if (!(origpath =3D virDomainDiskGetSource(def->parent.dom->disks[i= ]))) { + if (!(origpath =3D virDomainDiskGetSource(domdef->disks[i]))) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("cannot generate external snapshot name " "for disk '%s' without source"), @@ -711,7 +713,7 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDef *snapd= ef, } =20 /* Generate default external file names for external snapshot location= s */ - if (virDomainSnapshotDefAssignExternalNames(snapdef) < 0) + if (virDomainSnapshotDefAssignExternalNames(snapdef, domdef) < 0) return -1; =20 return 0; --=20 2.39.2