Fix handling return value of qemuMonitorSetBalloon

* src/qemu/qemu_driver.c: The positive return value of
  qemuMonitorSetBalloon should be handled as a success
This commit is contained in:
Ryota Ozaki 2009-10-07 15:33:36 +02:00 committed by Daniel Veillard
parent 3a05dc09ec
commit e1f5f8516f

View File

@ -3020,17 +3020,20 @@ static int qemudDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
} }
if (virDomainIsActive(vm)) { if (virDomainIsActive(vm)) {
ret = qemuMonitorSetBalloon(vm, newmem); int r = qemuMonitorSetBalloon(vm, newmem);
/* Turn lack of balloon support into a fatal error */ if (r < 0)
if (ret == 0) { goto cleanup;
/* Lack of balloon support is a fatal error */
if (r == 0) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT, qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
"%s", _("cannot set memory of an active domain")); "%s", _("cannot set memory of an active domain"));
ret = -1; goto cleanup;
} }
} else { } else {
vm->def->memory = newmem; vm->def->memory = newmem;
ret = 0;
} }
ret = 0;
cleanup: cleanup:
if (vm) if (vm)