mirror of https://gitee.com/openkylin/libvirt.git
qemu: Forbid <memoryBacking><locked> without <memtune><hard_limit>
In order for memory locking to work, the hard limit on memory locking (and usage) has to be set appropriately by the user. The documentation mentions the requirement already: with this patch, it's going to be enforced by runtime checks as well, by forbidding a non-compliant guest from being defined as well as edited and started. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1316774
This commit is contained in:
parent
28a7fd8ac1
commit
c2e60ad0e5
|
@ -2832,6 +2832,16 @@ qemuDomainDefValidate(const virDomainDef *def,
|
|||
}
|
||||
}
|
||||
|
||||
/* Memory locking can only work properly if the memory locking limit
|
||||
* for the QEMU process has been raised appropriately: the default one
|
||||
* is extrememly low, so there's no way the guest will fit in there */
|
||||
if (def->mem.locked && !virMemoryLimitIsSet(def->mem.hard_limit)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Setting <memoryBacking><locked> requires "
|
||||
"<memtune><hard_limit> to be set as well"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (qemuDomainDefValidateVideo(def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
<memory unit='KiB'>219136</memory>
|
||||
<currentMemory unit='KiB'>219136</currentMemory>
|
||||
<memtune>
|
||||
<hard_limit unit='KiB'>256000</hard_limit>
|
||||
</memtune>
|
||||
<memoryBacking>
|
||||
<locked/>
|
||||
</memoryBacking>
|
||||
|
|
Loading…
Reference in New Issue