]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: dereference symlinks in destroy and zap
authorLoic Dachary <ldachary@redhat.com>
Wed, 16 Dec 2015 14:57:03 +0000 (15:57 +0100)
committerLoic Dachary <ldachary@redhat.com>
Wed, 6 Jan 2016 15:54:05 +0000 (16:54 +0100)
The behavior of partprobe or sgdisk may be subtly different if given a
symbolic link to a device instead of an actual device. The debug output
is also more confusing when the symlink shows instead of the device it
points to.

Always dereference the symlink before running destroy and zap.

Signed-off-by: Loic Dachary <loic@dachary.org>
(cherry picked from commit fe71647bc9bd0f9ddc6d470ee7bee1e6b0983e2b)

Conflicts:
        src/ceph-disk
          trivial, because destroy is not implemented
          in infernalis

src/ceph-disk

index 3eab68924abc125ffbb50e3d05404e3f28dd212c..7d6b55cf1eab47a136f5fbe64cc23d43a7500be3 100755 (executable)
@@ -1242,6 +1242,7 @@ def zap(dev):
     """
     Destroy the partition table and content of a given disk.
     """
+    dev = os.path.realpath(dev)
     dmode = os.stat(dev).st_mode
     if not stat.S_ISBLK(dmode) or is_partition(dev):
         raise Error('not full block device; cannot zap', dev)