balloon: drop old stats code & API

Next commit will re-enable balloon stats with a different interface, but
this old code conflicts with it. Let's drop it.

It's important to note that the QMP and HMP interfaces are also dropped
by this commit. That shouldn't be a problem though, because:

 1. All QMP fields are optional
 2. This feature has always been disabled

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Luiz Capitulino 2012-12-03 15:56:41 -02:00
parent 58513bde83
commit 01ceb97e7b
4 changed files with 2 additions and 79 deletions

24
hmp.c
View File

@ -465,29 +465,7 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdict)
return; return;
} }
monitor_printf(mon, "balloon: actual=%" PRId64, info->actual >> 20); monitor_printf(mon, "balloon: actual=%" PRId64 "\n", info->actual >> 20);
if (info->has_mem_swapped_in) {
monitor_printf(mon, " mem_swapped_in=%" PRId64, info->mem_swapped_in);
}
if (info->has_mem_swapped_out) {
monitor_printf(mon, " mem_swapped_out=%" PRId64, info->mem_swapped_out);
}
if (info->has_major_page_faults) {
monitor_printf(mon, " major_page_faults=%" PRId64,
info->major_page_faults);
}
if (info->has_minor_page_faults) {
monitor_printf(mon, " minor_page_faults=%" PRId64,
info->minor_page_faults);
}
if (info->has_free_mem) {
monitor_printf(mon, " free_mem=%" PRId64, info->free_mem);
}
if (info->has_total_mem) {
monitor_printf(mon, " total_mem=%" PRId64, info->total_mem);
}
monitor_printf(mon, "\n");
qapi_free_BalloonInfo(info); qapi_free_BalloonInfo(info);
} }

View File

@ -164,28 +164,6 @@ static uint32_t virtio_balloon_get_features(VirtIODevice *vdev, uint32_t f)
static void virtio_balloon_stat(void *opaque, BalloonInfo *info) static void virtio_balloon_stat(void *opaque, BalloonInfo *info)
{ {
VirtIOBalloon *dev = opaque; VirtIOBalloon *dev = opaque;
#if 0
/* Disable guest-provided stats for now. For more details please check:
* https://bugzilla.redhat.com/show_bug.cgi?id=623903
*
* If you do enable it (which is probably not going to happen as we
* need a new command for it), remember that you also need to fill the
* appropriate members of the BalloonInfo structure so that the stats
* are returned to the client.
*/
if (dev->vdev.guest_features & (1 << VIRTIO_BALLOON_F_STATS_VQ)) {
virtqueue_push(dev->svq, &dev->stats_vq_elem, dev->stats_vq_offset);
virtio_notify(&dev->vdev, dev->svq);
return;
}
#endif
/* Stats are not supported. Clear out any stale values that might
* have been set by a more featureful guest kernel.
*/
reset_stats(dev);
info->actual = ram_size - ((uint64_t) dev->actual << info->actual = ram_size - ((uint64_t) dev->actual <<
VIRTIO_BALLOON_PFN_SHIFT); VIRTIO_BALLOON_PFN_SHIFT);
} }
@ -255,8 +233,6 @@ VirtIODevice *virtio_balloon_init(DeviceState *dev)
s->dvq = virtio_add_queue(&s->vdev, 128, virtio_balloon_handle_output); s->dvq = virtio_add_queue(&s->vdev, 128, virtio_balloon_handle_output);
s->svq = virtio_add_queue(&s->vdev, 128, virtio_balloon_receive_stats); s->svq = virtio_add_queue(&s->vdev, 128, virtio_balloon_receive_stats);
reset_stats(s);
s->qdev = dev; s->qdev = dev;
register_savevm(dev, "virtio-balloon", -1, 1, register_savevm(dev, "virtio-balloon", -1, 1,
virtio_balloon_save, virtio_balloon_load, s); virtio_balloon_save, virtio_balloon_load, s);

View File

@ -977,28 +977,10 @@
# #
# @actual: the number of bytes the balloon currently contains # @actual: the number of bytes the balloon currently contains
# #
# @mem_swapped_in: #optional number of pages swapped in within the guest
#
# @mem_swapped_out: #optional number of pages swapped out within the guest
#
# @major_page_faults: #optional number of major page faults within the guest
#
# @minor_page_faults: #optional number of minor page faults within the guest
#
# @free_mem: #optional amount of memory (in bytes) free in the guest
#
# @total_mem: #optional amount of memory (in bytes) visible to the guest
#
# Since: 0.14.0 # Since: 0.14.0
# #
# Notes: all current versions of QEMU do not fill out optional information in
# this structure.
## ##
{ 'type': 'BalloonInfo', { 'type': 'BalloonInfo', 'data': {'actual': 'int' } }
'data': {'actual': 'int', '*mem_swapped_in': 'int',
'*mem_swapped_out': 'int', '*major_page_faults': 'int',
'*minor_page_faults': 'int', '*free_mem': 'int',
'*total_mem': 'int'} }
## ##
# @query-balloon: # @query-balloon:

View File

@ -2549,13 +2549,6 @@ Make an asynchronous request for balloon info. When the request completes a
json-object will be returned containing the following data: json-object will be returned containing the following data:
- "actual": current balloon value in bytes (json-int) - "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: Example:
@ -2563,12 +2556,6 @@ Example:
<- { <- {
"return":{ "return":{
"actual":1073741824, "actual":1073741824,
"mem_swapped_in":0,
"mem_swapped_out":0,
"major_page_faults":142,
"minor_page_faults":239245,
"free_mem":1014185984,
"total_mem":1044668416
} }
} }