mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00:00
Introduce <current/> property to virtio-mem
The virtio-mem has another property that isn't exposed yet: current size exposed to the guest. Please note, that this is different to <requested/> 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 <current/> won't be parsed and is report only (for live XMLs). Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
99e4ae2b02
commit
59e9fb98f5
@ -7802,6 +7802,7 @@ Example: usage of the memory devices
|
|||||||
<node>0</node>
|
<node>0</node>
|
||||||
<block unit='KiB'>2048</block>
|
<block unit='KiB'>2048</block>
|
||||||
<requested unit='KiB'>1048576</requested>
|
<requested unit='KiB'>1048576</requested>
|
||||||
|
<current unit='KiB'>524288</current>
|
||||||
</target>
|
</target>
|
||||||
</memory>
|
</memory>
|
||||||
</devices>
|
</devices>
|
||||||
@ -7917,6 +7918,12 @@ Example: usage of the memory devices
|
|||||||
The total size exposed to the guest. Must respect ``block`` granularity
|
The total size exposed to the guest. Must respect ``block`` granularity
|
||||||
and be smaller than or equal to ``size``.
|
and be smaller than or equal to ``size``.
|
||||||
|
|
||||||
|
``current``
|
||||||
|
Active XML for ``virtio-mem`` model may contain ``current`` element that
|
||||||
|
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:`<a id="elementsIommu"/>`
|
:anchor:`<a id="elementsIommu"/>`
|
||||||
|
|
||||||
IOMMU devices
|
IOMMU devices
|
||||||
|
@ -6698,6 +6698,11 @@
|
|||||||
<ref name="scaledInteger"/>
|
<ref name="scaledInteger"/>
|
||||||
</element>
|
</element>
|
||||||
</optional>
|
</optional>
|
||||||
|
<optional>
|
||||||
|
<element name="current">
|
||||||
|
<ref name="scaledInteger"/>
|
||||||
|
</element>
|
||||||
|
</optional>
|
||||||
<optional>
|
<optional>
|
||||||
<element name="label">
|
<element name="label">
|
||||||
<element name="size">
|
<element name="size">
|
||||||
|
@ -25921,7 +25921,8 @@ virDomainMemorySourceDefFormat(virBuffer *buf,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
virDomainMemoryTargetDefFormat(virBuffer *buf,
|
virDomainMemoryTargetDefFormat(virBuffer *buf,
|
||||||
virDomainMemoryDef *def)
|
virDomainMemoryDef *def,
|
||||||
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
|
g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
|
||||||
|
|
||||||
@ -25943,6 +25944,10 @@ virDomainMemoryTargetDefFormat(virBuffer *buf,
|
|||||||
|
|
||||||
virBufferAsprintf(&childBuf, "<requested unit='KiB'>%llu</requested>\n",
|
virBufferAsprintf(&childBuf, "<requested unit='KiB'>%llu</requested>\n",
|
||||||
def->requestedsize);
|
def->requestedsize);
|
||||||
|
if (!(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)) {
|
||||||
|
virBufferAsprintf(&childBuf, "<current unit='KiB'>%llu</current>\n",
|
||||||
|
def->currentsize);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virXMLFormatElement(buf, "target", NULL, &childBuf);
|
virXMLFormatElement(buf, "target", NULL, &childBuf);
|
||||||
@ -25975,7 +25980,7 @@ virDomainMemoryDefFormat(virBuffer *buf,
|
|||||||
if (virDomainMemorySourceDefFormat(buf, def) < 0)
|
if (virDomainMemorySourceDefFormat(buf, def) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
virDomainMemoryTargetDefFormat(buf, def);
|
virDomainMemoryTargetDefFormat(buf, def, flags);
|
||||||
|
|
||||||
virDomainDeviceInfoFormat(buf, &def->info, flags);
|
virDomainDeviceInfoFormat(buf, &def->info, flags);
|
||||||
|
|
||||||
|
@ -2496,6 +2496,9 @@ struct _virDomainMemoryDef {
|
|||||||
unsigned long long labelsize; /* kibibytes; valid only for NVDIMM */
|
unsigned long long labelsize; /* kibibytes; valid only for NVDIMM */
|
||||||
unsigned long long blocksize; /* kibibytes; valid only for VIRTIO_MEM */
|
unsigned long long blocksize; /* kibibytes; valid only for VIRTIO_MEM */
|
||||||
unsigned long long requestedsize; /* 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 */
|
bool readonly; /* valid only for NVDIMM */
|
||||||
|
|
||||||
/* required for QEMU NVDIMM ppc64 support */
|
/* required for QEMU NVDIMM ppc64 support */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user