Rename share driver stats update method
Method 'get_share_stats' of share drivers uses private method called '_update_share_status'. But it should use 'stats' instead of 'status'. Some drivers have redefined it. So, rename it for base driver class and remove duplicated redefinitions of 'get_share_stats' in share drivers. Change-Id: Ib9a1184256380268376b1da426526f8394c2308a
This commit is contained in:
parent
67ccd12e42
commit
8695d471f5
|
@ -262,7 +262,7 @@ class ShareDriver(object):
|
|||
If 'refresh' is True, run update the stats first.
|
||||
"""
|
||||
if refresh:
|
||||
self._update_share_status()
|
||||
self._update_share_stats()
|
||||
|
||||
return self._stats
|
||||
|
||||
|
@ -300,12 +300,15 @@ class ShareDriver(object):
|
|||
"""Teardown share server."""
|
||||
pass
|
||||
|
||||
def _update_share_status(self):
|
||||
"""Retrieve status info from share group."""
|
||||
def _update_share_stats(self):
|
||||
"""Retrieve stats info from share group."""
|
||||
|
||||
LOG.debug("Updating share status")
|
||||
LOG.debug("Updating share stats")
|
||||
data = {}
|
||||
backend_name = self.configuration.safe_get('share_backend_name')
|
||||
# Note(zhiteng): These information are driver/backend specific,
|
||||
# each driver may define these values in its own config options
|
||||
# or fetch from driver specific configuration file.
|
||||
data["share_backend_name"] = backend_name or 'Generic_NFS'
|
||||
data["vendor_name"] = 'Open Source'
|
||||
data["driver_version"] = '1.0'
|
||||
|
|
|
@ -128,16 +128,6 @@ class EMCShareDriver(driver.ShareDriver):
|
|||
|
||||
self.plugin.connect(self, context)
|
||||
|
||||
def get_share_stats(self, refresh=False):
|
||||
"""Get share stats.
|
||||
|
||||
If 'refresh' is True, run update the stats first.
|
||||
"""
|
||||
if refresh:
|
||||
self._update_share_stats()
|
||||
|
||||
return self._stats
|
||||
|
||||
def _update_share_stats(self):
|
||||
"""Retrieve stats info from share."""
|
||||
|
||||
|
|
|
@ -444,25 +444,12 @@ class GenericShareDriver(driver.ExecuteMixin, driver.ShareDriver):
|
|||
'deleted in %ss. Giving up')
|
||||
% self.configuration.max_time_to_create_volume)
|
||||
|
||||
def get_share_stats(self, refresh=False):
|
||||
"""Get share status.
|
||||
def _update_share_stats(self):
|
||||
"""Retrieve stats info from share volume group."""
|
||||
|
||||
If 'refresh' is True, run update the stats first.
|
||||
"""
|
||||
if refresh:
|
||||
self._update_share_status()
|
||||
|
||||
return self._stats
|
||||
|
||||
def _update_share_status(self):
|
||||
"""Retrieve status info from share volume group."""
|
||||
|
||||
LOG.debug("Updating share status")
|
||||
LOG.debug("Updating share stats")
|
||||
data = {}
|
||||
|
||||
# Note(zhiteng): These information are driver/backend specific,
|
||||
# each driver may define these values in its own config options
|
||||
# or fetch from driver specific configuration file.
|
||||
data["share_backend_name"] = self.backend_name
|
||||
data["vendor_name"] = 'Open Source'
|
||||
data["driver_version"] = '1.0'
|
||||
|
|
|
@ -494,20 +494,10 @@ class GPFSShareDriver(driver.ExecuteMixin, driver.GaneshaMixin,
|
|||
LOG.error(msg)
|
||||
raise exception.InvalidParameterValue(err=msg)
|
||||
|
||||
def get_share_stats(self, refresh=False):
|
||||
"""Get share status.
|
||||
def _update_share_stats(self):
|
||||
"""Retrieve stats info from share volume group."""
|
||||
|
||||
If 'refresh' is True, run update the stats first.
|
||||
"""
|
||||
if refresh:
|
||||
self._update_share_status()
|
||||
|
||||
return self._stats
|
||||
|
||||
def _update_share_status(self):
|
||||
"""Retrieve status info from share volume group."""
|
||||
|
||||
LOG.debug("Updating share status")
|
||||
LOG.debug("Updating share stats")
|
||||
data = {}
|
||||
|
||||
data["share_backend_name"] = self.backend_name
|
||||
|
|
|
@ -188,10 +188,10 @@ class NetAppClusteredShareDriver(driver.ShareDriver):
|
|||
"""Get snapshot name according to snapshot name template."""
|
||||
return 'share_snapshot_' + snapshot_id.replace('-', '_')
|
||||
|
||||
def _update_share_status(self):
|
||||
"""Retrieve status info from Cluster Mode backend."""
|
||||
def _update_share_stats(self):
|
||||
"""Retrieve stats info from Cluster Mode backend."""
|
||||
|
||||
LOG.debug("Updating share status")
|
||||
LOG.debug("Updating share stats")
|
||||
data = {}
|
||||
data["share_backend_name"] = self.backend_name
|
||||
data["vendor_name"] = 'NetApp'
|
||||
|
|
|
@ -299,9 +299,9 @@ class ZFSSAShareDriver(driver.ShareDriver):
|
|||
elif share['share_proto'].startswith('CIFS'):
|
||||
return
|
||||
|
||||
def _update_share_status(self):
|
||||
"""Retrieve status info from a share."""
|
||||
LOG.debug("Updating share status...")
|
||||
def _update_share_stats(self):
|
||||
"""Retrieve stats info from a share."""
|
||||
LOG.debug("Updating share stats...")
|
||||
data = {}
|
||||
backend_name = self.configuration.safe_get('share_backend_name')
|
||||
data["share_backend_name"] = backend_name or self.__class__.__name__
|
||||
|
|
|
@ -135,7 +135,7 @@ class NetAppClusteredDrvTestCase(test.TestCase):
|
|||
fake_aggr2.translate_struct(fake_aggr2_struct)
|
||||
self.driver._find_match_aggregates = mock.Mock(
|
||||
return_value=[fake_aggr1, fake_aggr2])
|
||||
self.driver._update_share_status()
|
||||
self.driver._update_share_stats()
|
||||
res = self.driver._stats
|
||||
|
||||
expected = {}
|
||||
|
|
Loading…
Reference in New Issue