]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Merge "Fix LVM thin pool creation race"
authorJenkins <jenkins@review.openstack.org>
Fri, 13 Mar 2015 21:53:53 +0000 (21:53 +0000)
committerGerrit Code Review <review@openstack.org>
Fri, 13 Mar 2015 21:53:53 +0000 (21:53 +0000)
1  2 
cinder/brick/local_dev/lvm.py

index 2f6a3dc51e4f67f67fe07b4af7c4ce1f148b7d4e,9fe2f4de98ce770082488910df2cb5bd3eb81381..43190d2bbdb14afe310c4d8eca605f0b42846968
@@@ -92,16 -89,18 +92,22 @@@ class LVM(executor.Executor)
          if lvm_type == 'thin':
              pool_name = "%s-pool" % self.vg_name
              if self.get_volume(pool_name) is None:
-                 self.create_thin_pool(pool_name)
-             else:
-                 self.vg_thin_pool = pool_name
+                 try:
+                     self.create_thin_pool(pool_name)
+                 except putils.ProcessExecutionError:
+                     # Maybe we just lost the race against another copy of
+                     # this driver being in init in parallel - e.g.
+                     # cinder-volume and cinder-backup starting in parallel
+                     if self.get_volume(pool_name) is None:
+                         raise
+             self.vg_thin_pool = pool_name
              self.activate_lv(self.vg_thin_pool)
          self.pv_list = self.get_all_physical_volumes(root_helper, vg_name)
 +        if lvm_conf and os.path.isfile(lvm_conf):
 +            LVM.LVM_CMD_PREFIX = ['env',
 +                                  'LC_ALL=C',
 +                                  'LVM_SYSTEM_DIR=/etc/cinder']
  
      def _vg_exists(self):
          """Simple check to see if VG exists.