From nobody Mon Feb 9 11:31:59 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=1631545025; cv=none; d=zohomail.com; s=zohoarc; b=l6r1Z7W1tj5ClYGZ1LV1lTgS6GgFIgIzYWKUymeBcJW4FAMzmcLqz9EyQrwxgLzCN0C0te3h2FVH7nbTtgsu3HWRNlK7kIxjybwQU4d/AOo2/g1IYf1q/z+P84iwhRUGdUJGJ/7yGHvhbQOBtIs3RH4oDe2PvaJZhhdjq2XIplc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631545025; 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=H6khb8OenATRPPq0R5Xp7Uf+VlQ5QxYkqU0VbxU0js0=; b=AK41qcFbxMsBDMuvEy7bM+risCM8la7Vh4W8/0Zyp09TbRKolAOKgI7W8qdxNWKjjtvIfusVAAUS1PbxBtbJeSt2Pt2V+PrGurOmMYFYQSEB4H/N5wgrffaKz1Ycda3XXw643fEtEl4Zmkmi+zcx1j47pifuoWOoesjRDCA/f/o= 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 1631545025587465.84983946610726; Mon, 13 Sep 2021 07:57:05 -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-4-MBKcxQNdPeOjNZvWvDtatg-1; Mon, 13 Sep 2021 10:56:45 -0400 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 39FA4101451B; Mon, 13 Sep 2021 14:56:37 +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 1C6C45C3E0; Mon, 13 Sep 2021 14:56:37 +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 E165F1805986; Mon, 13 Sep 2021 14:56:36 +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 18DEr64E021170 for ; Mon, 13 Sep 2021 10:53:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id DE518188E4; Mon, 13 Sep 2021 14:53:06 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.93]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4247D6A907; Mon, 13 Sep 2021 14:53:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631545024; 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=H6khb8OenATRPPq0R5Xp7Uf+VlQ5QxYkqU0VbxU0js0=; b=Gr4JEr4iiTh/hiGxgvBWbfGMQFac3Bw8WQrsk2T8OfHcoOmNocGNtROhYzotG2qUfJgyZj aNp1UwribijPnwb6jwyqcxkXkxWTDLNieZPadrDnOjec/baBY8HePbh7U+yfiRhkFxxJk5 04km1TEASXNifTQG3E42vG4iyjeW7pU= X-MC-Unique: MBKcxQNdPeOjNZvWvDtatg-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v5 08/16] Introduce property to virtio-mem Date: Mon, 13 Sep 2021 16:52:36 +0200 Message-Id: <0abdbf054a72d204646c3dd738d58bca6168b90b.1631544341.git.mprivozn@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: david@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.16 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: 1631545026809100001 Content-Type: text/plain; charset="utf-8" The virtio-mem has another property that isn't exposed yet: current size exposed to the guest. Please note, that this is different to because esp. on sizing the memory down guest may refuse to release some blocks. Therefore, let's have another size to report in the XML. But because of its nature, the won't be parsed and is report only (for live XMLs). Signed-off-by: Michal Privoznik --- docs/formatdomain.rst | 7 +++++++ docs/schemas/domaincommon.rng | 5 +++++ src/conf/domain_conf.c | 9 +++++++-- src/conf/domain_conf.h | 3 +++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index c327e1deae..7dc93d6abe 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -7800,6 +7800,7 @@ Example: usage of the memory devices 0 2048 1048576 + 524288 @@ -7915,6 +7916,12 @@ Example: usage of the memory devices The total size exposed to the guest. Must respect ``block`` granulari= ty and be smaller than or equal to ``size``. =20 + ``current`` + Active XML for ``virtio-mem`` model may contain ``current`` element t= hat + reflects the current size of the corresponding virtio memory device. = The + element is formatted into live XML and never parsed, i.e. it is + output-only element. + :anchor:`` =20 IOMMU devices diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 82fdc7c8b5..a68f794262 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -6693,6 +6693,11 @@ + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9562065499..c91dd9d81c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -25905,7 +25905,8 @@ virDomainMemorySourceDefFormat(virBuffer *buf, =20 static void virDomainMemoryTargetDefFormat(virBuffer *buf, - virDomainMemoryDef *def) + virDomainMemoryDef *def, + unsigned int flags) { g_auto(virBuffer) childBuf =3D VIR_BUFFER_INIT_CHILD(buf); =20 @@ -25927,6 +25928,10 @@ virDomainMemoryTargetDefFormat(virBuffer *buf, =20 virBufferAsprintf(&childBuf, "%llu\n", def->requestedsize); + if (!(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)) { + virBufferAsprintf(&childBuf, "%llu\n", + def->currentsize); + } } =20 virXMLFormatElement(buf, "target", NULL, &childBuf); @@ -25959,7 +25964,7 @@ virDomainMemoryDefFormat(virBuffer *buf, if (virDomainMemorySourceDefFormat(buf, def) < 0) return -1; =20 - virDomainMemoryTargetDefFormat(buf, def); + virDomainMemoryTargetDefFormat(buf, def, flags); =20 virDomainDeviceInfoFormat(buf, &def->info, flags); =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index e9d8e0c7ae..91bf52ff3b 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2495,6 +2495,9 @@ struct _virDomainMemoryDef { unsigned long long labelsize; /* kibibytes; valid only for NVDIMM */ unsigned long long blocksize; /* kibibytes; valid only for VIRTIO_MEM = */ unsigned long long requestedsize; /* kibibytes; valid only for VIRTIO_= MEM */ + unsigned long long currentsize; /* kibibytes, valid for VIRTIO_MEM and + active domain only, only to report = never + parse */ bool readonly; /* valid only for NVDIMM */ =20 /* required for QEMU NVDIMM ppc64 support */ --=20 2.32.0