FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora Development

 
 
LinkBack Thread Tools
 
Old 04-04-2008, 01:13 AM
David Lehman
 
Default Support encrypted RAID member devices. (#429600)

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
"
entry = entry + "nr-spare-disks %d
" % (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
" % (devPrefix,
device)
entry = entry + " raid-disk %d
" % (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
" % (devPrefix,
device)
entry = entry + " spare-disk %d
" % (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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 04-04-2008, 01:27 AM
David Lehman
 
Default Support encrypted RAID member devices. (#429600)

With this we should handle all the partitioning setups we handled
before with the addition of encrypted devices. We can have encrypted
partitions, including RAID members and LVM PVs, encrypted RAID
devices, and encrypted LVM LVs. It should all be stackable to the
extent that it was before encryption was introduced into the
equation.
---
mkinitrd | 46 ++++++++++++++++++++++++++++------------------
1 files changed, 28 insertions(+), 18 deletions(-)

diff --git a/mkinitrd b/mkinitrd
index 4185f15..a6cbaad 100755
--- a/mkinitrd
+++ b/mkinitrd
@@ -69,7 +69,9 @@ MODULES=""
PREMODS=""
DMDEVS=""
ncryptodevs=0
-nlatecryptodevs=0
+ncryptoparts=0
+ncryptolvs=0
+ncryptoraids=0

NET_LIST=""
LD_SO_CONF=/etc/ld.so.conf
@@ -694,13 +696,17 @@ handledm() {
# if not, add the device to cryptodevs
local vg=$(lvshow /dev/$slavedev)
if [ -n "$vg" ]; then
- eval latecryptodev${nlatecryptodevs}='"'/dev/$slavedev $dmname'"'
- let nlatecryptodevs++
+ eval cryptolv${ncryptolvs}='"'/dev/$slavedev $dmname'"'
+ let ncryptolvs++
+ elif grep -q "^$slavedev :" /proc/mdstat ; then
+ eval cryptoraid${ncryptoraids}='"'/dev/$slavedev $dmname'"'
+ let ncryptoraids++
else
- eval cryptodev${ncryptodevs}='"'/dev/$slavedev $dmname'"'
- let ncryptodevs++
+ eval cryptoparts${ncryptoparts}='"'/dev/$slavedev $dmname'"'
+ let ncryptoparts++
fi

+ let ncryptodevs++
handlelvordev "/dev/$slavedev"
;;
esac
@@ -1559,7 +1565,7 @@ findkeymap () {
done
}

-if [ $ncryptodevs -ne 0 -o $nlatecryptodevs -ne 0 ]; then
+if [ $ncryptodevs -ne 0 ]; then
inst /sbin/cryptsetup "$MNTIMAGE"

KEYTABLE=
@@ -1758,24 +1764,28 @@ emit "mkblkdevs"

emitdms

-if [ -n "$raiddevices" ]; then
- for dev in $raiddevices; do
- emit "mdadm -As --auto=yes --run /dev/${dev}"
- done
-fi
+emitcrypto()
+{
+ emit "echo Setting up disk encryption: $1"
+ emit "cryptsetup luksOpen $1 $2"
+}

if [ -n "$KEYMAP" ]; then
emit "echo Loading keymap."
emit "$LOADKEYS $KEYMAP"
fi

-emitcrypto()
-{
- emit "echo Setting up disk encryption: $1"
- emit "cryptsetup luksOpen $1 $2"
-}
+for cryptdev in ${!cryptopart@} ; do
+ emitcrypto `eval echo '$'$cryptdev`
+done
+
+if [ -n "$raiddevices" ]; then
+ for dev in $raiddevices; do
+ emit "mdadm -As --auto=yes --run /dev/${dev}"
+ done
+fi

-for cryptdev in ${!cryptodev@} ; do
+for cryptdev in ${!cryptoraid@} ; do
emitcrypto `eval echo '$'$cryptdev`
done

@@ -1786,7 +1796,7 @@ if [ -z "$nolvm" -a -n "$vg_list" ]; then
emit "lvm vgchange -ay --ignorelockingfailure $vg_list"
fi

-for cryptdev in ${!latecryptodev@} ; do
+for cryptdev in ${!cryptolv@} ; do
emitcrypto `eval echo '$'$cryptdev`
done

--
1.5.4.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 04-04-2008, 01:30 AM
Dave Lehman
 
Default Support encrypted RAID member devices. (#429600)

In case anyone is confused, this is the anaconda patch. The other one is
for mkinitrd. Both pieces are required to fully solve the referenced
bug.

Dave


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 12:03 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org