|
23 | 23 | import java.io.FileOutputStream; |
24 | 24 | import java.io.FileReader; |
25 | 25 | import java.io.IOException; |
26 | | -import java.io.InputStream; |
27 | | -import java.io.InputStreamReader; |
28 | 26 | import java.io.Reader; |
29 | 27 | import java.net.InetAddress; |
30 | 28 | import java.net.URI; |
31 | 29 | import java.net.URISyntaxException; |
32 | | -import java.net.URL; |
33 | | -import java.net.URLConnection; |
34 | 30 | import java.text.DateFormat; |
35 | 31 | import java.text.MessageFormat; |
36 | 32 | import java.text.SimpleDateFormat; |
|
148 | 144 | import com.cloud.agent.api.VmStatsEntry; |
149 | 145 | import com.cloud.agent.api.check.CheckSshAnswer; |
150 | 146 | import com.cloud.agent.api.check.CheckSshCommand; |
151 | | -import com.cloud.agent.api.proxy.CheckConsoleProxyLoadCommand; |
152 | | -import com.cloud.agent.api.proxy.ConsoleProxyLoadAnswer; |
153 | | -import com.cloud.agent.api.proxy.WatchConsoleProxyLoadCommand; |
154 | 147 | import com.cloud.agent.api.routing.IpAssocCommand; |
155 | 148 | import com.cloud.agent.api.routing.IpAssocVpcCommand; |
156 | 149 | import com.cloud.agent.api.routing.NetworkElementCommand; |
@@ -1307,11 +1300,7 @@ public Answer executeRequest(final Command cmd) { |
1307 | 1300 | } |
1308 | 1301 |
|
1309 | 1302 | try { |
1310 | | - if (cmd instanceof CheckConsoleProxyLoadCommand) { |
1311 | | - return execute((CheckConsoleProxyLoadCommand)cmd); |
1312 | | - } else if (cmd instanceof WatchConsoleProxyLoadCommand) { |
1313 | | - return execute((WatchConsoleProxyLoadCommand)cmd); |
1314 | | - } else if (cmd instanceof GetVncPortCommand) { |
| 1303 | + if (cmd instanceof GetVncPortCommand) { |
1315 | 1304 | return execute((GetVncPortCommand)cmd); |
1316 | 1305 | } else if (cmd instanceof ModifySshKeysCommand) { |
1317 | 1306 | return execute((ModifySshKeysCommand)cmd); |
@@ -2886,56 +2875,10 @@ protected GetVncPortAnswer execute(final GetVncPortCommand cmd) { |
2886 | 2875 | } |
2887 | 2876 | } |
2888 | 2877 |
|
2889 | | - protected Answer execute(final CheckConsoleProxyLoadCommand cmd) { |
2890 | | - return executeProxyLoadScan(cmd, cmd.getProxyVmId(), cmd.getProxyVmName(), cmd.getProxyManagementIp(), cmd.getProxyCmdPort()); |
2891 | | - } |
2892 | | - |
2893 | | - protected Answer execute(final WatchConsoleProxyLoadCommand cmd) { |
2894 | | - return executeProxyLoadScan(cmd, cmd.getProxyVmId(), cmd.getProxyVmName(), cmd.getProxyManagementIp(), cmd.getProxyCmdPort()); |
2895 | | - } |
2896 | | - |
2897 | 2878 | protected MaintainAnswer execute(final MaintainCommand cmd) { |
2898 | 2879 | return new MaintainAnswer(cmd); |
2899 | 2880 | } |
2900 | 2881 |
|
2901 | | - private Answer executeProxyLoadScan(final Command cmd, final long proxyVmId, final String proxyVmName, final String proxyManagementIp, final int cmdPort) { |
2902 | | - String result = null; |
2903 | | - |
2904 | | - final StringBuffer sb = new StringBuffer(); |
2905 | | - sb.append("http://").append(proxyManagementIp).append(":" + cmdPort).append("/cmd/getstatus"); |
2906 | | - |
2907 | | - boolean success = true; |
2908 | | - try { |
2909 | | - final URL url = new URL(sb.toString()); |
2910 | | - final URLConnection conn = url.openConnection(); |
2911 | | - |
2912 | | - final InputStream is = conn.getInputStream(); |
2913 | | - final BufferedReader reader = new BufferedReader(new InputStreamReader(is)); |
2914 | | - final StringBuilder sb2 = new StringBuilder(); |
2915 | | - String line = null; |
2916 | | - try { |
2917 | | - while ((line = reader.readLine()) != null) { |
2918 | | - sb2.append(line + "\n"); |
2919 | | - } |
2920 | | - result = sb2.toString(); |
2921 | | - } catch (final IOException e) { |
2922 | | - success = false; |
2923 | | - } finally { |
2924 | | - try { |
2925 | | - is.close(); |
2926 | | - } catch (final IOException e) { |
2927 | | - s_logger.warn("Exception when closing , console proxy address : " + proxyManagementIp); |
2928 | | - success = false; |
2929 | | - } |
2930 | | - } |
2931 | | - } catch (final IOException e) { |
2932 | | - s_logger.warn("Unable to open console proxy command port url, console proxy address : " + proxyManagementIp); |
2933 | | - success = false; |
2934 | | - } |
2935 | | - |
2936 | | - return new ConsoleProxyLoadAnswer(cmd, proxyVmId, proxyVmName, success, result); |
2937 | | - } |
2938 | | - |
2939 | 2882 | protected PowerState convertToPowerState(final DomainState ps) { |
2940 | 2883 | final PowerState state = s_powerStatesTable.get(ps); |
2941 | 2884 | return state == null ? PowerState.PowerUnknown : state; |
|
0 commit comments