diff --git a/perl-xCAT/xCAT/NetworkUtils.pm b/perl-xCAT/xCAT/NetworkUtils.pm index 7d42970ba..6bfd957fd 100755 --- a/perl-xCAT/xCAT/NetworkUtils.pm +++ b/perl-xCAT/xCAT/NetworkUtils.pm @@ -2182,7 +2182,13 @@ sub pingNodeStatus { foreach (@mon_nodes) { $deadnodes{$_}=1; } - open (NMAP, "nmap -PE --system-dns --send-ip -sP ". $nodes . " 2> /dev/null|") or die("Cannot open nmap pipe: $!"); + + # get additional options from site table + my @nmap_options = xCAT::TableUtils->get_site_attribute("nmapoptions"); + my $more_options = $nmap_options[0]; + + #call namp + open (NMAP, "nmap -PE --system-dns --send-ip -sP $more_options ". $nodes . " 2> /dev/null|") or die("Cannot open nmap pipe: $!"); my $node; while () { if (/Host (.*) \(.*\) appears to be up/) { diff --git a/perl-xCAT/xCAT/PPCenergy.pm b/perl-xCAT/xCAT/PPCenergy.pm index eb5d6abe9..eb8c53723 100644 --- a/perl-xCAT/xCAT/PPCenergy.pm +++ b/perl-xCAT/xCAT/PPCenergy.pm @@ -14,7 +14,7 @@ use xCAT::Usage; use xCAT::NodeRange; use xCAT::DBobjUtils; use xCAT::FSPUtils; -use xCAT::TableUtils qw(get_site_Master); +use xCAT::TableUtils; %::QUERY_ATTRS = ( 'savingstatus' => 1, 'dsavingstatus' => 1, @@ -223,7 +223,6 @@ sub renergy { my ($node, $attrs) = %$nodehash; my $cec_name = @$attrs[2]; my $hw_type = @$attrs[4]; - if (!$cec_name) { return ([[$node, "ERROR: Cannot find the cec name, check the attributes: vpd.serial, vpd.mtm.", 1]]); @@ -295,7 +294,12 @@ sub renergy { foreach (@hcps_ip) { $deadnodes{$_}=1; } - open (NMAP, "nmap -PE --system-dns --send-ip -sP ". join(' ',@hcps_ip) . " 2> /dev/null|") or die("Cannot open nmap pipe: $!"); + + # get additional options from site table + my @nmap_options = xCAT::TableUtils->get_site_attribute("nmapoptions"); + my $more_options = $nmap_options[0]; + + open (NMAP, "nmap -PE --system-dns --send-ip -sP $more_options ". join(' ',@hcps_ip) . " 2> /dev/null|") or die("Cannot open nmap pipe: $!"); my $node; while () { #print "$_\n"; diff --git a/perl-xCAT/xCAT/ProfiledNodeUtils.pm b/perl-xCAT/xCAT/ProfiledNodeUtils.pm index 5fee1f892..37714c867 100644 --- a/perl-xCAT/xCAT/ProfiledNodeUtils.pm +++ b/perl-xCAT/xCAT/ProfiledNodeUtils.pm @@ -888,6 +888,7 @@ sub check_profile_consistent{ $ppc_netboot = 'grub2'; } my %profile_dict = ('x86' => 'xnba','x86_64' => 'xnba', 'ppc64' => $ppc_netboot, + 'ppc64el' => $ppc_netboot, 'fsp' => 'FSP', 'ipmi' => 'BMC'); # Check if imageprofile is consistent with networkprofile if ($profile_dict{$arch} ne $netboot) { diff --git a/perl-xCAT/xCAT/SLP.pm b/perl-xCAT/xCAT/SLP.pm index 3e8c5f438..d84d0a8ac 100755 --- a/perl-xCAT/xCAT/SLP.pm +++ b/perl-xCAT/xCAT/SLP.pm @@ -116,6 +116,9 @@ sub dodiscover { send_message($args{reqcallback}, 0, "The rarge is too large and may be time consuming. Broadcast is recommended."); } } + + #no need to check site.nmapoptions because it specifilly + # uses T5 for certain performance requirement. `/usr/bin/nmap $range -sn -PE -n --send-ip -T5 `; my $nmapres = `/usr/bin/nmap $range -PE -p 427 -n --send-ip -T5 `; foreach my $line (split(/\n\n/,$nmapres)) { diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index e644c375a..3a0fd505c 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -728,7 +728,7 @@ osimage => { description => 'OS Image Description', provmethod => 'The provisioning method for node deployment. The valid values are install, netboot,statelite,boottarget,dualboot,sysclone. If boottarget is set, you must set linuximage.boottarget to the name of the boottarget definition. It is not used by AIX.', rootfstype => 'The filesystem type for the rootfs is used when the provmethod is statelite. The valid values are nfs or ramdisk. The default value is nfs', - osdistroname => 'The name of the OS distro definition. This attribute can be used to specify which OS distro to use, instead of using the osname,osvers,and osarch attributes.', + osdistroname => 'The name of the OS distro definition. This attribute can be used to specify which OS distro to use, instead of using the osname,osvers,and osarch attributes. For *kit commands, the attribute will be used to read the osdistro table for the osname, osvers, and osarch attributes. If defined, the osname, osvers, and osarch attributes defined in the osimage table will be ignored.', osupdatename => 'A comma-separated list of OS distro updates to apply to this osimage.', cfmdir => 'CFM directory name for PCM. Set to /install/osimages//cfmdir by PCM. ', profile => 'The node usage category. For example compute, service.', @@ -995,6 +995,16 @@ site => { " dnsupdaters: The value are \',\' separated string which will be added to the zone config\n". " section. This is an interface for user to add configuration entries to\n". " the zone sections in named.conf.\n\n". + " dnsinterfaces: The network interfaces DNS server should listen on. If it is the same\n". + " for all nodes, use a simple comma-separated list of NICs. To\n". + " specify different NICs for different nodes:\n". + " xcatmn|eth1,eth2;service|bond0.\n". + " In this example xcatmn is the name of the xCAT MN, and DNS there\n". + " should listen on eth1 and eth2. On all of the nodes in group\n". + " 'service' DNS should listen on the bond0 nic.\n". + " NOTE: if using this attribute to block certain interfaces, make sure\n". + " the ip maps to your hostname of xCAT MN is not blocked since xCAT needs to\n". + " use this ip to communicate with the local NDS server on MN.\n\n". " -------------------------\n". "HARDWARE CONTROL ATTRIBUTES\n". " -------------------------\n". @@ -1122,6 +1132,13 @@ site => { " httpport: The port number that the booting/installing nodes should contact the\n". " http server on the MN/SN on. It is your responsibility to configure\n". " the http server to listen on that port - xCAT will not do that.\n\n". + " nmapoptions: Additional options for the nmap command. nmap is used in pping, \n". + " nodestat, xdsh -v and updatenode commands. Sometimes additional \n". + " performance tuning may be needed for nmap due to network traffic.\n". + " For example, if the network response time is too slow, nmap may not\n". + " give stable output. You can increase the timeout value by specifying \n". + " '--min-rtt-timeout 1s'. xCAT will append the options defined here to \n". + " the nmap command.\n\n". " ntpservers: A comma delimited list of NTP servers for the cluster - often the\n". " xCAT management node.\n\n". " svloglocal: if set to 1, syslog on the service node will not get forwarded to the\n". diff --git a/perl-xCAT/xCAT/ServiceNodeUtils.pm b/perl-xCAT/xCAT/ServiceNodeUtils.pm index c76d8d910..049831309 100755 --- a/perl-xCAT/xCAT/ServiceNodeUtils.pm +++ b/perl-xCAT/xCAT/ServiceNodeUtils.pm @@ -10,12 +10,8 @@ BEGIN # if AIX - make sure we include perl 5.8.2 in INC path. # Needed to find perl dependencies shipped in deps tarball. if ($^O =~ /^aix/i) { - use lib "/usr/opt/perl5/lib/5.8.2/aix-thread-multi"; - use lib "/usr/opt/perl5/lib/5.8.2"; - use lib "/usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi"; - use lib "/usr/opt/perl5/lib/site_perl/5.8.2"; -} - + unshift(@INC, qw(/usr/opt/perl5/lib/5.8.2/aix-thread-multi /usr/opt/perl5/lib/5.8.2 /usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi /usr/opt/perl5/lib/site_perl/5.8.2)); + } use lib "$::XCATROOT/lib/perl"; use strict; #----------------------------------------------------------------------------- diff --git a/perl-xCAT/xCAT/TableUtils.pm b/perl-xCAT/xCAT/TableUtils.pm index 69599d1fd..e55d194fa 100755 --- a/perl-xCAT/xCAT/TableUtils.pm +++ b/perl-xCAT/xCAT/TableUtils.pm @@ -10,11 +10,8 @@ BEGIN # if AIX - make sure we include perl 5.8.2 in INC path. # Needed to find perl dependencies shipped in deps tarball. if ($^O =~ /^aix/i) { - use lib "/usr/opt/perl5/lib/5.8.2/aix-thread-multi"; - use lib "/usr/opt/perl5/lib/5.8.2"; - use lib "/usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi"; - use lib "/usr/opt/perl5/lib/site_perl/5.8.2"; -} + unshift(@INC, qw(/usr/opt/perl5/lib/5.8.2/aix-thread-multi /usr/opt/perl5/lib/5.8.2 /usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi /usr/opt/perl5/lib/site_perl/5.8.2)); + } use lib "$::XCATROOT/lib/perl"; use strict; diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index f8efb5dd0..5f37479b4 100755 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -4295,5 +4295,43 @@ sub cleanup_for_powerLE_hardware_discovery { } +#The parseMacTabEntry parses the mac table entry and return the mac address of nic in management network +#Arguments: +#macString : the string of mac table entry +#HostName : the hostname of the node +#The mac address is taken as installnic when: +#1. the mac addr does not have a suffix "!xxxx" +#2. the mac addr has a fuffix "!" +#The schema description of mac table is: +# mac: The mac address or addresses for which xCAT will manage static bindings for this node. +#This may be simply a mac address, which would be bound to the node name (such as "01:02:03:04:05:0E"). +#This may also be a "|" delimited string of "mac address!hostname" format (such as "01:02:03:04:05:0E!node5|01:02:03:05:0F!node6-eth1"). +sub parseMacTabEntry{ + + my $macString=shift; + if( $macString =~ /xCAT::Utils/) + { + $macString=shift; + + } + my $HostName=shift; + + my $mac_ret; + my @macEntry=split(/\|/,$macString); + + foreach my $mac_t (@macEntry){ + if($mac_t =~ /!/){ + if($mac_t =~ /(.+)!$HostName$/){ + $mac_ret=$1; + } + }else{ + $mac_ret=$mac_t; + } + } + + + return $mac_ret; +} + 1; diff --git a/perl-xCAT/xCAT/data/discinfo.pm b/perl-xCAT/xCAT/data/discinfo.pm index 5615d3e59..1f637cfcb 100755 --- a/perl-xCAT/xCAT/data/discinfo.pm +++ b/perl-xCAT/xCAT/data/discinfo.pm @@ -67,12 +67,15 @@ require Exporter; "1359576196.686790" => "rhels6.4", #ppc64 "1384196515.415715" => "rhels6.5", #x86_64 "1384198011.520581" => "rhels6.5", #ppc64 + "1411733344.627228" => "rhels6.6", #x86_64 + "1411733344.616389" => "rhels6.6", #ppc64 "1285193176.593806" => "rhelhpc6", #x86_64 "1305067719.718814" => "rhelhpc6.1",#x86_64 "1321545261.599847" => "rhelhpc6.2",#x86_64 "1339640148.070971" => "rhelhpc6.3",#x86_64 "1359576195.413831" => "rhelhpc6.4",#x86_64, RHEL ComputeNode "1384196516.465862" => "rhelhpc6.5",#x86_64, RHEL ComputeNode + "1411733344.599861" => "rhelhpc6.6",#x86_64, RHEL ComputeNode "1399449226.140088" => "rhelhpc7.0",#x86_64, RHEL ComputeNode "1194015916.783841" => "fedora8", "1194015385.299901" => "fedora8", @@ -97,6 +100,7 @@ require Exporter; "1390839789.062069" => "SL6.5", #x86_64 DVD ISO Install "1394111947.452332" => "pkvm2.1", # ppc64, PowerKVM + "1413749127.352649" => "pkvm2.1.1", # ppc64, PowerKVM ); my %numdiscs = ( "1156364963.862322" => 4, diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index 162b71ca4..08d3e51e5 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -364,7 +364,8 @@ if ($::VERSION) my $versioncmd = "rpm -q --qf \"%{NAME}: %{VERSION}-%{RELEASE} \n\" xCAT-buildkit"; my $message = "Error quering xCAT-buildkit rpm. Version info is not available. \n"; if ( $debianflag ){ - $versioncmd = "dpkg-query --show -f='\${PackageSpec}: \${Version}\n' xcat-buildkit"; + + $versioncmd = "dpkg-query --show -f='\${binary:Package}: \${Version}\n' xcat-buildkit"; $message = "Error quering xcat-buildkit package. Version info is not available. \n"; } if ( system($versioncmd) ) { @@ -1166,7 +1167,7 @@ sub edit_bldkitconf my $kitcomponent_basename = $kitname."_compute"; if ($debianflag==1) { - if($osarch == "ppc64le"){ + if($osarch eq "ppc64le"){ $osarch="ppc64el"; } $kitcomponent_basename = $kitname."-compute"; @@ -1892,7 +1893,7 @@ sub validate_os chomp($osarch); if ($debianflag==1) { - if($osarch == "ppc64le"){ + if($osarch eq "ppc64le"){ $osarch="ppc64el"; } } @@ -3891,6 +3892,47 @@ sub NEW_kit_addpkgs } } + + #When using -k -r, there are useless repodir + #delete useless repo dir + my $kitrepodirby=$::base_repodir; + my $cmdby = "/bin/ls $kitrepodirby 2>/dev/null"; + my $outputby = `$cmdby`; + my @allrepolist = split(/\n/, $outputby); + my @dellist; + + foreach my $reponame (@allrepolist) + { + my $match=0; + foreach my $kr (@{$::bldkit_config->{kitrepo}{entries}}) + { + my $repodirname = "$kr->{kitreponame}"; + + if ( ${repodirname} eq ${reponame} ) + { + ${match}++; + } + } + if ( ${match} == 0 ) + { + push(@dellist,$reponame); + } + } + + foreach my $del (@dellist) + { + my $delrepodir=$::base_repodir."/".$del ; + if ( -d $delrepodir ) + { + my $delcmd="rm -Rf $delrepodir"; + if ( system($delcmd) ) + { + print "Failed to delete useless repo directory \n"; + } + } + } + + # Build the full kit tar file my $buildtar_rc = &kit_buildtar; diff --git a/xCAT-buildkit/share/xcat/kits/kit_template/buildkit.conf b/xCAT-buildkit/share/xcat/kits/kit_template/buildkit.conf index 86393c649..5f375942a 100644 --- a/xCAT-buildkit/share/xcat/kits/kit_template/buildkit.conf +++ b/xCAT-buildkit/share/xcat/kits/kit_template/buildkit.conf @@ -96,7 +96,8 @@ kit: # # osminorversion (optional) OS minor version. (ex. "4") # -# osarch (mandatory) OS architecture. (ex. "x86_64") +# osarch (mandatory) OS architecture. (ex.redhat x86_64 should be "x86_64", Ubuntu Power LE should be "ppc64el", +# For Ubuntu Power LE, system arch is ppc64le, for ubuntu software package, should use "ppc64el", # # compat_osbasenames (optional) Comma-separated list of compatible # OS distribution base names. (ex. "centos") diff --git a/xCAT-client/bin/mysqlsetup b/xCAT-client/bin/mysqlsetup index 2e9f48fe2..0947a4688 100755 --- a/xCAT-client/bin/mysqlsetup +++ b/xCAT-client/bin/mysqlsetup @@ -883,8 +883,11 @@ sub mysqlstart else { if ($::MariaDB==1) { # running MariaDB - #$cmd = "service mariadb start"; - $ret=xCAT::Utils->startservice("mariadb"); + if ($::linuxos =~ /rh.*/) { + $ret=xCAT::Utils->startservice("mariadb"); + } else { # sles + $ret=xCAT::Utils->startservice("mysql"); + } } else { # it is mysql @@ -993,7 +996,11 @@ sub mysqlreboot { if ($::MariaDB==1 ) { # MariaDB not MySQL + if ($::linuxos =~ /rh.*/) { $cmd = "chkconfig mariadb on"; + } else { #sles + $cmd = "chkconfig mysql on"; + } } else { # mysql if ($::linuxos =~ /rh.*/) { diff --git a/xCAT-client/bin/pping b/xCAT-client/bin/pping index e08755fe5..40af26b2e 100755 --- a/xCAT-client/bin/pping +++ b/xCAT-client/bin/pping @@ -169,7 +169,11 @@ sub nmap_pping { foreach (@$nodes) { $deadnodes{$_}=1; } - open (FPING, "nmap -PE --system-dns --send-ip -sP ".join(' ',@$nodes). " 2> /dev/null|") or die("Cannot open nmap pipe: $!"); + # get additional options from site table + my @nmap_options = xCAT::TableUtils->get_site_attribute("nmapoptions"); + my $more_options = $nmap_options[0]; + + open (FPING, "nmap -PE --system-dns --send-ip -sP $more_options ".join(' ',@$nodes). " 2> /dev/null|") or die("Cannot open nmap pipe: $!"); my $node; while () { if (/Host (.*) \(.*\) appears to be up/) { diff --git a/xCAT-client/bin/xdsh b/xCAT-client/bin/xdsh index 5a81f3103..a026544c5 100644 --- a/xCAT-client/bin/xdsh +++ b/xCAT-client/bin/xdsh @@ -443,22 +443,41 @@ sub parse_args_xdsh } - # add config file with strict host checking no - my $cmd = "echo \"StrictHostKeyChecking no\" >> $home/.ssh/config"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { # error - $msg = "Error from $cmd\n"; - xCAT::MsgUtils->message("E", $msg); + # add config file with strict host checking no, if not already there + my $configinfo = "StrictHostKeyChecking no"; + my $configfile= "$home/.ssh/config"; + if (-e $configfile) + { + my $cmd = "grep StrictHostKeyChecking $configfile"; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) + { # not there + $cmd = "echo $configinfo >> $configfile"; + my @output = xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { # error + xCAT::MsgUtils->message("E", "Error on $cmd, @output"); + return 1; + } + + } + } + else # file does not exist + { + my $cmd = "echo $configinfo >> $configfile"; + my @output = xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { # error + xCAT::MsgUtils->message("E", "Error on $cmd, @output"); + return 1; + } + else + { + chmod 0600, $configfile; + + } } - my $cmd = "chmod 0600 $home/.ssh/config"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { # error - $msg = "Error from $cmd\n"; - xCAT::MsgUtils->message("E", $msg); - } # if current_userid is not "root", we need to generate the keys # here before becoming root while running under xcatd diff --git a/xCAT-client/pods/man1/lskit.1.pod b/xCAT-client/pods/man1/lskit.1.pod index 521252cdc..636beac4a 100644 --- a/xCAT-client/pods/man1/lskit.1.pod +++ b/xCAT-client/pods/man1/lskit.1.pod @@ -58,6 +58,7 @@ is a comma-delimited list of kit names. The B command will only display t =item B<-x|--xml|--XML> +Need XCATXMLTRACE=1 env when using -x|--xml|--XML, for example: XCATXMLTRACE=1 lskit -x testkit-1.0.0 Return the output with XML tags. The data is returned as: @@ -156,6 +157,12 @@ To list the framework value of a Kit tarfile. kitframework=2 compatible_kitframeworks=0,1,2 +=item 5. + +To list kit "testkit-1.0-1" with XML tags, enter: + + XCATXMLTRACE=1 lskit -x testkit-1.0-1 + =back diff --git a/xCAT-client/pods/man1/lskitcomp.1.pod b/xCAT-client/pods/man1/lskitcomp.1.pod index eac6a6b11..b9d0eb2dd 100644 --- a/xCAT-client/pods/man1/lskitcomp.1.pod +++ b/xCAT-client/pods/man1/lskitcomp.1.pod @@ -47,6 +47,7 @@ is a comma-delimited list of kit component names. The B command will =item B<-x|--xml|--XML> +Need XCATXMLTRACE=1 env when using -x|--xml|--XML. Return the output with XML tags. The data is returned as: @@ -140,6 +141,12 @@ To list kit components compatible with "rhels-6.2-x86_64" osdistro and "computen lskitcomp -O rhels-6.2-x86_64 -S computenode +=item 6. + +To list the kit component "testkit-compute-1.0-1-ubuntu-14.04-ppc64el" with XML tags, enter: + + XCATXMLTRACE=1 lskitcomp -x testkit-compute-1.0-1-ubuntu-14.04-ppc64el + =back diff --git a/xCAT-client/pods/man1/rmkitcomp.1.pod b/xCAT-client/pods/man1/rmkitcomp.1.pod index 900556763..d9ba57b1d 100644 --- a/xCAT-client/pods/man1/rmkitcomp.1.pod +++ b/xCAT-client/pods/man1/rmkitcomp.1.pod @@ -48,7 +48,7 @@ osimage name that include this kit component. =item B -A comma-delimited list of valid full kit component names or kit component basenames that are to be removed from the osimage. +A comma-delimited list of valid full kit component names or kit component basenames that are to be removed from the osimage. If a basename is specified, all kitcomponents matching that basename will be removed from the osimage. =back diff --git a/xCAT-genesis-scripts/xCAT-genesis-scripts.spec b/xCAT-genesis-scripts/xCAT-genesis-scripts.spec index b714e094e..3b5d3baef 100755 --- a/xCAT-genesis-scripts/xCAT-genesis-scripts.spec +++ b/xCAT-genesis-scripts/xCAT-genesis-scripts.spec @@ -68,7 +68,7 @@ cd - # should run mknb. Tried to use rpm triggers, but in several cases the trigger would # get run multiple times. #echo "touching /etc/xcat/genesis-scripts-updated" -echo "If you are installing/updating xCAT-genesis-base separately, not as part of installing/updating all of xCAT, run 'mknb manually'" +echo "If you are installing/updating xCAT-genesis-base separately, not as part of installing/updating all of xCAT, run 'mknb ' manually" mkdir -p /etc/xcat touch /etc/xcat/genesis-scripts-updated diff --git a/xCAT-server/lib/perl/xCAT/RShellAPI.pm b/xCAT-server/lib/perl/xCAT/RShellAPI.pm index e6fbdad1a..f0bda278c 100644 --- a/xCAT-server/lib/perl/xCAT/RShellAPI.pm +++ b/xCAT-server/lib/perl/xCAT/RShellAPI.pm @@ -146,7 +146,8 @@ sub run_remote_shell_api { my $pw_tried=0; my $login_done=0; my ($prematch, $match)= $t->waitfor(Match => '/login[: ]*$/i', - Match => '/username[: ]*$/i', + Match => '/username[: ]*$/i', + Match => '/User Name[: ]*$/i', Match => '/password[: ]*$/i', Match => "/$prompt/", Errmode => "return"); @@ -155,7 +156,7 @@ sub run_remote_shell_api { } if ($match =~ /$prompt/) { $login_done=1; - } elsif (($match =~ /username[: ]*$/i) || ($match =~ /login[: ]*$/i )) { + } elsif (($match =~ /User Name[: ]*$/i) || ($match =~ /username[: ]*$/i) || ($match =~ /login[: ]*$/i )) { # user name if ($user) { if (! $t->put(String => "$user\n", diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 567efaff9..6852a0e27 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -473,7 +473,7 @@ sub windows_net_cfg { unless ($mactab) { die "mac table should always exist prior to template processing when doing autoula"; } my $ent = $mactab->getNodeAttribs($node,['mac'],prefetchcache=>1); unless ($ent and $ent->{mac}) { die "missing mac data for $node"; } - my $suffix = $ent->{mac}; + my $suffix = xCAT::Utils->parseMacTabEntry($ent->{mac},$node); my $mac = $suffix; $suffix = lc($suffix); $mac =~ s/:/-/g; @@ -665,7 +665,7 @@ sub esxipv6setup { my $hoststab; my $mactab = xCAT::Table->new('mac',-create=>0); my $ent = $mactab->getNodeAttribs($node,['mac'],prefetchcache=>1); - my $suffix = $ent->{mac}; + my $suffix = xCAT::Utils->parseMacTabEntry($ent->{mac},$node); $suffix = lc($suffix); unless ($mactab) { die "mac table should always exist prior to template processing when doing autoula"; } #in autoula, because ESXi weasel doesn't seemingly grok IPv6 at all, we'll have to do it in %pre @@ -693,7 +693,7 @@ sub kickstartnetwork { unless ($mactab) { $tmplerr ="mac table should always exist prior to template processing when doing autoula"; return;} my $ent = $mactab->getNodeAttribs($node,['mac'],prefetchcache=>1); unless ($ent and $ent->{mac}) { $tmplerr ="missing mac data for $node"; return;} - my $suffix = $ent->{mac}; + my $suffix = xCAT::Utils->parseMacTabEntry($ent->{mac},$node); $suffix = lc($suffix); if ($::XCATSITEVALS{managedaddressmode} eq "autoula") { unless ($hoststab) { $hoststab = xCAT::Table->new('hosts',-create=>1); } @@ -746,7 +746,7 @@ sub yast2network { unless ($mactab) { die "mac table should always exist prior to template processing when doing autoula"; } my $ent = $mactab->getNodeAttribs($node,['mac'],prefetchcache=>1); unless ($ent and $ent->{mac}) { die "missing mac data for $node"; } - my $suffix = $ent->{mac}; + my $suffix = xCAT::Utils->parseMacTabEntry($ent->{mac},$node); $suffix = lc($suffix); if ($::XCATSITEVALS{managedaddressmode} eq "autoula") { #TODO diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 033942f24..316bee41d 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -1434,7 +1434,7 @@ sub mkinstall { my $mactab = xCAT::Table->new("mac"); my $macref = $mactab->getNodeAttribs($node, ['mac']); - $ksdev = $macref->{mac}; + $ksdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node); } else { @@ -1447,7 +1447,7 @@ sub mkinstall { my $mactab = xCAT::Table->new("mac"); my $macref = $mactab->getNodeAttribs($node, ['mac']); - $ksdev = $macref->{mac}; + $ksdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node); } else { @@ -1690,12 +1690,19 @@ sub mksysclone copy("/var/lib/systemimager/scripts/post-install/10all.fix_swap_uuids","$pspath"); } - unless (-r "$pspath/95all.monitord_rebooted") + #unless (-r "$pspath/95all.monitord_rebooted") + #{ + # mkpath("$pspath"); + # copy("/var/lib/systemimager/scripts/post-install/95all.monitord_rebooted","$pspath"); + #} + + + if(-e "$pspath/95all.monitord_rebooted") { - mkpath("$pspath"); - copy("/var/lib/systemimager/scripts/post-install/95all.monitord_rebooted","$pspath"); + `rm $pspath/95all.monitord_rebooted`; } + # copy hosts copy("/etc/hosts","$installroot/sysclone/scripts/"); @@ -1896,7 +1903,7 @@ sub mksysclone { my $mactab = xCAT::Table->new("mac"); my $macref = $mactab->getNodeAttribs($node, ['mac']); - $ksdev = $macref->{mac}; + $ksdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node); } else { @@ -1909,7 +1916,7 @@ sub mksysclone { my $mactab = xCAT::Table->new("mac"); my $macref = $mactab->getNodeAttribs($node, ['mac']); - $ksdev = $macref->{mac}; + $ksdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node); } else { @@ -1963,7 +1970,7 @@ sub mksysclone if ($archref->{arch} eq "ppc64"){ my $mactab = xCAT::Table->new('mac'); my $macref = $mactab->getNodeAttribs($node, ['mac']); - my $formatmac = $macref->{mac}; + my $formatmac = xCAT::Utils->parseMacTabEntry($macref->{mac},$node); $formatmac =~ s/:/-/g; $formatmac = "01-".$formatmac; $kcmdline .= " BOOTIF=$formatmac "; diff --git a/xCAT-server/lib/xcat/plugins/ddns.pm b/xCAT-server/lib/xcat/plugins/ddns.pm index 2d6175f20..8ade8cbf8 100755 --- a/xCAT-server/lib/xcat/plugins/ddns.pm +++ b/xCAT-server/lib/xcat/plugins/ddns.pm @@ -515,6 +515,61 @@ sub process_request { $ctx->{zonestotouch}->{$_->{domain}}=1; } } + + # get the listen on port for the DNS server from site.dnsinterfaces + my @dnsifinsite = xCAT::TableUtils->get_site_attribute("dnsinterfaces"); + if (@dnsifinsite) + #syntax should be like host|ifname1,ifname2;host2|ifname3,ifname2 etc or simply ifname,ifname2 + { + my $dnsinterfaces = $dnsifinsite[0]; + my $listenonifs; + foreach my $dnsif (split /;/,$dnsinterfaces) { + if ($dnsif =~ /\|/) { # there's host in the string + my ($hosts,$dnsif) = split /\|/,$dnsif; + if (! xCAT::NetworkUtils->thishostisnot($hosts)) { + $listenonifs=$dnsif; + } else { + # this host string might be a xcat group, try to test each node in the group + foreach my $host (noderange($hosts)) { + unless (xCAT::NetworkUtils->thishostisnot($host)) { + $listenonifs=$dnsif; + last; + } + } + } + } else { + $listenonifs = $dnsif; + } + + # get the ip for each interface and set it to $ctx->{dnslistenonifs} + if ($listenonifs) { + $listenonifs = "lo,".$listenonifs; + # get the ip address for each interface + my (@listenipv4, @listenipv6); + for my $if (split /,/, $listenonifs) { + my @ifaddrs = `ip addr show $if`; + foreach (@ifaddrs) { + if (/^\s*inet\s+([^ ]*)/) { + my $ip = $1; + $ip =~ s/\/.*//; + push @listenipv4, $ip; + } elsif (/^\s*inet6\s+([^ ]*)/) { + my $ip = $1; + $ip =~ s/\/.*//; + push @listenipv6, $ip; + } + } + } + if (@listenipv4) { + $ctx->{dnslistenonifs}->{ipv4} = \@listenipv4; + } + if (@listenipv6) { + $ctx->{dnslistenonifs}->{ipv6} = \@listenipv6; + } + last; + } + } + } xCAT::SvrUtils::sendmsg("Getting reverse zones, this may take several minutes for a large cluster.", $callback); @@ -930,6 +985,20 @@ sub update_namedconf { push @newnamed,"\t\t".$_.";\n"; } push @newnamed,"\t};\n"; + } elsif (defined($ctx->{dnslistenonifs}) and defined($ctx->{dnslistenonifs}->{ipv4}) and $line =~ /listen-on {/) { + push @newnamed,"\tlisten-on \{\n"; + $skip=1; + foreach (@{$ctx->{dnslistenonifs}->{ipv4}}) { + push @newnamed,"\t\t".$_.";\n"; + } + push @newnamed,"\t};\n"; + } elsif (defined($ctx->{dnslistenonifs}) and defined($ctx->{dnslistenonifs}->{ipv6}) and $line =~ /listen-on-v6 {/) { + push @newnamed,"\tlisten-on-v6 \{\n"; + $skip=1; + foreach (@{$ctx->{dnslistenonifs}->{ipv6}}) { + push @newnamed,"\t\t".$_.";\n"; + } + push @newnamed,"\t};\n"; } elsif ($skip) { if ($line =~ /};/) { $skip = 0; @@ -1029,7 +1098,7 @@ sub update_namedconf { push @newnamed,"\tdirectory \"".$ctx->{zonesdir}."\";\n"; push @newnamed, "\tallow-recursion { any; };\n"; } - push @newnamed,"\t\t//listen-on-v6 { any; };\n"; + #push @newnamed,"\t\t//listen-on-v6 { any; };\n"; if ($ctx->{forwarders}) { push @newnamed,"\tforwarders {\n"; foreach (@{$ctx->{forwarders}}) { @@ -1055,6 +1124,23 @@ sub update_namedconf { push @newnamed,"\t};\n"; } } + + # add the listen-on option + if (defined($ctx->{dnslistenonifs}) and defined($ctx->{dnslistenonifs}->{ipv4})) { + push @newnamed, "\tlisten-on \{\n"; + foreach (@{$ctx->{dnslistenonifs}->{ipv4}}) { + push @newnamed,"\t\t".$_.";\n"; + } + push @newnamed,"\t};\n" + } + if (defined($ctx->{dnslistenonifs}) and defined($ctx->{dnslistenonifs}->{ipv6})) { + push @newnamed,"\tlisten-on-v6 \{\n"; + foreach (@{$ctx->{dnslistenonifs}->{ipv6}}) { + push @newnamed,"\t\t".$_.";\n"; + } + push @newnamed,"\t};\n"; + } + push @newnamed,"};\n\n"; } @@ -1068,7 +1154,7 @@ sub update_namedconf { $ctx->{restartneeded}=1; } } - + my $cmd = "grep '^nameserver' /etc/resolv.conf | awk '{print \$2}'"; my @output = xCAT::Utils->runcmd($cmd, 0); my $zone; diff --git a/xCAT-server/lib/xcat/plugins/debian.pm b/xCAT-server/lib/xcat/plugins/debian.pm index 74d7849a5..5d9d59a90 100755 --- a/xCAT-server/lib/xcat/plugins/debian.pm +++ b/xCAT-server/lib/xcat/plugins/debian.pm @@ -600,7 +600,9 @@ sub mkinstall $darch = "i386"; } else { - xCAT::MsgUtils->message("S","debian.pm: Unknown arch ($arch)"); + if ($arch ne "ppc64le" and $arch ne "ppc64el") { + xCAT::MsgUtils->message("S","debian.pm: Unknown arch ($arch)"); + } $darch = $arch; } @@ -810,7 +812,7 @@ sub mkinstall if ($ent->{installnic} eq "mac"){ my $mactab = xCAT::Table->new("mac"); my $macref = $mactab->getNodeAttribs($node, ['mac']); - $ksdev = $macref->{mac}; + $ksdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node); } else{ $ksdev = $ent->{installnic}; @@ -820,7 +822,7 @@ sub mkinstall if ($ent->{primarynic} eq "mac"){ my $mactab = xCAT::Table->new("mac"); my $macref = $mactab->getNodeAttribs($node, ['mac']); - $ksdev = $macref->{mac}; + $ksdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node); } else{ $ksdev = $ent->{primarynic}; @@ -1435,9 +1437,9 @@ sub mknetboot #} # append the mac address my $mac; - if( !$useifname && $machash->{$node}->[0] && $machash->{$node}->[0]->{'mac'}) { + if( $machash->{$node}->[0] && $machash->{$node}->[0]->{'mac'}) { # TODO: currently, only "mac" attribute with classic style is used, the "|" delimited string of "macaddress!hostname" format is not used - $mac = $machash->{$node}->[0]->{'mac'}; + $mac = xCAT::Utils->parseMacTabEntry($machash->{$node}->[0]->{'mac'},$node); # if ( (index($mac, "|") eq -1) and (index($mac, "!") eq -1) ) { #convert to linux format if ($mac !~ /:/) { @@ -1449,9 +1451,9 @@ sub mknetboot # } } - #if ($useifname && $mac) { - # $kcmdline .= "$mac "; - #} + if ($useifname && $mac) { + $kcmdline .= "$mac "; + } # add "netdev=" or "BOOTIF=" # which are used for other scenarios diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index 10bedbae8..3fd6c5a82 100755 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -1487,92 +1487,88 @@ sub process_request if ( $^O ne 'aix') { + my $os = xCAT::Utils->osver(); #add the active nics to /etc/sysconfig/dhcpd or /etc/default/dhcp3-server(ubuntu) my $dhcpver; my %missingfiles = ( "dhcpd"=>1, "dhcpd6"=>1, "dhcp3-server"=>1 ); - foreach $dhcpver ("dhcpd","dhcpd6","dhcp3-server", "isc-dhcp-server") { - if (-e "/etc/sysconfig/$dhcpver") { - # for dhcpd, dhcpd6 - if ($dhcpver eq "dhcpd") { - delete($missingfiles{dhcpd}); - delete($missingfiles{"dhcp3-server"}); - } else { - delete($missingfiles{$dhcpver}); - } - open DHCPD_FD, "/etc/sysconfig/$dhcpver"; - my $syscfg_dhcpd = ""; - my $found = 0; + foreach $dhcpver ("dhcpd", "dhcpd6", "dhcp3-server", "isc-dhcp-server") { + + # if ipv6 is not present, no need to look at dhcpd6 files + if (!$usingipv6 and $dhcpver eq "dhcpd6") { + delete($missingfiles{"dhcpd6"}); + next; + } + + # check the possible system config paths for the various Linux O/S + my $syspath; + foreach $syspath ("/etc/sysconfig", "/etc/default") { + + my $generatedpath = "$syspath/$dhcpver"; my $dhcpd_key = "DHCPDARGS"; - my $os = xCAT::Utils->osver(); + if ($os =~ /sles/i) { $dhcpd_key = "DHCPD_INTERFACE"; - } - - my $ifarg = "$dhcpd_key=\""; - foreach (keys %activenics) { - if (/!remote!/) { next; } - $ifarg .= " $_"; - } - $ifarg =~ s/\=\" /\=\"/; - $ifarg .= "\"\n"; - - while () { - if ($_ =~ m/^$dhcpd_key/) { - $found = 1; - $syscfg_dhcpd .= $ifarg; - } else { - $syscfg_dhcpd .= $_; + if ($usingipv6 and $dhcpver eq "dhcpd6") { + # For SLES, the dhcpd6 "dhcpver" is going to modify the dhcpd conf file with key=DHCPD6_INTERFACE + $dhcpd_key = "DHCPD6_INTERFACE"; + $generatedpath = "$syspath/dhcpd"; } } - if ( $found eq 0 ) { - $syscfg_dhcpd .= $ifarg; - } - close DHCPD_FD; - - open DBG_FD, '>', "/etc/sysconfig/$dhcpver"; - print DBG_FD $syscfg_dhcpd; - close DBG_FD; - } elsif (-e "/etc/default/$dhcpver") { #ubuntu - delete($missingfiles{"dhcpd"}); - #dhcpd and dhcpd6 use the same configure file - delete($missingfiles{"dhcpd6"}); - delete($missingfiles{"dhcp3-server"}); - open DHCPD_FD, "/etc/default/$dhcpver"; - my $syscfg_dhcpd = ""; - my $found = 0; - my $dhcpd_key = "INTERFACES"; - my $os = xCAT::Utils->osver(); - - my $ifarg = "$dhcpd_key=\""; - foreach (keys %activenics) { - if (/!remote!/) { next; } - $ifarg .= " $_"; - } - $ifarg =~ s/^ //; - $ifarg .= "\"\n"; - - while () { - if ($_ =~ m/^$dhcpd_key/) { - $found = 1; - $syscfg_dhcpd .= $ifarg; - } else { - $syscfg_dhcpd .= $_; + if ($generatedpath and -e "$generatedpath") { + # remove the file from the hash because it will be processed + if ($dhcpver eq "dhcpd") { + # If dhcpd is found, then not necessary to find dhcp3-server + delete($missingfiles{"dhcp3-server"}); } - } - if ( $found eq 0 ) { - $syscfg_dhcpd .= $ifarg; - } - close DHCPD_FD; + # UBUNTU/DEBIAN specific + if ($dhcpver eq "isc-dhcp-server") { + # UBUNTU/DEBIAN configuration ipv6 & ipv4 uses the isc-dhcp-server + # remove all other from the missingfiles hash + delete($missingfiles{"dhcpd"}); + delete($missingfiles{"dhcpd6"}); + delete($missingfiles{"dhcp3-server"}); - open DBG_FD, '>', "/etc/default/$dhcpver"; - print DBG_FD $syscfg_dhcpd; - close DBG_FD; + $dhcpd_key = "INTERFACES"; + } + delete($missingfiles{$dhcpver}); + + open DHCPD_FD, "$generatedpath"; + my $syscfg_dhcpd = ""; + my $found = 0; + + my $ifarg = "$dhcpd_key=\""; + foreach (keys %activenics) { + if (/!remote!/) { next; } + $ifarg .= " $_"; + } + $ifarg =~ s/\=\" /\=\"/; + $ifarg .= "\"\n"; + + while () { + if ($_ =~ m/^$dhcpd_key/) { + $found = 1; + $syscfg_dhcpd .= $ifarg; + } else { + $syscfg_dhcpd .= $_; + } + } + + if ( $found eq 0 ) { + $syscfg_dhcpd .= $ifarg; + } + close DHCPD_FD; + + # write out the new file with the interfaces defined + open DBG_FD, '>', "$generatedpath"; + print DBG_FD $syscfg_dhcpd; + close DBG_FD; + } } } + if ($usingipv6) { - my $os = xCAT::Utils->osver(); # sles had dhcpd and dhcpd6 config in the dhcp file if ($os =~ /sles/i) { if ($missingfiles{dhcpd}) { @@ -1587,7 +1583,6 @@ sub process_request if ($missingfiles{dhcpd}) { $callback->({error=>["The file /etc/sysconfig/dhcpd doesn't exist, check the dhcp server"]}); } - } unless ($dhcpconf[0]) diff --git a/xCAT-server/lib/xcat/plugins/hosts.pm b/xCAT-server/lib/xcat/plugins/hosts.pm index 898e620ed..7868e41f5 100755 --- a/xCAT-server/lib/xcat/plugins/hosts.pm +++ b/xCAT-server/lib/xcat/plugins/hosts.pm @@ -233,6 +233,12 @@ sub delotherinterfaces } } + +##!!!!!!!!!!!!!!!!!!! +# NOTE FOR CHANGING # +# This subroutine is called in ddns.pm, please take care the calling in ddns.pm +# for your changes, especially the change upon the subroutine interface +##!!!!!!!!!!!!!!!!!!! sub add_hosts_content { my %args = @_; my $nodelist = $args{nodelist}; @@ -585,6 +591,12 @@ sub writeout =cut #------------------------------------------------------------------------------- + +##!!!!!!!!!!!!!!!!!!! +# NOTE FOR CHANGING # +# This subroutine is called in ddns.pm, please take care the calling in ddns.pm +# for your changes, especially the change upon the subroutine interface +##!!!!!!!!!!!!!!!!!!! sub donics { my %args = @_; diff --git a/xCAT-server/lib/xcat/plugins/imgport.pm b/xCAT-server/lib/xcat/plugins/imgport.pm index 77aa7bac2..4ad889ab1 100644 --- a/xCAT-server/lib/xcat/plugins/imgport.pm +++ b/xCAT-server/lib/xcat/plugins/imgport.pm @@ -998,7 +998,7 @@ sub make_bundle { # Local imgexports go to the current working directory $dest = "$dir/$bundleName"; } - + $callback->( {data => ["Compressing $imagename bundle. Please be patient."]}); if($::VERBOSE){ $callback->({data => ["tar czvf $dest . "]}); @@ -1971,6 +1971,10 @@ sub make_files { $callback->({error=>["Could not open the litefile table."],errorcode=>[1]}); return 0; } + #get current litefile table entries + my @entries = $lftab->getAllAttribsWhere( "\"image\" = 'ALL'", 'file', 'options'); + + #get the entries for image open(FILE,"$fn") or die "Could not open $fn."; foreach my $line () { chomp($line); @@ -1978,10 +1982,25 @@ sub make_files { my @tmp=split('"', $line); my %keyhash; my %updates; - $keyhash{image}=$data->{osimage}->{imagename}; - $keyhash{file}=$tmp[3]; - $updates{options}=$tmp[5]; - $lftab->setAttribs(\%keyhash, \%updates ); + my $filename = $tmp[3]; + my $options = $tmp[5]; + + # If there is an entry with image as ALL for the same file, + # then no need to add the file name in the table + my $skip = 0; + foreach my $entry (@entries) { + if (($filename eq $entry->{'file'}) && ($options eq $entry->{'options'})){ + $skip = 1; + last; + } + } + + if ($skip == 0) { + $keyhash{image}=$data->{osimage}->{imagename}; + $keyhash{file}=$filename; + $updates{options}=$options; + $lftab->setAttribs(\%keyhash, \%updates ); + } } close(FILE); $lftab->commit; diff --git a/xCAT-server/lib/xcat/plugins/kit.pm b/xCAT-server/lib/xcat/plugins/kit.pm index 8516b8a51..72a9a2c83 100644 --- a/xCAT-server/lib/xcat/plugins/kit.pm +++ b/xCAT-server/lib/xcat/plugins/kit.pm @@ -31,6 +31,12 @@ $::KITFRAMEWORK ="2"; # this code is compatible with other kits that are at framework 0 or 1. $::COMPATIBLE_KITFRAMEWORKS = "0,1,2"; +my $debianflag = 0; +my $tempstring = xCAT::Utils->osver(); +if ( $tempstring =~ /debian/ || $tempstring =~ /ubuntu/ ){ + $debianflag = 1; +# print "debian"; +} #------------------------------------------------------- @@ -576,11 +582,23 @@ sub assign_to_osimage unless ( -d "$otherpkgdir" ) { mkpath("$otherpkgdir"); } - - # Create symlink if doesn't exist - unless ( -d "$otherpkgdir/$kitcomptable->{kitreponame}" ) { + if ( $debianflag ) + { + unless ( -d "$otherpkgdir/$kitcomptable->{kitreponame}" ) + { + # system("mkdir -p $otherpkgdir/$kitcomptable->{kitreponame}"); + # print "mkdir -p $otherpkgdir/$kitcomptable->{kitreponame}"; + system("cp -Rf $kitrepodir $otherpkgdir/"); + print "cp -Rf $kitrepodir $otherpkgdir/"; + } + } + else + { + # Create symlink if doesn't exist + unless ( -d "$otherpkgdir/$kitcomptable->{kitreponame}" ) { system("ln -sf $kitrepodir $otherpkgdir/$kitcomptable->{kitreponame} "); - } + } + } } else { $callback->({error => ["Cannot open linuximage table or otherpkgdir do not exist"],errorcode=>[1]}); return 1; @@ -1442,7 +1460,7 @@ sub rmkit push@{ $rsp{data} }, "Usage: rmkit - Remove Kits from xCAT."; push@{ $rsp{data} }, "\trmkit [-h|--help]"; push@{ $rsp{data} }, "\trmkit [-v|--version]"; - push@{ $rsp{data} }, "\trmkit [-V|--verbose] [-f|--force] [-t|--test] ] [-V]"; + push@{ $rsp{data} }, "\trmkit [-V|--verbose] [-f|--force] [-t|--test] ]"; xCAT::MsgUtils->message( "I", \%rsp, $callback ); }; @@ -2400,7 +2418,7 @@ sub rmkitcomp push@{ $rsp{data} }, "Usage: rmkitcomp - Remove Kit components from an xCAT osimage."; push@{ $rsp{data} }, "\trmkitcomp [-h|--help]"; push@{ $rsp{data} }, "\trmkitcomp [-v|--version]"; - push@{ $rsp{data} }, "\trmkitcomp [-V|--verbose] [-u|--uninstall] [-f|--force] \n\t\t-i "; + push@{ $rsp{data} }, "\trmkitcomp [-V|--verbose] [-u|--uninstall] [-f|--force] [--noscripts] \n\t\t-i "; xCAT::MsgUtils->message( "I", \%rsp, $callback, $ret ); }; @@ -2471,6 +2489,7 @@ sub rmkitcomp } my %kitcomps; + my @remove_kitcomps_by_basename; my $des = shift @ARGV; my @kitcomponents = split ',', $des; foreach my $kitcomponent (@kitcomponents) { @@ -2501,19 +2520,22 @@ sub rmkitcomp xCAT::MsgUtils->message( "E", \%rsp, $callback ); return 1; } - - my $highest = get_highest_version('kitcompname', 'version', 'release', @entries); - $kitcomps{$highest}{name} = $highest; - (my $kitcomptable) = $tabs{kitcomponent}->getAttribs({kitcompname => $highest}, 'kitname', 'kitpkgdeps', 'prerequisite', 'postbootscripts', 'genimage_postinstall', 'kitreponame', 'exlist', 'basename', 'driverpacks'); - $kitcomps{$highest}{kitname} = $kitcomptable->{kitname}; - $kitcomps{$highest}{kitpkgdeps} = $kitcomptable->{kitpkgdeps}; - $kitcomps{$highest}{prerequisite} = $kitcomptable->{prerequisite}; - $kitcomps{$highest}{basename} = $kitcomptable->{basename}; - $kitcomps{$highest}{exlist} = $kitcomptable->{exlist}; - $kitcomps{$highest}{postbootscripts} = $kitcomptable->{postbootscripts}; - $kitcomps{$highest}{kitreponame} = $kitcomptable->{kitreponame}; - $kitcomps{$highest}{driverpacks} = $kitcomptable->{driverpacks}; - $kitcomps{$highest}{genimage_postinstall} = $kitcomptable->{genimage_postinstall}; + push (@remove_kitcomps_by_basename,$kitcomponent); + foreach $basename_entry (@entries) { + my $this_entry = $basename_entry->{kitcompname}; + $kitcomps{$this_entry}{name} = $this_entry; + (my $kitcomptable) = $tabs{kitcomponent}->getAttribs({kitcompname => $this_entry}, 'kitname', 'kitpkgdeps', 'prerequisite', 'postbootscripts', 'genimage_postinstall', 'kitreponame', 'exlist', 'basename', 'driverpacks'); + $kitcomps{$this_entry}{kitname} = $kitcomptable->{kitname}; + $kitcomps{$this_entry}{kitpkgdeps} = $kitcomptable->{kitpkgdeps}; + $kitcomps{$this_entry}{prerequisite} = $kitcomptable->{prerequisite}; + $kitcomps{$this_entry}{basename} = $kitcomptable->{basename}; + $kitcomps{$this_entry}{exlist} = $kitcomptable->{exlist}; + $kitcomps{$this_entry}{postbootscripts} = $kitcomptable->{postbootscripts}; + $kitcomps{$this_entry}{kitreponame} = $kitcomptable->{kitreponame}; + $kitcomps{$this_entry}{driverpacks} = $kitcomptable->{driverpacks}; + $kitcomps{$this_entry}{genimage_postinstall} = $kitcomptable->{genimage_postinstall}; + $kitcomps{$this_entry}{remove_by_basename} = '1'; + } } } # Check if the kitcomponents are existing in osimage.kitcomponents attribute. @@ -2541,13 +2563,35 @@ sub rmkitcomp my $invalidkitcomp = ''; foreach my $kitcomp ( keys %kitcomps) { if ( !$kitcomps{$kitcomp}{matched} ) { - if ( !$invalidkitcomp ) { - $invalidkitcomp = $kitcomp; + if ( $kitcomps{$kitcomp}{remove_by_basename} ) { + delete($kitcomps{$kitcomp}); } else { + if ( !$invalidkitcomp ) { + $invalidkitcomp = $kitcomp; + } else { $invalidkitcomp = join(',', $invalidkitcomp, $kitcomp); + } } } } + + foreach $basename_to_remove (@remove_kitcomps_by_basename) { + my $removing_at_least_one = 0; + foreach my $kitcomponent (keys %kitcomps) { + if ($basename_to_remove eq $kitcomps{$kitcomponent}{basename}) { + $removing_at_least_one = 1; + last; + } + } + if (!$removing_at_least_one) { + if ( !$invalidkitcomp ) { + $invalidkitcomp = $basename_to_remove; + } else { + $invalidkitcomp = join(',', $invalidkitcomp, $basename_to_remove); + } + } + } + if ( $invalidkitcomp ) { my %rsp; @@ -2556,6 +2600,7 @@ sub rmkitcomp return 1; } + # Now check if there is any other kitcomponent depending on this one. foreach my $kitcomponent (keys %kitcomps) { @@ -2729,6 +2774,12 @@ sub rmkitcomp } } if ( !$match ) { + if ( $debianflag ) + { + #Now we do not use moun --bind for kitrepo dir to otherpkgdir + #leave this line is support old way when using mount + system("umount -f $otherpkgdir/$kitcomps{$kitcomponent}{kitreponame} > /dev/null"); + } system("rm -rf $otherpkgdir/$kitcomps{$kitcomponent}{kitreponame}"); } } @@ -3200,6 +3251,60 @@ sub rmkitcomp # Write osimage table with all the above udpates. $tabs{osimage}->setAttribs({imagename => $osimage }, \%{$osimagetable} ); + #After all the data updated in osimage and linuximage table + #check if these kitcomponents are assigned to other osimage + #if these kitcomponents are not used by other osimage, find their kitrepo and kitrepo directory under otherpkg dir + #delete these kitrepo + my @allosikitcomps = $tabs{osimage}->getAllAttribs( 'imagename', 'kitcomponents' ); + + (my $linuximagetable) = $tabs{linuximage}->getAttribs({imagename=> $osimage}, 'postinstall', 'exlist', 'otherpkglist', 'otherpkgdir', 'driverupdatesrc'); + if ( $linuximagetable and $linuximagetable->{otherpkgdir} ) { + + my $otherpkgdir = $linuximagetable->{otherpkgdir}; + foreach my $kitcomponent (keys %kitcomps) { + + my %newosikitcomponents; + foreach my $allosikitcomp (@allosikitcomps) { + if ( $allosikitcomp->{kitcomponents} and $allosikitcomp->{imagename} ) { + my @allkitcomps = split /,/, $allosikitcomp->{kitcomponents}; + foreach my $allkitcomp ( @allkitcomps ) { + if ( $allosikitcomp->{imagename} ne $osimage or $allkitcomp ne $kitcomponent ) { + $newosikitcomponents{$allkitcomp} = 1; + } + } + } + } + + if ( $kitcomps{$kitcomponent}{kitreponame} ) { + if ( -d "$otherpkgdir/$kitcomps{$kitcomponent}{kitreponame}" ) { + + # Check if this repo is used by other kitcomponent before removing the link + my $match = 0; + foreach my $osikitcomp ( keys %newosikitcomponents ) { + + my $depkitrepodir; + (my $kitcomptable) = $tabs{kitcomponent}->getAttribs({kitcompname => $osikitcomp}, 'kitreponame'); + if ( $kitcomptable and $kitcomptable->{kitreponame} ) { + $depkitrepodir = "$otherpkgdir/$kitcomptable->{kitreponame}"; + } + if ( $depkitrepodir =~ /^$otherpkgdir\/$kitcomps{$kitcomponent}{kitreponame}$/) { + $match = 1; + } + } + if ( !$match ) { + if ( $debianflag ) + { + system("umount -f $otherpkgdir/$kitcomps{$kitcomponent}{kitreponame} > /dev/null"); + } + system("rm -rf $otherpkgdir/$kitcomps{$kitcomponent}{kitreponame}"); + } + } + } + } + } + + + return; } @@ -4151,6 +4256,8 @@ sub lskit { my $kitrepo_hash = get_kitrepo_hash($::kitnames, $::kitrepoattrs); my $kitcomp_hash = get_kitcomp_hash($::kitnames, $::kitcompattrs); + + # Now display the output my @kitnames = keys(%$kit_hash); if (scalar @kitnames == 0) { @@ -4160,15 +4267,204 @@ sub lskit { return 0; } - if (defined($::opt_x)) { - create_lskit_xml_response($kit_hash, $kitrepo_hash, $kitcomp_hash); - } else { - create_lskit_stanza_response($kit_hash, $kitrepo_hash, $kitcomp_hash); + #lskit use options + if ( defined($::opt_K) || defined($::opt_R) || defined($::opt_C) ) { + + if ( ! defined($::opt_x)) { + if ( defined($::opt_K) ){ + lskit_K($kit_hash); + } + + # Option -R for kit repo attributes + if ( defined($::opt_R) ) { + my @kitrepos = keys(%$kitrepo_hash); + if (scalar @kitrepos == 0) { + my $rsp = {}; + push @{ $rsp->{data} }, "No kit repos were found."; + xCAT::MsgUtils->message("I", $rsp, $::CALLBACK); + return 0; + } + lskit_R($kit_hash,$kitrepo_hash); + } + + if ( defined($::opt_C) ) { + my @kitcomplist = keys(%$kitcomp_hash); + if (scalar @kitcomplist == 0) { + my $rsp = {}; + push @{ $rsp->{data} }, "No kit components were found."; + xCAT::MsgUtils->message("I", $rsp, $::CALLBACK); + return 0; + } + lskit_C($kit_hash,$kitcomp_hash); + } + }else + { + #To support xml format + if (defined($::opt_K)) { + create_lskit_K_xml_response($kit_hash); + } + if (defined($::opt_R)) { + create_lskit_R_xml_response($kit_hash,$kitrepo_hash); + } + if (defined($::opt_C)) { + create_lskit_C_xml_response($kit_hash,$kitcomp_hash); + } + } + } + else + { + #lskit use no options + if (defined($::opt_x)) { + create_lskit_xml_response($kit_hash, $kitrepo_hash, $kitcomp_hash); + } else { + create_lskit_stanza_response($kit_hash, $kitrepo_hash, $kitcomp_hash); + } } return 0; } +#---------------------------------------------------------------------------- + +=head3 lskit_R + + Support for listing kit repo + + Arguments: + Returns: + 0 - OK + 1 - help + 2 - error +=cut + +#----------------------------------------------------------------------------- + +sub lskit_R { + + my $kit_hash = shift; + my $kitrepo_hash = shift; + my $rsp = {}; + my $count = 0; + + + for my $kitname (sort(keys(%$kit_hash))) { + + my $output .= "\nkit : $kitname\n----------------------------------------------------\n"; + + + # Kit repository info + if (defined($kitrepo_hash->{$kitname})) { + for my $kitrepo (@{$kitrepo_hash->{$kitname}}) { + $output .= "kitrepo:\n"; + for my $kitrepo_attr (sort(keys(%$kitrepo))) { + $output .= sprintf(" %s=%s\n", $kitrepo_attr, $kitrepo->{$kitrepo_attr}); + } + $output .= "\n"; + } + } + + push @{ $rsp->{data} }, $output; + } + + xCAT::MsgUtils->message("D", $rsp, $::CALLBACK); + + +} + + +#---------------------------------------------------------------------------- + +=head3 lskit_K + + Support for listing kit + + Arguments: + Returns: + 0 - OK + 1 - help + 2 - error +=cut + +#----------------------------------------------------------------------------- + +sub lskit_K { + + my $kit_hash = shift; + my $rsp = {}; + my $count = 0; + + + for my $kitname (sort(keys(%$kit_hash))) { + + my $output .= "\nkit : $kitname\n----------------------------------------------------\n"; + # Kit info + if (defined($kit_hash->{$kitname})) { + my $kit = $kit_hash->{$kitname}->[0]; + $output .= "kit:\n"; + for my $kit_attr (sort(keys(%$kit))) { + $output .= sprintf(" %s=%s\n", $kit_attr, $kit->{$kit_attr}); + } + $output .= "\n"; + } + + + push @{ $rsp->{data} }, $output; + } + + xCAT::MsgUtils->message("D", $rsp, $::CALLBACK); + + +} + +#---------------------------------------------------------------------------- + +=head3 lskit_C + + Support for listing kitcomponent + + Arguments: + Returns: + 0 - OK + 1 - help + 2 - error +=cut + +#----------------------------------------------------------------------------- + +sub lskit_C { + + my $kit_hash = shift; + my $kitcomp_hash = shift; + my $rsp = {}; + my $count = 0; + + + for my $kitname (sort(keys(%$kit_hash))) { + + my $output .= "\nkit : $kitname\n----------------------------------------------------\n"; + + + # Kit component info + if (defined($kitcomp_hash->{$kitname})) { + for my $kitcomp (@{$kitcomp_hash->{$kitname}}) { + $output .= "kitcomponent:\n"; + for my $kitcomp_attr (sort(keys(%$kitcomp))) { + $output .= sprintf(" %s=%s\n", $kitcomp_attr, $kitcomp->{$kitcomp_attr}); + } + $output .= "\n"; + } + } + + + push @{ $rsp->{data} }, $output; + } + + xCAT::MsgUtils->message("D", $rsp, $::CALLBACK); + + +} + + #---------------------------------------------------------------------------- =head3 lskitcomp @@ -4333,20 +4629,35 @@ sub lskitdeployparam { foreach my $kit (@$kits) { my $deployparam_file = $kit->{kitdir}."/other_files/".$kit->{kitdeployparams}; + my $tmpkitdeployparames = $kit->{kitdeployparams}; + if (defined($deployparam_file)) { - open(my $fh, "<", $deployparam_file) || die sprintf("Failed to open file %s because: %s", $deployparam_file, $!); + + # Check if there is kitdeployparam file or not + if (defined($tmpkitdeployparames)) + { + open(my $fh, "<", $deployparam_file) || die sprintf("Failed to open file %s because: %s", $deployparam_file, $!); - while (<$fh>) { - chomp $_; - if ($_ =~ /^#ENV:.+=.+#$/) { - my $tmp = $_; - $tmp =~ s/^#ENV://; - $tmp =~ s/#$//; - (my $name, my $value) = split(/=/, $tmp); - $deployparam_hash->{$name} = $value; - } - } - close($fh); + while (<$fh>) { + chomp $_; + if ($_ =~ /^#ENV:.+=.+#$/) { + my $tmp = $_; + $tmp =~ s/^#ENV://; + $tmp =~ s/#$//; + (my $name, my $value) = split(/=/, $tmp); + $deployparam_hash->{$name} = $value; + } + } + close($fh); + } + else { + my $rsp = {}; + push @{ $rsp->{data}}, "There is no kitdeployparams file in $deployparam_file.\n"; + xCAT::MsgUtils->message("W", $rsp, $::CALLBACK); + + return 1; + } + } } @@ -4816,6 +5127,122 @@ sub create_lskit_xml_response { } +#---------------------------------------------------------------------------- + +=head3 create_lskit_K_xml_response + + Prepare a response that returns the kit info in XML format. + + Arguments: + kit hash table + + Note: Hash tables are created by create_hash_from_table_rows() +=cut + +#----------------------------------------------------------------------------- + +sub create_lskit_K_xml_response { + + my $kit_hash = shift; + + my $rsp = {}; + + for my $kitname (sort(keys(%$kit_hash))) { + my $output_hash = {"kitinfo" => {"kit" => [], "kitrepo" => [], "kitcomponent" => [] } }; + + # Kit info + if (defined($kit_hash->{$kitname})) { + my $kit = $kit_hash->{$kitname}->[0]; + push(@{$output_hash->{kitinfo}->{kit}}, $kit); + } + + push @{ $rsp->{data} }, $output_hash; + } + + xCAT::MsgUtils->message("D", $rsp, $::CALLBACK); +} + +#---------------------------------------------------------------------------- + +=head3 create_lskit_R_xml_response + + Prepare a response that returns the kit repository + info in XML format. + + Arguments: + kit repo hash table + + Note: Hash tables are created by create_hash_from_table_rows() +=cut + +#----------------------------------------------------------------------------- + +sub create_lskit_R_xml_response { + + my $kit_hash = shift; + my $kitrepo_hash = shift; + + my $rsp = {}; + + for my $kitname (sort(keys(%$kit_hash))) { + my $output_hash = {"kitinfo" => {"kit" => [], "kitrepo" => [], "kitcomponent" => [] } }; + + # Kit repository info + if (defined($kitrepo_hash->{$kitname})) { + for my $kitrepo (@{$kitrepo_hash->{$kitname}}) { + push(@{$output_hash->{kitinfo}->{kitrepo}}, $kitrepo); + } + } + + push @{ $rsp->{data} }, $output_hash; + } + + xCAT::MsgUtils->message("D", $rsp, $::CALLBACK); +} + + +#---------------------------------------------------------------------------- + +=head3 create_lskit_C_xml_response + + Prepare a response that returns the + kit component info in XML format. + + Arguments: + kit hash table + kit component hash table + + Note: Hash tables are created by create_hash_from_table_rows() +=cut + +#----------------------------------------------------------------------------- + +sub create_lskit_C_xml_response { + + my $kit_hash = shift; + my $kitcomp_hash = shift; + + my $rsp = {}; + + for my $kitname (sort(keys(%$kit_hash))) { + my $output_hash = {"kitinfo" => {"kit" => [], "kitrepo" => [], "kitcomponent" => [] } }; + + + # Kit component info + if (defined($kitcomp_hash->{$kitname})) { + for my $kitcomp (@{$kitcomp_hash->{$kitname}}) { + push(@{$output_hash->{kitinfo}->{kitcomp}}, $kitcomp); + } + } + + push @{ $rsp->{data} }, $output_hash; + } + + xCAT::MsgUtils->message("D", $rsp, $::CALLBACK); +} + + + #---------------------------------------------------------------------------- =head3 create_lskit_stanza_response diff --git a/xCAT-server/lib/xcat/plugins/nodestat.pm b/xCAT-server/lib/xcat/plugins/nodestat.pm index 2201d7d2e..e8f04b181 100644 --- a/xCAT-server/lib/xcat/plugins/nodestat.pm +++ b/xCAT-server/lib/xcat/plugins/nodestat.pm @@ -187,8 +187,8 @@ sub preprocess_request #my $sitetab = xCAT::Table->new('site'); #if ($sitetab) { #(my $ref) = $sitetab->getAttribs({key => 'useNmapfromMN'}, 'value'); - my @entries = xCAT::TableUtils->get_site_attribute("useNmapfromMN"); - my $t_entry = $entries[0]; + my @entries = xCAT::TableUtils->get_site_attribute("useNmapfromMN"); + my $t_entry = $entries[0]; if (defined($t_entry)) { if ($t_entry =~ /1|yes|YES|Y|y/) { $usenmapfrommn=1; } } @@ -634,79 +634,84 @@ sub process_request_nmap { my %rsp; my $installquerypossible=0; my @nodesetnodes=(); + + # get additional options from site table + my @nmap_options = xCAT::TableUtils->get_site_attribute("nmapoptions"); + my $more_options = $nmap_options[0]; + foreach my $ip6 (0,1) { #first pass, ipv4, second pass ipv6 - if ($ip6 and scalar(@ip6s)) { - open($fping,"nmap -6 -PS$ports,3001 -n --send-ip -p $ports,3001 ".join(' ',@ip6s). " 2> /dev/null|") or die("Can't start nmap: $!"); - } elsif (not $ip6 and scalar(@ips)) { - open($fping,"nmap -PE -n --send-ip -p $ports,3001 ".join(' ',@ips). " 2> /dev/null|") or die("Can't start nmap: $!"); - } else { next; } - while (<$fping>) { - if (/Interesting ports on ([^ ]*)[: ]/ or /Nmap scan report for ([^ ]*)/) { - my $tmpnode=$1; - if ($currnode) { #if still thinking about last node, flush him out - my $status = join ',',sort keys %states ; - my $appsd=""; - foreach my $portnum(keys %portservices) { - my $app_t=$portservices{$portnum}; - if ($states{$app_t}) {$appsd .= $app_t . "=up,";} - else {$appsd .= $app_t . "=down,";} - } - $appsd =~ s/,$//; - my $target=$currnode; - if ($hostsents{$target} and $hostsents{$target}->[0]->{ip}) { $target = $hostsents{$target}->[0]->{ip}; } - - if ($status or ($installquerypossible and $status = installer_query($target))) { #pingable, but no *clue* as to what the state may be - $ret->{$currnode}->{'status'}="ping"; - $ret->{$currnode}->{'appstatus'}=$status; - $ret->{$currnode}->{'appsd'}=$appsd; - $currnode=""; - %states=(); - } else { - push @nodesetnodes,$currnode; #Aggregate call to nodeset - } - } - $currnode=$tmpnode; - $currnode =~ s/:$//; - $currnode =~ s/\n$//; - - - my $nip; - if ($nip = xCAT::NetworkUtils->getipaddr($currnode)) { #reverse lookup may not resemble the nodename, key by ip - if ($nodebyip{$nip}) { - $currnode = $nodebyip{$nip}; - } - } - $installquerypossible=0; #reset possibility indicator - %rsp=(); - unless ($deadnodes{$1}) { - my $shortname; - foreach (keys %deadnodes) { - if (/\./) { - $shortname = $_; - $shortname =~ s/\..*//; - } - if ($currnode =~ /^$_\./ or ($shortname and $shortname eq $currnode)) { - $currnode = $_; - last; - } - } - } - delete $deadnodes{$currnode}; - } elsif ($currnode) { - #if (/^MAC/) { #oops not all nmap records end with MAC - if (/^PORT/) { next; } - ($port,$state) = split; - if ($port and $port =~ /^(\d*)\// and $state eq 'open') { - if ($1 eq "3001" and defined($chainhash{$currnode}->[0]->{currstate}) and $chainhash{$currnode}->[0]->{currstate} =~ /^install/) { - $installquerypossible=1; #It is possible to actually query node - } elsif ($1 ne "3001") { - $states{$portservices{$1}}=1; - } - } - } + if ($ip6 and scalar(@ip6s)) { + open($fping,"nmap -6 -PS$ports,3001 -n --send-ip -p $ports,3001 $more_options ".join(' ',@ip6s). " 2> /dev/null|") or die("Can't start nmap: $!"); + } elsif (not $ip6 and scalar(@ips)) { + open($fping,"nmap -PE -n --send-ip -p $ports,3001 $more_options ".join(' ',@ips). " 2> /dev/null|") or die("Can't start nmap: $!"); + } else { next; } + while (<$fping>) { + if (/Interesting ports on ([^ ]*)[: ]/ or /Nmap scan report for ([^ ]*)/) { + my $tmpnode=$1; + if ($currnode) { #if still thinking about last node, flush him out + my $status = join ',',sort keys %states ; + my $appsd=""; + foreach my $portnum(keys %portservices) { + my $app_t=$portservices{$portnum}; + if ($states{$app_t}) {$appsd .= $app_t . "=up,";} + else {$appsd .= $app_t . "=down,";} + } + $appsd =~ s/,$//; + my $target=$currnode; + if ($hostsents{$target} and $hostsents{$target}->[0]->{ip}) { $target = $hostsents{$target}->[0]->{ip}; } + + if ($status or ($installquerypossible and $status = installer_query($target))) { #pingable, but no *clue* as to what the state may be + $ret->{$currnode}->{'status'}="ping"; + $ret->{$currnode}->{'appstatus'}=$status; + $ret->{$currnode}->{'appsd'}=$appsd; + $currnode=""; + %states=(); + } else { + push @nodesetnodes,$currnode; #Aggregate call to nodeset + } + } + $currnode=$tmpnode; + $currnode =~ s/:$//; + $currnode =~ s/\n$//; + + + my $nip; + if ($nip = xCAT::NetworkUtils->getipaddr($currnode)) { #reverse lookup may not resemble the nodename, key by ip + if ($nodebyip{$nip}) { + $currnode = $nodebyip{$nip}; + } + } + $installquerypossible=0; #reset possibility indicator + %rsp=(); + unless ($deadnodes{$currnode}) { + my $shortname; + foreach (keys %deadnodes) { + if (/\./) { + $shortname = $_; + $shortname =~ s/\..*//; + } + if ($currnode =~ /^$_\./ or ($shortname and $shortname eq $currnode)) { + $currnode = $_; + last; + } + } + } + delete $deadnodes{$currnode}; + } elsif ($currnode) { + #if (/^MAC/) { #oops not all nmap records end with MAC + if (/^PORT/) { next; } + ($port,$state) = split; + if ($port and $port =~ /^(\d*)\// and $state eq 'open') { + if ($1 eq "3001" and defined($chainhash{$currnode}->[0]->{currstate}) and $chainhash{$currnode}->[0]->{currstate} =~ /^install/) { + $installquerypossible=1; #It is possible to actually query node + } elsif ($1 ne "3001") { + $states{$portservices{$1}}=1; + } + } + } + } } - } - + if ($currnode) { my $status = join ',',sort keys %states ; my $appsd=""; diff --git a/xCAT-server/lib/xcat/plugins/rhevm.pm b/xCAT-server/lib/xcat/plugins/rhevm.pm index b63a602a3..657c36a3d 100644 --- a/xCAT-server/lib/xcat/plugins/rhevm.pm +++ b/xCAT-server/lib/xcat/plugins/rhevm.pm @@ -579,7 +579,7 @@ sub mkinstall { if ($ent->{installnic} eq "mac") { my $mactab = xCAT::Table->new("mac"); my $macref = $mactab->getNodeAttribs($node, ['mac']); - $ksdev = $macref->{mac}; + $ksdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node); } else { $ksdev = $ent->{installnic}; } @@ -587,7 +587,7 @@ sub mkinstall { if ($ent->{primarynic} eq "mac") { my $mactab = xCAT::Table->new("mac"); my $macref = $mactab->getNodeAttribs($node, ['mac']); - $ksdev = $macref->{mac}; + $ksdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node); } else { $ksdev = $ent->{primarynic}; } diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index 3fb45e46f..032df544e 100755 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -582,7 +582,7 @@ sub mknetboot # add the kernel-booting parameter: netdev=, or BOOTIF= my $netdev = ""; - my $mac = $machash->{$node}->[0]->{mac}; + my $mac = xCAT::Utils->parseMacTabEntry($machash->{$node}->[0]->{mac},$node); if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic} and ($reshash->{$node}->[0]->{installnic} ne "mac")) { $kcmdline .= "netdev=" . $reshash->{$node}->[0]->{installnic} . " "; @@ -1010,6 +1010,11 @@ sub mkinstall and -r "$pkgdir/1/boot/i386/loader/linux" and -r "$pkgdir/1/boot/i386/loader/initrd" ) + or ( + $arch eq "ppc64le" + and -r "$pkgdir/1/boot/ppc64le/linux" + and -r "$pkgdir/1/boot/ppc64le/initrd" + ) or ($arch =~ /ppc/ and -r "$pkgdir/1/suseboot/inst64") ) { @@ -1050,6 +1055,12 @@ sub mkinstall copy("$pkgdir/1/boot/i386/loader/initrd", "$tftppath"); @dd_drivers = &insert_dd($callback, $os, $arch, "$tftppath/initrd", "$tftppath/linux", $driverupdatesrc, $netdrivers, $osupdir, $ignorekernelchk); } + } elsif ($arch eq "ppc64le") { + unless ($noupdateinitrd) { + copy("$pkgdir/1/boot/$arch/linux", "$tftppath"); + copy("$pkgdir/1/boot/$arch/initrd", "$tftppath"); + @dd_drivers = &insert_dd($callback, $os, $arch, "$tftppath/initrd", "$tftppath/linux", $driverupdatesrc, $netdrivers, $osupdir, $ignorekernelchk); + } } elsif ($arch =~ /ppc/) { @@ -1104,7 +1115,7 @@ sub mkinstall { my $mactab = xCAT::Table->new("mac"); my $macref = $mactab->getNodeAttribs($node, ['mac']); - $netdev = $macref->{mac}; + $netdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node); } else { @@ -1117,7 +1128,7 @@ sub mkinstall { my $mactab = xCAT::Table->new("mac"); my $macref = $mactab->getNodeAttribs($node, ['mac']); - $netdev = $macref->{mac}; + $netdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node); } else { @@ -1231,7 +1242,7 @@ sub mkinstall my $kernelpath; my $initrdpath; - if ($arch =~ /x86/) + if ($arch =~ /x86/ or $arch eq "ppc64le") { $kernelpath = "$rtftppath/linux"; $initrdpath = "$rtftppath/initrd"; @@ -1368,12 +1379,18 @@ sub mksysclone # copy("/var/lib/systemimager/scripts/post-install/11all.replace_byid_device","$pspath"); #} - unless (-r "$pspath/95all.monitord_rebooted") + #unless (-r "$pspath/95all.monitord_rebooted") + #{ + # mkpath("$pspath"); + # copy("/var/lib/systemimager/scripts/post-install/95all.monitord_rebooted","$pspath"); + #} + + if(-e "$pspath/95all.monitord_rebooted") { - mkpath("$pspath"); - copy("/var/lib/systemimager/scripts/post-install/95all.monitord_rebooted","$pspath"); + `rm $pspath/95all.monitord_rebooted`; } + # copy hosts copy("/etc/hosts","$installroot/sysclone/scripts/"); @@ -1452,7 +1469,7 @@ sub mksysclone { my $mactab = xCAT::Table->new("mac"); my $macref = $mactab->getNodeAttribs($node, ['mac']); - $ksdev = $macref->{mac}; + $ksdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node); } unless ( $ksdev eq "bootif" ) { @@ -1487,7 +1504,7 @@ sub mksysclone if ($archref->{arch} eq "ppc64"){ my $mactab = xCAT::Table->new('mac'); my $macref = $mactab->getNodeAttribs($node, ['mac']); - my $formatmac = $macref->{mac}; + my $formatmac = xCAT::Utils->parseMacTabEntry($macref->{mac},$node); $formatmac =~ s/:/-/g; $formatmac = "01-".$formatmac; $kcmdline .= " BOOTIF=$formatmac "; @@ -1732,6 +1749,9 @@ sub copycd { $darch = "x86"; } + elsif ($darch and ($darch eq "ppc64le" or $darch eq "ppc64el")) { + $darch = "ppc64le"; + } elsif ($darch and $darch =~ /ppc/) { $darch = "ppc64"; diff --git a/xCAT-server/lib/xcat/plugins/xCATWorld.pm b/xCAT-server/lib/xcat/plugins/xCATWorld.pm index ff7bf1e6c..09268ace7 100644 --- a/xCAT-server/lib/xcat/plugins/xCATWorld.pm +++ b/xCAT-server/lib/xcat/plugins/xCATWorld.pm @@ -102,8 +102,9 @@ sub process_request my $args = $request->{arg}; my $envs = $request->{env}; my %rsp; - my @nodes=@$nodes; - @ARGV = @{$args}; # get arguments + if (defined $args) { + @ARGV = @{$args}; # get arguments + } $::CALLBACK=$callback; # do your processing here # return info @@ -142,7 +143,7 @@ if ( # save your callback function my $out=xCAT::Utils->runxcmd( { command => ['xdsh'], - node => \@nodes, + node => \@$nodes, arg => [ "-v","ls /tmp" ] }, $subreq, 0,1); @@ -151,7 +152,7 @@ if ( my $rsp={}; $rsp->{data}->[0] = "Hello World from $host! I can process the following nodes:"; xCAT::MsgUtils->message("I", $rsp, $callback, 0); - foreach my $node (@nodes) + foreach my $node (@$nodes) { $rsp->{data}->[0] .= "$node\n"; } diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index 088388a3b..b504063cd 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -404,9 +404,18 @@ if ($::INITIALINSTALL || $::FORCE || $::UPDATEINSTALL) verbose("syslog has been set up."); } } - - -# +# The systemd only has LANG and PATH as default environmental variables, +# TERM is needed for KVM consoles(actually screen command needs TERM) +# import the TERM into systemd +if ( -d "/usr/lib/systemd/system" ) { + my $cmd = "systemctl import-environment TERM"; + xCAT::Utils->runcmd("$cmd", 0); + if ($::RUNCMD_RC != 0) { + xCAT::MsgUtils->message('E', "Could not import TERM into systemd."); + } else { + verbose("Imported TERM=$ENV{'TERM'} into systemd."); + } +} # # start xcatd diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index d8b4a7abd..a0b2a58e7 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -25,6 +25,8 @@ my %supported_encodes = ( ); my $sslctl; my $udpctl; +my $pid_UDP; +my $pid_MON; # if AIX - make sure we include perl 5.8.2 in INC path. # Needed to find perl dependencies shipped in deps tarball. if ($^O =~ /^aix/i) { @@ -198,8 +200,13 @@ $xcatdir = (($tmp and $tmp->{value}) ? $tmp->{value} : "/etc/xcat"); $sitetab->close; my $progname; my $pipeexpected; +my $ssl2udppipe=0; $SIG{PIPE} = sub { if ($pipeexpected) { return; } + if ($ssl2udppipe) { + xCAT::MsgUtils->message("S","SIGPIPE xcatd SSL listener to udp service pipe is broken. Ignore this error if you are shutting down or restarting xcatd."); + return; + } confess "SIGPIPE $$progname encountered a broken pipe (probably Ctrl-C by client)"; }; $progname = \$0; @@ -851,6 +858,10 @@ my %immediatechildren; sub generic_reaper { local($!); while (($CHILDPID=waitpid(-1,WNOHANG)) > 0) { + if (($CHILDPID == $pid_UDP) && ($udpctl)) { + # got here because UDP child is gone + close($udpctl); $udpctl=0; + } yield; } $SIG{CHLD} = \&generic_reaper; @@ -865,9 +876,15 @@ sub ssl_reaper { $sslclients--; $numdone--; } + if (($CHILDPID == $pid_UDP) && ($udpctl)) { + # got here because UDP child is gone + close($udpctl); $udpctl=0; + } } if ($udpctl) { + $ssl2udppipe=1; store_fd({clientcountchange=>$numdone,sslclientcount=>$sslclients},$udpctl); #notify udp service of how many clients are active + $ssl2udppipe=0; } $SIG{CHLD} = \&ssl_reaper; } @@ -879,6 +896,10 @@ sub dispatch_reaper { delete $dispatched_children{$CHILDPID}; $dispatch_children--; } + if (($CHILDPID == $pid_UDP) && ($udpctl)) { + # got here because UDP child is gone + close($udpctl); $udpctl=0; + } } $SIG{CHLD} = \&dispatch_reaper; } @@ -890,14 +911,16 @@ sub plugin_reaper { delete $plugin_children{$CHILDPID}; $plugin_numchildren--; } + if (($CHILDPID == $pid_UDP) && ($udpctl)) { + # got here because UDP child is gone + close($udpctl); $udpctl=0; + } } $SIG{CHLD} = \&plugin_reaper; } $SIG{CHLD} = \&generic_reaper; -my $pid_UDP; -my $pid_MON; $SIG{TERM} = $SIG{INT} = sub { #printf("Asked to quit...\n"); $quit++; @@ -1211,7 +1234,9 @@ if ($inet6support) { } $sslclients++; #THROTTLE if ($udpctl) { + $ssl2udppipe=1; store_fd({clientcountchange=>1,sslclientcount=>$sslclients},$udpctl); #notify udp service of how many clients are active + $ssl2udppipe=0; } $cnnection->close(); } @@ -2113,7 +2138,7 @@ sub get_request { my $request = shift; if ($encode eq "xml") { my $line = ""; - while ($request !~ m/<\/xcatrequest>/) { + 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.. fcntl($sock,F_SETFL,$flags); diff --git a/xCAT-server/share/xcat/cons/kvm b/xCAT-server/share/xcat/cons/kvm index da90b01b8..7d95cd3e4 100755 --- a/xCAT-server/share/xcat/cons/kvm +++ b/xCAT-server/share/xcat/cons/kvm @@ -75,6 +75,13 @@ until ($dsthost and $speed and $dstty) { exec "sleep $sleepint"; } release_lock(); +# The screen command needs the TERM env var, +# TERM might be empty for some unknown reasons, +# for example, on SLES 12 and on PowerKVM +if (!$ENV{'TERM'}) { + $ENV{'TERM'}="vt100"; +} + exec "ssh -t $dsthost screen -U -a -O -e ^]a -d -R -S serial-".$ARGV[0]."-cons -A $dstty $speed"; #my $pathtochild= dirname($scriptname). "/"; 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 96b3aa7bb..1bf577624 100755 --- a/xCAT-server/share/xcat/ib/scripts/Mellanox/mlnxofed_ib_install +++ b/xCAT-server/share/xcat/ib/scripts/Mellanox/mlnxofed_ib_install @@ -50,6 +50,17 @@ OS=`uname` #installroot='/install/netboot/sles11.1/x86_64/compute/rootimg' INSTALL_DIR='/install' +#echo "------------------------------------------" +#echo "OFED_DIR=$ofeddir" +#echo "OSVER=$OSVER" +#echo "arch=$ARCH" +#echo "NODESETSTATE=$NODESETSTATE" +#echo "mlnxofed_options=$mlnxofed_options" +#echo "installroot=$installroot" +#echo "------------------------------------------" + + + #use arg for the OFED_DIR if defined, ARGNUM=$# if [ $ARGNUM -gt 1 ]; then @@ -73,13 +84,13 @@ if [ -z "$mlnxofed_options" ]; then mlnxofed_options="--without-32bit --force" fi -if [ $NODESETSTATE != "genimage" ]; then +if [[ $NODESETSTATE != "genimage" ]]; then # running as a postscript in a full-disk install or AIX diskless install installroot="" fi if [ $OS != "AIX" ]; then - if [ $NODESETSTATE == "install" ] || [ $NODESETSTATE == "boot" ]; then + if [[ $NODESETSTATE == "install" ]] || [[ $NODESETSTATE == "boot" ]]; then # Being run from a stateful install postscript # Copy rpms directly from the xCAT management node and install mkdir -p /tmp/ofed @@ -92,13 +103,58 @@ if [ $OS != "AIX" ]; then wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=$num --reject "index.html*" --no-parent http://$MASTER$download_dir/ 2> /tmp/wget.log wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=$num --reject "index.html*" --no-parent http://$MASTER$download_dir/.mlnx 2>> /tmp/wget.log wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=$num --reject "index.html*" --no-parent http://$MASTER$download_dir/.supported_kernels 2>> /tmp/wget.log + + + if [ -f /etc/os-release ] && + cat /etc/os-release |grep NAME|grep Ubuntu>/dev/null + then + nodename=`hostname` + echo "$nodename 's operating system is Ubuntu." + echo "If you want to install Mellanox_OFED in $nodename, $nodename must have ability to access public network." + echo -n "checking $nodename 's ability to access public network..........." + if ping -c 3 91.189.88.140 > /dev/null;then + echo "[OK]" + else + echo "[Failed]" + echo "please make your $nodename have ability to access public network" + exit 1 + fi + + cp /etc/apt/sources.list /etc/apt/sources.list.bak + sed -i "/deb http:\\/\\/91.189.88.140\\/ubuntu-ports\\/ trusty main/d" /etc/apt/sources.list + sed -i "/deb http:\\/\\/91.189.88.140\\/ubuntu-ports\\/ trusty-updates main/d" /etc/apt/sources.list + sed -i "/deb http:\\/\\/91.189.88.140\\/ubuntu-ports\\/ trusty universe/d" /etc/apt/sources.list + sed -i "/deb http:\\/\\/91.189.88.140\\/ubuntu-ports\\/ trusty-updates universe/d" /etc/apt/sources.list + + echo "deb http://91.189.88.140/ubuntu-ports/ trusty main +deb http://91.189.88.140/ubuntu-ports/ trusty-updates main +deb http://91.189.88.140/ubuntu-ports/ trusty universe +deb http://91.189.88.140/ubuntu-ports/ trusty-updates universe" >> /etc/apt/sources.list + + apt-get clean all + sleep 1 + apt-get update + fi + #rpm -Uvh --force libibverbs-devel*.rpm #perl -x mlnxofedinstall --without-32bit --force - perl -x mlnxofedinstall $mlnxofed_options + + if [ -f /etc/os-release ] && + 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 $mlnxofed_options + sleep 1 + service openibd restart + else + echo "perl -x mlnxofedinstall $mlnxofed_options" + perl -x mlnxofedinstall $mlnxofed_options + fi rm -Rf /tmp/ofed fi - if [ $NODESETSTATE == "genimage" ]; then + if [[ $NODESETSTATE == "genimage" ]]; then # Being called from .postinstall script # Assume we are on the same machine if [[ $OS == sles* ]] || [[ $OS == suse* ]] || [[ -f /etc/SuSE-release ]]; then @@ -118,6 +174,52 @@ if [ $OS != "AIX" ]; then umount $installroot/dev/ umount $installroot/sys umount $installroot/proc + elif [ -f /etc/os-release ] && + cat /etc/os-release |grep NAME|grep Ubuntu>/dev/null; then + + mkdir $installroot/tmp/ofed_install + cp -r $OFED_DIR/ $installroot/tmp/ofed_install/ + + nodename=`hostname` + echo "$nodename 's operating system is Ubuntu." + echo "If you want to install Mellanox_OFED in $nodename, $nodename must have ability to access public network." + echo -n "checking $nodename 's ability to access public network..........." + if ping -c 3 91.189.88.140 > /dev/null;then + echo "[OK]" + else + echo "[Failed]" + echo "please make your $nodename have ability to access public network" + exit 1 + fi + + sourceslist="$installroot/etc/apt/sources.list" + cp $sourceslist $sourceslist.bak + + sed -i "/deb http:\\/\\/91.189.88.140\\/ubuntu-ports\\/ trusty main/d" $sourceslist + sed -i "/deb http:\\/\\/91.189.88.140\\/ubuntu-ports\\/ trusty-updates main/d" $sourceslist + sed -i "/deb http:\\/\\/91.189.88.140\\/ubuntu-ports\\/ trusty universe/d" $sourceslist + sed -i "/deb http:\\/\\/91.189.88.140\\/ubuntu-ports\\/ trusty-updates universe/d" $sourceslist + + echo "deb http://91.189.88.140/ubuntu-ports/ trusty main +deb http://91.189.88.140/ubuntu-ports/ trusty-updates main +deb http://91.189.88.140/ubuntu-ports/ trusty universe +deb http://91.189.88.140/ubuntu-ports/ trusty-updates universe" >> $sourceslist + + chroot $installroot apt-get clean all + sleep 1 + chroot $installroot apt-get update + 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" + chroot $installroot perl -x /tmp/ofed_install/ofed/mlnxofedinstall --without-fw-update $mlnxofed_options + rm -rf $installroot/tmp/ofed_install + umount $installroot/dev/ + umount $installroot/proc/ + umount $installroot/sys/ + else mkdir $installroot/tmp/ofed_install cp -r $OFED_DIR/ $installroot/tmp/ofed_install/ diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.ppc64le.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.ppc64le.pkglist new file mode 100644 index 000000000..818b8f26f --- /dev/null +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.ppc64le.pkglist @@ -0,0 +1,15 @@ +bash +nfs-common +openssl +isc-dhcp-client +libc-bin +linux-image-generic +openssh-server +openssh-client +wget +vim +ntp +rsync +busybox-static +gawk +dnsutils diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index 2298b324b..efe37096c 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -241,7 +241,14 @@ unless ($onlyinitrd) { my @line=split(" ",`ls -lh $installroot/$osver/$arch/dists/ | grep dr`); my $dist = $line[@line-1]; - my $aptgetcmd = "chroot $rootimg_dir apt-get update && chroot $rootimg_dir apt-get $non_interactive "; +# my $aptgetcmd = "chroot $rootimg_dir apt-get update && chroot $rootimg_dir apt-get $non_interactive "; + + # If there is env in otherpkg list + # apt-get update and apt-get install should be added env param + my $aptgetcmd = "chroot $rootimg_dir apt-get update"; + my $aptgetcmdby="chroot $rootimg_dir apt-get $non_interactive "; + + my $aptcachecmd = "chroot $rootimg_dir apt-get update && chroot $rootimg_dir apt-cache $non_interactive "; my $aptcmd1 = "debootstrap"; #my $aptcmd2 = "--arch $uarch $dist $rootimg_dir file://$installroot/$osver/$arch/"; @@ -408,9 +415,20 @@ unless ($onlyinitrd) { # install extra packages my $aptgetcmd_base = $aptgetcmd; + + #env param need to be added before each chroot + my $aptdevby=$aptgetcmd; + + # to prevent "The following packages cannot be authenticated" error, # invoke apt-get with "--allow-unauthenticated" option - $aptgetcmd .= " install --allow-unauthenticated "; + #example:If there is env IBM_PPE_RTE_LICENSE_ACCEPT , it should be in front of chroot + #IBM_PPE_RTE_LICENSE_ACCEPT=yes chroot /install/netboot/ubuntu14.04/ppc64el/compute/rootimg apt-get update&& IBM_PPE_RTE_LICENSE_ACCEPT=yes chroot /install/netboot/ubuntu14.04/ppc64el/compute/rootimg apt-get -y install --allow-unauthenticated pperte-license + $aptdevby .="&& ".$envlist." "; + $aptdevby .=$aptgetcmdby; + $aptdevby .=" install --allow-unauthenticated "; + $aptgetcmd=$aptdevby; + # append extra pkg names to yum command if ($extrapkgnames{$pass}) { $aptgetcmd .= " $extrapkgnames{$pass} "; @@ -447,7 +465,8 @@ unless ($onlyinitrd) { # run apt-get upgrade to update any installed debs # needed when running genimage again after updating software in repositories - my $aptgetcmd_update = $yumcmd_base . " upgrade "; + #my $aptgetcmd_update = $yumcmd_base . " upgrade "; + my $aptgetcmd_update = $aptgetcmd . "&&". $aptgetcmdby . " upgrade "; $rc = system("$aptgetcmd_update"); print("Umount /proc, /dev, /sys, pkgdir and otherpkgdir to the rootimg.\n"); umount_chroot($rootimg_dir); @@ -1752,7 +1771,7 @@ sub mount_chroot { system("mount -o bind $pkgdir $rootimage_dir/mnt/pkgdir"); if ($otherpkgdir){ if(-d $otherpkgdir){ - system("mount -o bind $otherpkgdir $rootimage_dir/mnt/otherpkgdir"); + system("mount --rbind $otherpkgdir $rootimage_dir/mnt/otherpkgdir"); }else{ print "The specified otherpkgdir $otherpkgdir does not exist!\n" } @@ -1765,8 +1784,13 @@ sub umount_chroot { #system("umount $rootimage_dir/proc"); #system("umount $rootimage_dir/sys"); system("umount $rootimage_dir/mnt/pkgdir"); - system("umount $rootimage_dir/mnt/otherpkgdir"); rmdir("$rootimage_dir/mnt/pkgdir"); + #system("umount $rootimage_dir/mnt/otherpkgdir"); + #system("grep /mnt/otherpkgdir /proc/mounts | cut -f2 -d' ' | sort -r|xargs umount"); + my @data = `grep /mnt/otherpkgdir /proc/mounts | cut -f2 -d' ' | sort -r`; + foreach (@data) { + `umount $_`; + } rmdir("$rootimage_dir/mnt/otherpkgdir"); } diff --git a/xCAT-server/xCAT-server.spec b/xCAT-server/xCAT-server.spec index d2245da4d..7320448a2 100644 --- a/xCAT-server/xCAT-server.spec +++ b/xCAT-server/xCAT-server.spec @@ -32,10 +32,11 @@ Obsoletes: atftp-xcat # The aix rpm cmd forces us to do this outside of ifos type stmts %if %notpcm %ifos linux -%ifnarch s390x +# ifarch/ifnarch does not work for noarch package +#%ifnarch s390x # PCM does not use or ship grub2-xcat Requires: grub2-xcat -%endif +#%endif %endif %endif @@ -175,6 +176,8 @@ rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/xen.pm rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/kvm.pm rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/vbox.pm rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/activedirectory.pm +rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/kit.pm +rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/confluent.pm %endif cp lib/xcat/dsh/Context/* $RPM_BUILD_ROOT/%{prefix}/xdsh/Context @@ -325,6 +328,8 @@ chmod 644 $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-server/* mkdir -p $RPM_BUILD_ROOT/%{prefix}/ws mkdir -p $RPM_BUILD_ROOT/etc/apache2/conf.d mkdir -p $RPM_BUILD_ROOT/etc/httpd/conf.d +mkdir -p $RPM_BUILD_ROOT/etc/xcat/conf.orig + cp xCAT-wsapi/* $RPM_BUILD_ROOT/%{prefix}/ws # PCM does not need xcatws.cgi @@ -335,20 +340,24 @@ rm -f $RPM_BUILD_ROOT/%{prefix}/ws/xcatws.cgi %if %fsm %else -echo "ScriptAlias /xcatrhevh %{prefix}/ws/xcatrhevh.cgi" > $RPM_BUILD_ROOT/etc/apache2/conf.d/xcat-ws.conf +echo "ScriptAlias /xcatrhevh %{prefix}/ws/xcatrhevh.cgi" > $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat-ws.conf.apache22 +echo "ScriptAlias /xcatrhevh %{prefix}/ws/xcatrhevh.cgi" > $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat-ws.conf.apache24 %if %notpcm -echo "ScriptAlias /xcatws %{prefix}/ws/xcatws.cgi" >> $RPM_BUILD_ROOT/etc/apache2/conf.d/xcat-ws.conf +echo "ScriptAlias /xcatws %{prefix}/ws/xcatws.cgi" >> $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat-ws.conf.apache22 +echo "ScriptAlias /xcatws %{prefix}/ws/xcatws.cgi" >> $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat-ws.conf.apache24 %endif -cat $RPM_BUILD_ROOT/%{prefix}/ws/xcat-ws.conf.apache2 >> $RPM_BUILD_ROOT/etc/apache2/conf.d/xcat-ws.conf -echo "ScriptAlias /xcatrhevh %{prefix}/ws/xcatrhevh.cgi" > $RPM_BUILD_ROOT/etc/httpd/conf.d/xcat-ws.conf -%if %notpcm -echo "ScriptAlias /xcatws %{prefix}/ws/xcatws.cgi" >> $RPM_BUILD_ROOT/etc/httpd/conf.d/xcat-ws.conf +cat $RPM_BUILD_ROOT/%{prefix}/ws/xcat-ws.conf.apache22 >> $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat-ws.conf.apache22 +cat $RPM_BUILD_ROOT/%{prefix}/ws/xcat-ws.conf.apache24 >> $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat-ws.conf.apache24 +#install lower version(<2.4) apache/httpd conf files by default +cp $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat-ws.conf.apache22 $RPM_BUILD_ROOT/etc/apache2/conf.d/xcat-ws.conf +cp $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat-ws.conf.apache22 $RPM_BUILD_ROOT/etc/httpd/conf.d/xcat-ws.conf %endif -cat $RPM_BUILD_ROOT/%{prefix}/ws/xcat-ws.conf.httpd >> $RPM_BUILD_ROOT/etc/httpd/conf.d/xcat-ws.conf -%endif -rm -f $RPM_BUILD_ROOT/%{prefix}/ws/xcat-ws.conf.apache2 -rm -f $RPM_BUILD_ROOT/%{prefix}/ws/xcat-ws.conf.httpd + + + +rm -f $RPM_BUILD_ROOT/%{prefix}/ws/xcat-ws.conf.apache22 +rm -f $RPM_BUILD_ROOT/%{prefix}/ws/xcat-ws.conf.apache24 %clean rm -rf $RPM_BUILD_ROOT @@ -361,6 +370,8 @@ rm -rf $RPM_BUILD_ROOT %if %fsm %else /etc/init.d/xcatd +#/etc/xcat/conf.orig/xcat-ws.conf.apache24 +#/etc/xcat/conf.orig/xcat-ws.conf.apache22 /etc/apache2/conf.d/xcat-ws.conf /etc/httpd/conf.d/xcat-ws.conf %endif @@ -406,8 +417,8 @@ fi if [ "$1" -gt "1" ]; then #only on upgrade... #migration issue for monitoring XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab filename=monitorctrl.pm notification -d - fi + %else if [ "$1" -gt "1" ]; then #only on upgrade for AIX... #migration issue for monitoring @@ -417,6 +428,26 @@ fi %endif +#Apply the correct httpd/apache configuration file according to the httpd/apache version +if [ -n "$(httpd -v 2>&1 |grep -e '^Server version\s*:.*\/2.4')" ] +then + rm -rf /etc/httpd/conf.d/xcat-ws.conf + cp /etc/xcat/conf.orig/xcat-ws.conf.apache24 /etc/httpd/conf.d/xcat-ws.conf +fi + +if [ -n "$(apachectl -v 2>&1 |grep -e '^Server version\s*:.*\/2.4')" ] +then + rm -rf /etc/apache2/conf.d/xcat-ws.conf + cp /etc/xcat/conf.orig/xcat-ws.conf.apache24 /etc/apache2/conf.d/xcat-ws.conf +fi + +if [ -n "$(apache2ctl -v 2>&1 |grep -e '^Server version\s*:.*\/2.4')" ] +then + rm -rf /etc/apache2/conf.d/xcat-ws.conf + cp /etc/xcat/conf.orig/xcat-ws.conf.apache24 /etc/apache2/conf.d/xcat-ws.conf +fi + + exit 0 %preun @@ -432,8 +463,6 @@ if [ $1 == 0 ]; then #This means only on -e fi rm -f /usr/sbin/xcatd #remove the symbolic - rm -f /etc/httpd/conf.d/xcat-ws.conf - rm -f /etc/httpd/conf.d/xcat-ws.conf fi %endif diff --git a/xCAT-server/xCAT-wsapi/genrestapidoc.pm b/xCAT-server/xCAT-wsapi/genrestapidoc.pm index 54e845362..9dec9ba81 100755 --- a/xCAT-server/xCAT-wsapi/genrestapidoc.pm +++ b/xCAT-server/xCAT-wsapi/genrestapidoc.pm @@ -17,6 +17,7 @@ my @apigroups = ( 'power', 'energy', 'energyattr', 'serviceprocessor', 'nextboot', 'bootstate', 'vitals', 'vitalsattr', 'inventory', 'inventoryattr', 'eventlog', 'beacon', 'updating','filesyncing','software_maintenance','postscript', 'nodeshell', 'nodecopy', + 'vm','vmclone','vmmigrate', ] }, { @@ -209,18 +210,24 @@ sub outwiki { my @example_array = (); if (defined($def->{example})) { push @example_array, $def->{example}; - } else { - foreach (1..10) { - if (defined($def->{'example'.$_})) { - push @example_array, $def->{'example'.$_}; - } + } + foreach (1..10) { + if (defined($def->{'example'.$_})) { + push @example_array, $def->{'example'.$_}; } } if (@example_array) { + my $exampleno = ""; + if ($#example_array > 0) { + $exampleno = 1; + } foreach my $line (@example_array) { my @parts = split ('\|', $line); - print "**Example:**\n"; + print "**Example$exampleno:**\n"; + if ($#example_array > 0) { + $exampleno++; + } if ($parts[1]) { print "$parts[1]\n"; diff --git a/xCAT-server/xCAT-wsapi/xcat-ws.conf.apache2 b/xCAT-server/xCAT-wsapi/xcat-ws.conf.apache22 similarity index 100% rename from xCAT-server/xCAT-wsapi/xcat-ws.conf.apache2 rename to xCAT-server/xCAT-wsapi/xcat-ws.conf.apache22 diff --git a/xCAT-server/xCAT-wsapi/xcat-ws.conf.httpd b/xCAT-server/xCAT-wsapi/xcat-ws.conf.apache24 similarity index 52% rename from xCAT-server/xCAT-wsapi/xcat-ws.conf.httpd rename to xCAT-server/xCAT-wsapi/xcat-ws.conf.apache24 index 921735e12..b10ccf224 100644 --- a/xCAT-server/xCAT-wsapi/xcat-ws.conf.httpd +++ b/xCAT-server/xCAT-wsapi/xcat-ws.conf.apache24 @@ -1,4 +1,10 @@ +LoadModule rewrite_module /usr/lib64/apache2-prefork/mod_rewrite.so RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteCond %{REQUEST_URI} xcatws RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [R,L] + + +Require all granted + + diff --git a/xCAT-server/xCAT-wsapi/xcatws.cgi b/xCAT-server/xCAT-wsapi/xcatws.cgi index 879bf81b6..c3318bf7e 100755 --- a/xCAT-server/xCAT-wsapi/xcatws.cgi +++ b/xCAT-server/xCAT-wsapi/xcatws.cgi @@ -403,23 +403,68 @@ my %URIdef = ( outhdler => \&noout, }, }, - virtualization => { - desc => "[URI:/nodes/{noderange}/virtualization] - The virtualization resource for the node {noderange}", - matcher => '^/nodes/[^/]*/virtualization$', - GET => { + vm => { + desc => "[URI:/nodes/{noderange}/vm] - The virtualization node {noderange}.", + desc1 => "The node should be a virtual machine of type kvm, esxi ...", + matcher => '^/nodes/[^/]*/vm$', + GET_backup => { desc => "Get the vm status for the node {noderange}.", cmd => "lsvm", - fhandler => \&common, + fhandler => \&actionhdl, + outhdler => \&actionout, }, PUT => { - desc => "Change the vm status for the node {noderange}. DataBody: {new:1|clone:1|migrate:1 ...}. new=1 means to run mkvm; clone=1 means to run rclone; migrate=1 means to run rmigrate.", - cmd => "", - fhandler => \&common, + desc => "Change the configuration for the virtual machine {noderange}.", + usage => "|$usagemsg{objchparam} DataBody: \n Set memory size - {\"memorysize\":\"sizeofmemory(MB)\"}\n Add new disk - {\"adddisk\":\"sizeofdisk1(GB),sizeofdisk2(GB)\"}\n Purge disk - {\"purgedisk\":\"scsi_id1,scsi_id2\"}|$usagemsg{non_getreturn}|", + example => "|Set memory to 3000MB.|PUT|/nodes/node1/vm {\"memorysize\":\"3000\"}||", + example1 => "|Add a new 20G disk.|PUT|/nodes/node1/vm {\"adddisk\":\"20G\"}||", + example2 => "|Purge the disk \'hdb\'.|PUT|/nodes/node1/vm {\"purgedisk\":\"hdb\"}||", + cmd => "chvm", + fhandler => \&actionhdl, + outhdler => \&noout, + }, + POST => { + desc => "Create the vm node {noderange}.", + usage => "|$usagemsg{objchparam} DataBody: \n Set CPU count - {\"cpucount\":\"numberofcpu\"}\n Set memory size - {\"memorysize\":\"sizeofmemory(MB)\"}\n Set disk size - {\"disksize\":\"sizeofdisk\"}\n Do it by force - {\"force\":\"yes\"}|$usagemsg{non_getreturn}|", + example => "|Create the vm node1 with a 30G disk, 2048M memory and 2 cpus.|POST|/nodes/node1/vm {\"disksize\":\"30G\",\"memorysize\":\"2048\",\"cpucount\":\"2\"}||", + cmd => "mkvm", + fhandler => \&actionhdl, + outhdler => \&noout, }, DELETE => { desc => "Remove the vm node {noderange}.", + usage => "|$usagemsg{objchparam} DataBody: \n Purge disk - {\"purge\":\"yes\"}\n Do it by force - {\"force\":\"yes\"}|$usagemsg{non_getreturn}|", + example => "|Remove the vm node1 by force and purge the disk.|DELETE|/nodes/node1/vm {\"force\":\"yes\",\"purge\":\"yes\"}||", cmd => "rmvm", - fhandler => \&common, + fhandler => \&actionhdl, + outhdler => \&noout, + }, + }, + vmclone => { + desc => "[URI:/nodes/{noderange}/vmclone] - The clone resource for the virtual node {noderange}.", + desc1 => "The node should be a virtual machine of kvm, esxi ...", + matcher => '^/nodes/[^/]*/vmclone$', + POST => { + desc => "Create a clone master from node {noderange}. Or clone the node {noderange} from a clone master.", + usage => "|$usagemsg{objchparam} DataBody: \n Clone a master named \"mastername\" - {\"tomaster\":\"mastername\"}\n Clone a node from master \"mastername\" - {\"frommaster\":\"mastername\"}\n Use Detach mode - {\"detach\":\"yes\"}\n Do it by force - {\"force\":\"yes\"}|The messages of creating Clone target.|", + example1 => "|Create a clone master named \"vmmaster\" from the node1.|POST|/nodes/node1/vmclone {\"tomaster\":\"vmmaster\",\"detach\":\"yes\"}|{\n \"node1\":{\n \"vmclone\":\"Cloning of node1.hda.qcow2 complete (clone uses 9633.19921875 for a disk size of 30720MB)\"\n }\n}|", + example2 => "|Clone the node1 from the clone master named \"vmmaster\".|POST|/nodes/node1/vmclone {\"frommaster\":\"vmmaster\"}||", + cmd => "clonevm", + fhandler => \&actionhdl, + outhdler => \&actionout, + }, + }, + vmmigrate => { + desc => "[URI:/nodes/{noderange}/vmmigrate] - The virtualization resource for migration.", + desc1 => "The node should be a virtual machine of kvm, esxi ...", + matcher => '^/nodes/[^/]*/vmmigrate$', + POST => { + desc => "Migrate a node to targe node.", + usage => "|$usagemsg{objchparam} DataBody: {\"target\":\"targethost\"}.", + example => "|Migrate node1 to target host host2.|POST|/nodes/node1/vmmigrate {\"target\":\"host2\"}||", + cmd => "rmigrate", + fhandler => \&actionhdl, + outhdler => \&actionout, }, }, updating => { @@ -1812,7 +1857,82 @@ sub actionhdl { if (isGET()) { push @args, '-z'; } - } + } elsif ($params->{'resourcename'} eq "vm") { + # handle the virtual machine + if (isGET()) { + # do nothing for kvm and esxi + }elsif (isPut()) { # change the configuration of vm + if (defined ($paramhash->{'adddisk'})) { #add new disk + push @args, ('-a', $paramhash->{'adddisk'}); + } + #if (defined ($paramhash->{'rmdisk'})) { #remove disk + # push @args, ('-d', $paramhash->{'rmdisk'}); + #} + if (defined ($paramhash->{'purgedisk'})) { #purge disk + push @args, ('-p', $paramhash->{'purgedisk'}); + } + if (defined ($paramhash->{'resizedisk'})) { #change the disk size + $paramhash->{'resizedisk'} =~ s/\:/=/; # replace : to be = in the param + push @args, ('--resize', $paramhash->{'resizedisk'}); + } + if (defined ($paramhash->{'memorysize'})) { #change the memory size + push @args, ('--mem', $paramhash->{'memorysize'}); + } + if (defined ($paramhash->{'cpucount'})) { #change the cpu size + push @args, ('--cpus', $paramhash->{'cpucount'}); + } + } elsif (isPost()) { # create virtual machine + if (defined ($paramhash->{'master'})) { # specify the master node for clone + push @args, ('-m', $paramhash->{'master'}); + } + if (defined ($paramhash->{'disksize'})) { # specify disk size + push @args, ('-s', $paramhash->{'disksize'}); + } + if (defined ($paramhash->{'memorysize'})) { #specify the memory size + push @args, ('--mem', $paramhash->{'memorysize'}); + } + if (defined ($paramhash->{'cpucount'})) { #specify the cpu size + push @args, ('--cpus', $paramhash->{'cpucount'}); + } + if (defined ($paramhash->{'force'}) && $paramhash->{'force'} eq "yes") { # force the recreate + push @args, "-f"; + } + } elsif (isDelete()) { + if (defined ($paramhash->{'force'}) && $paramhash->{'force'} eq "yes") { # force the recreate + push @args, "-f"; + } + if (defined ($paramhash->{'purge'}) && $paramhash->{'purge'} eq "yes") { # purge disk when remove the vm + push @args, "-p"; + } + } + } elsif ($params->{'resourcename'} eq "vmclone") { + # handle the clone of virtual machine + if (isPost()) { + if (defined ($paramhash->{'tomaster'})) { + push @args, ("-t", $paramhash->{'tomaster'}); + } elsif (defined ($paramhash->{'frommaster'})) { + push @args, ("-b", $paramhash->{'frommaster'}); + } else { + error ("Lack of operation data.",$STATUS_BAD_REQUEST,3); + } + + if (defined ($paramhash->{'detach'}) && $paramhash->{'detach'} eq "yes") { + push @args, "-d"; + } + if (defined ($paramhash->{'force'}) && $paramhash->{'force'} eq "yes") { # force the recreate + push @args, "-f"; + } + } + } elsif (($params->{'resourcename'} eq "vmmigrate")) { + # handle the migration of virtual machine + if (isPost()) { + if (defined ($paramhash->{'target'})) { + push @args, $paramhash->{'target'}; + } else { + error ("Lack of operation data.",$STATUS_BAD_REQUEST,3); + } + } + } push @{$request->{arg}}, @args; my $req = genRequest(); @@ -2638,11 +2758,18 @@ sub fetchParameters { } } } + } elsif (isPost()) { + $pdata = $q->param('POSTDATA'); + } elsif (isDelete()) { + if ($ENV{'CONTENT_TYPE'} =~ /json/) { + $q->read_from_client(\$pdata, $ENV{'CONTENT_LENGTH'}); + } } - elsif (isPost()) { $pdata = $q->param('POSTDATA'); } + if ($dbgdata) { $pdata = $dbgdata; } + my $genparms = {}; my $phash; if ($pdata) { diff --git a/xCAT-test/autotest/kitdata/buildkit.conf b/xCAT-test/autotest/kitdata/buildkit.conf new file mode 100644 index 000000000..a525cea10 --- /dev/null +++ b/xCAT-test/autotest/kitdata/buildkit.conf @@ -0,0 +1,59 @@ +# Kit Build File +# sample file used for Kit automation test, modify it according to your test OS +# +kit: + basename=ubuntukit + description=Test kit for ubuntukit + version=1.0 + release=1 + ostype=Linux + osarch=ppc64el + vendor=IBM Corp. + kitdeployparams=ubu.env + kitlicense=EPL + +kitrepo: + kitrepoid=ubuntu14.04 + osbasename=ubuntu + osmajorversion=14 + osminorversion=04 + osarch=ppc64el + +kitcomponent: + basename=ubuntukit-compute-1 + description=description for component ubuntukit-compute-1 + serverroles=compute + kitrepoid=ubuntu14.04 + kitpkgdeps=pkg1 + +kitcomponent: + basename=ubuntukit-compute-2 + description=description for component ubuntukit-compute-2 + serverroles=compute + kitrepoid=ubuntu14.04 + kitcompdeps=ubuntukit-compute-1 + kitpkgdeps=pkg2,pkg3 + ospkgdeps=xinetd + postinstall=test_postinstall + postupgrade=test_postinstall + postbootscripts=test_postboot + + +kitpackage: + filename=pkg1_*_all.deb + kitrepoid=ubuntu14.04 + isexternalpkg=no + rpm_prebuiltdir=/kittest + +kitpackage: + filename=pkg2_*_all.deb + kitrepoid=ubuntu14.04 + isexternalpkg=no + rpm_prebuiltdir=/kittest + +kitpackage: + filename=pkg3_*_all.deb + kitrepoid=ubuntu14.04 + isexternalpkg=no + rpm_prebuiltdir=/kittest + diff --git a/xCAT-test/autotest/kitdata/docs/index.html b/xCAT-test/autotest/kitdata/docs/index.html new file mode 100644 index 000000000..b00ea63c6 --- /dev/null +++ b/xCAT-test/autotest/kitdata/docs/index.html @@ -0,0 +1,10 @@ + + +Product Documentation + + + +Redirecting to: +http://sourceforge.net/apps/mediawiki/xcat/index.php?title=XCAT_Documentation + + diff --git a/xCAT-test/autotest/kitdata/other_files/ubu.env b/xCAT-test/autotest/kitdata/other_files/ubu.env new file mode 100644 index 000000000..5ff8bc7ba --- /dev/null +++ b/xCAT-test/autotest/kitdata/other_files/ubu.env @@ -0,0 +1 @@ +#ENV:TEST_LICENSE_ACCEPT=yes# diff --git a/xCAT-test/autotest/kitdata/scripts/test_postboot b/xCAT-test/autotest/kitdata/scripts/test_postboot new file mode 100755 index 000000000..788be4248 --- /dev/null +++ b/xCAT-test/autotest/kitdata/scripts/test_postboot @@ -0,0 +1,3 @@ +#!/bin/sh +echo "running test_postboot script" + diff --git a/xCAT-test/autotest/kitdata/scripts/test_postinstall b/xCAT-test/autotest/kitdata/scripts/test_postinstall new file mode 100755 index 000000000..8bb4e3163 --- /dev/null +++ b/xCAT-test/autotest/kitdata/scripts/test_postinstall @@ -0,0 +1,3 @@ +#!/bin/sh +echo "running test_postinstall script" + diff --git a/xCAT-test/autotest/kitdata/source_packages/kittest/pkg1_1-2_all.deb b/xCAT-test/autotest/kitdata/source_packages/kittest/pkg1_1-2_all.deb new file mode 100644 index 000000000..4a445c94a Binary files /dev/null and b/xCAT-test/autotest/kitdata/source_packages/kittest/pkg1_1-2_all.deb differ diff --git a/xCAT-test/autotest/kitdata/source_packages/kittest/pkg2_1-2_all.deb b/xCAT-test/autotest/kitdata/source_packages/kittest/pkg2_1-2_all.deb new file mode 100644 index 000000000..4a445c94a Binary files /dev/null and b/xCAT-test/autotest/kitdata/source_packages/kittest/pkg2_1-2_all.deb differ diff --git a/xCAT-test/autotest/kitdata/source_packages/kittest/pkg3_1-2_all.deb b/xCAT-test/autotest/kitdata/source_packages/kittest/pkg3_1-2_all.deb new file mode 100644 index 000000000..4a445c94a Binary files /dev/null and b/xCAT-test/autotest/kitdata/source_packages/kittest/pkg3_1-2_all.deb differ diff --git a/xCAT-test/autotest/linux.conf.template b/xCAT-test/autotest/linux.conf.template index 6741543a5..dccc7ad36 100644 --- a/xCAT-test/autotest/linux.conf.template +++ b/xCAT-test/autotest/linux.conf.template @@ -66,6 +66,7 @@ ISO=/iso/RHEL5.4-Server-20090819.0-ppc-DVD.iso NETDRIVER=ibmveth #network infterface card driver used by diskless installation NETBOOTDIR=/opt/xcat/share/xcat/netboot/rh #path of netboot directory, used by diskless installation MaxLparID=32 +KITDATA=kitdata [Custom] #commands run before test diff --git a/xCAT-test/autotest/testcase/addkit/cases0 b/xCAT-test/autotest/testcase/addkit/cases0 index 22cfb4998..0ee49701a 100644 --- a/xCAT-test/autotest/testcase/addkit/cases0 +++ b/xCAT-test/autotest/testcase/addkit/cases0 @@ -56,66 +56,66 @@ end start:addkit_multikit os:Linux cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/addkit/prodkit -cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/addkit/testkit +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/addkit/prod2kit cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkit;buildkit create prodkit check:rc==0 cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkit/prodkit;buildkit buildrepo all check:rc==0 cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkit/prodkit;buildkit buildtar check:rc==0 -cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkit;buildkit create testkit +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkit;buildkit create prod2kit check:rc==0 -cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkit/testkit;buildkit buildrepo all +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkit/prod2kit;buildkit buildrepo all check:rc==0 -cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkit/testkit;buildkit buildtar +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkit/prod2kit;buildkit buildtar check:rc==0 -cmd:addkit /opt/xcat/share/xcat/tools/autotest/testcase/addkit/prodkit/prodkit-1.0-1.tar.bz2,/opt/xcat/share/xcat/tools/autotest/testcase/addkit/testkit/testkit-1.0-1.tar.bz2 +cmd:addkit /opt/xcat/share/xcat/tools/autotest/testcase/addkit/prodkit/prodkit-1.0-1.tar.bz2,/opt/xcat/share/xcat/tools/autotest/testcase/addkit/prod2kit/prod2kit-1.0-1.tar.bz2 check:rc==0 check:output=~Adding Kit prodkit-1.0-1 -check:output=~Adding Kit testkit-1.0-1 -check:output=~Kit prodkit-1.0-1,testkit-1.0-1 was successfully added +check:output=~Adding Kit prod2kit-1.0-1 +check:output=~Kit prodkit-1.0-1,prod2kit-1.0-1 was successfully added cmd:tabdump kit|grep prodkit-1.0-1 check:rc==0 -cmd:tabdump kit|grep testkit-1.0-1 +cmd:tabdump kit|grep prod2kit-1.0-1 check:rc==0 cmd:rmkit prodkit-1.0-1 -cmd:rmkit testkit-1.0-1 +cmd:rmkit prod2kit-1.0-1 cmd:rm -f /opt/xcat/share/xcat/tools/autotest/testcase/addkit/prodkit/prodkit-1.0-1.tar.bz2 -cmd:rm -f /opt/xcat/share/xcat/tools/autotest/testcase/addkit/testkit/testkit-1.0-1.tar.bz2 +cmd:rm -f /opt/xcat/share/xcat/tools/autotest/testcase/addkit/prod2kit/prod2kit-1.0-1.tar.bz2 cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/addkit/prodkit -cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/addkit/testkit +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/addkit/prod2kit end start:addkit_p os:Linux cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/addkit/prodkit -cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/addkit/testkit +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/addkit/prod2kit cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkit;buildkit create prodkit check:rc==0 cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkit/prodkit;buildkit buildrepo all check:rc==0 cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkit/prodkit;buildkit buildtar check:rc==0 -cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkit;buildkit create testkit +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkit;buildkit create prod2kit check:rc==0 -cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkit/testkit;buildkit buildrepo all +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkit/prod2kit;buildkit buildrepo all check:rc==0 -cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkit/testkit;buildkit buildtar +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkit/prod2kit;buildkit buildtar check:rc==0 cmd:mkdir -p /install/test -cmd:addkit -p /install/test /opt/xcat/share/xcat/tools/autotest/testcase/addkit/prodkit/prodkit-1.0-1.tar.bz2,/opt/xcat/share/xcat/tools/autotest/testcase/addkit/testkit/testkit-1.0-1.tar.bz2 +cmd:addkit -p /install/test /opt/xcat/share/xcat/tools/autotest/testcase/addkit/prodkit/prodkit-1.0-1.tar.bz2,/opt/xcat/share/xcat/tools/autotest/testcase/addkit/prod2kit/prod2kit-1.0-1.tar.bz2 check:rc==0 check:output=~Adding Kit prodkit-1.0-1 -check:output=~Adding Kit testkit-1.0-1 -check:output=~Kit prodkit-1.0-1,testkit-1.0-1 was successfully added +check:output=~Adding Kit prod2kit-1.0-1 +check:output=~Kit prodkit-1.0-1,prod2kit-1.0-1 was successfully added cmd:tabdump kit|grep prodkit-1.0-1 check:rc==0 -cmd:tabdump kit|grep testkit-1.0-1 +cmd:tabdump kit|grep prod2kit-1.0-1 cmd:rmkit prodkit-1.0-1 -cmd:rmkit testkit-1.0-1 +cmd:rmkit prod2kit-1.0-1 cmd:rm -f /opt/xcat/share/xcat/tools/autotest/testcase/addkit/prodkit/prodkit-1.0-1.tar.bz2 -cmd:rm -f /opt/xcat/share/xcat/tools/autotest/testcase/addkit/testkit/testkit-1.0-1.tar.bz2 -cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/addkit/testkit +cmd:rm -f /opt/xcat/share/xcat/tools/autotest/testcase/addkit/prod2kit/prod2kit-1.0-1.tar.bz2 +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/addkit/prod2kit cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/addkit/prodkit end diff --git a/xCAT-test/autotest/testcase/addkitcomp/case0 b/xCAT-test/autotest/testcase/addkitcomp/case0 new file mode 100644 index 000000000..f0ef59d58 --- /dev/null +++ b/xCAT-test/autotest/testcase/addkitcomp/case0 @@ -0,0 +1,163 @@ +start:addkitcomp_v +os:Linux +cmd:addkitcomp -v +check:rc==0 +check:output=~addkitcomp +check:output=~kitframework +check:output=~compatible_frameworks +cmd:addkitcomp --version +check:rc==0 +check:output=~addkitcomp +check:output=~kitframework +check:output=~compatible_frameworks +end + +start:addkitcomp_h +os:Linux +cmd:addkitcomp -h +check:rc==0 +check:output =~ Usage +cmd:addkitcomp --help +check:rc==0 +check:output=~ Usage +end + +start:addkitcomp_i +os:Linux +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/mykits +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp;buildkit create mykits +check:rc==0 +check:output=~Kit template for mykits created in /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/mykits directory +cmd:rmkit mykits-1.0-1 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/mykits;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/mykits;buildkit buildtar +check:rc==0 +cmd:addkit /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/mykits/mykits-1.0-1.tar.bz2 +check:rc==0 +check:output=~Kit mykits-1.0-1 was successfully added +cmd:mkdef testimage -u profile=compute provmethod=install osarch=ppc64el +check:rc==0 +cmd:kitcompname=`lskit mykits-1.0-1 |grep kitcompname|awk -F= '{print $2}'`;addkitcomp -i testimage $kitcompname +check:rc==0 +check:output=~Assigning kit component +cmd:kitcompname=`lskit mykits-1.0-1 |grep kitcompname|awk -F= '{print $2}'`;rmkitcomp -i testimage $kitcompname +check:rc==0 +check:output=~Removing kitcomponent +check:output=~were removed from osimage testimage successfully +cmd:rmkit mykits-1.0-1 +check:rc==0 +cmd:rm -f /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/mykits/mykits-1.0-1.tar.bz2 +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/mykits +cmd:rmdef -t osimage -o testimage +check:rc==0 +end + +start:addkitcomp_f +os:Linux +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/mykits +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp;buildkit create mykits +check:rc==0 +check:output=~Kit template for mykits created in /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/mykits directory +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/mykits;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/mykits;buildkit buildtar +check:rc==0 +cmd:addkit /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/mykits/mykits-1.0-1.tar.bz2 +check:rc==0 +check:output=~Kit mykits-1.0-1 was successfully added +cmd:mkdef testimage -u profile=compute provmethod=install osarch=ppc64el +check:rc==0 +cmd:kitcompname=`lskit mykits-1.0-1 |grep kitcompname|awk -F= '{print $2}'`;addkitcomp -f -i testimage $kitcompname +check:rc==0 +check:output=~Assigning kit component +cmd:kitcompname=`lskit mykits-1.0-1 |grep kitcompname|awk -F= '{print $2}'`;rmkitcomp -i testimage $kitcompname +check:rc==0 +check:output=~Removing kitcomponent +check:output=~were removed from osimage testimage successfully +cmd:rmkit mykits-1.0-1 +check:rc==0 +cmd:rm -f /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/mykits/mykits-1.0-1.tar.bz2 +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/mykits +cmd:rmdef -t osimage -o testimage +check:rc==0 +end + +start:addkitcomp_a +os:Linux +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/$$KITDATA +cmd:mkdir -p /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/$$KITDATA +cmd:cp -rf /opt/xcat/share/xcat/tools/autotest/$$KITDATA /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/$$KITDATA;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/$$KITDATA;buildkit buildtar +check:rc==0 +cmd:addkit /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/$$KITDATA/*.tar.bz2 +check:rc==0 +check:output=~successfully added +cmd:mkdef testimage -u profile=compute provmethod=install osarch=ppc64el +check:rc==0 +cmd:addkitcomp -i testimage -a ubuntukit-compute-2 +check:rc==0 +check:output=~Assigning kit component ubuntukit-compute-2 +cmd:lsdef -t osimage -o testimage |grep -i kitcomponents +check:rc==0 +check:output=~ubuntukit-compute-1 +check:output=~ubuntukit-compute-2 +cmd:lsdef -t osimage -o testimage +check:rc==0 +check:output=~KIT_DEPLOY_PARAMS +check:output=~KIT_COMPONENTS +cmd:rmkitcomp -i testimage ubuntukit-compute-1-1.0-1-ubuntu-14.04-ppc64el +check:rc==1 +check:output=~Error: Failed to remove kitcomponent +cmd:rmkitcomp -i testimage -f ubuntukit-compute-1-1.0-1-ubuntu-14.04-ppc64el +check:rc==0 +check:output=~Removing kitcomponent ubuntukit-compute-1-1.0-1-ubuntu-14.04-ppc64el from osimage testimage +cmd:rmkitcomp -i testimage -f ubuntukit-compute-2-1.0-1-ubuntu-14.04-ppc64el +check:rc==0 +check:output=~Removing kitcomponent ubuntukit-compute-2-1.0-1-ubuntu-14.04-ppc64el from osimage testimage +cmd:rmkit ubuntukit-1.0-1-ppc64el +check:rc==0 +cmd:rm -f /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/$$KITDATA/ubuntukit-1.0-1-ppc64el.tar.bz2 +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/$$KITDATA +cmd:rmdef -t osimage -o testimage +check:rc==0 +end + +start:addkitcomp_noscripts +os:Linux +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/$$KITDATA +cmd:mkdir -p /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/$$KITDATA +cmd:cp -rf /opt/xcat/share/xcat/tools/autotest/$$KITDATA /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/$$KITDATA;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/$$KITDATA;buildkit buildtar +check:rc==0 +cmd:addkit /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/$$KITDATA/*.tar.bz2 +check:rc==0 +check:output=~successfully added +cmd:mkdef testimage -u profile=compute provmethod=install osarch=ppc64el +check:rc==0 +cmd:addkitcomp -i testimage -a ubuntukit-compute-2 --noscripts +check:rc==0 +check:output=~Assigning kit component ubuntukit-compute-2 +cmd:lsdef -t osimage -o testimage +check:rc==0 +check:output!=~postbootscripts +cmd:rmkitcomp -i testimage -f ubuntukit-compute-1-1.0-1-ubuntu-14.04-ppc64el +check:rc==0 +check:output=~Removing kitcomponent ubuntukit-compute-1-1.0-1-ubuntu-14.04-ppc64el from osimage testimage +cmd:rmkitcomp -i testimage -f ubuntukit-compute-2-1.0-1-ubuntu-14.04-ppc64el +check:rc==0 +check:output=~Removing kitcomponent ubuntukit-compute-2-1.0-1-ubuntu-14.04-ppc64el from osimage testimage +cmd:rmkit ubuntukit-1.0-1-ppc64el +check:rc==0 +cmd:rm -f /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/$$KITDATA/ubuntukit-1.0-1-ppc64el.tar.bz2 +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/addkitcomp/$$KITDATA +cmd:rmdef -t osimage -o testimage +check:rc==0 +end + + + diff --git a/xCAT-test/autotest/testcase/buildkit/cases0 b/xCAT-test/autotest/testcase/buildkit/cases0 index cb2bd02e3..1dff639b4 100644 --- a/xCAT-test/autotest/testcase/buildkit/cases0 +++ b/xCAT-test/autotest/testcase/buildkit/cases0 @@ -63,7 +63,7 @@ cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/mykits end start:buildkit_buildrepo_all -os:Linux +os:rhels cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit;buildkit create prodkit check:rc==0 @@ -75,7 +75,41 @@ check:output=~prodkit-1.0-1 cmd:ls /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/build/kit_repodir/prodkit-1.0-1-* check:output=~repodata check:output=~pkg1-1-1.noarch.rpm -check:output=~prodkit_compute-1.0-1.noarch.rpm +check:output=~prodkit-compute_1.0-1.noarch.rpm +cmd:cd -;rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit +end + +start:buildkit_buildrepo_all +os:sles +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit;buildkit create prodkit +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit buildrepo all +check:rc==0 +check:output!~error +cmd:ls /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/build/kit_repodir +check:output=~prodkit-1.0-1 +cmd:ls /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/build/kit_repodir/prodkit-1.0-1-* +check:output=~repodata +check:output=~pkg1-1-1.noarch.rpm +check:output=~prodkit-compute_1.0-1.noarch.rpm +cmd:cd -;rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit +end + +start:buildkit_buildrepo_all +os:ubuntu +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit;buildkit create prodkit +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit buildrepo all +check:rc==0 +check:output!~error +cmd:ls /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/build/kit_repodir +check:output=~prodkit-1.0-1 +cmd:ls /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/build/kit_repodir/prodkit-1.0-1-* +check:output=~Packages +check:output=~pkg1_1-2_all.deb +check:output=~prodkit-compute_1.0-1_all.deb cmd:cd -;rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit end @@ -92,7 +126,7 @@ check:output=~prodkit-1.0-1 cmd:ls /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/build/kit_repodir/prodkit-1.0-1-* check:output=~repodata check:output=~pkg1-1-1.noarch.rpm -check:output=~prodkit_compute-1.0-1.noarch.rpm +check:output=~prodkit-compute-1.0-1.noarch.rpm cmd:cd -;rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit end @@ -109,7 +143,24 @@ check:output=~prodkit-1.0-1 cmd:ls /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/build/kit_repodir/prodkit-1.0-1-* check:output=~repodata check:output=~pkg1-1-1.noarch.rpm -check:output=~prodkit_compute-1.0-1.noarch.rpm +check:output=~prodkit-compute-1.0-1.noarch.rpm +cmd:cd -;rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit +end + +start:buildkit_buildrepo_ubuntu +os:ubuntu +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit;buildkit create prodkit +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;reponame=`cat buildkit.conf|grep kitrepoid|sed 's/ //g' |grep ^kitrepoid=|head -1|awk -F= '{print $2}'`;buildkit buildrepo $reponame +check:rc==0 +check:output!~error +cmd:ls /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/build/kit_repodir +check:output=~prodkit-1.0-1 +cmd:ls /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/build/kit_repodir/prodkit-1.0-1-* +check:output=~Packages +check:output=~pkg1_1-2_all.deb +check:output=~prodkit-compute_1.0-1_all.deb cmd:cd -;rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit end @@ -138,7 +189,7 @@ cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit bu check:rc==0 cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;reponame=`cat buildkit.conf|grep kitrepoid|sed 's/ //g' |grep ^kitrepoid=|head -1|awk -F= '{print $2}'`;buildkit cleanrepo $reponame check:rc==0 -check:output=~Kit repository rhels[0-9].[0-9] has been removed +check:output=~been removed check:output!~error cmd:ls /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/build/kit_repodir|grep rhels check:output!~rhels @@ -161,6 +212,21 @@ check:output!~sles cmd:cd -;rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit end +start:buildkit_cleanrepo_ubuntu +os:ubuntu +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit;buildkit create prodkit +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;reponame=`cat buildkit.conf|grep kitrepoid|sed 's/ //g' |grep ^kitrepoid=|head -1|awk -F= '{print $2}'`;buildkit cleanrepo $reponame +check:rc==0 +check:output=~been removed +check:output!~error +cmd:ls /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/build/kit_repodir|grep ubuntu +check:output!~ubuntu +cmd:cd -;rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit +end start:buildkit_listrepo os:rhels @@ -191,6 +257,19 @@ check:output!~error cmd:cd -;rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit end +start:buildkit_listrepo +os:ubuntu +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit;buildkit create prodkit +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit listrepo +check:rc==0 +check:output=~ DONE +check:output!~error +cmd:cd -;rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit +end start:buildkit_buildtar os:Linux @@ -212,12 +291,16 @@ end start:buildkit_cleantar -os:Linux +os:rhels cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit;buildkit create prodkit check:rc==0 cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit buildrepo all check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit buildtar +check:rc==0 +check:output=~prodkit-1.0-1.tar.bz2 successfully built +check:output!~error cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit cleantar check:rc==0 check:output=~Kit tar files have been successfully removed from /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit @@ -228,27 +311,50 @@ check:output!~prodkit-1.0-1.tar.bz2 cmd:cd -;rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit end -start:buildkit_chkconfig -os:Linux +start:buildkit_cleantar +os:sles cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit;buildkit create prodkit check:rc==0 -cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit chkconfig +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit buildrepo all check:rc==0 -check:output=~No errors were found in Kit Build File /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/buildkit.conf -cmd:mv /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/other_files/sample/exclude.lst /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/other_files/sample/exclude.lst.new -cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit chkconfig -check:rc!=0 -check:output=~Exclude List file /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/other_files/sample/exclude.lst defined in Kit Componenet "prodkit_compute" does not exist or is not readable -cmd:mv /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/other_files/sample/exclude.lst.new /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/other_files/sample/exclude.lst -cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit chkconfig +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit buildtar check:rc==0 -check:output=~~No errors were found in Kit Build File /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/buildkit.conf +check:output=~prodkit-1.0-1.tar.bz2 successfully built +check:output!~error +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit cleantar +check:rc==0 +check:output=~Kit tar files have been successfully removed from /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit +check:output=~Removed /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/rpmbuild +check:output!~error +cmd: ls |grep prodkit-1.0-1.tar.bz2 +check:output!~prodkit-1.0-1.tar.bz2 +cmd:cd -;rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit +end + +start:buildkit_cleantar +os:ubuntu +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit;buildkit create prodkit +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit buildtar +check:rc==0 +check:output=~prodkit-1.0-1.tar.bz2 successfully built +check:output!~error +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit cleantar +check:rc==0 +check:output=~Kit tar files have been successfully removed from /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit +check:output=~Removed /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/build +check:output!~error +cmd: ls |grep prodkit-1.0-1.tar.bz2 +check:output!~prodkit-1.0-1.tar.bz2 cmd:cd -;rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit end start:buildkit_partialkit -os:Linux +os:rhels cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit;buildkit create prodkit check:rc==0 @@ -270,9 +376,54 @@ check:output!~pkg1-1-1.noarch.rpm cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit end +start:buildkit_partialkit +os:sles +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit;buildkit create prodkit +check:rc==0 +cmd:cat /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/buildkit.conf|sed 's/isexternalpkg=no/isexternalpkg=yes/g' > /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/buildkit.conf.new +cmd:cat /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/buildkit.conf.new |sed '/rpm_prebuiltdir/d' > /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/buildkit.conf.tmp +check:rc==0 +cmd:mv /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/buildkit.conf.tmp /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/buildkit.conf +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit buildtar +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;tar -tf prodkit-1.0-1.NEED_PRODUCT_PKGS.tar.bz2 +check:rc==0 +check:output=~prodkit-1.0-1/build_input/buildkit.conf +check:output=~prodkit-1.0-1/kit.conf +check:output=~prodkit-1.0-1/repos/ +check:output=~prodkit_compute-1.0-1.noarch.rpm +check:output!~pkg1-1-1.noarch.rpm +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit +end + +start:buildkit_partialkit_ubuntu +os:ubuntu +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit;buildkit create prodkit +check:rc==0 +cmd:cat /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/buildkit.conf|sed 's/isexternalpkg=no/isexternalpkg=yes/g' > /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/buildkit.conf.new +cmd:cat /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/buildkit.conf.new |sed '/rpm_prebuiltdir/d' > /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/buildkit.conf.tmp +check:rc==0 +cmd:mv /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/buildkit.conf.tmp /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/buildkit.conf +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit buildtar +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;tar -tf prodkit-1.0-1.NEED_PRODUCT_PKGS.tar.bz2 +check:rc==0 +check:output=~prodkit-1.0-1/build_input/buildkit.conf +check:output=~prodkit-1.0-1/kit.conf +check:output=~prodkit-1.0-1/repos/ +check:output=~prodkit-compute_1.0-1_all.deb +check:output!~pkg1_1-2_all.deb +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit +end start:buildkit_partialkit_completekit -os:Linux +os:rhels cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit;buildkit create prodkit check:rc==0 @@ -302,3 +453,65 @@ check:output=~pkg1-1-1.noarch.rpm cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit end +start:buildkit_partialkit_completekit +os:sles +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit;buildkit create prodkit +check:rc==0 +cmd:cat /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/buildkit.conf|sed 's/isexternalpkg=no/isexternalpkg=yes/g' > /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/buildkit.conf.new +cmd:cat /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/buildkit.conf.new |sed '/rpm_prebuiltdir/d' > /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/buildkit.conf.tmp +check:rc==0 +cmd:mv /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/buildkit.conf.tmp /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/buildkit.conf +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit buildtar +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;tar -tf prodkit-1.0-1.NEED_PRODUCT_PKGS.tar.bz2 +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit addpkgs prodkit-1.0-1.NEED_PRODUCT_PKGS.tar.bz2 -p source_packages/sample/pkg1 +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;tar -tf prodkit-1.0-1.tar.bz2 +check:rc==0 +check:output=~prodkit_compute-1.0-1.noarch.rpm +check:output=~pkg1-1-1.noarch.rpm +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;rm -f prodkit-1.0-1.tar.bz2 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit addpkgs prodkit-1.0-1.NEED_PRODUCT_PKGS.tar.bz2 -p source_packages/sample/pkg1 -k 2.0 -r s002a +check:rc==0 +check:output=~/opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/prodkit-2.0-s002a.tar.bz2 successfully built +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;tar -tf prodkit-2.0-s002a.tar.bz2 +check:output=~prodkit_compute-2.0-s002a.noarch.rpm +check:output=~pkg1-1-1.noarch.rpm +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit +end + +start:buildkit_partialkit_completekit +os:ubuntu +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit;buildkit create prodkit +check:rc==0 +cmd:cat /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/buildkit.conf|sed 's/isexternalpkg=no/isexternalpkg=yes/g' > /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/buildkit.conf.new +cmd:cat /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/buildkit.conf.new |sed '/rpm_prebuiltdir/d' > /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/buildkit.conf.tmp +check:rc==0 +cmd:mv /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/buildkit.conf.tmp /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/buildkit.conf +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit buildtar +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;tar -tf prodkit-1.0-1.NEED_PRODUCT_PKGS.tar.bz2 +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit addpkgs prodkit-1.0-1.NEED_PRODUCT_PKGS.tar.bz2 -p source_packages/sample/pkg1 +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;tar -tf prodkit-1.0-1.tar.bz2 +check:rc==0 +check:output=~prodkit-compute_1.0-1_all.deb +check:output=~pkg1_1-2_all.deb +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;rm -f prodkit-1.0-1.tar.bz2 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit addpkgs prodkit-1.0-1.NEED_PRODUCT_PKGS.tar.bz2 -p source_packages/sample/pkg1 -k 2.0 -r s002a +check:rc==0 +check:output=~/opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/prodkit-2.0-s002a.tar.bz2 successfully built +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;tar -tf prodkit-2.0-s002a.tar.bz2 +check:output=~prodkit-compute_2.0-s002a_all.deb +check:output=~pkg1_1-2_all.deb +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit +end + diff --git a/xCAT-test/autotest/testcase/chkkitcomp/cases0 b/xCAT-test/autotest/testcase/chkkitcomp/cases0 new file mode 100644 index 000000000..3b31e80e9 --- /dev/null +++ b/xCAT-test/autotest/testcase/chkkitcomp/cases0 @@ -0,0 +1,50 @@ +start:chkkitcomp_v +cmd:chkkitcomp -v +check:rc==0 +check:output~=Version +check:output~=kitframework +check:output~=compatible_frameworks +end + +start:chkkitcomp_h +cmd:addkit -h +check:rc==0 +check:output~=Usage +check:outpur!~error +end + +start:chkkitcomp_V +os:Linux +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/chkkitcomp/mykits +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/chkkitcomp;buildkit create mykits +check:rc==0 +check:output=~Kit template for mykits created in /opt/xcat/share/xcat/tools/autotest/testcase/chkkitcomp/mykits directory +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/chkkitcomp/mykits;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/chkkitcomp/mykits;buildkit buildtar +check:rc==0 +cmd:addkit /opt/xcat/share/xcat/tools/autotest/testcase/chkkitcomp/mykits/mykits-1.0-1.tar.bz2 +check:rc==0 +check:output=~Kit mykits-1.0-1 was successfully added +cmd:mkdef testimage -u profile=compute provmethod=install osarch=ppc64el +check:rc==0 +cmd:kitcompname=`lskit mykits-1.0-1 |grep kitcompname|awk -F= '{print $2}'`;addkitcomp -i testimage $kitcompname +check:rc==0 +check:output=~Assigning kit component +cmd:kitcompname=`lskit mykits-1.0-1 |grep kitcompname|awk -F= '{print $2}'`;chkkitcomp -i testimage $kitcompname +check:rc==0 +check:output=~compatible with osimage testimage +cmd:kitcompname=`lskit mykits-1.0-1 |grep kitcompname|awk -F= '{print $2}'`;chkkitcomp -i testimage $kitcompname -V +check:rc==0 +check:output=~compatible with osimage testimage +cmd:kitcompname=`lskit mykits-1.0-1 |grep kitcompname|awk -F= '{print $2}'`;rmkitcomp -i testimage $kitcompname +check:rc==0 +cmd:rmkit mykits-1.0-1 +check:rc==0 +cmd:rm -f /opt/xcat/share/xcat/tools/autotest/testcase/chkkitcomp/mykits/mykits-1.0-1.tar.bz2 +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/chkkitcomp/mykits +cmd:rmdef -t osimage -o testimage +check:rc==0 +end + + diff --git a/xCAT-test/autotest/testcase/lskit/case0 b/xCAT-test/autotest/testcase/lskit/case0 new file mode 100644 index 000000000..2a3a2c87d --- /dev/null +++ b/xCAT-test/autotest/testcase/lskit/case0 @@ -0,0 +1,115 @@ +start:lskit_v +os:Linux +cmd:lskit -v +check:rc==0 +check:output=~lskit +check:output=~kitframework +check:output=~compatible_frameworks +cmd:lskit --version +check:rc==0 +check:output=~lskit +check:output=~kitframework +check:output=~compatible_frameworks +end + +start:lskit_h +os:Linux +cmd:lskit -h +check:rc==0 +check:output =~ Usage +cmd:lskit --help +check:rc==0 +check:output=~ Usage +end + +start:lskit_F +os:Linux +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskit;buildkit create mykits +check:rc==0 +check:output=~Kit template for mykits created in /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits directory +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits;buildkit buildtar +check:rc==0 +cmd:lskit -F /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits/mykits-1.0-1.tar.bz2 +check:rc==0 +check:output=~Extracting the kit.conf file from /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits/mykits-1.0-1.tar.bz2 +check:output=~kitframework +check:output=~compatible_kitframeworks +cmd:rm -f /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits/mykits-1.0-1.tar.bz2 +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits +end + +start:lskit_K +os:Linux +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskit;buildkit create mykits +check:rc==0 +check:output=~Kit template for mykits created in /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits directory +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits;buildkit buildtar +check:rc==0 +cmd:addkit /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits/mykits-1.0-1.tar.bz2 +check:rc==0 +check:output=~Kit mykits-1.0-1 was successfully added +cmd:lskit -K basename mykits-1.0-1 +check:rc==0 +check:output=~basename +cmd:rmkit mykits-1.0-1 +check:rc==0 +check:output=~Kit mykits-1.0-1 was successfully removed +cmd:rm -f /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits/mykits-1.0-1.tar.bz2 +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits +end + +start:lskit_R +os:Linux +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskit;buildkit create mykits +check:rc==0 +check:output=~Kit template for mykits created in /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits directory +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits;buildkit buildtar +check:rc==0 +cmd:addkit /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits/mykits-1.0-1.tar.bz2 +check:rc==0 +check:output=~Kit mykits-1.0-1 was successfully added +cmd:lskit -R kitrepodir mykits-1.0-1 +check:rc==0 +check:output=~kitrepodir +cmd:lskit -R kitreponame mykits-1.0-1 +check:rc==0 +check:output=~kitreponame +cmd:rmkit mykits-1.0-1 +check:rc==0 +check:output=~Kit mykits-1.0-1 was successfully removed +cmd:rm -f /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits/mykits-1.0-1.tar.bz2 +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits +end + +start:lskit_C +os:Linux +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskit;buildkit create mykits +check:rc==0 +check:output=~Kit template for mykits created in /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits directory +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits;buildkit buildtar +check:rc==0 +cmd:addkit /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits/mykits-1.0-1.tar.bz2 +check:rc==0 +check:output=~Kit mykits-1.0-1 was successfully added +cmd:lskit -C kitcompname mykits-1.0-1 +check:rc==0 +check:output=~kitcompname +cmd:rmkit mykits-1.0-1 +check:rc==0 +check:output=~Kit mykits-1.0-1 was successfully removed +cmd:rm -f /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits/mykits-1.0-1.tar.bz2 +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits +end + diff --git a/xCAT-test/autotest/testcase/lskitcomp/case0 b/xCAT-test/autotest/testcase/lskitcomp/case0 new file mode 100644 index 000000000..ae02e7753 --- /dev/null +++ b/xCAT-test/autotest/testcase/lskitcomp/case0 @@ -0,0 +1,109 @@ +start:lskitcomp_v +os:Linux +cmd:lskitcomp -v +check:rc==0 +check:output=~lskitcomp +check:output=~kitframework +check:output=~compatible_frameworks +cmd:lskitcomp --version +check:rc==0 +check:output=~lskitcomp +check:output=~kitframework +check:output=~compatible_frameworks +end + +start:lskitcomp_h +os:Linux +cmd:lskitcomp -h +check:rc==0 +check:output =~ Usage +cmd:lskitcomp --help +check:rc==0 +check:output=~ Usage +end + +start:lskitcomp_C +os:Linux +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/lskitcomp/mykits +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskitcomp;buildkit create mykits +check:rc==0 +check:output=~Kit template for mykits created in /opt/xcat/share/xcat/tools/autotest/testcase/lskitcomp/mykits directory +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskitcomp/mykits;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskitcomp/mykits;buildkit buildtar +check:rc==0 +cmd:addkit /opt/xcat/share/xcat/tools/autotest/testcase/lskitcomp/mykits/mykits-1.0-1.tar.bz2 +check:rc==0 +cmd:compname=`lskit mykits-1.0-1 |grep kitcompname|awk -F= '{print $2}'`;lskitcomp -C basename $compname +check:rc==0 +check:output=~basename +cmd:compname=`lskit mykits-1.0-1 |grep kitcompname|awk -F= '{print $2}'`;lskitcomp -C kitcompname $compname +check:output=~kitcompname +check:rc==0 +cmd:compname=`lskit mykits-1.0-1 |grep kitcompname|awk -F= '{print $2}'`;lskitcomp -C kitreponame $compname +check:rc==0 +check:output=~kitreponame +cmd:compname=`lskit mykits-1.0-1 |grep kitcompname|awk -F= '{print $2}'`;lskitcomp -C serverroles $compname +check:rc==0 +check:output=~serverroles +cmd:rmkit mykits-1.0-1 +check:rc==0 +cmd:rm -f /opt/xcat/share/xcat/tools/autotest/testcase/lskitcomp/mykits/mykits-1.0-1.tar.bz2 +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/lskitcomp/mykits +end + +start:lskitcomp_C +os:Linux +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/lskitcomp/mykits +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskitcomp;buildkit create mykits +check:rc==0 +check:output=~Kit template for mykits created in /opt/xcat/share/xcat/tools/autotest/testcase/lskitcomp/mykits directory +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskitcomp/mykits;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskitcomp/mykits;buildkit buildtar +check:rc==0 +cmd:addkit /opt/xcat/share/xcat/tools/autotest/testcase/lskitcomp/mykits/mykits-1.0-1.tar.bz2 +check:rc==0 +cmd:compname=`lskit mykits-1.0-1 |grep kitcompname|awk -F= '{print $2}'`;lskitcomp -C basename $compname +check:rc==0 +check:output=~basename +cmd:compname=`lskit mykits-1.0-1 |grep kitcompname|awk -F= '{print $2}'`;lskitcomp -C kitcompname $compname +check:output=~kitcompname +check:rc==0 +cmd:compname=`lskit mykits-1.0-1 |grep kitcompname|awk -F= '{print $2}'`;lskitcomp -C kitreponame $compname +check:rc==0 +check:output=~kitreponame +cmd:compname=`lskit mykits-1.0-1 |grep kitcompname|awk -F= '{print $2}'`;lskitcomp -C serverroles $compname +check:rc==0 +check:output=~serverroles +cmd:rmkit mykits-1.0-1 +check:rc==0 +cmd:rm -f /opt/xcat/share/xcat/tools/autotest/testcase/lskitcomp/mykits/mykits-1.0-1.tar.bz2 +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/lskitcomp/mykits +end + + +start:lskitcomp_S +os:Linux +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/lskitcomp/mykits +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskitcomp;buildkit create mykits +check:rc==0 +check:output=~Kit template for mykits created in /opt/xcat/share/xcat/tools/autotest/testcase/lskitcomp/mykits directory +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskitcomp/mykits;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskitcomp/mykits;buildkit buildtar +check:rc==0 +cmd:addkit /opt/xcat/share/xcat/tools/autotest/testcase/lskitcomp/mykits/mykits-1.0-1.tar.bz2 +check:rc==0 +cmd:compname=`lskit mykits-1.0-1 |grep kitcompname|awk -F= '{print $2}'`;lskitcomp -S compute $compname +check:rc==0 +check:output=~compute +cmd:compname=`lskit mykits-1.0-1 |grep kitcompname|awk -F= '{print $2}'`;lskitcomp --serverrole compute $compname +check:rc==0 +check:output=~compute +cmd:rmkit mykits-1.0-1 +check:rc==0 +cmd:rm -f /opt/xcat/share/xcat/tools/autotest/testcase/lskitcomp/mykits/mykits-1.0-1.tar.bz2 +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/lskitcomp/mykits +end + diff --git a/xCAT-test/autotest/testcase/lskitdeployparam/case0 b/xCAT-test/autotest/testcase/lskitdeployparam/case0 new file mode 100644 index 000000000..33ff5547e --- /dev/null +++ b/xCAT-test/autotest/testcase/lskitdeployparam/case0 @@ -0,0 +1,88 @@ +start:lskitdeployparam_v +os:Linux +cmd:lskitdeployparam -v +check:rc==0 +check:output=~lskitdeployparam +check:output=~kitframework +check:output=~compatible_frameworks +cmd:lskitdeployparam --version +check:rc==0 +check:output=~lskitdeployparam +check:output=~kitframework +check:output=~compatible_frameworks +end + +start:lskitdeployparam_h +os:Linux +cmd:lskitdeployparam -h +check:rc==0 +check:output =~ Usage +cmd:lskitdeployparam --help +check:rc==0 +check:output=~ Usage +end + +start:lskitdeployparam_no_param +os:Linux +cmd:lskitdeployparam +check:rc==1 +check:output=~Error +check:output=~ Usage +end + + +start:lskitdeployparam_k_1 +os:Linux +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskit;buildkit create mykits +check:rc==0 +check:output=~Kit template for mykits created in /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits directory +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits;buildkit buildtar +check:rc==0 +cmd:addkit /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits/mykits-1.0-1.tar.bz2 +check:rc==0 +check:output=~Kit mykits-1.0-1 was successfully added +cmd:lskit -K basename mykits-1.0-1 +check:rc==0 +check:output=~basename +cmd:lskitdeployparam -k mykits-1.0-1 +check:rc==0 +cmd:rmkit mykits-1.0-1 +check:rc==0 +check:output=~Kit mykits-1.0-1 was successfully removed +cmd:rm -f /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits/mykits-1.0-1.tar.bz2 +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits +end + +start:lskitdeployparam_c_1 +os:Linux +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskit;buildkit create mykits +check:rc==0 +check:output=~Kit template for mykits created in /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits directory +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits;buildkit buildtar +check:rc==0 +cmd:addkit /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits/mykits-1.0-1.tar.bz2 +check:rc==0 +check:output=~Kit mykits-1.0-1 was successfully added +cmd:lskit -K basename mykits-1.0-1 +check:rc==0 +check:output=~basename +cmd:kitcompname=`lskit mykits-1.0-1 |grep kitcompname|awk -F= '{print $2}'`;lskitdeployparam -c $kitcompname +check:rc==0 +cmd:rmkit mykits-1.0-1 +check:rc==0 +check:output=~Kit mykits-1.0-1 was successfully removed +cmd:rm -f /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits/mykits-1.0-1.tar.bz2 +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/lskit/mykits +end + + + + + + diff --git a/xCAT-test/autotest/testcase/rmkit/case0 b/xCAT-test/autotest/testcase/rmkit/case0 new file mode 100644 index 000000000..c62d5dd91 --- /dev/null +++ b/xCAT-test/autotest/testcase/rmkit/case0 @@ -0,0 +1,145 @@ +start:rmkit_v +os:Linux +cmd:rmkit -v +check:rc==0 +check:output=~rmkit +check:output=~kitframework +check:output=~compatible_frameworks +cmd:rmkit --version +check:rc==0 +check:output=~rmkit +check:output=~kitframework +check:output=~compatible_frameworks +end + +start:rmkit_h +os:Linux +cmd:rmkit -h +check:rc==0 +check:output =~ Usage +cmd:rmkit --help +check:rc==0 +check:output=~ Usage +end + +start:rmkit_t_no +os:Linux +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/rmkit;buildkit create mykits +check:rc==0 +check:output=~Kit template for mykits created in /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits directory +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits;buildkit buildtar +check:rc==0 +cmd:addkit /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits/mykits-1.0-1.tar.bz2 +check:rc==0 +check:output=~Kit mykits-1.0-1 was successfully added +cmd:rmkit -t mykits-1.0-1 +check:rc==0 +check:output=~No kitcomponents are in use +cmd:rmkit --test mykits-1.0-1 +check:rc==0 +check:output=~No kitcomponents are in use +cmd:rmkit mykits-1.0-1 +check:rc==0 +cmd:rm -f /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits/mykits-1.0-1.tar.bz2 +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits +end + +start:rmkit_t_yes +os:Linux +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/rmkit;buildkit create mykits +check:rc==0 +check:output=~Kit template for mykits created in /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits directory +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits;buildkit buildtar +check:rc==0 +cmd:addkit /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits/mykits-1.0-1.tar.bz2 +check:rc==0 +check:output=~Kit mykits-1.0-1 was successfully added +cmd:mkdef testimage -u profile=compute provmethod=install osarch=ppc64el +check:rc==0 +cmd:kitcompname=`lskit mykits-1.0-1 |grep kitcompname|awk -F= '{print $2}'`;addkitcomp -i testimage $kitcompname +check:rc==0 +check:output=~Assigning kit component +cmd:rmkit -t mykits-1.0-1 +check:rc==0 +check:output=~Following kitcomponents are in use +cmd:rmkit --test mykits-1.0-1 +check:rc==0 +check:output=~Following kitcomponents are in use +cmd:kitcompname=`lskit mykits-1.0-1 |grep kitcompname|awk -F= '{print $2}'`;rmkitcomp -i testimage $kitcompname +check:rc==0 +check:output=~Removing kitcomponent +check:output=~were removed from osimage testimage successfully +cmd:rmkit mykits-1.0-1 +check:rc==0 +cmd:rm -f /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits/mykits-1.0-1.tar.bz2 +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits +cmd:rmdef -t osimage -o testimage +check:rc==0 +end + +start:rmkit_f +os:Linux +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/rmkit;buildkit create mykits +check:rc==0 +check:output=~Kit template for mykits created in /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits directory +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits;buildkit buildtar +check:rc==0 +cmd:addkit /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits/mykits-1.0-1.tar.bz2 +check:rc==0 +check:output=~Kit mykits-1.0-1 was successfully added +cmd:mkdef testimage -u profile=compute provmethod=install osarch=ppc64el +check:rc==0 +cmd:kitcompname=`lskit mykits-1.0-1 |grep kitcompname|awk -F= '{print $2}'`;addkitcomp -i testimage $kitcompname +check:rc==0 +check:output=~Assigning kit component +cmd:rmkit -f mykits-1.0-1 +check:rc==0 +check:output=~Removing kit mykits-1.0-1 +check:output=~Kit mykits-1.0-1 was successfully removed +cmd:rm -f /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits/mykits-1.0-1.tar.bz2 +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits +cmd:rmdef -t osimage -o testimage +check:rc==0 +end + + +start:rmkit_V +os:Linux +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/rmkit;buildkit create mykits +check:rc==0 +check:output=~Kit template for mykits created in /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits directory +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits;buildkit buildtar +check:rc==0 +cmd:addkit /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits/mykits-1.0-1.tar.bz2 +check:rc==0 +check:output=~Kit mykits-1.0-1 was successfully added +cmd:mkdef testimage -u profile=compute provmethod=install osarch=ppc64el +check:rc==0 +cmd:kitcompname=`lskit mykits-1.0-1 |grep kitcompname|awk -F= '{print $2}'`;addkitcomp -i testimage $kitcompname +check:rc==0 +check:output=~Assigning kit component +cmd:rmkit -f mykits-1.0-1 -V +check:rc==0 +check:output=~Removing kit mykits-1.0-1 +check:output=~Removing kit components +check:output=~Removing kit plugins +check:output=~Removing kit scripts +check:output=~Removing kitdir from +check:output=~Removing kit from xCAT DB +cmd:rm -f /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits/mykits-1.0-1.tar.bz2 +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/rmkit/mykits +cmd:rmdef -t osimage -o testimage +check:rc==0 +end diff --git a/xCAT-test/autotest/testcase/rmkitcomp/case0 b/xCAT-test/autotest/testcase/rmkitcomp/case0 new file mode 100644 index 000000000..857a823b5 --- /dev/null +++ b/xCAT-test/autotest/testcase/rmkitcomp/case0 @@ -0,0 +1,98 @@ +start:rmkitcomp_v +os:Linux +cmd:rmkitcomp -v +check:rc==0 +check:output=~rmkitcomp +check:output=~kitframework +check:output=~compatible_frameworks +cmd:rmkitcomp --version +check:rc==0 +check:output=~rmkitcomp +check:output=~kitframework +check:output=~compatible_frameworks +end + +start:rmkitcomp_h +os:Linux +cmd:rmkitcomp -h +check:rc==0 +check:output =~ Usage +cmd:rmkitcomp --help +check:rc==0 +check:output=~ Usage +end + +start:rmkitcomp_noscripts +os:Linux +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/rmkitcomp/$$KITDATA +cmd:mkdir -p /opt/xcat/share/xcat/tools/autotest/testcase/rmkitcomp/$$KITDATA +cmd:cp -rf /opt/xcat/share/xcat/tools/autotest/$$KITDATA /opt/xcat/share/xcat/tools/autotest/testcase/rmkitcomp +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/rmkitcomp/$$KITDATA;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/rmkitcomp/$$KITDATA;buildkit buildtar +check:rc==0 +cmd:addkit /opt/xcat/share/xcat/tools/autotest/testcase/rmkitcomp/$$KITDATA/*.tar.bz2 +check:rc==0 +check:output=~successfully added +cmd:mkdef testimage -u profile=compute provmethod=install osarch=ppc64el +check:rc==0 +cmd:addkitcomp -i testimage -a ubuntukit-compute-2 +check:rc==0 +check:output=~Assigning kit component ubuntukit-compute-2 +cmd:lsdef -t osimage -o testimage +check:rc==0 +check:output=~postbootscripts +cmd:rmkitcomp -i testimage -f ubuntukit-compute-2-1.0-1-ubuntu-14.04-ppc64el --noscripts +check:rc==0 +check:output=~Removing kitcomponent ubuntukit-compute-2-1.0-1-ubuntu-14.04-ppc64el from osimage testimage +cmd:lsdef -t osimage -o testimage +check:rc==0 +check:output=~postbootscripts +cmd:rmkitcomp -i testimage -f ubuntukit-compute-1-1.0-1-ubuntu-14.04-ppc64el +check:rc==0 +cmd:rmkit ubuntukit-1.0-1-ppc64el +check:rc==0 +cmd:rm -f /opt/xcat/share/xcat/tools/autotest/testcase/rmkitcomp/$$KITDATA/ubuntukit-1.0-1-ppc64el.tar.bz2 +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/rmkitcomp/$$KITDATA +cmd:rmdef -t osimage -o testimage +check:rc==0 +end + +start:rmkitcomp_f +os:Linux +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/rmkitcomp/$$KITDATA +cmd:mkdir -p /opt/xcat/share/xcat/tools/autotest/testcase/rmkitcomp/$$KITDATA +cmd:cp -rf /opt/xcat/share/xcat/tools/autotest/$$KITDATA /opt/xcat/share/xcat/tools/autotest/testcase/rmkitcomp +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/rmkitcomp/$$KITDATA;buildkit buildrepo all +check:rc==0 +cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/rmkitcomp/$$KITDATA;buildkit buildtar +check:rc==0 +cmd:addkit /opt/xcat/share/xcat/tools/autotest/testcase/rmkitcomp/$$KITDATA/*.tar.bz2 +check:rc==0 +check:output=~successfully added +cmd:mkdef testimage -u profile=compute provmethod=install osarch=ppc64el +check:rc==0 +cmd:addkitcomp -i testimage -a ubuntukit-compute-2 +check:rc==0 +check:output=~Assigning kit component ubuntukit-compute-2 +cmd:lsdef -t osimage -o testimage |grep -i kitcomponents +check:rc==0 +check:output=~ubuntukit-compute-1 +check:output=~ubuntukit-compute-2 +cmd:rmkitcomp -i testimage ubuntukit-compute-1-1.0-1-ubuntu-14.04-ppc64el +check:rc==1 +check:output=~Error: Failed to remove kitcomponent +cmd:rmkitcomp -i testimage -f ubuntukit-compute-1-1.0-1-ubuntu-14.04-ppc64el +check:rc==0 +check:output=~Removing kitcomponent ubuntukit-compute-1-1.0-1-ubuntu-14.04-ppc64el from osimage testimage +cmd:rmkitcomp -i testimage -f ubuntukit-compute-2-1.0-1-ubuntu-14.04-ppc64el +check:rc==0 +check:output=~Removing kitcomponent ubuntukit-compute-2-1.0-1-ubuntu-14.04-ppc64el from osimage testimage +cmd:rmkit ubuntukit-1.0-1-ppc64el +check:rc==0 +cmd:rm -f /opt/xcat/share/xcat/tools/autotest/testcase/rmkitcomp/$$KITDATA/ubuntukit-1.0-1-ppc64el.tar.bz2 +cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/testcase/rmkitcomp/$$KITDATA +cmd:rmdef -t osimage -o testimage +check:rc==0 +end + diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index 7506bf2b8..30086f685 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -539,7 +539,10 @@ sub loadcase $cases[$i]->{os}="Linux"; }elsif($string1 =~ /^sles\s*/ && -f "/etc/SuSE-release"){ $cases[$i]->{os}="Linux"; - }else{ + }elsif($string1 =~ /^ubuntu\s*/ && -f "/etc/lsb-release"){ + $cases[$i]->{os}="Linux"; + } + else{ $cases[$i]->{os}=$string1; } diff --git a/xCAT/debian/control b/xCAT/debian/control index 31c38c62d..d39349e22 100644 --- a/xCAT/debian/control +++ b/xCAT/debian/control @@ -7,6 +7,6 @@ Standards-Version: 3.7.2 Package: xcat Architecture: amd64 ppc64el -Depends: ${perl:Depends}, xcat-server, xcat-client, libdbd-sqlite3-perl, isc-dhcp-server, apache2, nfs-kernel-server, nmap, bind9, libxml-parser-perl, xinetd, tftpd-hpa, tftp-hpa, conserver-xcat, libnet-telnet-perl, ipmitool-xcat (>=1.8.9), syslinux[any-amd64], libsys-virt-perl, syslinux-xcat[any-amd64], xnba-undi[any-amd64], xcat-genesis-scripts, elilo-xcat[any-amd64] +Depends: ${perl:Depends}, xcat-server, xcat-client, libdbd-sqlite3-perl, isc-dhcp-server, apache2, nfs-kernel-server, nmap, bind9, libxml-parser-perl, xinetd, tftpd-hpa, tftp-hpa, conserver-xcat, libnet-telnet-perl, ipmitool-xcat (>=1.8.9), syslinux[any-amd64], libsys-virt-perl, syslinux-xcat[any-amd64], xnba-undi[any-amd64], xcat-genesis-scripts, elilo-xcat[any-amd64], xcat-buildkit Description: Server and configuration utilities of the xCAT management project xcat-server provides the core server and configuration management components of xCAT. This package should be installed on your management server diff --git a/xCAT/postscripts/configefi b/xCAT/postscripts/configefi index 1fc433126..1d71caaca 100644 --- a/xCAT/postscripts/configefi +++ b/xCAT/postscripts/configefi @@ -17,6 +17,26 @@ if [ "$arch" = "x86_64" ]; then if [ -f "/boot/efi/EFI/redhat/grub.efi" ];then efibootmgr -c -l \\EFI\\redhat\\grub.efi -L syscloneLinux + #support for redhat 7.0 + elif [ -f "/boot/efi/EFI/redhat/grubx64.efi" ];then + efibootmgr -c -l \\EFI\\redhat\\grubx64.efi -L syscloneLinux + + boot_root=`mount | grep -E ' on\s+/ type ' | awk '{print $1}'` + sed -i 's| root=\S*| root='$boot_root'|' /boot/efi/EFI/redhat/grub.cfg + + blkid -c /dev/null |grep UUID|while read str_line + do + partition=`echo "$str_line"|grep UUID|awk '{print $1}'|sed -e 's|/dev/\(.*\):|\1|g'` + #echo "partition=$partition" + + if echo "$partition"|grep /; then + continue + fi + + newuuid=`blkid -c /dev/null|grep "$partition"|sed -e 's|.*UUID="\(.*\)" T.*|\1|g'` + #echo "newuuid=$newuuid" + sed -i '/'$partition'/s|UUID=\S*|UUID='$newuuid'|' /etc/fstab + done elif [ -f "/boot/efi/efi/SuSE/elilo.efi" ];then efibootmgr -c -l \\efi\\SuSE\\elilo.efi -L syscloneLinux else @@ -31,7 +51,8 @@ if [ "$arch" = "x86_64" ]; then grep -v rootfs /proc/mounts > /etc/mtab boot_device='' if [ -f "/etc/systemconfig/systemconfig.conf" ];then - boot_root=`cat /etc/systemconfig/systemconfig.conf | grep ROOTDEV | awk '{print $3}'` + #boot_root=`cat /etc/systemconfig/systemconfig.conf | grep ROOTDEV | awk '{print $3}'` + boot_root=`mount | grep -E ' on\s+/ type ' | awk '{print $1}'` boot_device=`cat /etc/systemconfig/systemconfig.conf | grep BOOTDEV | awk '{print $3}'` else boot_root=`mount | grep -E ' on\s+/ type ' | awk '{print $1}'` @@ -100,8 +121,28 @@ elif [ "$arch" = "ppc64" ]; then # Set 0x41 as the partition type of the first partition # echo A | dd of=/dev/sda bs=1 count=1 seek=450 + elif [ -f "/boot/grub2/grub" ];then + echo "dd if=/boot/grub2/grub of=/dev/sda1 bs=4096" + dd if=/boot/grub2/grub of=/dev/sda1 bs=4096 + + boot_root=`mount | grep -E ' on\s+/ type ' | awk '{print $1}'` + sed -i 's| root=UUID=\S*| root='$boot_root'|' /boot/grub2/grub.cfg + + blkid -c /dev/null |grep UUID|while read str_line + do + partition=`echo "$str_line"|grep UUID|awk '{print $1}'|sed -e 's|/dev/\(.*\):|\1|g'` + #echo "partition=$partition" + + if echo "$partition"|grep /; then + continue + fi + + newuuid=`blkid -c /dev/null|grep "$partition"|sed -e 's|.*UUID="\(.*\)" T.*|\1|g'` + #echo "newuuid=$newuuid" + sed -i '/'$partition'/s|UUID=\S*|UUID='$newuuid'|' /etc/fstab + done else - echo "there isn't yaboot bootloader" + echo "Can not find boot loader" fi else echo "[ERROR]: unsupport arch....." diff --git a/xCAT/postscripts/configib b/xCAT/postscripts/configib index 904dd0da3..2845695ae 100755 --- a/xCAT/postscripts/configib +++ b/xCAT/postscripts/configib @@ -17,6 +17,7 @@ # NETWORKS_LINE2='netname=ib1||net=15.0.1.0||mask=255.255.255.0||mgtifname=||gateway=15.0.1.254||dhcpserver=||tftpserver=||nameservers=||ntpservers=||logservers=||dynamicrange=||staticrange=||staticrangeincrement=||nodehostname=||ddnsdomain=||vlanid=||domain=||disable=||comments=' # NETWORKS_LINE3='netname=ib3||net=15.0.3.0||mask=255.255.255.0||mgtifname=||gateway=||dhcpserver=||tftpserver=||nameservers=||ntpservers=||logservers=||dynamicrange=||staticrange=||staticrangeincrement=||nodehostname=||ddnsdomain=||vlanid=||domain=||disable=||comments=' + if [ "$(uname -s|tr 'A-Z' 'a-z')" = "linux" ];then str_dir_name=`dirname $0` . $str_dir_name/xcatlib.sh @@ -69,7 +70,7 @@ fi #find correct IB driver PLTFRM=`uname` -if [[ $OSVER == rhels5* || "$OSVER" == rhels6* ]] +if [[ $OSVER == rhels5* || "$OSVER" == rhels6* || "$OSVER" == ubuntu14* ]] then ib_driver="rdma" #/sbin/service $ib_driver status @@ -135,24 +136,59 @@ then elif [ -f /etc/SuSE-release ] then OS_name="suse" + elif [ -f /etc/os-release ] && cat /etc/os-release |grep NAME|grep Ubuntu>/dev/null + then + OS_name="ubuntu" else echo "Unsupported to config IB on this OS!" logger -p local4.info -t xcat "Unsupported to config IB on this OS!" exit - fi - - if [ $OS_name == 'suse' ] - then - dir="/etc/sysconfig/network" - else - dir="/etc/sysconfig/network-scripts" fi + + if [ $OS_name != 'ubuntu' ]; then + if [ $OS_name == 'suse' ] + then + dir="/etc/sysconfig/network" + else + dir="/etc/sysconfig/network-scripts" + fi + + #`rm -f $dir/ifcfg-$nic` 2>&1 1>/dev/null + # nic aliases + `rm -f $dir/ifcfg-ib*` 2>&1 1>/dev/null + else + interfaces="/etc/network/interfaces" - # remove the nic configuration files which are included in $NIC_IBNICS - for nic in `echo "$NIC_IBNICS" | tr "," "\n"` - do - rm -f $dir/ifcfg-$nic 2>&1 1>/dev/null - done + for tmp in `sed -n "/auto ib/=" ${interfaces}` + do + startline=`sed -n "/auto ib/=" ${interfaces}| head -n 1` + endline=`sed -n "$startline,/^auto/p" ${interfaces} |wc -l` + + if sed -n "$startline,/^auto/p" ${interfaces} |sed '$!d' |grep "auto" >/dev/null;then + endline=`expr $startline + $endline - 2` + else + endline=`expr $startline + $endline - 1` + fi + + ((startline--)) + temp=`sed -n ${startline}p ${interfaces}` + while [[ $temp =~ ^# ]] + do + ((startline--)) + temp=`sed -n ${startline}p ${interfaces}` + done + ((startline++)) + + temp=`sed -n ${endline}p ${interfaces}` + while [[ $temp =~ ^# ]] + do + ((endline--)) + temp=`sed -n ${endline}p ${interfaces}` + done + + sed -i ${startline},${endline}d ${interfaces} + done + fi else loop_number=`lsdev | grep "IP over Infiniband Network Interface" | wc -l` num=0 @@ -428,6 +464,56 @@ IPADDR=$nicip" > $dir/ifcfg-$nic:$ipindex goodnics="$goodnics,$nic:$ipindex" fi fi # end not the first ip address + elif [ $OS_name == 'ubuntu' ] + then + # First ip address + if [ $ipindex -eq 1 ]; then + # ipv6 + if echo $nicip | grep : 2>&1 1>/dev/null + then + echo "auto $nic +iface $nic inet6 static +address $nicip +netmask $netmask" >> /etc/network/interfaces + + if [ -n "$gateway" ]; then + echo "gateway $gateway" >> /etc/network/interfaces + fi + # ipv4 + else + # Write the info to the ifcfg file + echo "auto $nic +iface $nic inet static +address $nicip +netmask $netmask" >> /etc/network/interfaces + + #if [ -n "$gateway" ]; then + # echo "gateway $gateway" >> /etc/network/interfaces + #fi + fi + else # Not the first ip address + # ipv6 + if echo $nicip | grep : 2>&1 1>/dev/null + then + echo "auto $nic +iface $nic inet6 static +address $nicip +netmask $netmask" >> /etc/network/interfaces + + if [ -n "$gateway" ]; then + echo "gateway $gateway" >> /etc/network/interfaces + fi + else # ipv4 + echo "auto $nic:$ipindex +iface $nic:$ipindex inet static +address $nicip +netmask $netmask" >> /etc/network/interfaces + + #if [ -n "$gateway" ]; then + # echo "gateway $gateway" >> /etc/network/interfaces + #fi + fi + fi else echo "Unsupported operating system" logger -p local4.err -t xcat "Unsupported operating system" @@ -502,18 +588,27 @@ done # end for nic # Bringup all the ib interfaces if [ $PLTFRM == "Linux" ] then - #/sbin/service $ib_driver restart restartservice $ib_driver - for nic in `echo "$goodnics" | tr "," "\n"` + for nic in `echo "$goodnics" | tr "," "\n"|sort -u` do sleep 5 - if [[ "$OSVER" == rhels6* ]] then ip link set dev $nic up else - ifup $nic + if [[ "$OSVER" == ubuntu14* ]] + then + interfaces="/etc/network/interfaces" + for tmp in `cat $interfaces |grep "auto ib" |sort -u|awk '{print $2}'` + do + ifdown $tmp > /dev/null 2>&1 + sleep 2 + ifup $tmp + done + else + ifup $nic + fi fi done fi diff --git a/xCAT/postscripts/makeinitrd b/xCAT/postscripts/makeinitrd index ec71a5440..ecdadcd68 100755 --- a/xCAT/postscripts/makeinitrd +++ b/xCAT/postscripts/makeinitrd @@ -10,17 +10,28 @@ # And do whatever is necessary on ubuntu. if [[ -f /sbin/dracut ]]; then - # redhat6.x/centos6.x + # redhat6.x/centos6.x/rhels7.x echo "Running dracut to regenerate the initrd with the drivers needed by this node:" - dracut --force + arch=`uname -m` + #echo "arch=$arch" + initrdfile=`find /boot -name "initramfs-*.$arch.img"` + #echo "initrdfile=$initrdfile" + kernelversion=`echo $initrdfile |sed -e 's:/boot/initramfs-\(.*\)\.img:\1:g'` + #echo "kernelversion=$kernelversion" + mv $initrdfile $initrdfile.org + echo "dracut $initrdfile $kernelversion" + dracut $initrdfile $kernelversion else # suse/sles and redhat5.x/centos5.x echo "Running mkinitrd to regenerate the initrd with the drivers needed by this node:" osvers=`cat /etc/*release|sed -e 's/.*\([0-9]\{1,\}\.[0-9]\{1,\}\).*/\1/'` if [[ $osvers == 5\.* ]];then initrdfile=`find /boot -name "initrd-*.img"` + #echo "initrdfile=$initrdfile" kernelversion=`echo $initrdfile |sed -e 's:/boot/initrd-\(.*\)\.img:\1:g'` + #echo "kernelversion=$kernelversion" mv $initrdfile $initrdfile.org + echo "mkinitrd $initrdfile $kernelversion" mkinitrd $initrdfile $kernelversion else mkinitrd diff --git a/xCAT/postscripts/otherpkgs b/xCAT/postscripts/otherpkgs index 2845b5130..18c46dc5f 100755 --- a/xCAT/postscripts/otherpkgs +++ b/xCAT/postscripts/otherpkgs @@ -501,7 +501,7 @@ if ( pmatch "$OSVER" "sles11*" && [ $haszypper -eq 1 ] ); then result=`zypper --non-interactive --no-gpg-checks refresh 2>&1` -elif ( pmatch "$OSVER" "rhel*" && [ $hasyum -eq 1 ] ); then +elif ( ((pmatch "$OSVER" "rhel*") || (pmatch "$OSVER" "centos*") || (pmatch "$OSVER" "SL*")) && [ $hasyum -eq 1 ] ); then #remove old repo mkdir -p /etc/yum.repos.d if [ -r "/etc/yum.repos.d/local-repository.repo" ]; then diff --git a/xCAT/postscripts/remoteshell b/xCAT/postscripts/remoteshell index 1580c519b..0157d3584 100755 --- a/xCAT/postscripts/remoteshell +++ b/xCAT/postscripts/remoteshell @@ -460,6 +460,9 @@ then fi else #service sshd restart + # sshd is not enabled on SLES 12 by default + # does not hurt anything to re-enable if it is enabled already + enableservice sshd restartservice sshd fi diff --git a/xCAT/postscripts/replace_byid_device b/xCAT/postscripts/replace_byid_device index 8d199c2a6..47429e9ff 100644 --- a/xCAT/postscripts/replace_byid_device +++ b/xCAT/postscripts/replace_byid_device @@ -19,7 +19,7 @@ do # str_dev_prefix=`basename $str_old_dev | awk -F'-' '{print $1}'` #find out the new by-id name - str_new_dev=`ls -l --time-style=locale /dev/disk/by-id/ | grep -E "$str_real\$" | awk '{print $9}'` + str_new_dev=`ls -l --time-style=locale /dev/disk/by-id/ | grep -E "$str_real\$" | awk '{print $9}'|head -n 1` if [ -z "$str_new_dev" ];then continue fi diff --git a/xCAT/postscripts/syscloneimgupdate b/xCAT/postscripts/syscloneimgupdate index add1e21be..a77835e7a 100755 --- a/xCAT/postscripts/syscloneimgupdate +++ b/xCAT/postscripts/syscloneimgupdate @@ -32,7 +32,6 @@ for filename in \ /opt/xcat \ /root/.ssh \ /var/cache \ - /var/lib \ /xcatpost do if [ ! -e $filename ];then diff --git a/xCAT/postscripts/syslog b/xCAT/postscripts/syslog index 13e917fbb..974322ace 100755 --- a/xCAT/postscripts/syslog +++ b/xCAT/postscripts/syslog @@ -114,6 +114,77 @@ config_Rsyslog_C3() fi } +# This sets up rsyslog 8.x, different from the previous rsyslog versions. +# Instead of updating /etc/rsyslog.conf for forwarding to a remote host, +# You update /etc/rsyslog.d/remote.conf. The /etc/sysconfig/rsyslog file does not exist. +# This is only for Linux, since AIX does not use rsyslog. It ships its own syslog in an lpp, +# at least at the time of this code being written + +config_rsyslog_V8() +{ + + goLocal=0; + conf_file="/etc/rsyslog.conf" + remoteconf="/etc/rsyslog.d/remote.conf" + + # If this is a Management Node or Service Node, then it will be receiving syslog entries from the + # compute nodes. Management Node is receiving from Service Nodes and possibly compute nodes. + # They will all be put in /var/log/messages + # For the service node, if site table svloglocal is set then we will keep the logs on the servicenode + # and not forward to the Management Node. + + #now handling where the logs go, if goLocal=1 then log local, if not forward to MN + if [ -f /etc/xCATMN ]; then + goLocal=1 + else + # check to see if service node should forward of keep logs + if [ $isSN -eq 1 ]; then + if [ -n "$SVLOGLOCAL" ] && [ $SVLOGLOCAL -eq 1 ]; then + goLocal=1 + fi + fi + fi + + if [ $goLocal -eq 1 ]; then + #logging is local, do not forward + #making sure all the messages goes to /var/log/messages + touch /var/log/messages + # backup rsyslog.conf + if [ ! -f $conf_file.XCATORIG ]; then + cp -f $conf_file $conf_file.XCATORIG + fi + + grep "xCAT settings" $conf_file 2>&1 1> /dev/null + if [ $? -eq 0 ]; then + sed "/# xCAT settings/,$ d" $conf_file >/tmp/sed.tmp + cat /tmp/sed.tmp >$conf_file + fi + + echo "# xCAT settings" >> $conf_file + echo "*.debug /var/log/messages" >> $conf_file + else + # not logging local, forward logging + # backup the existing remote.conf file from the install + if [ ! -f $remoteconf.XCATORIG ]; then + cp -f $remoteconf $remoteconf.XCATORIG + fi + # check if already an entry by xCAT. If so, we need to replace it + grep "xCAT settings" $remoteconf 2>&1 1> /dev/null + if [ $? -eq 0 ]; then + sed "/# xCAT settings/,$ d" $remoteconf >/tmp/sed.tmp + cat /tmp/sed.tmp >$remoteconf + fi + + # add xCAT entries + echo "# xCAT settings" >> $remoteconf + echo "*.* @$master" >> $remoteconf + fi + # restart syslog ( could be service or systemctl call depending on the OS) + restartservice syslog + +} + + #echo "NTYPE=$NTYPE,OSVER=$OSVER,OSTYPE=$OSTYPE" if [ "$NTYPE" = service ]; then @@ -124,6 +195,19 @@ fi # systemdEnabled=1 #fi +# check if this is rsyslog version 8, setup is different no matter what OS. +# We only update the /etc/rsyslog.d/remote.conf file to point to the xcatmaster. +# Do not even touch rsyslog.conf +# There is no /etc/sysconfig/rsyslog file, so we use rsyslogd -v to get the version +SYSLOGPROD=`rsyslogd -v | grep rsyslogd |awk {'print $1'}` +SYSLOGVER=`rsyslogd -v | grep rsyslogd |awk {'print $2'}` +if ( pmatch $SYSLOGPROD "*rsyslogd*" ) && ( pmatch $SYSLOGVER "8*" ); then + config_rsyslog_V8 +#keep a record + logger -t xCAT -p local4.info "Install: rsyslog version 8 setup" + exit 0 +fi + if [ "$(uname -s)" = "Linux" ]; then if ( pmatch $OSVER "fedora*" ) || ( pmatch $OSVER "rhels5*" ) || ( pmatch $OSVER "rhel6*" ) || ( pmatch $OSVER "rhels6*" ) || [ -f /etc/fedora-release ] || [ -f /etc/redhat-release ] || ( pmatch $OSVER "ubuntu*" ) || ( is_lsb_ubuntu ) || ( pmatch $OSVER "debian*" ); then if [ -e /etc/rsyslog.conf ]; then @@ -158,13 +242,13 @@ fi -#handle sysconfig file to make remote loggling possible +#handle sysconfig file to make remote logging possible if [ $isLinux -eq 1 ] && [ -e $sysconfig ]; then if [ ! -f "$sysconfig.XCATORIG" ]; then cp -f $sysconfig $sysconfig.XCATORIG fi - #check if it is ryslog version 3, it has totally different settings in /etc/syslog.cong + #check if it is ryslog version 3, it has totally different settings in /etc/syslog.conf if [ $isRsyslog -eq 1 ]; then grep "SYSLOGD_OPTIONS" $sysconfig | grep -e "[\-c 3|\-c3|\-c4|\-c 4]" 2>&1 1> /dev/null if [ $? -eq 0 ]; then diff --git a/xCAT/postscripts/updatenetwork b/xCAT/postscripts/updatenetwork index de7db45c8..dd3e18900 100644 --- a/xCAT/postscripts/updatenetwork +++ b/xCAT/postscripts/updatenetwork @@ -4,8 +4,8 @@ . /tmp/post-install/variables.txt #delete the udev rule in the image -rule_file=`ls /etc/udev/rules.d/*net_persistent_names.rules` -if [ -n "$rule_file" ];then +rule_file="/etc/udev/rules.d/*net_persistent_names.rules" +if ls $rule_file >/dev/null 2>&1;then rm -f $rule_file fi diff --git a/xCAT/postscripts/xcatdsklspost b/xCAT/postscripts/xcatdsklspost index c9ac442bc..e279b9b89 100755 --- a/xCAT/postscripts/xcatdsklspost +++ b/xCAT/postscripts/xcatdsklspost @@ -29,7 +29,7 @@ update_VPD() # Run updatevpd only when necessary if [ -f /usr/sbin/lsvpd ]; then - /usr/sbin/lsvpd | grep -i cpu 2>&1 1>/dev/null + /usr/sbin/lsvpd | grep -i -E 'cpu|processor' 2>&1 1>/dev/null if [ "$?" = "1" ]; then update_VPD fi diff --git a/xCAT/xCAT.spec b/xCAT/xCAT.spec index 7d44b2049..4593a7bd4 100644 --- a/xCAT/xCAT.spec +++ b/xCAT/xCAT.spec @@ -63,10 +63,12 @@ Requires: syslinux xCAT-genesis-scripts-x86_64 elilo-xcat Requires: ipmitool-xcat >= 1.8.9 Requires: xnba-undi %endif +%ifos linux %ifarch ppc ppc64 Requires: xCAT-genesis-scripts-ppc64 Requires: ipmitool-xcat >= 1.8.9 %endif +%endif %if %notpcm %ifarch i386 i586 i686 x86 x86_64 @@ -182,6 +184,11 @@ then cp /etc/xcat/conf.orig/xcat.conf.apach24 /etc/apache2/conf.d/xcat.conf fi +if [ -n "$(apache2ctl -v 2>&1 |grep -e '^Server version\s*:.*\/2.4')" ] +then + rm -rf /etc/apache2/conf.d/xcat.conf + cp /etc/xcat/conf.orig/xcat.conf.apach24 /etc/apache2/conf.d/xcat.conf +fi %endif