From nobody Fri Dec 19 02:49:51 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1571415134; cv=none; d=zoho.com; s=zohoarc; b=JDkwrZhUsxhutyEt9EQyi40GSiHjbnn1V/5Y0WzTCRkJofDkU20xrHVXa9XWV7vm40Ve14wglNAtvhJMJmQCBCBcHv0dhlLEe8Up575mPaKIq5EwQ2rnG45NDrqWFJ/WXbRevFbomQSTlorIdlLq4o20x1LmZWmL/Hf+SRsV61o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571415134; 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=+dAwGth5cNshjWpGzpjn/20OF85UGRk5NY5XdpUlw4s=; b=Ng6EppscM7k4qz554nEAJB3SEdGIbD0dtkf9pRz3ttWcnZ7d/c+kEs0NKwFxrXCJWvXt7XzHjGqOuT/lBS4jotZE+ZvWrUg3Rf6d1DWiO3vqUtiRDgYbdP/r40u4Dhh7eJ/L6heXvR0EMAgyua6DvdcwvwBpByXhbuOXEsvD0PU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1571415134262115.10027049212238; Fri, 18 Oct 2019 09:12:14 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2A6D72B8C; Fri, 18 Oct 2019 16:12:12 +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 EF73960BF4; Fri, 18 Oct 2019 16:12:11 +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 B17F23FB48; Fri, 18 Oct 2019 16:12:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9IGBvNp004796 for ; Fri, 18 Oct 2019 12:11:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5C94A6012A; Fri, 18 Oct 2019 16:11:57 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id B30B8600C8; Fri, 18 Oct 2019 16:11:56 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 18 Oct 2019 18:11:09 +0200 Message-Id: <8e7f5a82005f5bfbdcf1bd90a3bcf23c3cc3b475.1571414890.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH RFC 24/40] qemu: checkpoint: Extract finalizing steps of checkpoint creation 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.71]); Fri, 18 Oct 2019 16:12:13 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Extract the linking and saving bits of checkpoint creation into qemuCheckpointCreateFinalize so that qemuCheckpointCreateXML is a bit simpler and also makes it reusable in the backup code. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_checkpoint.c | 44 +++++++++++++++++++++++++------------- src/qemu/qemu_checkpoint.h | 7 ++++++ 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index 946ae78368..6a272f9dab 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -432,6 +432,34 @@ qemuCheckpointCreate(virQEMUDriverPtr driver, } +int +qemuCheckpointCreateFinalize(virQEMUDriverPtr driver, + virDomainObjPtr vm, + virQEMUDriverConfigPtr cfg, + virDomainMomentObjPtr chk, + bool update_current) +{ + if (update_current) + virDomainCheckpointSetCurrent(vm->checkpoints, chk); + + if (qemuCheckpointWriteMetadata(vm, chk, driver->caps, + driver->xmlopt, + cfg->checkpointDir) < 0) { + /* if writing of metadata fails, error out rather than trying + * to silently carry on without completing the checkpoint */ + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unable to save metadata for checkpoint %s"), + chk->def->name); + virDomainCheckpointObjListRemove(vm->checkpoints, chk); + return -1; + } + + virDomainCheckpointLinkParent(vm->checkpoints, chk); + + return 0; +} + + virDomainCheckpointPtr qemuCheckpointCreateXML(virDomainPtr domain, virDomainObjPtr vm, @@ -489,22 +517,8 @@ qemuCheckpointCreateXML(virDomainPtr domain, if (!chk) goto endjob; - if (update_current) - virDomainCheckpointSetCurrent(vm->checkpoints, chk); - - if (qemuCheckpointWriteMetadata(vm, chk, driver->caps, - driver->xmlopt, - cfg->checkpointDir) < 0) { - /* if writing of metadata fails, error out rather than trying - * to silently carry on without completing the checkpoint */ - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unable to save metadata for checkpoint %s"), - chk->def->name); - virDomainCheckpointObjListRemove(vm->checkpoints, chk); + if (qemuCheckpointCreateFinalize(driver, vm, cfg, chk, update_current)= < 0) goto endjob; - } - - virDomainCheckpointLinkParent(vm->checkpoints, chk); /* If we fail after this point, there's not a whole lot we can do; * we've successfully created the checkpoint, so we have to go diff --git a/src/qemu/qemu_checkpoint.h b/src/qemu/qemu_checkpoint.h index 7fcbc99541..d0ea8f000f 100644 --- a/src/qemu/qemu_checkpoint.h +++ b/src/qemu/qemu_checkpoint.h @@ -61,3 +61,10 @@ qemuCheckpointCreateCommon(virQEMUDriverPtr driver, virDomainCheckpointDefPtr *def, virJSONValuePtr *actions, virDomainMomentObjPtr *chk); + +int +qemuCheckpointCreateFinalize(virQEMUDriverPtr driver, + virDomainObjPtr vm, + virQEMUDriverConfigPtr cfg, + virDomainMomentObjPtr chk, + bool update_current); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list