This fixes the situation when the actual netapp
volume data structure becomes inconsistent
because of operating on the actual object
than the copy of it. It also introduces some checks
before calculating volume stats.
Change-Id: I626f9ca9aa8c7cc41ba4aa6058f14cc040f7301f
Closes-Bug:#
1243081
data['netapp_thick_provisioned'] = 'true'\
if len(self.ssc_vols['all']) >\
len(self.ssc_vols['thin']) else 'false'
- vol_max = max(self.ssc_vols['all'])
- data['total_capacity_gb'] =\
- int(vol_max.space['size_total_bytes']) / units.GiB
- data['free_capacity_gb'] =\
- int(vol_max.space['size_avl_bytes']) / units.GiB
+ if self.ssc_vols['all']:
+ vol_max = max(self.ssc_vols['all'])
+ data['total_capacity_gb'] =\
+ int(vol_max.space['size_total_bytes']) / units.GiB
+ data['free_capacity_gb'] =\
+ int(vol_max.space['size_avl_bytes']) / units.GiB
+ else:
+ data['total_capacity_gb'] = 0
+ data['free_capacity_gb'] = 0
else:
LOG.warn(_("Cluster ssc is not updated. No volume stats found."))
ssc_utils.refresh_cluster_ssc(self, self.client, self.vserver)
data['netapp_thick_provisioned'] = 'true'\
if len(self.ssc_vols['all']) >\
len(self.ssc_vols['thin']) else 'false'
- vol_max = max(self.ssc_vols['all'])
- data['total_capacity_gb'] =\
- int(vol_max.space['size_total_bytes']) / units.GiB
- data['free_capacity_gb'] =\
- int(vol_max.space['size_avl_bytes']) / units.GiB
+ if self.ssc_vols['all']:
+ vol_max = max(self.ssc_vols['all'])
+ data['total_capacity_gb'] =\
+ int(vol_max.space['size_total_bytes']) / units.GiB
+ data['free_capacity_gb'] =\
+ int(vol_max.space['size_avl_bytes']) / units.GiB
+ else:
+ data['total_capacity_gb'] = 0
+ data['free_capacity_gb'] = 0
elif self.ssc_enabled:
LOG.warn(_("No cluster ssc stats found."
" Wait for next volume stats update."))
"""Shortlists volumes for extra specs provided."""
if specs is None or not isinstance(specs, dict):
return ssc_vols['all']
- result = ssc_vols['all']
+ result = copy.deepcopy(ssc_vols['all'])
raid_type = specs.get('netapp:raid_type')
disk_type = specs.get('netapp:disk_type')
qos_policy_group = specs.get('netapp:qos_policy_group')