[Thincrust-devel] [PATCH 2/3] Ensure that more than 10 devices can be assigned symlink, mappings that do not overlap.

Marc Savy msavy at redhat.com
Fri Aug 3 14:25:44 UTC 2012


Previously this behaviour was exhibited when over 10 devices are present:
    https://gist.github.com/3eda2490dde8c49e26b1

This patch ensures that the entire device number is matched.

  From 5efb73c15b9a2851ebb0d3b4d7a625a27bb46317 Mon Sep 17 00:00:00 2001
From: Marc Savy <msavy at redhat.com>
Date: Wed, 18 Jul 2012 14:09:44 +0100
Subject: [PATCH 2/3] Ensure that more than 10 devices can be assigned 
symlink
   mappings that do not overlap.
To: thincrust-devel at redhat.com

---
   appcreate/partitionedfs.py | 5 ++++-
   1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/appcreate/partitionedfs.py b/appcreate/partitionedfs.py
index 705c2ae..4982a69 100644
--- a/appcreate/partitionedfs.py
+++ b/appcreate/partitionedfs.py
@@ -24,6 +24,7 @@ import glob
   import shutil
   import subprocess
   import logging
+import re

   from imgcreate.errors import *
   from imgcreate.fs import *
@@ -141,8 +142,10 @@ class PartitionedMount(Mount):
               for i in range(len(kpartxOutput)):
                   line = kpartxOutput[i]
                   newdev = line.split()[0]
+                newdev_id = re.search('^loop\d+?p(\d+)$', newdev).group(1)
+
                   mapperdev = "/dev/mapper/" + newdev
-                loopdev = d['disk'].device + newdev[-1]
+                loopdev = d['disk'].device + newdev_id

                   logging.debug("Dev %s: %s -> %s" % (newdev, loopdev, 
mapperdev))
                   pnum = d['partitions'][i]
-- 
1.7.11.2


-------------- next part --------------
From 5efb73c15b9a2851ebb0d3b4d7a625a27bb46317 Mon Sep 17 00:00:00 2001
From: Marc Savy <msavy at redhat.com>
Date: Wed, 18 Jul 2012 14:09:44 +0100
Subject: [PATCH 2/3] Ensure that more than 10 devices can be assigned symlink
 mappings that do not overlap.
To: thincrust-devel at redhat.com

---
 appcreate/partitionedfs.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/appcreate/partitionedfs.py b/appcreate/partitionedfs.py
index 705c2ae..4982a69 100644
--- a/appcreate/partitionedfs.py
+++ b/appcreate/partitionedfs.py
@@ -24,6 +24,7 @@ import glob
 import shutil
 import subprocess
 import logging
+import re
 
 from imgcreate.errors import *
 from imgcreate.fs import *
@@ -141,8 +142,10 @@ class PartitionedMount(Mount):
             for i in range(len(kpartxOutput)):
                 line = kpartxOutput[i]
                 newdev = line.split()[0]
+                newdev_id = re.search('^loop\d+?p(\d+)$', newdev).group(1)
+
                 mapperdev = "/dev/mapper/" + newdev
-                loopdev = d['disk'].device + newdev[-1]
+                loopdev = d['disk'].device + newdev_id
 
                 logging.debug("Dev %s: %s -> %s" % (newdev, loopdev, mapperdev))
                 pnum = d['partitions'][i]
-- 
1.7.11.2




More information about the Thincrust-devel mailing list