From 5b50bd8d515e8a69e2f57baffc42f5d4e2bc17a2 Mon Sep 17 00:00:00 2001 From: Kun Huang Date: Sun, 21 Jul 2013 02:00:33 +0800 Subject: [PATCH] fix name 'update_volume_status' to 'update_volume_stats' _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 --- cinder/tests/test_block_device.py | 4 ++-- cinder/tests/test_volume.py | 2 +- cinder/volume/driver.py | 10 ++++----- cinder/volume/drivers/block_device.py | 8 +++---- cinder/volume/drivers/emc/emc_smis_common.py | 6 +++--- cinder/volume/drivers/emc/emc_smis_iscsi.py | 12 +++++------ cinder/volume/drivers/gpfs.py | 10 ++++----- cinder/volume/drivers/huawei/huawei_iscsi.py | 10 ++++----- cinder/volume/drivers/lvm.py | 22 ++++++++++---------- cinder/volume/drivers/netapp/iscsi.py | 18 ++++++++-------- cinder/volume/drivers/netapp/nfs.py | 18 ++++++++-------- cinder/volume/drivers/nexenta/volume.py | 10 ++++----- cinder/volume/drivers/nfs.py | 8 +++---- cinder/volume/drivers/storwize_svc.py | 14 ++++++------- 14 files changed, 76 insertions(+), 76 deletions(-) diff --git a/cinder/tests/test_block_device.py b/cinder/tests/test_block_device.py index cd928b2c9..b51424382 100644 --- a/cinder/tests/test_block_device.py +++ b/cinder/tests/test_block_device.py @@ -101,7 +101,7 @@ class TestBlockDeviceDriver(cinder.test.TestCase): '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}) @@ -111,7 +111,7 @@ class TestBlockDeviceDriver(cinder.test.TestCase): 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, diff --git a/cinder/tests/test_volume.py b/cinder/tests/test_volume.py index 41c389b6e..949e435a0 100644 --- a/cinder/tests/test_volume.py +++ b/cinder/tests/test_volume.py @@ -1613,7 +1613,7 @@ class ISCSITestCase(DriverTestCase): 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 diff --git a/cinder/volume/driver.py b/cinder/volume/driver.py index bb088573d..0543cbcd1 100644 --- a/cinder/volume/driver.py +++ b/cinder/volume/driver.py @@ -467,19 +467,19 @@ class ISCSIDriver(VolumeDriver): 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' diff --git a/cinder/volume/drivers/block_device.py b/cinder/volume/drivers/block_device.py index 130c642df..b94be1bf3 100644 --- a/cinder/volume/drivers/block_device.py +++ b/cinder/volume/drivers/block_device.py @@ -318,11 +318,11 @@ class BlockDeviceDriver(driver.ISCSIDriver): 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 @@ -332,7 +332,7 @@ class BlockDeviceDriver(driver.ISCSIDriver): 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, diff --git a/cinder/volume/drivers/emc/emc_smis_common.py b/cinder/volume/drivers/emc/emc_smis_common.py index 90ae06103..7e22befdd 100644 --- a/cinder/volume/drivers/emc/emc_smis_common.py +++ b/cinder/volume/drivers/emc/emc_smis_common.py @@ -852,9 +852,9 @@ class EMCSMISCommon(): 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() diff --git a/cinder/volume/drivers/emc/emc_smis_iscsi.py b/cinder/volume/drivers/emc/emc_smis_iscsi.py index 411174299..24956246f 100644 --- a/cinder/volume/drivers/emc/emc_smis_iscsi.py +++ b/cinder/volume/drivers/emc/emc_smis_iscsi.py @@ -221,19 +221,19 @@ class EMCSMISISCSIDriver(driver.ISCSIDriver): 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' diff --git a/cinder/volume/drivers/gpfs.py b/cinder/volume/drivers/gpfs.py index 901924c7e..c076e561a 100644 --- a/cinder/volume/drivers/gpfs.py +++ b/cinder/volume/drivers/gpfs.py @@ -332,20 +332,20 @@ class GPFSDriver(driver.VolumeDriver): 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' diff --git a/cinder/volume/drivers/huawei/huawei_iscsi.py b/cinder/volume/drivers/huawei/huawei_iscsi.py index 4c868668b..ac66098e4 100644 --- a/cinder/volume/drivers/huawei/huawei_iscsi.py +++ b/cinder/volume/drivers/huawei/huawei_iscsi.py @@ -546,12 +546,12 @@ class HuaweiISCSIDriver(driver.ISCSIDriver): 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 @@ -1501,10 +1501,10 @@ class HuaweiISCSIDriver(driver.ISCSIDriver): 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' diff --git a/cinder/volume/drivers/lvm.py b/cinder/volume/drivers/lvm.py index 18640c077..9b2646894 100644 --- a/cinder/volume/drivers/lvm.py +++ b/cinder/volume/drivers/lvm.py @@ -531,19 +531,19 @@ class LVMISCSIDriver(LVMVolumeDriver, driver.ISCSIDriver): 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, @@ -566,7 +566,7 @@ class LVMISCSIDriver(LVMVolumeDriver, driver.ISCSIDriver): 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: @@ -659,18 +659,18 @@ class ThinLVMVolumeDriver(LVMISCSIDriver): 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') diff --git a/cinder/volume/drivers/netapp/iscsi.py b/cinder/volume/drivers/netapp/iscsi.py index a83e274a1..266b926cf 100644 --- a/cinder/volume/drivers/netapp/iscsi.py +++ b/cinder/volume/drivers/netapp/iscsi.py @@ -537,17 +537,17 @@ class NetAppDirectISCSIDriver(driver.ISCSIDriver): 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() @@ -829,10 +829,10 @@ class NetAppDirectCmodeISCSIDriver(NetAppDirectISCSIDriver): 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') @@ -1112,10 +1112,10 @@ class NetAppDirect7modeISCSIDriver(NetAppDirectISCSIDriver): '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') diff --git a/cinder/volume/drivers/netapp/nfs.py b/cinder/volume/drivers/netapp/nfs.py index c15787584..30d4b49b2 100644 --- a/cinder/volume/drivers/netapp/nfs.py +++ b/cinder/volume/drivers/netapp/nfs.py @@ -182,9 +182,9 @@ class NetAppNFSDriver(nfs.NfsDriver): 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): @@ -344,9 +344,9 @@ class NetAppDirectCmodeNfsDriver (NetAppDirectNfsDriver): '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 @@ -476,9 +476,9 @@ class NetAppDirect7modeNfsDriver (NetAppDirectNfsDriver): 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 diff --git a/cinder/volume/drivers/nexenta/volume.py b/cinder/volume/drivers/nexenta/volume.py index 4bc3f6878..d18136186 100644 --- a/cinder/volume/drivers/nexenta/volume.py +++ b/cinder/volume/drivers/nexenta/volume.py @@ -284,17 +284,17 @@ class NexentaDriver(driver.ISCSIDriver): # pylint: disable=R0921 {'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 @@ -303,7 +303,7 @@ class NexentaDriver(driver.ISCSIDriver): # pylint: disable=R0921 KB = 1024 MB = KB ** 2 - LOG.debug(_("Updating volume status")) + LOG.debug(_("Updating volume stats")) data = {} backend_name = self.__class__.__name__ if self.configuration: diff --git a/cinder/volume/drivers/nfs.py b/cinder/volume/drivers/nfs.py index 275b61000..b851c4eb8 100644 --- a/cinder/volume/drivers/nfs.py +++ b/cinder/volume/drivers/nfs.py @@ -436,17 +436,17 @@ class NfsDriver(RemoteFsDriver): 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') diff --git a/cinder/volume/drivers/storwize_svc.py b/cinder/volume/drivers/storwize_svc.py index ad545c09f..c339e34a8 100755 --- a/cinder/volume/drivers/storwize_svc.py +++ b/cinder/volume/drivers/storwize_svc.py @@ -1343,20 +1343,20 @@ class StorwizeSVCDriver(san.SanISCSIDriver): """=====================================================================""" def get_volume_stats(self, refresh=False): - """Get volume status. + """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_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 = {} data['vendor_name'] = 'IBM' @@ -1373,7 +1373,7 @@ class StorwizeSVCDriver(san.SanISCSIDriver): ssh_cmd = 'svcinfo lssystem -delim !' attributes = self._execute_command_and_parse_attributes(ssh_cmd) if not attributes or not attributes['name']: - exception_message = (_('_update_volume_status: ' + exception_message = (_('_update_volume_stats: ' 'Could not get system name')) raise exception.VolumeBackendAPIException(data=exception_message) @@ -1386,7 +1386,7 @@ class StorwizeSVCDriver(san.SanISCSIDriver): attributes = self._execute_command_and_parse_attributes(ssh_cmd) if not attributes: LOG.error(_('Could not get pool data from the storage')) - exception_message = (_('_update_volume_status: ' + exception_message = (_('_update_volume_stats: ' 'Could not get storage pool data')) raise exception.VolumeBackendAPIException(data=exception_message) -- 2.45.2