lxc: Make SetMemory work for active domains only

This commit is contained in:
Jiri Denemark 2010-05-03 14:02:56 +02:00
parent e1fa3fb0fc
commit b94b72b457

View File

@ -642,7 +642,12 @@ static int lxcDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
goto cleanup;
}
if (virDomainObjIsActive(vm)) {
if (!virDomainObjIsActive(vm)) {
lxcError(VIR_ERR_OPERATION_INVALID,
"%s", _("Domain is not running"));
goto cleanup;
}
if (driver->cgroup == NULL) {
lxcError(VIR_ERR_NO_SUPPORT,
"%s", _("cgroups must be configured on the host"));
@ -660,9 +665,7 @@ static int lxcDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
"%s", _("Failed to set memory for domain"));
goto cleanup;
}
} else {
vm->def->memory = newmem;
}
ret = 0;
cleanup: