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

Bug#335230: [#335230] How to actually support EVMS in an initrd



Alle 13:07, domenica 23 ottobre 2005, hai scritto:

> > > We need a perl hacker.
> > Mattia, maybe you would like to jump in here too ? I hope i am not
> > abusing by asking you that :)
> Oh, well, I'd really like to :) Only problem I have is that I don't have
> any EVMS system available.

Can be simulated using a live cd that supports EVMS, like latest ubuntu live 
cds, booting cd from qemu using loops devices to simulate your testing 
harddisk config. 

> I'm going to see if I have enough spare HW 
> parts to build a pc and set it up but it might take some time...

Of course you can also debootstrap a debian system in a partitioned mounted 
loop and test there, I know that could be slower than a real hardware system. 

> Anyway having a good written guidance I could still provide perl code
> to play with.

A guide to write EVMS yaird support:

The right way to start is to add sid sources to apt and then with "apt-get 
source yaird" we are done.
In the directory yaird-0.1?/perl/ there is the main Plan.pm that checks for 
right way to handle the root device in this function at nearly 80:

sub addDevicePlan ($$$) {
	my ($actions, $device, $working) = @_;

	my $name = $device->name;
	for my $w (@{$working}) {
		if ($w eq $device) {
			Base::fatal ("loop detected: $name\n");
		}
	}

	my $ok = 0;
	$ok || ($ok = tryParent ($actions,$device,[$device,@{$working}]));
	$ok || ($ok = tryEvms ($actions,$device,[$device,@{$working}]));
	$ok || ($ok = tryDmCrypt ($actions,$device,[$device,@{$working}]));
	$ok || ($ok = tryLvm ($actions,$device,[$device,@{$working}]));
	$ok || ($ok = tryRaid ($actions,$device,[$device,@{$working}]));
	$ok || ($ok = tryHardware ($actions,$device,[$device,@{$working}]));
	if (! $ok) {
		Base::fatal ("unsupported device required: $name");
	}
	Base::debug ("device: completed $name");
}

The sub tryEvms in not already in place.
Yaird perl code gives some functions to handle device string to extract 
relevant parts. If the sub tryEvms need to use some tools to check for evms 
compliance, a new EvmsTab.pm and EvmsDev.pm should be added with similar 
roles as RaidDev.pm and RaidTab.pm.

This is for the "what code should be added part"

Now which tools we have:

evms_activate: to start evms volumes (at boot)

evms_query: can query a device at run time to have informations useful to know 
which plugins are needed in order to boot the device and the evms version.

evms_gather_info : gives a lot of output on underlying evms system.

Problem: the entire /lib/evms/2.5.3 is 1.6 Mb, but not all files are needed in 
order to boot. But this is a minor thing right now, we can copy all 
dir /lib/evms/$VER/ in the image and we are happy. From Base.pm there is an 
addTree and an addLibrary functions that should be merged in another 
addTreeLibrary that works for putting all evms plugins on the image.

Doing thing well we should be use evms_query to gather some info, let me 
explane with an example:

my target root device from fstab is "/dev/evms/lvm2/safe/root64" 

# evms_query objects /dev/evms/lvm2/sicuro/root64 | xargs -i evms_query 
plugins \{\} | sort | uniq

gives me :
DosSegMgr
LocalDskMgr
LVM2
MDRaid5RegMgr

that on my system correspond to libraries:
/lib/evms/2.5.3/dos-1.1.14.so
/lib/evms/2.5.3/disk-1.2.11.so
/lib/evms/2.5.3/lvm2-1.0.3.so
/lib/evms/2.5.3/md-1.1.18.so

This gives 708 Kb instead of 1.6 Mb.

If we need to know device numbers we could use "evms_query 
info /dev/evms/lvm2/sicuro/usr64 | grep Device" or similar to have them.

N.B. If the file /etc/evms.conf differs from default it should be copied also 
on the image because compatibility volumes could need it to proper showing up 
(the relevant part of this config file is the last "device_size_prompt = no" 
part).

After this step we should also look at debian-installer, we could look after 
to provide a gtk-directfb port for evms-gui or add evms support to partman, 
we will see. :-)

If I missed any fundamental part please correct me.

Thats all I can do for now, I should learn perl more to help more...

-- 
ESC:wq



Reply to: