Compare commits
122 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0b1751059b | |||
| 5d5bc70fe8 | |||
| 083154650c | |||
| 44060947cc | |||
| 731a2b9a9d | |||
| 544cabd915 | |||
| 9f8c5f7998 | |||
| 9f20565957 | |||
| bf91d7e939 | |||
| 3af54f8e00 | |||
| 82a094b753 | |||
| b6e445e1f6 | |||
| fb97c85957 | |||
| 4d5c361055 | |||
| f3fce3cbd7 | |||
| f9decc9b87 | |||
| c101ca6858 | |||
| fbd56c732b | |||
| 602f8beb52 | |||
| 734b00e875 | |||
| 2f2a72e90c | |||
| de82de8d87 | |||
| dd87d634e5 | |||
| a2a76f23c6 | |||
| 2f39a9182c | |||
| c94740deb4 | |||
| 5a7e50c1fe | |||
| dab3cf53b0 | |||
| 0857cb241a | |||
| 27085c3af0 | |||
| 1664ed82d8 | |||
| 6ee370cfbe | |||
| 4488357171 | |||
| b99460f24f | |||
| 7d9a0ad0ed | |||
| 3c84558504 | |||
| f891cc995b | |||
| 46c40ab353 | |||
| a2656b7645 | |||
| ba94317016 | |||
| f8f797bc57 | |||
| 08bfa000a6 | |||
| 980c22d787 | |||
| e83a221388 | |||
| 209b9202b7 | |||
| 7640137f02 | |||
| 11c7894e6f | |||
| 70cf9e5790 | |||
| b549c9b8e4 | |||
| e51af68867 | |||
| 254643a5c7 | |||
| 84b1fb6a79 | |||
| 68d2993a78 | |||
| 8b4c3c074b | |||
| 086c91877e | |||
| 259767a305 | |||
| c4331e85c6 | |||
| a585170667 | |||
| ba244e8841 | |||
| 1dac16d2ce | |||
| 2a241d4e64 | |||
| 5b3f372056 | |||
| 1dd54b108d | |||
| 94511e23c0 | |||
| 8947e743a1 | |||
| da0a0d9555 | |||
| 273bac6e72 | |||
| e680150395 | |||
| df3f6b7ffb | |||
| d7051e1bde | |||
| b44c562e4e | |||
| 4018deb485 | |||
| c4e78295ff | |||
| d37b7dd8f4 | |||
| 8f4cb07057 | |||
| 4ba6342bc7 | |||
| 451d63d075 | |||
| ba23720d6f | |||
| b733ed7993 | |||
| ab8527103f | |||
| 2c76dc1011 | |||
| d38374d1c2 | |||
| fd9e4f96ce | |||
| b8f5208ef0 | |||
| 108d40c7dc | |||
| ccf619ce12 | |||
| b390df9313 | |||
| ce8f2e5282 | |||
| ba38665c4e | |||
| b6629f4e61 | |||
| 2220d60168 | |||
| 2165956209 | |||
| 32a15b987a | |||
| 406346f2a6 | |||
| 7317419c92 | |||
| 98f2a6dd5b | |||
| a000d5f80b | |||
| 94e3862219 | |||
| 19b413af7f | |||
| c418b962ba | |||
| 20140c5c8f | |||
| 13016f8817 | |||
| a3476dd281 | |||
| a270d82762 | |||
| 63c773dd53 | |||
| 1254f86a45 | |||
| d8442c35e2 | |||
| 29e60c243e | |||
| 70c5242f77 | |||
| 71062b78d9 | |||
| 5a10afcb2d | |||
| 056f824b02 | |||
| 0d46150fcc | |||
| 664a1e0f74 | |||
| 405ad47b44 | |||
| a4119f52a2 | |||
| 9a014e31c3 | |||
| 88d34addd0 | |||
| ede6f9a65a | |||
| 901e60d507 | |||
| d14d92acf0 | |||
| c7dcb9160c |
@@ -118,18 +118,22 @@ sub submit_request {
|
||||
unless ($certfile) { $certfile = $homedir."/.xcat/client-cred.pem"; }
|
||||
unless ($cafile) { $cafile = $homedir."/.xcat/ca.pem"; }
|
||||
$xCAT::Client::EXITCODE = 0; # clear out exit code before invoking the plugin
|
||||
$request->{clienttype}->[0] = "cli"; # setup clienttype for auditlog
|
||||
if (ref($request) eq 'HASH') { # the request is an array, not pure XML
|
||||
$request->{clienttype}->[0] = "cli"; # setup clienttype for auditlog
|
||||
}
|
||||
# If XCATBYPASS is set, invoke the plugin process_request method directly
|
||||
# without going through the socket connection to the xcatd daemon
|
||||
if ($ENV{XCATBYPASS}) {
|
||||
#add current userid to the request
|
||||
if (!(defined($request->{username}))) {
|
||||
$request->{username}->[0] = getpwuid($>);
|
||||
}
|
||||
# only allow root to run
|
||||
unless ($request->{username}->[0] =~ /root/) {
|
||||
print ("WARNING: Only allow root to run XCATBYPASS mode, your current user ID is $request->{username}->[0].\n");
|
||||
return 0;
|
||||
if (ref($request) eq 'HASH') { # the request is an array, not pure XML
|
||||
if (!(defined($request->{username}))) {
|
||||
$request->{username}->[0] = getpwuid($>);
|
||||
}
|
||||
# only allow root to run
|
||||
unless ($request->{username}->[0] =~ /root/) {
|
||||
print ("WARNING: Only allow root to run XCATBYPASS mode, your current user ID is $request->{username}->[0].\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
# Load plugins from either specified or default dir
|
||||
require xCAT::Table;
|
||||
@@ -211,7 +215,12 @@ $request->{clienttype}->[0] = "cli"; # setup clienttype for auditlog
|
||||
}
|
||||
}
|
||||
|
||||
my $msg=XMLout($request,RootName=>'xcatrequest',NoAttr=>1,KeyAttr=>[]);
|
||||
my $msg;
|
||||
if (ref($request) eq 'HASH') { # the request is an array, not pure XML
|
||||
$msg=XMLout($request,RootName=>'xcatrequest',NoAttr=>1,KeyAttr=>[]);
|
||||
} else { #XML
|
||||
$msg=$request;
|
||||
}
|
||||
if ($ENV{XCATXMLTRACE}) { print $msg; }
|
||||
if($ENV{XCATXMLWARNING}) {
|
||||
validateXML($msg);
|
||||
@@ -374,6 +383,12 @@ sub plugin_command {
|
||||
require xCAT::Table;
|
||||
|
||||
$Main::resps={};
|
||||
my $xmlreq;
|
||||
if (ref($req) ne 'HASH') { # the request XML, get an array
|
||||
$xmlreq=$req; # save the original XML
|
||||
$req = XMLin($xmlreq,SuppressEmpty=>undef,ForceArray=>1) ;
|
||||
|
||||
}
|
||||
my @nodes;
|
||||
if ($req->{node}) {
|
||||
@nodes = @{$req->{node}};
|
||||
@@ -964,6 +979,11 @@ sub build_response {
|
||||
##########################################
|
||||
sub handle_response {
|
||||
my $rsp = shift;
|
||||
if ($ENV{'XCATSHOWXML'}) {
|
||||
my $xmlrec=XMLout($rsp,RootName=>'xcatresponse',NoAttr=>1,KeyAttr=>[]);
|
||||
print "$xmlrec\n";
|
||||
return;
|
||||
}
|
||||
#print "in handle_response\n";
|
||||
# Handle errors
|
||||
if ($rsp->{errorcode}) {
|
||||
|
||||
@@ -44,7 +44,11 @@ sub dpush {
|
||||
# Parse the command line for options and operands
|
||||
##########################################################################
|
||||
sub parse_args {
|
||||
xCAT::PPCrflash::parse_args(@_);
|
||||
my $req = shift;
|
||||
$req->{mgt} = __PACKAGE__;
|
||||
my $opt = xCAT::PPCrflash::parse_args($req);
|
||||
delete($req->{mgt});
|
||||
return $opt;
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
|
||||
@@ -69,21 +69,42 @@ sub enumerate_lcds {
|
||||
my $power_status_prefix = "Current Power Status:";
|
||||
my $Rc;
|
||||
my @refcode;
|
||||
my $c;
|
||||
my $c = 0;
|
||||
|
||||
my $values = xCAT::FSPUtils::fsp_api_action ($request, $name, $d, $action);
|
||||
$Rc = @$values[2];
|
||||
my $data = @$values[1];
|
||||
my $t_n = @$values[0];
|
||||
if( $Rc != 0 ) {
|
||||
my @names = split(/,/, $name);
|
||||
my @t_data = split(/\n\n/, $data);
|
||||
my @names = split(/,/, $t_n);
|
||||
my @t_data = split(/\n/, $data);
|
||||
foreach my $n (@names) {
|
||||
if( $data =~ /$n/ ) {
|
||||
chomp $t_data[$c];
|
||||
push @refcode,[$n, "$prefix $t_data[$c]", $Rc];
|
||||
if( $only_lcds == 0) {
|
||||
push @refcode,[$n, "$power_status_prefix $t_data[$c]", $Rc];
|
||||
}
|
||||
#push @refcode,[$n, "$prefix $t_data[$c]", $Rc];
|
||||
if($t_data[$c] =~ /Error/ ) {
|
||||
if( $only_lcds == 0) {
|
||||
push @refcode,[$n, "$power_status_prefix $t_data[$c]", $Rc];
|
||||
}
|
||||
push @refcode,[$n, "$prefix $t_data[$c]", $Rc];
|
||||
} else {
|
||||
if( $only_lcds == 0) {
|
||||
|
||||
# get power status
|
||||
if( $data =~ /1\|/) {
|
||||
push @refcode, [$n, "$power_status_prefix on", $Rc] ;
|
||||
} else {
|
||||
push @refcode, [$n, "$power_status_prefix off", $Rc];
|
||||
}
|
||||
}
|
||||
|
||||
# get lcd value
|
||||
if( $t_data[$c] =~ /1\|(\w[\w\s]*)/) {
|
||||
push @refcode, [$n, "$prefix $1", $Rc] ;
|
||||
} else {
|
||||
push @refcode, [$n, "$prefix blank", $Rc];
|
||||
}
|
||||
}
|
||||
$c++;
|
||||
} else {
|
||||
push @refcode, [$n, "$prefix $data", $Rc];
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
#!/usr/bin/perl
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
package xCAT::MacMap;
|
||||
|
||||
BEGIN
|
||||
{
|
||||
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
|
||||
}
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
|
||||
require Exporter;
|
||||
our @ISA=qw/Exporter/;
|
||||
our @EXPORT_OK=qw/walkoid/;
|
||||
@@ -174,11 +181,19 @@ sub rvlan {
|
||||
#first order of business is to identify the target switches
|
||||
my $switchtab=xCAT::Table->new('switch',-create=>0);
|
||||
unless ($switchtab) { return; }
|
||||
my $switchents = $switchtab->getNodesAttribs($nodes,[qw/switch port/]);
|
||||
my $switchents = $switchtab->getNodesAttribs($nodes,[qw/switch port interface/]);
|
||||
my $node;
|
||||
foreach $node (keys %$switchents) {
|
||||
my $entry;
|
||||
foreach $entry (@{$switchents->{$node}}) {
|
||||
#skip the none primary interface.
|
||||
# The vlaue of the primary interface could be empty, primary or primary:ethx
|
||||
if (defined($entry->{interface})) {
|
||||
if ($entry->{interface} !~ /primary/) {
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
$self->{switches}->{$entry->{switch}}->{$entry->{port}} = $node;
|
||||
}
|
||||
}
|
||||
@@ -318,6 +333,7 @@ sub refresh_table {
|
||||
$self->{switches} = {};
|
||||
foreach my $entry (@entries) {
|
||||
if (defined($entry->{switch}) and $entry->{switch} ne "" and defined($entry->{port}) and $entry->{port} ne "") {
|
||||
|
||||
if ( !$self->{switches}->{$entry->{switch}}->{$entry->{port}})
|
||||
{
|
||||
$self->{switches}->{$entry->{switch}}->{$entry->{port}} = $entry->{node};
|
||||
|
||||
@@ -157,10 +157,15 @@ sub parse_args {
|
||||
#--activate's value only can be concurrent and disruptive
|
||||
################################
|
||||
if(exists($opt{activate})) {
|
||||
if( ($opt{activate} ne "deferred") && ($opt{activate} ne "disruptive")) {
|
||||
return (usage("--activate's value can only be deferred or disruptive"));
|
||||
}
|
||||
|
||||
if (defined($request->{mgt}) && ($request->{mgt} =~ /xCAT::FSP/i)) {
|
||||
if (($opt{activate} ne "deferred") && ($opt{activate} ne "disruptive")) {
|
||||
return (usage("--activate's value can only be deferred or disruptive"));
|
||||
}
|
||||
} else {
|
||||
if( ($opt{activate} ne "concurrent") && ($opt{activate} ne "disruptive")) {
|
||||
return (usage("--activate's value can only be disruptive or concurrent"));
|
||||
}
|
||||
}
|
||||
if(!exists( $opt{d} )) {
|
||||
$opt{d} = "/tmp";
|
||||
}
|
||||
@@ -538,8 +543,8 @@ sub get_lic_filenames {
|
||||
# }
|
||||
} else {
|
||||
$msg = $msg . "Upgrade $mtms!";
|
||||
if($activate !~ /^(disruptive|deferred)$/) {
|
||||
$msg = "Option --activate's value shouldn't be $activate, and it must be disruptive or deferred";
|
||||
if($activate !~ /^(disruptive|concurrent)$/) {
|
||||
$msg = "Option --activate's value shouldn't be $activate, and it must be disruptive or concurrent";
|
||||
return ("", "","", $msg, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,8 +152,6 @@ sub remote_copy_command
|
||||
my @src_file =
|
||||
@{$$config{'destDir_srcFile'}{$dest_dir}{'same_dest_name'}};
|
||||
|
||||
#Remove a file from the list if it does not exist
|
||||
#@src_file = map { $_ if -e $_; } @src_file;
|
||||
my $src_file_list = join ' ', @src_file;
|
||||
if ($src_file_list)
|
||||
{
|
||||
@@ -164,7 +162,6 @@ sub remote_copy_command
|
||||
%{$$config{'destDir_srcFile'}{$dest_dir}{'diff_dest_name'}};
|
||||
foreach my $src_file_diff_dest (keys %diff_dest_hash)
|
||||
{
|
||||
next if !-e $src_file_diff_dest;
|
||||
my $diff_basename = $diff_dest_hash{$src_file_diff_dest};
|
||||
print RSCYCCMDFILE
|
||||
"$exec_path $sync_opt $src_file_diff_dest $dest_user_host:$dest_dir/$diff_basename\n";
|
||||
|
||||
@@ -186,11 +186,12 @@ vmmaster => {
|
||||
}
|
||||
},
|
||||
vm => {
|
||||
cols => [qw(node host migrationdest storage storagemodel cfgstore memory cpus nics nicmodel bootorder clockoffset virtflags master vncport textconsole powerstate beacon datacenter guestostype othersettings vidmodel vidproto vidpassword comments disable)],
|
||||
cols => [qw(node mgr host migrationdest storage storagemodel cfgstore memory cpus nics nicmodel bootorder clockoffset virtflags master vncport textconsole powerstate beacon datacenter cluster guestostype othersettings vidmodel vidproto vidpassword comments disable)],
|
||||
keys => [qw(node)],
|
||||
table_desc => 'Virtualization parameters',
|
||||
descriptions => {
|
||||
'node' => 'The node or static group name',
|
||||
'mgr' => 'The function manager for the virtual machine',
|
||||
'host' => 'The system that currently hosts the VM',
|
||||
'migrationdest' => 'A noderange representing candidate destinations for migration (i.e. similar systems, same SAN, or other criteria that xCAT can use',
|
||||
'storage' => 'A list of storage files or devices to be used. i.e. /cluster/vm/<nodename> or nfs://<server>/path/to/folder/',
|
||||
@@ -210,7 +211,8 @@ vm => {
|
||||
qcow2 is a sparse, copy-on-write capable format implemented at the virtualization layer rather than the filesystem level
|
||||
clonemethod=[qemu-img|reflink]
|
||||
qemu-img allows use of qcow2 to generate virtualization layer copy-on-write
|
||||
reflink uses a generic filesystem facility to clone the files on your behalf, but requires filesystem support such as btrfs ',
|
||||
reflink uses a generic filesystem facility to clone the files on your behalf, but requires filesystem support such as btrfs
|
||||
placement_affinity=[migratable|user_migratable|pinned]',
|
||||
'vncport' => 'Tracks the current VNC display port (currently not meant to be set',
|
||||
'textconsole' => 'Tracks the Psuedo-TTY that maps to the serial port or console of a VM',
|
||||
'powerstate' => "This flag is used by xCAT to track the last known power state of the VM.",
|
||||
@@ -218,19 +220,21 @@ vm => {
|
||||
'guestostype' => "This allows administrator to specify an identifier for OS to pass through to virtualization stack. Normally this should be ignored as xCAT will translate from nodetype.os rather than requiring this field be used\n",
|
||||
'beacon' => "This flag is used by xCAT to track the state of the identify LED with respect to the VM.",
|
||||
'datacenter' => "Optionally specify a datacenter for the VM to exist in (only applicable to VMWare)",
|
||||
'cluster' => 'Specify to the underlying virtualization infrastructure a cluster membership for the hypervisor.',
|
||||
'vidproto' => "Request a specific protocol for remote video access be set up. For example, spice in KVM.",
|
||||
'vidmodel' => "Model of video adapter to provide to guest. For example, qxl in KVM",
|
||||
'vidpassword' => "Password to use instead of temporary random tokens for VNC and SPICE access",
|
||||
}
|
||||
},
|
||||
hypervisor => {
|
||||
cols => [qw(node type mgr netmap defaultnet cluster datacenter preferdirect comments disable)],
|
||||
cols => [qw(node type mgr interface netmap defaultnet cluster datacenter preferdirect comments disable)],
|
||||
keys => [qw(node)],
|
||||
table_desc => 'Hypervisor parameters',
|
||||
descriptions => {
|
||||
'node' => 'The node or static group name',
|
||||
'type' => 'The plugin associated with hypervisor specific commands such as revacuate',
|
||||
mgr => 'The virtualization specific manager of this hypervisor when applicable',
|
||||
'mgr' => 'The virtualization specific manager of this hypervisor when applicable',
|
||||
'interface' => 'The defition of interfaces for the hypervisor. The format is [networkname:interfacename:bootprotocol:IP:netmask:gateway] that split with | for each interface',
|
||||
'netmap' => 'Optional mapping of useful names to relevant physical ports. For example, 10ge=vmnic_16.0&vmnic_16.1,ge=vmnic1 would be requesting two virtual switches to be created, one called 10ge with vmnic_16.0 and vmnic_16.1 bonded, and another simply connected to vmnic1. Use of this allows abstracting guests from network differences amongst hypervisors',
|
||||
'defaultnet' => 'Optionally specify a default network entity for guests to join to if they do not specify.',
|
||||
'cluster' => 'Specify to the underlying virtualization infrastructure a cluster membership for the hypervisor.',
|
||||
@@ -238,6 +242,20 @@ hypervisor => {
|
||||
'preferdirect' => 'If a mgr is declared for a hypervisor, xCAT will default to using the mgr for all operations. If this is field is set to yes or 1, xCAT will prefer to directly communicate with the hypervisor if possible'
|
||||
}
|
||||
},
|
||||
virtsd => {
|
||||
cols => [qw(node sdtype stype location host cluster datacenter comments disable)],
|
||||
keys => [qw(node)],
|
||||
table_desc => 'The parameters which used to create the Storage Domain',
|
||||
descriptions => {
|
||||
'node' => 'The name of the storage domain',
|
||||
'sdtype' => 'The type of storage domain. Valid values: data, iso, export',
|
||||
'stype' => 'The type of storge. Valid values: nfs, fcp, iscsi, localfs',
|
||||
'location' => 'The path of the storage',
|
||||
'host' => 'For rhev, a hypervisor host needs to be specified to manage the storage domain as SPM (Storage Pool Manager). But the SPM role will be failed over to another host when this host down.',
|
||||
'cluster' => 'A cluster of hosts',
|
||||
'datacenter' => 'A collection for all host, vm that will shared the same storages, networks.',
|
||||
}
|
||||
},
|
||||
websrv => {
|
||||
cols => [qw(node port username password comments disable)],
|
||||
keys => [qw(node)],
|
||||
@@ -916,6 +934,8 @@ site => {
|
||||
" mgmt node.\n\n".
|
||||
" timezone: (e.g. America/New_York)\n\n".
|
||||
" tftpdir: tftp directory path. Default is /tftpboot\n\n".
|
||||
" tftpflags: The flags that used to start tftpd. Default is \'-v -l -s /tftpboot \n".
|
||||
" -m /etc/tftpmapfile4xcat.conf\' if tftplfags is not set\n\n".
|
||||
" useNmapfromMN: When set to yes, nodestat command should obtain the node status\n".
|
||||
" using nmap (if available) from the management node instead of the\n".
|
||||
" service node. This will improve the performance in a flat network.\n\n".
|
||||
@@ -952,8 +972,8 @@ switch => {
|
||||
node => 'The node name or group name.',
|
||||
switch => 'The switch hostname.',
|
||||
port => 'The port number in the switch that this node is connected to. On a simple 1U switch, an administrator can generally enter the number as printed next to the ports, and xCAT will understand switch representation differences. On stacked switches or switches with line cards, administrators should usually use the CLI representation (i.e. 2/0/1 or 5/8). One notable exception is stacked SMC 8848M switches, in which you must add 56 for the proceeding switch, then the port number. For example, port 3 on the second switch in an SMC8848M stack would be 59',
|
||||
vlan => 'xCAT currently does not make use of this field, however it may do so in the future. For now, it can be used by administrators for their own purposes, but keep in mind some xCAT feature later may try to enforce this if set',
|
||||
interface => 'The interface name from the node perspective. This is not currently used by xCAT, but administrators may wish to use this for their own purposes',
|
||||
vlan => 'The ID for the tagged vlan that is created on this port using mkvlan and chvlan commands.',
|
||||
interface => 'The interface name from the node perspective. For example, eth0. For the primary nic, it can be empty, the word "primary" or "primary:ethx" where ethx is the interface name.',
|
||||
comments => 'Any user-written notes.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
},
|
||||
@@ -1750,6 +1770,12 @@ my @nodeattrs = (
|
||||
tabentry => 'mp.id',
|
||||
access_tabentry => 'mp.node=attr:node',
|
||||
},
|
||||
{attr_name => 'id',
|
||||
only_if => 'mgt=ipmi',
|
||||
tabentry => 'mp.id',
|
||||
access_tabentry => 'mp.node=attr:node',
|
||||
},
|
||||
|
||||
#################
|
||||
# mpa table #
|
||||
#################
|
||||
@@ -1790,6 +1816,10 @@ my @nodeattrs = (
|
||||
######################
|
||||
# vm table #
|
||||
######################
|
||||
{attr_name => 'vmmanager',
|
||||
tabentry => 'vm.mgr',
|
||||
access_tabentry => 'vm.node=attr:node',
|
||||
},
|
||||
{attr_name => 'vmhost',
|
||||
tabentry => 'vm.host',
|
||||
access_tabentry => 'vm.node=attr:node',
|
||||
@@ -1834,6 +1864,10 @@ my @nodeattrs = (
|
||||
tabentry => 'vm.virtflags',
|
||||
access_tabentry => 'vm.node=attr:node',
|
||||
},
|
||||
{attr_name => 'vmmaster',
|
||||
tabentry => 'vm.master',
|
||||
access_tabentry => 'vm.node=attr:node',
|
||||
},
|
||||
{attr_name => 'vmvncport',
|
||||
tabentry => 'vm.vncport',
|
||||
access_tabentry => 'vm.node=attr:node',
|
||||
@@ -1846,6 +1880,29 @@ my @nodeattrs = (
|
||||
tabentry => 'vm.beacon',
|
||||
access_tabentry => 'vm.node=attr:node',
|
||||
},
|
||||
{attr_name => 'vmcluster',
|
||||
tabentry => 'vm.cluster',
|
||||
access_tabentry => 'vm.node=attr:node',
|
||||
},
|
||||
######################
|
||||
# hypervisor table #
|
||||
######################
|
||||
{attr_name => 'hosttype',
|
||||
tabentry => 'hypervisor.type',
|
||||
access_tabentry => 'hypervisor.node=attr:node',
|
||||
},
|
||||
{attr_name => 'hostinterface',
|
||||
tabentry => 'hypervisor.interface',
|
||||
access_tabentry => 'hypervisor.node=attr:node',
|
||||
},
|
||||
{attr_name => 'hostmanager',
|
||||
tabentry => 'hypervisor.mgr',
|
||||
access_tabentry => 'hypervisor.node=attr:node',
|
||||
},
|
||||
{attr_name => 'hostcluster',
|
||||
tabentry => 'hypervisor.cluster',
|
||||
access_tabentry => 'hypervisor.node=attr:node',
|
||||
},
|
||||
######################
|
||||
# websrv table #
|
||||
######################
|
||||
@@ -2101,6 +2158,11 @@ push(@{$defspec{node}->{'attrs'}}, @nodeattrs);
|
||||
tabentry => 'linuximage.crashkernelsize',
|
||||
access_tabentry => 'linuximage.imagename=attr:imagename',
|
||||
},
|
||||
{attr_name => 'usercomment',
|
||||
only_if => 'imagetype=linux',
|
||||
tabentry => 'linuximage.comments',
|
||||
access_tabentry => 'linuximage.imagename=attr:imagename',
|
||||
},
|
||||
####################
|
||||
# nimimage table#
|
||||
####################
|
||||
|
||||
@@ -2108,6 +2108,8 @@ sub _refresh_cache { #if cache exists, force a rebuild, leaving reference counts
|
||||
# (uses stale nodelist data and misses new nodes, the error)
|
||||
#1st noderange finishes
|
||||
#2nd noderange finishes
|
||||
} else { #even if a cache is not in use *right this second*, we need to mark any cached data that may exist as invalid, do so by suggesting the cache is from 1970
|
||||
if ($self->{_cachestamp}) { $self->{_cachestamp}=0; }
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
+31
-1
@@ -390,6 +390,31 @@ Options:
|
||||
"Usage:
|
||||
rmflexnode [-h|--help|-v|--version]
|
||||
rmflexnode <noderange>",
|
||||
"lsve" =>
|
||||
"Usage:
|
||||
lsve [-t type] [-m manager] [-o object]
|
||||
-t: dc - 'Data Center', cl - 'Cluster', sd - 'Storage Domain', nw - 'Network', tpl -'Template'
|
||||
-m: FQDN (Fully Qualified Domain Name) of the rhev manager
|
||||
-o: Target object to display",
|
||||
"cfgve" =>
|
||||
"Usage:
|
||||
cfgve -t dc -m manager -o object [-c -k nfs|localfs | -r]
|
||||
cfgve -t cl -m manager -o object [-c -p cpu type | -r -f]
|
||||
cfgve -t sd -m manager -o object [-c | -g | -s | -a | -b | -r -f]
|
||||
-t: sd - 'Storage Domain', nw - 'Network', tpl -'Template'
|
||||
-m: FQDN (Fully Qualified Domain Name) of the rhev manager
|
||||
-o: Target object to configure
|
||||
cfgve -t nw -m manager -o object [-c -d data center -n vlan ID | -a -l cluster| -b | -r]
|
||||
cfgve -t tpl -m manager -o object [-r]",
|
||||
"chhypervisor" =>
|
||||
"Usage:
|
||||
chhypervisor noderange [-a | -n | -p | -e | -d | -h]",
|
||||
"rmhypervisor" =>
|
||||
"Usage:
|
||||
rmhypervisor noderange [-f | -h]",
|
||||
"clonevm" =>
|
||||
"Usage:
|
||||
clonevm noderange [-t createmaster -f | -b basemaster -d | -h]",
|
||||
);
|
||||
my $vers = xCAT::Utils->Version();
|
||||
my %version = (
|
||||
@@ -414,7 +439,12 @@ my %version = (
|
||||
"lsflexnode" => "$vers",
|
||||
"mkflexnode" => "$vers",
|
||||
"rmflexnode" => "$vers",
|
||||
"nodeset" => "$vers"
|
||||
"nodeset" => "$vers",
|
||||
"lsve" => "$vers",
|
||||
"cfgve" => "$vers",
|
||||
"chhypervisor" => "$vers",
|
||||
"rmhypervisor" => "$vers",
|
||||
"clonevm" => "$vers",
|
||||
);
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
@@ -22,24 +22,17 @@ I:xlsmp.rte
|
||||
# AIX bundle package list for PE
|
||||
|
||||
# POE
|
||||
I:ppe.poe
|
||||
I:ppe.pdb
|
||||
I:ppe.rte
|
||||
#I:ppe.man
|
||||
I:ppe.loc.license
|
||||
|
||||
# needed on login node
|
||||
#I:ppe.hpct
|
||||
#I:ppedev.hpct
|
||||
|
||||
# LAPI
|
||||
I:rsct.lapi
|
||||
#I:rsct.sci
|
||||
|
||||
# MetaCluster (checkpoint/restore)
|
||||
I:mcr.rte
|
||||
I:mdcr
|
||||
|
||||
|
||||
|
||||
# AIX bundle file for ESSL and PESSL packages
|
||||
|
||||
# ESSL
|
||||
@@ -53,11 +46,7 @@ I:essl.loc.license
|
||||
|
||||
# PESSL
|
||||
I:pessl.rte.up
|
||||
I:pessl.rte.smp
|
||||
I:pessl.rte.rs1
|
||||
I:pessl.rte.mp
|
||||
I:pessl.rte.hv
|
||||
I:pessl.rte.common
|
||||
I:pessl.rte
|
||||
I:pessl.msg.en_US
|
||||
#I:pessl.msg.En_US
|
||||
|
||||
Executable → Regular
+48
-17
@@ -1,4 +1,9 @@
|
||||
#!/bin/ksh
|
||||
#!/usr/bin/ksh
|
||||
|
||||
#
|
||||
# example postscript intended to reduce OS jitter
|
||||
#
|
||||
|
||||
trap "chmod 774 /etc/rc.tcpip" INT QUIT TERM EXIT
|
||||
|
||||
#NB: WANT TO ADD THIS BACK IN AT SOME POINT - SYSTEM HANG DETECTION DEAMON
|
||||
@@ -26,7 +31,6 @@ rmitab piobe > /dev/null 2>&1
|
||||
#qdaemon:23456789:wait:/usr/bin/startsrc -sqdaemon
|
||||
rmitab qdaemon > /dev/null 2>&1
|
||||
|
||||
#do we really need wpar support now?
|
||||
rcwpars:2:once:/etc/rc.wpars > /dev/console 2>&1 # Corrals autostart
|
||||
rmitab rcwpars > /dev/null 2>&1
|
||||
|
||||
@@ -85,15 +89,19 @@ rmitab ctrmc > /dev/null 2>&1
|
||||
#dscrset:2:once:/usr/sbin/dscrctl -n -s 30 >/dev/null 2>/dev/console
|
||||
|
||||
#to disable sendmail daemon, need to comment the line in /etc/rc.tcpip that begins: start /usr/lib/sendmail
|
||||
#As of 11/16/10 John L. re-enable sendmail as some subsystems want to use this for PERCS
|
||||
#Unless someone says we need it, it's back off - 4/18/11 John L.
|
||||
grep -q "^start /usr/lib/sendmail" /etc/rc.tcpip
|
||||
if [[ $? -eq 0 ]] then
|
||||
cat /etc/rc.tcpip | sed 's/^start \/usr\/lib\/sendmail/#start \/usr\/lib\/sendmail/' > /tmp/rc.tcpip.tmpfile.$$
|
||||
cp -p /etc/rc.tcpip /etc/rc.tcpip.prev
|
||||
mv /tmp/rc.tcpip.tmpfile.$$ /etc/rc.tcpip
|
||||
# Leave enabled on login nodes
|
||||
host `hostname` | grep -qE "l[0-9]+"
|
||||
if [[ $? -ne 0 ]]
|
||||
then
|
||||
|
||||
grep -q "^start /usr/lib/sendmail" /etc/rc.tcpip
|
||||
if [[ $? -eq 0 ]] then
|
||||
cat /etc/rc.tcpip | sed 's/^start \/usr\/lib\/sendmail/#start \/usr\/lib\/sendmail/' > /tmp/rc.tcpip.tmpfile.$$
|
||||
cp -p /etc/rc.tcpip /etc/rc.tcpip.prev
|
||||
mv /tmp/rc.tcpip.tmpfile.$$ /etc/rc.tcpip
|
||||
fi
|
||||
stopsrc -s sendmail > /dev/null 2>&1
|
||||
fi
|
||||
stopsrc -s sendmail > /dev/null 2>&1
|
||||
|
||||
|
||||
#to disable aixmibd daemon, need to comment the line in /etc/rc.tcpip that begins: start /usr/sbin/aixmibd
|
||||
@@ -123,20 +131,42 @@ if [[ $? -eq 0 ]] then
|
||||
fi
|
||||
stopsrc -s snmpmibd > /dev/null 2>&1
|
||||
|
||||
#disable the prngd daemon (the random daemon is more efficient)
|
||||
stopsrc -s prngd
|
||||
|
||||
chmod 774 /etc/rc.tcpip
|
||||
|
||||
#try to clean up some cron junk - we only touch the crontab file once (and save a backup)
|
||||
if [[ ! -f /var/spool/cron/crontabs/root.before.clean_jitter ]] then
|
||||
cp -p /var/spool/cron/crontabs/root /var/spool/cron/crontabs/root.before.clean_jitter
|
||||
|
||||
grep -v "bin\/pmcfg" /var/spool/cron/crontabs/root | grep -v "bin\/stcron" | grep -v "bin\/dumpctr" | \
|
||||
grep -v "ras\/dumpcheck" > /var/spool/cron/crontabs/root.after.clean_jitter
|
||||
|
||||
egrep -v "bin\/pmcfg|bin\/stcron|bin\/dumpctr|ras\/dumpcheck|bin\/errclear" /var/spool/cron/crontabs/root > /var/spool/cron/crontabs/root.after.clean_jitter
|
||||
|
||||
cp /var/spool/cron/crontabs/root.after.clean_jitter /var/spool/cron/crontabs/root
|
||||
fi
|
||||
|
||||
for i in $(ps -efk | grep "topasrec" | grep -v killproc | grep -v grep | awk ' {print $2} ') ; do
|
||||
kill $i
|
||||
done
|
||||
#for i in $(ps -efk | egrep "\/usr\/sbin\/cron|topasrec" | grep -v grep | awk ' { print $2} ') ; do
|
||||
# kill $i
|
||||
#done
|
||||
#
|
||||
#nohup /usr/sbin/cron > /dev/null 2>&1 &
|
||||
|
||||
CRON="/usr/sbin/cron"
|
||||
|
||||
# Find PID for cron process - check for exact pattern match on process name and it's parent PID is 1
|
||||
CRON_PID=$(ps -ef | grep ${CRON} | grep -v grep | awk '{ if ($NF = "${CRON}" && $3 == "1") { print $2 }}')
|
||||
|
||||
if [ -n "${CRON_PID}" ]
|
||||
then
|
||||
echo "Killing ${CRON} (${CRON_PID}) to re-read config file(s)"
|
||||
kill ${CRON_PID}
|
||||
fi
|
||||
|
||||
# Allow time to respawn from inittab
|
||||
sleep 1
|
||||
|
||||
# Print new cron PID
|
||||
CRON_PID=$(ps -ef | grep ${CRON} | grep -v grep | awk '{ if ($NF = "${CRON}" && $3 == "1") { print $2 }}')
|
||||
echo "New cron PID is ${CRON_PID}"
|
||||
|
||||
ls -l /etc/rc.tcpip
|
||||
telinit q
|
||||
@@ -150,6 +180,7 @@ if [[ $? -ne 0 ]] then
|
||||
echo '* cosched1 18 100 97 10' >> /etc/poe.priority
|
||||
echo '* cosched2 13 100 99.5 10' >> /etc/poe.priority
|
||||
echo '* cosched3 13 100 99 3' >> /etc/poe.priority
|
||||
echo '* cosched4 18 100 97 1' >> /etc/poe.priority
|
||||
chmod 644 /etc/poe.priority
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/bin/ksh
|
||||
|
||||
# Cleanly reboots an AIX node
|
||||
|
||||
echo "Shutting and rebooting node NOW !!!"
|
||||
echo "shutdown -Fr" | at now
|
||||
|
||||
exit 0
|
||||
@@ -11,14 +11,18 @@ I:essl.loc.license
|
||||
|
||||
# PESSL
|
||||
I:pessl.rte.up
|
||||
I:pessl.rte.smp
|
||||
I:pessl.rte.rs1
|
||||
I:pessl.rte.mp
|
||||
# If you are using PESSL 4.1.0 or beyond, comment pessl.rte.hv out, it's not needed.
|
||||
I:pessl.rte.hv
|
||||
I:pessl.rte.common
|
||||
I:pessl.rte
|
||||
I:pessl.msg.en_US
|
||||
|
||||
# If you are using PESSL 4.1.0 or beyond, comment pessl.rte.hv out, it's not needed.
|
||||
#I:pessl.rte.hv
|
||||
|
||||
# If you are using PESSL 4.2.0 or beyond, comment pessl.rte.smp,pessl.rte.rs1,and pessl.rte.common, they have been built into pessl.rte.up and pessl.rte.mp
|
||||
#I:pessl.rte.common
|
||||
#I:pessl.rte.smp
|
||||
#I:pessl.rte.rs1
|
||||
|
||||
#I:pessl.msg.En_US
|
||||
#I:pessl.man.en_US
|
||||
I:pessl.loc.license
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/ksh
|
||||
|
||||
#
|
||||
# example postscript to tune ml interface for improved stability and performance
|
||||
#
|
||||
|
||||
chdev -l mlt0 -a agg_killtime=-1 2>/dev/null # allow "agg_interval" and "agg_threshold" to default
|
||||
|
||||
# The effect of the above is that complete ml route entries last forever, incomplete entries time out
|
||||
# in 40 seconds, and there are no keepalive probes for complete entries (to reduce OS jitter).
|
||||
|
||||
# The following is also recommended to improve balance across hf interfaces (assuming sequential ml
|
||||
# addressing, at least within each drawer). Note that "agg_hash" must be set PRIOR to the ml interface
|
||||
# being configured.
|
||||
|
||||
chdev -l mlt0 -a agg_hash=2 2>/dev/null
|
||||
|
||||
@@ -1,20 +1,13 @@
|
||||
# AIX bundle package list for PE
|
||||
|
||||
# POE
|
||||
I:ppe.poe
|
||||
I:ppe.pdb
|
||||
I:ppe.rte
|
||||
#I:ppe.man
|
||||
I:ppe.loc.license
|
||||
|
||||
# needed on login node
|
||||
#I:ppe.hpct
|
||||
#I:ppedev.hpct
|
||||
|
||||
# LAPI
|
||||
I:rsct.lapi
|
||||
#I:rsct.sci
|
||||
|
||||
# MetaCluster (checkpoint/restore)
|
||||
I:mcr.rte
|
||||
I:mdcr
|
||||
|
||||
|
||||
|
||||
@@ -12,6 +12,25 @@
|
||||
|
||||
OS=`uname`
|
||||
|
||||
# On AIX, need to correctly configure LAPI kernel extensions on a
|
||||
# diskless node boot
|
||||
# (added for PE 1.2 and newer releases)
|
||||
if [ "$OS" == "AIX" ]; then
|
||||
if [ "$NODESETSTATE" = "netboot" -o \
|
||||
"$NODESETSTATE" = "statelite" -o \
|
||||
"$NODESETSTATE" = "diskless" -o \
|
||||
"$NODESETSTATE" = "dataless" ]; then
|
||||
# Unconfigure any existing LAPI kernel extension
|
||||
if [ -x /etc/methods/ucfgzcmem ] ; then
|
||||
/etc/methods/ucfgzcmem
|
||||
fi
|
||||
# Configure the LAPI kernel extension at the latest level
|
||||
if [ -x /etc/methods/cfgzcmem ] ; then
|
||||
/etc/methods/cfgzcmem
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Configure the PNSD.cfg to use a smaller log so it doesn't use so much memory
|
||||
# for a stateless image. Normally, pnsd creates this file if it does not
|
||||
# exist, but it will not fill it in if it does exist.
|
||||
|
||||
@@ -45,6 +45,10 @@ mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/IBMhpc/rsct
|
||||
|
||||
%ifos linux
|
||||
cp -a share/xcat/IBMhpc/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/IBMhpc/
|
||||
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/IBMhpc/ping-all/
|
||||
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/IBMhpc/ml-tuning
|
||||
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/IBMhpc/aix-clean-jitter
|
||||
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/IBMhpc/aix-reboot
|
||||
chmod -R 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/IBMhpc/*
|
||||
%else
|
||||
cp -hpR share/xcat/IBMhpc/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/IBMhpc/
|
||||
|
||||
@@ -365,7 +365,6 @@ legend {
|
||||
|
||||
/*--- jQuery datatable ---*/
|
||||
.dataTables_wrapper {
|
||||
overflow: auto;
|
||||
width: auto;
|
||||
margin: 10px auto;
|
||||
-moz-border-radius: 3px;
|
||||
|
||||
+213
-144
@@ -1,3 +1,4 @@
|
||||
var iframeTimer;
|
||||
/**
|
||||
* Execute when the DOM is fully loaded
|
||||
*/
|
||||
@@ -21,19 +22,19 @@ var hmcPlugin = function() {
|
||||
*/
|
||||
hmcPlugin.prototype.getStep = function() {
|
||||
return [ 'Basic patterns', 'Supernode', 'More patterns',
|
||||
'Power on hardware', 'Discover frames', 'Management node',
|
||||
'Power on hardware', 'Discover frames', 'Discover hmcs', 'Management node',
|
||||
'Discover Rest of Hardware and Update Definitions', 'Create LPARs' ];
|
||||
};
|
||||
|
||||
hmcPlugin.prototype.getInitFunction = function() {
|
||||
return [ powerInitBasicPattern, powerInitSupernode, powerInitSiteTable,
|
||||
powerInitPoweronHardware, powerInitDiscoverFrames, powerInitConfig,
|
||||
powerInitPoweronHardware, powerInitDiscoverFrames, powerInitDiscoverHmc, powerInitConfig,
|
||||
powerInitUpdateDefinition, powerInitCreateLpar ];
|
||||
};
|
||||
|
||||
hmcPlugin.prototype.getNextFunction = function() {
|
||||
return [ checkBasicPattern, checkSupernode, checkSiteTable, undefined,
|
||||
checkFrameMtms, undefined, undefined, collectInputValue ];
|
||||
checkFrameMtms, checkHmcMtms, undefined, undefined, collectInputValue ];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -942,13 +943,31 @@ function showSiteArea() {
|
||||
url : 'lib/systemcmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'ifconfig | grep -E "encap|Mask"'
|
||||
cmd : 'ifconfig | egrep "encap|Mask"'
|
||||
},
|
||||
|
||||
success : function(data) {
|
||||
$('#discoverContentDiv #siteTableStat div').html(
|
||||
'Current network interface configuration:<br/><pre>'
|
||||
+ data.rsp + '</pre>');
|
||||
var ipvlan1 = 'addr:' + getDiscoverEnv('vlan1ip') + '\.[0-9]+\.[0-9]+\.[0-9]+';
|
||||
var ipvlan2 = 'addr:' + getDiscoverEnv('vlan2ip') + '\.[0-9]+\.[0-9]+\.[0-9]+';
|
||||
var lines = data.rsp.split('\n');
|
||||
var iparray = new Array();
|
||||
var re1 = new RegExp(ipvlan1,"i");
|
||||
var re2 = new RegExp(ipvlan2,"i");
|
||||
for (var i in lines){
|
||||
var line = lines[i];
|
||||
if (line.match(ipvlan1)){
|
||||
var temp = re1.exec(line);
|
||||
iparray.push(temp[0].substr(5));
|
||||
}
|
||||
if (line.match(ipvlan2)){
|
||||
var temp = re2.exec(line);
|
||||
iparray.push(temp[0].substr(5));
|
||||
}
|
||||
}
|
||||
setDiscoverEnv('ipfordiscovery', iparray.join(','));
|
||||
}
|
||||
});
|
||||
createDiscoverButtons();
|
||||
@@ -1035,8 +1054,7 @@ function powerInitPoweronHardware() {
|
||||
function powerInitDiscoverFrames() {
|
||||
$('#discoverContentDiv').empty();
|
||||
$('.tooltip').remove();
|
||||
var showDiv = $('<div style="min-height:360px" id="discoverShow"><h2>'
|
||||
+ steps[currentStep] + '</h2>');
|
||||
var showDiv = '<h2>' + steps[currentStep] + '</h2></div><div style="min-height:360px" id="discoverShow">';
|
||||
$('#discoverContentDiv').append(showDiv);
|
||||
|
||||
//the discover button, use lsslp
|
||||
@@ -1044,7 +1062,7 @@ function powerInitDiscoverFrames() {
|
||||
discoverButton.bind('click', function(){
|
||||
$('#discoverShow').empty();
|
||||
$('#discoverContentDiv button').remove();
|
||||
$('#discoverShow').append(createStatusBar('framedisc'));
|
||||
$('#discoverShow').append(createStatusBar('discoverdisc'));
|
||||
$('#discoverShow').append('<center><table><tr><td id="frameTd">'
|
||||
+ '</td><td style="width:20px"></td><td id="mtmsTd"></td></tr></table></center>');
|
||||
discoverFrame();
|
||||
@@ -1056,8 +1074,8 @@ function powerInitDiscoverFrames() {
|
||||
importButton.bind('click', function(){
|
||||
$('#discoverShow').empty();
|
||||
$('#discoverContentDiv button').remove();
|
||||
$('#discoverShow').append(createStatusBar('framedisc'));
|
||||
$('#framedisc div').html('Use the mtms map file with the format <framename> <mtm> <serial>(frame1 78AC-100 9920032).');
|
||||
$('#discoverShow').append(createStatusBar('discoverdisc'));
|
||||
$('#discoverdisc div').html('Use the mtms map file with the format <framename> <mtm> <serial>(frame1 78AC-100 9920032).');
|
||||
$('#discoverShow').append('<center><form action="lib/upload.php" method="post" enctype="multipart/form-data">MTMS map file:'
|
||||
+ '<input type="file" name="file"></form></center>');
|
||||
$('#discoverShow form').append(createButton('Parse'));
|
||||
@@ -1071,7 +1089,7 @@ function powerInitDiscoverFrames() {
|
||||
var mapArray = getDiscoverEnv('framemtmsmap').split(';');
|
||||
for (var i in mapArray) {
|
||||
var tempArray = mapArray[i].split(',');
|
||||
showMap(tempArray[0], tempArray[1], 0);
|
||||
showMap(tempArray[0], tempArray[1], 0, 'Frame and MTMS map');
|
||||
}
|
||||
|
||||
createDiscoverButtons();
|
||||
@@ -1080,7 +1098,7 @@ function powerInitDiscoverFrames() {
|
||||
}
|
||||
|
||||
function discoverFrame(){
|
||||
$('#framedisc div').append('Discovering all Frames by lsslp.').append(createLoader());
|
||||
$('#discoverdisc div').append('Discovering all Frames by lsslp.').append(createLoader());
|
||||
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
@@ -1095,7 +1113,7 @@ function discoverFrame(){
|
||||
success : function(data) {
|
||||
var tempInfo = data.rsp[0];
|
||||
if (-1 != tempInfo.indexOf('Error')) {
|
||||
$('#framedisc div').html(tempInfo);
|
||||
$('#discoverdisc div').html(tempInfo);
|
||||
createDiscoverButtons();
|
||||
return;
|
||||
}
|
||||
@@ -1105,7 +1123,7 @@ function discoverFrame(){
|
||||
|
||||
// Check the defined number and discovered number
|
||||
if (mtmsArray.length != frameArray.length) {
|
||||
$('#framedisc div').html(
|
||||
$('#discoverdisc div').html(
|
||||
'Error: Definded Number is ' + frameArray.length
|
||||
+ ', but lsslp discovered Number is '
|
||||
+ mtmsArray.length
|
||||
@@ -1114,20 +1132,20 @@ function discoverFrame(){
|
||||
return;
|
||||
}
|
||||
|
||||
$('#framedisc div').html(
|
||||
$('#discoverdisc div').html(
|
||||
'Mapping the frame name and mtms which discovered by lsslp.<br\>'
|
||||
+ 'Select the frame name, then select the mtms.');
|
||||
|
||||
for (var i in frameArray) {
|
||||
$('#frameTd').append(
|
||||
'<p><input name="frameradio" type="radio" onclick="createMap(this)"><span>'
|
||||
'<p><input name="frameradio" type="radio" onclick="createMap(this, \'Frame and MTMS map\')"><span>'
|
||||
+ frameArray[i] + '</span></p>');
|
||||
|
||||
}
|
||||
|
||||
for (var i in mtmsArray) {
|
||||
$('#mtmsTd').append(
|
||||
'<p><input name="mtmsradio" type="radio" onclick="createMap(this)"><span>'
|
||||
'<p><input name="mtmsradio" type="radio" onclick="createMap(this, \'Frame and MTMS map\')"><span>'
|
||||
+ mtmsArray[i] + '</span></p>');
|
||||
}
|
||||
|
||||
@@ -1137,8 +1155,20 @@ function discoverFrame(){
|
||||
}
|
||||
|
||||
function parseMtmsMap(responseText){
|
||||
var frameArray = expandNR(getDiscoverEnv('frameName'));
|
||||
var lines = responseText.split("\n");
|
||||
var typeflag;
|
||||
var nodeArray;
|
||||
if ($('#discoverContentDiv h2').text().toLocaleLowerCase().indexOf('hmc') >= 0){
|
||||
typeflag = 'hmc';
|
||||
nodeArray= expandNR(getDiscoverEnv('hmcName'));
|
||||
}
|
||||
else{
|
||||
typeflag = 'frame';
|
||||
nodeArray= expandNR(getDiscoverEnv('frameName'));
|
||||
}
|
||||
|
||||
//replace the \r\n for different os file eol format
|
||||
responseText = responseText.replace(/[\r\n]+/g, ";");
|
||||
var lines = responseText.split(";");
|
||||
var temphash = new Object();
|
||||
var nulldefine = '';
|
||||
|
||||
@@ -1150,33 +1180,33 @@ function parseMtmsMap(responseText){
|
||||
temphash[tempname] = tempmtm + '-' + tempserial;
|
||||
}
|
||||
|
||||
for (var i in frameArray){
|
||||
var tempname = frameArray[i];
|
||||
for (var i in nodeArray){
|
||||
var tempname = nodeArray[i];
|
||||
if (!temphash[tempname]){
|
||||
if (!nulldefine){
|
||||
nulldefine += 'tempname';
|
||||
nulldefine += tempname;
|
||||
}
|
||||
else{
|
||||
nulldefine += ', tempname';
|
||||
nulldefine += ',' + tempname;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nulldefine){
|
||||
$('#framedisc div').html(
|
||||
$('#discoverdisc div').html(
|
||||
'Error: ' + nulldefine + ' was not defined in the map file, please check!');
|
||||
return;
|
||||
}
|
||||
else{
|
||||
for (var i in temphash){
|
||||
showMap(i, temphash[i], 0);
|
||||
showMap(i, temphash[i], 0, 'Frame and MTMS map');
|
||||
}
|
||||
}
|
||||
|
||||
createDiscoverButtons();
|
||||
}
|
||||
|
||||
function createMap(obj) {
|
||||
function createMap(obj, fieldtitle) {
|
||||
var fname = '';
|
||||
var mname = '';
|
||||
|
||||
@@ -1193,16 +1223,16 @@ function createMap(obj) {
|
||||
}
|
||||
|
||||
$('#discoverShow :checked').parent().remove();
|
||||
showMap(fname, mname, 1);
|
||||
showMap(fname, mname, 1, fieldtitle);
|
||||
}
|
||||
|
||||
function showMap(fname, mname, deleteflag) {
|
||||
function showMap(fname, mname, deleteflag, fieldtitle) {
|
||||
var rowClass = '';
|
||||
var deleteicon = '';
|
||||
if ($('#discoverShow fieldset').size() < 1) {
|
||||
$('#discoverShow')
|
||||
.append(
|
||||
'<fieldset><legend>Frame and MTMS map</legend><center><table></table></center></fieldset>');
|
||||
'<fieldset><legend>' + fieldtitle + '</legend><center><table></table></center></fieldset>');
|
||||
}
|
||||
|
||||
if (0 == $('#discoverShow fieldset tr').size() % 2) {
|
||||
@@ -1292,7 +1322,96 @@ function checkFrameMtms(operType) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 7: Create the xcatsetup configure file and run xcatsetup to define all
|
||||
* Step 7: define the hmc mtms map
|
||||
*/
|
||||
|
||||
function powerInitDiscoverHmc() {
|
||||
$('#discoverContentDiv').empty();
|
||||
$('.tooltip').remove();
|
||||
var showDiv = '<h2>' + steps[currentStep] + '</h2><div style="min-height:360px" id="discoverShow"></div>';
|
||||
$('#discoverContentDiv').append(showDiv);
|
||||
|
||||
//the discover button, use lsslp
|
||||
var discoverButton = createButton('Discovery by lsslp');
|
||||
discoverButton.bind('click', function(){
|
||||
|
||||
});
|
||||
|
||||
//the import button, use mtms map file
|
||||
var importButton = createButton('Import the mtms map file');
|
||||
importButton.bind('click', function(){
|
||||
$('#discoverShow').empty();
|
||||
$('#discoverContentDiv button').remove();
|
||||
$('#discoverShow').append(createStatusBar('discoverdisc'));
|
||||
$('#discoverdisc div').html('Use the mtms map file with the format <hmcname> <mtm> <serial>(hmc1 7042CR6 10689EC).');
|
||||
$('#discoverShow').append('<center><form action="lib/upload.php" method="post" enctype="multipart/form-data">MTMS map file:'
|
||||
+ '<input type="file" name="file"></form></center>');
|
||||
$('#discoverShow form').append(createButton('Parse'));
|
||||
$('#discoverShow form').ajaxForm({
|
||||
success : parseMtmsMap
|
||||
});
|
||||
});
|
||||
$('#discoverShow').append(importButton);
|
||||
|
||||
if (getDiscoverEnv('hmcmtmsmap')) {
|
||||
var mapArray = getDiscoverEnv('hmcmtmsmap').split(';');
|
||||
for (var i in mapArray) {
|
||||
var tempArray = mapArray[i].split(',');
|
||||
showMap(tempArray[0], tempArray[1], 0, 'HMC and MTMS map');
|
||||
}
|
||||
|
||||
createDiscoverButtons();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function checkHmcMtms(operType){
|
||||
// Check the number of radio button
|
||||
var vpdStr = '';
|
||||
$('#discoverShow .ui-state-error').remove();
|
||||
if (0 < $('#discoverShow :radio').size()) {
|
||||
var warnBar = createWarnBar('Map all of the hmc and mtms.');
|
||||
$('#discoverContentDiv #discoverShow').prepend(warnBar);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Find out all maps
|
||||
var maps = '';
|
||||
$('#discoverShow fieldset tr').each(
|
||||
function() {
|
||||
var hmcname = $(this).children().eq(0).html();
|
||||
var mtms = $(this).children().eq(2).html();
|
||||
var pos = mtms.lastIndexOf('-');
|
||||
var startpos = mtms.indexOf(':');
|
||||
|
||||
maps += (hmcname + ',' + mtms + ';');
|
||||
vpdStr += hmcname + ',' + mtms.substring(startpos + 1, pos) + ',' + mtms.substring(pos + 1) + ':';
|
||||
});
|
||||
|
||||
maps = maps.substr(0, maps.length - 1);
|
||||
vpdStr = vpdStr.substr(0, vpdStr.length - 1);
|
||||
setDiscoverEnv('hmcmtmsmap', maps);
|
||||
|
||||
if ('back' == operType) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Write the maps into vpd table
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'updatevpd;' + vpdStr,
|
||||
msg : ''
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Step 8: Create the xcatsetup configure file and run xcatsetup to define all
|
||||
* objects in xcat database.
|
||||
*/
|
||||
function powerInitConfig(operType) {
|
||||
@@ -1325,7 +1444,7 @@ function powerInitConfig(operType) {
|
||||
createSetupFile();
|
||||
}
|
||||
/**
|
||||
* Step 7: Create the xcat configure file
|
||||
* Step 8: Create the xcat configure file
|
||||
*/
|
||||
function createSetupFile() {
|
||||
var fileContent = '';
|
||||
@@ -1404,7 +1523,7 @@ function createSetupFile() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 7: Run the xcatsetup command
|
||||
* Step 8: Run the xcatsetup command
|
||||
*/
|
||||
function runSetup() {
|
||||
$('#setupLine').append(createLoader());
|
||||
@@ -1428,8 +1547,21 @@ function runSetup() {
|
||||
});
|
||||
}
|
||||
|
||||
function updateFrameHeight(){
|
||||
var frameArray = document.getElementsByTagName('iframe');
|
||||
for (var i = 0;i < frameArray.length; i++){
|
||||
var tempiframe = document.getElementsByTagName('iframe')[i];
|
||||
tempiframe.height = tempiframe.contentWindow.document.documentElement.scrollHeight;
|
||||
}
|
||||
|
||||
//scroll the status div to the bottom automaticlly
|
||||
var infodiv = document.getElementById('returninfo');
|
||||
infodiv.scrollTop = infodiv.scrollHeight;
|
||||
|
||||
iframeTimer = setTimeout(updateFrameHeight, 2000);
|
||||
}
|
||||
/**
|
||||
* Step 8: Discover all HMC and CEC in the cluster and update into xCAT database
|
||||
* Step 9: Discover all HMC and CEC in the cluster and update into xCAT database
|
||||
*/
|
||||
function powerInitUpdateDefinition(operType) {
|
||||
$('#discoverContentDiv').empty();
|
||||
@@ -1446,9 +1578,7 @@ function powerInitUpdateDefinition(operType) {
|
||||
showStr += '<div id="outputinfo"></div><ul>';
|
||||
|
||||
showStr += '<li id="hmcLine1"><span class="ui-icon ' + iconClass
|
||||
+ '"></span>Discover HMCs.</li>';
|
||||
showStr += '<li id="hmcLine2"><span class="ui-icon ' + iconClass
|
||||
+ '"></span>Update HMCs into xCAT database.</li>';
|
||||
+ '"></span>Discover and define HMCs into xCAT database..</li>';
|
||||
showStr += '<li id="frameLine1"><span class="ui-icon ' + iconClass
|
||||
+ '"></span>Update Frames into xCAT database.</li>';
|
||||
showStr += '<li id="frameLine2"><span class="ui-icon ' + iconClass
|
||||
@@ -1476,121 +1606,56 @@ function powerInitUpdateDefinition(operType) {
|
||||
return;
|
||||
}
|
||||
|
||||
iframeTimer = setTimeout(updateFrameHeight, 10000);
|
||||
lsslpWriteHMC();
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 8: Write all the lsslp HMC info into database
|
||||
* Step 9: Write all the lsslp HMC info into database
|
||||
*/
|
||||
function lsslpWriteHMC() {
|
||||
$('#hmcLine1').append(createLoader());
|
||||
var cmdlink = 'lib/cmd.php?cmd=lsslp&tgt=&args=-s;HMC&msg=&opts=flush';
|
||||
var hmciframe1 = $('<iframe id="hmciframe1"></iframe>').attr('src', cmdlink).css({
|
||||
|
||||
$('#returninfo div').append('<p>Discovere HMCs and define into xCAT database.</p>');
|
||||
var cmdlink = 'lib/cmd.php?cmd=lsslp&tgt=&args=-w;-s;HMC;-t;2;';
|
||||
if (getDiscoverEnv('ipfordiscovery')){
|
||||
cmdlink += '-i;' + getDiscoverEnv('ipfordiscovery') + ';';
|
||||
}
|
||||
cmdlink += '-C;' + expandNR(getDiscoverEnv('hmcName')).length;
|
||||
cmdlink += '&msg=&opts=flush';
|
||||
var hmciframe1 = $('<iframe id="hmciframe1" scrolling="no"></iframe>').attr('src', cmdlink).css({
|
||||
'display': 'block',
|
||||
'border': '0px',
|
||||
'margin': '10px',
|
||||
'width': '100%',
|
||||
'overflow': 'visible'
|
||||
'width': '100%'
|
||||
});
|
||||
|
||||
hmciframe1.load( function() {
|
||||
var mapstring = "Add map between hmc and frames into xCAT database<br/>";
|
||||
//extract the return information from the iframe hmciframe1
|
||||
var mtmsArray = new Array();
|
||||
var hmclines = $(document.getElementById('hmciframe1').contentWindow.document.body).text();
|
||||
var temparray = hmclines.split("\n");
|
||||
for (var i in temparray){
|
||||
var line = temparray[i].replace(/(^\s*)|(\s*$)/g, "");
|
||||
if (line.toLowerCase().indexOf('hmc') >= 0){
|
||||
line = line.replace(/\s+/g, " ");
|
||||
var attrs = line.split(" ");
|
||||
//attrs[1] is mtm, attrs[2] is serial number
|
||||
mtmsArray.push(attrs[1], attrs[2]);
|
||||
}
|
||||
}
|
||||
// modify the page elements
|
||||
$('#returninfo div').append(hmciframe1);
|
||||
|
||||
hmciframe1.load(function() {
|
||||
$('#hmcLine1 img').remove();
|
||||
var tempSpan = $('#hmcLine1').find('span');
|
||||
tempSpan.removeClass('ui-icon-gear');
|
||||
tempSpan.addClass('ui-icon-check');
|
||||
$('#hmcLine2').append(createLoader());
|
||||
|
||||
var hmcArray = expandNR(getDiscoverEnv('hmcName'));
|
||||
var tempPar = '';
|
||||
|
||||
if (hmcArray.length > (mtmsArray.length / 2)) {
|
||||
// Error info
|
||||
$('#hmcLine2 img').remove();
|
||||
var warnBar = createWarnBar('Error: Defined ' + hmcArray.length
|
||||
+ ' HMCs, but discovered ' + mtmsArray.length / 2
|
||||
+ ' HMCs. Please check the configuration.');
|
||||
$('#discoverContentDiv div').prepend(warnBar);
|
||||
createDiscoverButtons();
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the HMC and MTMs pair string
|
||||
for (var i in hmcArray) {
|
||||
var j = 2 * i;
|
||||
if ('' == tempPar) {
|
||||
tempPar += hmcArray[i] + ',' + mtmsArray[j] + ',' + mtmsArray[j + 1];
|
||||
} else {
|
||||
tempPar += ':' + hmcArray[i] + ',' + mtmsArray[j] + ',' + mtmsArray[j + 1];
|
||||
}
|
||||
mapstring += hmcArray[i] + '<----->' + mtmsArray[j] + '-' + mtmsArray[j + 1] + '<br/>';
|
||||
}
|
||||
|
||||
$('#returninfo div').append('<p>' + mapstring + '</p>');
|
||||
|
||||
// Write MTMs and HMC name pair into vpd table
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'updatevpd;' + tempPar,
|
||||
msg : ''
|
||||
},
|
||||
success : function() {
|
||||
$('#returninfo div').append('<p>Add the discovered HMCs into xCAT database.</p>');
|
||||
var cmklink2 = 'lib/cmd.php?cmd=lsslp&tgt=&args=-w;-s;HMC&msg=&opts=flush';
|
||||
var hmciframe2 = $('<iframe id="hmciframe2"></iframe>').attr('src', cmdlink).css({
|
||||
'display': 'block',
|
||||
'border': '0px',
|
||||
'margin': '10px',
|
||||
'width': '100%',
|
||||
'overflow': 'visible'
|
||||
});
|
||||
$('#returninfo div').append(hmciframe2);
|
||||
|
||||
hmciframe2.load(function() {
|
||||
$('#hmcLine2 img').remove();
|
||||
var tempSpan = $('#hmcLine2').find('span');
|
||||
tempSpan.removeClass('ui-icon-gear');
|
||||
tempSpan.addClass('ui-icon-check');
|
||||
lsslpWriteFrame();
|
||||
});
|
||||
}
|
||||
});
|
||||
lsslpWriteFrame();
|
||||
});
|
||||
|
||||
$('#returninfo div').append(hmciframe1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 8: Write all lsslp frame info into the database
|
||||
* Step 9: Write all lsslp frame info into the database
|
||||
*/
|
||||
function lsslpWriteFrame() {
|
||||
$('#frameLine1').append(createLoader());
|
||||
$('#returninfo div').append('<p>Write the discovered FRAMES into xCAT Database.</p>');
|
||||
var cmdlink = 'lib/cmd.php?cmd=lsslp&tgt=&args=-w;-s;FRAME&msg=&opts=flush';;
|
||||
var frameiframe1 = $('<iframe id="frameiframe1"></iframe>').attr('src', cmdlink).css({
|
||||
var cmdlink = 'lib/cmd.php?cmd=lsslp&tgt=&args=-w;-s;FRAME;';
|
||||
if (getDiscoverEnv('ipfordiscovery')){
|
||||
cmdlink += '-i;' + getDiscoverEnv('ipfordiscovery');
|
||||
}
|
||||
cmdlink += '&msg=&opts=flush';
|
||||
var frameiframe1 = $('<iframe id="frameiframe1" scrolling="no"></iframe>').attr('src', cmdlink).css({
|
||||
'display': 'block',
|
||||
'border': '0px',
|
||||
'margin': '10px',
|
||||
'width': '100%',
|
||||
'overflow': 'visible'
|
||||
'width': '100%'
|
||||
});
|
||||
$('#returninfo div').append(frameiframe1);
|
||||
|
||||
@@ -1604,7 +1669,7 @@ function lsslpWriteFrame() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 8: config the frame dhcp and dns
|
||||
* Step 9: config the frame dhcp and dns
|
||||
*/
|
||||
function frameSetup() {
|
||||
$('#frameLine2').append(createLoader());
|
||||
@@ -1632,18 +1697,17 @@ function frameSetup() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 8: reset the networks for frames
|
||||
* Step 9: reset the networks for frames
|
||||
*/
|
||||
function frameReset(){
|
||||
$('#frameLine3').append(createLoader());
|
||||
$('#returninfo div').append('<p>Reset network on FRAMES to get persistent IP.</p>');
|
||||
var cmdlink = 'lib/cmd.php?cmd=rspconfig&tgt=frame&args=--resetnet&msg=&opts=flush';;
|
||||
var frameiframe2 = $('<iframe id="frameiframe2"></iframe>').attr('src', cmdlink).css({
|
||||
var cmdlink = 'lib/cmd.php?cmd=rspconfig&tgt=frame&args=--resetnet&msg=&opts=flush';
|
||||
var frameiframe2 = $('<iframe id="frameiframe2" scrolling="no"></iframe>').attr('src', cmdlink).css({
|
||||
'display': 'block',
|
||||
'border': '0px',
|
||||
'margin': '10px',
|
||||
'width': '100%',
|
||||
'overflow': 'visible'
|
||||
'width': '100%'
|
||||
});
|
||||
$('#returninfo div').append(frameiframe2);
|
||||
frameiframe2.load(function() {
|
||||
@@ -1656,7 +1720,7 @@ function frameReset(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 8: create hardware connection for frames
|
||||
* Step 9: create hardware connection for frames
|
||||
*/
|
||||
function frameHwconn(){
|
||||
$('#frameLine4').append(createLoader());
|
||||
@@ -1684,18 +1748,21 @@ function frameHwconn(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 8: Write all the lsslp cec info into database
|
||||
* Step 9: Write all the lsslp cec info into database
|
||||
*/
|
||||
function lsslpWriteCec() {
|
||||
$('#cecLine').append(createLoader());
|
||||
$('#returninfo div').append('<p>Discover and write CECs into xCAT Database.</p>');
|
||||
var cmdlink = 'lib/cmd.php?cmd=lsslp&tgt=&args=-s;CEC;-w&msg=&opts=flush';;
|
||||
var ceciframe1 = $('<iframe id="ceciframe1"></iframe>').attr('src', cmdlink).css({
|
||||
var cmdlink = 'lib/cmd.php?cmd=lsslp&tgt=&args=-s;CEC;-w;';
|
||||
if (getDiscoverEnv('ipfordiscovery')){
|
||||
cmdlink += '-i;' + getDiscoverEnv('ipfordiscovery');
|
||||
}
|
||||
cmdlink += '&msg=&opts=flush';
|
||||
var ceciframe1 = $('<iframe id="ceciframe1" scrolling="no"></iframe>').attr('src', cmdlink).css({
|
||||
'display': 'block',
|
||||
'border': '0px',
|
||||
'margin': '10px',
|
||||
'width': '100%',
|
||||
'overflow': 'visible'
|
||||
'width': '100%'
|
||||
});
|
||||
$('#returninfo div').append(ceciframe1);
|
||||
ceciframe1.load(function() {
|
||||
@@ -1708,7 +1775,7 @@ function lsslpWriteCec() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 8: config the cec dhcp and dns
|
||||
* Step 9: config the cec dhcp and dns
|
||||
*/
|
||||
function cecsetup(){
|
||||
$('#cecLine2').append(createLoader());
|
||||
@@ -1735,18 +1802,17 @@ function cecsetup(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 8: reset the networks for cecs
|
||||
* Step 9: reset the networks for cecs
|
||||
*/
|
||||
function cecReset(){
|
||||
$('#cecLine3').append(createLoader());
|
||||
$('#returninfo div').append('<p>Reset network on CECs to get persistent IP.</p>');
|
||||
var cmdlink = 'lib/cmd.php?cmd=rspconfig&tgt=cec&args=--resetnet&msg=&opts=flush';;
|
||||
var ceciframe2 = $('<iframe id="ceciframe2"></iframe>').attr('src', cmdlink).css({
|
||||
var cmdlink = 'lib/cmd.php?cmd=rspconfig&tgt=cec&args=--resetnet&msg=&opts=flush';
|
||||
var ceciframe2 = $('<iframe id="ceciframe2" scrolling="no"></iframe>').attr('src', cmdlink).css({
|
||||
'display': 'block',
|
||||
'border': '0px',
|
||||
'margin': '10px',
|
||||
'width': '100%',
|
||||
'overflow': 'visible'
|
||||
'width': '100%'
|
||||
});
|
||||
$('#returninfo div').append(ceciframe2);
|
||||
ceciframe2.load(function() {
|
||||
@@ -1759,7 +1825,7 @@ function cecReset(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 8: config the cec
|
||||
* Step 9: config the cec
|
||||
*/
|
||||
function cecHwconn(){
|
||||
$('#cecLine4').append(createLoader());
|
||||
@@ -1780,13 +1846,15 @@ function cecHwconn(){
|
||||
tempSpan.removeClass('ui-icon-gear');
|
||||
tempSpan.addClass('ui-icon-check');
|
||||
$('#returninfo div').append('<p><pre>' + data.rsp.join("\n") + '</pre></p>');
|
||||
clearTimeout(iframeTimer);
|
||||
updateFrameHeight();
|
||||
createDiscoverButtons();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 9: Create LPARs
|
||||
* Step 10: Create LPARs
|
||||
*/
|
||||
function powerInitCreateLpar() {
|
||||
$('#discoverContentDiv').empty();
|
||||
@@ -1810,6 +1878,7 @@ function powerInitCreateLpar() {
|
||||
|
||||
function ihCreateLpar(parentDiv) {
|
||||
var showStr = 'Partition Rule:<br/>'
|
||||
+ 'By default, 1 partition is already created in each octant of each CEC, with all of the octant\'s CPUs and memory assigned to it. If this is the configuration you want, click Next. To customize the partition configuration, use one of the rules below.<br/>'
|
||||
+ 'If all the octants configuration value are same in one CEC, it will be " -r 0-7:value".<br/>'
|
||||
+ 'If the octants use the different configuration value in one cec, it will be "-r 0:value1,1:value2,...7:value7", or "-r 0:value1,1-7:value2".<br/>'
|
||||
+ 'The octants configuration value for one Octant could be 1, 2, 3, 4, 5 . The meanings of the octants configuration value are as following:<br/>'
|
||||
|
||||
+8
-8
@@ -307,11 +307,11 @@ DataTable.prototype.add = function(rowCont) {
|
||||
* @param barId Status bar ID
|
||||
*/
|
||||
function createStatusBar(barId) {
|
||||
var statusBar = $('<div class="ui-corner-all" id="' + barId + '"></div>').css({
|
||||
// Do not change the background color or color! This is handled by the theme
|
||||
// the user selects.
|
||||
var statusBar = $('<div class="ui-state-highlight ui-corner-all" id="' + barId + '"></div>').css({
|
||||
'margin-bottom': '5px',
|
||||
'min-height': '30px',
|
||||
'background-color':'#7BBEDE',
|
||||
'color': '#FFFFFF',
|
||||
'max-height': '150px',
|
||||
'overflow': 'auto'
|
||||
});
|
||||
@@ -354,10 +354,10 @@ function createStatusBar(barId) {
|
||||
* @return Info bar
|
||||
*/
|
||||
function createInfoBar(msg) {
|
||||
var infoBar = $('<div class="ui-corner-all"></div>').css({
|
||||
'margin': '5px 0px',
|
||||
'background-color':'#7BBEDE',
|
||||
'color': '#FFFFFF'
|
||||
// Do not change the background color or color! This is handled by the theme
|
||||
// the user selects.
|
||||
var infoBar = $('<div class="ui-state-highlight ui-corner-all"></div>').css({
|
||||
'margin': '5px 0px'
|
||||
});
|
||||
var icon = $('<span class="ui-icon ui-icon-info"></span>').css({
|
||||
'display': 'inline-block',
|
||||
@@ -1055,4 +1055,4 @@ function getNodesChecked(datatableId) {
|
||||
}
|
||||
|
||||
return tgts;
|
||||
}
|
||||
}
|
||||
|
||||
+146
-141
@@ -12,126 +12,131 @@ require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
* @param $cmd The xCAT command
|
||||
* @param $tgt The target node or group
|
||||
* @param $args The xCAT command arguments, separated by semicolons
|
||||
* @param $opts The xCAT command options, separated by semicolons
|
||||
* @param $opts The xCAT command options, separated by semicolons
|
||||
* @return The xCAT response. Replies are in the form of JSON
|
||||
*/
|
||||
if (isset($_GET["cmd"])) {
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$tgt = $_GET["tgt"];
|
||||
$args = $_GET["args"];
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$tgt = $_GET["tgt"];
|
||||
$args = $_GET["args"];
|
||||
|
||||
// File contents in case of file write
|
||||
if (isset($_GET["cont"])) {
|
||||
$cont = $_GET["cont"];
|
||||
}
|
||||
// File contents in case of file write
|
||||
if (isset($_GET["cont"])) {
|
||||
$cont = $_GET["cont"];
|
||||
}
|
||||
|
||||
// Special messages put here
|
||||
// This gets sent back to the AJAX request as is.
|
||||
$msg = $_GET["msg"];
|
||||
// Special messages put here
|
||||
// This gets sent back to the AJAX request as is.
|
||||
$msg = $_GET["msg"];
|
||||
|
||||
// If no $tgt is given, set $tgt to NULL
|
||||
if (!$tgt) {
|
||||
$tgt = NULL;
|
||||
}
|
||||
// If no $tgt is given, set $tgt to NULL
|
||||
if (!$tgt) {
|
||||
$tgt = NULL;
|
||||
}
|
||||
|
||||
// If no $msg is given, set $msg to NULL
|
||||
if (!$msg) {
|
||||
$msg = NULL;
|
||||
}
|
||||
// If no $msg is given, set $msg to NULL
|
||||
if (!$msg) {
|
||||
$msg = NULL;
|
||||
}
|
||||
|
||||
// If no $args are given, set $args_array to NULL
|
||||
$args_array = array();
|
||||
if ($args) {
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($args,";")) {
|
||||
// Split the arguments into an array
|
||||
$args_array = array();
|
||||
$args_array = explode(";", $args);
|
||||
} else {
|
||||
$args_array = array($args);
|
||||
}
|
||||
}
|
||||
// If no $args are given, set $args_array to NULL
|
||||
$args_array = array();
|
||||
if ($args) {
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($args,";")) {
|
||||
// Split the arguments into an array
|
||||
$args_array = array();
|
||||
$args_array = explode(";", $args);
|
||||
} else {
|
||||
$args_array = array($args);
|
||||
}
|
||||
}
|
||||
|
||||
// If no $opts are given, set $opts_array to NULL
|
||||
$opts_array = array();
|
||||
if (isset($_GET["opts"])) {
|
||||
$opts = $_GET["opts"];
|
||||
// If no $opts are given, set $opts_array to NULL
|
||||
$opts_array = array();
|
||||
if (isset($_GET["opts"])) {
|
||||
$opts = $_GET["opts"];
|
||||
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($opts,";")) {
|
||||
// Split the arguments into an array
|
||||
$opts_array = array();
|
||||
$opts_array = explode(";", $opts);
|
||||
} else {
|
||||
$opts_array = array($opts);
|
||||
}
|
||||
}
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($opts,";")) {
|
||||
// Split the arguments into an array
|
||||
$opts_array = array();
|
||||
$opts_array = explode(";", $opts);
|
||||
} else {
|
||||
$opts_array = array($opts);
|
||||
}
|
||||
}
|
||||
|
||||
// Time needed to update /etc/hosts
|
||||
if (strncasecmp($cmd, "makehosts", 9) == 0) {
|
||||
sleep(5);
|
||||
}
|
||||
|
||||
// Submit request and get response
|
||||
$xml = docmd($cmd, $tgt, $args_array, $opts_array);
|
||||
// If the output is flushed, do not return output in JSON
|
||||
if (in_array("flush", $opts_array)) {
|
||||
return;
|
||||
}
|
||||
// Submit request and get response
|
||||
$xml = docmd($cmd, $tgt, $args_array, $opts_array);
|
||||
// If the output is flushed, do not return output in JSON
|
||||
if (in_array("flush", $opts_array)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$rsp = array();
|
||||
$rsp = array();
|
||||
|
||||
// webrun pping and gangliastatus output needs special handling
|
||||
if(strncasecmp($cmd, "webrun", 6) == 0 && (stristr($args, "pping") || stristr($args, "gangliastatus") || stristr($args, "chtab"))) {
|
||||
$rsp = extractWebrun($xml);
|
||||
}
|
||||
// nodels output needs special handling
|
||||
else if(strncasecmp($cmd, "nodels", 6) == 0) {
|
||||
// Handle the output the same way as webrun
|
||||
$rsp = extractNodels($xml);
|
||||
}
|
||||
// extnoderange output needs special handling
|
||||
// This command gets the nodes and groups
|
||||
else if(strncasecmp($cmd, "extnoderange", 12) == 0) {
|
||||
$rsp = extractExtnoderange($xml);
|
||||
}
|
||||
// Write contents to file
|
||||
else if(strncasecmp($cmd, "write", 4) == 0) {
|
||||
// Directory should be /var/opt/xcat/profiles
|
||||
// You can write anything to that directory
|
||||
$file = "$tgt";
|
||||
$handle = fopen($file, 'w') or die("Cannot open $file");
|
||||
fwrite($handle, $cont);
|
||||
fclose($handle);
|
||||
// webrun pping and gangliastatus output needs special handling
|
||||
if (strncasecmp($cmd, "webrun", 6) == 0 && (stristr($args, "pping") || stristr($args, "gangliastatus") || stristr($args, "chtab"))) {
|
||||
$rsp = extractWebrun($xml);
|
||||
}
|
||||
// nodels output needs special handling
|
||||
else if (strncasecmp($cmd, "nodels", 6) == 0) {
|
||||
// Handle the output the same way as webrun
|
||||
$rsp = extractNodels($xml);
|
||||
}
|
||||
// extnoderange output needs special handling
|
||||
// This command gets the nodes and groups
|
||||
else if (strncasecmp($cmd, "extnoderange", 12) == 0) {
|
||||
$rsp = extractExtnoderange($xml);
|
||||
}
|
||||
// Write contents to file
|
||||
else if (strncasecmp($cmd, "write", 4) == 0) {
|
||||
// Directory should be /var/opt/xcat/profiles
|
||||
// You can write anything to that directory
|
||||
$file = "$tgt";
|
||||
$handle = fopen($file, 'w') or die("Cannot open $file");
|
||||
fwrite($handle, $cont);
|
||||
fclose($handle);
|
||||
|
||||
$rsp = "Directory entry written to $file";
|
||||
}
|
||||
// Handle the typical output
|
||||
else {
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
if($data->name) {
|
||||
$node = $data->name;
|
||||
$rsp = "Directory entry written to $file";
|
||||
}
|
||||
// Handle the typical output
|
||||
else {
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
if($data->name) {
|
||||
$node = $data->name;
|
||||
|
||||
if ($data->data->contents) {
|
||||
$cont = $data->data->contents;
|
||||
} else {
|
||||
$cont = $data->data;
|
||||
}
|
||||
if ($data->data->contents) {
|
||||
$cont = $data->data->contents;
|
||||
} else {
|
||||
$cont = $data->data;
|
||||
}
|
||||
|
||||
if ($data->data->desc) {
|
||||
$cont = $data->data->desc . ": " . $cont;
|
||||
}
|
||||
if ($data->data->desc) {
|
||||
$cont = $data->data->desc . ": " . $cont;
|
||||
}
|
||||
|
||||
$cont = str_replace(":|:", "\n", $cont);
|
||||
array_push($rsp, "$node: $cont");
|
||||
} else if (strlen("$data") > 2) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$cont = str_replace(":|:", "\n", $cont);
|
||||
array_push($rsp, "$node: $cont");
|
||||
} else if (strlen("$data") > 2) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reply in the form of JSON
|
||||
$rtn = array("rsp" => $rsp, "msg" => $msg);
|
||||
echo json_encode($rtn);
|
||||
// Reply in the form of JSON
|
||||
$rtn = array("rsp" => $rsp, "msg" => $msg);
|
||||
echo json_encode($rtn);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,26 +146,26 @@ if (isset($_GET["cmd"])) {
|
||||
* @return An array containing the output
|
||||
*/
|
||||
function extractWebrun($xml) {
|
||||
$rsp = array();
|
||||
$i = 0;
|
||||
$rsp = array();
|
||||
$i = 0;
|
||||
|
||||
// Extract data returned
|
||||
foreach($xml->children() as $nodes){
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
// Extract data returned
|
||||
foreach($xml->children() as $nodes){
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
|
||||
// Get the content
|
||||
$status = $node->data;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
// Get the content
|
||||
$status = $node->data;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
|
||||
// Add to return array
|
||||
$rsp[$i] = array("$name", "$status");
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
// Add to return array
|
||||
$rsp[$i] = array("$name", "$status");
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
return $rsp;
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,26 +175,26 @@ function extractWebrun($xml) {
|
||||
* @return An array containing the output
|
||||
*/
|
||||
function extractNodels($xml) {
|
||||
$rsp = array();
|
||||
$i = 0;
|
||||
$rsp = array();
|
||||
$i = 0;
|
||||
|
||||
// Extract data returned
|
||||
foreach($xml->children() as $nodes){
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
// Get the content
|
||||
$status = $node->data->contents;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
// Extract data returned
|
||||
foreach($xml->children() as $nodes){
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
// Get the content
|
||||
$status = $node->data->contents;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
|
||||
$description = $node->data->desc;
|
||||
// Add to return array
|
||||
$rsp[$i] = array("$name", "$status", "$description");
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$description = $node->data->desc;
|
||||
// Add to return array
|
||||
$rsp[$i] = array("$name", "$status", "$description");
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
return $rsp;
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -199,13 +204,13 @@ function extractNodels($xml) {
|
||||
* @return The nodes and groups
|
||||
*/
|
||||
function extractExtnoderange($xml) {
|
||||
$rsp = array();
|
||||
$rsp = array();
|
||||
|
||||
// Extract data returned
|
||||
foreach ($xml->xcatresponse->intersectinggroups as $group) {
|
||||
array_push($rsp, "$group");
|
||||
}
|
||||
// Extract data returned
|
||||
foreach ($xml->xcatresponse->intersectinggroups as $group) {
|
||||
array_push($rsp, "$group");
|
||||
}
|
||||
|
||||
return $rsp;
|
||||
return $rsp;
|
||||
}
|
||||
?>
|
||||
+239
-228
@@ -5,7 +5,7 @@
|
||||
|
||||
// Retain session variables across page requests
|
||||
session_start();
|
||||
session_write_close(); // Do not block other HTTP requests
|
||||
session_write_close(); // Do not block other HTTP requests
|
||||
|
||||
// The settings below display error on the screen, instead of giving blank pages.
|
||||
error_reporting(E_ALL);
|
||||
@@ -22,33 +22,33 @@ ini_set('display_errors', true);
|
||||
* See perl-xCAT/xCAT/Client.pm for the format
|
||||
*/
|
||||
function docmd($cmd, $nr, $args_array, $opts_array){
|
||||
// If we are not logged in,
|
||||
// do not try to communicate with xcatd
|
||||
if (!is_logged()) {
|
||||
echo "<p>You are not logged in! Failed to run command.</p>";
|
||||
return simplexml_load_string('<xcat></xcat>', 'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
}
|
||||
// If we are not logged in,
|
||||
// do not try to communicate with xcatd
|
||||
if (!is_logged()) {
|
||||
echo "<p>You are not logged in! Failed to run command.</p>";
|
||||
return simplexml_load_string('<xcat></xcat>', 'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
}
|
||||
|
||||
// Create xCAT request
|
||||
// Add command, node range, and arguments to request
|
||||
$request = simplexml_load_string('<xcatrequest></xcatrequest>');
|
||||
$request->addChild('command', $cmd);
|
||||
if (!empty($nr)) {
|
||||
$request->addChild('noderange', $nr);
|
||||
}
|
||||
if (!empty($args_array)) {
|
||||
foreach ($args_array as $a) {
|
||||
$request->addChild('arg',$a);
|
||||
}
|
||||
}
|
||||
// Create xCAT request
|
||||
// Add command, node range, and arguments to request
|
||||
$request = simplexml_load_string('<xcatrequest></xcatrequest>');
|
||||
$request->addChild('command', $cmd);
|
||||
if (!empty($nr)) {
|
||||
$request->addChild('noderange', $nr);
|
||||
}
|
||||
if (!empty($args_array)) {
|
||||
foreach ($args_array as $a) {
|
||||
$request->addChild('arg',$a);
|
||||
}
|
||||
}
|
||||
|
||||
// Add user and password to request
|
||||
$usernode=$request->addChild('becomeuser');
|
||||
$usernode->addChild('username',$_SESSION["username"]);
|
||||
$usernode->addChild('password',getpassword());
|
||||
// Add user and password to request
|
||||
$usernode=$request->addChild('becomeuser');
|
||||
$usernode->addChild('username',$_SESSION["username"]);
|
||||
$usernode->addChild('password',getpassword());
|
||||
|
||||
$xml = submit_request($request, 0, $opts_array);
|
||||
return $xml;
|
||||
$xml = submit_request($request, 0, $opts_array);
|
||||
return $xml;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,146 +59,157 @@ function docmd($cmd, $nr, $args_array, $opts_array){
|
||||
* @return A tree of SimpleXML objects
|
||||
*/
|
||||
function submit_request($req, $skipVerify, $opts_array){
|
||||
$xcathost = "localhost";
|
||||
$port = "3001";
|
||||
$rsp = FALSE;
|
||||
$response = '';
|
||||
$cleanexit = 0;
|
||||
$xcathost = "localhost";
|
||||
$port = "3001";
|
||||
$rsp = FALSE;
|
||||
$response = '';
|
||||
$cleanexit = 0;
|
||||
$flushtail = '';
|
||||
|
||||
// Determine whether to flush output or not
|
||||
$flush = false;
|
||||
if ($opts_array && in_array("flush", $opts_array)) {
|
||||
$flush = true;
|
||||
}
|
||||
// Determine whether to flush output or not
|
||||
$flush = false;
|
||||
if ($opts_array && in_array("flush", $opts_array)) {
|
||||
$flush = true;
|
||||
}
|
||||
|
||||
// Determine how to handle the flush output
|
||||
// You can specify a function name, in place of TBD, to handle the flush output
|
||||
$flush_format = "";
|
||||
if ($opts_array && in_array("flush-format=TBD", $opts_array)) {
|
||||
$flush_format = "TBD";
|
||||
}
|
||||
// Determine how to handle the flush output
|
||||
// You can specify a function name, in place of TBD, to handle the flush output
|
||||
$flush_format = "";
|
||||
if ($opts_array && in_array("flush-format=TBD", $opts_array)) {
|
||||
$flush_format = "TBD";
|
||||
}
|
||||
|
||||
// Open syslog, include the process ID and also send the log to standard error,
|
||||
// and use a user defined logging mechanism
|
||||
openlog("xCAT-UI", LOG_PID | LOG_PERROR, LOG_LOCAL0);
|
||||
// Open syslog, include the process ID and also send the log to standard error,
|
||||
// and use a user defined logging mechanism
|
||||
openlog("xCAT-UI", LOG_PID | LOG_PERROR, LOG_LOCAL0);
|
||||
|
||||
// Open a socket to xcatd
|
||||
syslog(LOG_INFO, "Opening socket to xcatd...");
|
||||
if ($fp = stream_socket_client('ssl://'.$xcathost.':'.$port, $errno, $errstr, 30, STREAM_CLIENT_CONNECT)){
|
||||
$reqXML = $req->asXML();
|
||||
$nr = $req->noderange;
|
||||
$cmd = $req->command;
|
||||
// Open a socket to xcatd
|
||||
syslog(LOG_INFO, "Opening socket to xcatd...");
|
||||
if ($fp = stream_socket_client('ssl://'.$xcathost.':'.$port, $errno, $errstr, 30, STREAM_CLIENT_CONNECT)){
|
||||
$reqXML = $req->asXML();
|
||||
$nr = $req->noderange;
|
||||
$cmd = $req->command;
|
||||
|
||||
syslog(LOG_INFO, "Sending request: $cmd $nr");
|
||||
stream_set_blocking($fp, 0); // Set as non-blocking
|
||||
fwrite($fp,$req->asXML()); // Send XML to xcatd
|
||||
set_time_limit(900); // Set 15 minutes timeout (for long running requests)
|
||||
// The default is 30 seconds which is too short for some requests
|
||||
syslog(LOG_INFO, "Sending request: $cmd $nr");
|
||||
stream_set_blocking($fp, 0); // Set as non-blocking
|
||||
fwrite($fp,$req->asXML()); // Send XML to xcatd
|
||||
set_time_limit(900); // Set 15 minutes timeout (for long running requests)
|
||||
// The default is 30 seconds which is too short for some requests
|
||||
|
||||
// Turn on output buffering
|
||||
ob_start();
|
||||
if ($flush){
|
||||
echo str_pad('',1024)."\n";
|
||||
}
|
||||
|
||||
while (!feof($fp)) {
|
||||
// Read until there is no more
|
||||
// Remove newlines and add it to the response
|
||||
$str = fread($fp, 8192);
|
||||
if ($str) {
|
||||
$response .= preg_replace('/>\n\s*</', '><', $str);
|
||||
// Turn on output buffering
|
||||
ob_start();
|
||||
if ($flush){
|
||||
echo str_pad('',1024)."\n";
|
||||
}
|
||||
|
||||
while (!feof($fp)) {
|
||||
// Read until there is no more
|
||||
// Remove newlines and add it to the response
|
||||
$str = fread($fp, 8192);
|
||||
if ($str) {
|
||||
$response .= preg_replace('/>\n\s*</', '><', $str);
|
||||
|
||||
// Flush output to browser
|
||||
if ($flush) {
|
||||
// Strip HTML tags from output
|
||||
$str = preg_replace('/<errorcode>.*<\/errorcode>/', '', $str);
|
||||
if ($tmp = trim(strip_tags($str))) {
|
||||
// Format the output based on what was given for $flush_format
|
||||
if ($flush_format == "TDB") {
|
||||
format_TBD($tmp);
|
||||
} else {
|
||||
$tmp = preg_replace('/\n\s*/', "\n", $tmp);
|
||||
// Print out output by default
|
||||
echo '<pre style="font-size: 10px;">' . $tmp . '</pre>';
|
||||
ob_flush();
|
||||
flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Flush output to browser
|
||||
if ($flush) {
|
||||
$str = $flushtail . $str;
|
||||
if (preg_match('/[^>]+$/', $str, $matches)){
|
||||
$flushtail = $matches[0];
|
||||
$str = preg_replace('/[^>]+$/', '', $str);
|
||||
} else {
|
||||
$flushtail = '';
|
||||
}
|
||||
|
||||
$str = preg_replace('/<errorcode>.*<\/errorcode>/', '', $str);
|
||||
// Strip HTML tags from output
|
||||
if ($tmp = trim(strip_tags($str))) {
|
||||
// Format the output based on what was given for $flush_format
|
||||
if ($flush_format == "TDB") {
|
||||
format_TBD($tmp);
|
||||
} else {
|
||||
$tmp = preg_replace('/\n\s*/', "\n", $tmp);
|
||||
|
||||
// Print out output by default
|
||||
echo '<pre style="font-size: 10px;">' . $tmp . '</pre>';
|
||||
ob_flush();
|
||||
flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Look for serverdone response
|
||||
$fullpattern = '/<xcatresponse>\s*<serverdone>\s*<\/serverdone>\s*<\/xcatresponse>/';
|
||||
$mixedpattern = '/<serverdone>\s*<\/serverdone>.*<\/xcatresponse>/';
|
||||
$recentpattern = '/<\/xcatresponse>/';
|
||||
if (preg_match($recentpattern,$str) && preg_match($mixedpattern,$response)) {
|
||||
// Transaction is done, package up XML and return it
|
||||
// Remove the serverdone response and put an xcat tag around the rest
|
||||
$count = 0;
|
||||
$response = preg_replace($fullpattern,'', $response, -1, $count); // 1st try to remove the long pattern
|
||||
if (!$count) {
|
||||
$response = preg_replace($mixedpattern,'', $response) . '</xcatresponse>/';
|
||||
}
|
||||
$response = "<xcat>$response</xcat>";
|
||||
$response = preg_replace('/>\n\s*</', '><', $response);
|
||||
$response = preg_replace('/\n/', ':|:', $response);
|
||||
$rsp = simplexml_load_string($response,'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
$cleanexit = 1;
|
||||
break;
|
||||
}
|
||||
} // End of while(!feof($fp))
|
||||
// Look for serverdone response
|
||||
$fullpattern = '/<xcatresponse>\s*<serverdone>\s*<\/serverdone>\s*<\/xcatresponse>/';
|
||||
$mixedpattern = '/<serverdone>\s*<\/serverdone>.*<\/xcatresponse>/';
|
||||
$recentpattern = '/<\/xcatresponse>/';
|
||||
if (preg_match($recentpattern,$str) && preg_match($mixedpattern,$response)) {
|
||||
// Transaction is done, package up XML and return it
|
||||
// Remove the serverdone response and put an xcat tag around the rest
|
||||
$count = 0;
|
||||
$response = preg_replace($fullpattern,'', $response, -1, $count); // 1st try to remove the long pattern
|
||||
if (!$count) {
|
||||
$response = preg_replace($mixedpattern,'', $response) . '</xcatresponse>/';
|
||||
}
|
||||
$response = "<xcat>$response</xcat>";
|
||||
$response = preg_replace('/>\n\s*</', '><', $response);
|
||||
$response = preg_replace('/\n/', ':|:', $response);
|
||||
$rsp = simplexml_load_string($response,'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
$cleanexit = 1;
|
||||
break;
|
||||
}
|
||||
} // End of while(!feof($fp))
|
||||
|
||||
syslog(LOG_INFO, "($cmd $nr) Sending response");
|
||||
fclose($fp);
|
||||
} else {
|
||||
echo "<p>xCAT submit request socket error: $errno - $errstr</p>";
|
||||
}
|
||||
syslog(LOG_INFO, "($cmd $nr) Sending response");
|
||||
fclose($fp);
|
||||
} else {
|
||||
echo "<p>xCAT submit request socket error: $errno - $errstr</p>";
|
||||
}
|
||||
|
||||
// Flush (send) the output buffer and turn off output buffering
|
||||
ob_end_flush();
|
||||
// Flush (send) the output buffer and turn off output buffering
|
||||
ob_end_flush();
|
||||
|
||||
// Close syslog
|
||||
closelog();
|
||||
// Close syslog
|
||||
closelog();
|
||||
|
||||
if(! $cleanexit) {
|
||||
if (preg_match('/^\s*<xcatresponse>.*<\/xcatresponse>\s*$/',$response)) {
|
||||
// Probably an error message
|
||||
$response = "<xcat>$response</xcat>";
|
||||
$rsp = simplexml_load_string($response,'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
} else if(!$skipVerify) {
|
||||
echo "<p>(Error) xCAT response ended prematurely: ", htmlentities($response), "</p>";
|
||||
$rsp = FALSE;
|
||||
}
|
||||
}
|
||||
return $rsp;
|
||||
if (!$cleanexit) {
|
||||
if (preg_match('/^\s*<xcatresponse>.*<\/xcatresponse>\s*$/',$response)) {
|
||||
// Probably an error message
|
||||
$response = "<xcat>$response</xcat>";
|
||||
$rsp = simplexml_load_string($response,'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
} else if (!$skipVerify) {
|
||||
echo "<p>(Error) xCAT response ended prematurely: ", htmlentities($response), "</p>";
|
||||
$rsp = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable password storage to split between cookie and session variable
|
||||
*/
|
||||
function xorcrypt($data, $key) {
|
||||
$datalen = strlen($data);
|
||||
$keylen = strlen($key);
|
||||
for ($i=0;$i<$datalen;$i++) {
|
||||
$data[$i] = chr(ord($data[$i])^ord($key[$i]));
|
||||
}
|
||||
$datalen = strlen($data);
|
||||
$keylen = strlen($key);
|
||||
for ($i=0;$i<$datalen;$i++) {
|
||||
$data[$i] = chr(ord($data[$i])^ord($key[$i]));
|
||||
}
|
||||
|
||||
return $data;
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get password
|
||||
*/
|
||||
function getpassword() {
|
||||
if (isset($GLOBALS['xcatauthsecret'])) {
|
||||
$cryptext = $GLOBALS['xcatauthsecret'];
|
||||
} else if (isset($_COOKIE["xcatauthsecret"])) {
|
||||
$cryptext = $_COOKIE["xcatauthsecret"];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (isset($GLOBALS['xcatauthsecret'])) {
|
||||
$cryptext = $GLOBALS['xcatauthsecret'];
|
||||
} else if (isset($_COOKIE["xcatauthsecret"])) {
|
||||
$cryptext = $_COOKIE["xcatauthsecret"];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return xorcrypt($_SESSION["secretkey"], base64_decode($cryptext));
|
||||
return xorcrypt($_SESSION["secretkey"], base64_decode($cryptext));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -209,15 +220,15 @@ function getpassword() {
|
||||
* @param $password Password
|
||||
*/
|
||||
function setpassword($password) {
|
||||
$randlen = strlen($password);
|
||||
$key = getrandchars($randlen);
|
||||
$cryptext = xorcrypt($password,$key);
|
||||
$randlen = strlen($password);
|
||||
$key = getrandchars($randlen);
|
||||
$cryptext = xorcrypt($password,$key);
|
||||
|
||||
// Non-ascii characters, encode it in base64
|
||||
$cryptext = base64_encode($cryptext);
|
||||
setcookie("xcatauthsecret",$cryptext,0,'/');
|
||||
$GLOBALS["xcatauthsecret"] = $cryptext;
|
||||
$_SESSION["secretkey"] = $key;
|
||||
// Non-ascii characters, encode it in base64
|
||||
$cryptext = base64_encode($cryptext);
|
||||
setcookie("xcatauthsecret",$cryptext,0,'/');
|
||||
$GLOBALS["xcatauthsecret"] = $cryptext;
|
||||
$_SESSION["secretkey"] = $key;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -227,16 +238,16 @@ function setpassword($password) {
|
||||
* @return RAND characters
|
||||
*/
|
||||
function getrandchars($length) {
|
||||
$charset = '0123456789abcdefghijklmnopqrstuvwxyz!@#$%^&*';
|
||||
$charsize = strlen($charset);
|
||||
srand();
|
||||
$chars = '';
|
||||
for ($i=0;$i<$length;$i++) {
|
||||
$num=rand()%$charsize;
|
||||
$chars=$chars.substr($charset,$num,1);
|
||||
}
|
||||
$charset = '0123456789abcdefghijklmnopqrstuvwxyz!@#$%^&*';
|
||||
$charsize = strlen($charset);
|
||||
srand();
|
||||
$chars = '';
|
||||
for ($i=0;$i<$length;$i++) {
|
||||
$num=rand()%$charsize;
|
||||
$chars=$chars.substr($charset,$num,1);
|
||||
}
|
||||
|
||||
return $chars;
|
||||
return $chars;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -245,11 +256,11 @@ function getrandchars($length) {
|
||||
* @return True if user has a session, false otherwise
|
||||
*/
|
||||
function is_logged() {
|
||||
if (isset($_SESSION["username"]) and !is_bool(getpassword())) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (isset($_SESSION["username"]) and !is_bool(getpassword())) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -258,27 +269,27 @@ function is_logged() {
|
||||
* @return True if the user is currently logged in successfully, false otherwise
|
||||
*/
|
||||
function isAuthenticated() {
|
||||
if (is_logged()) {
|
||||
if ($_SESSION["xcatpassvalid"] != 1) {
|
||||
$testcred = docmd("authcheck", "", NULL, NULL);
|
||||
if (isset($testcred->{'xcatresponse'}->{'data'})) {
|
||||
$result = "".$testcred->{'xcatresponse'}->{'data'};
|
||||
if (is_numeric(strpos("Authenticated",$result))) {
|
||||
// Logged in successfully
|
||||
$_SESSION["xcatpassvalid"] = 1;
|
||||
} else {
|
||||
// Not logged in
|
||||
$_SESSION["xcatpassvalid"] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_logged()) {
|
||||
if ($_SESSION["xcatpassvalid"] != 1) {
|
||||
$testcred = docmd("authcheck", "", NULL, NULL);
|
||||
if (isset($testcred->{'xcatresponse'}->{'data'})) {
|
||||
$result = "".$testcred->{'xcatresponse'}->{'data'};
|
||||
if (is_numeric(strpos("Authenticated",$result))) {
|
||||
// Logged in successfully
|
||||
$_SESSION["xcatpassvalid"] = 1;
|
||||
} else {
|
||||
// Not logged in
|
||||
$_SESSION["xcatpassvalid"] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_SESSION["xcatpassvalid"]) and $_SESSION["xcatpassvalid"]==1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (isset($_SESSION["xcatpassvalid"]) and $_SESSION["xcatpassvalid"]==1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -287,70 +298,70 @@ function isAuthenticated() {
|
||||
* @return True if the user has root access, false otherwise
|
||||
*/
|
||||
function isRootAcess() {
|
||||
if (is_logged() && $_SESSION["xcatpassvalid"]) {
|
||||
$testacc = docmd('tabdump', '', array('policy', '-w', "name==" . $_SESSION["username"]), array());
|
||||
if (isset($testacc->{'xcatresponse'}->{'data'}->{1})) {
|
||||
$result = $testacc->{'xcatresponse'}->{'data'}->{1};
|
||||
$result = str_replace('"', '', $result);
|
||||
$args = array();
|
||||
$args = explode(",", $result);
|
||||
if (is_logged() && $_SESSION["xcatpassvalid"]) {
|
||||
$testacc = docmd('tabdump', '', array('policy', '-w', "name==" . $_SESSION["username"]), array());
|
||||
if (isset($testacc->{'xcatresponse'}->{'data'}->{1})) {
|
||||
$result = $testacc->{'xcatresponse'}->{'data'}->{1};
|
||||
$result = str_replace('"', '', $result);
|
||||
$args = array();
|
||||
$args = explode(",", $result);
|
||||
|
||||
// Get the comments which contains the privilege
|
||||
$comments = $args[8];
|
||||
$args = explode(";", $comments);
|
||||
// Default privilege is guest
|
||||
$privilege = 'guest';
|
||||
$_SESSION["xcatpassvalid"] = 0;
|
||||
foreach ($args as $arg) {
|
||||
// Get user privilege
|
||||
if ($arg && is_numeric(strpos($arg, "privilege"))) {
|
||||
if (is_numeric(strpos($arg, "root"))) {
|
||||
// Set privilege to root
|
||||
$privilege = 'root';
|
||||
$_SESSION["xcatpassvalid"] = 1;
|
||||
}
|
||||
// Get the comments which contains the privilege
|
||||
$comments = $args[8];
|
||||
$args = explode(";", $comments);
|
||||
// Default privilege is guest
|
||||
$privilege = 'guest';
|
||||
$_SESSION["xcatpassvalid"] = 0;
|
||||
foreach ($args as $arg) {
|
||||
// Get user privilege
|
||||
if ($arg && is_numeric(strpos($arg, "privilege"))) {
|
||||
if (is_numeric(strpos($arg, "root"))) {
|
||||
// Set privilege to root
|
||||
$privilege = 'root';
|
||||
$_SESSION["xcatpassvalid"] = 1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp($_SESSION["username"], 'root') == 0) {
|
||||
$_SESSION["xcatpassvalid"] = 1;
|
||||
}
|
||||
if (strcmp($_SESSION["username"], 'root') == 0) {
|
||||
$_SESSION["xcatpassvalid"] = 1;
|
||||
}
|
||||
|
||||
if (isset($_SESSION["xcatpassvalid"]) and $_SESSION["xcatpassvalid"]==1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (isset($_SESSION["xcatpassvalid"]) and $_SESSION["xcatpassvalid"]==1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log out of current user session
|
||||
*/
|
||||
function logout() {
|
||||
// Clear the secret cookie from browser
|
||||
if (isset($_COOKIE["xcatauthsecret"])) {
|
||||
setcookie("xcatauthsecret",'',time()-86400*7,'/');
|
||||
}
|
||||
// Clear the secret cookie from browser
|
||||
if (isset($_COOKIE["xcatauthsecret"])) {
|
||||
setcookie("xcatauthsecret",'',time()-86400*7,'/');
|
||||
}
|
||||
|
||||
// Expire session cookie
|
||||
if (isset($_COOKIE[session_name()])) {
|
||||
setcookie(session_name(),"",time()-86400*7,"/");
|
||||
}
|
||||
// Expire session cookie
|
||||
if (isset($_COOKIE[session_name()])) {
|
||||
setcookie(session_name(),"",time()-86400*7,"/");
|
||||
}
|
||||
|
||||
// Clear server store of data
|
||||
$_SESSION=array();
|
||||
// Clear server store of data
|
||||
$_SESSION=array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a given string and echo it back to the browser
|
||||
*/
|
||||
function format_TBD($str) {
|
||||
// Format a given string however you want it
|
||||
echo $tmp . '<br/>';
|
||||
flush();
|
||||
// Format a given string however you want it
|
||||
echo $tmp . '<br/>';
|
||||
flush();
|
||||
}
|
||||
?>
|
||||
|
||||
+12
-12
@@ -11,29 +11,29 @@ header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
if (isset($_REQUEST["password"])) {
|
||||
// Clear data from session
|
||||
$_SESSION = array();
|
||||
// Clear data from session
|
||||
$_SESSION = array();
|
||||
|
||||
// Zap existing session entirely
|
||||
session_regenerate_id(true);
|
||||
setpassword($_REQUEST["password"]);
|
||||
// Zap existing session entirely
|
||||
session_regenerate_id(true);
|
||||
setpassword($_REQUEST["password"]);
|
||||
|
||||
// Invalid password
|
||||
$_SESSION["xcatpassvalid"] = -1;
|
||||
// Invalid password
|
||||
$_SESSION["xcatpassvalid"] = -1;
|
||||
}
|
||||
|
||||
if (isset($_REQUEST["username"])) {
|
||||
$_SESSION["username"] = $_REQUEST["username"];
|
||||
$_SESSION["username"] = $_REQUEST["username"];
|
||||
|
||||
// Invalid user name
|
||||
$_SESSION["xcatpassvalid"]=-1;
|
||||
// Invalid user name
|
||||
$_SESSION["xcatpassvalid"]=-1;
|
||||
}
|
||||
|
||||
$jdata = array();
|
||||
if (isAuthenticated() && isRootAcess()) {
|
||||
$jdata["authenticated"]="yes";
|
||||
$jdata["authenticated"]="yes";
|
||||
} else {
|
||||
$jdata["authenticated"]="no";
|
||||
$jdata["authenticated"]="no";
|
||||
}
|
||||
|
||||
echo json_encode($jdata);
|
||||
|
||||
+59
-59
@@ -7,90 +7,90 @@ $output = '';
|
||||
$temp = '';
|
||||
$pythonProcess = '';
|
||||
if (!isAuthenticated()) {
|
||||
echo ("Please login before continuing!");
|
||||
echo ("Please login before continuing!");
|
||||
}
|
||||
|
||||
$query = 's=' . $_POST['s'] . '&w=' . $_POST['w'] . '&h=' . $_POST['h'];
|
||||
if (isset($_POST['q'])) {
|
||||
$query .= '&q=1';
|
||||
$query .= '&q=1';
|
||||
} else {
|
||||
$query .= '&q=0';
|
||||
$query .= '&q=0';
|
||||
}
|
||||
|
||||
if (isset($_POST['f'])) {
|
||||
$pythonProcess = exec('ps -aef | grep -v grep | grep ajaxterm.py');
|
||||
if ('' == $pythonProcess) {
|
||||
exec('nohup ' . dirname(__FILE__) . '/ajaxterm/ajaxterm.py >/dev/null 2>&1 &');
|
||||
}
|
||||
sleep(1);
|
||||
$pythonProcess = exec('ps -aef | grep -v grep | grep ajaxterm.py');
|
||||
if ('' == $pythonProcess) {
|
||||
exec('nohup ' . dirname(__FILE__) . '/ajaxterm/ajaxterm.py >/dev/null 2>&1 &');
|
||||
}
|
||||
sleep(1);
|
||||
|
||||
$temp = $query . '&k=' . urlencode($_SESSION["username"] . "\r");
|
||||
$output = rconsSynchronise($temp);
|
||||
if (0 < substr_count($output, 'error')) {
|
||||
echo json_encode(array('err'=>$output));
|
||||
exit;
|
||||
}
|
||||
sleep(1);
|
||||
$temp = $query . '&k=' . urlencode($_SESSION["username"] . "\r");
|
||||
$output = rconsSynchronise($temp);
|
||||
if (0 < substr_count($output, 'error')) {
|
||||
echo json_encode(array('err'=>$output));
|
||||
exit;
|
||||
}
|
||||
sleep(1);
|
||||
|
||||
$temp = $query . '&k=' . urlencode(getpassword() . "\r");
|
||||
$output = rconsSynchronise($temp);
|
||||
if (0 < substr_count($output, 'error')) {
|
||||
echo json_encode(array('err'=>$output));
|
||||
exit;
|
||||
}
|
||||
sleep(1);
|
||||
$temp = $query . '&k=' . urlencode(getpassword() . "\r");
|
||||
$output = rconsSynchronise($temp);
|
||||
if (0 < substr_count($output, 'error')) {
|
||||
echo json_encode(array('err'=>$output));
|
||||
exit;
|
||||
}
|
||||
sleep(1);
|
||||
|
||||
$temp = $query . '&c=1&k=' . urlencode('rcons ' . $_POST['s'] . "\r");
|
||||
$temp = $query . '&c=1&k=' . urlencode('rcons ' . $_POST['s'] . "\r");
|
||||
} else {
|
||||
$temp = $query . '&c=1&k=' . urlencode($_POST['k']);
|
||||
$temp = $query . '&c=1&k=' . urlencode($_POST['k']);
|
||||
}
|
||||
|
||||
$output = rconsSynchronise($temp);
|
||||
if (0 < substr_count($output, 'error')) {
|
||||
echo (array('err'=>$output));
|
||||
echo (array('err'=>$output));
|
||||
} else {
|
||||
$xml = simplexml_load_string($output);
|
||||
if ('pre' == $xml->getName()) {
|
||||
$output = $xml->asXML();
|
||||
$output = preg_replace('/'. chr(160) . '/', ' ', $output);
|
||||
$xml = simplexml_load_string($output);
|
||||
if ('pre' == $xml->getName()) {
|
||||
$output = $xml->asXML();
|
||||
$output = preg_replace('/'. chr(160) . '/', ' ', $output);
|
||||
|
||||
echo json_encode(array('term'=>$output));
|
||||
} else {
|
||||
echo json_encode(array('nc'=>'nc'));
|
||||
}
|
||||
echo json_encode(array('term'=>$output));
|
||||
} else {
|
||||
echo json_encode(array('nc'=>'nc'));
|
||||
}
|
||||
}
|
||||
|
||||
function rconsSynchronise($parameter) {
|
||||
$flag = false;
|
||||
$return = "";
|
||||
$out = "";
|
||||
$fp = fsockopen("127.0.0.1", 8022, $errno, $errstr, 30);
|
||||
if (!$fp) {
|
||||
return "<error>$errstr($errno)</error>";
|
||||
}
|
||||
$flag = false;
|
||||
$return = "";
|
||||
$out = "";
|
||||
$fp = fsockopen("127.0.0.1", 8022, $errno, $errstr, 30);
|
||||
if (!$fp) {
|
||||
return "<error>$errstr($errno)</error>";
|
||||
}
|
||||
|
||||
$out = "GET /u?$parameter HTTP/1.1\r\nHost: 127.0.0.1:8022\r\nConnection: Close\r\n\r\n";
|
||||
$out = "GET /u?$parameter HTTP/1.1\r\nHost: 127.0.0.1:8022\r\nConnection: Close\r\n\r\n";
|
||||
|
||||
fwrite($fp, $out);
|
||||
while (!feof($fp)) {
|
||||
$line = fgets($fp,1024);
|
||||
if (0 == strlen($line)) {
|
||||
continue;
|
||||
}
|
||||
fwrite($fp, $out);
|
||||
while (!feof($fp)) {
|
||||
$line = fgets($fp,1024);
|
||||
if (0 == strlen($line)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ('<' == substr($line, 0, 1)) {
|
||||
$flag = true;
|
||||
$return .= $line;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ('<' == substr($line, 0, 1)) {
|
||||
$flag = true;
|
||||
$return .= $line;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($flag) {
|
||||
while (!feof($fp)) {
|
||||
$return .= fgets($fp, 1024);
|
||||
}
|
||||
}
|
||||
if ($flag) {
|
||||
while (!feof($fp)) {
|
||||
$return .= fgets($fp, 1024);
|
||||
}
|
||||
}
|
||||
|
||||
return ($return);
|
||||
return ($return);
|
||||
}
|
||||
?>
|
||||
+123
-123
@@ -15,102 +15,102 @@ require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
* @return The xCAT response. Replies are in the form of JSON
|
||||
*/
|
||||
if (isset($_GET["cmd"])) {
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$tgt = $_GET["tgt"];
|
||||
$args = $_GET["args"];
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$tgt = $_GET["tgt"];
|
||||
$args = $_GET["args"];
|
||||
|
||||
// Special messages put here
|
||||
// This gets sent back to the AJAX request as is.
|
||||
$msg = $_GET["msg"];
|
||||
// Special messages put here
|
||||
// This gets sent back to the AJAX request as is.
|
||||
$msg = $_GET["msg"];
|
||||
|
||||
// If no $tgt is given, set $tgt to NULL
|
||||
if (!$tgt) {
|
||||
$tgt = NULL;
|
||||
}
|
||||
// If no $tgt is given, set $tgt to NULL
|
||||
if (!$tgt) {
|
||||
$tgt = NULL;
|
||||
}
|
||||
|
||||
// If no $msg is given, set $msg to NULL
|
||||
if (!$msg) {
|
||||
$msg = NULL;
|
||||
}
|
||||
// If no $msg is given, set $msg to NULL
|
||||
if (!$msg) {
|
||||
$msg = NULL;
|
||||
}
|
||||
|
||||
// If no $args are given, set $args_array to NULL
|
||||
$args_array = array();
|
||||
if ($args) {
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($args,";")) {
|
||||
// Split the arguments into an array
|
||||
$args_array = array();
|
||||
$args_array = explode(";", $args);
|
||||
} else {
|
||||
$args_array = array($args);
|
||||
}
|
||||
}
|
||||
// If no $args are given, set $args_array to NULL
|
||||
$args_array = array();
|
||||
if ($args) {
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($args,";")) {
|
||||
// Split the arguments into an array
|
||||
$args_array = array();
|
||||
$args_array = explode(";", $args);
|
||||
} else {
|
||||
$args_array = array($args);
|
||||
}
|
||||
}
|
||||
|
||||
// If no $opts are given, set $opts_array to NULL
|
||||
$opts_array = array();
|
||||
if (isset($_GET["opts"])) {
|
||||
$opts = $_GET["opts"];
|
||||
// If no $opts are given, set $opts_array to NULL
|
||||
$opts_array = array();
|
||||
if (isset($_GET["opts"])) {
|
||||
$opts = $_GET["opts"];
|
||||
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($opts,";")) {
|
||||
// Split the arguments into an array
|
||||
$opts_array = array();
|
||||
$opts_array = explode(";", $opts);
|
||||
} else {
|
||||
$opts_array = array($opts);
|
||||
}
|
||||
}
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($opts,";")) {
|
||||
// Split the arguments into an array
|
||||
$opts_array = array();
|
||||
$opts_array = explode(";", $opts);
|
||||
} else {
|
||||
$opts_array = array($opts);
|
||||
}
|
||||
}
|
||||
|
||||
// Submit request and get response
|
||||
$xml = docmd($cmd, $tgt, $args_array, $opts_array);
|
||||
// If the output is flushed, do not return output in JSON
|
||||
if (in_array("flush", $opts_array)) {
|
||||
return;
|
||||
}
|
||||
// Submit request and get response
|
||||
$xml = docmd($cmd, $tgt, $args_array, $opts_array);
|
||||
// If the output is flushed, do not return output in JSON
|
||||
if (in_array("flush", $opts_array)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$rsp = array();
|
||||
$rsp = array();
|
||||
|
||||
// webrun pping and gangliastatus output needs special handling
|
||||
if(strncasecmp($cmd, "webrun", 6) == 0 && (stristr($args, "pping") || stristr($args, "gangliastatus") || stristr($args, "chtab"))) {
|
||||
$rsp = extractWebrun($xml);
|
||||
}
|
||||
// nodels output needs special handling
|
||||
else if(strncasecmp($cmd, "nodels", 6) == 0) {
|
||||
// Handle the output the same way as webrun
|
||||
$rsp = extractNodels($xml);
|
||||
}
|
||||
// extnoderange output needs special handling
|
||||
// This command gets the nodes and groups
|
||||
else if(strncasecmp($cmd, "extnoderange", 12) == 0) {
|
||||
$rsp = extractExtnoderange($xml);
|
||||
}
|
||||
// Handle the typical output
|
||||
else {
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
if($data->name) {
|
||||
$node = $data->name;
|
||||
// webrun pping and gangliastatus output needs special handling
|
||||
if(strncasecmp($cmd, "webrun", 6) == 0 && (stristr($args, "pping") || stristr($args, "gangliastatus") || stristr($args, "chtab"))) {
|
||||
$rsp = extractWebrun($xml);
|
||||
}
|
||||
// nodels output needs special handling
|
||||
else if(strncasecmp($cmd, "nodels", 6) == 0) {
|
||||
// Handle the output the same way as webrun
|
||||
$rsp = extractNodels($xml);
|
||||
}
|
||||
// extnoderange output needs special handling
|
||||
// This command gets the nodes and groups
|
||||
else if(strncasecmp($cmd, "extnoderange", 12) == 0) {
|
||||
$rsp = extractExtnoderange($xml);
|
||||
}
|
||||
// Handle the typical output
|
||||
else {
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
if($data->name) {
|
||||
$node = $data->name;
|
||||
|
||||
if($data->data->contents){
|
||||
$cont = $data->data->contents;
|
||||
} else {
|
||||
$cont = $data->data;
|
||||
}
|
||||
if($data->data->contents){
|
||||
$cont = $data->data->contents;
|
||||
} else {
|
||||
$cont = $data->data;
|
||||
}
|
||||
|
||||
$cont = str_replace(":|:", "\n", $cont);
|
||||
array_push($rsp, "$node: $cont");
|
||||
} else if (strlen("$data") > 2) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$cont = str_replace(":|:", "\n", $cont);
|
||||
array_push($rsp, "$node: $cont");
|
||||
} else if (strlen("$data") > 2) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reply in the form of JSON
|
||||
$rtn = array("rsp" => $rsp, "msg" => $msg);
|
||||
echo json_encode($rtn);
|
||||
// Reply in the form of JSON
|
||||
$rtn = array("rsp" => $rsp, "msg" => $msg);
|
||||
echo json_encode($rtn);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,26 +120,26 @@ if (isset($_GET["cmd"])) {
|
||||
* @return An array containing the output
|
||||
*/
|
||||
function extractWebrun($xml) {
|
||||
$rsp = array();
|
||||
$i = 0;
|
||||
$rsp = array();
|
||||
$i = 0;
|
||||
|
||||
// Extract data returned
|
||||
foreach($xml->children() as $nodes){
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
// Extract data returned
|
||||
foreach($xml->children() as $nodes){
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
|
||||
// Get the content
|
||||
$status = $node->data;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
// Get the content
|
||||
$status = $node->data;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
|
||||
// Add to return array
|
||||
$rsp[$i] = array("$name", "$status");
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
// Add to return array
|
||||
$rsp[$i] = array("$name", "$status");
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
return $rsp;
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -149,26 +149,26 @@ function extractWebrun($xml) {
|
||||
* @return An array containing the output
|
||||
*/
|
||||
function extractNodels($xml) {
|
||||
$rsp = array();
|
||||
$i = 0;
|
||||
$rsp = array();
|
||||
$i = 0;
|
||||
|
||||
// Extract data returned
|
||||
foreach($xml->children() as $nodes){
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
// Get the content
|
||||
$status = $node->data->contents;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
// Extract data returned
|
||||
foreach($xml->children() as $nodes){
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
// Get the content
|
||||
$status = $node->data->contents;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
|
||||
$description = $node->data->desc;
|
||||
// Add to return array
|
||||
$rsp[$i] = array("$name", "$status", "$description");
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$description = $node->data->desc;
|
||||
// Add to return array
|
||||
$rsp[$i] = array("$name", "$status", "$description");
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
return $rsp;
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -178,13 +178,13 @@ function extractNodels($xml) {
|
||||
* @return The nodes and groups
|
||||
*/
|
||||
function extractExtnoderange($xml) {
|
||||
$rsp = array();
|
||||
$rsp = array();
|
||||
|
||||
// Extract data returned
|
||||
foreach ($xml->xcatresponse->intersectinggroups as $group) {
|
||||
array_push($rsp, "$group");
|
||||
}
|
||||
// Extract data returned
|
||||
foreach ($xml->xcatresponse->intersectinggroups as $group) {
|
||||
array_push($rsp, "$group");
|
||||
}
|
||||
|
||||
return $rsp;
|
||||
return $rsp;
|
||||
}
|
||||
?>
|
||||
+39
-39
@@ -12,9 +12,9 @@ require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
* @return The xCAT response. Replies are in the form of JSON
|
||||
*/
|
||||
if (isset($_POST["table"])) {
|
||||
// HTTP POST requests
|
||||
$tab = $_POST["table"];
|
||||
$cont = $_POST["cont"];
|
||||
// HTTP POST requests
|
||||
$tab = $_POST["table"];
|
||||
$cont = $_POST["cont"];
|
||||
}
|
||||
|
||||
// Create xCAT request
|
||||
@@ -31,46 +31,46 @@ $usernode->addChild('password', getpassword());
|
||||
// Go through each table row
|
||||
$first = 0;
|
||||
foreach($cont as $line){
|
||||
if($first == 0){
|
||||
// The 1st line is the table header
|
||||
// It does not need special processing
|
||||
// Create string containing all array elements
|
||||
$str = implode(",", $line);
|
||||
$request->addChild('data', $str);
|
||||
if($first == 0){
|
||||
// The 1st line is the table header
|
||||
// It does not need special processing
|
||||
// Create string containing all array elements
|
||||
$str = implode(",", $line);
|
||||
$request->addChild('data', $str);
|
||||
|
||||
$first = 1;
|
||||
continue;
|
||||
}
|
||||
$first = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Go through each column
|
||||
foreach ($line as &$col){
|
||||
// If the column does begins and end with a quote
|
||||
// Change quotes to "
|
||||
if(!empty($col) && !preg_match('/^".*"$/', $col)) {
|
||||
$col = '"' . $col . '"';
|
||||
}
|
||||
}
|
||||
// Go through each column
|
||||
foreach ($line as &$col){
|
||||
// If the column does begins and end with a quote
|
||||
// Change quotes to "
|
||||
if(!empty($col) && !preg_match('/^".*"$/', $col)) {
|
||||
$col = '"' . $col . '"';
|
||||
}
|
||||
}
|
||||
|
||||
// Sort line
|
||||
ksort($line, SORT_NUMERIC);
|
||||
$keys = array_keys($line);
|
||||
$max = count($line) - 1;
|
||||
if ($keys[$max] != $max){
|
||||
for ($i = 0; $i <= $keys[$max]; $i++) {
|
||||
if (!isset($line[$i])) {
|
||||
$line[$i]='';
|
||||
}
|
||||
}
|
||||
ksort($line, SORT_NUMERIC);
|
||||
}
|
||||
// Sort line
|
||||
ksort($line, SORT_NUMERIC);
|
||||
$keys = array_keys($line);
|
||||
$max = count($line) - 1;
|
||||
if ($keys[$max] != $max){
|
||||
for ($i = 0; $i <= $keys[$max]; $i++) {
|
||||
if (!isset($line[$i])) {
|
||||
$line[$i]='';
|
||||
}
|
||||
}
|
||||
ksort($line, SORT_NUMERIC);
|
||||
}
|
||||
|
||||
// Create string containing all array elements
|
||||
$str = implode(",", $line);
|
||||
// Replace " with "
|
||||
$str = str_replace('"', '"', $str);
|
||||
// Replace ' with '
|
||||
$str = str_replace("'", ''', $str);
|
||||
$request->addChild('data', $str);
|
||||
// Create string containing all array elements
|
||||
$str = implode(",", $line);
|
||||
// Replace " with "
|
||||
$str = str_replace('"', '"', $str);
|
||||
// Replace ' with '
|
||||
$str = str_replace("'", ''', $str);
|
||||
$request->addChild('data', $str);
|
||||
}
|
||||
|
||||
// Run command
|
||||
|
||||
+102
-102
@@ -13,125 +13,125 @@ require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
* @return The xCAT response. Replies are in the form of JSON
|
||||
*/
|
||||
if (isset($_GET["cmd"])) {
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$tgt = $_GET["tgt"];
|
||||
$args = $_GET["args"];
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$tgt = $_GET["tgt"];
|
||||
$args = $_GET["args"];
|
||||
|
||||
// Attachments are put here
|
||||
$att = $_GET["att"];
|
||||
// Attachments are put here
|
||||
$att = $_GET["att"];
|
||||
|
||||
// Special messages put here
|
||||
$msg = $_GET["msg"];
|
||||
// Special messages put here
|
||||
$msg = $_GET["msg"];
|
||||
|
||||
// If no $tgt is given, set $tgt to NULL
|
||||
if (!$tgt) {
|
||||
$tgt = NULL;
|
||||
}
|
||||
// If no $tgt is given, set $tgt to NULL
|
||||
if (!$tgt) {
|
||||
$tgt = NULL;
|
||||
}
|
||||
|
||||
// If no $args is given, set $args to NULL
|
||||
if (!$args) {
|
||||
$args = NULL;
|
||||
}
|
||||
// If no $args is given, set $args to NULL
|
||||
if (!$args) {
|
||||
$args = NULL;
|
||||
}
|
||||
|
||||
// If no $msg is given, set $msg to NULL
|
||||
if (!$msg) {
|
||||
$msg = NULL;
|
||||
}
|
||||
// If no $msg is given, set $msg to NULL
|
||||
if (!$msg) {
|
||||
$msg = NULL;
|
||||
}
|
||||
|
||||
// If no $att is given, set $att to NULL
|
||||
if (!$att) {
|
||||
$att = NULL;
|
||||
}
|
||||
// If no $att is given, set $att to NULL
|
||||
if (!$att) {
|
||||
$att = NULL;
|
||||
}
|
||||
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($args,";")) {
|
||||
// Split the arguments into an array
|
||||
$arr = array();
|
||||
$arr = explode(";", $args);
|
||||
} else {
|
||||
$arr = array($args);
|
||||
}
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($args,";")) {
|
||||
// Split the arguments into an array
|
||||
$arr = array();
|
||||
$arr = explode(";", $args);
|
||||
} else {
|
||||
$arr = array($args);
|
||||
}
|
||||
|
||||
$rsp = array();
|
||||
$rsp = array();
|
||||
|
||||
// Replace user entry
|
||||
if (strncasecmp($cmd, "chvm", 4) == 0 && strncasecmp($arr[0], "--replacevs", 11) == 0) {
|
||||
// Directory /var/tmp permissions = 777
|
||||
// You can write anything to that directory
|
||||
$userEntry = "/var/tmp/$tgt.txt";
|
||||
$handle = fopen($userEntry, 'w') or die("Cannot open $userEntry");
|
||||
fwrite($handle, $att);
|
||||
fclose($handle);
|
||||
// Replace user entry
|
||||
if (strncasecmp($cmd, "chvm", 4) == 0 && strncasecmp($arr[0], "--replacevs", 11) == 0) {
|
||||
// Directory /var/tmp permissions = 777
|
||||
// You can write anything to that directory
|
||||
$userEntry = "/var/tmp/$tgt.txt";
|
||||
$handle = fopen($userEntry, 'w') or die("Cannot open $userEntry");
|
||||
fwrite($handle, $att);
|
||||
fclose($handle);
|
||||
|
||||
// CLI command: chvm gpok249 --replacevs /tmp/dirEntry.txt
|
||||
// Replace user entry
|
||||
array_push($arr, $userEntry);
|
||||
$xml = docmd($cmd, $tgt, $arr, NULL);
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
}
|
||||
// CLI command: chvm gpok249 --replacevs /tmp/dirEntry.txt
|
||||
// Replace user entry
|
||||
array_push($arr, $userEntry);
|
||||
$xml = docmd($cmd, $tgt, $arr, NULL);
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create virtual server
|
||||
else if (strncasecmp($cmd, "mkvm", 4) == 0) {
|
||||
// Directory /var/tmp permissions = 777
|
||||
// You can write anything to that directory
|
||||
$userEntry = "/var/tmp/$tgt.txt";
|
||||
$handle = fopen($userEntry, 'w') or die("Cannot open $userEntry");
|
||||
fwrite($handle, $att);
|
||||
fclose($handle);
|
||||
// Create virtual server
|
||||
else if (strncasecmp($cmd, "mkvm", 4) == 0) {
|
||||
// Directory /var/tmp permissions = 777
|
||||
// You can write anything to that directory
|
||||
$userEntry = "/var/tmp/$tgt.txt";
|
||||
$handle = fopen($userEntry, 'w') or die("Cannot open $userEntry");
|
||||
fwrite($handle, $att);
|
||||
fclose($handle);
|
||||
|
||||
// CLI command: mkvm gpok3 /tmp/gpok3.txt
|
||||
// Create user entry
|
||||
array_unshift($arr, $userEntry);
|
||||
$xml = docmd($cmd, $tgt, $arr, NULL);
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
}
|
||||
// CLI command: mkvm gpok3 /tmp/gpok3.txt
|
||||
// Create user entry
|
||||
array_unshift($arr, $userEntry);
|
||||
$xml = docmd($cmd, $tgt, $arr, NULL);
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Run shell script
|
||||
// This is a typical command used by all platforms. It is put here because
|
||||
// most of the code needed are already here
|
||||
else if (strncasecmp($cmd, "xdsh", 4) == 0) {
|
||||
// Directory /var/tmp permissions = 777
|
||||
// You can write anything to that directory
|
||||
$msgArgs = explode(";", $msg);
|
||||
$inst = str_replace("out=scriptStatusBar", "", $msgArgs[0]);
|
||||
$script = "/var/tmp/script$inst.sh";
|
||||
// Run shell script
|
||||
// This is a typical command used by all platforms. It is put here because
|
||||
// most of the code needed are already here
|
||||
else if (strncasecmp($cmd, "xdsh", 4) == 0) {
|
||||
// Directory /var/tmp permissions = 777
|
||||
// You can write anything to that directory
|
||||
$msgArgs = explode(";", $msg);
|
||||
$inst = str_replace("out=scriptStatusBar", "", $msgArgs[0]);
|
||||
$script = "/var/tmp/script$inst.sh";
|
||||
|
||||
// Write to file
|
||||
$handle = fopen($script, 'w') or die("Cannot open $script");
|
||||
fwrite($handle, $att);
|
||||
fclose($handle);
|
||||
// Write to file
|
||||
$handle = fopen($script, 'w') or die("Cannot open $script");
|
||||
fwrite($handle, $att);
|
||||
fclose($handle);
|
||||
|
||||
// Change it to executable
|
||||
chmod($script, 0777);
|
||||
// Change it to executable
|
||||
chmod($script, 0777);
|
||||
|
||||
// CLI command: xdsh gpok3 -e /var/tmp/gpok3.sh
|
||||
// Create user entry
|
||||
array_push($arr, $script);
|
||||
$xml = docmd($cmd, $tgt, $arr, NULL);
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
// CLI command: xdsh gpok3 -e /var/tmp/gpok3.sh
|
||||
// Create user entry
|
||||
array_push($arr, $script);
|
||||
$xml = docmd($cmd, $tgt, $arr, NULL);
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
|
||||
// Remove this file
|
||||
unlink($script);
|
||||
}
|
||||
// Remove this file
|
||||
unlink($script);
|
||||
}
|
||||
|
||||
// Reply in the form of JSON
|
||||
$rtn = array("rsp" => $rsp, "msg" => $msg);
|
||||
echo json_encode($rtn);
|
||||
// Reply in the form of JSON
|
||||
$rtn = array("rsp" => $rsp, "msg" => $msg);
|
||||
echo json_encode($rtn);
|
||||
}
|
||||
?>
|
||||
@@ -260,19 +260,7 @@ else
|
||||
then
|
||||
echo "Running command: ${chroot} /usr/xcatchrootscript\n"
|
||||
fi
|
||||
msg=`${chroot} /usr/xcatchrootscript`
|
||||
|
||||
rc=$?
|
||||
|
||||
echo "\n\n$msg\n\n"
|
||||
|
||||
#if [ ${rc} -ne 0 ]
|
||||
#then
|
||||
# error=1
|
||||
# echo "\nError: The chroot command failed for '$cmd_string'."
|
||||
# echo "Error: The return code from chroot was '${rc}'\n"
|
||||
#fi
|
||||
|
||||
${chroot} /usr/xcatchrootscript
|
||||
|
||||
# sensitive process has completed
|
||||
${M_CHATTR} -a Rstate=available $spotObj
|
||||
|
||||
@@ -188,6 +188,12 @@ if ($ENV{'DSHEXECUTE'})
|
||||
{
|
||||
push(@{$cmdref->{env}}, "DSHEXECUTE=$ENV{'DSHEXECUTE'}");
|
||||
}
|
||||
if ($ENV{'DSH_ENVIRONMENT'})
|
||||
{
|
||||
push(@{$cmdref->{env}}, "DSH_ENVIRONMENT=$ENV{'DSH_ENVIRONMENT'}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
xCAT::Client::submit_request($cmdref, \&xCAT::Client::handle_response);
|
||||
exit $xCAT::Client::EXITCODE;
|
||||
|
||||
@@ -0,0 +1,213 @@
|
||||
=head1 NAME
|
||||
|
||||
B<cfgve> - Configure the elements for a virtual environment.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<cfgve> B<-t> dc B<-m> manager B<-o> object [B<-c> B<-k> nfs|localfs | B<-r>]
|
||||
|
||||
B<cfgve> B<-t> cl B<-m> manager B<-o> object [B<-c> B<-p> cpu type| B<-r> B<-f>]
|
||||
|
||||
B<cfgve> B<-t> sd B<-m> manager B<-o> object [B<-c> | B<-g> | B<-s>
|
||||
| B<-a> | B<-b> | B<-r> B<-f>]
|
||||
|
||||
B<cfgve> B<-t> nw B<-m> manager B<-o> object [B<-c> B<-d> data center B<-n>
|
||||
vlan ID | B<-a> B<-l> cluster | B<-b> | B<-r>]
|
||||
|
||||
B<cfgve> B<-t> tpl B<-m> manager B<-o> object [B<-r>]
|
||||
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
The B<cfgve> command can be used to configure a virtual environment for
|
||||
'Storage Domain', 'Network' and 'Template' objects.
|
||||
|
||||
The mandatory parameter B<-m manager> is used to specify the address of the
|
||||
manager of virtual environment. xCAT needs it to access the RHEV manager.
|
||||
|
||||
The mandatory parameter B<-t type> is used to specify the type of the target
|
||||
object.
|
||||
|
||||
Basically, B<cfgve> command supports five types of object: B<dc>, B<cl>,
|
||||
B<sd>, B<nw> and B<tpl>.
|
||||
|
||||
=over 3
|
||||
|
||||
B<dc> - The B<create> and B<remove> operations are supported.
|
||||
|
||||
B<cl> - The B<create> and B<remove> operations are supported.
|
||||
|
||||
B<sd> - The B<create>, B<attach>, B<detach>, B<activate>,
|
||||
B<deactivate> and B<remove> operations are supported.
|
||||
|
||||
B<nw> - The B<create>, B<attach>, B<detach> and B<remove> operations are supported.
|
||||
|
||||
B<tpl> - The B<remove> operation is supported.
|
||||
|
||||
=back
|
||||
|
||||
The mandatory parameter B<-o object> is used to specify which object to configure.
|
||||
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 2
|
||||
|
||||
=item B<-a>
|
||||
To attach the target object.
|
||||
|
||||
=item B<-b>
|
||||
To detach the target object.
|
||||
|
||||
=item B<-c>
|
||||
To create the target object.
|
||||
|
||||
For creating of B<Storage Domain>, the target storage domain will be created
|
||||
first, then attached to data center and activated.
|
||||
|
||||
The parameters that used to create the storage domain are gotten
|
||||
from 'virtsd' table. The detail parameters in the virtsd table:
|
||||
|
||||
=over 3
|
||||
|
||||
B<virtsd.node> - The name of the storage domain.
|
||||
|
||||
B<virtsd.sdtype> - The type of storage domain. Valid value: data, iso, export.
|
||||
Default value is 'data'.
|
||||
|
||||
B<virtsd.stype> - The storage type. "nfs" or "localfs".
|
||||
|
||||
B<virtsd.location> - The location of the storage.
|
||||
B<nfs>: Format: [nfsserver:nfspath].
|
||||
The NFS export directory must be configured for read write access and must
|
||||
be owned by vdsm:kvm.
|
||||
B<localfs>: "/data/images/rhev" is set by default.
|
||||
|
||||
B<virtsd.host> - A host must be specified for a storage doamin as SPM
|
||||
(Storage Pool Manager) when initialize the storage domain. The role of SPM
|
||||
may be migrated to other host by rhev-m during the running of the datacenter
|
||||
(For example, when the current SPM encountered issue or going to maintenance
|
||||
status.
|
||||
|
||||
B<virtsd.datacenter> - The storage will be attached to. 'Default' data center
|
||||
is the default value.
|
||||
|
||||
=back
|
||||
|
||||
=item B<-d> I<data center>
|
||||
|
||||
The name of data center.
|
||||
|
||||
Specify the 'Data Center' that will be used for the object to be attached to.
|
||||
It is used by <nw> type.
|
||||
|
||||
=item B<-f>
|
||||
It can be used with B<-r> to remove the target object by force.
|
||||
|
||||
For removing of B<Storage Domain>, if B<-f> is specified, the storage domain will be deactivated and detached from data center before the removing.
|
||||
|
||||
=item B<-g>
|
||||
To activate the target object.
|
||||
|
||||
=item B<-h>
|
||||
Display usage message.
|
||||
|
||||
=item B<-k> I<storage type>
|
||||
|
||||
To specify the type of the storage type when creating the data center.
|
||||
|
||||
Supported type: nfs; localfs.
|
||||
|
||||
=item B<-l> I<cluster>
|
||||
|
||||
Specify the cluster for the network to attach to.
|
||||
|
||||
=item B<-m> I<manager>
|
||||
|
||||
Specify the manager of the virtual environment.
|
||||
|
||||
For RHEV, the FQDN (Fully Qualified Domain Name) of the rhev manager have
|
||||
to be specified.
|
||||
|
||||
=item B<-n> I<vlan ID>
|
||||
|
||||
To specify the vlan number when creating a network.
|
||||
|
||||
=item B<-o> I<object>
|
||||
|
||||
The name of the target object.
|
||||
|
||||
=item B<-p> I<cpu type>
|
||||
|
||||
To specify the cpu type when creating the cluster.
|
||||
B<Intel Penryn Family> is default type.
|
||||
|
||||
Supported type: B<Intel Conroe Family>, B<Intel Penryn Family>,
|
||||
B<Intel Nehalem Family>, B<Intel Westmere Family>, B<AMD Opteron G1>,
|
||||
B<AMD Opteron G2>, B<AMD Opteron G3>
|
||||
|
||||
=item B<-r>
|
||||
To remove the target object.
|
||||
|
||||
For removing of B<Storage Domain>, the storage space will be formatted after removing.
|
||||
|
||||
=item B<-s>
|
||||
To deactivate the target object.
|
||||
|
||||
=item B<-t> I<type>
|
||||
|
||||
Specify the B<type> of the target object.
|
||||
|
||||
Supported types:
|
||||
B<dc> - Data Center
|
||||
B<cl> - Cluster
|
||||
B<sd> - Storage Domain
|
||||
B<nw> - Network
|
||||
B<tpl> - Template
|
||||
|
||||
=back
|
||||
|
||||
=head1 RETURN VALUE
|
||||
|
||||
0 The command completed successfully.
|
||||
|
||||
1 An error has occurred.
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
=over 2
|
||||
|
||||
=item 1.
|
||||
To create the Storage Domain 'sd1', enter:
|
||||
|
||||
cfgve -t sd -m <FQDN of rhev manager> -o sd1 -c
|
||||
|
||||
=item 2.
|
||||
To deactivate the Storage Domain 'sd1' from data center, enter:
|
||||
|
||||
cfgve -t sd -m <FQDN of rhev manager> -o sd1 -s
|
||||
|
||||
=item 3.
|
||||
To remove the Storage Domain 'sd1', enter:
|
||||
|
||||
cfgve -t sd -m <FQDN of rhev manager> -o sd1 -r
|
||||
|
||||
=item 4.
|
||||
To create the network 'nw1', enter:
|
||||
|
||||
cfgve -t nw -m <FQDN of rhev manager> -o nw1 -c
|
||||
|
||||
=item 5.
|
||||
To remove the template 'tpl01', enter:
|
||||
|
||||
cfgve -t tpl -m <FQDN of rhev manager> -o tpl01 -r
|
||||
|
||||
=back
|
||||
|
||||
=head1 FILES
|
||||
|
||||
/opt/xcat/bin/cfgve
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<lsve(1)|lsve.1>
|
||||
@@ -0,0 +1,156 @@
|
||||
=head1 NAME
|
||||
|
||||
B<chhypervisor> - Configure the virtualization hosts.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<RHEV specific :>
|
||||
|
||||
=over 2
|
||||
|
||||
B<chhypervisor> I<noderange> [B<-a>]
|
||||
|
||||
B<chhypervisor> I<noderange> [B<-n>]
|
||||
|
||||
B<chhypervisor> I<noderange> [B<-p>]
|
||||
|
||||
B<chhypervisor> I<noderange> [B<-e>]
|
||||
|
||||
B<chhypervisor> I<noderange> [B<-d>]
|
||||
|
||||
=back
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
The B<chhypervisor> command can be used to configure the RHEV-h host.
|
||||
|
||||
The rhev-h host will register to the rhev-m automatically, but admin needs to
|
||||
approve the host can be added to the 'cluster' with B<-a> flag .
|
||||
|
||||
After registering, the network interfaces of host need to be added to the 'network' of
|
||||
RHEV. And the power management for the host should be configured so that
|
||||
rhev-m could make proper decision when certain host encountered error.
|
||||
|
||||
For each host, an entry should be added to the hypervisor table:
|
||||
|
||||
The columns of hypervisor table:
|
||||
|
||||
=over 2
|
||||
|
||||
B<hypervisor.node> - rhev-h host name.
|
||||
|
||||
B<hypervisor.type> - Must be set to 'rhevh'.
|
||||
|
||||
B<hypervisor.mgr> - The rhev manager (The FQDN of rhev-m server) for the host.
|
||||
|
||||
B<hypervisor.interface> - The configuration for the nics. Refer to B<-n>.
|
||||
|
||||
B<hypervisor.cluster> - The cluster that the host will be added to. The
|
||||
default is 'Default' cluster if not specified.
|
||||
|
||||
=back
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 2
|
||||
|
||||
=item B<-a>
|
||||
Approve the host that to be added to cluster.
|
||||
|
||||
Before approve, the status of the host must be 'pending_approval'.
|
||||
|
||||
=item B<-n>
|
||||
Configure the network interfaces for the host.
|
||||
|
||||
Note: This operation only can be run when host is in 'maintenance mode'.
|
||||
Use B<-d> to switch the host to 'maintenance' mode.
|
||||
|
||||
The interfaces which configured in hypervisor.interface will be added
|
||||
to the network of RHEV.
|
||||
|
||||
The format of hypervisor.interface is multiple [network:interfacename:
|
||||
protocol:IP:netmask:gateway] sections separated with '|'. For example:
|
||||
[rhevm2:eth0:static:10.1.0.236:255.255.255.0:0.0.0.0].
|
||||
|
||||
=over 2
|
||||
|
||||
B<network> - The logic network which has been created by 'cfgve -t nw'
|
||||
or the default management network 'rhevm'.
|
||||
|
||||
B<interfacename> - Physical network name: 'eth0','eth1'...
|
||||
|
||||
B<protocol> - To identify which boot protocol to use for the interface: dhcp
|
||||
or static.
|
||||
|
||||
B<IP> - The IP address for the interface.
|
||||
|
||||
B<netmask> - The network mask for the interface.
|
||||
|
||||
B<gateway> - The gateay for the interface. This field only can be set when
|
||||
the interface is added to 'rhevm' network.
|
||||
|
||||
=back
|
||||
|
||||
=item B<-p>
|
||||
Configure the power management for the host.
|
||||
|
||||
The power management must be configured for the rhev-h host to make the
|
||||
rhev-m to monitor the power status of the host, so that when certain host
|
||||
failed to function, rhev-m will fail over certain role like SPM to other active host.
|
||||
|
||||
For rack mounted server, the bmc IP and user:password need to be set for the
|
||||
power management (These parameters are gotten from ipmi table). rhev-m uses the
|
||||
ipmi protocol to get the power status of the host.
|
||||
|
||||
=item B<-e>
|
||||
To activate the host.
|
||||
|
||||
=item B<-d>
|
||||
To deactivate the host to maintenance mode.
|
||||
|
||||
=item B<-h>
|
||||
Display usage message.
|
||||
|
||||
=back
|
||||
|
||||
=head1 RETURN VALUE
|
||||
|
||||
0 The command completed successfully.
|
||||
|
||||
1 An error has occurred.
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
=over 2
|
||||
|
||||
=item 1.
|
||||
To approve the host 'host1', enter:
|
||||
|
||||
chhypervisor host1 -a
|
||||
|
||||
=item 2.
|
||||
To configure the network interface for the host 'host1', enter:
|
||||
|
||||
chhypervisor host1 -n
|
||||
|
||||
=item 3.
|
||||
To configure the power management for the host 'host1', enter:
|
||||
|
||||
chhypervisor host1 -p
|
||||
|
||||
=item 4.
|
||||
To activate the host 'host1', enter:
|
||||
|
||||
chhypervisor host1 -e
|
||||
|
||||
=item 5.
|
||||
To deactivate the host 'host1', enter:
|
||||
|
||||
chhypervisor host1 -d
|
||||
|
||||
=back
|
||||
|
||||
=head1 FILES
|
||||
|
||||
/opt/xcat/bin/chhypervisor
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
=head1 NAME
|
||||
|
||||
B<lsve> - Lists detail attributes for a virtual environment.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<lsve> [B<-t> type] [B<-m> manager] [B<-o> object]
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
The B<lsve> command can be used to list a virtual environment for
|
||||
'Data Center', 'Cluster', 'Storage Domain', 'Network' and 'Template' objects.
|
||||
|
||||
The mandatory parameter B<-m manager> is used to specify the address of the
|
||||
manager of virtual environment. xCAT needs it to access the RHEV manager.
|
||||
|
||||
The mandatory parameter B<-t type> is used to specify the type of the target
|
||||
object.
|
||||
|
||||
Basically, B<lsve> command supports three types of object: B<dc>, B<cl>, B<sd>, B<nw>
|
||||
and B<tpl>.
|
||||
|
||||
The parameter B<-o object> is used to specify which object to list. If no B<-o> is specified,
|
||||
all the objects with the B<-t> type will be displayed.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 2
|
||||
|
||||
=item B<-h>
|
||||
Display usage message.
|
||||
|
||||
=item B<-m>
|
||||
Specify the manager of the virtual environment.
|
||||
|
||||
For RHEV, the FQDN (Fully Qualified Domain Name) of the rhev manager have to be specified.
|
||||
|
||||
=item B<-o>
|
||||
The target object to display.
|
||||
|
||||
=item B<-t>
|
||||
Specify the B<type> of the target object.
|
||||
|
||||
Supported types:
|
||||
B<dc> - Data Center (For type of 'dc', all the elements belongs to the data
|
||||
center will be listed.)
|
||||
B<cl> - Cluster
|
||||
B<sd> - Storage Domain (To get the status of Storage Doamin, show it from
|
||||
I<data center> it attached to.
|
||||
B<nw> - Network
|
||||
B<tpl> - Template
|
||||
|
||||
=back
|
||||
|
||||
=head1 RETURN VALUE
|
||||
|
||||
0 The command completed successfully.
|
||||
|
||||
1 An error has occurred.
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
=over 2
|
||||
|
||||
=item 1.
|
||||
To list the data center 'Default', enter:
|
||||
|
||||
lsve -t B<dc> -m <FQDN of rhev manager> -o Default
|
||||
|
||||
Output is similar to:
|
||||
|
||||
datacenters: [Default]
|
||||
description: The default Data Center
|
||||
state: up
|
||||
storageformat: v1
|
||||
storagetype: nfs
|
||||
clusters: [Default]
|
||||
cpu: Intel Westmere Family
|
||||
description: The default server cluster
|
||||
memory_hugepage: true
|
||||
memory_overcommit: 100
|
||||
storagedomains: [image]
|
||||
available: 55834574848
|
||||
committed: 13958643712
|
||||
ismaster: true
|
||||
status: active
|
||||
storage_add: <Address of storage domain>
|
||||
storage_format: v1
|
||||
storage_path: /vfsimg
|
||||
storage_type: nfs
|
||||
type: data
|
||||
used: 9663676416
|
||||
networks: [rhevm2]
|
||||
description:
|
||||
state: operational
|
||||
stp: false
|
||||
networks: [rhevm]
|
||||
description: Management Network
|
||||
state: operational
|
||||
stp: false
|
||||
templates: [Blank]
|
||||
bootorder: hd
|
||||
cpucore: 1
|
||||
cpusocket: 1
|
||||
creation_time: 2008-04-01T00:00:00.000-04:00
|
||||
display: spice
|
||||
memory: 536870912
|
||||
state: ok
|
||||
stateless: false
|
||||
type: desktop
|
||||
|
||||
|
||||
=item 2.
|
||||
To list the cluster 'Default', enter:
|
||||
|
||||
lsve -t B<cl> -m <FQDN of rhev manager> -o Default
|
||||
|
||||
Output is similar to:
|
||||
|
||||
cpu: Intel Westmere Family
|
||||
description: The default server cluster
|
||||
memory_hugepage: true
|
||||
memory_overcommit: 10
|
||||
|
||||
|
||||
=item 3.
|
||||
To list the Storage Domain 'image', enter:
|
||||
|
||||
lsve -t B<sd> -m <FQDN of rhev manager> -o image
|
||||
|
||||
Output is similar to:
|
||||
storagedomains: [image]
|
||||
available: 55834574848
|
||||
committed: 13958643712
|
||||
ismaster: true
|
||||
status:
|
||||
storage_add: <Address of storage domain>
|
||||
storage_format: v1
|
||||
storage_path: /vfsimg
|
||||
storage_type: nfs
|
||||
type: data
|
||||
used: 9663676416
|
||||
|
||||
=item 4.
|
||||
To list the network 'rhevm', enter:
|
||||
|
||||
lsve -t B<nw> -m <FQDN of rhev manager> -o rhevm
|
||||
|
||||
Output is similar to:
|
||||
|
||||
networks: [rhevm]
|
||||
description: Management Network
|
||||
state: operational
|
||||
stp: false
|
||||
|
||||
=item 5.
|
||||
To list the template 'tpl01', enter:
|
||||
|
||||
lsve -t tpl -m <FQDN of rhev manager> -o tpl01
|
||||
|
||||
Output is similar to:
|
||||
|
||||
templates: [tpl01]
|
||||
bootorder: network
|
||||
cpucore: 2
|
||||
cpusocket: 2
|
||||
creation_time: 2012-08-22T23:52:35.953-04:00
|
||||
display: vnc
|
||||
memory: 1999634432
|
||||
state: ok
|
||||
stateless: false
|
||||
type: server
|
||||
|
||||
|
||||
=back
|
||||
|
||||
=head1 FILES
|
||||
|
||||
/opt/xcat/bin/lsve
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<cfgve(1)|cfgve.1>
|
||||
@@ -6,7 +6,7 @@ B<mkdsklsnode> - Use this xCAT command to define and initialize AIX/NIM diskless
|
||||
|
||||
B<mkdsklsnode [-h|--help ]>
|
||||
|
||||
B<mkdsklsnode [-V|--verbose] [-f|--force] [-n|--newname] [-i osimage_name] [-l location] [-u|--updateSN] [-k|--skipsync] [-p|--primarySN] [-b|--backupSN] [-S|--setuphanfs] noderange [attr=val [attr=val ...]]>
|
||||
B<mkdsklsnode [-V|--verbose] [-f|--force] [-n|--newname] [-i osimage_name] [-l location] [-u|--updateSN] [-k|--skipsync] [-p|--primarySN] [-b|--backupSN] [-S|--setuphanfs] [-r|--resonly] noderange [attr=val [attr=val ...]]>
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
@@ -123,6 +123,10 @@ Create a new NIM machine object name for the xCAT node. Use the naming conventio
|
||||
|
||||
When using backup service nodes only update the primary. The default is to update both the primary and backup service nodes.
|
||||
|
||||
=item B<-r|--resonly>
|
||||
|
||||
Use this option if you wish to copy osimages to the service nodes and define the local resources BUT do not wish to define the local NIM client definitions. This option is only valid when the xCAT "site" definition attribute "sharedinstall" is set to "sns" (using xCAT HASN support). You run the mkdslsnode command as you normally would but include the "-r" option. You can run the same command without the "-r" option to define the NIM clients on the service nodes.
|
||||
|
||||
=item B<-S|--setuphanfs>
|
||||
|
||||
Setup NFSv4 replication between the primary service nodes and backup service nodes to provide high availability NFS for the compute nodes. This option only exports the /install directory with NFSv4 replication settings, the data synchronization between the primary service nodes and backup service nodes needs to be taken care of through some mechanism.
|
||||
@@ -183,6 +187,12 @@ Initialize an xCAT node called "node02" as an AIX diskless node. Create a new N
|
||||
|
||||
B<mkdsklsnode -n -i 61spot node02>
|
||||
|
||||
=item 5
|
||||
|
||||
In an HASN environment, replicate NIM resources listed in an osimage definiton on remote service nodes without creating NIM client definitions.
|
||||
|
||||
B<mkdsklsnode -S -r -b compute>
|
||||
|
||||
=back
|
||||
|
||||
=head1 FILES
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
=head1 NAME
|
||||
|
||||
B<rmhypervisor> - Remove the virtualization hosts.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<RHEV specific :>
|
||||
|
||||
=over 2
|
||||
|
||||
B<rmhypervisor> I<noderange> [B<-f>]
|
||||
|
||||
=back
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
The B<rmhypervisor> command can be used to remove the virtualization host.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 2
|
||||
|
||||
=item B<-f>
|
||||
|
||||
If B<-f> is specified, the host will be deactivated to maintenance before the removing.
|
||||
|
||||
=back
|
||||
|
||||
=head1 RETURN VALUE
|
||||
|
||||
0 The command completed successfully.
|
||||
|
||||
1 An error has occurred.
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
=over 2
|
||||
|
||||
=item 1.
|
||||
To remove the host 'host1', enter:
|
||||
|
||||
rmhypervisor host1
|
||||
|
||||
=back
|
||||
|
||||
=head1 FILES
|
||||
|
||||
/opt/xcat/bin/rmhypervisor
|
||||
|
||||
@@ -98,6 +98,8 @@ DSH_PATH=$PATH
|
||||
The B<-E> flag exports a local environment definition file to each remote
|
||||
target. Environment variables specified in this file are defined in the
|
||||
remote shell environment before the I<command_list> is executed.
|
||||
This is not supported when running xdsh to nodes that are serviced
|
||||
by Service Nodes (hierarchy).
|
||||
|
||||
B<COMMAND> B<EXECUTION>:
|
||||
|
||||
@@ -230,7 +232,7 @@ for valid names.
|
||||
xdsh will chroot (xcatchroot for AIX) to this path and run the xdsh command against the
|
||||
install image. No other xdsh flags, environment variables apply with
|
||||
this input. A noderange is not accepted. Only runs on the local host,
|
||||
normally the Management Node.
|
||||
normally the Management Node. The command you run must not prompt for input, the prompt will not be returned to you and it will appear that xdsh hangs.
|
||||
|
||||
=item B<-K>|B<--ssh-setup>
|
||||
|
||||
@@ -382,6 +384,8 @@ Specify a user-defined device type. See B<--devicetype> flag.
|
||||
Specifies a file that contains environment variable
|
||||
definitions to export to the target before executing the remote
|
||||
command. This variable is overridden by the B<-E> flag.
|
||||
This is not supported when running xdsh to nodes that are serviced
|
||||
by Service Nodes (hierarchy).
|
||||
|
||||
=item B<DSH_FANOUT>
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
=head1 NAME
|
||||
|
||||
B<copycds> - Copies Linux distributions and service levels from CDs/DVDs to install directory.
|
||||
B<copycds> - Copies Linux distributions and service levels from DVDs/ISOs to the xCAT /install directory.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
@@ -9,15 +8,11 @@ B<copycds> [{B<-n|--name|--osver>}=I<distroname>] [{B<-a|--arch>}=I<architecture
|
||||
|
||||
B<copycds> [B<-h>|B<--help>]
|
||||
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
The B<copycds> command copies all contents of Distribution CDs/DVDs or Service Pack CDs/DVDs to the install directory as
|
||||
designated in the B<site> table attribute: B<installdir>. The B<copycds> command can copy from one or more ISO files,
|
||||
or from the CD/DVD device path. If xCAT doesn't recognize the signature of the CD/DVD (e.g. in the .discinfo
|
||||
file), you must specify the -n and -a options. This is sometimes the case for distros that have very
|
||||
recently been released, and the xCAT code hasn't been updated for it yet.
|
||||
The B<copycds> command copies all contents of Distribution DVDs/ISOs or Service Pack DVDs/ISOs to a destination directory. The destination directory will be formed from the B<installdir> site attribute and the distro name and architecture, for example: /install/rhels6.3/x86_64. The B<copycds> command can copy from one or more ISO files, or the CD/DVD device path.
|
||||
|
||||
You can get xCAT to recognize new DVDs/ISOs by adding them to /opt/xcat/lib/perl/xCAT/data/discinfo.pm and reloading xcatd (service xcatd reload).
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
@@ -25,40 +20,38 @@ recently been released, and the xCAT code hasn't been updated for it yet.
|
||||
|
||||
=item {B<-n|--name|--osver>}=I<distroname>
|
||||
|
||||
The linux distro name and version that the ISO/DVD contains. Examples: rhels5.3, centos5.1, fedora9.
|
||||
The linux distro name and version that the ISO/DVD contains. Examples: rhels6.3, sles11.2, fedora9. Note the 's' in rhels6.3 which denotes the Server version of RHEL, which is typically used.
|
||||
|
||||
=item {B<-a|--arch>}=I<architecture>]
|
||||
|
||||
The architecture of the linux distro on the ISO/DVD. Examples: x86, x86_64, ppc64.
|
||||
The architecture of the linux distro on the ISO/DVD. Examples: x86, x86_64, ppc64, s390x.
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
=over 2
|
||||
|
||||
=item *
|
||||
|
||||
To copy the RPMs from a set of ISOs that represent the CDs of a distro:
|
||||
To copy the RPMs from a set of ISOs that represent the DVDs of a distro:
|
||||
|
||||
B<copycds cd1.iso cd2.iso cd3.iso>
|
||||
copycds dvd1.iso dvd2.iso
|
||||
|
||||
=item *
|
||||
|
||||
To copy the RPMs from a physical DVD:
|
||||
|
||||
B<copycds /dev/dvd>
|
||||
copycds /dev/dvd
|
||||
|
||||
=item *
|
||||
|
||||
To copy the RPMs from a DVD ISO of a very recently released distro:
|
||||
|
||||
B<copycds -n rhels5.3 -a x86_64 dvd.iso>
|
||||
copycds -n rhels5.3 -a x86_64 dvd.iso
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<nodeset(8)|nodeset.8>, L<site(5)|site.5>, L<nodetype(5)|nodetype.5>
|
||||
|
||||
@@ -4,38 +4,46 @@ B<makedhcp> - Creates and updates DHCP configuration files.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<makedhcp> B<-n>
|
||||
B<makedhcp> B<-n> [B<-l>|B<--localonly>]
|
||||
|
||||
B<makedhcp> B<-a>
|
||||
B<makedhcp> B<-a> [B<-l>|B<--localonly>]
|
||||
|
||||
B<makedhcp> B<-a -d>
|
||||
B<makedhcp> B<-a -d> [B<-l>|B<--localonly>]
|
||||
|
||||
B<makedhcp> B<-d> I<noderange>
|
||||
B<makedhcp> B<-d> I<noderange> [B<-l>|B<--localonly>]
|
||||
|
||||
B<makedhcp> I<noderange> [B<-s> I<statements>]
|
||||
B<makedhcp> I<noderange> [B<-s> I<statements>] [B<-l>|B<--localonly>]
|
||||
|
||||
B<makedhcp> [I<-h|--help>]
|
||||
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
The B<makedhcp> command creates and updates the DHCP configuration file on the local system.
|
||||
|
||||
The B<makedhcp> command creates and updates the DHCP configuration on the management node and service nodes.
|
||||
The B<makedhcp> command is supported for both Linux and AIX clusters.
|
||||
|
||||
With the B<-n> option, B<makedhcp> will create a new dhcp configuration file. For Linux systems the file will include network entries as well as certain general parameters such as a dynamic range and omapi configuration. For AIX systems the file will include network entries.
|
||||
=over 3
|
||||
|
||||
If a configuration file already exist the B<makedhcp> command will create a backup before creating a new one.
|
||||
=item 1.
|
||||
|
||||
On AIX systems, if there are any non-xCAT entries in the configuration file they will be preserved and added to the end of the new configuration file.
|
||||
Start by filling out the L<networks(5)|networks.5> table properly.
|
||||
|
||||
With a noderange or the B<-a> option, B<makedhcp> will inject configuration data pertinent to the specified nodes that immediately takes effect without a restart of DHCP.
|
||||
=item 2.
|
||||
|
||||
On AIX systems B<makedhcp> will not add entries for cluster nodes that will be installed using NIM. The entries for these nodes will be managed by NIM.
|
||||
Then use the B<makedhcp -n> option to create a new dhcp configuration file.
|
||||
|
||||
If the B<-d> flag is used with the B<-a> flag then B<makedhcp> will delete all the node entries created by xCAT. The B<-d> flag followed by a I<noderange> will delete the dhcp host definitons for the noderange.
|
||||
=item 3.
|
||||
|
||||
Any entries created by NIM will not be removed.
|
||||
Next, get the node IP addresses and MACs defined in the xCAT database.
|
||||
Also, get the hostnames and IP addresses pushed to /etc/hosts (using L<makehosts(8)|makehosts.8>) and to DNS (using L<makedns(8)|makedns.8>).
|
||||
|
||||
=item 4.
|
||||
|
||||
Then run B<makedhcp> with a noderange or the B<-a> option. This will inject into dhcpd configuration data pertinent to the specified nodes.
|
||||
On linux, the configuration information immediately takes effect without a restart of DHCP.
|
||||
|
||||
=back
|
||||
|
||||
If you need to delete node entries from the DHCP configuration, use the B<-d> flag.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
@@ -43,42 +51,53 @@ Any entries created by NIM will not be removed.
|
||||
|
||||
=item B<-n>
|
||||
|
||||
Create a new dhcp configuration file with a network statement for each network the dhcp daemon should listen on. The B<makedhcp> command will automatically restart the dhcp daemon after this operation. This option will replace any existing configuration file!
|
||||
Create a new dhcp configuration file with a network statement for each network the dhcp daemon should listen on.
|
||||
(Which networks dhcpd should listen on can be controlled by the dhcpinterfaces attribute in the L<site(5)|site.5> table.)
|
||||
The B<makedhcp> command will automatically restart the dhcp daemon after this operation.
|
||||
This option will replace any existing configuration file (making a backup of it first).
|
||||
For Linux systems the file will include network entries as well as certain general parameters such as a dynamic range and omapi configuration.
|
||||
For AIX systems the file will include network entries.
|
||||
On AIX systems, if there are any non-xCAT entries in the existing configuration file they will be preserved and added to the end of the new configuration file.
|
||||
|
||||
=item B<-a>
|
||||
|
||||
Define all nodes to the DHCP server. (Will only add nodes that can be reached, network-wise, by this DHCP server.) The dhcp daemon does not have to be restarted after this.
|
||||
Define all nodes to the DHCP server. (Will only add nodes that can be reached, network-wise, by this DHCP server.)
|
||||
The dhcp daemon does not have to be restarted after this.
|
||||
On AIX systems B<makedhcp> will not add entries for cluster nodes that will be installed using NIM. The entries for these nodes will be managed by NIM.
|
||||
|
||||
=item I<noderange>
|
||||
|
||||
Add the specified nodes to the DHCP server configuration.
|
||||
|
||||
=item [B<-s> I<statements>]
|
||||
=item B<-s> I<statements>
|
||||
|
||||
For the input noderange, the argument will be interpreted like dhcp configuration file text.
|
||||
|
||||
=item B<-a -d>
|
||||
|
||||
Delete all node entries added by xCAT from the DHCP server configuration.
|
||||
|
||||
=item B<-d> I<noderange>
|
||||
|
||||
Delete all node entries, added by xCAT, in the noderange from the DHCP server configuration.
|
||||
Delete node entries from the DHCP server configuration. On AIX, any entries created by NIM will not be removed.
|
||||
|
||||
=item B<-h>
|
||||
=item B<-a -d>
|
||||
|
||||
Delete all node entries, that were added by xCAT, from the DHCP server configuration.
|
||||
|
||||
=item B<-l>|B<--localonly>
|
||||
|
||||
Configure dhcpd on the local machine only. Without this option, makedhcp will also send this
|
||||
operation to any service nodes that service the nodes in the noderange.
|
||||
|
||||
=item B<-h|--help>
|
||||
|
||||
Display usage message.
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=head1 RETURN VALUE
|
||||
|
||||
0 The command completed successfully.
|
||||
|
||||
1 An error has occurred.
|
||||
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
=over 3
|
||||
@@ -107,7 +126,7 @@ Will cause dhcp on the next request to set root-path appropriately for only node
|
||||
|
||||
=head1 FILES
|
||||
|
||||
DHCP configuration files.
|
||||
DHCP configuration files:
|
||||
|
||||
[AIX] /etc/dhcpsd.cnf
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=head1 NAME
|
||||
|
||||
B<xcatdebug> - Enable or disable the trace facilities for xCAT.
|
||||
B<xcatdebug> - Enable or disable the trace facilities for xCAT. (Only supports Linux Operating System)
|
||||
|
||||
B<xcatdebug> { [B<-f enable|disable> [B<-c configuration file | subroutine list>]] | [ B<-d enable |disable>]}
|
||||
|
||||
|
||||
@@ -200,6 +200,9 @@ ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/sbin/snmove
|
||||
ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/lsxcatd
|
||||
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/postage
|
||||
ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/slpdiscover
|
||||
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/cfghost
|
||||
ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/cfgve
|
||||
ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/lsve
|
||||
|
||||
|
||||
%clean
|
||||
|
||||
@@ -57,6 +57,8 @@ if [ "$IPMIMFG" == 2 ]; then #IBM
|
||||
let idev=idev-1
|
||||
done
|
||||
fi
|
||||
elif [ "$XPROD" == "291" ]; then
|
||||
LOCKEDUSERS=1
|
||||
else
|
||||
IBMFAM=`ipmitool raw 0x3a 0x50 |head -n 1| awk '{print $1 $2 $3 $4}'`
|
||||
if [ "$IBMFAM" == "59554f4f" ]; then
|
||||
|
||||
@@ -76,7 +76,8 @@ restart)
|
||||
fi
|
||||
$STATUS > /dev/null 2>&1
|
||||
if [ "$?" = "0" ]; then
|
||||
if ! nodels --version |grep -q 'Version 2.6'; then #upgrade or downgrade from another major release, stop it just in case
|
||||
ver=`nodels --version`
|
||||
if [[ $ver < "Version 2.6" ]]; then # force to stop xcatd first when update from version earlier than 2.6
|
||||
$0 stop
|
||||
fi
|
||||
fi
|
||||
@@ -89,7 +90,8 @@ reload)
|
||||
fi
|
||||
$STATUS > /dev/null 2>&1
|
||||
if [ "$?" = "0" ]; then
|
||||
if ! nodels --version |grep -q 'Version 2.6'; then #upgrade or downgrade from another major release, stop it just in case
|
||||
ver=`nodels --version`
|
||||
if [[ $ver < "Version 2.6" ]]; then # force to stop xcatd first when update from version earlier than 2.6
|
||||
$0 stop
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -16,7 +16,22 @@ use warnings "all";
|
||||
use Time::HiRes qw/time/;
|
||||
|
||||
use IO::Socket::INET qw/!AF_INET6 !PF_INET6/;
|
||||
my $initialtimeout=0.100;
|
||||
my $initialtimeout=0.809;
|
||||
use constant STATE_OPENSESSION=>1;
|
||||
use constant STATE_EXPECTINGRAKP2=>2;
|
||||
use constant STATE_EXPECTINGRAKP4=>3;
|
||||
use constant STATE_ESTABLISHED=>4;
|
||||
#my $ipmidbg;
|
||||
#open($ipmidbg,">","/tmp/ipmidbg");
|
||||
#sub dprint {
|
||||
# return;
|
||||
# my $self = shift;
|
||||
# foreach (@_) {
|
||||
# foreach (split /\n/,$_) {
|
||||
# print $ipmidbg $self->{bmc}.": ".$_."\n";
|
||||
# }
|
||||
# }
|
||||
#}
|
||||
|
||||
my $doipv6=eval {
|
||||
require Socket6;
|
||||
@@ -155,9 +170,15 @@ sub logout {
|
||||
if ( $self->{onlogout}) { $self->{onlogout}->("SUCCESS",$self->{onlogout_args}); }
|
||||
return;
|
||||
}
|
||||
$self->{noretry}=1;
|
||||
$self->subcmd(netfn=>0x6,command=>0x3c,data=>$self->{sessionid},callback=>\&logged_out,callback_args=>$self);
|
||||
$self->{logged}=0; #seeing as how we are going to take it on faith the logout happened, do the callback now
|
||||
if ( $self->{onlogout}) {
|
||||
$self->{onlogout}->("SUCCESS",$self->{onlogout_args});
|
||||
}
|
||||
}
|
||||
sub logged_out {
|
||||
return;
|
||||
my $rsp = shift;
|
||||
my $self = shift;
|
||||
if (defined $rsp->{code} and $rsp->{code} == 0) {
|
||||
@@ -315,11 +336,16 @@ sub got_channel_auth_cap {
|
||||
sub open_rmcpplus_request {
|
||||
my $self = shift;
|
||||
$self->{'authtype'}=6;
|
||||
$self->{sidm} = [0x15,0x58,0x25,0x7a];
|
||||
my @payload = (0x1f,#message tag, TODO: could be random
|
||||
unless ($self->{localsid}) { $self->{localsid}=358098297; } #this is an arbitrary number of no significance
|
||||
$self->{localsid}+=1; #new session ID if we are relogging
|
||||
my @sidbytes = unpack("C4",pack("N",$self->{localsid}));
|
||||
$self->{sidm} = \@sidbytes;
|
||||
unless ($self->{rmcptag}) { $self->{rmcptag} = 1; }
|
||||
$self->{rmcptag}+=1;
|
||||
my @payload = ($self->{rmcptag},#message tag,
|
||||
0, #requested privilege role, 0 is highest allowed
|
||||
0,0, #reserved
|
||||
0x15,0x58,0x25,0x7a, #we only have to sweat one session, so no need to generate
|
||||
@sidbytes,
|
||||
0,0,0,8,1,0,0,0, #table 13-17, request sha
|
||||
1,0,0,8,1,0,0,0); #sha integrity
|
||||
if ($aessupport) {
|
||||
@@ -327,7 +353,7 @@ sub open_rmcpplus_request {
|
||||
} else {
|
||||
push @payload,(2,0,0,8,0,0,0,0);
|
||||
}
|
||||
$self->{sessionestablishmentcontext} = 'opensession';
|
||||
$self->{sessionestablishmentcontext} = STATE_OPENSESSION;
|
||||
$self->sendpayload(payload=>\@payload,type=>$payload_types{'rmcpplusopenreq'});
|
||||
}
|
||||
|
||||
@@ -344,13 +370,10 @@ sub checksum {
|
||||
sub subcmd {
|
||||
my $self = shift;
|
||||
my %args = @_;
|
||||
my $rqaddr=0x81; #see section 5.5 of ipmi2 spec, rqsa by old code
|
||||
my $rsaddr=0x20; #figrue 13-4, rssa by old code
|
||||
my @rnl = ($rsaddr,$args{netfn}<<2);
|
||||
my @rest = ($rqaddr,$self->{seqlun},$args{command},@{$args{data}});
|
||||
my @rest = ($self->{rqaddr},$self->{seqlun},$args{command},@{$args{data}});
|
||||
my @payload=(@rnl,$self->checksum(@rnl),@rest,$self->checksum(@rest));
|
||||
$self->{seqlun} += 4; #increment by 1<<2
|
||||
$self->{seqlun} &= 0xff; #keep it one byte
|
||||
$self->{ipmicallback} = $args{callback};
|
||||
$self->{ipmicallback_args} = $args{callback_args};
|
||||
my $type = $payload_types{'ipmi'};
|
||||
@@ -423,15 +446,32 @@ sub waitforrsp {
|
||||
|
||||
sub timedout {
|
||||
my $self = shift;
|
||||
$self->{timeout} = $self->{timeout}*2;
|
||||
unless (ref $self->{pendingargs}) {
|
||||
return;
|
||||
}
|
||||
$self->{nowait}=1;
|
||||
$self->{timeout} = $self->{timeout}*1.5;
|
||||
if ($self->{noretry}) { return; }
|
||||
if ($self->{timeout} > 7) { #giveup, really
|
||||
$self->{timeout}=$initialtimeout;
|
||||
my $rsp={};
|
||||
$rsp->{error} = "timeout";
|
||||
$self->{ipmicallback}->($rsp,$self->{ipmicallback_args});
|
||||
$self->{nowait}=0;
|
||||
return;
|
||||
}
|
||||
$self->sendpayload(%{$self->{pendingargs}},nowait=>1); #do not induce the xmit to wait for packets, just spit it out. timedout is in a wait-for-packets loop already, so it's fine
|
||||
if ($self->{sessionestablishmentcontext} == STATE_OPENSESSION) { #in this particular case, we want to craft a new rmcp session request with a new client side session id, to aid in distinguishing retry from new
|
||||
$self->open_rmcpplus_request();
|
||||
#experimintation has showed rakp1 and 3 are best done with a straightforward retry, not something fancy...
|
||||
#stale rakp3 in a ipmi2 implementation that can't handle it will be detected through rmcp status code rather than assuming we must start over.
|
||||
} elsif ($self->{sessionestablishmentcontext} == STATE_EXPECTINGRAKP2) { #in this particular case, we want to craft a new rmcp session request with a new client side session id, to aid in distinguishing retry from new
|
||||
$self->relog();
|
||||
} elsif ($self->{sessionestablishmentcontext} == STATE_EXPECTINGRAKP4) { #in this particular case, we want to craft a new rmcp session request with a new client side session id, to aid in distinguishing retry from new
|
||||
$self->relog();
|
||||
} else {
|
||||
$self->sendpayload(%{$self->{pendingargs}},nowait=>1); #do not induce the xmit to wait for packets, just spit it out. timedout is in a wait-for-packets loop already, so it's fine
|
||||
}
|
||||
$self->{nowait}=0;
|
||||
}
|
||||
sub route_ipmiresponse {
|
||||
my $sockaddr=shift;
|
||||
@@ -521,10 +561,8 @@ sub handle_ipmi_packet {
|
||||
return 3; #authcode bad, pretend it never existed
|
||||
}
|
||||
}
|
||||
unless ($rsp[2] == 0x15 and
|
||||
$rsp[3] == 0x58 and
|
||||
$rsp[4] == 0x25 and
|
||||
$rsp[5] == 0x7a) {
|
||||
my $thissid = unpack("N",pack("C*",$rsp[2],$rsp[3],$rsp[4],$rsp[5]));
|
||||
unless ($thissid==$self->{localsid}) {
|
||||
return 1; #this response does not match our current session id, ignore it
|
||||
}
|
||||
my $remsequencenumber=$rsp[6]+$rsp[7]>>8+$rsp[8]>>16+$rsp[9]>>24;
|
||||
@@ -576,10 +614,11 @@ sub got_rmcp_response {
|
||||
my $self = shift;
|
||||
my @data = @_;
|
||||
my $byte = shift @data;
|
||||
unless ($self->{sessionestablishmentcontext} eq 'opensession') {
|
||||
unless ($self->{sessionestablishmentcontext} and $self->{sessionestablishmentcontext} != STATE_ESTABLISHED) {
|
||||
#we would ignore an RMCP+ open session response if we are not in an IPMI2 negotiation, so we have to have *some* state that isn't established for this to be kosher
|
||||
return 9; #now's not the time for this response, ignore it
|
||||
}
|
||||
unless ($byte == 0x1f) {
|
||||
unless ($byte == $self->{rmcptag}) { #make sure this rmcp response is specifically the last one we sent.... we don't want to happily proceed with the risk a retry request blew up our temp session id without letting us know
|
||||
return 9;
|
||||
}
|
||||
$byte = shift @data;
|
||||
@@ -594,14 +633,17 @@ sub got_rmcp_response {
|
||||
}
|
||||
splice @data,0,5;
|
||||
$self->{pendingsessionid} = [splice @data,0,4];
|
||||
$self->{sessionestablishmentcontext} = 'rakp2';
|
||||
#TODO: if we retried, and the first answer comes back but the second answer is dropped, log in will fail as we do not know our correct session id
|
||||
#basically, we would have to retry open session requested until RAKP2 *confirmed* good
|
||||
$self->send_rakp1();
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub send_rakp3 {
|
||||
#TODO: this is the point where OPEN RMCP SESSION REQUEST should have retry stopped, not send_rakp1
|
||||
my $self = shift;
|
||||
my @payload = (0x1f,0,0,0,@{$self->{pendingsessionid}});
|
||||
$self->{rmcptag}+=1;
|
||||
my @payload = ($self->{rmcptag},0,0,0,@{$self->{pendingsessionid}});
|
||||
my @user = unpack("C*",$self->{userid});
|
||||
push @payload,unpack("C*",hmac_sha1(pack("C*",@{$self->{remoterandomnumber}},@{$self->{sidm}},4,scalar @user,@user),$self->{password}));
|
||||
$self->sendpayload(payload=>\@payload,type=>$payload_types{'rakp3'});
|
||||
@@ -609,7 +651,8 @@ sub send_rakp3 {
|
||||
|
||||
sub send_rakp1 {
|
||||
my $self = shift;
|
||||
my @payload = (0x1f,0,0,0,@{$self->{pendingsessionid}});
|
||||
$self->{rmcptag}+=1;
|
||||
my @payload = ($self->{rmcptag},0,0,0,@{$self->{pendingsessionid}});
|
||||
$self->{randomnumber}=[];
|
||||
foreach (1..16) {
|
||||
my $randomnumber = int(rand(255));
|
||||
@@ -620,10 +663,12 @@ sub send_rakp1 {
|
||||
my @user = unpack("C*",$self->{userid});
|
||||
push @payload,scalar @user;
|
||||
push @payload,@user;
|
||||
$self->{sessionestablishmentcontext} = STATE_EXPECTINGRAKP2;
|
||||
$self->sendpayload(payload=>\@payload,type=>$payload_types{'rakp1'});
|
||||
}
|
||||
sub init {
|
||||
my $self = shift;
|
||||
$self->{sessionestablishmentcontext} = 0;
|
||||
$self->{'sequencenumber'} = 0; #init sequence number
|
||||
$self->{'sequencenumberbytes'} = [0,0,0,0]; #init sequence number
|
||||
$self->{'sessionid'} = [0,0,0,0]; # init session id
|
||||
@@ -631,6 +676,16 @@ sub init {
|
||||
$self->{'ipmiversion'}='1.5'; # send first packet as 1.5
|
||||
$self->{'timeout'}=$initialtimeout; #start at a quick timeout, increase on retry
|
||||
$self->{'seqlun'}=0; #the IPMB seqlun combo, increment by 4s
|
||||
$self->{rqaddr}=0x81; #Per table '5-4' system sofware ids in the ipmi spec, we are allowed 0x81-0x8d software ids
|
||||
#A problem with ipmi is that chatty commands (rinv) can mistake stale data for new if sequence number overflows
|
||||
#for example, if 'get firmware information' command is retried, and happens to have sequence number 4,
|
||||
#64 transactions later a reply to the retry comes up, the data is passed into the callback function because of ambiguity introduced by the
|
||||
#overflowed sequence number
|
||||
#to mitigate this, we will iterate rqaddr every time the seqlun counter overflows
|
||||
#of course, this still means that rqaddr will, itself, overflow, but it mitigates things because:
|
||||
#448 instead of 64 transactions are now required before ambiguity is possible
|
||||
#A stale reply has to come in after the conversation has advanced at least 448 transactions, meaning longer delay on extraneous reply before this is a problem
|
||||
#even if a stale reply comes in at *about* the right time, it has to match an exact multiple of 448 instead of 64, which is significantly less likely.
|
||||
$self->{'logged'}=0;
|
||||
}
|
||||
sub relog {
|
||||
@@ -644,16 +699,28 @@ sub got_rakp4 {
|
||||
my $self = shift;
|
||||
my @data = @_;
|
||||
my $byte = shift @data;
|
||||
unless ($self->{sessionestablishmentcontext} eq 'rakp4') {
|
||||
unless ($self->{sessionestablishmentcontext} == STATE_EXPECTINGRAKP4) { #ignore rakp4 unless we are explicitly expecting RAKP4
|
||||
return 9; #now's not the time for this response, ignore it
|
||||
}
|
||||
unless ($byte == 0x1f) {
|
||||
unless ($byte == $self->{rmcptag}) { #make sure this rmcp response is specifically the last one we sent.... we don't want to happily proceed with the risk a retry request blew up our temp session id without letting us know
|
||||
return 9;
|
||||
}
|
||||
$byte = shift @data;
|
||||
unless ($byte == 0x00) {
|
||||
if (($byte == 0x02 or $byte == 15) and $self->{logontries}) { # 0x02 is 'invalid session id', seems that some ipmi implementations sometimes expire a temporary id before I can respond, start over in such a case
|
||||
if (($byte == 0x02) and $self->{logontries}) {
|
||||
#ok, turns out an IPMI2 device may optimistically assume that since it has transmitted RAKP4, it's done with this whole RAKP exchange, thus
|
||||
#code 2 can happen.... To workaround this, code 2 is taken as a cue to start over if we haven't got an rakp2 yet
|
||||
$self->relog();
|
||||
}
|
||||
if (($byte == 0x02 or $byte == 15) and $self->{logontries}) { # most likely scenario is that a retry earlier in the process invalided the flow this packet came in on, ignore it and hope the retries all sort out
|
||||
#UPDATE: turns out open rmcp session request shenanigans were to blame, rakp2 straight retransmits seems safe
|
||||
#the biggest risk: that we did not receive the correct rakp2, so the prudent thing to be doing in this time interval would be retrying RAKP1...
|
||||
#ipmi2 session negotiation is a bit weird in how retries can corrupt state and we effectively should be rewinding a bit...
|
||||
#TODO: think about retry logic hard to decide how many packets we can retry
|
||||
#thought: can we match a failed RAKP2 to the last RAKP1 we transmitted? If we can, and we see the last RAKP1 was in fact the one this response is for, that
|
||||
#would definitely mean we should rewinnd to open session rquest..
|
||||
#ditto for rakp4, if we can confirm rakp is for the last transmitted rakp3, then we need to rewind to send_rakp1...
|
||||
#$self->relog();
|
||||
return;
|
||||
}
|
||||
$self->{onlogon}->("ERROR: $byte code on opening RMCP+ session",$self->{onlogon_args}); #TODO: errors
|
||||
@@ -663,7 +730,8 @@ sub got_rakp4 {
|
||||
my @expectauthcode = unpack("C*",hmac_sha1(pack("C*",@{$self->{randomnumber}},@{$self->{pendingsessionid}},@{$self->{remoteguid}}),$self->{sik}));
|
||||
foreach (@expectauthcode[0..11]) {
|
||||
unless ($_ == (shift @data)) {
|
||||
$self->{onlogon}->("ERROR: failure in final rakp exchange message",$self->{onlogon_args});
|
||||
#we'll just ignore this transgression...... *this time*
|
||||
#$self->{onlogon}->("ERROR: failure in final rakp exchange message",$self->{onlogon_args});
|
||||
return 9;
|
||||
}
|
||||
}
|
||||
@@ -674,7 +742,7 @@ sub got_rakp4 {
|
||||
}
|
||||
$self->{sequencenumber}=1;
|
||||
$self->{sequencenumberbytes}=[1,0,0,0];
|
||||
$self->{sessionestablishmentcontext} = 'done'; #will move on to relying upon session sequence number
|
||||
$self->{sessionestablishmentcontext} = STATE_ESTABLISHED; #will move on to relying upon session sequence number
|
||||
$self->set_admin_level();
|
||||
return 0;
|
||||
}
|
||||
@@ -684,16 +752,19 @@ sub got_rakp2 {
|
||||
my $self=shift;
|
||||
my @data = @_;
|
||||
my $byte = shift @data;
|
||||
unless ($self->{sessionestablishmentcontext} eq 'rakp2') {
|
||||
unless ($self->{sessionestablishmentcontext} >= STATE_EXPECTINGRAKP2 and $self->{sessionestablishmentcontext} != STATE_ESTABLISHED) {
|
||||
#we will bail out unless the state is either EXPECTINGRAKP2 or EXPECTINGRAKP4.
|
||||
#the reason being that if an old rakp1 retry actually made it and we were just too aggressive, then a previous rakp2 is invalidated and invalid session id or the integrity check value is bad
|
||||
return 9; #now's not the time for this response, ignore it
|
||||
}
|
||||
unless ($byte == 0x1f) {
|
||||
unless ($byte == $self->{rmcptag}) { #make sure this rmcp response is specifically the last one we sent.... we don't want to happily proceed with the risk a retry request blew up our temp session id without letting us know
|
||||
return 9;
|
||||
}
|
||||
$byte = shift @data;
|
||||
unless ($byte == 0x00) {
|
||||
if (($byte == 0x02 or $byte == 15) and $self->{logontries}) { # 0x02 is 'invalid session id', seems that some ipmi implementations sometimes expire a temporary id before I can respond, start over in such a case
|
||||
$self->relog();
|
||||
if ($byte == 0x02) { #invalid session id is almost certainly because a retry on rmcp+ open session response rendered our session id invalid, ignore this in the hope that we'll get an answer for our retry that invalidated us..
|
||||
#$self->relog();
|
||||
#TODO: probably should disable RAKP1 retry here... high likelihood that we'll just spew a bad RAKP1 and Open Session Request retry would be more appropriate to try to discern a valid session id
|
||||
return;
|
||||
}
|
||||
$self->{onlogon}->("ERROR: $byte code on opening RMCP+ session",$self->{onlogon_args}); #TODO: errors
|
||||
@@ -711,7 +782,7 @@ sub got_rakp2 {
|
||||
#Data now represents authcode.. sha1 only..
|
||||
my @user = unpack("C*",$self->{userid});
|
||||
my $ulength = scalar @user;
|
||||
my $hmacdata = pack("C*",(0x15,0x58,0x25,0x7a,@{$self->{pendingsessionid}},@{$self->{randomnumber}},@{$self->{remoterandomnumber}},@{$self->{remoteguid}},4,$ulength,@user));
|
||||
my $hmacdata = pack("C*",(@{$self->{sidm}},@{$self->{pendingsessionid}},@{$self->{randomnumber}},@{$self->{remoterandomnumber}},@{$self->{remoteguid}},4,$ulength,@user));
|
||||
my @expectedhash = (unpack("C*",hmac_sha1($hmacdata,$self->{password})));
|
||||
foreach (0..(scalar(@expectedhash)-1)) {
|
||||
if ($expectedhash[$_] != $data[$_]) {
|
||||
@@ -726,7 +797,7 @@ sub got_rakp2 {
|
||||
my @aeskey = unpack("C*",$self->{k2});
|
||||
$self->{aeskey} = pack("C*",(splice @aeskey,0,16));
|
||||
}
|
||||
$self->{sessionestablishmentcontext} = 'rakp4';
|
||||
$self->{sessionestablishmentcontext} = STATE_EXPECTINGRAKP4;
|
||||
$self->send_rakp3();
|
||||
return 0;
|
||||
}
|
||||
@@ -736,12 +807,24 @@ sub parse_ipmi_payload {
|
||||
my @payload = @_;
|
||||
#for now, just trash the headers, this has been validated to death anyway
|
||||
#except seqlun, that one is important
|
||||
if ($payload[4] != ($self->{seqlun} ? $self->{seqlun}-4 : 252)) {
|
||||
print "Successfully didn't get confused by stale response ".$payload[4]." and ".($self->{seqlun}-4)."\n";
|
||||
hexdump(@payload);
|
||||
if ($payload[4] != $self->{seqlun} or $payload[0] != $self->{rqaddr}) {
|
||||
#both sequence number and arqaddr must match, because we are using rqaddr to extend the sequence number
|
||||
#print "Successfully didn't get confused by stale response ".$payload[4]." and ".($self->{seqlun}-4)."\n";
|
||||
#hexdump(@payload);
|
||||
return 1; #response mismatch
|
||||
}
|
||||
$self->{seqlun} += 4; #increment by 1<<2
|
||||
if ($self->{seqlun} > 0xff) { #overflow case
|
||||
#Problem with rqaddr iteration strategy to get more sequence numbers, changing swid invalidates reservation ids for some BMCs...
|
||||
# if ($self->{rqaddr} == 0x8d) { #rqaddr itself is forced to overflow
|
||||
# $self->{rqaddr}=0x81;
|
||||
# } else {
|
||||
# $self->{rqaddr}+=2; #table 5-4 demands rqaddr be odd for software ids, so we must increment by 2
|
||||
#}
|
||||
$self->{seqlun} &= 0xff; #keep it one byte
|
||||
}
|
||||
delete $sessions_waiting{$self}; #deregister self as satisfied, callback will reregister if appropriate
|
||||
delete $self->{pendingargs};
|
||||
splice @payload,0,5; #remove rsaddr/netfs/lun/checksum/rq/seq/lun
|
||||
pop @payload; #remove checksum
|
||||
my $rsp;
|
||||
@@ -848,7 +931,7 @@ sub sendpayload {
|
||||
#push integrity data
|
||||
}
|
||||
}
|
||||
unless ($args{nowait}) { #if nowait indicated, the packet will be sent regardless of maxpending
|
||||
unless ($args{nowait} or $self->{nowait}) { #if nowait indicated, the packet will be sent regardless of maxpending
|
||||
#primary use case would be retries that should represent no delta to pending sessions in aggregate and therefore couldn't exceed maxpending anywy
|
||||
#if we did do this on timedout, waitforrsp may recurse, which is a complicated issue. Theoretically, if waitforrsp protected itself, it
|
||||
#would act the same, but best be explicit about nowait if practice does not match theory
|
||||
@@ -864,7 +947,7 @@ sub sendpayload {
|
||||
$sessions_waiting{$self}->{ipmisession}=$self;
|
||||
if ($args{delayxmit}) {
|
||||
$sessions_waiting{$self}->{timeout}=time()+$args{delayxmit};
|
||||
$self->{timeout}=$initialtimeout/2; #since we are burning one of the retry attempts, start the backoff algorithm faster to make it come out even
|
||||
$self->{timeout}=$initialtimeout/1.5; #since we are burning one of the retry attempts, start the backoff algorithm faster to make it come out even
|
||||
undef $args{delayxmit};
|
||||
return; #don't actually transmit packet, use retry timer to start us off
|
||||
} else {
|
||||
|
||||
@@ -372,77 +372,17 @@ sub makescript
|
||||
}
|
||||
|
||||
#get vlan related items
|
||||
my $vlan;
|
||||
my $swtab = xCAT::Table->new("switch", -create => 0);
|
||||
if ($swtab) {
|
||||
my $tmp = $swtab->getNodeAttribs($node, ['vlan'],prefetchcache=>1);
|
||||
if (defined($tmp) && ($tmp) && $tmp->{vlan})
|
||||
{
|
||||
$vlan = $tmp->{vlan};
|
||||
push @scriptd, "VLANID='" . $vlan . "'\n";
|
||||
push @scriptd, "export VLANID\n";
|
||||
} else {
|
||||
my $vmtab = xCAT::Table->new("vm", -create => 0);
|
||||
if ($vmtab) {
|
||||
my $tmp1 = $vmtab->getNodeAttribs($node, ['nics'],prefetchcache=>1);
|
||||
if (defined($tmp1) && ($tmp1) && $tmp1->{nics})
|
||||
{
|
||||
push @scriptd, "VMNODE='YES'\n";
|
||||
push @scriptd, "export VMNODE\n";
|
||||
|
||||
my @nics=split(',', $tmp1->{nics});
|
||||
foreach my $nic (@nics) {
|
||||
if ($nic =~ /^vl([\d]+)$/) {
|
||||
$vlan = $1;
|
||||
push @scriptd, "VLANID='" . $vlan . "'\n";
|
||||
push @scriptd, "export VLANID\n";
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
my $module_name="xCAT_plugin::vlan";
|
||||
eval("use $module_name;");
|
||||
if (!$@) {
|
||||
no strict "refs";
|
||||
if (defined(${$module_name."::"}{getNodeVlanConfData})) {
|
||||
my @tmp_scriptd=${$module_name."::"}{getNodeVlanConfData}->($node);
|
||||
#print Dumper(@tmp_scriptd);
|
||||
if (@tmp_scriptd > 0) {
|
||||
@scriptd=(@scriptd,@tmp_scriptd);
|
||||
}
|
||||
}
|
||||
|
||||
if ($vlan) {
|
||||
my $nwtab=xCAT::Table->new("networks", -create =>0);
|
||||
if ($nwtab) {
|
||||
my $sent = $nwtab->getAttribs({vlanid=>"$vlan"},'net','mask');
|
||||
my $subnet;
|
||||
my $netmask;
|
||||
if ($sent and ($sent->{net})) {
|
||||
$subnet=$sent->{net};
|
||||
$netmask=$sent->{mask};
|
||||
}
|
||||
if (($subnet) && ($netmask)) {
|
||||
my $hoststab = xCAT::Table->new("hosts", -create => 0);
|
||||
if ($hoststab) {
|
||||
my $tmp = $hoststab->getNodeAttribs($node, ['otherinterfaces'],prefetchcache=>1);
|
||||
if (defined($tmp) && ($tmp) && $tmp->{otherinterfaces})
|
||||
{
|
||||
my $otherinterfaces = $tmp->{otherinterfaces};
|
||||
my @itf_pairs=split(/,/, $otherinterfaces);
|
||||
foreach (@itf_pairs) {
|
||||
my ($name,$ip)=split(/:/, $_);
|
||||
if(xCAT::NetworkUtils->ishostinsubnet($ip, $netmask, $subnet)) {
|
||||
if ($name =~ /^-/ ) {
|
||||
$name = $node.$name;
|
||||
}
|
||||
push @scriptd, "VLANHOSTNAME='" . $name . "'\n";
|
||||
push @scriptd, "export VLANHOSTNAME\n";
|
||||
push @scriptd, "VLANIP='" . $ip . "'\n";
|
||||
push @scriptd, "export VLANIP\n";
|
||||
push @scriptd, "VLANSUBNET='" . $subnet . "'\n";
|
||||
push @scriptd, "export VLANSUBNET\n";
|
||||
push @scriptd, "VLANNETMASK='" . $netmask . "'\n";
|
||||
push @scriptd, "export VLANNETMASK\n";
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1415,7 +1415,7 @@ sub enable_TFTPhpa
|
||||
push @newcfgfile, $_;
|
||||
}
|
||||
} elsif (/^\s*disable\s*=/ && !/^\s*disable\s*=\s*yes/) {
|
||||
# enable the tftp by handling the entry 'disable = xx'
|
||||
# disable the tftp by handling the entry 'disable = yes'
|
||||
my $newcfg = $_;
|
||||
$newcfg =~ s/=.*$/= yes/;
|
||||
push @newcfgfile, $newcfg;
|
||||
@@ -1464,23 +1464,9 @@ sub enable_TFTPhpa
|
||||
}
|
||||
}
|
||||
}
|
||||
# /usr/sbin/in.tftpd -V
|
||||
# tftp-hpa 0.49, with remap, with tcpwrappers
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# start xinetd
|
||||
#my $rc = xCAT::Utils->startService("xinetd");
|
||||
#if ($rc != 0)
|
||||
#{
|
||||
# xCAT::MsgUtils->message("S", " Failed to start xinetd.");
|
||||
# return 1;
|
||||
#}
|
||||
#xCAT::MsgUtils->message("S", " The tftp-hpa has been reconfigured.");
|
||||
}
|
||||
|
||||
# get the version of TCP/IP protocol
|
||||
my $protocols;
|
||||
my $v4only="-4 ";
|
||||
open($protocols,"<","/proc/net/protocols");
|
||||
@@ -1495,13 +1481,21 @@ sub enable_TFTPhpa
|
||||
} else {
|
||||
$v4only="";
|
||||
}
|
||||
|
||||
# get the tftpflags which set by customer
|
||||
my $tftpflags = xCAT::Utils->get_site_attribute("tftpflags");
|
||||
my $startcmd = "/usr/sbin/in.tftpd $v4only -v -l -s $tftpdir -m /etc/tftpmapfile4xcat.conf";
|
||||
if ($tftpflags) {
|
||||
$startcmd = "/usr/sbin/in.tftpd $v4only $tftpflags";
|
||||
}
|
||||
|
||||
if (-x "/usr/sbin/in.tftpd") {
|
||||
system("killall in.tftpd"); #xinetd can leave behind blocking tftp servers even if it won't start new ones
|
||||
my @tftpprocs=`ps axf|grep -v grep|grep in.tftpd`;
|
||||
while (@tftpprocs) {
|
||||
sleep 0.1;
|
||||
}
|
||||
system("/usr/sbin/in.tftpd $v4only -v -l -s /tftpboot -m /etc/tftpmapfile4xcat.conf");
|
||||
system("$startcmd");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -34,7 +34,7 @@ sub handled_commands
|
||||
return {
|
||||
copycd => "anaconda",
|
||||
mknetboot => "nodetype:os=(centos.*)|(rh.*)|(fedora.*)|(SL.*)",
|
||||
mkinstall => "nodetype:os=(esxi4.1)|(esx[34].*)|(centos.*)|(rh.*)|(fedora.*)|(SL.*)",
|
||||
mkinstall => "nodetype:os=(esxi4.1)|(esx[34].*)|(centos.*)|(rh(?!evh).*)|(fedora.*)|(SL.*)",
|
||||
mkstatelite => "nodetype:os=(esx[34].*)|(centos.*)|(rh.*)|(fedora.*)|(SL.*)",
|
||||
|
||||
};
|
||||
@@ -1074,7 +1074,7 @@ sub mkinstall
|
||||
{
|
||||
mkpath("$tftpdir/xcat/$os/$arch");
|
||||
if($esxi){
|
||||
copyesxiboot($pkgdir, "$tftpdir/xcat/$os/$arch");
|
||||
copyesxiboot($pkgdir, "$tftpdir/xcat/$os/$arch",osver=>$os);
|
||||
}else{
|
||||
copy($kernpath,"$tftpdir/xcat/$os/$arch");
|
||||
copy($initrdpath,"$tftpdir/xcat/$os/$arch/initrd.img");
|
||||
@@ -1465,6 +1465,10 @@ sub getplatform {
|
||||
{
|
||||
$platform = "fedora";
|
||||
}
|
||||
elsif ($os =~ /esxi.*/)
|
||||
{
|
||||
$platform = "esxi";
|
||||
}
|
||||
elsif ($os =~ /esx.*/)
|
||||
{
|
||||
$platform = "esx";
|
||||
@@ -1481,9 +1485,13 @@ sub getplatform {
|
||||
sub copyesxiboot {
|
||||
my $srcdir = shift;
|
||||
my $targetdir = shift;
|
||||
my %args=@_;
|
||||
my $os='esxi';
|
||||
if ($args{osver}) { $os=$args{osver} }
|
||||
# this just does the same thing that the stateless version does.
|
||||
unless(-f "$targetdir/mod.tgz"){
|
||||
xCAT_plugin::esx::makecustomizedmod('esxi', $targetdir);
|
||||
require xCAT_plugin::esx;
|
||||
xCAT_plugin::esx::makecustomizedmod($os, $targetdir);
|
||||
}
|
||||
my @files = qw(mboot.c32 vmkboot.gz vmkernel.gz sys.vgz cim.vgz ienviron.vgz install.vgz);
|
||||
foreach my $f (@files){
|
||||
|
||||
@@ -4211,6 +4211,10 @@ sub clicmds {
|
||||
push @cfgtext,"The current account password has expired, please modify it first";
|
||||
return ([1,\@unhandled,"Management module refuses requested password as insufficiently secure, try another password"]);
|
||||
}
|
||||
$t->waitfor(match=>"/system> /");
|
||||
$t->cmd("accseccfg -rc 0 -pe 0 -pi 0 -ct 0 -lp 0 -lf 0 -T system:mm[1]");
|
||||
$t->waitfor(match=>"/system> /");
|
||||
$t->cmd("accseccfg -rc 0 -pe 0 -pi 0 -ct 0 -lp 0 -lf 0 -T system:mm[2]");
|
||||
}
|
||||
$t->waitfor(match=>"/system> /");
|
||||
} elsif (not $t) {#ssh failed.. fallback to a telnet attempt for older AMMs with telnet disabled by default
|
||||
@@ -4338,7 +4342,7 @@ sub rscanfsp {
|
||||
if (/(mm\[\d+\])\s+primary/) {
|
||||
# get the type of mm
|
||||
@data = $t->cmd("info -T system:$1");
|
||||
if (grep /(Mach type\/model: Chassis Management Module)|(Mach type\/model: CMM)/, @data) {
|
||||
if (grep /(Mach type\/model: Chassis Management Module)|(Mach type\/model: CMM)|(Product Name:.*Chassis Management Module)/, @data) {
|
||||
$telnetrscan{'mm'}{'type'} = "cmm";
|
||||
}
|
||||
}
|
||||
@@ -4479,6 +4483,7 @@ sub passwd {
|
||||
return ([1, @data]);
|
||||
}
|
||||
}
|
||||
|
||||
@data = ();
|
||||
my $snmp_cmd = "users -n $user -ap sha -pp des -ppw $pass -T system:$mm";
|
||||
@data = $t->cmd($snmp_cmd);
|
||||
|
||||
@@ -105,6 +105,10 @@ sub process_request {
|
||||
if ($arch) {
|
||||
push @{$newreq->{arg}},("-a",$arch);
|
||||
}
|
||||
if (! -l $file) {
|
||||
push @{$newreq->{arg}},("-f",$file);
|
||||
}
|
||||
|
||||
$doreq->($newreq,\&take_answer);
|
||||
$::CDMOUNTPATH="";
|
||||
|
||||
|
||||
@@ -4090,7 +4090,7 @@ sub copycd {
|
||||
}
|
||||
close(LINE);
|
||||
if ($product and $version) {
|
||||
$distname = $product.$version;
|
||||
unless ($distname) { $distname = $product.$version; }
|
||||
$found = 1;
|
||||
}
|
||||
} elsif (-r $path . "/README" and -r $path . "/open_source_licenses.txt" and -d $path . "/VMware") { #Candidate to be ESX 3.5
|
||||
@@ -4099,7 +4099,7 @@ sub copycd {
|
||||
if (/VMware ESX Server 3.5\s*$/) {
|
||||
$darch ='x86';
|
||||
$arch = 'x86';
|
||||
$distname = 'esx3.5';
|
||||
unless ($distname) { $distname = 'esx3.5'; }
|
||||
$found = 1;
|
||||
last;
|
||||
}
|
||||
@@ -4115,10 +4115,12 @@ sub copycd {
|
||||
chomp($line);
|
||||
if($line =~ /VMware ESXi(?: version)? 4\.(\d+)/){
|
||||
$darch = "x86_64";
|
||||
unless ($distname) {
|
||||
$distname = "esxi4";
|
||||
if ($1) {
|
||||
$distname .= '.'.$1;
|
||||
}
|
||||
}
|
||||
$found = 1;
|
||||
if( $arch and $arch ne $darch){
|
||||
xCAT::SvrUtils::sendmsg([1, "Requested distribution architecture $arch, but media is $darch"], $output_handler);
|
||||
@@ -4139,7 +4141,7 @@ sub copycd {
|
||||
if (/ThinESX Installer/) {
|
||||
$darch = 'x86';
|
||||
$arch='x86';
|
||||
$distname='esxi3.5';
|
||||
unless ($distname) { $distname='esxi3.5'; }
|
||||
$found=1;
|
||||
last;
|
||||
}
|
||||
@@ -4151,14 +4153,14 @@ sub copycd {
|
||||
if (/VMware ESXi 5\.0/) {
|
||||
$darch="x86_64";
|
||||
$arch="x86_64";
|
||||
$distname='esxi5';
|
||||
unless ($distname) { $distname='esxi5'; }
|
||||
$found=1;
|
||||
last;
|
||||
}
|
||||
if (/VMware ESXi 5\.1/) {
|
||||
$darch="x86_64";
|
||||
$arch="x86_64";
|
||||
$distname='esxi5.1';
|
||||
unless ($distname) { $distname='esxi5.1'; }
|
||||
$found=1;
|
||||
last;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ use xCAT::GlobalDef;
|
||||
use xCAT_monitoring::monitorctrl;
|
||||
use xCAT::SPD qw/decode_spd/;
|
||||
use xCAT::IPMI;
|
||||
my %needbladeinv;
|
||||
|
||||
use POSIX qw(ceil floor);
|
||||
use Storable qw(store_fd retrieve_fd thaw freeze);
|
||||
@@ -28,6 +29,7 @@ use HTTP::Request::Common;
|
||||
my $iem_support;
|
||||
my $vpdhash;
|
||||
my %allerrornodes=();
|
||||
my $immdetected=0;
|
||||
|
||||
eval {
|
||||
require IBM::EnergyManager;
|
||||
@@ -1058,7 +1060,7 @@ sub check_rsp_errors { #TODO: pass in command-specfic error code translation tab
|
||||
}
|
||||
if ($rsp->{code}) { #ipmi error
|
||||
if ($codes{$rsp->{code}}) {
|
||||
xCAT::SvrUtils::sendmsg([1,$codes{$rsp->{code}}],$callback);
|
||||
xCAT::SvrUtils::sendmsg([1,$codes{$rsp->{code}}],$callback,$sessdata->{node},%allerrornodes);
|
||||
} else {
|
||||
xCAT::SvrUtils::sendmsg([1,sprintf("Unknown error code %02xh",$rsp->{code})],$callback,$sessdata->{node},%allerrornodes);
|
||||
}
|
||||
@@ -1489,7 +1491,7 @@ sub inv {
|
||||
$subcommand = "all";
|
||||
}
|
||||
if($subcommand eq "all") {
|
||||
@types = qw(model serial deviceid mprom guid misc hw asset firmware);
|
||||
@types = qw(model serial deviceid mprom guid misc hw asset firmware mac);
|
||||
}
|
||||
elsif($subcommand eq "asset") {
|
||||
$sessdata->{skipotherfru}=1;
|
||||
@@ -1554,6 +1556,9 @@ sub fru_initted {
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($sessdata->{isite} and (grep {$_ eq "mac"} @types)) {
|
||||
$needbladeinv{$_}="mac";
|
||||
}
|
||||
}
|
||||
|
||||
sub add_textual_fru {
|
||||
@@ -1679,12 +1684,122 @@ sub got_bmc_fw_info {
|
||||
$fru->desc("BMC Firmware");
|
||||
$fru->value($mprom);
|
||||
$sessdata->{fru_hash}->{mprom} = $fru;
|
||||
$sessdata->{isanimm}=$isanimm;
|
||||
if ($isanimm) {
|
||||
$sessdata->{ipmisession}->subcmd(netfn=>0x3a,command=>0xf0,data=>[0,0,0,0],callback=>\&get_uefi_version_with_fmapi,callback_args=>$sessdata);
|
||||
#$sessdata->{ipmisession}->subcmd(netfn=>0x3a,command=>0xf0,data=>[0,0,0,0],callback=>\&get_uefi_version_with_fmapi,callback_args=>$sessdata);
|
||||
get_imm_property(property=>"/v2/bios/build_id",callback=>\&got_bios_buildid,sessdata=>$sessdata);
|
||||
} else {
|
||||
initfru_with_mprom($sessdata);
|
||||
}
|
||||
}
|
||||
sub got_bios_buildid {
|
||||
my %res = @_;
|
||||
my $sessdata = $res{sessdata};
|
||||
if ($res{data}) {
|
||||
$sessdata->{biosbuildid} = $res{data};
|
||||
get_imm_property(property=>"/v2/bios/build_version",callback=>\&got_bios_version,sessdata=>$sessdata);
|
||||
} else {
|
||||
initfru_with_mprom($sessdata);
|
||||
}
|
||||
}
|
||||
sub got_bios_version {
|
||||
my %res = @_;
|
||||
my $sessdata = $res{sessdata};
|
||||
if ($res{data}) {
|
||||
$sessdata->{biosbuildversion} = $res{data};
|
||||
get_imm_property(property=>"/v2/bios/build_date",callback=>\&got_bios_date,sessdata=>$sessdata);
|
||||
} else {
|
||||
initfru_with_mprom($sessdata);
|
||||
}
|
||||
}
|
||||
sub got_bios_date {
|
||||
my %res = @_;
|
||||
my $sessdata = $res{sessdata};
|
||||
if ($res{data}) {
|
||||
$sessdata->{biosbuilddate} = $res{data};
|
||||
my $fru = FRU->new();
|
||||
$fru->rec_type("bios,uefi,firmware");
|
||||
$fru->desc("UEFI Version");
|
||||
$fru->value($sessdata->{biosbuildversion}." (".$sessdata->{biosbuildid}." ".$sessdata->{biosbuilddate}.")");
|
||||
$sessdata->{fru_hash}->{uefi} = $fru;
|
||||
get_imm_property(property=>"/v2/fpga/build_id",callback=>\&got_fpga_buildid,sessdata=>$sessdata);
|
||||
} else {
|
||||
initfru_with_mprom($sessdata);
|
||||
}
|
||||
}
|
||||
sub got_fpga_buildid {
|
||||
my %res = @_;
|
||||
my $sessdata = $res{sessdata};
|
||||
if ($res{data}) {
|
||||
$sessdata->{fpgabuildid} = $res{data};
|
||||
get_imm_property(property=>"/v2/fpga/build_version",callback=>\&got_fpga_version,sessdata=>$sessdata);
|
||||
} else {
|
||||
initfru_with_mprom($sessdata);
|
||||
}
|
||||
}
|
||||
sub got_fpga_version {
|
||||
my %res = @_;
|
||||
my $sessdata = $res{sessdata};
|
||||
if ($res{data}) {
|
||||
$sessdata->{fpgabuildversion} = $res{data};
|
||||
get_imm_property(property=>"/v2/fpga/build_date",callback=>\&got_fpga_date,sessdata=>$sessdata);
|
||||
} else {
|
||||
initfru_with_mprom($sessdata);
|
||||
}
|
||||
}
|
||||
sub got_fpga_date {
|
||||
my %res = @_;
|
||||
my $sessdata = $res{sessdata};
|
||||
if ($res{data}) {
|
||||
$sessdata->{fpgabuilddate} = $res{data};
|
||||
my $fru = FRU->new();
|
||||
$fru->rec_type("fpga,firmware");
|
||||
$fru->desc("FPGA Version");
|
||||
$fru->value($sessdata->{fpgabuildversion}." (".$sessdata->{fpgabuildid}." ".$sessdata->{fpgabuilddate}.")");
|
||||
$sessdata->{fru_hash}->{fpga} = $fru;
|
||||
}
|
||||
initfru_with_mprom($sessdata);
|
||||
}
|
||||
sub get_imm_property {
|
||||
my %args = @_;
|
||||
my @getpropertycommand;
|
||||
my $sessdata = $args{sessdata};
|
||||
$sessdata->{property_callback} = $args{callback};
|
||||
@getpropertycommand = unpack("C*",$args{property});
|
||||
my $length = 0b10000000 | (scalar @getpropertycommand);#use length to store tlv
|
||||
unshift @getpropertycommand,$length;
|
||||
#command also needs the overall length
|
||||
$length = (scalar @getpropertycommand);
|
||||
unshift @getpropertycommand,$length&0xff;
|
||||
unshift @getpropertycommand,($length>>8)&0xff;
|
||||
unshift @getpropertycommand,0; #the actual 'get proprety' command is 0.
|
||||
$sessdata->{ipmisession}->subcmd(netfn=>0x3a,command=>0xc4,data=>\@getpropertycommand,callback=>\&got_imm_property,callback_args=>$sessdata);
|
||||
|
||||
}
|
||||
sub got_imm_property {
|
||||
if (check_rsp_errors(@_)) {
|
||||
return;
|
||||
}
|
||||
my $rsp = shift;
|
||||
my $sessdata = shift;
|
||||
my @data = @{$rsp->{data}};
|
||||
my $propval = shift @data;
|
||||
my %res;
|
||||
$res{sessdata}=$sessdata;
|
||||
if ($propval == 0) { #success
|
||||
shift @data; #discard payload size
|
||||
shift @data; #discard payload size
|
||||
while (@data) {
|
||||
my $tlv = shift @data;
|
||||
if ($tlv & 0b10000000) {
|
||||
$tlv = $tlv & 0b1111111;
|
||||
my @val = splice(@data,0,$tlv);
|
||||
$res{data}= unpack("Z*",pack("C*",@val));
|
||||
}
|
||||
}
|
||||
}
|
||||
$sessdata->{property_callback}->(%res);
|
||||
}
|
||||
sub get_uefi_version_with_fmapi {
|
||||
if (check_rsp_errors(@_)) {
|
||||
return;
|
||||
@@ -1996,6 +2111,31 @@ sub initfru_zero {
|
||||
}
|
||||
$sessdata->{fru_hash}->{$frudex++} = $fru;
|
||||
}
|
||||
if ($fruhash->{board}->{frunum}) {
|
||||
$fru = FRU->new();
|
||||
$fru->rec_type("misc");
|
||||
$fru->desc("Board FRU Number");
|
||||
$fru->value($fruhash->{board}->{frunum});
|
||||
$sessdata->{fru_hash}->{$frudex++} = $fru;
|
||||
}
|
||||
if ($fruhash->{board}->{revision}) {
|
||||
$fru = FRU->new();
|
||||
$fru->rec_type("misc");
|
||||
$fru->desc("Board Revision");
|
||||
$fru->value($fruhash->{board}->{revision});
|
||||
$sessdata->{fru_hash}->{$frudex++} = $fru;
|
||||
}
|
||||
if ($fruhash->{board}->{macaddrs}) {
|
||||
my $macindex=1;
|
||||
foreach my $mac (@{$fruhash->{board}->{macaddrs}}) {
|
||||
$fru = FRU->new();
|
||||
$fru->rec_type("mac");
|
||||
$fru->desc("MAC Address $macindex");
|
||||
$macindex++;
|
||||
$fru->value($mac);
|
||||
$sessdata->{fru_hash}->{$frudex++} = $fru;
|
||||
}
|
||||
}
|
||||
if ($fruhash->{board}->{name}->{value}) {
|
||||
$fru = FRU->new();
|
||||
$fru->rec_type("misc");
|
||||
@@ -2307,7 +2447,9 @@ sub add_fruhash {
|
||||
$fruhash = decode_spd(@{$sessdata->{currfrudata}});
|
||||
} else {
|
||||
my $err;
|
||||
$immdetected=$sessdata->{isanimm}; #pass by global, evil, but practical this time
|
||||
($err,$fruhash) = parsefru($sessdata->{currfrudata});
|
||||
$immdetected=0; #revert state of global
|
||||
if ($err) {
|
||||
my $fru = FRU->new();
|
||||
if ($sessdata->{currfrutype} and $sessdata->{currfrutype} eq 'dimm') {
|
||||
@@ -2630,6 +2772,24 @@ sub parseboard {
|
||||
$idx+=$currsize;
|
||||
($currsize,$currdata,$encode)=extractfield(\@area,$idx);
|
||||
}
|
||||
if ($immdetected) { #we can understand more specifically some of the extra fields...
|
||||
$boardinf{frunum}=$boardinf{extra}->[0]->{value};
|
||||
$boardinf{revision}=$boardinf{extra}->[4]->{value};
|
||||
#time to process the mac field...
|
||||
my $macdata = $boardinf{extra}->[6]->{value};
|
||||
my $macstring = "1";
|
||||
while ($macstring !~ /00:00:00:00:00:00/) {
|
||||
my @currmac = splice @$macdata,0,6;
|
||||
unless ((scalar @currmac) == 6) {
|
||||
last;
|
||||
}
|
||||
$macstring = sprintf("%02x:%02x:%02x:%02x:%02x:%02x",@currmac);
|
||||
if ($macstring !~ /00:00:00:00:00:00/) {
|
||||
push @{$boardinf{macaddrs}},$macstring;
|
||||
}
|
||||
}
|
||||
delete $boardinf{extra};
|
||||
}
|
||||
return \%boardinf;
|
||||
}
|
||||
sub parsechassis {
|
||||
@@ -2953,7 +3113,7 @@ sub decodealert {
|
||||
my %sdr_hash = %{$sessdata->{sdr_hash}};
|
||||
foreach $key (keys %sdr_hash) {
|
||||
my $sdr = $sdr_hash{$key};
|
||||
if($sdr->sensor_number == $sensor_num) {
|
||||
if($sdr->sensor_number == $sensor_num and $sdr->rec_type != 192 and $sdr->rec_type != 17) {
|
||||
$sensor_desc = $sdr_hash{$key}->id_string;
|
||||
if($sdr->rec_type == 0x01) {
|
||||
last;
|
||||
@@ -3584,6 +3744,8 @@ sub getaddsensorevent {
|
||||
0x0 => "Vendor mismatch",
|
||||
0x1 => "Revision mismatch",
|
||||
0x2 => "Processor missing",
|
||||
0x3 => "Power Supply rating mismatch",
|
||||
0x4 => "Voltage rating mismatch",
|
||||
);
|
||||
if ($extra{$event_data_3}) {
|
||||
$text = $extra{$event_data_3};
|
||||
@@ -3659,11 +3821,38 @@ sub getaddsensorevent {
|
||||
$text .= sprintf ("type %02xh/offset %02xh",$event_data_2,$event_data_3&0x0F);
|
||||
} elsif ($offset == 0x05) {
|
||||
$text = "$event_data_3% full";
|
||||
}elsif($offset==0x06){
|
||||
if(defined $event_data_2){
|
||||
if(defined($event_data_3) and ($event_data_3 & 0x80 == 0x80)){
|
||||
$text="Vendor-specific processor number:";
|
||||
}else{
|
||||
$text="Entity Instance number:";
|
||||
}
|
||||
$text.=sprintf("%02xh",$event_data_2 & 0xff);
|
||||
}else{
|
||||
$text="for all Processor sensors";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($sensor_type == 0x12) {
|
||||
if($offset == 0x03) {
|
||||
my %extra={
|
||||
0x0 => "Log Entry Action: entry added",
|
||||
0x1 => "Log Entry Action: entry added because event did not be map to standard IPMI event",
|
||||
0x2 => "Log Entry Action: entry added along with one or more corresponding SEL entries",
|
||||
0x3 => "Log Entry Action: log cleared",
|
||||
0x4 => "Log Entry Action: log disabled",
|
||||
0x5 => "Log Entry Action: log enabled",
|
||||
};
|
||||
$text="$text, ".$extra{($event_data_2>>4) & 0x0f};
|
||||
%extra={
|
||||
0x0 => "Log Type:MCA Log",
|
||||
0x1 => "Log Type:OEM 1",
|
||||
0x2 => "Log Type:OEM 2",
|
||||
};
|
||||
$text="$text, ".$extra{($event_data_2) & 0x0f};
|
||||
$text =~ s/^, //;
|
||||
}
|
||||
if($offset == 0x04) {
|
||||
if($event_data_2 & 0b00100000) {
|
||||
@@ -3686,6 +3875,19 @@ sub getaddsensorevent {
|
||||
}
|
||||
$text =~ s/^, //;
|
||||
}
|
||||
if($offset == 0x05){
|
||||
if($event_data_2 & 0x80){
|
||||
$text="$text, event is second of pair";
|
||||
}elsif($event_data_2 & 0x80==0){
|
||||
$text="$text, event is first of pair";
|
||||
}
|
||||
if($event_data_2 & 0x0F == 0x1){
|
||||
$text="$text, SDR Timestamp Clock updated";
|
||||
}elsif($event_data_2 & 0x0F == 0x0){
|
||||
$text="$text, SEL Timestamp Clock updated";
|
||||
}
|
||||
$text =~ s/^, //;
|
||||
}
|
||||
}
|
||||
if ($sensor_type == 0x1d && $offset == 0x07) {
|
||||
my %causes = (
|
||||
@@ -4093,19 +4295,19 @@ sub did_led {
|
||||
if ($returnd[2]) { # != 0) {
|
||||
#It's on...
|
||||
if ($returnd[6] == 4) {
|
||||
xCAT::SvrUtils::sendmsg(sprintf("BIOS or admininstrator has %s lit",getsensorname($mfg_id,$prod_id,$sdr->led_id,"ibmleds")),$callback,$sessdata->{node},%allerrornodes);
|
||||
xCAT::SvrUtils::sendmsg(sprintf("BIOS or admininstrator has %s lit",getsensorname($mfg_id,$prod_id,$sdr->led_id,"ibmleds",$sdr)),$callback,$sessdata->{node},%allerrornodes);
|
||||
$sessdata->{activeleds}=1;
|
||||
}
|
||||
elsif ($returnd[6] == 3) {
|
||||
xCAT::SvrUtils::sendmsg(sprintf("A user has manually requested LED 0x%04x (%s) be active",$sdr->led_id,getsensorname($mfg_id,$prod_id,$sdr->led_id,"ibmleds")),$callback,$sessdata->{node},%allerrornodes);
|
||||
xCAT::SvrUtils::sendmsg(sprintf("A user has manually requested LED 0x%04x (%s) be active",$sdr->led_id,getsensorname($mfg_id,$prod_id,$sdr->led_id,"ibmleds",$sdr)),$callback,$sessdata->{node},%allerrornodes);
|
||||
$sessdata->{activeleds}=1;
|
||||
}
|
||||
elsif ($returnd[6] == 1 && $sdr->led_id !=0) {
|
||||
xCAT::SvrUtils::sendmsg(sprintf("LED 0x%02x%02x (%s) active to indicate LED 0x%02x%02x (%s) is active",$led_id_ms,$led_id_ls,getsensorname($mfg_id,$prod_id,$sdr->led_id,"ibmleds"),$returnd[4],$returnd[5],getsensorname($mfg_id,$prod_id,($returnd[4]<<8)+$returnd[5],"ibmleds")),$callback,$sessdata->{node},%allerrornodes);
|
||||
xCAT::SvrUtils::sendmsg(sprintf("LED 0x%02x%02x (%s) active to indicate LED 0x%02x%02x (%s) is active",$led_id_ms,$led_id_ls,getsensorname($mfg_id,$prod_id,$sdr->led_id,"ibmleds",$sdr),$returnd[4],$returnd[5],getsensorname($mfg_id,$prod_id,($returnd[4]<<8)+$returnd[5],"ibmleds")),$callback,$sessdata->{node},%allerrornodes);
|
||||
$sessdata->{activeleds}=1;
|
||||
}
|
||||
elsif ($sdr->led_id ==0 and $led_id_ms == 0 and $led_id_ls == 0) {
|
||||
xCAT::SvrUtils::sendmsg(sprintf("LED 0x0000 (%s) active to indicate system error condition.",getsensorname($mfg_id,$prod_id,$sdr->led_id,"ibmleds")),$callback,$sessdata->{node},%allerrornodes);
|
||||
xCAT::SvrUtils::sendmsg(sprintf("LED 0x0000 (%s) active to indicate system error condition.",getsensorname($mfg_id,$prod_id,$sdr->led_id,"ibmleds",$sdr)),$callback,$sessdata->{node},%allerrornodes);
|
||||
$sessdata->{activeleds}=1;
|
||||
if ($returnd[6] == 1 and $returnd[4] == 0xf and $returnd[5] == 0xff) {
|
||||
$sessdata->{doled} = [$returnd[4],$returnd[5]];
|
||||
@@ -4120,7 +4322,7 @@ sub did_led {
|
||||
my %sdr_hash = %{$sessdata->{sdr_hash}};
|
||||
foreach my $key (keys %sdr_hash) {
|
||||
my $osdr = $sdr_hash{$key};
|
||||
if($osdr->sensor_number == $sensor_num) {
|
||||
if($osdr->sensor_number == $sensor_num and $osdr->rec_type != 192 and $osdr->rec_type != 17) {
|
||||
$sensor_desc = $sdr_hash{$key}->id_string;
|
||||
if($osdr->rec_type == 0x01) {
|
||||
last;
|
||||
@@ -4131,7 +4333,7 @@ sub did_led {
|
||||
if ($led_id_ms == 0xf and $led_id_ls == 0xff) {
|
||||
xCAT::SvrUtils::sendmsg(sprintf("LED active to indicate Sensor 0x%02x (%s) error.",$sensor_num,$sensor_desc),$callback,$sessdata->{node},%allerrornodes);
|
||||
} else {
|
||||
xCAT::SvrUtils::sendmsg(sprintf("LED %02x%02x active to indicate Sensor 0x%02x (%s) error.",$led_id_ms,$led_id_ls,$sensor_num,$sensor_desc),$callback,$sessdata->{node},%allerrornodes);
|
||||
xCAT::SvrUtils::sendmsg(sprintf("LED %02x%02x (%s) active to indicate Sensor 0x%02x (%s) error.",$led_id_ms,$led_id_ls,getsensorname($mfg_id,$prod_id,$sdr->led_id,"ibmleds",$sdr),$sensor_num,$sensor_desc),$callback,$sessdata->{node},%allerrornodes);
|
||||
}
|
||||
$sessdata->{activeleds}=1;
|
||||
} else { #an LED is on for some other reason
|
||||
@@ -4985,6 +5187,10 @@ sub parse_sdr { #parse sdr data, then cann initsdr_withreserveation to advance t
|
||||
} else {
|
||||
$sdr->led_id(($sdr_data[12]<<8)+$sdr_data[13]);
|
||||
}
|
||||
if (scalar(@sdr_data) > 17) { #well what do you know, we have an ascii description, probably...
|
||||
my $id = unpack("Z*",pack("C*",@sdr_data[16..$#sdr_data]));
|
||||
if ($id) { $sdr->id_string($id); }
|
||||
}
|
||||
#$sdr->led_id_ms($sdr_data[13]);
|
||||
#$sdr->led_id_ls($sdr_data[12]);
|
||||
$sdr->sensor_number(sprintf("%04x",$sdr->led_id));
|
||||
@@ -5066,6 +5272,7 @@ sub getsensorname
|
||||
my $prodid = shift;
|
||||
my $sensor = shift;
|
||||
my $file = shift;
|
||||
my $sdr = shift;
|
||||
|
||||
my $mfg;
|
||||
my $prod;
|
||||
@@ -5074,6 +5281,7 @@ sub getsensorname
|
||||
my $name="";
|
||||
|
||||
if ($file and $file eq "ibmleds") {
|
||||
if ($sdr and $sdr->id_string ne "LED") { return $sdr->id_string; } # this is preferred mechanism
|
||||
if ($xCAT::data::ibmleds::leds{"$mfgid,$prodid"}->{$sensor}) {
|
||||
return $xCAT::data::ibmleds::leds{"$mfgid,$prodid"}->{$sensor}. " LED";
|
||||
} elsif ($ndebug) {
|
||||
@@ -5721,7 +5929,7 @@ sub process_request {
|
||||
|
||||
|
||||
if ($command eq 'rpower') {
|
||||
if (($global_check) && ($extrargs->[0] ne 'stat') && ($extrargs->[0] ne 'status') && ($extrargs->[0] ne 'state')) {
|
||||
if (($global_check) && ($extrargs->[0] ne 'stat') && ($extrargs->[0] ne 'status') && ($extrargs->[0] ne 'state') && ($extrargs->[0] ne 'suspend') && ($extrargs->[0] ne 'wake')) {
|
||||
$check=1;
|
||||
my @allnodes=();
|
||||
foreach (@donargs) { push(@allnodes, $_->[0]); }
|
||||
@@ -5780,6 +5988,14 @@ sub process_request {
|
||||
}
|
||||
}
|
||||
while (xCAT::IPMI->waitforrsp()) { yield };
|
||||
if (keys %needbladeinv) {
|
||||
#ok, we have some inventory data that, for now, suggests blade plugin to getdata from blade plugin
|
||||
# my @bladenodes = keys %needbladeinv;
|
||||
# $request->{arg}=['mac'];
|
||||
# $request->{node}=\@bladenodes;
|
||||
# require xCAT_plugin::blade;
|
||||
# xCAT_plugin::blade::process_request($request,$callback);
|
||||
}
|
||||
####return;
|
||||
####while ($sub_fds->count > 0 and $children > 0) {
|
||||
#### my $handlednodes={};
|
||||
|
||||
@@ -997,8 +997,10 @@ sub xhrm_satisfy {
|
||||
my $vlanip;
|
||||
my $netmask;
|
||||
my $subnet;
|
||||
my $vlan;
|
||||
my $interface;
|
||||
if ($nic =~ /^vl([\d]+)$/) {
|
||||
my $vlan=$1;
|
||||
$vlan=$1;
|
||||
my $nwtab=xCAT::Table->new("networks", -create =>0);
|
||||
if ($nwtab) {
|
||||
my $sent = $nwtab->getAttribs({vlanid=>"$vlan"},'net','mask');
|
||||
@@ -1026,9 +1028,38 @@ sub xhrm_satisfy {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#get the nic that vlan tagged
|
||||
my $swtab = xCAT::Table->new("switch", -create => 0);
|
||||
if ($swtab) {
|
||||
my $tmp_switch = $swtab->getNodesAttribs([$hyp], ['vlan','interface']);
|
||||
if (defined($tmp_switch) && (exists($tmp_switch->{$hyp}))) {
|
||||
my $tmp_node_array=$tmp_switch->{$hyp};
|
||||
foreach my $tmp (@$tmp_node_array) {
|
||||
if (exists($tmp->{vlan})) {
|
||||
my $vlans = $tmp->{vlan};
|
||||
foreach my $vlan_tmp (split(',',$vlans)) {
|
||||
if ($vlan_tmp == $vlan) {
|
||||
if (exists($tmp->{interface})) {
|
||||
$interface=$tmp->{interface};
|
||||
}
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#print "nic=$nic\n";
|
||||
$rc |=system("ssh $hyp xHRM bridgeprereq $nic $vlanip $netmask");
|
||||
if (($interface) || ($interface =~ /primary/)) {
|
||||
$interface =~ s/primary(:)?//g;
|
||||
}
|
||||
#print "interface=$interface nic=$nic vlanip=$vlanip netmask=$netmask\n";
|
||||
if ($interface) {
|
||||
$rc |=system("ssh $hyp xHRM bridgeprereq $interface:$nic $vlanip $netmask");
|
||||
} else {
|
||||
$rc |=system("ssh $hyp xHRM bridgeprereq $nic $vlanip $netmask");
|
||||
}
|
||||
|
||||
#TODO: surprise! there is relatively undocumented libvirt capability for this...
|
||||
#./tests/interfaceschemadata/ will have to do in lieu of documentation..
|
||||
@@ -1487,7 +1518,7 @@ sub chvm {
|
||||
foreach $store (split /\|/, $confdata->{vm}->{$node}->[0]->{storage}) {
|
||||
$store =~ s/,.*//;
|
||||
$store =~ s/=.*//;
|
||||
if ($store =~ /^nfs:\/\//) {
|
||||
if (($store =~ /^nfs:\/\//) || ($store =~ /^dir:\/\//)) {
|
||||
my %disks = %{get_multiple_paths_by_url(url=>$store,node=>$node)};
|
||||
foreach (keys %disks) {
|
||||
$useddisks{$disks{$_}->{device}}=1;
|
||||
@@ -1573,7 +1604,7 @@ sub chvm {
|
||||
}
|
||||
$vmxml=$dom->get_xml_description();
|
||||
} elsif ($confdata->{kvmnodedata}->{$node}->[0]->{xml}) {
|
||||
my $vmxml=$confdata->{kvmnodedata}->{$node}->[0]->{xml};
|
||||
$vmxml=$confdata->{kvmnodedata}->{$node}->[0]->{xml};
|
||||
my $disknode = $parser->parse_balanced_chunk($xml);
|
||||
my $vmdoc = $parser->parse_string($vmxml);
|
||||
my $devicesnode = $vmdoc->findnodes("/domain/devices")->[0];
|
||||
|
||||
@@ -593,26 +593,28 @@ sub format_output {
|
||||
###########################################
|
||||
# Read table to get exists data
|
||||
###########################################
|
||||
my $errcode = read_from_table();
|
||||
if ($errcode) {
|
||||
send_msg( $request, 0, "Can't open $errcode table" );
|
||||
return;
|
||||
}
|
||||
unless($globalopt{service} =~ /hardware-management-console/) {
|
||||
my $errcode = read_from_table();
|
||||
if ($errcode) {
|
||||
send_msg( $request, 0, "Can't open $errcode table" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
###########################################
|
||||
# Parse responses and add to hash
|
||||
###########################################
|
||||
my $outhash = parse_responses( $request, \$length, $searchmacsref );
|
||||
|
||||
#hmc bug efix
|
||||
my $newouthash;
|
||||
if ($globalopt{service} =~ /hardware-management-console/) {
|
||||
for my $en ( keys %$outhash ) {
|
||||
if (${$outhash->{$en}}{type} eq 'hmc') {
|
||||
$newouthash->{$en} = $outhash->{$en};
|
||||
}
|
||||
}
|
||||
$outhash = $newouthash;
|
||||
}
|
||||
#my $newouthash;
|
||||
#if ($globalopt{service} =~ /hardware-management-console/) {
|
||||
# for my $en ( keys %$outhash ) {
|
||||
# if (${$outhash->{$en}}{type} eq 'hmc') {
|
||||
# $newouthash->{$en} = $outhash->{$en};
|
||||
# }
|
||||
# }
|
||||
# $outhash = $newouthash;
|
||||
#}
|
||||
|
||||
###########################################
|
||||
# filter the result in the same vlan
|
||||
@@ -647,8 +649,10 @@ sub format_output {
|
||||
my $raw = ${$outhash->{$_}}{url};
|
||||
$rawhash{$raw} = 1;
|
||||
}
|
||||
foreach ( keys %rawhash ) {
|
||||
$result .= "$_\n";
|
||||
foreach my $en ( keys %rawhash ) {
|
||||
if ($en =~ /(\(type.*\))/) {
|
||||
$result .= "$1\n";
|
||||
}
|
||||
}
|
||||
|
||||
send_msg( $request, 0, $result );
|
||||
@@ -1256,20 +1260,17 @@ sub xCATdB {
|
||||
my $outhash = shift;
|
||||
|
||||
########################################
|
||||
# Update database if the name changed
|
||||
########################################
|
||||
my %db = ();
|
||||
my @tabs = qw(nodelist ppc vpd nodehm nodetype ppcdirect hosts mac mp);
|
||||
foreach ( @tabs ) {
|
||||
$db{$_} = xCAT::Table->new( $_);
|
||||
if ( !$db{$_} ) {
|
||||
return( "Error opening '$_'" );
|
||||
}
|
||||
}
|
||||
|
||||
########################################
|
||||
# Begin to write each node
|
||||
# Begin to collect attributes for each node
|
||||
########################################
|
||||
my %nodelisthash;
|
||||
my %ppchash;
|
||||
my %vpdhash;
|
||||
my %nodehmhash;
|
||||
my %nodetypehash;
|
||||
my %ppcdirecthash;
|
||||
my %hostshash;
|
||||
my %machash;
|
||||
my %mphash;
|
||||
foreach my $nodeentry ( keys %$outhash ) {
|
||||
my $type = ${$outhash->{$nodeentry}}{type};
|
||||
my $model = ${$outhash->{$nodeentry}}{mtm};
|
||||
@@ -1289,36 +1290,56 @@ sub xCATdB {
|
||||
# Write result to every tables,
|
||||
########################################
|
||||
if ( $type =~ /^bpa|fsp|cec|frame$/ ) {
|
||||
$db{nodelist}->setNodeAttribs($hostname,{node=>$hostname, groups=>"$type,all", hidden=>$hidden});
|
||||
$db{ppc}->setNodeAttribs($hostname,{node=>$hostname, id=>$id, parent=>$parent, hcp=>$hostname, nodetype=>$globalhwtype{$type}});
|
||||
$db{vpd}->setNodeAttribs($hostname,{mtm=>$model, serial=>$serial, side=>$side});
|
||||
$db{nodehm}->setNodeAttribs($hostname,{mgt=>$globalmgt{$type}});
|
||||
$db{nodetype}->setNodeAttribs($hostname,{nodetype=>$globalnodetype{$type}});
|
||||
$db{hosts}->setNodeAttribs($hostname,{otherinterfaces=>$otherif}) if ($type =~ /fsp|bpa/);
|
||||
$db{mac}->setNodeAttribs($hostname,{mac=>$mac}) if ($type =~ /^fsp|bpa$/);
|
||||
$nodelisthash{$hostname} = {groups=>"$type,all", hidden=>$hidden};
|
||||
$ppchash{$hostname} = {id=>$id, parent=>$parent, hcp=>$hostname, nodetype=>$globalhwtype{$type}};
|
||||
$vpdhash{$hostname} = {mtm=>$model, serial=>$serial, side=>$side};
|
||||
$nodehmhash{$hostname} = {mgt=>$globalmgt{$type}};
|
||||
$nodetypehash{$hostname} = {nodetype=>$globalnodetype{$type}};
|
||||
$hostshash{$hostname} = {otherinterfaces=>$otherif} if ($type =~ /fsp|bpa/);
|
||||
$machash{$hostname} = {mac=>$mac} if ($type =~ /^fsp|bpa$/);
|
||||
} elsif ( $type =~ /^(rsa|mm)$/ ) {
|
||||
my @data = ($type, $model, $serial, $side, $ip, $frameid, $cageid, $parent, $mac);
|
||||
xCAT::PPCdb::add_systemX( $type, $hostname, \@data );
|
||||
} elsif ( $type =~ /^(hmc|ivm)$/ ) {
|
||||
$db{nodelist}->setNodeAttribs($hostname,{node=>$hostname, groups=>"$type,all", hidden=>$hidden});
|
||||
$db{ppc}->setNodeAttribs($hostname,{node=>$hostname, nodetype=>$globalhwtype{$type}});
|
||||
$db{vpd}->setNodeAttribs($hostname,{mtm=>$model, serial=>$serial});
|
||||
$db{nodetype}->setNodeAttribs($hostname,{nodetype=>$globalnodetype{$type}});
|
||||
$db{nodehm}->setNodeAttribs($hostname,{mgt=>$globalmgt{$type}});
|
||||
$db{hosts}->setNodeAttribs($hostname,{ip=>$ip});
|
||||
$db{mac}->setNodeAttribs($hostname,{mac=>$mac});
|
||||
$nodelisthash{$hostname} = {groups=>"$type,all", hidden=>$hidden};
|
||||
$ppchash{$hostname} = {nodetype=>$globalhwtype{$type}};
|
||||
$vpdhash{$hostname} = {mtm=>$model, serial=>$serial};
|
||||
$nodetypehash{$hostname} = {nodetype=>$globalnodetype{$type}};
|
||||
$nodehmhash{$hostname} = {mgt=>$globalmgt{$type}};
|
||||
$hostshash{$hostname} = {ip=>$ip};
|
||||
$machash{$hostname} = {mac=>$mac};
|
||||
}elsif ($type =~ /^cmm$/){
|
||||
$db{nodelist}->setNodeAttribs($hostname,{node=>$hostname, groups=>"cmm,all", hidden=>$hidden});
|
||||
$db{vpd}->setNodeAttribs($hostname,{mtm=>$model, serial=>$serial});
|
||||
$db{nodetype}->setNodeAttribs($hostname,{nodetype=>$globalnodetype{$type}});
|
||||
$db{nodehm}->setNodeAttribs($hostname,{mgt=>"blade"});
|
||||
$db{mp}->setNodeAttribs($hostname,{nodetype=>$globalhwtype{$type}, mpa=>$hostname, id=>$side});
|
||||
$db{hosts}->setNodeAttribs($hostname,{otherinterfaces=>$otherif});
|
||||
$nodelisthash{$hostname} = {groups=>"cmm,all", hidden=>$hidden};
|
||||
$vpdhash{$hostname} = {mtm=>$model, serial=>$serial};
|
||||
$nodetypehash{$hostname} = {nodetype=>$globalnodetype{$type}};
|
||||
$nodehmhash{$hostname} = {mgt=>"blade"};
|
||||
$mphash{$hostname} = {nodetype=>$globalhwtype{$type}, mpa=>$hostname, id=>$side};
|
||||
$hostshash{$hostname} = {otherinterfaces=>$otherif};
|
||||
}
|
||||
}
|
||||
foreach ( @tabs ) {
|
||||
$db{$_}->close();
|
||||
}
|
||||
########################################
|
||||
# Update database
|
||||
########################################
|
||||
my %dbhash;
|
||||
$dbhash{nodelist} = \%nodelisthash, if (%nodelisthash);
|
||||
$dbhash{ppc} = \%ppchash, if (%ppchash);
|
||||
$dbhash{vpd} = \%vpdhash, if (%vpdhash);
|
||||
$dbhash{nodehm} = \%nodehmhash, if (%nodehmhash);
|
||||
$dbhash{nodetype} = \%nodetypehash, if (%nodetypehash);
|
||||
$dbhash{ppcdirect} = \%ppcdirecthash, if (%ppcdirecthash);
|
||||
$dbhash{hosts} = \%hostshash, if (%hostshash);
|
||||
$dbhash{mac} = \%machash, if (%machash);
|
||||
$dbhash{mp} = \%mphash, if (%mphash);
|
||||
|
||||
|
||||
for my $tab (keys %dbhash) {
|
||||
my $db = xCAT::Table->new($tab);
|
||||
if ( !$db ) {
|
||||
return( "Error opening $db" );
|
||||
}
|
||||
$db->setNodesAttribs($dbhash{$tab});
|
||||
$db->close();
|
||||
}
|
||||
}
|
||||
##########################################################################
|
||||
# Stanza formatting
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -192,8 +192,7 @@ sub setupIMM {
|
||||
my $node = shift;
|
||||
my %args = @_;
|
||||
my $slpdata = $args{slpdata};
|
||||
my $ipmitab = xCAT::Table->new('ipmi',-create=>0);
|
||||
unless ($ipmitab) { die "ipmi settings required to set up imm in xCAT" }
|
||||
my $ipmitab = xCAT::Table->new('ipmi',-create=>1);
|
||||
my $ient = $ipmitab->getNodeAttribs($node,[qw/bmc bmcid/],prefetchcache=>1);
|
||||
my $newaddr;
|
||||
if ($ient) {
|
||||
@@ -204,15 +203,27 @@ sub setupIMM {
|
||||
} #skip configuration, we already know this one
|
||||
$newaddr = $ient->{bmc};
|
||||
}
|
||||
my @ips;
|
||||
if ($newaddr) {
|
||||
my @ips=();
|
||||
my $autolla=0;
|
||||
if ($newaddr and not $newaddr =~ /^fe80:.*%.*/) {
|
||||
@ips = xCAT::NetworkUtils::getipaddr($newaddr,GetAllAddresses=>1);
|
||||
} else {
|
||||
if ($args{curraddr} =~ /^fe80:.*%.*/) { #if SLP were able to glean an LLA out of this, let's just roll with that result
|
||||
$ipmitab->setNodeAttribs($node,{bmc=>$args{curraddr}});
|
||||
$autolla=1;
|
||||
}
|
||||
}
|
||||
if (!@ips) {
|
||||
if (not scalar @ips and not $autolla) {
|
||||
sendmsg(":Cannot find the IP attribute for bmc",$callback,$node);
|
||||
return;
|
||||
}
|
||||
sendmsg(":Configuration of ".$node."[".join(',',@ips)."] commencing, configuration may take a few minutes to take effect",$callback);
|
||||
my $targips;
|
||||
if (scalar(@ips)) {
|
||||
$targips = join(',',@ips);
|
||||
} elsif ($autolla) {
|
||||
$targips=$args{curraddr};
|
||||
}
|
||||
sendmsg(":Configuration of ".$node."[$targips] commencing, configuration may take a few minutes to take effect",$callback);
|
||||
my $child = fork();
|
||||
if ($child) { return; }
|
||||
unless (defined $child) { die "error spawining process" }
|
||||
@@ -225,8 +236,9 @@ sub setupIMM {
|
||||
-output_record_separator=>"\r",
|
||||
Timeout=>15,
|
||||
Errmode=>'return',
|
||||
Prompt=>'/MYIMM> $/');
|
||||
Prompt=>'/> $/');
|
||||
if ($ssh and $ssh->atprompt) { #we are in and good to issue commands
|
||||
$ssh->cmd("accseccfg -pe 0 -rc 0 -ci 0 -lf 0 -lp 0"); #disable the more insane password rules, this isn't by and large a human used interface
|
||||
$ssh->cmd("users -1 -n ".$args{username}." -p ".$args{password}." -a super"); #this gets ipmi going
|
||||
foreach my $ip (@ips) {
|
||||
if ($ip =~ /:/) {
|
||||
|
||||
@@ -114,6 +114,7 @@ sub process_request
|
||||
'd|dest=s' => \$::SN2, # dest SN akb MN
|
||||
'D|destn=s' => \$::SN2N, # dest SN akb node
|
||||
'l|liteonly' => \$::SLonly, # update statelite only!
|
||||
'n|noretarget' => \$::NORETARGET, # no dump retarget
|
||||
'P|postscripts=s' => \$::POST, # postscripts to be run
|
||||
'i|ignorenodes' => \$::IGNORE,
|
||||
'V|verbose' => \$::VERBOSE,
|
||||
@@ -862,108 +863,150 @@ sub process_request
|
||||
#
|
||||
# restore .client_data files on the new SN
|
||||
#
|
||||
if ( ($::isaix) && ($sharedinstall eq "sns") ){
|
||||
|
||||
# first get the shared_root locations for each SN and osimage
|
||||
my $nimtab = xCAT::Table->new('nimimage');
|
||||
my %SRloc;
|
||||
foreach my $n (@nodes) {
|
||||
my $osimage = $nhash{$n}{'provmethod'};
|
||||
my ($sn, $junk) = split(/,/, $nhash{$n}{'servicenode'});
|
||||
if ( ($::isaix) && ($sharedinstall eq "sns") ){
|
||||
|
||||
# $sn is name of SN as known by management node
|
||||
# first get the shared_root locations for each SN and osimage
|
||||
my $nimtab = xCAT::Table->new('nimimage');
|
||||
my %SRloc;
|
||||
foreach my $n (@nodes) {
|
||||
my $osimage = $nhash{$n}{'provmethod'};
|
||||
# get the new primary SN
|
||||
my ($sn, $junk) = split(/,/, $sn_hash{$n}{'servicenode'});
|
||||
|
||||
if (!$SRloc{$sn}{$osimage}) {
|
||||
# $sn is name of SN as known by management node
|
||||
if (!$SRloc{$sn}{$osimage}) {
|
||||
|
||||
my $SRn = $nimtab->getAttribs({'imagename' => $osimage}, 'shared_root');
|
||||
my $SRname=$SRn->{shared_root};
|
||||
my $SRn = $nimtab->getAttribs({'imagename' => $osimage}, 'shared_root');
|
||||
my $SRname=$SRn->{shared_root};
|
||||
|
||||
if ($SRname) {
|
||||
my $srloc = xCAT::InstUtils->get_nim_attr_val($SRname, 'location', $callback, $nimprime, $sub_req);
|
||||
|
||||
$SRloc{$sn}{$osimage}=$srloc;
|
||||
if ($SRname) {
|
||||
my $srloc = xCAT::InstUtils->get_nim_attr_val($SRname, 'location', $callback, $nimprime, $sub_req);
|
||||
$SRloc{$sn}{$osimage}=$srloc;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$nimtab->close();
|
||||
$nimtab->close();
|
||||
|
||||
# now try to restore any backup client data
|
||||
# need a list of nodes for each SN
|
||||
# - the nodes that have this SN as their primary SN
|
||||
my %SNnodes;
|
||||
my $nrtab = xCAT::Table->new('noderes');
|
||||
my $nrhash;
|
||||
if ($nrtab)
|
||||
{
|
||||
$nrhash = $nrtab->getNodesAttribs(\@nodes, ['xcatmaster', 'servicenode']);
|
||||
}
|
||||
$nrtab->close();
|
||||
|
||||
# for each service node
|
||||
foreach my $s (keys %SRloc) {
|
||||
foreach my $node (@nodes)
|
||||
{
|
||||
my ($snode, $junk) = (split /,/, $nrhash->{$node}->[0]->{'servicenode'});
|
||||
push(@{$SNnodes{$snode}}, $node);
|
||||
}
|
||||
|
||||
# for each osimage on that SN
|
||||
foreach my $osi (keys %{$SRloc{$s}}) {
|
||||
# now try to restore any backup client data
|
||||
|
||||
# set the names of the .client_data and backup directories
|
||||
my $sloc = $SRloc{$s}{$osi};
|
||||
# ex. /install/nim/shared_root/71Bdskls_shared_root
|
||||
# for each service node
|
||||
foreach my $s (keys %SRloc) {
|
||||
|
||||
my $cdloc = "$sloc/etc/.client_data";
|
||||
my $snbk = "$s" . "_" . "$osi";
|
||||
my $bkloc = "$sloc/$snbk/.client_data";
|
||||
# for each osimage on that SN
|
||||
foreach my $osi (keys %{$SRloc{$s}}) {
|
||||
|
||||
# get a list of files from the backup dir
|
||||
my $rcmd = qq~/usr/bin/ls $bkloc 2>/dev/null~;
|
||||
# set the names of the .client_data and backup directories
|
||||
my $sloc = $SRloc{$s}{$osi};
|
||||
# ex. /install/nim/shared_root/71Bdskls_shared_root
|
||||
|
||||
my $rlist = xCAT::InstUtils->xcmd($callback, $sub_req, "xdsh", $s, $rcmd, 0);
|
||||
my $cdloc = "$sloc/etc/.client_data";
|
||||
my $snbk = "$s" . "_" . "$osi";
|
||||
my $bkloc = "$sloc/$snbk/.client_data";
|
||||
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Could not list contents of $bkloc.\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
$error++;
|
||||
}
|
||||
# get a list of files from the backup dir
|
||||
my $rcmd = qq~/usr/bin/ls $bkloc 2>/dev/null~;
|
||||
|
||||
# restore file on node by node basis
|
||||
# we don't want all the files!
|
||||
# - just the ones we are moving
|
||||
foreach my $nd (@nodes) {
|
||||
|
||||
$nd =~ s/\..*$//;
|
||||
|
||||
# for each file in $bkloc
|
||||
my $filestring = "";
|
||||
foreach my $f ( split(/\n/, $rlist) ){
|
||||
my $junk;
|
||||
my $file;
|
||||
if ($f =~ /:/) {
|
||||
($junk, $file) = split(/:/, $f);
|
||||
}
|
||||
$file =~ s/\s*//g; # remove blanks
|
||||
|
||||
# if file contains node name then copy it
|
||||
if ($file =~ /$nd/) {
|
||||
$filestring .= "$bkloc/$file ";
|
||||
}
|
||||
if ($::VERBOSE) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Running \'$rcmd\' on $s\n";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
my $ccmd=qq~/usr/bin/cp -p -r $filestring $cdloc 2>/dev/null~;
|
||||
|
||||
my $output = xCAT::InstUtils->xcmd($callback, $sub_req, "xdsh", $s, $rcmd, 0);
|
||||
my $rlist = xCAT::InstUtils->xcmd($callback, $sub_req, "xdsh", $s, $rcmd, 0);
|
||||
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Could not copy files to $cdloc.\n";
|
||||
push @{$rsp->{data}}, "Could not list contents of $bkloc.\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
$error++;
|
||||
}
|
||||
|
||||
# restore files on node by node basis
|
||||
# we don't want all the files!
|
||||
# we need to process only the nodes that have this SN as
|
||||
# their primary
|
||||
my @nodelist = @{$SNnodes{$s}};
|
||||
|
||||
foreach my $nd (@nodelist) {
|
||||
$nd =~ s/\..*$//;
|
||||
# for each file in $bkloc
|
||||
my $filestring = "";
|
||||
foreach my $f ( split(/\n/, $rlist) ){
|
||||
my $junk;
|
||||
my $file;
|
||||
if ($f =~ /:/) {
|
||||
($junk, $file) = split(/:/, $f);
|
||||
}
|
||||
$file =~ s/\s*//g; # remove blanks
|
||||
|
||||
# if file contains node name then copy it
|
||||
if ($file =~ /$nd/) {
|
||||
$filestring .= "$bkloc/$file ";
|
||||
}
|
||||
}
|
||||
|
||||
if (!$filestring) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "No backup client_data files for node $nd in $bkloc. Current client data files in $cdloc should be checked to avoid boot errors.\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
$error++;
|
||||
next;
|
||||
}
|
||||
|
||||
my $ccmd=qq~/usr/bin/cp -p $filestring $cdloc~;
|
||||
|
||||
if ($::VERBOSE) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Running \'$ccmd\' on $s.\n";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
|
||||
my $output = xCAT::InstUtils->xcmd($callback, $sub_req, "xdsh", $s, $ccmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Could not copy\n$filestring\n\tto $cdloc.\n";
|
||||
push @{$rsp->{data}}, "Command output:\n$output\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# - retarget the iscsi dump device to the new server for the nodes
|
||||
#
|
||||
if ((!$::IGNORE) && ($::isaix) && ($sharedinstall eq "sns")) {
|
||||
|
||||
if (&dump_retarget($callback, \@nodes, $sub_req) != 0)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "One or more errors occured while attemping to re-target the dump device on cluster nodes.\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
$error++;
|
||||
if (!$::NORETARGET) {
|
||||
if (&dump_retarget($callback, \@nodes, $sub_req) != 0)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "One or more errors occured while attemping to re-target the dump device on cluster nodes.\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,16 @@ sub handled_commands
|
||||
nr => "tabutils", # not implemented yet
|
||||
rnoderange => "tabutils", # not implemented yet
|
||||
tabgrep => "tabutils",
|
||||
getAllEntries => "tabutils",
|
||||
getNodesAttribs => "tabutils",
|
||||
getTablesAllNodeAttribs => "tabutils",
|
||||
getTablesNodesAttribs => "tabutils",
|
||||
getTablesAllRowAttribs => "tabutils",
|
||||
setNodesAttribs => "tabutils",
|
||||
delEntries => "tabutils",
|
||||
getAttribs => "tabutils",
|
||||
setAttribs => "tabutils",
|
||||
NodeRange => "tabutils",
|
||||
gennr => "tabutils"
|
||||
};
|
||||
}
|
||||
@@ -140,6 +150,46 @@ sub process_request
|
||||
elsif ($command eq "tabch"){
|
||||
return tabch($request, $callback);
|
||||
}
|
||||
elsif ($command eq "getAllEntries")
|
||||
{
|
||||
return getAllEntries($request,$callback);
|
||||
}
|
||||
elsif ($command eq "getNodesAttribs")
|
||||
{
|
||||
return getNodesAttribs($request,$callback);
|
||||
}
|
||||
elsif ($command eq "getTablesAllNodeAttribs")
|
||||
{
|
||||
return getTablesAllNodeAttribs($request,$callback);
|
||||
}
|
||||
elsif ($command eq "getTablesNodesAttribs")
|
||||
{
|
||||
return getTablesNodesAttribs($request,$callback);
|
||||
}
|
||||
elsif ($command eq "getTablesAllRowAttribs")
|
||||
{
|
||||
return getTablesAllRowAttribs($request,$callback);
|
||||
}
|
||||
elsif ($command eq "setNodesAttribs")
|
||||
{
|
||||
return setNodesAttribs($request,$callback);
|
||||
}
|
||||
elsif ($command eq "delEntries")
|
||||
{
|
||||
return delEntries($request,$callback);
|
||||
}
|
||||
elsif ($command eq "getAttribs")
|
||||
{
|
||||
return getAttribs($request,$callback);
|
||||
}
|
||||
elsif ($command eq "setAttribs")
|
||||
{
|
||||
return setAttribs($request,$callback);
|
||||
}
|
||||
elsif ($command eq "NodeRange")
|
||||
{
|
||||
return NodeRange($request,$callback);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "$command not implemented yet\n";
|
||||
@@ -214,13 +264,15 @@ sub gettab
|
||||
{
|
||||
my $tab = xCAT::Table->new($tabn);
|
||||
(my $ent) = $tab->getAttribs(\%keyhash, keys %{$tabhash{$tabn}});
|
||||
foreach my $coln (keys %{$tabhash{$tabn}})
|
||||
{
|
||||
if ($ent) {
|
||||
foreach my $coln (keys %{$tabhash{$tabn}})
|
||||
{
|
||||
if ($terse > 0) {
|
||||
$callback->({data => ["" . $ent->{$coln}]});
|
||||
} else {
|
||||
$callback->({data => ["$tabn.$coln: " . $ent->{$coln}]});
|
||||
}
|
||||
}
|
||||
}
|
||||
$tab->close;
|
||||
}
|
||||
@@ -269,8 +321,8 @@ sub noderm
|
||||
$requestcommand->({command=>['makedhcp'],node=>$nodes,arg=>['-d']});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
# Build the argument list for using the -d option of nodech to do our work for us
|
||||
my @tablist = ("-d");
|
||||
foreach (keys %{xCAT::Schema::tabspec})
|
||||
@@ -2201,3 +2253,645 @@ else {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# getAllEntries
|
||||
#
|
||||
# Read all the rows from the input table name and returns the response, so
|
||||
# that the XML will look like this
|
||||
#<xcatrequest>
|
||||
#<clienttype>PCM</clienttype>
|
||||
#<command>getAllEntries</command>
|
||||
#<table>nodelist</table>
|
||||
#</xcatrequest>
|
||||
|
||||
|
||||
#<xcatresponse>
|
||||
#<row>
|
||||
#<attr1>value1</attr1>
|
||||
#.
|
||||
#.
|
||||
#.
|
||||
#<attrN>valueN</attrN>
|
||||
#</row>
|
||||
#.
|
||||
#.
|
||||
#.
|
||||
#</xcatresponse>
|
||||
#
|
||||
#
|
||||
sub getAllEntries
|
||||
{
|
||||
my $request = shift;
|
||||
my $cb = shift;
|
||||
my $command = $request->{command}->[0];
|
||||
my $tablename = $request->{table}->[0];
|
||||
my $tab=xCAT::Table->new($tablename);
|
||||
my %rsp;
|
||||
my $recs = $tab->getAllEntries("all");
|
||||
unless (@$recs) # table exists, but is empty. Show header.
|
||||
{
|
||||
if (defined($xCAT::Schema::tabspec{$tablename}))
|
||||
{
|
||||
my $header = "#";
|
||||
my @array =@{$xCAT::Schema::tabspec{$tablename}->{cols}};
|
||||
foreach my $arow (@array) {
|
||||
$header .= $arow;
|
||||
$header .= ",";
|
||||
}
|
||||
chop $header;
|
||||
push @{$rsp{row}}, $header;
|
||||
$cb->(\%rsp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
my %noderecs;
|
||||
foreach my $rec (@$recs) {
|
||||
my %datseg=();
|
||||
foreach my $key (keys %$rec) {
|
||||
#$datseg{$key} = [$rec->{$key}];
|
||||
$datseg{$key} = $rec->{$key};
|
||||
}
|
||||
push @{$noderecs{"row"}}, \%datseg;
|
||||
}
|
||||
push @{$rsp{"row"}}, @{$noderecs{"row"}};
|
||||
# for checkin XML created
|
||||
#my $xmlrec=XMLout(\%rsp,RootName=>'xcatresponse',NoAttr=>1,KeyAttr=>[]);
|
||||
$cb->(\%rsp);
|
||||
|
||||
return;
|
||||
}
|
||||
# getNodesAttribs
|
||||
# Read all the array of attributes for the noderange from the input table.
|
||||
# If the <attr>ALL</attr> is input then read all the attributes
|
||||
#<xcatrequest>
|
||||
#<clienttype>PCM</clienttype>
|
||||
#<command>getNodesAttribs</command>
|
||||
#<table>nodelist</table>
|
||||
#<noderange>blade01-blade02</noderange>
|
||||
#<attr>groups</attr>
|
||||
#<attr>status</attr>
|
||||
#</xcatrequest>
|
||||
#
|
||||
#<xcatresponse>
|
||||
#<node>
|
||||
#<name>nodename</name>
|
||||
#<attr1>value1</attr1>
|
||||
#.
|
||||
#.
|
||||
#.
|
||||
#<attrN>valueN</attrN>
|
||||
#</node>
|
||||
#.
|
||||
#.
|
||||
#.
|
||||
#</xcatresponse>
|
||||
#
|
||||
#
|
||||
sub getNodesAttribs
|
||||
{
|
||||
my $request = shift;
|
||||
my $cb = shift;
|
||||
my $node = $request->{node};
|
||||
my $command = $request->{command}->[0];
|
||||
my $tablename = $request->{table}->[0];
|
||||
my $attr = $request->{attr};
|
||||
my $tab=xCAT::Table->new($tablename);
|
||||
my @nodes = @$node;
|
||||
my @attrs= @$attr;
|
||||
my %rsp;
|
||||
my %noderecs;
|
||||
if (grep (/ALL/,@attrs)) { # read the schema and build array of all attrs
|
||||
@attrs=();
|
||||
my $schema = xCAT::Table->getTableSchema($tablename);
|
||||
my $desc = $schema->{descriptions};
|
||||
foreach my $c (@{$schema->{cols}}) {
|
||||
# my $space = (length($c)<7 ? "\t\t" : "\t");
|
||||
push @attrs, $c;
|
||||
}
|
||||
}
|
||||
my $rechash = $tab->getNodesAttribs(\@nodes,\@attrs);
|
||||
foreach my $node (@nodes){
|
||||
my $recs = $rechash->{$node};
|
||||
foreach my $rec (@$recs) {
|
||||
my %datseg=();
|
||||
$datseg{name} = [$node];
|
||||
foreach my $key (keys %$rec) {
|
||||
if ($key ne "node") { # do not put in the added node attribute
|
||||
$datseg{$key} = [$rec->{$key}];
|
||||
}
|
||||
}
|
||||
push @{$noderecs{$node}}, \%datseg;
|
||||
}
|
||||
push @{$rsp{"node"}}, @{$noderecs{$node}};
|
||||
|
||||
}
|
||||
# for checkin XML created
|
||||
#my $xmlrec=XMLout(\%rsp,RootName=>'xcatresponse',NoAttr=>1,KeyAttr=>[]);
|
||||
$cb->(\%rsp);
|
||||
return;
|
||||
}
|
||||
|
||||
# getTablesAllNodeAttribs
|
||||
# Read all all the nodes from the input tables and get the input attribute
|
||||
# or get ALL attributes, if the word ALL is used.
|
||||
# If the <attr>ALL</attr> is input then read all the attributes
|
||||
#<xcatrequest>
|
||||
#<clienttype>PCM</clienttype>
|
||||
#<command>getTablesAllNodeAttribs</command>
|
||||
#<table>
|
||||
#<tablename>nodelist</tablename>
|
||||
#<attr>groups</attr>
|
||||
#<attr>status</attr>
|
||||
#</table>
|
||||
#<table>
|
||||
#<tablename>nodetype</tablename>
|
||||
#<attr>ALL</attr>
|
||||
#</table>
|
||||
# .
|
||||
# .
|
||||
# .
|
||||
#</xcatrequest>
|
||||
#
|
||||
#<xcatresponse>
|
||||
#<table>
|
||||
#<tablename>tablename1</tablename>
|
||||
#<node>
|
||||
#<name>n1</name>
|
||||
#<attr1>value1</attr1>
|
||||
#<attr2>value1</attr2>
|
||||
#.
|
||||
#<attrN>valueN</attrN>
|
||||
#</node>
|
||||
#</table>
|
||||
# .
|
||||
# .
|
||||
# .
|
||||
#</xcatresponse>
|
||||
#
|
||||
sub getTablesAllNodeAttribs
|
||||
{
|
||||
my $request = shift;
|
||||
my $cb = shift;
|
||||
my $command = $request->{command}->[0];
|
||||
my %rsp;
|
||||
|
||||
# process each table in the request
|
||||
my $tables = $request->{table};
|
||||
foreach my $tabhash (@$tables) {
|
||||
|
||||
my $tablename = $tabhash->{tablename}->[0];
|
||||
my $attr = $tabhash->{attr};
|
||||
my @attrs=@$attr;
|
||||
my $tab=xCAT::Table->new($tablename);
|
||||
my %noderecs;
|
||||
my $recs;
|
||||
# build the table name record
|
||||
@{$noderecs{table}->[0]->{tablename}} = $tablename;
|
||||
# if request for ALL attributes
|
||||
if (grep (/ALL/,@attrs)) { # read the schema and build array of all attrs
|
||||
@attrs=();
|
||||
my $schema = xCAT::Table->getTableSchema($tablename);
|
||||
my $desc = $schema->{descriptions};
|
||||
foreach my $c (@{$schema->{cols}}) {
|
||||
# my $space = (length($c)<7 ? "\t\t" : "\t");
|
||||
push @attrs, $c;
|
||||
}
|
||||
}
|
||||
# read all the nodes and there attributes in this table
|
||||
my @nodeentries = $tab->getAllNodeAttribs(\@attrs);
|
||||
foreach my $node (@nodeentries){
|
||||
# build the node entrys
|
||||
my %datseg=();
|
||||
$datseg{name} = $node->{node};
|
||||
foreach my $at (@attrs) {
|
||||
# if the attribute has a value and is not the node attribute
|
||||
if (($node->{$at}) && ($at ne "node")) {
|
||||
$datseg{$at} = $node->{$at};
|
||||
}
|
||||
}
|
||||
push @{$noderecs{table}->[0]->{node}}, \%datseg;
|
||||
}
|
||||
push @{$rsp{"table"}}, @{$noderecs{table}};
|
||||
} # end of all table processing
|
||||
# for checkin XML created
|
||||
#my $xmlrec=XMLout(\%rsp,RootName=>'xcatresponse',NoAttr=>1,KeyAttr=>[]);
|
||||
$cb->(\%rsp);
|
||||
return;
|
||||
}
|
||||
# getTablesNodesAttribs
|
||||
# Read the nodes in the noderange from the input tables
|
||||
# and get the input attributes
|
||||
# or get ALL attributes, if the word ALL is used.
|
||||
# If the <attr>ALL</attr> is input then read all the attributes
|
||||
#<xcatrequest>
|
||||
#<clienttype>PCM</clienttype>
|
||||
#<command>getTablesAllNodeAttribs</command>
|
||||
#<noderange>blade01-blade10</noderange>
|
||||
#<table>
|
||||
#<tablename>nodelist</tablename>
|
||||
#<attr>groups</attr>
|
||||
#<attr>status</attr>
|
||||
#</table>
|
||||
#<table>
|
||||
#<tablename>nodetype</tablename>
|
||||
#<attr>ALL</attr>
|
||||
#</table>
|
||||
# .
|
||||
# .
|
||||
# .
|
||||
#</xcatrequest>
|
||||
#
|
||||
#<xcatresponse>
|
||||
#<table>
|
||||
#<tablename>tablename1</tablename>
|
||||
#<node>
|
||||
#<name>n1</name>
|
||||
#<attr1>value1</attr1>
|
||||
#<attr2>value1</attr2>
|
||||
#.
|
||||
#<attrN>valueN</attrN>
|
||||
#</node>
|
||||
#</table>
|
||||
# .
|
||||
# .
|
||||
# .
|
||||
#</xcatresponse>
|
||||
#
|
||||
sub getTablesNodesAttribs
|
||||
{
|
||||
my $request = shift;
|
||||
my $cb = shift;
|
||||
my $command = $request->{command}->[0];
|
||||
my %rsp;
|
||||
|
||||
# process each table in the request
|
||||
my $tables = $request->{table};
|
||||
my $node = $request->{node};
|
||||
my @nodes=@$node;
|
||||
foreach my $tabhash (@$tables) {
|
||||
|
||||
my $tablename = $tabhash->{tablename}->[0];
|
||||
my $attr = $tabhash->{attr};
|
||||
my @attrs=@$attr;
|
||||
my $tab=xCAT::Table->new($tablename);
|
||||
my %noderecs;
|
||||
my $recs;
|
||||
# build the table name record
|
||||
@{$noderecs{table}->[0]->{tablename}} = $tablename;
|
||||
# if request for ALL attributes
|
||||
if (grep (/ALL/,@attrs)) { # read the schema and build array of all attrs
|
||||
@attrs=();
|
||||
my $schema = xCAT::Table->getTableSchema($tablename);
|
||||
my $desc = $schema->{descriptions};
|
||||
foreach my $c (@{$schema->{cols}}) {
|
||||
# my $space = (length($c)<7 ? "\t\t" : "\t");
|
||||
push @attrs, $c;
|
||||
}
|
||||
}
|
||||
# read the nodes and their attributes in this table
|
||||
my $rechash = $tab->getNodesAttribs(\@nodes,\@attrs);
|
||||
foreach my $node (@nodes){
|
||||
my $recs = $rechash->{$node};
|
||||
foreach my $rec (@$recs) {
|
||||
my %datseg=();
|
||||
$datseg{name} = [$node];
|
||||
foreach my $key (keys %$rec) {
|
||||
if ($key ne "node") { # do not put in the added node attribute
|
||||
$datseg{$key} = [$rec->{$key}];
|
||||
}
|
||||
}
|
||||
push @{$noderecs{table}->[0]->{node}}, \%datseg;
|
||||
}
|
||||
|
||||
}
|
||||
push @{$rsp{"table"}}, @{$noderecs{table}};
|
||||
} # end of all table processing
|
||||
# for checkin XML created
|
||||
#my $xmlrec=XMLout(\%rsp,RootName=>'xcatresponse',NoAttr=>1,KeyAttr=>[]);
|
||||
$cb->(\%rsp);
|
||||
return;
|
||||
}
|
||||
# getTablesALLRowAttribs
|
||||
# Read all the rows from the input non-Node key'd
|
||||
# tables and get the input attributes
|
||||
# or get ALL attributes, if the word ALL is used.
|
||||
#<xcatrequest>
|
||||
#<clienttype>PCM</clienttype>
|
||||
#<command>getTablesALLRowAttribs</command>
|
||||
#<table>
|
||||
#<tablename>osimage</tablename>
|
||||
#<attr>imagename</attr>
|
||||
#<attr>synclists</attr>
|
||||
#</table>
|
||||
#<table>
|
||||
#<tablename>linuximage</tablename>
|
||||
#<attr>ALL</attr>
|
||||
#</table>
|
||||
# .
|
||||
# .
|
||||
# .
|
||||
#</xcatrequest>
|
||||
#
|
||||
#<xcatresponse>
|
||||
#<table>
|
||||
#<tablename>osimage</tablename>
|
||||
#<row>
|
||||
#<synclists>value1</synclists>
|
||||
#</row>
|
||||
#<row>
|
||||
#.
|
||||
#.
|
||||
#</row>
|
||||
#</table>
|
||||
#<table>
|
||||
#<tablename>linuximage</tablename>
|
||||
#<row>
|
||||
#<imagename>value</imagename>
|
||||
#<template>value</template>
|
||||
#.
|
||||
#.
|
||||
#</row>
|
||||
#<row>
|
||||
#.
|
||||
#.
|
||||
#</row>
|
||||
#</table>
|
||||
#</xcatresponse>
|
||||
#.
|
||||
#.
|
||||
#
|
||||
sub getTablesAllRowAttribs
|
||||
{
|
||||
my $request = shift;
|
||||
my $cb = shift;
|
||||
my $command = $request->{command}->[0];
|
||||
my %rsp;
|
||||
|
||||
# process each table in the request
|
||||
my $tables = $request->{table};
|
||||
foreach my $tabhash (@$tables) {
|
||||
|
||||
my $tablename = $tabhash->{tablename}->[0];
|
||||
my $attr = $tabhash->{attr};
|
||||
my @attrs=@$attr;
|
||||
my $tab=xCAT::Table->new($tablename);
|
||||
my %noderecs;
|
||||
# build the table name record
|
||||
@{$noderecs{table}->[0]->{tablename}} = $tablename;
|
||||
# if request for ALL attributes
|
||||
if (grep (/ALL/,@attrs)) { # read the schema and build array of all attrs
|
||||
@attrs=();
|
||||
my $schema = xCAT::Table->getTableSchema($tablename);
|
||||
my $desc = $schema->{descriptions};
|
||||
foreach my $c (@{$schema->{cols}}) {
|
||||
# my $space = (length($c)<7 ? "\t\t" : "\t");
|
||||
push @attrs, $c;
|
||||
}
|
||||
}
|
||||
# read all the attributes in this table
|
||||
my @recs = $tab->getAllAttribs(@attrs);
|
||||
my %tblrecs;
|
||||
foreach my $rec (@recs) {
|
||||
my %datseg=();
|
||||
foreach my $key (keys %$rec) {
|
||||
$datseg{$key} = $rec->{$key};
|
||||
}
|
||||
push @{$tblrecs{table}->[0]->{row}}, \%datseg;
|
||||
}
|
||||
push @{$rsp{"table"}}, @{$tblrecs{table}};
|
||||
} # end of all table processing
|
||||
# for checkin XML created
|
||||
# my $xmlrec=XMLout(\%rsp,RootName=>'xcatresponse',NoAttr=>1,KeyAttr=>[]);
|
||||
$cb->(\%rsp);
|
||||
return;
|
||||
}
|
||||
#
|
||||
# setNodesAttribs
|
||||
# Sets Nodes attributes for noderange for each of the tables supplied
|
||||
# Example of XML in for this routine
|
||||
#<xcatrequest>
|
||||
#<clienttype>PCM</clienttype>
|
||||
#<command>setNodesAttribs</command>
|
||||
#<noderange>blade01-blade02</noderange>
|
||||
#<arg>
|
||||
# <table>
|
||||
# <name>nodelist</name>
|
||||
# <attr>
|
||||
# <groups>test</groups>
|
||||
# <comments> This is a another testx</comments>
|
||||
# </attr>
|
||||
# </table>
|
||||
# <table>
|
||||
# <name>nodetype</name>
|
||||
# <attr>
|
||||
# <os>Redhat2</os>
|
||||
# <comments> This is a another testy</comments>
|
||||
# </attr>
|
||||
# </table>
|
||||
#</arg>
|
||||
#</xcatrequest>
|
||||
#
|
||||
sub setNodesAttribs
|
||||
{
|
||||
my $request = shift;
|
||||
my $cb = shift;
|
||||
my $node = $request->{node}; # added by Client.pm
|
||||
my $noderange = $request->{noderange};
|
||||
my $command = $request->{command}->[0];
|
||||
my %rsp;
|
||||
my $args = $request->{arg};
|
||||
my $tables= $args->[0]->{table};
|
||||
# take input an build a request for the nodech function
|
||||
my $newrequest;
|
||||
$newrequest->{noderange} = $request->{noderange};
|
||||
$newrequest->{command}->[0] = "nodech";
|
||||
foreach my $table (@$tables) {
|
||||
my $tablename = $table->{name}->[0];
|
||||
my %keyhash;
|
||||
my $attrs = $table->{attr};
|
||||
foreach my $attrhash (@$attrs) {
|
||||
foreach my $key (keys %$attrhash) {
|
||||
my $tblattr = $tablename;
|
||||
$tblattr .= ".$key=";
|
||||
$tblattr .= $table->{attr}->[0]->{$key}->[0];
|
||||
push (@{$newrequest->{arg}}, $tblattr);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (@$node) {
|
||||
&nodech(\@$node,$newrequest->{arg},$cb,0);
|
||||
} else {
|
||||
my $rsp = {errorcode=>1,error=>"No nodes in noderange"};
|
||||
$cb->(\%rsp);
|
||||
}
|
||||
return;
|
||||
}
|
||||
#
|
||||
# delEntries
|
||||
# Deletes the table entry based on the input attributes
|
||||
# The attributes and AND'd to together to form the delete request
|
||||
# DELETE FROM nodelist WHERE ("groups" = "compute1,test" AND "status" = "down")
|
||||
# Example of XML in for this routine
|
||||
#
|
||||
#<xcatrequest>
|
||||
#<clienttype>PCM</clienttype>
|
||||
#<command>delEntries</command>
|
||||
#<table>
|
||||
# <name>nodelist</name>
|
||||
# <attr>
|
||||
# <groups>compute1,test</groups>
|
||||
# <status>down</status>
|
||||
# </attr>
|
||||
#</table>
|
||||
# .
|
||||
# .
|
||||
#<table>
|
||||
# .
|
||||
# .
|
||||
# .
|
||||
#</table>
|
||||
#</xcatrequest>
|
||||
#
|
||||
# To delete all entries in a table, you input no attributes
|
||||
#<xcatrequest>
|
||||
#<clienttype>PCM</clienttype>
|
||||
#<command>delEntries</command>
|
||||
#<table>
|
||||
# <name>nodelist</name>
|
||||
#</table>
|
||||
#</xcatrequest>
|
||||
|
||||
|
||||
sub delEntries
|
||||
{
|
||||
my $request = shift;
|
||||
my $cb = shift;
|
||||
my $command = $request->{command}->[0];
|
||||
my %rsp;
|
||||
my $tables= $request->{table};
|
||||
foreach my $table (@$tables) {
|
||||
my $tablename = $table->{name}->[0];
|
||||
my $tab=xCAT::Table->new($tablename);
|
||||
my %keyhash;
|
||||
my $attrs = $table->{attr};
|
||||
foreach my $attrhash (@$attrs) {
|
||||
foreach my $key (keys %$attrhash) {
|
||||
$keyhash{$key} = $attrhash->{$key}->[0];
|
||||
}
|
||||
}
|
||||
if (%keyhash) { # delete based on requested attributes
|
||||
$tab->delEntries(\%keyhash); #Yes, delete *all* entries
|
||||
} else { # delete all entries
|
||||
$tab->delEntries(); #delete *all* entries
|
||||
}
|
||||
$tab->commit; # commit
|
||||
}
|
||||
return;
|
||||
}
|
||||
# getAttribs
|
||||
# Read all the array of attributes for the key from the input table.
|
||||
#<xcatrequest>
|
||||
#<clienttype>PCM</clienttype>
|
||||
#<command>getAttribs</command>
|
||||
#<table>site</table>
|
||||
#<keys>
|
||||
# <key>domain</key>
|
||||
#</keys>
|
||||
#<attr>value</attr>
|
||||
#<attr>comments</attr>
|
||||
#</xcatrequest>
|
||||
#
|
||||
#
|
||||
#<xcatresponse>
|
||||
#<value>{domain value}</value>
|
||||
#<comments>This is a comment</comments>
|
||||
#</xcatresponse>
|
||||
sub getAttribs
|
||||
{
|
||||
my $request = shift;
|
||||
my $cb = shift;
|
||||
my $command = $request->{command}->[0];
|
||||
my $tablename = $request->{table}->[0];
|
||||
my $attr = $request->{attr};
|
||||
my @attrs= @$attr;
|
||||
my $tab=xCAT::Table->new($tablename);
|
||||
my %rsp;
|
||||
my %keyhash;
|
||||
foreach my $k (keys %{$request->{keys}->[0]}) {
|
||||
$keyhash{$k} = $request->{keys}->[0]->{$k}->[0];
|
||||
}
|
||||
my $recs = $tab->getAttribs(\%keyhash,\@attrs);
|
||||
|
||||
if ($recs) {
|
||||
my %attrhash=%$recs;
|
||||
foreach my $k (keys %attrhash) {
|
||||
|
||||
push @{$rsp{$k}}, $recs->{$k};
|
||||
}
|
||||
}
|
||||
$cb->(\%rsp);
|
||||
return;
|
||||
}
|
||||
# setAttribs
|
||||
# Set the attributes for the key(s) input in the table.
|
||||
#<xcatrequest>
|
||||
#<clienttype>PCM</clienttype>
|
||||
#<command>setAttribs</command>
|
||||
#<table>site</table>
|
||||
#<keys>
|
||||
# <key>domain</key>
|
||||
#</keys>
|
||||
#<attr>
|
||||
# <value>cluster.net</value>
|
||||
# <comments>This is a comment</comments>
|
||||
#</xcatrequest>
|
||||
#
|
||||
sub setAttribs
|
||||
{
|
||||
my $request = shift;
|
||||
my $cb = shift;
|
||||
my $command = $request->{command}->[0];
|
||||
my $tablename = $request->{table}->[0];
|
||||
my $tab=xCAT::Table->new($tablename);
|
||||
my %rsp;
|
||||
my %keyhash;
|
||||
my %attrhash;
|
||||
foreach my $k (keys %{$request->{keys}->[0]}) {
|
||||
$keyhash{$k} = $request->{keys}->[0]->{$k}->[0];
|
||||
}
|
||||
foreach my $a (keys %{$request->{attr}->[0]}) {
|
||||
$attrhash{$a} = $request->{attr}->[0]->{$a}->[0];
|
||||
}
|
||||
$tab->setAttribs(\%keyhash,\%attrhash);
|
||||
return;
|
||||
}
|
||||
# noderange
|
||||
# Expands the input noderange into a list of nodes.
|
||||
#<xcatrequest>
|
||||
#<clienttype>PCM</clienttype>
|
||||
#<command>noderange</command>
|
||||
#<noderange>compute1-compute2</noderange>
|
||||
#</xcatrequest>
|
||||
#<xcatresponse>
|
||||
#<node>nodename1</node>
|
||||
# .
|
||||
# .
|
||||
#<node>nodenamern1</node>
|
||||
#</xcatresponse>
|
||||
sub NodeRange
|
||||
{
|
||||
my $request = shift;
|
||||
my $cb = shift;
|
||||
my $command = $request->{command}->[0];
|
||||
my %rsp;
|
||||
my $node=$request->{node};
|
||||
my @nodes = @$node;
|
||||
foreach my $node (@nodes){
|
||||
push @{$rsp{"node"}}, $node;
|
||||
|
||||
}
|
||||
$cb->(\%rsp);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -451,7 +451,6 @@ sub preprocess_updatenode
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
my $sn = xCAT::Utils->get_ServiceNode(\@nodes, "xcat", "MN");
|
||||
if ($::ERROR_RC)
|
||||
{
|
||||
@@ -543,7 +542,7 @@ sub preprocess_updatenode
|
||||
foreach my $snkey (keys %$sn)
|
||||
{
|
||||
|
||||
my @tmp_a=split(',',$s);
|
||||
my @tmp_a=split(',',$snkey);
|
||||
foreach my $s1 (@tmp_a) {
|
||||
if ($::SECURITY
|
||||
&& !(grep /^$s1$/, @good_sns)
|
||||
@@ -1418,7 +1417,7 @@ sub doAIXcopy
|
||||
{
|
||||
|
||||
my $sip = xCAT::NetworkUtils->getipaddr($snkey);
|
||||
chomp $ip;
|
||||
chomp $sip;
|
||||
if ($ip eq $sip)
|
||||
{
|
||||
next;
|
||||
@@ -1668,24 +1667,26 @@ sub doAIXcopy
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# get the dir names to copy to
|
||||
my $rpm_srcdir;
|
||||
my $instp_srcdir;
|
||||
my $emgr_srcdir;
|
||||
my $srcdir;
|
||||
if ($::ALTSRC) {
|
||||
$rpm_srcdir = "$imagedef{$img}{alt_loc}";
|
||||
$instp_srcdir = "$imagedef{$img}{alt_loc}";
|
||||
$emgr_srcdir = "$imagedef{$img}{alt_loc}";
|
||||
$srcdir = "$imagedef{$img}{alt_loc}";
|
||||
} else {
|
||||
$rpm_srcdir = "$imagedef{$img}{lpp_loc}/RPMS/ppc";
|
||||
$instp_srcdir = "$imagedef{$img}{lpp_loc}/installp/ppc";
|
||||
$emgr_srcdir = "$imagedef{$img}{lpp_loc}/emgr/ppc";
|
||||
$srcdir = "$imagedef{$img}{lpp_loc}";
|
||||
}
|
||||
my $dir = dirname($srcdir);
|
||||
|
||||
if ($::VERBOSE)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Copying $srcdir to $dir on service node $snkey.\n";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
|
||||
# make sure the dir exists on the service node
|
||||
# also make sure it's writeable by all
|
||||
my $mkcmd = qq~/usr/bin/mkdir -p $rpm_srcdir; chmod 777 $rpm_srcdir; /usr/bin/mkdir -p $instp_srcdir; chmod 777 $instp_srcdir; /usr/bin/mkdir -p $emgr_srcdir; chmod 777 $emgr_srcdir~;
|
||||
my $mkcmd = qq~/usr/bin/mkdir -p $dir~;
|
||||
my $output = xCAT::InstUtils->xcmd($callback, $subreq, "xdsh", $snkey, $mkcmd, 0);
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
my $rsp;
|
||||
@@ -1697,72 +1698,34 @@ sub doAIXcopy
|
||||
next;
|
||||
}
|
||||
|
||||
# copy all the packages
|
||||
foreach my $pkg (@pkglist)
|
||||
{
|
||||
my $rcpargs;
|
||||
my $srcfile;
|
||||
if (($pkg =~ /^R:/) || ($pkg =~ /\.rpm/))
|
||||
{
|
||||
my ($junk, $pname);
|
||||
if ($pkg =~ /:/) {
|
||||
($junk, $pname) = split(/:/, $pkg);
|
||||
} else {
|
||||
$pname = $pkg;
|
||||
}
|
||||
# sync source files to SN
|
||||
my $cpcmd = qq~$::XCATROOT/bin/prsync -o "rlHpEAogDz" $srcdir $snkey:$dir 2>/dev/null~;
|
||||
$output=xCAT::InstUtils->xcmd($callback, $subreq, "xdsh", $nimprime, $cpcmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Could not copy $srcdir to $dir for service node $snkey.\n";
|
||||
push @{$rsp->{data}}, "Output from command: \n\n$output\n\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return (1);
|
||||
}
|
||||
|
||||
# use rpm location
|
||||
$rcpargs = ["$rpm_srcdir/$pname", "$rpm_srcdir"];
|
||||
|
||||
} elsif (($pkg =~ /^E:/) || ($pkg =~ /epkg\.Z/)) {
|
||||
|
||||
my ($junk, $pname);
|
||||
if ($pkg =~ /:/) {
|
||||
($junk, $pname) = split(/:/, $pkg);
|
||||
} else {
|
||||
$pname = $pkg;
|
||||
}
|
||||
$rcpargs = ["$emgr_srcdir/$pname", "$emgr_srcdir"];
|
||||
}
|
||||
else
|
||||
{
|
||||
my $pname;
|
||||
my $junk;
|
||||
if ($pkg =~ /:/)
|
||||
{
|
||||
($junk, $pname) = split(/:/, $pkg);
|
||||
}
|
||||
else
|
||||
{
|
||||
$pname = $pkg;
|
||||
}
|
||||
|
||||
# use installp loc
|
||||
my @allfiles = glob "$instp_srcdir/$pname*";
|
||||
my $sourcefiles = "";
|
||||
foreach my $file (@allfiles) {
|
||||
$sourcefiles .= "$file ";
|
||||
}
|
||||
$rcpargs = [$sourcefiles, "$instp_srcdir"];
|
||||
}
|
||||
|
||||
if ($::VERBOSE)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Copying files to $snkey.\n";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
|
||||
my $output = xCAT::Utils->runxcmd({command => ["xdcp"], node => [$snkey], arg => $rcpargs}, $subreq, -1, 0);
|
||||
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Could not copy $pkg to $snkey.\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
# run inutoc in remote installp dir
|
||||
my $installpsrcdir;
|
||||
if ($::ALTSRC) {
|
||||
$installpsrcdir = $srcdir;
|
||||
} else {
|
||||
$installpsrcdir = "$srcdir/installp/ppc";
|
||||
}
|
||||
my $icmd = qq~cd $installpsrcdir; /usr/sbin/inutoc .~;
|
||||
my $output = xCAT::InstUtils->xcmd($callback, $subreq, "xdsh", $snkey, $icmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Could not run inutoc for $installpsrcdir on $snkey\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
}
|
||||
} # end for each osimage
|
||||
} # end - for each service node
|
||||
return (0, \%imagedef, \%nodeupdateinfo);
|
||||
}
|
||||
|
||||
@@ -322,7 +322,6 @@ if(0) { # only do networks on the management node (NIM primary) for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (0, \@nodelist, \@servicenodes, $type);
|
||||
}
|
||||
|
||||
@@ -693,6 +692,9 @@ sub x2n
|
||||
|
||||
$::msgstr = "$::Sname: ";
|
||||
|
||||
my $nimprime = xCAT::InstUtils->getnimprime();
|
||||
chomp $nimprime;
|
||||
|
||||
# process the command line
|
||||
$rc = &processArgs($callback);
|
||||
if ($rc != 0)
|
||||
@@ -720,6 +722,7 @@ sub x2n
|
||||
my @networks;
|
||||
my @groups;
|
||||
foreach my $obj (keys %::objhash) {
|
||||
|
||||
if ($::objtype{$obj} eq 'node') {
|
||||
push(@nodes, $obj);
|
||||
} elsif ($::objtype{$obj} eq 'network') {
|
||||
@@ -742,6 +745,17 @@ sub x2n
|
||||
if (scalar(@nodes)) {
|
||||
foreach my $objname (@nodes) {
|
||||
|
||||
# does this node belong to this server?
|
||||
my $nimmaster = $nimprime;
|
||||
if ($::objhash{$objname}{servicenode}) {
|
||||
my $sn2;
|
||||
($nimmaster, $sn2) = split(/,/, $::objhash{$objname}{servicenode});
|
||||
}
|
||||
|
||||
if (!xCAT::InstUtils->is_me($nimmaster)) {
|
||||
next;
|
||||
}
|
||||
|
||||
if ($::opt_l || $::opt_r) {
|
||||
|
||||
if (&rm_or_list_nim_object($objname, $::objtype{$objname}, $callback)) {
|
||||
@@ -749,13 +763,13 @@ sub x2n
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
|
||||
if (mkclientdef($objname, $callback)) {
|
||||
# could not create client definition
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
next;
|
||||
}
|
||||
} # end for each node
|
||||
}
|
||||
|
||||
# NIM network definitions
|
||||
|
||||
@@ -49,6 +49,11 @@ if (
|
||||
exit 1;
|
||||
}
|
||||
|
||||
if ($^O !~ /^linux/i) {
|
||||
print "xcatdebug command only supports Linux Operating System.\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
if (!($::FUNC || $::DEBUG)) {
|
||||
print "$usage";
|
||||
exit 1;
|
||||
|
||||
@@ -87,9 +87,13 @@ else
|
||||
#for (( num = 0; num < loop_number; num++ ))
|
||||
while [ $num -lt $loop_number ]
|
||||
do
|
||||
num1=`expr $num % 2`
|
||||
`rmdev -d -l ib$num`
|
||||
`rmdev -d -l ml$num1`
|
||||
`rmdev -d -l ib$num >/dev/null 2>&1`
|
||||
n=`expr $num % 2`
|
||||
if [ $n == 1 ]
|
||||
then
|
||||
mlnum=`expr $num / 2`
|
||||
`rmdev -d -l ml$mlnum >/dev/null 2>&1`
|
||||
fi
|
||||
num=`expr $num + 1`
|
||||
done
|
||||
|
||||
|
||||
@@ -82,9 +82,11 @@ else
|
||||
#for (( num = 0; num < loop_number; num++ ))
|
||||
while [ $num -lt $loop_number ]
|
||||
do
|
||||
num1=`expr $num % 2`
|
||||
`rmdev -d -l ib$num`
|
||||
`rmdev -d -l ml$num1`
|
||||
num0=`expr $num \* 2`
|
||||
num1=`expr $num0 + 1`
|
||||
`rmdev -d -l ib$num0 >/dev/null 2>&1`
|
||||
`rmdev -d -l ib$num1 >/dev/null 2>&1`
|
||||
`rmdev -d -l ml$num >/dev/null 2>&1`
|
||||
num=`expr $num + 1`
|
||||
done
|
||||
|
||||
@@ -94,6 +96,7 @@ else
|
||||
fi
|
||||
|
||||
|
||||
|
||||
HOST=`hostname -s`
|
||||
|
||||
num=0
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
../esx/base.esxi4.1.tmpl
|
||||
@@ -34,3 +34,9 @@ fi
|
||||
export HOSTNAME=$(host $IP 2>/dev/null | awk '{print $5}' | awk -F. '{print $1}')
|
||||
hostname $HOSTNAME
|
||||
|
||||
if [ -f /boot/efi/efi/redhat/grub.conf ]; then #RedHat bug, grub.efi corrupts console unless we are careful...
|
||||
sed -i s/^terminal.*// /boot/efi/efi/redhat/grub.conf
|
||||
bootpart=$(sed -e 's/#.*//' /boot/efi/efi/redhat/grub.conf |grep root|grep -v kernel|head -n 1|awk '{print $2}')
|
||||
bootpart="${bootpart%\\n}"
|
||||
sed -i s!^serial.*!splashimage=$bootpart/boot/grub/splash.xpm.gz! /boot/efi/efi/redhat/grub.conf
|
||||
fi
|
||||
|
||||
@@ -8,6 +8,11 @@ hostname $HOSTNAME
|
||||
# Master/service node set by nodeset
|
||||
export MASTER_IPS=( replace_master )
|
||||
export MASTER=replace_master
|
||||
export INSTALLDIR=replace_install_dir
|
||||
if [ -z "$INSTALLDIR" ]; then
|
||||
INSTALLDIR="/install"
|
||||
fi
|
||||
|
||||
cd /tmp
|
||||
RAND=$(perl -e 'print int(rand(50)). "\n"')
|
||||
sleep $RAND
|
||||
@@ -15,111 +20,111 @@ sleep $RAND
|
||||
# Loop through the master/service nodes
|
||||
for t in $(seq 1 20)
|
||||
do
|
||||
GOTIT=0
|
||||
for i in $MASTER_IPS
|
||||
do
|
||||
# Download postscripts from FTP server
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/postscripts
|
||||
if [ "$?" = "0" ]; then
|
||||
# Exit if openssl is not executable
|
||||
if [ ! -x /usr/bin/openssl ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
USEOPENSSLFORXCAT=1
|
||||
export USEOPENSSLFORXCAT
|
||||
|
||||
# Get xcat server
|
||||
XCATSERVER=$i:3001
|
||||
export XCATSERVER
|
||||
GOTIT=0
|
||||
for i in $MASTER_IPS
|
||||
do
|
||||
# Download postscripts from server
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -e robots=off -nH --cut-dirs=2 --reject "index.html*" --no-parent -t 0 -T 60 http://$i$INSTALLDIR/postscripts/ -P /xcatpost
|
||||
if [ "$?" = "0" ]; then
|
||||
# Exit if openssl is not executable
|
||||
if [ ! -x /usr/bin/openssl ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
USEOPENSSLFORXCAT=1
|
||||
export USEOPENSSLFORXCAT
|
||||
|
||||
# Get xcat server
|
||||
XCATSERVER=$i:3001
|
||||
export XCATSERVER
|
||||
|
||||
# Move postscritps into /xcatpost
|
||||
mv $i/postscripts /xcatpost
|
||||
# Remove postscritps
|
||||
rm -rf $i
|
||||
# Make postscripts executable
|
||||
chmod +x /xcatpost/*
|
||||
# Move postscritps into /xcatpost
|
||||
mv $i/postscripts /xcatpost
|
||||
# Remove postscritps
|
||||
rm -rf $i
|
||||
|
||||
# Make postscripts executable
|
||||
chmod +x /xcatpost/*
|
||||
|
||||
# Get postscript to run on this node from xcat server
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
|
||||
MYCONT=`grep MASTER /tmp/mypostscript`
|
||||
MAX_RETRIES=10
|
||||
RETRY=0
|
||||
while [ -z "$MYCONT" ]; do
|
||||
RETRY=$(($RETRY+1))
|
||||
if [ $RETRY -eq $MAX_RETRIES ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
# Get postscript to run on this node from xcat server
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /xcatpost/mypostscript
|
||||
MYCONT=`grep MASTER /xcatpost/mypostscript`
|
||||
MAX_RETRIES=10
|
||||
RETRY=0
|
||||
while [ -z "$MYCONT" ]; do
|
||||
RETRY=$(($RETRY+1))
|
||||
if [ $RETRY -eq $MAX_RETRIES ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
|
||||
# Sleep a couple of seconds before trying again
|
||||
let SLI=$RANDOM%10+10
|
||||
sleep $SLI
|
||||
|
||||
# Get postscript to run on this node from xcat server
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
|
||||
MYCONT=`grep MASTER /tmp/mypostscript`
|
||||
done
|
||||
# Sleep a couple of seconds before trying again
|
||||
let SLI=$RANDOM%10+10
|
||||
sleep $SLI
|
||||
|
||||
# Get postscript to run on this node from xcat server
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /xcatpost/mypostscript
|
||||
MYCONT=`grep MASTER /xcatpost/mypostscript`
|
||||
done
|
||||
|
||||
# Make executable
|
||||
chmod +x /tmp/mypostscript
|
||||
GOTIT=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# If postscripts for this node are found
|
||||
if [ "$GOTIT" = "1" ]; then
|
||||
# Save the master/service node to /opt/xcat/xcatinfo file
|
||||
if [ ! -f /opt/xcat/xcatinfo ]; then
|
||||
mkdir -p /opt/xcat
|
||||
touch /opt/xcat/xcatinfo
|
||||
fi
|
||||
echo "XCATSERVER=$i" > /opt/xcat/xcatinfo
|
||||
break
|
||||
fi
|
||||
RAND=$(perl -e 'print int(rand(5)). "\n"')
|
||||
sleep $RAND
|
||||
# Make executable
|
||||
chmod +x /xcatpost/mypostscript
|
||||
GOTIT=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# If postscripts for this node are found
|
||||
if [ "$GOTIT" = "1" ]; then
|
||||
# Save the master/service node to /opt/xcat/xcatinfo file
|
||||
if [ ! -f /opt/xcat/xcatinfo ]; then
|
||||
mkdir -p /opt/xcat
|
||||
touch /opt/xcat/xcatinfo
|
||||
fi
|
||||
echo "XCATSERVER=$i" > /opt/xcat/xcatinfo
|
||||
echo "REBOOT=TRUE" >> /opt/xcat/xcatinfo
|
||||
break
|
||||
fi
|
||||
RAND=$(perl -e 'print int(rand(5)). "\n"')
|
||||
sleep $RAND
|
||||
done
|
||||
|
||||
cd /xcatpost
|
||||
export PATH=/xcatpost:$PATH
|
||||
|
||||
# use the run_ps subroutine to run the postscripts
|
||||
TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript`
|
||||
# Use the run_ps subroutine to run the postscripts
|
||||
TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /xcatpost/mypostscript`
|
||||
echo "
|
||||
# subroutine used to run postscripts
|
||||
# Subroutine used to run postscripts
|
||||
run_ps () {
|
||||
logdir=\"/var/log/xcat\"
|
||||
mkdir -p \$logdir
|
||||
logfile=\"/var/log/xcat/xcat.log\"
|
||||
logdir=\"/var/log/xcat\"
|
||||
mkdir -p \$logdir
|
||||
logfile=\"/var/log/xcat/xcat.log\"
|
||||
|
||||
if [ -f \$1 ]; then
|
||||
echo \"Running postscript: \$@\" | tee -a \$logfile
|
||||
./\$@ 2>&1 1> /tmp/tmp4xcatlog
|
||||
cat /tmp/tmp4xcatlog | tee -a \$logfile
|
||||
else
|
||||
echo \"Postscript \$1 does NOT exist.\" | tee -a \$logfile
|
||||
fi
|
||||
if [ -f \$1 ]; then
|
||||
echo \"Running postscript: \$@\" | tee -a \$logfile
|
||||
./\$@ 2>&1 | tee -a $logfile
|
||||
else
|
||||
echo \"Postscript \$1 does NOT exist.\" | tee -a \$logfile
|
||||
fi
|
||||
}
|
||||
# subroutine end
|
||||
# Subroutine end
|
||||
|
||||
" > /tmp/mypostscript
|
||||
echo "$TMP" >> /tmp/mypostscript
|
||||
TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript`
|
||||
echo "$TMP" > /tmp/mypostscript
|
||||
" > /xcatpost/mypostscript
|
||||
echo "$TMP" >> /xcatpost/mypostscript
|
||||
TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /xcatpost/mypostscript`
|
||||
echo "$TMP" > /xcatpost/mypostscript
|
||||
|
||||
|
||||
|
||||
# Save post boot scripts to /tmp/mypostscript.post
|
||||
TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript`
|
||||
echo "$TMP" > /tmp/mypostscript.post
|
||||
chmod 755 /tmp/mypostscript.post
|
||||
# Save post boot scripts to /xcatpost/mypostscript.post
|
||||
TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /xcatpost/mypostscript`
|
||||
echo "$TMP" > /xcatpost/mypostscript.post
|
||||
chmod 755 /xcatpost/mypostscript.post
|
||||
|
||||
# Create post init
|
||||
cat >/etc/init.d/xcatpostinit1 << 'EOF'
|
||||
# Install directory variable set by nodeset
|
||||
replace_install_dir/postscripts/xcatpostinit1
|
||||
$INSTALLDIR/postscripts/xcatpostinit1
|
||||
EOF
|
||||
# Change permissions
|
||||
chmod 755 /etc/init.d/xcatpostinit1
|
||||
@@ -128,7 +133,7 @@ chmod 755 /etc/init.d/xcatpostinit1
|
||||
mkdir -p /opt/xcat
|
||||
cat >/opt/xcat/xcatinstallpost << 'EOF'
|
||||
# Install directory variable set by nodeset
|
||||
replace_install_dir/postscripts/xcatinstallpost
|
||||
$INSTALLDIR/postscripts/xcatinstallpost
|
||||
chkconfig xcatpostinit1 off
|
||||
EOF
|
||||
chmod 755 /opt/xcat/xcatinstallpost
|
||||
@@ -136,9 +141,9 @@ chmod 755 /opt/xcat/xcatinstallpost
|
||||
chkconfig --add xcatpostinit1
|
||||
|
||||
# Only run preboot scripts here
|
||||
TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /tmp/mypostscript`
|
||||
echo "$TMP" > /tmp/mypostscript
|
||||
/tmp/mypostscript
|
||||
TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /xcatpost/mypostscript`
|
||||
echo "$TMP" > /xcatpost/mypostscript
|
||||
/xcatpost/mypostscript
|
||||
|
||||
# Master/service node variable set by nodeset
|
||||
updateflag.awk replace_master 3002
|
||||
updateflag.awk $MASTER 3002
|
||||
|
||||
@@ -8,118 +8,122 @@ hostname $HOSTNAME
|
||||
# Master/service node set by nodeset
|
||||
export MASTER_IPS=( replace_master )
|
||||
export MASTER=replace_master
|
||||
export INSTALLDIR=replace_install_dir
|
||||
if [ -z "$INSTALLDIR" ]; then
|
||||
INSTALLDIR="/install"
|
||||
fi
|
||||
|
||||
cd /tmp
|
||||
RAND=$(perl -e 'print int(rand(50)). "\n"')
|
||||
sleep $RAND
|
||||
|
||||
# Loop through the master/service nodes
|
||||
for j in $(seq 1 20)
|
||||
for t in $(seq 1 20)
|
||||
do
|
||||
GOTIT=0
|
||||
for i in $MASTER_IPS
|
||||
do
|
||||
# Download postscripts from FTP server
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/postscripts
|
||||
if [ "$?" = "0" ]; then
|
||||
# Exit if openssl is not executable
|
||||
if [ ! -x /usr/bin/openssl ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
USEOPENSSLFORXCAT=1
|
||||
export USEOPENSSLFORXCAT
|
||||
|
||||
# Get xcat server
|
||||
XCATSERVER=$i:3001
|
||||
export XCATSERVER
|
||||
GOTIT=0
|
||||
for i in $MASTER_IPS
|
||||
do
|
||||
# Download postscripts from server
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -e robots=off -nH --cut-dirs=2 --reject "index.html*" --no-parent -t 0 -T 60 http://$i$INSTALLDIR/postscripts/ -P /xcatpost
|
||||
if [ "$?" = "0" ]; then
|
||||
# Exit if openssl is not executable
|
||||
if [ ! -x /usr/bin/openssl ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
USEOPENSSLFORXCAT=1
|
||||
export USEOPENSSLFORXCAT
|
||||
|
||||
# Get xcat server
|
||||
XCATSERVER=$i:3001
|
||||
export XCATSERVER
|
||||
|
||||
# Move postscritps into /xcatpost
|
||||
mv $i/postscripts /xcatpost
|
||||
# Remove postscritps
|
||||
rm -rf $i
|
||||
# Make postscripts executable
|
||||
chmod +x /xcatpost/*
|
||||
# Move postscripts into /xcatpost
|
||||
mv $i/postscripts /xcatpost
|
||||
# Remove postscritps
|
||||
rm -rf $i
|
||||
|
||||
# Make postscripts executable
|
||||
chmod +x /xcatpost/*
|
||||
|
||||
# Get postscript to run on this node from xcat server
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
|
||||
MYCONT=`grep MASTER /tmp/mypostscript`
|
||||
MAX_RETRIES=10
|
||||
RETRY=0
|
||||
while [ -z "$MYCONT" ]; do
|
||||
RETRY=$(($RETRY+1))
|
||||
if [ $RETRY -eq $MAX_RETRIES ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
# Get postscript to run on this node from xcat server
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /xcatpost/mypostscript
|
||||
MYCONT=`grep MASTER /xcatpost/mypostscript`
|
||||
MAX_RETRIES=10
|
||||
RETRY=0
|
||||
while [ -z "$MYCONT" ]; do
|
||||
RETRY=$(($RETRY+1))
|
||||
if [ $RETRY -eq $MAX_RETRIES ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
|
||||
# Sleep a couple of seconds before trying again
|
||||
let SLI=$RANDOM%10+10
|
||||
sleep $SLI
|
||||
|
||||
# Get postscript to run on this node from xcat server
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
|
||||
MYCONT=`grep MASTER /tmp/mypostscript`
|
||||
done
|
||||
# Sleep a couple of seconds before trying again
|
||||
let SLI=$RANDOM%10+10
|
||||
sleep $SLI
|
||||
|
||||
# Get postscript to run on this node from xcat server
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /xcatpost/mypostscript
|
||||
MYCONT=`grep MASTER /xcatpost/mypostscript`
|
||||
done
|
||||
|
||||
# Make executable
|
||||
chmod +x /tmp/mypostscript
|
||||
GOTIT=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# If postscripts for this node are found
|
||||
if [ "$GOTIT" = "1" ]; then
|
||||
# Save the master/service node to /opt/xcat/xcatinfo file
|
||||
if [ ! -f /opt/xcat/xcatinfo ]; then
|
||||
mkdir -p /opt/xcat
|
||||
touch /opt/xcat/xcatinfo
|
||||
fi
|
||||
echo "XCATSERVER=$i" > /opt/xcat/xcatinfo
|
||||
break
|
||||
fi
|
||||
RAND=$(perl -e 'print int(rand(5)). "\n"')
|
||||
sleep $RAND
|
||||
# Make executable
|
||||
chmod +x /xcatpost/mypostscript
|
||||
GOTIT=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# If postscripts for this node are found
|
||||
if [ "$GOTIT" = "1" ]; then
|
||||
# Save the master/service node to /opt/xcat/xcatinfo file
|
||||
if [ ! -f /opt/xcat/xcatinfo ]; then
|
||||
mkdir -p /opt/xcat
|
||||
touch /opt/xcat/xcatinfo
|
||||
fi
|
||||
echo "XCATSERVER=$i" > /opt/xcat/xcatinfo
|
||||
break
|
||||
fi
|
||||
RAND=$(perl -e 'print int(rand(5)). "\n"')
|
||||
sleep $RAND
|
||||
done
|
||||
|
||||
cd /xcatpost
|
||||
export PATH=/xcatpost:$PATH
|
||||
|
||||
# use the run_ps subroutine to run the postscripts
|
||||
TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript`
|
||||
# Use the run_ps subroutine to run the postscripts
|
||||
TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /xcatpost/mypostscript`
|
||||
echo "
|
||||
# subroutine used to run postscripts
|
||||
# Subroutine used to run postscripts
|
||||
run_ps () {
|
||||
logdir=\"/var/log/xcat\"
|
||||
mkdir -p \$logdir
|
||||
logfile=\"/var/log/xcat/xcat.log\"
|
||||
logdir=\"/var/log/xcat\"
|
||||
mkdir -p \$logdir
|
||||
logfile=\"/var/log/xcat/xcat.log\"
|
||||
|
||||
if [ -f \$1 ]; then
|
||||
echo \"Running postscript: \$@\" | tee -a \$logfile
|
||||
./\$@ 2>&1 1> /tmp/tmp4xcatlog
|
||||
cat /tmp/tmp4xcatlog | tee -a \$logfile
|
||||
else
|
||||
echo \"Postscript \$1 does NOT exist.\" | tee -a \$logfile
|
||||
fi
|
||||
if [ -f \$1 ]; then
|
||||
echo \"Running postscript: \$@\" | tee -a \$logfile
|
||||
./\$@ 2>&1 | tee -a $logfile
|
||||
else
|
||||
echo \"Postscript \$1 does NOT exist.\" | tee -a \$logfile
|
||||
fi
|
||||
}
|
||||
# subroutine end
|
||||
# Subroutine end
|
||||
|
||||
" > /tmp/mypostscript
|
||||
echo "$TMP" >> /tmp/mypostscript
|
||||
TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript`
|
||||
echo "$TMP" > /tmp/mypostscript
|
||||
" > /xcatpost/mypostscript
|
||||
echo "$TMP" >> /xcatpost/mypostscript
|
||||
TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /xcatpost/mypostscript`
|
||||
echo "$TMP" > /xcatpost/mypostscript
|
||||
|
||||
|
||||
|
||||
# Save post boot scripts to /tmp/mypostscript.post
|
||||
TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript`
|
||||
echo "$TMP" > /tmp/mypostscript.post
|
||||
chmod 755 /tmp/mypostscript.post
|
||||
# Save post boot scripts to /xcatpost/mypostscript.post
|
||||
TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /xcatpost/mypostscript`
|
||||
echo "$TMP" > /xcatpost/mypostscript.post
|
||||
chmod 755 /xcatpost/mypostscript.post
|
||||
|
||||
# Create post init
|
||||
cat >/etc/init.d/xcatpostinit1 << 'EOF'
|
||||
# Install directory variable set by nodeset
|
||||
replace_install_dir/postscripts/xcatpostinit1
|
||||
$INSTALLDIR/postscripts/xcatpostinit1
|
||||
EOF
|
||||
# Change permissions
|
||||
chmod 755 /etc/init.d/xcatpostinit1
|
||||
@@ -128,7 +132,7 @@ chmod 755 /etc/init.d/xcatpostinit1
|
||||
mkdir -p /opt/xcat
|
||||
cat >/opt/xcat/xcatinstallpost << 'EOF'
|
||||
# Install directory variable set by nodeset
|
||||
replace_install_dir/postscripts/xcatinstallpost
|
||||
$INSTALLDIR/postscripts/xcatinstallpost
|
||||
chkconfig xcatpostinit1 off
|
||||
EOF
|
||||
chmod 755 /opt/xcat/xcatinstallpost
|
||||
@@ -136,12 +140,12 @@ chmod 755 /opt/xcat/xcatinstallpost
|
||||
chkconfig --add xcatpostinit1
|
||||
|
||||
# Only run preboot scripts here
|
||||
TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /tmp/mypostscript`
|
||||
echo "$TMP" > /tmp/mypostscript
|
||||
/tmp/mypostscript
|
||||
TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /xcatpost/mypostscript`
|
||||
echo "$TMP" > /xcatpost/mypostscript
|
||||
/xcatpost/mypostscript
|
||||
|
||||
# Master/service node variable set by nodeset
|
||||
updateflag.awk replace_master 3002
|
||||
updateflag.awk $MASTER 3002
|
||||
|
||||
# Restore default SELinux security context
|
||||
restorecon -R -v /root/.ssh
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<post-scripts config:type="list">
|
||||
<script>
|
||||
<filename>post.sh</filename>
|
||||
<interpreter>shell</interpreter>
|
||||
<source>
|
||||
<post-scripts config:type="list">
|
||||
<script>
|
||||
<filename>post.sh</filename>
|
||||
<interpreter>shell</interpreter>
|
||||
<source>
|
||||
<![CDATA[
|
||||
#!/bin/sh
|
||||
|
||||
@@ -22,77 +22,83 @@ HOSTNAME=$(hostname -s)
|
||||
|
||||
# These variables are set by nodeset
|
||||
export MASTER_IPS=( replace_master )
|
||||
export MASTER=replace_master
|
||||
export INSTALLDIR=replace_install_dir
|
||||
if [ -z "$INSTALLDIR" ]; then
|
||||
INSTALLDIR="/install"
|
||||
fi
|
||||
|
||||
for t in $(seq 1 20)
|
||||
do
|
||||
GOTIT=0
|
||||
|
||||
# Loop through the master/service nodes
|
||||
for i in $MASTER_IPS
|
||||
do
|
||||
# Download postscripts from FTP server
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/postscripts
|
||||
if [ "$?" = "0" ]; then
|
||||
# Exit if openssl is not executable
|
||||
if [ ! -x /usr/bin/openssl ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get xcat server
|
||||
XCATSERVER=$i:3001
|
||||
export XCATSERVER
|
||||
USEOPENSSLFORXCAT=1
|
||||
export USEOPENSSLFORXCAT
|
||||
GOTIT=0
|
||||
|
||||
# Loop through the master/service nodes
|
||||
for i in $MASTER_IPS
|
||||
do
|
||||
# Download postscripts from FTP server
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -e robots=off -nH --cut-dirs=2 --reject "index.html*" --no-parent -t 0 -T 60 http://$i$INSTALLDIR/postscripts/ -P /xcatpost
|
||||
if [ "$?" = "0" ]; then
|
||||
# Exit if openssl is not executable
|
||||
if [ ! -x /usr/bin/openssl ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get xcat server
|
||||
XCATSERVER=$i:3001
|
||||
export XCATSERVER
|
||||
USEOPENSSLFORXCAT=1
|
||||
export USEOPENSSLFORXCAT
|
||||
|
||||
# Move postscritps into /xcatpost
|
||||
mv $i/postscripts /xcatpost
|
||||
# Remove postscritps
|
||||
rm -rf $i
|
||||
# Make postscripts executable
|
||||
chmod +x /xcatpost/*
|
||||
# Move postscritps into /xcatpost
|
||||
mv $i/postscripts /xcatpost
|
||||
# Remove postscritps
|
||||
rm -rf $i
|
||||
# Make postscripts executable
|
||||
chmod +x /xcatpost/*
|
||||
|
||||
# Get postscript to run on this node from xcat server
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
|
||||
MYCONT=`grep MASTER /tmp/mypostscript`
|
||||
MAX_RETRIES=10
|
||||
RETRY=0
|
||||
while [ -z "$MYCONT" ]; do
|
||||
RETRY=$(($RETRY+1))
|
||||
if [ $RETRY -eq $MAX_RETRIES ]; then
|
||||
break
|
||||
fi
|
||||
# Get postscript to run on this node from xcat server
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
|
||||
MYCONT=`grep MASTER /tmp/mypostscript`
|
||||
MAX_RETRIES=10
|
||||
RETRY=0
|
||||
while [ -z "$MYCONT" ]; do
|
||||
RETRY=$(($RETRY+1))
|
||||
if [ $RETRY -eq $MAX_RETRIES ]; then
|
||||
break
|
||||
fi
|
||||
|
||||
# Sleep a couple of seconds before trying again
|
||||
let SLI=$RANDOM%10+10
|
||||
sleep $SLI
|
||||
# Sleep a couple of seconds before trying again
|
||||
let SLI=$RANDOM%10+10
|
||||
sleep $SLI
|
||||
|
||||
# Get postscript to run on this node from xcat server
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
|
||||
MYCONT=`grep MASTER /tmp/mypostscript`
|
||||
done
|
||||
# Get postscript to run on this node from xcat server
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
|
||||
MYCONT=`grep MASTER /tmp/mypostscript`
|
||||
done
|
||||
|
||||
# Make executable
|
||||
chmod +x /tmp/mypostscript
|
||||
GOTIT=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# If postscripts for this node are found
|
||||
if [ "$GOTIT" = "1" ]; then
|
||||
# Save the master/service node to /opt/xcat/xcatinfo file
|
||||
if [ ! -f /opt/xcat/xcatinfo ]; then
|
||||
mkdir -p /opt/xcat
|
||||
touch /opt/xcat/xcatinfo
|
||||
fi
|
||||
# Make executable
|
||||
chmod +x /tmp/mypostscript
|
||||
GOTIT=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# If postscripts for this node are found
|
||||
if [ "$GOTIT" = "1" ]; then
|
||||
# Save the master/service node to /opt/xcat/xcatinfo file
|
||||
if [ ! -f /opt/xcat/xcatinfo ]; then
|
||||
mkdir -p /opt/xcat
|
||||
touch /opt/xcat/xcatinfo
|
||||
fi
|
||||
|
||||
echo "XCATSERVER=$i" > /opt/xcat/xcatinfo
|
||||
break
|
||||
fi
|
||||
echo "XCATSERVER=$i" > /opt/xcat/xcatinfo
|
||||
echo "REBOOT=TRUE" >> /opt/xcat/xcatinfo
|
||||
break
|
||||
fi
|
||||
|
||||
# Sleep for a couple of seconds
|
||||
RAND=$(perl -e 'print int(rand(5)). "\n"')
|
||||
sleep $RAND
|
||||
# Sleep for a couple of seconds
|
||||
RAND=$(perl -e 'print int(rand(5)). "\n"')
|
||||
sleep $RAND
|
||||
done
|
||||
|
||||
PATH=/xcatpost:$PATH
|
||||
@@ -124,7 +130,6 @@ TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ s/\(.*\)/run_p
|
||||
echo "$TMP" > /tmp/mypostscript
|
||||
|
||||
|
||||
|
||||
# Save post boot scripts to /tmp/mypostscript.post
|
||||
TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript`
|
||||
echo "$TMP" > /tmp/mypostscript.post
|
||||
@@ -133,7 +138,7 @@ chmod 755 /tmp/mypostscript.post
|
||||
# Create post init
|
||||
cat >/etc/init.d/xcatpostinit1 << 'EOF'
|
||||
# Install directory variable is set by nodeset
|
||||
replace_install_dir/postscripts/xcatpostinit1
|
||||
$INSTALLDIR/postscripts/xcatpostinit1
|
||||
EOF
|
||||
# Change permissions
|
||||
chmod 755 /etc/init.d/xcatpostinit1
|
||||
@@ -145,7 +150,7 @@ ln -s /etc/init.d/xcatpostinit1 /etc/init.d/rc5.d/S84xcatpostinit1
|
||||
mkdir -p /opt/xcat
|
||||
cat >/opt/xcat/xcatinstallpost << 'EOF'
|
||||
# Install directory variable is set by nodeset
|
||||
replace_install_dir/postscripts/xcatinstallpost
|
||||
$INSTALLDIR/postscripts/xcatinstallpost
|
||||
chkconfig xcatpostinit1 off
|
||||
EOF
|
||||
# Change permissions
|
||||
@@ -161,9 +166,9 @@ echo "$TMP" > /tmp/mypostscript
|
||||
/tmp/mypostscript
|
||||
|
||||
# Master node is set by nodeset
|
||||
updateflag.awk replace_master 3002
|
||||
updateflag.awk $MASTER 3002
|
||||
cd /
|
||||
]]>
|
||||
</source>
|
||||
</script>
|
||||
</post-scripts>
|
||||
</source>
|
||||
</script>
|
||||
</post-scripts>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<post-scripts config:type="list">
|
||||
<script>
|
||||
<filename>post.sh</filename>
|
||||
<interpreter>shell</interpreter>
|
||||
<source>
|
||||
<post-scripts config:type="list">
|
||||
<script>
|
||||
<filename>post.sh</filename>
|
||||
<interpreter>shell</interpreter>
|
||||
<source>
|
||||
<![CDATA[
|
||||
#!/bin/sh
|
||||
|
||||
@@ -11,84 +11,90 @@ cat /etc/sysconfig/network/ifcfg-replace_device | grep -v "LLADDR" | grep -v "UN
|
||||
echo "LLADDR='replace_lladdr'" >> /tmp/ifcfg-replace_device
|
||||
echo "UNIQUE=''" >> /tmp/ifcfg-replace_device
|
||||
echo "NAME='OSA Express Network card (replace_nic_addr)'" >> /tmp/ifcfg-replace_device
|
||||
cat /tmp/ifcfg-replace_device > /etc/sysconfig/network/ifcfg-replace_device
|
||||
cat /tmp/ifcfg-replace_device > /etc/sysconfig/network/ifcfg-replace_device
|
||||
|
||||
# Get node hostname
|
||||
HOSTNAME=$(hostname -s)
|
||||
|
||||
# These variables are set by nodeset
|
||||
export MASTER_IPS=( replace_master )
|
||||
export MASTER=replace_master
|
||||
export INSTALLDIR=replace_install_dir
|
||||
if [ -z "$INSTALLDIR" ]; then
|
||||
INSTALLDIR="/install"
|
||||
fi
|
||||
|
||||
for t in $(seq 1 20)
|
||||
do
|
||||
GOTIT=0
|
||||
|
||||
# Loop through the master/service nodes
|
||||
for i in $MASTER_IPS
|
||||
do
|
||||
# Download postscripts from FTP server
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/postscripts
|
||||
if [ "$?" = "0" ]; then
|
||||
# Exit if openssl is not executable
|
||||
if [ ! -x /usr/bin/openssl ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get xcat server
|
||||
XCATSERVER=$i:3001
|
||||
export XCATSERVER
|
||||
USEOPENSSLFORXCAT=1
|
||||
export USEOPENSSLFORXCAT
|
||||
GOTIT=0
|
||||
|
||||
# Loop through the master/service nodes
|
||||
for i in $MASTER_IPS
|
||||
do
|
||||
# Download postscripts from FTP server
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -e robots=off -nH --cut-dirs=2 --reject "index.html*" --no-parent -t 0 -T 60 http://$i$INSTALLDIR/postscripts/ -P /xcatpost
|
||||
if [ "$?" = "0" ]; then
|
||||
# Exit if openssl is not executable
|
||||
if [ ! -x /usr/bin/openssl ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get xcat server
|
||||
XCATSERVER=$i:3001
|
||||
export XCATSERVER
|
||||
USEOPENSSLFORXCAT=1
|
||||
export USEOPENSSLFORXCAT
|
||||
|
||||
# Move postscritps into /xcatpost
|
||||
mv $i/postscripts /xcatpost
|
||||
# Remove postscritps
|
||||
rm -rf $i
|
||||
# Make postscripts executable
|
||||
chmod +x /xcatpost/*
|
||||
# Move postscritps into /xcatpost
|
||||
mv $i/postscripts /xcatpost
|
||||
# Remove postscritps
|
||||
rm -rf $i
|
||||
# Make postscripts executable
|
||||
chmod +x /xcatpost/*
|
||||
|
||||
# Get postscript to run on this node from xcat server
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
|
||||
MYCONT=`grep MASTER /tmp/mypostscript`
|
||||
MAX_RETRIES=10
|
||||
RETRY=0
|
||||
while [ -z "$MYCONT" ]; do
|
||||
RETRY=$(($RETRY+1))
|
||||
if [ $RETRY -eq $MAX_RETRIES ]; then
|
||||
break
|
||||
fi
|
||||
# Get postscript to run on this node from xcat server
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
|
||||
MYCONT=`grep MASTER /tmp/mypostscript`
|
||||
MAX_RETRIES=10
|
||||
RETRY=0
|
||||
while [ -z "$MYCONT" ]; do
|
||||
RETRY=$(($RETRY+1))
|
||||
if [ $RETRY -eq $MAX_RETRIES ]; then
|
||||
break
|
||||
fi
|
||||
|
||||
# Sleep a couple of seconds before trying again
|
||||
let SLI=$RANDOM%10+10
|
||||
sleep $SLI
|
||||
# Sleep a couple of seconds before trying again
|
||||
let SLI=$RANDOM%10+10
|
||||
sleep $SLI
|
||||
|
||||
# Get postscript to run on this node from xcat server
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
|
||||
MYCONT=`grep MASTER /tmp/mypostscript`
|
||||
done
|
||||
# Get postscript to run on this node from xcat server
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
|
||||
MYCONT=`grep MASTER /tmp/mypostscript`
|
||||
done
|
||||
|
||||
# Make executable
|
||||
chmod +x /tmp/mypostscript
|
||||
GOTIT=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# If postscripts for this node are found
|
||||
if [ "$GOTIT" = "1" ]; then
|
||||
# Save the master/service node to /opt/xcat/xcatinfo file
|
||||
if [ ! -f /opt/xcat/xcatinfo ]; then
|
||||
mkdir -p /opt/xcat
|
||||
touch /opt/xcat/xcatinfo
|
||||
fi
|
||||
# Make executable
|
||||
chmod +x /tmp/mypostscript
|
||||
GOTIT=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# If postscripts for this node are found
|
||||
if [ "$GOTIT" = "1" ]; then
|
||||
# Save the master/service node to /opt/xcat/xcatinfo file
|
||||
if [ ! -f /opt/xcat/xcatinfo ]; then
|
||||
mkdir -p /opt/xcat
|
||||
touch /opt/xcat/xcatinfo
|
||||
fi
|
||||
|
||||
echo "XCATSERVER=$i" > /opt/xcat/xcatinfo
|
||||
break
|
||||
fi
|
||||
echo "XCATSERVER=$i" > /opt/xcat/xcatinfo
|
||||
echo "REBOOT=TRUE" >> /opt/xcat/xcatinfo
|
||||
break
|
||||
fi
|
||||
|
||||
# Sleep for a couple of seconds
|
||||
RAND=$(perl -e 'print int(rand(5)). "\n"')
|
||||
sleep $RAND
|
||||
# Sleep for a couple of seconds
|
||||
RAND=$(perl -e 'print int(rand(5)). "\n"')
|
||||
sleep $RAND
|
||||
done
|
||||
|
||||
PATH=/xcatpost:$PATH
|
||||
@@ -128,7 +134,7 @@ chmod 755 /tmp/mypostscript.post
|
||||
# Create post init
|
||||
cat >/etc/init.d/xcatpostinit1 << 'EOF'
|
||||
# Install directory variable is set by nodeset
|
||||
replace_install_dir/postscripts/xcatpostinit1
|
||||
$INSTALLDIR/postscripts/xcatpostinit1
|
||||
EOF
|
||||
# Change permissions
|
||||
chmod 755 /etc/init.d/xcatpostinit1
|
||||
@@ -140,8 +146,7 @@ ln -s /etc/init.d/xcatpostinit1 /etc/init.d/rc5.d/S84xcatpostinit1
|
||||
mkdir -p /opt/xcat
|
||||
cat >/opt/xcat/xcatinstallpost << 'EOF'
|
||||
# Install directory variable is set by nodeset
|
||||
replace_install_dir/postscripts/xcatinstallpost
|
||||
chkconfig xcatpostinit1 off
|
||||
$INSTALLDIR/postscripts/xcatinstallpost
|
||||
EOF
|
||||
# Change permissions
|
||||
chmod 755 /opt/xcat/xcatinstallpost
|
||||
@@ -156,9 +161,9 @@ echo "$TMP" > /tmp/mypostscript
|
||||
/tmp/mypostscript
|
||||
|
||||
# Master node is set by nodeset
|
||||
updateflag.awk replace_master 3002
|
||||
updateflag.awk $MASTER 3002
|
||||
cd /
|
||||
]]>
|
||||
</source>
|
||||
</script>
|
||||
</post-scripts>
|
||||
</source>
|
||||
</script>
|
||||
</post-scripts>
|
||||
|
||||
@@ -218,10 +218,12 @@ mkdir -p $RPM_BUILD_ROOT/%{prefix}/ws
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/apache2/conf.d
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/httpd/conf.d
|
||||
cp xCAT-wsapi/* $RPM_BUILD_ROOT/%{prefix}/ws
|
||||
echo "ScriptAlias /xcatws %{prefix}/ws/xcatws.cgi" > $RPM_BUILD_ROOT/etc/apache2/conf.d/xcat-ws.conf
|
||||
echo "ScriptAlias /xcatrhevh %{prefix}/ws/xcatrhevh.cgi" > $RPM_BUILD_ROOT/etc/apache2/conf.d/xcat-ws.conf
|
||||
echo "ScriptAlias /xcatws %{prefix}/ws/xcatws.cgi" >> $RPM_BUILD_ROOT/etc/apache2/conf.d/xcat-ws.conf
|
||||
cat $RPM_BUILD_ROOT/%{prefix}/ws/xcat-ws.conf.apache2 >> $RPM_BUILD_ROOT/etc/apache2/conf.d/xcat-ws.conf
|
||||
|
||||
echo "ScriptAlias /xcatws %{prefix}/ws/xcatws.cgi" > $RPM_BUILD_ROOT/etc/httpd/conf.d/xcat-ws.conf
|
||||
echo "ScriptAlias /xcatrhevh %{prefix}/ws/xcatrhevh.cgi" > $RPM_BUILD_ROOT/etc/httpd/conf.d/xcat-ws.conf
|
||||
echo "ScriptAlias /xcatws %{prefix}/ws/xcatws.cgi" >> $RPM_BUILD_ROOT/etc/httpd/conf.d/xcat-ws.conf
|
||||
cat $RPM_BUILD_ROOT/%{prefix}/ws/xcat-ws.conf.httpd >> $RPM_BUILD_ROOT/etc/httpd/conf.d/xcat-ws.conf
|
||||
rm -f $RPM_BUILD_ROOT/%{prefix}/ws/xcat-ws.conf.apache2
|
||||
rm -f $RPM_BUILD_ROOT/%{prefix}/ws/xcat-ws.conf.httpd
|
||||
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
use strict;
|
||||
use CGI qw/:standard/;
|
||||
use Socket;
|
||||
use IO::Socket::INET;
|
||||
use IO::Socket::SSL; IO::Socket::SSL->import('inet4');
|
||||
|
||||
|
||||
my $q = CGI->new;
|
||||
my $url = $q->url;
|
||||
my $pathInfo = $q->path_info;
|
||||
my $peerAdd = $q->remote_addr;
|
||||
|
||||
my $iaddr = inet_aton($peerAdd);
|
||||
my $peerhost = gethostbyaddr($iaddr, AF_INET);
|
||||
$peerhost =~ s/\..*//;
|
||||
|
||||
if ($pathInfo =~ /^\/rhevh_finish_install\/(.*)$/) {
|
||||
if ($1 eq $peerhost) {
|
||||
&rhevhupdateflag($peerhost);
|
||||
my $cmd = "rhevhupdateflag";
|
||||
}
|
||||
}
|
||||
# check mapping of the IP and hostname
|
||||
|
||||
sub rhevhupdateflag {
|
||||
my $node = shift;
|
||||
|
||||
|
||||
my $socket = IO::Socket::INET->new(
|
||||
PeerAddr => "127.0.0.1",
|
||||
PeerPort => '3001',
|
||||
Timeout => 15,);
|
||||
my $client;
|
||||
if ($socket) {
|
||||
$client = IO::Socket::SSL->start_SSL($socket,
|
||||
Timeout => 0,
|
||||
);
|
||||
}
|
||||
|
||||
my $req1 = "<xcatrequest><command>rhevhupdateflag</command><noderange>";
|
||||
my $req2 = "</noderange></xcatrequest>";
|
||||
my $req = $req1.$node.$req2;
|
||||
|
||||
print $client $req;
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ cmd:makedhcp -a
|
||||
check:rc==0
|
||||
cmd:service dhcpd restart
|
||||
check:rc==0
|
||||
cmd:cat /var/lib/dhcpd/dhcpd.leases| grep $$CN
|
||||
check:output=~$$CN
|
||||
#cmd:cat /var/lib/dhcpd/dhcpd.leases| grep $$CN
|
||||
#check:output=~$$CN
|
||||
cmd:copycds $$ISO
|
||||
check:rc==0
|
||||
cmd:nodeset $$CN install
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
start:Linux_sles_diskless_installation_ppc_flat
|
||||
os:Linux
|
||||
cmd:rscan __GETNODEATTR($$CN,hcp)__ -w
|
||||
check:rc==0
|
||||
cmd:makedns -n
|
||||
check:rc==0
|
||||
cmd:service named restart
|
||||
check:rc==0
|
||||
cmd:makeconservercf $$CN
|
||||
check:rc==0
|
||||
cmd:cat /etc/conserver.cf | grep $$CN
|
||||
check:output=~$$CN
|
||||
cmd:sleep 60
|
||||
cmd:getmacs $$CN -f -D
|
||||
check:rc==0
|
||||
cmd:makedhcp -n
|
||||
check:rc==0
|
||||
cmd:makedhcp -a
|
||||
check:rc==0
|
||||
cmd:service dhcpd restart
|
||||
check:rc==0
|
||||
cmd:cat /var/lib/dhcp/db/dhcpd.leases| grep $$CN
|
||||
check:output=~$$CN
|
||||
cmd:copycds $$ISO
|
||||
check:rc==0
|
||||
cmd:if [ ! -d /install/custom/netboot/sles ]; then mkdir -p /install/custom/netboot/sles; fi
|
||||
check:rc==0
|
||||
cmd:if [ ! -e /install/custom/netboot/sles/compute.synclist ]; then echo "/etc/resolv.conf -> /etc/resolv.conf" > /install/custom/netboot/sles/compute.synclist; fi
|
||||
check:rc==0
|
||||
cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-__GETNODEATTR($$CN,provmethod)__-__GETNODEATTR($$CN,profile)__ synclists=/install/custom/netboot/sles/compute.synclist
|
||||
check:rc==0
|
||||
cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-__GETNODEATTR($$CN,provmethod)__-__GETNODEATTR($$CN,profile)__
|
||||
check:rc==0
|
||||
cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-__GETNODEATTR($$CN,provmethod)__-__GETNODEATTR($$CN,profile)__
|
||||
check:rc==0
|
||||
cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-__GETNODEATTR($$CN,provmethod)__-__GETNODEATTR($$CN,profile)__
|
||||
check:rc==0
|
||||
cmd:rnetboot $$CN
|
||||
check:rc==0
|
||||
cmd:sleep 600
|
||||
cmd:lsdef -l $$CN | grep status
|
||||
check:output=~booted
|
||||
cmd:xdsh $$CN date
|
||||
check:rc==0
|
||||
check:output=~\d\d:\d\d:\d\d
|
||||
end
|
||||
@@ -0,0 +1,141 @@
|
||||
#comments:make sure you have compute node definition on your MN
|
||||
#this case is just supplement for some commands,after your executing,check output from log
|
||||
start:lsslp_cmm
|
||||
description:for part of ngp firebird commands
|
||||
cmd:makedhcp -n
|
||||
check:rc==0
|
||||
check:output!=Error
|
||||
cmd:lsslp -m -z -s CMM
|
||||
check:rc==0
|
||||
check:output=~(hwtype=cmm)
|
||||
check:output=~(groups=cmm,all)
|
||||
end
|
||||
|
||||
start:rspconfig_snmp_ssh
|
||||
description:rspconfig snmpcfg sshcfg
|
||||
cmd:makehosts cmm
|
||||
check:rc==0
|
||||
cmd:makedns cmm
|
||||
check:rc==0
|
||||
cmd:rspconfig cmm sshcfg=enable snmpcfg=enable
|
||||
check:rc==0
|
||||
check:output=~OK
|
||||
check:output!=error
|
||||
check:output=~OK
|
||||
cmd:rspconfig cmm sshcfg
|
||||
check:rc==0
|
||||
check:output=~enabled
|
||||
cmd:rspconfig cmm snmpcfg
|
||||
check:rc==0
|
||||
check:output=~enabled
|
||||
end
|
||||
|
||||
start:rscan_cmm
|
||||
description:rscan cmm
|
||||
cmd:rscan cmm
|
||||
check:rc==0
|
||||
cmd:rscan cmm -z
|
||||
check:rc==0
|
||||
check:output=~cmm
|
||||
cmd:rscan cmm -u
|
||||
check:rc==0
|
||||
end
|
||||
|
||||
start:rspconfig_network
|
||||
cmd:rspconfig $$CN network=*
|
||||
check:rc==0
|
||||
check:output=~OK
|
||||
end
|
||||
|
||||
start:rspconfig_textid
|
||||
description:rspconfig textid
|
||||
cmd:rspconfig $$CN textid=abc123
|
||||
check:rc==0
|
||||
cmd:sleep 20
|
||||
cmd:rspconfig $$CN textid
|
||||
check:rc==0
|
||||
check:output=~abc123
|
||||
check:output=~(\w+)(.*?)\1
|
||||
cmd:rspconfig $$CN textid=*
|
||||
check:rc==0
|
||||
cmd:rspconfig $$CN textid
|
||||
check:output!=abc123
|
||||
cmd:rspconfig blade textid=*
|
||||
check:rc==0
|
||||
cmd:sleep 30
|
||||
cmd:rspconfig blade textid
|
||||
check:rc==0
|
||||
check:output=~(\w+)(.*?)\1
|
||||
end
|
||||
|
||||
start:rspconfig_hwconn
|
||||
description:for hwconn
|
||||
cmd:rmhwconn $$CN
|
||||
check:rc==0
|
||||
check:rc!~(state=LINE UP)
|
||||
cmd:mkhwconn $$CN -t
|
||||
check:rc==0
|
||||
cmd:sleep 40
|
||||
cmd:lshwconn $$CN
|
||||
check:rc==0
|
||||
check:output=~(LINE UP)
|
||||
cmd:rmhwconn blade
|
||||
check:rc==0
|
||||
check:rc!~(state=LINE UP)
|
||||
cmd:mkhwconn blade -t
|
||||
check:rc==0
|
||||
cmd:sleep 50
|
||||
cmd:lshwconn blade
|
||||
check:rc==0
|
||||
check:output=~(LINE UP)
|
||||
end
|
||||
|
||||
start:rpower_bladenode
|
||||
description:rpower
|
||||
cmd:rpower $$CN off
|
||||
check:rc==0
|
||||
cmd:sleep 50
|
||||
cmd:rpower $$CN state
|
||||
check:rc==0
|
||||
cmd:rpower $$CN on
|
||||
check:rc==0
|
||||
check:output=~Success
|
||||
end
|
||||
|
||||
start:rspconfig_solcfg
|
||||
description:for solcfg
|
||||
cmd:rspconfig cmm solcfg=enable
|
||||
check:rc==0
|
||||
cmd:rspconfig cmm solcfg
|
||||
check:output=~enable
|
||||
cmd:rspconfig cmm solcfg=disable
|
||||
check:rc==0
|
||||
cmd:rspconfig cmm solcfg
|
||||
check:rc=0
|
||||
check:output=~disabled
|
||||
check:output!~enable
|
||||
end
|
||||
|
||||
start:getmacs_d_blade
|
||||
description:getmacs
|
||||
cmd:makeconservercf
|
||||
check:rc==0
|
||||
cmd:chdef $$CN getmac=blade
|
||||
cmd:getmacs $$CN -d
|
||||
check:rc==0
|
||||
check:output=~[a-f0-9A-F]{12}|[a-f0-9A-F]{2}:[a-f0-9A-F]{2}:[a-f0-9A-F]{2}:[a-f0-9A-F]{2}:[a-f0-9A-F]{2}:[a-f0-9A-F]{2}
|
||||
cmd:chdef $$CN installnic=mac
|
||||
cmd:getmacs $$CN
|
||||
check:rc==0
|
||||
check:output=~[a-f0-9A-F]{12}|[a-f0-9A-F]{2}:[a-f0-9A-F]{2}:[a-f0-9A-F]{2}:[a-f0-9A-F]{2}:[a-f0-9A-F]{2}:[a-f0-9A-F]{2}
|
||||
end
|
||||
|
||||
start:rinv_firm_ngp
|
||||
description:check firmware level
|
||||
cmd:rinv $$CN firm
|
||||
check:rc==0
|
||||
cmd:rvitals $$CN all
|
||||
check:rc==0
|
||||
check:output=~(Status: Good)
|
||||
end
|
||||
|
||||
@@ -96,7 +96,7 @@ if [ -z "$OSPKGDIR" ]; then
|
||||
OSPKGDIR="$OSPKGDIR/1"
|
||||
elif ( pmatch "$OSVER" "rhel*" ); then
|
||||
OSPKGDIR="$OSPKGDIR/Server"
|
||||
elif ( pmatch "$OSVER" "SL*" ); then
|
||||
elif ( pmatch "$OSVER" "SL5*" ); then
|
||||
OSPKGDIR="$OSPKGDIR/SL"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -199,7 +199,17 @@ sub setupAIXsn
|
||||
# check if /install/postscripts is in /etc/exports
|
||||
if (&runcmd("/bin/cat /etc/exports 2>/dev/null | grep '$installdir/postscripts ' >/dev/null 2>&1") != 0) {
|
||||
# if not add it and make sure it is exported
|
||||
if (&runcmd("echo '$installdir/postscripts -ro' >> /etc/exports; exportfs -a") !=0 ) {
|
||||
my $res;
|
||||
if ($ENV{'USENFSV4ONAIX'} && ($ENV{'USENFSV4ONAIX'} =~ /1|Yes|yes|YES|Y|y/))
|
||||
{
|
||||
$res = &runcmd("echo '$installdir/postscripts -vers=3:4,ro' >> /etc/exports; exportfs -a");
|
||||
}
|
||||
else
|
||||
{
|
||||
$res = &runcmd("echo '$installdir/postscripts -ro' >> /etc/exports; exportfs -a");
|
||||
}
|
||||
if ($res != 0)
|
||||
{
|
||||
$msg = "$::sdate servicenode: Could not update the /etc/exports file.\n";
|
||||
`logger -t xcat $msg`;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ download_postscripts()
|
||||
retry=0
|
||||
rc=1
|
||||
while [ 0 -eq 0 ]; do
|
||||
wget -l inf -nH -N -r --waitretry=10 --random-wait -T 60 -nH --cut-dirs=2 --reject "index.html*" --no-parent http://$server$INSTALLDIR/postscripts/ -P /xcatpost 2> /tmp/wget.log
|
||||
wget -l inf -nH -N -r --waitretry=10 --random-wait -e robots=off -T 60 -nH --cut-dirs=2 --reject "index.html*" --no-parent http://$server$INSTALLDIR/postscripts/ -P /xcatpost 2> /tmp/wget.log
|
||||
rc=$?
|
||||
|
||||
if [ $rc -eq 0 ]; then
|
||||
|
||||
+1
-4
@@ -25,14 +25,11 @@ Requires: xCAT-server xCAT-client perl-DBD-SQLite
|
||||
|
||||
%ifos linux
|
||||
Requires: dhcp httpd nfs-utils expect nmap bind perl-XML-Parser vsftpd perl(CGI)
|
||||
Requires: /etc/xinetd.d/tftp
|
||||
%ifnarch s390x
|
||||
Requires: /etc/xinetd.d/tftp
|
||||
# yaboot-xcat is pulled in so any MN can manage ppc nodes
|
||||
Requires: conserver-xcat yaboot-xcat perl-Net-Telnet fping
|
||||
%endif
|
||||
%ifarch ppc64
|
||||
Requires: perl-IO-Stty
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%ifarch i386 i586 i686 x86 x86_64
|
||||
|
||||
+2
-7
@@ -24,15 +24,10 @@ Requires: perl-XML-Parser
|
||||
Conflicts: xCAT
|
||||
|
||||
%ifos linux
|
||||
# yaboot-xcat is pulled in so any SN can manage ppc nodes
|
||||
Requires: dhcp httpd nfs-utils expect nmap fping bind perl-XML-Parser vsftpd
|
||||
%ifarch ppc64
|
||||
Requires: perl-IO-Stty
|
||||
%endif
|
||||
%ifarch s390x
|
||||
# No additional requires for zLinux right now
|
||||
%else
|
||||
%ifnarch s390x
|
||||
Requires: /etc/xinetd.d/tftp
|
||||
# yaboot-xcat is pulled in so any SN can manage ppc nodes
|
||||
Requires: conserver-xcat yaboot-xcat perl-Net-Telnet
|
||||
%endif
|
||||
%endif
|
||||
|
||||
Reference in New Issue
Block a user