]> git.proxmox.com Git - pve-qemu-kvm.git/blobdiff - debian/patches/virtio-balloon-fix-query.patch
Two more fixes
[pve-qemu-kvm.git] / debian / patches / virtio-balloon-fix-query.patch
index 649211c1e98bf9a1ef1a9a88daca758c93a36cb5..97574d798641fd2202a9846ea40ac0fd451ece93 100644 (file)
@@ -1,8 +1,8 @@
 Index: new/hmp.c
 ===================================================================
---- new.orig/hmp.c     2014-06-17 06:14:28.000000000 +0200
-+++ new/hmp.c  2014-06-17 06:14:58.000000000 +0200
-@@ -536,7 +536,35 @@
+--- new.orig/hmp.c     2014-11-20 06:45:05.000000000 +0100
++++ new/hmp.c  2014-11-20 07:26:23.000000000 +0100
+@@ -635,7 +635,35 @@
          return;
      }
  
@@ -41,18 +41,23 @@ Index: new/hmp.c
  }
 Index: new/hw/virtio/virtio-balloon.c
 ===================================================================
---- new.orig/hw/virtio/virtio-balloon.c        2014-06-17 06:14:28.000000000 +0200
-+++ new/hw/virtio/virtio-balloon.c     2014-06-17 06:14:58.000000000 +0200
-@@ -305,6 +305,35 @@
+--- new.orig/hw/virtio/virtio-balloon.c        2014-11-20 06:45:06.000000000 +0100
++++ new/hw/virtio/virtio-balloon.c     2014-11-20 07:26:23.000000000 +0100
+@@ -319,8 +319,37 @@
+ static void virtio_balloon_stat(void *opaque, BalloonInfo *info)
+ {
      VirtIOBalloon *dev = opaque;
-     info->actual = ram_size - ((uint64_t) dev->actual <<
-                                VIRTIO_BALLOON_PFN_SHIFT);
+-    info->actual = get_current_ram_size() - ((uint64_t) dev->actual <<
+-                                             VIRTIO_BALLOON_PFN_SHIFT);
++    ram_addr_t ram_size = get_current_ram_size();
++    info->actual = ram_size - ((uint64_t) dev->actual <<
++                               VIRTIO_BALLOON_PFN_SHIFT);
 +
 +    info->max_mem = ram_size;
 +
 +    if (!(balloon_stats_enabled(dev) && balloon_stats_supported(dev) &&
-+          dev->stats_last_update)) {
-+      return;
++           dev->stats_last_update)) {
++       return;
 +    }
 +
 +    info->last_update = dev->stats_last_update;
@@ -75,21 +80,14 @@ Index: new/hw/virtio/virtio-balloon.c
 +
 +    info->total_mem = dev->stats[VIRTIO_BALLOON_S_MEMTOT];
 +    info->has_total_mem = info->total_mem >= 0 ? true : false;
-+
  }
  
  static void virtio_balloon_to_target(void *opaque, ram_addr_t target)
 Index: new/qapi-schema.json
 ===================================================================
---- new.orig/qapi-schema.json  2014-06-17 06:14:28.000000000 +0200
-+++ new/qapi-schema.json       2014-06-17 06:14:58.000000000 +0200
-@@ -815,15 +815,34 @@
- ##
- # @BalloonInfo:
--#
-+# 
- # Information about the guest balloon device.
+--- new.orig/qapi-schema.json  2014-11-20 06:45:06.000000000 +0100
++++ new/qapi-schema.json       2014-11-20 07:26:23.000000000 +0100
+@@ -983,10 +983,29 @@
  #
  # @actual: the number of bytes the balloon currently contains
  #
@@ -112,8 +110,8 @@ Index: new/qapi-schema.json
 +# 
 +# Since: 0.14.0
  ##
--{ 'type': 'BalloonInfo', 'data': {'actual': 'int' } }
-+{ 'type': 'BalloonInfo',
+-{ 'struct': 'BalloonInfo', 'data': {'actual': 'int' } }
++{ 'struct': 'BalloonInfo',
 +  'data': {'actual': 'int', '*last_update': 'int', '*mem_swapped_in': 'int',
 +           '*mem_swapped_out': 'int', '*major_page_faults': 'int',
 +           '*minor_page_faults': 'int', '*free_mem': 'int',
@@ -123,9 +121,9 @@ Index: new/qapi-schema.json
  # @query-balloon:
 Index: new/qmp-commands.hx
 ===================================================================
---- new.orig/qmp-commands.hx   2014-06-17 06:14:28.000000000 +0200
-+++ new/qmp-commands.hx        2014-06-17 06:14:58.000000000 +0200
-@@ -3162,6 +3162,13 @@
+--- new.orig/qmp-commands.hx   2014-11-20 06:45:06.000000000 +0100
++++ new/qmp-commands.hx        2014-11-20 07:26:23.000000000 +0100
+@@ -3329,6 +3329,13 @@
  json-object will be returned containing the following data:
  
  - "actual": current balloon value in bytes (json-int)
@@ -139,7 +137,7 @@ Index: new/qmp-commands.hx
  
  Example:
  
-@@ -3169,6 +3176,12 @@
+@@ -3336,6 +3344,12 @@
  <- {
        "return":{
           "actual":1073741824,