Beispiel #1
0
    def _update_volume_stats(self):
        """Retrieve stats info for NexentaStor appliance."""
        LOG.debug("Updating volume stats")
        total_space = 0
        free_space = 0
        shares_with_capacities = {}
        for mounted_share in self._mounted_shares:
            total, free, allocated = self._get_capacity_info(mounted_share)
            shares_with_capacities[mounted_share] = utils.str2gib_size(total)
            if total_space < utils.str2gib_size(total):
                total_space = utils.str2gib_size(total)
            if free_space < utils.str2gib_size(free):
                free_space = utils.str2gib_size(free)
                share = mounted_share

        location_info = "%(driver)s:%(share)s" % {"driver": self.__class__.__name__, "share": share}
        nms_url = self.share2nms[share].url
        self._stats = {
            "vendor_name": "Nexenta",
            "dedup": self.volume_deduplication,
            "compression": self.volume_compression,
            "description": self.volume_description,
            "nms_url": nms_url,
            "ns_shares": shares_with_capacities,
            "driver_version": self.VERSION,
            "storage_protocol": "NFS",
            "total_capacity_gb": total_space,
            "free_capacity_gb": free_space,
            "reserved_percentage": self.configuration.reserved_percentage,
            "QoS_support": False,
            "location_info": location_info,
            "volume_backend_name": self.backend_name,
            "nfs_mount_point_base": self.nfs_mount_point_base,
        }
Beispiel #2
0
    def _update_volume_stats(self):
        """Retrieve stats info for NexentaStor appliance."""
        LOG.debug("Updating volume stats")
        share = ":/".join([self.nef_host, self.share])
        total, free, allocated = self._get_capacity_info(self.share)
        total_space = utils.str2gib_size(total)
        free_space = utils.str2gib_size(free)

        location_info = "%(driver)s:%(share)s" % {"driver": self.__class__.__name__, "share": share}
        self._stats = {
            "vendor_name": "Nexenta",
            "dedup": self.dataset_deduplication,
            "compression": self.dataset_compression,
            "description": self.dataset_description,
            "nef_url": self.nef_host,
            "driver_version": self.VERSION,
            "storage_protocol": "NFS",
            "total_capacity_gb": total_space,
            "free_capacity_gb": free_space,
            "reserved_percentage": self.configuration.reserved_percentage,
            "QoS_support": False,
            "location_info": location_info,
            "volume_backend_name": self.backend_name,
            "nfs_mount_point_base": self.nfs_mount_point_base,
        }
Beispiel #3
0
 def test_str2gib_size(self):
     self.assertEqual(utils.str2gib_size('1024M'), 1)
     self.assertEqual(utils.str2gib_size('300M'),
                      300 * units.MiB // units.GiB)
     self.assertEqual(utils.str2gib_size('1.2T'),
                      1.2 * units.TiB // units.GiB)
     self.assertRaises(ValueError, utils.str2gib_size, 'A')
Beispiel #4
0
    def _update_volume_stats(self):
        """Retrieve stats info for NexentaStor appliance."""
        LOG.debug('Updating volume stats')

        url = 'storage/pools/%(pool)s/volumeGroups/%(group)s' % {
            'pool': self.storage_pool,
            'group': self.volume_group,
        }
        stats = self.nef.get(url)
        total_amount = utils.str2gib_size(stats['bytesAvailable'])
        free_amount = utils.str2gib_size(
            stats['bytesAvailable'] - stats['bytesUsed'])

        location_info = '%(driver)s:%(host)s:%(pool)s/%(group)s' % {
            'driver': self.__class__.__name__,
            'host': self.nef_host,
            'pool': self.storage_pool,
            'group': self.volume_group,
        }
        self._stats = {
            'vendor_name': 'Nexenta',
            'dedup': self.dataset_deduplication,
            'compression': self.dataset_compression,
            'description': self.dataset_description,
            'driver_version': self.VERSION,
            'storage_protocol': 'iSCSI',
            'total_capacity_gb': total_amount,
            'free_capacity_gb': free_amount,
            'reserved_percentage': self.configuration.reserved_percentage,
            'QoS_support': False,
            'volume_backend_name': self.backend_name,
            'location_info': location_info,
            'iscsi_target_portal_port': self.iscsi_target_portal_port,
            'nef_url': self.nef.url
        }
Beispiel #5
0
    def _update_volume_stats(self):
        """Retrieve stats info for NexentaStor appliance."""
        LOG.debug('Updating volume stats')

        stats = self.nms.volume.get_child_props(
            self.configuration.nexenta_volume, 'health|size|used|available')

        total_amount = utils.str2gib_size(stats['size'])
        free_amount = utils.str2gib_size(stats['available'])

        location_info = '%(driver)s:%(host)s:%(volume)s' % {
            'driver': self.__class__.__name__,
            'host': self.nms_host,
            'volume': self.volume
        }
        self._stats = {
            'vendor_name': 'Nexenta',
            'dedup': self.volume_deduplication,
            'compression': self.volume_compression,
            'description': self.volume_description,
            'driver_version': self.VERSION,
            'storage_protocol': 'iSCSI',
            'total_capacity_gb': total_amount,
            'free_capacity_gb': free_amount,
            'reserved_percentage': self.configuration.reserved_percentage,
            'QoS_support': False,
            'volume_backend_name': self.backend_name,
            'location_info': location_info,
            'iscsi_target_portal_port': self.iscsi_target_portal_port,
            'nms_url': self.nms.url
        }
Beispiel #6
0
    def _update_volume_stats(self):
        """Retrieve stats info for NexentaStor appliance."""
        LOG.debug('Updating volume stats')

        stats = self.nms.volume.get_child_props(
            self.configuration.nexenta_volume, 'health|size|used|available')

        total_amount = utils.str2gib_size(stats['size'])
        free_amount = utils.str2gib_size(stats['available'])

        location_info = '%(driver)s:%(host)s:%(volume)s' % {
            'driver': self.__class__.__name__,
            'host': self.nms_host,
            'volume': self.volume
        }
        self._stats = {
            'vendor_name': 'Nexenta',
            'dedup': self.volume_deduplication,
            'compression': self.volume_compression,
            'description': self.volume_description,
            'driver_version': self.VERSION,
            'storage_protocol': 'iSCSI',
            'total_capacity_gb': total_amount,
            'free_capacity_gb': free_amount,
            'reserved_percentage': self.configuration.reserved_percentage,
            'QoS_support': False,
            'volume_backend_name': self.backend_name,
            'location_info': location_info,
            'iscsi_target_portal_port': self.iscsi_target_portal_port,
            'nms_url': self.nms.url
        }
Beispiel #7
0
    def _update_volume_stats(self):
        """Retrieve stats info for NexentaStor appliance."""
        LOG.debug('Updating volume stats')
        total, free, allocated = self._get_capacity_info(self.share)
        total_space = utils.str2gib_size(total)
        free_space = utils.str2gib_size(free)
        share = ':/'.join([self.nas_host, self.share])

        location_info = '%(driver)s:%(share)s' % {
            'driver': self.__class__.__name__,
            'share': share
        }
        self._stats = {
            'vendor_name': 'Nexenta',
            'compression': self.dataset_compression,
            'description': self.dataset_description,
            'nef_url': self.nef_host,
            'nef_port': self.nef_port,
            'driver_version': self.VERSION,
            'storage_protocol': 'NFS',
            'sparsed_volumes': self.sparsed_volumes,
            'total_capacity_gb': total_space,
            'free_capacity_gb': free_space,
            'reserved_percentage': self.configuration.reserved_percentage,
            'QoS_support': False,
            'multiattach': True,
            'location_info': location_info,
            'volume_backend_name': self.backend_name,
            'nfs_mount_point_base': self.nfs_mount_point_base
        }
Beispiel #8
0
 def get_volume_stats(self, refresh=False):
     LOG.debug("Get volume stats")
     try:
         resp = self.restapi.get("system/stats")
         location_info = "%(driver)s:%(host)s:%(bucket)s" % {
             "driver": self.__class__.__name__,
             "host": self.hostname,
             "bucket": self.bucket_path,
         }
         summary = resp["stats"]["summary"]
         total = nexenta_utils.str2gib_size(summary["total_capacity"])
         free = nexenta_utils.str2gib_size(summary["total_available"])
         return {
             "vendor_name": "Nexenta",
             "driver_version": self.VERSION,
             "storage_protocol": "NBD",
             "reserved_percentage": self.reserved_percentage,
             "total_capacity_gb": total,
             "free_capacity_gb": free,
             "QoS_support": False,
             "volume_backend_name": self.backend_name,
             "location_info": location_info,
             "restapi_url": self.restapi.url,
         }
     except exception.VolumeBackendAPIException:
         with excutils.save_and_reraise_exception():
             LOG.exception(_LE("Error creating snapshot"))
Beispiel #9
0
    def _update_volume_stats(self):
        """Retrieve stats info for NexentaStor appliance."""
        LOG.debug('Updating volume stats')

        url = 'storage/volumeGroups/%s?fields=bytesAvailable,bytesUsed' % (
            '%2F'.join([self.storage_pool, self.volume_group]))
        stats = self.nef.get(url)
        free = utils.str2gib_size(stats['bytesAvailable'])
        allocated = utils.str2gib_size(stats['bytesUsed'])

        location_info = '%(driver)s:%(host)s:%(pool)s/%(group)s' % {
            'driver': self.__class__.__name__,
            'host': self.iscsi_host,
            'pool': self.storage_pool,
            'group': self.volume_group,
        }
        self._stats = {
            'vendor_name': 'Nexenta',
            'dedup': self.dataset_deduplication,
            'compression': self.dataset_compression,
            'description': self.dataset_description,
            'driver_version': self.VERSION,
            'storage_protocol': 'iSCSI',
            'sparsed_volumes': self.configuration.nexenta_sparse,
            'total_capacity_gb': free + allocated,
            'free_capacity_gb': free,
            'reserved_percentage': self.configuration.reserved_percentage,
            'QoS_support': False,
            'volume_backend_name': self.backend_name,
            'location_info': location_info,
            'iscsi_target_portal_port': self.iscsi_target_portal_port,
            'nef_url': self.nef.url
        }
Beispiel #10
0
 def get_volume_stats(self, refresh=False):
     LOG.debug('Get volume stats')
     try:
         resp = self.restapi.get('system/stats')
         location_info = '%(driver)s:%(host)s:%(bucket)s' % {
             'driver': self.__class__.__name__,
             'host': self.hostname,
             'bucket': self.bucket_path
         }
         summary = resp['stats']['summary']
         total = nexenta_utils.str2gib_size(summary['total_capacity'])
         free = nexenta_utils.str2gib_size(summary['total_available'])
         return {
             'vendor_name': 'Nexenta',
             'driver_version': self.VERSION,
             'storage_protocol': 'NBD',
             'reserved_percentage': self.reserved_percentage,
             'total_capacity_gb': total,
             'free_capacity_gb': free,
             'QoS_support': False,
             'volume_backend_name': self.backend_name,
             'location_info': location_info,
             'restapi_url': self.restapi.url
         }
     except exception.VolumeBackendAPIException:
         with excutils.save_and_reraise_exception():
             LOG.exception('Error creating snapshot')
Beispiel #11
0
 def get_volume_stats(self, refresh=False):
     LOG.debug('Get volume stats')
     try:
         resp = self.restapi.get('system/stats')
         location_info = '%(driver)s:%(host)s:%(bucket)s' % {
             'driver': self.__class__.__name__,
             'host': self.hostname,
             'bucket': self.bucket_path
         }
         summary = resp['stats']['summary']
         total = nexenta_utils.str2gib_size(summary['total_capacity'])
         free = nexenta_utils.str2gib_size(summary['total_available'])
         return {
             'vendor_name': 'Nexenta',
             'driver_version': self.VERSION,
             'storage_protocol': 'NBD',
             'reserved_percentage': self.reserved_percentage,
             'total_capacity_gb': total,
             'free_capacity_gb': free,
             'QoS_support': False,
             'volume_backend_name': self.backend_name,
             'location_info': location_info,
             'restapi_url': self.restapi.url
         }
     except exception.VolumeBackendAPIException:
         with excutils.save_and_reraise_exception():
             LOG.exception(_LE('Error creating snapshot'))
Beispiel #12
0
    def _update_volume_stats(self):
        """Retrieve stats info for NexentaStor appliance."""
        LOG.debug('Updating volume stats')
        share = ':/'.join([self.nef_host, self.share])
        total, free, allocated = self._get_capacity_info(self.share)
        total_space = utils.str2gib_size(total)
        free_space = utils.str2gib_size(free)

        location_info = '%(driver)s:%(share)s' % {
            'driver': self.__class__.__name__,
            'share': share
        }
        self._stats = {
            'vendor_name': 'Nexenta',
            'dedup': self.dataset_deduplication,
            'compression': self.dataset_compression,
            'description': self.dataset_description,
            'nef_url': self.nef_host,
            'driver_version': self.VERSION,
            'storage_protocol': 'NFS',
            'total_capacity_gb': total_space,
            'free_capacity_gb': free_space,
            'reserved_percentage': self.configuration.reserved_percentage,
            'QoS_support': False,
            'location_info': location_info,
            'volume_backend_name': self.backend_name,
            'nfs_mount_point_base': self.nfs_mount_point_base
        }
Beispiel #13
0
 def test_str2gib_size(self):
     self.assertEqual(1, utils.str2gib_size('1024M'))
     self.assertEqual(300 * units.Mi // units.Gi,
                      utils.str2gib_size('300M'))
     self.assertEqual(1.2 * units.Ti // units.Gi,
                      utils.str2gib_size('1.2T'))
     self.assertRaises(ValueError, utils.str2gib_size, 'A')
Beispiel #14
0
 def test_str2gib_size(self):
     self.assertEqual(1, utils.str2gib_size('1024M'))
     self.assertEqual(300 * units.Mi // units.Gi,
                      utils.str2gib_size('300M'))
     self.assertEqual(1.2 * units.Ti // units.Gi,
                      utils.str2gib_size('1.2T'))
     self.assertRaises(ValueError, utils.str2gib_size, 'A')
 def test_str2gib_size(self):
     self.assertEqual(utils.str2gib_size('1024M'), 1)
     self.assertEqual(utils.str2gib_size('300M'),
                      300 * units.MiB // units.GiB)
     self.assertEqual(utils.str2gib_size('1.2T'),
                      1.2 * units.TiB // units.GiB)
     self.assertRaises(ValueError, utils.str2gib_size, 'A')
Beispiel #16
0
    def _get_capacity_info(self, nfs_share):
        """Calculate available space on the NFS share.

        :param nfs_share: example 172.18.194.100:/var/nfs
        """
        nms = self.share2nms[nfs_share]
        ns_volume, ns_folder = self._get_share_datasets(nfs_share)
        folder_props = nms.folder.get_child_props('%s/%s' % (ns_volume,
                                                             ns_folder),
                                                  'used|available')
        free = utils.str2size(folder_props['available'])
        allocated = utils.str2size(folder_props['used'])
        self.shares_with_capacities[nfs_share] = {
            'free': utils.str2gib_size(free),
            'total': utils.str2gib_size(free + allocated)}
        return free + allocated, free, allocated
Beispiel #17
0
    def _get_capacity_info(self, nfs_share):
        """Calculate available space on the NFS share.

        :param nfs_share: example 172.18.194.100:/var/nfs
        """
        nms = self.share2nms[nfs_share]
        ns_volume, ns_folder = self._get_share_datasets(nfs_share)
        folder_props = nms.folder.get_child_props('%s/%s' % (ns_volume,
                                                             ns_folder),
                                                  'used|available')
        free = utils.str2size(folder_props['available'])
        allocated = utils.str2size(folder_props['used'])
        self.shares_with_capacities[nfs_share] = {
            'free': utils.str2gib_size(free),
            'total': utils.str2gib_size(free + allocated)}
        return free + allocated, free, allocated
Beispiel #18
0
    def _update_volume_stats(self):
        """Retrieve stats info for NexentaStor appliance."""
        LOG.debug('Updating volume stats')
        total_space = 0
        free_space = 0
        shares_with_capacities = {}
        for mounted_share in self._mounted_shares:
            total, free, allocated = self._get_capacity_info(mounted_share)
            shares_with_capacities[mounted_share] = utils.str2gib_size(total)
            if total_space < utils.str2gib_size(total):
                total_space = utils.str2gib_size(total)
            if free_space < utils.str2gib_size(free):
                free_space = utils.str2gib_size(free)
                share = mounted_share

        location_info = '%(driver)s:%(share)s' % {
            'driver': self.__class__.__name__,
            'share': share
        }
        nms_url = self.share2nms[share].url
        self._stats = {
            'vendor_name': 'Nexenta',
            'dedup': self.volume_deduplication,
            'compression': self.volume_compression,
            'description': self.volume_description,
            'nms_url': nms_url,
            'ns_shares': shares_with_capacities,
            'driver_version': self.VERSION,
            'storage_protocol': 'NFS',
            'total_capacity_gb': total_space,
            'free_capacity_gb': free_space,
            'reserved_percentage': self.configuration.reserved_percentage,
            'QoS_support': False,
            'location_info': location_info,
            'volume_backend_name': self.backend_name,
            'nfs_mount_point_base': self.nfs_mount_point_base
        }
Beispiel #19
0
    def _update_volume_stats(self):
        """Retrieve stats info for NexentaStor appliance."""
        LOG.debug('Updating volume stats')
        total_space = 0
        free_space = 0
        shares_with_capacities = {}
        for mounted_share in self._mounted_shares:
            total, free, allocated = self._get_capacity_info(mounted_share)
            shares_with_capacities[mounted_share] = utils.str2gib_size(total)
            if total_space < utils.str2gib_size(total):
                total_space = utils.str2gib_size(total)
            if free_space < utils.str2gib_size(free):
                free_space = utils.str2gib_size(free)
                share = mounted_share

        location_info = '%(driver)s:%(share)s' % {
            'driver': self.__class__.__name__,
            'share': share
        }
        nms_url = self.share2nms[share].url
        self._stats = {
            'vendor_name': 'Nexenta',
            'dedup': self.volume_deduplication,
            'compression': self.volume_compression,
            'description': self.volume_description,
            'nms_url': nms_url,
            'ns_shares': shares_with_capacities,
            'driver_version': self.VERSION,
            'storage_protocol': 'NFS',
            'total_capacity_gb': total_space,
            'free_capacity_gb': free_space,
            'reserved_percentage': self.configuration.reserved_percentage,
            'QoS_support': False,
            'location_info': location_info,
            'volume_backend_name': self.backend_name,
            'nfs_mount_point_base': self.nfs_mount_point_base
        }
Beispiel #20
0
    def get_volume_stats(self, refresh=False):
        resp = self.restapi.get('system/stats')
        summary = resp['stats']['summary']
        total = nexenta_utils.str2gib_size(summary['total_capacity'])
        free = nexenta_utils.str2gib_size(summary['total_available'])

        location_info = '%(driver)s:%(host)s:%(bucket)s' % {
            'driver': self.__class__.__name__,
            'host': self._get_target_address(None),
            'bucket': self.bucket_path
        }
        return {
            'vendor_name': 'Nexenta',
            'driver_version': self.VERSION,
            'storage_protocol': 'iSCSI',
            'reserved_percentage': 0,
            'total_capacity_gb': total,
            'free_capacity_gb': free,
            'QoS_support': False,
            'volume_backend_name': self.backend_name,
            'location_info': location_info,
            'iscsi_target_portal_port': self.iscsi_target_port,
            'restapi_url': self.restapi.url
        }
Beispiel #21
0
    def get_volume_stats(self, refresh=False):
        resp = self.restapi.get('system/stats')
        summary = resp['stats']['summary']
        total = nexenta_utils.str2gib_size(summary['total_capacity'])
        free = nexenta_utils.str2gib_size(summary['total_available'])

        location_info = '%(driver)s:%(host)s:%(bucket)s' % {
            'driver': self.__class__.__name__,
            'host': self._get_target_address(None),
            'bucket': self.bucket_path
        }
        return {
            'vendor_name': 'Nexenta',
            'driver_version': self.VERSION,
            'storage_protocol': 'iSCSI',
            'reserved_percentage': 0,
            'total_capacity_gb': total,
            'free_capacity_gb': free,
            'QoS_support': False,
            'volume_backend_name': self.backend_name,
            'location_info': location_info,
            'iscsi_target_portal_port': self.iscsi_target_port,
            'restapi_url': self.restapi.url
        }
Beispiel #22
0
 def test_str2gib_size(self):
     self.assertEqual(1, utils.str2gib_size("1024M"))
     self.assertEqual(300 * units.Mi // units.Gi, utils.str2gib_size("300M"))
     self.assertEqual(1.2 * units.Ti // units.Gi, utils.str2gib_size("1.2T"))
     self.assertRaises(ValueError, utils.str2gib_size, "A")
Beispiel #23
0
 def test_str2gib_size(self):
     self.assertEqual(utils.str2gib_size("1024M"), 1)
     self.assertEqual(utils.str2gib_size("300M"), 300 * units.MiB // units.GiB)
     self.assertEqual(utils.str2gib_size("1.2T"), 1.2 * units.TiB // units.GiB)
     self.assertRaises(ValueError, utils.str2gib_size, "A")