[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [PATCH 3/3] Set UUIDs including subsystem prefix for mpath, dmraid devices. (#584328)



On 10/12/2010 06:27 PM, David Lehman wrote:
---

Not the best changelog ever, but the patch looks fine.


  device.py |   18 ++++++++++++++++--
  1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/device.py b/device.py
index c9ccc84..0bf0398 100644
--- a/device.py
+++ b/device.py
@@ -322,7 +322,8 @@ class MultiPath:
          table = self.get_table()
          import dm as _dm

-        self.get_map()
+        self._set_map_uuid(self.map)
+
          # this sets the refcount to 2 (undone by __deactivate__)
          nameCache.get(self.name)

@@ -382,6 +383,10 @@ class MultiPath:
          self._MultiPath__prefix = value
      prefix = property(get_prefix, set_prefix, None, \
          "prefix for path to device nodes")
+
+    def _set_map_uuid(self, map):
+        if map and not map.uuid:
+            map.uuid = "MPATH-%s" % map.name

      def get_PedDevice(self):
          import parted as _parted
@@ -523,6 +528,7 @@ class MultiPath:
                      map = _PartitionDeviceMap(0, 2, bdev,
                          part.geometry.start, part.number)
                  map.name = name
+                self._set_map_uuid(map)
                  yield map

          del disk
@@ -610,6 +616,8 @@ class RaidSet:
          self.active = False
          self.mknod = False

+        self._set_map_uuid(self.map)
+
      def __cmp__(self, other):
          return cmp(self.map, other.map)

@@ -620,7 +628,12 @@ class RaidSet:
      prefix = property(get_prefix, set_prefix, None, \
          "prefix for path to device nodes")

-    def get_PedDevice(self):
+    def _set_map_uuid(self, map):
+        if map and not map.uuid:
+            # make sure the map has a uuid complete with subsystem prefix
+            map.uuid = "DMRAID-%s" % map.name
+
+     def get_PedDevice(self):
          import parted as _parted
          ret = _parted.getDevice(self.bdev.path)
          del _parted
@@ -786,6 +799,7 @@ class RaidSet:
                      map = _PartitionDeviceMap(0, 2, bdev,
                          part.geometry.start, part.number)
                  map.name = name
+                self._set_map_uuid(map)
                  map.create()
                  self._RaidSet__parts.append(map)



--
        Peter

Computers have already beaten communists at chess.  The next thing you
know, they'll be beating humans.
		-- Dale

01234567890123456789012345678901234567890123456789012345678901234567890123456789


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]