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

Re: [PATCH 2/3] Add a uuid property to DeviceMap and pass the value to dm.map ctor.



On 10/12/2010 06:27 PM, David Lehman wrote:
Related: rhbz#584328

Looks good to me.

---
  maps.py |   14 +++++++++++++-
  1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/maps.py b/maps.py
index 4090422..ccc8ca5 100644
--- a/maps.py
+++ b/maps.py
@@ -149,6 +149,16 @@ class DeviceMap:
          self.__name = name
      name = property(get_name, set_name, None, "the name of the device map")

+    def get_uuid(self):
+        return self.__uuid
+    def set_uuid(self, uuid):
+        if not self.map is None:
+            if self.map.uuid:
+                raise ValueError("UUID already set for %s" % self.name)
+            self.map.uuid = uuid
+        self.__uuid = uuid
+    uuid = property(get_uuid, set_uuid, None, "the uuid of the device map")
+
      def get_map(self):
          return self.__map
      def set_map(self, map):
@@ -163,6 +173,7 @@ class DeviceMap:
          self.__parents = []
          self.__map = None
          self.__name = None
+        self.__uuid = None

          self.start = start
          self.size = size
@@ -183,7 +194,8 @@ class DeviceMap:
                  name = self.name
              if self.name is None:
                  raise ValueError, "DeviceMap name is not set"
-            self.map = _dm.map(name = self.name, table = self.table)
+            self.map = _dm.map(name = self.name, uuid=self.uuid,
+                               table = self.table)
          del _dm
          del _device



--
        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]