From 04fa63f08132098218aa6bbdf14d2ccab65b8cb5 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Wed, 23 Jun 2021 05:15:48 -0400 Subject: [PATCH] Only hit the network endpoint once Otherwise this is hit for every VM which gets very slow very fast. --- client-cli/pvc/cli_lib/vm.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client-cli/pvc/cli_lib/vm.py b/client-cli/pvc/cli_lib/vm.py index 65722255..f1d5848f 100644 --- a/client-cli/pvc/cli_lib/vm.py +++ b/client-cli/pvc/cli_lib/vm.py @@ -1397,6 +1397,9 @@ def format_list(config, vm_list, raw): ) ) + # Get a list of cluster networks for validity comparisons + cluster_net_list = call_api(config, 'get', '/network').json() + # Format the string (elements) for domain_information in vm_list: if domain_information['state'] == 'start': @@ -1414,7 +1417,6 @@ def format_list(config, vm_list, raw): # Handle colouring for an invalid network config net_list = getNiceNetID(domain_information) - cluster_net_list = call_api(config, 'get', '/network').json() vm_net_colour = '' for net_vni in net_list: if net_vni not in ['cluster', 'storage', 'upstream'] and not re.match(r'^macvtap:.*', net_vni) and not re.match(r'^hostdev:.*', net_vni):