mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Reformat all source code. Added checkstyle to check the source code
This commit is contained in:
parent
31758ed8d0
commit
8d62744681
@ -99,28 +99,28 @@ public class Agent implements HandlerFactory, IAgentControl {
|
||||
}
|
||||
}
|
||||
|
||||
List<IAgentControlListener> _controlListeners = new ArrayList<IAgentControlListener>();
|
||||
List<IAgentControlListener> _controlListeners = new ArrayList<IAgentControlListener>();
|
||||
|
||||
IAgentShell _shell;
|
||||
NioConnection _connection;
|
||||
ServerResource _resource;
|
||||
Link _link;
|
||||
Long _id;
|
||||
IAgentShell _shell;
|
||||
NioConnection _connection;
|
||||
ServerResource _resource;
|
||||
Link _link;
|
||||
Long _id;
|
||||
|
||||
Timer _timer = new Timer("Agent Timer");
|
||||
Timer _timer = new Timer("Agent Timer");
|
||||
|
||||
List<WatchTask> _watchList = new ArrayList<WatchTask>();
|
||||
long _sequence = 0;
|
||||
long _lastPingResponseTime = 0;
|
||||
long _pingInterval = 0;
|
||||
AtomicInteger _inProgress = new AtomicInteger();
|
||||
List<WatchTask> _watchList = new ArrayList<WatchTask>();
|
||||
long _sequence = 0;
|
||||
long _lastPingResponseTime = 0;
|
||||
long _pingInterval = 0;
|
||||
AtomicInteger _inProgress = new AtomicInteger();
|
||||
|
||||
StartupTask _startup = null;
|
||||
long _startupWaitDefault = 180000;
|
||||
long _startupWait = _startupWaitDefault;
|
||||
boolean _reconnectAllowed = true;
|
||||
StartupTask _startup = null;
|
||||
long _startupWaitDefault = 180000;
|
||||
long _startupWait = _startupWaitDefault;
|
||||
boolean _reconnectAllowed = true;
|
||||
//For time sentitive task, e.g. PingTask
|
||||
private ThreadPoolExecutor _ugentTaskPool;
|
||||
private ThreadPoolExecutor _ugentTaskPool;
|
||||
ExecutorService _executor;
|
||||
|
||||
// for simulator use only
|
||||
@ -132,11 +132,11 @@ public class Agent implements HandlerFactory, IAgentControl {
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(new ShutdownThread(this));
|
||||
|
||||
_ugentTaskPool = new ThreadPoolExecutor(shell.getPingRetries(), 2 * shell.getPingRetries(), 10, TimeUnit.MINUTES,
|
||||
new SynchronousQueue<Runnable>(), new NamedThreadFactory("UgentTask")
|
||||
);
|
||||
|
||||
_executor = new ThreadPoolExecutor(_shell.getWorkers(), 5 * _shell.getWorkers(), 1, TimeUnit.DAYS, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory("agentRequest-Handler"));
|
||||
_ugentTaskPool = new ThreadPoolExecutor(shell.getPingRetries(), 2 * shell.getPingRetries(), 10, TimeUnit.MINUTES, new SynchronousQueue<Runnable>(), new NamedThreadFactory(
|
||||
"UgentTask"));
|
||||
|
||||
_executor = new ThreadPoolExecutor(_shell.getWorkers(), 5 * _shell.getWorkers(), 1, TimeUnit.DAYS, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory(
|
||||
"agentRequest-Handler"));
|
||||
}
|
||||
|
||||
public Agent(IAgentShell shell, int localAgentId, ServerResource resource) throws ConfigurationException {
|
||||
@ -168,16 +168,14 @@ public class Agent implements HandlerFactory, IAgentControl {
|
||||
s_logger.debug("Adding shutdown hook");
|
||||
Runtime.getRuntime().addShutdownHook(new ShutdownThread(this));
|
||||
|
||||
_ugentTaskPool = new ThreadPoolExecutor(shell.getPingRetries(), 2 * shell.getPingRetries(), 10, TimeUnit.MINUTES,
|
||||
new SynchronousQueue<Runnable>(), new NamedThreadFactory("UgentTask")
|
||||
);
|
||||
_ugentTaskPool = new ThreadPoolExecutor(shell.getPingRetries(), 2 * shell.getPingRetries(), 10, TimeUnit.MINUTES, new SynchronousQueue<Runnable>(), new NamedThreadFactory(
|
||||
"UgentTask"));
|
||||
|
||||
|
||||
_executor = new ThreadPoolExecutor(_shell.getWorkers(), 5 * _shell.getWorkers(), 1, TimeUnit.DAYS, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory("agentRequest-Handler"));
|
||||
|
||||
_executor = new ThreadPoolExecutor(_shell.getWorkers(), 5 * _shell.getWorkers(), 1, TimeUnit.DAYS, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory(
|
||||
"agentRequest-Handler"));
|
||||
|
||||
s_logger.info("Agent [id = " + (_id != null ? _id : "new") + " : type = " + getResourceName() + " : zone = " + _shell.getZone() + " : pod = " + _shell.getPod() + " : workers = "
|
||||
+ _shell.getWorkers() + " : host = " + _shell.getHost() + " : port = " + _shell.getPort());
|
||||
s_logger.info("Agent [id = " + (_id != null ? _id : "new") + " : type = " + getResourceName() + " : zone = " + _shell.getZone() + " : pod = " + _shell.getPod() +
|
||||
" : workers = " + _shell.getWorkers() + " : host = " + _shell.getHost() + " : port = " + _shell.getPort());
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
@ -218,13 +216,13 @@ public class Agent implements HandlerFactory, IAgentControl {
|
||||
s_logger.error("Unable to start the resource: " + _resource.getName());
|
||||
throw new CloudRuntimeException("Unable to start the resource: " + _resource.getName());
|
||||
}
|
||||
|
||||
|
||||
_connection.start();
|
||||
while (!_connection.isStartup()) {
|
||||
_shell.getBackoffAlgorithm().waitBeforeRetry();
|
||||
_connection = new NioClient("Agent", _shell.getHost(), _shell.getPort(), _shell.getWorkers(), this);
|
||||
_connection.start();
|
||||
}
|
||||
while (!_connection.isStartup()) {
|
||||
_shell.getBackoffAlgorithm().waitBeforeRetry();
|
||||
_connection = new NioClient("Agent", _shell.getHost(), _shell.getPort(), _shell.getWorkers(), this);
|
||||
_connection.start();
|
||||
}
|
||||
}
|
||||
|
||||
public void stop(final String reason, final String detail) {
|
||||
@ -408,7 +406,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
||||
}
|
||||
}
|
||||
|
||||
final StartupAnswer startup = (StartupAnswer) answer;
|
||||
final StartupAnswer startup = (StartupAnswer)answer;
|
||||
if (!startup.getResult()) {
|
||||
s_logger.error("Not allowed to connect to the server: " + answer.getDetails());
|
||||
System.exit(1);
|
||||
@ -426,7 +424,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
||||
setLastPingResponseTime();
|
||||
scheduleWatch(link, response, _pingInterval, _pingInterval);
|
||||
|
||||
_ugentTaskPool.setKeepAliveTime(2* _pingInterval, TimeUnit.MILLISECONDS);
|
||||
_ugentTaskPool.setKeepAliveTime(2 * _pingInterval, TimeUnit.MILLISECONDS);
|
||||
|
||||
s_logger.info("Startup Response Received: agent id = " + getId());
|
||||
}
|
||||
@ -442,42 +440,42 @@ public class Agent implements HandlerFactory, IAgentControl {
|
||||
final Command cmd = cmds[i];
|
||||
Answer answer;
|
||||
try {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
if (!requestLogged) // ensures request is logged only once per method call
|
||||
{
|
||||
String requestMsg = request.toString();
|
||||
if (requestMsg != null) {
|
||||
s_logger.debug("Request:" + requestMsg);
|
||||
}
|
||||
requestLogged = true;
|
||||
}
|
||||
s_logger.debug("Processing command: " + cmd.toString());
|
||||
}
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
if (!requestLogged) // ensures request is logged only once per method call
|
||||
{
|
||||
String requestMsg = request.toString();
|
||||
if (requestMsg != null) {
|
||||
s_logger.debug("Request:" + requestMsg);
|
||||
}
|
||||
requestLogged = true;
|
||||
}
|
||||
s_logger.debug("Processing command: " + cmd.toString());
|
||||
}
|
||||
|
||||
if (cmd instanceof CronCommand) {
|
||||
final CronCommand watch = (CronCommand) cmd;
|
||||
final CronCommand watch = (CronCommand)cmd;
|
||||
scheduleWatch(link, request, watch.getInterval() * 1000, watch.getInterval() * 1000);
|
||||
answer = new Answer(cmd, true, null);
|
||||
} else if (cmd instanceof ShutdownCommand) {
|
||||
ShutdownCommand shutdown = (ShutdownCommand) cmd;
|
||||
ShutdownCommand shutdown = (ShutdownCommand)cmd;
|
||||
s_logger.debug("Received shutdownCommand, due to: " + shutdown.getReason());
|
||||
cancelTasks();
|
||||
_reconnectAllowed = false;
|
||||
answer = new Answer(cmd, true, null);
|
||||
} else if (cmd instanceof ReadyCommand && ((ReadyCommand)cmd).getDetails() != null) {
|
||||
s_logger.debug("Not ready to connect to mgt server: " + ((ReadyCommand)cmd).getDetails());
|
||||
System.exit(1);
|
||||
return;
|
||||
s_logger.debug("Not ready to connect to mgt server: " + ((ReadyCommand)cmd).getDetails());
|
||||
System.exit(1);
|
||||
return;
|
||||
} else if (cmd instanceof MaintainCommand) {
|
||||
s_logger.debug("Received maintainCommand" );
|
||||
cancelTasks();
|
||||
_reconnectAllowed = false;
|
||||
answer = new MaintainAnswer((MaintainCommand)cmd);
|
||||
s_logger.debug("Received maintainCommand");
|
||||
cancelTasks();
|
||||
_reconnectAllowed = false;
|
||||
answer = new MaintainAnswer((MaintainCommand)cmd);
|
||||
} else if (cmd instanceof AgentControlCommand) {
|
||||
answer = null;
|
||||
synchronized (_controlListeners) {
|
||||
for (IAgentControlListener listener : _controlListeners) {
|
||||
answer = listener.processControlRequest(request, (AgentControlCommand) cmd);
|
||||
answer = listener.processControlRequest(request, (AgentControlCommand)cmd);
|
||||
if (answer != null) {
|
||||
break;
|
||||
}
|
||||
@ -522,10 +520,10 @@ public class Agent implements HandlerFactory, IAgentControl {
|
||||
response = new Response(request, answers);
|
||||
} finally {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
String responseMsg = response.toString();
|
||||
if (responseMsg != null) {
|
||||
s_logger.debug(response.toString());
|
||||
}
|
||||
String responseMsg = response.toString();
|
||||
if (responseMsg != null) {
|
||||
s_logger.debug(response.toString());
|
||||
}
|
||||
}
|
||||
|
||||
if (response != null) {
|
||||
@ -549,19 +547,18 @@ public class Agent implements HandlerFactory, IAgentControl {
|
||||
// Notice, we are doing callback while holding a lock!
|
||||
synchronized (_controlListeners) {
|
||||
for (IAgentControlListener listener : _controlListeners) {
|
||||
listener.processControlResponse(response, (AgentControlAnswer) answer);
|
||||
listener.processControlResponse(response, (AgentControlAnswer)answer);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setLastPingResponseTime();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void processReadyCommand(Command cmd) {
|
||||
|
||||
final ReadyCommand ready = (ReadyCommand) cmd;
|
||||
|
||||
final ReadyCommand ready = (ReadyCommand)cmd;
|
||||
|
||||
s_logger.info("Proccess agent ready command, agent id = " + ready.getHostId());
|
||||
if (ready.getHostId() != null) {
|
||||
setId(ready.getHostId());
|
||||
@ -594,9 +591,9 @@ public class Agent implements HandlerFactory, IAgentControl {
|
||||
} catch (final ClosedChannelException e) {
|
||||
s_logger.warn("Unable to send request: " + request.toString());
|
||||
}
|
||||
|
||||
|
||||
} else if (obj instanceof Request) {
|
||||
final Request req = (Request) obj;
|
||||
final Request req = (Request)obj;
|
||||
final Command command = req.getCommand();
|
||||
Answer answer = null;
|
||||
_inProgress.incrementAndGet();
|
||||
@ -646,7 +643,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
||||
|
||||
@Override
|
||||
public AgentControlAnswer sendRequest(AgentControlCommand cmd, int timeoutInMilliseconds) throws AgentControlChannelException {
|
||||
Request request = new Request(this.getId(), -1, new Command[] { cmd } , true, false);
|
||||
Request request = new Request(this.getId(), -1, new Command[] {cmd}, true, false);
|
||||
request.setSequence(getNextSequence());
|
||||
|
||||
AgentControlListener listener = new AgentControlListener(request);
|
||||
@ -670,7 +667,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
||||
|
||||
@Override
|
||||
public void postRequest(AgentControlCommand cmd) throws AgentControlChannelException {
|
||||
Request request = new Request(this.getId(), -1, new Command[] { cmd } , true, false);
|
||||
Request request = new Request(this.getId(), -1, new Command[] {cmd}, true, false);
|
||||
request.setSequence(getNextSequence());
|
||||
postRequest(request);
|
||||
}
|
||||
@ -690,7 +687,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
||||
|
||||
public class AgentControlListener implements IAgentControlListener {
|
||||
private AgentControlAnswer _answer;
|
||||
private final Request _request;
|
||||
private final Request _request;
|
||||
|
||||
public AgentControlListener(Request request) {
|
||||
_request = request;
|
||||
@ -732,8 +729,8 @@ public class Agent implements HandlerFactory, IAgentControl {
|
||||
|
||||
public class WatchTask extends ManagedContextTimerTask {
|
||||
protected Request _request;
|
||||
protected Agent _agent;
|
||||
protected Link _link;
|
||||
protected Agent _agent;
|
||||
protected Link _link;
|
||||
|
||||
public WatchTask(final Link link, final Request request, final Agent agent) {
|
||||
super();
|
||||
@ -760,7 +757,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
||||
}
|
||||
|
||||
public class StartupTask extends ManagedContextTimerTask {
|
||||
protected Link _link;
|
||||
protected Link _link;
|
||||
protected volatile boolean cancelled = false;
|
||||
|
||||
public StartupTask(final Link link) {
|
||||
@ -788,16 +785,16 @@ public class Agent implements HandlerFactory, IAgentControl {
|
||||
}
|
||||
cancelled = true;
|
||||
_startup = null;
|
||||
_startupWait = _startupWaitDefault *2;
|
||||
_startupWait = _startupWaitDefault * 2;
|
||||
reconnect(_link);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class AgentRequestHandler extends Task {
|
||||
public AgentRequestHandler(Task.Type type, Link link, Request req) {
|
||||
super(type, link, req);
|
||||
}
|
||||
public AgentRequestHandler(Task.Type type, Link link, Request req) {
|
||||
super(type, link, req);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doTask(Task task) throws Exception {
|
||||
@ -829,7 +826,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
||||
request = Request.parse(task.getData());
|
||||
if (request instanceof Response) {
|
||||
//It's for pinganswer etc, should be processed immediately.
|
||||
processResponse((Response) request, task.getLink());
|
||||
processResponse((Response)request, task.getLink());
|
||||
} else {
|
||||
//put the requests from mgt server into another thread pool, as the request may take a longer time to finish. Don't block the NIO main thread pool
|
||||
//processRequest(request, task.getLink());
|
||||
|
||||
@ -55,8 +55,7 @@ import com.cloud.utils.backoff.impl.ConstantTimeBackoff;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
public class AgentShell implements IAgentShell, Daemon {
|
||||
private static final Logger s_logger = Logger.getLogger(AgentShell.class
|
||||
.getName());
|
||||
private static final Logger s_logger = Logger.getLogger(AgentShell.class.getName());
|
||||
|
||||
private final Properties _properties = new Properties();
|
||||
private final Map<String, Object> _cmdLineProperties = new HashMap<String, Object>();
|
||||
@ -76,7 +75,6 @@ public class AgentShell implements IAgentShell, Daemon {
|
||||
private int _pingRetries;
|
||||
private final List<Agent> _agents = new ArrayList<Agent>();
|
||||
|
||||
|
||||
public AgentShell() {
|
||||
}
|
||||
|
||||
@ -180,18 +178,15 @@ public class AgentShell implements IAgentShell, Daemon {
|
||||
propertiesStream = new FileInputStream(file);
|
||||
_properties.load(propertiesStream);
|
||||
} catch (final FileNotFoundException ex) {
|
||||
throw new CloudRuntimeException("Cannot find the file: "
|
||||
+ file.getAbsolutePath(), ex);
|
||||
throw new CloudRuntimeException("Cannot find the file: " + file.getAbsolutePath(), ex);
|
||||
} catch (final IOException ex) {
|
||||
throw new CloudRuntimeException("IOException in reading "
|
||||
+ file.getAbsolutePath(), ex);
|
||||
throw new CloudRuntimeException("IOException in reading " + file.getAbsolutePath(), ex);
|
||||
} finally {
|
||||
IOUtils.closeQuietly(propertiesStream);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean parseCommand(final String[] args)
|
||||
throws ConfigurationException {
|
||||
protected boolean parseCommand(final String[] args) throws ConfigurationException {
|
||||
String host = null;
|
||||
String workers = null;
|
||||
String port = null;
|
||||
@ -233,8 +228,7 @@ public class AgentShell implements IAgentShell, Daemon {
|
||||
|
||||
_port = NumberUtils.toInt(port, 8250);
|
||||
|
||||
_proxyPort = NumberUtils.toInt(
|
||||
getProperty(null, "consoleproxy.httpListenPort"), 443);
|
||||
_proxyPort = NumberUtils.toInt(getProperty(null, "consoleproxy.httpListenPort"), 443);
|
||||
|
||||
if (workers == null) {
|
||||
workers = getProperty(null, "workers");
|
||||
@ -268,8 +262,7 @@ public class AgentShell implements IAgentShell, Daemon {
|
||||
}
|
||||
|
||||
if (_host == null || (_host.startsWith("@") && _host.endsWith("@"))) {
|
||||
throw new ConfigurationException(
|
||||
"Host is not configured correctly: " + _host);
|
||||
throw new ConfigurationException("Host is not configured correctly: " + _host);
|
||||
}
|
||||
|
||||
final String retries = getProperty(null, "ping.retries");
|
||||
@ -292,7 +285,7 @@ public class AgentShell implements IAgentShell, Daemon {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void init(DaemonContext dc) throws DaemonInitException {
|
||||
s_logger.debug("Initializing AgentShell from JSVC");
|
||||
@ -302,26 +295,25 @@ public class AgentShell implements IAgentShell, Daemon {
|
||||
throw new DaemonInitException("Initialization failed", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void init(String[] args) throws ConfigurationException {
|
||||
|
||||
// PropertiesUtil is used both in management server and agent packages,
|
||||
// it searches path under class path and common J2EE containers
|
||||
// For KVM agent, do it specially here
|
||||
|
||||
File file = new File("/etc/cloudstack/agent/log4j-cloud.xml");
|
||||
if(!file.exists()) {
|
||||
file = PropertiesUtil.findConfigFile("log4j-cloud.xml");
|
||||
}
|
||||
DOMConfigurator.configureAndWatch(file.getAbsolutePath());
|
||||
// PropertiesUtil is used both in management server and agent packages,
|
||||
// it searches path under class path and common J2EE containers
|
||||
// For KVM agent, do it specially here
|
||||
|
||||
File file = new File("/etc/cloudstack/agent/log4j-cloud.xml");
|
||||
if (!file.exists()) {
|
||||
file = PropertiesUtil.findConfigFile("log4j-cloud.xml");
|
||||
}
|
||||
DOMConfigurator.configureAndWatch(file.getAbsolutePath());
|
||||
|
||||
s_logger.info("Agent started");
|
||||
|
||||
s_logger.info("Agent started");
|
||||
|
||||
final Class<?> c = this.getClass();
|
||||
_version = c.getPackage().getImplementationVersion();
|
||||
if (_version == null) {
|
||||
throw new CloudRuntimeException(
|
||||
"Unable to find the implementation version of this agent");
|
||||
throw new CloudRuntimeException("Unable to find the implementation version of this agent");
|
||||
}
|
||||
s_logger.info("Implementation Version is " + _version);
|
||||
|
||||
@ -330,19 +322,18 @@ public class AgentShell implements IAgentShell, Daemon {
|
||||
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
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.info("Defaulting to using properties file for storage");
|
||||
_storage = new PropertiesStorage();
|
||||
_storage.configure("Storage", new HashMap<String, Object>());
|
||||
|
||||
// merge with properties from command line to let resource access
|
||||
// command line parameters
|
||||
for (Map.Entry<String, Object> cmdLineProp : getCmdLineProperties()
|
||||
.entrySet()) {
|
||||
for (Map.Entry<String, Object> cmdLineProp : getCmdLineProperties().entrySet()) {
|
||||
_properties.put(cmdLineProp.getKey(), cmdLineProp.getValue());
|
||||
}
|
||||
|
||||
@ -362,46 +353,30 @@ public class AgentShell implements IAgentShell, Daemon {
|
||||
launchAgentFromTypeInfo();
|
||||
}
|
||||
|
||||
private void launchAgentFromClassInfo(String resourceClassNames)
|
||||
throws ConfigurationException {
|
||||
private void launchAgentFromClassInfo(String resourceClassNames) throws ConfigurationException {
|
||||
String[] names = resourceClassNames.split("\\|");
|
||||
for (String name : names) {
|
||||
Class<?> impl;
|
||||
try {
|
||||
impl = Class.forName(name);
|
||||
final Constructor<?> constructor = impl
|
||||
.getDeclaredConstructor();
|
||||
final Constructor<?> constructor = impl.getDeclaredConstructor();
|
||||
constructor.setAccessible(true);
|
||||
ServerResource resource = (ServerResource) constructor
|
||||
.newInstance();
|
||||
ServerResource resource = (ServerResource)constructor.newInstance();
|
||||
launchAgent(getNextAgentId(), resource);
|
||||
} catch (final ClassNotFoundException e) {
|
||||
throw new ConfigurationException("Resource class not found: "
|
||||
+ name + " due to: " + e.toString());
|
||||
throw new ConfigurationException("Resource class not found: " + name + " due to: " + e.toString());
|
||||
} catch (final SecurityException e) {
|
||||
throw new ConfigurationException(
|
||||
"Security excetion when loading resource: " + name
|
||||
+ " due to: " + e.toString());
|
||||
throw new ConfigurationException("Security excetion when loading resource: " + name + " due to: " + e.toString());
|
||||
} catch (final NoSuchMethodException e) {
|
||||
throw new ConfigurationException(
|
||||
"Method not found excetion when loading resource: "
|
||||
+ name + " due to: " + e.toString());
|
||||
throw new ConfigurationException("Method not found excetion when loading resource: " + name + " due to: " + e.toString());
|
||||
} catch (final IllegalArgumentException e) {
|
||||
throw new ConfigurationException(
|
||||
"Illegal argument excetion when loading resource: "
|
||||
+ name + " due to: " + e.toString());
|
||||
throw new ConfigurationException("Illegal argument excetion when loading resource: " + name + " due to: " + e.toString());
|
||||
} catch (final InstantiationException e) {
|
||||
throw new ConfigurationException(
|
||||
"Instantiation excetion when loading resource: " + name
|
||||
+ " due to: " + e.toString());
|
||||
throw new ConfigurationException("Instantiation excetion when loading resource: " + name + " due to: " + e.toString());
|
||||
} catch (final IllegalAccessException e) {
|
||||
throw new ConfigurationException(
|
||||
"Illegal access exception when loading resource: "
|
||||
+ name + " due to: " + e.toString());
|
||||
throw new ConfigurationException("Illegal access exception when loading resource: " + name + " due to: " + e.toString());
|
||||
} catch (final InvocationTargetException e) {
|
||||
throw new ConfigurationException(
|
||||
"Invocation target exception when loading resource: "
|
||||
+ name + " due to: " + e.toString());
|
||||
throw new ConfigurationException("Invocation target exception when loading resource: " + name + " due to: " + e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -410,14 +385,12 @@ public class AgentShell implements IAgentShell, Daemon {
|
||||
String typeInfo = getProperty(null, "type");
|
||||
if (typeInfo == null) {
|
||||
s_logger.error("Unable to retrieve the type");
|
||||
throw new ConfigurationException(
|
||||
"Unable to retrieve the type of this agent.");
|
||||
throw new ConfigurationException("Unable to retrieve the type of this agent.");
|
||||
}
|
||||
s_logger.trace("Launching agent based on type=" + typeInfo);
|
||||
}
|
||||
|
||||
private void launchAgent(int localAgentId, ServerResource resource)
|
||||
throws ConfigurationException {
|
||||
private void launchAgent(int localAgentId, ServerResource resource) throws ConfigurationException {
|
||||
// we don't track agent after it is launched for now
|
||||
Agent agent = new Agent(this, localAgentId, resource);
|
||||
_agents.add(agent);
|
||||
|
||||
@ -37,10 +37,9 @@ import com.cloud.utils.PropertiesUtil;
|
||||
* @config {@table || Param Name | Description | Values | Default || || path |
|
||||
* path to the properties _file | String | db/db.properties || * }
|
||||
**/
|
||||
@Local(value = { StorageComponent.class })
|
||||
@Local(value = {StorageComponent.class})
|
||||
public class PropertiesStorage implements StorageComponent {
|
||||
private static final Logger s_logger = Logger
|
||||
.getLogger(PropertiesStorage.class);
|
||||
private static final Logger s_logger = Logger.getLogger(PropertiesStorage.class);
|
||||
Properties _properties = new Properties();
|
||||
File _file;
|
||||
String _name;
|
||||
@ -69,7 +68,7 @@ public class PropertiesStorage implements StorageComponent {
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params) {
|
||||
_name = name;
|
||||
String path = (String) params.get("path");
|
||||
String path = (String)params.get("path");
|
||||
if (path == null) {
|
||||
path = "agent.properties";
|
||||
}
|
||||
@ -79,13 +78,11 @@ public class PropertiesStorage implements StorageComponent {
|
||||
file = new File(path);
|
||||
try {
|
||||
if (!file.createNewFile()) {
|
||||
s_logger.error("Unable to create _file: "
|
||||
+ file.getAbsolutePath());
|
||||
s_logger.error("Unable to create _file: " + file.getAbsolutePath());
|
||||
return false;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
s_logger.error(
|
||||
"Unable to create _file: " + file.getAbsolutePath(), e);
|
||||
s_logger.error("Unable to create _file: " + file.getAbsolutePath(), e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,25 +31,21 @@ import org.apache.log4j.Logger;
|
||||
import com.cloud.utils.concurrency.NamedThreadFactory;
|
||||
|
||||
public class DhcpProtocolParserServer extends Thread {
|
||||
private static final Logger s_logger = Logger
|
||||
.getLogger(DhcpProtocolParserServer.class);;
|
||||
private static final Logger s_logger = Logger.getLogger(DhcpProtocolParserServer.class);;
|
||||
protected ExecutorService _executor;
|
||||
private int dhcpServerPort = 67;
|
||||
private int bufferSize = 300;
|
||||
protected boolean _running = false;
|
||||
|
||||
public DhcpProtocolParserServer(int workers) {
|
||||
_executor = new ThreadPoolExecutor(workers, 10 * workers, 1,
|
||||
TimeUnit.DAYS, new LinkedBlockingQueue<Runnable>(),
|
||||
new NamedThreadFactory("DhcpListener"));
|
||||
_executor = new ThreadPoolExecutor(workers, 10 * workers, 1, TimeUnit.DAYS, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory("DhcpListener"));
|
||||
_running = true;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
while (_running) {
|
||||
try {
|
||||
DatagramSocket dhcpSocket = new DatagramSocket(dhcpServerPort,
|
||||
InetAddress.getByAddress(new byte[] { 0, 0, 0, 0 }));
|
||||
DatagramSocket dhcpSocket = new DatagramSocket(dhcpServerPort, InetAddress.getByAddress(new byte[] {0, 0, 0, 0}));
|
||||
dhcpSocket.setBroadcast(true);
|
||||
|
||||
while (true) {
|
||||
|
||||
@ -32,18 +32,16 @@ import org.apache.log4j.Logger;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
|
||||
@Local(value = { DhcpSnooper.class })
|
||||
@Local(value = {DhcpSnooper.class})
|
||||
public class FakeDhcpSnooper implements DhcpSnooper {
|
||||
private static final Logger s_logger = Logger
|
||||
.getLogger(FakeDhcpSnooper.class);
|
||||
private static final Logger s_logger = Logger.getLogger(FakeDhcpSnooper.class);
|
||||
private Queue<String> _ipAddresses = new ConcurrentLinkedQueue<String>();
|
||||
private Map<String, String> _macIpMap = new ConcurrentHashMap<String, String>();
|
||||
private Map<String, InetAddress> _vmIpMap = new ConcurrentHashMap<String, InetAddress>();
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params)
|
||||
throws ConfigurationException {
|
||||
String guestIpRange = (String) params.get("guest.ip.range");
|
||||
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
||||
String guestIpRange = (String)params.get("guest.ip.range");
|
||||
if (guestIpRange != null) {
|
||||
String[] guestIps = guestIpRange.split("-");
|
||||
if (guestIps.length == 2) {
|
||||
@ -78,8 +76,7 @@ public class FakeDhcpSnooper implements DhcpSnooper {
|
||||
InetAddress inetAddr = InetAddress.getByName(ipAddr);
|
||||
_macIpMap.put(macAddr.toLowerCase(), ipAddr);
|
||||
_vmIpMap.put(vmName, inetAddr);
|
||||
s_logger.info("Got ip address " + ipAddr + " for vm " + vmName
|
||||
+ " mac=" + macAddr.toLowerCase());
|
||||
s_logger.info("Got ip address " + ipAddr + " for vm " + vmName + " mac=" + macAddr.toLowerCase());
|
||||
return inetAddr;
|
||||
} catch (UnknownHostException e) {
|
||||
s_logger.warn("Failed to get InetAddress for " + ipAddr);
|
||||
@ -103,8 +100,7 @@ public class FakeDhcpSnooper implements DhcpSnooper {
|
||||
}
|
||||
ipAddr = _macIpMap.remove(macAddr);
|
||||
|
||||
s_logger.info("Cleaning up for mac address: " + macAddr + " ip="
|
||||
+ ipAddr + " inetAddr=" + inetAddr);
|
||||
s_logger.info("Cleaning up for mac address: " + macAddr + " ip=" + ipAddr + " inetAddr=" + inetAddr);
|
||||
if (ipAddr != null) {
|
||||
_ipAddresses.offer(ipAddr);
|
||||
}
|
||||
@ -134,34 +130,34 @@ public class FakeDhcpSnooper implements DhcpSnooper {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
@Override
|
||||
public void setConfigParams(Map<String, Object> params) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getConfigParams() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public void setConfigParams(Map<String, Object> params) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
@Override
|
||||
public int getRunLevel() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRunLevel(int level) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
@Override
|
||||
public Map<String, Object> getConfigParams() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRunLevel() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRunLevel(int level) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -28,13 +28,12 @@ public class MockVm {
|
||||
private int cpuCount;
|
||||
private int utilization; // in percentage
|
||||
private int vncPort; // 0-based allocation, real port number needs to be
|
||||
// applied with base
|
||||
// applied with base
|
||||
|
||||
public MockVm() {
|
||||
}
|
||||
|
||||
public MockVm(String vmName, State state, long ramSize, int cpuCount,
|
||||
int utilization, int vncPort) {
|
||||
public MockVm(String vmName, State state, long ramSize, int cpuCount, int utilization, int vncPort) {
|
||||
this.vmName = vmName;
|
||||
this.state = state;
|
||||
this.ramSize = ramSize;
|
||||
|
||||
@ -53,22 +53,15 @@ public class MockVmMgr implements VmMgr {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String startVM(String vmName, String vnetId, String gateway,
|
||||
String dns, String privateIP, String privateMac,
|
||||
String privateMask, String publicIP, String publicMac,
|
||||
String publicMask, int cpuCount, int cpuUtilization, long ramSize,
|
||||
String localPath, String vncPassword) {
|
||||
public String startVM(String vmName, String vnetId, String gateway, String dns, String privateIP, String privateMac, String privateMask, String publicIP, String publicMac,
|
||||
String publicMask, int cpuCount, int cpuUtilization, long ramSize, String localPath, String vncPassword) {
|
||||
|
||||
if (s_logger.isInfoEnabled()) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("Start VM. name: " + vmName + ", vnet: " + vnetId
|
||||
+ ", dns: " + dns);
|
||||
sb.append(", privateIP: " + privateIP + ", privateMac: "
|
||||
+ privateMac + ", privateMask: " + privateMask);
|
||||
sb.append(", publicIP: " + publicIP + ", publicMac: " + publicMac
|
||||
+ ", publicMask: " + publicMask);
|
||||
sb.append(", cpu count: " + cpuCount + ", cpuUtilization: "
|
||||
+ cpuUtilization + ", ram : " + ramSize);
|
||||
sb.append("Start VM. name: " + vmName + ", vnet: " + vnetId + ", dns: " + dns);
|
||||
sb.append(", privateIP: " + privateIP + ", privateMac: " + privateMac + ", privateMask: " + privateMask);
|
||||
sb.append(", publicIP: " + publicIP + ", publicMac: " + publicMac + ", publicMask: " + publicMask);
|
||||
sb.append(", cpu count: " + cpuCount + ", cpuUtilization: " + cpuUtilization + ", ram : " + ramSize);
|
||||
sb.append(", localPath: " + localPath);
|
||||
s_logger.info(sb.toString());
|
||||
}
|
||||
@ -83,8 +76,7 @@ public class MockVmMgr implements VmMgr {
|
||||
if (vncPort < 0)
|
||||
return "Unable to allocate VNC port";
|
||||
|
||||
vm = new MockVm(vmName, State.Running, ramSize, cpuCount,
|
||||
cpuUtilization, vncPort);
|
||||
vm = new MockVm(vmName, State.Running, ramSize, cpuCount, cpuUtilization, vncPort);
|
||||
vms.put(vmName, vm);
|
||||
}
|
||||
}
|
||||
@ -272,12 +264,10 @@ public class MockVmMgr implements VmMgr {
|
||||
int vncPort = allocVncPort();
|
||||
if (vncPort < 0) {
|
||||
s_logger.debug("Unable to allocate VNC port");
|
||||
throw new CloudRuntimeException(
|
||||
"Unable to allocate vnc port");
|
||||
throw new CloudRuntimeException("Unable to allocate vnc port");
|
||||
}
|
||||
|
||||
vm = new MockVm(vmName, State.Running, ramSize,
|
||||
vmSpec.getCpus(), utilizationPercent, vncPort);
|
||||
vm = new MockVm(vmName, State.Running, ramSize, vmSpec.getCpus(), utilizationPercent, vncPort);
|
||||
vms.put(vmName, vm);
|
||||
}
|
||||
}
|
||||
@ -302,7 +292,7 @@ public class MockVmMgr implements VmMgr {
|
||||
}
|
||||
|
||||
protected Long getConfiguredProperty(String key, Long defaultValue) {
|
||||
String val = (String) _params.get(key);
|
||||
String val = (String)_params.get(key);
|
||||
|
||||
if (val != null) {
|
||||
Long result = Long.parseLong(val);
|
||||
@ -312,7 +302,7 @@ public class MockVmMgr implements VmMgr {
|
||||
}
|
||||
|
||||
protected Integer getConfiguredProperty(String key, Integer defaultValue) {
|
||||
String val = (String) _params.get(key);
|
||||
String val = (String)_params.get(key);
|
||||
|
||||
if (val != null) {
|
||||
Integer result = Integer.parseInt(val);
|
||||
|
||||
@ -25,11 +25,8 @@ import com.cloud.vm.VirtualMachine.State;
|
||||
public interface VmMgr {
|
||||
public Set<String> getCurrentVMs();
|
||||
|
||||
public String startVM(String vmName, String vnetId, String gateway,
|
||||
String dns, String privateIP, String privateMac,
|
||||
String privateMask, String publicIP, String publicMac,
|
||||
String publicMask, int cpuCount, int cpuUtilization, long ramSize,
|
||||
String localPath, String vncPassword);
|
||||
public String startVM(String vmName, String vnetId, String gateway, String dns, String privateIP, String privateMac, String privateMask, String publicIP, String publicMac,
|
||||
String publicMask, int cpuCount, int cpuUtilization, long ramSize, String localPath, String vncPassword);
|
||||
|
||||
public String stopVM(String vmName, boolean force);
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ import com.cloud.resource.ServerResource;
|
||||
import com.cloud.storage.Storage;
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
|
||||
@Local(value = { ServerResource.class })
|
||||
@Local(value = {ServerResource.class})
|
||||
public class DummyResource implements ServerResource {
|
||||
String _name;
|
||||
Host.Type _type;
|
||||
@ -58,7 +58,7 @@ public class DummyResource implements ServerResource {
|
||||
@Override
|
||||
public Answer executeRequest(Command cmd) {
|
||||
if (cmd instanceof CheckNetworkCommand) {
|
||||
return new CheckNetworkAnswer((CheckNetworkCommand) cmd, true, null);
|
||||
return new CheckNetworkAnswer((CheckNetworkCommand)cmd, true, null);
|
||||
}
|
||||
System.out.println("Received Command: " + cmd.toString());
|
||||
Answer answer = new Answer(cmd, !_negative, "response");
|
||||
@ -77,12 +77,12 @@ public class DummyResource implements ServerResource {
|
||||
}
|
||||
|
||||
protected String getConfiguredProperty(String key, String defaultValue) {
|
||||
String val = (String) _params.get(key);
|
||||
String val = (String)_params.get(key);
|
||||
return val == null ? defaultValue : val;
|
||||
}
|
||||
|
||||
protected Long getConfiguredProperty(String key, Long defaultValue) {
|
||||
String val = (String) _params.get(key);
|
||||
String val = (String)_params.get(key);
|
||||
|
||||
if (val != null) {
|
||||
Long result = Long.parseLong(val);
|
||||
@ -99,7 +99,7 @@ public class DummyResource implements ServerResource {
|
||||
long dom0ram = Math.min(ram / 10, 768 * 1024 * 1024L);
|
||||
|
||||
String cap = getConfiguredProperty("capabilities", "hvm");
|
||||
info.add((int) cpus);
|
||||
info.add((int)cpus);
|
||||
info.add(speed);
|
||||
info.add(ram);
|
||||
info.add(cap);
|
||||
@ -110,53 +110,38 @@ public class DummyResource implements ServerResource {
|
||||
|
||||
protected void fillNetworkInformation(final StartupCommand cmd) {
|
||||
|
||||
cmd.setPrivateIpAddress((String) getConfiguredProperty(
|
||||
"private.ip.address", "127.0.0.1"));
|
||||
cmd.setPrivateMacAddress((String) getConfiguredProperty(
|
||||
"private.mac.address", "8A:D2:54:3F:7C:C3"));
|
||||
cmd.setPrivateNetmask((String) getConfiguredProperty(
|
||||
"private.ip.netmask", "255.255.255.0"));
|
||||
cmd.setPrivateIpAddress((String)getConfiguredProperty("private.ip.address", "127.0.0.1"));
|
||||
cmd.setPrivateMacAddress((String)getConfiguredProperty("private.mac.address", "8A:D2:54:3F:7C:C3"));
|
||||
cmd.setPrivateNetmask((String)getConfiguredProperty("private.ip.netmask", "255.255.255.0"));
|
||||
|
||||
cmd.setStorageIpAddress((String) getConfiguredProperty(
|
||||
"private.ip.address", "127.0.0.1"));
|
||||
cmd.setStorageMacAddress((String) getConfiguredProperty(
|
||||
"private.mac.address", "8A:D2:54:3F:7C:C3"));
|
||||
cmd.setStorageNetmask((String) getConfiguredProperty(
|
||||
"private.ip.netmask", "255.255.255.0"));
|
||||
cmd.setGatewayIpAddress((String) getConfiguredProperty(
|
||||
"gateway.ip.address", "127.0.0.1"));
|
||||
cmd.setStorageIpAddress((String)getConfiguredProperty("private.ip.address", "127.0.0.1"));
|
||||
cmd.setStorageMacAddress((String)getConfiguredProperty("private.mac.address", "8A:D2:54:3F:7C:C3"));
|
||||
cmd.setStorageNetmask((String)getConfiguredProperty("private.ip.netmask", "255.255.255.0"));
|
||||
cmd.setGatewayIpAddress((String)getConfiguredProperty("gateway.ip.address", "127.0.0.1"));
|
||||
|
||||
}
|
||||
|
||||
private Map<String, String> getVersionStrings() {
|
||||
Map<String, String> result = new HashMap<String, String>();
|
||||
String hostOs = (String) _params.get("Host.OS");
|
||||
String hostOsVer = (String) _params.get("Host.OS.Version");
|
||||
String hostOsKernVer = (String) _params.get("Host.OS.Kernel.Version");
|
||||
String hostOs = (String)_params.get("Host.OS");
|
||||
String hostOsVer = (String)_params.get("Host.OS.Version");
|
||||
String hostOsKernVer = (String)_params.get("Host.OS.Kernel.Version");
|
||||
result.put("Host.OS", hostOs == null ? "Fedora" : hostOs);
|
||||
result.put("Host.OS.Version", hostOsVer == null ? "14" : hostOsVer);
|
||||
result.put("Host.OS.Kernel.Version",
|
||||
hostOsKernVer == null ? "2.6.35.6-45.fc14.x86_64"
|
||||
: hostOsKernVer);
|
||||
result.put("Host.OS.Kernel.Version", hostOsKernVer == null ? "2.6.35.6-45.fc14.x86_64" : hostOsKernVer);
|
||||
return result;
|
||||
}
|
||||
|
||||
protected StoragePoolInfo initializeLocalStorage() {
|
||||
String hostIp = (String) getConfiguredProperty("private.ip.address",
|
||||
"127.0.0.1");
|
||||
String localStoragePath = (String) getConfiguredProperty(
|
||||
"local.storage.path", "/mnt");
|
||||
String hostIp = (String)getConfiguredProperty("private.ip.address", "127.0.0.1");
|
||||
String localStoragePath = (String)getConfiguredProperty("local.storage.path", "/mnt");
|
||||
String lh = hostIp + localStoragePath;
|
||||
String uuid = UUID.nameUUIDFromBytes(lh.getBytes()).toString();
|
||||
|
||||
String capacity = (String) getConfiguredProperty(
|
||||
"local.storage.capacity", "1000000000");
|
||||
String available = (String) getConfiguredProperty(
|
||||
"local.storage.avail", "10000000");
|
||||
String capacity = (String)getConfiguredProperty("local.storage.capacity", "1000000000");
|
||||
String available = (String)getConfiguredProperty("local.storage.avail", "10000000");
|
||||
|
||||
return new StoragePoolInfo(uuid, hostIp, localStoragePath,
|
||||
localStoragePath, StoragePoolType.Filesystem,
|
||||
Long.parseLong(capacity), Long.parseLong(available));
|
||||
return new StoragePoolInfo(uuid, hostIp, localStoragePath, localStoragePath, StoragePoolType.Filesystem, Long.parseLong(capacity), Long.parseLong(available));
|
||||
|
||||
}
|
||||
|
||||
@ -166,10 +151,8 @@ public class DummyResource implements ServerResource {
|
||||
|
||||
final List<Object> info = getHostInfo();
|
||||
|
||||
final StartupRoutingCommand cmd = new StartupRoutingCommand(
|
||||
(Integer) info.get(0), (Long) info.get(1), (Long) info.get(2),
|
||||
(Long) info.get(4), (String) info.get(3), HypervisorType.KVM,
|
||||
RouterPrivateIpStrategy.HostLocal, changes, null);
|
||||
final StartupRoutingCommand cmd = new StartupRoutingCommand((Integer)info.get(0), (Long)info.get(1), (Long)info.get(2), (Long)info.get(4), (String)info.get(3),
|
||||
HypervisorType.KVM, RouterPrivateIpStrategy.HostLocal, changes, null);
|
||||
fillNetworkInformation(cmd);
|
||||
cmd.getHostDetails().putAll(getVersionStrings());
|
||||
cmd.setCluster(getConfiguredProperty("cluster", "1"));
|
||||
@ -177,20 +160,20 @@ public class DummyResource implements ServerResource {
|
||||
StartupStorageCommand sscmd = new StartupStorageCommand();
|
||||
sscmd.setPoolInfo(pi);
|
||||
sscmd.setGuid(pi.getUuid());
|
||||
sscmd.setDataCenter((String) _params.get("zone"));
|
||||
sscmd.setDataCenter((String)_params.get("zone"));
|
||||
sscmd.setResourceType(Storage.StorageResourceType.STORAGE_POOL);
|
||||
|
||||
return new StartupCommand[] { cmd, sscmd };
|
||||
return new StartupCommand[] {cmd, sscmd};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params) {
|
||||
_name = name;
|
||||
|
||||
String value = (String) params.get("type");
|
||||
String value = (String)params.get("type");
|
||||
_type = Host.Type.valueOf(value);
|
||||
|
||||
value = (String) params.get("negative.reply");
|
||||
value = (String)params.get("negative.reply");
|
||||
_negative = Boolean.parseBoolean(value);
|
||||
setParams(params);
|
||||
return true;
|
||||
@ -225,33 +208,33 @@ public class DummyResource implements ServerResource {
|
||||
_agentControl = agentControl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
@Override
|
||||
public void setConfigParams(Map<String, Object> params) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getConfigParams() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public void setConfigParams(Map<String, Object> params) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
@Override
|
||||
public int getRunLevel() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRunLevel(int level) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
@Override
|
||||
public Map<String, Object> getConfigParams() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRunLevel() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRunLevel(int level) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ public class ConsoleProxyAuthenticationResult {
|
||||
private int port;
|
||||
private String tunnelUrl;
|
||||
private String tunnelSession;
|
||||
|
||||
|
||||
public ConsoleProxyAuthenticationResult() {
|
||||
success = false;
|
||||
isReauthentication = false;
|
||||
|
||||
@ -81,8 +81,7 @@ import com.cloud.utils.script.Script;
|
||||
* server.
|
||||
*
|
||||
*/
|
||||
public class ConsoleProxyResource extends ServerResourceBase implements
|
||||
ServerResource {
|
||||
public class ConsoleProxyResource extends ServerResourceBase implements ServerResource {
|
||||
static final Logger s_logger = Logger.getLogger(ConsoleProxyResource.class);
|
||||
|
||||
private final Properties _properties = new Properties();
|
||||
@ -99,31 +98,30 @@ public class ConsoleProxyResource extends ServerResourceBase implements
|
||||
@Override
|
||||
public Answer executeRequest(final Command cmd) {
|
||||
if (cmd instanceof CheckConsoleProxyLoadCommand) {
|
||||
return execute((CheckConsoleProxyLoadCommand) cmd);
|
||||
return execute((CheckConsoleProxyLoadCommand)cmd);
|
||||
} else if (cmd instanceof WatchConsoleProxyLoadCommand) {
|
||||
return execute((WatchConsoleProxyLoadCommand) cmd);
|
||||
return execute((WatchConsoleProxyLoadCommand)cmd);
|
||||
} else if (cmd instanceof ReadyCommand) {
|
||||
s_logger.info("Receive ReadyCommand, response with ReadyAnswer");
|
||||
return new ReadyAnswer((ReadyCommand) cmd);
|
||||
return new ReadyAnswer((ReadyCommand)cmd);
|
||||
} else if (cmd instanceof CheckHealthCommand) {
|
||||
return new CheckHealthAnswer((CheckHealthCommand) cmd, true);
|
||||
return new CheckHealthAnswer((CheckHealthCommand)cmd, true);
|
||||
} else if (cmd instanceof StartConsoleProxyAgentHttpHandlerCommand) {
|
||||
return execute((StartConsoleProxyAgentHttpHandlerCommand) cmd);
|
||||
return execute((StartConsoleProxyAgentHttpHandlerCommand)cmd);
|
||||
} else {
|
||||
return Answer.createUnsupportedCommandAnswer(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
private Answer execute(StartConsoleProxyAgentHttpHandlerCommand cmd) {
|
||||
s_logger.info("Invoke launchConsoleProxy() in responding to StartConsoleProxyAgentHttpHandlerCommand");
|
||||
s_logger.info("Invoke launchConsoleProxy() in responding to StartConsoleProxyAgentHttpHandlerCommand");
|
||||
launchConsoleProxy(cmd.getKeystoreBits(), cmd.getKeystorePassword(), cmd.getEncryptorPassword());
|
||||
return new Answer(cmd);
|
||||
}
|
||||
|
||||
private void disableRpFilter() {
|
||||
try {
|
||||
FileWriter fstream = new FileWriter(
|
||||
"/proc/sys/net/ipv4/conf/eth2/rp_filter");
|
||||
FileWriter fstream = new FileWriter("/proc/sys/net/ipv4/conf/eth2/rp_filter");
|
||||
BufferedWriter out = new BufferedWriter(fstream);
|
||||
out.write("0");
|
||||
out.close();
|
||||
@ -133,25 +131,18 @@ public class ConsoleProxyResource extends ServerResourceBase implements
|
||||
}
|
||||
|
||||
protected Answer execute(final CheckConsoleProxyLoadCommand cmd) {
|
||||
return executeProxyLoadScan(cmd, cmd.getProxyVmId(),
|
||||
cmd.getProxyVmName(), cmd.getProxyManagementIp(),
|
||||
cmd.getProxyCmdPort());
|
||||
return executeProxyLoadScan(cmd, cmd.getProxyVmId(), cmd.getProxyVmName(), cmd.getProxyManagementIp(), cmd.getProxyCmdPort());
|
||||
}
|
||||
|
||||
protected Answer execute(final WatchConsoleProxyLoadCommand cmd) {
|
||||
return executeProxyLoadScan(cmd, cmd.getProxyVmId(),
|
||||
cmd.getProxyVmName(), cmd.getProxyManagementIp(),
|
||||
cmd.getProxyCmdPort());
|
||||
return executeProxyLoadScan(cmd, cmd.getProxyVmId(), cmd.getProxyVmName(), cmd.getProxyManagementIp(), cmd.getProxyCmdPort());
|
||||
}
|
||||
|
||||
private Answer executeProxyLoadScan(final Command cmd,
|
||||
final long proxyVmId, final String proxyVmName,
|
||||
final String proxyManagementIp, final int cmdPort) {
|
||||
private Answer executeProxyLoadScan(final Command cmd, final long proxyVmId, final String proxyVmName, final String proxyManagementIp, final int cmdPort) {
|
||||
String result = null;
|
||||
|
||||
final StringBuffer sb = new StringBuffer();
|
||||
sb.append("http://").append(proxyManagementIp).append(":" + cmdPort)
|
||||
.append("/cmd/getstatus");
|
||||
sb.append("http://").append(proxyManagementIp).append(":" + cmdPort).append("/cmd/getstatus");
|
||||
|
||||
boolean success = true;
|
||||
try {
|
||||
@ -159,8 +150,7 @@ public class ConsoleProxyResource extends ServerResourceBase implements
|
||||
final URLConnection conn = url.openConnection();
|
||||
|
||||
final InputStream is = conn.getInputStream();
|
||||
final BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(is));
|
||||
final BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
||||
final StringBuilder sb2 = new StringBuilder();
|
||||
String line = null;
|
||||
try {
|
||||
@ -173,19 +163,16 @@ public class ConsoleProxyResource extends ServerResourceBase implements
|
||||
try {
|
||||
is.close();
|
||||
} catch (final IOException e) {
|
||||
s_logger.warn("Exception when closing , console proxy address : "
|
||||
+ proxyManagementIp);
|
||||
s_logger.warn("Exception when closing , console proxy address : " + proxyManagementIp);
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
} catch (final IOException e) {
|
||||
s_logger.warn("Unable to open console proxy command port url, console proxy address : "
|
||||
+ proxyManagementIp);
|
||||
s_logger.warn("Unable to open console proxy command port url, console proxy address : " + proxyManagementIp);
|
||||
success = false;
|
||||
}
|
||||
|
||||
return new ConsoleProxyLoadAnswer(cmd, proxyVmId, proxyVmName, success,
|
||||
result);
|
||||
return new ConsoleProxyLoadAnswer(cmd, proxyVmId, proxyVmName, success, result);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -206,7 +193,7 @@ public class ConsoleProxyResource extends ServerResourceBase implements
|
||||
cmd.setProxyVmId(_proxyVmId);
|
||||
if (_pubIp != null)
|
||||
cmd.setPublicIpAddress(_pubIp);
|
||||
return new StartupCommand[] { cmd };
|
||||
return new StartupCommand[] {cmd};
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -219,18 +206,17 @@ public class ConsoleProxyResource extends ServerResourceBase implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params)
|
||||
throws ConfigurationException {
|
||||
_localgw = (String) params.get("localgw");
|
||||
_eth1mask = (String) params.get("eth1mask");
|
||||
_eth1ip = (String) params.get("eth1ip");
|
||||
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
||||
_localgw = (String)params.get("localgw");
|
||||
_eth1mask = (String)params.get("eth1mask");
|
||||
_eth1ip = (String)params.get("eth1ip");
|
||||
if (_eth1ip != null) {
|
||||
params.put("private.network.device", "eth1");
|
||||
} else {
|
||||
s_logger.info("eth1ip parameter has not been configured, assuming that we are not inside a system vm");
|
||||
}
|
||||
|
||||
String eth2ip = (String) params.get("eth2ip");
|
||||
String eth2ip = (String)params.get("eth2ip");
|
||||
if (eth2ip != null) {
|
||||
params.put("public.network.device", "eth2");
|
||||
} else {
|
||||
@ -243,84 +229,69 @@ public class ConsoleProxyResource extends ServerResourceBase implements
|
||||
_properties.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
String value = (String) params.get("premium");
|
||||
String value = (String)params.get("premium");
|
||||
if (value != null && value.equals("premium"))
|
||||
_proxyPort = 443;
|
||||
else {
|
||||
value = (String) params.get("consoleproxy.httpListenPort");
|
||||
value = (String)params.get("consoleproxy.httpListenPort");
|
||||
_proxyPort = NumbersUtil.parseInt(value, 80);
|
||||
}
|
||||
|
||||
value = (String) params.get("proxy_vm");
|
||||
value = (String)params.get("proxy_vm");
|
||||
_proxyVmId = NumbersUtil.parseLong(value, 0);
|
||||
|
||||
if (_localgw != null) {
|
||||
String mgmtHost = (String) params.get("host");
|
||||
String mgmtHost = (String)params.get("host");
|
||||
addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, mgmtHost);
|
||||
|
||||
String internalDns1 = (String) params.get("internaldns1");
|
||||
String internalDns1 = (String)params.get("internaldns1");
|
||||
if (internalDns1 == null) {
|
||||
s_logger.warn("No DNS entry found during configuration of NfsSecondaryStorage");
|
||||
} else {
|
||||
addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask,
|
||||
internalDns1);
|
||||
addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, internalDns1);
|
||||
}
|
||||
|
||||
String internalDns2 = (String) params.get("internaldns2");
|
||||
String internalDns2 = (String)params.get("internaldns2");
|
||||
if (internalDns2 != null) {
|
||||
addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask,
|
||||
internalDns2);
|
||||
addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, internalDns2);
|
||||
}
|
||||
}
|
||||
|
||||
_pubIp = (String) params.get("public.ip");
|
||||
_pubIp = (String)params.get("public.ip");
|
||||
|
||||
value = (String) params.get("disable_rp_filter");
|
||||
value = (String)params.get("disable_rp_filter");
|
||||
if (value != null && value.equalsIgnoreCase("true")) {
|
||||
disableRpFilter();
|
||||
}
|
||||
|
||||
if (s_logger.isInfoEnabled())
|
||||
s_logger.info("Receive proxyVmId in ConsoleProxyResource configuration as "
|
||||
+ _proxyVmId);
|
||||
s_logger.info("Receive proxyVmId in ConsoleProxyResource configuration as " + _proxyVmId);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void addRouteToInternalIpOrCidr(String localgw, String eth1ip,
|
||||
String eth1mask, String destIpOrCidr) {
|
||||
s_logger.debug("addRouteToInternalIp: localgw=" + localgw + ", eth1ip="
|
||||
+ eth1ip + ", eth1mask=" + eth1mask + ",destIp=" + destIpOrCidr);
|
||||
private void addRouteToInternalIpOrCidr(String localgw, String eth1ip, String eth1mask, String destIpOrCidr) {
|
||||
s_logger.debug("addRouteToInternalIp: localgw=" + localgw + ", eth1ip=" + eth1ip + ", eth1mask=" + eth1mask + ",destIp=" + destIpOrCidr);
|
||||
if (destIpOrCidr == null) {
|
||||
s_logger.debug("addRouteToInternalIp: destIp is null");
|
||||
return;
|
||||
}
|
||||
if (!NetUtils.isValidIp(destIpOrCidr)
|
||||
&& !NetUtils.isValidCIDR(destIpOrCidr)) {
|
||||
s_logger.warn(" destIp is not a valid ip address or cidr destIp="
|
||||
+ destIpOrCidr);
|
||||
if (!NetUtils.isValidIp(destIpOrCidr) && !NetUtils.isValidCIDR(destIpOrCidr)) {
|
||||
s_logger.warn(" destIp is not a valid ip address or cidr destIp=" + destIpOrCidr);
|
||||
return;
|
||||
}
|
||||
boolean inSameSubnet = false;
|
||||
if (NetUtils.isValidIp(destIpOrCidr)) {
|
||||
if (eth1ip != null && eth1mask != null) {
|
||||
inSameSubnet = NetUtils.sameSubnet(eth1ip, destIpOrCidr,
|
||||
eth1mask);
|
||||
inSameSubnet = NetUtils.sameSubnet(eth1ip, destIpOrCidr, eth1mask);
|
||||
} else {
|
||||
s_logger.warn("addRouteToInternalIp: unable to determine same subnet: _eth1ip="
|
||||
+ eth1ip
|
||||
+ ", dest ip="
|
||||
+ destIpOrCidr
|
||||
+ ", _eth1mask="
|
||||
+ eth1mask);
|
||||
s_logger.warn("addRouteToInternalIp: unable to determine same subnet: _eth1ip=" + eth1ip + ", dest ip=" + destIpOrCidr + ", _eth1mask=" + eth1mask);
|
||||
}
|
||||
} else {
|
||||
inSameSubnet = NetUtils.isNetworkAWithinNetworkB(destIpOrCidr,
|
||||
NetUtils.ipAndNetMaskToCidr(eth1ip, eth1mask));
|
||||
inSameSubnet = NetUtils.isNetworkAWithinNetworkB(destIpOrCidr, NetUtils.ipAndNetMaskToCidr(eth1ip, eth1mask));
|
||||
}
|
||||
if (inSameSubnet) {
|
||||
s_logger.debug("addRouteToInternalIp: dest ip " + destIpOrCidr
|
||||
+ " is in the same subnet as eth1 ip " + eth1ip);
|
||||
s_logger.debug("addRouteToInternalIp: dest ip " + destIpOrCidr + " is in the same subnet as eth1 ip " + eth1ip);
|
||||
return;
|
||||
}
|
||||
Script command = new Script("/bin/bash", s_logger);
|
||||
@ -332,11 +303,9 @@ public class ConsoleProxyResource extends ServerResourceBase implements
|
||||
command.add("ip route add " + destIpOrCidr + " via " + localgw);
|
||||
String result = command.execute();
|
||||
if (result != null) {
|
||||
s_logger.warn("Error in configuring route to internal ip err="
|
||||
+ result);
|
||||
s_logger.warn("Error in configuring route to internal ip err=" + result);
|
||||
} else {
|
||||
s_logger.debug("addRouteToInternalIp: added route to internal ip="
|
||||
+ destIpOrCidr + " via " + localgw);
|
||||
s_logger.debug("addRouteToInternalIp: added route to internal ip=" + destIpOrCidr + " via " + localgw);
|
||||
}
|
||||
}
|
||||
|
||||
@ -354,17 +323,13 @@ public class ConsoleProxyResource extends ServerResourceBase implements
|
||||
try {
|
||||
Class<?> consoleProxyClazz = Class.forName("com.cloud.consoleproxy.ConsoleProxy");
|
||||
try {
|
||||
s_logger.info("Invoke setEncryptorPassword(), ecnryptorPassword: " + encryptorPassword);
|
||||
Method methodSetup = consoleProxyClazz.getMethod(
|
||||
"setEncryptorPassword", String.class);
|
||||
s_logger.info("Invoke setEncryptorPassword(), ecnryptorPassword: " + encryptorPassword);
|
||||
Method methodSetup = consoleProxyClazz.getMethod("setEncryptorPassword", String.class);
|
||||
methodSetup.invoke(null, encryptorPassword);
|
||||
|
||||
s_logger.info("Invoke startWithContext()");
|
||||
Method method = consoleProxyClazz.getMethod(
|
||||
"startWithContext", Properties.class,
|
||||
Object.class, byte[].class, String.class);
|
||||
method.invoke(null, _properties, resource, ksBits,
|
||||
ksPassword);
|
||||
|
||||
s_logger.info("Invoke startWithContext()");
|
||||
Method method = consoleProxyClazz.getMethod("startWithContext", Properties.class, Object.class, byte[].class, String.class);
|
||||
method.invoke(null, _properties, resource, ksBits, ksPassword);
|
||||
} catch (SecurityException e) {
|
||||
s_logger.error("Unable to launch console proxy due to SecurityException", e);
|
||||
System.exit(ExitStatus.Error.value());
|
||||
@ -391,7 +356,7 @@ public class ConsoleProxyResource extends ServerResourceBase implements
|
||||
_consoleProxyMain.start();
|
||||
} else {
|
||||
s_logger.info("com.cloud.consoleproxy.ConsoleProxy is already running");
|
||||
|
||||
|
||||
try {
|
||||
Class<?> consoleProxyClazz = Class.forName("com.cloud.consoleproxy.ConsoleProxy");
|
||||
Method methodSetup = consoleProxyClazz.getMethod("setEncryptorPassword", String.class);
|
||||
@ -418,20 +383,18 @@ public class ConsoleProxyResource extends ServerResourceBase implements
|
||||
}
|
||||
}
|
||||
|
||||
public String authenticateConsoleAccess(String host, String port,
|
||||
String vmId, String sid, String ticket, Boolean isReauthentication) {
|
||||
|
||||
ConsoleAccessAuthenticationCommand cmd = new ConsoleAccessAuthenticationCommand(
|
||||
host, port, vmId, sid, ticket);
|
||||
public String authenticateConsoleAccess(String host, String port, String vmId, String sid, String ticket, Boolean isReauthentication) {
|
||||
|
||||
ConsoleAccessAuthenticationCommand cmd = new ConsoleAccessAuthenticationCommand(host, port, vmId, sid, ticket);
|
||||
cmd.setReauthenticating(isReauthentication);
|
||||
|
||||
|
||||
ConsoleProxyAuthenticationResult result = new ConsoleProxyAuthenticationResult();
|
||||
result.setSuccess(false);
|
||||
result.setReauthentication(isReauthentication);
|
||||
|
||||
try {
|
||||
AgentControlAnswer answer = getAgentControl().sendRequest(cmd, 10000);
|
||||
|
||||
|
||||
if (answer != null) {
|
||||
ConsoleAccessAuthenticationAnswer authAnswer = (ConsoleAccessAuthenticationAnswer)answer;
|
||||
result.setSuccess(authAnswer.succeeded());
|
||||
@ -443,68 +406,60 @@ public class ConsoleProxyResource extends ServerResourceBase implements
|
||||
s_logger.error("Authentication failed for vm: " + vmId + " with sid: " + sid);
|
||||
}
|
||||
} catch (AgentControlChannelException e) {
|
||||
s_logger.error("Unable to send out console access authentication request due to "
|
||||
+ e.getMessage(), e);
|
||||
s_logger.error("Unable to send out console access authentication request due to " + e.getMessage(), e);
|
||||
}
|
||||
|
||||
return new Gson().toJson(result);
|
||||
}
|
||||
|
||||
public void reportLoadInfo(String gsonLoadInfo) {
|
||||
ConsoleProxyLoadReportCommand cmd = new ConsoleProxyLoadReportCommand(
|
||||
_proxyVmId, gsonLoadInfo);
|
||||
ConsoleProxyLoadReportCommand cmd = new ConsoleProxyLoadReportCommand(_proxyVmId, gsonLoadInfo);
|
||||
try {
|
||||
getAgentControl().postRequest(cmd);
|
||||
|
||||
if (s_logger.isDebugEnabled())
|
||||
s_logger.debug("Report proxy load info, proxy : " + _proxyVmId
|
||||
+ ", load: " + gsonLoadInfo);
|
||||
s_logger.debug("Report proxy load info, proxy : " + _proxyVmId + ", load: " + gsonLoadInfo);
|
||||
} catch (AgentControlChannelException e) {
|
||||
s_logger.error(
|
||||
"Unable to send out load info due to " + e.getMessage(), e);
|
||||
s_logger.error("Unable to send out load info due to " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public void ensureRoute(String address) {
|
||||
if (_localgw != null) {
|
||||
if (s_logger.isDebugEnabled())
|
||||
s_logger.debug("Ensure route for " + address + " via "
|
||||
+ _localgw);
|
||||
s_logger.debug("Ensure route for " + address + " via " + _localgw);
|
||||
|
||||
// this method won't be called in high frequency, serialize access
|
||||
// to script execution
|
||||
synchronized (this) {
|
||||
try {
|
||||
addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask,
|
||||
address);
|
||||
addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, address);
|
||||
} catch (Throwable e) {
|
||||
s_logger.warn(
|
||||
"Unexpected exception while adding internal route to "
|
||||
+ address, e);
|
||||
s_logger.warn("Unexpected exception while adding internal route to " + address, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
}
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConfigParams(Map<String, Object> params) {
|
||||
}
|
||||
@Override
|
||||
public void setConfigParams(Map<String, Object> params) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getConfigParams() {
|
||||
return new HashMap<String, Object>();
|
||||
}
|
||||
@Override
|
||||
public Map<String, Object> getConfigParams() {
|
||||
return new HashMap<String, Object>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRunLevel() {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int getRunLevel() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRunLevel(int level) {
|
||||
}
|
||||
@Override
|
||||
public void setRunLevel(int level) {
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,8 +29,7 @@ public class AgentShellTest {
|
||||
public void parseCommand() throws ConfigurationException {
|
||||
AgentShell shell = new AgentShell();
|
||||
UUID anyUuid = UUID.randomUUID();
|
||||
shell.parseCommand(new String[] { "port=55555", "threads=4",
|
||||
"host=localhost", "pod=pod1", "guid=" + anyUuid, "zone=zone1" });
|
||||
shell.parseCommand(new String[] {"port=55555", "threads=4", "host=localhost", "pod=pod1", "guid=" + anyUuid, "zone=zone1"});
|
||||
Assert.assertEquals(55555, shell.getPort());
|
||||
Assert.assertEquals(4, shell.getWorkers());
|
||||
Assert.assertEquals("localhost", shell.getHost());
|
||||
@ -38,6 +37,7 @@ public class AgentShellTest {
|
||||
Assert.assertEquals("pod1", shell.getPod());
|
||||
Assert.assertEquals("zone1", shell.getZone());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loadProperties() throws ConfigurationException {
|
||||
AgentShell shell = new AgentShell();
|
||||
|
||||
@ -30,8 +30,7 @@ import org.junit.Test;
|
||||
public class PropertiesStorageTest {
|
||||
@Test
|
||||
public void configureWithNotExistingFile() {
|
||||
String fileName = "target/notyetexistingfile"
|
||||
+ System.currentTimeMillis();
|
||||
String fileName = "target/notyetexistingfile" + System.currentTimeMillis();
|
||||
File file = new File(fileName);
|
||||
|
||||
PropertiesStorage storage = new PropertiesStorage();
|
||||
@ -48,8 +47,7 @@ public class PropertiesStorageTest {
|
||||
|
||||
@Test
|
||||
public void configureWithExistingFile() throws IOException {
|
||||
String fileName = "target/existingfile"
|
||||
+ System.currentTimeMillis();
|
||||
String fileName = "target/existingfile" + System.currentTimeMillis();
|
||||
File file = new File(fileName);
|
||||
|
||||
FileUtils.writeStringToFile(file, "a=b\n\n");
|
||||
|
||||
@ -28,31 +28,31 @@ import com.cloud.vm.VirtualMachine.PowerState;
|
||||
//
|
||||
public class HostVmStateReportEntry {
|
||||
VirtualMachine.PowerState state;
|
||||
|
||||
|
||||
// host name or host uuid
|
||||
String host;
|
||||
|
||||
// XS needs Xen Tools version info
|
||||
String hostToolsVersion;
|
||||
|
||||
|
||||
public HostVmStateReportEntry() {
|
||||
}
|
||||
|
||||
|
||||
public HostVmStateReportEntry(PowerState state, String host, String hostToolsVersion) {
|
||||
this.state = state;
|
||||
this.host = host;
|
||||
this.hostToolsVersion = hostToolsVersion;
|
||||
}
|
||||
|
||||
|
||||
public PowerState getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
public String getHost() {
|
||||
return host;
|
||||
}
|
||||
|
||||
|
||||
public String getHostToolsVersion() {
|
||||
return hostToolsVersion;
|
||||
return hostToolsVersion;
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,13 +28,11 @@ import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*/
|
||||
@Target({ TYPE, FIELD })
|
||||
@Target({TYPE, FIELD})
|
||||
@Retention(RUNTIME)
|
||||
public @interface LogLevel {
|
||||
public enum Log4jLevel { // Had to do this because Level is not primitive.
|
||||
Off(Level.OFF),
|
||||
Trace(Level.TRACE),
|
||||
Debug(Level.DEBUG);
|
||||
Off(Level.OFF), Trace(Level.TRACE), Debug(Level.DEBUG);
|
||||
|
||||
Level _level;
|
||||
|
||||
|
||||
@ -21,101 +21,99 @@ import java.net.URI;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
|
||||
public class PvlanSetupCommand extends Command {
|
||||
public enum Type {
|
||||
DHCP,
|
||||
VM
|
||||
}
|
||||
private String op;
|
||||
private String primary;
|
||||
private String isolated;
|
||||
private String vmMac;
|
||||
private String dhcpName;
|
||||
private String dhcpMac;
|
||||
private String dhcpIp;
|
||||
private Type type;
|
||||
private String networkTag;
|
||||
public enum Type {
|
||||
DHCP, VM
|
||||
}
|
||||
|
||||
protected PvlanSetupCommand() {}
|
||||
|
||||
protected PvlanSetupCommand(Type type, String op, URI uri, String networkTag)
|
||||
{
|
||||
this.type = type;
|
||||
this.op = op;
|
||||
this.primary = NetUtils.getPrimaryPvlanFromUri(uri);
|
||||
this.isolated = NetUtils.getIsolatedPvlanFromUri(uri);
|
||||
this.networkTag = networkTag;
|
||||
}
|
||||
|
||||
static public PvlanSetupCommand createDhcpSetup(String op, URI uri, String networkTag, String dhcpName, String dhcpMac, String dhcpIp)
|
||||
{
|
||||
PvlanSetupCommand cmd = new PvlanSetupCommand(Type.DHCP, op, uri, networkTag);
|
||||
cmd.setDhcpName(dhcpName);
|
||||
cmd.setDhcpMac(dhcpMac);
|
||||
cmd.setDhcpIp(dhcpIp);
|
||||
return cmd;
|
||||
}
|
||||
|
||||
static public PvlanSetupCommand createVmSetup(String op, URI uri, String networkTag, String vmMac)
|
||||
{
|
||||
PvlanSetupCommand cmd = new PvlanSetupCommand(Type.VM, op, uri, networkTag);
|
||||
cmd.setVmMac(vmMac);
|
||||
return cmd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return true;
|
||||
}
|
||||
private String op;
|
||||
private String primary;
|
||||
private String isolated;
|
||||
private String vmMac;
|
||||
private String dhcpName;
|
||||
private String dhcpMac;
|
||||
private String dhcpIp;
|
||||
private Type type;
|
||||
private String networkTag;
|
||||
|
||||
public String getOp() {
|
||||
return op;
|
||||
}
|
||||
protected PvlanSetupCommand() {
|
||||
}
|
||||
|
||||
public String getPrimary() {
|
||||
return primary;
|
||||
}
|
||||
protected PvlanSetupCommand(Type type, String op, URI uri, String networkTag) {
|
||||
this.type = type;
|
||||
this.op = op;
|
||||
this.primary = NetUtils.getPrimaryPvlanFromUri(uri);
|
||||
this.isolated = NetUtils.getIsolatedPvlanFromUri(uri);
|
||||
this.networkTag = networkTag;
|
||||
}
|
||||
|
||||
public String getIsolated() {
|
||||
return isolated;
|
||||
}
|
||||
static public PvlanSetupCommand createDhcpSetup(String op, URI uri, String networkTag, String dhcpName, String dhcpMac, String dhcpIp) {
|
||||
PvlanSetupCommand cmd = new PvlanSetupCommand(Type.DHCP, op, uri, networkTag);
|
||||
cmd.setDhcpName(dhcpName);
|
||||
cmd.setDhcpMac(dhcpMac);
|
||||
cmd.setDhcpIp(dhcpIp);
|
||||
return cmd;
|
||||
}
|
||||
|
||||
public String getVmMac() {
|
||||
return vmMac;
|
||||
}
|
||||
static public PvlanSetupCommand createVmSetup(String op, URI uri, String networkTag, String vmMac) {
|
||||
PvlanSetupCommand cmd = new PvlanSetupCommand(Type.VM, op, uri, networkTag);
|
||||
cmd.setVmMac(vmMac);
|
||||
return cmd;
|
||||
}
|
||||
|
||||
protected void setVmMac(String vmMac) {
|
||||
this.vmMac = vmMac;
|
||||
}
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getDhcpMac() {
|
||||
return dhcpMac;
|
||||
}
|
||||
public String getOp() {
|
||||
return op;
|
||||
}
|
||||
|
||||
protected void setDhcpMac(String dhcpMac) {
|
||||
this.dhcpMac = dhcpMac;
|
||||
}
|
||||
public String getPrimary() {
|
||||
return primary;
|
||||
}
|
||||
|
||||
public String getDhcpIp() {
|
||||
return dhcpIp;
|
||||
}
|
||||
public String getIsolated() {
|
||||
return isolated;
|
||||
}
|
||||
|
||||
protected void setDhcpIp(String dhcpIp) {
|
||||
this.dhcpIp = dhcpIp;
|
||||
}
|
||||
public String getVmMac() {
|
||||
return vmMac;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
protected void setVmMac(String vmMac) {
|
||||
this.vmMac = vmMac;
|
||||
}
|
||||
|
||||
public String getDhcpName() {
|
||||
return dhcpName;
|
||||
}
|
||||
public String getDhcpMac() {
|
||||
return dhcpMac;
|
||||
}
|
||||
|
||||
public void setDhcpName(String dhcpName) {
|
||||
this.dhcpName = dhcpName;
|
||||
}
|
||||
protected void setDhcpMac(String dhcpMac) {
|
||||
this.dhcpMac = dhcpMac;
|
||||
}
|
||||
|
||||
public String getNetworkTag() {
|
||||
return networkTag;
|
||||
}
|
||||
public String getDhcpIp() {
|
||||
return dhcpIp;
|
||||
}
|
||||
|
||||
protected void setDhcpIp(String dhcpIp) {
|
||||
this.dhcpIp = dhcpIp;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getDhcpName() {
|
||||
return dhcpName;
|
||||
}
|
||||
|
||||
public void setDhcpName(String dhcpName) {
|
||||
this.dhcpName = dhcpName;
|
||||
}
|
||||
|
||||
public String getNetworkTag() {
|
||||
return networkTag;
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,67 +21,69 @@ import java.util.Map;
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
|
||||
public class StoragePoolInfo {
|
||||
String uuid;
|
||||
String host;
|
||||
String localPath;
|
||||
String hostPath;
|
||||
StoragePoolType poolType;
|
||||
long capacityBytes;
|
||||
long availableBytes;
|
||||
Map<String, String> details;
|
||||
String uuid;
|
||||
String host;
|
||||
String localPath;
|
||||
String hostPath;
|
||||
StoragePoolType poolType;
|
||||
long capacityBytes;
|
||||
long availableBytes;
|
||||
Map<String, String> details;
|
||||
|
||||
protected StoragePoolInfo() {
|
||||
super();
|
||||
}
|
||||
protected StoragePoolInfo() {
|
||||
super();
|
||||
}
|
||||
|
||||
public StoragePoolInfo(String uuid, String host, String hostPath,
|
||||
String localPath, StoragePoolType poolType, long capacityBytes,
|
||||
long availableBytes) {
|
||||
super();
|
||||
this.uuid = uuid;
|
||||
this.host = host;
|
||||
this.localPath = localPath;
|
||||
this.hostPath = hostPath;
|
||||
this.poolType = poolType;
|
||||
this.capacityBytes = capacityBytes;
|
||||
this.availableBytes = availableBytes;
|
||||
}
|
||||
public StoragePoolInfo(String uuid, String host, String hostPath, String localPath, StoragePoolType poolType, long capacityBytes, long availableBytes) {
|
||||
super();
|
||||
this.uuid = uuid;
|
||||
this.host = host;
|
||||
this.localPath = localPath;
|
||||
this.hostPath = hostPath;
|
||||
this.poolType = poolType;
|
||||
this.capacityBytes = capacityBytes;
|
||||
this.availableBytes = availableBytes;
|
||||
}
|
||||
|
||||
public StoragePoolInfo(String uuid, String host, String hostPath,
|
||||
String localPath, StoragePoolType poolType, long capacityBytes,
|
||||
long availableBytes, Map<String, String> details) {
|
||||
public StoragePoolInfo(String uuid, String host, String hostPath, String localPath, StoragePoolType poolType, long capacityBytes, long availableBytes,
|
||||
Map<String, String> details) {
|
||||
this(uuid, host, hostPath, localPath, poolType, capacityBytes, availableBytes);
|
||||
this.details = details;
|
||||
}
|
||||
|
||||
public long getCapacityBytes() {
|
||||
return capacityBytes;
|
||||
}
|
||||
public long getAvailableBytes() {
|
||||
return availableBytes;
|
||||
}
|
||||
public long getCapacityBytes() {
|
||||
return capacityBytes;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
public String getHost() {
|
||||
return host;
|
||||
}
|
||||
public String getLocalPath() {
|
||||
return localPath;
|
||||
}
|
||||
public String getHostPath() {
|
||||
return hostPath;
|
||||
}
|
||||
public StoragePoolType getPoolType() {
|
||||
return poolType;
|
||||
}
|
||||
public long getAvailableBytes() {
|
||||
return availableBytes;
|
||||
}
|
||||
|
||||
public void setUuid(String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public Map<String, String> getDetails() {
|
||||
return details;
|
||||
}
|
||||
public String getHost() {
|
||||
return host;
|
||||
}
|
||||
|
||||
public String getLocalPath() {
|
||||
return localPath;
|
||||
}
|
||||
|
||||
public String getHostPath() {
|
||||
return hostPath;
|
||||
}
|
||||
|
||||
public StoragePoolType getPoolType() {
|
||||
return poolType;
|
||||
}
|
||||
|
||||
public void setUuid(String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public Map<String, String> getDetails() {
|
||||
return details;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
package com.cloud.agent.api.storage;
|
||||
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
|
||||
@ -23,4 +23,4 @@ public class CreateVolumeOVAAnswer extends Answer {
|
||||
super(cmd, result, details);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,40 +21,40 @@ import com.cloud.agent.api.to.StorageFilerTO;
|
||||
import com.cloud.storage.StoragePool;
|
||||
|
||||
public class CreateVolumeOVACommand extends Command {
|
||||
String secUrl;
|
||||
String volPath;
|
||||
String volName;
|
||||
StorageFilerTO pool;
|
||||
String secUrl;
|
||||
String volPath;
|
||||
String volName;
|
||||
StorageFilerTO pool;
|
||||
|
||||
public CreateVolumeOVACommand() {
|
||||
}
|
||||
public CreateVolumeOVACommand() {
|
||||
}
|
||||
|
||||
public CreateVolumeOVACommand(String secUrl, String volPath, String volName, StoragePool pool, int wait) {
|
||||
public CreateVolumeOVACommand(String secUrl, String volPath, String volName, StoragePool pool, int wait) {
|
||||
this.secUrl = secUrl;
|
||||
this.volPath = volPath;
|
||||
this.volName = volName;
|
||||
this.pool = new StorageFilerTO(pool);
|
||||
setWait(wait);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getVolPath() {
|
||||
return this.volPath;
|
||||
}
|
||||
|
||||
public String getVolName() {
|
||||
return this.volName;
|
||||
}
|
||||
public String getSecondaryStorageUrl() {
|
||||
return this.secUrl;
|
||||
public String getVolPath() {
|
||||
return this.volPath;
|
||||
}
|
||||
|
||||
public String getVolName() {
|
||||
return this.volName;
|
||||
}
|
||||
|
||||
public String getSecondaryStorageUrl() {
|
||||
return this.secUrl;
|
||||
}
|
||||
|
||||
public StorageFilerTO getPool() {
|
||||
return pool;
|
||||
return pool;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -23,16 +23,20 @@ public class PasswordAuth {
|
||||
|
||||
String userName;
|
||||
String password;
|
||||
|
||||
public PasswordAuth() {
|
||||
|
||||
}
|
||||
|
||||
public PasswordAuth(String user, String password) {
|
||||
this.userName = user;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
@ -19,30 +19,28 @@ package com.cloud.agent.api.storage;
|
||||
import com.cloud.agent.api.Command;
|
||||
|
||||
public class PrepareOVAPackingCommand extends Command {
|
||||
private String templatePath;
|
||||
private String secUrl;
|
||||
private String templatePath;
|
||||
private String secUrl;
|
||||
|
||||
public PrepareOVAPackingCommand() {
|
||||
}
|
||||
public PrepareOVAPackingCommand() {
|
||||
}
|
||||
|
||||
public PrepareOVAPackingCommand(String secUrl, String templatePath) {
|
||||
this.secUrl = secUrl;
|
||||
this.templatePath = templatePath;
|
||||
}
|
||||
public PrepareOVAPackingCommand(String secUrl, String templatePath) {
|
||||
this.secUrl = secUrl;
|
||||
this.templatePath = templatePath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getTemplatePath() {
|
||||
return this.templatePath;
|
||||
}
|
||||
public String getTemplatePath() {
|
||||
return this.templatePath;
|
||||
}
|
||||
|
||||
public String getSecondaryStorageUrl() {
|
||||
return this.secUrl;
|
||||
}
|
||||
public String getSecondaryStorageUrl() {
|
||||
return this.secUrl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -19,7 +19,5 @@
|
||||
package com.cloud.agent.api.to;
|
||||
|
||||
public enum DataObjectType {
|
||||
VOLUME,
|
||||
SNAPSHOT,
|
||||
TEMPLATE
|
||||
VOLUME, SNAPSHOT, TEMPLATE
|
||||
}
|
||||
|
||||
@ -22,6 +22,8 @@ import com.cloud.storage.DataStoreRole;
|
||||
|
||||
public interface DataStoreTO {
|
||||
DataStoreRole getRole();
|
||||
|
||||
String getUuid();
|
||||
|
||||
String getUrl();
|
||||
}
|
||||
|
||||
@ -22,8 +22,11 @@ import com.cloud.hypervisor.Hypervisor;
|
||||
|
||||
public interface DataTO {
|
||||
public DataObjectType getObjectType();
|
||||
|
||||
public DataStoreTO getDataStore();
|
||||
|
||||
public Hypervisor.HypervisorType getHypervisorType();
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
|
||||
@ -26,11 +26,11 @@ public class DhcpTO {
|
||||
this.routerIp = routerIp;
|
||||
this.startIpOfSubnet = StartIpOfSubnet;
|
||||
this.gateway = gateway;
|
||||
this.netmask =netmask;
|
||||
this.netmask = netmask;
|
||||
|
||||
}
|
||||
|
||||
public void setRouterIp(String routerIp){
|
||||
public void setRouterIp(String routerIp) {
|
||||
this.routerIp = routerIp;
|
||||
}
|
||||
|
||||
@ -39,10 +39,10 @@ public class DhcpTO {
|
||||
}
|
||||
|
||||
public void setNetmask(String netmask) {
|
||||
this.netmask = netmask ;
|
||||
this.netmask = netmask;
|
||||
}
|
||||
|
||||
public void setStartIpOfSubnet( String ipOfSubNet) {
|
||||
public void setStartIpOfSubnet(String ipOfSubNet) {
|
||||
startIpOfSubnet = ipOfSubNet;
|
||||
}
|
||||
|
||||
@ -57,6 +57,7 @@ public class DhcpTO {
|
||||
public String getNetmask() {
|
||||
return netmask;
|
||||
}
|
||||
|
||||
public String getStartIpOfSubnet() {
|
||||
return startIpOfSubnet;
|
||||
}
|
||||
|
||||
@ -40,9 +40,9 @@ public class DiskTO {
|
||||
private Map<String, String> _details;
|
||||
|
||||
public DiskTO() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public DiskTO(DataTO data, Long diskSeq, String path, Volume.Type type) {
|
||||
this.data = data;
|
||||
this.diskSeq = diskSeq;
|
||||
|
||||
@ -60,10 +60,13 @@ public class FirewallRuleTO implements InternalIdentity {
|
||||
protected FirewallRuleTO() {
|
||||
}
|
||||
|
||||
public FirewallRuleTO(long id, String srcIp, String protocol, Integer srcPortStart, Integer srcPortEnd, boolean revoked, boolean alreadyAdded, FirewallRule.Purpose purpose, List<String> sourceCidr,Integer icmpType,Integer icmpCode) {
|
||||
this(id,null,srcIp,protocol,srcPortStart,srcPortEnd,revoked,alreadyAdded,purpose,sourceCidr,icmpType,icmpCode);
|
||||
public FirewallRuleTO(long id, String srcIp, String protocol, Integer srcPortStart, Integer srcPortEnd, boolean revoked, boolean alreadyAdded, FirewallRule.Purpose purpose,
|
||||
List<String> sourceCidr, Integer icmpType, Integer icmpCode) {
|
||||
this(id, null, srcIp, protocol, srcPortStart, srcPortEnd, revoked, alreadyAdded, purpose, sourceCidr, icmpType, icmpCode);
|
||||
}
|
||||
public FirewallRuleTO(long id,String srcVlanTag, String srcIp, String protocol, Integer srcPortStart, Integer srcPortEnd, boolean revoked, boolean alreadyAdded, FirewallRule.Purpose purpose, List<String> sourceCidr,Integer icmpType,Integer icmpCode) {
|
||||
|
||||
public FirewallRuleTO(long id, String srcVlanTag, String srcIp, String protocol, Integer srcPortStart, Integer srcPortEnd, boolean revoked, boolean alreadyAdded,
|
||||
FirewallRule.Purpose purpose, List<String> sourceCidr, Integer icmpType, Integer icmpCode) {
|
||||
this.id = id;
|
||||
this.srcVlanTag = srcVlanTag;
|
||||
this.srcIp = srcIp;
|
||||
@ -80,7 +83,7 @@ public class FirewallRuleTO implements InternalIdentity {
|
||||
int i = 0;
|
||||
for (Integer port : portRange) {
|
||||
srcPortRange[i] = port.intValue();
|
||||
i ++;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,42 +95,121 @@ public class FirewallRuleTO implements InternalIdentity {
|
||||
this.icmpCode = icmpCode;
|
||||
this.trafficType = null;
|
||||
}
|
||||
|
||||
public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp) {
|
||||
this(rule.getId(),srcVlanTag, srcIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getState()==State.Revoke, rule.getState()==State.Active, rule.getPurpose(),rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode());
|
||||
this(rule.getId(),
|
||||
srcVlanTag,
|
||||
srcIp,
|
||||
rule.getProtocol(),
|
||||
rule.getSourcePortStart(),
|
||||
rule.getSourcePortEnd(),
|
||||
rule.getState() == State.Revoke,
|
||||
rule.getState() == State.Active,
|
||||
rule.getPurpose(),
|
||||
rule.getSourceCidrList(),
|
||||
rule.getIcmpType(),
|
||||
rule.getIcmpCode());
|
||||
}
|
||||
|
||||
public FirewallRuleTO(FirewallRule rule, String srcIp) {
|
||||
this(rule.getId(),null, srcIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getState()==State.Revoke, rule.getState()==State.Active, rule.getPurpose(),rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode());
|
||||
this(rule.getId(),
|
||||
null,
|
||||
srcIp,
|
||||
rule.getProtocol(),
|
||||
rule.getSourcePortStart(),
|
||||
rule.getSourcePortEnd(),
|
||||
rule.getState() == State.Revoke,
|
||||
rule.getState() == State.Active,
|
||||
rule.getPurpose(),
|
||||
rule.getSourceCidrList(),
|
||||
rule.getIcmpType(),
|
||||
rule.getIcmpCode());
|
||||
}
|
||||
|
||||
public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp, FirewallRule.Purpose purpose) {
|
||||
this(rule.getId(),srcVlanTag, srcIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getState()==State.Revoke, rule.getState()==State.Active, purpose,rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode());
|
||||
this(rule.getId(),
|
||||
srcVlanTag,
|
||||
srcIp,
|
||||
rule.getProtocol(),
|
||||
rule.getSourcePortStart(),
|
||||
rule.getSourcePortEnd(),
|
||||
rule.getState() == State.Revoke,
|
||||
rule.getState() == State.Active,
|
||||
purpose,
|
||||
rule.getSourceCidrList(),
|
||||
rule.getIcmpType(),
|
||||
rule.getIcmpCode());
|
||||
}
|
||||
|
||||
public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp, FirewallRule.Purpose purpose, FirewallRule.TrafficType trafficType) {
|
||||
this(rule.getId(),srcVlanTag, srcIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getState()==State.Revoke, rule.getState()==State.Active, purpose,rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode());
|
||||
this(rule.getId(),
|
||||
srcVlanTag,
|
||||
srcIp,
|
||||
rule.getProtocol(),
|
||||
rule.getSourcePortStart(),
|
||||
rule.getSourcePortEnd(),
|
||||
rule.getState() == State.Revoke,
|
||||
rule.getState() == State.Active,
|
||||
purpose,
|
||||
rule.getSourceCidrList(),
|
||||
rule.getIcmpType(),
|
||||
rule.getIcmpCode());
|
||||
this.trafficType = trafficType;
|
||||
}
|
||||
|
||||
public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp, FirewallRule.Purpose purpose, FirewallRule.TrafficType trafficType, boolean defaultEgressPolicy) {
|
||||
this(rule.getId(),srcVlanTag, srcIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getState()==State.Revoke, rule.getState()==State.Active, purpose,rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode());
|
||||
this(rule.getId(),
|
||||
srcVlanTag,
|
||||
srcIp,
|
||||
rule.getProtocol(),
|
||||
rule.getSourcePortStart(),
|
||||
rule.getSourcePortEnd(),
|
||||
rule.getState() == State.Revoke,
|
||||
rule.getState() == State.Active,
|
||||
purpose,
|
||||
rule.getSourceCidrList(),
|
||||
rule.getIcmpType(),
|
||||
rule.getIcmpCode());
|
||||
this.trafficType = trafficType;
|
||||
this.defaultEgressPolicy = defaultEgressPolicy;
|
||||
}
|
||||
|
||||
public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp, FirewallRule.Purpose purpose, boolean revokeState, boolean alreadyAdded) {
|
||||
this(rule.getId(),srcVlanTag, srcIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), revokeState, alreadyAdded, purpose,rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode());
|
||||
this(rule.getId(),
|
||||
srcVlanTag,
|
||||
srcIp,
|
||||
rule.getProtocol(),
|
||||
rule.getSourcePortStart(),
|
||||
rule.getSourcePortEnd(),
|
||||
revokeState,
|
||||
alreadyAdded,
|
||||
purpose,
|
||||
rule.getSourceCidrList(),
|
||||
rule.getIcmpType(),
|
||||
rule.getIcmpCode());
|
||||
}
|
||||
|
||||
public FirewallRuleTO(FirewallRule rule, String guestVlanTag, FirewallRule.TrafficType trafficType, String guestCidr, boolean defaultEgressPolicy, FirewallRule.FirewallRuleType type) {
|
||||
this(rule.getId(), guestVlanTag, null, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getState()==State.Revoke, rule.getState()==State.Active, rule.getPurpose(), rule.getSourceCidrList(), rule.getIcmpType(), rule.getIcmpCode());
|
||||
public FirewallRuleTO(FirewallRule rule, String guestVlanTag, FirewallRule.TrafficType trafficType, String guestCidr, boolean defaultEgressPolicy,
|
||||
FirewallRule.FirewallRuleType type) {
|
||||
this(rule.getId(),
|
||||
guestVlanTag,
|
||||
null,
|
||||
rule.getProtocol(),
|
||||
rule.getSourcePortStart(),
|
||||
rule.getSourcePortEnd(),
|
||||
rule.getState() == State.Revoke,
|
||||
rule.getState() == State.Active,
|
||||
rule.getPurpose(),
|
||||
rule.getSourceCidrList(),
|
||||
rule.getIcmpType(),
|
||||
rule.getIcmpCode());
|
||||
this.trafficType = trafficType;
|
||||
this.defaultEgressPolicy = defaultEgressPolicy;
|
||||
this.guestCidr = guestCidr;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public FirewallRule.TrafficType getTrafficType(){
|
||||
public FirewallRule.TrafficType getTrafficType() {
|
||||
return trafficType;
|
||||
}
|
||||
|
||||
@ -136,7 +218,7 @@ public class FirewallRuleTO implements InternalIdentity {
|
||||
}
|
||||
|
||||
public String getSrcVlanTag() {
|
||||
return srcVlanTag;
|
||||
return srcVlanTag;
|
||||
}
|
||||
|
||||
public String getSrcIp() {
|
||||
@ -151,19 +233,19 @@ public class FirewallRuleTO implements InternalIdentity {
|
||||
return srcPortRange;
|
||||
}
|
||||
|
||||
public Integer getIcmpType(){
|
||||
return icmpType;
|
||||
public Integer getIcmpType() {
|
||||
return icmpType;
|
||||
}
|
||||
|
||||
public Integer getIcmpCode(){
|
||||
return icmpCode;
|
||||
public Integer getIcmpCode() {
|
||||
return icmpCode;
|
||||
}
|
||||
|
||||
public String getStringSrcPortRange() {
|
||||
if (srcPortRange == null || srcPortRange.length < 2)
|
||||
return "0:0";
|
||||
else
|
||||
return NetUtils.portRangeToString(srcPortRange);
|
||||
if (srcPortRange == null || srcPortRange.length < 2)
|
||||
return "0:0";
|
||||
else
|
||||
return NetUtils.portRangeToString(srcPortRange);
|
||||
}
|
||||
|
||||
public boolean revoked() {
|
||||
|
||||
@ -34,8 +34,8 @@ public class IpAddressTO {
|
||||
private TrafficType trafficType;
|
||||
private String networkName;
|
||||
|
||||
public IpAddressTO(long accountId, String ipAddress, boolean add, boolean firstIP, boolean sourceNat, String broadcastUri,
|
||||
String vlanGateway, String vlanNetmask, String vifMacAddress, Integer networkRate, boolean isOneToOneNat) {
|
||||
public IpAddressTO(long accountId, String ipAddress, boolean add, boolean firstIP, boolean sourceNat, String broadcastUri, String vlanGateway, String vlanNetmask,
|
||||
String vifMacAddress, Integer networkRate, boolean isOneToOneNat) {
|
||||
this.accountId = accountId;
|
||||
this.publicIp = ipAddress;
|
||||
this.add = add;
|
||||
@ -72,7 +72,6 @@ public class IpAddressTO {
|
||||
return networkName;
|
||||
}
|
||||
|
||||
|
||||
public void setTrafficType(TrafficType trafficType) {
|
||||
this.trafficType = trafficType;
|
||||
}
|
||||
@ -81,7 +80,7 @@ public class IpAddressTO {
|
||||
return add;
|
||||
}
|
||||
|
||||
public boolean isOneToOneNat(){
|
||||
public boolean isOneToOneNat() {
|
||||
return this.oneToOneNat;
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
// under the License.
|
||||
package com.cloud.agent.api.to;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -36,7 +35,6 @@ import com.cloud.network.lb.LoadBalancingRule.LbStickinessPolicy;
|
||||
import com.cloud.network.lb.LoadBalancingRule.LbSslCert;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
|
||||
public class LoadBalancerTO {
|
||||
String uuid;
|
||||
String srcIp;
|
||||
@ -55,7 +53,8 @@ public class LoadBalancerTO {
|
||||
final static int MAX_STICKINESS_POLICIES = 1;
|
||||
final static int MAX_HEALTHCHECK_POLICIES = 1;
|
||||
|
||||
public LoadBalancerTO(String uuid, String srcIp, int srcPort, String protocol, String algorithm, boolean revoked, boolean alreadyAdded, boolean inline, List<LbDestination> destinations) {
|
||||
public LoadBalancerTO(String uuid, String srcIp, int srcPort, String protocol, String algorithm, boolean revoked, boolean alreadyAdded, boolean inline,
|
||||
List<LbDestination> destinations) {
|
||||
if (destinations == null) { // for autoscaleconfig destinations will be null;
|
||||
destinations = new ArrayList<LbDestination>();
|
||||
}
|
||||
@ -77,17 +76,14 @@ public class LoadBalancerTO {
|
||||
}
|
||||
}
|
||||
|
||||
public LoadBalancerTO(String id, String srcIp, int srcPort, String protocol, String algorithm, boolean revoked,
|
||||
boolean alreadyAdded, boolean inline, List<LbDestination> arg_destinations,
|
||||
List<LbStickinessPolicy> stickinessPolicies) {
|
||||
public LoadBalancerTO(String id, String srcIp, int srcPort, String protocol, String algorithm, boolean revoked, boolean alreadyAdded, boolean inline,
|
||||
List<LbDestination> arg_destinations, List<LbStickinessPolicy> stickinessPolicies) {
|
||||
|
||||
this(id, srcIp, srcPort, protocol, algorithm, revoked, alreadyAdded, inline, arg_destinations,
|
||||
stickinessPolicies, null, null, null);
|
||||
this(id, srcIp, srcPort, protocol, algorithm, revoked, alreadyAdded, inline, arg_destinations, stickinessPolicies, null, null, null);
|
||||
}
|
||||
|
||||
public LoadBalancerTO(String id, String srcIp, int srcPort, String protocol, String algorithm, boolean revoked,
|
||||
boolean alreadyAdded, boolean inline, List<LbDestination> arg_destinations,
|
||||
List<LbStickinessPolicy> stickinessPolicies, List<LbHealthCheckPolicy> healthCheckPolicies, LbSslCert sslCert, String lbProtocol) {
|
||||
public LoadBalancerTO(String id, String srcIp, int srcPort, String protocol, String algorithm, boolean revoked, boolean alreadyAdded, boolean inline,
|
||||
List<LbDestination> arg_destinations, List<LbStickinessPolicy> stickinessPolicies, List<LbHealthCheckPolicy> healthCheckPolicies, LbSslCert sslCert, String lbProtocol) {
|
||||
this(id, srcIp, srcPort, protocol, algorithm, revoked, alreadyAdded, inline, arg_destinations);
|
||||
this.stickinessPolicies = null;
|
||||
this.healthCheckPolicies = null;
|
||||
@ -96,8 +92,7 @@ public class LoadBalancerTO {
|
||||
int index = 0;
|
||||
for (LbStickinessPolicy stickinesspolicy : stickinessPolicies) {
|
||||
if (!stickinesspolicy.isRevoked()) {
|
||||
this.stickinessPolicies[index] = new StickinessPolicyTO(stickinesspolicy.getMethodName(),
|
||||
stickinesspolicy.getParams());
|
||||
this.stickinessPolicies[index] = new StickinessPolicyTO(stickinesspolicy.getMethodName(), stickinesspolicy.getParams());
|
||||
index++;
|
||||
if (index == MAX_STICKINESS_POLICIES)
|
||||
break;
|
||||
@ -111,12 +106,11 @@ public class LoadBalancerTO {
|
||||
this.healthCheckPolicies = new HealthCheckPolicyTO[MAX_HEALTHCHECK_POLICIES];
|
||||
int index = 0;
|
||||
for (LbHealthCheckPolicy hcp : healthCheckPolicies) {
|
||||
this.healthCheckPolicies[0] = new HealthCheckPolicyTO(hcp.getpingpath(), hcp.getDescription(),
|
||||
hcp.getResponseTime(), hcp.getHealthcheckInterval(), hcp.getHealthcheckThresshold(),
|
||||
hcp.getUnhealthThresshold(), hcp.isRevoked());
|
||||
index++;
|
||||
if (index == MAX_HEALTHCHECK_POLICIES)
|
||||
break;
|
||||
this.healthCheckPolicies[0] = new HealthCheckPolicyTO(hcp.getpingpath(), hcp.getDescription(), hcp.getResponseTime(), hcp.getHealthcheckInterval(),
|
||||
hcp.getHealthcheckThresshold(), hcp.getUnhealthThresshold(), hcp.isRevoked());
|
||||
index++;
|
||||
if (index == MAX_HEALTHCHECK_POLICIES)
|
||||
break;
|
||||
}
|
||||
|
||||
if (index == 0)
|
||||
@ -190,8 +184,8 @@ public class LoadBalancerTO {
|
||||
return this.autoScaleVmGroupTO != null;
|
||||
}
|
||||
|
||||
public LbSslCert getSslCert(){
|
||||
return this.sslCert;
|
||||
public LbSslCert getSslCert() {
|
||||
return this.sslCert;
|
||||
}
|
||||
|
||||
public static class StickinessPolicyTO {
|
||||
@ -210,7 +204,7 @@ public class LoadBalancerTO {
|
||||
this._methodName = methodName;
|
||||
this._paramsList = paramsList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class HealthCheckPolicyTO {
|
||||
private String pingPath;
|
||||
@ -221,8 +215,7 @@ public class LoadBalancerTO {
|
||||
private int unhealthThresshold;
|
||||
private boolean revoke = false;
|
||||
|
||||
public HealthCheckPolicyTO(String pingPath, String description, int responseTime, int healthcheckInterval,
|
||||
int healthcheckThresshold, int unhealthThresshold, boolean revoke) {
|
||||
public HealthCheckPolicyTO(String pingPath, String description, int responseTime, int healthcheckInterval, int healthcheckThresshold, int unhealthThresshold, boolean revoke) {
|
||||
|
||||
this.description = description;
|
||||
this.pingPath = pingPath;
|
||||
@ -277,6 +270,7 @@ public class LoadBalancerTO {
|
||||
boolean revoked;
|
||||
boolean alreadyAdded;
|
||||
String monitorState;
|
||||
|
||||
public DestinationTO(String destIp, int destPort, boolean revoked, boolean alreadyAdded) {
|
||||
this.destIp = destIp;
|
||||
this.destPort = destPort;
|
||||
@ -311,8 +305,8 @@ public class LoadBalancerTO {
|
||||
return monitorState;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static class CounterTO implements Serializable {
|
||||
private final String name;
|
||||
private final String source;
|
||||
@ -342,8 +336,7 @@ public class LoadBalancerTO {
|
||||
private final String relationalOperator;
|
||||
private final CounterTO counter;
|
||||
|
||||
public ConditionTO(long threshold, String relationalOperator, CounterTO counter)
|
||||
{
|
||||
public ConditionTO(long threshold, String relationalOperator, CounterTO counter) {
|
||||
this.threshold = threshold;
|
||||
this.relationalOperator = relationalOperator;
|
||||
this.counter = counter;
|
||||
@ -494,8 +487,8 @@ public class LoadBalancerTO {
|
||||
private final String state;
|
||||
private final String currentState;
|
||||
|
||||
AutoScaleVmGroupTO(String uuid, int minMembers, int maxMembers, int memberPort, int interval, List<AutoScalePolicyTO> policies, AutoScaleVmProfileTO profile, String state, String currentState)
|
||||
{
|
||||
AutoScaleVmGroupTO(String uuid, int minMembers, int maxMembers, int memberPort, int interval, List<AutoScalePolicyTO> policies, AutoScaleVmProfileTO profile, String state,
|
||||
String currentState) {
|
||||
this.uuid = uuid;
|
||||
this.minMembers = minMembers;
|
||||
this.maxMembers = maxMembers;
|
||||
@ -544,8 +537,7 @@ public class LoadBalancerTO {
|
||||
}
|
||||
}
|
||||
|
||||
public void setAutoScaleVmGroup(LbAutoScaleVmGroup lbAutoScaleVmGroup)
|
||||
{
|
||||
public void setAutoScaleVmGroup(LbAutoScaleVmGroup lbAutoScaleVmGroup) {
|
||||
List<LbAutoScalePolicy> lbAutoScalePolicies = lbAutoScaleVmGroup.getPolicies();
|
||||
List<AutoScalePolicyTO> autoScalePolicyTOs = new ArrayList<AutoScalePolicyTO>(lbAutoScalePolicies.size());
|
||||
for (LbAutoScalePolicy lbAutoScalePolicy : lbAutoScalePolicies) {
|
||||
@ -559,21 +551,20 @@ public class LoadBalancerTO {
|
||||
conditionTOs.add(conditionTO);
|
||||
}
|
||||
AutoScalePolicy autoScalePolicy = lbAutoScalePolicy.getPolicy();
|
||||
autoScalePolicyTOs.add(new AutoScalePolicyTO(autoScalePolicy.getId(), autoScalePolicy.getDuration(),
|
||||
autoScalePolicy.getQuietTime(), autoScalePolicy.getAction(),
|
||||
conditionTOs, lbAutoScalePolicy.isRevoked()));
|
||||
autoScalePolicyTOs.add(new AutoScalePolicyTO(autoScalePolicy.getId(), autoScalePolicy.getDuration(), autoScalePolicy.getQuietTime(), autoScalePolicy.getAction(),
|
||||
conditionTOs, lbAutoScalePolicy.isRevoked()));
|
||||
}
|
||||
LbAutoScaleVmProfile lbAutoScaleVmProfile = lbAutoScaleVmGroup.getProfile();
|
||||
AutoScaleVmProfile autoScaleVmProfile = lbAutoScaleVmProfile.getProfile();
|
||||
|
||||
AutoScaleVmProfileTO autoScaleVmProfileTO = new AutoScaleVmProfileTO(lbAutoScaleVmProfile.getZoneId(), lbAutoScaleVmProfile.getDomainId(),
|
||||
lbAutoScaleVmProfile.getCsUrl(), lbAutoScaleVmProfile.getAutoScaleUserApiKey(), lbAutoScaleVmProfile.getAutoScaleUserSecretKey(),
|
||||
lbAutoScaleVmProfile.getServiceOfferingId(), lbAutoScaleVmProfile.getTemplateId(), lbAutoScaleVmProfile.getVmName(),
|
||||
lbAutoScaleVmProfile.getNetworkId(),autoScaleVmProfile.getOtherDeployParams(), autoScaleVmProfile.getCounterParams(),
|
||||
autoScaleVmProfile.getDestroyVmGraceperiod());
|
||||
AutoScaleVmProfileTO autoScaleVmProfileTO = new AutoScaleVmProfileTO(lbAutoScaleVmProfile.getZoneId(), lbAutoScaleVmProfile.getDomainId(), lbAutoScaleVmProfile.getCsUrl(),
|
||||
lbAutoScaleVmProfile.getAutoScaleUserApiKey(), lbAutoScaleVmProfile.getAutoScaleUserSecretKey(), lbAutoScaleVmProfile.getServiceOfferingId(),
|
||||
lbAutoScaleVmProfile.getTemplateId(), lbAutoScaleVmProfile.getVmName(), lbAutoScaleVmProfile.getNetworkId(), autoScaleVmProfile.getOtherDeployParams(),
|
||||
autoScaleVmProfile.getCounterParams(), autoScaleVmProfile.getDestroyVmGraceperiod());
|
||||
|
||||
AutoScaleVmGroup autoScaleVmGroup = lbAutoScaleVmGroup.getVmGroup();
|
||||
autoScaleVmGroupTO = new AutoScaleVmGroupTO(autoScaleVmGroup.getUuid(), autoScaleVmGroup.getMinMembers(), autoScaleVmGroup.getMaxMembers(), autoScaleVmGroup.getMemberPort(),
|
||||
autoScaleVmGroup.getInterval(), autoScalePolicyTOs, autoScaleVmProfileTO, autoScaleVmGroup.getState(), lbAutoScaleVmGroup.getCurrentState());
|
||||
autoScaleVmGroupTO = new AutoScaleVmGroupTO(autoScaleVmGroup.getUuid(), autoScaleVmGroup.getMinMembers(), autoScaleVmGroup.getMaxMembers(),
|
||||
autoScaleVmGroup.getMemberPort(), autoScaleVmGroup.getInterval(), autoScalePolicyTOs, autoScaleVmProfileTO, autoScaleVmGroup.getState(),
|
||||
lbAutoScaleVmGroup.getCurrentState());
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ public class MonitorServiceTO implements InternalIdentity {
|
||||
protected MonitorServiceTO() {
|
||||
}
|
||||
|
||||
public MonitorServiceTO (String service, String processname, String serviceName, String servicepath, String pidFile, boolean isDefault) {
|
||||
public MonitorServiceTO(String service, String processname, String serviceName, String servicepath, String pidFile, boolean isDefault) {
|
||||
this.service = service;
|
||||
this.processname = processname;
|
||||
this.serviceName = serviceName;
|
||||
@ -39,8 +39,6 @@ public class MonitorServiceTO implements InternalIdentity {
|
||||
this.isDefault = isDefault;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean isDefault() {
|
||||
return isDefault;
|
||||
}
|
||||
@ -54,7 +52,6 @@ public class MonitorServiceTO implements InternalIdentity {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public String getService() {
|
||||
return service;
|
||||
}
|
||||
|
||||
@ -26,7 +26,6 @@ import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
|
||||
|
||||
public class NetworkACLTO implements InternalIdentity {
|
||||
long id;
|
||||
String vlanTag;
|
||||
@ -44,9 +43,8 @@ public class NetworkACLTO implements InternalIdentity {
|
||||
protected NetworkACLTO() {
|
||||
}
|
||||
|
||||
|
||||
public NetworkACLTO(long id,String vlanTag, String protocol, Integer portStart, Integer portEnd, boolean revoked,
|
||||
boolean alreadyAdded, List<String> cidrList, Integer icmpType,Integer icmpCode,TrafficType trafficType, boolean allow, int number) {
|
||||
public NetworkACLTO(long id, String vlanTag, String protocol, Integer portStart, Integer portEnd, boolean revoked, boolean alreadyAdded, List<String> cidrList,
|
||||
Integer icmpType, Integer icmpCode, TrafficType trafficType, boolean allow, int number) {
|
||||
this.vlanTag = vlanTag;
|
||||
this.protocol = protocol;
|
||||
|
||||
@ -61,7 +59,7 @@ public class NetworkACLTO implements InternalIdentity {
|
||||
int i = 0;
|
||||
for (Integer port : range) {
|
||||
portRange[i] = port.intValue();
|
||||
i ++;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,7 +70,7 @@ public class NetworkACLTO implements InternalIdentity {
|
||||
this.icmpCode = icmpCode;
|
||||
this.trafficType = trafficType;
|
||||
|
||||
if(!allow){
|
||||
if (!allow) {
|
||||
this.action = "DROP";
|
||||
} else {
|
||||
this.action = "ACCEPT";
|
||||
@ -81,10 +79,20 @@ public class NetworkACLTO implements InternalIdentity {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public NetworkACLTO(NetworkACLItem rule, String vlanTag, NetworkACLItem.TrafficType trafficType ) {
|
||||
this(rule.getId(), vlanTag, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(),
|
||||
rule.getState() == NetworkACLItem.State.Revoke, rule.getState() == NetworkACLItem.State.Active,
|
||||
rule.getSourceCidrList() ,rule.getIcmpType(), rule.getIcmpCode(),trafficType, rule.getAction() == NetworkACLItem.Action.Allow, rule.getNumber());
|
||||
public NetworkACLTO(NetworkACLItem rule, String vlanTag, NetworkACLItem.TrafficType trafficType) {
|
||||
this(rule.getId(),
|
||||
vlanTag,
|
||||
rule.getProtocol(),
|
||||
rule.getSourcePortStart(),
|
||||
rule.getSourcePortEnd(),
|
||||
rule.getState() == NetworkACLItem.State.Revoke,
|
||||
rule.getState() == NetworkACLItem.State.Active,
|
||||
rule.getSourceCidrList(),
|
||||
rule.getIcmpType(),
|
||||
rule.getIcmpCode(),
|
||||
trafficType,
|
||||
rule.getAction() == NetworkACLItem.Action.Allow,
|
||||
rule.getNumber());
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
@ -103,11 +111,11 @@ public class NetworkACLTO implements InternalIdentity {
|
||||
return portRange;
|
||||
}
|
||||
|
||||
public Integer getIcmpType(){
|
||||
public Integer getIcmpType() {
|
||||
return icmpType;
|
||||
}
|
||||
|
||||
public Integer getIcmpCode(){
|
||||
public Integer getIcmpCode() {
|
||||
return icmpCode;
|
||||
}
|
||||
|
||||
@ -138,7 +146,7 @@ public class NetworkACLTO implements InternalIdentity {
|
||||
return action;
|
||||
}
|
||||
|
||||
public int getNumber(){
|
||||
public int getNumber() {
|
||||
return number;
|
||||
}
|
||||
}
|
||||
|
||||
@ -164,7 +164,7 @@ public class NetworkTO {
|
||||
|
||||
public void setBroadcastUri(URI broadcastUri) {
|
||||
// only do this if the scheme needs aligning with the broadcastUri
|
||||
if(broadcastUri != null && getBroadcastType() == null) {
|
||||
if (broadcastUri != null && getBroadcastType() == null) {
|
||||
setBroadcastType(BroadcastDomainType.getSchemeValue(broadcastUri));
|
||||
}
|
||||
this.broadcastUri = broadcastUri;
|
||||
|
||||
@ -24,7 +24,7 @@ public class NicTO extends NetworkTO {
|
||||
Integer networkRateMulticastMbps;
|
||||
boolean defaultNic;
|
||||
String uuid;
|
||||
List <String> nicSecIps;
|
||||
List<String> nicSecIps;
|
||||
|
||||
public NicTO() {
|
||||
super();
|
||||
|
||||
@ -36,13 +36,14 @@ public class PortForwardingRuleTO extends FirewallRuleTO {
|
||||
public PortForwardingRuleTO(PortForwardingRule rule, String srcVlanTag, String srcIp) {
|
||||
super(rule, srcVlanTag, srcIp);
|
||||
this.dstIp = rule.getDestinationIpAddress().addr();
|
||||
this.dstPortRange = new int[] { rule.getDestinationPortStart(), rule.getDestinationPortEnd() };
|
||||
this.dstPortRange = new int[] {rule.getDestinationPortStart(), rule.getDestinationPortEnd()};
|
||||
}
|
||||
|
||||
public PortForwardingRuleTO(long id, String srcIp, int srcPortStart, int srcPortEnd, String dstIp, int dstPortStart, int dstPortEnd, String protocol, boolean revoked, boolean alreadyAdded) {
|
||||
super(id, null, srcIp, protocol, srcPortStart, srcPortEnd, revoked, alreadyAdded, FirewallRule.Purpose.PortForwarding, null,0,0);
|
||||
public PortForwardingRuleTO(long id, String srcIp, int srcPortStart, int srcPortEnd, String dstIp, int dstPortStart, int dstPortEnd, String protocol, boolean revoked,
|
||||
boolean alreadyAdded) {
|
||||
super(id, null, srcIp, protocol, srcPortStart, srcPortEnd, revoked, alreadyAdded, FirewallRule.Purpose.PortForwarding, null, 0, 0);
|
||||
this.dstIp = dstIp;
|
||||
this.dstPortRange = new int[] { dstPortStart, dstPortEnd };
|
||||
this.dstPortRange = new int[] {dstPortStart, dstPortEnd};
|
||||
}
|
||||
|
||||
public String getDstIp() {
|
||||
|
||||
@ -47,11 +47,8 @@ public final class S3TO implements S3Utils.ClientOptions, DataStoreTO {
|
||||
|
||||
}
|
||||
|
||||
public S3TO(final Long id, final String uuid, final String accessKey,
|
||||
final String secretKey, final String endPoint,
|
||||
final String bucketName, final Boolean httpsFlag,
|
||||
final Integer connectionTimeout, final Integer maxErrorRetry,
|
||||
final Integer socketTimeout, final Date created, final boolean enableRRS, final long maxUploadSize) {
|
||||
public S3TO(final Long id, final String uuid, final String accessKey, final String secretKey, final String endPoint, final String bucketName, final Boolean httpsFlag,
|
||||
final Integer connectionTimeout, final Integer maxErrorRetry, final Integer socketTimeout, final Date created, final boolean enableRRS, final long maxUploadSize) {
|
||||
|
||||
super();
|
||||
|
||||
@ -81,26 +78,21 @@ public final class S3TO implements S3Utils.ClientOptions, DataStoreTO {
|
||||
return false;
|
||||
}
|
||||
|
||||
final S3TO thatS3TO = (S3TO) thatObject;
|
||||
final S3TO thatS3TO = (S3TO)thatObject;
|
||||
|
||||
if (httpsFlag != null ? !httpsFlag.equals(thatS3TO.httpsFlag)
|
||||
: thatS3TO.httpsFlag != null) {
|
||||
if (httpsFlag != null ? !httpsFlag.equals(thatS3TO.httpsFlag) : thatS3TO.httpsFlag != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (accessKey != null ? !accessKey.equals(thatS3TO.accessKey)
|
||||
: thatS3TO.accessKey != null) {
|
||||
if (accessKey != null ? !accessKey.equals(thatS3TO.accessKey) : thatS3TO.accessKey != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (connectionTimeout != null ? !connectionTimeout
|
||||
.equals(thatS3TO.connectionTimeout)
|
||||
: thatS3TO.connectionTimeout != null) {
|
||||
if (connectionTimeout != null ? !connectionTimeout.equals(thatS3TO.connectionTimeout) : thatS3TO.connectionTimeout != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (endPoint != null ? !endPoint.equals(thatS3TO.endPoint)
|
||||
: thatS3TO.endPoint != null) {
|
||||
if (endPoint != null ? !endPoint.equals(thatS3TO.endPoint) : thatS3TO.endPoint != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -112,30 +104,23 @@ public final class S3TO implements S3Utils.ClientOptions, DataStoreTO {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (maxErrorRetry != null ? !maxErrorRetry
|
||||
.equals(thatS3TO.maxErrorRetry)
|
||||
: thatS3TO.maxErrorRetry != null) {
|
||||
if (maxErrorRetry != null ? !maxErrorRetry.equals(thatS3TO.maxErrorRetry) : thatS3TO.maxErrorRetry != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (secretKey != null ? !secretKey.equals(thatS3TO.secretKey)
|
||||
: thatS3TO.secretKey != null) {
|
||||
if (secretKey != null ? !secretKey.equals(thatS3TO.secretKey) : thatS3TO.secretKey != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (socketTimeout != null ? !socketTimeout
|
||||
.equals(thatS3TO.socketTimeout)
|
||||
: thatS3TO.socketTimeout != null) {
|
||||
if (socketTimeout != null ? !socketTimeout.equals(thatS3TO.socketTimeout) : thatS3TO.socketTimeout != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bucketName != null ? !bucketName.equals(thatS3TO.bucketName)
|
||||
: thatS3TO.bucketName != null) {
|
||||
if (bucketName != null ? !bucketName.equals(thatS3TO.bucketName) : thatS3TO.bucketName != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (created != null ? !created.equals(thatS3TO.created)
|
||||
: thatS3TO.created != null) {
|
||||
if (created != null ? !created.equals(thatS3TO.created) : thatS3TO.created != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -157,13 +142,9 @@ public final class S3TO implements S3Utils.ClientOptions, DataStoreTO {
|
||||
result = 31 * result + (endPoint != null ? endPoint.hashCode() : 0);
|
||||
result = 31 * result + (bucketName != null ? bucketName.hashCode() : 0);
|
||||
result = 31 * result + (httpsFlag ? 1 : 0);
|
||||
result = 31
|
||||
* result
|
||||
+ (connectionTimeout != null ? connectionTimeout.hashCode() : 0);
|
||||
result = 31 * result
|
||||
+ (maxErrorRetry != null ? maxErrorRetry.hashCode() : 0);
|
||||
result = 31 * result
|
||||
+ (socketTimeout != null ? socketTimeout.hashCode() : 0);
|
||||
result = 31 * result + (connectionTimeout != null ? connectionTimeout.hashCode() : 0);
|
||||
result = 31 * result + (maxErrorRetry != null ? maxErrorRetry.hashCode() : 0);
|
||||
result = 31 * result + (socketTimeout != null ? socketTimeout.hashCode() : 0);
|
||||
|
||||
return result;
|
||||
|
||||
@ -274,7 +255,6 @@ public final class S3TO implements S3Utils.ClientOptions, DataStoreTO {
|
||||
return DataStoreRole.Image;
|
||||
}
|
||||
|
||||
|
||||
public boolean getEnableRRS() {
|
||||
return enableRRS;
|
||||
}
|
||||
@ -291,20 +271,20 @@ public final class S3TO implements S3Utils.ClientOptions, DataStoreTO {
|
||||
this.maxSingleUploadSizeInBytes = maxSingleUploadSizeInBytes;
|
||||
}
|
||||
|
||||
public boolean getSingleUpload(long objSize){
|
||||
if ( maxSingleUploadSizeInBytes < 0 ){
|
||||
public boolean getSingleUpload(long objSize) {
|
||||
if (maxSingleUploadSizeInBytes < 0) {
|
||||
// always use single part upload
|
||||
return true;
|
||||
} else if ( maxSingleUploadSizeInBytes == 0 ){
|
||||
} else if (maxSingleUploadSizeInBytes == 0) {
|
||||
// always use multi part upload
|
||||
return false;
|
||||
} else {
|
||||
// check object size to set flag
|
||||
if (objSize < maxSingleUploadSizeInBytes){
|
||||
if (objSize < maxSingleUploadSizeInBytes) {
|
||||
return true;
|
||||
} else{
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,30 +26,52 @@ import com.cloud.network.rules.StaticNatRule;
|
||||
*
|
||||
*/
|
||||
|
||||
public class StaticNatRuleTO extends FirewallRuleTO{
|
||||
public class StaticNatRuleTO extends FirewallRuleTO {
|
||||
String dstIp;
|
||||
|
||||
protected StaticNatRuleTO() {
|
||||
}
|
||||
|
||||
public StaticNatRuleTO(StaticNatRule rule, String srcVlanTag, String srcIp, String dstIp) {
|
||||
super(rule.getId(),srcVlanTag, srcIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(),rule.getState()==State.Revoke, rule.getState()==State.Active, rule.getPurpose(), null,0,0);
|
||||
super(rule.getId(),
|
||||
srcVlanTag,
|
||||
srcIp,
|
||||
rule.getProtocol(),
|
||||
rule.getSourcePortStart(),
|
||||
rule.getSourcePortEnd(),
|
||||
rule.getState() == State.Revoke,
|
||||
rule.getState() == State.Active,
|
||||
rule.getPurpose(),
|
||||
null,
|
||||
0,
|
||||
0);
|
||||
this.dstIp = dstIp;
|
||||
}
|
||||
|
||||
public StaticNatRuleTO(StaticNatRule rule, String scrIp, String dstIp) {
|
||||
super(rule.getId(), scrIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(),rule.getState()==State.Revoke, rule.getState()==State.Active, rule.getPurpose(), null,0,0);
|
||||
super(rule.getId(),
|
||||
scrIp,
|
||||
rule.getProtocol(),
|
||||
rule.getSourcePortStart(),
|
||||
rule.getSourcePortEnd(),
|
||||
rule.getState() == State.Revoke,
|
||||
rule.getState() == State.Active,
|
||||
rule.getPurpose(),
|
||||
null,
|
||||
0,
|
||||
0);
|
||||
this.dstIp = dstIp;
|
||||
}
|
||||
|
||||
|
||||
public StaticNatRuleTO(long id, String srcIp, Integer srcPortStart, Integer srcPortEnd, String dstIp, Integer dstPortStart, Integer dstPortEnd, String protocol, boolean revoked, boolean alreadyAdded) {
|
||||
super(id, srcIp, protocol, srcPortStart, srcPortEnd, revoked, alreadyAdded, FirewallRule.Purpose.StaticNat, null,0,0);
|
||||
public StaticNatRuleTO(long id, String srcIp, Integer srcPortStart, Integer srcPortEnd, String dstIp, Integer dstPortStart, Integer dstPortEnd, String protocol,
|
||||
boolean revoked, boolean alreadyAdded) {
|
||||
super(id, srcIp, protocol, srcPortStart, srcPortEnd, revoked, alreadyAdded, FirewallRule.Purpose.StaticNat, null, 0, 0);
|
||||
this.dstIp = dstIp;
|
||||
}
|
||||
|
||||
public StaticNatRuleTO(long id,String srcVlanTag, String srcIp, Integer srcPortStart, Integer srcPortEnd, String dstIp, Integer dstPortStart, Integer dstPortEnd, String protocol, boolean revoked, boolean alreadyAdded) {
|
||||
super(id, srcVlanTag, srcIp, protocol, srcPortStart, srcPortEnd, revoked, alreadyAdded, FirewallRule.Purpose.StaticNat, null,0,0);
|
||||
|
||||
public StaticNatRuleTO(long id, String srcVlanTag, String srcIp, Integer srcPortStart, Integer srcPortEnd, String dstIp, Integer dstPortStart, Integer dstPortEnd,
|
||||
String protocol, boolean revoked, boolean alreadyAdded) {
|
||||
super(id, srcVlanTag, srcIp, protocol, srcPortStart, srcPortEnd, revoked, alreadyAdded, FirewallRule.Purpose.StaticNat, null, 0, 0);
|
||||
this.dstIp = dstIp;
|
||||
}
|
||||
|
||||
|
||||
@ -27,7 +27,8 @@ public class SwiftTO implements DataStoreTO, SwiftUtil.SwiftClientCfg {
|
||||
String userName;
|
||||
String key;
|
||||
|
||||
public SwiftTO() { }
|
||||
public SwiftTO() {
|
||||
}
|
||||
|
||||
public SwiftTO(Long id, String url, String account, String userName, String key) {
|
||||
this.id = id;
|
||||
|
||||
@ -61,7 +61,8 @@ public class VirtualMachineTO {
|
||||
DiskTO[] disks;
|
||||
NicTO[] nics;
|
||||
|
||||
public VirtualMachineTO(long id, String instanceName, VirtualMachine.Type type, int cpus, Integer speed, long minRam, long maxRam, BootloaderType bootloader, String os, boolean enableHA, boolean limitCpuUse, String vncPassword) {
|
||||
public VirtualMachineTO(long id, String instanceName, VirtualMachine.Type type, int cpus, Integer speed, long minRam, long maxRam, BootloaderType bootloader, String os,
|
||||
boolean enableHA, boolean limitCpuUse, String vncPassword) {
|
||||
this.id = id;
|
||||
this.name = instanceName;
|
||||
this.type = type;
|
||||
@ -76,7 +77,8 @@ public class VirtualMachineTO {
|
||||
this.vncPassword = vncPassword;
|
||||
}
|
||||
|
||||
public VirtualMachineTO(long id, String instanceName, VirtualMachine.Type type, int cpus, Integer minSpeed, Integer maxSpeed, long minRam, long maxRam, BootloaderType bootloader, String os, boolean enableHA, boolean limitCpuUse, String vncPassword) {
|
||||
public VirtualMachineTO(long id, String instanceName, VirtualMachine.Type type, int cpus, Integer minSpeed, Integer maxSpeed, long minRam, long maxRam,
|
||||
BootloaderType bootloader, String os, boolean enableHA, boolean limitCpuUse, String vncPassword) {
|
||||
this.id = id;
|
||||
this.name = instanceName;
|
||||
this.type = type;
|
||||
@ -150,8 +152,9 @@ public class VirtualMachineTO {
|
||||
public Integer getMaxSpeed() {
|
||||
return maxSpeed;
|
||||
}
|
||||
|
||||
public boolean getLimitCpuUse() {
|
||||
return limitCpuUse;
|
||||
return limitCpuUse;
|
||||
}
|
||||
|
||||
public long getMinRam() {
|
||||
@ -232,11 +235,11 @@ public class VirtualMachineTO {
|
||||
}
|
||||
|
||||
public String getVncPassword() {
|
||||
return this.vncPassword;
|
||||
return this.vncPassword;
|
||||
}
|
||||
|
||||
public void setVncPassword(String vncPassword) {
|
||||
this.vncPassword = vncPassword;
|
||||
this.vncPassword = vncPassword;
|
||||
}
|
||||
|
||||
public String getVncAddr() {
|
||||
@ -248,11 +251,11 @@ public class VirtualMachineTO {
|
||||
}
|
||||
|
||||
public Map<String, String> getDetails() {
|
||||
return params;
|
||||
return params;
|
||||
}
|
||||
|
||||
public void setDetails(Map<String, String> params) {
|
||||
this.params = params;
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
@ -263,5 +266,4 @@ public class VirtualMachineTO {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -55,7 +55,8 @@ public class VolumeTO implements InternalIdentity {
|
||||
this.chainInfo = chainInfo;
|
||||
}
|
||||
|
||||
public VolumeTO(long id, Volume.Type type, StoragePoolType poolType, String poolUuid, String name, String mountPoint, String path, long size, String chainInfo, String guestOsType) {
|
||||
public VolumeTO(long id, Volume.Type type, StoragePoolType poolType, String poolUuid, String name, String mountPoint, String path, long size, String chainInfo,
|
||||
String guestOsType) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.path = path;
|
||||
@ -126,16 +127,16 @@ public class VolumeTO implements InternalIdentity {
|
||||
public String getChainInfo() {
|
||||
return chainInfo;
|
||||
}
|
||||
|
||||
|
||||
public void setChainInfo(String chainInfo) {
|
||||
this.chainInfo = chainInfo;
|
||||
this.chainInfo = chainInfo;
|
||||
}
|
||||
|
||||
public String getOsType() {
|
||||
return guestOsType;
|
||||
}
|
||||
|
||||
public void setPath(String path){
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
|
||||
@ -29,25 +29,25 @@ import com.cloud.vm.VirtualMachineProfile;
|
||||
|
||||
public interface HostAllocator extends Adapter {
|
||||
|
||||
/**
|
||||
* @param UserVm vm
|
||||
* @param ServiceOffering offering
|
||||
**/
|
||||
boolean isVirtualMachineUpgradable(final VirtualMachine vm, final ServiceOffering offering);
|
||||
/**
|
||||
* @param UserVm vm
|
||||
* @param ServiceOffering offering
|
||||
**/
|
||||
boolean isVirtualMachineUpgradable(final VirtualMachine vm, final ServiceOffering offering);
|
||||
|
||||
/**
|
||||
* Determines which physical hosts are suitable to
|
||||
* allocate the guest virtual machines on
|
||||
*
|
||||
* @param VirtualMachineProfile vmProfile
|
||||
* @param DeploymentPlan plan
|
||||
* @param GuestType type
|
||||
* @param ExcludeList avoid
|
||||
* @param int returnUpTo (use -1 to return all possible hosts)
|
||||
* @return List<Host> List of hosts that are suitable for VM allocation
|
||||
**/
|
||||
/**
|
||||
* Determines which physical hosts are suitable to
|
||||
* allocate the guest virtual machines on
|
||||
*
|
||||
* @param VirtualMachineProfile vmProfile
|
||||
* @param DeploymentPlan plan
|
||||
* @param GuestType type
|
||||
* @param ExcludeList avoid
|
||||
* @param int returnUpTo (use -1 to return all possible hosts)
|
||||
* @return List<Host> List of hosts that are suitable for VM allocation
|
||||
**/
|
||||
|
||||
public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo);
|
||||
public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo);
|
||||
|
||||
/**
|
||||
* Determines which physical hosts are suitable to allocate the guest
|
||||
@ -99,9 +99,9 @@ public interface HostAllocator extends Adapter {
|
||||
* capacity)
|
||||
* @return List<Host> List of hosts that are suitable for VM allocation
|
||||
**/
|
||||
public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, List<? extends Host> hosts,
|
||||
int returnUpTo, boolean considerReservedCapacity);
|
||||
public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, List<? extends Host> hosts, int returnUpTo,
|
||||
boolean considerReservedCapacity);
|
||||
|
||||
public static int RETURN_UPTO_ALL = -1;
|
||||
public static int RETURN_UPTO_ALL = -1;
|
||||
|
||||
}
|
||||
|
||||
@ -28,6 +28,6 @@ import com.cloud.vm.VirtualMachineProfile;
|
||||
|
||||
public interface PodAllocator extends Adapter {
|
||||
Pair<Pod, Long> allocateTo(VirtualMachineTemplate template, ServiceOffering offering, DataCenter dc, long userId, Set<Long> avoids);
|
||||
|
||||
|
||||
Pod allocateTo(VirtualMachineProfile vm, DataCenter dc, Set<? extends Pod> avoids);
|
||||
}
|
||||
|
||||
@ -23,12 +23,20 @@ import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface Alert extends Identity, InternalIdentity {
|
||||
short getType();
|
||||
|
||||
String getSubject();
|
||||
|
||||
Long getPodId();
|
||||
|
||||
long getDataCenterId();
|
||||
|
||||
int getSentCount();
|
||||
|
||||
Date getCreatedDate();
|
||||
|
||||
Date getLastSent();
|
||||
|
||||
Date getResolved();
|
||||
|
||||
boolean getArchived();
|
||||
}
|
||||
|
||||
@ -35,10 +35,10 @@ public class ListRecurringSnapshotScheduleCmd extends BaseListCmd {
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.SNAPSHOT_POLICY_ID, type=CommandType.LONG, description="lists recurring snapshots by snapshot policy ID")
|
||||
@Parameter(name = ApiConstants.SNAPSHOT_POLICY_ID, type = CommandType.LONG, description = "lists recurring snapshots by snapshot policy ID")
|
||||
private Long snapshotPolicyId;
|
||||
|
||||
@Parameter(name=ApiConstants.VOLUME_ID, type=CommandType.LONG, required=true, description="list recurring snapshots by volume ID")
|
||||
@Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.LONG, required = true, description = "list recurring snapshots by volume ID")
|
||||
private Long volumeId;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
@ -63,7 +63,7 @@ public class ListRecurringSnapshotScheduleCmd extends BaseListCmd {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
public void execute() {
|
||||
List<? extends SnapshotSchedule> snapshotSchedules = _snapshotService.findRecurringSnapshotSchedule(this);
|
||||
ListResponse<SnapshotScheduleResponse> response = new ListResponse<SnapshotScheduleResponse>();
|
||||
List<SnapshotScheduleResponse> snapshotScheduleResponses = new ArrayList<SnapshotScheduleResponse>();
|
||||
|
||||
@ -18,8 +18,6 @@ package com.cloud.capacity;
|
||||
|
||||
public enum CapacityState {
|
||||
|
||||
Enabled,
|
||||
Disabled,
|
||||
Maintenance,
|
||||
Enabled, Disabled, Maintenance,
|
||||
|
||||
}
|
||||
|
||||
@ -226,7 +226,8 @@ public interface ConfigurationService {
|
||||
* @throws
|
||||
* @return The new Vlan object
|
||||
*/
|
||||
Vlan createVlanAndPublicIpRange(CreateVlanIpRangeCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, ResourceAllocationException;
|
||||
Vlan createVlanAndPublicIpRange(CreateVlanIpRangeCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException,
|
||||
ResourceAllocationException;
|
||||
|
||||
/**
|
||||
* Marks the the account with the default zone-id.
|
||||
|
||||
@ -29,8 +29,7 @@ import com.cloud.org.Grouping;
|
||||
*/
|
||||
public interface DataCenter extends InfrastructureEntity, Grouping, Identity, InternalIdentity {
|
||||
public enum NetworkType {
|
||||
Basic,
|
||||
Advanced,
|
||||
Basic, Advanced,
|
||||
}
|
||||
|
||||
String getDns1();
|
||||
|
||||
@ -20,14 +20,22 @@ import org.apache.cloudstack.acl.InfrastructureEntity;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface DedicatedResources extends InfrastructureEntity, InternalIdentity, Identity{
|
||||
public interface DedicatedResources extends InfrastructureEntity, InternalIdentity, Identity {
|
||||
long getId();
|
||||
|
||||
Long getDataCenterId();
|
||||
|
||||
Long getPodId();
|
||||
|
||||
Long getClusterId();
|
||||
|
||||
Long getHostId();
|
||||
|
||||
Long getDomainId();
|
||||
|
||||
Long getAccountId();
|
||||
|
||||
String getUuid();
|
||||
|
||||
long getAffinityGroupId();
|
||||
}
|
||||
|
||||
@ -22,8 +22,7 @@ import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface Vlan extends InfrastructureEntity, InternalIdentity, Identity {
|
||||
public enum VlanType {
|
||||
DirectAttached,
|
||||
VirtualNetwork
|
||||
DirectAttached, VirtualNetwork
|
||||
}
|
||||
|
||||
public final static String UNTAGGED = "untagged";
|
||||
@ -44,9 +43,9 @@ public interface Vlan extends InfrastructureEntity, InternalIdentity, Identity {
|
||||
|
||||
public Long getPhysicalNetworkId();
|
||||
|
||||
public String getIp6Gateway();
|
||||
public String getIp6Gateway();
|
||||
|
||||
public String getIp6Cidr();
|
||||
public String getIp6Cidr();
|
||||
|
||||
public String getIp6Range();
|
||||
public String getIp6Range();
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ public class DeployDestination {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
DeployDestination that = (DeployDestination) obj;
|
||||
DeployDestination that = (DeployDestination)obj;
|
||||
if (this._dc == null || that._dc == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -29,10 +29,20 @@ public interface DeploymentClusterPlanner extends DeploymentPlanner {
|
||||
static final String ClusterCPUCapacityDisableThresholdCK = "cluster.cpu.allocated.capacity.disablethreshold";
|
||||
static final String ClusterMemoryCapacityDisableThresholdCK = "cluster.memory.allocated.capacity.disablethreshold";
|
||||
|
||||
static final ConfigKey<Float> ClusterCPUCapacityDisableThreshold = new ConfigKey<Float>(Float.class, ClusterCPUCapacityDisableThresholdCK, "Alert", "0.85",
|
||||
"Percentage (as a value between 0 and 1) of cpu utilization above which allocators will disable using the cluster for low cpu available. Keep the corresponding notification threshold lower than this to be notified beforehand.", true, ConfigKey.Scope.Cluster, null);
|
||||
static final ConfigKey<Float> ClusterMemoryCapacityDisableThreshold = new ConfigKey<Float>(Float.class, ClusterMemoryCapacityDisableThresholdCK, "Alert", "0.85",
|
||||
"Percentage (as a value between 0 and 1) of memory utilization above which allocators will disable using the cluster for low memory available. Keep the corresponding notification threshold lower than this to be notified beforehand.", true, ConfigKey.Scope.Cluster, null);
|
||||
static final ConfigKey<Float> ClusterCPUCapacityDisableThreshold = new ConfigKey<Float>(
|
||||
Float.class,
|
||||
ClusterCPUCapacityDisableThresholdCK,
|
||||
"Alert",
|
||||
"0.85",
|
||||
"Percentage (as a value between 0 and 1) of cpu utilization above which allocators will disable using the cluster for low cpu available. Keep the corresponding notification threshold lower than this to be notified beforehand.",
|
||||
true, ConfigKey.Scope.Cluster, null);
|
||||
static final ConfigKey<Float> ClusterMemoryCapacityDisableThreshold = new ConfigKey<Float>(
|
||||
Float.class,
|
||||
ClusterMemoryCapacityDisableThresholdCK,
|
||||
"Alert",
|
||||
"0.85",
|
||||
"Percentage (as a value between 0 and 1) of memory utilization above which allocators will disable using the cluster for low memory available. Keep the corresponding notification threshold lower than this to be notified beforehand.",
|
||||
true, ConfigKey.Scope.Cluster, null);
|
||||
|
||||
/**
|
||||
* This is called to determine list of possible clusters where a virtual
|
||||
@ -46,10 +56,8 @@ public interface DeploymentClusterPlanner extends DeploymentPlanner {
|
||||
* avoid these data centers, pods, clusters, or hosts.
|
||||
* @return DeployDestination for that virtual machine.
|
||||
*/
|
||||
List<Long> orderClusters(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid)
|
||||
throws InsufficientServerCapacityException;
|
||||
List<Long> orderClusters(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException;
|
||||
|
||||
PlannerResourceUsage getResourceUsage(VirtualMachineProfile vmProfile,
|
||||
DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException;
|
||||
PlannerResourceUsage getResourceUsage(VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException;
|
||||
|
||||
}
|
||||
|
||||
@ -82,11 +82,7 @@ public interface DeploymentPlanner extends Adapter {
|
||||
boolean canHandle(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid);
|
||||
|
||||
public enum AllocationAlgorithm {
|
||||
random,
|
||||
firstfit,
|
||||
userdispersing,
|
||||
userconcentratedpod_random,
|
||||
userconcentratedpod_firstfit;
|
||||
random, firstfit, userdispersing, userconcentratedpod_random, userconcentratedpod_firstfit;
|
||||
}
|
||||
|
||||
public enum PlannerResourceUsage {
|
||||
|
||||
@ -59,7 +59,7 @@ public interface Domain extends OwnedBy, Identity, InternalIdentity {
|
||||
void setState(State state);
|
||||
|
||||
String getNetworkDomain();
|
||||
|
||||
|
||||
public String getUuid();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ TYPE, METHOD })
|
||||
@Target({TYPE, METHOD})
|
||||
@Retention(RUNTIME)
|
||||
public @interface ActionEvent {
|
||||
boolean create() default false;
|
||||
|
||||
@ -24,7 +24,7 @@ import static java.lang.annotation.RetentionPolicy.*;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ TYPE, METHOD })
|
||||
@Target({TYPE, METHOD})
|
||||
@Retention(RUNTIME)
|
||||
public @interface ActionEvents {
|
||||
ActionEvent[] value();
|
||||
|
||||
@ -24,21 +24,26 @@ import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface Event extends ControlledEntity, Identity, InternalIdentity {
|
||||
public enum State {
|
||||
Created,
|
||||
Scheduled,
|
||||
Started,
|
||||
Completed;
|
||||
Created, Scheduled, Started, Completed;
|
||||
}
|
||||
|
||||
String getType();
|
||||
|
||||
State getState();
|
||||
|
||||
String getDescription();
|
||||
|
||||
Date getCreateDate();
|
||||
|
||||
long getUserId();
|
||||
|
||||
int getTotalSize();
|
||||
|
||||
String getLevel();
|
||||
|
||||
long getStartId();
|
||||
|
||||
String getParameters();
|
||||
|
||||
boolean getArchived();
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ public class EventCategory {
|
||||
private static List<EventCategory> eventCategories = new ArrayList<EventCategory>();
|
||||
private String eventCategoryName;
|
||||
|
||||
public EventCategory(String categoryName) {
|
||||
public EventCategory(String categoryName) {
|
||||
this.eventCategoryName = categoryName;
|
||||
eventCategories.add(this);
|
||||
}
|
||||
@ -49,8 +49,8 @@ public class EventCategory {
|
||||
}
|
||||
|
||||
public static final EventCategory ACTION_EVENT = new EventCategory("ActionEvent");
|
||||
public static final EventCategory ALERT_EVENT = new EventCategory("AlertEvent");
|
||||
public static final EventCategory USAGE_EVENT = new EventCategory("UsageEvent");
|
||||
public static final EventCategory ALERT_EVENT = new EventCategory("AlertEvent");
|
||||
public static final EventCategory USAGE_EVENT = new EventCategory("UsageEvent");
|
||||
public static final EventCategory RESOURCE_STATE_CHANGE_EVENT = new EventCategory("ResourceStateEvent");
|
||||
public static final EventCategory ASYNC_JOB_CHANGE_EVENT = new EventCategory("AsyncJobEvent");
|
||||
}
|
||||
|
||||
@ -95,7 +95,6 @@ public class EventTypes {
|
||||
public static final String EVENT_PROXY_REBOOT = "PROXY.REBOOT";
|
||||
public static final String EVENT_PROXY_HA = "PROXY.HA";
|
||||
|
||||
|
||||
// VNC Console Events
|
||||
public static final String EVENT_VNC_CONNECT = "VNC.CONNECT";
|
||||
public static final String EVENT_VNC_DISCONNECT = "VNC.DISCONNECT";
|
||||
@ -122,7 +121,6 @@ public class EventTypes {
|
||||
public static final String EVENT_NIC_DETAIL_UPDATE = "NIC.DETAIL.UPDATE";
|
||||
public static final String EVENT_NIC_DETAIL_REMOVE = "NIC.DETAIL.REMOVE";
|
||||
|
||||
|
||||
// Load Balancers
|
||||
public static final String EVENT_ASSIGN_TO_LOAD_BALANCER_RULE = "LB.ASSIGN.TO.RULE";
|
||||
public static final String EVENT_REMOVE_FROM_LOAD_BALANCER_RULE = "LB.REMOVE.FROM.RULE";
|
||||
@ -195,7 +193,6 @@ public class EventTypes {
|
||||
public static final String EVENT_VOLUME_DETAIL_REMOVE = "VOLUME.DETAIL.REMOVE";
|
||||
public static final String EVENT_VOLUME_UPDATE = "VOLUME.UPDATE";
|
||||
|
||||
|
||||
// Domains
|
||||
public static final String EVENT_DOMAIN_CREATE = "DOMAIN.CREATE";
|
||||
public static final String EVENT_DOMAIN_DELETE = "DOMAIN.DELETE";
|
||||
@ -353,7 +350,6 @@ public class EventTypes {
|
||||
public static final String EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_ENABLE = "SWITCH.MGMT.ENABLE";
|
||||
public static final String EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_DISABLE = "SWITCH.MGMT.DISABLE";
|
||||
|
||||
|
||||
public static final String EVENT_EXTERNAL_FIREWALL_DEVICE_ADD = "PHYSICAL.FIREWALL.ADD";
|
||||
public static final String EVENT_EXTERNAL_FIREWALL_DEVICE_DELETE = "PHYSICAL.FIREWALL.DELETE";
|
||||
public static final String EVENT_EXTERNAL_FIREWALL_DEVICE_CONFIGURE = "PHYSICAL.FIREWALL.CONFIGURE";
|
||||
@ -420,7 +416,6 @@ public class EventTypes {
|
||||
public static final String EVENT_AUTOSCALEVMGROUP_ENABLE = "AUTOSCALEVMGROUP.ENABLE";
|
||||
public static final String EVENT_AUTOSCALEVMGROUP_DISABLE = "AUTOSCALEVMGROUP.DISABLE";
|
||||
|
||||
|
||||
public static final String EVENT_BAREMETAL_DHCP_SERVER_ADD = "PHYSICAL.DHCP.ADD";
|
||||
public static final String EVENT_BAREMETAL_DHCP_SERVER_DELETE = "PHYSICAL.DHCP.DELETE";
|
||||
public static final String EVENT_BAREMETAL_PXE_SERVER_ADD = "PHYSICAL.PXE.ADD";
|
||||
@ -437,9 +432,8 @@ public class EventTypes {
|
||||
|
||||
public static final String EVENT_HOST_RESERVATION_RELEASE = "HOST.RESERVATION.RELEASE";
|
||||
// Dedicated guest vlan range
|
||||
public static final String EVENT_GUEST_VLAN_RANGE_DEDICATE = "GUESTVLANRANGE.DEDICATE";
|
||||
public static final String EVENT_DEDICATED_GUEST_VLAN_RANGE_RELEASE = "GUESTVLANRANGE.RELEASE";
|
||||
|
||||
public static final String EVENT_GUEST_VLAN_RANGE_DEDICATE = "GUESTVLANRANGE.DEDICATE";
|
||||
public static final String EVENT_DEDICATED_GUEST_VLAN_RANGE_RELEASE = "GUESTVLANRANGE.RELEASE";
|
||||
|
||||
public static final String EVENT_PORTABLE_IP_RANGE_CREATE = "PORTABLE.IP.RANGE.CREATE";
|
||||
public static final String EVENT_PORTABLE_IP_RANGE_DELETE = "PORTABLE.IP.RANGE.DELETE";
|
||||
@ -616,9 +610,9 @@ public class EventTypes {
|
||||
|
||||
// VLANs/IP ranges
|
||||
entityEventDetails.put(EVENT_VLAN_IP_RANGE_CREATE, Vlan.class.getName());
|
||||
entityEventDetails.put(EVENT_VLAN_IP_RANGE_DELETE,Vlan.class.getName());
|
||||
entityEventDetails.put(EVENT_VLAN_IP_RANGE_DELETE, Vlan.class.getName());
|
||||
entityEventDetails.put(EVENT_VLAN_IP_RANGE_DEDICATE, Vlan.class.getName());
|
||||
entityEventDetails.put(EVENT_VLAN_IP_RANGE_RELEASE,Vlan.class.getName());
|
||||
entityEventDetails.put(EVENT_VLAN_IP_RANGE_RELEASE, Vlan.class.getName());
|
||||
|
||||
entityEventDetails.put(EVENT_STORAGE_IP_RANGE_CREATE, StorageNetworkIpRange.class.getName());
|
||||
entityEventDetails.put(EVENT_STORAGE_IP_RANGE_DELETE, StorageNetworkIpRange.class.getName());
|
||||
@ -638,13 +632,13 @@ public class EventTypes {
|
||||
entityEventDetails.put(EVENT_SECURITY_GROUP_REMOVE, SecurityGroup.class.getName());
|
||||
|
||||
// Host
|
||||
entityEventDetails.put(EVENT_HOST_RECONNECT, Host.class.getName());
|
||||
entityEventDetails.put(EVENT_HOST_RECONNECT, Host.class.getName());
|
||||
|
||||
// Maintenance
|
||||
entityEventDetails.put(EVENT_MAINTENANCE_CANCEL, Host.class.getName());
|
||||
entityEventDetails.put(EVENT_MAINTENANCE_CANCEL_PRIMARY_STORAGE, Host.class.getName());
|
||||
entityEventDetails.put(EVENT_MAINTENANCE_PREPARE, Host.class.getName());
|
||||
entityEventDetails.put(EVENT_MAINTENANCE_PREPARE_PRIMARY_STORAGE, Host.class.getName());
|
||||
entityEventDetails.put(EVENT_MAINTENANCE_CANCEL, Host.class.getName());
|
||||
entityEventDetails.put(EVENT_MAINTENANCE_CANCEL_PRIMARY_STORAGE, Host.class.getName());
|
||||
entityEventDetails.put(EVENT_MAINTENANCE_PREPARE, Host.class.getName());
|
||||
entityEventDetails.put(EVENT_MAINTENANCE_PREPARE_PRIMARY_STORAGE, Host.class.getName());
|
||||
|
||||
// VPN
|
||||
entityEventDetails.put(EVENT_REMOTE_ACCESS_VPN_CREATE, RemoteAccessVpn.class.getName());
|
||||
@ -667,8 +661,8 @@ public class EventTypes {
|
||||
entityEventDetails.put(EVENT_ENABLE_STATIC_NAT, StaticNat.class.getName());
|
||||
entityEventDetails.put(EVENT_DISABLE_STATIC_NAT, StaticNat.class.getName());
|
||||
|
||||
entityEventDetails.put(EVENT_ZONE_VLAN_ASSIGN,Vlan.class.getName());
|
||||
entityEventDetails.put(EVENT_ZONE_VLAN_RELEASE,Vlan.class.getName());
|
||||
entityEventDetails.put(EVENT_ZONE_VLAN_ASSIGN, Vlan.class.getName());
|
||||
entityEventDetails.put(EVENT_ZONE_VLAN_RELEASE, Vlan.class.getName());
|
||||
|
||||
// Projects
|
||||
entityEventDetails.put(EVENT_PROJECT_CREATE, Project.class.getName());
|
||||
@ -682,7 +676,7 @@ public class EventTypes {
|
||||
entityEventDetails.put(EVENT_PROJECT_ACCOUNT_REMOVE, Project.class.getName());
|
||||
|
||||
// Network as a Service
|
||||
entityEventDetails.put(EVENT_NETWORK_ELEMENT_CONFIGURE,Network.class.getName());
|
||||
entityEventDetails.put(EVENT_NETWORK_ELEMENT_CONFIGURE, Network.class.getName());
|
||||
|
||||
// Physical Network Events
|
||||
entityEventDetails.put(EVENT_PHYSICAL_NETWORK_CREATE, PhysicalNetwork.class.getName());
|
||||
@ -711,7 +705,6 @@ public class EventTypes {
|
||||
entityEventDetails.put(EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_ENABLE, "Nexus1000v");
|
||||
entityEventDetails.put(EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_DISABLE, "Nexus1000v");
|
||||
|
||||
|
||||
entityEventDetails.put(EVENT_EXTERNAL_FIREWALL_DEVICE_ADD, PhysicalNetwork.class.getName());
|
||||
entityEventDetails.put(EVENT_EXTERNAL_FIREWALL_DEVICE_DELETE, PhysicalNetwork.class.getName());
|
||||
entityEventDetails.put(EVENT_EXTERNAL_FIREWALL_DEVICE_CONFIGURE, PhysicalNetwork.class.getName());
|
||||
@ -740,8 +733,8 @@ public class EventTypes {
|
||||
entityEventDetails.put(EVENT_TAGS_DELETE, "tag");
|
||||
|
||||
// external network device events
|
||||
entityEventDetails.put(EVENT_EXTERNAL_NVP_CONTROLLER_ADD, "NvpController");
|
||||
entityEventDetails.put(EVENT_EXTERNAL_NVP_CONTROLLER_DELETE, "NvpController");
|
||||
entityEventDetails.put(EVENT_EXTERNAL_NVP_CONTROLLER_ADD, "NvpController");
|
||||
entityEventDetails.put(EVENT_EXTERNAL_NVP_CONTROLLER_DELETE, "NvpController");
|
||||
entityEventDetails.put(EVENT_EXTERNAL_NVP_CONTROLLER_CONFIGURE, "NvpController");
|
||||
|
||||
// AutoScale
|
||||
@ -764,7 +757,7 @@ public class EventTypes {
|
||||
entityEventDetails.put(EVENT_DEDICATED_GUEST_VLAN_RANGE_RELEASE, GuestVlan.class.getName());
|
||||
}
|
||||
|
||||
public static String getEntityForEvent (String eventName) {
|
||||
public static String getEntityForEvent(String eventName) {
|
||||
String entityClassName = entityEventDetails.get(eventName);
|
||||
if (entityClassName == null || entityClassName.isEmpty()) {
|
||||
return null;
|
||||
@ -772,7 +765,7 @@ public class EventTypes {
|
||||
int index = entityClassName.lastIndexOf(".");
|
||||
String entityName = entityClassName;
|
||||
if (index != -1) {
|
||||
entityName = entityClassName.substring(index+1);
|
||||
entityName = entityClassName.substring(index + 1);
|
||||
}
|
||||
return entityName;
|
||||
}
|
||||
|
||||
@ -24,10 +24,16 @@ public interface UsageEvent extends InternalIdentity {
|
||||
String getType();
|
||||
|
||||
Date getCreateDate();
|
||||
|
||||
long getAccountId();
|
||||
|
||||
Long getSize();
|
||||
|
||||
Long getTemplateId();
|
||||
|
||||
Long getOfferingId();
|
||||
|
||||
long getResourceId();
|
||||
|
||||
long getZoneId();
|
||||
}
|
||||
|
||||
@ -19,9 +19,9 @@ package com.cloud.exception;
|
||||
import com.cloud.exception.CloudException;
|
||||
|
||||
public class AgentControlChannelException extends CloudException {
|
||||
private static final long serialVersionUID = -310647782960500466L;
|
||||
|
||||
public AgentControlChannelException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
private static final long serialVersionUID = -310647782960500466L;
|
||||
|
||||
public AgentControlChannelException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,42 +28,40 @@ import com.cloud.utils.exception.CSExceptionErrorCode;
|
||||
|
||||
public class CloudException extends Exception {
|
||||
|
||||
// This holds a list of uuids and their names. Add uuid:fieldname pairs
|
||||
protected ArrayList<String> idList = new ArrayList<String>();
|
||||
// This holds a list of uuids and their names. Add uuid:fieldname pairs
|
||||
protected ArrayList<String> idList = new ArrayList<String>();
|
||||
|
||||
protected Integer csErrorCode;
|
||||
protected Integer csErrorCode;
|
||||
|
||||
public CloudException(String message) {
|
||||
super(message);
|
||||
setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName()));
|
||||
}
|
||||
public CloudException(String message) {
|
||||
super(message);
|
||||
setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName()));
|
||||
}
|
||||
|
||||
public CloudException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName()));
|
||||
}
|
||||
|
||||
public CloudException() {
|
||||
super();
|
||||
setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName()));
|
||||
}
|
||||
|
||||
public void addProxyObject(String uuid) {
|
||||
idList.add(uuid);
|
||||
return;
|
||||
}
|
||||
|
||||
public CloudException() {
|
||||
super();
|
||||
setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName()));
|
||||
}
|
||||
public ArrayList<String> getIdProxyList() {
|
||||
return idList;
|
||||
}
|
||||
|
||||
public void addProxyObject(String uuid) {
|
||||
idList.add(uuid);
|
||||
return;
|
||||
}
|
||||
public void setCSErrorCode(int cserrcode) {
|
||||
this.csErrorCode = cserrcode;
|
||||
}
|
||||
|
||||
public ArrayList<String> getIdProxyList() {
|
||||
return idList;
|
||||
}
|
||||
|
||||
public void setCSErrorCode(int cserrcode) {
|
||||
this.csErrorCode = cserrcode;
|
||||
}
|
||||
|
||||
public int getCSErrorCode() {
|
||||
return this.csErrorCode;
|
||||
}
|
||||
public int getCSErrorCode() {
|
||||
return this.csErrorCode;
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,7 +56,8 @@ public abstract class InsufficientCapacityException extends CloudException {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
@Override
|
||||
public String toString() {
|
||||
String str = super.toString();
|
||||
return str + "Scope=" + scope + "; id=" + id;
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
package com.cloud.exception;
|
||||
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
public class MissingParameterValueException extends CloudRuntimeException {
|
||||
|
||||
public MissingParameterValueException(String message) {
|
||||
|
||||
@ -16,8 +16,7 @@
|
||||
// under the License.
|
||||
package com.cloud.exception;
|
||||
|
||||
public class NetworkRuleConflictException extends
|
||||
ManagementServerException {
|
||||
public class NetworkRuleConflictException extends ManagementServerException {
|
||||
|
||||
private static final long serialVersionUID = -294905017911859479L;
|
||||
|
||||
|
||||
@ -24,13 +24,13 @@ import com.cloud.utils.SerialVersionUID;
|
||||
*/
|
||||
public class OperationTimedoutException extends CloudException {
|
||||
private static final long serialVersionUID = SerialVersionUID.OperationTimedoutException;
|
||||
|
||||
|
||||
long _agentId;
|
||||
long _seqId;
|
||||
int _time;
|
||||
Command[] _cmds;
|
||||
boolean _isActive;
|
||||
|
||||
|
||||
public OperationTimedoutException(Command[] cmds, long agentId, long seqId, int time, boolean isActive) {
|
||||
super("Commands " + seqId + " to Host " + agentId + " timed out after " + time);
|
||||
_agentId = agentId;
|
||||
@ -39,24 +39,24 @@ public class OperationTimedoutException extends CloudException {
|
||||
_cmds = cmds;
|
||||
_isActive = isActive;
|
||||
}
|
||||
|
||||
|
||||
public long getAgentId() {
|
||||
return _agentId;
|
||||
}
|
||||
|
||||
|
||||
public long getSequenceId() {
|
||||
return _seqId;
|
||||
}
|
||||
|
||||
|
||||
public int getWaitTime() {
|
||||
return _time;
|
||||
}
|
||||
|
||||
|
||||
public Command[] getCommands() {
|
||||
return _cmds;
|
||||
}
|
||||
|
||||
|
||||
public boolean isActive() {
|
||||
return _isActive;
|
||||
return _isActive;
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ public class PermissionDeniedException extends CloudRuntimeException {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public PermissionDeniedException(String message, Throwable cause){
|
||||
public PermissionDeniedException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
|
||||
@ -26,8 +26,7 @@ public class ResourceInUseException extends ManagementServerException {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ResourceInUseException(String message, String resourceType,
|
||||
String resourceName) {
|
||||
public ResourceInUseException(String message, String resourceType, String resourceName) {
|
||||
super(message);
|
||||
this.resourceType = resourceType;
|
||||
this.resourceName = resourceName;
|
||||
|
||||
@ -30,6 +30,7 @@ public class StorageUnavailableException extends ResourceUnavailableException {
|
||||
public StorageUnavailableException(String msg, long poolId) {
|
||||
this(msg, poolId, null);
|
||||
}
|
||||
|
||||
public StorageUnavailableException(String msg, long poolId, Throwable cause) {
|
||||
this(msg, StoragePool.class, poolId, cause);
|
||||
}
|
||||
|
||||
@ -21,11 +21,11 @@ import com.cloud.utils.component.Adapter;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
|
||||
public interface FenceBuilder extends Adapter {
|
||||
/**
|
||||
* Fence off the vm.
|
||||
*
|
||||
* @param vm vm
|
||||
* @param host host where the vm was running on.
|
||||
*/
|
||||
/**
|
||||
* Fence off the vm.
|
||||
*
|
||||
* @param vm vm
|
||||
* @param host host where the vm was running on.
|
||||
*/
|
||||
public Boolean fenceOff(VirtualMachine vm, Host host);
|
||||
}
|
||||
|
||||
@ -25,7 +25,6 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.resource.ResourceState;
|
||||
import com.cloud.utils.fsm.StateObject;
|
||||
|
||||
|
||||
/**
|
||||
* Host represents one particular host server.
|
||||
*/
|
||||
@ -49,6 +48,7 @@ public interface Host extends StateObject<Status>, Identity, InternalIdentity {
|
||||
LocalSecondaryStorage(false),
|
||||
L2Networking(false);
|
||||
boolean _virtual;
|
||||
|
||||
private Type(boolean virtual) {
|
||||
_virtual = virtual;
|
||||
}
|
||||
@ -155,26 +155,32 @@ public interface Host extends StateObject<Status>, Identity, InternalIdentity {
|
||||
* @return disconnection date
|
||||
*/
|
||||
Date getDisconnectedOn();
|
||||
|
||||
/**
|
||||
* @return version
|
||||
*/
|
||||
String getVersion();
|
||||
|
||||
/*
|
||||
* @return total size
|
||||
*/
|
||||
long getTotalSize();
|
||||
|
||||
/*
|
||||
* @return capabilities
|
||||
*/
|
||||
String getCapabilities();
|
||||
|
||||
/*
|
||||
* @return last pinged time
|
||||
*/
|
||||
long getLastPinged();
|
||||
|
||||
/*
|
||||
* @return management server id
|
||||
*/
|
||||
Long getManagementServerId();
|
||||
|
||||
/*
|
||||
*@return removal date
|
||||
*/
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
// under the License.
|
||||
package com.cloud.host;
|
||||
|
||||
|
||||
/**
|
||||
* the networking environment of the host. The
|
||||
* the environment.
|
||||
|
||||
@ -20,12 +20,19 @@ public interface HostStats {
|
||||
|
||||
// host related stats
|
||||
public double getCpuUtilization();
|
||||
|
||||
public double getNetworkWriteKBs();
|
||||
|
||||
public double getTotalMemoryKBs();
|
||||
|
||||
public double getFreeMemoryKBs();
|
||||
|
||||
public double getNetworkReadKBs();
|
||||
|
||||
public String getEntityType();
|
||||
|
||||
public double getUsedMemory();
|
||||
|
||||
public HostStats getHostStats();
|
||||
|
||||
// public double getAverageLoad();
|
||||
|
||||
@ -23,32 +23,27 @@ import com.cloud.utils.fsm.NoTransitionException;
|
||||
import com.cloud.utils.fsm.StateMachine2;
|
||||
|
||||
public enum Status {
|
||||
Creating(true, false, false),
|
||||
Connecting(true, false, false),
|
||||
Up(true, false, false),
|
||||
Down(true, true, true),
|
||||
Disconnected(true, true, true),
|
||||
Alert(true, true, true),
|
||||
Removed(true, false, true),
|
||||
Error(true, false, true),
|
||||
Rebalancing(true, false, true);
|
||||
Creating(true, false, false), Connecting(true, false, false), Up(true, false, false), Down(true, true, true), Disconnected(true, true, true), Alert(true, true, true), Removed(
|
||||
true,
|
||||
false,
|
||||
true), Error(true, false, true), Rebalancing(true, false, true);
|
||||
|
||||
private final boolean updateManagementServer;
|
||||
private final boolean checkManagementServer;
|
||||
private final boolean lostConnection;
|
||||
|
||||
private Status(boolean updateConnection, boolean checkManagementServer, boolean lostConnection) {
|
||||
this.updateManagementServer = updateConnection;
|
||||
this.checkManagementServer = checkManagementServer;
|
||||
this.lostConnection = lostConnection;
|
||||
this.updateManagementServer = updateConnection;
|
||||
this.checkManagementServer = checkManagementServer;
|
||||
this.lostConnection = lostConnection;
|
||||
}
|
||||
|
||||
public boolean updateManagementServer() {
|
||||
return updateManagementServer;
|
||||
return updateManagementServer;
|
||||
}
|
||||
|
||||
public boolean checkManagementServer() {
|
||||
return checkManagementServer;
|
||||
return checkManagementServer;
|
||||
}
|
||||
|
||||
public boolean lostConnection() {
|
||||
@ -74,8 +69,9 @@ public enum Status {
|
||||
|
||||
private final boolean isUserRequest;
|
||||
private final String comment;
|
||||
|
||||
private Event(boolean isUserRequest, String comment) {
|
||||
this.isUserRequest = isUserRequest;
|
||||
this.isUserRequest = isUserRequest;
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
@ -84,7 +80,7 @@ public enum Status {
|
||||
}
|
||||
|
||||
public boolean isUserRequest() {
|
||||
return isUserRequest;
|
||||
return isUserRequest;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ public class Hypervisor {
|
||||
return HypervisorType.VirtualBox;
|
||||
} else if (hypervisor.equalsIgnoreCase("Parralels")) {
|
||||
return HypervisorType.Parralels;
|
||||
}else if (hypervisor.equalsIgnoreCase("BareMetal")) {
|
||||
} else if (hypervisor.equalsIgnoreCase("BareMetal")) {
|
||||
return HypervisorType.BareMetal;
|
||||
} else if (hypervisor.equalsIgnoreCase("Simulator")) {
|
||||
return HypervisorType.Simulator;
|
||||
|
||||
@ -21,18 +21,16 @@ import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
|
||||
|
||||
/**
|
||||
* HypervisorCapability represents one particular hypervisor version's capabilities.
|
||||
*/
|
||||
public interface HypervisorCapabilities extends Identity, InternalIdentity{
|
||||
public interface HypervisorCapabilities extends Identity, InternalIdentity {
|
||||
|
||||
/**
|
||||
* @return type of hypervisor
|
||||
*/
|
||||
HypervisorType getHypervisorType();
|
||||
|
||||
|
||||
String getHypervisorVersion();
|
||||
|
||||
boolean isSecurityGroupEnabled();
|
||||
|
||||
@ -17,32 +17,32 @@
|
||||
package com.cloud.info;
|
||||
|
||||
public class ConsoleProxyLoadInfo {
|
||||
|
||||
private long id;
|
||||
private String name;
|
||||
private int count;
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(int count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
private long id;
|
||||
private String name;
|
||||
private int count;
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(int count) {
|
||||
this.count = count;
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,32 +17,32 @@
|
||||
package com.cloud.info;
|
||||
|
||||
public class RunningHostCountInfo {
|
||||
|
||||
private long dcId;
|
||||
private String hostType;
|
||||
private int count;
|
||||
|
||||
public long getDcId() {
|
||||
return dcId;
|
||||
}
|
||||
|
||||
public void setDcId(long dcId) {
|
||||
this.dcId = dcId;
|
||||
}
|
||||
|
||||
public String getHostType() {
|
||||
return hostType;
|
||||
}
|
||||
|
||||
public void setHostType(String hostType) {
|
||||
this.hostType = hostType;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(int count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
private long dcId;
|
||||
private String hostType;
|
||||
private int count;
|
||||
|
||||
public long getDcId() {
|
||||
return dcId;
|
||||
}
|
||||
|
||||
public void setDcId(long dcId) {
|
||||
this.dcId = dcId;
|
||||
}
|
||||
|
||||
public String getHostType() {
|
||||
return hostType;
|
||||
}
|
||||
|
||||
public void setHostType(String hostType) {
|
||||
this.hostType = hostType;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(int count) {
|
||||
this.count = count;
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,8 +44,7 @@ public interface IpAddress extends ControlledEntity, Identity, InternalIdentity
|
||||
}
|
||||
|
||||
enum Purpose {
|
||||
StaticNat,
|
||||
Lb
|
||||
StaticNat, Lb
|
||||
}
|
||||
|
||||
long getDataCenterId();
|
||||
|
||||
@ -16,27 +16,29 @@
|
||||
// under the License.
|
||||
|
||||
package com.cloud.network;
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
|
||||
/**
|
||||
* Nic represents one nic on the VM.
|
||||
*/
|
||||
public interface MonitoringService extends ControlledEntity, Identity, InternalIdentity {
|
||||
public interface MonitoringService extends ControlledEntity, Identity, InternalIdentity {
|
||||
/**
|
||||
* @return id in the CloudStack database
|
||||
*/
|
||||
enum Service {
|
||||
Dhcp,
|
||||
LoadBalancing,
|
||||
Ssh,
|
||||
Webserver,
|
||||
Dhcp, LoadBalancing, Ssh, Webserver,
|
||||
}
|
||||
|
||||
long getId();
|
||||
|
||||
String getService();
|
||||
|
||||
String getServiceName();
|
||||
|
||||
String getPidFile();
|
||||
|
||||
String getServicePath();
|
||||
}
|
||||
|
||||
@ -36,8 +36,7 @@ import com.cloud.utils.fsm.StateObject;
|
||||
public interface Network extends ControlledEntity, StateObject<Network.State>, InternalIdentity, Identity {
|
||||
|
||||
public enum GuestType {
|
||||
Shared,
|
||||
Isolated
|
||||
Shared, Isolated
|
||||
}
|
||||
|
||||
public static class Service {
|
||||
@ -47,11 +46,10 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
|
||||
public static final Service Dhcp = new Service("Dhcp");
|
||||
public static final Service Dns = new Service("Dns", Capability.AllowDnsSuffixModification);
|
||||
public static final Service Gateway = new Service("Gateway");
|
||||
public static final Service Firewall = new Service("Firewall", Capability.SupportedProtocols,
|
||||
Capability.MultipleIps, Capability.TrafficStatistics, Capability.SupportedTrafficDirection, Capability.SupportedEgressProtocols);
|
||||
public static final Service Lb = new Service("Lb", Capability.SupportedLBAlgorithms, Capability.SupportedLBIsolation,
|
||||
Capability.SupportedProtocols, Capability.TrafficStatistics, Capability.LoadBalancingSupportedIps,
|
||||
Capability.SupportedStickinessMethods, Capability.ElasticLb, Capability.LbSchemes);
|
||||
public static final Service Firewall = new Service("Firewall", Capability.SupportedProtocols, Capability.MultipleIps, Capability.TrafficStatistics,
|
||||
Capability.SupportedTrafficDirection, Capability.SupportedEgressProtocols);
|
||||
public static final Service Lb = new Service("Lb", Capability.SupportedLBAlgorithms, Capability.SupportedLBIsolation, Capability.SupportedProtocols,
|
||||
Capability.TrafficStatistics, Capability.LoadBalancingSupportedIps, Capability.SupportedStickinessMethods, Capability.ElasticLb, Capability.LbSchemes);
|
||||
public static final Service UserData = new Service("UserData");
|
||||
public static final Service SourceNat = new Service("SourceNat", Capability.SupportedSourceNatTypes, Capability.RedundantRouter);
|
||||
public static final Service StaticNat = new Service("StaticNat", Capability.ElasticIp);
|
||||
@ -60,7 +58,6 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
|
||||
public static final Service NetworkACL = new Service("NetworkACL", Capability.SupportedProtocols);
|
||||
public static final Service Connectivity = new Service("Connectivity");
|
||||
|
||||
|
||||
private final String name;
|
||||
private final Capability[] caps;
|
||||
|
||||
@ -82,7 +79,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
|
||||
boolean success = false;
|
||||
if (caps != null) {
|
||||
int length = caps.length;
|
||||
for (int i = 0; i< length; i++) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (caps[i].getName().equalsIgnoreCase(cap.getName())) {
|
||||
success = true;
|
||||
break;
|
||||
@ -102,7 +99,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<Service> listAllServices(){
|
||||
public static List<Service> listAllServices() {
|
||||
return supportedServices;
|
||||
}
|
||||
}
|
||||
@ -207,20 +204,14 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
|
||||
}
|
||||
|
||||
enum Event {
|
||||
ImplementNetwork,
|
||||
DestroyNetwork,
|
||||
OperationSucceeded,
|
||||
OperationFailed;
|
||||
ImplementNetwork, DestroyNetwork, OperationSucceeded, OperationFailed;
|
||||
}
|
||||
|
||||
public enum State {
|
||||
|
||||
Allocated("Indicates the network configuration is in allocated but not setup"),
|
||||
Setup("Indicates the network configuration is setup"),
|
||||
Implementing("Indicates the network configuration is being implemented"),
|
||||
Implemented("Indicates the network configuration is in use"),
|
||||
Shutdown("Indicates the network configuration is being destroyed"),
|
||||
Destroy("Indicates that the network is destroyed");
|
||||
Allocated("Indicates the network configuration is in allocated but not setup"), Setup("Indicates the network configuration is setup"), Implementing(
|
||||
"Indicates the network configuration is being implemented"), Implemented("Indicates the network configuration is in use"), Shutdown(
|
||||
"Indicates the network configuration is being destroyed"), Destroy("Indicates that the network is destroyed");
|
||||
|
||||
protected static final StateMachine2<State, Network.Event, Network> s_fsm = new StateMachine2<State, Network.Event, Network>();
|
||||
|
||||
@ -240,37 +231,38 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
|
||||
}
|
||||
|
||||
String _description;
|
||||
|
||||
private State(String description) {
|
||||
_description = description;
|
||||
}
|
||||
}
|
||||
|
||||
public class IpAddresses {
|
||||
private String ip4Address;
|
||||
private String ip6Address;
|
||||
|
||||
public IpAddresses(String ip4Address, String ip6Address) {
|
||||
setIp4Address(ip4Address);
|
||||
setIp6Address(ip6Address);
|
||||
}
|
||||
private String ip4Address;
|
||||
private String ip6Address;
|
||||
|
||||
public String getIp4Address() {
|
||||
return ip4Address;
|
||||
}
|
||||
public IpAddresses(String ip4Address, String ip6Address) {
|
||||
setIp4Address(ip4Address);
|
||||
setIp6Address(ip6Address);
|
||||
}
|
||||
|
||||
public void setIp4Address(String ip4Address) {
|
||||
this.ip4Address = ip4Address;
|
||||
}
|
||||
public String getIp4Address() {
|
||||
return ip4Address;
|
||||
}
|
||||
|
||||
public String getIp6Address() {
|
||||
return ip6Address;
|
||||
}
|
||||
public void setIp4Address(String ip4Address) {
|
||||
this.ip4Address = ip4Address;
|
||||
}
|
||||
|
||||
public void setIp6Address(String ip6Address) {
|
||||
this.ip6Address = ip6Address;
|
||||
}
|
||||
public String getIp6Address() {
|
||||
return ip6Address;
|
||||
}
|
||||
|
||||
public void setIp6Address(String ip6Address) {
|
||||
this.ip6Address = ip6Address;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String getName();
|
||||
|
||||
Mode getMode();
|
||||
|
||||
@ -39,7 +39,6 @@ import com.cloud.vm.Nic;
|
||||
import com.cloud.vm.NicProfile;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
|
||||
|
||||
/**
|
||||
* The NetworkModel presents a read-only view into the Network data such as L2 networks,
|
||||
* Nics, PublicIps, NetworkOfferings, traffic labels, physical networks and the like
|
||||
@ -143,8 +142,7 @@ public interface NetworkModel {
|
||||
|
||||
boolean areServicesEnabledInZone(long zoneId, NetworkOffering offering, List<Service> services);
|
||||
|
||||
Map<PublicIpAddress, Set<Service>> getIpToServices(List<? extends PublicIpAddress> publicIps, boolean rulesRevoked,
|
||||
boolean includingFirewall);
|
||||
Map<PublicIpAddress, Set<Service>> getIpToServices(List<? extends PublicIpAddress> publicIps, boolean rulesRevoked, boolean includingFirewall);
|
||||
|
||||
Map<Provider, ArrayList<PublicIpAddress>> getProviderToIpList(Network network, Map<PublicIpAddress, Set<Service>> ipToServices);
|
||||
|
||||
@ -239,25 +237,25 @@ public interface NetworkModel {
|
||||
Set<Long> getAvailableIps(Network network, String requestedIp);
|
||||
|
||||
String getDomainNetworkDomain(long domainId, long zoneId);
|
||||
|
||||
|
||||
PublicIpAddress getSourceNatIpAddressForGuestNetwork(Account owner, Network guestNetwork);
|
||||
|
||||
|
||||
boolean isNetworkInlineMode(Network network);
|
||||
|
||||
boolean isIP6AddressAvailableInNetwork(long networkId);
|
||||
boolean isIP6AddressAvailableInNetwork(long networkId);
|
||||
|
||||
boolean isIP6AddressAvailableInVlan(long vlanId);
|
||||
boolean isIP6AddressAvailableInVlan(long vlanId);
|
||||
|
||||
void checkIp6Parameters(String startIPv6, String endIPv6, String ip6Gateway, String ip6Cidr) throws InvalidParameterValueException;
|
||||
void checkIp6Parameters(String startIPv6, String endIPv6, String ip6Gateway, String ip6Cidr) throws InvalidParameterValueException;
|
||||
|
||||
void checkRequestedIpAddresses(long networkId, String ip4, String ip6) throws InvalidParameterValueException;
|
||||
void checkRequestedIpAddresses(long networkId, String ip4, String ip6) throws InvalidParameterValueException;
|
||||
|
||||
String getStartIpv6Address(long id);
|
||||
String getStartIpv6Address(long id);
|
||||
|
||||
boolean isProviderEnabledInZone(long zoneId, String provider);
|
||||
|
||||
Nic getPlaceholderNicForRouter(Network network, Long podId);
|
||||
|
||||
|
||||
IpAddress getPublicIpAddress(String ipAddress, long zoneId);
|
||||
|
||||
List<String> getUsedIpsInNetwork(Network network);
|
||||
|
||||
@ -124,7 +124,6 @@ public class NetworkProfile implements Network {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
@ -267,13 +266,13 @@ public class NetworkProfile implements Network {
|
||||
trafficType = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIp6Gateway() {
|
||||
return ip6Gateway;
|
||||
}
|
||||
@Override
|
||||
public String getIp6Gateway() {
|
||||
return ip6Gateway;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIp6Cidr() {
|
||||
return ip6Cidr;
|
||||
}
|
||||
@Override
|
||||
public String getIp6Cidr() {
|
||||
return ip6Cidr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,5 +24,5 @@ import com.cloud.network.rules.FirewallRule;
|
||||
|
||||
public interface NetworkRuleApplier {
|
||||
public boolean applyRules(Network network, FirewallRule.Purpose purpose, List<? extends FirewallRule> rules) throws ResourceUnavailableException;
|
||||
|
||||
|
||||
}
|
||||
@ -51,25 +51,22 @@ public interface NetworkService {
|
||||
|
||||
List<? extends Network> getIsolatedNetworksOwnedByAccountInZone(long zoneId, Account owner);
|
||||
|
||||
IpAddress allocateIP(Account ipOwner, long zoneId, Long networkId) throws ResourceAllocationException,
|
||||
InsufficientAddressCapacityException, ConcurrentOperationException;
|
||||
IpAddress allocateIP(Account ipOwner, long zoneId, Long networkId) throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException;
|
||||
|
||||
boolean releaseIpAddress(long ipAddressId) throws InsufficientAddressCapacityException;
|
||||
|
||||
IpAddress allocatePortableIP(Account ipOwner, int regionId, Long zoneId, Long networkId, Long vpcId) throws ResourceAllocationException,
|
||||
InsufficientAddressCapacityException, ConcurrentOperationException;
|
||||
IpAddress allocatePortableIP(Account ipOwner, int regionId, Long zoneId, Long networkId, Long vpcId) throws ResourceAllocationException, InsufficientAddressCapacityException,
|
||||
ConcurrentOperationException;
|
||||
|
||||
boolean releasePortableIpAddress(long ipAddressId);
|
||||
|
||||
Network createGuestNetwork(CreateNetworkCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException,
|
||||
ResourceAllocationException;
|
||||
Network createGuestNetwork(CreateNetworkCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException;
|
||||
|
||||
List<? extends Network> searchForNetworks(ListNetworksCmd cmd);
|
||||
|
||||
boolean deleteNetwork(long networkId);
|
||||
|
||||
boolean restartNetwork(RestartNetworkCmd cmd, boolean cleanup) throws ConcurrentOperationException,
|
||||
ResourceUnavailableException, InsufficientCapacityException;
|
||||
boolean restartNetwork(RestartNetworkCmd cmd, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
|
||||
|
||||
int getActiveNicsInNetwork(long networkId);
|
||||
|
||||
@ -79,27 +76,23 @@ public interface NetworkService {
|
||||
|
||||
IpAddress getIp(long id);
|
||||
|
||||
Network updateGuestNetwork(long networkId, String name, String displayText, Account callerAccount, User callerUser,
|
||||
String domainSuffix, Long networkOfferingId, Boolean changeCidr, String guestVmCidr, Boolean displayNetwork);
|
||||
Network updateGuestNetwork(long networkId, String name, String displayText, Account callerAccount, User callerUser, String domainSuffix, Long networkOfferingId,
|
||||
Boolean changeCidr, String guestVmCidr, Boolean displayNetwork);
|
||||
|
||||
PhysicalNetwork createPhysicalNetwork(Long zoneId, String vnetRange, String networkSpeed,
|
||||
List<String> isolationMethods, String broadcastDomainRange, Long domainId, List<String> tags, String name);
|
||||
PhysicalNetwork createPhysicalNetwork(Long zoneId, String vnetRange, String networkSpeed, List<String> isolationMethods, String broadcastDomainRange, Long domainId,
|
||||
List<String> tags, String name);
|
||||
|
||||
Pair<List<? extends PhysicalNetwork>, Integer> searchPhysicalNetworks(Long id, Long zoneId, String keyword,
|
||||
Long startIndex, Long pageSize, String name);
|
||||
Pair<List<? extends PhysicalNetwork>, Integer> searchPhysicalNetworks(Long id, Long zoneId, String keyword, Long startIndex, Long pageSize, String name);
|
||||
|
||||
PhysicalNetwork updatePhysicalNetwork(Long id, String networkSpeed, List<String> tags,
|
||||
String newVnetRangeString, String state);
|
||||
PhysicalNetwork updatePhysicalNetwork(Long id, String networkSpeed, List<String> tags, String newVnetRangeString, String state);
|
||||
|
||||
boolean deletePhysicalNetwork(Long id);
|
||||
|
||||
List<? extends Service> listNetworkServices(String providerName);
|
||||
|
||||
PhysicalNetworkServiceProvider addProviderToPhysicalNetwork(Long physicalNetworkId, String providerName,
|
||||
Long destinationPhysicalNetworkId, List<String> enabledServices);
|
||||
PhysicalNetworkServiceProvider addProviderToPhysicalNetwork(Long physicalNetworkId, String providerName, Long destinationPhysicalNetworkId, List<String> enabledServices);
|
||||
|
||||
Pair<List<? extends PhysicalNetworkServiceProvider>, Integer> listNetworkServiceProviders(Long physicalNetworkId, String name,
|
||||
String state, Long startIndex, Long pageSize);
|
||||
Pair<List<? extends PhysicalNetworkServiceProvider>, Integer> listNetworkServiceProviders(Long physicalNetworkId, String name, String state, Long startIndex, Long pageSize);
|
||||
|
||||
PhysicalNetworkServiceProvider updateNetworkServiceProvider(Long id, String state, List<String> enabledServices);
|
||||
|
||||
@ -115,8 +108,8 @@ public interface NetworkService {
|
||||
|
||||
long findPhysicalNetworkId(long zoneId, String tag, TrafficType trafficType);
|
||||
|
||||
PhysicalNetworkTrafficType addTrafficTypeToPhysicalNetwork(Long physicalNetworkId, String trafficType,
|
||||
String xenLabel, String kvmLabel, String vmwareLabel, String simulatorLabel, String vlan, String hypervLabel);
|
||||
PhysicalNetworkTrafficType addTrafficTypeToPhysicalNetwork(Long physicalNetworkId, String trafficType, String xenLabel, String kvmLabel, String vmwareLabel,
|
||||
String simulatorLabel, String vlan, String hypervLabel);
|
||||
|
||||
PhysicalNetworkTrafficType getPhysicalNetworkTrafficType(Long id);
|
||||
|
||||
@ -132,14 +125,11 @@ public interface NetworkService {
|
||||
|
||||
Pair<List<? extends PhysicalNetworkTrafficType>, Integer> listTrafficTypes(Long physicalNetworkId);
|
||||
|
||||
|
||||
Network getExclusiveGuestNetwork(long zoneId);
|
||||
|
||||
List<Pair<TrafficType, String>> listTrafficTypeImplementor(ListTrafficTypeImplementorsCmd cmd);
|
||||
|
||||
List<? extends Network> getIsolatedNetworksWithSourceNATOwnedByAccountInZone(long zoneId, Account owner);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param networkId
|
||||
@ -150,8 +140,8 @@ public interface NetworkService {
|
||||
* @throws ResourceAllocationException
|
||||
* @throws InsufficientAddressCapacityException
|
||||
*/
|
||||
IpAddress associateIPToNetwork(long ipId, long networkId) throws InsufficientAddressCapacityException,
|
||||
ResourceAllocationException, ResourceUnavailableException, ConcurrentOperationException;
|
||||
IpAddress associateIPToNetwork(long ipId, long networkId) throws InsufficientAddressCapacityException, ResourceAllocationException, ResourceUnavailableException,
|
||||
ConcurrentOperationException;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -171,13 +161,11 @@ public interface NetworkService {
|
||||
* @throws ConcurrentOperationException
|
||||
* @throws ResourceAllocationException
|
||||
*/
|
||||
Network createPrivateNetwork(String networkName, String displayText, long physicalNetworkId, String broadcastUri,
|
||||
String startIp, String endIP, String gateway, String netmask, long networkOwnerId, Long vpcId, Boolean sourceNat, Long networkOfferingId)
|
||||
throws ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException;
|
||||
Network createPrivateNetwork(String networkName, String displayText, long physicalNetworkId, String broadcastUri, String startIp, String endIP, String gateway, String netmask,
|
||||
long networkOwnerId, Long vpcId, Boolean sourceNat, Long networkOfferingId) throws ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException;
|
||||
|
||||
/* Requests an IP address for the guest nic */
|
||||
NicSecondaryIp allocateSecondaryGuestIP(Account account, long zoneId, Long nicId,
|
||||
Long networkId, String ipaddress) throws InsufficientAddressCapacityException;
|
||||
NicSecondaryIp allocateSecondaryGuestIP(Account account, long zoneId, Long nicId, Long networkId, String ipaddress) throws InsufficientAddressCapacityException;
|
||||
|
||||
boolean releaseSecondaryIpFromNic(long ipAddressId);
|
||||
|
||||
|
||||
@ -28,8 +28,7 @@ import com.cloud.utils.exception.CloudRuntimeException;
|
||||
public class Networks {
|
||||
|
||||
public enum RouterPrivateIpStrategy {
|
||||
None,
|
||||
DcGlobal, // global to data center
|
||||
None, DcGlobal, // global to data center
|
||||
HostLocal;
|
||||
|
||||
public static String DummyPrivateIp = "169.254.1.1";
|
||||
@ -39,16 +38,11 @@ public class Networks {
|
||||
* Different ways to assign ip address to this network.
|
||||
*/
|
||||
public enum Mode {
|
||||
None,
|
||||
Static,
|
||||
Dhcp,
|
||||
ExternalDhcp;
|
||||
None, Static, Dhcp, ExternalDhcp;
|
||||
};
|
||||
|
||||
public enum AddressFormat {
|
||||
Ip4,
|
||||
Ip6,
|
||||
DualStack
|
||||
Ip4, Ip6, DualStack
|
||||
}
|
||||
|
||||
/**
|
||||
@ -78,23 +72,17 @@ public class Networks {
|
||||
else
|
||||
return new URI("vlan://" + value.toString());
|
||||
} catch (URISyntaxException e) {
|
||||
throw new CloudRuntimeException(
|
||||
"Unable to convert to broadcast URI: " + value);
|
||||
throw new CloudRuntimeException("Unable to convert to broadcast URI: " + value);
|
||||
}
|
||||
}
|
||||
},
|
||||
Vswitch("vs", String.class),
|
||||
LinkLocal(null, null),
|
||||
Vnet("vnet", Long.class),
|
||||
Storage("storage", Integer.class),
|
||||
Lswitch("lswitch", String.class) {
|
||||
Vswitch("vs", String.class), LinkLocal(null, null), Vnet("vnet", Long.class), Storage("storage", Integer.class), Lswitch("lswitch", String.class) {
|
||||
@Override
|
||||
public <T> URI toUri(T value) {
|
||||
try {
|
||||
return new URI("lswitch", value.toString(), null, null);
|
||||
} catch (URISyntaxException e) {
|
||||
throw new CloudRuntimeException(
|
||||
"Unable to convert to broadcast URI: " + value);
|
||||
throw new CloudRuntimeException("Unable to convert to broadcast URI: " + value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,10 +94,7 @@ public class Networks {
|
||||
return uri.getSchemeSpecificPart();
|
||||
}
|
||||
},
|
||||
Mido("mido", String.class),
|
||||
Pvlan("pvlan", String.class),
|
||||
Vxlan("vxlan", Long.class),
|
||||
UnDecided(null, null);
|
||||
Mido("mido", String.class), Pvlan("pvlan", String.class), Vxlan("vxlan", Long.class), UnDecided(null, null);
|
||||
|
||||
private final String scheme;
|
||||
private final Class<?> type;
|
||||
@ -145,8 +130,7 @@ public class Networks {
|
||||
try {
|
||||
return new URI(scheme + "://" + value.toString());
|
||||
} catch (URISyntaxException e) {
|
||||
throw new CloudRuntimeException(
|
||||
"Unable to convert to broadcast URI: " + value);
|
||||
throw new CloudRuntimeException("Unable to convert to broadcast URI: " + value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -167,8 +151,7 @@ public class Networks {
|
||||
* @return the scheme as BroadcastDomainType
|
||||
* @throws URISyntaxException when the string can not be converted to URI
|
||||
*/
|
||||
public static BroadcastDomainType getTypeOf(String str)
|
||||
throws URISyntaxException {
|
||||
public static BroadcastDomainType getTypeOf(String str) throws URISyntaxException {
|
||||
if (com.cloud.dc.Vlan.UNTAGGED.equalsIgnoreCase(str)) {
|
||||
return Native;
|
||||
}
|
||||
@ -223,8 +206,7 @@ public class Networks {
|
||||
* @return depending on the scheme/BroadcastDomainType
|
||||
* @throws URISyntaxException the string is not even an uri
|
||||
*/
|
||||
public static String getValue(String uriString)
|
||||
throws URISyntaxException {
|
||||
public static String getValue(String uriString) throws URISyntaxException {
|
||||
return getValue(new URI(uriString));
|
||||
}
|
||||
|
||||
@ -260,17 +242,10 @@ public class Networks {
|
||||
* Different types of network traffic in the data center.
|
||||
*/
|
||||
public enum TrafficType {
|
||||
None,
|
||||
Public,
|
||||
Guest,
|
||||
Storage,
|
||||
Management,
|
||||
Control,
|
||||
Vpn;
|
||||
None, Public, Guest, Storage, Management, Control, Vpn;
|
||||
|
||||
public static boolean isSystemNetwork(TrafficType trafficType) {
|
||||
if (Storage.equals(trafficType) || Management.equals(trafficType)
|
||||
|| Control.equals(trafficType)) {
|
||||
if (Storage.equals(trafficType) || Management.equals(trafficType) || Control.equals(trafficType)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -296,9 +271,7 @@ public class Networks {
|
||||
};
|
||||
|
||||
public enum IsolationType {
|
||||
None(null, null),
|
||||
Ec2("ec2", String.class),
|
||||
Vlan("vlan", Integer.class) {
|
||||
None(null, null), Ec2("ec2", String.class), Vlan("vlan", Integer.class) {
|
||||
@Override
|
||||
public <T> URI toUri(T value) {
|
||||
try {
|
||||
@ -307,14 +280,11 @@ public class Networks {
|
||||
else
|
||||
return new URI("vlan", value.toString(), null, null);
|
||||
} catch (URISyntaxException e) {
|
||||
throw new CloudRuntimeException(
|
||||
"Unable to convert to isolation URI: " + value);
|
||||
throw new CloudRuntimeException("Unable to convert to isolation URI: " + value);
|
||||
}
|
||||
}
|
||||
},
|
||||
Vswitch("vs", String.class),
|
||||
Undecided(null, null),
|
||||
Vnet("vnet", Long.class);
|
||||
Vswitch("vs", String.class), Undecided(null, null), Vnet("vnet", Long.class);
|
||||
|
||||
private final String scheme;
|
||||
private final Class<?> type;
|
||||
@ -336,15 +306,13 @@ public class Networks {
|
||||
try {
|
||||
return new URI(scheme + "://" + value.toString());
|
||||
} catch (URISyntaxException e) {
|
||||
throw new CloudRuntimeException(
|
||||
"Unable to convert to isolation type URI: " + value);
|
||||
throw new CloudRuntimeException("Unable to convert to isolation type URI: " + value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum BroadcastScheme {
|
||||
Vlan("vlan"),
|
||||
VSwitch("vswitch");
|
||||
Vlan("vlan"), VSwitch("vswitch");
|
||||
|
||||
private final String scheme;
|
||||
|
||||
|
||||
@ -28,24 +28,15 @@ import org.apache.cloudstack.api.InternalIdentity;
|
||||
public interface PhysicalNetwork extends Identity, InternalIdentity {
|
||||
|
||||
public enum State {
|
||||
Disabled,
|
||||
Enabled;
|
||||
Disabled, Enabled;
|
||||
}
|
||||
|
||||
public enum IsolationMethod {
|
||||
VLAN,
|
||||
L3,
|
||||
GRE,
|
||||
STT,
|
||||
VNS,
|
||||
MIDO,
|
||||
SSP,
|
||||
VXLAN;
|
||||
VLAN, L3, GRE, STT, VNS, MIDO, SSP, VXLAN;
|
||||
}
|
||||
|
||||
public enum BroadcastDomainRange {
|
||||
POD,
|
||||
ZONE;
|
||||
POD, ZONE;
|
||||
}
|
||||
|
||||
BroadcastDomainRange getBroadcastDomainRange();
|
||||
@ -62,7 +53,7 @@ public interface PhysicalNetwork extends Identity, InternalIdentity {
|
||||
|
||||
Long getDomainId();
|
||||
|
||||
List<Pair<Integer,Integer>> getVnet();
|
||||
List<Pair<Integer, Integer>> getVnet();
|
||||
|
||||
String getVnetString();
|
||||
|
||||
|
||||
@ -28,9 +28,7 @@ import com.cloud.network.Network.Service;
|
||||
public interface PhysicalNetworkServiceProvider extends InternalIdentity {
|
||||
|
||||
public enum State {
|
||||
Disabled,
|
||||
Enabled,
|
||||
Shutdown;
|
||||
Disabled, Enabled, Shutdown;
|
||||
}
|
||||
|
||||
long getId();
|
||||
|
||||
@ -37,6 +37,6 @@ public interface PhysicalNetworkTrafficType extends InternalIdentity, Identity {
|
||||
String getVmwareNetworkLabel();
|
||||
|
||||
String getSimulatorNetworkLabel();
|
||||
|
||||
|
||||
String getHypervNetworkLabel();
|
||||
}
|
||||
|
||||
@ -22,16 +22,20 @@ import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface RemoteAccessVpn extends ControlledEntity, InternalIdentity, Identity {
|
||||
enum State {
|
||||
Added,
|
||||
Running,
|
||||
Removed
|
||||
Added, Running, Removed
|
||||
}
|
||||
|
||||
long getServerAddressId();
|
||||
|
||||
String getIpRange();
|
||||
|
||||
String getIpsecPresharedKey();
|
||||
|
||||
String getLocalIp();
|
||||
|
||||
Long getNetworkId();
|
||||
|
||||
Long getVpcId();
|
||||
|
||||
State getState();
|
||||
}
|
||||
|
||||
@ -24,13 +24,22 @@ import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface Site2SiteCustomerGateway extends ControlledEntity, Identity, InternalIdentity {
|
||||
public String getGatewayIp();
|
||||
|
||||
public String getGuestCidrList();
|
||||
|
||||
public String getIpsecPsk();
|
||||
|
||||
public String getIkePolicy();
|
||||
|
||||
public String getEspPolicy();
|
||||
|
||||
public Long getIkeLifetime();
|
||||
|
||||
public Long getEspLifetime();
|
||||
|
||||
public Boolean getDpd();
|
||||
|
||||
public Date getRemoved();
|
||||
|
||||
String getName();
|
||||
}
|
||||
|
||||
@ -23,17 +23,22 @@ import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface Site2SiteVpnConnection extends ControlledEntity, InternalIdentity {
|
||||
enum State {
|
||||
Pending,
|
||||
Connected,
|
||||
Disconnected,
|
||||
Error,
|
||||
Pending, Connected, Disconnected, Error,
|
||||
}
|
||||
|
||||
public long getId();
|
||||
|
||||
public String getUuid();
|
||||
|
||||
public long getVpnGatewayId();
|
||||
|
||||
public long getCustomerGatewayId();
|
||||
|
||||
public State getState();
|
||||
|
||||
public Date getCreated();
|
||||
|
||||
public Date getRemoved();
|
||||
|
||||
public boolean isPassive();
|
||||
}
|
||||
|
||||
@ -24,6 +24,8 @@ import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface Site2SiteVpnGateway extends ControlledEntity, Identity, InternalIdentity {
|
||||
public long getAddrId();
|
||||
|
||||
public long getVpcId();
|
||||
|
||||
public Date getRemoved();
|
||||
}
|
||||
|
||||
@ -41,12 +41,12 @@ public interface UserIpv6Address extends ControlledEntity, Identity, InternalIde
|
||||
State getState();
|
||||
|
||||
Long getNetworkId();
|
||||
|
||||
|
||||
Long getSourceNetworkId();
|
||||
|
||||
Long getPhysicalNetworkId();
|
||||
|
||||
void setState(UserIpv6Address.State state);
|
||||
|
||||
|
||||
String getMacAddress();
|
||||
}
|
||||
|
||||
@ -35,8 +35,7 @@ public interface VirtualNetworkApplianceService {
|
||||
* the command specifying router's id
|
||||
* @return DomainRouter object
|
||||
*/
|
||||
VirtualRouter startRouter(long routerId, boolean reprogramNetwork) throws ConcurrentOperationException,
|
||||
ResourceUnavailableException, InsufficientCapacityException;
|
||||
VirtualRouter startRouter(long routerId, boolean reprogramNetwork) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
|
||||
|
||||
/**
|
||||
* Reboots domain router
|
||||
@ -45,8 +44,7 @@ public interface VirtualNetworkApplianceService {
|
||||
* the command specifying router's id
|
||||
* @return router if successful
|
||||
*/
|
||||
VirtualRouter rebootRouter(long routerId, boolean reprogramNetwork) throws ConcurrentOperationException,
|
||||
ResourceUnavailableException, InsufficientCapacityException;
|
||||
VirtualRouter rebootRouter(long routerId, boolean reprogramNetwork) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
|
||||
|
||||
VirtualRouter upgradeRouter(UpgradeRouterCmd cmd);
|
||||
|
||||
@ -66,7 +64,7 @@ public interface VirtualNetworkApplianceService {
|
||||
VirtualRouter startRouter(long id) throws ResourceUnavailableException, InsufficientCapacityException, ConcurrentOperationException;
|
||||
|
||||
VirtualRouter destroyRouter(long routerId, Account caller, Long callerUserId) throws ResourceUnavailableException, ConcurrentOperationException;
|
||||
|
||||
|
||||
VirtualRouter findRouter(long routerId);
|
||||
|
||||
List<Long> upgradeRouterTemplate(UpgradeRouterTemplateCmd cmd);
|
||||
|
||||
@ -21,10 +21,7 @@ import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface VirtualRouterProvider extends InternalIdentity, Identity {
|
||||
public enum Type {
|
||||
VirtualRouter,
|
||||
ElasticLoadBalancerVm,
|
||||
VPCVirtualRouter,
|
||||
InternalLbVm
|
||||
VirtualRouter, ElasticLoadBalancerVm, VPCVirtualRouter, InternalLbVm
|
||||
}
|
||||
|
||||
public Type getType();
|
||||
|
||||
@ -21,7 +21,7 @@ import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.router.VirtualRouter;
|
||||
|
||||
public interface VpcVirtualNetworkApplianceService extends VirtualNetworkApplianceService{
|
||||
public interface VpcVirtualNetworkApplianceService extends VirtualNetworkApplianceService {
|
||||
|
||||
/**
|
||||
* @param router
|
||||
@ -32,8 +32,8 @@ public interface VpcVirtualNetworkApplianceService extends VirtualNetworkApplian
|
||||
* @throws ResourceUnavailableException
|
||||
* @throws InsufficientCapacityException
|
||||
*/
|
||||
boolean addVpcRouterToGuestNetwork(VirtualRouter router, Network network, boolean isRedundant)
|
||||
throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
|
||||
boolean addVpcRouterToGuestNetwork(VirtualRouter router, Network network, boolean isRedundant) throws ConcurrentOperationException, ResourceUnavailableException,
|
||||
InsufficientCapacityException;
|
||||
|
||||
/**
|
||||
* @param router
|
||||
@ -43,7 +43,6 @@ public interface VpcVirtualNetworkApplianceService extends VirtualNetworkApplian
|
||||
* @throws ConcurrentOperationException
|
||||
* @throws ResourceUnavailableException
|
||||
*/
|
||||
boolean removeVpcRouterFromGuestNetwork(VirtualRouter router, Network network, boolean isRedundant)
|
||||
throws ConcurrentOperationException, ResourceUnavailableException;
|
||||
boolean removeVpcRouterFromGuestNetwork(VirtualRouter router, Network network, boolean isRedundant) throws ConcurrentOperationException, ResourceUnavailableException;
|
||||
|
||||
}
|
||||
|
||||
@ -22,9 +22,7 @@ import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface VpnUser extends ControlledEntity, InternalIdentity, Identity {
|
||||
enum State {
|
||||
Add,
|
||||
Revoke,
|
||||
Active
|
||||
Add, Revoke, Active
|
||||
}
|
||||
|
||||
String getUsername();
|
||||
|
||||
@ -50,8 +50,7 @@ public class AutoScaleCounter {
|
||||
@SerializedName("description")
|
||||
private String _description;
|
||||
|
||||
public AutoScaleCounterParam(String name, Boolean required,
|
||||
String description, Boolean flag) {
|
||||
public AutoScaleCounterParam(String name, Boolean required, String description, Boolean flag) {
|
||||
this._paramName = name;
|
||||
this._required = required;
|
||||
this._description = description;
|
||||
|
||||
@ -20,7 +20,6 @@ package com.cloud.network.as;
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
|
||||
public interface AutoScaleVmGroup extends ControlledEntity, InternalIdentity {
|
||||
|
||||
String State_New = "new";
|
||||
|
||||
@ -23,8 +23,7 @@ import org.apache.cloudstack.api.InternalIdentity;
|
||||
public interface Counter extends InternalIdentity, Identity {
|
||||
|
||||
public static enum Source {
|
||||
netscaler,
|
||||
snmp
|
||||
netscaler, snmp
|
||||
}
|
||||
|
||||
String getName();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user