From 072960726fbf377927a79e21427bd9d9640ae900 Mon Sep 17 00:00:00 2001 From: Dimitris Moraitis Date: Fri, 18 Nov 2022 17:45:30 +0200 Subject: [PATCH] Add defensive check when fetching KVM machines, fixes issue with non-responding hosts --- src/mist/api/clouds/controllers/compute/controllers.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/mist/api/clouds/controllers/compute/controllers.py b/src/mist/api/clouds/controllers/compute/controllers.py index 6cf5e9be7..5c7b94267 100644 --- a/src/mist/api/clouds/controllers/compute/controllers.py +++ b/src/mist/api/clouds/controllers/compute/controllers.py @@ -4951,9 +4951,13 @@ def _get_host_driver(self, machine): return driver def list_machines_single_host(self, host): - driver = self._get_host_driver(host) - return driver.list_nodes( - parse_arp_table=config.LIBVIRT_PARSE_ARP_TABLES) + try: + driver = self._get_host_driver(host) + return driver.list_nodes( + parse_arp_table=config.LIBVIRT_PARSE_ARP_TABLES) + except Exception as e: + log.error('Failed to get machines from host: %s', host) + return [] async def list_machines_all_hosts(self, hosts, loop): vms = [