5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-03-10 12:58:25 +03:00

use new query-balloon to get used/free memory

Also set stats-polling-interval on the balloon driver at startup.

bump version to 2.3-2
This commit is contained in:
Dietmar Maurer 2012-12-18 12:36:18 +01:00
parent 91bd6c909b
commit 64e7fcf2e2
3 changed files with 36 additions and 4 deletions

View File

@ -2,7 +2,7 @@ RELEASE=2.3
VERSION=2.3
PACKAGE=qemu-server
PKGREL=1
PKGREL=2
DESTDIR=
PREFIX=/usr

View File

@ -2027,6 +2027,25 @@ sub vmstatus {
my $qmpclient = PVE::QMPClient->new();
my $ballooncb = sub {
my ($vmid, $resp) = @_;
my $info = $resp->{'return'};
return if !$info->{max_mem};
my $d = $res->{$vmid};
# use memory assigned to VM
$d->{maxmem} = $info->{max_mem};
$d->{balloon} = $info->{actual};
if (defined($info->{total_mem}) && defined($info->{free_mem})) {
$d->{mem} = $info->{total_mem} - $info->{free_mem};
$d->{freemem} = $info->{free_mem};
}
};
my $blockstatscb = sub {
my ($vmid, $resp) = @_;
my $data = $resp->{'return'} || [];
@ -2042,7 +2061,11 @@ sub vmstatus {
my $statuscb = sub {
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).
$qmpclient->queue_cmd($vmid, $ballooncb, 'query-balloon');
my $status = 'unknown';
if (!defined($status = $resp->{'return'}->{status})) {
@ -2957,10 +2980,13 @@ sub vm_start {
$capabilities->{capability} = "xbzrle";
$capabilities->{state} = JSON::true;
eval { PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "migrate-set-capabilities", capabilities => [$capabilities]); };
} elsif ($conf->{balloon}) {
vm_balloonset($vmid, $conf->{balloon});
vm_mon_cmd($vmid, 'qom-set',
path => "machine/peripheral/balloon0",
property => "stats-polling-interval",
value => 2);
}
vm_balloonset($vmid, $conf->{balloon}) if $conf->{balloon};
});
}

View File

@ -1,3 +1,9 @@
qemu-server (2.3-2) unstable; urgency=low
* use memory info from ballon driver (if enabled)
-- Proxmox Support Team <support@proxmox.com> Tue, 18 Dec 2012 12:51:57 +0100
qemu-server (2.3-1) unstable; urgency=low
* include new qemu backup feature