Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
This commit is contained in:
commit
d9d0ac7835
@ -68,7 +68,7 @@ function makedeb {
|
||||
}
|
||||
|
||||
# build all debian packages
|
||||
packages="xCAT-client xCAT-nbroot xCAT-nbroot2 perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-IBMhpc xCAT-rmc xCAT-vlan"
|
||||
packages="xCAT-client xCAT-nbroot xCAT-nbroot2 perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-IBMhpc xCAT-rmc xCAT-vlan xCAT-confluent"
|
||||
|
||||
for file in `echo $packages`
|
||||
do
|
||||
|
@ -194,8 +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 xCAT-OpenStack-baremetal xCAT-buildkit"
|
||||
packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT xCATsn xCAT-test xCAT-buildkit xCAT-vlan"
|
||||
packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT xCATsn xCAT-test xCAT-buildkit xCAT-vlan xCAT-confluent"
|
||||
target_archs=(amd64 ppc64el)
|
||||
for file in `echo $packages`
|
||||
do
|
||||
|
18
buildcore.sh
18
buildcore.sh
@ -241,12 +241,13 @@ if [ "$OSNAME" = "AIX" ]; then
|
||||
fi
|
||||
|
||||
# Build the rest of the noarch rpms
|
||||
for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xCAT-buildkit xCAT-SoftLayer xCAT-vlan; do
|
||||
for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xCAT-buildkit xCAT-SoftLayer xCAT-vlan xCAT-confluent; do
|
||||
#if [ "$EMBED" = "zvm" -a "$rpmname" != "xCAT-server" -a "$rpmname" != "xCAT-UI" ]; then continue; fi # for zvm embedded env only need to build server and UI
|
||||
if [[ " $EMBEDBUILD " != *\ $rpmname\ * ]]; then continue; fi
|
||||
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-buildkit" ]; then continue; fi # do not build xCAT-buildkit on aix
|
||||
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-SoftLayer" ]; then continue; fi # do not build xCAT-softlayer on aix
|
||||
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-vlan" ]; then continue; fi # do not build xCAT-vlan on aix
|
||||
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-buildkit" ]; then continue; fi # do not build xCAT-buildkit on aix
|
||||
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-SoftLayer" ]; then continue; fi # do not build xCAT-softlayer on aix
|
||||
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-vlan" ]; then continue; fi # do not build xCAT-vlan on aix
|
||||
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-confluent" ]; then continue; fi # do not build xCAT-confluent on aix
|
||||
if $GREP $rpmname $GITUP || [ "$BUILDALL" == 1 ]; then
|
||||
UPLOAD=1
|
||||
maker $rpmname
|
||||
@ -427,7 +428,14 @@ if [[ $REPOFILE == "xCAT-*.repo" ]]; then
|
||||
echo "ERROR: For xcat-dep, please execute $0 in the correct <os>/<arch> subdirectory"
|
||||
exit 1
|
||||
fi
|
||||
sed -e 's|baseurl=.*|baseurl=file://'"`pwd`"'|' $REPOFILE | sed -e 's|gpgkey=.*|gpgkey=file://'"`pwd`"'/repodata/repomd.xml.key|' > /etc/yum.repos.d/$REPOFILE
|
||||
#
|
||||
# default to RHEL yum, if doesn't exist try Zypper
|
||||
#
|
||||
DIRECTORY="/etc/yum.repos.d"
|
||||
if [[ ! -d ${DIRECTORY} ]]; then
|
||||
DIRECTORY="/etc/zypp/repos.d"
|
||||
fi
|
||||
sed -e 's|baseurl=.*|baseurl=file://'"`pwd`"'|' $REPOFILE | sed -e 's|gpgkey=.*|gpgkey=file://'"`pwd`"'/repodata/repomd.xml.key|' > ${DIRECTORY}/$REPOFILE
|
||||
cd -
|
||||
EOF2
|
||||
chmod 775 mklocalrepo.sh
|
||||
|
@ -1,28 +1,36 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Query the softlayer account for info about all of the bare metal servers and
|
||||
# put the info in mkdef stanza format, so the node can be defined in the xcat db
|
||||
# so that xcat can manage/deploy them.
|
||||
"""
|
||||
Usage: getslnodes.py [-h] [-v] [<hostname-match>]
|
||||
|
||||
Description:
|
||||
Query your SoftLayer account and get attributes for each bare metal server.
|
||||
The attributes can be piped to 'mkdef -z' to define the nodes into the xCAT
|
||||
Database so that xCAT can manage them.
|
||||
|
||||
getslnodes requires a the .softlayer configuration file defined which can
|
||||
be set by running "sl config setup" on the command line.
|
||||
|
||||
positional arguments:
|
||||
hostname-match Select servers that include this partial hostname.
|
||||
|
||||
Optional:
|
||||
-h, --help show this help message and exit
|
||||
-v, --verbose display verbose output
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
try:
|
||||
import sys
|
||||
import docopt
|
||||
import pprint
|
||||
import argparse
|
||||
import SoftLayer
|
||||
except ImportError as e:
|
||||
print 'Error: install missing python module before running this command: '+str(e)
|
||||
print 'Error: install missing python module before running this command: ' + str(e)
|
||||
sys.exit(2)
|
||||
|
||||
# Process the cmd line args
|
||||
# --help is automatically provided by this
|
||||
parser = argparse.ArgumentParser(description="Query your SoftLayer account and get attributes for each bare metal server. The attributes can be piped to 'mkdef -z' to define the nodes in the xCAT DB so that xCAT can manage them. getslnodes requires a .softlayer file in your home directory that contains your SoftLayer username, api_key, and optionally endpoint_url.")
|
||||
parser.add_argument('hnmatch', metavar='hostname-match', nargs='?', help='Select servers that include this partial hostname.')
|
||||
parser.add_argument('-v', "--verbose", action="store_true", help="display verbose output")
|
||||
args = parser.parse_args()
|
||||
hnmatch = args.hnmatch # if they specified a hostname match, only show svrs that start with that
|
||||
def get_sl_servers():
|
||||
|
||||
# Get info from softlayer
|
||||
try:
|
||||
# username, api_key, endpoint_url come from the .softlayer file
|
||||
client = SoftLayer.Client()
|
||||
|
||||
@ -30,53 +38,74 @@ try:
|
||||
operatingSystem.id, operatingSystem.passwords.username, operatingSystem.passwords.password, \
|
||||
remoteManagementAccounts.username, remoteManagementAccounts.password, remoteManagementComponent.ipmiIpAddress, \
|
||||
primaryBackendNetworkComponent.primaryIpAddress, primaryBackendNetworkComponent.macAddress"
|
||||
#
|
||||
# If they specified hnmatch, it would be faster to have softlayer filter the response with something like:
|
||||
# filter={'hardware': {'hostname': {'operation': '*= '+hostname}, 'domain': {'operation': '*= '+domain}}}
|
||||
# But those 2 operations are ANDed together, so it will not work. And currently, filtering does not work on fullyQualifiedDomainName.
|
||||
#
|
||||
servers = client['Account'].getHardware(mask=mask)
|
||||
if args.verbose: pprint.pprint(servers)
|
||||
except SoftLayer.exceptions.SoftLayerAPIError as e:
|
||||
print 'Error: '+str(e)
|
||||
return servers
|
||||
|
||||
def print_xcat_node_stanza(servers, hnmatch):
|
||||
|
||||
# print info out in xcat node stanza format
|
||||
for server in servers:
|
||||
if hnmatch and server['fullyQualifiedDomainName'].find(hnmatch) == -1: continue
|
||||
print "\n"+server['hostname']+":"
|
||||
print "\tobjtype=node"
|
||||
print "\tgroups=slnode,ipmi,all"
|
||||
print "\tmgt=ipmi"
|
||||
print "\tbmc="+server['remoteManagementComponent']['ipmiIpAddress']
|
||||
for server in servers:
|
||||
if hnmatch and server['fullyQualifiedDomainName'].find(hnmatch) == -1:
|
||||
continue
|
||||
|
||||
# I have seen svrs with no remoteManagementAccounts entries
|
||||
if len(server['remoteManagementAccounts']):
|
||||
print "\tbmcusername="+server['remoteManagementAccounts'][0]['username']
|
||||
print "\tbmcpassword="+server['remoteManagementAccounts'][0]['password']
|
||||
print "\n"+server['hostname']+":"
|
||||
print "\tobjtype=node"
|
||||
print "\tgroups=slnode,ipmi,all"
|
||||
print "\tmgt=ipmi"
|
||||
print "\tbmc="+server['remoteManagementComponent']['ipmiIpAddress']
|
||||
|
||||
print "\tip="+server['primaryBackendNetworkComponent']['primaryIpAddress']
|
||||
print "\tmac="+server['primaryBackendNetworkComponent']['macAddress']
|
||||
print "\tserial="+server['manufacturerSerialNumber']
|
||||
print "\tnetboot=xnba"
|
||||
print "\tarch=x86_64"
|
||||
# I have seen svrs with no remoteManagementAccounts entries
|
||||
if len(server['remoteManagementAccounts']):
|
||||
print "\tbmcusername="+server['remoteManagementAccounts'][0]['username']
|
||||
print "\tbmcpassword="+server['remoteManagementAccounts'][0]['password']
|
||||
|
||||
# Find the root or Administrator username and pw
|
||||
username = None
|
||||
password = None
|
||||
for entry in server['operatingSystem']['passwords']:
|
||||
if entry['username'] == 'root' or entry['username'] == 'Administrator':
|
||||
# found it
|
||||
username = entry['username']
|
||||
password = entry['password']
|
||||
break
|
||||
elif not username:
|
||||
# save the 1st entry, in case we never find root or Administrator
|
||||
username = entry['username']
|
||||
password = entry['password']
|
||||
if username and password: userStr = ", user:"+username+", pw:"+password
|
||||
print "\tusercomment=hostname:"+server['fullyQualifiedDomainName']+userStr
|
||||
sys.exit(0)
|
||||
print "\tip="+server['primaryBackendNetworkComponent']['primaryIpAddress']
|
||||
print "\tmac="+server['primaryBackendNetworkComponent']['macAddress']
|
||||
print "\tserial="+server['manufacturerSerialNumber']
|
||||
print "\tnetboot=xnba"
|
||||
print "\tarch=x86_64"
|
||||
|
||||
# Find the root or Administrator username and pw
|
||||
username = None
|
||||
password = None
|
||||
for entry in server['operatingSystem']['passwords']:
|
||||
if entry['username'] == 'root' or entry['username'] == 'Administrator':
|
||||
# found it
|
||||
username = entry['username']
|
||||
password = entry['password']
|
||||
break
|
||||
elif not username:
|
||||
# save the 1st entry, in case we never find root or Administrator
|
||||
username = entry['username']
|
||||
password = entry['password']
|
||||
|
||||
if username and password:
|
||||
userStr = ", user:"+username+", pw:"+password
|
||||
|
||||
print "\tusercomment=hostname:"+server['fullyQualifiedDomainName']+userStr
|
||||
|
||||
|
||||
def verbose(text):
|
||||
'''Print msg only if -v was specified.'''
|
||||
if args.verbose: print text
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
arguments = (docopt.docopt(__doc__, version="1.0"))
|
||||
# print arguments
|
||||
|
||||
servers = get_sl_servers()
|
||||
if arguments['--verbose']:
|
||||
pprint.pprint(servers)
|
||||
|
||||
print_xcat_node_stanza(servers, arguments['<hostname-match>'])
|
||||
|
||||
except docopt.DocoptExit as e:
|
||||
print e
|
||||
except SoftLayer.exceptions.SoftLayerAPIError as e:
|
||||
print e
|
||||
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
|
@ -28,7 +28,7 @@ system management server
|
||||
|
||||
%build
|
||||
# Convert pods to man pages and html pages
|
||||
./xpod2man
|
||||
#./xpod2man
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
@ -225,7 +225,12 @@ $uarch="amd64" if ($arch eq x86_64);
|
||||
|
||||
unless ($onlyinitrd) {
|
||||
@aptdirs=();
|
||||
find(\&isaptdir, <$srcdir/>);
|
||||
|
||||
# Get the ubuntu repo path from osimage.pkgdir
|
||||
my @srcdirs = split(',', $srcdir);
|
||||
foreach my $dir (@srcdirs) {
|
||||
find(\&isaptdir, <$dir/>);
|
||||
}
|
||||
# Add the dir for kernel deb to be installed
|
||||
if ($kernelver) {
|
||||
find(\&isaptdir, <$kerneldir/>);
|
||||
@ -274,11 +279,20 @@ unless ($onlyinitrd) {
|
||||
my $aptcmd1 = "debootstrap";
|
||||
#my $aptcmd2 = "--arch $uarch $dist $rootimg_dir file://$installroot/$osver/$arch/";
|
||||
my $aptcmd2;
|
||||
if ($uarch eq 'ppc64el') {
|
||||
$aptcmd2 = "--verbose --arch $uarch $dist $rootimg_dir http://ports.ubuntu.com/ubuntu-ports/";
|
||||
|
||||
# Check whether a local Ubuntu mirror is specified
|
||||
# if linuximage.pkgdir has second mirror is set, we consider the second mirror as a full Ubuntu mirror
|
||||
if ($#srcdirs > 0) {
|
||||
$aptcmd2 = "--verbose --arch $uarch $dist $rootimg_dir file://$srcdirs[1]";
|
||||
$srcdir = $srcdirs[0];
|
||||
} else {
|
||||
$aptcmd2 = "--verbose --arch $uarch $dist $rootimg_dir http://archive.ubuntu.com/ubuntu/";
|
||||
if ($uarch eq 'ppc64el') {
|
||||
$aptcmd2 = "--verbose --arch $uarch $dist $rootimg_dir http://ports.ubuntu.com/ubuntu-ports/";
|
||||
} else {
|
||||
$aptcmd2 = "--verbose --arch $uarch $dist $rootimg_dir http://archive.ubuntu.com/ubuntu/";
|
||||
}
|
||||
}
|
||||
|
||||
mkpath("$rootimg_dir/var/lib/dpkg");
|
||||
mkpath("$rootimg_dir/var/lib/apt");
|
||||
|
||||
@ -390,6 +404,7 @@ 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){
|
||||
|
@ -11,7 +11,6 @@ chdef_multiple_keys
|
||||
chdef_n
|
||||
chdef_t_o_error
|
||||
chtab_null
|
||||
chtab_modify
|
||||
chtab_d
|
||||
chtab_modify_node
|
||||
chtab_modify_key
|
||||
@ -120,9 +119,7 @@ noderm_null
|
||||
noderm_err_node
|
||||
nodeset_stat
|
||||
nodeset_noderange
|
||||
nodestat_noderange
|
||||
nodestat_err_node
|
||||
rinv_null
|
||||
rinv_bus
|
||||
rinv_config
|
||||
rinv_serial
|
||||
@ -131,7 +128,6 @@ rinv_firm
|
||||
rinv_all
|
||||
rinv_noderange_err
|
||||
rmdef_null
|
||||
rmdef_f_all
|
||||
rmdef_t_err
|
||||
rpower_off
|
||||
rpower_stat
|
||||
@ -191,7 +187,6 @@ dumpxCATdb_a_p_nullskiptables_V
|
||||
dumpxCATdb_p_V
|
||||
restorexCAT_h
|
||||
restorexCATdb_v
|
||||
restorexCATdb_p
|
||||
restorexCATdb_p_V
|
||||
restorexCATdb_a_p_V
|
||||
restorexCATdb_wrongpath
|
||||
@ -216,7 +211,6 @@ makehosts_d
|
||||
makehosts_n
|
||||
makehosts_n_noderange
|
||||
xdcp_src_dst
|
||||
xdcp_P
|
||||
makedns_h
|
||||
makedns_d_node
|
||||
makedns_n
|
||||
@ -224,15 +218,10 @@ makedns
|
||||
noderange_individual_node
|
||||
noderange_individual_grp
|
||||
noderange_node01-node10
|
||||
noderange_node[01-10]
|
||||
noderange_group1-group3
|
||||
noderange_node001-node200
|
||||
noderange_node10+3
|
||||
noderange_10-20
|
||||
noderange_XCAT_NODE_PREFIX
|
||||
noderange_XCAT_NODE_SUFFIX
|
||||
noderange_/nrtestnode.*
|
||||
noderange_/tmp/nodelistfile
|
||||
noderange_exclusion
|
||||
noderange_group_intersection
|
||||
confignics_config_one_port_single_value
|
||||
@ -246,11 +235,9 @@ xdsh_h
|
||||
xdsh_V
|
||||
xdsh_regular_command
|
||||
xdsh_Q_command
|
||||
xdsh_c_sn
|
||||
xdsh_c_cn
|
||||
xdsh_e_filename
|
||||
xdsh_E
|
||||
xdsh_i_linux
|
||||
xdsh_t
|
||||
xdsh_q
|
||||
xdsh_T
|
||||
|
@ -11,7 +11,6 @@ chdef_multiple_keys
|
||||
chdef_n
|
||||
chdef_t_o_error
|
||||
chtab_null
|
||||
chtab_modify
|
||||
chtab_d
|
||||
chtab_modify_node
|
||||
chtab_modify_key
|
||||
@ -120,9 +119,7 @@ noderm_null
|
||||
noderm_err_node
|
||||
nodeset_stat
|
||||
nodeset_noderange
|
||||
nodestat_noderange
|
||||
nodestat_err_node
|
||||
rinv_null
|
||||
rinv_bus
|
||||
rinv_config
|
||||
rinv_serial
|
||||
@ -131,7 +128,6 @@ rinv_firm
|
||||
rinv_all
|
||||
rinv_noderange_err
|
||||
rmdef_null
|
||||
rmdef_f_all
|
||||
rmdef_t_err
|
||||
rpower_off
|
||||
rpower_stat
|
||||
@ -191,7 +187,6 @@ dumpxCATdb_a_p_nullskiptables_V
|
||||
dumpxCATdb_p_V
|
||||
restorexCAT_h
|
||||
restorexCATdb_v
|
||||
restorexCATdb_p
|
||||
restorexCATdb_p_V
|
||||
restorexCATdb_a_p_V
|
||||
restorexCATdb_wrongpath
|
||||
@ -216,7 +211,6 @@ makehosts_d
|
||||
makehosts_n
|
||||
makehosts_n_noderange
|
||||
xdcp_src_dst
|
||||
xdcp_P
|
||||
makedns_h
|
||||
makedns_d_node
|
||||
makedns_n
|
||||
@ -224,15 +218,10 @@ makedns
|
||||
noderange_individual_node
|
||||
noderange_individual_grp
|
||||
noderange_node01-node10
|
||||
noderange_node[01-10]
|
||||
noderange_group1-group3
|
||||
noderange_node001-node200
|
||||
noderange_node10+3
|
||||
noderange_10-20
|
||||
noderange_XCAT_NODE_PREFIX
|
||||
noderange_XCAT_NODE_SUFFIX
|
||||
noderange_/nrtestnode.*
|
||||
noderange_/tmp/nodelistfile
|
||||
noderange_exclusion
|
||||
noderange_group_intersection
|
||||
confignics_config_one_port_single_value
|
||||
@ -246,11 +235,9 @@ xdsh_h
|
||||
xdsh_V
|
||||
xdsh_regular_command
|
||||
xdsh_Q_command
|
||||
xdsh_c_sn
|
||||
xdsh_c_cn
|
||||
xdsh_e_filename
|
||||
xdsh_E
|
||||
xdsh_i_linux
|
||||
xdsh_t
|
||||
xdsh_q
|
||||
xdsh_T
|
||||
|
@ -168,7 +168,6 @@ lsxcatd_null
|
||||
lsxcatd_h
|
||||
lsxcatd_d
|
||||
lsxcatd_a
|
||||
xdcp_P
|
||||
makedns_d_node
|
||||
makedns_n
|
||||
makedns
|
||||
|
@ -224,8 +224,6 @@ rmkit_f
|
||||
rmkit_V
|
||||
rmkitcomp_v
|
||||
rmkitcomp_h
|
||||
rmkitcomp_noscripts
|
||||
rmkitcomp_f
|
||||
xdsh_h
|
||||
xdsh_V
|
||||
xdsh_regular_command
|
||||
@ -237,5 +235,3 @@ xdsh_t
|
||||
xdsh_q
|
||||
xdsh_T
|
||||
xdsh_o
|
||||
xdsh_c_sn
|
||||
xdsh_i_linux
|
||||
|
@ -100,7 +100,7 @@ function configipv4(){
|
||||
echo "NETMASK_${num_v4num}=${str_v4mask}" >> $str_conf_file
|
||||
echo "NETWORK_${num_v4num}=${str_v4net}" >> $str_conf_file
|
||||
echo "LABEL_${num_v4num}=${num_v4num}" >> $str_conf_file
|
||||
if [ "$str_mtu "!= "$str_default_token" ]; then
|
||||
if [ "$str_mtu" != "$str_default_token" ]; then
|
||||
echo "MTU_${num_v4num}=${str_mtu}" >> $str_conf_file
|
||||
fi
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user