Пример #1
0
    def update_share_stats(self, stats_dict):
        """Communicate with EMCNASClient to get the stats."""
        stats_dict['driver_version'] = VERSION

        self._get_context('Mover').get_ref(self.mover_name, True)

        stats_dict['pools'] = []

        status, pools = self._get_context('StoragePool').get_all()
        for name, pool in pools.items():
            if not self.pools or pool['name'] in self.pools:
                total_size = float(pool['total_size'])
                used_size = float(pool['used_size'])

                pool_stat = dict(
                    pool_name=pool['name'],
                    total_capacity_gb=enas_utils.mb_to_gb(total_size),
                    free_capacity_gb=enas_utils.mb_to_gb(total_size -
                                                         used_size),
                    qos=False,
                    reserved_percentage=self.reserved_percentage,
                    reserved_snapshot_percentage=(
                        self.reserved_snapshot_percentage),
                )
                stats_dict['pools'].append(pool_stat)

        if not stats_dict['pools']:
            message = _("Failed to update storage pool.")
            LOG.error(message)
            raise exception.EMCVnxXMLAPIError(err=message)
Пример #2
0
    def update_share_stats(self, stats_dict):
        """Communicate with EMCNASClient to get the stats."""
        stats_dict['driver_version'] = VERSION

        self._get_context('Mover').get_ref(self.mover_name, True)

        stats_dict['pools'] = []

        status, pools = self._get_context('StoragePool').get_all()
        for name, pool in pools.items():
            if not self.pools or pool['name'] in self.pools:
                total_size = float(pool['total_size'])
                used_size = float(pool['used_size'])

                pool_stat = {
                    'pool_name': pool['name'],
                    'total_capacity_gb': enas_utils.mb_to_gb(total_size),
                    'free_capacity_gb':
                    enas_utils.mb_to_gb(total_size - used_size),
                    'qos': False,
                    'reserved_percentage': self.reserved_percentage,
                    'reserved_snapshot_percentage':
                    self.reserved_snapshot_percentage,
                    'snapshot_support': True,
                    'create_share_from_snapshot_support': True,
                    'revert_to_snapshot_support': False,
                    'ipv6_support': True
                }
                stats_dict['pools'].append(pool_stat)

        if not stats_dict['pools']:
            message = _("Failed to update storage pool.")
            LOG.error(message)
            raise exception.EMCPowerMaxXMLAPIError(err=message)
Пример #3
0
 def test_mb_to_gb(self, size_in_mb, size_in_gb):
     self.assertEqual(size_in_gb, utils.mb_to_gb(size_in_mb))