diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 89a52ab1b7..54e63878fa 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -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 requires " + " to be set as well")); + goto cleanup; + } + if (qemuDomainDefValidateVideo(def) < 0) goto cleanup; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mlock-on.xml b/tests/qemuxml2argvdata/qemuxml2argv-mlock-on.xml index 20a5eaa71f..2046663743 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-mlock-on.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-mlock-on.xml @@ -3,6 +3,9 @@ c7a5fdbd-edaf-9455-926a-d65c16db1809 219136 219136 + + 256000 +