Skip to content

Commit

Permalink
CA-390512: Improved xenapi error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerald Elder-Vass committed Jul 23, 2024
1 parent 54d9b4f commit 4a219f3
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions XSConsoleData.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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' : {
Expand Down

0 comments on commit 4a219f3

Please sign in to comment.