qemu: monitor: Make qemuMonitorSetBalloon operate on unsinged long long

This commit is contained in:
Peter Krempa 2015-05-27 14:03:17 +02:00
parent efe8b44a84
commit 987b70777a
6 changed files with 19 additions and 19 deletions

View File

@ -2022,11 +2022,15 @@ qemuMonitorExpirePassword(qemuMonitorPtr mon,
} }
/*
* Returns: 0 if balloon not supported, +1 if balloon adjust worked
* or -1 on failure
*/
int int
qemuMonitorSetBalloon(qemuMonitorPtr mon, qemuMonitorSetBalloon(qemuMonitorPtr mon,
unsigned long newmem) unsigned long long newmem)
{ {
VIR_DEBUG("newmem=%lu", newmem); VIR_DEBUG("newmem=%llu", newmem);
QEMU_CHECK_MONITOR(mon); QEMU_CHECK_MONITOR(mon);

View File

@ -401,7 +401,7 @@ int qemuMonitorExpirePassword(qemuMonitorPtr mon,
int type, int type,
const char *expire_time); const char *expire_time);
int qemuMonitorSetBalloon(qemuMonitorPtr mon, int qemuMonitorSetBalloon(qemuMonitorPtr mon,
unsigned long newmem); unsigned long long newmem);
int qemuMonitorSetCPU(qemuMonitorPtr mon, int cpu, bool online); int qemuMonitorSetCPU(qemuMonitorPtr mon, int cpu, bool online);

View File

@ -2175,16 +2175,14 @@ int qemuMonitorJSONExpirePassword(qemuMonitorPtr mon,
return ret; return ret;
} }
/*
* Returns: 0 if balloon not supported, +1 if balloon adjust worked int
* or -1 on failure qemuMonitorJSONSetBalloon(qemuMonitorPtr mon,
*/ unsigned long long newmem)
int qemuMonitorJSONSetBalloon(qemuMonitorPtr mon,
unsigned long newmem)
{ {
int ret; int ret;
virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("balloon", virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("balloon",
"U:value", ((unsigned long long)newmem)*1024, "U:value", newmem * 1024,
NULL); NULL);
virJSONValuePtr reply = NULL; virJSONValuePtr reply = NULL;
if (!cmd) if (!cmd)

View File

@ -94,7 +94,7 @@ int qemuMonitorJSONExpirePassword(qemuMonitorPtr mon,
const char *protocol, const char *protocol,
const char *expire_time); const char *expire_time);
int qemuMonitorJSONSetBalloon(qemuMonitorPtr mon, int qemuMonitorJSONSetBalloon(qemuMonitorPtr mon,
unsigned long newmem); unsigned long long newmem);
int qemuMonitorJSONSetCPU(qemuMonitorPtr mon, int cpu, bool online); int qemuMonitorJSONSetCPU(qemuMonitorPtr mon, int cpu, bool online);
int qemuMonitorJSONEjectMedia(qemuMonitorPtr mon, int qemuMonitorJSONEjectMedia(qemuMonitorPtr mon,

View File

@ -1110,12 +1110,10 @@ int qemuMonitorTextExpirePassword(qemuMonitorPtr mon,
return ret; return ret;
} }
/*
* Returns: 0 if balloon not supported, +1 if balloon adjust worked int
* or -1 on failure qemuMonitorTextSetBalloon(qemuMonitorPtr mon,
*/ unsigned long long newmem)
int qemuMonitorTextSetBalloon(qemuMonitorPtr mon,
unsigned long newmem)
{ {
char *cmd; char *cmd;
char *reply = NULL; char *reply = NULL;
@ -1125,7 +1123,7 @@ int qemuMonitorTextSetBalloon(qemuMonitorPtr mon,
* 'newmem' is in KB, QEMU monitor works in MB, and we all wish * 'newmem' is in KB, QEMU monitor works in MB, and we all wish
* we just worked in bytes with unsigned long long everywhere. * we just worked in bytes with unsigned long long everywhere.
*/ */
if (virAsprintf(&cmd, "balloon %lu", VIR_DIV_UP(newmem, 1024)) < 0) if (virAsprintf(&cmd, "balloon %llu", VIR_DIV_UP(newmem, 1024)) < 0)
return -1; return -1;
if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {

View File

@ -79,7 +79,7 @@ int qemuMonitorTextExpirePassword(qemuMonitorPtr mon,
const char *protocol, const char *protocol,
const char *expire_time); const char *expire_time);
int qemuMonitorTextSetBalloon(qemuMonitorPtr mon, int qemuMonitorTextSetBalloon(qemuMonitorPtr mon,
unsigned long newmem); unsigned long long newmem);
int qemuMonitorTextSetCPU(qemuMonitorPtr mon, int cpu, bool online); int qemuMonitorTextSetCPU(qemuMonitorPtr mon, int cpu, bool online);
int qemuMonitorTextEjectMedia(qemuMonitorPtr mon, int qemuMonitorTextEjectMedia(qemuMonitorPtr mon,