2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-19 04:40:21 +00:00

Merge pull request #1811 from gurevichmark/console_on_demand

Support yes and no for node object attribute consoleondemand
This commit is contained in:
Xiaopeng Wang
2016-09-12 14:11:03 +08:00
committed by GitHub
5 changed files with 19 additions and 16 deletions

View File

@ -110,7 +110,7 @@ nodehm Attributes:
\ **consoleondemand**\
This overrides the value from site.consoleondemand; (0=no, 1=yes). Default is the result from site.consoleondemand.
This overrides the value from site.consoleondemand. Set to 'yes', 'no', '1' (equivalent to 'yes'), or '0' (equivalent to 'no'). If not set, the default is the value from site.consoleondemand.

View File

@ -171,7 +171,7 @@ group Attributes:
\ **consoleondemand**\ (nodehm.consoleondemand)
This overrides the value from site.consoleondemand; (0=no, 1=yes). Default is the result from site.consoleondemand.
This overrides the value from site.consoleondemand. Set to 'yes', 'no', '1' (equivalent to 'yes'), or '0' (equivalent to 'no'). If not set, the default is the value from site.consoleondemand.

View File

@ -183,7 +183,7 @@ node Attributes:
\ **consoleondemand**\ (nodehm.consoleondemand)
This overrides the value from site.consoleondemand; (0=no, 1=yes). Default is the result from site.consoleondemand.
This overrides the value from site.consoleondemand. Set to 'yes', 'no', '1' (equivalent to 'yes'), or '0' (equivalent to 'no'). If not set, the default is the value from site.consoleondemand.

View File

@ -595,7 +595,7 @@ passed as argument rather than by table value',
serialflow => "The flow control value of the serial port for this node. For SOL this is typically 'hard'.",
getmac => 'The method to use to get MAC address of the node with the getmac command. If not set, the mgt attribute will be used. Valid values: same as values for mgmt attribute.',
cmdmapping => 'The fully qualified name of the file that stores the mapping between PCM hardware management commands and xCAT/third-party hardware management commands for a particular type of hardware device. Only used by PCM.',
consoleondemand => 'This overrides the value from site.consoleondemand; (0=no, 1=yes). Default is the result from site.consoleondemand.',
consoleondemand => "This overrides the value from site.consoleondemand. Set to 'yes', 'no', '1' (equivalent to 'yes'), or '0' (equivalent to 'no'). If not set, the default is the value from site.consoleondemand.",
comments => 'Any user-written notes.',
disable => "Set to 'yes' or '1' to comment out this row.",
},

View File

@ -191,6 +191,7 @@ sub docfheaders {
# Put in standard headers common to all conserver.cf files
my $content = shift;
my $cb = shift;
my @newheaders = ();
my $numlines = @$content;
my $idx = 0;
@ -283,18 +284,19 @@ sub docfheaders {
#-- then start all consoles on demand
#-- this helps eliminate many ssh connections to blade AMM
#-- which seems to kill AMMs occasionally
#my $sitetab = xCAT::Table->new('site');
#my $vcon = $sitetab->getAttribs({key => "consoleondemand"}, 'value');
my @entries = xCAT::TableUtils->get_site_attribute("consoleondemand");
my $site_entry = $entries[0];
if (defined($site_entry) and $site_entry eq "yes") {
push @newheaders, " options ondemand;\n";
$siteondemand = 1;
$siteondemand = 0;
if (defined($site_entry)) {
if (lc($site_entry) eq "yes") {
push @newheaders, " options ondemand;\n";
$siteondemand = 1;
}
elsif (lc($site_entry) ne "no") {
# consoleondemand attribute is set, but it is not "yes" or "no"
xCAT::SvrUtils::sendmsg([ 1, "Unexpected value $site_entry for consoleondemand attribute in site table" ], $cb);
}
}
else {
$siteondemand = 0;
}
push @newheaders, "}\n";
unshift @$content, @newheaders;
}
@ -327,7 +329,7 @@ sub makeconservercf {
push @filecontent, $_;
}
close $cfile;
docfheaders(\@filecontent);
docfheaders(\@filecontent,$cb);
my $isSN = xCAT::Utils->isServiceNode();
my @hostinfo = xCAT::NetworkUtils->determinehostname();
@ -575,10 +577,11 @@ sub donodeent {
}
}
if (defined($cfgent->{consoleondemand})) {
if ($cfgent->{consoleondemand} && !$siteondemand) {
# consoleondemand attribute for node can be "1", "yes", "0" and "no"
if ((($cfgent->{consoleondemand} eq "1") || lc($cfgent->{consoleondemand}) eq "yes") && !$siteondemand) {
push @$content, " options ondemand;\n";
}
elsif (!$cfgent->{consoleondemand} && $siteondemand) {
elsif ((($cfgent->{consoleondemand} eq "0") || lc($cfgent->{consoleondemand}) eq "no") && $siteondemand) {
push @$content, " options !ondemand;\n";
}
}