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

Re: [PATCH] Move setting of UUIDs into activate methods. (#584328)



 On 10/20/2010 05:57 AM, David Lehman wrote:
 Setting the UUIDs from __init__ means accessing self.map, which has the
 side-effect of creating the array's device node and setting self.active
 to True, which prevents subsequent calls to activate from creating the
 partitions' device nodes. We avoid this mess by setting the UUIDs only
 from within activate and only if mknod is True.
 ---
 device.py | 9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

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

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

 @@ -570,9 +569,8 @@ class MultiPath:
 self.map.dev.mknod(self.prefix+self.name)
 self.mknod = True

 - map = self.map
 + self._set_map_uuid(self.map)
 nameCache.get(self.name) # this should set the refcount to 2
 - del map

 self.removeMemberParts()
 self.buildParts()
 @@ -616,8 +614,6 @@ class RaidSet:
 self.active = False
 self.mknod = False

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

 @@ -841,6 +837,7 @@ class RaidSet:
 pass
 self.map.dev.mknod(self.prefix+self.name)
 self.mknod = True
 + self._set_map_uuid(self.map)

 self.removeMemberParts()
 if mkparts:

Ack.

--
David Cantrell <dcantrell redhat com>
Red Hat / Honolulu, HI


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