mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
Check for balloon model in qemuDomainSetMemoryStatsPeriod
There's no point in calling the monitor if there is no balloon.
This commit is contained in:
parent
09ebc10fe1
commit
bf42e6d848
@ -2459,6 +2459,14 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period,
|
||||
priv = vm->privateData;
|
||||
|
||||
if (def) {
|
||||
if (!def->memballoon ||
|
||||
def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Memory balloon model must be virtio to set the"
|
||||
" collection period"));
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
qemuDomainObjEnterMonitor(driver, vm);
|
||||
r = qemuMonitorSetMemoryStatsPeriod(priv->mon, period);
|
||||
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
||||
@ -2475,6 +2483,13 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period,
|
||||
}
|
||||
|
||||
if (persistentDef) {
|
||||
if (!persistentDef->memballoon ||
|
||||
persistentDef->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Memory balloon model must be virtio to set the"
|
||||
" collection period"));
|
||||
goto endjob;
|
||||
}
|
||||
persistentDef->memballoon->period = period;
|
||||
ret = virDomainSaveConfig(cfg->configDir, persistentDef);
|
||||
goto endjob;
|
||||
|
Loading…
x
Reference in New Issue
Block a user