-From 132444451193736847c68d91f74c09cb76a16e6a Mon Sep 17 00:00:00 2001
+From 5921bc0360f6964a5bb5355c2707c806425f4734 Mon Sep 17 00:00:00 2001
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
Date: Wed, 9 Dec 2015 14:27:49 +0100
Subject: [PATCH 06/47] virtio-balloon: fix query
hmp.c | 30 +++++++++++++++++++++++++++++-
hw/virtio/virtio-balloon.c | 33 +++++++++++++++++++++++++++++++--
qapi-schema.json | 23 +++++++++++++++++++++--
- qmp-commands.hx | 13 +++++++++++++
- 4 files changed, 94 insertions(+), 5 deletions(-)
+ 3 files changed, 81 insertions(+), 5 deletions(-)
diff --git a/hmp.c b/hmp.c
-index bb45f7f..3b0dd81 100644
+index edb8970..904542d 100644
--- a/hmp.c
+++ b/hmp.c
-@@ -704,7 +704,35 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdict)
+@@ -723,7 +723,35 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdict)
return;
}
qapi_free_BalloonInfo(info);
}
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
-index ad4189a..b3a17f4 100644
+index a705e0e..158e13e 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
-@@ -376,8 +376,37 @@ static uint64_t virtio_balloon_get_features(VirtIODevice *vdev, uint64_t f,
+@@ -379,8 +379,37 @@ static uint64_t virtio_balloon_get_features(VirtIODevice *vdev, uint64_t f,
static void virtio_balloon_stat(void *opaque, BalloonInfo *info)
{
VirtIOBalloon *dev = opaque;
static void virtio_balloon_to_target(void *opaque, ram_addr_t target)
diff --git a/qapi-schema.json b/qapi-schema.json
-index 5658723..4bf7222 100644
+index b921994..e7a8117 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
-@@ -1278,10 +1278,29 @@
+@@ -1900,10 +1900,29 @@
#
# @actual: the number of bytes the balloon currently contains
#
-# Since: 0.14.0
-+# @last_update: #optional time when stats got updated from guest
++# @last_update: time when stats got updated from guest
+#
-+# @mem_swapped_in: #optional number of pages swapped in within the guest
++# @mem_swapped_in: number of pages swapped in within the guest
+#
-+# @mem_swapped_out: #optional number of pages swapped out within the guest
++# @mem_swapped_out: number of pages swapped out within the guest
+#
-+# @major_page_faults: #optional number of major page faults within the guest
++# @major_page_faults: number of major page faults within the guest
#
-+# @minor_page_faults: #optional number of minor page faults within the guest
++# @minor_page_faults: number of minor page faults within the guest
+#
-+# @free_mem: #optional amount of memory (in bytes) free in the guest
++# @free_mem: amount of memory (in bytes) free in the guest
+#
-+# @total_mem: #optional amount of memory (in bytes) visible to the guest
++# @total_mem: amount of memory (in bytes) visible to the guest
+#
+# @max_mem: amount of memory (in bytes) assigned to the guest
+#
##
# @query-balloon:
-diff --git a/qmp-commands.hx b/qmp-commands.hx
-index 6866264..6de28d4 100644
---- a/qmp-commands.hx
-+++ b/qmp-commands.hx
-@@ -3854,6 +3854,13 @@ Make an asynchronous request for balloon info. When the request completes a
- json-object will be returned containing the following data:
-
- - "actual": current balloon value in bytes (json-int)
-+- "mem_swapped_in": Amount of memory swapped in bytes (json-int, optional)
-+- "mem_swapped_out": Amount of memory swapped out in bytes (json-int, optional)
-+- "major_page_faults": Number of major faults (json-int, optional)
-+- "minor_page_faults": Number of minor faults (json-int, optional)
-+- "free_mem": Total amount of free and unused memory in
-+ bytes (json-int, optional)
-+- "total_mem": Total amount of available memory in bytes (json-int, optional)
-
- Example:
-
-@@ -3861,6 +3868,12 @@ Example:
- <- {
- "return":{
- "actual":1073741824,
-+ "mem_swapped_in":0,
-+ "mem_swapped_out":0,
-+ "major_page_faults":142,
-+ "minor_page_faults":239245,
-+ "free_mem":1014185984,
-+ "total_mem":1044668416
- }
- }
-
--
2.1.4