Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core

This commit is contained in:
root 2014-10-19 17:56:15 -07:00
commit cc971870f9
117 changed files with 3237 additions and 826 deletions

View File

@ -194,12 +194,12 @@ then
if [ ! -d ../../$package_dir_name ];then
mkdir -p "../../$package_dir_name"
fi
packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-OpenStack xCAT-OpenStack-baremetal"
packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-OpenStack xCAT-OpenStack-baremetal xCAT-buildkit"
target_archs=(amd64 ppc64el)
for file in `echo $packages`
do
file_low=`echo $file | tr '[A-Z]' '[a-z]'`
if [ "$file" = "xCAT" ]; then
if [ "$file" = "xCAT" -o "$file" = "xCAT-genesis-scripts" ]; then
target_archs="amd64 ppc64el"
else
target_archs="all"
@ -208,8 +208,8 @@ then
do
if grep -q $file $update_log || [ "$BUILDALL" == 1 -o "$file" = "perl-xCAT" ]; then
rm -f ../../$package_dir_name/${file_low}_*.$target_arch.deb
#only for genesis package
rm -f ../../$package_dir_name/${file_low}-amd64_*.deb
#genesis scripts package, don't remove genesis amd64 files
#rm -f ../../$package_dir_name/${file_low}-amd64_*.deb
cd $file
dch -v $pkg_version -b -c debian/changelog $build_string
if [ "$target_arch" = "all" ]; then

View File

@ -265,6 +265,8 @@ if [ "$OSNAME" != "AIX" ]; then
ORIGFAILEDRPMS="$FAILEDRPMS"
./makerpm xCAT-genesis-scripts x86_64 "$EMBED"
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS xCAT-genesis-scripts-x86_64"; fi
./makerpm xCAT-genesis-scripts ppc64 "$EMBED"
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS xCAT-genesis-scripts-ppc64"; fi
if [ "$FAILEDRPMS" = "$ORIGFAILEDRPMS" ]; then # all succeeded
rm -f $DESTDIR/xCAT-genesis-scripts*rpm
rm -f $SRCDIR/xCAT-genesis-scripts*rpm

View File

@ -266,7 +266,7 @@ See http://www.perl.com/doc/manual/html/pod/perlre.html for information on perl
As of xCAT 2.8.1, you can use a modified version of the regular expression support described in the previous section. You do not need to enter the node information (1st part of the expression), it will be derived from the input nodename. You only need to supply the 2nd part of the expression to determine the value to give the attribute. For examples, see
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Listing_and_Modifying_the_Database#Easy_Regular_expressions
https://sourceforge.net/p/xcat/wiki/Listing_and_Modifying_the_Database/#easy-regular-expressions
=head1 OBJECT DEFINITIONS

View File

@ -69,14 +69,14 @@ This program module file, is a set of network utilities used by xCAT commands.
#-------------------------------------------------------------------------------
sub getNodeDomains()
{
my $class = shift;
my $class = shift;
my $nodes = shift;
my @nodelist = @$nodes;
my %nodedomains;
# Get the network info for each node
my %nethash = xCAT::DBobjUtils->getNetwkInfo(\@nodelist);
my %nethash = xCAT::DBobjUtils->getNetwkInfo(\@nodelist);
# get the site domain value
my @domains = xCAT::TableUtils->get_site_attribute("domain");
@ -85,12 +85,13 @@ sub getNodeDomains()
# for each node - set hash value to network domain or default
# to site domain
foreach my $node (@nodelist) {
if ($nethash{$node}{domain}) {
$nodedomains{$node} = $nethash{$node}{domain};
} else {
$nodedomains{$node} = $sitedomain;
}
}
unless (defined($node)) {next;}
if (defined($nethash{$node}) && $nethash{$node}{domain}) {
$nodedomains{$node} = $nethash{$node}{domain};
} else {
$nodedomains{$node} = $sitedomain;
}
}
return \%nodedomains;
}

View File

@ -3617,6 +3617,10 @@ push(@{$defspec{group}->{'attrs'}}, @nodeattrs);
tabentry => 'kit.kitdeployparams',
access_tabentry => 'kit.kitname=attr:kitname',
},
{attr_name => 'kitdir',
tabentry => 'kit.kitdir',
access_tabentry => 'kit.kitname=attr:kitname',
},
);
#############################
@ -3633,8 +3637,8 @@ push(@{$defspec{group}->{'attrs'}}, @nodeattrs);
tabentry => 'kitrepo.kitname',
access_tabentry => 'kitrepo.kitreponame=attr:kitreponame',
},
{attr_name => 'osname',
tabentry => 'kitrepo.osname',
{attr_name => 'osbasename',
tabentry => 'kitrepo.osbasename',
access_tabentry => 'kitrepo.kitreponame=attr:kitreponame',
},
{attr_name => 'osmajorversion',
@ -3702,6 +3706,10 @@ push(@{$defspec{group}->{'attrs'}}, @nodeattrs);
tabentry => 'kitcomponent.kitpkgdeps',
access_tabentry => 'kitcomponent.kitcompname=attr:kitcompname',
},
{attr_name => 'prerequisite',
tabentry => 'kitcomponent.prerequisite',
access_tabentry => 'kitcomponent.kitcompname=attr:kitcompname',
},
{attr_name => 'driverpacks',
tabentry => 'kitcomponent.driverpacks',
access_tabentry => 'kitcomponent.kitcompname=attr:kitcompname',
@ -3714,6 +3722,10 @@ push(@{$defspec{group}->{'attrs'}}, @nodeattrs);
tabentry => 'kitcomponent.postbootscripts',
access_tabentry => 'kitcomponent.kitcompname=attr:kitcompname',
},
{attr_name => 'genimage_postinstall',
tabentry => 'kitcomponent.genimage_postinstall',
access_tabentry => 'kitcomponent.kitcompname=attr:kitcompname',
},
{attr_name => 'exlist',
tabentry => 'kitcomponent.exlist',
access_tabentry => 'kitcomponent.kitcompname=attr:kitcompname',

View File

@ -4232,4 +4232,68 @@ sub disableservice{
xCAT::Utils->runcmd($cmd, -1);
return $::RUNCMD_RC;
}
sub cleanup_for_powerLE_hardware_discovery {
my $host_node = shift;
if( $host_node =~ /xCAT::Utils/)
{
$host_node=shift;
}
my $pbmc_node = shift;
my $subreq = shift;
my $ipmitab = xCAT::Table->new("ipmi");
unless($ipmitab) {
xCAT::MsgUtils->message("S", "Discovery Error: can not open ipmi table.");
return;
}
my @nodes = ($host_node, $pbmc_node);
my $ipmihash = $ipmitab->getNodesAttribs(\@nodes, ['node', 'bmc', 'username', 'password']);
if ($ipmihash) {
my $new_bmc_ip = $ipmihash->{$host_node}->[0]->{bmc};
my $new_bmc_password = $ipmihash->{$host_node}->[0]->{password};
xCAT::MsgUtils->message("S", "Discovery info: configure password for pbmc_node:$pbmc_node.");
`rspconfig $pbmc_node password=$new_bmc_password`;
#if ($new_bmc_password) {
# xCAT::Utils->runxcmd(
# {
# command => ["rspconfig"],
# node => ["$pbmc_node"],
# arg => [ "password=$new_bmc_password" ],
# },
# $subreq, 0,1);
# if ($::RUNCMD_RC != 0) {
# xCAT::MsgUtils->message("S", "Discovery Error: configure password failed for FSP.");
# return;
# }
#}
xCAT::MsgUtils->message("S", "Discover info: configure ip:$new_bmc_ip for pbmc_node:$pbmc_node.");
`rspconfig $pbmc_node ip=$new_bmc_ip`;
#if($new_bmc_ip) {
# xCAT::Utils->runxcmd(
# {
# command => ["rspconfig"],
# node => ["$pbmc_node"],
# arg => [ "ip=$new_bmc_ip" ],
# },
# $subreq, 0,1);
# if ($::RUNCMD_RC != 0) {
# xCAT::MsgUtils->message("S", "Discovery Error: configure IP address failed for FSP.");
# return;
# }
#}
xCAT::MsgUtils->message("S", "Discovery info: remove pbmc_node:$pbmc_node.");
`rmdef $pbmc_node`;
#xCAT::Utils->runxcmd(
# {
# command => ["rmdef"],
# node => ["$pbmc_node"],
# },
# $subreq, 0,1);
}
}
1;

View File

@ -103,7 +103,7 @@ else # assume Linux
fi
if [ ! -e $gpfsprofile.sh ]; then
echo 'export PATH=$PATH:/usr/lpp/mmfs/bin' > $gpfsprofile.sh
echo 'setenv PATH $PATH:/usr/lpp/mmfs/bin' > $gpfsprofile.csh
echo 'setenv PATH ${PATH}:/usr/lpp/mmfs/bin' > $gpfsprofile.csh
# Turn off LANG support since we did not install other msg catalogs
echo 'export LC_CTYPE=POSIX' >> $gpfsprofile.sh
echo 'setenv LC_CTYPE POSIX' >> $gpfsprofile.csh

View File

@ -1,2 +0,0 @@
xcat-openstack-baremetal_2.8.4-1_all.deb admin extra
xcat-openstack-baremetal_2.8.4-1_all.deb admin extra

View File

@ -1,201 +0,0 @@
dh_installdirs
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb

View File

@ -322,6 +322,7 @@ if (
'k|kitversion=s' => \$::KITVERSION,
'r|kitrelease=s' => \$::KITRELEASE,
'l|kitloc=s' => \$::KITLOC,
'for=s' => \$::FOROSVERSARCH,
)
)
{
@ -337,11 +338,26 @@ if ($::HELP)
}
my $debianflag = 0;
my $dpkg_flag = '-uc -us';
my $tempstring = xCAT::BuildKitUtils->osver();
if ( $tempstring =~ /debian/ || $tempstring =~ /ubuntu/ ){
$debianflag = 1;
}
# This is an undocumented flag to support our local build team
# to allow building Ubuntu kits on our RH build machines.
# It requires RH rpms such as dep, fakeroot, perl-File-DesktopEntry,
# perl-File-BaseDir, and html2text to be installed on the build server
# for this to work. To use this flag:
# buildkit --for ubuntu buildrepo <reponame>
# buildkit --for ubuntu buildtar
if ($::FOROSVERSARCH) {
if ( $::FOROSVERSARCH =~ /debian/ || $::FOROSVERSARCH =~ /ubuntu/ ) {
$debianflag=1;
$dpkg_flag .= ' -A -d';
}
}
# display the version statement if -v or --version is specified
if ($::VERSION)
{
@ -764,20 +780,21 @@ sub kit_buildrepo1
}
}
# Build kitcomponent metapackages
# Build kitcomponent preppackages and metapackages
if ( $debianflag ){
foreach my $kc (@{$::bldkit_config->{kitcomponent}{entries}}) {
if ($repoid ne $kc->{kitrepoid}) { next; }
my $debname = "$repodir/".&comppkgname($kc);
if (-r $debname) { next; }
if ($::VERBOSE) { print "building kitcomponent metapackage for $kc->{basename} \n";}
if ($::VERBOSE) { print "building kitcomponent package for $kc->{basename} \n";}
if (&build_kitcomp_debian($kc)) {
print "Error building kitcomponent metapackage for $kc->{basename} \n";
return 1;
}
}
if ( system("cd $repo;dpkg-scanpackages . > Packages") ) {
print "Error building the repository meta-data with the dpkg-scanpackages command \n";
if ( system("cd $repodir;dpkg-scanpackages . > Packages") ) {
print "Error building the repository meta-data with the dpkg-scanpackages command \n";
return 1;
}
}
@ -1005,7 +1022,7 @@ sub kit_buildtar
}
}
print "Creating tar file $tarfile.\n";
print "Creating tar file $::current_dir/$kitfilename.\n";
if ( system("cd $::deploy_dir; cd ..; tar -cjhf $tarfile $kitname/*") ) {
print "Error building tarfile $tarfile \n";
@ -1145,6 +1162,7 @@ sub edit_bldkitconf
my ($osbasename,$osmore) = split(/\,/, $osinfo);
my ($osmajorversion,$osminorversion) = split(/\./, $osmore);
my $osarch=`uname -p`;
my $kitcomponent_basename = $kitname."_compute";
if ($debianflag==1) {
@ -1872,6 +1890,12 @@ sub validate_os
my ($osmajorversion,$osminorversion) = split(/\./, $osmore);
my $osarch=`uname -p`;
chomp($osarch);
if ($debianflag==1) {
if($osarch == "ppc64le"){
$osarch="ppc64el";
}
}
$osinfo =~ s/\,//;
my $repo_osinfo = "$repo->{osbasename}$repo->{osmajorversion}";
if (defined($repo->{osminorversion})){
@ -2414,14 +2438,45 @@ sub build_kitcomp_debian{
}
}
#run the dpkg-buildpackage command
my $curdir = $::workdir;
my $cmd = "rm -Rf $debbuilddir";
system($cmd);
mkpath($debbuilddir);
#Create debian directory for this kit component
if ( &gen_kitcomp_debdir($comp,\%repo) ) { return 1; }
$::VALID_PREP_COMPONENT = 0;
if ( !$::PREREQUISITE ) {
if ( $comp->{ospkgdeps} || $comp->{preinstall} || $comp->{preupgrade} || $comp->{preuninstall} ) {
#Create debian directory for this kit component preppackage
if ( &gen_kitcomp_debdir_prep($comp,\%repo) ) { return 1; }
$::VALID_PREP_COMPONENT = 1;
# build prep deb
my $prep_compversion = $comp->{version} . "-" . $comp->{release};
my $prep_buildstring = "Prep Kit component build package.";
my $prep_debbuilddir = $::workdir."/debbuild/"."prep-".$comp->{kitcompname};
my $prep_debianbuildcmd = "cd $prep_debbuilddir;debchange -v $prep_compversion -b -c debian/changelog $prep_buildstring;dpkg-buildpackage $dpkg_flag";
if ( system($prep_debianbuildcmd) ) {
print "Error running \"dpkg-buildpackage $dpkg_flag\" command for kit component prep-$comp->{kitcompname} meta package\n";
return 1;
}
}
#Create debian directory for this kit component metapackage
if ( &gen_kitcomp_debdir($comp,\%repo,'METADEB') ) { return 1; }
} else {
#Create debian directory for this kit component
if ( &gen_kitcomp_debdir($comp,\%repo,'ALL') ) { return 1; }
}
if (defined($comp->{non_native_pkgs}) ) {
my $sourcedir = $::workdir."/source_packages";
@ -2443,11 +2498,11 @@ sub build_kitcomp_debian{
}
}
my $compversion = $comp->{version} . "-" . $comp->{release};
my $buildstring = "Kit component build package.";
my $debianbuildcmd = "cd $debbuilddir;dch -v $compversion -b -c debian/changelog $buildstring;dpkg-buildpackage -uc -us";
my $buildstring = "\'Kit component build package.\'";
my $debianbuildcmd = "cd $debbuilddir;debchange -v $compversion -b -c debian/changelog $buildstring;dpkg-buildpackage $dpkg_flag";
if ( !$::NON_NATIVE_PKGS->{$comp->{kitcompname}} ) {
if ( system($debianbuildcmd) ) {
print "Error running \"dpkg-buildpackage -uc -us\" command for kit component $comp->{kitcompname} meta package\n";
print "Error running \"dpkg-buildpackage $dpkg_flag\" command for kit component $comp->{kitcompname} meta package\n";
return 1;
}
my $repodir = $::base_repodir."/".$repo{kitreponame};
@ -2463,6 +2518,99 @@ sub build_kitcomp_debian{
return 0;
}
#-----------------------------------------------------------------------------
=head3 gen_kitcomp_debdir_prep
=cut
#-----------------------------------------------------------------------------
sub gen_kitcomp_debdir_prep{
my $comp = shift;
my $repo = shift;
my $scriptdir = $::workdir."/scripts/";
my $combuilddir = $::workdir."/debbuild/"."prep-".$comp->{kitcompname};
#copy the debian dir template to the build path
mkpath("$combuilddir/debian");
my $cmd = "cp -Rf " . $::XCATSHARE . "/kits/debian_template/* $combuilddir/debian/";
system($cmd);
my $kitname = $::bldkit_config->{kit}{entries}[0]->{basename};
my $kitcompname = "prep-".$comp->{kitcompname};
my $upgradeflag = "pre-".$comp->{basename} . ".tmp";
my ($prescript,$postscript,$preupscript,$postupscript,$preunscript,$postunscript,$nonnativepkgs) = '';
if (defined($comp->{preinstall})) {
$prescript = &load_script("$scriptdir$comp->{preinstall}");
}
if (defined($comp->{preupgrade})) {
$preupscript = &load_script("$scriptdir$comp->{preupgrade}");
}
if (defined($comp->{preuninstall})) {
$preunscript = &load_script("$scriptdir$comp->{preuninstall}");
}
#replace all special sub string in all files under debian
unless (opendir(DH, "${combuilddir}/debian/")){
print "Can not open the xCAT Kit Component debian dir: ${combuilddir}/debian/";
return 1;
}
foreach (readdir(DH)){
my $file = "${combuilddir}/debian/$_";
if ( -d $file){
next;
}
unless ( open ( FH, "<", $file )){
print "Error attempting to open the xCAT Kit Component ${kitcompname}'s debian template file $file.\n";
close(DH);
return 1;
}
if ($::VERBOSE){
print "Reading the xCAT Kit Component ${kitcompname}'s debian template file $file. \n";
}
my @lines = <FH>;
close(FH);
my $prep_comp_name="prep-".$comp->{basename};
for(@lines) {
chomp;
s/<<<INSERT_kitcomponent_basename_HERE>>>/$prep_comp_name/;
s/<<<INSERT_kitcomponent_ospkgdeps_HERE>>>/$comp->{ospkgdeps}/;
s/<<<INSERT_kitcomponent_kitpkgdeps_HERE>>>//;
s/<<<INSERT_kitcomponent_kitcompdeps_HERE>>>//;
s/<<<INSERT_kitcomponent_desc_HERE>>>/$comp->{description}/;
s/<<<INSERT_kitcomponent_upgrade_flag_HERE>>>/$upgradeflag/;
s/<<<INSERT_kitcomponent_preinstall_script_HERE>>>/$prescript/;
s/<<<INSERT_kitcomponent_postinstall_script_HERE>>>//;
s/<<<INSERT_kitcomponent_preupgrade_script_HERE>>>/$preupscript/;
s/<<<INSERT_kitcomponent_postupgrade_script_HERE>>>//;
s/<<<INSERT_kitcomponent_preuninstall_script_HERE>>>/$preunscript/;
s/<<<INSERT_kitcomponent_postuninstall_script_HERE>>>//;
}
my $joined_lines = join("\n", @lines);
@lines = split(/\\n/,$joined_lines);
open (FH, ">", $file);
if ($::VERBOSE){
print "Created kitcomponent ${kitcompname}'s build file under debian dir $file";
}
print FH @lines;
close(FH);
}
closedir(DH);
return 0;
}
#-----------------------------------------------------------------------------
=head3 gen_kitcomp_debdir
@ -2475,6 +2623,7 @@ sub build_kitcomp_debian{
sub gen_kitcomp_debdir{
my $comp = shift;
my $repo = shift;
my $level = shift;
my $scriptdir = $::workdir."/scripts/";
my $combuilddir = $::workdir."/debbuild/".$comp->{kitcompname};
@ -2488,29 +2637,38 @@ sub gen_kitcomp_debdir{
my $upgradeflag = $comp->{basename} . ".tmp";
my ($prescript,$postscript,$preupscript,$postupscript,$preunscript,$postunscript,$nonnativepkgs) = '';
if (defined($comp->{preinstall})) {
$prescript = &load_script("$scriptdir$comp->{preinstall}");
}
if (defined($comp->{postinstall})) {
$postscript = &load_script("$scriptdir$comp->{postinstall}");
}
if (defined($comp->{preupgrade})) {
$preupscript = &load_script("$scriptdir$comp->{preupgrade}");
}
if (defined($comp->{postupgrade})) {
$postupscript = &load_script("$scriptdir$comp->{postupgrade}");
}
if (defined($comp->{preuninstall})) {
$preunscript = &load_script("$scriptdir$comp->{preuninstall}");
}
if (defined($comp->{postuninstall})) {
$postunscript = &load_script("$scriptdir$comp->{postuninstall}");
}
if (defined($comp->{non_native_pkgs})) {
$nonnativepkgs = "\n";
$nonnativepkgs .= "mkdir -p \$RPM_BUILD_ROOT/opt/xcat/kits/$kitname/$kitcompname \n";
$nonnativepkgs .= "cp -a * \$RPM_BUILD_ROOT/opt/xcat/kits/$kitname/$kitcompname \n";
if ($level eq 'METADEB' || $level eq 'ALL')
{
if (defined($comp->{postinstall})) {
$postscript = &load_script("$scriptdir$comp->{postinstall}");
}
if (defined($comp->{postupgrade})) {
$postupscript = &load_script("$scriptdir$comp->{postupgrade}");
}
if (defined($comp->{postuninstall})) {
$postunscript = &load_script("$scriptdir$comp->{postuninstall}");
}
if (defined($comp->{non_native_pkgs})) {
$nonnativepkgs = "\n";
$nonnativepkgs .= "mkdir -p \$RPM_BUILD_ROOT/opt/xcat/kits/$kitname/$kitcompname \n";
$nonnativepkgs .= "cp -a * \$RPM_BUILD_ROOT/opt/xcat/kits/$kitname/$kitcompname \n";
}
}
if ($level eq 'ALL')
{
if (defined($comp->{preinstall})) {
$prescript = &load_script("$scriptdir$comp->{preinstall}");
}
if (defined($comp->{preupgrade})) {
$preupscript = &load_script("$scriptdir$comp->{preupgrade}");
}
if (defined($comp->{preuninstall})) {
$preunscript = &load_script("$scriptdir$comp->{preuninstall}");
}
}
#replace all special sub string in all files under debian
unless (opendir(DH, "${combuilddir}/debian/")){
@ -2535,12 +2693,20 @@ sub gen_kitcomp_debdir{
}
my @lines = <FH>;
close(FH);
my $prepcomp="prep-".$comp->{basename};
for(@lines) {
chomp;
s/<<<INSERT_kitcomponent_basename_HERE>>>/$comp->{basename}/;
s/<<<INSERT_kitcomponent_ospkgdeps_HERE>>>/$comp->{ospkgdeps}/;
s/<<<INSERT_kitcomponent_kitpkgdeps_HERE>>>/$comp->{kitpkgdeps}/;
s/<<<INSERT_kitcomponent_kitcompdeps_HERE>>>/$comp->{kitcompdeps}/;
if ( $::VALID_PREP_COMPONENT ) {
s/<<<INSERT_kitcomponent_kitcompdeps_HERE>>>/$comp->{kitcompdeps},$prepcomp/;
}
else
{
s/<<<INSERT_kitcomponent_kitcompdeps_HERE>>>/$comp->{kitcompdeps}/;
}
s/<<<INSERT_kitcomponent_desc_HERE>>>/$comp->{description}/;
s/<<<INSERT_kitcomponent_upgrade_flag_HERE>>>/$upgradeflag/;
s/<<<INSERT_kitcomponent_preinstall_script_HERE>>>/$prescript/;
@ -2689,8 +2855,13 @@ sub create_kitconf
$::kit_config->{$s}{entries}[$li]->{kitreponame} =
$se->{kitreponame};
if ( !$::PREREQUISITE and ($se->{ospkgdeps} || $se->{preinstall} || $se->{preupgrade} || $se->{preuninstall}) ) {
$::kit_config->{$s}{entries}[$li]->{prerequisite} =
if ( $debianflag ){
$::kit_config->{$s}{entries}[$li]->{prerequisite} =
"prep-" . $se->{basename};
}else{
$::kit_config->{$s}{entries}[$li]->{prerequisite} =
"prep_" . $se->{basename};
}
}
}
$li++;
@ -3408,7 +3579,7 @@ sub kit_addpkgs
#for debian/ubuntu
my $repodir = $tmpdir . "/repos/".$non_native_kitreponame;
if ( $debianflag ){
my $debbuildcmd = "cd $source_dir;dpkg-buildpackage -uc -us";
my $debbuildcmd = "cd $source_dir;dpkg-buildpackage $dpkg_flag";
if ( system($debbuildcmd) ){
print "error running debian build cmd for kit component $non_native_basename meta package.\n";
return 1;
@ -3594,9 +3765,13 @@ sub NEW_kit_addpkgs
if ($kp->{isexternalpkg} eq 'yes') {
my $ext_filename = $kp->{filename};
my $ext_reponames = $kp->{kitreponame};
my $files = xCAT::BuildKitUtils->find_latest_pkg(\@pkgdirlist, $ext_filename);
my $files;
if($debianflag){
$files = xCAT::BuildKitUtils->find_latest_pkg_deb(\@pkgdirlist, $ext_filename);
}
else {
$files = xCAT::BuildKitUtils->find_latest_pkg(\@pkgdirlist, $ext_filename);
}
if (!defined($files) ) {
print "Error: The product package file $ext_filename was not found in the package directory(s) @pkgdirlist.\n";
# Cleanup

View File

@ -134,6 +134,87 @@ sub get_latest_version
}
}
#--------------------------------------------------------------------------
=head3 get_latest_version_deb
Find the latest version in a list of debs with the same basename
Arguments:
- the repo location
- a list of debs with the same basename
Returns:
- name of deb
- undef
Example:
my $new_d = xCAT::BuildKitUtils->get_latest_version($repodir, \@rpmlist);
Comments:
=cut
#--------------------------------------------------------------------------
sub get_latest_version_deb
{
my ($class, $repodir, $debs) = @_;
my @deblist = @$debs;
my %localversions_hash = ();
my $file_name;
my %founddeb;
my $latest;
my $i = 0;
foreach my $deb (@deblist)
{
# include path
my $fulldebpath = "$repodir/$deb*";
chomp $deb;
# get the basename, version, and release for this deb
print "dpkg -I $repodir/$deb |grep Package|awk '{print \$2}'";
my $basenamedeb = `dpkg -I $repodir/$deb |grep Package|awk '{print \$2}'`;
chomp $basenamedeb;
my $versiondeb = `dpkg -I $repodir/$deb |grep Version|awk '{print \$2}'`;
chomp $versiondeb;
$founddeb{$basenamedeb}{$deb}{version}=$versiondeb;
$i++;
}
if ($i == 0)
{
print "error\n";
return undef;
}
foreach my $r (keys %founddeb ) {
# if more than one with same basename then find the latest
my $latestmatch="";
foreach my $fdeb (keys %{$founddeb{$r}} ) {
# if we already found a match in some other dir
if ($latestmatch) {
# then we need to figure out which is the newest
# if the $fdeb is newer than use iti
if ( ! xCAT::BuildKitUtils->testVersion_deb($founddeb{$r}{$fdeb}{version}, 'gt', $founddeb{$r}{$latestmatch}{version}) ) {
$latestmatch = $fdeb;
}
} else {
$latestmatch = $fdeb;
}
}
$latest=$latestmatch;
}
if ($i == 0)
{
print "Error: Could not determine the latest version for the following list of debs: @deblist\n";
return undef;
} else {
return ($latest);
}
}
#--------------------------------------------------------------------------
=head3 find_latest_pkg
@ -160,6 +241,7 @@ sub find_latest_pkg
my @rpms;
my %foundrpm;
# need to check each pkgdir for the rpm(s)
# - if more than one match need to pick latest
# find all the matches in all the directories
@ -223,6 +305,128 @@ sub find_latest_pkg
}
}
#--------------------------------------------------------------------------
=head3 find_latest_pkg_deb
Find the latest deb package give the deb name and a list of
possible package locations.
Arguments:
- a list of package directories
- the name of the deb
Returns:
- \@founddeblist
- undef
Example:
my $newrpm = xCAT::BuildKitUtils->find_latest_pkg_deb(\@pkgdirs, $debname);
Comments:
=cut
#--------------------------------------------------------------------------
sub find_latest_pkg_deb
{
my ($class, $pkgdirs, $debname) = @_;
my @pkgdirlist = @$pkgdirs;
my @debs;
my %founddeb;
# need to check each pkgdir for the deb(s)
# - if more than one match need to pick latest
# find all the matches in all the directories
foreach my $debdir (@pkgdirlist) {
my $ffile = $debdir."/".$debname;
if ( system("/bin/ls $ffile > /dev/null 2>&1") ){
# if not then skip to next dir
next;
} else {
# if so then get the details and add it to the %founddeb hash
my $cmd = "/bin/ls $ffile 2>/dev/null";
my $output = `$cmd`;
my @deblist = split(/\n/, $output);
if ( scalar(@deblist) == 0) {
next;
}
foreach my $r (@deblist) {
my $basename = `dpkg -I $r* |grep Package|awk '{print \$2}'`;
chomp $basename;
my $version = `dpkg -I $r* |grep Version|awk '{print \$2}'`;
chomp $version;
$founddeb{$basename}{$r}{version}=$version;
}
}
}
# for each unique deb basename
foreach my $r (keys %founddeb ) {
# if more than one with same basename then find the latest
my $latestmatch="";
foreach my $fdeb (keys %{$founddeb{$r}} ) {
# if we already found a match in some other dir
if ($latestmatch) {
# then we need to figure out which is the newest
# if the $fdeb is newer than use it
if ( ! xCAT::BuildKitUtils->testVersion_deb($founddeb{$r}{$fdeb}{version}, 'gt', $founddeb{$r}{$latestmatch}{version}) ) {
$latestmatch = $fdeb;
}
} else {
$latestmatch = $fdeb;
}
}
push(@debs, $latestmatch);
}
if (scalar(@debs)) {
return \@debs;
} else {
return undef;
}
}
#------------------------------------------------------------------------------
=head3 testVersion_deb
Compare version1 and version2 according to the operator and
return 1 0 or 0.
Arguments:
$version1
$operator
$version2
Returns:
1 or 0
Example:
Comments:
The return value is generated with the Require query
=cut
#-----------------------------------------------------------------------------
sub testVersion_deb
{
my ($class, $version1, $operator, $version2) = @_;
if ($::VERBOSE) {
print "dpkg --compare-versions $version1 $operator $version2 \n";
}
my $result =`dpkg --compare-versions $version1 $operator $version2`;
return $result;
}
#------------------------------------------------------------------------------

View File

@ -17,10 +17,12 @@ set -e
case "$1" in
install)
<<<INSERT_kitcomponent_preinstall_script_HERE>>>
echo "preinstall processing"
;;
upgrade)
if [ -f /tmp/<<<INSERT_kitcomponent_upgrade_flag_HERE>>> ]; then
echo "preupgrade processing"
<<<INSERT_kitcomponent_preupgrade_script_HERE>>>
fi
;;

View File

@ -1,3 +1,21 @@
#!/bin/sh
echo "running sample-comp1 genimage_post script"
rpmdir="/opt/xcat/kits/<<<buildkit_WILL_INSERT_kit_basename_HERE>>>/<<<buildkit_WILL_INSERT_kitcomponent_name_HERE>>>"
if [[ ! -z "$installroot" ]]; then
if [ -n "`ls $installroot$rpmdir/*.deb 2> /dev/null`" ] ; then
dpkg -i --force-all --instdir=$installroot $installroot$rpmdir/*.deb
elif [ -n "`ls $installroot$rpmdir/*.rpm 2> /dev/null`" ] ; then
rpm --force --root $installroot -Uvh $installroot$rpmdir/*.rpm
fi
else
if [ -n "`ls $rpmdir/*.deb 2> /dev/null`" ] ; then
dpkg -i --force-all $rpmdir/*.deb
elif [ -n "`ls $rpmdir/*.rpm 2> /dev/null`" ] ; then
rpm --force -Uvh $rpmdir/*.rpm
fi
fi
exit 0

View File

@ -6,13 +6,15 @@ B<configfpc> - discover the Fan Power Controllers (FPCs) and configure the FPC i
B<configfpc> B<-i> I<interface>
B<configfpc> B<-i> I<interface> B<--ip> I<default ip address>
B<configfpc> [B<-V>|B<--verbose>]
B<configfpc> [B<-h>|B<--help>|B<-?>]
=head1 DESCRIPTION
B<configfpc> will discover and configure all FPCs that are set to the default IP address.
B<configfpc> will discover and configure all FPCs that are set to the default IP address. If not supplied the default ip is 192.168.0.100.
The B<-i> B<interface> is required to direct B<configfpc> to the xCAT MN interface which is on the same VLAN as the FPCs.
@ -24,7 +26,7 @@ The B<configfpc> command discovers the FPCs and collects the MAC address. The MA
This process is repeated until no more FPCs are discovered.
For more information on xCAT support of NeXtScale and configfpc see:
For more information on xCAT support of NeXtScale and configfpc see the following doc:
XCAT_NeXtScale_Clusters
=head1 OPTIONS
@ -35,6 +37,10 @@ XCAT_NeXtScale_Clusters
Use this flag to specify which xCAT MN interface (example: eth4) that is connected to the NeXtScale FPCs. This option is required.
=item B<--ip> I<default ip address>
Use this flag to override the default ip address of 192.168.0.100 with a new address.
=item B<-V>|B<--verbose>
Verbose mode
@ -51,5 +57,11 @@ To discover and configure all NeXtScale Fan Power Controllers (FPCs) connected o
B<configfpc> B<-i> I<eth0>
=item 2
To override the default ip address and run in Verbose mode.
B<configfpc> B<-i> I<eth0> B<--ip> I<196.68.0.100> B<-V>
=back

View File

@ -51,6 +51,8 @@ if [ "$HOSTOS" = "mcp" ]; then
sed -i 's/\/etc\/redhat-release/\/etc\/base-release \/etc\/system-release/' $DRACUTMODDIR/install
sed -i 's/btrfs//' $DRACUTMODDIR/installkernel
sed -i 's/\/usr\/bin\/basename/\/bin\/basename/' $DRACUTMODDIR/install
# these are needed for sysclone, but are not yet in mcp
sed -i 's/ bc//' $DRACUTMODDIR/install
sed -i 's/ mkdosfs//' $DRACUTMODDIR/install
@ -58,6 +60,10 @@ if [ "$HOSTOS" = "mcp" ]; then
sed -i 's/ kexec//' $DRACUTMODDIR/install
sed -i 's/ klogd//' $DRACUTMODDIR/install
sed -i 's/ mdadm//' $DRACUTMODDIR/install
sed -i 's/ mkfs\.xfs//' $DRACUTMODDIR/install
sed -i 's/ xfs_db//' $DRACUTMODDIR/install
sed -i 's/ mkreiserfs//' $DRACUTMODDIR/install
sed -i 's/ reiserfstune//' $DRACUTMODDIR/install
# These timezone files are not available in the latest mcp build
sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Asia\/Riyadh87//' $DRACUTMODDIR/install

View File

@ -4,14 +4,14 @@ dracut_install wget openssl tar mstflint ipmitool cpio gzip lsmod ethtool modpro
dracut_install netstat # broadcom update requires
dracut_install uniq # mellanox update requires
dracut_install grep ip hostname /usr/bin/awk egrep grep dirname expr
dracut_install mount.nfs sshd vi reboot lspci parted screen mkfs mkfs.ext4 #mkfs.btrfs removed
dracut_install mount.nfs sshd vi reboot lspci parted screen mkfs mkfs.ext4 mkfs.xfs xfs_db #mkfs.btrfs removed
dracut_install efibootmgr
#dracut_install libvirtd /usr/share/libvirt/cpu_map.xml /usr/bin/qemu-img /usr/libexec/qemu-kvm
dracut_install mkswap df brctl vconfig ifenslave ssh-keygen scp clear dhclient lldpad
dracut_install lldptool /lib64/libnss_dns-2.12.so /lib64/libnss_dns.so.2
dracut_install poweroff ntpq ntpd hwclock date /usr/share/terminfo/x/xterm /usr/share/terminfo/s/screen /etc/nsswitch.conf /etc/services
dracut_install /sbin/rsyslogd /etc/protocols umount /bin/rpm /usr/lib/rpm/rpmrc
dracut_install chmod /lib/libc.so.6 /lib/ld-linux.so.2 /lib/libdl.so.2 /lib/libm.so.6 /sbin/route /sbin/ifconfig /usr/bin/head /etc/redhat-release ping tr lsusb /usr/share/hwdata/usb.ids #ibm fw wrapper requirements
dracut_install chmod /lib/libc.so.6 /lib/ld-linux.so.2 /lib/libdl.so.2 /lib/libm.so.6 /sbin/route /sbin/ifconfig /usr/bin/whoami /usr/bin/head /usr/bin/tail /usr/bin/basename /etc/redhat-release ping tr lsusb /usr/share/hwdata/usb.ids #ibm fw wrapper requirements
dracut_install dmidecode /usr/lib64/libstdc++.so.6 #uxspi prereqs, but will use dmidecode to improve decision on loading ipmi_si
dracut_install dmidecode /usr/lib64/libstdc++.so.5 #broadcom firmware update links against old lib
dracut_install /lib/libpthread.so.0 #32 bit lib because UXSPI will not ship a native 64 bit build

View File

@ -1,6 +1,6 @@
#!/bin/bash
instmods nfs sunrpc
instmods e1000 e1000e virtio_net igb ines sfc mlx4_en cxgb3 cxgb4 tg3 bnx2 bnx2x bna ixgb ixgbe qlge mptsas mpt2sas mpt3sas ata_piix megaraid_sas virtio_blk ahci ibmaem xhci-hcd sd_mod pmcraid be2net vfat ext3 ext4 btrfs reiserfs usb_storage scsi_wait_scan kvm kvm-intel kvm-amd ipmi_si ipmi_devintf qlcnic
instmods e1000 e1000e virtio_net igb ines sfc mlx4_en cxgb3 cxgb4 tg3 bnx2 bnx2x bna ixgb ixgbe qlge mptsas mpt2sas mpt3sas ata_piix megaraid_sas virtio_blk ahci ibmaem xhci-hcd sd_mod pmcraid be2net vfat ext3 ext4 btrfs reiserfs usb_storage scsi_wait_scan kvm kvm-intel kvm-amd ipmi_si ipmi_devintf qlcnic xfs
instmods macvlan macvtap 8021q bridge bonding vmxnet3 cpufreq_ondemand acpi-cpufreq powernow-k8 cdc_ether
instmods mptctl #LSI firmware management requires this
instmods mlx4_ib ib_umad #make the mellanox ib available enough to examine /sys

View File

@ -1,4 +1,4 @@
%define version 2.8
%define version 2.9
%ifarch i386 i586 i686 x86
%define tarch x86
%endif

View File

@ -387,6 +387,21 @@ if [ ! "$IPMIVER" == "1.5" ]; then
if [ $TRIES -gt $TIMEOUT ]; then echo "ERROR"; else echo "OK"; fi
fi
# Reset the BMC for the x3755 M4 (8722), otherwise the BMC will not be pingable after running of bmcsetup
XPROD=`ipmitool mc info|grep "^Product ID"|awk '{print $4}'`
if [ "$XPROD" = "309" ] ; then
echo "Resetting BMC ..."
ipmitool mc reset cold
echo "Waiting for the BMC to appear ..."
sleep 15
TRIES=0
while ! ipmitool lan print $LANCHAN > /dev/null; do
sleep 3
let TRIES=TRIES+1
if [ $TRIES -gt $TIMEOUT ]; then break; fi
done
fi
# update the node status to 'bmcready'
for parm in `cat /proc/cmdline`; do
key=`echo $parm|awk -F= '{print $1}'`

View File

@ -135,7 +135,8 @@ fi
#so we have some cases where DMI table explictly records every function number, and some where only first function is enumerated
#so for each onboard device, we record it. If it is also the first function, we'll seek out other function numbers and append
#if that other function number does not show up in its own dmi type 41 record
for onboard in `dmidecode -t 41|egrep '(Type:|Bus Address)'|grep -A1 Ethernet|grep -v Ethernet|sed -e 's/.*Address: //'`; do
if [ -f "/usr/sbin/dmidecode" ]; then
for onboard in `dmidecode -t 41|egrep '(Type:|Bus Address)'|grep -A1 Ethernet|grep -v Ethernet|sed -e 's/.*Address: //'`; do
obdevs=("${obdevs[@]}" $onboard)
if [ ${onboard#*.}=0 ]; then
truncslot=${onboard%.*}
@ -145,8 +146,8 @@ for onboard in `dmidecode -t 41|egrep '(Type:|Bus Address)'|grep -A1 Ethernet|gr
fi
done
fi
done
done
fi
#TODO: downed nics, also examine /sys/bus/pci/*/ for more network class devices that might not have driver suppert
for dev in `ip link|grep -B1 ether|grep UP|awk '{print $2}'|sed -e s/://|grep -v usb0`; do
FIRMDESC=""
@ -155,7 +156,7 @@ for dev in `ip link|grep -B1 ether|grep UP|awk '{print $2}'|sed -e s/://|grep -v
PCI_SLOT=`grep PCI_SLOT_NAME /sys/class/net/$dev/device/uevent|awk -F= '{print $2}'`
ADDRESS=`ip address show dev $dev|grep "inet "|grep global|awk '{print $2}'`
MAC=`ip link show dev $dev|grep ether|awk '{print $2}'| tr /a-f/ /A-F/`
if [ ! -z "$PCI_SLOT" ]; then
if [[ ! -z "$PCI_SLOT" && -f "/usr/sbin/dmidecode" ]]; then
SLOTNAME=`dmidecode -t 9|egrep '(Designation|Address)'|grep -B1 $PCI_SLOT|grep Designation|sed -e 's/.*Designation:[ ]*//'`
if [ -z "$SLOTNAME" ]; then #check for on board device
index=1

View File

@ -59,7 +59,7 @@ echo "Done"
PUBKEY=`openssl rsa -in /etc/xcat/privkey.pem -pubout 2> /dev/null|grep -v "PUBLIC KEY"`
PUBKEY=`echo $PUBKEY|sed -e 's/ //g'`
export PUBKEY
/sbin/rsyslogd -c4
/sbin/rsyslogd -4
mkdir -p /var/lib/lldpad
echo 'lldp :' >> /var/lib/lldpad/lldpad.conf
echo '{' >> /var/lib/lldpad/lldpad.conf
@ -146,10 +146,24 @@ if [[ -n $hostip && -n $netmask && -n $gateway && -n $bootnic ]]; then
else
echo "Setting IP via DHCP..."
# This section is for System P hardware discovery, which won't have a BOOTIF value set
tries=0
while [ $tries -lt 5 ]; do
if [ -z "$bootnic" ]; then
ALLUP_NICS=`ip link show | grep -v "^ " | grep "state UP" | awk '{print $2}' | sed -e 's/:$//'|grep -v lo`
for tmp1 in $ALLUP_NICS; do
bootnic=$tmp1
break
done
else
break
fi
sleep 2
tries=$(($tries+1))
done
if [ -z "$bootnic" ]; then
ALLUP_NICS=`ip link show | grep -v "^ " | grep "state UP" | awk '{print $2}' | sed -e 's/:$//'|grep -v lo`
for tmp1 in $ALLUP_NICS; do
bootnic=$tmp1
ALL_NICS=`ip link show | grep -v "^ " | awk '{print $2}' | sed -e 's/:$//' | grep -v lo`
for tmp in $ALL_NICS; do
bootnic=$tmp
break
done
fi
@ -185,6 +199,13 @@ ntpd -g -x
# rv 0 state does not work with the new ntp versions
#(while ! ntpq -c "rv 0 state"|grep 'state=4' > /dev/null; do sleep 1; done; hwclock --systohc) &
(while [ "`ntpq -c \"rv 0 offset\" | grep \"offset=\" | awk -F \"=\" '{print $2}' | awk -F \".\" '{print $1}' | sed s/-//`" -ge 1000 ]; do sleep 1; done; hwclock --systohc) &
IPMI_ERROR=`ipmitool mc info`
IPMI_RC=$?
IPMI_SUPPORT=1
if [ $IPMI_RC -ne 0 ]; then
IPMI_SUPPORT=0
fi
if [ -f "/usr/sbin/dmidecode" ]; then
if dmidecode|grep IPMI > /dev/null; then
modprobe ipmi_si
@ -253,10 +274,14 @@ while :; do
cd -
elif [ "$dest" = "reboot" -o "$dest" = "boot" ]; then
/bin/nextdestiny $XCATMASTER:$XCATPORT
ipmitool chassis bootdev pxe
if [ $IPMI_SUPPORT -ne 0 ]; then
ipmitool chassis bootdev pxe
fi
reboot -f
elif [ "$dest" = "install" -o "$dest" = "netboot" ]; then
ipmitool chassis bootdev pxe
if [ $IPMI_SUPPORT -ne 0 ]; then
ipmitool chassis bootdev pxe
fi
reboot -f
elif [ "$dest" = sysclone ]; then
/bin/dosysclone

View File

@ -0,0 +1,29 @@
#!/bin/sh
SOURCE_FILE="pseries_platform"
PLATFORM_FILE=/proc/cpuinfo
export PLATFORM_UNKNOWN=0
export PLATFORM_POWERKVM_HOST=1
export PLATFORM_POWERKVM_GUEST=2
export PLATFORM_PSERIES_LPAR=3
export platform_name="Unknown"
export platform=$PLATFORM_UNKNOWN
if grep -q "PowerNV" $PLATFORM_FILE; then
platform_name="PowerKVM Host"
platform=$PLATFORM_POWERKVM_HOST
elif grep -q "IBM pSeries (emulated by qemu)" $PLATFORM_FILE; then
platform_name="PowerKVM pSeries Guest"
platform=$PLATFORM_POWERKVM_GUEST
elif grep -q "pSeries" $PLATFORM_FILE; then
platform_name="PowerVM pSeries LPAR"
platform=$PLATFORM_PSERIES_LPAR
fi
PARAM=$0
BASENAME=`basename $0`
echo "basename:$BASENAME, param:$PARAM"
if [ $SOURCE_FILE = `basename $0` ]; then
echo $platform_name
fi

View File

@ -0,0 +1,457 @@
#!/bin/sh
# Copyright (c) 2003, 2004, 2008 International Business Machines
# Common Public License Version 1.0 (see COPYRIGHT)
#
# Authors: John Rose <johnrose@us.ibm.com>
# Mike Strosaker <strosake@austin.ibm.com>
# Simple script to update flash. The kernel module rtas_flash does
# the real work at reboot time.
# This script has minimal dependencies so it can operate in a rescue
# environment. This is probably overkill since it is easy enough to
# flash without this script.
#set -x
# For now firmware can only handle 4k pages. At some point in the
# future they will be able to handle large pages. When that (hopefully)
# happens we will need to use getconf to retrieve the systems page size.
PAGE_SIZE=4096
# Error Codes
E_SUCCESS=0 # Success
E_UNSUPPORTED=1 # Flash update is not supported on this system
E_USAGE=3 # Usage error
E_PERM=4 # Permission error
E_IMAGE=5 # Image file error
E_PROC_FS=6 # Proc file either doesn't exist, or behaves unexpectedly
E_MODULE=7 # Error loading module
E_RTAS=8 # RTAS call failed
E_USER=9 # User aborted operation
E_OVERWRITE=10 # Auto overwrite permanent side image
E_WRNTY=15 # Update Access Key Expired
# Script Constants
PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
PROCFLASH=/proc/ppc64/rtas/firmware_update
PROCMANAGE=/proc/ppc64/rtas/manage_flash
PROCVALIDATE=/proc/ppc64/rtas/validate_flash
OLDPROCFLASH=/proc/ppc64/rtas/firmware_flash
PSERIES_PLATFORM=$(dirname $0)/pseries_platform
# firmware_update Status Values
FLASH_AUTH=-9002 # RTAS Not Service Authority Partition
FLASH_NO_OP=-1099 # No operation initiated by user
FLASH_IMG_SHORT=-1005 # Flash image shorter than expected
FLASH_IMG_BAD_LEN=-1004 # Bad length value in flash list block
FLASH_IMG_NULL_DATA=-1003 # Bad data value in flash list block
FLASH_IMG_READY=0 # Firmware img ready for flash on reboot
# manage_flash Status Values
MANAGE_AUTH=-9002 # RTAS Not Service Authority Partition
MANAGE_ACTIVE_ERR=-9001 # RTAS Cannot Overwrite Active Img
MANAGE_NO_OP=-1099 # No operation initiated by user
MANAGE_PARAM_ERR=-3 # RTAS Parameter Error
MANAGE_HW_ERR=-1 # RTAS Hardware Error
MANAGE_SUCCESS=0 # Operation Successful
# validate_flash Status Values
VALIDATE_AUTH=-9002 # RTAS Not Service Authority Partition
VALIDATE_INCOMPLETE=-1002 # User copied < VALIDATE_BUF_SIZE
VALIDATE_READY=-1001 # Firmware image ready for validation
VALIDATE_PARAM_ERR=-3 # RTAS Parameter Error
VALIDATE_HW_ERR=-1 # RTAS Hardware Error
VALIDATE_TMP_UPDATE=0 # RPA Section 7.3, Table 63
VALIDATE_FLASH_AUTH=1 # RPA Section 7.3, Table 63
VALIDATE_INVALID_IMG=2 # RPA Section 7.3, Table 63
VALIDATE_CUR_UNKNOWN=3 # RPA Section 7.3, Table 63
VALIDATE_TMP_COMMIT_DL=4 # RPA Section 7.3, Table 63
VALIDATE_TMP_COMMIT=5 # RPA Section 7.3, Table 63
VALIDATE_TMP_UPDATE_DL=6 # RPA Section 7.3, Table 63
VALIDATE_OUT_OF_WRNTY=7 # RPA Section 7.3, Table 63
error() {
local exit_code=$1
if [ $# -lt 1 ]; then
echo "error(): usage" >&2
return $E_USAGE
fi
shift;
echo update_flash: $* >&2
exit $exit_code
}
usage() {
local exit_code;
if [ "$1" == $E_SUCCESS ]; then
exit_code=$E_SUCCESS
else
exit_code=$E_USAGE
fi
echo "USAGE: update_flash {-h | -s | -r | -c | [-v|-n] -f <image filename>}" >&2
echo " -h Print this message." >&2
echo " -s Determine if partition has access to" >&2
echo " perform flash image management." >&2
echo " -r Reject temporary image." >&2
echo " -c Commit temporary image." >&2
echo " -v Validate ONLY with given image file." >&2
echo " -n Do not overwrite Permanent side" >&2
echo " image automatically." >&2
echo " -f <filename> Update with given image file. If possible," >&2
echo " the image is automatically validated prior" >&2
echo " to update." >&2
echo "" >&2
exit $exit_code
}
query_support() {
local exit_status=$E_UNSUPPORTED
if [ ! -r "$PROCVALIDATE" ]; then
modprobe rtas_flash || error $E_MODULE "could not load rtas_flash kernel module"
fi
if [ -e "/proc/device-tree/rtas/ibm,manage-flash-image" ]; then
grep \\"$VALIDATE_AUTH" "$PROCVALIDATE" > /dev/null
if [ $? -ne 0 ]; then
# validate-flash did not return "not authorized"
head --bytes=4k /dev/zero > $PROCVALIDATE 2>/dev/null
grep 1 "$PROCVALIDATE" > /dev/null
if [ $? -ne 0 ]; then
# validate-flash did not return "not authorized"
exit_status=0
fi
fi
else
if [ -e "/proc/device-tree/rtas/ibm,update-flash-64-and-reboot" ] || [ -e "/proc/device-tree/rtas/udpate-flash-and-reboot" ]; then
exit_status=0
fi
fi
if [ $exit_status -ne 0 ]; then
echo update_flash: flash image cannot be managed from this partition
else
echo update_flash: flash image management is supported
fi
exit $exit_status;
}
echo_validate_rtas_buf() {
local output="$1"
local cur_t_name=$(echo "$output" | grep "^MI" | head -n 1 | awk ' { print $2 } ')
local cur_p_name=$(echo "$output" | grep "^MI" | head -n 1 | awk ' { print $3 } ')
local new_t_name=$(echo "$output" | grep "^MI" | tail -n 1 | awk ' { print $2 } ')
local new_p_name=$(echo "$output" | grep "^MI" | tail -n 1 | awk ' { print $3 } ')
echo "Projected Flash Update Results:"
echo "Current T Image: $cur_t_name"
echo "Current P Image: $cur_p_name"
echo "New T Image: $new_t_name"
echo "New P Image: $new_p_name"
}
echo_entitlement_expiry_date() {
local build_date=`cat $PROCVALIDATE | grep "^MG" | tail -n 1 | cut -d " " -f2`
local entl_date=`cat $PROCVALIDATE | grep "^ME" | cut -d " " -f2`
echo "The selected firmware image cannot be applied."
echo ""
echo -n "The Build Date of the firmware image selected is "
if [ "$build_date" != "" ]; then
echo "$(date --date=$build_date +"%B %d, %Y")."
else
echo "UNKNOWN."
fi
echo -n "The System's Update Access Key Expiration Date is "
if [ "$entl_date" != "" ]; then
echo "$(date --date=$entl_date +"%B %d, %Y")."
else
echo "UNKNOWN."
fi
echo ""
echo "Please go to http://www.ibm.com/servers/eserver/ess to obtain "
echo "a replacement update access key."
}
echo_validate_return_status() {
local output="$1"
local rc=$(echo "$output" | head -n 1)
local rtas_buf=$(echo "$output" | tail -n +2)
[ $# -eq 1 ] || error $E_USAGE "echo_validate_return_status(): usage"
case "$rc" in
$VALIDATE_PARAM_ERR)
error $E_RTAS "RTAS: validate() Parameter Error";;
$VALIDATE_HW_ERR)
error $E_RTAS "RTAS: validate() Hardware Error";;
$VALIDATE_FLASH_AUTH)
error $E_RTAS "RTAS: validate() Partition does not have authority";;
$VALIDATE_AUTH)
error $E_RTAS "RTAS: validate() Partition does not have authority";;
$VALIDATE_INVALID_IMG)
error $E_RTAS "RTAS: validate() Invalid candidate image for this platform";;
$VALIDATE_TMP_UPDATE)
echo "info: Temporary side will be updated with a newer or"
echo "identical image";;
$VALIDATE_CUR_UNKNOWN)
echo "info: Current fixpack level is unknown";;
$VALIDATE_TMP_COMMIT_DL)
echo "info: Current Temporary image will be committed to"
echo "Permanent side before being replaced with new image, and"
echo "the new image is downlevel from current image";;
$VALIDATE_TMP_COMMIT)
echo "info: Current Temporary side will be committed to"
echo "Permanent side before being replaced with the new image";;
$VALIDATE_TMP_UPDATE_DL)
echo "info: Temporary side will be updated with a downlevel"
echo "image";;
$VALIDATE_OUT_OF_WRNTY)
echo_entitlement_expiry_date
error $E_WRNTY "Please contact your service support structure.";;
*) error $E_RTAS "RTAS: Unknown validate-flash-image Return Status"
esac
echo
echo_validate_rtas_buf "$rtas_buf"
# Do not commit T side image to P side
if [ $no_overwrite_opt -eq 1 ]; then
if [ $rc -eq $VALIDATE_TMP_COMMIT_DL ] || [ $rc -eq $VALIDATE_TMP_COMMIT ]; then
echo ""
echo "update_flash: Run without -n option to flash new image"
exit $E_OVERWRITE
fi
fi
}
validate_flash() {
local img_file=$1
local output=""
[ $# -eq 1 ] || error $E_USAGE "validate_flash(): usage"
[ -r $PROCVALIDATE ] || return $E_PROC_FS
grep \\"$VALIDATE_AUTH" "$PROCVALIDATE" > /dev/null
if [ $? -eq 0 ]; then # validate-flash returned "not authorized"
return $E_RTAS
fi
# Copy image file to proc file
cp "$img_file" "$PROCVALIDATE" || error $E_PROC_FS "error copying flash image to rtas_flash validate module"
# Display appropriate message, exiting if necessary
output="$(cat $PROCVALIDATE)"
echo_validate_return_status "$output"
return 0
}
validate_flash_from_file() {
local img_file=$1
[ $# -eq 1 ] || error $E_USAGE "validate_flash_from_file(): usage"
if [ ! -r "$PROCVALIDATE" ]; then
modprobe rtas_flash || error $E_MODULE "could not load rtas_flash kernel module"
[ -r "$PROCVALIDATE" ] || error $E_PROC_FS "rtas_flash kernel module did not create $PROCVALIDATE"
fi
if validate_flash $img_file; then
return 0;
else
case "$?" in
$E_PROC_FS) error $E_PROC_FS "validate: $PROCVALIDATE does not exist";;
$E_RTAS) error $E_RTAS "validate: firmware validation not supported on this system";;
esac
fi
}
echo_update_status() {
local rc="$1"
[ $# -eq 1 ] || error $E_USAGE "echo_update_status(): usage"
case "$rc" in
$FLASH_AUTH)
error $E_RTAS "RTAS: Partition does not have authority";;
$FLASH_IMG_SHORT)
error $E_IMAGE "Flash image shorter than expected";;
$FLASH_IMG_BAD_LEN)
error $E_PROC_FS "Bad length value in flash list block";;
$FLASH_IMG_NULL_DATA)
error $E_PROC_FS "Bad data value in flash list block";;
$FLASH_IMG_READY)
echo "Flash image ready...rebooting the system...";;
*) error $E_PROC_FS "RTAS: Unknown update flash status"
esac
}
update_flash_from_file() {
local img_file=$1
local output=""
local oldkernel=0
[ $# -eq 1 ] || error $E_USAGE "update_flash_from_file(): usage"
[ -r "$img_file" ] || error $E_IMAGE "cannot read $img_file"
flashfile=$PROCFLASH
if [ ! -r "$PROCFLASH" ]; then
modprobe rtas_flash
if [ ! -r "$PROCFLASH" ]; then
if [ -r "$OLDPROCFLASH" ]; then
oldkernel=1
else
error $E_PROC_FS "rtas_flash kernel module did not create $PROCFLASH"
fi
fi
fi
if [ -r "$PROCVALIDATE" ]; then
validate_flash "$img_file"
fi
if [ $oldkernel -eq 0 ]; then
dd if="$img_file" of="$PROCFLASH" bs=$PAGE_SIZE 2>/dev/null || error $E_PROC_FS "error copying flash image to rtas_flash kernel module"
output="$(cat $PROCFLASH)"
echo_update_status "$output"
else
dd if="$img_file" of="$OLDPROCFLASH" bs=PAGE_SIZE 2>/dev/null || error $E_PROC_FS "error copying flash image to rtas_flash kernel module"
cat "$OLDPROCFLASH"
fi
#XXX
reboot
return 0;
}
echo_manage_return_status() {
local is_commit=$1
local output=$2
local rc=$(echo $output)
[ $# -eq 2 ] || error $E_USAGE "echo_manage_return_status(): usage"
case "$rc" in
$MANAGE_AUTH)
error $E_RTAS "RTAS: manage() Partition does not have authority";;
$MANAGE_ACTIVE_ERR)
error $E_RTAS "RTAS: manage() Cannot Overwrite the Active Firmware Image";;
$MANAGE_PARAM_ERR)
error $E_RTAS "RTAS: manage() Parameter Error";;
$MANAGE_HW_ERR)
error $E_RTAS "RTAS: manage() Hardware Error";;
$MANAGE_SUCCESS)
if [ $is_commit -eq 0 ]; then
echo "success: Rejected temporary firmware image"
else
echo "success: Committed temporary firmware image"
fi
;;
*) error $E_RTAS "Unknown manage-flash-image Return Status"
esac
}
manage_flash() {
local is_commit=$1
local commit_str="1"
local reject_str="0"
local output=""
[ $# -eq 1 ] || error $E_USAGE "manage_flash(): usage"
if [ ! -r "$PROCMANAGE" ]; then
modprobe rtas_flash || error $E_MODULE "could not load rtas_flash kernel module"
[ -r "$PROCMANAGE" ] || error $E_PROC_FS "rtas_flash kernel module did not create $PROCMANAGE"
fi
if [ $is_commit -eq 1 ]; then
echo $commit_str > $PROCMANAGE
else
echo $reject_str > $PROCMANAGE
fi
output=$(cat $PROCMANAGE)
echo_manage_return_status $is_commit "$output"
if echo $output | grep "^success" > /dev/null; then
return 0
else
return $E_RTAS
fi
}
file=""
check_opt=0
commit_opt=0
reject_opt=0
validate_opt=0
no_overwrite_opt=0
file_opt=0
[ -d /proc/device-tree ] || error $E_PROC_FS "iSeries or /proc not mounted"
#XXX
#[ "`whoami`" = "root" ] || error $E_PERM "must be root to execute this command"
# Check for platform and if PowerNV call update_flash_nv
# PowerNV update_flash tool
UPDATE_FLASH_NV=$(dirname $0)/update_flash_nv
. $PSERIES_PLATFORM
case "$platform" in
$PLATFORM_UNKNOWN | $PLATFORM_POWERKVM_GUEST)
echo "update_flash: is not supported on the $platform_name platform"
exit 1;;
$PLATFORM_POWERKVM_HOST)
if [ ! -r "$UPDATE_FLASH_NV" ]; then
error $E_PERM "Couldn't find $UPDATE_FLASH_NV file."
fi
/bin/sh $UPDATE_FLASH_NV $@
exit $?
esac
while [ -n "$1" ]; do
arg="$1"
shift
case "$arg" in
-q|-l|-D|-S) error $E_USAGE "the $arg option is not implemented";;
-h) usage $E_SUCCESS;;
-s) check_opt=1;;
-c) commit_opt=1;;
-r) reject_opt=1;;
-v) validate_opt=1;;
-n) no_overwrite_opt=1;;
-f) file_opt=1; file="$1"; shift;;
*) error $E_USAGE "unknown option $arg"
esac
done
if [ -n "$file" ]; then
if [ $commit_opt -eq 1 ] || [ $reject_opt -eq 1 ] ||
[ $check_opt -eq 1 ]; then
usage
elif [ $validate_opt -eq 1 ] && [ $no_overwrite_opt -eq 1 ]; then
usage
elif [ $validate_opt -eq 1 ]; then
validate_flash_from_file $file
else
update_flash_from_file $file
fi
else
[ $check_opt -eq 1 ] && query_support
[ $commit_opt -eq 0 ] && [ $reject_opt -eq 0 ] && usage
[ $commit_opt -eq 1 ] && [ $reject_opt -eq 1 ] && usage
manage_flash $commit_opt
fi

View File

@ -0,0 +1,416 @@
#!/bin/sh
# Copyright (c) 2013 International Business Machines
# Common Public License Version 1.0 (see COPYRIGHT)
#
# Authors: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
#
# Simple script for code update on "KVM on Power" machines. This
# is a simple wrapper script to pass the image. The Linux kernel
# and FW does the real work during system reboot.
#
# This script has minimal dependencies so it can operate in a
# rescue environment.
#set -x
# Error codes
E_SUCCESS=0 # Success
E_UNSUPPORTED=1 # Firmware update is not supported
E_USAGE=3 # Usage error
E_PERM=4 # Permission error
E_IMAGE=5 # Image file error
E_SYS_FS=6 # Firmware update related sysfs file doesn't exist
E_MODULE=7 # Error loading module
E_OPAL=8 # OPAL call failed
E_USER=9 # User aborted operation
E_OVERWRITE=10 # Auto overwrite permanent side image
E_WRNTY=15 # Update Access Key Expired
# Firmware update related files
SYS_IMAGE_FILE=/sys/firmware/opal/image
SYS_VALIDATE_FLASH=/sys/firmware/opal/validate_flash
SYS_MANAGE_FLASH=/sys/firmware/opal/manage_flash
SYS_UPDATE_FLASH=/sys/firmware/opal/update_flash
# Code update status values
FLASH_SUCCESS=0 # Success
FLASH_PARAM_ERR=-1 # Parameter error
FLASH_BUSY=-2 # OPAL busy
FLASH_HW_ERR=-6 # Hardware error
FLASH_INTERNAL_ERR=-11 # Internal error
FLASH_NO_OP=-1099 # No operation initiated by user
FLASH_NO_AUTH=-9002 # Inband firmware update is not allowed
# Validate image status values
FLASH_IMG_READY=-1001 # Image ready for validation
FLASH_IMG_INCOMPLETE=-1002 # User copied < VALIDATE_BUF_SIZE
# Manage image status values
FLASH_ACTIVE_ERR=-9001 # Cannot overwrite active img
# Flash image status values
FLASH_IMG_READY=0 # Image ready for flash on reboot
FLASH_INVALID_IMG=-1003 # Flash image shorter than expected
FLASH_IMG_NULL_DATA=-1004 # Bad data
FLASH_IMG_BAD_LEN=-1005 # Bad length
# Validate image update result tokens
#
# T side will be updated
VALIDATE_TMP_UPDATE=0
#
# Partition does not have authority
VALIDATE_FLASH_AUTH=1
#
# Candidate image is not valid for this platform
VALIDATE_INVALID_IMG=2
#
# Current fixpack level is unknown
VALIDATE_CUR_UNKNOWN=3
#
# Current T side will be committed to P side before being replace
# with new image, and the new image is downlevel from current image
VALIDATE_TMP_COMMIT_DL=4
#
# Current T side will be committed to P side before being replaced
# with new image
VALIDATE_TMP_COMMIT=5
#
# T side will be updated with a downlevel image
VALIDATE_TMP_UPDATE_DL=6
#
# The candidate image's release date is later than the system's Update
# Access Key Expiration date - service warranty period has expired
VALIDATE_OUT_OF_WRNTY=7
error() {
local exit_code=$1
if [ $# -lt 1 ]; then
echo "error(): usage." >&2
return $E_USAGE
fi
shift;
echo update_flash: $* >&2
exit $exit_code
}
usage() {
local exit_code;
if [ "$1" == $E_SUCCESS ]; then
exit_code=$E_SUCCESS
else
exit_code=$E_USAGE
fi
echo "USAGE: update_flash {-h | -s | -r | -c | [-v|-n] -f <image filename>}" >&2
echo " -h Print this message." >&2
echo " -s Determine if partition has access to" >&2
echo " perform flash image management." >&2
echo " -r Reject temporary image." >&2
echo " -c Commit temporary image." >&2
echo " -v Validate the given image file." >&2
echo " -n Do not overwrite Permanent side" >&2
echo " image automatically." >&2
echo " -f <filename> Update with given image file. If possible," >&2
echo " the image is automatically validated prior" >&2
echo " to update." >&2
echo "" >&2
exit $exit_code
}
# Validate sysfs interface
validate_sysfs_file() {
local file="$1"
if [ -r "$file" ]; then
return $E_SUCCESS
fi
error $E_SYS_FS "sysfs interface for firmware update does not exists."
}
# Copy image to sysfs file
copy_candidate_image() {
local img_file=$1
[ $# -eq 1 ] || error $E_USAGE "copy_candidate_image(): usage."
[ -r "$img_file" ] || error $E_IMAGE "Cannot read ${img_file}."
# Copy candidate image
dd if=$img_file of=$SYS_IMAGE_FILE 2>/dev/null
if [ $? -ne 0 ]; then
echo "update_flash: Error copying firmware image."
error $E_IMAGE "Please retry with valid firmware image."
fi
}
echo_opal_return_status() {
case "$1" in
$FLASH_PARAM_ERR)
error $E_OPAL "Parameter Error.";;
$FLASH_BUSY)
error $E_OPAL "OPAL Busy.";;
$FLASH_HW_ERR)
error $E_OPAL "Hardware error.";;
$FLASH_INTERNAL_ERR)
error $E_OPAL "OPAL internal error.";;
$FLASH_NO_AUTH)
error $E_PERM "System does not have authority to perform firmware update.";;
$FLASH_IMG_INCOMPLETE)
error $E_IMAGE "Invalid candidate image.";;
$FLASH_ACTIVE_ERR)
error $E_OVERWRITE "Cannot Overwrite the Active Firmware Image.";;
$FLASH_INVALID_IMG)
error $E_IMAGE "Invalid candidate image.";;
$FLASH_IMG_NULL_DATA)
error $E_IMAGE "Bad data value in flash list block.";;
$FLASH_IMG_BAD_LEN)
error $E_IMAGE "Bad length value in flash list block.";;
*) error $E_OPAL "Unknown return status.";;
esac
}
# Determine if partition has access to perform flash image management
query_flash_support() {
# Validate sysfs interface
validate_sysfs_file $SYS_IMAGE_FILE
# By default KVM on Power host is allowed to do firmware management
echo "update_flash: Firmware image management is supported."
exit $E_SUCCESS
}
echo_validate_buf() {
local output="$1"
local cur_t=$(echo "$output" | grep "^MI" | head -n 1 | awk ' { print $2 } ')
local cur_p=$(echo "$output" | grep "^MI" | head -n 1 | awk ' { print $3 } ')
local new_t=$(echo "$output" | grep "^MI" | tail -n 1 | awk ' { print $2 } ')
local new_p=$(echo "$output" | grep "^MI" | tail -n 1 | awk ' { print $3 } ')
echo "Projected Flash Update Results:"
echo "Current T Image: $cur_t"
echo "Current P Image: $cur_p"
echo "New T Image: $new_t"
echo "New P Image: $new_p"
}
echo_validate_return_status() {
local output="$1"
local rc=$(echo "$output" | head -n 1)
local opal_buf=$(echo "$output" | tail -n +2)
[ $# -eq 1 ] || error $E_USAGE "echo_validate_return_status(): usage."
if [ $rc -lt 0 ]; then
echo_opal_return_status $rc
fi
# Validation result
case "$rc" in
$VALIDATE_TMP_UPDATE)
echo -n "info: Temporary side will be updated with a newer or"
echo " identical image.";;
$VALIDATE_FLASH_AUTH)
error $E_OPAL "System does not have authority.";;
$VALIDATE_INVALID_IMG)
error $E_OPAL "Invalid candidate image for this platform.";;
$VALIDATE_CUR_UNKNOWN)
echo "info: Current fixpack level is unknown.";;
$VALIDATE_TMP_COMMIT_DL)
echo "info: Current Temporary image will be committed to"
echo "Permanent side before being replaced with new image,"
echo "and the new image is downlevel from current image.";;
$VALIDATE_TMP_COMMIT)
echo "info: Current Temporary side will be committed to"
echo "Permanent side before being replaced with the new"
echo "image.";;
$VALIDATE_TMP_UPDATE_DL)
echo "info: Temporary side will be updated with a downlevel image.";;
*) error $E_OPAL "Unknown return status."
esac
echo
echo_validate_buf "$opal_buf"
# Do not commit T side image to P side
if [ $no_overwrite_opt -eq 1 ]; then
if [ $rc -eq $VALIDATE_TMP_COMMIT_DL ] ||
[ $rc -eq $VALIDATE_TMP_COMMIT ]; then
echo ""
echo "update_flash: Run without -n option to flash new image."
exit $E_OVERWRITE
fi
fi
}
validate_flash() {
local output=""
# Validate candidate image
echo 1 > $SYS_VALIDATE_FLASH 2>/dev/null
# Display appropriate message, exiting if necessary
output="$(cat $SYS_VALIDATE_FLASH)"
echo_validate_return_status "$output"
}
validate_flash_from_file() {
local img_file=$1
[ $# -eq 1 ] || error $E_USAGE "validate_flash_from_file(): usage."
# Validate sysfs interface
validate_sysfs_file $SYS_VALIDATE_FLASH
# Copy candiadate image
copy_candidate_image $img_file
# Validate candidate image
validate_flash
exit $E_SUCCESS
}
echo_update_return_status() {
local rc="$1"
[ $# -eq 1 ] || error $E_USAGE "echo_update_return_status(): usage."
if [ $rc -lt 0 ]; then
echo_opal_return_status $rc
elif [ $rc -eq $FLASH_IMG_READY ]; then
echo
echo "FLASH: Image ready...rebooting the system..."
echo "FLASH: This will take several minutes."
echo "FLASH: Do not power off!"
else
error $E_SYS_FS "Unknown return status."
fi
}
update_flash_from_file() {
local img_file=$1
local output=""
[ $# -eq 1 ] || error $E_USAGE "update_flash_from_file(): usage."
# Validate sysfs interface
validate_sysfs_file $SYS_UPDATE_FLASH
# Copy candidate image
copy_candidate_image $img_file
# Validate candidate image
validate_flash
# Update image
echo 1 > $SYS_UPDATE_FLASH 2>/dev/null
output="$(cat $SYS_UPDATE_FLASH)"
echo_update_return_status "$output"
# Reboot system, so that we can flash new image
reboot -f
exit $E_SUCCESS
}
echo_manage_return_status() {
local is_commit=$1
local output=$2
local rc=$(echo $output)
[ $# -eq 2 ] || error $E_USAGE "echo_manage_return_status(): usage."
if [ $rc -lt 0 ]; then
echo_opal_return_status $rc
elif [ $rc -eq $FLASH_SUCCESS ]; then
if [ $is_commit -eq 0 ]; then
echo "Success: Rejected temporary firmware image."
else
echo "Success: Committed temporary firmware image."
fi
else
error $E_OPAL "Unknown return status."
fi
}
manage_flash() {
local is_commit=$1
local commit_str="1"
local reject_str="0"
local output=""
[ $# -eq 1 ] || error $E_USAGE "manage_flash(): usage."
# Validate sysfs interface
validate_sysfs_file $SYS_MANAGE_FLASH
# Commit operation
if [ $is_commit -eq 1 ]; then
echo $commit_str > $SYS_MANAGE_FLASH
else
echo $reject_str > $SYS_MANAGE_FLASH
fi
# Result
output=$(cat $SYS_MANAGE_FLASH)
echo_manage_return_status $is_commit "$output"
exit $E_SUCCESS
}
file=""
check_opt=0
commit_opt=0
reject_opt=0
validate_opt=0
no_overwrite_opt=0
file_opt=0
# Only root user can perform firmware update
[ "`whoami`" == "root" ] || error $E_PERM "Must be root to execute this command."
# Parse command line options
while [ -n "$1" ]; do
arg="$1"
shift
case "$arg" in
-q|-l|-D|-S) error $E_USAGE "The $arg option is not implemented.";;
-h) usage $E_SUCCESS;;
-s) check_opt=1;;
-c) commit_opt=1;;
-r) reject_opt=1;;
-v) validate_opt=1;;
-n) no_overwrite_opt=1;;
-f) file_opt=1; file="$1"; shift;;
*) error $E_USAGE "Unknown option ${arg}."
esac
done
if [ -n "$file" ]; then
if [ $commit_opt -eq 1 ] || [ $reject_opt -eq 1 ] ||
[ $check_opt -eq 1 ]; then
usage
elif [ $validate_opt -eq 1 ] && [ $no_overwrite_opt -eq 1 ]; then
usage
elif [ $validate_opt -eq 1 ]; then
validate_flash_from_file $file
else
update_flash_from_file $file
fi
else
if [ $check_opt -eq 1 ]; then
if [ $commit_opt -eq 1 ] || [ $reject_opt -eq 1 ]; then
usage
else
query_flash_support
fi
fi
[ $commit_opt -eq 0 ] && [ $reject_opt -eq 0 ] && usage
[ $commit_opt -eq 1 ] && [ $reject_opt -eq 1 ] && usage
manage_flash $commit_opt
fi

View File

@ -1,4 +1,4 @@
xcat-genesis-scripts-amd64 (2.8-snap20130205) precise; urgency=low
xcat-genesis-scripts (2.8-snap20130205) precise; urgency=low
* Nightly_Builds

View File

@ -1,13 +1,13 @@
Source: xcat-genesis-scripts-amd64
Source: xcat-genesis-scripts
Section: admin
Priority: extra
Maintainer: xCAT <xcat-user@lists.sourceforge.net>
Build-Depends: debhelper (>= 8.0.0)
Standards-Version: 3.9.2
Package: xcat-genesis-scripts-amd64
Architecture: all
Depends: xcat-genesis-base-amd64
Package: xcat-genesis-scripts
Architecture: amd64 ppc64el
Depends: xcat-genesis-base-amd64[any-amd64],xcat-genesis-base-ppc64[any-ppc64el]
Description: xCAT genesis
(Genesis Enhanced Netboot Environment for System Information and Servicing) is a small, embedded-like environment for xCAT's use in discovery and management actions when interaction with an OS is infeasible. This package reperesents the EPL content that is more tightly bound to specific xcat-core versions

View File

@ -1 +0,0 @@
/opt/xcat/share/xcat/netboot/genesis/x86_64/fs

View File

@ -1,3 +0,0 @@
./etc/ opt/xcat/share/xcat/netboot/genesis/x86_64/fs
./bin/ opt/xcat/share/xcat/netboot/genesis/x86_64/fs
./sbin/ opt/xcat/share/xcat/netboot/genesis/x86_64/fs

View File

@ -20,6 +20,7 @@ set -e
case "$1" in
configure)
echo "If you are installing/updating xCAT-genesis-base separately, not as part of installing/updating all of xCAT, run 'mknb <arch> manually'"
touch /etc/xcat/genesis-scripts-updated
;;

View File

@ -9,6 +9,15 @@
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
ifneq ($(DEB_BUILD_ARCH),ppc64el)
export TARGET_ARCH=x86_64
else
export TARGET_ARCH=ppc64
endif
export installdir=/opt/xcat/share/xcat/netboot/genesis/$(TARGET_ARCH)/fs
export installtodir=opt/xcat/share/xcat/netboot/genesis/$(TARGET_ARCH)/fs
build:
pwd
@ -21,8 +30,11 @@ install:
pwd
dh_testdir
dh_testroot
dh_installdirs
dh_installdirs $(installdir)
dh_install -X".svn"
dh_install ./etc/ $(installtodir)
dh_install ./bin/ $(installtodir)
dh_install ./sbin/ $(installtodir)
dh_compress
dh_installdeb
dh_gencontrol

View File

@ -90,13 +90,16 @@ touch /etc/xcat/genesis-scripts-updated
%{rpminstallroot}/bin/remoteimmsetup
%{rpminstallroot}/bin/udpcat.awk
%{rpminstallroot}/bin/updateflag.awk
%{rpminstallroot}/bin/pseries_platform
%{rpminstallroot}/bin/update_flash
%{rpminstallroot}/bin/update_flash_nv
%{rpminstallroot}/debian/changelog
%{rpminstallroot}/debian/compat
%{rpminstallroot}/debian/control
%{rpminstallroot}/debian/copyright
%{rpminstallroot}/debian/dirs
#%{rpminstallroot}/debian/dirs
%{rpminstallroot}/debian/docs
%{rpminstallroot}/debian/install
#%{rpminstallroot}/debian/install
%{rpminstallroot}/debian/postinst
%{rpminstallroot}/debian/postrm
%{rpminstallroot}/debian/preinst

View File

@ -1 +0,0 @@
xcat-rmc_2.5.0-1_all.deb admin extra

32
xCAT-server/lib/perl/xCAT/PPC.pm Executable file → Normal file
View File

@ -2142,29 +2142,41 @@ sub findme {
my $request = shift;
my $callback = shift;
my $subreq = shift;
my $vpdtab = xCAT::Table->new('vpd');
if (!defined $request->{'mtm'} or !defined $request->{'serial'}) {
xCAT::MsgUtils->message("S", "Discovery Error: 'mtm' or 'serial' not found.");
return;
}
unless ($vpdtab) {
xCAT::MsgUtils->message("S", "Discovery Error: Could not open table: vpd.");
my @attr_array = ();
my $mtms = $request->{'mtm'}->[0]."*".$request->{'serial'}->[0];
my $tmp_nodes = $::XCATVPDHASH{$mtms};
my @nodes = ();
my $pbmc_node;
foreach (@$tmp_nodes) {
if ($::XCATPPCHASH{$_}) {
$pbmc_node = $_;
} else {
push @nodes, $_;
}
}
my $nodenum = $#nodes;
if ($nodenum < 0) {
xCAT::MsgUtils->message("S", "Discovery Error: Could not find any node.");
return;
} elsif ($nodenum > 0) {
xCAT::MsgUtils->message("S", "Discovery Error: More than one node were found.");
return;
}
my @attr_array = ();
push @attr_array, "mtm==$request->{mtm}->[0]";
push @attr_array, "serial==$request->{serial}->[0]";
my @nodes = $vpdtab->getAllAttribsWhere(\@attr_array, 'node');
foreach (@nodes) {
{
my $req = {%$request};
$req->{command} = ['discovered'];
$req->{noderange} = [$_->{node}];
$req->{noderange} = [$nodes[0]];
$req->{pbmc_node} = [$pbmc_node];
$req->{discoverymethod} = ['mtms'];
$subreq->($req);
%{$req} = ();
}
}
##########################################################################
# Process request from xCat daemon
##########################################################################

View File

@ -713,6 +713,9 @@ sub update_tables_with_templates
osarch=>$arch,
synclists=>$synclistfile,
osdistroname=>$osdistroname);
if ($args{description}) {
$tb_cols{description} = $args{description};
}
$osimagetab->setAttribs(\%key_col, \%tb_cols);
if ($osname =~ /^win/) {

View File

@ -30,30 +30,30 @@ $Getopt::Long::ignorecase = 0;
# Globals
#
%::CLIATTRS; # attr=values provided on the command line
%::FILEATTRS; # attr=values provided in an input file
%::FINALATTRS; # final set of attr=values that are used to set
# %::CLIATTRS; # attr=values provided on the command line
#%::FILEATTRS; # attr=values provided in an input file
#%::FINALATTRS; # final set of attr=values that are used to set
# the object
%::objfilehash; # hash of objects/types based of "-f" option
#%::objfilehash; # hash of objects/types based of "-f" option
# (list in file)
%::WhereHash; # hash of attr=val from "-w" option
@::AttrList; # list of attrs from "-i" option
%::NicsAttrHash; # hash of nics attributes specified with "-i" option
#%::WhereHash; # hash of attr=val from "-w" option
#@::AttrList; # list of attrs from "-i" option
#%::NicsAttrHash; # hash of nics attributes specified with "-i" option
# e.g. $::NicsAttrHash{'nicips'} = ("eth0","eth1");
# object type lists
@::clobjtypes; # list of object types derived from the command line.
@::fileobjtypes; # list of object types from input file ("-x" or "-z")
#@::clobjtypes; # list of object types derived from the command line.
#@::fileobjtypes; # list of object types from input file ("-x" or "-z")
# object name lists
@::clobjnames; # list of object names derived from the command line
@::fileobjnames; # list of object names from an input file
@::objfilelist; # list of object names from the "-f" option
@::allobjnames; # combined list
#@::clobjnames; # list of object names derived from the command line
#@::fileobjnames; # list of object names from an input file
#@::objfilelist; # list of object names from the "-f" option
#@::allobjnames; # combined list
@::noderange; # list of nodes derived from command line
#@::noderange; # list of nodes derived from command line
#------------------------------------------------------------------------------
@ -951,7 +951,7 @@ sub processArgs
}
}
}
elsif (@::noderange && (@::clobjtypes[0] eq 'node'))
elsif (@::noderange && ($::clobjtypes[0] eq 'node'))
{
# if there's no object list and the type is node then the
@ -1278,7 +1278,7 @@ sub defmk
{
# if attr=val on cmd line then could only have one type
$::objtype = @::clobjtypes[0];
$::objtype = $::clobjtypes[0];
#
# set cli attrs for each object definition
@ -1921,7 +1921,7 @@ sub defch
{
# if attr=val on cmd line then could only have one type
$::objtype = @::clobjtypes[0];
$::objtype = $::clobjtypes[0];
#
# set cli attrs for each object definition
@ -2760,7 +2760,7 @@ sub defls
my %objhash;
my @objectlist;
@::allobjnames;
# @::allobjnames;
my @displayObjList;
my $numtypes = 0;
@ -2843,7 +2843,7 @@ sub defls
if ($::objectsfrom_opto || $::objectsfrom_nr || $::objectsfrom_args)
{
my $type = @::clobjtypes[0];
my $type = $::clobjtypes[0];
$numtypes = 1;
@ -3748,7 +3748,7 @@ sub defrm
# there can only be one type value
if ($::objectsfrom_opto || $::objectsfrom_nr || $::objectsfrom_args)
{
my $type = @::clobjtypes[0];
my $type = $::clobjtypes[0];
foreach my $obj (sort @::clobjnames)
{
@ -3873,8 +3873,8 @@ sub defrm
$nhash{$m} = 'node';
}
# Performance: Only call getobjdefs once
my @attrs = ('groups');
%nodehash = xCAT::DBobjUtils->getobjdefs(\%nhash, 0, \@attrs);
@attrs = ('groups');
%nodehash = xCAT::DBobjUtils->getobjdefs(\%nhash, 0, \@attrs);
if (!(%nodehash))
{
my $rsp;
@ -4222,7 +4222,7 @@ sub initialize_variables
%::CLIATTRS = ();
%::FILEATTRS = ();
%::FINALATTRS = ();
%::objfilehash = ();
# %::objfilehash = ();
%::WhereHash = ();
@::AttrList = ();
%::NicsAttrHash = ();

View File

@ -18,7 +18,6 @@ use xCAT::NetworkUtils;
use xCAT::MacMap;
use Socket;
use Net::Ping;
my $interface;
##########################################################################
## Command handler method from tables
@ -65,6 +64,7 @@ sub process_request {
my $getopt_success = Getopt::Long::GetOptions(
'help|h|?' => \$::opt_h,
'i|I=s' => \$::opt_I,
'ip|ip=s' => \$::opt_IP,
'verbose|V' => \$::opt_V,
);
@ -89,7 +89,7 @@ sub process_request {
# Option -i for kit component attributes
if ( defined($::opt_I) ) {
$interface = $::opt_I;
$::interface = $::opt_I;
}
my $command = $request->{command}->[0];
@ -116,9 +116,9 @@ sub configfpc_usage {
push @{ $rsp->{data} },
"\nUsage: configfpc - Configure the NeXtScale FPCs.i This command requires the -i option to give specify which network adapter to use to look for the FPCs.\n";
push @{ $rsp->{data} },
" configfpc -i interface \n ";
" configfpc -i interface [--ip default ip address]\n ";
push @{ $rsp->{data} },
" configfpc [-V|--verbose] -i interface \n ";
" configfpc [-V|--verbose] -i interface [--ip default ip address] \n ";
push @{ $rsp->{data} }, " configfpc [-h|--help|-?] \n";
xCAT::MsgUtils->message( "I", $rsp, $::CALLBACK );
return 0;
@ -129,7 +129,8 @@ sub configfpc_usage {
#
###########################################################################
# This routine will look for NeXtWcale Fan Power Controllers (FPC) that have
# a default IP address of 192.169.0.100
# a default IP address of 192.168.0.100
# It will take in a different default IP address, if you input --ip <new default ip>
#
# For each FPC found the code will
# 1 - ping the default IP address to get the default IP and MAC in the arp table
@ -155,18 +156,40 @@ sub configfpc {
my $ipmiuser = 'USERID';
my $ipmipass = 'PASSW0RD';
my $fpcip = '192.168.0.100';
if ($::opt_IP) { # override with --ip input
$fpcip = $::opt_IP;
}
# Build route, if defaultip is 192.168.0.100, then route is 192.168.0.101/16
my ($a1,$a2,$a3,$a4)=split(/\./, $fpcip);
my $a4 = $a4 +1;
my $a5="\/16";
my $route=join(".", $a1, $a2, $a3,$a4);
my $route = $route . $a5;
if($::VERBOSE){
my $rsp;
push @{ $rsp->{data} }, "Default IP address is $fpcip \n";
xCAT::MsgUtils->message( "I", $rsp, $::CALLBACK );
}
if($::VERBOSE){
my $rsp;
push @{ $rsp->{data} }, "Default route address is $route \n";
xCAT::MsgUtils->message( "I", $rsp, $::CALLBACK );
}
my $defnode = 'deffpc';
# This is the default FPC IP that we are looking for
my $foundfpc = 0;
# Setup routing to 182.168.0.100 network
# Setup routing to on the network:w
if($::VERBOSE){
my $rsp;
push@{ $rsp->{data} }, "Adding route definition for 192.168.0.101/16 to $::interface interface";
push@{ $rsp->{data} }, "Running ip addr add dev $::interface $route";
xCAT::MsgUtils->message( "I", $rsp, $callback );
}
my $setroute = `ip addr add dev $::interface 192.168.0.101/16`;
my $setroute = `ip addr add dev $::interface $route`;
#
# check for an FPC - this ping will also add the FPC IP and MAC to the ARP table
@ -271,15 +294,14 @@ sub configfpc {
#
# Cleanup on the way out - Delete route and remove the deffpc node definition
#
# Delete routing to 182.168.0.100 network
# Delete routing to from the network
if($::VERBOSE){
my $rsp;
push@{ $rsp->{data} }, "Deleting route definition for 192.168.0.101/16 on interface $::interface";
push@{ $rsp->{data} }, "Running ip addr del dev $::interface $route";
xCAT::MsgUtils->message( "I", $rsp, $callback );
}
my $setroute = `ip addr del dev $::interface 192.168.0.101/16`;
my $setroute = `ip addr del dev $::interface $route`;
# Delete routing to 182.168.0.100 network
if($::VERBOSE){
my $rsp;
push@{ $rsp->{data} }, "Removing default FPC node definition $defnode";
@ -427,7 +449,11 @@ sub set_FPC_network_parms {
sub get_node {
my $callback = shift;
my $fpcip = '192.168.0.100';
my $fpcip = '192.168.0.100'; # default if not entered on CLI
if ($::opt_IP) { # override with --ip input
$fpcip = $::opt_IP;
}
# get the FPC from the arp table
my $arpout = `arp -a | grep $fpcip`;
@ -478,7 +504,7 @@ sub add_node {
if($::VERBOSE){
my $rsp;
push@{ $rsp->{data} }, "Creating default FPC node deffpc with IP 192.168.0.100 for later use with rspconfig";
push@{ $rsp->{data} }, "Creating default FPC node deffpc with IP $fpcip for later use with rspconfig";
xCAT::MsgUtils->message( "I", $rsp, $callback );
}

View File

@ -281,7 +281,7 @@ sub copycd
{
$darch = "ppc64el";
}
elsif ($darch and $darch =~ /ppc/)
elsif ($darch and ($darch =~ /ppc/ or $darch =~ /powerpc/))
{
$darch = "ppc64";
}
@ -1435,7 +1435,7 @@ sub mknetboot
#}
# append the mac address
my $mac;
if( $useifname && $machash->{$node}->[0] && $machash->{$node}->[0]->{'mac'}) {
if( !$useifname && $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'};
# if ( (index($mac, "|") eq -1) and (index($mac, "!") eq -1) ) {
@ -1449,9 +1449,9 @@ sub mknetboot
# }
}
if ($useifname && $mac) {
$kcmdline .= "$mac ";
}
#if ($useifname && $mac) {
# $kcmdline .= "$mac ";
#}
# add "netdev=<eth0>" or "BOOTIF=<mac>"
# which are used for other scenarios
@ -1463,7 +1463,7 @@ sub mknetboot
} elsif ( $reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic} and $reshash->{$node}->[0]->{primarynic} ne "mac") {
$kcmdline .= "netdev=" . $reshash->{$node}->[0]->{primarynic} . " ";
} else {
if ( $useifname && $mac) {
if ( !$useifname && $mac) {
$kcmdline .= "BOOTIF=" . $mac . " ";
}
}

View File

@ -1208,28 +1208,27 @@ sub process_request
# if option is query then call listnode for each node and return
if ($opt{q})
{
{
# call listnode for each node requested
foreach my $node ( @{$req->{node}} ) {
listnode($node,$callback);
}
return;
return;
}
# if current node is a servicenode, make sure that it is also a dhcpserver
my $isok=1;
if (xCAT::Utils->isServiceNode()) {
$isok=0;
my @hostinfo=xCAT::NetworkUtils->determinehostname();
my %iphash=();
foreach(@hostinfo) {$iphash{$_}=1;}
my @sn = xCAT::ServiceNodeUtils->getSNList('dhcpserver');
foreach my $s (@sn)
{
if (exists($iphash{$s})) {
$isok=1;
}
}
$isok=0;
my @hostinfo=xCAT::NetworkUtils->determinehostname();
my %iphash=();
foreach(@hostinfo) {$iphash{$_}=1;}
my @sn = xCAT::ServiceNodeUtils->getSNList('dhcpserver');
foreach my $s (@sn) {
if (exists($iphash{$s})) {
$isok=1;
}
}
}
if($isok == 0) { #do nothing if it is a service node, but not dhcpserver
@ -1332,39 +1331,35 @@ sub process_request
@dhcpconf = ();
@dhcp6conf = ();
my $dhcplockfd;
open($dhcplockfd,">","/tmp/xcat/dhcplock");
flock($dhcplockfd,LOCK_EX);
if ($::XCATSITEVALS{externaldhcpservers}) { #do nothing if remote dhcpservers at this point
} elsif ($opt{n})
{
if (-e $dhcpconffile)
{
if ($^O eq 'aix')
{
# save NIM aix entries - to be restored later
my $aixconf;
open($aixconf, $dhcpconffile);
if ($aixconf)
{
my $save=0;
while (<$aixconf>)
{
if ($save) {
push @aixcfg, $_;
}
my $dhcplockfd;
open($dhcplockfd,">","/tmp/xcat/dhcplock");
flock($dhcplockfd,LOCK_EX);
if ($::XCATSITEVALS{externaldhcpservers}) {
# do nothing if remote dhcpservers at this point
} elsif ($opt{n}) {
if (-e $dhcpconffile) {
if ($^O eq 'aix') {
# save NIM aix entries - to be restored later
my $aixconf;
open($aixconf, $dhcpconffile);
if ($aixconf) {
my $save=0;
while (<$aixconf>) {
if ($save) {
push @aixcfg, $_;
}
if ($_ =~ /#Network configuration end\n/) {
$save++;
}
}
close($aixconf);
}
$restartdhcp=1;
@dhcpconf = ();
}
if ($_ =~ /#Network configuration end\n/) {
$save++;
}
}
close($aixconf);
}
$restartdhcp=1;
@dhcpconf = ();
}
my $rsp;
my $rsp;
push @{$rsp->{data}}, "Renamed existing dhcp configuration file to $dhcpconffile.xcatbak\n";
xCAT::MsgUtils->message("I", $rsp, $callback);
@ -1400,11 +1395,11 @@ sub process_request
@dhcp6conf = ();
}
}
my $nettab = xCAT::Table->new("networks");
my @vnets = $nettab->getAllAttribs('net','mgtifname','mask','dynamicrange','nameservers','ddnsdomain', 'domain');
my $nettab = xCAT::Table->new("networks");
my @vnets = $nettab->getAllAttribs('net','mgtifname','mask','dynamicrange','nameservers','ddnsdomain', 'domain');
# get a list of all domains listed in xCAT network defs
# - include the site domain - if any
# get a list of all domains listed in xCAT network defs
# - include the site domain - if any
my $nettab = xCAT::Table->new("networks");
my @doms = $nettab->getAllAttribs('domain');
foreach(@doms){
@ -1416,9 +1411,9 @@ sub process_request
# add the site domain
if ($site_domain) {
if (!grep(/^$site_domain$/, @alldomains)) {
push (@alldomains, $site_domain);
}
if (!grep(/^$site_domain$/, @alldomains)) {
push (@alldomains, $site_domain);
}
}
foreach (@vnets) {
@ -1450,18 +1445,19 @@ sub process_request
}
}
foreach(@vnets){
foreach(@vnets){
#TODO: v6 relayed networks?
my $n = $_->{net};
my $if = $_->{mgtifname};
my $nm = $_->{mask};
my $n = $_->{net};
my $if = $_->{mgtifname};
my $nm = $_->{mask};
if ($if =~ /!remote!/ and $n !~ /:/) { #only take in networks with special interface, but only v4 for now
push @nrn, "$n:$if:$nm";
push @nrn, "$n:$if:$nm";
}
}
}
if ($querynics)
{ #Use netstat to determine activenics only when no site ent.
#TODO: IPv6 auto-detect, or just really really insist people define dhcpinterfaces or suffer doom?
{
# Use netstat to determine activenics only when no site ent.
# TODO: IPv6 auto-detect, or just really really insist people define dhcpinterfaces or suffer doom?
foreach (@nrn)
{
my @ent = split /:/;
@ -1491,93 +1487,103 @@ sub process_request
if ( $^O ne 'aix')
{
#add the active nics to /etc/sysconfig/dhcpd or /etc/default/dhcp3-server(ubuntu)
#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 );
my %missingfiles = ( "dhcpd"=>1, "dhcpd6"=>1, "dhcp3-server"=>1 );
foreach $dhcpver ("dhcpd","dhcpd6","dhcp3-server", "isc-dhcp-server") {
if (-e "/etc/sysconfig/$dhcpver") {
if ($dhcpver eq "dhcpd") {
if (-e "/etc/sysconfig/$dhcpver") {
# for dhcpd, dhcpd6
if ($dhcpver eq "dhcpd") {
delete($missingfiles{dhcpd});
delete($missingfiles{"dhcp3-server"});
} else {
delete($missingfiles{$dhcpver});
delete($missingfiles{$dhcpver});
}
open DHCPD_FD, "/etc/sysconfig/$dhcpver";
my $syscfg_dhcpd = "";
my $found = 0;
my $dhcpd_key = "DHCPDARGS";
open DHCPD_FD, "/etc/sysconfig/$dhcpver";
my $syscfg_dhcpd = "";
my $found = 0;
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 (<DHCPD_FD>) {
if ($_ =~ m/^$dhcpd_key/) {
$found = 1;
$syscfg_dhcpd .= $ifarg;
} else {
$syscfg_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 (<DHCPD_FD>) {
if ($_ =~ m/^$dhcpd_key/) {
$found = 1;
$syscfg_dhcpd .= $ifarg;
} else {
$syscfg_dhcpd .= $_;
}
}
if ( $found eq 0 ) {
$syscfg_dhcpd .= $ifarg;
}
close DHCPD_FD;
open DBG_FD, '>', "/etc/default/$dhcpver";
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) {
$dhcpd_key = "DHCPD_INTERFACE";
}
my $ifarg = "$dhcpd_key=\"";
foreach (keys %activenics) {
if (/!remote!/) { next; }
$ifarg .= " $_";
}
$ifarg =~ s/^ //;
$ifarg .= "\"\n";
while (<DHCPD_FD>) {
if ($_ =~ m/^$dhcpd_key/) {
$found = 1;
$syscfg_dhcpd .= $ifarg;
}else {
$syscfg_dhcpd .= $_;
if ($missingfiles{dhcpd}) {
$callback->({error=>["The file /etc/sysconfig/dhcpd doesn't exist, check the dhcp server"]});
}
} else {
if ($missingfiles{dhcpd6}) {
$callback->({error=>["The file /etc/sysconfig/dhcpd6 doesn't exist, check the dhcp server"]});
}
}
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 (<DHCPD_FD>) {
if ($_ =~ m/^$dhcpd_key/) {
$found = 1;
$syscfg_dhcpd .= $ifarg;
}else {
$syscfg_dhcpd .= $_;
}
}
if ( $found eq 0 ) {
$syscfg_dhcpd .= $ifarg;
}
close DHCPD_FD;
open DBG_FD, '>', "/etc/default/$dhcpver";
print DBG_FD $syscfg_dhcpd;
close DBG_FD;
}
}
if ($usingipv6 and $missingfiles{dhcpd6}) {
$callback->({error=>["The file /etc/sysconfig/dhcpd6 doesn't exist, check the dhcp server"]});
}
if ($missingfiles{dhcpd}) {
$callback->({error=>["The file /etc/sysconfig/dhcpd doesn't exist, check the dhcp server"]});
}
@ -2416,6 +2422,9 @@ sub addnet
push @netent,
" } else if option client-architecture = 00:02 { #ia64\n ";
push @netent, " filename \"elilo.efi\";\n";
push @netent,
" } else if option client-architecture = 00:0e { #OPAL-v3\n ";
push @netent, " option conf-file = \"http://$tftp/tftpboot/pxelinux.cfg/p/".$net."_".$maskbits."\";\n";
push @netent,
" } else if substring(filename,0,1) = null { #otherwise, provide yaboot if the client isn't specific\n ";
push @netent, " filename \"/yaboot\";\n";

View File

@ -54,7 +54,7 @@ sub delnode
sub addnode
{
my $callback = shift;
my $callback = shift;
my $node = shift;
my $ip = shift;
@ -65,11 +65,11 @@ sub addnode
my $othernames = shift;
my $domain = shift;
my $nics = shift;
my $nics = shift;
my $idx = 0;
my $foundone = 0;
# if this ip was already added then just update the entry
# if this ip was already added then just update the entry
while ($idx <= $#hosts)
{
@ -82,22 +82,22 @@ sub addnode
}
else
{
# we found a matching entry in the hosts list
if ($nics) {
# we're processing the nics table and we found an
# existing entry for this ip so just add this
# node name as an alias for the existing entry
my ($hip, $hnode, $hdom, $hother)= split(/ /, $hosts[$idx]);
# at this point "othernames", if any is just a space
# delimited list - so just add the node name to the list
$othernames .= " $node";
$hosts[$idx] = build_line($callback, $ip, $hnode, $domain, $othernames);
} else {
# otherwise just try to completely update the existing
# entry
$hosts[$idx] = build_line($callback, $ip, $node, $domain, $othernames);
}
# we found a matching entry in the hosts list
if ($nics) {
# we're processing the nics table and we found an
# existing entry for this ip so just add this
# ode name as an alias for the existing entry
my ($hip, $hnode, $hdom, $hother)= split(/ /, $hosts[$idx]);
# at this point "othernames", if any is just a space
# elimited list - so just add the node name to the list
$othernames .= " $node";
$hosts[$idx] = build_line($callback, $ip, $hnode, $domain, $othernames);
} else {
# otherwise just try to completely update the existing
# entry
$hosts[$idx] = build_line($callback, $ip, $node, $domain, $othernames);
}
}
$foundone = 1;
}
@ -106,14 +106,14 @@ sub addnode
if ($foundone) { return; }
my $line = build_line($callback, $ip, $node, $domain, $othernames);
if ($line) {
push @hosts, $line;
}
if ($line) {
push @hosts, $line;
}
}
sub build_line
{
my $callback = shift;
my $callback = shift;
my $ip = shift;
my $node = shift;
my $domain = shift;
@ -121,13 +121,13 @@ sub build_line
my @o_names = ();
my @n_names = ();
# Trim spaces from the beginning and end from $othernames
$othernames =~ s/^\s+|\s+$//g;
if (defined $othernames)
{
# the "hostnames" attribute can be a list delimited by
# either a comma or a space
# Trim spaces from the beginning and end from $othernames
$othernames =~ s/^\s+|\s+$//g;
# the "hostnames" attribute can be a list delimited by
# either a comma or a space
@o_names = split(/,| /, $othernames);
}
my $longname;
@ -153,26 +153,26 @@ sub build_line
}
unshift(@o_names, @n_names);
my $shortname=$node;
my $shortname=$node;
if ($node =~ m/\.$domain$/i)
{
$longname = $node;
($shortname = $node) =~ s/\.$domain$//;
($shortname = $node) =~ s/\.$domain$//;
}
elsif ($domain && !$longname)
{
$shortname = $node;
$shortname = $node;
$longname = "$node.$domain";
}
# if shortname contains a dot then we have a bad syntax for name
if ($shortname =~ /\./) {
my $rsp;
push @{$rsp->{data}}, "Invalid short node name \'$shortname\'. The short node name may not contain a dot. The short node name is considered to be anything preceeding the network domain name in the fully qualified node name \'$longname\'.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
return undef;
}
if ($shortname =~ /\./) {
my $rsp;
push @{$rsp->{data}}, "Invalid short node name \'$shortname\'. The short node name may not contain a dot. The short node name is considered to be anything preceeding the network domain name in the fully qualified node name \'$longname\'.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
return undef;
}
$othernames = join(' ', @o_names);
if ($LONGNAME) { return "$ip $longname $shortname $othernames\n"; }
@ -182,7 +182,7 @@ sub build_line
sub addotherinterfaces
{
my $callback = shift;
my $callback = shift;
my $node = shift;
my $otherinterfaces = shift;
my $domain = shift;
@ -190,12 +190,12 @@ sub addotherinterfaces
my @itf_pairs = split(/,/, $otherinterfaces);
foreach (@itf_pairs)
{
my ($itf, $ip);
if ($_ =~ /!/) {
($itf, $ip) = split(/!/, $_);
} else {
($itf, $ip) = split(/:/, $_);
}
my ($itf, $ip);
if ($_ =~ /!/) {
($itf, $ip) = split(/!/, $_);
} else {
($itf, $ip) = split(/:/, $_);
}
if ($ip && xCAT::NetworkUtils->isIpaddr($ip))
{
if ($itf =~ /^-/)
@ -216,12 +216,12 @@ sub delotherinterfaces
my @itf_pairs = split(/,/, $otherinterfaces);
foreach (@itf_pairs)
{
my ($itf, $ip);
if ($_ =~ /!/) {
($itf, $ip) = split(/!/, $_);
} else {
($itf, $ip) = split(/:/, $_);
}
my ($itf, $ip);
if ($_ =~ /!/) {
($itf, $ip) = split(/!/, $_);
} else {
($itf, $ip) = split(/:/, $_);
}
if ($ip && xCAT::NetworkUtils->isIpaddr($ip))
{
if ($itf =~ /^-/)
@ -234,82 +234,80 @@ sub delotherinterfaces
}
sub add_hosts_content {
my %args = @_;
my $nodelist = $args{nodelist};
my $callback = $args{callback};
my $DELNODE = $args{delnode};
my $domain = $args{domain};
my $hoststab = xCAT::Table->new('hosts',-create=>0);
my $hostscache;
if ($hoststab) {
$hostscache =
$hoststab->getNodesAttribs($nodelist,
[qw(ip node hostnames otherinterfaces)]);
}
foreach (@{$nodelist})
my %args = @_;
my $nodelist = $args{nodelist};
my $callback = $args{callback};
my $DELNODE = $args{delnode};
my $domain = $args{domain};
my $hoststab = xCAT::Table->new('hosts',-create=>0);
my $hostscache;
if ($hoststab) {
$hostscache = $hoststab->getNodesAttribs($nodelist,
[qw(ip node hostnames otherinterfaces)]);
}
foreach (@{$nodelist}) {
my $ref = $hostscache->{$_}->[0];
my $nodename = $_;
my $ip = $ref->{ip};
if (not $ip) {
$ip = xCAT::NetworkUtils->getipaddr($nodename); #attempt lookup
}
my $netn;
($domain, $netn) = &getIPdomain($ip, $callback);
if (!$domain) {
if ($::sitedomain) {
$domain=$::sitedomain;
} elsif ($::XCATSITEVALS{domain}) {
$domain=$::XCATSITEVALS{domain};
} else {
my $rsp;
push @{$rsp->{data}}, "No domain can be determined for node \'$nodename\'. The domain of the xCAT node must be provided in an xCAT network definition or the xCAT site definition.\n";
xCAT::MsgUtils->message("W", $rsp, $callback);
next;
}
}
if ($DELNODE)
{
delnode $nodename, $ip, $ref->{hostnames}, $domain;
if (defined($ref->{otherinterfaces}))
{
my $ref = $hostscache->{$_}->[0];
my $nodename = $_;
my $ip = $ref->{ip};
if (not $ip) {
$ip = xCAT::NetworkUtils->getipaddr($nodename); #attempt lookup
}
my $netn;
($domain, $netn) = &getIPdomain($ip, $callback);
if (!$domain) {
if ($::sitedomain) {
$domain=$::sitedomain;
} elsif ($::XCATSITEVALS{domain}) {
$domain=$::XCATSITEVALS{domain};
} else {
my $rsp;
push @{$rsp->{data}}, "No domain can be determined for node \'$nodename\'. The domain of the xCAT node must be provided in an xCAT network definition or the xCAT site definition.\n";
xCAT::MsgUtils->message("W", $rsp, $callback);
next;
}
}
if ($DELNODE)
{
delnode $nodename, $ip, $ref->{hostnames}, $domain;
if (defined($ref->{otherinterfaces}))
{
delotherinterfaces $nodename, $ref->{otherinterfaces}, $domain;
}
}
else
{
if (xCAT::NetworkUtils->isIpaddr($ip))
{
addnode $callback, $nodename, $ip, $ref->{hostnames}, $domain;
}
else
{
my $rsp;
delotherinterfaces $nodename, $ref->{otherinterfaces}, $domain;
}
}
else
{
if (xCAT::NetworkUtils->isIpaddr($ip))
{
addnode $callback, $nodename, $ip, $ref->{hostnames}, $domain;
}
else
{
my $rsp;
if (!$ip)
{
push @{$rsp->{data}}, "Ignoring node \'$nodename\', it can not be resolved.";
}
else
{
push @{$rsp->{data}}, "Ignoring node \'$nodename\', its ip address \'$ip\' is not valid.";
push @{$rsp->{data}}, "Ignoring node \'$nodename\', its ip address \'$ip\' is not valid.";
}
xCAT::MsgUtils->message("W", $rsp, $callback);
}
xCAT::MsgUtils->message("W", $rsp, $callback);
}
if (defined($ref->{otherinterfaces}))
{
addotherinterfaces $callback, $nodename, $ref->{otherinterfaces}, $domain;
}
}
} #end foreach
if ($args{hostsref}) {
@{$args{hostsref}} = @hosts;
}
}
if (defined($ref->{otherinterfaces}))
{
addotherinterfaces $callback, $nodename, $ref->{otherinterfaces}, $domain;
}
}
} #end foreach
if ($args{hostsref}) {
@{$args{hostsref}} = @hosts;
}
}
sub process_request
{
Getopt::Long::Configure("bundling");
@ -324,7 +322,7 @@ sub process_request
my $HELP;
my $VERSION;
my $REMOVE;
my $DELNODE;
my $DELNODE;
my $usagemsg =
"Usage: makehosts <noderange> [-d] [-n] [-l] [-a] [-o] [-m]\n makehosts -h\n makehosts -v";
@ -390,14 +388,14 @@ sub process_request
return;
}
# get site domain for backward compatibility
my $sitetab = xCAT::Table->new('site');
if ($sitetab) {
my $dom = $sitetab->getAttribs({key=>'domain'},'value');
if ($dom and $dom->{value}) {
$::sitedomain=$dom->{value};
}
}
# get site domain for backward compatibility
my $sitetab = xCAT::Table->new('site');
if ($sitetab) {
my $dom = $sitetab->getAttribs({key=>'domain'},'value');
if ($dom and $dom->{value}) {
$::sitedomain=$dom->{value};
}
}
my $hoststab = xCAT::Table->new('hosts');
my $domain;
@ -431,9 +429,9 @@ sub process_request
}
# the contents of the /etc/hosts file is saved in the @hosts array
# the @hosts elements are updated and used to re-create the
# /etc/hosts file at the end by the writeout subroutine.
# the contents of the /etc/hosts file is saved in the @hosts array
# the @hosts elements are updated and used to re-create the
# /etc/hosts file at the end by the writeout subroutine.
open($lockh, ">", "/tmp/xcat/hostsfile.lock");
flock($lockh, LOCK_EX);
my $rconf;
@ -465,21 +463,21 @@ sub process_request
}
my $linklocal = xCAT::NetworkUtils->linklocaladdr($mac);
my $netn;
my $netn;
($domain, $netn) = &getIPdomain($linklocal, $callback);
if (!$domain) {
if ($::sitedomain) {
$domain=$::sitedomain;
} elsif ($::XCATSITEVALS{domain}) {
$domain=$::XCATSITEVALS{domain};
} else {
my $rsp;
push @{$rsp->{data}}, "No domain can be determined for node \'$node\'. The domain of the xCAT node must be provided in an xCAT network definition or the xCAT site definition.\n";
xCAT::MsgUtils->message("W", $rsp, $callback);
next;
}
}
if (!$domain) {
if ($::sitedomain) {
$domain=$::sitedomain;
} elsif ($::XCATSITEVALS{domain}) {
$domain=$::XCATSITEVALS{domain};
} else {
my $rsp;
push @{$rsp->{data}}, "No domain can be determined for node \'$node\'. The domain of the xCAT node must be provided in an xCAT network definition or the xCAT site definition.\n";
xCAT::MsgUtils->message("W", $rsp, $callback);
next;
}
}
if ($DELNODE)
{
@ -493,7 +491,7 @@ sub process_request
}
else
{
add_hosts_content(nodelist=>$req->{node},callback=>$callback,delnode=>$DELNODE,domain=>$domain);
add_hosts_content(nodelist=>$req->{node},callback=>$callback,delnode=>$DELNODE,domain=>$domain);
} # end else
# do the other node nics - if any
@ -515,14 +513,14 @@ sub process_request
push @allnodes, $_->{node};
my $netn;
($domain, $netn) = &getIPdomain($_->{ip});
if (!$domain) {
my $netn;
($domain, $netn) = &getIPdomain($_->{ip});
if (!$domain) {
$domain=$::sitedomain;
}
if (!$domain) {
if (!$domain) {
$domain=$::XCATSITEVALS{domain};
}
}
if (xCAT::NetworkUtils->isIpaddr($_->{ip}))
{
@ -569,13 +567,13 @@ sub writeout
=head3 donics
Add the additional network interfaces for a list of nodes as
indicated in the nics table
indicated in the nics table
Arguments:
node name
node name
Returns:
0 - ok
1 - error
0 - ok
1 - error
Globals:
@ -601,8 +599,8 @@ sub donics
foreach my $node (@nodelist)
{
my $nich;
my %nicindex;
my $nich;
my %nicindex;
# get the nic info
my $et =
@ -615,64 +613,64 @@ sub donics
]
);
# only require IP for nic
# only require IP for nic
if ( !($et->{nicips}) ) {
next;
}
# gather nics info
# delimiter could be ":" or "!"
# new $et->{nicips} looks like
# "eth0!11.10.1.1,eth1!60.0.0.5|60.0.0.250..."
# gather nics info
# delimiter could be ":" or "!"
# new $et->{nicips} looks like
# "eth0!11.10.1.1,eth1!60.0.0.5|60.0.0.250..."
my @nicandiplist = split(',', $et->{'nicips'});
foreach (@nicandiplist)
{
my ($nicname, $nicip);
my ($nicname, $nicip);
# if it contains a "!" then split on "!"
if ($_ =~ /!/) {
($nicname, $nicip) = split('!', $_);
} else {
($nicname, $nicip) = split(':', $_);
}
# if it contains a "!" then split on "!"
if ($_ =~ /!/) {
($nicname, $nicip) = split('!', $_);
} else {
($nicname, $nicip) = split(':', $_);
}
$nicindex{$nicname}=0;
$nicindex{$nicname}=0;
if (!$nicip) {
next;
}
if (!$nicip) {
next;
}
if ( $nicip =~ /\|/) {
my @ips = split( /\|/, $nicip);
foreach my $ip (@ips) {
$nich->{$nicname}->{nicip}->[$nicindex{$nicname}] = $ip;
$nicindex{$nicname}++;
}
} else {
$nich->{$nicname}->{nicip}->[$nicindex{$nicname}] = $nicip;
$nicindex{$nicname}++;
}
}
if ( $nicip =~ /\|/) {
my @ips = split( /\|/, $nicip);
foreach my $ip (@ips) {
$nich->{$nicname}->{nicip}->[$nicindex{$nicname}] = $ip;
$nicindex{$nicname}++;
}
} else {
$nich->{$nicname}->{nicip}->[$nicindex{$nicname}] = $nicip;
$nicindex{$nicname}++;
}
}
my @nicandsufx = split(',', $et->{'nichostnamesuffixes'});
my @nicandprfx = split(',', $et->{'nichostnameprefixes'});
foreach (@nicandsufx)
{
my ($nicname, $nicsufx);
if ($_ =~ /!/) {
($nicname, $nicsufx) = split('!', $_);
} else {
($nicname, $nicsufx) = split(':', $_);
}
my ($nicname, $nicsufx);
if ($_ =~ /!/) {
($nicname, $nicsufx) = split('!', $_);
} else {
($nicname, $nicsufx) = split(':', $_);
}
if ( $nicsufx =~ /\|/) {
my @sufs = split( /\|/, $nicsufx);
my $index=0;
my $index=0;
foreach my $suf (@sufs) {
$nich->{$nicname}->{nicsufx}->[$index] = $suf;
$index++;
$index++;
}
} else {
$nich->{$nicname}->{nicsufx}->[0] = $nicsufx;
@ -680,46 +678,49 @@ sub donics
}
foreach (@nicandprfx)
{
my ($nicname, $nicprfx);
if ($_ =~ /!/) {
($nicname, $nicprfx) = split('!', $_);
} else {
($nicname, $nicprfx) = split(':', $_);
}
my ($nicname, $nicprfx);
if ($_ =~ /!/) {
($nicname, $nicprfx) = split('!', $_);
} else {
($nicname, $nicprfx) = split(':', $_);
}
if ( $nicprfx =~ /\|/) {
if ( defined($nicprfx) && $nicprfx =~ /\|/) {
my @prfs = split( /\|/, $nicprfx);
my $index=0;
my $index=0;
foreach my $prf (@prfs) {
$nich->{$nicname}->{nicprfx}->[$index] = $prf;
$index++;
$index++;
}
} else {
$nich->{$nicname}->{nicprfx}->[0] = $nicprfx;
}
}
# see if we need to fill in a default suffix
# nich has all the valid nics - ie. that have IPs provided!
foreach my $nic (keys %{$nich}) {
for (my $i = 0; $i < $nicindex{$nic}; $i++ ){
if (!$nich->{$nic}->{nicsufx}->[$i] && !$nich->{$nic}->{nicprfx}->[$i]) {
# then we have no suffix at all for this
# so set a default
$nich->{$nic}->{nicsufx}->[$i] = "-$nic";
}
}
}
# see if we need to fill in a default suffix
# nich has all the valid nics - ie. that have IPs provided!
foreach my $nic (keys %{$nich}) {
unless (defined ($nicindex{$nic})) {
$nicindex{$nic} = 0;
}
for (my $i = 0; $i < $nicindex{$nic}; $i++ ){
if (!$nich->{$nic}->{nicsufx}->[$i] && !$nich->{$nic}->{nicprfx}->[$i]) {
# then we have no suffix at all for this
# so set a default
$nich->{$nic}->{nicsufx}->[$i] = "-$nic";
}
}
}
my @nicandnetwrk = split(',', $et->{'nicnetworks'});
foreach (@nicandnetwrk)
{
my ($nicname, $netwrk);
if ($_ =~ /!/) {
($nicname, $netwrk) = split('!', $_);
} else {
($nicname, $netwrk) = split(':', $_);
}
my ($nicname, $netwrk);
if ($_ =~ /!/) {
($nicname, $netwrk) = split('!', $_);
} else {
($nicname, $netwrk) = split(':', $_);
}
if (!$netwrk) {
next;
@ -737,7 +738,10 @@ sub donics
}
}
my @nicandnicalias = split(',', $et->{'nicaliases'});
my @nicandnicalias;
if (defined($et->{'nicaliases'})) {
@nicandnicalias = split(',', $et->{'nicaliases'});
}
foreach (@nicandnicalias)
{
my ($nicname, $aliases);
@ -762,78 +766,82 @@ sub donics
}
}
# end gather nics info
# end gather nics info
# add or delete nic entries in the hosts file
foreach my $nic (keys %{$nich}) {
# add or delete nic entries in the hosts file
foreach my $nic (keys %{$nich}) {
# make sure we have the short hostname
my $shorthost;
($shorthost = $node) =~ s/\..*$//;
for (my $i = 0; $i < $nicindex{$nic}; $i++ ){
my $nicip = "";
my $nicsuffix = "";
my $nicprefix = "";
my $nicnetworks = "";
my $nicaliases = "";
$nicip = $nich->{$nic}->{nicip}->[$i] if (defined ($nich->{$nic}->{nicip}->[$i]));
$nicsuffix = $nich->{$nic}->{nicsufx}->[$i] if (defined($nich->{$nic}->{nicsufx}->[$i]));
$nicprefix = $nich->{$nic}->{nicprfx}->[$i] if (defined($nich->{$nic}->{nicprfx}->[$i]));
$nicnetworks = $nich->{$nic}->{netwrk}->[$i] if (defined($nich->{$nic}->{netwrk}->[$i]));
$nicaliases = $nich->{$nic}->{nicaliases}->[$i] if (defined($nich->{$nic}->{nicaliases}->[$i]));
for (my $i = 0; $i < $nicindex{$nic}; $i++ ){
if (!$nicip) {
next;
}
my $nicip = $nich->{$nic}->{nicip}->[$i];
my $nicsuffix = $nich->{$nic}->{nicsufx}->[$i];
my $nicprefix = $nich->{$nic}->{nicprfx}->[$i];
my $nicnetworks = $nich->{$nic}->{netwrk}->[$i];
my $nicaliases = $nich->{$nic}->{nicaliases}->[$i];
# construct hostname for nic
my $nichostname = "$nicprefix$shorthost$nicsuffix";
if (!$nicip) {
next;
}
# get domain from network def provided by nic attr
my $nt = $nettab->getAttribs({ netname => "$nicnetworks"}, 'domain');
# look up the domain as a check or if it's not provided
my ($ndomain, $netn) = &getIPdomain($nicip, $callback);
# construct hostname for nic
my $nichostname = "$nicprefix$shorthost$nicsuffix";
# get domain from network def provided by nic attr
my $nt = $nettab->getAttribs({ netname => "$nicnetworks"}, 'domain');
# look up the domain as a check or if it's not provided
my ($ndomain, $netn) = &getIPdomain($nicip, $callback);
if ( $nt->{domain} && $ndomain ) {
# if they don't match we may have a problem.
if($nicnetworks ne $netn) {
my $rsp;
push @{$rsp->{data}}, "The xCAT network name listed for
if ( $nt->{domain} && $ndomain ) {
# if they don't match we may have a problem.
if($nicnetworks ne $netn) {
my $rsp;
push @{$rsp->{data}}, "The xCAT network name listed for
\'$nichostname\' is \'$nicnetworks\' however the nic IP address \'$nicip\' seems to be in the \'$netn\' network.\nIf there is an error then makes corrections to the database definitions and re-run this command.\n";
xCAT::MsgUtils->message("W", $rsp, $callback);
}
}
xCAT::MsgUtils->message("W", $rsp, $callback);
}
}
# choose a domain
my $nicdomain;
if ( $ndomain ) {
# use the one based on the ip address
$nicdomain=$ndomain;
} elsif ( $nt->{domain} ) {
# then try the one provided in the nics entry
$nicdomain=$nt->{domain};
} elsif ( $::sitedomain) {
# try the site domain for backward compatibility
$nicdomain=$::sitedomain;
} elsif ($::XCATSITEVALS{domain}) {
$nicdomain=$::XCATSITEVALS{domain};
} else {
my $rsp;
push @{$rsp->{data}}, "No domain can be determined for the NIC IP value of \'$nicip\'. The network domains must be provided in an xCAT network definition or the xCAT site definition.\n";
xCAT::MsgUtils->message("W", $rsp, $callback);
next;
}
# choose a domain
my $nicdomain;
if ( $ndomain ) {
# use the one based on the ip address
$nicdomain=$ndomain;
} elsif ( $nt->{domain} ) {
# then try the one provided in the nics entry
$nicdomain=$nt->{domain};
} elsif ( $::sitedomain) {
# try the site domain for backward compatibility
$nicdomain=$::sitedomain;
} elsif ($::XCATSITEVALS{domain}) {
$nicdomain=$::XCATSITEVALS{domain};
} else {
my $rsp;
push @{$rsp->{data}}, "No domain can be determined for the NIC IP value of \'$nicip\'. The network domains must be provided in an xCAT network definition or the xCAT site definition.\n";
xCAT::MsgUtils->message("W", $rsp, $callback);
next;
}
if ($delnode)
{
delnode $nichostname, $nicip, '', $nicdomain;
}
else
{
addnode $callback, $nichostname, $nicip, $nicaliases, $nicdomain, 1;
}
if ($delnode)
{
delnode $nichostname, $nicip, '', $nicdomain;
}
else
{
addnode $callback, $nichostname, $nicip, $nicaliases, $nicdomain, 1;
}
} # end for each index
} # end for each nic
} # end for each node
if ($args{hostsref}) {
@{$args{hostsref}} = @hosts;
@{$args{hostsref}} = @hosts;
}
$nettab->close;
@ -846,12 +854,12 @@ sub donics
=head3 getIPdomain
Find the xCAT network definition match the IP and then return the
domain value from that network def.
Find the xCAT network definition match the IP and then return the
domain value from that network def.
Arguments:
node IP
callback
node IP
callback
Returns:
domain and netname - ok
undef - error

View File

@ -789,12 +789,25 @@ sub setnetinfo {
else {
return(1,"configuration of $subcommand is not implemented currently");
}
unless ($sessdata->{netinfo_setinprogress}) {
$sessdata->{netinfo_setinprogress} = '1';
$sessdata->{ipmisession}->subcmd(netfn=>$netfun, command=>0x01, data=>[$channel_number,0x0,0x1], callback=>\&setnetinfo,callback_args=>$sessdata);
}
my $command = shift @cmd;
$sessdata->{ipmisession}->subcmd(netfn=>$netfun,command=>$command,data=>\@cmd,callback=>\&netinfo_set,callback_args=>$sessdata);
}
sub netinfo_set {
my $rsp = shift;
my $sessdata = shift;
if ($sessdata->{netinfo_setinprogress}) {
my $channel_number = $sessdata->{ipmisession}->{currentchannel};
delete $sessdata->{netinfo_setinprogress};
$sessdata->{rsp}->{error} = $rsp->{error};
$sessdata->{rsp}->{code} = $rsp->{code};
$sessdata->{ipmisession}->subcmd(netfn=>0x0c, command=>0x01, data=>[$channel_number,0x0,0x0], callback=>\&netinfo_set,callback_args=>$sessdata);
} else {
$rsp = $sessdata->{rsp};
}
if ($rsp->{error}) {
xCAT::SvrUtils::sendmsg([1,$rsp->{error}],$callback,$sessdata->{node},%allerrornodes);
return;
@ -886,6 +899,7 @@ sub getnetinfo_response {
my $rsp = shift;
my $sessdata = shift;
my $subcommand = $sessdata->{subcommand};
$subcommand =~ s/=.*//;
$sessdata->{subcommand} = shift @{$sessdata->{extraargs}};
if ($rsp->{error}) {
xCAT::SvrUtils::sendmsg([1,$rsp->{error}],$callback,$sessdata->{node},%allerrornodes);

View File

@ -1979,20 +1979,24 @@ sub addkitcomp
# Read serverrole from osimage.
$os{$osimage}{serverrole} = lc($osimagetable->{'serverrole'});
} elsif ( !$osimagetable or !$osimagetable->{'osname'} ) {
} elsif ( !$osimagetable ) {
my %rsp;
push@{ $rsp{data} }, "osimage $osimage does not contains a valid 'osname' attribute";
push@{ $rsp{data} }, "osimage $osimage does not exist";
xCAT::MsgUtils->message( "E", \%rsp, $callback );
return 1;
} elsif ( !$osimagetable->{'osname'} ) {
my %rsp;
push@{ $rsp{data} }, "osimage $osimage does not contain a valid 'osname' attribute";
xCAT::MsgUtils->message( "E", \%rsp, $callback );
return 1;
} elsif ( !$osimagetable->{'osvers'} ) {
my %rsp;
push@{ $rsp{data} }, "osimage $osimage does not contains a valid 'osvers' attribute";
push@{ $rsp{data} }, "osimage $osimage does not contain a valid 'osvers' attribute";
xCAT::MsgUtils->message( "E", \%rsp, $callback );
return 1;
} elsif ( !$osimagetable->{'osarch'} ) {
my %rsp;
push@{ $rsp{data} }, "osimage $osimage does not contains a valid 'osarch' attribute";
push@{ $rsp{data} }, "osimage $osimage does not contain a valid 'osarch' attribute";
xCAT::MsgUtils->message( "E", \%rsp, $callback );
return 1;
} else {
@ -2893,7 +2897,8 @@ sub rmkitcomp
$inlist = 1;
}
if ( $kitcomps{$kitcomponent}{prerequisite} ) {
if ( $line =~ /^$kitreponame\/prep_$basename$/ ) {
if (( $line =~ /^$kitreponame\/prep_$basename$/ ) ||
( $line =~ /^$kitreponame\/prep-$basename$/ )) {
if ( $inlist ) {
$num--;
foreach ( 1..$num ) {
@ -3336,20 +3341,24 @@ sub chkkitcomp
# Read serverrole from osimage.
$os{$osimage}{serverrole} = lc($osimagetable->{'serverrole'});
} elsif ( !$osimagetable or !$osimagetable->{'osname'} ) {
} elsif ( !$osimagetable ) {
my %rsp;
push@{ $rsp{data} }, "osimage $osimage does not contains a valid 'osname' attribute";
push@{ $rsp{data} }, "osimage $osimage does not exist";
xCAT::MsgUtils->message( "E", \%rsp, $callback );
return 1;
} elsif ( !$osimagetable->{'osname'} ) {
my %rsp;
push@{ $rsp{data} }, "osimage $osimage does not contain a valid 'osname' attribute";
xCAT::MsgUtils->message( "E", \%rsp, $callback );
return 1;
} elsif ( !$osimagetable->{'osvers'} ) {
my %rsp;
push@{ $rsp{data} }, "osimage $osimage does not contains a valid 'osvers' attribute";
push@{ $rsp{data} }, "osimage $osimage does not contain a valid 'osvers' attribute";
xCAT::MsgUtils->message( "E", \%rsp, $callback );
return 1;
} elsif ( !$osimagetable->{'osarch'} ) {
my %rsp;
push@{ $rsp{data} }, "osimage $osimage does not contains a valid 'osarch' attribute";
push@{ $rsp{data} }, "osimage $osimage does not contain a valid 'osarch' attribute";
xCAT::MsgUtils->message( "E", \%rsp, $callback );
return 1;
} else {

View File

@ -53,6 +53,9 @@ sub process_request {
if (! $arch) {
$callback->({error=>"Need to specify architecture (x86, x86_64 or ppc64)"},{errorcode=>[1]});
return;
} elsif ( $arch eq "ppc64le" or $arch eq "ppc64el" ) {
$callback->({data=>"The arch:$arch is not supported at present, pls use \"ppc64\" instead"});
return;
}
unless (-d "$::XCATROOT/share/xcat/netboot/$arch" or -d "$::XCATROOT/share/xcat/netboot/genesis/$arch") {
$callback->({error=>"Unable to find directory $::XCATROOT/share/xcat/netboot/$arch or $::XCATROOT/share/xcat/netboot/genesis/$arch",errorcode=>[1]});
@ -78,6 +81,9 @@ sub process_request {
$callback->({error=>["Failed to create a temporary directory"],errorcode=>[1]});
return;
}
unless (-e "$tftpdir/xcat") {
mkpath("$tftpdir/xcat");
}
my $rc;
my $invisibletouch=0;
if (-e "$::XCATROOT/share/xcat/netboot/genesis/$arch") {
@ -117,6 +123,7 @@ sub process_request {
system("ssh-keygen -t rsa -f $tempdir/etc/ssh_host_rsa_key -C '' -N ''");
system("ssh-keygen -t dsa -f $tempdir/etc/ssh_host_dsa_key -C '' -N ''");
}
my $initrd_file = undef;
my $lzma_exit_value=1;
if ($invisibletouch) {
my $done=0;
@ -129,18 +136,25 @@ sub process_request {
unlink ("$tftpdir/xcat/genesis.fs.$arch.lzma");
} else {
$done = 1;
$initrd_file = "$tftpdir/xcat/genesis.fs.$arch.lzma";
}
}
if (not $done) {
$callback->({data=>["Creating genesis.fs.$arch.gz in $tftpdir/xcat"]});
system("cd $tempdir; find . | cpio -o -H newc | gzip -9 > $tftpdir/xcat/genesis.fs.$arch.gz");
$initrd_file = "$tftpdir/xcat/genesis.fs.$arch.gz";
}
} else {
$callback->({data=>["Creating nbfs.$arch.gz in $tftpdir/xcat"]});
system("cd $tempdir; find . | cpio -o -H newc | gzip -9 > $tftpdir/xcat/nbfs.$arch.gz");
$initrd_file = "$tftpdir/xcat/nbfs.$arch.gz";
}
system ("rm -rf $tempdir");
unless ($initrd_file) {
$callback->({data=>["Creating filesystem file in $tftpdir/xcat failed"]});
return;
}
my $hexnets = xCAT::NetworkUtils->my_hexnets();
my $normnets = xCAT::NetworkUtils->my_nets();
my $consolecmdline;
@ -170,7 +184,7 @@ sub process_request {
chmod(0644,"$tftpdir/pxelinux.0");
}
} elsif ($arch =~ /ppc/) {
mkpath("$tftpdir/etc");
mkpath("$tftpdir/pxelinux.cfg/p/");
}
my $dopxe=0;
foreach (keys %{$normnets}) {
@ -231,6 +245,14 @@ sub process_request {
close($cfg);
}
} elsif ($arch =~ /ppc/) {
open($cfgfile,">", "$tftpdir/pxelinux.cfg/p/$net");
print $cfgfile "default xCAT\n";
print $cfgfile " label xCAT\n";
print $cfgfile " kernel http://".$normnets->{$_}.":80/$tftpdir/xcat/genesis.kernel.$arch\n";
print $cfgfile " initrd http://".$normnets->{$_}.":80/$initrd_file\n";
print $cfgfile ' append "quiet xcatd='.$normnets->{$_}.":$xcatdport $consolecmdline\"\n";
close($cfgfile);
}
}
$dopxe=0;
@ -262,11 +284,11 @@ sub process_request {
close($cfgfile);
} elsif ($arch =~ /ppc/) {
open($cfgfile,">","$tftpdir/etc/".lc($_));
print $cfgfile "timeout=5\n";
print $cfgfile " label=xcat\n";
print $cfgfile " image=xcat/nbk.$arch\n";
print $cfgfile " initrd=xcat/nbfs.$arch.gz\n";
print $cfgfile ' append="quiet xcatd='.$hexnets->{$_}.":$xcatdport $consolecmdline\"\n";
print $cfgfile "default xCAT\n";
print $cfgfile " label xCAT\n";
print $cfgfile " kernel http://".$hexnets->{$_}.":80/$tftpdir/xcat/genesis.kernel.$arch\n";
print $cfgfile " initrd http://".$hexnets->{$_}.":80/$initrd_file\n";
print $cfgfile ' append "quiet xcatd='.$hexnets->{$_}.":$xcatdport $consolecmdline\"\n";
close($cfgfile);
}
}

View File

@ -353,6 +353,10 @@ sub process_request {
$callback->({error=> ["The node [$node] should have a correct IP address which belongs to the management network."], errorcode=>["1"]});
return;
}
if (defined ($request->{pbmc_node}) and defined($request->{pbmc_node}->[0]) ) {
my $pbmc_node = $request->{pbmc_node}->[0];
xCAT::Utils->cleanup_for_powerLE_hardware_discovery($node, $pbmc_node, $doreq);
}
my $restartstring = "restart";
if (scalar @forcenics > 0) {

View File

@ -130,6 +130,17 @@ sub findme {
$node = $allnodes[0];
}
}
my $pbmc_node = undef;
if ($request->{'mtm'}->[0] and $request->{'serial'}->[0]) {
my $mtms = $request->{'mtm'}->[0]."*".$request->{'serial'}->[0];
my $tmp_nodes = $::XCATVPDHASH{$mtms};
foreach (@$tmp_nodes) {
if ($::XCATPPCHASH{$_}) {
$pbmc_node = $_;
}
}
}
if ($node) {
my $skiphostip;
@ -363,8 +374,13 @@ sub findme {
}
# call the discovered command to update the discovery request to a node
$request->{command}=['discovered'];
$request->{noderange} = [$node];
if ($pbmc_node) {
$request->{pbmc_node} = [$pbmc_node];
}
$request->{discoverymethod} = ['sequential'];
$request->{updateswitch} = ['yes'];
$subreq->($request);

View File

@ -1645,6 +1645,9 @@ sub copycd
if (not $darch and m/^BASEARCHS\s+(\S+)/) {
$darch = $1;
}
if (not $darch and m/^REPOID.*\/(\S+)/) {
$darch = $1;
}
}
close($dinfo);
unless ($darch)
@ -1672,7 +1675,7 @@ sub copycd
my $prod = <$mfile>;
close($mfile);
if ($prod =~ m/SUSE-Linux-Enterprise-Server/ || $prod =~ m/SUSE-Linux-Enterprise-Software-Development-Kit/)
if ($prod =~ m/SUSE-Linux-Enterprise-Server/ || $prod =~ m/SUSE-Linux-Enterprise-Software-Development-Kit/ || $prod =~ m/SLES/)
{
if (-f "$mntpath/content") {
my $content;
@ -1685,6 +1688,12 @@ sub copycd
$detdistname = "sles".$verpair[1];
unless ($distname) { $distname = $detdistname; }
}
unless ($distname) {
if (/^DISTRO/) {
$_ =~ /sles:(\d+),/;
$distname = "sles".$1;
}
}
}
} else {
my @parts = split /\s+/, $prod;

View File

@ -157,6 +157,16 @@ sub process_request {
if ($node) { last; }
}
}
my $pbmc_node = undef;
if ($req->{'mtm'}->[0] and $req->{'serial'}->[0]) {
my $mtms = $req->{'mtm'}->[0]."*".$req->{'serial'}->[0];
my $tmp_nodes = $::XCATVPDHASH{$mtms};
foreach (@$tmp_nodes) {
if ($::XCATPPCHASH{$_}) {
$pbmc_node = $_;
}
}
}
if ($node) {
my $mactab = xCAT::Table->new('mac',-create=>1);
@ -169,6 +179,9 @@ sub process_request {
#$doreq->(\%request);
$req->{command}=['discovered'];
$req->{noderange} = [$node];
if ($pbmc_node) {
$req->{pbmc_node} = [$pbmc_node];
}
$req->{discoverymethod} = ['switch'];
$doreq->($req);
%{$req}=();#Clear req structure, it's done..

View File

@ -1873,22 +1873,25 @@ sub mknb
# the xCAT-genesis-base.spec file touches /etc/xcat/genesis-base-updated,
# so we know to run mknb here.
my $cmd;
if ($::arch eq "x86_64" && (-f '/etc/xcat/genesis-scripts-updated') ) {
if ($::arch =~ /ppc/) {
$::arch = "ppc64";
}
if ((($::arch eq "x86_64") ||($::arch =~ /ppc/)) && (-f '/etc/xcat/genesis-scripts-updated') ) {
unlink '/etc/xcat/genesis-scripts-updated';
# Do not print messages or run command twice
if (-f '/etc/xcat/genesis-base-updated') {
unlink '/etc/xcat/genesis-base-updated';
}
$cmd = "$::XCATROOT/sbin/mknb $::arch";
xCAT::MsgUtils->message('I', "Running '$cmd', triggered by the installation/update of xCAT-genesis-scripts-x86_64 ...");
xCAT::MsgUtils->message('I', "Running '$cmd', triggered by the installation/update of xCAT-genesis-scripts-$::arch ...");
}
if ($::arch eq "x86_64" && (-f '/etc/xcat/genesis-base-updated')) {
if ((($::arch eq "x86_64") ||($::arch =~ /ppc/)) && (-f '/etc/xcat/genesis-base-updated')) {
unlink '/etc/xcat/genesis-base-updated';
$cmd = "$::XCATROOT/sbin/mknb $::arch";
xCAT::MsgUtils->message('I', "Running '$cmd', triggered by the installation/update of xCAT-genesis-base-x86_64 ...");
xCAT::MsgUtils->message('I', "Running '$cmd', triggered by the installation/update of xCAT-genesis-base-$::arch ...");
}
#my $outref = xCAT::Utils->runcmd("$cmd", 0);
my $outref = xCAT::Utils->runcmd("$cmd", 0);
if ($cmd) {
system($cmd);
if ($? != 0) {

View File

@ -280,6 +280,7 @@ my $socket;
$SIG{USR2} = sub {
if ($socket) { #do not mess with pid file except when we still have the socket.
unlink("/var/run/xcat/installservice.pid"); close($socket); $quit=1;
$udpctl=0;
xCAT::MsgUtils->message("S","xcatd install monitor $$ quiescing");
}
};
@ -542,8 +543,15 @@ sub do_discovery_process {
my $vintage = time();
$dispatch_requests=0;
populate_site_hash();
populate_vpd_hash();
populate_ppc_hash();
while (not $quit) {
if ((time()-$vintage)> 15) { populate_site_hash(); } #site table reread every 15 second
if ((time()-$vintage)> 15) {
populate_site_hash();
populate_vpd_hash();
populate_ppc_hash();
$vintage = time();
} #site table reread every 15 second
my $msg = fd_retrieve($broker);
my $data;
my $client;
@ -612,6 +620,7 @@ sub do_udp_service { #This function opens up a UDP port
if ($socket) {
#only clear out pid file when we still have socket.
unlink("/var/run/xcat/udpservice.pid"); close($socket); $quit=1; $socket=0;
$udpctl=0;
xCAT::MsgUtils->message("S","xcatd udp service $$ quiescing");
}
kill(15,$discopid);
@ -857,7 +866,9 @@ sub ssl_reaper {
$numdone--;
}
}
store_fd({clientcountchange=>$numdone,sslclientcount=>$sslclients},$udpctl); #notify udp service of how many clients are active
if ($udpctl) {
store_fd({clientcountchange=>$numdone,sslclientcount=>$sslclients},$udpctl); #notify udp service of how many clients are active
}
$SIG{CHLD} = \&ssl_reaper;
}
@ -923,12 +934,14 @@ if (! defined $pid_UDP) {
die;
}
unless ($pid_UDP) {
close($udpctl);
close($udpctl); $udpctl=0;
$$progname="xcatd: UDP listener";
my $pid_disco;
my $discoctl;
my $udpbroker;
socketpair($discoctl,$udpbroker,AF_UNIX,SOCK_STREAM,PF_UNSPEC);
$udpbroker->autoflush(1);
$discoctl->autoflush(1);
$pid_disco = xCAT::Utils->xfork;
if (!defined $pid_disco) {
xCAT::MsgUtils->message("S", "Unable to fork for UDP/TCP");
@ -952,7 +965,7 @@ if (! defined $pid_MON) {
}
unless ($pid_MON) {
$$progname="xcatd: install monitor";
close($udpctl);
close($udpctl); $udpctl=0;
do_installm_service;
xexit(0);
}
@ -1001,6 +1014,7 @@ my $mainpidfile;
$SIG{USR2} = sub {
if ($listener) {
unlink("/var/run/xcat/mainservice.pid"); close($listener); $quit=1; $listener=0;
$udpctl=0;
xCAT::MsgUtils->message("S","xcatd main service $$ quiescing");
}
};
@ -1115,7 +1129,7 @@ until ($quit) {
}
if ($child == 0) {
close($udpctl);
close($udpctl); $udpctl=0;
$SIG{TERM} = $SIG{INT} = {};
$SIG{CHLD} = \&generic_reaper; #THROTTLE
$listener->close;
@ -1196,7 +1210,9 @@ if ($inet6support) {
xexit(0);
}
$sslclients++; #THROTTLE
store_fd({clientcountchange=>1,sslclientcount=>$sslclients},$udpctl); #notify udp service of how many clients are active
if ($udpctl) {
store_fd({clientcountchange=>1,sslclientcount=>$sslclients},$udpctl); #notify udp service of how many clients are active
}
$cnnection->close();
}
if (open($mainpidfile,"<","/var/run/xcat/mainservice.pid")) {
@ -2035,6 +2051,29 @@ sub populate_site_hash {
}
}
sub populate_vpd_hash {
%::XCATVPDHASH=();
my $vpdtab = xCAT::Table->new('vpd',-create=>0);
unless ($vpdtab) {return;}
my @entries = $vpdtab->getAllAttribs(qw/node serial mtm/);
foreach (@entries) {
unless ($_->{mtm} and $_->{serial}) {next;}
my $mtms = $_->{mtm}."*".$_->{serial};
push @{$::XCATVPDHASH{$mtms}}, $_->{node};
}
}
sub populate_ppc_hash {
%::XCATPPCHASH=();
my $ppctab = xCAT::Table->new('ppc',-create=>0);
unless ($ppctab) {return;}
my @entries = $ppctab->getAllAttribs(qw/node nodetype/);
foreach (@entries) {
if ($_->{nodetype} and $_->{nodetype} eq 'pbmc') {
$::XCATPPCHASH{$_->{node}}=$_->{nodetype};
}
}
}
sub send_response {
my $response = shift;
my $sock = shift;

View File

@ -0,0 +1 @@
xcat/xcat-dep/rh5/x86_64/systemimager-client

View File

@ -0,0 +1 @@
xcat/xcat-dep/rh6/ppc64/systemimager-client

View File

@ -0,0 +1 @@
xcat/xcat-dep/rh7/ppc64/systemimager-client

View File

@ -0,0 +1 @@
xcat/xcat-dep/rh7/x86_64/systemimager-client

View File

@ -13,8 +13,14 @@ if [ -z "$PRINIC" ]
then
for karg in $(cat /proc/cmdline |sed -e 's/-/:/g' -e 's/ /\n/g'); do
if [ "${karg%%=*}" = "BOOTIF" ]; then
MACADDR="${karg#*=}";
#The BOOTIF in pxelinux will be the MAC address with the hardware type code as a prefix
#such as BOOTIF=01-40-f2-e9-68-de-90
if [ "${#MACADDR}" == "20" ]; then
MACADDR=${MACADDR:3:21}
fi
#export PRINIC=`ifconfig -a|grep -i "hwaddr ${karg#*=01:}"|awk '{print $1}'`
export PRINIC=`ip -o link|grep -i "${karg#*=}"|awk '{print $2}'|sed s/://`
export PRINIC=`ip -o link|grep -i "$MACADDR"|awk '{print $2}'|sed s/://`
fi
done
if [ -z "$PRINIC" ]; then

View File

@ -12,13 +12,16 @@ if [ -z "$PRINIC" ]
then
export PRINIC=eth0
elif [[ `echo "$PRINIC" | grep -sqE ^[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+$ ;echo $?` == "0" ]]; then
export PRINIC=`ifconfig -a | grep -i "HWaddr $PRINIC" | awk '{print $1}'`
#export PRINIC=`ifconfig -a | grep -i "HWaddr $PRINIC" | awk '{print $1}'`
export PRINIC=`ip -o link|grep -i "$PRINIC" |awk '{print $2}'|sed s/://`
fi
IP=$(ifconfig $PRINIC | grep inet | awk '{print $2}' | awk -F: '{print $2}')
#IP=$(ifconfig $PRINIC | grep inet | awk '{print $2}' | awk -F: '{print $2}')
IP=$(ip addr show dev $PRINIC | grep inet | grep -v inet6 | awk '{print $2}' | head -n 1 | awk -F '/' '{print $1}')
if [ -z $IP ]
then
dhclient eth0
IP=$(ifconfig $PRINIC | grep inet | awk '{print $2}' | awk -F: '{print $2}')
#IP=$(ifconfig $PRINIC | grep inet | awk '{print $2}' | awk -F: '{print $2}')
IP=$(ip addr show dev $PRINIC | grep inet | grep -v inet6 | awk '{print $2}' | head -n 1 | awk -F '/' '{print $1}')
fi
echo "search #TABLE:site:key=domain:value#" >/etc/resolv.conf
for i in $(echo #TABLE:site:key=nameservers:value# | tr ',' ' ')

View File

@ -0,0 +1 @@
xcat/xcat-dep/sles11/ppc64/systemimager-client

View File

@ -0,0 +1 @@
../rh/dracut_033

View File

@ -0,0 +1 @@
../rh/dracut_033

View File

@ -0,0 +1 @@
../rh/dracut_033

View File

@ -338,9 +338,10 @@ unless ($onlyinitrd) {
#add the other package directory to for apt-get install
open ($aptconfig,">","$rootimg_dir/etc/apt/sources.list.d/genimage.apt.list");
if ($otherpkgsdir_local){
print $aptconfig "deb file://$otherpkgsdir_local ./\n";
}
#if ($otherpkgsdir_local){
# # print $aptconfig "deb file://$otherpkgsdir_local ./\n";
# print $aptconfig "deb file:///mnt/otherpkgdir/ ./\n";
#}
if ($otherpkgsdir_internet){
print $aptconfig $otherpkgsdir_internet;
}
@ -367,20 +368,24 @@ unless ($onlyinitrd) {
my %extrapkgnames;
if (keys(%extra_hash) > 0) {
open ($aptconfig,">","$rootimg_dir/etc/apt/sources.list.d/genimage.apt.list");
my $index=1;
foreach $pass (sort {$a <=> $b} (keys(%extra_hash))) {
foreach (keys(%{$extra_hash{$pass}})) {
if($_ eq "INCLUDEBAD") {
print "Unable to open the following pkglist files:\n".join("\n",@{$extra_hash{$pass}{INCLUDEBAD}});
exit 1;
#print "Unable to open the following pkglist files:\n".join("\n",@{$extra_hash{$pass}{INCLUDEBAD}});
xdie "Unable to open the following pkglist files:\n".join("\n",@{$extra_hash{$pass}{INCLUDEBAD}});
# exit 1;
}
if (($_ eq "PRE_REMOVE") || ($_ eq "POST_REMOVE") || ($_ eq "ENVLIST")) { next;}
if ($otherpkgsdir_local) { print $aptconfig "deb file:///mnt/otherpkgdir/$_ ./\n"};
$index++;
my $pa=$extra_hash{$pass}{$_};
$extrapkgnames{$pass} .= " " . join(' ', @$pa);
}
}
close($aptconfig);
$index--;
foreach $pass (sort {$a <=> $b} (keys(%extra_hash))) {
@ -403,7 +408,9 @@ unless ($onlyinitrd) {
# install extra packages
my $aptgetcmd_base = $aptgetcmd;
$aptgetcmd .= " install ";
# to prevent "The following packages cannot be authenticated" error,
# invoke apt-get with "--allow-unauthenticated" option
$aptgetcmd .= " install --allow-unauthenticated ";
# append extra pkg names to yum command
if ($extrapkgnames{$pass}) {
$aptgetcmd .= " $extrapkgnames{$pass} ";
@ -417,8 +424,9 @@ unless ($onlyinitrd) {
print "$envlist $aptgetcmd\n";
my $rc = system("$envlist $aptgetcmd");
if ($rc) {
print "apt-get invocation failed\n";
exit 1;
#print "apt-get invocation failed\n";
#exit 1;
xdie "apt-get invocation failed\n";
}
} else {
print "No Packages marked for install\n";
@ -1743,7 +1751,11 @@ sub mount_chroot {
#system("mount -o bind /sys $rootimage_dir/sys");
system("mount -o bind $pkgdir $rootimage_dir/mnt/pkgdir");
if ($otherpkgdir){
system("mount -o bind $otherpkgdir $rootimage_dir/mnt/otherpkgdir");
if(-d $otherpkgdir){
system("mount -o bind $otherpkgdir $rootimage_dir/mnt/otherpkgdir");
}else{
print "The specified otherpkgdir $otherpkgdir does not exist!\n"
}
}
}

View File

@ -1044,11 +1044,11 @@ sub do_test1
send_msg(2, "start test");
send_msg(2, "******************************");
system("xdsh $MN perl /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_full_installation_flat_ppc64");
sleep 300;
system("xdsh $MN /opt/xcat/bin/xcattest -b bat.bundle");
system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_diskless_installation_flat_ppc64");
system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_statelite_installation_flat_ppc64");
system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_sn_installation_flat_x86_vm");
#system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_diskless_installation_flat_ppc64");
#system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_statelite_installation_flat_ppc64");
#system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_sn_installation_flat_x86_vm");
#if($dsklscnsninst){
# system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_cn_with_sn_diskless_installation_flat_x86_vm");
# system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/");
@ -1081,7 +1081,8 @@ sub do_test1
send_msg(2, "start test");
send_msg(2, "******************************");
system("xdsh $MN perl /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_full_installation_flat_ppc64");
# system("xdsh $MN /opt/xcat/bin/xcattest -b bat.bundle");
sleep 300;
system("xdsh $MN /opt/xcat/bin/xcattest -b bat.bundle");
# system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_sles_diskless_installation_ppc64_flat");
# system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_sles_statelite_installation_flat_ppc64");
# system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_sn_installation_flat_x86_vm");
@ -1491,7 +1492,7 @@ sub send_mail {
my $msg = shift;
my $head;
if($num == 0) {
$head = "xCATreg got fital error with: ";
$head = "xCATreg got fatal error with: ";
} elsif ($num == 1) {
$head = "AUTOMATED REGRESSION TEST REPORT\n";
}
@ -1501,9 +1502,13 @@ sub send_mail {
my $mailprog = "/bin/mail";
my $sendmail = "echo \"$content\"";
send_msg(2, "begin to send mail , the contents is $sendmail\n");
my $send = $sendmail." | $mailprog -s \"$subject\" \"$confkeys{mailgroup}\" ";
system($send);
send_msg(2, "finish sending mail, $send\n");
if ($confkeys{mailgroup}) {
my $send = "$sendmail"." | $mailprog -s \"$subject\" \"$confkeys{mailgroup}\" ";
system($send);
send_msg(2, "finish sending mail, $send\n");
} else {
send_msg(1, "can't send mail to nobody ");
}
return 0;
}

View File

@ -25,7 +25,7 @@ cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-ins
check:rc==0
cmd:rnetboot $$CN
check:rc==0
cmd:sleep 1200
cmd:sleep 1800
cmd:ping $$CN -c 3
check:output=~64 bytes from $$CN
cmd:lsdef -l $$CN | grep status

View File

@ -151,7 +151,7 @@ cmd:tabprune auditlog -a
check:rc==0
cmd:lsdef -t auditlog
check:rc==0
check:output=~auditlog
check:output=~auditlog|Could not find any object
end
start:lsdef_t_eventlog

View File

@ -98,6 +98,19 @@ check:output=~test.file
cmd:xdsh $$TARGET_NODE "hostname"
check:output=~$$TARGET_NODE: $$TARGET_NODE
cmd:xdsh $$GOLDEN_CLIENT "cd / && date > update.flag"
check:rc==0
cmd:imgcapture $$GOLDEN_CLIENT -t sysclone -o goldenclient-osimage-$$GOS-$$MODE -V
check:rc==0
cmd:updatenode $$TARGET_NODE -S
check:rc==0
cmd:xdsh $$TARGET_NODE "ls -l / |grep update.flag"
check:rc==0
check:output=~update.flag
cmd:xdsh $$TARGET_NODE "rm -f /update.flag"
check:rc==0
end

55
xCAT-test/xmlapi/README Normal file
View File

@ -0,0 +1,55 @@
xCAT has an XML input interface to the xCAT tables. The routines are in tabutils.pm and map to the
Table.pm routines by the same name. These routines were written for PCM but are also used in the restapi. They are not a documented api.
For the restapi, check the following for how and which routines are used.
xCAT-server/xCAT-wsapi/xcatws.cgi at all the functions between tablenodehdl() and tablerowdelhdl().
getAllEntries => "tabutils",
getNodesAttribs => "tabutils",
getTablesAllNodeAttribs => "tabutils",
getTablesNodesAttribs => "tabutils",
getTablesAllRowAttribs => "tabutils",
setNodesAttribs => "tabutils",
delEntries => "tabutils",
getAttribs => "tabutils",
setAttribs => "tabutils",
NodeRange => "tabutils",
If you vi /opt/xcat/lib/perl/xCAT_plugin/tabutils.pm, and search for example "sub getAllEntries", you will see documented in the routines comments to input XML format requried and the output XML sent.
To test these routines, I put together a driver program pcmdriver, that generates the test XML and sends it and displays the returned output.
For example:
vi xmldriver in this directory
You will see
$ENV{'XCATXMLTRACE'}=1;
my $XML=`cat /.../xmlapi/getTablesAllRowAttribsreq`;
my $data=$XML;
$ENV{'XCATSHOWXML'}=1;
xCAT::Client::submit_request($data, \&xCAT::Client::handle_response);
exit $xCAT::Client::EXITCODE;
If you vi getTablesAllRowAttribsreq, you will see the following. This is an XML request to get the all rows from the passwd table the attributes username and rack. These is one of these XML request files for all
possible input to the routines in the directory.
XCATXMLTRACE is exported to show the XML that is being sent to xcatd. XCATSHOWXML is exported to display the XML returned to the client.
To get the XML request you must not be running in XCATBYPASS mode, you can get the reponse in XCATBYPASS mode.
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getTablesAllRowAttribs</command>
<table>
<tablename>passwd</tablename>
<attr>username</attr>
</table>
<table>
<tablename>rack</tablename>
<attr>rackname</attr>
</table>
</xcatrequest>

View File

@ -0,0 +1,13 @@
sub setNodeAttribs
sub addNodeAttribs
sub setAttribs
sub setAttribsWhere
sub setNodesAttribs
sub getNodesAttribs
sub getNodeAttribs
sub getAllEntries
sub getAllAttribsWhere
sub getAllNodeAttribs
sub getAllAttribs
sub delEntries
sub getAttribs

View File

@ -0,0 +1,11 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>delEntries</command>
<table>
<name>nodelist</name>
<attr>
<groups>compute1,lissa</groups>
<status>down</status>
</attr>
</table>
</xcatrequest>

View File

@ -0,0 +1,17 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>delEntries</command>
<table>
<name>nodelist</name>
<attrs>
<groups>compute1,lissa</groups>
<status>down</status>
</attrs>
</table>
<table>
<name>nodelist</name>
<attrs>
<groups>compute2</groups>
</attrs>
</table>
</xcatrequest>

View File

@ -0,0 +1,7 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>delEntries</command>
<table>
<name>nodelist</name>
</table>
</xcatrequest>

View File

@ -0,0 +1,35 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>deltbl</command>
<table>tablename</table>
<key>key1</key>
<value>value1</value>
<node>noderange2</node>
.
.
.
or <node>ALL</node>
<attr>attribute1</attr>
<attr>attribute2</attr>
.
.
.
<attr>attributeN</attr>
</xcatrequest>
<xcatresponse>
<rows>
<attr>attribute1</attr>
<value>value1</value>
<attr>attribute2</attr>
<value>value2</value>
.
.
.
.
<attr>attributeN</attr>
<value>valueN</value>
</rows>
<xcatresponse>
<serverdone></serverdone>
</xcatresponse>

View File

@ -0,0 +1,37 @@
# Reads all entries from the input Table
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getAllEntries</command>
<table>tablename</table>
</xcatrequest>
<xcatresponse>
<row>
<attr>attribute1</attr>
<value>value1</value>
<attr>attribute2</attr>
<value>value2</value>
.
.
.
<attr>attributeN</attr>
<value>valueN</value>
</row>
.
.
.
<row>
<attr>attribute1</attr>
<value>value1</value>
<attr>attribute2</attr>
<value>value2</value>
.
.
.
.
<attr>attributeN</attr>
<value>valueN</value>
</row>
</xcatresponse>
<xcatresponse>
<serverdone></serverdone>
</xcatresponse>

View File

@ -0,0 +1,37 @@
# Reads all entries from the input Table
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getAllEntries</command>
<table>tablename</table>
</xcatrequest>
<xcatresponse>
<row>
<attr>attribute1</attr>
<value>value1</value>
<attr>attribute2</attr>
<value>value2</value>
.
.
.
<attr>attributeN</attr>
<value>valueN</value>
</row>
.
.
.
<row>
<attr>attribute1</attr>
<value>value1</value>
<attr>attribute2</attr>
<value>value2</value>
.
.
.
.
<attr>attributeN</attr>
<value>valueN</value>
</row>
</xcatresponse>
<xcatresponse>
<serverdone></serverdone>
</xcatresponse>

View File

@ -0,0 +1,5 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getAllEntries</command>
<table>switch</table>
</xcatrequest>

View File

@ -0,0 +1,5 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getAllEntries</command>
<table>nodelist</table>
</xcatrequest>

View File

@ -0,0 +1,5 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getAllEntries</command>
<table>nodelist</table>
</xcatrequest>

View File

@ -0,0 +1,10 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getAttribs</command>
<table>site</table>
<keys>
<key>domain</key>
</keys>
<attrs>value</attrs>
<attrs>comments</attrs>
</xcatrequest>

View File

@ -0,0 +1,8 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getAttribs</command>
<table>site</table>
<key>domain</key>
<attr>value</attr>
<attr>comments</attr>
</xcatrequest>

View File

@ -0,0 +1,11 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getAttribs</command>
<table>networks</table>
<keys>
<net>11.35.0.0</net>
<mask>255.255.0.0</mask>
</keys>
<attr>netname</attr>
<attr>dhcpserver</attr>
</xcatrequest>

View File

@ -0,0 +1,50 @@
# Reads the table input for the noderange and returns list of attributes
# requested
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getNodeAttribs</command>
<table>tablename</table>
<node>noderange</node>
<attr>attribute1</attr>
<value>value1</value>
<attr>attribute2</attr>
<value>value2</value>
.
.
.
<attr>attributeN</attr>
<value>valueN</value>
</xcatrequest>
<xcatresponse>
<node>nodename1</node>
<row>
<attr>attribute1</attr>
<value>value1</value>
<attr>attribute2</attr>
<value>value2</value>
.
.
.
<attr>attributeN</attr>
<value>valueN</value>
</row>
.
.
.
<node>nodenameN</node>
<row>
<attr>attribute1</attr>
<value>value1</value>
<attr>attribute2</attr>
<value>value2</value>
.
.
.
<attr>attributeN</attr>
<value>valueN</value>
</row>
</xcatresponse>
<xcatresponse>
<serverdone></serverdone>
</xcatresponse>

View File

@ -0,0 +1,50 @@
# Reads the table input for the noderange and returns list of attributes
# requested
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getNodeAttribs</command>
<table>tablename</table>
<node>noderange</node>
<attr>attribute1</attr>
<value>value1</value>
<attr>attribute2</attr>
<value>value2</value>
.
.
.
<attr>attributeN</attr>
<value>valueN</value>
</xcatrequest>
<xcatresponse>
<node>nodename1</node>
<row>
<attr>attribute1</attr>
<value>value1</value>
<attr>attribute2</attr>
<value>value2</value>
.
.
.
<attr>attributeN</attr>
<value>valueN</value>
</row>
.
.
.
<node>nodenameN</node>
<row>
<attr>attribute1</attr>
<value>value1</value>
<attr>attribute2</attr>
<value>value2</value>
.
.
.
<attr>attributeN</attr>
<value>valueN</value>
</row>
</xcatresponse>
<xcatresponse>
<serverdone></serverdone>
</xcatresponse>

View File

@ -0,0 +1,8 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getNodesAttribs</command>
<table>nodelist</table>
<noderange>blade01-blade02</noderange>
<attr>groups</attr>
<attr>status</attr>
</xcatrequest>

View File

@ -0,0 +1,7 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getNodesAttribs</command>
<table>nodelist</table>
<noderange>blade01-blade02</noderange>
<attr>ALL</attr>
</xcatrequest>

View File

@ -0,0 +1,7 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getNodesAttribs</command>
<table>nodelist</table>
<noderange>blade01-blade02</noderange>
<attr>ALL</attr>
</xcatrequest>

View File

@ -0,0 +1,9 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getTablesAllNodeAttribs</command>
<table>
<tablename>nodelist</tablename>
<attr>groups</attr>
<attr>comments</attr>
</table>
</xcatrequest>

View File

@ -0,0 +1,14 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getTablesAllNodeAttribs</command>
<table>
<tablename>nodetype</tablename>
<attr>os</attr>
<attr>nodetype</attr>
</table>
<table>
<tablename>nodelist</tablename>
<attr>groups</attr>
<attr>status</attr>
</table>
</xcatrequest>

View File

@ -0,0 +1,13 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getTablesAllNodeAttribs</command>
<table>
<tablename>nodetype</tablename>
<attr>os</attr>
<attr>nodetype</attr>
</table>
<table>
<tablename>nodelist</tablename>
<attr>ALL</attr>
</table>
</xcatrequest>

View File

@ -0,0 +1,36 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getTablesAllNodeAttribs</command>
<table>
<tablename>nodetype</tablename>
<attr>ALL</attr>
</table>
<table>
<tablename>nodelist</tablename>
<attr>ALL</attr>
</table>
<table>
<tablename>noderes</tablename>
<attr>ALL</attr>
</table>
<table>
<tablename>postscripts</tablename>
<attr>ALL</attr>
</table>
<table>
<tablename>mac</tablename>
<attr>ALL</attr>
</table>
<table>
<tablename>mp</tablename>
<attr>ALL</attr>
</table>
<table>
<tablename>nodehm</tablename>
<attr>ALL</attr>
</table>
<table>
<tablename>mpa</tablename>
<attr>ALL</attr>
</table>
</xcatrequest>

View File

@ -0,0 +1,12 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getTablesAllRowAttribs</command>
<table>
<tablename>passwd</tablename>
<attr>username</attr>
</table>
<table>
<tablename>rack</tablename>
<attr>rackname</attr>
</table>
</xcatrequest>

View File

@ -0,0 +1,9 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getTablesNodesAttribs</command>
<noderange>test</noderange>
<table>
<tablename>nodelist</tablename>
<attr>ALL</attr>
</table>
</xcatrequest>

View File

@ -0,0 +1,13 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getTablesNodesAttribs</command>
<noderange>test</noderange>
<table>
<tablename>nodelist</tablename>
<attr>ALL</attr>
</table>
<table>
<tablename>nodetype</tablename>
<attr>nodetype</attr>
</table>
</xcatrequest>

View File

@ -0,0 +1,9 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getTablesNodesAttribs</command>
<noderange>test</noderange>
<table>
<tablename>noderes</tablename>
<attr>ALL</attr>
</table>
</xcatrequest>

View File

@ -0,0 +1,14 @@
# Reads the table input for the noderange and returns list of attributes
# requested
<xcatrequest>
<clienttype>PCM</clienttype>
<command>NodeRange</command>
<node>compute1-compute2</node>
</xcatrequest>
<xcatresponse>
<node>node1</node>
.
.
.
<node>noden</node>
</xcatresponse>

View File

@ -0,0 +1,5 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>NodeRange</command>
<noderange>compute1-compute2</noderange>
</xcatrequest>

View File

@ -0,0 +1,5 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>NodeRange</command>
<noderange>compute1-compute2</noderange>
</xcatrequest>

View File

@ -0,0 +1,5 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>NodeRange</command>
<noderange>compute1-compute2</noderange>
</xcatrequest>

View File

@ -0,0 +1,34 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>readtbl</command>
<table>tablename</table>
<node>noderange1</node>
<node>noderange2</node>
.
.
.
or <node>ALL</node>
<attr>attribute1</attr>
<attr>attribute2</attr>
.
.
.
<attr>attributeN</attr>
</xcatrequest>
<xcatresponse>
<rows>
<attr>attribute1</attr>
<value>value1</value>
<attr>attribute2</attr>
<value>value2</value>
.
.
.
.
<attr>attributeN</attr>
<value>valueN</value>
</rows>
<xcatresponse>
<serverdone></serverdone>
</xcatresponse>

View File

@ -0,0 +1,34 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>readtbl</command>
<table>tablename</table>
<node>noderange1</node>
<node>noderange2</node>
.
.
.
or <node>ALL</node>
<attr>attribute1</attr>
<attr>attribute2</attr>
.
.
.
<attr>attributeN</attr>
</xcatrequest>
<xcatresponse>
<rows>
<attr>attribute1</attr>
<value>value1</value>
<attr>attribute2</attr>
<value>value2</value>
.
.
.
.
<attr>attributeN</attr>
<value>valueN</value>
</rows>
<xcatresponse>
<serverdone></serverdone>
</xcatresponse>

View File

@ -0,0 +1,17 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>setAttribs</command>
<table>tablename</table>
<keys>
<keyname1>value1</keyname1>
<keyname2>value2</keyname2> For multiple key tables
</keys>
<attr>
<attrname1>value1</attrname1>
<attrname2>value2</attrname2>
</attr>
</xcatrequest>
<xcatresponse>
<serverdone></serverdone>
</xcatresponse>

View File

@ -0,0 +1,12 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>setAttribs</command>
<table>site</table>
<keys>
<key>domain</key>
</keys>
<attr>
<value>pok.com</value>
<comments>This is a test</comments>
</attr>
</xcatrequest>

View File

@ -0,0 +1,13 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>setAttribs</command>
<table>networks</table>
<keys>
<net>10.0.1.0</key>
<mask>255.255.255.0</mask>
</keys>
<attr>
<gateway>10.0.1.254</gateway>
</attr>
</xcatrequest>

Some files were not shown because too many files have changed in this diff Show More