mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-14 03:57:40 +00:00
api: cluster/resources: add information about guest locks
using the new get_guest_config_property helper from pve-cluster, which allows us to get this info with relatively low overhead. With a somewhat realistic setup of 303 guest configurations here my API call timing changes from ~ 24 to 26 ms without this to 26 to 28 ms with this patch applied, which seems reasonable. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
68f371d4d1
commit
f79372c0dc
@ -297,10 +297,17 @@ __PACKAGE__->register_method({
|
||||
|
||||
# we try to generate 'numbers' by using "$X + 0"
|
||||
if (!$param->{type} || $param->{type} eq 'vm') {
|
||||
my $locked_vms = PVE::Cluster::get_guest_config_property('lock');
|
||||
|
||||
foreach my $vmid (keys %$idlist) {
|
||||
|
||||
my $data = $idlist->{$vmid};
|
||||
my $entry = PVE::API2Tools::extract_vm_stats($vmid, $data, $rrd);
|
||||
|
||||
if (defined(my $lock = $locked_vms->{$vmid}->{lock})) {
|
||||
$entry->{lock} = $lock;
|
||||
}
|
||||
|
||||
if (my $pool = $usercfg->{vms}->{$vmid}) {
|
||||
$entry->{pool} = $pool;
|
||||
if (my $pe = $pooldata->{$pool}) {
|
||||
|
Loading…
Reference in New Issue
Block a user