fix problems in sinv supporting images

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2401 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
lissav 2008-10-28 15:32:58 +00:00
parent c02300a631
commit 7948b0fa9f
3 changed files with 48 additions and 41 deletions

View File

@ -3602,13 +3602,13 @@ sub parse_and_run_dsh
)
{
xCAT::DSHCLI->usage_dsh;
exit 1;
return 1;
}
if ($options{'help'})
{
xCAT::DSHCLI->usage_dsh;
exit 0;
return 0;
}
my $rsp = {};
@ -3653,12 +3653,16 @@ sub parse_and_run_dsh
# for the hostname in the output
my $path = $options{'rootimg'};
$imagename= xCAT::Utils->get_image_name($path);
if (@$nodes[0] eq "NO_NODE_RANGE") { # from sinv, discard this name
undef @$nodes;
}
if (defined(@$nodes))
{
my $rsp = ();
$rsp->{data}->[0] =
"Input noderange and any other xdsh flags or environment variables are not valid with -i flag. They are ignored.";
xCAT::MsgUtils->message("I", $rsp, $::CALLBACK);
"Input noderange:@$nodes and any other xdsh flags or environment variables are not valid with -i flag.";
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK,1);
return;
}
}

View File

@ -165,7 +165,7 @@ sub parse_and_run_sinv
$rsp->{data}->[0] =
"Input command file: $options{'sinv_cmd_file'} does not exist.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
exit 1;
return 1;
}
$cmd = `cat $options{'sinv_cmd_file'}`;
}
@ -179,7 +179,7 @@ sub parse_and_run_sinv
my @cmdparts = split(' ', $cmd);
my $cmdtype = shift @cmdparts;
my $noderange = shift @cmdparts;
my @cmd = ();
my @cmd = ();
if ($noderange =~ /^-/)
{ # no noderange
push @cmd, $noderange; # put flag back on command
@ -199,11 +199,11 @@ sub parse_and_run_sinv
}
my $cmdoutput;
if ($cmdtype eq "xdsh")
{ # chose output routine to run
{ # chose output routine to run
$cmdoutput = "xdshoutput";
}
else
{ # rinv
{ # rinv
$cmdoutput = "rinvoutput";
}
@ -211,14 +211,14 @@ sub parse_and_run_sinv
# install image ( -i) for xdsh, only case where noderange is not required
if ($noderange =~ /^-/)
{ # no noderange, it is a flag
{ # no noderange, it is a flag
@nodelist = "NO_NODE_RANGE";
# add flag back to arguments
$args .= $noderange;
}
else
{ # get noderange
{ # get noderange
@nodelist = noderange($noderange); # expand noderange
if (nodesmissed)
{
@ -1092,49 +1092,52 @@ sub writereport
#
# Now check to see if we covered all nodes in the dsh
# short names must match long names
# short names must match long names, ignore NO_NODE_RANGE
#
my $firstpass = 0;
my $nodefound = 0;
foreach my $dshnodename (@dshnodearray)
{
my @shortdshnodename;
my @shortnodename;
chomp $dshnodename;
$dshnodename =~ s/\s*//g; # remove blanks
foreach my $nodename (@nodearray)
{
@shortdshnodename = split(/\./, $dshnodename);
@shortnodename = split(/\./, $nodename);
if ($shortdshnodename[0] eq $shortnodename[0])
if ($dshnodename ne "NO_NODE_RANGE")
{ # skip it
my @shortdshnodename;
my @shortnodename;
chomp $dshnodename;
$dshnodename =~ s/\s*//g; # remove blanks
foreach my $nodename (@nodearray)
{
$nodefound = 1; # we have a match
last;
@shortdshnodename = split(/\./, $dshnodename);
@shortnodename = split(/\./, $nodename);
if ($shortdshnodename[0] eq $shortnodename[0])
{
$nodefound = 1; # we have a match
last;
}
}
}
if ($nodefound == 0)
{ # dsh node name missing
if ($firstpass == 0)
{ # put out header
$rsp->{data}->[0] = "The following nodes had no output:\n";
if ($nodefound == 0)
{ # dsh node name missing
if ($firstpass == 0)
{ # put out header
$rsp->{data}->[0] = "The following nodes had no output:\n";
print $::OUTPUT_FILE_HANDLE $rsp->{data}->[0];
if ($::VERBOSE)
{
xCAT::MsgUtils->message("I", $rsp, $callback);
}
$firstpass = 1;
}
# add missing node
$rsp->{data}->[0] = "$shortdshnodename[0]\n";
print $::OUTPUT_FILE_HANDLE $rsp->{data}->[0];
if ($::VERBOSE)
{
xCAT::MsgUtils->message("I", $rsp, $callback);
}
$firstpass = 1;
}
# add missing node
$rsp->{data}->[0] = "$shortdshnodename[0]\n";
print $::OUTPUT_FILE_HANDLE $rsp->{data}->[0];
if ($::VERBOSE)
{
xCAT::MsgUtils->message("I", $rsp, $callback);
}
$nodefound = 0;
}
$nodefound = 0;
}
return;
}

View File

@ -2828,9 +2828,9 @@ sub get_image_name {
{
my @fields = split('/', $imagepath);
$imagename .= $fields[5];
$imagename .= ".";
$imagename .= "-";
$imagename .= $fields[3];
$imagename .= ".";
$imagename .= "-";
$imagename .= $fields[4];
}
else