]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: support NVMe device partitions 4892/head
authorislepnev <islepnev@gmail.com>
Fri, 17 Apr 2015 19:33:01 +0000 (22:33 +0300)
committerAbhishek Lekshmanan <abhishek.lekshmanan@ril.com>
Sun, 7 Jun 2015 09:22:14 +0000 (14:52 +0530)
Linux nvme kernel module v0.9 enumerate devices as following:

/dev/nvme0 - characted revice
/dev/nvme0n1 - whole block device
/dev/nvme0n1p1 - first partition
/dev/nvme0n1p2 - second partition

http://tracker.ceph.com/issues/11612 Fixes: #11612

Signed-off-by: Ilja Slepnev <islepnev@gmail.com>
(cherry picked from commit 9b62cf254d02d30609793be8b1cb8a94f38891f1)

src/ceph-disk

index 1f6239944ab528b4823060089c433b4ef58a1a65..61a28fdf00f22a0279c759a5151336f4be1e8254 100755 (executable)
@@ -2358,6 +2358,13 @@ def get_dev_fs(dev):
         return None
 
 
+def split_dev_base_partnum(dev):
+    if 'loop' in dev or 'cciss' in dev or 'nvme' in dev:
+        return re.match('(.*\d+)p(\d+)', dev).group(1, 2)
+    else:
+        return re.match('(\D+)(\d+)', dev).group(1, 2)
+
+
 def get_partition_type(part):
     """
     Get the GPT partition type UUID.  If we have an old blkid and can't
@@ -2407,7 +2414,7 @@ def get_partition_type(part):
     if 'blkid' not in warned_about:
         LOG.warning('Old blkid does not support ID_PART_ENTRY_* fields, trying sgdisk; may not correctly identify ceph volumes with dmcrypt')
         warned_about['blkid'] = True
-    (base, partnum) = re.match('(\D+)(\d+)', part).group(1, 2)
+    (base, partnum) = split_dev_base_partnum(part)
     sgdisk, _ = command(
         [
             'sgdisk',
@@ -2433,10 +2440,7 @@ def get_partition_type(part):
 
 
 def get_partition_uuid(dev):
-    if 'loop' in dev or 'cciss' in dev:
-        (base, partnum) = re.match('(.*\d+)p(\d+)', dev).group(1, 2)
-    else:
-        (base, partnum) = re.match('(\D+)(\d+)', dev).group(1, 2)
+    (base, partnum) = split_dev_base_partnum(dev)
     out, _ = command(['sgdisk', '-i', partnum, base])
     for line in out.splitlines():
         m = re.match('Partition unique GUID: (\S+)', line)