From fe7beabb89f4f15398a5441b1979b5ddd1b25edd Mon Sep 17 00:00:00 2001 From: Arif Ali Date: Wed, 29 Jan 2014 21:47:09 +0000 Subject: [PATCH] add per node consoleondemand --- perl-xCAT/xCAT/Schema.pm | 7 ++++++- xCAT-server/lib/xcat/plugins/conserver.pm | 17 +++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 3e24192fd..7eebae3ff 100644 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -532,7 +532,7 @@ nodegroup => { }, }, nodehm => { - cols => [qw(node power mgt cons termserver termport conserver serialport serialspeed serialflow getmac cmdmapping comments disable)], + cols => [qw(node power mgt cons termserver termport conserver serialport serialspeed serialflow getmac cmdmapping consoleondemand comments disable)], keys => [qw(node)], tablespace =>'XCATTBS16K', table_desc => "Settings that control how each node's hardware is managed. Typically, an additional table that is specific to the hardware type of the node contains additional info. E.g. the ipmi, mp, and ppc tables.", @@ -549,6 +549,7 @@ nodehm => { 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.', comments => 'Any user-written notes.', disable => "Set to 'yes' or '1' to comment out this row.", }, @@ -1816,6 +1817,10 @@ my @nodeattrs = ( {attr_name => 'serialflow', tabentry => 'nodehm.serialflow', access_tabentry => 'nodehm.node=attr:node', + }, + {attr_name => 'consoleondemand', + tabentry => 'nodehm.consoleondemand', + access_tabentry => 'nodehm.node=attr:node', }, ################## # vpd table # diff --git a/xCAT-server/lib/xcat/plugins/conserver.pm b/xCAT-server/lib/xcat/plugins/conserver.pm index da4aeb285..e3fbd4902 100644 --- a/xCAT-server/lib/xcat/plugins/conserver.pm +++ b/xCAT-server/lib/xcat/plugins/conserver.pm @@ -12,6 +12,7 @@ use strict; use Data::Dumper; my @cservers = qw(mrv cyclades); my %termservers; #list of noted termservers +my $siteondemand; # The site value for consoleondemand my $usage_string= " makeconservercf [-d|--delete] noderange @@ -276,6 +277,10 @@ sub docfheaders { my $site_entry = $entries[0]; if ( defined($site_entry) and $site_entry eq "yes" ) { push @newheaders," options ondemand;\n"; + $siteondemand=1; + } + else { + $siteondemand=0; } push @newheaders,"}\n"; @@ -322,7 +327,7 @@ sub makeconservercf { my $hmtab = xCAT::Table->new('nodehm'); my @cfgents1;# = $hmtab->getAllNodeAttribs(['cons','serialport','mgt','conserver','termserver','termport']); if (($nodes and @$nodes > 0) or $req->{noderange}->[0]) { - @cfgents1 = $hmtab->getNodesAttribs($nodes,['node','cons','serialport','mgt','conserver','termserver','termport']); + @cfgents1 = $hmtab->getNodesAttribs($nodes,['node','cons','serialport','mgt','conserver','termserver','termport','consoleondemand']); # Adjust the data structure to make the result consistent with the getAllNodeAttribs() call we make if a noderange was not specified my @tmpcfgents1; foreach my $ent (@cfgents1) @@ -335,7 +340,7 @@ sub makeconservercf { @cfgents1 = @tmpcfgents1 } else { - @cfgents1 = $hmtab->getAllNodeAttribs(['cons','serialport','mgt','conserver','termserver','termport']); + @cfgents1 = $hmtab->getAllNodeAttribs(['cons','serialport','mgt','conserver','termserver','termport','consoleondemand']); } @@ -538,6 +543,14 @@ foreach my $node (sort keys %$cfgenthash) { push @$content," exec $locerror".$::XCATROOT."/share/xcat/cons/".$cmeth." ".$node.";\n" } } + if (defined($cfgent->{consoleondemand})) { + if ($cfgent->{consoleondemand} && !$siteondemand ) { + push @$content," options ondemand;\n"; + } + elsif (!$cfgent->{consoleondemand} && $siteondemand ) { + push @$content," options !ondemand;\n"; + } + } push @$content,"}\n"; push @$content,"#xCAT END $node CONS\n"; }