def _get_pools(self): """Retrieve list of pools available to this backend.""" pools = [] aggr_space = self._get_aggregate_space() for aggr_name in sorted(aggr_space.keys()): total_capacity_gb = na_utils.round_down(float( aggr_space[aggr_name].get('total', 0)) / units.Gi, '0.01') free_capacity_gb = na_utils.round_down(float( aggr_space[aggr_name].get('available', 0)) / units.Gi, '0.01') allocated_capacity_gb = na_utils.round_down(float( aggr_space[aggr_name].get('used', 0)) / units.Gi, '0.01') pool = { 'pool_name': aggr_name, 'total_capacity_gb': total_capacity_gb, 'free_capacity_gb': free_capacity_gb, 'allocated_capacity_gb': allocated_capacity_gb, 'QoS_support': 'False', 'reserved_percentage': 0, } # Add storage service catalog data. pool_ssc_stats = self._ssc_stats.get(aggr_name) if pool_ssc_stats: pool.update(pool_ssc_stats) pools.append(pool) return pools
def _get_pools(self): """Retrieve list of pools available to this backend.""" pools = [] aggr_space = self._get_aggregate_space() for aggr_name in sorted(aggr_space.keys()): total_capacity_gb = na_utils.round_down(float(aggr_space[aggr_name].get("total", 0)) / units.Gi, "0.01") free_capacity_gb = na_utils.round_down(float(aggr_space[aggr_name].get("available", 0)) / units.Gi, "0.01") allocated_capacity_gb = na_utils.round_down(float(aggr_space[aggr_name].get("used", 0)) / units.Gi, "0.01") if total_capacity_gb == 0.0: total_capacity_gb = "unknown" pool = { "pool_name": aggr_name, "total_capacity_gb": total_capacity_gb, "free_capacity_gb": free_capacity_gb, "allocated_capacity_gb": allocated_capacity_gb, "QoS_support": "False", "reserved_percentage": 0, "dedupe": [True, False], "compression": [True, False], "thin_provisioning": [True, False], } # Add storage service catalog data. pool_ssc_stats = self._ssc_stats.get(aggr_name) if pool_ssc_stats: pool.update(pool_ssc_stats) pools.append(pool) return pools
def _get_pools(self): """Retrieve list of pools available to this backend.""" pools = [] aggr_space = self._get_aggregate_space() for aggr_name in sorted(aggr_space.keys()): total_capacity_gb = na_utils.round_down(float( aggr_space[aggr_name].get('total', 0)) / units.Gi, '0.01') free_capacity_gb = na_utils.round_down(float( aggr_space[aggr_name].get('available', 0)) / units.Gi, '0.01') allocated_capacity_gb = na_utils.round_down(float( aggr_space[aggr_name].get('used', 0)) / units.Gi, '0.01') if total_capacity_gb == 0.0: total_capacity_gb = 'unknown' pool = { 'pool_name': aggr_name, 'total_capacity_gb': total_capacity_gb, 'free_capacity_gb': free_capacity_gb, 'allocated_capacity_gb': allocated_capacity_gb, 'QoS_support': 'False', 'reserved_percentage': 0, } # Add storage service catalog data. pool_ssc_stats = self._ssc_stats.get(aggr_name) if pool_ssc_stats: pool.update(pool_ssc_stats) pools.append(pool) return pools
def test_round_down(self): self.assertAlmostEqual(na_utils.round_down(5.567), 5.56) self.assertAlmostEqual(na_utils.round_down(5.567, '0.00'), 5.56) self.assertAlmostEqual(na_utils.round_down(5.567, '0.0'), 5.5) self.assertAlmostEqual(na_utils.round_down(5.567, '0'), 5) self.assertAlmostEqual(na_utils.round_down(0, '0.00'), 0) self.assertAlmostEqual(na_utils.round_down(-5.567), -5.56) self.assertAlmostEqual(na_utils.round_down(-5.567, '0.00'), -5.56) self.assertAlmostEqual(na_utils.round_down(-5.567, '0.0'), -5.5) self.assertAlmostEqual(na_utils.round_down(-5.567, '0'), -5)
def get_share_stats(self): """Retrieve stats info from Data ONTAP backend.""" data = { 'share_backend_name': self._backend_name, 'driver_name': self.driver_name, 'vendor_name': 'NetApp', 'driver_version': '1.0', 'netapp_storage_family': 'ontap_cluster', 'storage_protocol': 'NFS_CIFS', 'total_capacity_gb': 0.0, 'free_capacity_gb': 0.0, } pools = [] aggr_space = self._get_aggregate_space() for aggr_name in sorted(aggr_space.keys()): total_capacity_gb = na_utils.round_down( float(aggr_space[aggr_name].get('total', 0)) / units.Gi, '0.01') free_capacity_gb = na_utils.round_down( float(aggr_space[aggr_name].get('available', 0)) / units.Gi, '0.01') allocated_capacity_gb = na_utils.round_down( float(aggr_space[aggr_name].get('used', 0)) / units.Gi, '0.01') pool = { 'pool_name': aggr_name, 'total_capacity_gb': total_capacity_gb, 'free_capacity_gb': free_capacity_gb, 'allocated_capacity_gb': allocated_capacity_gb, 'QoS_support': 'False', 'reserved_percentage': 0, } # Add storage service catalog data. pool_ssc_stats = self._ssc_stats.get(aggr_name) if pool_ssc_stats: pool.update(pool_ssc_stats) pools.append(pool) data['pools'] = pools return data
def get_share_stats(self): """Retrieve stats info from Data ONTAP backend.""" data = { 'share_backend_name': self._backend_name, 'driver_name': self.driver_name, 'vendor_name': 'NetApp', 'driver_version': '1.0', 'netapp_storage_family': 'ontap_cluster', 'storage_protocol': 'NFS_CIFS', 'total_capacity_gb': 0.0, 'free_capacity_gb': 0.0, } pools = [] aggr_space = self._get_aggregate_space() for aggr_name in sorted(aggr_space.keys()): total_capacity_gb = na_utils.round_down(float( aggr_space[aggr_name].get('total', 0)) / units.Gi, '0.01') free_capacity_gb = na_utils.round_down(float( aggr_space[aggr_name].get('available', 0)) / units.Gi, '0.01') allocated_capacity_gb = na_utils.round_down(float( aggr_space[aggr_name].get('used', 0)) / units.Gi, '0.01') pool = { 'pool_name': aggr_name, 'total_capacity_gb': total_capacity_gb, 'free_capacity_gb': free_capacity_gb, 'allocated_capacity_gb': allocated_capacity_gb, 'QoS_support': 'False', 'reserved_percentage': 0, } # Add storage service catalog data. pool_ssc_stats = self._ssc_stats.get(aggr_name) if pool_ssc_stats: pool.update(pool_ssc_stats) pools.append(pool) data['pools'] = pools return data