From nobody Sun Feb 8 13:45:11 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=1637839011; cv=none; d=zohomail.com; s=zohoarc; b=d7cEzubq6FSwHA5HTBZyGmswKAciGXSRUfo4a55R2dSfDq2VxtDxK69udgsEy5g7rnULng+UyWPcyH+eo03PBlvOpm4zSsii/CQrwqkKyobeOsdTIcUv+XAtmS2oIbhnIzLBwA9NpQ3jW7bMNNppnwMfU2Vd/uz2uS4hNBv/1ZE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637839011; 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=z324bFr4jxGfoWCAHv1qpLvT06UN0cNHB+RMM3P0/Ss=; b=O+lBfyRFNp8pLdex/zVqOB/AgJfkZ+KxnwBugLeEpPKJm4zwmdLzCFWXZRMxVC2p0+BnblEsoCMoGEKyBAomPoKzVqOgONbE4fYaWR7UcTlXNzi2yvdOOTi/hOSimW7ZhzmAl3U6x4GFqcR3m33U8bZ7iSbCeqStCxkJ155FtDE= 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 1637839011182497.31933765510155; Thu, 25 Nov 2021 03:16:51 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-206-bM1WfedkOlyNstXVu9PMDA-1; Thu, 25 Nov 2021 06:16:48 -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 4D768835BE1; Thu, 25 Nov 2021 11:16:42 +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 2BC4D19D9F; Thu, 25 Nov 2021 11:16:42 +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 CD07B4A7CB; Thu, 25 Nov 2021 11:16:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1APBGZTZ022887 for ; Thu, 25 Nov 2021 06:16:35 -0500 Received: by smtp.corp.redhat.com (Postfix) id D25BA1042A90; Thu, 25 Nov 2021 11:16:35 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.194.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 501151037F3C for ; Thu, 25 Nov 2021 11:16:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637839010; 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=z324bFr4jxGfoWCAHv1qpLvT06UN0cNHB+RMM3P0/Ss=; b=Vsrcs6RAyBamWD7aROKbKhfPWKzEn54Pr0rR48E58UySavVTrSqI4bzmEeKyqUfLhdV7Ym Aon13iTJIwb13S9oWZkUlpk6HgXLVrDBPiQAMt0gsyWVPU0IRzEqYDzBUkvOMEVpuBOyUV 6tvFUMNDcXQT50AfTUzdCOroJy1tdIw= X-MC-Unique: bM1WfedkOlyNstXVu9PMDA-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 08/11] qemu_snapshot: create: move saving metadata to separate function Date: Thu, 25 Nov 2021 12:16:14 +0100 Message-Id: <925614cf0a4c44a5168da259386efd6c1de822db.1637838934.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1637839013368100007 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina --- src/qemu/qemu_snapshot.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 46f65b8144..ce16236224 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1694,6 +1694,27 @@ qemuSnapshotAlignDisks(virDomainObj *vm, } =20 =20 +static int +qemuSnapshotCreateWriteMetadata(virDomainObj *vm, + virDomainMomentObj *snap, + virQEMUDriver *driver, + virQEMUDriverConfig *cfg) +{ + if (qemuDomainSnapshotWriteMetadata(vm, snap, + driver->xmlopt, + cfg->snapshotDir) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unable to save metadata for snapshot %s"), + snap->def->name); + return -1; + } + + virDomainSnapshotLinkParent(vm->snapshots, snap); + + return 0; +} + + virDomainSnapshotPtr qemuSnapshotCreateXML(virDomainPtr domain, virDomainObj *vm, @@ -1822,20 +1843,14 @@ qemuSnapshotCreateXML(virDomainPtr domain, if (!redefine || (flags & VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT)) qemuSnapshotSetCurrent(vm, snap); =20 - if (qemuDomainSnapshotWriteMetadata(vm, snap, - driver->xmlopt, - cfg->snapshotDir) < 0) { + if (qemuSnapshotCreateWriteMetadata(vm, snap, driver, cfg) < 0) { /* if writing of metadata fails, error out rather than trying * to silently carry on without completing the snapshot */ virObjectUnref(snapshot); snapshot =3D NULL; - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unable to save metadata for snapshot %s"), - snap->def->name); goto endjob; } =20 - virDomainSnapshotLinkParent(vm->snapshots, snap); snap =3D NULL; } =20 --=20 2.31.1