From 62b04f0d6c5652ea354ddb8dba43c02423aafbfa Mon Sep 17 00:00:00 2001 From: daniceexi Date: Tue, 23 Dec 2014 03:02:43 -0500 Subject: [PATCH] [Energy management support for P8 with CIM] support to display cim xml payload if specifying -V --- perl-xCAT/xCAT/CIMUtils.pm | 8 ++++++++ xCAT-server/lib/xcat/plugins/energy.pm | 2 ++ 2 files changed, 10 insertions(+) diff --git a/perl-xCAT/xCAT/CIMUtils.pm b/perl-xCAT/xCAT/CIMUtils.pm index 766f247a6..085095b98 100644 --- a/perl-xCAT/xCAT/CIMUtils.pm +++ b/perl-xCAT/xCAT/CIMUtils.pm @@ -423,9 +423,17 @@ sub send_http_request $ua->timeout(10); # the default timeout is 10s } + if (defined($http_params->{verbose}) && defined ($http_params->{callback})) { + $http_params->{callback}({data => ["\n========CIM Request Start========", $http_request->as_string(), "=======CIM Request End======="]}); + } + # send request and receive the response my $response = $ua->request($http_request); + if (defined($http_params->{verbose}) && defined ($http_params->{callback}) && defined ($response->{_content})) { + $http_params->{callback}({data => ["\n========CIM Response Start========", $response->{_content}, "=======CIM Response End======="]}); + } + # check the http response if (defined ($response) && defined ($response->{_rc}) && defined ($response->{_msg})) { if ($response->{_rc} eq "200" && $response->{_msg} eq "OK") { diff --git a/xCAT-server/lib/xcat/plugins/energy.pm b/xCAT-server/lib/xcat/plugins/energy.pm index 1c93e9d9c..0cd4be70f 100644 --- a/xCAT-server/lib/xcat/plugins/energy.pm +++ b/xCAT-server/lib/xcat/plugins/energy.pm @@ -382,6 +382,8 @@ sub process_request { password => $password); if ($verbose) { + $args{verbose} = 1; + $args{callback} = $callback; xCAT::MsgUtils->message("I", {data => ["$node: Access hcp [$ip], user [$user], passowrd [$password]"]}, $callback); } # call the cim utils to connect to cim server