Implement bittorrent support for RHEL stateless/statelite with ramfs
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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");
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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"
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user