]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: fix get_partition_uuid for loop/cciss
authorDan van der Ster <daniel.vanderster@cern.ch>
Fri, 12 Dec 2014 11:35:42 +0000 (12:35 +0100)
committerLoic Dachary <ldachary@redhat.com>
Sat, 13 Dec 2014 14:01:45 +0000 (15:01 +0100)
Loopback and cciss devices have an extra 'p' before the partition
number. Add exceptional handling of these devices.

Signed-off-by: Dan van der Ster <daniel.vanderster@cern.ch>
src/ceph-disk

index b96ae9720631fd0d7a1a2db07b84f33068c22784..c1e6e09678ea0d9c50316cfe1768e5c2bd3be77f 100755 (executable)
@@ -2285,7 +2285,10 @@ def get_partition_type(part):
 
 
 def get_partition_uuid(dev):
-    (base, partnum) = re.match('(\D+)(\d+)', dev).group(1, 2)
+    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)
     out, _ = command(['sgdisk', '-i', partnum, base])
     for line in out.splitlines():
         m = re.match('Partition unique GUID: (\S+)', line)