diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 52229e21e..7dc5e2b96 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -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 diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index 280c584eb..2480c00d8 100644 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -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; diff --git a/xCAT-server/lib/xcat/plugins/statelite.pm b/xCAT-server/lib/xcat/plugins/statelite.pm index f8088ada7..41ee78520 100644 --- a/xCAT-server/lib/xcat/plugins/statelite.pm +++ b/xCAT-server/lib/xcat/plugins/statelite.pm @@ -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"); diff --git a/xCAT-server/share/xcat/netboot/rh/dracut/install.netboot b/xCAT-server/share/xcat/netboot/rh/dracut/install.netboot index d9cd35d83..d9fe9c714 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut/install.netboot +++ b/xCAT-server/share/xcat/netboot/rh/dracut/install.netboot @@ -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 diff --git a/xCAT-server/share/xcat/netboot/rh/dracut/install.statelite b/xCAT-server/share/xcat/netboot/rh/dracut/install.statelite index 727f2b864..7c494d84c 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut/install.statelite +++ b/xCAT-server/share/xcat/netboot/rh/dracut/install.statelite @@ -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" diff --git a/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot index 638785f97..72a1f4ba9 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot @@ -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