diff --git a/build-ubunturepo b/build-ubunturepo index fea44509b..a2bb046e3 100755 --- a/build-ubunturepo +++ b/build-ubunturepo @@ -194,7 +194,8 @@ then if [ ! -d ../../$package_dir_name ];then mkdir -p "../../$package_dir_name" fi - packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-OpenStack xCAT-OpenStack-baremetal xCAT-buildkit" + #packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-OpenStack xCAT-OpenStack-baremetal xCAT-buildkit" + packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT xCATsn xCAT-test xCAT-buildkit" target_archs=(amd64 ppc64el) for file in `echo $packages` do diff --git a/buildcore.sh b/buildcore.sh index 7edc5cad1..a07099f23 100755 --- a/buildcore.sh +++ b/buildcore.sh @@ -41,7 +41,8 @@ UPLOADUSER=bp-sawyers FRS=/home/frs/project/x/xc/xcat # These are the rpms that should be built for each kind of xcat build -ALLBUILD="perl-xCAT xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xCAT-buildkit xCAT xCATsn xCAT-genesis-scripts xCAT-OpenStack xCAT-SoftLayer xCAT-OpenStack-baremetal" +#ALLBUILD="perl-xCAT xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xCAT-buildkit xCAT xCATsn xCAT-genesis-scripts xCAT-OpenStack xCAT-SoftLayer xCAT-OpenStack-baremetal" +ALLBUILD="perl-xCAT xCAT-client xCAT-server xCAT-test xCAT-buildkit xCAT xCATsn xCAT-genesis-scripts xCAT-SoftLayer" ZVMBUILD="perl-xCAT xCAT-server xCAT-UI" ZVMLINK="xCAT-client xCAT xCATsn" # xCAT and xCATsn have PCM specific configuration - conserver-xcat, syslinux-xcat diff --git a/perl-xCAT/xCAT/NotifHandler.pm b/perl-xCAT/xCAT/NotifHandler.pm index c23db6325..c70b73942 100644 --- a/perl-xCAT/xCAT/NotifHandler.pm +++ b/perl-xCAT/xCAT/NotifHandler.pm @@ -311,9 +311,6 @@ sub notify { my ($modname, $path, $suffix) = fileparse($_, ".pm"); # print "modname=$modname, path=$path, suffix=$suffix\n"; if ($suffix =~ /.pm/) { #it is a perl module - my $pid; - if ($pid=xCAT::Utils->xfork()) { } - elsif (defined($pid)) { my $fname; if (($path eq "") || ($path eq ".\/")) { #default path is /opt/xcat/lib/perl/xCAT_monitoring/ if there is no path specified @@ -328,8 +325,7 @@ sub notify { else { ${"xCAT_monitoring::".$modname."::"}{processTableChanges}->($action, $tablename, $old_data, $new_data); } - exit 0; - } + return 0; } else { #it is a command my $pid; diff --git a/perl-xCAT/xCAT/Table.pm b/perl-xCAT/xCAT/Table.pm index bbe2ddbc8..474e4c8d0 100644 --- a/perl-xCAT/xCAT/Table.pm +++ b/perl-xCAT/xCAT/Table.pm @@ -3837,7 +3837,7 @@ sub writeAllEntries } my $filename = shift; my $fh; - my $rc; + my $rc = 0; # open the file for write unless (open($fh," > $filename")) { my $msg="Unable to open $filename for write \n."; diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index 5f37479b4..8eb1e0050 100755 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -2162,7 +2162,72 @@ sub osver my $line = ''; my @lines; my $relfile; - if (-f "/etc/redhat-release") + + if (-f "/etc/os-release"){ + my $version; + my $version_id; + my $id; + my $id_like; + my $name; + my $prettyname; + my $verrel; + if (open($relfile,"<","/etc/os-release")) { + my @text = <$relfile>; + close($relfile); + chomp(@text); + #print Dumper(\@text); + foreach my $line (@text){ + if($line =~ /^\s*VERSION=\"?([0-9\.]+).*/){ + $version=$1; + } + if($line =~ /^\s*VERSION_ID=\"?([0-9\.]+).*/){ + $version_id=$1; + } + + + if($line =~ /^\s*ID=\"?([0-9a-z\_\-\.]+).*/){ + $id=$1; + } + if($line =~ /^\s*ID_LIKE=\"?([0-9a-z\_\-\.]+).*/){ + $id_like=$1; + } + + + if($line =~ /^\s*NAME=\"?(.*)/){ + $name=$1; + } + if($line =~ /^\s*PRETTY_NAME=\"?(.*)/){ + $prettyname=$1; + } + } + } + + $os=$id; + if (!$os and $id_like) { + $os=$id_like; + } + + $verrel=$version; + if (!$verrel and $version_id) { + $verrel=$version_id; + } + + + if(!$name and $prettyname){ + $name=$prettyname; + } + + if($os =~ /rhel/ and $name =~ /Server/i){ + $os="rhels"; + } + + if($verrel =~ /([0-9]+)\.?(.*)/) { + $ver=$1; + $rel=$2; + } +# print "$ver -- $rel"; + } + elsif (-f "/etc/redhat-release") { open($relfile,"<","/etc/redhat-release"); $line = <$relfile>; @@ -2269,8 +2334,10 @@ sub osver close($relfile); } } +#print "xxxx $type === $rel \n"; if ( $type and $type =~ /all/ ) { - if ( $rel ) { + if ( $rel ne "") { +# print "xxx $os-$ver-$rel \n"; return( "$os" . "," . "$ver" . ".$rel" ); } else { return( "$os" . "," . "$ver" ); diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index e61152906..2323d469d 100755 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -192,6 +192,14 @@ sub parse_attr_for_osimage{ return -1; } my ($tmp_imagetype, $tmp_arch, $tmp_osname,$tmp_ostype,$tmp_osvers); + if (!exists($attr_hash->{osvers})) { + $tmp_osvers = xCAT::Utils->osver("all"); + $tmp_osvers =~ s/,//; + $attr_hash->{osvers} = $tmp_osvers; + } else { + $tmp_osvers =$attr_hash->{osvers}; + } + if (!exists($attr_hash->{osarch})) { $tmp_arch = `uname -m`; chomp($tmp_arch); @@ -200,13 +208,13 @@ sub parse_attr_for_osimage{ } else { $tmp_arch = $attr_hash->{osarch}; } - if (!exists($attr_hash->{osvers})) { - $tmp_osvers = xCAT::Utils->osver("all"); - $tmp_osvers =~ s/,//; - $attr_hash->{osvers} = $tmp_osvers; - } else { - $tmp_osvers =$attr_hash->{osvers}; - } + + #for ubuntu,the the arch attribute "ppc64le" should be modified to "ppc64el" + if(($tmp_osvers =~ /^ubuntu/i) && ($tmp_arch =~ /^ppc64le/i)){ + $tmp_arch="ppc64el"; + $attr_hash->{osarch} = "ppc64el"; + } + $tmp_osname = $tmp_osvers; $tmp_ostype="Linux"; #like Linux, Windows $tmp_imagetype="linux"; diff --git a/xCAT-server/lib/xcat/plugins/tabutils.pm b/xCAT-server/lib/xcat/plugins/tabutils.pm index 3001c0546..71f5cfe71 100644 --- a/xCAT-server/lib/xcat/plugins/tabutils.pm +++ b/xCAT-server/lib/xcat/plugins/tabutils.pm @@ -740,7 +740,7 @@ sub tabdump output_table($table,$cb,$tabh,$recs); } else { # dump to file - my $rc1; + my $rc1 = 0; my $fh; # check to see if you can open the file unless (open($fh," > $FILENAME")) { diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index 25ee8462e..2dbb8fed8 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -2157,7 +2157,7 @@ sub get_request { my $encode = shift; my $request = shift; if ($encode eq "xml") { - my $line = ""; + my $line = $request; while ((!$request) || ($request !~ m/<\/xcatrequest>/)) { my $flags=fcntl($sock,F_GETFL,0); $flags |= O_NONBLOCK; #we want sysread to bail on us, select seems to be evil to us still.. @@ -2171,7 +2171,7 @@ sub get_request { $flags=fcntl($sock,F_GETFL,0); $flags &= ~O_NONBLOCK; #now we want *print* to be blocking IO fcntl($sock,F_SETFL,$flags); - $request .= $line; + $request = $line; } return eval { XMLin($request, SuppressEmpty=>undef,ForceArray=>1) }; } elsif ($encode eq "storable") { diff --git a/xCAT-server/share/xcat/ib/scripts/Mellanox/mlnxofed_ib_install b/xCAT-server/share/xcat/ib/scripts/Mellanox/mlnxofed_ib_install index 62039922e..6ae065f70 100755 --- a/xCAT-server/share/xcat/ib/scripts/Mellanox/mlnxofed_ib_install +++ b/xCAT-server/share/xcat/ib/scripts/Mellanox/mlnxofed_ib_install @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/sh # # # Sample script to customize options for Mellonax OFED IB support @@ -143,8 +143,8 @@ deb http://91.189.88.140/ubuntu-ports/ trusty-updates universe" >> /etc/apt/sour cat /etc/os-release|grep NAME|grep Ubuntu>/dev/null && uname -m |grep ppc64 >/dev/null then - echo "ARCH=powerpc perl -x mlnxofedinstall $mlnxofed_options" - ARCH=powerpc perl -x mlnxofedinstall --without-fw-update $mlnxofed_options + echo "ARCH=powerpc perl -x mlnxofedinstall --without-fw-update $mlnxofed_options" + ARCH=powerpc perl -x mlnxofedinstall --without-fw-update $mlnxofed_options sleep 1 service openibd restart else @@ -211,10 +211,50 @@ deb http://91.189.88.140/ubuntu-ports/ trusty-updates universe" >> $sourceslist mount --bind /dev $installroot/dev/ mount --bind /proc $installroot/proc/ mount --bind /sys $installroot/sys/ - chroot $installroot apt-get install -y linux-headers-$(uname -r) - echo "perl -x mlnxofedinstall $mlnxofed_options" + mv "${installroot}/bin/uname" "${installroot}/bin/uname.nouse" +# cat <<-EOF >"${installroot}/bin/uname" +# #!/bin/sh +# [ "\$1" = "-r" ] && cd /lib/modules && for d in *; do :; done && echo \$d +# [ "\$1" = "-m" ] && if [ -d "/proc/powerpc" ];then echo ppc64le;else echo x86_64;fi +# [ "\$1" = "-s" ] && echo Linux +# exit 0 +# EOF + + cat <<-EOF >"${installroot}/bin/uname" + #!/bin/sh + case "\$1" in + "-m") + ARCH="\$(dpkg --print-architecture || rpm -q kernel-\$("\$0" -r) --qf '%{arch}')" + case "\$ARCH" in + "amd64") + ARCH="x86_64" + ;; + "ppc64el") + ARCH="ppc64le" + ;; + esac + echo "\$ARCH" + ;; + "-r") + cd /lib/modules && for d in * ; do : ; done && echo \$d + ;; + "-s"|"") + echo "Linux" + ;; + esac + exit 0 + EOF + +# head -n 999 "${installroot}/bin/uname" + chmod 0755 "${installroot}/bin/uname" + + chroot $installroot sh -c 'apt-get install -y linux-headers-$(uname -r)' + + echo "perl -x /tmp/ofed_install/ofed/mlnxofedinstall --without-fw-update $mlnxofed_options" chroot $installroot perl -x /tmp/ofed_install/ofed/mlnxofedinstall --without-fw-update $mlnxofed_options + mv "${installroot}/bin/uname.nouse" "${installroot}/bin/uname" + rm -rf $installroot/tmp/ofed_install umount $installroot/dev/ umount $installroot/proc/ diff --git a/xCAT-server/share/xcat/install/ubuntu/compute.tmpl b/xCAT-server/share/xcat/install/ubuntu/compute.tmpl index d3b3a79c8..01c1c74ac 100644 --- a/xCAT-server/share/xcat/install/ubuntu/compute.tmpl +++ b/xCAT-server/share/xcat/install/ubuntu/compute.tmpl @@ -53,7 +53,7 @@ d-i partman/early_command string \ rm /tmp/devs-with-boot 2>/dev/null || true; \ else \ DEV=`ls /dev/disk/by-path/* -l | egrep -o '/dev.*sd[^0-9]$' | sort -t : -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -g | head -n1 | egrep -o 'sd.*$'`; \ - if [[ $DEV == "" ]]; then DEV="sda"; fi; \ + if [[ "$DEV" == "" ]]; then DEV="sda"; fi; \ echo "/dev/$DEV" > /tmp/boot_disk; \ fi; \ debconf-set partman-auto/disk "$(cat /tmp/boot_disk)" diff --git a/xCAT-server/share/xcat/install/ubuntu/kvm.tmpl b/xCAT-server/share/xcat/install/ubuntu/kvm.tmpl index 1f7fa6e21..01c1c74ac 100644 --- a/xCAT-server/share/xcat/install/ubuntu/kvm.tmpl +++ b/xCAT-server/share/xcat/install/ubuntu/kvm.tmpl @@ -18,7 +18,7 @@ d-i netcfg/dhcp_timeout string 120 d-i mirror/country string manual d-i mirror/protocol string http -d-i mirror/http/directory string /install/#TABLE:nodetype:$NODE:os#/#TABLE:nodetype:$NODE:arch# +d-i mirror/http/directory string #INCLUDE_OSIMAGE_PKGDIR# d-i mirror/http/proxy string # Suite to install. @@ -37,7 +37,26 @@ d-i partman-md/device_remove_md boolean true #create the /tmp/partitioning based on the uefi or legacy bios d-i partman/early_command string \ - debconf-set partman-auto/disk "$(list-devices disk | head -n1)" + set -x; \ + rm /tmp/devs-with-boot 2>/dev/null || true; \ + for d in $(list-devices partition); do \ + mkdir -p /tmp/mymount; \ + rc=0; \ + mount $d /tmp/mymount || rc=$?; \ + if [[ $rc -eq 0 ]]; then \ + [[ -d /tmp/mymount/boot ]] && echo $d >>/tmp/devs-with-boot; \ + umount /tmp/mymount; \ + fi \ + done; \ + if [[ -e /tmp/devs-with-boot ]]; then \ + head -n1 /tmp/devs-with-boot | egrep -o '\S+[^0-9]' > /tmp/boot_disk; \ + rm /tmp/devs-with-boot 2>/dev/null || true; \ + else \ + DEV=`ls /dev/disk/by-path/* -l | egrep -o '/dev.*sd[^0-9]$' | sort -t : -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -g | head -n1 | egrep -o 'sd.*$'`; \ + if [[ "$DEV" == "" ]]; then DEV="sda"; fi; \ + echo "/dev/$DEV" > /tmp/boot_disk; \ + fi; \ + debconf-set partman-auto/disk "$(cat /tmp/boot_disk)" d-i partman-auto/expert_recipe_file string /tmp/partitioning # This makes partman automatically partition without confirmation, provided diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.pkglist index c23ba181a..617097381 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.pkglist @@ -2,7 +2,7 @@ bash nfs-common openssl isc-dhcp-client -linux-image-server +linux-image-generic openssh-server openssh-client wget diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index 2b41a05cd..8ae54c759 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -64,6 +64,7 @@ my $permission; # the permission works only for statelite mode currently my $tempfile; my $prompt; my $noupdate; +my $kernelimage; sub xdie { @@ -211,7 +212,7 @@ unless ($onlyinitrd) { if ($kernelver) { find(\&isaptdir, <$kerneldir/>); if (!grep /$kerneldir/, @aptdirs) { - print "The repository for $kerneldir should be created before running the geniamge. Try to run [createrepo $kerneldir].\n"; + print "The repository for $kerneldir should be created before running the genimage.\n"; } } unless (scalar(@aptdirs)) { @@ -315,6 +316,9 @@ unless ($onlyinitrd) { } push @npa, $kernelname; } + elsif ($p =~ /linux-image-generic/) { + $kernelimage = "linux-image-generic"; + } elsif ($p =~ /^@/) { push @npa, "\"$p\""; } @@ -471,6 +475,13 @@ unless ($onlyinitrd) { #my $aptgetcmd_update = $yumcmd_base . " upgrade "; my $aptgetcmd_update = $aptgetcmd . "&&". $aptgetcmdby . " upgrade "; $rc = system("$aptgetcmd_update"); + if ($kernelimage) { + if ($kernelver) { + $kernelimage = "linux-image-".$kernelver; + } + my $aptgetcmd_install = $aptgetcmd . "&&". $aptgetcmdby. " install --no-install-recommends ".$kernelimage; + $rc = system("$aptgetcmd_install"); + } print("Umount /proc, /dev, /sys, pkgdir and otherpkgdir to the rootimg.\n"); umount_chroot($rootimg_dir); # ignore any return code diff --git a/xCAT-server/share/xcat/tools/xCATreg b/xCAT-server/share/xcat/tools/xCATreg index 507e5e38b..7c4438184 100755 --- a/xCAT-server/share/xcat/tools/xCATreg +++ b/xCAT-server/share/xcat/tools/xCATreg @@ -86,7 +86,7 @@ sub usage -U: when -U is specified, only code updates can trigger the regression.\n -V: log and message in verbose mode.\n -e: send the test result to email_addr\n"; - print " xCATreg [-?|-h]\n"; + print " xCATreg [--help|-h]\n"; print " xCATreg [-f configure file] [-b branch] [-m mangement node][-V][-e] install mn \n"; print " xCATreg [-f configure file] [-b branch] [-m mangement node ] [-U][-V][-e] if code updates there will be regression.\n"; print "\n"; @@ -1530,7 +1530,7 @@ send_msg(2,"........................"); ####################################### send_msg(2, "step 0, initializing..............."); if ( - !GetOptions("h|?" => \$needhelp, + !GetOptions("h|help" => \$needhelp, "f=s" => \$configfile, "b=s" => \$branch, "m=s" => \$management_node, diff --git a/xCAT/postscripts/disableconsistentNICrename b/xCAT/postscripts/disableconsistentNICrename index 3c5e221b0..90f33c039 100755 --- a/xCAT/postscripts/disableconsistentNICrename +++ b/xCAT/postscripts/disableconsistentNICrename @@ -2,4 +2,15 @@ #modify the grub.cfg to prevent nic consistent network renameing grep -E -q "net.ifnames=0" /etc/sysconfig/grub || sed -i '/^GRUB_CMDLINE_LINUX=.*/{s/"$/ net.ifnames=0"/}' /etc/sysconfig/grub grep -E -q "net.ifnames=0" /etc/default/grub || sed -i '/^GRUB_CMDLINE_LINUX=.*/{s/"$/ net.ifnames=0"/}' /etc/default/grub -grub2-mkconfig -o /boot/grub2/grub.cfg + +if [ -f "/boot/efi/EFI/redhat/grub.cfg" ];then + GRUB_CFG_FILE="/boot/efi/EFI/redhat/grub.cfg" +#elif [ -f "/boot/efi/efi/SuSE/elilo.efi" ];then +elif [ -f "/boot/grub2/grub.cfg" ];then + GRUB_CFG_FILE="/boot/grub2/grub.cfg" +elif [ -f "/boot/grub/grub.cfg" ];then + GRUB_CFG_FILE="/boot/grub/grub.cfg" +fi + + +grub2-mkconfig -o "$GRUB_CFG_FILE"