<dt><code>period</code></dt>
<dd>
<p>
- The optional <code>period</code> allows the QEMU virtio memory
- balloon driver to provide statistics through the <code>virsh
- dommemstat [domain]</code> command. By default, collection is
- not enabled. In order to enable, use the <code>virsh dommemstat
- [domain] --period [number]</code> command or <code>virsh edit</code>
- command to add the option to the XML definition.
- The <code>virsh dommemstat</code> will accept the options
- <code>--live</code>, <code>--current</code>, or <code>--config</code>.
- If an option is not provided, the change for a running domain will
- only be made to the active guest.
- If the QEMU driver is not at the right
- revision, the attempt to set the period will fail.
+ The optional <code>period</code> allows the QEMU virtio memory balloon
+ driver to provide statistics through the <code>virsh dommemstat
+ [domain]</code> command. By default, collection is not enabled. In
+ order to enable, use the <code>virsh dommemstat [domain] --period
+ [number]</code> command or <code>virsh edit</code> command to add the
+ option to the XML definition. The <code>virsh dommemstat</code> will
+ accept the options <code>--live</code>, <code>--current</code>,
+ or <code>--config</code>. If an option is not provided, the change
+ for a running domain will only be made to the active guest. If the
+ QEMU driver is not at the right revision, the attempt to set the
+ period will fail. Large values (e.g. many years) might be ignored.
<span class='since'>Since 1.1.1, requires QEMU 1.5</span>
</p>
</dd>
char *model;
virDomainMemballoonDefPtr def;
xmlNodePtr save = ctxt->node;
+ unsigned int period = 0;
if (VIR_ALLOC(def) < 0)
return NULL;
}
ctxt->node = node;
- if (virXPathUInt("string(./stats/@period)", ctxt, &def->period) < -1) {
+ if (virXPathUInt("string(./stats/@period)", ctxt, &period) < -1) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("invalid statistics collection period"));
goto error;
}
+ def->period = period;
+ if (def->period < 0)
+ def->period = 0;
+
if (def->model == VIR_DOMAIN_MEMBALLOON_MODEL_NONE)
VIR_DEBUG("Ignoring device address for none model Memballoon");
else if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0)
virBufferAdjustIndent(&childrenBuf, indent + 2);
if (def->period)
- virBufferAsprintf(&childrenBuf, "<stats period='%u'/>\n", def->period);
+ virBufferAsprintf(&childrenBuf, "<stats period='%i'/>\n", def->period);
if (virDomainDeviceInfoNeedsFormat(&def->info, flags) &&
virDomainDeviceInfoFormat(&childrenBuf, &def->info, flags) < 0) {