Reformat all source code. Added checkstyle to check the source code

This commit is contained in:
Alex Huang 2013-11-20 07:26:53 -08:00
parent 31758ed8d0
commit 8d62744681
4339 changed files with 867376 additions and 1045042 deletions

View File

@ -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")
);
_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"));
}
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() {
@ -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());
}
@ -455,11 +453,11 @@ public class Agent implements HandlerFactory, IAgentControl {
}
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;
@ -469,7 +467,7 @@ public class Agent implements HandlerFactory, IAgentControl {
System.exit(1);
return;
} else if (cmd instanceof MaintainCommand) {
s_logger.debug("Received maintainCommand" );
s_logger.debug("Received maintainCommand");
cancelTasks();
_reconnectAllowed = false;
answer = new MaintainAnswer((MaintainCommand)cmd);
@ -477,7 +475,7 @@ public class Agent implements HandlerFactory, IAgentControl {
answer = null;
synchronized (_controlListeners) {
for (IAgentControlListener listener : _controlListeners) {
answer = listener.processControlRequest(request, (AgentControlCommand) cmd);
answer = listener.processControlRequest(request, (AgentControlCommand)cmd);
if (answer != null) {
break;
}
@ -549,7 +547,7 @@ 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 {
@ -557,10 +555,9 @@ public class Agent implements HandlerFactory, IAgentControl {
}
}
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) {
@ -596,7 +593,7 @@ public class Agent implements HandlerFactory, IAgentControl {
}
} 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);
}
@ -788,7 +785,7 @@ public class Agent implements HandlerFactory, IAgentControl {
}
cancelled = true;
_startup = null;
_startupWait = _startupWaitDefault *2;
_startupWait = _startupWaitDefault * 2;
reconnect(_link);
}
}
@ -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());

View File

@ -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");
@ -310,7 +303,7 @@ public class AgentShell implements IAgentShell, Daemon {
// For KVM agent, do it specially here
File file = new File("/etc/cloudstack/agent/log4j-cloud.xml");
if(!file.exists()) {
if (!file.exists()) {
file = PropertiesUtil.findConfigFile("log4j-cloud.xml");
}
DOMConfigurator.configureAndWatch(file.getAbsolutePath());
@ -320,8 +313,7 @@ public class AgentShell implements IAgentShell, Daemon {
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,7 +322,7 @@ 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);
}
}
@ -341,8 +333,7 @@ public class AgentShell implements IAgentShell, Daemon {
// 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);

View File

@ -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;
}
}

View File

@ -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) {

View File

@ -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);
}

View File

@ -33,8 +33,7 @@ public class MockVm {
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;

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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,16 +98,16 @@ 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);
}
@ -122,8 +121,7 @@ public class ConsoleProxyResource extends ServerResourceBase implements
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);
}
}
@ -355,16 +324,12 @@ public class ConsoleProxyResource extends ServerResourceBase implements
Class<?> consoleProxyClazz = Class.forName("com.cloud.consoleproxy.ConsoleProxy");
try {
s_logger.info("Invoke setEncryptorPassword(), ecnryptorPassword: " + encryptorPassword);
Method methodSetup = consoleProxyClazz.getMethod(
"setEncryptorPassword", String.class);
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);
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());
@ -418,11 +383,9 @@ public class ConsoleProxyResource extends ServerResourceBase implements
}
}
public String authenticateConsoleAccess(String host, String port,
String vmId, String sid, String ticket, Boolean isReauthentication) {
public String authenticateConsoleAccess(String host, String port, String vmId, String sid, String ticket, Boolean isReauthentication) {
ConsoleAccessAuthenticationCommand cmd = new ConsoleAccessAuthenticationCommand(
host, port, vmId, sid, ticket);
ConsoleAccessAuthenticationCommand cmd = new ConsoleAccessAuthenticationCommand(host, port, vmId, sid, ticket);
cmd.setReauthenticating(isReauthentication);
ConsoleProxyAuthenticationResult result = new ConsoleProxyAuthenticationResult();
@ -443,44 +406,36 @@ 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);
}
}
}

View File

@ -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();

View File

@ -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");

View File

@ -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;

View File

@ -22,9 +22,9 @@ import com.cloud.utils.net.NetUtils;
public class PvlanSetupCommand extends Command {
public enum Type {
DHCP,
VM
DHCP, VM
}
private String op;
private String primary;
private String isolated;
@ -35,10 +35,10 @@ public class PvlanSetupCommand extends Command {
private Type type;
private String networkTag;
protected PvlanSetupCommand() {}
protected PvlanSetupCommand() {
}
protected PvlanSetupCommand(Type type, String op, URI uri, String networkTag)
{
protected PvlanSetupCommand(Type type, String op, URI uri, String networkTag) {
this.type = type;
this.op = op;
this.primary = NetUtils.getPrimaryPvlanFromUri(uri);
@ -46,8 +46,7 @@ public class PvlanSetupCommand extends Command {
this.networkTag = networkTag;
}
static public PvlanSetupCommand createDhcpSetup(String op, URI uri, String networkTag, String dhcpName, String dhcpMac, String dhcpIp)
{
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);
@ -55,8 +54,7 @@ public class PvlanSetupCommand extends Command {
return cmd;
}
static public PvlanSetupCommand createVmSetup(String op, URI uri, String networkTag, String 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;

View File

@ -34,9 +34,7 @@ public class StoragePoolInfo {
super();
}
public StoragePoolInfo(String uuid, String host, String hostPath,
String localPath, StoragePoolType poolType, long capacityBytes,
long availableBytes) {
public StoragePoolInfo(String uuid, String host, String hostPath, String localPath, StoragePoolType poolType, long capacityBytes, long availableBytes) {
super();
this.uuid = uuid;
this.host = host;
@ -47,9 +45,8 @@ public class StoragePoolInfo {
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;
}
@ -57,6 +54,7 @@ public class StoragePoolInfo {
public long getCapacityBytes() {
return capacityBytes;
}
public long getAvailableBytes() {
return availableBytes;
}
@ -64,15 +62,19 @@ public class StoragePoolInfo {
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;
}

View File

@ -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

View File

@ -49,12 +49,12 @@ public class CreateVolumeOVACommand extends Command {
public String getVolName() {
return this.volName;
}
public String getSecondaryStorageUrl() {
return this.secUrl;
}
public StorageFilerTO getPool() {
return pool;
}
}

View File

@ -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;
}

View File

@ -44,5 +44,3 @@ public class PrepareOVAPackingCommand extends Command {
}
}

View File

@ -19,7 +19,5 @@
package com.cloud.agent.api.to;
public enum DataObjectType {
VOLUME,
SNAPSHOT,
TEMPLATE
VOLUME, SNAPSHOT, TEMPLATE
}

View File

@ -22,6 +22,8 @@ import com.cloud.storage.DataStoreRole;
public interface DataStoreTO {
DataStoreRole getRole();
String getUuid();
String getUrl();
}

View File

@ -22,8 +22,11 @@ import com.cloud.hypervisor.Hypervisor;
public interface DataTO {
public DataObjectType getObjectType();
public DataStoreTO getDataStore();
public Hypervisor.HypervisorType getHypervisorType();
/**
* @return
*/

View File

@ -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;
}

View File

@ -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;
}
@ -151,11 +233,11 @@ public class FirewallRuleTO implements InternalIdentity {
return srcPortRange;
}
public Integer getIcmpType(){
public Integer getIcmpType() {
return icmpType;
}
public Integer getIcmpCode(){
public Integer getIcmpCode() {
return icmpCode;
}

View File

@ -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;
}

View File

@ -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,9 +106,8 @@ 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());
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;
@ -190,7 +184,7 @@ public class LoadBalancerTO {
return this.autoScaleVmGroupTO != null;
}
public LbSslCert getSslCert(){
public LbSslCert getSslCert() {
return this.sslCert;
}
@ -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(),
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());
}
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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;

View File

@ -24,7 +24,7 @@ public class NicTO extends NetworkTO {
Integer networkRateMulticastMbps;
boolean defaultNic;
String uuid;
List <String> nicSecIps;
List<String> nicSecIps;
public NicTO() {
super();

View File

@ -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() {

View File

@ -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,18 +271,18 @@ 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;
}
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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,6 +152,7 @@ public class VirtualMachineTO {
public Integer getMaxSpeed() {
return maxSpeed;
}
public boolean getLimitCpuUse() {
return limitCpuUse;
}
@ -263,5 +266,4 @@ public class VirtualMachineTO {
this.uuid = uuid;
}
}

View File

@ -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;
@ -135,7 +136,7 @@ public class VolumeTO implements InternalIdentity {
return guestOsType;
}
public void setPath(String path){
public void setPath(String path) {
this.path = path;
}

View File

@ -99,8 +99,8 @@ 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;

View File

@ -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();
}

View File

@ -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>();

View File

@ -18,8 +18,6 @@ package com.cloud.capacity;
public enum CapacityState {
Enabled,
Disabled,
Maintenance,
Enabled, Disabled, Maintenance,
}

View File

@ -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.

View File

@ -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();

View File

@ -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();
}

View File

@ -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";

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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 {

View File

@ -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;

View File

@ -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();

View File

@ -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();
}

View File

@ -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";
@ -440,7 +435,6 @@ public class EventTypes {
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";
public static final String EVENT_PORTABLE_IP_TRANSFER = "PORTABLE.IP.TRANSFER";
@ -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());
@ -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());
@ -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;
}

View File

@ -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();
}

View File

@ -43,8 +43,6 @@ public class CloudException extends Exception {
setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName()));
}
public CloudException() {
super();
setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName()));

View File

@ -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;
}

View File

@ -17,6 +17,7 @@
package com.cloud.exception;
import com.cloud.utils.exception.CloudRuntimeException;
public class MissingParameterValueException extends CloudRuntimeException {
public MissingParameterValueException(String message) {

View File

@ -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;

View File

@ -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);
}

View File

@ -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;

View File

@ -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);
}

View File

@ -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
*/

View File

@ -16,7 +16,6 @@
// under the License.
package com.cloud.host;
/**
* the networking environment of the host. The
* the environment.

View File

@ -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();

View File

@ -23,15 +23,10 @@ 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;
@ -74,6 +69,7 @@ public enum Status {
private final boolean isUserRequest;
private final String comment;
private Event(boolean isUserRequest, String comment) {
this.isUserRequest = isUserRequest;
this.comment = comment;

View File

@ -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;

View File

@ -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();

View File

@ -44,8 +44,7 @@ public interface IpAddress extends ControlledEntity, Identity, InternalIdentity
}
enum Purpose {
StaticNat,
Lb
StaticNat, Lb
}
long getDataCenterId();

View File

@ -16,11 +16,11 @@
// 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.
*/
@ -29,14 +29,16 @@ public interface MonitoringService extends ControlledEntity, Identity, Internal
* @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();
}

View File

@ -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,6 +231,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
}
String _description;
private State(String description) {
_description = description;
}

View File

@ -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);

View File

@ -124,7 +124,6 @@ public class NetworkProfile implements Network {
return id;
}
@Override
public String getUuid() {
return uuid;

View File

@ -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,15 +125,12 @@ 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
* @param entityId
@ -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);

View File

@ -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;

View File

@ -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();

View File

@ -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();

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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);

View File

@ -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();

View File

@ -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;
}

View File

@ -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();

View File

@ -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;

View File

@ -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";

View File

@ -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();

View File

@ -27,7 +27,11 @@ import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
public interface DhcpServiceProvider extends NetworkElement {
boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
boolean configDhcpSupportForSubnet(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
InsufficientCapacityException, ResourceUnavailableException;
boolean configDhcpSupportForSubnet(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
boolean removeDhcpSupportForSubnet(Network network) throws ResourceUnavailableException;
}

View File

@ -26,7 +26,7 @@ import com.cloud.network.Network.Service;
import com.cloud.network.PublicIpAddress;
import com.cloud.utils.component.Adapter;
public interface IpDeployer extends Adapter{
public interface IpDeployer extends Adapter {
/**
* Modify ip addresses on this network
* Depending on the State of the ip addresses the element should take

View File

@ -23,7 +23,7 @@ import com.cloud.network.Network;
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.vpc.NetworkACLItem;
public interface NetworkACLServiceProvider extends NetworkElement{
public interface NetworkACLServiceProvider extends NetworkElement {
/**
* @param config

View File

@ -56,8 +56,8 @@ public interface NetworkElement extends Adapter {
* @return true if network configuration is now usable; false if not; null if not handled by this element.
* @throws InsufficientNetworkCapacityException TODO
*/
boolean implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context)
throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
boolean implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
ResourceUnavailableException, InsufficientCapacityException;
/**
* Prepare for a nic to be added into this network.
@ -71,8 +71,7 @@ public interface NetworkElement extends Adapter {
* @throws ResourceUnavailableException
* @throws InsufficientNetworkCapacityException
*/
boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm,
DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
ResourceUnavailableException, InsufficientCapacityException;
/**
@ -85,8 +84,7 @@ public interface NetworkElement extends Adapter {
* @throws ConcurrentOperationException
* @throws ResourceUnavailableException
*/
boolean release(Network network, NicProfile nic, VirtualMachineProfile vm,
ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException;
boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException;
/**
* The network is being shutdown.
@ -97,8 +95,7 @@ public interface NetworkElement extends Adapter {
* @throws ConcurrentOperationException
* @throws ResourceUnavailableException
*/
boolean shutdown(Network network, ReservationContext context, boolean cleanup)
throws ConcurrentOperationException, ResourceUnavailableException;
boolean shutdown(Network network, ReservationContext context, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException;
/**
* The network is being destroyed.
@ -124,8 +121,7 @@ public interface NetworkElement extends Adapter {
* @throws ConcurrentOperationException
* @throws ResourceUnavailableException
*/
boolean shutdownProviderInstances(PhysicalNetworkServiceProvider provider, ReservationContext context)
throws ConcurrentOperationException, ResourceUnavailableException;
boolean shutdownProviderInstances(PhysicalNetworkServiceProvider provider, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException;
/**
* This should return true if out of multiple services provided by this element, only some can be enabled. If all the services MUST be provided, this should return false.

View File

@ -27,8 +27,12 @@ import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
public interface UserDataServiceProvider extends NetworkElement {
public boolean addPasswordAndUserdata(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
public boolean addPasswordAndUserdata(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
boolean savePassword(Network network, NicProfile nic, VirtualMachineProfile vm) throws ResourceUnavailableException;
boolean saveUserData(Network network, NicProfile nic, VirtualMachineProfile vm) throws ResourceUnavailableException;
boolean saveSSHKey(Network network, NicProfile nic, VirtualMachineProfile vm, String SSHPublicKey) throws ResourceUnavailableException;
}

View File

@ -25,9 +25,12 @@ import com.cloud.network.VirtualRouterProvider;
import com.cloud.network.VirtualRouterProvider.Type;
import com.cloud.utils.component.PluggableService;
public interface VirtualRouterElementService extends PluggableService{
public interface VirtualRouterElementService extends PluggableService {
VirtualRouterProvider configure(ConfigureVirtualRouterElementCmd cmd);
VirtualRouterProvider addElement(Long nspId, Type providerType);
VirtualRouterProvider getCreatedElement(long id);
List<? extends VirtualRouterProvider> searchForVirtualRouterElement(ListVirtualRouterElementsCmd cmd);
}

View File

@ -16,7 +16,6 @@
// under the License.
package com.cloud.network.element;
import java.util.List;
import com.cloud.deploy.DeployDestination;
@ -30,14 +29,14 @@ import com.cloud.network.vpc.StaticRouteProfile;
import com.cloud.network.vpc.Vpc;
import com.cloud.vm.ReservationContext;
public interface VpcProvider extends NetworkElement{
public interface VpcProvider extends NetworkElement {
/**
* Start vpc element as specified
* @param vpc fully specified vpc configuration.
* @throws InsufficientNetworkCapacityException TODO
*/
boolean implementVpc(Vpc vpc, DeployDestination dest, ReservationContext context)
throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
boolean implementVpc(Vpc vpc, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException,
InsufficientCapacityException;
/**
* @param vpc

View File

@ -16,7 +16,6 @@
// under the License.
package com.cloud.network.firewall;
import java.util.List;
import org.apache.cloudstack.api.command.user.firewall.ListFirewallRulesCmd;
@ -29,6 +28,7 @@ import com.cloud.utils.Pair;
public interface FirewallService {
FirewallRule createIngressFirewallRule(FirewallRule rule) throws NetworkRuleConflictException;
FirewallRule createEgressFirewallRule(FirewallRule rule) throws NetworkRuleConflictException;
Pair<List<? extends FirewallRule>, Integer> listFirewallRules(ListFirewallRulesCmd cmd);
@ -42,8 +42,9 @@ public interface FirewallService {
*/
boolean revokeFirewallRule(long ruleId, boolean apply);
boolean applyEgressFirewallRules (FirewallRule rule, Account caller) throws ResourceUnavailableException;
boolean applyIngressFirewallRules(long Ipid , Account caller) throws ResourceUnavailableException;
boolean applyEgressFirewallRules(FirewallRule rule, Account caller) throws ResourceUnavailableException;
boolean applyIngressFirewallRules(long Ipid, Account caller) throws ResourceUnavailableException;
FirewallRule getFirewallRule(long ruleId);

View File

@ -126,7 +126,8 @@ public interface NetworkGuru extends Adapter {
* @throws InsufficientAddressCapacityException if there are not addresses
* to be assigned.
*/
NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException;
NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException,
ConcurrentOperationException;
/**
* Once a guest network is implemented, then the virtual machine must
@ -146,7 +147,8 @@ public interface NetworkGuru extends Adapter {
* @throws ConcurrentOperationException if there are multiple operations
* happening on this guest network or vm.
*/
void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException;
void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException,
InsufficientAddressCapacityException, ConcurrentOperationException;
/**
* When a virtual machine is stopped, the NetworkGuru is informed via the

View File

@ -16,7 +16,6 @@
// under the License.
package com.cloud.network.lb;
import org.apache.cloudstack.api.command.user.loadbalancer.DeleteSslCertCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.ListSslCertsCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.UploadSslCertCmd;
@ -27,6 +26,8 @@ import java.util.List;
public interface CertService {
public SslCertResponse uploadSslCert(UploadSslCertCmd certCmd);
public void deleteSslCert(DeleteSslCertCmd deleteSslCertCmd);
public List<SslCertResponse> listSslCerts(ListSslCertsCmd listSslCertCmd);
}

View File

@ -39,8 +39,8 @@ public class LoadBalancingRule {
private LbSslCert sslCert;
private String lbProtocol;
public LoadBalancingRule(LoadBalancer lb, List<LbDestination> destinations,
List<LbStickinessPolicy> stickinessPolicies, List<LbHealthCheckPolicy> healthCheckPolicies, Ip sourceIp) {
public LoadBalancingRule(LoadBalancer lb, List<LbDestination> destinations, List<LbStickinessPolicy> stickinessPolicies, List<LbHealthCheckPolicy> healthCheckPolicies,
Ip sourceIp) {
this.lb = lb;
this.destinations = destinations;
this.stickinessPolicies = stickinessPolicies;
@ -48,8 +48,8 @@ public class LoadBalancingRule {
this.sourceIp = sourceIp;
}
public LoadBalancingRule(LoadBalancer lb, List<LbDestination> destinations,
List<LbStickinessPolicy> stickinessPolicies, List<LbHealthCheckPolicy> healthCheckPolicies, Ip sourceIp, LbSslCert sslCert, String lbProtocol) {
public LoadBalancingRule(LoadBalancer lb, List<LbDestination> destinations, List<LbStickinessPolicy> stickinessPolicies, List<LbHealthCheckPolicy> healthCheckPolicies,
Ip sourceIp, LbSslCert sslCert, String lbProtocol) {
this.lb = lb;
this.destinations = destinations;
this.stickinessPolicies = stickinessPolicies;
@ -119,7 +119,6 @@ public class LoadBalancingRule {
return lb.getNetworkId();
}
public void setDestinations(List<LbDestination> destinations) {
this.destinations = destinations;
}
@ -140,7 +139,7 @@ public class LoadBalancingRule {
return healthCheckPolicies;
}
public LbSslCert getLbSslCert(){
public LbSslCert getLbSslCert() {
return sslCert;
}
@ -193,13 +192,11 @@ public class LoadBalancingRule {
private int unhealthThresshold;
private boolean _revoke;
public LbHealthCheckPolicy(String pingpath, String description, int responseTime, int healthcheckInterval,
int healthcheckThresshold, int unhealthThresshold) {
public LbHealthCheckPolicy(String pingpath, String description, int responseTime, int healthcheckInterval, int healthcheckThresshold, int unhealthThresshold) {
this(pingpath, description, responseTime, healthcheckInterval, healthcheckThresshold, unhealthThresshold, false);
}
public LbHealthCheckPolicy(String pingpath, String description, int responseTime, int healthcheckInterval,
int healthcheckThresshold, int unhealthThresshold, boolean revoke) {
public LbHealthCheckPolicy(String pingpath, String description, int responseTime, int healthcheckInterval, int healthcheckThresshold, int unhealthThresshold, boolean revoke) {
this.pingpath = pingpath;
this.description = description;
this.responseTime = responseTime;
@ -349,9 +346,8 @@ public class LoadBalancingRule {
private final String networkId;
private final String vmName;
public LbAutoScaleVmProfile(AutoScaleVmProfile profile, String autoScaleUserApiKey,
String autoScaleUserSecretKey, String csUrl, String zoneId, String domainId, String serviceOfferingId,
String templateId, String vmName, String networkId) {
public LbAutoScaleVmProfile(AutoScaleVmProfile profile, String autoScaleUserApiKey, String autoScaleUserSecretKey, String csUrl, String zoneId, String domainId,
String serviceOfferingId, String templateId, String vmName, String networkId) {
this.profile = profile;
this.autoScaleUserApiKey = autoScaleUserApiKey;
this.autoScaleUserSecretKey = autoScaleUserSecretKey;
@ -411,8 +407,7 @@ public class LoadBalancingRule {
private final LbAutoScaleVmProfile profile;
private final String currentState;
public LbAutoScaleVmGroup(AutoScaleVmGroup vmGroup, List<LbAutoScalePolicy> policies,
LbAutoScaleVmProfile profile, String currentState) {
public LbAutoScaleVmGroup(AutoScaleVmGroup vmGroup, List<LbAutoScalePolicy> policies, LbAutoScaleVmProfile profile, String currentState) {
this.vmGroup = vmGroup;
this.policies = policies;
this.profile = profile;
@ -439,11 +434,10 @@ public class LoadBalancingRule {
public static class LbSslCert {
private String cert;
private String key;
private String password=null;
private String chain=null;
private String password = null;
private String chain = null;
private boolean revoked;
public LbSslCert(String cert, String key, String password, String chain, boolean revoked) {
this.cert = cert;
this.key = key;
@ -469,7 +463,7 @@ public class LoadBalancingRule {
return chain;
}
public boolean isRevoked(){
public boolean isRevoked() {
return revoked;
}
}

View File

@ -38,7 +38,6 @@ import com.cloud.uservm.UserVm;
import com.cloud.utils.Pair;
import com.cloud.utils.net.Ip;
public interface LoadBalancingRulesService {
/**
* Create a load balancer rule from the given ipAddress/port to the given private port
@ -50,9 +49,9 @@ public interface LoadBalancingRulesService {
* @return the newly created LoadBalancerVO if successful, null otherwise
* @throws InsufficientAddressCapacityException
*/
LoadBalancer createPublicLoadBalancerRule(String xId, String name, String description,
int srcPortStart, int srcPortEnd, int defPortStart, int defPortEnd, Long ipAddrId, String protocol, String algorithm,
long networkId, long lbOwnerId, boolean openFirewall, String lbProtocol) throws NetworkRuleConflictException, InsufficientAddressCapacityException;
LoadBalancer createPublicLoadBalancerRule(String xId, String name, String description, int srcPortStart, int srcPortEnd, int defPortStart, int defPortEnd, Long ipAddrId,
String protocol, String algorithm, long networkId, long lbOwnerId, boolean openFirewall, String lbProtocol) throws NetworkRuleConflictException,
InsufficientAddressCapacityException;
LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd);
@ -86,7 +85,9 @@ public interface LoadBalancingRulesService {
* @thows NetworkRuleConflictException
*/
public HealthCheckPolicy createLBHealthCheckPolicy(CreateLBHealthCheckPolicyCmd cmd);
public boolean applyLBHealthCheckPolicy(CreateLBHealthCheckPolicyCmd cmd) throws ResourceUnavailableException;
boolean deleteLBHealthCheckPolicy(long healthCheckPolicyId, boolean apply);
/**
@ -101,8 +102,8 @@ public interface LoadBalancingRulesService {
boolean applyLoadBalancerConfig(long lbRuleId) throws ResourceUnavailableException;
boolean assignCertToLoadBalancer(long lbRuleId, Long CertId);
boolean removeCertFromLoadBalancer(long lbRuleId);
boolean removeCertFromLoadBalancer(long lbRuleId);
/**
* List instances that have either been applied to a load balancer or are eligible to be assigned to a load

View File

@ -16,7 +16,6 @@
// under the License.
package com.cloud.network.lb;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
@ -24,9 +23,13 @@ import org.apache.cloudstack.api.InternalIdentity;
public interface SslCert extends InternalIdentity, Identity, ControlledEntity {
public String getCertificate();
public String getKey() ;
public String getKey();
public String getChain();
public String getPassword();
public String getFingerPrint();
}

View File

@ -25,21 +25,27 @@ public interface VirtualRouter extends VirtualMachine {
public enum Role {
VIRTUAL_ROUTER, LB, INTERNAL_LB_VM
}
Role getRole();
boolean getIsRedundantRouter();
public enum RedundantState {
UNKNOWN,
MASTER,
BACKUP,
FAULT
UNKNOWN, MASTER, BACKUP, FAULT
}
RedundantState getRedundantState();
String getPublicIpAddress();
boolean isStopPending();
void setStopPending(boolean stopPending);
/**
* @return
*/
Long getVpcId();
String getTemplateVersion();
}

View File

@ -24,12 +24,7 @@ import org.apache.cloudstack.api.InternalIdentity;
public interface FirewallRule extends ControlledEntity, Identity, InternalIdentity {
enum Purpose {
Firewall,
PortForwarding,
LoadBalancing,
Vpn,
StaticNat,
NetworkACL,
Firewall, PortForwarding, LoadBalancing, Vpn, StaticNat, NetworkACL,
}
enum FirewallRuleType {
@ -45,8 +40,7 @@ public interface FirewallRule extends ControlledEntity, Identity, InternalIdenti
}
enum TrafficType {
Ingress,
Egress
Ingress, Egress
}
/**

Some files were not shown because too many files have changed in this diff Show More