From nobody Mon Feb 9 08:29:58 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 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=1573654962; cv=none; d=zoho.com; s=zohoarc; b=i514fPshx6c5TUulJGf2VP64mFlHhBxDdk/6L7Slw/0Ddi4J6MtgPcQeKhxbLZM1ZQzlF6T70EsYZ4ceOnttMAJv+AHsb+IafI7RYVeuJnjA0miWtnCGWb3Z/V1nJZFag38AkxIole66j0Ooqnw8XnYXbF0bv7ScMH/ceyo+ppI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573654962; h=Content-Type:Content-Transfer-Encoding:Cc: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=IyukIaKEB7RHiOwd3fVPxu/xr/s7+lo3F5xPt7X6lIQ=; b=OjKfeEv9Si9nFR7YEPNx4mEzf7RoDduf4Vdah03JfJ89Xwub1EcReR2XtCDlt8D6ESmjS5fU3J8rhFHg+9cNV4iNZEMq6Ggsf6k5/u5HbULRszm9rekD6K4aCmMKXGewfqggRRtTweGS0qd0hNL4Jgzn5Efdrh6VpVQwzro8DnY= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1573654962347198.91355766128663; Wed, 13 Nov 2019 06:22:42 -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-193-76N4wOdWM9CCvf2pPC3RkA-1; Wed, 13 Nov 2019 09:22:37 -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 CD18F8C06A2; Wed, 13 Nov 2019 14:22: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 9331C4DA24; Wed, 13 Nov 2019 14:22: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 3E1C11808855; Wed, 13 Nov 2019 14:22:30 +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 xADEMJhC011584 for ; Wed, 13 Nov 2019 09:22:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1D4841C0; Wed, 13 Nov 2019 14:22:19 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 74C383ACA; Wed, 13 Nov 2019 14:22:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573654961; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=IyukIaKEB7RHiOwd3fVPxu/xr/s7+lo3F5xPt7X6lIQ=; b=ZPHgDwLvnQ9r0Cn2RnTMuTMRNn7Bc1l7rEcO1d24s+877KwQSNIeUhhrd5HZqecEnjbwNA p6j84hO5OMoKaEE8fieHQjOgvFIIy/RMHqOcivS5GS2pm26bvvaIqH/J31pu2mIPf9ueXs 4viQ3YG74pPPobpMVVpUZiv8XAyTWwo= From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 13 Nov 2019 15:22:12 +0100 Message-Id: <9f9084d99ea5ed6840ec2972a230eb649307f426.1573654864.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 Cc: Pavel Mores Subject: [libvirt] [PATCH 2/2] qemu: snapshot: Fix inactive external snapshots when backing chain is present 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 X-MC-Unique: 76N4wOdWM9CCvf2pPC3RkA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The inactive external snapshot code replaced the file name in the virStorageSource but did not touch the backing files. This meant that after an inactive snapshot the backing chain recorded in the inactive XML (which is used with -blockdev) would be incorrect. Fix it by adding a new layer if there is an existing chain and replacing the virStorageSource struct fully when there is no chain. Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c969a3d463..c1b404adfa 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14613,19 +14613,32 @@ qemuDomainSnapshotCreateInactiveExternal(virQEMUD= riverPtr driver, /* update disk definitions */ for (i =3D 0; i < snapdef->ndisks; i++) { + g_autoptr(virStorageSource) newsrc =3D NULL; + snapdisk =3D &(snapdef->disks[i]); defdisk =3D vm->def->disks[snapdisk->idx]; - if (snapdisk->snapshot =3D=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNA= L) { - VIR_FREE(defdisk->src->path); - defdisk->src->path =3D g_strdup(snapdisk->src->path); - defdisk->src->format =3D snapdisk->src->format; + if (snapdisk->snapshot !=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) + continue; - if (virDomainSaveConfig(cfg->configDir, driver->caps, vm->def)= < 0) - goto cleanup; + if (!(newsrc =3D virStorageSourceCopy(snapdisk->src, false))) + goto cleanup; + + if (virStorageSourceInitChainElement(newsrc, defdisk->src, false) = < 0) + goto cleanup; + + if (virStorageSourceHasBacking(defdisk->src)) { + newsrc->backingStore =3D g_steal_pointer(&defdisk->src); + } else { + virObjectUnref(defdisk->src); } + + defdisk->src =3D g_steal_pointer(&newsrc); } + if (virDomainSaveConfig(cfg->configDir, driver->caps, vm->def) < 0) + goto cleanup; + ret =3D 0; cleanup: --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list