]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: monitor: Make qemuMonitorSetBalloon operate on unsinged long long
authorPeter Krempa <pkrempa@redhat.com>
Wed, 27 May 2015 12:03:17 +0000 (14:03 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 3 Jun 2015 07:42:08 +0000 (09:42 +0200)
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.h
src/qemu/qemu_monitor_json.c
src/qemu/qemu_monitor_json.h
src/qemu/qemu_monitor_text.c
src/qemu/qemu_monitor_text.h

index 45414cfee70e1951c4b3fe0979120ba153f29282..e9c57f1897b8c7185fd58cf555438d1f878b0c7c 100644 (file)
@@ -2022,11 +2022,15 @@ qemuMonitorExpirePassword(qemuMonitorPtr mon,
 }
 
 
+/*
+ * Returns: 0 if balloon not supported, +1 if balloon adjust worked
+ * or -1 on failure
+ */
 int
 qemuMonitorSetBalloon(qemuMonitorPtr mon,
-                      unsigned long newmem)
+                      unsigned long long newmem)
 {
-    VIR_DEBUG("newmem=%lu", newmem);
+    VIR_DEBUG("newmem=%llu", newmem);
 
     QEMU_CHECK_MONITOR(mon);
 
index 76380a05bf0f87f027598c5d04c87ecd09881de0..d30b514e851570363d105061e72ce7c4759bd254 100644 (file)
@@ -401,7 +401,7 @@ int qemuMonitorExpirePassword(qemuMonitorPtr mon,
                               int type,
                               const char *expire_time);
 int qemuMonitorSetBalloon(qemuMonitorPtr mon,
-                          unsigned long newmem);
+                          unsigned long long newmem);
 int qemuMonitorSetCPU(qemuMonitorPtr mon, int cpu, bool online);
 
 
index 2287398586b520b7bb61d57567db8ef8ea5b474d..e6da804aebb6756938f4c7612d084125ef644f83 100644 (file)
@@ -2175,16 +2175,14 @@ int qemuMonitorJSONExpirePassword(qemuMonitorPtr mon,
     return ret;
 }
 
-/*
- * Returns: 0 if balloon not supported, +1 if balloon adjust worked
- * or -1 on failure
- */
-int qemuMonitorJSONSetBalloon(qemuMonitorPtr mon,
-                              unsigned long newmem)
+
+int
+qemuMonitorJSONSetBalloon(qemuMonitorPtr mon,
+                          unsigned long long newmem)
 {
     int ret;
     virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("balloon",
-                                                     "U:value", ((unsigned long long)newmem)*1024,
+                                                     "U:value", newmem * 1024,
                                                      NULL);
     virJSONValuePtr reply = NULL;
     if (!cmd)
index 43adc906cb9c538db2cbef2e2db99a7fc5c1fa49..05c9b29f58dc6a28b1d535aef8e4ac31b73f1e59 100644 (file)
@@ -94,7 +94,7 @@ int qemuMonitorJSONExpirePassword(qemuMonitorPtr mon,
                                   const char *protocol,
                                   const char *expire_time);
 int qemuMonitorJSONSetBalloon(qemuMonitorPtr mon,
-                              unsigned long newmem);
+                              unsigned long long newmem);
 int qemuMonitorJSONSetCPU(qemuMonitorPtr mon, int cpu, bool online);
 
 int qemuMonitorJSONEjectMedia(qemuMonitorPtr mon,
index ad36dd09338b0fb2ffd198c59467066aad011668..1b6bc02d9f77cb49ba543dffa764d36132516012 100644 (file)
@@ -1110,12 +1110,10 @@ int qemuMonitorTextExpirePassword(qemuMonitorPtr mon,
     return ret;
 }
 
-/*
- * Returns: 0 if balloon not supported, +1 if balloon adjust worked
- * or -1 on failure
- */
-int qemuMonitorTextSetBalloon(qemuMonitorPtr mon,
-                              unsigned long newmem)
+
+int
+qemuMonitorTextSetBalloon(qemuMonitorPtr mon,
+                          unsigned long long newmem)
 {
     char *cmd;
     char *reply = NULL;
@@ -1125,7 +1123,7 @@ int qemuMonitorTextSetBalloon(qemuMonitorPtr mon,
      * 'newmem' is in KB, QEMU monitor works in MB, and we all wish
      * 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;
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
index 40edc9a258909b1cd21b4ae1b5b056bf8e55925c..6f9a215d0d55fd8cf03cc988ea48e8fdc8992669 100644 (file)
@@ -79,7 +79,7 @@ int qemuMonitorTextExpirePassword(qemuMonitorPtr mon,
                                   const char *protocol,
                                   const char *expire_time);
 int qemuMonitorTextSetBalloon(qemuMonitorPtr mon,
-                              unsigned long newmem);
+                              unsigned long long newmem);
 int qemuMonitorTextSetCPU(qemuMonitorPtr mon, int cpu, bool online);
 
 int qemuMonitorTextEjectMedia(qemuMonitorPtr mon,