From 39bc1e21a6eeee13266a2d24d094e99001b4d575 Mon Sep 17 00:00:00 2001 From: jjohnson2 Date: Thu, 26 Mar 2015 10:01:10 -0400 Subject: [PATCH] Change wvid to pass IP to client When remote xCAT client is used, often the client will not have the same name resolution in place as the management node. For wvid, mitigate this by passing the IP address to the client. If name resolution worked before, this should be no downside. If routing also doesn't work, well the user is no worse off than before at the moment. --- xCAT-server/lib/xcat/plugins/ipmi.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index a6334f063..8a665ada9 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -26,6 +26,7 @@ use xCAT::TableUtils; use xCAT::IMMUtils; use xCAT::ServiceNodeUtils; use xCAT::SvrUtils; +use xCAT::NetworkUtils; use xCAT::Usage; use Thread qw(yield); use LWP 5.64; @@ -1229,6 +1230,8 @@ sub getrvidparms_imm2 { return; } my $host = $sessdata->{ipmisession}->{bmc}; + my $hostname; + ($hostname, $host) = xCAT::NetworkUtils->gethostnameandip($host); my $ip6mode=0; if ($host =~ /:/) { $ip6mode=1; $host = "[".$host."]"; } my $message = "user=".$sessdata->{ipmisession}->{userid}."&password=".$sessdata->{ipmisession}->{password}."&SessionTimeout=1200"; @@ -1252,15 +1255,15 @@ sub getrvidparms_imm2 { $response = $browser->request(GET $baseurl."data/logout"); return; } - $response = $browser->request(GET $baseurl."designs/imm/viewer(".$sessdata->{ipmisession}->{bmc}.'@'.$ip6mode.'@'.time().'@1@0@1@jnlp)'); + $response = $browser->request(GET $baseurl."designs/imm/viewer(".$host.'@'.$ip6mode.'@'.time().'@1@0@1@jnlp)'); #arguments are host, then ipv6 or not, then timestamp, then whether to encrypte or not, singleusermode, finally 'notwin32' my $jnlp = $response->content; unless ($jnlp) { #ok, might be the newer syntax... - $response = $browser->request(GET $baseurl."designs/imm/viewer(".$sessdata->{ipmisession}->{bmc}.'@'.$httpport.'@'.$ip6mode.'@'.time().'@1@0@1@jnlp'.'@USERID@0@0@0@0'.')'); + $response = $browser->request(GET $baseurl."designs/imm/viewer(".$host.'@'.$httpport.'@'.$ip6mode.'@'.time().'@1@0@1@jnlp'.'@USERID@0@0@0@0'.')'); #arguments are host, then ipv6 or not, then timestamp, then whether to encrypte or not, singleusermode, finally 'notwin32' $jnlp = $response->content; if ($jnlp =~ /Failed to parse ip format for request/) { - $response = $browser->request(GET $baseurl."designs/imm/viewer(".$sessdata->{ipmisession}->{bmc}.'@'.$httpport.'@'.$ip6mode.'@'.time().'@1@0@1@jnlp'.'@USERID@0@0@0@0@0'.')'); + $response = $browser->request(GET $baseurl."designs/imm/viewer(".$host.'@'.$httpport.'@'.$ip6mode.'@'.time().'@1@0@1@jnlp'.'@USERID@0@0@0@0@0'.')'); #arguments are host, then ipv6 or not, then timestamp, then whether to encrypte or not, singleusermode, 'notwin32', and one more (unknown) $jnlp = $response->content; }