This patch adds virDomainSetMemroyFlags(,,VIR_DOMAIN_MEM_CURRENT) support code to qemu driver. Signed-off-by: Taku Izumi <izumi.taku@xxxxxxxxxxxxxx> --- src/qemu/qemu_driver.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) Index: libvirt/src/qemu/qemu_driver.c =================================================================== --- libvirt.orig/src/qemu/qemu_driver.c +++ libvirt/src/qemu/qemu_driver.c @@ -1575,16 +1575,11 @@ static int qemudDomainSetMemoryFlags(vir qemuDomainObjPrivatePtr priv; virDomainObjPtr vm; virDomainDefPtr persistentDef = NULL; - int ret = -1, r; + int ret = -1, r, isActive; virCheckFlags(VIR_DOMAIN_MEM_LIVE | VIR_DOMAIN_MEM_CONFIG, -1); - if ((flags & (VIR_DOMAIN_MEM_LIVE | VIR_DOMAIN_MEM_CONFIG)) == 0) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("invalid flag combination: (0x%x)"), flags); - } - qemuDriverLock(driver); vm = virDomainFindByUUID(&driver->domains, dom->uuid); qemuDriverUnlock(driver); @@ -1605,7 +1600,16 @@ static int qemudDomainSetMemoryFlags(vir if (qemuDomainObjBeginJob(vm) < 0) goto cleanup; - if (!virDomainObjIsActive(vm) && (flags & VIR_DOMAIN_MEM_LIVE)) { + isActive = virDomainObjIsActive(vm); + + if (flags == VIR_DOMAIN_MEM_CURRENT) { + if (isActive) + flags = VIR_DOMAIN_MEM_LIVE; + else + flags = VIR_DOMAIN_MEM_CONFIG; + } + + if (!isActive && (flags & VIR_DOMAIN_MEM_LIVE)) { qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", _("domain is not running")); goto endjob; -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list