]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: display information about dmcrypted data and journal volumes
authorSage Weil <sage@redhat.com>
Wed, 13 Aug 2014 00:26:07 +0000 (17:26 -0700)
committerSage Weil <sage@redhat.com>
Sat, 16 Aug 2014 00:15:37 +0000 (17:15 -0700)
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit c7a1ceba441fa99a82e19ed2cd3c6782a5d77636)

src/ceph-disk

index 9ff7f5c81083a0c4e97ba4d1338256af65b1083a..398e5c89a1bb7637d7682843fca047e2a2e20421 100755 (executable)
@@ -2243,11 +2243,30 @@ def list_dev(dev, uuid_map, journal_map):
             desc = ['ceph data'] + desc
         else:
             desc = ['ceph data', 'unprepared']
+    elif ptype == DMCRYPT_OSD_UUID:
+        holders = is_held(dev)
+        if not holders:
+            desc = ['ceph data (dmcrypt)', 'not currently mapped']
+        elif len(holders) == 1:
+            holder = '/dev/' + holders[0]
+            fs_desc = list_dev_osd(holder, uuid_map)
+            desc = ['ceph data (dmcrypt %s)' % holder] + fs_desc
+        else:
+            desc = ['ceph data (dmcrypt)', 'holders: ' + ','.join(holders)]
     elif ptype == JOURNAL_UUID:
         desc.append('ceph journal')
         part_uuid = get_partition_uuid(dev)
         if part_uuid and part_uuid in journal_map:
             desc.append('for %s' % journal_map[part_uuid])
+    elif ptype == DMCRYPT_JOURNAL_UUID:
+        holders = is_held(dev)
+        if len(holders) == 1:
+            desc = ['ceph journal (dmcrypt /dev/%s)' % holders[0]]
+        else:
+            desc = ['ceph journal (dmcrypt)']
+        part_uuid = get_partition_uuid(dev)
+        if part_uuid and part_uuid in journal_map:
+            desc.append('for %s' % journal_map[part_uuid])
     else:
         path = is_mounted(dev)
         fs_type = get_dev_fs(dev)
@@ -2291,6 +2310,22 @@ def main_list(args):
                             unmount(tpath)
                     except MountError:
                         pass
+            if ptype == DMCRYPT_OSD_UUID:
+                holders = is_held(dev)
+                if len(holders) == 1:
+                    holder = '/dev/' + holders[0]
+                    fs_type = get_dev_fs(holder)
+                    if fs_type is not None:
+                        try:
+                            tpath = mount(dev=holder, fstype=fs_type, options='')
+                            try:
+                                journal_uuid = get_oneliner(tpath, 'journal_uuid')
+                                if journal_uuid:
+                                    journal_map[journal_uuid.lower()] = dev
+                            finally:
+                                unmount(tpath)
+                        except MountError:
+                            pass
 
     for base, parts in sorted(partmap.iteritems()):
         if parts: