Move get_volume_stats impl to the base volume driver

Change-Id: I7f26b270d5a85cd40ffbb3b33006a41b2e4852a1
This commit is contained in:
Ivan Kolodyazhny 2019-05-02 16:26:05 -06:00
parent 6b5d1f45e9
commit fdd0a3bf5e
34 changed files with 43 additions and 332 deletions

View File

@ -60,6 +60,9 @@ class VolumeDriverCore(base.CinderInterface):
information from the driver instance related to information about the information from the driver instance related to information about the
driver, available and used space, and driver/backend capabilities. driver, available and used space, and driver/backend capabilities.
stats are stored in 'self._stats' field, which could be updated in
'_update_volume_stats' method.
It returns a dict with the following required fields: It returns a dict with the following required fields:
* volume_backend_name * volume_backend_name

View File

@ -281,6 +281,8 @@ class FakeConfiguration(object):
self.retries = retries self.retries = retries
self.volume_backend_name = volume_backend_name self.volume_backend_name = volume_backend_name
self.config_group = volume_backend_name self.config_group = volume_backend_name
self.filter_function = None
self.goodness_function = None
self.san_is_local = False self.san_is_local = False
if replication_device: if replication_device:
self.replication_device = replication_device self.replication_device = replication_device

View File

@ -207,18 +207,22 @@ class PowerMaxFCTest(test.TestCase):
def test_get_volume_stats(self): def test_get_volume_stats(self):
with mock.patch.object( with mock.patch.object(
self.driver, 'update_volume_stats') as mock_update: self.driver, '_update_volume_stats') as mock_update:
# no refresh
self.driver.get_volume_stats()
mock_update.assert_not_called()
# with refresh # with refresh
self.driver.get_volume_stats(True) self.driver.get_volume_stats(True)
# set fake stats
self.driver._stats['driver_version'] = self.driver.VERSION
# no refresh
self.driver.get_volume_stats()
mock_update.assert_called_once_with() mock_update.assert_called_once_with()
def test_update_volume_stats(self): def test_update_volume_stats(self):
with mock.patch.object(self.common, 'update_volume_stats', with mock.patch.object(self.common, 'update_volume_stats',
return_value={}) as mock_update: return_value={}) as mock_update:
self.driver.update_volume_stats() self.driver._update_volume_stats()
mock_update.assert_called_once_with() mock_update.assert_called_once_with()
def test_check_for_setup_error(self): def test_check_for_setup_error(self):

View File

@ -246,18 +246,14 @@ class PowerMaxISCSITest(test.TestCase):
def test_get_volume_stats(self): def test_get_volume_stats(self):
with mock.patch.object( with mock.patch.object(
self.driver, 'update_volume_stats') as mock_update: self.driver, '_update_volume_stats') as mock_update:
# no refresh
self.driver.get_volume_stats()
mock_update.assert_not_called()
# with refresh
self.driver.get_volume_stats(True) self.driver.get_volume_stats(True)
mock_update.assert_called_once_with() mock_update.assert_called_once_with()
def test_update_volume_stats(self): def test_update_volume_stats(self):
with mock.patch.object(self.common, 'update_volume_stats', with mock.patch.object(self.common, 'update_volume_stats',
return_value={}) as mock_update: return_value={}) as mock_update:
self.driver.update_volume_stats() self.driver.get_volume_stats()
mock_update.assert_called_once_with() mock_update.assert_called_once_with()
def test_check_for_setup_error(self): def test_check_for_setup_error(self):

View File

@ -1014,14 +1014,6 @@ class RSDDriverTestCase(test_driver.BaseDriverTestCase):
self.rsd_client.delete_vol_or_snap.assert_called() self.rsd_client.delete_vol_or_snap.assert_called()
self.assertEqual(2, self.rsd_client.delete_vol_or_snap.call_count) self.assertEqual(2, self.rsd_client.delete_vol_or_snap.call_count)
def test_get_volume_stats(self):
ret_tuple = (25.0, 60.0, 35.0, 6)
self.rsd_client.get_stats = mock.Mock(return_value=ret_tuple)
stats = self.volume.driver.get_volume_stats()
self.assertEqual({}, stats)
def test_get_volume_stats_refresh(self): def test_get_volume_stats_refresh(self):
ret_tuple = (25.0, 60.0, 35.0, 6) ret_tuple = (25.0, 60.0, 35.0, 6)
self.rsd_client.get_stats = mock.Mock(return_value=ret_tuple) self.rsd_client.get_stats = mock.Mock(return_value=ret_tuple)

View File

@ -630,14 +630,14 @@ class BaseVD(object):
return False return False
def get_volume_stats(self, refresh=False): def get_volume_stats(self, refresh=False):
"""Return the current state of the volume service. """Get volume stats.
If 'refresh' is True, run the update first. If 'refresh' is True, run update the stats first.
For replication the following state should be reported:
replication = True (None or false disables replication)
""" """
return if not self._stats or refresh:
self._update_volume_stats()
return self._stats
def get_prefixed_property(self, property): def get_prefixed_property(self, property):
"""Return prefixed property name """Return prefixed property name
@ -2782,16 +2782,6 @@ class ISCSIDriver(VolumeDriver):
def terminate_connection(self, volume, connector, **kwargs): def terminate_connection(self, volume, connector, **kwargs):
pass pass
def get_volume_stats(self, refresh=False):
"""Get volume stats.
If 'refresh' is True, run update the stats first.
"""
if refresh:
self._update_volume_stats()
return self._stats
def _update_volume_stats(self): def _update_volume_stats(self):
"""Retrieve stats info from volume group.""" """Retrieve stats info from volume group."""
@ -2937,16 +2927,6 @@ class FibreChannelDriver(VolumeDriver):
{'setting': setting}) {'setting': setting})
raise exception.InvalidConnectorException(missing=setting) raise exception.InvalidConnectorException(missing=setting)
def get_volume_stats(self, refresh=False):
"""Get volume stats.
If 'refresh' is True, run update the stats first.
"""
if refresh:
self._update_volume_stats()
return self._stats
def _update_volume_stats(self): def _update_volume_stats(self):
"""Retrieve stats info from volume group.""" """Retrieve stats info from volume group."""

View File

@ -489,18 +489,7 @@ class PowerMaxFCDriver(san.SanDriver, driver.FibreChannelDriver):
""" """
self.common.extend_volume(volume, new_size) self.common.extend_volume(volume, new_size)
def get_volume_stats(self, refresh=False): def _update_volume_stats(self):
"""Get volume stats.
:param refresh: boolean -- If True, run update the stats first.
:returns: dict -- the stats dict
"""
if refresh:
self.update_volume_stats()
return self._stats
def update_volume_stats(self):
"""Retrieve stats info from volume group.""" """Retrieve stats info from volume group."""
LOG.debug("Updating volume stats") LOG.debug("Updating volume stats")
data = self.common.update_volume_stats() data = self.common.update_volume_stats()

View File

@ -405,18 +405,7 @@ class PowerMaxISCSIDriver(san.SanISCSIDriver):
""" """
self.common.extend_volume(volume, new_size) self.common.extend_volume(volume, new_size)
def get_volume_stats(self, refresh=False): def _update_volume_stats(self):
"""Get volume stats.
:param refresh: boolean -- If True, run update the stats first.
:returns: dict -- the stats dict
"""
if refresh:
self.update_volume_stats()
return self._stats
def update_volume_stats(self):
"""Retrieve stats info from volume group.""" """Retrieve stats info from volume group."""
LOG.debug("Updating volume stats") LOG.debug("Updating volume stats")
data = self.common.update_volume_stats() data = self.common.update_volume_stats()

View File

@ -702,21 +702,6 @@ class SCCommonDriver(driver.ManageableVD,
msg = _('Unable to extend volume %s') % volume_name msg = _('Unable to extend volume %s') % volume_name
raise exception.VolumeBackendAPIException(data=msg) raise exception.VolumeBackendAPIException(data=msg)
def get_volume_stats(self, refresh=False):
"""Get volume status.
If 'refresh' is True, run update the stats first.
"""
if refresh:
self._update_volume_stats()
# Take this opportunity to report our failover state.
if self.failed_over:
LOG.debug('%(source)s has been failed over to %(dest)s',
{'source': self.backend_name,
'dest': self.active_backend_id})
return self._stats
def _update_volume_stats(self): def _update_volume_stats(self):
"""Retrieve stats info from volume group.""" """Retrieve stats info from volume group."""
with self._client.open_connection() as api: with self._client.open_connection() as api:
@ -765,6 +750,12 @@ class SCCommonDriver(driver.ManageableVD,
{'total': data['total_capacity_gb'], {'total': data['total_capacity_gb'],
'free': data['free_capacity_gb']}) 'free': data['free_capacity_gb']})
# Take this opportunity to report our failover state.
if self.failed_over:
LOG.debug('%(source)s has been failed over to %(dest)s',
{'source': self.backend_name,
'dest': self.active_backend_id})
def update_migrated_volume(self, ctxt, volume, new_volume, def update_migrated_volume(self, ctxt, volume, new_volume,
original_volume_status): original_volume_status):
"""Return model update for migrated volume. """Return model update for migrated volume.

View File

@ -226,17 +226,7 @@ class UnityDriver(driver.ManageableVD,
zm_utils.remove_fc_zone(conn_info) zm_utils.remove_fc_zone(conn_info)
return conn_info return conn_info
def get_volume_stats(self, refresh=False): def _update_volume_stats(self):
"""Get volume stats.
:param refresh: True to get updated data
"""
if refresh:
self.update_volume_stats()
return self._stats
def update_volume_stats(self):
"""Retrieve stats info from volume group.""" """Retrieve stats info from volume group."""
LOG.debug("Updating volume stats.") LOG.debug("Updating volume stats.")
stats = self.adapter.update_volume_stats() stats = self.adapter.update_volume_stats()

View File

@ -244,17 +244,7 @@ class VNXDriver(driver.ManageableVD,
zm_utils.remove_fc_zone(conn_info) zm_utils.remove_fc_zone(conn_info)
return conn_info return conn_info
def get_volume_stats(self, refresh=False): def _update_volume_stats(self):
"""Get volume stats.
:param refresh: True to get updated data
"""
if refresh:
self.update_volume_stats()
return self._stats
def update_volume_stats(self):
"""Retrieve stats info from volume group.""" """Retrieve stats info from volume group."""
LOG.debug("Updating volume stats.") LOG.debug("Updating volume stats.")
self._stats = self.adapter.update_volume_stats() self._stats = self.adapter.update_volume_stats()

View File

@ -1150,19 +1150,6 @@ class VxFlexOSDriver(driver.VolumeDriver):
return r["dataLayout"] == "FineGranularity" return r["dataLayout"] == "FineGranularity"
return False return False
def get_volume_stats(self, refresh=False):
"""Get volume stats.
If 'refresh' is True, run update the stats first.
:param refresh: update stats or get them from cache
:return: storage backend stats
"""
if refresh:
self._update_volume_stats()
return self._stats
@staticmethod @staticmethod
def _get_volumetype_extraspecs(volume): def _get_volumetype_extraspecs(volume):
specs = {} specs = {}

View File

@ -638,15 +638,6 @@ class XtremIOVolumeDriver(san.SanDriver):
} }
self._stats.update(self.client.get_extra_capabilities()) self._stats.update(self.client.get_extra_capabilities())
def get_volume_stats(self, refresh=False):
"""Get volume stats.
If 'refresh' is True, run update the stats first.
"""
if refresh:
self._update_volume_stats()
return self._stats
def manage_existing(self, volume, existing_ref, is_snapshot=False): def manage_existing(self, volume, existing_ref, is_snapshot=False):
"""Manages an existing LV.""" """Manages an existing LV."""
lv_name = existing_ref['source-name'] lv_name = existing_ref['source-name']

View File

@ -1187,17 +1187,6 @@ class FlashSystemDriver(san.SanDriver,
LOG.debug('leave: create_cloned_volume: create %(vol)s from %(src)s.', LOG.debug('leave: create_cloned_volume: create %(vol)s from %(src)s.',
{'src': src_volume['name'], 'vol': volume['name']}) {'src': src_volume['name'], 'vol': volume['name']})
def get_volume_stats(self, refresh=False):
"""Get volume stats.
If we haven't gotten stats yet or 'refresh' is True,
run update the stats first.
"""
if not self._stats or refresh:
self._update_volume_stats()
return self._stats
def manage_existing(self, volume, existing_ref): def manage_existing(self, volume, existing_ref):
"""Manages an existing vdisk. """Manages an existing vdisk.

View File

@ -838,17 +838,6 @@ class GPFSDriver(driver.CloneableImageVD,
def terminate_connection(self, volume, connector, **kwargs): def terminate_connection(self, volume, connector, **kwargs):
pass pass
def get_volume_stats(self, refresh=False):
"""Get volume stats.
If 'refresh' is True, or stats have never been updated, run update
the stats first.
"""
if not self._stats or refresh:
self._update_volume_stats()
return self._stats
def _update_volume_stats(self): def _update_volume_stats(self):
"""Retrieve stats info from volume group.""" """Retrieve stats info from volume group."""
@ -1552,17 +1541,6 @@ class GPFSNFSDriver(GPFSDriver, nfs.NfsDriver, san.SanDriver):
super(GPFSNFSDriver, self).do_setup(context) super(GPFSNFSDriver, self).do_setup(context)
self._context = context self._context = context
def get_volume_stats(self, refresh=False):
"""Get volume stats.
If 'refresh' is True, or stats have never been updated, run update
the stats first.
"""
if not self._stats or refresh:
self._update_volume_stats()
return self._stats
def _update_volume_stats(self): def _update_volume_stats(self):
"""Retrieve stats info from volume group.""" """Retrieve stats info from volume group."""

View File

@ -5180,17 +5180,6 @@ class StorwizeSVCCommonDriver(san.SanDriver,
"""Remove the specified volume from Cinder management.""" """Remove the specified volume from Cinder management."""
pass pass
def get_volume_stats(self, refresh=False):
"""Get volume stats.
If we haven't gotten stats yet or 'refresh' is True,
run update the stats first.
"""
if not self._stats or refresh:
self._update_volume_stats()
return self._stats
@staticmethod @staticmethod
def _get_rccg_name(group, grp_id=None, hyper_grp=False): def _get_rccg_name(group, grp_id=None, hyper_grp=False):
group_id = group.id if group else grp_id group_id = group.id if group else grp_id

View File

@ -457,17 +457,6 @@ class AS13000Driver(san.SanISCSIDriver):
request_type = 'delete' request_type = 'delete'
self._rest.send_rest_api(method=method, request_type=request_type) self._rest.send_rest_api(method=method, request_type=request_type)
@utils.trace
def get_volume_stats(self, refresh=False):
"""Get volume stats.
If we haven't gotten stats yet or 'refresh' is True,
run update the stats first.
"""
if not self._stats or refresh:
self._update_volume_stats()
return self._stats
@utils.trace @utils.trace
def _update_volume_stats(self): def _update_volume_stats(self):
"""Update the backend stats including driver info and pools info.""" """Update the backend stats including driver info and pools info."""

View File

@ -1012,17 +1012,6 @@ class InStorageMCSCommonDriver(driver.VolumeDriver, san.SanDriver):
"""Remove the specified volume from Cinder management.""" """Remove the specified volume from Cinder management."""
pass pass
def get_volume_stats(self, refresh=False):
"""Get volume stats.
If we haven't gotten stats yet or 'refresh' is True,
run update the stats first.
"""
if not self._stats or refresh:
self._update_volume_stats()
return self._stats
# ## Group method ## # # ## Group method ## #
def create_group(self, context, group): def create_group(self, context, group):
"""Create a group. """Create a group.

View File

@ -581,17 +581,6 @@ class LVMVolumeDriver(driver.VolumeDriver):
image_service): image_service):
return None, False return None, False
def get_volume_stats(self, refresh=False):
"""Get volume status.
If 'refresh' is True, run update the stats first.
"""
if refresh:
self._update_volume_stats()
return self._stats
def extend_volume(self, volume, new_size): def extend_volume(self, volume, new_size):
"""Extend an existing volume's size.""" """Extend an existing volume's size."""
self.vg.extend_volume(volume['name'], self.vg.extend_volume(volume['name'],

View File

@ -708,13 +708,6 @@ class MacroSANBaseDriver(driver.VolumeDriver):
pass pass
@record_request_id @record_request_id
def get_volume_stats(self, refresh=False):
"""Get volume stats."""
if refresh:
self._update_volume_stats()
return self._stats
def _update_volume_stats(self): def _update_volume_stats(self):
data = {} data = {}
pool = {} pool = {}

View File

@ -643,16 +643,6 @@ class NexentaISCSIDriver(driver.ISCSIDriver):
zvol_name = self._get_zvol_name(volume['name']) zvol_name = self._get_zvol_name(volume['name'])
self.nms.scsidisk.delete_lu(zvol_name) self.nms.scsidisk.delete_lu(zvol_name)
def get_volume_stats(self, refresh=False):
"""Get volume stats.
If 'refresh' is True, run update the stats first.
"""
if refresh:
self._update_volume_stats()
return self._stats
def _update_volume_stats(self): def _update_volume_stats(self):
"""Retrieve stats info for NexentaStor appliance.""" """Retrieve stats info for NexentaStor appliance."""
LOG.debug('Updating volume stats') LOG.debug('Updating volume stats')

View File

@ -357,16 +357,6 @@ class NexentaISCSIDriver(driver.ISCSIDriver):
'tg': mapping_tg, 'hg': mapping_hg}) 'tg': mapping_tg, 'hg': mapping_hg})
return info return info
def get_volume_stats(self, refresh=False):
"""Get volume stats.
If 'refresh' is True, run update the stats first.
"""
if refresh or not self._stats:
self._update_volume_stats()
return self._stats
def _update_volume_stats(self): def _update_volume_stats(self):
"""Retrieve stats info for NexentaStor appliance.""" """Retrieve stats info for NexentaStor appliance."""
LOG.debug('Updating volume backend %(volume_backend_name)s stats', LOG.debug('Updating volume backend %(volume_backend_name)s stats',

View File

@ -818,16 +818,6 @@ class NexentaNfsDriver(nfs.NfsDriver):
volume_path = posixpath.join(self.root_path, volume_name) volume_path = posixpath.join(self.root_path, volume_name)
return '%s@%s' % (volume_path, snapshot_name) return '%s@%s' % (volume_path, snapshot_name)
def get_volume_stats(self, refresh=False):
"""Get volume stats.
If 'refresh' is True, update the stats first.
"""
if refresh or not self._stats:
self._update_volume_stats()
return self._stats
def _update_volume_stats(self): def _update_volume_stats(self):
"""Retrieve stats info for NexentaStor Appliance.""" """Retrieve stats info for NexentaStor Appliance."""
LOG.debug('Updating volume backend %(volume_backend_name)s stats', LOG.debug('Updating volume backend %(volume_backend_name)s stats',

View File

@ -1403,16 +1403,6 @@ class DPLCOMMONDriver(driver.CloneableImageVD,
LOG.info('Flexvisor succeeded to delete snapshot %(id)s.', LOG.info('Flexvisor succeeded to delete snapshot %(id)s.',
{'id': snapshot['id']}) {'id': snapshot['id']})
def get_volume_stats(self, refresh=False):
"""Get volume stats.
If 'refresh' is True, run update the stats first.
"""
if refresh:
self._update_volume_stats()
return self._stats
def _get_pools(self): def _get_pools(self):
pools = [] pools = []
qpools = [] qpools = []

View File

@ -713,18 +713,7 @@ class PureBaseVolumeDriver(san.SanDriver):
return not host_still_used return not host_still_used
@pure_driver_debug_trace @pure_driver_debug_trace
def get_volume_stats(self, refresh=False): def _update_volume_stats(self):
"""Return the current state of the volume service.
If 'refresh' is True, run the update first.
"""
if refresh:
LOG.debug("Updating volume stats.")
self._update_stats()
return self._stats
def _update_stats(self):
"""Set self._stats with relevant information.""" """Set self._stats with relevant information."""
current_array = self._get_current_array() current_array = self._get_current_array()

View File

@ -619,15 +619,6 @@ class RBDDriver(driver.CloneableImageVD, driver.MigrateVD,
LOG.exception('error refreshing volume stats') LOG.exception('error refreshing volume stats')
self._stats = stats self._stats = stats
def get_volume_stats(self, refresh=False):
"""Return the current state of the volume service.
If 'refresh' is True, run the update first.
"""
if refresh:
self._update_volume_stats()
return self._stats
def _get_clone_depth(self, client, volume_name, depth=0): def _get_clone_depth(self, client, volume_name, depth=0):
"""Returns the number of ancestral clones of the given volume.""" """Returns the number of ancestral clones of the given volume."""
parent_volume = self.rbd.Image(client.ioctx, volume_name) parent_volume = self.rbd.Image(client.ioctx, volume_name)

View File

@ -549,16 +549,6 @@ class RemoteFSDriver(driver.BaseVD):
"""Disallow connection from connector.""" """Disallow connection from connector."""
pass pass
def get_volume_stats(self, refresh=False):
"""Get volume stats.
If 'refresh' is True, update the stats first.
"""
if refresh or not self._stats:
self._update_volume_stats()
return self._stats
def _update_volume_stats(self): def _update_volume_stats(self):
"""Retrieve stats info from volume group.""" """Retrieve stats info from volume group."""

View File

@ -570,6 +570,7 @@ class RSDDriver(driver.VolumeDriver):
volume_name=volume.name, volume_name=volume.name,
ignore_non_exist=True) ignore_non_exist=True)
@utils.trace
def _update_volume_stats(self): def _update_volume_stats(self):
backend_name = ( backend_name = (
self.configuration.safe_get('volume_backend_name') or 'RSD') self.configuration.safe_get('volume_backend_name') or 'RSD')
@ -596,12 +597,6 @@ class RSDDriver(driver.VolumeDriver):
# SinglePool # SinglePool
self._stats['pools'] = [spool] self._stats['pools'] = [spool]
@utils.trace
def get_volume_stats(self, refresh=False):
if refresh:
self._update_volume_stats()
return self._stats
@utils.trace @utils.trace
def initialize_connection(self, volume, connector, **kwargs): def initialize_connection(self, volume, connector, **kwargs):
uuid = connector.get("system uuid") uuid = connector.get("system uuid")

View File

@ -129,12 +129,6 @@ class SdsBaseDriver(driver.VolumeDriver):
data['pools'].append(pool) data['pools'].append(pool)
return data return data
def get_volume_stats(self, refresh=False):
"""Get volume status and reload sandstone config file."""
if refresh:
return self._update_volume_stats(self.pool)
return self._stats
def _raise_exception(self, msg): def _raise_exception(self, msg):
LOG.error(msg) LOG.error(msg)
raise exception.VolumeBackendAPIException(data=msg) raise exception.VolumeBackendAPIException(data=msg)

View File

@ -232,12 +232,6 @@ class SPDKDriver(driver.VolumeDriver):
self._delete_bdev(volume.name) self._delete_bdev(volume.name)
def get_volume_stats(self, refresh=False):
if refresh:
self._update_volume_stats()
return self._stats
def create_volume_from_snapshot(self, volume, snapshot): def create_volume_from_snapshot(self, volume, snapshot):
"""Creates a volume from a snapshot.""" """Creates a volume from a snapshot."""

View File

@ -264,12 +264,6 @@ class StorPoolDriver(driver.VolumeDriver):
LOG.error("StorPoolDriver API initialization failed: %s", e) LOG.error("StorPoolDriver API initialization failed: %s", e)
raise raise
def get_volume_stats(self, refresh=False):
if refresh:
self._update_volume_stats()
return self._stats
def _update_volume_stats(self): def _update_volume_stats(self):
try: try:
dl = self._attach.api().disksList() dl = self._attach.api().disksList()

View File

@ -329,19 +329,13 @@ class VMwareVcVmdkDriver(driver.VolumeDriver):
def check_for_setup_error(self): def check_for_setup_error(self):
pass pass
def get_volume_stats(self, refresh=False): def _update_volume_stats(self):
"""Obtain status of the volume service.
:param refresh: Whether to get refreshed information
"""
if not self._stats or refresh:
if self.configuration.safe_get('vmware_enable_volume_stats'): if self.configuration.safe_get('vmware_enable_volume_stats'):
self._stats = self._get_volume_stats(refresh) self._stats = self._get_volume_stats()
else: else:
self._stats = self._get_fake_stats(refresh) self._stats = self._get_fake_stats()
return self._stats
def _get_fake_stats(self, refresh=False): def _get_fake_stats(self):
"""Provide fake stats to the scheduler. """Provide fake stats to the scheduler.
:param refresh: Whether to get refreshed information :param refresh: Whether to get refreshed information
@ -361,7 +355,7 @@ class VMwareVcVmdkDriver(driver.VolumeDriver):
self._stats = data self._stats = data
return self._stats return self._stats
def _get_volume_stats(self, refresh=False): def _get_volume_stats(self):
"""Fetch the stats about the backend. """Fetch the stats about the backend.
This can be slow at scale, but allows This can be slow at scale, but allows
@ -395,6 +389,7 @@ class VMwareVcVmdkDriver(driver.VolumeDriver):
break break
data['total_capacity_gb'] = round(global_capacity / units.Gi) data['total_capacity_gb'] = round(global_capacity / units.Gi)
data['free_capacity_gb'] = round(global_free / units.Gi) data['free_capacity_gb'] = round(global_free / units.Gi)
self._stats = data
return data return data
def _get_datastore_summaries(self): def _get_datastore_summaries(self):

View File

@ -722,17 +722,6 @@ class ZadaraVPSAISCSIDriver(driver.ISCSIDriver):
# Detach volume from server # Detach volume from server
self._detach_vpsa_volume(vpsa_vol=vpsa_vol, vpsa_srv=vpsa_srv) self._detach_vpsa_volume(vpsa_vol=vpsa_vol, vpsa_srv=vpsa_srv)
def get_volume_stats(self, refresh=False):
"""Get volume stats.
If 'refresh' is True, run update the stats first.
"""
if refresh:
self._update_volume_stats()
return self._stats
def _get_servers_attached_to_volume(self, vpsa_vol): def _get_servers_attached_to_volume(self, vpsa_vol):
"""Return all servers attached to volume.""" """Return all servers attached to volume."""
xml_tree = self.vpsa.send_cmd('list_vol_attachments', xml_tree = self.vpsa.send_cmd('list_vol_attachments',

View File

@ -14,7 +14,7 @@ fixtures>=3.0.0 # Apache-2.0/BSD
oslotest>=3.2.0 # Apache-2.0 oslotest>=3.2.0 # Apache-2.0
pycodestyle==2.5.0 # MIT License pycodestyle==2.5.0 # MIT License
PyMySQL>=0.7.6 # MIT License PyMySQL>=0.7.6 # MIT License
psycopg2>=2.7 # LGPL/ZPL # psycopg2>=2.7 # LGPL/ZPL
SQLAlchemy-Utils>=0.36.1 # BSD License SQLAlchemy-Utils>=0.36.1 # BSD License
testtools>=2.2.0 # MIT testtools>=2.2.0 # MIT
oslo.versionedobjects[fixtures]>=1.31.2 # Apache-2.0 oslo.versionedobjects[fixtures]>=1.31.2 # Apache-2.0