From 4a219f3c4266e2a08aea95968d435b267ca4c9ae Mon Sep 17 00:00:00 2001 From: Gerald Elder-Vass Date: Tue, 23 Jul 2024 10:22:01 +0000 Subject: [PATCH] CA-390512: Improved xenapi error handling --- XSConsoleData.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/XSConsoleData.py b/XSConsoleData.py index 9cbd762..5231d6f 100644 --- a/XSConsoleData.py +++ b/XSConsoleData.py @@ -209,8 +209,7 @@ def Update(self): # NULL or dangling reference self.data['host']['crash_dump_sr'] = None - convertCPU = lambda cpu: self.session.xenapi.host_cpu.get_record(cpu) - self.data['host']['host_CPUs'] = list(map(convertCPU, self.data['host']['host_CPUs'])) + self.UpdateHostCPUs() def convertPIF(inPIF): retVal = self.session.xenapi.PIF.get_record(inPIF) @@ -360,6 +359,17 @@ def update_SR_reference(inPool, retPool, key): self.DeriveData() + def UpdateHostCPUs(self): + convertCPU = lambda cpu: self.session.xenapi.host_cpu.get_record(cpu) + hostCPUs = list(map(convertCPU, self.data['host']['host_CPUs'])) + + self.data['host']['host_CPUs'] = [] + for cpu in hostCPUs: + if 'HANDLE_INVALID' in cpu: + XSLogError('xenapi host_cpu: ' + ', '.join(cpu)) + else: + self.data['host']['host_CPUs'].append(cpu) + def DeriveData(self): self.data.update({ 'derived' : {