Signed-off-by: Chen Hanxiao <chenhanxiao@xxxxxxxxxxxxxx> --- src/lxc/lxc_driver.c | 36 +++++------------------------------- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index be6ee19..9f974eb 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -680,37 +680,6 @@ lxcDomainGetMaxMemory(virDomainPtr dom) return ret; } -static int lxcDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax) -{ - virDomainObjPtr vm; - int ret = -1; - - if (!(vm = lxcDomObjFromDomain(dom))) - goto cleanup; - - if (virDomainSetMaxMemoryEnsureACL(dom->conn, vm->def) < 0) - goto cleanup; - - if (newmax < vm->def->mem.cur_balloon) { - if (!virDomainObjIsActive(vm)) { - 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; - } - } - - vm->def->mem.max_balloon = newmax; - ret = 0; - - cleanup: - if (vm) - virObjectUnlock(vm); - return ret; -} - static int lxcDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, unsigned int flags) { @@ -809,6 +778,11 @@ static int lxcDomainSetMemory(virDomainPtr dom, unsigned long newmem) return lxcDomainSetMemoryFlags(dom, newmem, VIR_DOMAIN_AFFECT_LIVE); } +static int lxcDomainSetMaxMemory(virDomainPtr dom, unsigned long memory) +{ + return lxcDomainSetMemoryFlags(dom, memory, VIR_DOMAIN_MEM_MAXIMUM); +} + static int lxcDomainSetMemoryParameters(virDomainPtr dom, virTypedParameterPtr params, -- 1.9.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list