提交 ba8c8361 编写于 作者: J Ján Tomko

LXC: Allow setting max mem lower than current mem

For inactive domains, set both current and maximum memory
to the specified 'maximum memory' value.

This matches the behavior of QEMU driver's SetMaxMemory.

https://bugzilla.redhat.com/show_bug.cgi?id=1091132
上级 87388228
...@@ -692,10 +692,15 @@ static int lxcDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax) ...@@ -692,10 +692,15 @@ static int lxcDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax)
goto cleanup; goto cleanup;
if (newmax < vm->def->mem.cur_balloon) { if (newmax < vm->def->mem.cur_balloon) {
virReportError(VIR_ERR_INVALID_ARG, if (!virDomainObjIsActive(vm)) {
"%s", _("Cannot set max memory lower than current memory")); vm->def->mem.cur_balloon = newmax;
} else {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("Cannot set max memory lower than current"
" memory for an active domain"));
goto cleanup; goto cleanup;
} }
}
vm->def->mem.max_balloon = newmax; vm->def->mem.max_balloon = newmax;
ret = 0; ret = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册