From: Loic Dachary Date: Mon, 17 Aug 2015 21:00:44 +0000 (+0200) Subject: ceph-disk: replace partx with partprobe X-Git-Tag: v9.1.0~252^2~1^2~16 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=aac89719881c2788941b74d385d95860e520ea78;p=ceph.git ceph-disk: replace partx with partprobe 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 --- diff --git a/src/ceph-disk b/src/ceph-disk index 69f8b8c5f0d5..555f62c3ee3f 100755 --- a/src/ceph-disk +++ b/src/ceph-disk @@ -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: