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' is True, run update the stats first.
|
||||||
"""
|
"""
|
||||||
if refresh:
|
if refresh:
|
||||||
self._update_share_status()
|
self._update_share_stats()
|
||||||
|
|
||||||
return self._stats
|
return self._stats
|
||||||
|
|
||||||
|
@ -300,12 +300,15 @@ class ShareDriver(object):
|
||||||
"""Teardown share server."""
|
"""Teardown share server."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _update_share_status(self):
|
def _update_share_stats(self):
|
||||||
"""Retrieve status info from share group."""
|
"""Retrieve stats info from share group."""
|
||||||
|
|
||||||
LOG.debug("Updating share status")
|
LOG.debug("Updating share stats")
|
||||||
data = {}
|
data = {}
|
||||||
backend_name = self.configuration.safe_get('share_backend_name')
|
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["share_backend_name"] = backend_name or 'Generic_NFS'
|
||||||
data["vendor_name"] = 'Open Source'
|
data["vendor_name"] = 'Open Source'
|
||||||
data["driver_version"] = '1.0'
|
data["driver_version"] = '1.0'
|
||||||
|
|
|
@ -128,16 +128,6 @@ class EMCShareDriver(driver.ShareDriver):
|
||||||
|
|
||||||
self.plugin.connect(self, context)
|
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):
|
def _update_share_stats(self):
|
||||||
"""Retrieve stats info from share."""
|
"""Retrieve stats info from share."""
|
||||||
|
|
||||||
|
|
|
@ -444,25 +444,12 @@ class GenericShareDriver(driver.ExecuteMixin, driver.ShareDriver):
|
||||||
'deleted in %ss. Giving up')
|
'deleted in %ss. Giving up')
|
||||||
% self.configuration.max_time_to_create_volume)
|
% self.configuration.max_time_to_create_volume)
|
||||||
|
|
||||||
def get_share_stats(self, refresh=False):
|
def _update_share_stats(self):
|
||||||
"""Get share status.
|
"""Retrieve stats info from share volume group."""
|
||||||
|
|
||||||
If 'refresh' is True, run update the stats first.
|
LOG.debug("Updating share stats")
|
||||||
"""
|
|
||||||
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")
|
|
||||||
data = {}
|
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["share_backend_name"] = self.backend_name
|
||||||
data["vendor_name"] = 'Open Source'
|
data["vendor_name"] = 'Open Source'
|
||||||
data["driver_version"] = '1.0'
|
data["driver_version"] = '1.0'
|
||||||
|
|
|
@ -494,20 +494,10 @@ class GPFSShareDriver(driver.ExecuteMixin, driver.GaneshaMixin,
|
||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
raise exception.InvalidParameterValue(err=msg)
|
raise exception.InvalidParameterValue(err=msg)
|
||||||
|
|
||||||
def get_share_stats(self, refresh=False):
|
def _update_share_stats(self):
|
||||||
"""Get share status.
|
"""Retrieve stats info from share volume group."""
|
||||||
|
|
||||||
If 'refresh' is True, run update the stats first.
|
LOG.debug("Updating share stats")
|
||||||
"""
|
|
||||||
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")
|
|
||||||
data = {}
|
data = {}
|
||||||
|
|
||||||
data["share_backend_name"] = self.backend_name
|
data["share_backend_name"] = self.backend_name
|
||||||
|
|
|
@ -188,10 +188,10 @@ class NetAppClusteredShareDriver(driver.ShareDriver):
|
||||||
"""Get snapshot name according to snapshot name template."""
|
"""Get snapshot name according to snapshot name template."""
|
||||||
return 'share_snapshot_' + snapshot_id.replace('-', '_')
|
return 'share_snapshot_' + snapshot_id.replace('-', '_')
|
||||||
|
|
||||||
def _update_share_status(self):
|
def _update_share_stats(self):
|
||||||
"""Retrieve status info from Cluster Mode backend."""
|
"""Retrieve stats info from Cluster Mode backend."""
|
||||||
|
|
||||||
LOG.debug("Updating share status")
|
LOG.debug("Updating share stats")
|
||||||
data = {}
|
data = {}
|
||||||
data["share_backend_name"] = self.backend_name
|
data["share_backend_name"] = self.backend_name
|
||||||
data["vendor_name"] = 'NetApp'
|
data["vendor_name"] = 'NetApp'
|
||||||
|
|
|
@ -299,9 +299,9 @@ class ZFSSAShareDriver(driver.ShareDriver):
|
||||||
elif share['share_proto'].startswith('CIFS'):
|
elif share['share_proto'].startswith('CIFS'):
|
||||||
return
|
return
|
||||||
|
|
||||||
def _update_share_status(self):
|
def _update_share_stats(self):
|
||||||
"""Retrieve status info from a share."""
|
"""Retrieve stats info from a share."""
|
||||||
LOG.debug("Updating share status...")
|
LOG.debug("Updating share stats...")
|
||||||
data = {}
|
data = {}
|
||||||
backend_name = self.configuration.safe_get('share_backend_name')
|
backend_name = self.configuration.safe_get('share_backend_name')
|
||||||
data["share_backend_name"] = backend_name or self.__class__.__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)
|
fake_aggr2.translate_struct(fake_aggr2_struct)
|
||||||
self.driver._find_match_aggregates = mock.Mock(
|
self.driver._find_match_aggregates = mock.Mock(
|
||||||
return_value=[fake_aggr1, fake_aggr2])
|
return_value=[fake_aggr1, fake_aggr2])
|
||||||
self.driver._update_share_status()
|
self.driver._update_share_stats()
|
||||||
res = self.driver._stats
|
res = self.driver._stats
|
||||||
|
|
||||||
expected = {}
|
expected = {}
|
||||||
|
|
Loading…
Reference in New Issue