Skip to content

Commit

Permalink
fix name 'update_volume_status' to 'update_volume_stats'
Browse files Browse the repository at this point in the history
_update_volume_status() private method is called by
get_volume_stats(). This is confusing as the volume's
stats and not status gets updated.

fixes bug #1199327

Change-Id: I9f7971e457250798320c14d3f58bdc199c8cfceb
  • Loading branch information
Kun Huang committed Jul 22, 2013
1 parent 767a018 commit 5b50bd8
Show file tree
Hide file tree
Showing 14 changed files with 76 additions and 76 deletions.
4 changes: 2 additions & 2 deletions cinder/tests/test_block_device.py
Expand Up @@ -101,7 +101,7 @@ def test_create_volume(self):
'provider_location': 'None:3260,None None '
'None dev_path'})

def test_update_volume_status(self):
def test_update_volume_stats(self):
self.mox.StubOutWithMock(self.drv, '_devices_sizes')
self.drv._devices_sizes().AndReturn({'/dev/loop1': 1024,
'/dev/loop2': 1024})
Expand All @@ -111,7 +111,7 @@ def test_update_volume_status(self):
self.configuration.safe_get('volume_backend_name'). \
AndReturn('BlockDeviceDriver')
self.mox.ReplayAll()
self.drv._update_volume_status()
self.drv._update_volume_stats()
self.assertEquals(self.drv._stats,
{'total_capacity_gb': 2,
'free_capacity_gb': 2,
Expand Down
2 changes: 1 addition & 1 deletion cinder/tests/test_volume.py
Expand Up @@ -1613,7 +1613,7 @@ def _emulate_vgs_execute(_command, *_args, **_kwargs):

self.volume.driver.set_execute(_emulate_vgs_execute)

self.volume.driver._update_volume_status()
self.volume.driver._update_volume_stats()

stats = self.volume.driver._stats

Expand Down
10 changes: 5 additions & 5 deletions cinder/volume/driver.py
Expand Up @@ -467,19 +467,19 @@ def _get_iscsi_initiator(self):
return l[l.index('=') + 1:].strip()

def get_volume_stats(self, refresh=False):
"""Get volume status.
"""Get volume stats.
If 'refresh' is True, run update the stats first.
"""
if refresh:
self._update_volume_status()
self._update_volume_stats()

return self._stats

def _update_volume_status(self):
"""Retrieve status info from volume group."""
def _update_volume_stats(self):
"""Retrieve stats info from volume group."""

LOG.debug(_("Updating volume status"))
LOG.debug(_("Updating volume stats"))
data = {}
backend_name = self.configuration.safe_get('volume_backend_name')
data["volume_backend_name"] = backend_name or 'Generic_iSCSI'
Expand Down
8 changes: 4 additions & 4 deletions cinder/volume/drivers/block_device.py
Expand Up @@ -318,11 +318,11 @@ def create_cloned_volume(self, volume, src_vref):

def get_volume_stats(self, refresh=False):
if refresh:
self._update_volume_status()
self._update_volume_stats()
return self._stats

def _update_volume_status(self):
"""Retrieve status info from volume group."""
def _update_volume_stats(self):
"""Retrieve stats info from volume group."""
dict_of_devices_sizes = self._devices_sizes()
used_devices = self._get_used_devices()
total_size = 0
Expand All @@ -332,7 +332,7 @@ def _update_volume_status(self):
free_size += size
total_size += size

LOG.debug("Updating volume status")
LOG.debug("Updating volume stats")
backend_name = self.configuration.safe_get('volume_backend_name')
data = {'total_capacity_gb': total_size / 1024,
'free_capacity_gb': free_size / 1024,
Expand Down
6 changes: 3 additions & 3 deletions cinder/volume/drivers/emc/emc_smis_common.py
Expand Up @@ -852,9 +852,9 @@ def terminate_connection(self, volume, connector):
self.conn = self._get_ecom_connection()
self._unmap_lun(volume, connector)

def update_volume_status(self):
"""Retrieve status info."""
LOG.debug(_("Updating volume status"))
def update_volume_stats(self):
"""Retrieve stats info."""
LOG.debug(_("Updating volume stats"))
self.conn = self._get_ecom_connection()
storage_type = self._get_storage_type()

Expand Down
12 changes: 6 additions & 6 deletions cinder/volume/drivers/emc/emc_smis_iscsi.py
Expand Up @@ -221,19 +221,19 @@ def terminate_connection(self, volume, connector, **kwargs):
self.common.terminate_connection(volume, connector)

def get_volume_stats(self, refresh=False):
"""Get volume status.
"""Get volume stats.
If 'refresh' is True, run update the stats first.
"""
if refresh:
self.update_volume_status()
self.update_volume_stats()

return self._stats

def update_volume_status(self):
"""Retrieve status info from volume group."""
LOG.debug(_("Updating volume status"))
data = self.common.update_volume_status()
def update_volume_stats(self):
"""Retrieve stats info from volume group."""
LOG.debug(_("Updating volume stats"))
data = self.common.update_volume_stats()
backend_name = self.configuration.safe_get('volume_backend_name')
data['volume_backend_name'] = backend_name or 'EMCSMISISCSIDriver'
data['storage_protocol'] = 'iSCSI'
Expand Down
10 changes: 5 additions & 5 deletions cinder/volume/drivers/gpfs.py
Expand Up @@ -332,20 +332,20 @@ def terminate_connection(self, volume, connector, **kwargs):
pass

def get_volume_stats(self, refresh=False):
"""Get volume status.
"""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_status()
self._update_volume_stats()

return self._stats

def _update_volume_status(self):
"""Retrieve status info from volume group."""
def _update_volume_stats(self):
"""Retrieve stats info from volume group."""

LOG.debug("Updating volume status")
LOG.debug("Updating volume stats")
data = {}
backend_name = self.configuration.safe_get('volume_backend_name')
data["volume_backend_name"] = backend_name or 'GPFS'
Expand Down
10 changes: 5 additions & 5 deletions cinder/volume/drivers/huawei/huawei_iscsi.py
Expand Up @@ -546,12 +546,12 @@ def create_volume_from_snapshot(self, volume, snapshot):
self._delete_luncopy(luncopy_id)

def get_volume_stats(self, refresh=False):
"""Get volume status.
"""Get volume stats.
If 'refresh' is True, run update the stats first.
"""
if refresh:
self._update_volume_status()
self._update_volume_stats()

return self._stats

Expand Down Expand Up @@ -1501,10 +1501,10 @@ def _is_resource_pool_enough(self):
return False
return True

def _update_volume_status(self):
"""Retrieve status info from volume group."""
def _update_volume_stats(self):
"""Retrieve stats info from volume group."""

LOG.debug(_("Updating volume status"))
LOG.debug(_("Updating volume stats"))
data = {}
backend_name = self.configuration.safe_get('volume_backend_name')
data["volume_backend_name"] = backend_name or 'HuaweiISCSIDriver'
Expand Down
22 changes: 11 additions & 11 deletions cinder/volume/drivers/lvm.py
Expand Up @@ -531,19 +531,19 @@ def remove_export(self, context, volume):
self.tgtadm.remove_iscsi_target(iscsi_target, 0, volume['id'])

def get_volume_stats(self, refresh=False):
"""Get volume status.
"""Get volume stats.
If 'refresh' is True, run update the stats first.
"""
if refresh:
self._update_volume_status()
self._update_volume_stats()

return self._stats

def _update_volume_status(self):
"""Retrieve status info from volume group."""
def _update_volume_stats(self):
"""Retrieve stats info from volume group."""

LOG.debug(_("Updating volume status"))
LOG.debug(_("Updating volume stats"))
data = {}

# Note(zhiteng): These information are driver/backend specific,
Expand All @@ -566,7 +566,7 @@ def _update_volume_status(self):
self.configuration.volume_group,
run_as_root=True)
except exception.ProcessExecutionError as exc:
LOG.error(_("Error retrieving volume status: %s"), exc.stderr)
LOG.error(_("Error retrieving volume stats: %s"), exc.stderr)
out = False

if out:
Expand Down Expand Up @@ -659,18 +659,18 @@ def create_snapshot(self, snapshot):
self._do_lvm_snapshot(orig_lv_name, snapshot)

def get_volume_stats(self, refresh=False):
"""Get volume status.
"""Get volume stats.
If 'refresh' is True, run update the stats first.
"""
if refresh:
self._update_volume_status()
self._update_volume_stats()

return self._stats

def _update_volume_status(self):
"""Retrieve status info from volume group."""
def _update_volume_stats(self):
"""Retrieve stats info from volume group."""

LOG.debug(_("Updating volume status"))
LOG.debug(_("Updating volume stats"))
data = {}

backend_name = self.configuration.safe_get('volume_backend_name')
Expand Down
18 changes: 9 additions & 9 deletions cinder/volume/drivers/netapp/iscsi.py
Expand Up @@ -537,17 +537,17 @@ def create_cloned_volume(self, volume, src_vref):
self._clone_lun(src_vol.name, new_name, 'true')

def get_volume_stats(self, refresh=False):
"""Get volume status.
"""Get volume stats.
If 'refresh' is True, run update the stats first.
"""
if refresh:
self._update_volume_status()
self._update_volume_stats()

return self._stats

def _update_volume_status(self):
"""Retrieve status info from volume group."""
def _update_volume_stats(self):
"""Retrieve stats info from volume group."""
raise NotImplementedError()


Expand Down Expand Up @@ -829,10 +829,10 @@ def _configure_tunneling(self, do_tunneling=False):
else:
self.client.set_vserver(None)

def _update_volume_status(self):
"""Retrieve status info from volume group."""
def _update_volume_stats(self):
"""Retrieve stats info from volume group."""

LOG.debug(_("Updating volume status"))
LOG.debug(_("Updating volume stats"))
data = {}
netapp_backend = 'NetApp_iSCSI_Cluster_direct'
backend_name = self.configuration.safe_get('volume_backend_name')
Expand Down Expand Up @@ -1112,10 +1112,10 @@ def _create_lun_meta(self, lun):
'is-space-reservation-enabled')
return meta_dict

def _update_volume_status(self):
def _update_volume_stats(self):
"""Retrieve status info from volume group."""

LOG.debug(_("Updating volume status"))
LOG.debug(_("Updating volume stats"))
data = {}
netapp_backend = 'NetApp_iSCSI_7mode_direct'
backend_name = self.configuration.safe_get('volume_backend_name')
Expand Down
18 changes: 9 additions & 9 deletions cinder/volume/drivers/netapp/nfs.py
Expand Up @@ -182,9 +182,9 @@ def create_cloned_volume(self, volume, src_vref):

return {'provider_location': share}

def _update_volume_status(self):
"""Retrieve status info from volume group."""
super(NetAppNFSDriver, self)._update_volume_status()
def _update_volume_stats(self):
"""Retrieve stats info from volume group."""
super(NetAppNFSDriver, self)._update_volume_stats()


class NetAppDirectNfsDriver (NetAppNFSDriver):
Expand Down Expand Up @@ -344,9 +344,9 @@ def _clone_file(self, volume, src_path, dest_path, vserver=None):
'destination-path': dest_path})
self._invoke_successfully(clone_create, vserver)

def _update_volume_status(self):
"""Retrieve status info from volume group."""
super(NetAppDirectCmodeNfsDriver, self)._update_volume_status()
def _update_volume_stats(self):
"""Retrieve stats info from volume group."""
super(NetAppDirectCmodeNfsDriver, self)._update_volume_stats()
netapp_backend = 'NetApp_NFS_cluster_direct'
backend_name = self.configuration.safe_get('volume_backend_name')
self._stats["volume_backend_name"] = (backend_name or
Expand Down Expand Up @@ -476,9 +476,9 @@ def _clear_clone(self, clone_id):
time.sleep(5)
retry = retry - 1

def _update_volume_status(self):
"""Retrieve status info from volume group."""
super(NetAppDirect7modeNfsDriver, self)._update_volume_status()
def _update_volume_stats(self):
"""Retrieve stats info from volume group."""
super(NetAppDirect7modeNfsDriver, self)._update_volume_stats()
netapp_backend = 'NetApp_NFS_7mode_direct'
backend_name = self.configuration.safe_get('volume_backend_name')
self._stats["volume_backend_name"] = (backend_name or
Expand Down
10 changes: 5 additions & 5 deletions cinder/volume/drivers/nexenta/volume.py
Expand Up @@ -284,17 +284,17 @@ def remove_export(self, _ctx, volume):
{'target': target_name, 'exc': exc})

def get_volume_stats(self, refresh=False):
"""Get volume status.
"""Get volume stats.
If 'refresh' is True, run update the stats first.
"""
if refresh:
self._update_volume_status()
self._update_volume_stats()

return self._stats

def _update_volume_status(self):
"""Retrieve status info for Nexenta device."""
def _update_volume_stats(self):
"""Retrieve stats info for Nexenta device."""

# NOTE(jdg): Aimon Bustardo was kind enough to point out the
# info he had regarding Nexenta Capabilities, ideally it would
Expand All @@ -303,7 +303,7 @@ def _update_volume_status(self):
KB = 1024
MB = KB ** 2

LOG.debug(_("Updating volume status"))
LOG.debug(_("Updating volume stats"))
data = {}
backend_name = self.__class__.__name__
if self.configuration:
Expand Down
8 changes: 4 additions & 4 deletions cinder/volume/drivers/nfs.py
Expand Up @@ -436,17 +436,17 @@ def _mount_nfs(self, nfs_share, mount_path, ensure=False):
raise

def get_volume_stats(self, refresh=False):
"""Get volume status.
"""Get volume stats.
If 'refresh' is True, run update the stats first.
"""
if refresh or not self._stats:
self._update_volume_status()
self._update_volume_stats()

return self._stats

def _update_volume_status(self):
"""Retrieve status info from volume group."""
def _update_volume_stats(self):
"""Retrieve stats info from volume group."""

data = {}
backend_name = self.configuration.safe_get('volume_backend_name')
Expand Down

0 comments on commit 5b50bd8

Please sign in to comment.