From nobody Mon Feb 9 04:45:43 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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 (zohomail.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=1593701122; cv=none; d=zohomail.com; s=zohoarc; b=Jj2GnWih/ULZhYgZwTnLfVJs2sJ3PMRUHuHPd1A7GpDXnCR3CzdOt27Jn1StMK2P2lRqvwh6dI/Fy6JVcLaIqeMsuE6TozqdsS3XiAuf34uLqRbr396oC5Q5dYPQCf6y3lN0/tI9BjmsQPsOEsEA+Ip5dn6etbkCcouYt19pfGI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593701122; 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=9M0P6lHgEmx/7/dnPoqKNBLCKDrRDST5B6cszdE/bRI=; b=ZMjUGhUxxQGn7P3HBOU8kSiSoWDvvSFW2oGOWCfGsMrfd3UTZUUvnHQ/G0mRK5lCvuQVktoNDzeo2TTvHL1d5beRRIfWoV3IWNIv1OseaI1XTXGQ+rnevCQFqEEjgavIhki0QCeGgL8IrsI46FGb6t5jy+PV/SDN7blFUOLWObM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.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 159370112287849.43722101311096; Thu, 2 Jul 2020 07:45:22 -0700 (PDT) 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-312-sEaFgFoROomVbJy43jbVKg-1; Thu, 02 Jul 2020 10:45:19 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 90DD8805722; Thu, 2 Jul 2020 14:45:11 +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 12A4E79257; Thu, 2 Jul 2020 14:45: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 D2DF46C9D7; Thu, 2 Jul 2020 14:45:10 +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 062EeZ9B011851 for ; Thu, 2 Jul 2020 10:40:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id 02DEF10002A2; Thu, 2 Jul 2020 14:40:35 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6996F10013D2 for ; Thu, 2 Jul 2020 14:40:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593701121; 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=9M0P6lHgEmx/7/dnPoqKNBLCKDrRDST5B6cszdE/bRI=; b=KgoUJx7hSyxq4TyrSmF5eWOzaW+F7A+sbu5JSIwICfuohMPnTcdFc0F4PViI59WOqLlimH FMxVD7pPz/7vbtljWu7BjNH9AzH0HSvwhU8l11K5cPP956ovebK7mPt+fFJcjPzj1xoR0P TlNmRxSPiwSanNnxmahf8W8EGV4Cx2s= X-MC-Unique: sEaFgFoROomVbJy43jbVKg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 17/24] conf: checkpoint: Add a flag storing whether disk 'size' is valid Date: Thu, 2 Jul 2020 16:40:03 +0200 Message-Id: <6de875a3b1f4ce2f8d41b6c5b9cac4d1af23da1f.1593700474.git.pkrempa@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.79 on 10.5.11.13 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) Content-Type: text/plain; charset="utf-8" Avoid printing '0' size in case when we weren't able to determine the backup size by adding a flag whether the size is valid and interlock printing of the field according to the flag. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/conf/checkpoint_conf.c | 2 +- src/conf/checkpoint_conf.h | 1 + tests/qemudomaincheckpointxml2xmltest.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/conf/checkpoint_conf.c b/src/conf/checkpoint_conf.c index d557fada49..3405e8a3cc 100644 --- a/src/conf/checkpoint_conf.c +++ b/src/conf/checkpoint_conf.c @@ -430,7 +430,7 @@ virDomainCheckpointDiskDefFormat(virBufferPtr buf, virDomainCheckpointTypeToString(disk->type)); if (disk->bitmap) { virBufferEscapeString(buf, " bitmap=3D'%s'", disk->bitmap); - if (flags & VIR_DOMAIN_CHECKPOINT_FORMAT_SIZE) + if (flags & VIR_DOMAIN_CHECKPOINT_FORMAT_SIZE && disk->sizeValid) virBufferAsprintf(buf, " size=3D'%llu'", disk->size); } virBufferAddLit(buf, "/>\n"); diff --git a/src/conf/checkpoint_conf.h b/src/conf/checkpoint_conf.h index ee5d210593..f115b98c2b 100644 --- a/src/conf/checkpoint_conf.h +++ b/src/conf/checkpoint_conf.h @@ -46,6 +46,7 @@ struct _virDomainCheckpointDiskDef { int type; /* virDomainCheckpointType */ char *bitmap; /* bitmap name, if type is bitmap */ unsigned long long size; /* current checkpoint size in bytes */ + bool sizeValid; }; /* Stores the complete checkpoint metadata */ diff --git a/tests/qemudomaincheckpointxml2xmltest.c b/tests/qemudomainchec= kpointxml2xmltest.c index b73ac74e81..a5a5b59205 100644 --- a/tests/qemudomaincheckpointxml2xmltest.c +++ b/tests/qemudomaincheckpointxml2xmltest.c @@ -83,6 +83,7 @@ testCompareXMLToXMLFiles(const char *inxml, } if (flags & TEST_SIZE) { def->disks[0].size =3D 1048576; + def->disks[0].sizeValid =3D true; formatflags |=3D VIR_DOMAIN_CHECKPOINT_FORMAT_SIZE; } --=20 2.26.2