]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Brick LVM: Rename get_all_volumes, further optimize
authorEric Harney <eharney@redhat.com>
Tue, 28 Oct 2014 21:03:42 +0000 (17:03 -0400)
committerEric Harney <eharney@redhat.com>
Wed, 29 Oct 2014 13:53:29 +0000 (09:53 -0400)
This method can process all LVs, those in a VG, or an
individual LV.  Rename it to be more descriptive.

Optimize update_volume_group_info check for thin pool.

Remove volume.utils.get_all_volumes, which is unused.

Remove fake_lvm.get_all_volumes and
fake_lvm.get_all_volume_groups which don't appear to
have correct signatures/returns and are unused.

Change-Id: I412c62230517cbfc08cc0076aaeea45224e6b50e

cinder/brick/local_dev/lvm.py
cinder/tests/brick/fake_lvm.py
cinder/volume/utils.py

index 1befdfa9c8519eae0814bf8439788439436c3fce..aecdb3c2bbfd7afb2aa59a9253a3bc5075608bb7 100644 (file)
@@ -233,8 +233,8 @@ class LVM(executor.Executor):
         return self._supports_lvchange_ignoreskipactivation
 
     @staticmethod
-    def get_all_volumes(root_helper, vg_name=None, lv_name=None):
-        """Static method to get all LV's on a system.
+    def get_lv_info(root_helper, vg_name=None, lv_name=None):
+        """Retrieve info about LVs (all, in a VG, or a single LV).
 
         :param root_helper: root_helper to use for execute
         :param vg_name: optional, gathers info for only the specified VG
@@ -273,9 +273,9 @@ class LVM(executor.Executor):
         :returns: List of Dictionaries with LV info
 
         """
-        self.lv_list = self.get_all_volumes(self._root_helper,
-                                            self.vg_name,
-                                            lv_name)
+        self.lv_list = self.get_lv_info(self._root_helper,
+                                        self.vg_name,
+                                        lv_name)
         return self.lv_list
 
     def get_volume(self, name):
@@ -389,7 +389,9 @@ class LVM(executor.Executor):
         self.vg_uuid = vg_list[0]['uuid']
 
         if self.vg_thin_pool is not None:
-            for lv in self.get_all_volumes(self._root_helper, self.vg_name):
+            for lv in self.get_lv_info(self._root_helper,
+                                       self.vg_name,
+                                       self.vg_thin_pool):
                 if lv['name'] == self.vg_thin_pool:
                     self.vg_thin_pool_size = lv['size']
                     tpfs = self._get_thin_pool_free_space(self.vg_name,
index f1cc0adb708600a84f7e161f4568365ce20b5b93..cadb3d80e940368ae5421faf0188b4abfd31cd4c 100644 (file)
@@ -27,11 +27,6 @@ class FakeBrickLVM(object):
     def supports_thin_provisioning():
         return False
 
-    def get_all_volumes(vg_name=None):
-        if vg_name is not None:
-            return [vg_name]
-        return ['cinder-volumes', 'fake-vg-1']
-
     def get_volumes(self):
         return ['fake-volume']
 
@@ -44,9 +39,6 @@ class FakeBrickLVM(object):
     def get_physical_volumes(self):
         return []
 
-    def get_all_volume_groups(vg_name=None):
-        return ['cinder-volumes', 'fake-vg']
-
     def update_volume_group_info(self):
         pass
 
index 56f5b0c6208bc1dd41c2b67ceb8219e10b5d8f51..24ccf6141dc22ec071922a2a0314f782d79b42c7 100644 (file)
@@ -393,12 +393,6 @@ def supports_thin_provisioning():
         utils.get_root_helper())
 
 
-def get_all_volumes(vg_name=None):
-    return brick_lvm.LVM.get_all_volumes(
-        utils.get_root_helper(),
-        vg_name)
-
-
 def get_all_physical_volumes(vg_name=None):
     return brick_lvm.LVM.get_all_physical_volumes(
         utils.get_root_helper(),