diff --git a/docs/source/guides/admin-guides/references/man5/nodehm.5.rst b/docs/source/guides/admin-guides/references/man5/nodehm.5.rst index 39d61c12e..e3978e25e 100644 --- a/docs/source/guides/admin-guides/references/man5/nodehm.5.rst +++ b/docs/source/guides/admin-guides/references/man5/nodehm.5.rst @@ -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. diff --git a/docs/source/guides/admin-guides/references/man7/group.7.rst b/docs/source/guides/admin-guides/references/man7/group.7.rst index 51e9aab67..410881cb7 100644 --- a/docs/source/guides/admin-guides/references/man7/group.7.rst +++ b/docs/source/guides/admin-guides/references/man7/group.7.rst @@ -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. diff --git a/docs/source/guides/admin-guides/references/man7/node.7.rst b/docs/source/guides/admin-guides/references/man7/node.7.rst index e894f7fb1..09b1fa33a 100644 --- a/docs/source/guides/admin-guides/references/man7/node.7.rst +++ b/docs/source/guides/admin-guides/references/man7/node.7.rst @@ -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. diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index ae4d446de..b70a4ad7b 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -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.", }, diff --git a/xCAT-server/lib/xcat/plugins/conserver.pm b/xCAT-server/lib/xcat/plugins/conserver.pm index 986b77b90..8fdc5dfec 100644 --- a/xCAT-server/lib/xcat/plugins/conserver.pm +++ b/xCAT-server/lib/xcat/plugins/conserver.pm @@ -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"; } }