From nobody Sun Feb 8 19:27:46 2026 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=1687878781; cv=none; d=zohomail.com; s=zohoarc; b=VNmpiEk/S5LeyhlQOyv7rCzn4y+aSqzxwqfgF2xaBSp4G7/goukWsfnaUExbkL53O1IyjvGLy2ZDrkuxtt784AzqDLXHE7rYCPEo4yRsx1pmzYDMyxZFpWTnWz84VXrzhnW9YooHTNRGr0Tt1ASopr8weWodeAmCcCdFVDsyn8Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687878781; 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=qam5xeFztWJUQbV2Ep9yhW3YXlrPa2qmzvVIUxMwFwo=; b=egsiDCjgaP4gUHn8zNZM8iC4H+lpcL2H62F49DiUuQgF5x0C/Xbdotpcxa3vpfUMt/7K7kqfsUCw6FL+O4XW0kKPBOmhJ2b79l1u9ifg1326CQB6RaRMHzZEX/yddgSKYfJwJAPyGNyMxEkmqCL/61yoe8u0xODMf8yx4HZEg98= 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 1687878781325356.68797562342206; Tue, 27 Jun 2023 08:13:01 -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-534-veC25tJrNFmuhQY1PqfcyA-1; Tue, 27 Jun 2023 11:12:17 -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 03E7E38470AB; Tue, 27 Jun 2023 15:07:33 +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 0E35D40C6F5A; Tue, 27 Jun 2023 15:07:32 +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 E8B2E1946588; Tue, 27 Jun 2023 15:07:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B125D194658C for ; Tue, 27 Jun 2023 15:07:30 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 9016C4229B6; Tue, 27 Jun 2023 15:07:30 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.45.225.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 32D2840140F for ; Tue, 27 Jun 2023 15:07:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687878780; 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=qam5xeFztWJUQbV2Ep9yhW3YXlrPa2qmzvVIUxMwFwo=; b=LvcN6rYlSoCatsEUQUCco+1IP4Aw7lgMHv1tw0SAT59LN/sDvv9Uv8U1vY1D4Nm4QUr4fC skAebI2y6hYysv0nTqP7/9NEXUc5IAK1xZmqcU7hC0TEPaXzlspuNyfp3fJlImhYXLiRUI P21YAQgRGiAtbSMfxJpSYmIqlhm64h8= X-MC-Unique: veC25tJrNFmuhQY1PqfcyA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH v2 03/24] snapshot_conf: use alternate domain definition in virDomainSnapshotDefAssignExternalNames Date: Tue, 27 Jun 2023 17:07:06 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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: 1687878782082100001 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 cc59bddbc8..ac5aba1753 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -486,12 +486,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; @@ -514,7 +516,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 d= isk '%1$s' without source"), disk->name); @@ -702,7 +704,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.41.0