From 6845606f294842ecc734480f931b11f0e70f6456 Mon Sep 17 00:00:00 2001 From: chenglch Date: Fri, 1 Jul 2016 04:07:54 -0400 Subject: [PATCH] Add restapi for console Provide the interface for xcat web GUI to control console resource. --- xCAT-server/xCAT-wsapi/xcatws.cgi | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/xCAT-server/xCAT-wsapi/xcatws.cgi b/xCAT-server/xCAT-wsapi/xcatws.cgi index d0fa35d62..54e3ca8a9 100755 --- a/xCAT-server/xCAT-wsapi/xcatws.cgi +++ b/xCAT-server/xCAT-wsapi/xcatws.cgi @@ -217,6 +217,18 @@ my %URIdef = ( outhdler => \&noout, } }, + console => { + desc => "[URI:/nodes/{noderange}/console] - The console configuration for the node {noderange}", + matcher => '^/nodes/[^/]*/console$', + PUT => { + desc => "Update conserver configuration for the node {noderange}.", + usage => "|Json Formatted DataBody: {action:on/off}.|$usagemsg{non_getreturn}|", + example => "|Enable the console capability for node1|PUT|/nodes/node1/console {\"action\":\"on\"}||", + cmd => "makeconservercf", + fhandler => \&actionhdl, + outhdler => \&noout, + } + }, energy => { desc => "[URI:/nodes/{noderange}/energy] - The energy resource for the node {noderange}", matcher => '^/nodes/[^/]*/energy$', @@ -2119,6 +2131,14 @@ sub actionhdl { } } + } elsif ($params->{'resourcename'} eq "console") { + if ($paramhash->{'action'}) { + my $option = $paramhash->{'action'}; + my %op_hash = ('on' => '', 'off' => '-d'); + push @args, $op_hash{$paramhash->{'action'}}; + } else { + error("Missed Action.",$STATUS_NOT_FOUND); + } } push @{$request->{arg}}, @args;