From nobody Sun May 19 03:38:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.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 205.139.110.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=1573654951; cv=none; d=zoho.com; s=zohoarc; b=ZpyDLaMYIXDw0qU6jzJSc1C47+KsKPvYPwd10YS2JgkO8dHA8pg9f6fyHPLPtD+3aN8rzavWQ70L4yLr2mjrThRFBBW0bP43qZwy7633amuyyiv/OtNrUzP7jhU8+SBH5EphVPBWCUMBJXqEHxc4YhZRxYJ0oaSbCmZ1rQRPRpU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573654951; 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=O+3sacVsbUIARwfJtmYx5lo/yixMBd2m0yRjvZjGIZg=; b=OtRjf3cw2nLK2o7M0ix02eMshXuTJ+0DCEi3xeioNP+/9MqOg8tWyI9aXB96rfTFOW5BF5fWHsVuvXWhKRZNrZjggDtdl/KhghF2A8yGCXVjNx33Bu2IuV1bX+NWxy/iXkhuYUH0VqhDRoiJQnypn74PUzlPunxIDfkLziyI9mQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.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 [205.139.110.120]) by mx.zohomail.com with SMTPS id 15736549512691023.8523448036738; Wed, 13 Nov 2019 06:22:31 -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-350-l8sR5HAhPvy3WK27b2FTFg-1; Wed, 13 Nov 2019 09:22:27 -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 45B5B10753FC; Wed, 13 Nov 2019 14:22:22 +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 D44AB4DA0A; Wed, 13 Nov 2019 14:22:21 +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 6348B4E562; Wed, 13 Nov 2019 14:22:21 +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 xADEMIFw011575 for ; Wed, 13 Nov 2019 09:22:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2A01863BBB; Wed, 13 Nov 2019 14:22:18 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 80DBB6365C; Wed, 13 Nov 2019 14:22:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573654950; 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=O+3sacVsbUIARwfJtmYx5lo/yixMBd2m0yRjvZjGIZg=; b=CG+BT3I6fq2acgp9aMPpOvLGGv2YPR/GRY1qwq5SU7uKf20NhAWDSbCrlWJ8m1SZF7u5va nAzM6uE7B8ijbM14ahzKHIsC+TeRoZs/fH2cO+NyPPvlJa77SkemdXmGSezoagqt/JYHSi VyZQWLp1zEHKGHzPHg3Wf1jm6NmvjjQ= From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 13 Nov 2019 15:22:11 +0100 Message-Id: <343406f16b60749458a17161818fb35286cadc75.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 1/2] qemu: blockjob: Transfer 'readonly' state of images after active layer block commit 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: l8sR5HAhPvy3WK27b2FTFg-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" When commiting a different image becomes the disk source. Since we store the readonly flag per-image we must update it to the same state the original image had. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_blockjob.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index 2dddb1e408..5c294f8024 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -1106,6 +1106,7 @@ qemuBlockJobProcessEventCompletedActiveCommit(virQEMU= DriverPtr driver, cfgbase =3D cfgbaseparent->backingStore; cfgbaseparent->backingStore =3D NULL; cfgdisk->src =3D cfgbase; + cfgdisk->src->readonly =3D cfgtop->readonly; virObjectUnref(cfgtop); } @@ -1115,6 +1116,7 @@ qemuBlockJobProcessEventCompletedActiveCommit(virQEMU= DriverPtr driver, baseparent->backingStore =3D NULL; job->disk->src =3D job->data.commit.base; + job->disk->src->readonly =3D job->data.commit.top->readonly; qemuBlockJobEventProcessConcludedRemoveChain(driver, vm, asyncJob, job= ->data.commit.top); virObjectUnref(job->data.commit.top); --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 19 03:38:08 2024 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 Reviewed-by: J=C3=A1n Tomko --- 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