Implement bittorrent support for RHEL stateless/statelite with ramfs

This commit is contained in:
Jarrod Johnson 2014-05-15 10:23:48 -04:00
parent 1f48dcea9c
commit 471d947171
6 changed files with 38 additions and 4 deletions

View File

@ -662,7 +662,11 @@ sub mknetboot
$kcmdline = "NFSROOT=$nfssrv:$nfsdir STATEMNT=";
}
} else {
$kcmdline = "imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg-statelite.gz STATEMNT=";
if (-r "$rootimgdir/rootimg-statelite.gz.metainfo") {
$kcmdline = "imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg-statelite.gz.metainfo STATEMNT=";
} else {
$kcmdline = "imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg-statelite.gz STATEMNT=";
}
}
# add support for subVars in the value of "statemnt"
@ -724,8 +728,13 @@ sub mknetboot
$kcmdline .= "NODE=$node ";
}
else {
$kcmdline =
"imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg.$suffix ";
if (-r "$rootimgdir/rootimg.$suffix.metainfo") {
$kcmdline =
"imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg.$suffix.metainfo ";
} else {
$kcmdline =
"imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg.$suffix ";
}
$kcmdline .= "XCAT=$xcatmaster:$xcatdport ";
$kcmdline .= "NODE=$node ";
# add flow control setting

View File

@ -51,12 +51,14 @@ sub process_request {
my $rootimg_dir;
my $destdir;
my $imagename;
my $dotorrent;
GetOptions(
"profile|p=s" => \$profile,
"arch|a=s" => \$arch,
"osver|o=s" => \$osver,
"method|m=s" => \$method,
"tracker=s" => \$dotorrent,
"help|h" => \$help,
"version|v" => \$version
);
@ -386,6 +388,14 @@ sub process_request {
`$excludestr`;
if ($method =~ /cpio/) {
chmod 0644,"$destdir/rootimg.gz";
if ($dotorrent) {
my $currdir = getcwd;
chdir($destdir);
unlink("rootimg.gz.metainfo");
system("ctorrent -t -u $dotorrent -l 1048576 -s rootimg.gz.metainfo rootimg.gz");
chmod 0644, "rootimg.gz.metainfo";
chdir($currdir);
}
umask $oldmask;
} elsif ($method =~ /squashfs/) {
my $flags;

View File

@ -67,6 +67,7 @@ sub process_request {
my $exlist; # it is used when rootfstype = ramdisk
my $destdir;
my $imagename;
my $dotorrent;
GetOptions(
"rootfstype|t=s" => \$rootfstype,
@ -74,6 +75,7 @@ sub process_request {
"arch|a=s" => \$arch,
"osver|o=s" => \$osver,
"help|h" => \$help,
"tracker" => \$dotorrent,
"version|v" => \$version,
"verbose|V" => \$verbose
);
@ -534,6 +536,14 @@ sub process_request {
chdir("$rootimg_dir");
xCAT::Utils->runcmd("$excludestr");
chmod 0644, "$destdir/rootimg-statelite.gz";
if ($dotorrent) {
my $currdir = getcwd;
chdir($destdir);
unlink("rootimg-statelite.gz.metainfo");
system("ctorrent -t -u $dotorrent -l 1048576 -s rootimg-statelite.gz.metainfo rootimg.gz");
chmod 0644, "rootimg-statelite.gz.metainfo";
chdir($currdir);
}
umask $oldmask;
system("rm -f $xcat_packimg_tmpfile");

View File

@ -1,6 +1,7 @@
#!/bin/sh
echo $drivers
dracut_install wget cpio gzip dash modprobe touch echo cut wc
dracut_install wget cpio gzip dash modprobe touch echo cut wc
dracut_install -o ctorrent
dracut_install grep ifconfig hostname awk egrep grep dirname expr
dracut_install mount.nfs
dracut_install parted mke2fs bc mkswap swapon chmod

View File

@ -1,6 +1,7 @@
#!/bin/sh
echo $drivers
dracut_install wget cpio gzip dash modprobe wc touch echo cut
dracut_install -o ctorrent
dracut_install grep ifconfig hostname awk egrep grep dirname expr
dracut_install parted mke2fs bc mkswap swapon chmod
inst "$moddir/xcat-updateflag" "/tmp/updateflag"

View File

@ -45,6 +45,9 @@ if [ ! -z "$imgurl" ]; then
fi
#echo 0 > /proc/sys/vm/zone_reclaim_mode #Avoid kernel bug
if [ -r /*.metainfo ]; then
ctorrent /*.metainfo -e 0
fi
if [ -r /rootimg.sfs ]; then
echo Setting up squashfs with ram overlay.
mknod /dev/loop0 b 7 0