]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix _update_volume_stats typos
authorKIYOHIRO ADACHI <adachi@mxs.nes.nec.co.jp>
Tue, 26 Nov 2013 06:54:17 +0000 (15:54 +0900)
committerKIYOHIRO ADACHI <adachi@mxs.nes.nec.co.jp>
Tue, 26 Nov 2013 22:29:45 +0000 (07:29 +0900)
Fix _update_volume_stats typos in 'cinder/volume/driver.py' and
'cinder/volume/drivers/eqlx.py'.
'_update_volume_status' to '_update_volume_stats'

Change-Id: I0642bdb911ca72517ed655f795e0055f4c4654b8
Closes-Bug: #1254978

cinder/tests/test_eqlx.py
cinder/tests/test_volume.py
cinder/volume/driver.py
cinder/volume/drivers/eqlx.py

index 433989374c2d2145841004ad7c09969fb13e0153..c2306e6a7ef60c3364a7b3b8ce709f524d3314f6 100644 (file)
@@ -217,17 +217,29 @@ class DellEQLSanISCSIDriverTestCase(test.TestCase):
         self.driver.do_setup(self._context)
         self.assertEqual(fake_group_ip, self.driver._group_ip)
 
-    def test_update_volume_status(self):
+    def test_update_volume_stats(self):
         self.driver._eql_execute = self.mox.\
             CreateMock(self.driver._eql_execute)
         self.driver._eql_execute('pool', 'select',
                                  self.configuration.eqlx_pool, 'show').\
             AndReturn(['TotalCapacity: 111GB', 'FreeSpace: 11GB'])
         self.mox.ReplayAll()
-        self.driver._update_volume_status()
+        self.driver._update_volume_stats()
         self.assertEqual(self.driver._stats['total_capacity_gb'], 111.0)
         self.assertEqual(self.driver._stats['free_capacity_gb'], 11.0)
 
+    def test_update_volume_stats2(self):
+        self.driver._eql_execute = self.mox.\
+            CreateMock(self.driver._eql_execute)
+        self.driver._eql_execute('pool', 'select',
+                                 self.configuration.eqlx_pool, 'show').\
+            AndReturn(['TotalCapacity: 111GB', 'FreeSpace: 11GB'])
+        self.mox.ReplayAll()
+        stats = self.driver.get_volume_stats(refresh=True)
+        self.assertEqual(stats['total_capacity_gb'], float('111.0'))
+        self.assertEqual(stats['free_capacity_gb'], float('11.0'))
+        self.assertEqual(stats['vendor_name'], 'Dell')
+
     def test_get_space_in_gb(self):
         self.assertEqual(self.driver._get_space_in_gb('123.0GB'), 123.0)
         self.assertEqual(self.driver._get_space_in_gb('123.0TB'), 123.0 * 1024)
index bbdea1d80e9b698a96dd32c62a5b6ccc84f210e3..b0daff791ce50dcbc8a69617ca3faa3bcb4eb35d 100644 (file)
@@ -2378,6 +2378,34 @@ class ISERTestCase(ISCSITestCase):
         self.configuration.iser_ip_address = '0.0.0.0'
         self.configuration.iser_port = 3260
 
+    def test_get_volume_stats(self):
+        def _fake_get_all_volume_groups(obj, vg_name=None, no_suffix=True):
+            return [{'name': 'cinder-volumes',
+                     'size': '5.52',
+                     'available': '0.52',
+                     'lv_count': '2',
+                     'uuid': 'vR1JU3-FAKE-C4A9-PQFh-Mctm-9FwA-Xwzc1m'}]
+
+        self.stubs.Set(brick_lvm.LVM,
+                       'get_all_volume_groups',
+                       _fake_get_all_volume_groups)
+        self.volume.driver.vg = brick_lvm.LVM('cinder-volumes', 'sudo')
+
+        stats = self.volume.driver.get_volume_stats(refresh=True)
+
+        self.assertEqual(stats['total_capacity_gb'], float('5.52'))
+        self.assertEqual(stats['free_capacity_gb'], float('0.52'))
+        self.assertEqual(stats['storage_protocol'], 'iSER')
+
+    def test_get_volume_stats2(self):
+        iser_driver = self.base_driver(configuration=self.configuration)
+
+        stats = iser_driver.get_volume_stats(refresh=True)
+
+        self.assertEqual(stats['total_capacity_gb'], 'infinite')
+        self.assertEqual(stats['free_capacity_gb'], 'infinite')
+        self.assertEqual(stats['storage_protocol'], 'iSER')
+
 
 class FibreChannelTestCase(DriverTestCase):
     """Test Case for FibreChannelDriver."""
index ab9c275113ed56234996cea7f202eabf2b8717ed..049fd7a714d570805b8e55b1154a6d74c83e5a71 100644 (file)
@@ -795,10 +795,10 @@ class ISERDriver(ISCSIDriver):
             'data': iser_properties
         }
 
-    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_iSER'
index 92cdef642f340ff9f547764c2f7135458ebfcfb2..75cca0f4693935a1cdda603a0cb0a7bd71c3d86a 100644 (file)
@@ -241,10 +241,10 @@ class DellEQLSanISCSIDriver(SanISCSIDriver):
             part = 'TB'
         return scale * float(val.partition(part)[0])
 
-    def _update_volume_status(self):
-        """Retrieve status info from volume group."""
+    def _update_volume_stats(self):
+        """Retrieve stats info from eqlx group."""
 
-        LOG.debug(_("Updating volume status"))
+        LOG.debug(_("Updating volume stats"))
         data = {}
         backend_name = "eqlx"
         if self.configuration: