]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: replace partx with partprobe
authorLoic Dachary <ldachary@redhat.com>
Mon, 17 Aug 2015 21:00:44 +0000 (23:00 +0200)
committerLoic Dachary <ldachary@redhat.com>
Sat, 29 Aug 2015 00:37:51 +0000 (02:37 +0200)
Older distributions that required partx (CentOS 6 and the like) are no
longer supported and the partx fallback can be obsoleted.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
src/ceph-disk

index 69f8b8c5f0d563c85cffdfc4a0395f2d2a71ea01..555f62c3ee3f57b368bd749eec476b8dd29efbae 100755 (executable)
@@ -1123,33 +1123,14 @@ def get_free_partition_index(dev):
         return 1
 
 
-def update_partition(action, dev, description):
-     # try to make sure the kernel refreshes the table.  note
-     # that if this gets ebusy, we are probably racing with
-     # udev because it already updated it.. ignore failure here.
-
-     # On RHEL and CentOS distros, calling partprobe forces a reboot of the
-     # server. Since we are not resizing partitons so we rely on calling
-     # partx
-     if platform_distro().startswith(('centos', 'red', 'scientific')):
-         LOG.info('calling partx on %s device %s', description, dev)
-         LOG.info('re-reading known partitions will display errors')
-         command(
-             [
-                 'partx',
-                 action,
-                 dev,
-             ],
-         )
-
-     else:
-         LOG.debug('Calling partprobe on %s device %s', description, dev)
-         command(
-             [
-                 'partprobe',
-                 dev,
-             ],
-         )
+def update_partition(dev, description):
+     LOG.debug('Calling partprobe on %s device %s', description, dev)
+     command(
+         [
+             'partprobe',
+             dev,
+         ],
+     )
 
 
 def zap(dev):
@@ -1188,7 +1169,7 @@ def zap(dev):
             ],
         )
 
-        update_partition('-d', dev, 'zapped')
+        update_partition(dev, 'zapped')
 
     except subprocess.CalledProcessError as e:
         raise Error(e)
@@ -1305,7 +1286,7 @@ def prepare_journal_dev(
                 ]
             )
 
-        update_partition('-a', journal, 'prepared')
+        update_partition(journal, 'prepared')
 
         # wait for udev event queue to clear
         command(
@@ -1521,7 +1502,7 @@ def prepare_dev(
                     data,
                 ],
             )
-            update_partition('-a', data, 'created')
+            update_partition(data, 'created')
             command(
                 [
                     # wait for udev event queue to clear
@@ -1824,7 +1805,7 @@ def main_prepare(args):
         prepare_lock.release()  # noqa
 
         if stat.S_ISBLK(dmode):
-            update_partition('-a', args.data, 'prepared')
+            update_partition(args.data, 'prepared')
 
     except Error as e:
         if journal_dm_keypath: