When creating the RAIDDevice instance, pass in Device instances (as opposed to device names) for the members list. This way we have all the information we need to set up the RAID, including encryption stuff. Previously we instantiated Devices for the RAID members in the setupDevice method. Now we just use the preexisting Device instances from the member RequestSpecs. --- fsset.py | 24 +++++++++++------------- partRequests.py | 3 ++- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/fsset.py b/fsset.py index 34259dd..0f34859 100644 --- a/fsset.py +++ b/fsset.py @@ -2362,7 +2362,7 @@ class RAIDDevice(Device): self.crypto.setDevice(self.device) # make sure the list of raid members is sorted - self.members.sort() + self.members.sort(cmp=lambda x,y: cmp(x.getDevice(),y.getDevice())) def __del__ (self): del RAIDDevice.usedMajors[self.minor] @@ -2414,13 +2414,13 @@ class RAIDDevice(Device): entry = entry + "persistent-superblock 1\n" entry = entry + "nr-spare-disks %d\n" % (self.spares,) i = 0 - for device in self.members[:self.numDisks]: + for device in [m.getDevice() for m in self.members[:self.numDisks]]: entry = entry + " device %s/%s\n" % (devPrefix, device) entry = entry + " raid-disk %d\n" % (i,) i = i + 1 i = 0 - for device in self.members[self.numDisks:]: + for device in [m.getDevice() for m in self.members[self.numDisks:]]: entry = entry + " device %s/%s\n" % (devPrefix, device) entry = entry + " spare-disk %d\n" % (i,) @@ -2428,13 +2428,10 @@ class RAIDDevice(Device): return entry def setupDevice (self, chroot="/", devPrefix='/dev'): - def devify(x): - return "/dev/%s" %(x,) - if not self.isSetup: - for device in self.members: - pd = PartitionDevice(device) - pd.setupDevice(chroot, devPrefix=devPrefix) + memberDevs = [] + for pd in self.members: + memberDevs.append(pd.setupDevice(chroot, devPrefix=devPrefix)) if pd.isNetdev(): self.setAsNetdev() args = ["--create", "/dev/%s" %(self.device,), @@ -2445,16 +2442,17 @@ class RAIDDevice(Device): if self.spares > 0: args.append("--spare-devices=%s" %(self.spares,),) - args.extend(map(devify, self.members)) + args.extend(memberDevs) log.info("going to run: %s" %(["mdadm"] + args,)) iutil.execWithRedirect ("mdadm", args, stderr="/dev/tty5", stdout="/dev/tty5", searchPath = 1) - raid.register_raid_device(self.device, self.members[:], + raid.register_raid_device(self.device, + [m.getDevice() for m in self.members], self.level, self.numDisks) self.isSetup = 1 else: - isys.raidstart(self.device, self.members[0]) + isys.raidstart(self.device, self.members[0].getDevice()) if self.crypto: self.crypto.formatDevice() @@ -2471,7 +2469,7 @@ class RAIDDevice(Device): elif not asBoot: return self.device else: - return self.members[0] + return self.members[0].getDevice(asBoot=asBoot) def solidify(self): return diff --git a/partRequests.py b/partRequests.py index 0b77e4c..cf83b25 100644 --- a/partRequests.py +++ b/partRequests.py @@ -690,7 +690,8 @@ class RaidRequestSpec(RequestSpec): # Alway return a new device for minor changing raidmems = [] for member in self.raidmembers: - raidmems.append(partitions.getRequestByID(member).device) + request = partitions.getRequestByID(member) + raidmems.append(request.getDevice(partitions)) self.dev = fsset.RAIDDevice(int(self.raidlevel[4:]), raidmems, minor = self.raidminor, spares = self.raidspares, -- 1.5.4.1 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list