From nobody Tue May 7 08:44:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 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=1574330465; cv=none; d=zoho.com; s=zohoarc; b=TfuyJxtp1+0VUeu9NkWX60qxuNcx0+RjDUtZ5yycuqzZIN1z2u17SDPJ9p9zH6emy/zzayjUbChG3ApTvgEqQQuxaaBAL52qSSHmfcbma/+kLQLbe9c6xjQ/cYYL2W9vRZ8iPOnSQ/e9Am21louCMKk+EBGkMkEc5eItn37nM4U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574330465; 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=GqLmR2ZyfbCmcs/2a4KQMfeYyprPP8cBj65YdmCHdNw=; b=AUIo2UWBlUL4lISkz4vhsgOBVcqjlqWisgzSo2K98V/GgFkDx59WaoGNFeXJIiklNQaA12qHABIB/fwJlF4OOt+TileVLgIi9FIw1ckE7Kn2IS0udLz2ZyHwDZYNlM4e9hkz/U4rVe3AtVsu33JSn3ifGpZYvMbn1J3cECw7tP4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 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-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 15743304656451023.1692789140121; Thu, 21 Nov 2019 02:01: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-294-kZZlruDFO5qPPZS79-rFUQ-1; Thu, 21 Nov 2019 05:00:59 -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 725B98026B2; Thu, 21 Nov 2019 10:00:54 +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 227BB6931A; Thu, 21 Nov 2019 10:00:54 +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 0A9134BB5C; Thu, 21 Nov 2019 10:00:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xALA0oVd003000 for ; Thu, 21 Nov 2019 05:00:50 -0500 Received: by smtp.corp.redhat.com (Postfix) id 69F5228DFF; Thu, 21 Nov 2019 10:00:50 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.43.2.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD36044F8E; Thu, 21 Nov 2019 10:00:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574330462; 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=GqLmR2ZyfbCmcs/2a4KQMfeYyprPP8cBj65YdmCHdNw=; b=ESnf05e4ElU54WQKms+3wH2IDkDV2+/yJtESsZiY+bM9HbX4PmkGarfx51jAJGTBTNHQbg Nh6TFwR0fuRj9ts8TmzN9qXtISjyE94MuIgeDYaUrvza5Xxzg4K3mYCAs+tLPb+KztZLna 5iaOCDfgN3tM/mi8HXssVzUcu4U52ws= From: Pavel Mores To: libvir-list@redhat.com Date: Thu, 21 Nov 2019 11:00:44 +0100 Message-Id: <20191121100047.17747-2-pmores@redhat.com> In-Reply-To: <20191121100047.17747-1-pmores@redhat.com> References: <20191121100047.17747-1-pmores@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Pavel Mores Subject: [libvirt] [PATCH v3 1/4] qemu: block: propagate the delete flag to where it can actually be used 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: kZZlruDFO5qPPZS79-rFUQ-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" Propagate the delete flag from qemuDomainBlockCommit() (which was just ignoring it until now) to qemuBlockJobDiskNewCommit() where it can be stored in the qemuBlockJobCommitData structure which holds information necessary to finish the job asynchronously. In the actual qemuBlockJobDiskNewCommit() in this commit, we temporarily pass a literal 'false' to preserve the current behaviour until the whole implementation of the feature is in place. Signed-off-by: Pavel Mores --- src/qemu/qemu_blockjob.c | 4 +++- src/qemu/qemu_blockjob.h | 4 +++- src/qemu/qemu_driver.c | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index 5c294f8024..7d94a6ce38 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -250,7 +250,8 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm, virDomainDiskDefPtr disk, virStorageSourcePtr topparent, virStorageSourcePtr top, - virStorageSourcePtr base) + virStorageSourcePtr base, + bool delete_imgs) { qemuDomainObjPrivatePtr priv =3D vm->privateData; g_autoptr(qemuBlockJobData) job =3D NULL; @@ -273,6 +274,7 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm, job->data.commit.topparent =3D topparent; job->data.commit.top =3D top; job->data.commit.base =3D base; + job->data.commit.deleteCommittedImages =3D delete_imgs; =20 if (qemuBlockJobRegister(job, vm, disk, true) < 0) return NULL; diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h index d8da918f2f..d77f1dcdb3 100644 --- a/src/qemu/qemu_blockjob.h +++ b/src/qemu/qemu_blockjob.h @@ -85,6 +85,7 @@ struct _qemuBlockJobCommitData { virStorageSourcePtr topparent; virStorageSourcePtr top; virStorageSourcePtr base; + bool deleteCommittedImages; }; =20 =20 @@ -165,7 +166,8 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm, virDomainDiskDefPtr disk, virStorageSourcePtr topparent, virStorageSourcePtr top, - virStorageSourcePtr base); + virStorageSourcePtr base, + bool delete_imgs); =20 qemuBlockJobDataPtr qemuBlockJobNewCreate(virDomainObjPtr vm, diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index dc14ec86a3..a3ff4b2177 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18638,7 +18638,7 @@ qemuDomainBlockCommit(virDomainPtr dom, goto endjob; =20 if (!(job =3D qemuBlockJobDiskNewCommit(vm, disk, top_parent, topSourc= e, - baseSource))) + baseSource, false))) goto endjob; =20 disk->mirrorState =3D VIR_DOMAIN_DISK_MIRROR_STATE_NONE; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 08:44:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 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=1574330466; cv=none; d=zoho.com; s=zohoarc; b=lhwZ80MG5V1rughoK9QcoqDY2+1cH7pa7HIsFzFotiZaol3LKmCHZtofFBhBxGA9PeKpRQuiCF9cHCAwJaZynSLuOYipgjE/ZdwXoey1tsn11UDQH71/lqjcEV9MRkMCsclSlLwA8yR3s4S4UFKdNPQtTuFGAQR3FJuVaIAXkvY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574330466; 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=GwBfM/wZRg/kWaNM0au+wddqiUH/L93LkhVCBvpu2Z0=; b=GBQ05g8qGx4AqUbEJNZBHubf93DTvvk8DfnQ9Ww5KEK+bRg7qnr0qGMhCH/9tBd1gVAQWnKcdOL2pYAwqt+A3IJOKHx2uGzgKj6bunzLgcV1ywBLohtYhqszXI/dkDNCbZG9URcKysh9tnrsN3lyV3VAQkWdaY2XPZWyLXkNVUo= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 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-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1574330466523409.26121458390037; Thu, 21 Nov 2019 02:01:06 -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-76-uFIiRd0HMzSs4clRot3CFg-1; Thu, 21 Nov 2019 05:01:01 -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 8840518B638F; Thu, 21 Nov 2019 10:00:55 +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 38DE828DF6; Thu, 21 Nov 2019 10:00:55 +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 BEF984BB65; Thu, 21 Nov 2019 10:00:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xALA0p7f003007 for ; Thu, 21 Nov 2019 05:00:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6664629343; Thu, 21 Nov 2019 10:00:51 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.43.2.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id BA1F328DF6; Thu, 21 Nov 2019 10:00:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574330465; 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=GwBfM/wZRg/kWaNM0au+wddqiUH/L93LkhVCBvpu2Z0=; b=QgOdBOtRqC/YkbBWlwNtR0QQAc/tttvhu2jvZ5o8XXT8TGp/jmwStbCiQWq4DYEiJuU9EC 0Ii/qerUeEXPBs3LduTI/yOVf0n8U0ogO4etTGmagCfpkjg9FXOdjrSMAFc8jYEiUnuKAt dzRgqn/6AswI8hMMTpoVhY5hxyBUgN8= From: Pavel Mores To: libvir-list@redhat.com Date: Thu, 21 Nov 2019 11:00:45 +0100 Message-Id: <20191121100047.17747-3-pmores@redhat.com> In-Reply-To: <20191121100047.17747-1-pmores@redhat.com> References: <20191121100047.17747-1-pmores@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Pavel Mores Subject: [libvirt] [PATCH v3 2/4] qemu: block: use the delete flag to delete snapshot images if requested 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 X-MC-Unique: uFIiRd0HMzSs4clRot3CFg-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 blockcommit finishes successfully, one of the qemuBlockJobProcessEventCompletedCommit() and qemuBlockJobProcessEventCompletedActiveCommit() event handlers is called. This is where the delete flag (stored in qemuBlockJobCommitData since the previous commit) can actually be used to delete the committed snapshot images if requested. We use virFileRemove() instead of a simple unlink() to cover the case where the image to be removed is on an NFS volume. To acquire the uid/gid argume= nts for the virFileRemove() call, we call qemuDomainGetImageIds() which was previously static in its file so we first have to export it. Signed-off-by: Pavel Mores --- src/qemu/qemu_blockjob.c | 39 +++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_domain.c | 2 +- src/qemu/qemu_domain.h | 6 ++++++ 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index 7d94a6ce38..1bf23dac3c 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -965,6 +965,37 @@ qemuBlockJobProcessEventCompletedPull(virQEMUDriverPtr= driver, } =20 =20 +/** + * Helper for qemuBlockJobProcessEventCompletedCommit() and + * qemuBlockJobProcessEventCompletedActiveCommit(). Relies on adjustments + * these functions perform on the 'backingStore' chain to function correct= ly. + * + * TODO look into removing backing store for non-local snapshots too + */ +static void +qemuBlockJobUnlinkCommittedStorage(virQEMUDriverPtr driver, + virDomainObjPtr vm, + virDomainDiskDefPtr disk, + virStorageSourcePtr top) +{ + virStorageSourcePtr p =3D top; + virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); + uid_t uid; + gid_t gid; + + for (; p !=3D NULL; p =3D p->backingStore) { + if (virStorageSourceIsLocalStorage(p)) { + + qemuDomainGetImageIds(cfg, vm, p, disk->src, &uid, &gid); + + if (virFileRemove(p->path, uid, gid) < 0) { + VIR_WARN("Unable to remove snapshot image file %s (%s)", + p->path, g_strerror(errno)); + } + } + } +} + /** * qemuBlockJobProcessEventCompletedCommit: * @driver: qemu driver object @@ -1031,6 +1062,10 @@ qemuBlockJobProcessEventCompletedCommit(virQEMUDrive= rPtr driver, job->data.commit.topparent->backingStore =3D job->data.commit.base; =20 qemuBlockJobEventProcessConcludedRemoveChain(driver, vm, asyncJob, job= ->data.commit.top); + + if (job->data.commit.deleteCommittedImages) + qemuBlockJobUnlinkCommittedStorage(driver, vm, job->disk, job->dat= a.commit.top); + virObjectUnref(job->data.commit.top); job->data.commit.top =3D NULL; =20 @@ -1121,6 +1156,10 @@ qemuBlockJobProcessEventCompletedActiveCommit(virQEM= UDriverPtr driver, job->disk->src->readonly =3D job->data.commit.top->readonly; =20 qemuBlockJobEventProcessConcludedRemoveChain(driver, vm, asyncJob, job= ->data.commit.top); + + if (job->data.commit.deleteCommittedImages) + qemuBlockJobUnlinkCommittedStorage(driver, vm, job->disk, job->dat= a.commit.top); + virObjectUnref(job->data.commit.top); job->data.commit.top =3D NULL; /* the mirror element does not serve functional purpose for the commit= job */ diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 262b74d1ab..07bf8f5a54 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -10133,7 +10133,7 @@ qemuDomainCleanupRun(virQEMUDriverPtr driver, priv->ncleanupCallbacks_max =3D 0; } =20 -static void +void qemuDomainGetImageIds(virQEMUDriverConfigPtr cfg, virDomainObjPtr vm, virStorageSourcePtr src, diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 98a9540275..f66610c7d3 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -834,6 +834,12 @@ bool qemuDomainDiskChangeSupported(virDomainDiskDefPtr= disk, const char *qemuDomainDiskNodeFormatLookup(virDomainObjPtr vm, const char *disk); =20 +void qemuDomainGetImageIds(virQEMUDriverConfigPtr cfg, + virDomainObjPtr vm, + virStorageSourcePtr src, + virStorageSourcePtr parentSrc, + uid_t *uid, gid_t *gid); + int qemuDomainStorageFileInit(virQEMUDriverPtr driver, virDomainObjPtr vm, virStorageSourcePtr src, --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 08:44:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 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=1574330477; cv=none; d=zoho.com; s=zohoarc; b=Y7i67ea8UpczMqYN72GzcpGrH8Z1JmMWW/EFF105q+CrwNPnagshEkmXH7LzOFdihqqUCJOsk2rT+IEVzQNhhwZhl8cFcmzXUTH+dceLnQY2yMiohVD++I5JW4W1p8pZ14lH2jXo9rIfZpogQEPu0mzGH10sYWSrg1N+RlwT0MI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574330477; 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=6DSXdVzNkyHsV2HmXweSMBCh8s1elgEBrHA2GiywXHY=; b=O2D2sGVzQsHlxdRRoU7MPfTPU3XWcwbY9LdAfx4aHvAr2GSqzH7b5UExejn87yT6wGQplwomKmnZ9bFZRsGRqvwN8HLzDPAQ0AQIvcRLVqyuDI2eq6kCZ3USrJ5hqZjkmUxdM1QGtmeEL1Lc71uWa+4bZ7JIQKIuJXJeyN12ldA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 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-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1574330477582206.07675019718533; Thu, 21 Nov 2019 02:01:17 -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-257-scZJT0NcM1Go7WQ3vvxFpQ-1; Thu, 21 Nov 2019 05:01:12 -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 8F9C98024CA; Thu, 21 Nov 2019 10:01:04 +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 4861244F98; Thu, 21 Nov 2019 10:01:04 +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 BBC314E566; Thu, 21 Nov 2019 10:01:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xALA0qBT003016 for ; Thu, 21 Nov 2019 05:00:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6331144F95; Thu, 21 Nov 2019 10:00:52 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.43.2.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id B578D44F8E; Thu, 21 Nov 2019 10:00:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574330476; 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=6DSXdVzNkyHsV2HmXweSMBCh8s1elgEBrHA2GiywXHY=; b=U6bohNUHUHtp9ql89zyO2ufSaVy1eYDrtTQ9HG7xPHvj9d1z12WtBBs9Cmed9f/jr+9vMH 3GR+2OYGV5VxAvH8IYhrfGJ1jAKc7Arx6Xskm3/ZHaDMiIMAf9YoE11hmvw5BF2kBqB02N vVu+OClXrjD4hfam39/P0B9f34mUBnw= From: Pavel Mores To: libvir-list@redhat.com Date: Thu, 21 Nov 2019 11:00:46 +0100 Message-Id: <20191121100047.17747-4-pmores@redhat.com> In-Reply-To: <20191121100047.17747-1-pmores@redhat.com> References: <20191121100047.17747-1-pmores@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Pavel Mores Subject: [libvirt] [PATCH v3 3/4] qemu: block: store the delete flag in libvirtd's status XML 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 X-MC-Unique: scZJT0NcM1Go7WQ3vvxFpQ-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" Since blockcommit is asynchronous, libvirtd can be restarted while the operation runs. To ensure the information necessary to finish up the job is not lost, serialisation to and deserialisation from the status XML is added. To unittest this, the new element was only added to the active commit test, the non-active commit test doesn't have the new element so as to test its absence. Signed-off-by: Pavel Mores Reviewed-by: Peter Krempa --- src/qemu/qemu_domain.c | 4 ++++ tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml | 1 + 2 files changed, 5 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 07bf8f5a54..f4cb0f9ea0 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2512,6 +2512,8 @@ qemuDomainObjPrivateXMLFormatBlockjobIterator(void *p= ayload, virBufferAsprintf(&childBuf, "\n", job->= data.commit.top->nodeformat); if (job->data.commit.topparent) virBufferAsprintf(&childBuf, "\n",= job->data.commit.topparent->nodeformat); + if (job->data.commit.deleteCommittedImages) + virBufferAddLit(&childBuf, "\n"); break; =20 case QEMU_BLOCKJOB_TYPE_CREATE: @@ -3069,6 +3071,8 @@ qemuDomainObjPrivateXMLParseBlockjobDataSpecific(qemu= BlockJobDataPtr job, "string(./base/@n= ode)", &job->data.commit= .base, ctxt); + if (virXPathNode("./deleteCommittedImages", ctxt)) + job->data.commit.deleteCommittedImages =3D true; if (!job->data.commit.top || !job->data.commit.base) goto broken; diff --git a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml b/tests/q= emustatusxml2xmldata/blockjob-blockdev-in.xml index 4f6930001e..5fd2ed1d78 100644 --- a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml +++ b/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml @@ -242,6 +242,7 @@ + --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 08:44:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 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=1574330476; cv=none; d=zoho.com; s=zohoarc; b=nRATjKxKBs7sjQvOiH0YV1QgU1tY025T7bLmyD4sMf/SU2cWCGKs1XPb5x7R/xFIYlnYhJnkR3YJFT+Ap+sbDfx+0vLfR1q0eu0yWxMkRbFrau6Sj2plaLTPm1nR935m57XTda7vR9Qcy+n2eUHc0D1C5Ix2H3PE7ZUjzDICdJk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574330476; 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=SLJhtMoXXtlRgcAm7xESAWg9ZhsMy9laTIAanfBPc9c=; b=aNEQMruKGssqkxKojrjDAzSxu3bGMr9j5EyHtX8iYPdDwuDBobqWuYFqp+E5ux0CBvyL/P/ruVJkehFXTlvzfvn3cVvynCC+7b717IlWprsji4rWk1c9dbf/pOLF8wv4ls7ENtO20b0/7hCJ+UG8fIKYVVAt6PE5d+ViQvoACto= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 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-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 157433047687462.69882822618479; Thu, 21 Nov 2019 02:01:16 -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-402-XYwc3ySuO4Oq4P7a-jgkjQ-1; Thu, 21 Nov 2019 05:01:13 -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 77AF7593AA; Thu, 21 Nov 2019 10:01:04 +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 3D97163644; Thu, 21 Nov 2019 10:01:04 +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 A07CE18089D0; Thu, 21 Nov 2019 10:01:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xALA0row003023 for ; Thu, 21 Nov 2019 05:00:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5F75344F94; Thu, 21 Nov 2019 10:00:53 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.43.2.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id B15A328DF6; Thu, 21 Nov 2019 10:00:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574330475; 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=SLJhtMoXXtlRgcAm7xESAWg9ZhsMy9laTIAanfBPc9c=; b=dnuWjDyUfy5rgrGXJxupPbmzDM9d8QSiNP1iA+zM5J1zGrIuV0qhki/iifyV7vb5TTrX+B kv0EAJFXs8h9mFNw2/Fp6kxI0q1VpI/TcxwZa2N+29KyFIG5xY4tpsNeo71f4ZdcksO0pO ZqA+VFFbLpcBPk2wo6OpCWWagzzJQYk= From: Pavel Mores To: libvir-list@redhat.com Date: Thu, 21 Nov 2019 11:00:47 +0100 Message-Id: <20191121100047.17747-5-pmores@redhat.com> In-Reply-To: <20191121100047.17747-1-pmores@redhat.com> References: <20191121100047.17747-1-pmores@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Pavel Mores Subject: [libvirt] [PATCH v3 4/4] qemu: block: enable the snapshot image deletion feature 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 X-MC-Unique: XYwc3ySuO4Oq4P7a-jgkjQ-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" With all plumbing in place, we can now enable the new functionality. Signed-off-by: Pavel Mores --- src/qemu/qemu_driver.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a3ff4b2177..75458f5c8a 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18496,10 +18496,10 @@ qemuDomainBlockCommit(virDomainPtr dom, bool persistjob =3D false; bool blockdev =3D false; =20 - /* XXX Add support for COMMIT_DELETE */ virCheckFlags(VIR_DOMAIN_BLOCK_COMMIT_SHALLOW | VIR_DOMAIN_BLOCK_COMMIT_ACTIVE | VIR_DOMAIN_BLOCK_COMMIT_RELATIVE | + VIR_DOMAIN_BLOCK_COMMIT_DELETE | VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES, -1); =20 if (!(vm =3D qemuDomainObjFromDomain(dom))) @@ -18638,7 +18638,8 @@ qemuDomainBlockCommit(virDomainPtr dom, goto endjob; =20 if (!(job =3D qemuBlockJobDiskNewCommit(vm, disk, top_parent, topSourc= e, - baseSource, false))) + baseSource, + flags & VIR_DOMAIN_BLOCK_COMMIT_= DELETE))) goto endjob; =20 disk->mirrorState =3D VIR_DOMAIN_DISK_MIRROR_STATE_NONE; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list