[pve-devel] [PATCH] RFC : qom ballon fix V1.
Alexandre Derumier
aderumier at odiso.com
Fri Mar 6 11:32:48 CET 2015
changelog:
- values are in bytes
- we need to skip values if they are = -1
(guest don't have yet reported values)
need to fix:
pvestatd seem to balloon under the ballon_min,
I wonder if it's not because total_mem is lower than actual
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
PVE/QemuServer.pm | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 2509a0a..ab2bbb3 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2493,9 +2493,11 @@ sub vmstatus {
my $d = $res->{$vmid};
if (defined($info->{stats}->{"stat-total-memory"}) && defined($info->{stats}->{"stat-free-memory"})) {
- $d->{balloon} = int($info->{stats}->{"stat-total-memory"}/1024/1024);
- $d->{freemem} = int($info->{stats}->{"stat-free-memory"}/1024/1024);
- $d->{mem} = $d->{maxmem} - $d->{freemem};
+ return if $info->{stats}->{"stat-total-memory"} eq "-1";
+
+ $d->{balloon} = $info->{stats}->{"stat-total-memory"};
+ $d->{freemem} = $info->{stats}->{"stat-free-memory"};
+ $d->{mem} = ($d->{maxmem}*1024*1024) - $d->{freemem};
}
};
@@ -2517,10 +2519,6 @@ sub vmstatus {
my ($vmid, $resp) = @_;
$qmpclient->queue_cmd($vmid, $blockstatscb, 'query-blockstats');
- # this fails if ballon driver is not loaded, so this must be
- # the last commnand (following command are aborted if this fails).
- # maybe is it fixed by
- #http://git.qemu.org/?p=qemu.git;a=commit;h=38dbd48b247ebe05bdc6ef52ccdc60cc21274877
$qmpclient->queue_cmd($vmid, $ballooncb, 'qom-get',
path => "machine/peripheral/balloon0",
--
1.7.10.4
More information about the pve-devel
mailing list