mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-17 11:04:00 +01:00
Remove some dead code
This commit is contained in:
parent
dcc288c8be
commit
abb049bc0b
@ -24,7 +24,6 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -50,7 +49,6 @@ import org.apache.log4j.xml.DOMConfigurator;
|
|||||||
import com.cloud.agent.Agent.ExitStatus;
|
import com.cloud.agent.Agent.ExitStatus;
|
||||||
import com.cloud.agent.dao.StorageComponent;
|
import com.cloud.agent.dao.StorageComponent;
|
||||||
import com.cloud.agent.dao.impl.PropertiesStorage;
|
import com.cloud.agent.dao.impl.PropertiesStorage;
|
||||||
import com.cloud.host.Host;
|
|
||||||
import com.cloud.resource.ServerResource;
|
import com.cloud.resource.ServerResource;
|
||||||
import com.cloud.utils.LogUtils;
|
import com.cloud.utils.LogUtils;
|
||||||
import com.cloud.utils.NumbersUtil;
|
import com.cloud.utils.NumbersUtil;
|
||||||
@ -82,7 +80,6 @@ public class AgentShell implements IAgentShell, Daemon {
|
|||||||
private int _nextAgentId = 1;
|
private int _nextAgentId = 1;
|
||||||
private volatile boolean _exit = false;
|
private volatile boolean _exit = false;
|
||||||
private int _pingRetries;
|
private int _pingRetries;
|
||||||
private Thread _consoleProxyMain = null;
|
|
||||||
private final List<Agent> _agents = new ArrayList<Agent>();
|
private final List<Agent> _agents = new ArrayList<Agent>();
|
||||||
|
|
||||||
public AgentShell() {
|
public AgentShell() {
|
||||||
@ -415,10 +412,12 @@ public class AgentShell implements IAgentShell, Daemon {
|
|||||||
loadProperties();
|
loadProperties();
|
||||||
parseCommand(args);
|
parseCommand(args);
|
||||||
|
|
||||||
|
if (s_logger.isDebugEnabled()) {
|
||||||
List<String> properties = Collections.list((Enumeration<String>)_properties.propertyNames());
|
List<String> properties = Collections.list((Enumeration<String>)_properties.propertyNames());
|
||||||
for (String property:properties){
|
for (String property:properties){
|
||||||
s_logger.debug("Found property: " + property);
|
s_logger.debug("Found property: " + property);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
s_logger.info("Defaulting to using properties file for storage");
|
s_logger.info("Defaulting to using properties file for storage");
|
||||||
_storage = new PropertiesStorage();
|
_storage = new PropertiesStorage();
|
||||||
@ -447,71 +446,6 @@ public class AgentShell implements IAgentShell, Daemon {
|
|||||||
launchAgentFromTypeInfo();
|
launchAgentFromTypeInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean needConsoleProxy() {
|
|
||||||
for (Agent agent : _agents) {
|
|
||||||
if (agent.getResource().getType().equals(Host.Type.ConsoleProxy)
|
|
||||||
|| agent.getResource().getType().equals(Host.Type.Routing))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getConsoleProxyPort() {
|
|
||||||
int port = NumbersUtil.parseInt(
|
|
||||||
getProperty(null, "consoleproxy.httpListenPort"), 443);
|
|
||||||
return port;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void openPortWithIptables(int port) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
private void launchConsoleProxy() throws ConfigurationException {
|
|
||||||
if (!needConsoleProxy()) {
|
|
||||||
if (s_logger.isInfoEnabled())
|
|
||||||
s_logger.info("Storage only agent, no need to start console proxy on it");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int port = getConsoleProxyPort();
|
|
||||||
openPortWithIptables(port);
|
|
||||||
|
|
||||||
_consoleProxyMain = new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
Class<?> consoleProxyClazz = Class.forName("com.cloud.consoleproxy.ConsoleProxy");
|
|
||||||
|
|
||||||
try {
|
|
||||||
Method method = consoleProxyClazz.getMethod("start",
|
|
||||||
Properties.class);
|
|
||||||
method.invoke(null, _properties);
|
|
||||||
} catch (SecurityException e) {
|
|
||||||
s_logger.error("Unable to launch console proxy due to SecurityException");
|
|
||||||
System.exit(ExitStatus.Error.value());
|
|
||||||
} catch (NoSuchMethodException e) {
|
|
||||||
s_logger.error("Unable to launch console proxy due to NoSuchMethodException");
|
|
||||||
System.exit(ExitStatus.Error.value());
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
s_logger.error("Unable to launch console proxy due to IllegalArgumentException");
|
|
||||||
System.exit(ExitStatus.Error.value());
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
s_logger.error("Unable to launch console proxy due to IllegalAccessException");
|
|
||||||
System.exit(ExitStatus.Error.value());
|
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
s_logger.error("Unable to launch console proxy due to InvocationTargetException");
|
|
||||||
System.exit(ExitStatus.Error.value());
|
|
||||||
}
|
|
||||||
} catch (final ClassNotFoundException e) {
|
|
||||||
s_logger.error("Unable to launch console proxy due to ClassNotFoundException");
|
|
||||||
System.exit(ExitStatus.Error.value());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, "Console-Proxy-Main");
|
|
||||||
_consoleProxyMain.setDaemon(true);
|
|
||||||
_consoleProxyMain.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void launchAgentFromClassInfo(String resourceClassNames)
|
private void launchAgentFromClassInfo(String resourceClassNames)
|
||||||
throws ConfigurationException {
|
throws ConfigurationException {
|
||||||
String[] names = resourceClassNames.split("\\|");
|
String[] names = resourceClassNames.split("\\|");
|
||||||
@ -604,14 +538,6 @@ public class AgentShell implements IAgentShell, Daemon {
|
|||||||
|
|
||||||
launchAgent();
|
launchAgent();
|
||||||
|
|
||||||
//
|
|
||||||
// For both KVM & Xen-Server hypervisor, we have switched to
|
|
||||||
// VM-based console proxy solution, disable launching
|
|
||||||
// of console proxy here
|
|
||||||
//
|
|
||||||
// launchConsoleProxy();
|
|
||||||
//
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
while (!_exit)
|
while (!_exit)
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
@ -631,9 +557,6 @@ public class AgentShell implements IAgentShell, Daemon {
|
|||||||
|
|
||||||
public void stop() {
|
public void stop() {
|
||||||
_exit = true;
|
_exit = true;
|
||||||
if (_consoleProxyMain != null) {
|
|
||||||
_consoleProxyMain.interrupt();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user