2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-30 17:46:38 +00:00

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

This commit is contained in:
litingt 2014-03-19 02:10:47 -04:00
commit 81dc649a24
41 changed files with 3212 additions and 141 deletions

View File

@ -194,7 +194,7 @@ 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"
packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-OpenStack xCAT-OpenStack-baremetal"
for file in `echo $packages`
do

View File

@ -138,6 +138,12 @@ if [ "$PERLVER" == "v5.8.2" ]; then
OSVER='5.3'
elif [ "$PERLVER" == "v5.8.8" ]; then
OSVER='6.1'
aixver=`lslpp -lc|grep 'bos.rte:'|head -1|cut -d: -f3`
if [[ $aixver < '6.1.9.0' ]]; then
AIX61Y=0
else
AIX61Y=1
fi
elif [ "$PERLVER" == "v5.10.1" ]; then
OSVER='7.1'
aixver=`lslpp -lc|grep 'bos.rte:'|head -1|cut -d: -f3`
@ -173,8 +179,8 @@ for i in `ls *.rpm|grep -v -E '^tcl-|^tk-|^expect-|^unixODBC-|^xCAT-UI-deps|^per
opts=""
fi
# On 7.1L we need a newer version of perl-Net_SSLeay.pm
if [[ $AIX71L -eq 1 ]]; then
# On 7.1L and 6.1Y we need a newer version of perl-Net_SSLeay.pm
if [[ $AIX71L -eq 1 || $AIX61Y -eq 1 ]]; then
if [[ $i == perl-Net_SSLeay.pm-1.30-* ]]; then continue; fi # skip the old rpm
else
if [[ $i == perl-Net_SSLeay.pm-1.55-* ]]; then continue; fi # skip the new rpm

View File

@ -53,6 +53,7 @@ function makexcat {
tar -X /tmp/xcat-excludes -cf $RPMROOT/SOURCES/templates.tar templates
gzip -f $RPMROOT/SOURCES/templates.tar
cp xcat.conf $RPMROOT/SOURCES
cp xcat.conf.apach24 $RPMROOT/SOURCES
cp xCATMN $RPMROOT/SOURCES
else # xCATsn
tar -X /tmp/xcat-excludes -cf $RPMROOT/SOURCES/license.tar LICENSE.html

View File

@ -2747,7 +2747,7 @@ sub collapsenicsattr()
# e.g nicips.eth0
# do not need to handle nic attributes without the postfix .ethx,
# it will be overwritten by the attributes with the postfix .ethx,
if ($nodeattr =~ /^(nic\w+)\.(\w+)$/)
if ($nodeattr =~ /^(nic\w+)\.(.*)$/)
{
if ($1 && $2)
{

View File

@ -1562,8 +1562,8 @@ hwinv => {
node => 'The node name or group name.',
cputype => 'The cpu model name for the node.',
cpucount => 'The number of cpus for the node.',
memory => 'The size of the memory for the node.',
disksize => 'The size of the disks for the node.',
memory => 'The size of the memory for the node in MB.',
disksize => 'The size of the disks for the node in GB.',
comments => 'Any user-provided notes.',
disable => "Set to 'yes' or '1' to comment out this row.",
},

View File

@ -376,6 +376,7 @@ fi
mkdir -p \$dest_dir
cat /tmp/$to_userid/.ssh/authorized_keys >> \$home/.ssh/authorized_keys 2>&1
cat /tmp/$to_userid/.ssh/id_rsa.pub >> \$home/.ssh/authorized_keys 2>&1
rm -f \$home/.ssh/id_rsa 2>&1
cp /tmp/$to_userid/.ssh/id_rsa \$home/.ssh/id_rsa 2>&1
cp /tmp/$to_userid/.ssh/id_rsa.pub \$home/.ssh/id_rsa.pub 2>&1
chmod 0600 \$home/.ssh/id_* 2>&1
@ -1999,7 +2000,7 @@ sub updatenodegroups {
}
}
my ($ent) = $tabhd->getNodeAttribs($node, ['groups']);
my @list = qw(all);
my @list = ();
if (defined($ent) and $ent->{groups}) {
push @list, split(/,/,$ent->{groups});
}

View File

@ -0,0 +1,6 @@
xcat-openstack-baremetal for Debian
-----------------------------------
<possible notes regarding this package - if none, delete this file>
-- root <root@unknown> Wed, 12 Mar 2014 01:47:54 -0700

View File

@ -0,0 +1,9 @@
xcat-openstack-baremetal for Debian
-----------------------------------
<this file describes information about the source package, see Debian policy
manual section 4.14. You WILL either need to modify or delete this file>

View File

@ -0,0 +1,5 @@
xcat-openstack-baremetal (2.8.4-1) unstable; urgency=low
* Initial release (Closes: #nnnn) <nnnn is the bug number of your ITP>
-- root <root@unknown> Wed, 12 Mar 2014 01:47:54 -0700

View File

@ -0,0 +1 @@
8

View File

@ -0,0 +1,14 @@
Source: xcat-openstack-baremetal
Section: admin
Priority: extra
Maintainer: xCAT <xcat-user@lists.sourceforge.net>
Build-Depends: debhelper (>= 8.0.0)
Standards-Version: 3.9.4
Homepage: http://xcat.sourceforge.net/
#Vcs-Git: git://git.debian.org/collab-maint/xcat-openstack-baremetal.git
#Vcs-Browser: http://git.debian.org/?p=collab-maint/xcat-openstack-baremetal.git;a=summary
Package: xcat-openstack-baremetal
Architecture: all
Depends: xCAT-client
Description: Executables and data of the xCAT baremetal driver for OpenStack

View File

@ -0,0 +1,38 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: xcat-openstack-baremetal
Source: <url://example.com>
Files: *
Copyright: <years> <put author's name and email here>
<years> <likewise for another author>
License: <special license>
<Put the license of the package here indented by 1 space>
<This follows the format of Description: lines in control file>
.
<Including paragraphs>
# If you want to use GPL v2 or later for the /debian/* files use
# the following clauses, or change it to suit. Delete these two lines
Files: debian/*
Copyright: 2014 root <root@unknown>
License: GPL-2+
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.
# Please avoid to pick license terms that are more restrictive than the
# packaged work, as it may make Debian's contributions unacceptable upstream.

View File

@ -0,0 +1,7 @@
opt/xcat/bin
opt/xcat/sbin
opt/xcat/lib/perl/xCAT_plugin
opt/xcat/lib/python/xcat/openstack/baremetal
opt/xcat/share/xcat/openstack/postscripts
opt/xcat/share/man/man1
opt/xcat/share/doc/man1

View File

View File

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

View File

@ -0,0 +1,6 @@
lib/* opt/xcat/lib/
share/xcat/openstack/postscripts/* opt/xcat/share/xcat/openstack/postscripts/
share/man/man1/* opt/xcat/share/man/man1/
share/doc/man1/* opt/xcat/share/doc/man1/

View File

@ -0,0 +1,43 @@
#!/bin/sh
# postinst script for xcat-openstack-baremetal
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
configure)
#copy the postscripts under /installl/postscripts directory on MN only
if [ -f "/etc/xCATMN" ]; then
cp /opt/xcat/share/xcat/openstack/postscripts/* /install/postscripts/
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

View File

@ -0,0 +1,46 @@
#!/bin/sh
# prerm script for xcat-openstack-baremetal
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <prerm> `remove'
# * <old-prerm> `upgrade' <new-version>
# * <new-prerm> `failed-upgrade' <old-version>
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
# * <deconfigured's-prerm> `deconfigure' `in-favour'
# <package-being-installed> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
remove|upgrade|deconfigure)
#remove postscripts under /installl/postscripts directory on MN only
if [ -f "/etc/xCATMN" ]; then
for fn in /opt/xcat/share/xcat/openstack/postscripts/*
do
bn=`basename $fn`
rm /install/postscripts/$bn
done
fi
;;
failed-upgrade)
;;
*)
echo "prerm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

View File

@ -0,0 +1,44 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
build:
pwd
`pwd`/xpod2man
clean:
dh_testdir
dh_testroot
dh_clean -d
install:
pwd
dh_testdir
dh_testroot
dh_installdirs
dh_install -X".svn"
chmod 444 `pwd`/debian/xcat-openstack-baremetal/opt/xcat/share/man/man1/*
chmod 644 `pwd`/debian/xcat-openstack-baremetal/opt/xcat/share/doc/man1/*
dh_link
binary-indep: build install
pwd
export
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
binary-arch:
pwd
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure

View File

@ -0,0 +1 @@
1.0

View File

@ -0,0 +1,201 @@
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

@ -0,0 +1,4 @@
opt/xcat/bin/xcatclient opt/xcat/sbin/deploy_ops_bm_node
opt/xcat/bin/xcatclient opt/xcat/sbin/cleanup_ops_bm_node
opt/xcat/bin/xcatclient opt/xcat/bin/opsaddbmnode
opt/xcat/bin/xcatclientnnr opt/xcat/bin/opsaddimage

View File

@ -0,0 +1 @@
misc:Depends=

View File

@ -103,6 +103,13 @@ sub opsaddbmnode {
my $nodes = $request->{node};
#get node mgt
my $nodehmhash;
my $nodehmtab = xCAT::Table->new("nodehm");
if ($nodehmtab) {
$nodehmhash = $nodehmtab->getNodesAttribs($nodes,['power', 'mgt']);
}
#get bmc info for the nodes
my $ipmitab = xCAT::Table->new("ipmi", -create => 0);
my $tmp_ipmi;
@ -113,6 +120,7 @@ sub opsaddbmnode {
$callback->({error=>["Cannot open the ipmi table."],errorcode=>[1]});
return 1;
}
#get mac for the nodes
my $mactab = xCAT::Table->new("mac", -create => 0);
my $tmp_mac;
@ -135,24 +143,55 @@ sub opsaddbmnode {
return 1;
}
#get default username and password for bmc
my $d_bmcuser;
my $d_bmcpasswd;
my $passtab = xCAT::Table->new('passwd');
if ($passtab) {
($tmp_passwd)=$passtab->getAttribs({'key'=>'ipmi'},'username','password');
if (defined($tmp_passwd)) {
$d_bmcuser = $tmp_passwd->{username};
$d_bmcpasswd = $tmp_passwd->{password};
}
}
#print "d_bmcuser=$d_bmcuser, d_bmcpasswd=$d_bmcpasswd \n";
foreach my $node (@$nodes) {
#collect the node infomation needed for each node, some info
#may not be defined in the xCAT db
my ($bmc, $bmc_user, $bmc_password, $mac, $cpu, $memory, $disk);
my $ref_ipmi = $tmp_ipmi->{$node}->[0];
if ($ref_ipmi) {
if (exists($ref_ipmi->{bmc})) {
$bmc = $ref_ipmi->{bmc};
}
if (exists($ref_ipmi->{username})) {
$bmc_user = $ref_ipmi->{username};
}
if (exists($ref_ipmi->{password})) {
$bmc_password = $ref_ipmi->{password};
my $mgt;
my $ref_nodehm = $nodehmhash->{$node}->[0];
if ($ref_nodehm) {
if ($ref_nodehm->{'power'}) {
$mgt = $ref_nodehm->{'power'};
} elsif ($ref_nodehm->{'mgt'}) {
$mgt = $ref_nodehm->{'mgt'};
}
}
$ref_mac = $tmp_mac->{$node}->[0];
my ($bmc, $bmc_user, $bmc_password, $mac, $cpu, $memory, $disk);
if (($mgt) && ($mgt eq 'ipmi')) {
my $ref_ipmi = $tmp_ipmi->{$node}->[0];
if ($ref_ipmi) {
if (exists($ref_ipmi->{bmc})) {
$bmc = $ref_ipmi->{bmc};
}
if (exists($ref_ipmi->{username})) {
$bmc_user = $ref_ipmi->{username};
if (exists($ref_ipmi->{password})) {
$bmc_password = $ref_ipmi->{password};
}
} else { #take the default if they cannot be found on ipmi table
if ($d_bmcuser) { $bmc_user = $d_bmcuser; }
if ($d_bmcpasswd) { $bmc_password = $d_bmcpasswd; }
}
}
} # else { # for hardware control point other than ipmi, just fake it in OpenStack.
#$bmc = "0.0.0.0";
#$bmc_user = "xCAT";
#$bmc_password = "xCAT";
#}
my $ref_mac = $tmp_mac->{$node}->[0];
if ($ref_mac) {
if (exists($ref_mac->{mac})) {
$mac = $ref_mac->{mac};
@ -180,7 +219,7 @@ sub opsaddbmnode {
} else {
$disk = $b[0];
}
print "a=@a, b=@b\n";
#print "a=@a, b=@b\n";
#TODO: what if the unit is not in GB? We need to convert it to MB
$disk =~ s/GB|gb//g;
}
@ -418,7 +457,7 @@ sub deploy_ops_bm_node {
$callback->($rsp);
return 0;
}
print "node=$node, image=$img_name, host=$hostname, ip=$fixed_ip, mask=$netmask\n";
#print "node=$node, image=$img_name, host=$hostname, ip=$fixed_ip, mask=$netmask\n";
#validate the image name
my $osimagetab = xCAT::Table->new('osimage', -create=>1);
@ -604,7 +643,7 @@ sub add_postscript {
my $callback=shift;
my $node=shift;
my $script=shift;
print "script=$script\n";
#print "script=$script\n";
my $posttab=xCAT::Table->new("postscripts", -create =>1);
my %setup_hash;

View File

@ -168,7 +168,7 @@ class xCATBareMetalDriver(bm_driver.BareMetalDriver):
"""
#import pdb
#pdb.set_trace()
context = nova_context.get_admin_context()
context = nova_context.get_admin_context()
try:
node = bm_driver._get_baremetal_node_by_instance_uuid(instance['uuid'])

View File

@ -21,7 +21,7 @@ my @pods = getPodList($poddir);
#foreach (@pods) { print "$_\n"; } exit;
# Build the cmd overview page.
writesummarypage("$poddir/man1/xcat.1.pod", @pods);
#writesummarypage("$poddir/man1/xcat.1.pod", @pods);
# Build the man page for each pod.
#mkdir($mandir) or die "Error: could not create $mandir.\n";
@ -126,6 +126,7 @@ sub getPodList {
# Create the xcat man page that gives a summary description of each xcat cmd.
# Not used
sub writesummarypage {
my $file = shift; # relative path file name of the man page
# the rest of @_ contains the pod files that describe each cmd

View File

@ -11,8 +11,9 @@ Vendor: IBM Corp.
Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}}
Prefix: /opt/xcat
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root
%ifos linux
BuildArch: noarch
%endif
Requires: xCAT-server
#Requires: xCAT-server >= %{epoch}:%(cat Version|cut -d. -f 1,2)
@ -47,7 +48,7 @@ mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-SoftLayer
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/man/man1
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/man1
cp -a share/xcat/install/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/install/
cp -p -R share/xcat/install/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/install/
cp -d bin/* $RPM_BUILD_ROOT/%{prefix}/bin
chmod 755 $RPM_BUILD_ROOT/%{prefix}/bin/*

View File

@ -117,7 +117,7 @@ if ((!$imagename) && (!$profile) && (!$os) && (!$arch)) {
if ($? == 0) {
if (($tmpimgs) && ($tmpimgs !~ /^Could/)) { #Could is returned when the osimage table is empty
my @images=split('\n', $tmpimgs);
print "Do you want to re-genarate an existing image from the osimage table? ";
print "Do you want to re-generate an existing image from the osimage table? ";
print "[y/n] ";
my $conf = <stdin>;
chomp($conf);
@ -128,7 +128,7 @@ if ((!$imagename) && (!$profile) && (!$os) && (!$arch)) {
foreach(sort @images){
print " $_\n";
}
# default is the first image cause in many cases
# default is the first image
print "Which image do you want to re-generate? [";
print $images[0];
print "] ";
@ -294,13 +294,10 @@ if ($profile) { print " Profile: $profile\n"; }
# get the interface
if ((!$imagename) && (!$interface)){
while(1){
print "Which network interface do you want the image to boot from? [";
print "eth0";
print "] ";
print "OPTIONAL: Which specific network interface will the image boot from? [<blank>]";
$interface = <stdin>;
chomp($interface);
if($interface eq ""){
$interface = "eth0";
last;
}else{
print "You want your stateless machines to boot off of ";
@ -317,8 +314,9 @@ if ((!$imagename) && (!$interface)){
}
}
}
if ($interface) { print " Interface: $interface\n"; }
else { print " No interface specified. The interface will be determined at network boot time.\n"; }
}
if ($interface) { print " Interface: $interface\n"; }

145
xCAT-client/podchecker Executable file
View File

@ -0,0 +1,145 @@
#!/usr/bin/perl
eval 'exec perl -S $0 "$@"'
if 0;
#############################################################################
# podchecker -- command to invoke the podchecker function in Pod::Checker
#
# Copyright (c) 1998-2000 by Bradford Appleton. All rights reserved.
# This file is part of "PodParser". PodParser is free software;
# you can redistribute it and/or modify it under the same terms
# as Perl itself.
#############################################################################
use strict;
#use diagnostics;
=head1 NAME
podchecker - check the syntax of POD format documentation files
=head1 SYNOPSIS
B<podchecker> [B<-help>] [B<-man>] [B<-(no)warnings>] [I<file>S< >...]
=head1 OPTIONS AND ARGUMENTS
=over 8
=item B<-help>
Print a brief help message and exit.
=item B<-man>
Print the manual page and exit.
=item B<-warnings> B<-nowarnings>
Turn on/off printing of warnings. Repeating B<-warnings> increases the
warning level, i.e. more warnings are printed. Currently increasing to
level two causes flagging of unescaped "E<lt>,E<gt>" characters.
=item I<file>
The pathname of a POD file to syntax-check (defaults to standard input).
=back
=head1 DESCRIPTION
B<podchecker> will read the given input files looking for POD
syntax errors in the POD documentation and will print any errors
it find to STDERR. At the end, it will print a status message
indicating the number of errors found.
Directories are ignored, an appropriate warning message is printed.
B<podchecker> invokes the B<podchecker()> function exported by B<Pod::Checker>
Please see L<Pod::Checker/podchecker()> for more details.
=head1 RETURN VALUE
B<podchecker> returns a 0 (zero) exit status if all specified
POD files are ok.
=head1 ERRORS
B<podchecker> returns the exit status 1 if at least one of
the given POD files has syntax errors.
The status 2 indicates that at least one of the specified
files does not contain I<any> POD commands.
Status 1 overrides status 2. If you want unambiguous
results, call B<podchecker> with one single argument only.
=head1 SEE ALSO
L<Pod::Parser> and L<Pod::Checker>
=head1 AUTHORS
Please report bugs using L<http://rt.cpan.org>.
Brad Appleton E<lt>bradapp@enteract.comE<gt>,
Marek Rouchal E<lt>marekr@cpan.orgE<gt>
Based on code for B<Pod::Text::pod2text(1)> written by
Tom Christiansen E<lt>tchrist@mox.perl.comE<gt>
=cut
use Pod::Checker;
use Pod::Usage;
use Getopt::Long;
## Define options
my %options;
## Parse options
GetOptions(\%options, qw(help man warnings+ nowarnings)) || pod2usage(2);
pod2usage(1) if ($options{help});
pod2usage(-verbose => 2) if ($options{man});
if($options{nowarnings}) {
$options{warnings} = 0;
}
elsif(!defined $options{warnings}) {
$options{warnings} = 1; # default is warnings on
}
## Dont default to STDIN if connected to a terminal
pod2usage(2) if ((@ARGV == 0) && (-t STDIN));
## Invoke podchecker()
my $status = 0;
@ARGV = qw(-) unless(@ARGV);
for my $podfile (@ARGV) {
if($podfile eq '-') {
$podfile = '<&STDIN';
}
elsif(-d $podfile) {
warn "podchecker: Warning: Ignoring directory '$podfile'\n";
next;
}
my $errors =
podchecker($podfile, undef, '-warnings' => $options{warnings});
if($errors > 0) {
# errors occurred
$status = 1;
printf STDERR ("%s has %d pod syntax %s.\n",
$podfile, $errors,
($errors == 1) ? 'error' : 'errors');
}
elsif($errors < 0) {
# no pod found
$status = 2 unless($status);
print STDERR "$podfile does not contain any pod commands.\n";
}
else {
print STDERR "$podfile pod syntax OK.\n";
}
}
exit $status;

View File

@ -0,0 +1,138 @@
=head1 B<NAME>
B<chzone> - Changes a zone defined in the cluster.
=head1 B<SYNOPSIS>
B<chzone> <zonename> [B<--defaultzone>] [-K] [B<-k> I<full path to the ssh RSA private key>] [B<-a> I<noderange> | B<-r> I<noderange>] [B<-g>] [B<-f>] [B<-s> I<yes|no>] [-V]
B<chzone> [B<-h> | B<-v>]
=head1 B<DESCRIPTION>
The B<chzone> command is designed to change the definition of a zone previous defined in the cluster.
The chzone command is only supported on Linux ( No AIX support).
The nodes are not updated with the new root ssh keys by chzone. You must run updatenode -k or xdsh -K to the nodes to update the root ssh keys to the new generated zone keys. This will also sync any service nodes with the zone keys, if you have a hierarchical cluster.
Note: if any zones in the zone table, there must be one and only one defaultzone. Otherwise, errors will occur.
=head1 B<OPTIONS>
=over 5
=item B<-h>|B<--help>
Displays usage information.
=item B<-v>|B<--version>
Displays command version and build date.
=item B<-k | --sshkeypath> I<full path to the ssh RSA private key>
This is the path to the id_rsa key that will be used to build new root's ssh keys for the zone. If -k is used, it will generate the ssh public key from the input ssh RSA private key, and store both in /etc/xcat/sshkeys/<zonename>/.ssh directory.
=item B<-K | --genkeys>
Using this flag, will generate new ssh RSA private and public keys for the zone into the /etc/xcat/sshkeys/<zonename>/.ssh directory.
The nodes are not automatically updated with the new root ssh keys by chzone. You must run updatenode -k or xdsh -K to the nodes to update the root ssh keys to the new generated zone keys. This will also sync any service nodes with the zone keys, if you have a hierarchical cluster.
=item B<--default>
if --defaultzone is input, then it will set the zone defaultzone attribute to yes.
if --defaultzone is input and another zone is currently the default,
then the -f flag must be used to force a change to the new defaultzone.
If -f flag is not use an error will be returned and no change made.
Note: if any zones in the zone table, there must be one and only one defaultzone. Otherwise, errors will occur.
=item B<-a | --addnoderange> I<noderange>
For each node in the noderange, it will set the zonename attribute for that node to the input zonename.
If the -g flag is also on the command, then
it will add the group name "zonename" to each node in the noderange.
=item B<-r | --rmnoderange> I<noderange>
For each node in the noderange, if the node is a member of the input zone, it will remove the zonename attribute for that node.
If any of the nodes in the noderange is not a member of the zone, you will get an error and nothing will be changed.
If the -g flag is also on the command, then
it will remove the group name "zonename" from each node in the noderange.
=item B<-s| --sshbetweennodes> B<yes|no>
If -s entered, the zone sshbetweennodes attribute will be set to yes or no based on the input. When this is set to yes, then ssh will be setup to allow passwordless root access between nodes. If no, then root will be prompted for a password when running ssh between the nodes in the zone.
=item B<-f | --force>
Used with the (--defaultzone) flag to override the current default zone.
=item B<-g | --assigngroup>
Used with the (-a or -r ) flag to add or remove the group zonename for all nodes in the input noderange.
=item B<-V>|B<--Verbose>
Verbose mode.
=back
=head1 B<Examples>
=over 3
=item *
To chzone zone1 to the default zone, enter:
B<chzone> I<zone1> --default -f
=item *
To generate new root ssh keys for zone2A using the ssh id_rsa private key in /root/.ssh:
B<chzone> I<zone2A> -k /root/.ssh
Note: you must use xdsh -K or updatenode -k to update the nodes with the new keys
=item *
To generate new root ssh keys for zone2A, enter :
B<chzone> I<zone2A> -K
Note: you must use xdsh -K or updatenode -k to update the nodes with the new keys
=item *
To add a new group of nodes (compute3) to zone3 and add zone3 group to the nodes, enter:
B<chzone> I<zone3> -a compute3 -g
=item *
To remove a group of nodes (compute4) from zone4 and remove zone4 group from the nodes, enter:
B<chzone> I<zone4> -r compute4 -g
=item *
To change the sshbetweennodes setting on the zone to not allow passwordless ssh between nodes, enter:
B<chzone> I<zone5> -s no
Note: you must use xdsh -K or updatenode -k to update the nodes with this new setting.
=back
B<Files>
B</opt/xcat/bin/chzone/>
Location of the chzone command.
=head1 B<SEE ALSO>
L <mkzone(1)|mkzone.1>,L <rmzone(1)|rmzone.1>,L <xdsh(1)|xdsh.1>, L<updatenode(1)|updatenode.1>

View File

@ -6,10 +6,10 @@ B<genimage> - Generates a stateless image to be used for a diskless install.
B<genimage>
B<genimage> B<-o> I<osver> [B<-a> I<arch>] B<-p> I<profile> B<-i> I<nodebootif> B<-n> I<nodenetdrivers> [B<--onlyinitrd>] [B<-r> I<otherifaces>] [B<-k> I<kernelver>] [B<-g> I<krpmver>] [B<-m> I<statelite>] [B<-l> I<rootlimitsize>] [B<--permission> I<permission>] [B<--interactive>] [B<--dryrun>]
B<genimage> [B<-o> I<osver>] [B<-a> I<arch>] [B<-p> I<profile>] [B<-i> I<nodebootif>] [B<-n> I<nodenetdrivers>] [B<--onlyinitrd>] [B<-r> I<otherifaces>] [B<-k> I<kernelver>] [B<-g> I<krpmver>] [B<-m> I<statelite>] [B<-l> I<rootlimitsize>] [B<--permission> I<permission>] [B<--interactive>] [B<--dryrun>] [B<--ignorekernelchk>] I<imagename>
B<genimage> B<-o> I<osver> [B<-a> I<arch>] B<-p> I<profile> B<-i> I<nodebootif> B<-n> I<nodenetdrivers> [B<--onlyinitrd>] [B<-r> I<otherifaces>] [B<-k> I<kernelver>] [B<-g> I<krpmver>] [B<-m> I<statelite>] [B<-l> I<rootlimitsize>] [B<--permission> I<permission>] [B<--interactive>] [B<--dryrun>]
B<genimage> [B<-h> | B<--help> | B<-v> | B<--version>]
@ -17,43 +17,43 @@ B<genimage> [B<-h> | B<--help> | B<-v> | B<--version>]
=head1 DESCRIPTION
Generates a stateless and a statelite image that can be used to boot xCAT nodes in a diskless mode.
If I<imagename> is not specified, the default packages included
(and excluded) in the image are specified by
The I<imagename> format of the command is recommended. When specified, genimage will use the osimage definition for information to generate this image. Additional options specified on the command line will override any corresponding previous osimage settings, and will be written back to the osimage definition.
If I<imagename> is not specified (old method):
- the default packages included (and excluded) in the image are specified by
/opt/xcat/share/xcat/netboot/<os>/<profile>[.<osver>][.<arch>].pkglist and
/opt/xcat/share/xcat/netboot/<os>/<profile>[.<osver>][.<arch>].exlist.
Additional packages that are not from the os distro can be specified in a
- Additional packages that are not from the os distro can be specified in a
/opt/xcat/share/xcat/netboot/<os>/<profile>[.<osver>][.<arch>].otherpkgs.pkglist file.
Customized package list files can be specified under /install/custom/netboot/<os> directory. The generated image will be put in /install/netboot/<osver>/<arch>/<profile> directory.
- Customized package list files will override these files and can be specified under /install/custom/netboot/<os> directory.
- The generated image will be put in /install/netboot/<osver>/<arch>/<profile> directory.
The newly generated image names will have the following format:
- osimage definitions will be created in the I<linuximage> and I<osimage> tables. The newly generated image names will have the following format:
for stateless: <osver>-<arch>-netboot-<profile>
for stateless: <osver>-<arch>-netboot-<profile>
for statelite: <osver>-<arch>-statelite-<profile>
for statelite: <osver>-<arch>-statelite-<profile>
B<genimage> command will create them into I<linuximage> and I<osimage> tables.
If I<imagename> is specified, the package list file names are read from the I<osimage> table and I<linuximage> tables.
If B<genimage> runs on the management node, both the I<osimage> table and I<linuximage> table will be updated with the given values from the options.
The B<genimage> command will generate two initial ramdisks for B<stateless> and B<statelite>, one is B<initrd-stateless.gz>, the other one is B<initrd-statelite.gz>.
After your image is created, you can chroot to the
After your image is generated, you can chroot to the
image, install any additional software you would like, or make modifications to files, and then run the following command to prepare the image for deployment.
for stateless: B<packimage>
for statelite: B<liteimg>
Becides prompting for the input for some paramters, the B<genimage> command takes default quesses for the parameters not specified or not defined in the I<osimage> and I<linuximage> tables. It also makes default answers for questions from yum/zypper command when installing rpms into the image. Please use --interactive flag if you want yum/zypper command to prompt you for the answers.
Besides prompting for some paramter values, the B<genimage> command takes default guesses for the parameters not specified or not defined in the I<osimage> and I<linuximage> tables. It also assumes default answers for questions from the yum/zypper command when installing rpms into the image. Please use --interactive flag if you want the yum/zypper command to prompt you for the answers.
If B<--onlyinitrd> is specified, only regenerates the initrd for a stateless image to be used for a diskless install.
If B<--onlyinitrd> is specified, genimage only regenerates the initrd for a stateless image to be used for a diskless install.
The B<genimage> command must be run on a system that is the same architecture and same distro with same major release version as the nodes it will be
used on. If the management node is not the same architecture or same distro level, copy the contents of
@ -61,10 +61,9 @@ used on. If the management node is not the same architecture or same distro lev
the management node to that system. Then change directory to /opt/xcat/share/xcat/netboot/<os> and run ./genimage.
=head1 Parameters
I<imagename> specifies the name of a os image definition to be used. The specification for the image is storted in the I<osimage> table and I<linuximage> table.
I<imagename> specifies the name of an os image definition to be used. The specification for the image is stored in the I<osimage> table and I<linuximage> table.
=head1 OPTIONS
@ -88,7 +87,7 @@ the nodes' nodetype.profile attribute must be set to this same value.
=item B<-i> I<nodebootif>
The network interface the diskless node will boot over (e.g. eth0).
This argument is now optional, and allows you to specify the network boot interface to be configured in the image (e.g. eth0). If not specified, the interface will be determined and configured during the network boot process.
=item B<-n> I<nodenetdrivers>
@ -183,46 +182,53 @@ To prompt the user for inputs:
genimage
=item 2
To generate an image using information from an osimage definition:
To generate a fedora8 image for a compute node architecture
genimage myimagename
=item 3
To run genimage in test mode without actually generating an image:
genimage --dryrun myimagename
=item 4
To generate an image and have yum/zypper prompt for responses:
genimage myimagename --interactive
=item 5
To generate an image, replacing some values in the osimage definition:
genimage -i eth0 -n tg3 myimagename
=item 6
(old method) To generate a fedora8 image for a compute node architecture
x86_64 and place it in the
/install/netboot/fedora8/x86_64/compute/rootimg directory:
genimage -i eth0 -o fedora8 -p compute
=item 3
=item 7
(old method)
genimage -i eth0 -r eth1,eth2 -n tg3,bnx2 -o centos5.1 -p compute
=item 4
=item 8
(old method)
genimage -i eth0 -n tg3,bnx2 -o sles11 -p compute --interactive
=item 5
=item 9
(old method)
genimage -i eth0 -n igb,e1000e,e1000,bnx2,tg3 -o centos5.4 -p nfsroot --permission 777
=item 6
genimage -i eth0 -n tg3 myimagename
=item 7
genimage myimagename
=item 8
genimage myimagename --interactive
=item 9
To regenerate the initrd for a fedora8 image for a compute node architecture x86_64 and place it in the /install/netboot/fedora8/x86_64/compute/rootimg directory: change directory to /opt/xcat/share/xcat/netboot/fedora and run:
genimage --onlyinitrd -i eth0 -n tg3,bnx2 -o fedora8 -p compute
=item 10
(old method)
To regenerate the initrd for a fedora8 image for a compute node architecture x86_64 and place it in the /install/netboot/fedora8/x86_64/compute/rootimg directory:
genimage --dryrun myimagename
cd /opt/xcat/share/xcat/netboot/fedora
./genimage --onlyinitrd -i eth0 -n tg3,bnx2 -o fedora8 -p compute
=back

View File

@ -0,0 +1,121 @@
=head1 B<NAME>
B<mkzone> - Defines a new zone in the cluster.
=head1 B<SYNOPSIS>
B<mkzone> <zonename> [B<--defaultzone>] [B<-k> I<full path to the ssh RSA private key>] [B<-a> I<noderange>] [B<-g>] [B<-f>] [B<-s> I<yes|no>] [-V]
B<mkzone> [B<-h> | B<-v>]
=head1 B<DESCRIPTION>
The B<mkzone> command is designed to divide the xCAT cluster into multiple zones. The nodes in each zone will share common root ssh keys. This allows the nodes in a zone to be able to as root ssh to each other without password, but cannot do the same to any node in another zone. All zones share a common xCAT Management Node and database including the site table, which defines the attributes of the entire cluster.
The mkzone command is only supported on Linux ( No AIX support).
The nodes are not updated with the new root ssh keys by mkzone. You must run updatenode -k or xdsh -K to the nodes to update the root ssh keys to the new generated zone keys. This will also sync any service nodes with the zone keys, if you have a hierarchical cluster.
Note: if any zones in the zone table, there must be one and only one defaultzone. Otherwise, errors will occur.
=head1 B<OPTIONS>
=over 5
=item B<-h>|B<--help>
Displays usage information.
=item B<-v>|B<--version>
Displays command version and build date.
=item B<-k | --sshkeypath> I<full path to the ssh RSA private key>
This is the path to the id_rsa key that will be used to build root's ssh keys for the zone. If -k is used, it will generate the ssh public key from the input ssh RSA private key and store both in /etc/xcat/sshkeys/<zonename>/.ssh directory.
If -f is not used, then it will generate a set of root ssh keys for the zone and store them in /etc/xcat/sshkeys/<zonename>/.ssh.
=item B<--default>
if --defaultzone is input, then it will set the zone defaultzone attribute to yes; otherwise it will set to no.
if --defaultzone is input and another zone is currently the default,
then the -f flag must be used to force a change to the new defaultzone.
If -f flag is not use an error will be returned and no change made.
Note: if any zones in the zone table, there must be one and only one defaultzone. Otherwise, errors will occur.
=item B<-a | --addnoderange> I<noderange>
For each node in the noderange, it will set the zonename attribute for that node to the input zonename.
If the -g flag is also on the command, then
it will add the group name "zonename" to each node in the noderange.
=item B<-s| --sshbetweennodes> B<yes|no>
If -s entered, the zone sshbetweennodes attribute will be set to yes or no. It defaults to yes. When this is set to yes, then ssh will be setup
to allow passwordless root access between nodes. If no, then root will be prompted for a password when running ssh between the nodes in the zone.
=item B<-f | --force>
Used with the (--defaultzone) flag to override the current default zone.
=item B<-g | --assigngroup>
Used with the (-a) flag to create the group zonename for all nodes in the input noderange.
=item B<-V>|B<--Verbose>
Verbose mode.
=back
=head1 B<Examples>
=over 3
=item *
To make a new zone1 using defaults , enter:
B<mkzone> I<zone1>
Note: with the first mkzone, you will automatically get the xcatdefault zone created as the default zone. This zone uses ssh keys from
<roothome>/.ssh directory.
=item *
To make a new zone2 using defaults and make it the default zone enter:
B<mkzone> I<zone2> --defaultzone -f
=item *
To make a new zone2A using the ssh id_rsa private key in /root/.ssh:
B<mkzone> I<zone2A> -k /root/.ssh
=item *
To make a new zone3 and assign the noderange compute3 to the zone enter:
B<mkzone> I<zone3> -a compute3
=item *
To make a new zone4 and assign the noderange compute4 to the zone and add zone4 as a group to each node enter:
B<mkzone> I<zone4> -a compute4 -g
=item *
To make a new zone5 and assign the noderange compute5 to the zone and add zone5 as a group to each node but not allow passwordless ssh between the nodes enter:
B<mkzone> I<zone5> -a compute5 -g -s no
=back
B<Files>
B</opt/xcat/bin/mkzone/>
Location of the mkzone command.
=head1 B<SEE ALSO>
L<chzone(1)|chzone.1>, L<rmzone(1)|rmzone.1>, L<xdsh(1)|xdsh.1>, L<updatenode(1)|updatenode.1>

View File

@ -0,0 +1,84 @@
=head1 B<NAME>
B<rmzone> - Removes a zone from the cluster.
=head1 B<SYNOPSIS>
B<rmzone> <zonename> [B<-g>] [B<-f>]
B<rmzone> [B<-h> | B<-v>]
=head1 B<DESCRIPTION>
The B<rmzone> command is designed to remove a previously defined zone from the cluster.
It will remove the zone entry in the zone table. It will remove the zone from the zonename attributes on the nodes that were assigned to the zone. Optionally, it will remove the zonename group from the nodes that were assigned to the zone.
It will also remove the root ssh keys that were created for that zone on the Management Node.
The rmzone command is only supported on Linux ( No AIX support).
The nodes are not automatically updated with new root ssh keys by rmzone. You must run updatenode -k or xdsh -K to the nodes to update the root ssh keys. The nodes new ssh key will be assigned from the defaultzone in the zone table, or if no entries in the zone table, the keys will come from /root/.ssh.
Note: if any zones in the zone table, there must be one and only one defaultzone. Otherwise, errors will occur.
=head1 B<OPTIONS>
=over 5
=item B<-h>|B<--help>
Displays usage information.
=item B<-v>|B<--version>
Displays command version and build date.
=item B<-f | --force>
Used to remove a zone that is defined as current default zone. This should only be done if you are removing all zones, or you will
adding a new zone or changing an existing zone to be the default zone.
=item B<-g | --assigngroup>
Remove the assigned group named B<zonename> from all nodes assigned to the zone being removed.
=item B<-V>|B<--Verbose>
Verbose mode.
=back
=head1 B<Examples>
=over 3
=item *
To remove zone1 from the zone table and the zonename attribute on all it's assigned nodes , enter:
B<rmzone> I<zone1>
=item *
To remove zone2 from the zone table, the zone2 zonename attribute, and the zone2 group assigned to all nodes that were in zone2, enter:
B<rmzone> I<zone2> -g
=item *
To remove zone3 from the zone table, all the node zone attributes and override the fact it is the defaultzone, enter:
B<rmzone> I<zone3> -g -f
=back
B<Files>
B</opt/xcat/bin/rmzone/>
Location of the rmzone command.
=head1 B<SEE ALSO>
L <mkzone(1)|mkzone.1>,L <chzone(1)|chzone.1>,L <xdsh(1)|xdsh.1>, L<updatenode(1)|updatenode.1>

View File

@ -622,7 +622,8 @@ sub processArgs
# if it has an "=" sign its an attr=val - we hope
# - this will handle "attr= "
my ($attr, $value) = $a =~ /^\s*(\S+?)\s*=\s*(\S*.*)$/;
# The attribute itself might contain "space", like "nics.Local Connection Adapter 1" on windows
my ($attr, $value) = $a =~ /^\s*(.*?)\s*=\s*(\S*.*)$/;
if (!defined($attr) || !defined($value))
{
my $rsp;
@ -644,7 +645,7 @@ sub processArgs
my $nicattrs = 0;
foreach my $kattr (keys %::ATTRS)
{
if ($kattr =~ /^nic\w+\.\w+$/)
if ($kattr =~ /^nic\w+\..*$/)
{
$nicattrs = 1;
}
@ -850,7 +851,7 @@ sub processArgs
foreach my $dattr (@dispattrs)
{
# lsdef -t node -h -i nicips.eth0
if($dattr =~ /^(nic\w+)\.\w+$/)
if($dattr =~ /^(nic\w+)\..*$/)
{
$dattr = $1;
}
@ -1148,7 +1149,7 @@ sub processArgs
my $i = 0;
for ($i=0; $i < (scalar @::AttrList) ; $i++ )
{
if($::AttrList[$i] =~ /^(nic\w+)\.(\w+)$/)
if($::AttrList[$i] =~ /^(nic\w+)\.(.*)$/)
{
$::AttrList[$i] = $1;
push @{$::NicsAttrHash{$::AttrList[$i]}}, $2;
@ -1304,7 +1305,7 @@ sub defmk
{
my $attrorig = $attr;
# nicips.eth0 => nicips
if ($attr =~ /^(nic\w+)\.\w+$/)
if ($attr =~ /^(nic\w+)\..*$/)
{
$attr = $1;
}
@ -1948,7 +1949,7 @@ sub defch
{
my $attrorig = $attr;
# nicips.eth0 => nicips
if ($attr =~ /^(nic\w+)\.\w+$/)
if ($attr =~ /^(nic\w+)\..*$/)
{
$attr = $1;
}
@ -2635,7 +2636,7 @@ sub setFINALattrs
my %tmphash = ();
foreach my $nodeattr (keys %{$::CLIATTRS{$objname}})
{
if ($nodeattr =~ /^(nic\w+)\.\w+$/)
if ($nodeattr =~ /^(nic\w+)\..*$/)
{
my $tmpnicattr = $1;
if (!defined($tmphash{$tmpnicattr}))
@ -3408,7 +3409,7 @@ sub defls
my $rsp;
$rsp->{data}->[0] =
"Could not find an object named \'$obj\' of type \'$type\'.";
xCAT::MsgUtils->message("I", $rsp, $::callback);
xCAT::MsgUtils->message("E", $rsp, $::callback);
next;
}
}

View File

@ -4423,7 +4423,7 @@ sub process_request {
if ($request->{mtm} and $request->{mtm} =~ /^(\w{4})/) {
my $group = xCAT::data::ibmhwtypes::parse_group($request->{mtm});
if (defined($group)) {
xCAT::TableUtils->updatenodegroups($node, $group);
xCAT::TableUtils->updatenodegroups($node, $group.",all");
}
}
if ($mac) {

2
xCAT-server/lib/xcat/plugins/lsslp.pm Normal file → Executable file
View File

@ -368,7 +368,7 @@ sub parse_args {
###################################
my (@octets) = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
if ( scalar(@octets) != 4 ) {
return( [1,"Invalid IP address: $ip"] );
return( usage("Invalid IP address: $ip") );
}
foreach my $octet ( @octets ) {
if (( $octet < 0 ) or ( $octet > 255 )) {

View File

@ -1061,7 +1061,7 @@ sub syncSNZoneKeys
my $file="/tmp/xcatzonesynclist";
# Run xdcp <servicenodes> -F /tmp/xcatzonesynclist
# can leave it , never changes and is built each time
my $content= "\"/etc/xcat/sshkeys/* -> /etc/xcat/sshkeys/\"";
my $content= "\"/etc/xcat/sshkeys/ -> /etc/xcat/sshkeys/\"";
`echo $content > $file`;
# xdcp rsync the file
@ -1081,7 +1081,7 @@ sub syncSNZoneKeys
@::good_SN = @sn; # initialize all good
# run the command to the servicenodes
# xdcp <sn> -F <syncfile>
# xdcp <sn> -o "--delete" -F <syncfile>
my $addreq;
$addreq->{'_xcatdest'} = $::mnname;
$addreq->{node} = \@sn;
@ -1092,6 +1092,8 @@ sub syncSNZoneKeys
push (@{$addreq->{arg}},"--nodestatus"); # return nodestatus
}
push (@{$addreq->{arg}},"-v");
push (@{$addreq->{arg}},"-o");
push (@{$addreq->{arg}},"--delete"); # will cleanup the directory if zones are removed
push (@{$addreq->{arg}},"-F");
push (@{$addreq->{arg}},$file);
$addreq->{command}->[0] = "xdcp"; # input command is xdsh, but we need to run xdcp -F

View File

@ -95,13 +95,26 @@ sub process_request
my $args = $request->{arg};
@ARGV = @{$args}; # get arguments
my %options = ();
$Getopt::Long::ignorecase = 0;
# Get the zonename if it is in the input
my @SaveARGV = @ARGV;
my $zonename;
my $arg= @SaveARGV[0];
if (!($arg =~ /-h/) && (!($arg =~ /-v/))) { # if not -h -v,then it must be a zone name
$zonename = @SaveARGV[0]; # here is the zonename, if there is one
if ($zonename) { # take zonename off the argument list so it will parse correctly
my $tmp = shift(@SaveARGV);
@ARGV = @SaveARGV;
}
}
Getopt::Long::Configure("posix_default");
Getopt::Long::Configure("no_gnu_compat");
Getopt::Long::Configure("bundling");
my %options = ();
if (
!GetOptions(
'a|noderange=s' => \$options{'noderange'},
'a|noderange=s' => \$options{'addnoderange'},
'r|noderange=s' => \$options{'rmnoderange'},
'defaultzone|defaultzone' => \$options{'defaultzone'},
'g|assigngrp' => \$options{'assigngroup'},
'f|force' => \$options{'force'},
@ -132,14 +145,14 @@ sub process_request
exit 0;
}
# test to see if the zonename was input
if (scalar(@ARGV) == 0) {
if (!$zonename) {
my $rsp = {};
$rsp->{error}->[0] =
"zonename not specified, see man page for syntax.";
"zonename not specified, it is required for this command.";
xCAT::MsgUtils->message("E", $rsp, $callback);
exit 1;
} else {
$request->{zonename} = $ARGV[0];
$request->{zonename} = $zonename;
}
# if -s entered must be yes/1 or no/0
if ($options{'sshbetweennodes'}) {
@ -166,12 +179,40 @@ sub process_request
$rsp->{info}->[0] =
"The site table sshbetweennodes attribute is set to $entries[0]. It is not used when zones are defined. To get rid of this warning, remove the site table sshbetweennodes attribute.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
# save input noderange
if ($options{'noderange'}) {
}
# -a and -r flags cannot be used together
if (($options{'addnoderange'}) && ($options{'rmnoderange'})) {
my $rsp = {};
$rsp->{error}->[0] =
"You may not use the -a flag to add nodes and the -r flag to remove nodes on one command.";
xCAT::MsgUtils->message("E", $rsp, $callback);
exit 1;
}
# save input noderange to add nodes
if ($options{'addnoderange'}) {
# check to see if Management Node is in the noderange, if so error
$request->{noderange}->[0] = $options{'noderange'};
$request->{noderange}->[0] = $options{'addnoderange'};
my @nodes = xCAT::NodeRange::noderange($request->{noderange}->[0]);
my @mname = xCAT::Utils->noderangecontainsMn(@nodes);
if (@mname)
{ # MN in the nodelist
my $nodes=join(',', @mname);
my $rsp = {};
$rsp->{error}->[0] =
"You must not run $command and include the management node: $nodes.";
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
exit 1;
}
}
# save input noderange to remove nodes
if ($options{'rmnoderange'}) {
# check to see if Management Node is in the noderange, if so error
$request->{noderange}->[0] = $options{'rmnoderange'};
my @nodes = xCAT::NodeRange::noderange($request->{noderange}->[0]);
my @mname = xCAT::Utils->noderangecontainsMn(@nodes);
if (@mname)
@ -243,13 +284,21 @@ sub mkzone
return 1;
}
# test for -g, if no noderange this is an error
if (( ! defined($$options{'noderange'})) && ($$options{'assigngroup'})) {
if (( ! defined($$options{'addnoderange'})) && ($$options{'assigngroup'})) {
my $rsp = {};
$rsp->{error}->[0] =
" The -g flag requires a noderange ( -a).";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
# test for -r, not valid
if ($$options{'rmnoderange'}) {
my $rsp = {};
$rsp->{error}->[0] =
" The -r flag Is not valid for mkzone. Use chzone.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
# check to see if the input zone already exists
if (xCAT::Zone->iszonedefined($request->{zonename})) {
my $rsp = {};
@ -265,10 +314,13 @@ sub mkzone
$keydir .= "/.ssh";
# update the zone table
$rc=updatezonetable($request, $callback,$options,$keydir);
# add new zones to the zone table
$rc=addtozonetable($request, $callback,$options,$keydir);
if ($rc == 0) { # zone table setup is ok
$rc=addnodestozone($request, $callback,$options,$keydir);
# test for a noderange, if(-a) not supplied nothing to do
if (defined($$options{'addnoderange'})) {
$rc=addnodestozone($request, $callback,$options,$keydir);
}
if ($rc == 0) { # zone table setup is ok
# generate root ssh keys
$rc=gensshkeys($request, $callback,$options,$keydir);
@ -287,6 +339,10 @@ sub mkzone
=head3
Parses and runs chzone
Input
request
callback
Input arguments from the GetOpts
=cut
@ -295,14 +351,100 @@ sub mkzone
sub chzone
{
my ($request, $callback,$options,$keydir) = @_;
my $rc=0;
# Create default path to generated ssh keys
# keydir comes in set to /etc/xcat/sshkeys
$keydir .= $request->{zonename};
$keydir .= "/.ssh";
my $zonename=$request->{zonename};
# already checked but lets do it again, need a zonename
if (!($request->{zonename})) {
my $rsp = {};
$rsp->{error}->[0] =
"zonename not specified The zonename is required.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
# see if they asked to do anything
if ((!($$options{'sshkeypath'})) && (!($$options{'gensshkeys'})) &&
(!( $$options{'addnoderange'})) && (!( $$options{'rmnoderange'})) &&
(!( $$options{'defaultzone'})) &&
(!($$options{'assigngroup'} )) && (!($$options{'sshbetweennodes'}))) {
my $rsp = {};
$rsp->{info}->[0] =
"chzone was run but nothing to do.";
xCAT::MsgUtils->message("I", $rsp, $callback);
return 0;
}
# test for -g, if no noderange (-r or -a) this is an error
if ((( ! defined($$options{'addnoderange'}))&& ( ! defined($$options{'rmnoderange'}))) && ($$options{'assigngroup'})) {
my $rsp = {};
$rsp->{error}->[0] =
" The -g flag requires a noderange using the -a or -r option.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
# if -r remove nodes from zone, check to see that they are a member of the zone
# if not a member of the zone, error out and do nothing
if ($$options{'rmnoderange'}){
my @nodes = xCAT::NodeRange::noderange($request->{noderange}->[0]);
foreach my $node (@nodes) {
my $nodezonename=xCAT::Zone->getmyzonename($node);
if ($nodezonename ne $zonename) {
my $rsp = {};
$rsp->{error}->[0] =
" $node does not belong to the zone:$zonename. Rerun the chzone -r command with only nodes in the noderange that are currently assigned to the zone.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
}
}
# get the zone ssh key directory. We don't have a good zone without it.
my $sshrootkeydir = xCAT::Zone->getzonekeydir($zonename);
if ($sshrootkeydir == 1) { # error return
#if we have been requested to regenerated the ssh keys continue
if (($$options{'sshkeypath'}) || ($$options{'gensshkeys'})) {
my $rsp = {};
$rsp->{info}->[0] =
" sshkeydir attribute not defined for $zonename. The zone sshkeydir will be regenerated.";
xCAT::MsgUtils->message("I", $rsp, $callback);
} else { # sshkeydir is missing and they did not request to regenerate, that is an error
my $rsp = {};
$rsp->{error}->[0] =
" sshkeydir attribute not defined for $zonename. The zone sshkeydir must be regenerated. Rerun this command with -k or -K options";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
} else { # we got a sshkeydir from the database, use it
$keydir=$sshrootkeydir;
}
# do we regenerate keys (-k or -K)
if (($$options{'sshkeypath'}) || ($$options{'gensshkeys'})) {
$rc=gensshkeys($request, $callback,$options,$keydir);
if ($rc != 0) {
return 1;
}
}
# update the zone table
$rc=updatezonetable($request, $callback,$options,$keydir);
if ($rc == 0) { # zone table setup is ok
# update the nodelist table
if (defined($$options{'addnoderange'})) {
$rc=addnodestozone($request, $callback,$options,$keydir);
} else { # note -a and -r are not allowed on one chzone
if (defined($$options{'rmnoderange'})) {
$rc=rmnodesfromzone($request, $callback,$options,$keydir);
}
}
}
# my $rsp = {};
#xCAT::MsgUtils->message("I", $rsp, $callback);
return 0;
return $rc;
}
#-------------------------------------------------------
@ -411,7 +553,7 @@ sub rmzone
$tab->delEntries({zonename=>$zonename});
# remove zonename and possibly group name (-g flag) from any nodes defined in this zone
my $rc=rmnodesfromzone($request, $callback,$options);
my $rc=rmnodesfromzone($request, $callback,$options,"ALL");
return $rc;
@ -518,7 +660,7 @@ sub gensshkeys
#-------------------------------------------------------
=head3
updatezonetable
addtozonetable
Add the new zone to the zone table, check if already there and
error - use either chzone or -f to override default
@ -527,7 +669,7 @@ sub gensshkeys
=cut
#-------------------------------------------------------
sub updatezonetable
sub addtozonetable
{
my ($request, $callback,$options,$keydir) = @_;
my $rc=0;
@ -601,6 +743,81 @@ sub updatezonetable
}
#-------------------------------------------------------
=head3
updatezonetable
change either the sshbetweennodes or defaultzone attribute
or generate new keys ( -k -K)
=cut
#-------------------------------------------------------
sub updatezonetable
{
my ($request, $callback,$options,$keydir) = @_;
my $zoneentry;
my $zonename=$request->{zonename};
# check for changes
if (($$options{'sshbetweennodes'}) || ( $$options{'defaultzone'}) ||
($$options{'sshkeypath'}) || ($$options{'gensshkeys'})) {
my $tab = xCAT::Table->new("zone");
if($tab) {
# now add the users changes
my %tb_cols;
# generated keys ( -k or -K)
if (($$options{'sshkeypath'}) || ($$options{'gensshkeys'})) {
$tb_cols{sshkeydir} = $keydir; # key directory
}
# set sshbetweennodes attribute from -s flag
if ( $$options{'sshbetweennodes'}) {
$tb_cols{sshbetweennodes} = $$options{'sshbetweennodes'};
}
# if --defaultzone
if ( $$options{'defaultzone'}) { # set the default
# check to see if a default already defined
my $curdefaultzone = xCAT::Zone->getdefaultzone($callback);
if (!(defined ($curdefaultzone))) { # no default defined
$tb_cols{defaultzone} ="yes";
} else { # already a default
if ($$options{'force'}) { # force the default
$tb_cols{defaultzone} ="yes";
$tab->setAttribs({zonename => $zonename}, \%tb_cols);
# now change the old default zone to not be the default
my %tb1_cols;
$tb1_cols{defaultzone} ="no";
$tab->setAttribs({zonename => $curdefaultzone}, \%tb1_cols);
$tab->commit();
$tab->close();
} else { # no force this is an error
my $rsp = {};
$rsp->{error}->[0] =
" Failure setting default zone. The defaultzone $curdefaultzone already exists. Use the -f flag if you want to override the current default zone.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
}
} else { # not a default zone change, just commit the other changes
$tab->setAttribs({zonename => $zonename}, \%tb_cols);
$tab->commit();
$tab->close();
}
} else {
my $rsp = {};
$rsp->{error}->[0] =
" Failure opening the zone table.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
}
return 0;
}
#-------------------------------------------------------
=head3
addnodestozone
Add the new zonename attribute to any nodes in the noderange ( if a noderange specified)
@ -615,15 +832,17 @@ sub addnodestozone
{
my ($request, $callback,$options,$keydir) = @_;
my $rc=0;
# test for a noderange, if not supplied nothing to do
if ( ! defined($$options{'noderange'})) {
return 0;
}
my $zonename=$request->{zonename};
# there is a node range. update the nodelist table
# if -g add zonename group also
my $group=$$options{'noderange'};
my @nodes = xCAT::NodeRange::noderange($request->{noderange}->[0]);
# check to see if noderange expanded
if (!(scalar @nodes)) {
my $rsp = {};
$rsp->{error}->[0] =
" The noderange $request->{noderange}->[0] is not valid. The nodes are not defined.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
my $tab = xCAT::Table->new("nodelist");
if ($tab)
{
@ -651,9 +870,11 @@ sub addnodestozone
=head3
rmnodesfromzone
removes the zonename from all nodes with their zonename the input zone
removes the zonename from all nodes with their zonename the input zone or
the noderange supplied on the -r flag
if -g, removes zonename group from all nodes defined with their zonename the input zone.
Note if $ALL is input it removes all nodes from the zone,
otherwise $request->{noderange} points to the noderange
=cut
@ -661,13 +882,26 @@ sub addnodestozone
#-------------------------------------------------------
sub rmnodesfromzone
{
my ($request, $callback,$options) = @_;
my ($request, $callback,$options,$ALL) = @_;
my $zonename=$request->{zonename};
my $tab = xCAT::Table->new("nodelist");
if ($tab)
{
# read all the nodes with zonename
my @nodes = xCAT::Zone->getnodesinzone($callback,$zonename);
my @nodes;
if ($ALL) { # do all nodes
@nodes = xCAT::Zone->getnodesinzone($callback,$zonename);
} else { # the nodes in the noderange ( -r )
@nodes = xCAT::NodeRange::noderange($request->{noderange}->[0]);
# check to see if noderange expanded
if (!(scalar @nodes)) {
my $rsp = {};
$rsp->{error}->[0] =
" The noderange $request->{noderange}->[0] is not valid. The nodes are not defined.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
}
# if -g then remove the zonename group attribute on each node
if ($$options{'assigngroup'}){
foreach my $node (@nodes) {

View File

@ -0,0 +1,128 @@
#! /usr/bin/perl
package genrestapidoc;
my @apigroups = (
{
groupname => 'node',
resources => ['allnode', 'nodeallattr']
},
{
groupname => 'network',
resources => ['network', 'network_allattr', 'network_attr']
},
);
my %formathdl = (
text => \&outtext,
);
sub outtext {
my $def = shift;
my $opt = shift;
my $head = shift;
if ($head) {
print "\n$head\n";
}
my $postfix = "?userName=xxx&password=xxx&pretty=1";
if (defined ($def->{desc})) {
print " $opt - $def->{desc}\n";
}
if (defined ($def->{usage})) {
my @parts = split ('\|', $def->{usage});
if ($parts[1]) {
print " Parameters: $parts[2]\n";
}
if ($parts[2]) {
print " Returns: $parts[2]\n";
}
}
if (defined ($def->{example})) {
my @parts = split ('\|', $def->{example});
print " Example:\n";
if ($parts[1]) {
print " $parts[1]\n";
}
if ($parts[2] && $parts[3] && $parts[4]) {
my ($uri, $data);
if ($part[3] =~ /\s+/) {
($uri, $data) = split(/ /, $part[3]);
print " #curl $parts[2] -k \'https://myserver/xcatws$uri$postfix\' -H Content-Type:application/json --data \'$data\'\n";
} else {
print " #curl $parts[2] -k \'https://myserver/xcatws$parts[3]$postfix\'\n";
}
$parts[4] =~ s/\n/\n /g;
print " $parts[4]\n";
}
}
}
sub gendoc {
my $URIdef = shift;
my $format = shift;
unless ($format) {
$format = "text";
}
my @errmsg;
foreach my $group (@apigroups) {
my $groupname = $group->{'groupname'};
if (defined ($URIdef->{$groupname})) {
foreach my $res (@{$group->{'resources'}}) {
if (defined ($URIdef->{$groupname}->{$res})) {
if (defined ($URIdef->{$groupname}->{$res}->{GET})) {
$formathdl{$format}->($URIdef->{$groupname}->{$res}->{GET}, "GET", $URIdef->{$groupname}->{$res}->{desc});
}
if (defined ($URIdef->{$groupname}->{$res}->{PUT})) {
$formathdl{$format}->($URIdef->{$groupname}->{$res}->{PUT}, "PUT");
}
if (defined ($URIdef->{$groupname}->{$res}->{POST})) {
$formathdl{$format}->($URIdef->{$groupname}->{$res}->{POST}, "POST");
}
if (defined ($URIdef->{$groupname}->{$res}->{DELETE})) {
$formathdl{$format}->($URIdef->{$groupname}->{$res}->{DELETE}, "DELETE");
}
} else {
push @errmsg, "Cannot find the definition for resource [$res]\n";
}
}
} else {
push @errmsg, "Cannot find the definition for resource group [$groupname]\n";
}
}
print @errmsg;
}
sub displayUsage {
foreach my $group (keys %URIdef) {
print "Resource Group: $group\n";
foreach my $res (keys %{$URIdef{$group}}) {
print " Resource: $res\n";
print " $URIdef{$group}->{$res}->{desc}\n";
if (defined ($URIdef{$group}->{$res}->{GET})) {
print " GET: $URIdef{$group}->{$res}->{GET}->{desc}\n";
}
if (defined ($URIdef{$group}->{$res}->{PUT})) {
print " PUT: $URIdef{$group}->{$res}->{PUT}->{desc}\n";
}
if (defined ($URIdef{$group}->{$res}->{POST})) {
print " POST: $URIdef{$group}->{$res}->{POST}->{desc}\n";
}
if (defined ($URIdef{$group}->{$res}->{DELETE})) {
print " DELETE: $URIdef{$group}->{$res}->{DELETE}->{desc}\n";
}
}
}
}

1734
xCAT-server/xCAT-wsapi/restapi.pl Executable file

File diff suppressed because it is too large Load Diff

View File

@ -42,80 +42,83 @@ function chkrc
#todo: add a test case for every api call that is documented
set -x
# clean up from last time
curl -# -X DELETE -k "https://127.0.0.1/xcatws/nodes/wstest?userName=$user&password=$pw" >/dev/null; echo ''
curl -# -X DELETE -k "https://127.0.0.1/xcatws/node/wstest?userName=$user&password=$pw" >/dev/null; echo ''
# create test nodes
curl -# -X POST -k "https://127.0.0.1/xcatws/nodes/wstest1-wstest2?userName=$user&password=$pw&$format" $ctype --data '{"groups":"wstest","netboot":"xnba"}' \
curl -# -X POST -k "https://127.0.0.1/xcatws/node/wstest1-wstest2?userName=$user&password=$pw&$format" $ctype --data '{"groups":"wstest","netboot":"xnba"}' \
| grep -q '2 object definitions have been created'; chkrc
# list all nodes and make sure they are in the list
curl -# -X GET -k "https://127.0.0.1/xcatws/nodes?userName=$user&password=$pw&$format" \
curl -# -X GET -k "https://127.0.0.1/xcatws/node?userName=$user&password=$pw&$format" \
| pcregrep -qM '"wstest1",\n\s*"wstest2"'; chkrc
# list all node's group and netboot attributes
curl -# -X GET -k "https://127.0.0.1/xcatws/nodes?userName=$user&password=$pw&field=groups&field=netboot" \
curl -# -X GET -k "https://127.0.0.1/xcatws/node?userName=$user&password=$pw&field=groups&field=netboot" \
| grep -qE '"nodename":"wstest1".*"groups":"wstest"'; chkrc
# list all attributes of all nodes
curl -# -X GET -k "https://127.0.0.1/xcatws/nodes?userName=$user&password=$pw&field=ALL" \
curl -# -X GET -k "https://127.0.0.1/xcatws/node?userName=$user&password=$pw&field=ALL" \
| grep -qE '"nodename":"wstest1".*"groups":"wstest"'; chkrc
# list the noderange and make sure they are in the list
curl -# -X GET -k "https://127.0.0.1/xcatws/nodes/wstest?userName=$user&password=$pw&$format" \
curl -# -X GET -k "https://127.0.0.1/xcatws/node/wstest?userName=$user&password=$pw&$format" \
| pcregrep -qM '"wstest1",\n\s*"wstest2"'; chkrc
# list all node's group and netboot attributes
curl -# -X GET -k "https://127.0.0.1/xcatws/nodes/wstest?userName=$user&password=$pw&field=groups&field=netboot" \
curl -# -X GET -k "https://127.0.0.1/xcatws/node/wstest?userName=$user&password=$pw&field=groups&field=netboot" \
| grep -qE '"nodename":"wstest1".*"groups":"wstest"'; chkrc
# list all attributes of all nodes
curl -# -X GET -k "https://127.0.0.1/xcatws/nodes/wstest?userName=$user&password=$pw&field=ALL" \
curl -# -X GET -k "https://127.0.0.1/xcatws/node/wstest?userName=$user&password=$pw&field=ALL" \
| grep -qE '"nodename":"wstest1".*"groups":"wstest"'; chkrc
# change some attributes
curl -# -X PUT -k "https://127.0.0.1/xcatws/nodes/wstest?userName=$user&password=$pw&$format" $ctype --data '{"room":"222","netboot":"pxe"}' \
curl -# -X PUT -k "https://127.0.0.1/xcatws/node/wstest?userName=$user&password=$pw&$format" $ctype --data '{"room":"222","netboot":"pxe"}' \
| grep -q '2 object definitions have been created or modified'; chkrc
# verify they got the new values
curl -# -X GET -k "https://127.0.0.1/xcatws/nodes/wstest?userName=$user&password=$pw&field=room&field=netboot" \
curl -# -X GET -k "https://127.0.0.1/xcatws/node/wstest?userName=$user&password=$pw&field=room&field=netboot" \
| grep -qE '"nodename":"wstest1".*"room":"222"'; chkrc
# delete the nodes
curl -# -X DELETE -k "https://127.0.0.1/xcatws/nodes/wstest?userName=$user&password=$pw&$format" \
curl -# -X DELETE -k "https://127.0.0.1/xcatws/node/wstest?userName=$user&password=$pw&$format" \
| grep -q '2 object definitions have been removed'; chkrc
# list all nodes and make sure they are not in the list
curl -# -X GET -k "https://127.0.0.1/xcatws/nodes?userName=$user&password=$pw&$format" \
curl -# -X GET -k "https://127.0.0.1/xcatws/node?userName=$user&password=$pw&$format" \
| pcregrep -qM '"wstest1",\n\s*"wstest2"'; chkrc not
# list the power state of the noderange
curl -# -X GET -k "https://127.0.0.1/xcatws/nodes/$nr/power?userName=$user&password=$pw&$format" \
curl -# -X GET -k "https://127.0.0.1/xcatws/node/$nr/power?userName=$user&password=$pw&$format" \
| grep -q '"power":"on"'; chkrc
# list the nodestat state of the noderange
curl -# -X GET -k "https://127.0.0.1/xcatws/nodes/$nr/status?userName=$user&password=$pw&$format" \
curl -# -X GET -k "https://127.0.0.1/xcatws/node/$nr/status?userName=$user&password=$pw&$format" \
| grep -q '":"sshd"'; chkrc
# list the node inventory of the noderange
curl -# -X GET -k "https://127.0.0.1/xcatws/nodes/$nr/inventory?userName=$user&password=$pw&$format" \
curl -# -X GET -k "https://127.0.0.1/xcatws/node/$nr/inventory?userName=$user&password=$pw&$format" \
| grep -q '"Board manufacturer":"IBM"'; chkrc
# list the node vitals of the noderange
curl -# -X GET -k "https://127.0.0.1/xcatws/nodes/$nr/vitals?userName=$user&password=$pw&$format" \
curl -# -X GET -k "https://127.0.0.1/xcatws/node/$nr/vitals?userName=$user&password=$pw&$format" \
| grep -q '"Cooling Fault":"false"'; chkrc
# list the node energy settings of the noderange
curl -# -X GET -k "https://127.0.0.1/xcatws/nodes/$nr/energy?userName=$user&password=$pw&$format&field=cappingstatus&field=cappingmaxmin" \
curl -# -X GET -k "https://127.0.0.1/xcatws/node/$nr/energy?userName=$user&password=$pw&$format&field=cappingstatus&field=cappingmaxmin" \
| grep -q '"cappingstatus":"off"'; chkrc
# run a cmd on the noderange
curl -# -X POST -k "https://127.0.0.1/xcatws/nodes/$nr/dsh?userName=$user&password=$pw&$format" $ctype --data '{"command":"pwd"}' \
curl -# -X POST -k "https://127.0.0.1/xcatws/node/$nr/dsh?userName=$user&password=$pw&$format" $ctype --data '{"command":"pwd"}' \
| grep -q '"/root"'; chkrc
# copy a file to the noderange
curl -# -X POST -k "https://127.0.0.1/xcatws/nodes/$nr/dcp?userName=$user&password=$pw&$format" $ctype --data '{"source":"/root/.bashrc","target":"/tmp/"}' \
curl -# -X POST -k "https://127.0.0.1/xcatws/node/$nr/dcp?userName=$user&password=$pw&$format" $ctype --data '{"source":"/root/.bashrc","target":"/tmp/"}' \
| grep -q '"errorcode":"0"'; chkrc
# test the table calls
curl -# -X GET -k "https://127.0.0.1/xcatws/table/nodelist/wstest?userName=$user&password=$pw&$format"
exit
@ -128,5 +131,5 @@ exit
#curl -X GET -k "https://127.0.0.1/xcatws/images/bp-netboot?userName=$user&password=$pw&$format&field=osvers"
#todo: remove when these test cases are in xcatws-test.pl
#./xcatws-test.pl -u "https://127.0.0.1/xcatws/nodes/test001?userName=$user&password=$pw" -m GET
#./xcatws-test.pl -u "https://127.0.0.1/xcatws/nodes/test001?userName=$user&password=$pw" -m PUT "nodepos.room=foo"
#./xcatws-test.pl -u "https://127.0.0.1/xcatws/node/test001?userName=$user&password=$pw" -m GET
#./xcatws-test.pl -u "https://127.0.0.1/xcatws/node/test001?userName=$user&password=$pw" -m PUT "nodepos.room=foo"