
Can you align your if statements so that the next line is under the first argument (not right under the if). So something like: if virt == 'Xen' and \ curr_cim_rev This makes the if statement a little easier to read.
curr_cim_rev, changeset = get_provider_version(virt, server) - if 'DiskPool' in ap['InstanceID'] and virt =='Xen' and \ - curr_cim_rev >= libvirt_rasd_template_changes: + if 'DiskPool' in ap['InstanceID']: + if virt =='Xen' and \ + curr_cim_rev >= libvirt_rasd_template_changes and \ + curr_cim_rev < libvirt_rasd_new_changes: # For Diskpool, we have info 1 for each of Min, Max, # default, Increment and 1 for each of PV and FV # hence 4 * 2 = 8 records - exp_len = 8 + exp_len = 8 + if virt == 'Xen' and \ + curr_cim_rev >= libvirt_rasd_new_changes: + exp_len = 16
For this, you could do: if 'DiskPool' in ap['InstanceID']: if virt =='Xen': if curr_cim_rev >= libvirt_rasd_template_changes and \ curr_cim_rev < libvirt_rasd_new_changes: ... if curr_cim_rev >= libvirt_rasd_new_changes: ...
+ if virt == 'KVM' and \ + curr_cim_rev >= libvirt_rasd_new_changes: + exp_len = 8 else: exp_len = 4
Remove this else. Instead, before if if 'DiskPool' in ap['InstanceID']: line, set exp_len = 4. That way exp_len will always be set to some value. Because how you have it here, if the virt is Xen but one of the if statements doesn't match, then exp_len isn't set. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com