mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-29 07:10:36 +00:00
vm status: force int where appropriate
to avoid potential problems with stringified numbers in Javascript and elsewehere. The vmid was not always an integer as the return schema expects, namely when there was an opt_vmid argument, because the 'ne' comparision coerced the vmid to be a string then. Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
parent
ef88eaaa58
commit
ad2cad72be
@ -2651,8 +2651,8 @@ sub vmstatus {
|
|||||||
|
|
||||||
my $conf = PVE::QemuConfig->load_config($vmid);
|
my $conf = PVE::QemuConfig->load_config($vmid);
|
||||||
|
|
||||||
my $d = { vmid => $vmid };
|
my $d = { vmid => int($vmid) };
|
||||||
$d->{pid} = $list->{$vmid}->{pid};
|
$d->{pid} = int($list->{$vmid}->{pid});
|
||||||
|
|
||||||
# fixme: better status?
|
# fixme: better status?
|
||||||
$d->{status} = $list->{$vmid}->{pid} ? 'running' : 'stopped';
|
$d->{status} = $list->{$vmid}->{pid} ? 'running' : 'stopped';
|
||||||
@ -2711,8 +2711,8 @@ sub vmstatus {
|
|||||||
$d->{netin} += $netdev->{$dev}->{transmit};
|
$d->{netin} += $netdev->{$dev}->{transmit};
|
||||||
|
|
||||||
if ($full) {
|
if ($full) {
|
||||||
$d->{nics}->{$dev}->{netout} = $netdev->{$dev}->{receive};
|
$d->{nics}->{$dev}->{netout} = int($netdev->{$dev}->{receive});
|
||||||
$d->{nics}->{$dev}->{netin} = $netdev->{$dev}->{transmit};
|
$d->{nics}->{$dev}->{netin} = int($netdev->{$dev}->{transmit});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user