]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: support NVMe device partitions 4751/head
authorislepnev <islepnev@gmail.com>
Fri, 17 Apr 2015 19:33:01 +0000 (22:33 +0300)
committerIlja Slepnev <islepnev@gmail.com>
Fri, 22 May 2015 21:51:45 +0000 (00:51 +0300)
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>
src/ceph-disk

index df48a2a9c675a3f8d270c9ebea1e210db43ee4e3..bbffc58ec03ea6f6dbdf20f419286f67df2da866 100755 (executable)
@@ -2386,6 +2386,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
@@ -2435,7 +2442,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',
@@ -2461,10 +2468,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)