mirror of https://github.com/apache/cloudstack.git
Merge javelin into master
This commit is contained in:
commit
296c20332d
|
|
@ -62,7 +62,6 @@ tools/cli/build/
|
|||
awsapi/modules/*
|
||||
!.gitignore
|
||||
.classpath
|
||||
.project
|
||||
.settings.xml
|
||||
.settings/
|
||||
db.properties.override
|
||||
|
|
@ -73,4 +72,5 @@ docs/tmp
|
|||
docs/publish
|
||||
docs/runbook/tmp
|
||||
docs/runbook/publish
|
||||
.project
|
||||
Gemfile.lock
|
||||
|
|
|
|||
|
|
@ -53,10 +53,7 @@ import com.cloud.utils.ProcessUtil;
|
|||
import com.cloud.utils.PropertiesUtil;
|
||||
import com.cloud.utils.backoff.BackoffAlgorithm;
|
||||
import com.cloud.utils.backoff.impl.ConstantTimeBackoff;
|
||||
import com.cloud.utils.component.Adapters;
|
||||
import com.cloud.utils.component.ComponentLocator;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.net.MacAddress;
|
||||
import com.cloud.utils.script.Script;
|
||||
|
||||
public class AgentShell implements IAgentShell {
|
||||
|
|
@ -146,6 +143,7 @@ public class AgentShell implements IAgentShell {
|
|||
return _guid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getCmdLineProperties() {
|
||||
return _cmdLineProperties;
|
||||
}
|
||||
|
|
@ -378,8 +376,6 @@ public class AgentShell implements IAgentShell {
|
|||
|
||||
public void init(String[] args) throws ConfigurationException {
|
||||
|
||||
final ComponentLocator locator = ComponentLocator.getLocator("agent");
|
||||
|
||||
final Class<?> c = this.getClass();
|
||||
_version = c.getPackage().getImplementationVersion();
|
||||
if (_version == null) {
|
||||
|
|
@ -396,12 +392,9 @@ public class AgentShell implements IAgentShell {
|
|||
s_logger.debug("Found property: " + property);
|
||||
}
|
||||
|
||||
_storage = locator.getManager(StorageComponent.class);
|
||||
if (_storage == null) {
|
||||
s_logger.info("Defaulting to using properties file for storage");
|
||||
_storage = new PropertiesStorage();
|
||||
_storage.configure("Storage", new HashMap<String, Object>());
|
||||
}
|
||||
s_logger.info("Defaulting to using properties file for storage");
|
||||
_storage = new PropertiesStorage();
|
||||
_storage.configure("Storage", new HashMap<String, Object>());
|
||||
|
||||
// merge with properties from command line to let resource access
|
||||
// command line parameters
|
||||
|
|
@ -410,22 +403,9 @@ public class AgentShell implements IAgentShell {
|
|||
_properties.put(cmdLineProp.getKey(), cmdLineProp.getValue());
|
||||
}
|
||||
|
||||
final Adapters adapters = locator.getAdapters(BackoffAlgorithm.class);
|
||||
final Enumeration en = adapters.enumeration();
|
||||
while (en.hasMoreElements()) {
|
||||
_backoff = (BackoffAlgorithm) en.nextElement();
|
||||
break;
|
||||
}
|
||||
if (en.hasMoreElements()) {
|
||||
s_logger.info("More than one backoff algorithm specified. Using the first one ");
|
||||
}
|
||||
|
||||
if (_backoff == null) {
|
||||
s_logger.info("Defaulting to the constant time backoff algorithm");
|
||||
_backoff = new ConstantTimeBackoff();
|
||||
_backoff.configure("ConstantTimeBackoff",
|
||||
new HashMap<String, Object>());
|
||||
}
|
||||
s_logger.info("Defaulting to the constant time backoff algorithm");
|
||||
_backoff = new ConstantTimeBackoff();
|
||||
_backoff.configure("ConstantTimeBackoff", new HashMap<String, Object>());
|
||||
}
|
||||
|
||||
private void launchAgent() throws ConfigurationException {
|
||||
|
|
@ -469,6 +449,7 @@ public class AgentShell implements IAgentShell {
|
|||
openPortWithIptables(port);
|
||||
|
||||
_consoleProxyMain = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Class<?> consoleProxyClazz = Class.forName("com.cloud.consoleproxy.ConsoleProxy");
|
||||
|
|
@ -522,7 +503,7 @@ public class AgentShell implements IAgentShell {
|
|||
} catch (final SecurityException e) {
|
||||
throw new ConfigurationException(
|
||||
"Security excetion when loading resource: " + name
|
||||
+ " due to: " + e.toString());
|
||||
+ " due to: " + e.toString());
|
||||
} catch (final NoSuchMethodException e) {
|
||||
throw new ConfigurationException(
|
||||
"Method not found excetion when loading resource: "
|
||||
|
|
@ -534,7 +515,7 @@ public class AgentShell implements IAgentShell {
|
|||
} catch (final InstantiationException e) {
|
||||
throw new ConfigurationException(
|
||||
"Instantiation excetion when loading resource: " + name
|
||||
+ " due to: " + e.toString());
|
||||
+ " due to: " + e.toString());
|
||||
} catch (final IllegalAccessException e) {
|
||||
throw new ConfigurationException(
|
||||
"Illegal access exception when loading resource: "
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import java.io.IOException;
|
|||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -41,19 +40,15 @@ import com.cloud.agent.dao.impl.PropertiesStorage;
|
|||
import com.cloud.agent.transport.Request;
|
||||
import com.cloud.resource.ServerResource;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
import com.cloud.utils.ProcessUtil;
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
import com.cloud.utils.backoff.BackoffAlgorithm;
|
||||
import com.cloud.utils.backoff.impl.ConstantTimeBackoff;
|
||||
import com.cloud.utils.component.Adapters;
|
||||
import com.cloud.utils.component.ComponentLocator;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.net.MacAddress;
|
||||
import com.cloud.utils.nio.HandlerFactory;
|
||||
import com.cloud.utils.nio.Link;
|
||||
import com.cloud.utils.nio.NioServer;
|
||||
import com.cloud.utils.nio.Task;
|
||||
import com.cloud.utils.nio.Task.Type;
|
||||
|
||||
/**
|
||||
* Implementation of agent shell to run the agents on System Center Virtual Machine manager
|
||||
|
|
@ -61,7 +56,7 @@ import com.cloud.utils.nio.Task.Type;
|
|||
|
||||
public class VmmAgentShell implements IAgentShell, HandlerFactory {
|
||||
|
||||
private static final Logger s_logger = Logger.getLogger(VmmAgentShell.class.getName());
|
||||
private static final Logger s_logger = Logger.getLogger(VmmAgentShell.class.getName());
|
||||
private final Properties _properties = new Properties();
|
||||
private final Map<String, Object> _cmdLineProperties = new HashMap<String, Object>();
|
||||
private StorageComponent _storage;
|
||||
|
|
@ -76,112 +71,112 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory {
|
|||
private int _proxyPort;
|
||||
private int _workers;
|
||||
private String _guid;
|
||||
static private NioServer _connection;
|
||||
static private int _listenerPort=9000;
|
||||
static private NioServer _connection;
|
||||
static private int _listenerPort=9000;
|
||||
private int _nextAgentId = 1;
|
||||
private volatile boolean _exit = false;
|
||||
private int _pingRetries;
|
||||
private Thread _consoleProxyMain = null;
|
||||
private final Thread _consoleProxyMain = null;
|
||||
private final List<Agent> _agents = new ArrayList<Agent>();
|
||||
|
||||
public VmmAgentShell() {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Properties getProperties() {
|
||||
return _properties;
|
||||
return _properties;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BackoffAlgorithm getBackoffAlgorithm() {
|
||||
return _backoff;
|
||||
return _backoff;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getPingRetries() {
|
||||
return _pingRetries;
|
||||
return _pingRetries;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getZone() {
|
||||
return _zone;
|
||||
return _zone;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getPod() {
|
||||
return _pod;
|
||||
return _pod;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getHost() {
|
||||
return _host;
|
||||
return _host;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getPrivateIp() {
|
||||
return _privateIp;
|
||||
return _privateIp;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getPort() {
|
||||
return _port;
|
||||
return _port;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getProxyPort() {
|
||||
return _proxyPort;
|
||||
return _proxyPort;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getWorkers() {
|
||||
return _workers;
|
||||
return _workers;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getGuid() {
|
||||
return _guid;
|
||||
return _guid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void upgradeAgent(String url) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
@Override
|
||||
public void upgradeAgent(String url) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
@Override
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return _version;
|
||||
return _version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getCmdLineProperties() {
|
||||
// TODO Auto-generated method stub
|
||||
return _cmdLineProperties;
|
||||
}
|
||||
|
||||
public String getProperty(String prefix, String name) {
|
||||
if(prefix != null)
|
||||
return _properties.getProperty(prefix + "." + name);
|
||||
|
||||
return _properties.getProperty(name);
|
||||
@Override
|
||||
public Map<String, Object> getCmdLineProperties() {
|
||||
// TODO Auto-generated method stub
|
||||
return _cmdLineProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPersistentProperty(String prefix, String name) {
|
||||
if(prefix != null)
|
||||
return _storage.get(prefix + "." + name);
|
||||
return _storage.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPersistentProperty(String prefix, String name, String value) {
|
||||
if(prefix != null)
|
||||
_storage.persist(prefix + "." + name, value);
|
||||
else
|
||||
_storage.persist(name, value);
|
||||
}
|
||||
public String getProperty(String prefix, String name) {
|
||||
if(prefix != null)
|
||||
return _properties.getProperty(prefix + "." + name);
|
||||
|
||||
private void loadProperties() throws ConfigurationException {
|
||||
return _properties.getProperty(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPersistentProperty(String prefix, String name) {
|
||||
if(prefix != null)
|
||||
return _storage.get(prefix + "." + name);
|
||||
return _storage.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPersistentProperty(String prefix, String name, String value) {
|
||||
if(prefix != null)
|
||||
_storage.persist(prefix + "." + name, value);
|
||||
else
|
||||
_storage.persist(name, value);
|
||||
}
|
||||
|
||||
private void loadProperties() throws ConfigurationException {
|
||||
final File file = PropertiesUtil.findConfigFile("agent.properties");
|
||||
if (file == null) {
|
||||
throw new ConfigurationException("Unable to find agent.properties.");
|
||||
|
|
@ -197,7 +192,7 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory {
|
|||
throw new CloudRuntimeException("IOException in reading " + file.getAbsolutePath(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected boolean parseCommand(final String[] args) throws ConfigurationException {
|
||||
String host = null;
|
||||
String workers = null;
|
||||
|
|
@ -211,7 +206,7 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory {
|
|||
System.out.println("Invalid Parameter: " + args[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// save command line properties
|
||||
_cmdLineProperties.put(tokens[0], tokens[1]);
|
||||
|
||||
|
|
@ -222,14 +217,14 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory {
|
|||
} else if (tokens[0].equalsIgnoreCase("host")) {
|
||||
host = tokens[1];
|
||||
} else if(tokens[0].equalsIgnoreCase("zone")) {
|
||||
zone = tokens[1];
|
||||
zone = tokens[1];
|
||||
} else if(tokens[0].equalsIgnoreCase("pod")) {
|
||||
pod = tokens[1];
|
||||
pod = tokens[1];
|
||||
} else if(tokens[0].equalsIgnoreCase("guid")) {
|
||||
guid = tokens[1];
|
||||
} else if(tokens[0].equalsIgnoreCase("eth1ip")) {
|
||||
_privateIp = tokens[1];
|
||||
}
|
||||
guid = tokens[1];
|
||||
} else if(tokens[0].equalsIgnoreCase("eth1ip")) {
|
||||
_privateIp = tokens[1];
|
||||
}
|
||||
}
|
||||
|
||||
if (port == null) {
|
||||
|
|
@ -237,7 +232,7 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory {
|
|||
}
|
||||
|
||||
_port = NumbersUtil.parseInt(port, 8250);
|
||||
|
||||
|
||||
_proxyPort = NumbersUtil.parseInt(getProperty(null, "consoleproxy.httpListenPort"), 443);
|
||||
|
||||
if (workers == null) {
|
||||
|
|
@ -254,42 +249,42 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory {
|
|||
host = "localhost";
|
||||
}
|
||||
_host = host;
|
||||
|
||||
|
||||
if(zone != null)
|
||||
_zone = zone;
|
||||
_zone = zone;
|
||||
else
|
||||
_zone = getProperty(null, "zone");
|
||||
_zone = getProperty(null, "zone");
|
||||
if (_zone == null || (_zone.startsWith("@") && _zone.endsWith("@"))) {
|
||||
_zone = "default";
|
||||
_zone = "default";
|
||||
}
|
||||
|
||||
if(pod != null)
|
||||
_pod = pod;
|
||||
_pod = pod;
|
||||
else
|
||||
_pod = getProperty(null, "pod");
|
||||
_pod = getProperty(null, "pod");
|
||||
if (_pod == null || (_pod.startsWith("@") && _pod.endsWith("@"))) {
|
||||
_pod = "default";
|
||||
_pod = "default";
|
||||
}
|
||||
|
||||
if (_host == null || (_host.startsWith("@") && _host.endsWith("@"))) {
|
||||
throw new ConfigurationException("Host is not configured correctly: " + _host);
|
||||
}
|
||||
|
||||
|
||||
final String retries = getProperty(null, "ping.retries");
|
||||
_pingRetries = NumbersUtil.parseInt(retries, 5);
|
||||
|
||||
String value = getProperty(null, "developer");
|
||||
boolean developer = Boolean.parseBoolean(value);
|
||||
|
||||
|
||||
if(guid != null)
|
||||
_guid = guid;
|
||||
_guid = guid;
|
||||
else
|
||||
_guid = getProperty(null, "guid");
|
||||
_guid = getProperty(null, "guid");
|
||||
if (_guid == null) {
|
||||
if (!developer) {
|
||||
throw new ConfigurationException("Unable to find the guid");
|
||||
}
|
||||
_guid = MacAddress.getMacAddress().toString(":");
|
||||
if (!developer) {
|
||||
throw new ConfigurationException("Unable to find the guid");
|
||||
}
|
||||
_guid = MacAddress.getMacAddress().toString(":");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -303,63 +298,46 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory {
|
|||
}
|
||||
s_logger.trace("Launching agent based on type=" + typeInfo);
|
||||
}
|
||||
|
||||
|
||||
private void launchAgent() throws ConfigurationException {
|
||||
String resourceClassNames = getProperty(null, "resource");
|
||||
s_logger.trace("resource=" + resourceClassNames);
|
||||
if(resourceClassNames != null) {
|
||||
launchAgentFromClassInfo(resourceClassNames);
|
||||
return;
|
||||
launchAgentFromClassInfo(resourceClassNames);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
launchAgentFromTypeInfo();
|
||||
}
|
||||
|
||||
|
||||
private void init(String[] args) throws ConfigurationException{
|
||||
|
||||
final ComponentLocator locator = ComponentLocator.getLocator("agent");
|
||||
|
||||
|
||||
final Class<?> c = this.getClass();
|
||||
_version = c.getPackage().getImplementationVersion();
|
||||
if (_version == null) {
|
||||
throw new CloudRuntimeException("Unable to find the implementation version of this agent");
|
||||
}
|
||||
s_logger.info("Implementation Version is " + _version);
|
||||
|
||||
|
||||
parseCommand(args);
|
||||
|
||||
_storage = locator.getManager(StorageComponent.class);
|
||||
if (_storage == null) {
|
||||
s_logger.info("Defaulting to using properties file for storage");
|
||||
_storage = new PropertiesStorage();
|
||||
_storage.configure("Storage", new HashMap<String, Object>());
|
||||
}
|
||||
|
||||
s_logger.info("Defaulting to using properties file for storage");
|
||||
_storage = new PropertiesStorage();
|
||||
_storage.configure("Storage", new HashMap<String, Object>());
|
||||
|
||||
// merge with properties from command line to let resource access command line parameters
|
||||
for(Map.Entry<String, Object> cmdLineProp : getCmdLineProperties().entrySet()) {
|
||||
_properties.put(cmdLineProp.getKey(), cmdLineProp.getValue());
|
||||
}
|
||||
|
||||
final Adapters adapters = locator.getAdapters(BackoffAlgorithm.class);
|
||||
final Enumeration en = adapters.enumeration();
|
||||
while (en.hasMoreElements()) {
|
||||
_backoff = (BackoffAlgorithm)en.nextElement();
|
||||
break;
|
||||
}
|
||||
if (en.hasMoreElements()) {
|
||||
s_logger.info("More than one backoff algorithm specified. Using the first one ");
|
||||
_properties.put(cmdLineProp.getKey(), cmdLineProp.getValue());
|
||||
}
|
||||
|
||||
if (_backoff == null) {
|
||||
s_logger.info("Defaulting to the constant time backoff algorithm");
|
||||
_backoff = new ConstantTimeBackoff();
|
||||
_backoff.configure("ConstantTimeBackoff", new HashMap<String, Object>());
|
||||
}
|
||||
s_logger.info("Defaulting to the constant time backoff algorithm");
|
||||
_backoff = new ConstantTimeBackoff();
|
||||
_backoff.configure("ConstantTimeBackoff", new HashMap<String, Object>());
|
||||
}
|
||||
|
||||
private void launchAgentFromClassInfo(String resourceClassNames) throws ConfigurationException {
|
||||
String[] names = resourceClassNames.split("\\|");
|
||||
for(String name: names) {
|
||||
String[] names = resourceClassNames.split("\\|");
|
||||
for(String name: names) {
|
||||
Class<?> impl;
|
||||
try {
|
||||
impl = Class.forName(name);
|
||||
|
|
@ -368,41 +346,41 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory {
|
|||
ServerResource resource = (ServerResource)constructor.newInstance();
|
||||
launchAgent(getNextAgentId(), resource);
|
||||
} catch (final ClassNotFoundException e) {
|
||||
throw new ConfigurationException("Resource class not found: " + name);
|
||||
throw new ConfigurationException("Resource class not found: " + name);
|
||||
} catch (final SecurityException e) {
|
||||
throw new ConfigurationException("Security excetion when loading resource: " + name);
|
||||
throw new ConfigurationException("Security excetion when loading resource: " + name);
|
||||
} catch (final NoSuchMethodException e) {
|
||||
throw new ConfigurationException("Method not found excetion when loading resource: " + name);
|
||||
throw new ConfigurationException("Method not found excetion when loading resource: " + name);
|
||||
} catch (final IllegalArgumentException e) {
|
||||
throw new ConfigurationException("Illegal argument excetion when loading resource: " + name);
|
||||
throw new ConfigurationException("Illegal argument excetion when loading resource: " + name);
|
||||
} catch (final InstantiationException e) {
|
||||
throw new ConfigurationException("Instantiation excetion when loading resource: " + name);
|
||||
throw new ConfigurationException("Instantiation excetion when loading resource: " + name);
|
||||
} catch (final IllegalAccessException e) {
|
||||
throw new ConfigurationException("Illegal access exception when loading resource: " + name);
|
||||
throw new ConfigurationException("Illegal access exception when loading resource: " + name);
|
||||
} catch (final InvocationTargetException e) {
|
||||
throw new ConfigurationException("Invocation target exception when loading resource: " + name);
|
||||
throw new ConfigurationException("Invocation target exception when loading resource: " + name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
agent.start();
|
||||
// we don't track agent after it is launched for now
|
||||
Agent agent = new Agent(this, localAgentId, resource);
|
||||
_agents.add(agent);
|
||||
agent.start();
|
||||
}
|
||||
|
||||
public synchronized int getNextAgentId() {
|
||||
return _nextAgentId++;
|
||||
return _nextAgentId++;
|
||||
}
|
||||
|
||||
private void run(String[] args) {
|
||||
|
||||
try {
|
||||
|
||||
private void run(String[] args) {
|
||||
|
||||
try {
|
||||
System.setProperty("java.net.preferIPv4Stack","true");
|
||||
loadProperties();
|
||||
init(args);
|
||||
|
||||
loadProperties();
|
||||
init(args);
|
||||
|
||||
String instance = getProperty(null, "instance");
|
||||
if (instance == null) {
|
||||
instance = "";
|
||||
|
|
@ -413,22 +391,22 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory {
|
|||
// TODO need to do this check. For Agentshell running on windows needs different approach
|
||||
//final String run = "agent." + instance + "pid";
|
||||
//s_logger.debug("Checking to see if " + run + "exists.");
|
||||
//ProcessUtil.pidCheck(run);
|
||||
|
||||
|
||||
//ProcessUtil.pidCheck(run);
|
||||
|
||||
|
||||
// TODO: For Hyper-V agent.properties need to be revamped to support multiple agents
|
||||
// corresponding to multiple clusters but running on a SCVMM host
|
||||
|
||||
|
||||
// read the persistent storage and launch the agents
|
||||
//launchAgent();
|
||||
//launchAgent();
|
||||
|
||||
// FIXME get rid of this approach of agent listening for boot strap commands from the management server
|
||||
|
||||
// now listen for bootstrap request from the management server and launch agents
|
||||
_connection = new NioServer("VmmAgentShell", _listenerPort, 1, this);
|
||||
_connection.start();
|
||||
s_logger.info("SCVMM agent is listening on port " +_listenerPort + " for bootstrap command from management server");
|
||||
while(_connection.isRunning());
|
||||
// now listen for bootstrap request from the management server and launch agents
|
||||
_connection = new NioServer("VmmAgentShell", _listenerPort, 1, this);
|
||||
_connection.start();
|
||||
s_logger.info("SCVMM agent is listening on port " +_listenerPort + " for bootstrap command from management server");
|
||||
while(_connection.isRunning());
|
||||
} catch(final ConfigurationException e) {
|
||||
s_logger.error("Unable to start agent: " + e.getMessage());
|
||||
System.out.println("Unable to start agent: " + e.getMessage());
|
||||
|
|
@ -438,89 +416,89 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory {
|
|||
System.out.println("Unable to start agent: " + e.getMessage());
|
||||
System.exit(ExitStatus.Error.value());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Task create(com.cloud.utils.nio.Task.Type type, Link link,
|
||||
byte[] data) {
|
||||
return new AgentBootStrapHandler(type, link, data);
|
||||
}
|
||||
@Override
|
||||
public Task create(com.cloud.utils.nio.Task.Type type, Link link,
|
||||
byte[] data) {
|
||||
return new AgentBootStrapHandler(type, link, data);
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
_exit = true;
|
||||
if(_consoleProxyMain != null) {
|
||||
_consoleProxyMain.interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
VmmAgentShell shell = new VmmAgentShell();
|
||||
Runtime.getRuntime().addShutdownHook(new ShutdownThread(shell));
|
||||
shell.run(args);
|
||||
}
|
||||
public void stop() {
|
||||
_exit = true;
|
||||
if(_consoleProxyMain != null) {
|
||||
_consoleProxyMain.interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
// class to handle the bootstrap command from the management server
|
||||
private class AgentBootStrapHandler extends Task {
|
||||
public static void main(String[] args) {
|
||||
|
||||
public AgentBootStrapHandler(Task.Type type, Link link, byte[] data) {
|
||||
super(type, link, data);
|
||||
}
|
||||
VmmAgentShell shell = new VmmAgentShell();
|
||||
Runtime.getRuntime().addShutdownHook(new ShutdownThread(shell));
|
||||
shell.run(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doTask(Task task) throws Exception {
|
||||
final Type type = task.getType();
|
||||
s_logger.info("recieved task of type "+ type.toString() +" to handle in BootStrapTakHandler");
|
||||
if (type == Task.Type.DATA)
|
||||
{
|
||||
final byte[] data = task.getData();
|
||||
final Request request = Request.parse(data);
|
||||
final Command cmd = request.getCommand();
|
||||
|
||||
if (cmd instanceof StartupVMMAgentCommand) {
|
||||
// class to handle the bootstrap command from the management server
|
||||
private class AgentBootStrapHandler extends Task {
|
||||
|
||||
StartupVMMAgentCommand vmmCmd = (StartupVMMAgentCommand) cmd;
|
||||
public AgentBootStrapHandler(Task.Type type, Link link, byte[] data) {
|
||||
super(type, link, data);
|
||||
}
|
||||
|
||||
_zone = Long.toString(vmmCmd.getDataCenter());
|
||||
_cmdLineProperties.put("zone", _zone);
|
||||
@Override
|
||||
protected void doTask(Task task) throws Exception {
|
||||
final Type type = task.getType();
|
||||
s_logger.info("recieved task of type "+ type.toString() +" to handle in BootStrapTakHandler");
|
||||
if (type == Task.Type.DATA)
|
||||
{
|
||||
final byte[] data = task.getData();
|
||||
final Request request = Request.parse(data);
|
||||
final Command cmd = request.getCommand();
|
||||
|
||||
_pod = Long.toString(vmmCmd.getPod());
|
||||
_cmdLineProperties.put("pod", _pod);
|
||||
if (cmd instanceof StartupVMMAgentCommand) {
|
||||
|
||||
_cluster = vmmCmd.getClusterName();
|
||||
_cmdLineProperties.put("cluster", _cluster);
|
||||
StartupVMMAgentCommand vmmCmd = (StartupVMMAgentCommand) cmd;
|
||||
|
||||
_guid = vmmCmd.getGuid();
|
||||
_cmdLineProperties.put("guid", _guid);
|
||||
_zone = Long.toString(vmmCmd.getDataCenter());
|
||||
_cmdLineProperties.put("zone", _zone);
|
||||
|
||||
_host = vmmCmd.getManagementServerIP();
|
||||
_port = NumbersUtil.parseInt(vmmCmd.getport(), 8250);
|
||||
_pod = Long.toString(vmmCmd.getPod());
|
||||
_cmdLineProperties.put("pod", _pod);
|
||||
|
||||
s_logger.info("Recieved boot strap command from management server with parameters " +
|
||||
" Zone:"+ _zone + " "+
|
||||
" Cluster:"+ _cluster + " "+
|
||||
" pod:"+_pod + " "+
|
||||
" host:"+ _host +" "+
|
||||
" port:"+_port);
|
||||
_cluster = vmmCmd.getClusterName();
|
||||
_cmdLineProperties.put("cluster", _cluster);
|
||||
|
||||
launchAgentFromClassInfo("com.cloud.hypervisor.hyperv.resource.HypervResource");
|
||||
|
||||
// TODO: persist the info in agent.properties for agent restarts
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_guid = vmmCmd.getGuid();
|
||||
_cmdLineProperties.put("guid", _guid);
|
||||
|
||||
_host = vmmCmd.getManagementServerIP();
|
||||
_port = NumbersUtil.parseInt(vmmCmd.getport(), 8250);
|
||||
|
||||
s_logger.info("Recieved boot strap command from management server with parameters " +
|
||||
" Zone:"+ _zone + " "+
|
||||
" Cluster:"+ _cluster + " "+
|
||||
" pod:"+_pod + " "+
|
||||
" host:"+ _host +" "+
|
||||
" port:"+_port);
|
||||
|
||||
launchAgentFromClassInfo("com.cloud.hypervisor.hyperv.resource.HypervResource");
|
||||
|
||||
// TODO: persist the info in agent.properties for agent restarts
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class ShutdownThread extends Thread {
|
||||
VmmAgentShell _shell;
|
||||
VmmAgentShell _shell;
|
||||
public ShutdownThread(VmmAgentShell shell) {
|
||||
this._shell = shell;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
_shell.stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
// 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
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.agent.configuration;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.utils.component.Adapter;
|
||||
import com.cloud.utils.component.ComponentLibraryBase;
|
||||
import com.cloud.utils.component.ComponentLocator.ComponentInfo;
|
||||
import com.cloud.utils.component.Manager;
|
||||
import com.cloud.utils.component.PluggableService;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public class AgentComponentLibraryBase extends ComponentLibraryBase {
|
||||
@Override
|
||||
public Map<String, ComponentInfo<GenericDao<?, ?>>> getDaos() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, ComponentInfo<Manager>> getManagers() {
|
||||
if (_managers.size() == 0) {
|
||||
populateManagers();
|
||||
}
|
||||
return _managers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<ComponentInfo<Adapter>>> getAdapters() {
|
||||
if (_adapters.size() == 0) {
|
||||
populateAdapters();
|
||||
}
|
||||
return _adapters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Class<?>, Class<?>> getFactories() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void populateManagers() {
|
||||
// addManager("StackMaidManager", StackMaidManagerImpl.class);
|
||||
}
|
||||
|
||||
protected void populateAdapters() {
|
||||
|
||||
}
|
||||
|
||||
protected void populateServices() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, ComponentInfo<PluggableService>> getPluggableServices() {
|
||||
if (_pluggableServices.size() == 0) {
|
||||
populateServices();
|
||||
}
|
||||
return _pluggableServices;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -127,4 +127,34 @@ public class PropertiesStorage implements StorageComponent {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConfigParams(Map<String, Object> params) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getConfigParams() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRunLevel() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRunLevel(int level) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,4 +139,34 @@ public class FakeDhcpSnooper implements DhcpSnooper {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConfigParams(Map<String, Object> params) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getConfigParams() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRunLevel() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRunLevel(int level) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -224,4 +224,34 @@ public class DummyResource implements ServerResource {
|
|||
public void setAgentControl(IAgentControl agentControl) {
|
||||
_agentControl = agentControl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConfigParams(Map<String, Object> params) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getConfigParams() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRunLevel() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRunLevel(int level) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ import com.google.gson.Gson;
|
|||
* server.
|
||||
*
|
||||
*/
|
||||
public class ConsoleProxyResource extends ServerResourceBase implements
|
||||
public abstract class ConsoleProxyResource extends ServerResourceBase implements
|
||||
ServerResource {
|
||||
static final Logger s_logger = Logger.getLogger(ConsoleProxyResource.class);
|
||||
|
||||
|
|
|
|||
|
|
@ -19,24 +19,23 @@ package com.cloud.agent;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.AgentShell;
|
||||
import com.cloud.utils.testcase.Log4jEnabledTestCase;
|
||||
|
||||
public class TestAgentShell extends Log4jEnabledTestCase {
|
||||
public class TestAgentShell extends TestCase {
|
||||
protected final static Logger s_logger = Logger.getLogger(TestAgentShell.class);
|
||||
|
||||
|
||||
public void testWget() {
|
||||
File file = null;
|
||||
try {
|
||||
file = File.createTempFile("wget", ".html");
|
||||
AgentShell.wget("http://www.google.com/", file);
|
||||
|
||||
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("file saved to " + file.getAbsolutePath());
|
||||
}
|
||||
|
||||
|
||||
} catch (final IOException e) {
|
||||
s_logger.warn("Exception while downloading agent update package, ", e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
package com.cloud.agent.api.proxy;
|
||||
|
||||
import com.cloud.agent.api.Command;
|
||||
import com.cloud.agent.api.LogLevel.Log4jLevel;
|
||||
import com.cloud.agent.api.LogLevel;
|
||||
import com.cloud.agent.api.LogLevel.Log4jLevel;
|
||||
|
||||
public class StartConsoleProxyAgentHttpHandlerCommand extends Command {
|
||||
@LogLevel(Log4jLevel.Off)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
// under the License.
|
||||
package com.cloud.agent.api.storage;
|
||||
|
||||
import com.cloud.agent.api.Command;
|
||||
|
||||
public class CreateEntityDownloadURLCommand extends AbstractDownloadCommand {
|
||||
|
||||
|
|
|
|||
|
|
@ -18,11 +18,12 @@ package com.cloud.agent.api.storage;
|
|||
|
||||
import java.net.URI;
|
||||
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
|
||||
|
||||
public class DownloadCommand extends AbstractDownloadCommand implements InternalIdentity {
|
||||
public static class PasswordAuth {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ package com.cloud.agent.api.storage;
|
|||
import java.util.Map;
|
||||
|
||||
import com.cloud.agent.api.Answer;
|
||||
|
||||
import com.cloud.storage.template.TemplateInfo;
|
||||
|
||||
public class ListTemplateAnswer extends Answer {
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@
|
|||
// under the License.
|
||||
package com.cloud.agent.api.storage;
|
||||
|
||||
import com.cloud.agent.api.LogLevel;
|
||||
import com.cloud.agent.api.LogLevel.Log4jLevel;
|
||||
import com.cloud.agent.api.to.SwiftTO;
|
||||
|
||||
public class ListVolumeCommand extends StorageCommand {
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@
|
|||
// under the License.
|
||||
package com.cloud.agent.api.storage;
|
||||
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.agent.api.to.StorageFilerTO;
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.storage.StoragePool;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ package com.cloud.agent.api.storage;
|
|||
|
||||
import com.cloud.agent.api.Command;
|
||||
import com.cloud.agent.api.to.StorageFilerTO;
|
||||
import com.cloud.storage.StoragePool;
|
||||
|
||||
public class ResizeVolumeCommand extends Command {
|
||||
private String path;
|
||||
|
|
|
|||
|
|
@ -16,11 +16,12 @@
|
|||
// under the License.
|
||||
package com.cloud.agent.api.storage;
|
||||
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.agent.api.storage.DownloadCommand.PasswordAuth;
|
||||
import com.cloud.agent.api.to.TemplateTO;
|
||||
import com.cloud.storage.Upload.Type;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
|
||||
public class UploadCommand extends AbstractUploadCommand implements InternalIdentity {
|
||||
|
|
|
|||
|
|
@ -19,10 +19,11 @@ package com.cloud.agent.api.to;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.network.rules.FirewallRule.State;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
/**
|
||||
* FirewallRuleTO transfers a port range for an ip to be opened.
|
||||
|
|
@ -94,7 +95,7 @@ public class FirewallRuleTO implements InternalIdentity {
|
|||
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());
|
||||
}
|
||||
|
||||
|
||||
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());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,10 +20,11 @@ package com.cloud.agent.api.to;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.network.rules.FirewallRule.TrafficType;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
|
||||
public class NetworkACLTO implements InternalIdentity {
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@
|
|||
// under the License.
|
||||
package com.cloud.agent.api.to;
|
||||
|
||||
import com.cloud.utils.S3Utils;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.cloud.utils.S3Utils;
|
||||
|
||||
public final class S3TO implements S3Utils.ClientOptions {
|
||||
|
||||
private Long id;
|
||||
|
|
|
|||
|
|
@ -16,9 +16,10 @@
|
|||
// under the License.
|
||||
package com.cloud.agent.api.to;
|
||||
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public class TemplateTO implements InternalIdentity {
|
||||
private long id;
|
||||
|
|
|
|||
|
|
@ -16,10 +16,11 @@
|
|||
// under the License.
|
||||
package com.cloud.agent.api.to;
|
||||
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.storage.Volume;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public class VolumeTO implements InternalIdentity {
|
||||
protected VolumeTO() {
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@
|
|||
// under the License.
|
||||
package com.cloud.alert;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public interface Alert extends Identity, InternalIdentity {
|
||||
short getType();
|
||||
String getSubject();
|
||||
|
|
|
|||
|
|
@ -16,14 +16,17 @@
|
|||
// under the License.
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import org.apache.cloudstack.api.*;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.DomainResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkResponse;
|
||||
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
|
||||
import org.apache.cloudstack.api.response.ProjectResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.response.NetworkResponse;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
|
|
|
|||
|
|
@ -16,11 +16,14 @@
|
|||
// under the License.
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import org.apache.cloudstack.api.*;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@ package com.cloud.api.commands;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseListCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.SnapshotScheduleResponse;
|
||||
|
||||
import com.cloud.storage.snapshot.SnapshotSchedule;
|
||||
|
||||
//@APICommand(description="Lists recurring snapshot schedule", responseObject=SnapshotScheduleResponse.class)
|
||||
|
|
|
|||
|
|
@ -20,24 +20,27 @@ import java.util.List;
|
|||
|
||||
import javax.naming.NamingException;
|
||||
|
||||
import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
|
||||
import org.apache.cloudstack.api.command.admin.ldap.LDAPConfigCmd;
|
||||
import org.apache.cloudstack.api.command.admin.ldap.LDAPRemoveCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.CreateNetworkOfferingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.DeleteNetworkOfferingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.UpdateNetworkOfferingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.offering.CreateDiskOfferingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.offering.CreateServiceOfferingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vlan.CreateVlanIpRangeCmd;
|
||||
import org.apache.cloudstack.api.command.admin.offering.*;
|
||||
import org.apache.cloudstack.api.command.admin.offering.DeleteDiskOfferingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.offering.DeleteServiceOfferingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.offering.UpdateDiskOfferingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.offering.UpdateServiceOfferingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.pod.DeletePodCmd;
|
||||
import org.apache.cloudstack.api.command.admin.pod.UpdatePodCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vlan.CreateVlanIpRangeCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vlan.DeleteVlanIpRangeCmd;
|
||||
import org.apache.cloudstack.api.command.admin.zone.CreateZoneCmd;
|
||||
import org.apache.cloudstack.api.command.admin.offering.DeleteDiskOfferingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.DeleteNetworkOfferingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd;
|
||||
import org.apache.cloudstack.api.command.admin.ldap.LDAPConfigCmd;
|
||||
import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.UpdateNetworkOfferingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.pod.UpdatePodCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.offering.UpdateDiskOfferingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.zone.UpdateZoneCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd;
|
||||
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.Pod;
|
||||
import com.cloud.dc.Vlan;
|
||||
|
|
|
|||
|
|
@ -18,11 +18,12 @@ package com.cloud.dc;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.org.Grouping;
|
||||
import org.apache.cloudstack.acl.InfrastructureEntity;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.org.Grouping;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -16,11 +16,12 @@
|
|||
// under the License.
|
||||
package com.cloud.dc;
|
||||
|
||||
import com.cloud.org.Grouping;
|
||||
import org.apache.cloudstack.acl.InfrastructureEntity;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.org.Grouping;
|
||||
|
||||
/**
|
||||
* Represents one pod in the cloud stack.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -18,10 +18,11 @@ package com.cloud.domain;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
import com.cloud.user.OwnedBy;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.user.OwnedBy;
|
||||
|
||||
/**
|
||||
* Domain defines the Domain object.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package com.cloud.exception;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.cloud.utils.exception.CSExceptionErrorCode;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package com.cloud.exception;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.SerialVersionUID;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
|
|
|||
|
|
@ -18,11 +18,12 @@ package com.cloud.host;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.resource.ResourceState;
|
||||
import com.cloud.utils.fsm.StateObject;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -16,10 +16,11 @@
|
|||
// under the License.
|
||||
package com.cloud.hypervisor;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
|
||||
|
||||
/**
|
||||
* HypervisorCapability represents one particular hypervisor version's capabilities.
|
||||
|
|
|
|||
|
|
@ -19,10 +19,11 @@ package com.cloud.network;
|
|||
import java.util.Date;
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import com.cloud.utils.net.Ip;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.utils.net.Ip;
|
||||
|
||||
/**
|
||||
*
|
||||
* - Allocated = null
|
||||
|
|
|
|||
|
|
@ -16,11 +16,24 @@
|
|||
// under the License.
|
||||
package com.cloud.network;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.network.Networks.BroadcastDomainType;
|
||||
import com.cloud.network.Networks.Mode;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
import com.cloud.network.Networks.BroadcastDomainType;
|
||||
import com.cloud.network.Networks.Mode;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
import com.cloud.utils.fsm.StateMachine2;
|
||||
import com.cloud.utils.fsm.StateObject;
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
|
@ -34,7 +47,7 @@ import java.util.List;
|
|||
*/
|
||||
public interface Network extends ControlledEntity, StateObject<Network.State>, InternalIdentity, Identity {
|
||||
|
||||
public enum GuestType {
|
||||
public enum GuestType {
|
||||
Shared,
|
||||
Isolated
|
||||
}
|
||||
|
|
@ -46,7 +59,7 @@ 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,
|
||||
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,
|
||||
|
|
@ -232,7 +245,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
|
|||
_description = description;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class IpAddresses {
|
||||
private String ip4Address;
|
||||
private String ip6Address;
|
||||
|
|
@ -270,7 +283,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
|
|||
String getGateway();
|
||||
|
||||
String getCidr();
|
||||
|
||||
|
||||
String getIp6Gateway();
|
||||
|
||||
String getIp6Cidr();
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import java.net.URI;
|
|||
import com.cloud.network.Networks.BroadcastDomainType;
|
||||
import com.cloud.network.Networks.Mode;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public class NetworkProfile implements Network {
|
||||
private long id;
|
||||
|
|
|
|||
|
|
@ -19,9 +19,10 @@ package com.cloud.network;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@
|
|||
// under the License.
|
||||
package com.cloud.network;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -18,9 +18,10 @@ package com.cloud.network;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.network.Network.Service;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.network.Network.Service;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -16,10 +16,11 @@
|
|||
// under the License.
|
||||
package com.cloud.network;
|
||||
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -17,9 +17,10 @@
|
|||
package com.cloud.network;
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import com.cloud.dc.Vlan;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.dc.Vlan;
|
||||
|
||||
/**
|
||||
*/
|
||||
public interface PublicIpAddress extends ControlledEntity, IpAddress, Vlan, InternalIdentity {
|
||||
|
|
|
|||
|
|
@ -19,11 +19,12 @@ package com.cloud.network;
|
|||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.command.admin.network.*;
|
||||
import org.apache.cloudstack.api.command.admin.network.UpdateStorageNetworkIpRangeCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.DeleteStorageNetworkIpRangeCmd;
|
||||
import com.cloud.dc.StorageNetworkIpRange;
|
||||
import org.apache.cloudstack.api.command.admin.network.CreateStorageNetworkIpRangeCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.DeleteStorageNetworkIpRangeCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.ListStorageNetworkIpRangeCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.UpdateStorageNetworkIpRangeCmd;
|
||||
|
||||
import com.cloud.dc.StorageNetworkIpRange;
|
||||
|
||||
public interface StorageNetworkService {
|
||||
StorageNetworkIpRange createIpRange(CreateStorageNetworkIpRangeCmd cmd) throws SQLException;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package com.cloud.network;
|
||||
|
||||
import org.apache.cloudstack.api.command.admin.router.UpgradeRouterCmd;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
|
|
|
|||
|
|
@ -19,11 +19,19 @@ package com.cloud.network.as;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.command.admin.autoscale.CreateCounterCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.*;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScalePolicyCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScaleVmGroupCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScaleVmProfileCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.CreateConditionCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.ListAutoScalePoliciesCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.ListAutoScaleVmGroupsCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.ListAutoScaleVmProfilesCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.ListConditionsCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.ListCountersCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScalePolicyCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScaleVmGroupCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScaleVmProfileCmd;
|
||||
|
||||
import com.cloud.exception.ResourceInUseException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,9 +20,10 @@ package com.cloud.network.as;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import com.cloud.utils.Pair;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
/**
|
||||
* AutoScaleVmProfile
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
// under the License.
|
||||
package com.cloud.network.element;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
|
@ -45,19 +44,19 @@ public interface NetworkElement extends Adapter {
|
|||
Map<Service, Map<Capability, String>> getCapabilities();
|
||||
|
||||
/**
|
||||
* NOTE:
|
||||
* NOTE:
|
||||
* NetworkElement -> Network.Provider is a one-to-one mapping. While adding a new NetworkElement, one must add a new Provider name to Network.Provider.
|
||||
*/
|
||||
Provider getProvider();
|
||||
|
||||
/**
|
||||
* Implement the network configuration as specified.
|
||||
* Implement the network configuration as specified.
|
||||
* @param config fully specified network configuration.
|
||||
* @param offering network offering that originated the network configuration.
|
||||
* @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)
|
||||
boolean implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context)
|
||||
throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
|
||||
|
||||
/**
|
||||
|
|
@ -72,8 +71,8 @@ public interface NetworkElement extends Adapter {
|
|||
* @throws ResourceUnavailableException
|
||||
* @throws InsufficientNetworkCapacityException
|
||||
*/
|
||||
boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
|
||||
boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
|
||||
ResourceUnavailableException, InsufficientCapacityException;
|
||||
|
||||
/**
|
||||
|
|
@ -86,7 +85,7 @@ public interface NetworkElement extends Adapter {
|
|||
* @throws ConcurrentOperationException
|
||||
* @throws ResourceUnavailableException
|
||||
*/
|
||||
boolean release(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
boolean release(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException;
|
||||
|
||||
/**
|
||||
|
|
@ -98,7 +97,7 @@ public interface NetworkElement extends Adapter {
|
|||
* @throws ConcurrentOperationException
|
||||
* @throws ResourceUnavailableException
|
||||
*/
|
||||
boolean shutdown(Network network, ReservationContext context, boolean cleanup)
|
||||
boolean shutdown(Network network, ReservationContext context, boolean cleanup)
|
||||
throws ConcurrentOperationException, ResourceUnavailableException;
|
||||
|
||||
/**
|
||||
|
|
@ -125,11 +124,11 @@ public interface NetworkElement extends Adapter {
|
|||
* @throws ConcurrentOperationException
|
||||
* @throws ResourceUnavailableException
|
||||
*/
|
||||
boolean shutdownProviderInstances(PhysicalNetworkServiceProvider provider, ReservationContext context)
|
||||
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.
|
||||
* 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.
|
||||
* @return true/false
|
||||
*/
|
||||
boolean canEnableIndividualServices();
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import java.util.List;
|
|||
|
||||
import org.apache.cloudstack.api.command.admin.router.ConfigureVirtualRouterElementCmd;
|
||||
import org.apache.cloudstack.api.command.admin.router.ListVirtualRouterElementsCmd;
|
||||
|
||||
import com.cloud.network.VirtualRouterProvider;
|
||||
import com.cloud.network.VirtualRouterProvider.VirtualRouterProviderType;
|
||||
import com.cloud.utils.component.PluggableService;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import com.cloud.exception.ResourceUnavailableException;
|
|||
import com.cloud.network.vpc.PrivateGateway;
|
||||
import com.cloud.network.vpc.StaticRouteProfile;
|
||||
import com.cloud.network.vpc.Vpc;
|
||||
import com.cloud.network.vpc.VpcGateway;
|
||||
import com.cloud.vm.ReservationContext;
|
||||
|
||||
public interface VpcProvider extends NetworkElement{
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ package com.cloud.network.firewall;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.firewall.ListFirewallRulesCmd;
|
||||
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ package com.cloud.network.firewall;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.network.ListNetworkACLsCmd;
|
||||
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import com.cloud.network.as.Counter;
|
|||
import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.network.rules.LoadBalancer;
|
||||
import com.cloud.utils.Pair;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public class LoadBalancingRule implements FirewallRule, LoadBalancer {
|
||||
private LoadBalancer lb;
|
||||
|
|
|
|||
|
|
@ -18,9 +18,13 @@ package com.cloud.network.lb;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.*;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLBStickinessPolicyCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLoadBalancerRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.ListLBStickinessPoliciesCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.ListLoadBalancerRuleInstancesCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.ListLoadBalancerRulesCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.UpdateLoadBalancerRuleCmd;
|
||||
|
||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
|
|
|
|||
|
|
@ -16,8 +16,9 @@
|
|||
// under the License.
|
||||
package com.cloud.network.rules;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package com.cloud.network.rules;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.firewall.ListPortForwardingRulesCmd;
|
||||
|
||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
|
|
|
|||
|
|
@ -18,10 +18,11 @@ package com.cloud.network.rules;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.utils.Pair;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
/**
|
||||
*/
|
||||
public interface StickinessPolicy extends InternalIdentity, Identity {
|
||||
|
|
|
|||
|
|
@ -15,9 +15,10 @@
|
|||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.network.security;
|
||||
import com.cloud.network.security.SecurityRule.SecurityRuleType;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.network.security.SecurityRule.SecurityRuleType;
|
||||
|
||||
public interface SecurityGroupRules extends InternalIdentity {
|
||||
|
||||
String getName();
|
||||
|
|
|
|||
|
|
@ -18,7 +18,12 @@ package com.cloud.network.security;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.securitygroup.*;
|
||||
import org.apache.cloudstack.api.command.user.securitygroup.AuthorizeSecurityGroupEgressCmd;
|
||||
import org.apache.cloudstack.api.command.user.securitygroup.AuthorizeSecurityGroupIngressCmd;
|
||||
import org.apache.cloudstack.api.command.user.securitygroup.CreateSecurityGroupCmd;
|
||||
import org.apache.cloudstack.api.command.user.securitygroup.DeleteSecurityGroupCmd;
|
||||
import org.apache.cloudstack.api.command.user.securitygroup.RevokeSecurityGroupEgressCmd;
|
||||
import org.apache.cloudstack.api.command.user.securitygroup.RevokeSecurityGroupIngressCmd;
|
||||
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
|
|
|
|||
|
|
@ -16,10 +16,11 @@
|
|||
// under the License.
|
||||
package com.cloud.network.security;
|
||||
|
||||
import com.cloud.async.AsyncInstanceCreateStatus;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.async.AsyncInstanceCreateStatus;
|
||||
|
||||
public interface SecurityRule extends Identity, InternalIdentity {
|
||||
|
||||
public static class SecurityRuleType {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
// under the License.
|
||||
package com.cloud.network.vpc;
|
||||
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public class StaticRouteProfile implements StaticRoute {
|
||||
private long id;
|
||||
|
|
|
|||
|
|
@ -17,10 +17,11 @@
|
|||
package com.cloud.network.vpc;
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import com.cloud.network.Network;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.network.Network;
|
||||
|
||||
public interface Vpc extends ControlledEntity, Identity, InternalIdentity {
|
||||
public enum State {
|
||||
Enabled,
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import java.util.Set;
|
|||
|
||||
import org.apache.cloudstack.api.command.user.vpc.ListPrivateGatewaysCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpc.ListStaticRoutesCmd;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
|
|
|
|||
|
|
@ -18,8 +18,9 @@ package com.cloud.network.vpn;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.vpn.ListVpnUsersCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.ListRemoteAccessVpnsCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.ListVpnUsersCmd;
|
||||
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.RemoteAccessVpn;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ package com.cloud.network.vpn;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.vpn.*;
|
||||
import org.apache.cloudstack.api.command.user.vpn.CreateVpnConnectionCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.CreateVpnCustomerGatewayCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.CreateVpnGatewayCmd;
|
||||
|
|
@ -26,9 +25,11 @@ import org.apache.cloudstack.api.command.user.vpn.DeleteVpnConnectionCmd;
|
|||
import org.apache.cloudstack.api.command.user.vpn.DeleteVpnCustomerGatewayCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.DeleteVpnGatewayCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.ListVpnConnectionsCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.ListVpnCustomerGatewaysCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.ListVpnGatewaysCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.ResetVpnConnectionCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.UpdateVpnCustomerGatewayCmd;
|
||||
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.Site2SiteCustomerGateway;
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@
|
|||
// under the License.
|
||||
package com.cloud.offering;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.cloudstack.acl.InfrastructureEntity;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Represents a disk offering that specifies what the end user needs in
|
||||
* the disk offering.
|
||||
|
|
|
|||
|
|
@ -16,12 +16,13 @@
|
|||
// under the License.
|
||||
package com.cloud.offering;
|
||||
|
||||
import com.cloud.network.Network.GuestType;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
import org.apache.cloudstack.acl.InfrastructureEntity;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.network.Network.GuestType;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
|
||||
/**
|
||||
* Describes network offering
|
||||
*
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@
|
|||
// under the License.
|
||||
package com.cloud.offering;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.cloudstack.acl.InfrastructureEntity;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* offered.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -16,11 +16,12 @@
|
|||
// under the License.
|
||||
package com.cloud.org;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.org.Managed.ManagedState;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.org.Managed.ManagedState;
|
||||
|
||||
public interface Cluster extends Grouping, InternalIdentity, Identity {
|
||||
public static enum ClusterType {
|
||||
CloudManaged,
|
||||
|
|
|
|||
|
|
@ -19,9 +19,10 @@ package com.cloud.projects;
|
|||
import java.util.Date;
|
||||
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import com.cloud.domain.PartOf;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.domain.PartOf;
|
||||
|
||||
public interface Project extends PartOf, Identity, InternalIdentity {
|
||||
public enum State {
|
||||
Active, Disabled, Suspended
|
||||
|
|
|
|||
|
|
@ -20,12 +20,18 @@ import java.util.List;
|
|||
|
||||
import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
|
||||
import org.apache.cloudstack.api.command.admin.cluster.DeleteClusterCmd;
|
||||
import org.apache.cloudstack.api.command.admin.host.*;
|
||||
import org.apache.cloudstack.api.command.admin.host.AddHostCmd;
|
||||
import org.apache.cloudstack.api.command.admin.host.AddSecondaryStorageCmd;
|
||||
import org.apache.cloudstack.api.command.admin.host.CancelMaintenanceCmd;
|
||||
import org.apache.cloudstack.api.command.admin.host.PrepareForMaintenanceCmd;
|
||||
import org.apache.cloudstack.api.command.admin.host.ReconnectHostCmd;
|
||||
import org.apache.cloudstack.api.command.admin.host.UpdateHostCmd;
|
||||
import org.apache.cloudstack.api.command.admin.host.UpdateHostPasswordCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.AddS3Cmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.ListS3sCmd;
|
||||
import org.apache.cloudstack.api.command.admin.swift.AddSwiftCmd;
|
||||
import org.apache.cloudstack.api.command.admin.swift.ListSwiftsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.host.PrepareForMaintenanceCmd;
|
||||
|
||||
import com.cloud.exception.DiscoveryException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.ResourceInUseException;
|
||||
|
|
@ -36,7 +42,6 @@ import com.cloud.storage.S3;
|
|||
import com.cloud.storage.Swift;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.fsm.NoTransitionException;
|
||||
import org.apache.cloudstack.api.command.admin.host.ReconnectHostCmd;
|
||||
|
||||
public interface ResourceService {
|
||||
/**
|
||||
|
|
@ -95,7 +100,7 @@ public interface ResourceService {
|
|||
Swift discoverSwift(AddSwiftCmd addSwiftCmd) throws DiscoveryException;
|
||||
|
||||
S3 discoverS3(AddS3Cmd cmd) throws DiscoveryException;
|
||||
|
||||
|
||||
List<HypervisorType> getSupportedHypervisorTypes(long zoneId, boolean forVirtualRouter, Long podId);
|
||||
|
||||
Pair<List<? extends Swift>, Integer> listSwifts(ListSwiftsCmd cmd);
|
||||
|
|
|
|||
|
|
@ -22,43 +22,42 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.cloud.alert.Alert;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.command.admin.cluster.ListClustersCmd;
|
||||
import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd;
|
||||
import org.apache.cloudstack.api.command.admin.domain.UpdateDomainCmd;
|
||||
import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.host.UpdateHostPasswordCmd;
|
||||
import org.apache.cloudstack.api.command.admin.pod.ListPodsByCmd;
|
||||
import org.apache.cloudstack.api.command.admin.resource.ListAlertsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.resource.ListCapacityCmd;
|
||||
import org.apache.cloudstack.api.command.admin.domain.UpdateDomainCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.systemvm.*;
|
||||
import org.apache.cloudstack.api.command.admin.resource.UploadCustomCertificateCmd;
|
||||
import org.apache.cloudstack.api.command.admin.systemvm.DestroySystemVmCmd;
|
||||
import org.apache.cloudstack.api.command.admin.systemvm.ListSystemVMsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.systemvm.RebootSystemVmCmd;
|
||||
import org.apache.cloudstack.api.command.admin.systemvm.StopSystemVmCmd;
|
||||
import org.apache.cloudstack.api.command.admin.systemvm.UpgradeSystemVMCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vlan.ListVlanIpRangesCmd;
|
||||
import org.apache.cloudstack.api.command.user.address.ListPublicIpAddressesCmd;
|
||||
import org.apache.cloudstack.api.command.user.config.ListCapabilitiesCmd;
|
||||
import org.apache.cloudstack.api.command.user.guest.ListGuestOsCategoriesCmd;
|
||||
import org.apache.cloudstack.api.command.user.guest.ListGuestOsCmd;
|
||||
import org.apache.cloudstack.api.command.user.iso.ListIsosCmd;
|
||||
import org.apache.cloudstack.api.command.user.iso.UpdateIsoCmd;
|
||||
import org.apache.cloudstack.api.command.user.offering.ListDiskOfferingsCmd;
|
||||
import org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd;
|
||||
import org.apache.cloudstack.api.command.user.ssh.DeleteSSHKeyPairCmd;
|
||||
import org.apache.cloudstack.api.command.user.ssh.CreateSSHKeyPairCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.ListTemplatesCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.GetVMPasswordCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.ExtractVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.UpdateTemplateCmd;
|
||||
import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd;
|
||||
import org.apache.cloudstack.api.command.user.guest.ListGuestOsCategoriesCmd;
|
||||
import org.apache.cloudstack.api.command.user.iso.ListIsosCmd;
|
||||
import org.apache.cloudstack.api.command.user.ssh.DeleteSSHKeyPairCmd;
|
||||
import org.apache.cloudstack.api.command.user.ssh.ListSSHKeyPairsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.systemvm.ListSystemVMsCmd;
|
||||
import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd;
|
||||
import org.apache.cloudstack.api.command.admin.systemvm.RebootSystemVmCmd;
|
||||
import org.apache.cloudstack.api.command.user.ssh.RegisterSSHKeyPairCmd;
|
||||
import org.apache.cloudstack.api.command.admin.systemvm.StopSystemVmCmd;
|
||||
import org.apache.cloudstack.api.command.user.iso.UpdateIsoCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.ListTemplatesCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.UpdateTemplateCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.GetVMPasswordCmd;
|
||||
import org.apache.cloudstack.api.command.user.vmgroup.UpdateVMGroupCmd;
|
||||
import org.apache.cloudstack.api.command.admin.systemvm.UpgradeSystemVMCmd;
|
||||
import org.apache.cloudstack.api.command.admin.resource.UploadCustomCertificateCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.ExtractVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd;
|
||||
|
||||
import com.cloud.alert.Alert;
|
||||
import com.cloud.capacity.Capacity;
|
||||
import com.cloud.configuration.Configuration;
|
||||
import com.cloud.dc.DataCenter;
|
||||
|
|
@ -78,7 +77,6 @@ import com.cloud.offering.ServiceOffering;
|
|||
import com.cloud.org.Cluster;
|
||||
import com.cloud.storage.GuestOS;
|
||||
import com.cloud.storage.GuestOsCategory;
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import com.cloud.user.SSHKeyPair;
|
||||
import com.cloud.utils.Pair;
|
||||
|
|
@ -127,7 +125,7 @@ public interface ManagementService {
|
|||
/**
|
||||
* Searches for servers by the specified search criteria Can search by: "name", "type", "state", "dataCenterId",
|
||||
* "podId"
|
||||
*
|
||||
*
|
||||
* @param cmd
|
||||
* @return List of Hosts
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -18,11 +18,12 @@
|
|||
*/
|
||||
package com.cloud.storage;
|
||||
|
||||
import com.cloud.agent.api.to.S3TO;
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import java.util.Date;
|
||||
import com.cloud.agent.api.to.S3TO;
|
||||
|
||||
public interface S3 extends InternalIdentity, Identity {
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
// under the License.
|
||||
package com.cloud.storage;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.utils.fsm.StateMachine2;
|
||||
import com.cloud.utils.fsm.StateObject;
|
||||
|
|
@ -23,8 +25,6 @@ import org.apache.cloudstack.acl.ControlledEntity;
|
|||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public interface Snapshot extends ControlledEntity, Identity, InternalIdentity, StateObject<Snapshot.State> {
|
||||
public enum Type {
|
||||
MANUAL,
|
||||
|
|
@ -44,6 +44,7 @@ public interface Snapshot extends ControlledEntity, Identity, InternalIdentity,
|
|||
return max;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.name();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,10 +18,11 @@ package com.cloud.storage;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
|
||||
public interface StoragePool extends Identity, InternalIdentity {
|
||||
|
||||
/**
|
||||
|
|
@ -94,4 +95,14 @@ public interface StoragePool extends Identity, InternalIdentity {
|
|||
int getPort();
|
||||
|
||||
Long getPodId();
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
String getStorageProvider();
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
String getStorageType();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package com.cloud.storage;
|
||||
|
||||
public enum StoragePoolStatus {
|
||||
Creating,
|
||||
Up,
|
||||
PrepareForMaintenance,
|
||||
ErrorInMaintenance,
|
||||
|
|
|
|||
|
|
@ -18,12 +18,14 @@ package com.cloud.storage;
|
|||
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import org.apache.cloudstack.api.command.admin.storage.*;
|
||||
import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaintenanceCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.CreateStoragePoolCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.DeletePoolCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.UpdateStoragePoolCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.UploadVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.UploadVolumeCmd;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
|
|
|
|||
|
|
@ -16,9 +16,10 @@
|
|||
// under the License.
|
||||
package com.cloud.storage;
|
||||
|
||||
import com.cloud.agent.api.to.SwiftTO;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.agent.api.to.SwiftTO;
|
||||
|
||||
public interface Swift extends InternalIdentity {
|
||||
public long getId();
|
||||
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@
|
|||
// under the License.
|
||||
package com.cloud.storage;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public interface Upload extends InternalIdentity, Identity {
|
||||
|
||||
public static enum Status {
|
||||
|
|
|
|||
|
|
@ -16,14 +16,13 @@
|
|||
// under the License.
|
||||
package com.cloud.storage;
|
||||
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface VMTemplateStorageResourceAssoc extends InternalIdentity {
|
||||
public static enum Status {
|
||||
UNKNOWN, DOWNLOAD_ERROR, NOT_DOWNLOADED, DOWNLOAD_IN_PROGRESS, DOWNLOADED, ABANDONED, UPLOADED, NOT_UPLOADED, UPLOAD_ERROR, UPLOAD_IN_PROGRESS
|
||||
UNKNOWN, DOWNLOAD_ERROR, NOT_DOWNLOADED, DOWNLOAD_IN_PROGRESS, DOWNLOADED, ABANDONED, UPLOADED, NOT_UPLOADED, UPLOAD_ERROR, UPLOAD_IN_PROGRESS, CREATING, CREATED
|
||||
}
|
||||
|
||||
String getInstallPath();
|
||||
|
|
|
|||
|
|
@ -19,11 +19,12 @@ package com.cloud.storage;
|
|||
import java.util.Date;
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.template.BasedOn;
|
||||
import com.cloud.utils.fsm.StateMachine2;
|
||||
import com.cloud.utils.fsm.StateObject;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface Volume extends ControlledEntity, Identity, InternalIdentity, BasedOn, StateObject<Volume.State> {
|
||||
enum Type {
|
||||
|
|
@ -38,8 +39,9 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
|
|||
Snapshotting("There is a snapshot created on this volume, not backed up to secondary storage yet"),
|
||||
Resizing("The volume is being resized"),
|
||||
Expunging("The volume is being expunging"),
|
||||
Destroy("The volume is destroyed, and can't be recovered."),
|
||||
UploadOp ("The volume upload operation is in progress or in short the volume is on secondary storage");
|
||||
Destroy("The volume is destroyed, and can't be recovered."),
|
||||
Destroying("The volume is destroying, and can't be recovered."),
|
||||
UploadOp ("The volume upload operation is in progress or in short the volume is on secondary storage");
|
||||
|
||||
String _description;
|
||||
|
||||
|
|
@ -63,14 +65,14 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
|
|||
s_fsm.addTransition(Creating, Event.OperationFailed, Allocated);
|
||||
s_fsm.addTransition(Creating, Event.OperationSucceeded, Ready);
|
||||
s_fsm.addTransition(Creating, Event.DestroyRequested, Destroy);
|
||||
s_fsm.addTransition(Creating, Event.CreateRequested, Creating);
|
||||
s_fsm.addTransition(Creating, Event.CreateRequested, Creating);
|
||||
s_fsm.addTransition(Ready, Event.ResizeRequested, Resizing);
|
||||
s_fsm.addTransition(Resizing, Event.OperationSucceeded, Ready);
|
||||
s_fsm.addTransition(Resizing, Event.OperationFailed, Ready);
|
||||
s_fsm.addTransition(Allocated, Event.UploadRequested, UploadOp);
|
||||
s_fsm.addTransition(UploadOp, Event.CopyRequested, Creating);// CopyRequested for volume from sec to primary storage
|
||||
s_fsm.addTransition(UploadOp, Event.CopyRequested, Creating);// CopyRequested for volume from sec to primary storage
|
||||
s_fsm.addTransition(Creating, Event.CopySucceeded, Ready);
|
||||
s_fsm.addTransition(Creating, Event.CopyFailed, UploadOp);// Copying volume from sec to primary failed.
|
||||
s_fsm.addTransition(Creating, Event.CopyFailed, UploadOp);// Copying volume from sec to primary failed.
|
||||
s_fsm.addTransition(UploadOp, Event.DestroyRequested, Destroy);
|
||||
s_fsm.addTransition(Ready, Event.DestroyRequested, Destroy);
|
||||
s_fsm.addTransition(Destroy, Event.ExpungingRequested, Expunging);
|
||||
|
|
@ -152,4 +154,14 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
|
|||
public void incrUpdatedCount();
|
||||
|
||||
public Date getUpdated();
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
String getReservationId();
|
||||
|
||||
/**
|
||||
* @param reserv
|
||||
*/
|
||||
void setReservationId(String reserv);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,10 +19,11 @@ package com.cloud.storage.snapshot;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.snapshot.CreateSnapshotPolicyCmd;
|
||||
import org.apache.cloudstack.api.command.user.snapshot.ListSnapshotsCmd;
|
||||
import org.apache.cloudstack.api.command.user.snapshot.DeleteSnapshotPoliciesCmd;
|
||||
import com.cloud.api.commands.ListRecurringSnapshotScheduleCmd;
|
||||
import org.apache.cloudstack.api.command.user.snapshot.ListSnapshotPoliciesCmd;
|
||||
import org.apache.cloudstack.api.command.user.snapshot.ListSnapshotsCmd;
|
||||
|
||||
import com.cloud.api.commands.ListRecurringSnapshotScheduleCmd;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.storage.Snapshot;
|
||||
|
|
|
|||
|
|
@ -24,10 +24,11 @@ import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoPermissionsCmd;
|
|||
import org.apache.cloudstack.api.command.user.iso.DeleteIsoCmd;
|
||||
import org.apache.cloudstack.api.command.user.iso.ExtractIsoCmd;
|
||||
import org.apache.cloudstack.api.command.user.iso.RegisterIsoCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.*;
|
||||
import org.apache.cloudstack.api.command.user.template.CopyTemplateCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.DeleteTemplateCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.ExtractTemplateCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.RegisterTemplateCmd;
|
||||
|
||||
import com.cloud.exception.InternalErrorException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.StorageUnavailableException;
|
||||
|
|
|
|||
|
|
@ -20,11 +20,12 @@ import java.util.Date;
|
|||
import java.util.Map;
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.storage.Storage.TemplateType;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface VirtualMachineTemplate extends ControlledEntity, Identity, InternalIdentity {
|
||||
|
||||
|
|
@ -89,6 +90,5 @@ public interface VirtualMachineTemplate extends ControlledEntity, Identity, Inte
|
|||
Long getSourceTemplateId();
|
||||
|
||||
String getTemplateTag();
|
||||
|
||||
Map getDetails();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,10 @@ import java.util.Map;
|
|||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||
import org.apache.cloudstack.api.command.admin.account.UpdateAccountCmd;
|
||||
import org.apache.cloudstack.api.command.admin.user.DeleteUserCmd;
|
||||
import org.apache.cloudstack.api.command.admin.user.RegisterCmd;
|
||||
import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd;
|
||||
|
||||
import org.apache.cloudstack.api.command.admin.user.RegisterCmd;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@
|
|||
// under the License.
|
||||
package com.cloud.user;
|
||||
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface User extends OwnedBy, InternalIdentity {
|
||||
public static final long UID_SYSTEM = 1;
|
||||
|
||||
|
|
@ -72,6 +72,6 @@ public interface User extends OwnedBy, InternalIdentity {
|
|||
String getRegistrationToken();
|
||||
|
||||
boolean isRegistered();
|
||||
|
||||
|
||||
public int getRegionId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@
|
|||
// under the License.
|
||||
package com.cloud.user;
|
||||
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface UserAccount extends InternalIdentity {
|
||||
long getId();
|
||||
|
||||
|
|
|
|||
|
|
@ -16,14 +16,11 @@
|
|||
// under the License.
|
||||
package com.cloud.user;
|
||||
|
||||
import com.cloud.server.ManagementService;
|
||||
import com.cloud.utils.component.ComponentLocator;
|
||||
import com.cloud.utils.component.ComponentContext;
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class UserContext {
|
||||
|
||||
private static ThreadLocal<UserContext> s_currentContext = new ThreadLocal<UserContext>();
|
||||
private static final ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
|
||||
private static final AccountService _accountMgr = locator.getManager(AccountService.class);
|
||||
|
||||
private long userId;
|
||||
private String sessionId;
|
||||
|
|
@ -31,10 +28,9 @@ public class UserContext {
|
|||
private long startEventId = 0;
|
||||
private long accountId;
|
||||
private String eventDetails;
|
||||
|
||||
private boolean apiServer;
|
||||
|
||||
private static UserContext s_adminContext = new UserContext(_accountMgr.getSystemUser().getId(), _accountMgr.getSystemAccount(), null, false);
|
||||
@Inject private AccountService _accountMgr = null;
|
||||
|
||||
public UserContext() {
|
||||
}
|
||||
|
|
@ -51,6 +47,9 @@ public class UserContext {
|
|||
}
|
||||
|
||||
public User getCallerUser() {
|
||||
if (_accountMgr == null) {
|
||||
_accountMgr = ComponentContext.getComponent(AccountService.class);
|
||||
}
|
||||
return _accountMgr.getActiveUser(userId);
|
||||
}
|
||||
|
||||
|
|
@ -90,10 +89,10 @@ public class UserContext {
|
|||
// however, there are many places that run background jobs assume the system context.
|
||||
//
|
||||
// If there is a security concern, all entry points from user (including the front end that takes HTTP
|
||||
// request in and
|
||||
// request in and
|
||||
// the core async-job manager that runs commands from user) have explicitly setup the UserContext.
|
||||
//
|
||||
return s_adminContext;
|
||||
return UserContextInitializer.getInstance().getAdminContext();
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,28 +14,27 @@
|
|||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.cluster;
|
||||
package com.cloud.user;
|
||||
|
||||
/**
|
||||
*
|
||||
* task. The state is serialized and stored. When cleanup is required
|
||||
* CleanupMaid is instantiated from the stored data and cleanup() is called.
|
||||
*
|
||||
*/
|
||||
public interface CleanupMaid {
|
||||
/**
|
||||
* cleanup according the state that was stored.
|
||||
*
|
||||
* @return 0 indicates cleanup was successful. Negative number
|
||||
* indicates the cleanup was unsuccessful but don't retry. Positive number
|
||||
* indicates the cleanup was unsuccessful and retry in this many seconds.
|
||||
*/
|
||||
int cleanup(CheckPointManager checkPointMgr);
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class UserContextInitializer {
|
||||
@Inject private AccountService _accountMgr;
|
||||
|
||||
private static UserContextInitializer s_instance;
|
||||
|
||||
public UserContextInitializer() {
|
||||
s_instance = this;
|
||||
}
|
||||
|
||||
/**
|
||||
* returned here is recorded.
|
||||
* @return
|
||||
*/
|
||||
String getCleanupProcedure();
|
||||
public static UserContextInitializer getInstance() {
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
public UserContext getAdminContext() {
|
||||
return new UserContext(_accountMgr.getSystemUser().getId(), _accountMgr.getSystemAccount(), null, false);
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@
|
|||
package com.cloud.uservm;
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ public class DiskProfile {
|
|||
private long diskOfferingId;
|
||||
private Long templateId;
|
||||
private long volumeId;
|
||||
private String path;
|
||||
|
||||
private HypervisorType hyperType;
|
||||
|
||||
|
|
@ -56,6 +57,10 @@ public class DiskProfile {
|
|||
this(vol.getId(), vol.getVolumeType(), vol.getName(), offering.getId(), vol.getSize(), offering.getTagsArray(), offering.getUseLocalStorage(), offering.isCustomized(), null);
|
||||
this.hyperType = hyperType;
|
||||
}
|
||||
|
||||
public DiskProfile(DiskProfile dp) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return size of the disk requested in bytes.
|
||||
|
|
@ -137,4 +142,16 @@ public class DiskProfile {
|
|||
public HypervisorType getHypersorType() {
|
||||
return this.hyperType;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return this.path;
|
||||
}
|
||||
|
||||
public void setSize(long size) {
|
||||
this.size = size;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,12 +21,13 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.network.Networks.AddressFormat;
|
||||
import com.cloud.network.Networks.Mode;
|
||||
import com.cloud.utils.fsm.FiniteState;
|
||||
import com.cloud.utils.fsm.StateMachine;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
/**
|
||||
* Nic represents one nic on the VM.
|
||||
|
|
|
|||
|
|
@ -18,13 +18,14 @@ package com.cloud.vm;
|
|||
|
||||
import java.net.URI;
|
||||
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.Networks.AddressFormat;
|
||||
import com.cloud.network.Networks.BroadcastDomainType;
|
||||
import com.cloud.network.Networks.Mode;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
import com.cloud.vm.Nic.ReservationStrategy;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public class NicProfile implements InternalIdentity {
|
||||
long id;
|
||||
|
|
|
|||
|
|
@ -22,20 +22,24 @@ import java.util.Map;
|
|||
import javax.naming.InsufficientResourcesException;
|
||||
|
||||
import org.apache.cloudstack.api.command.admin.vm.AssignVMCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.CreateTemplateCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.*;
|
||||
import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd;
|
||||
import org.apache.cloudstack.api.command.user.vmgroup.DeleteVMGroupCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.AddNicToVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.DeployVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.DestroyVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.RebootVMCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.RemoveNicFromVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.ResetVMPasswordCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.ResetVMSSHKeyCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.RestoreVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.StartVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.UpdateDefaultNicForVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.UpdateVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.UpgradeVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd;
|
||||
import org.apache.cloudstack.api.command.user.vmgroup.DeleteVMGroupCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd;
|
||||
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
|
|
|
|||
|
|
@ -21,14 +21,15 @@ import java.util.Map;
|
|||
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.utils.fsm.StateMachine2;
|
||||
import com.cloud.utils.fsm.StateObject;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
/**
|
||||
* VirtualMachine describes the properties held by a virtual machine
|
||||
*
|
||||
*
|
||||
*/
|
||||
public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, InternalIdentity, StateObject<VirtualMachine.State> {
|
||||
|
||||
|
|
@ -239,9 +240,11 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
|
|||
*/
|
||||
public long getTemplateId();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* returns the guest OS ID
|
||||
*
|
||||
*
|
||||
* @return guestOSId
|
||||
*/
|
||||
public long getGuestOSId();
|
||||
|
|
@ -254,7 +257,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
|
|||
/**
|
||||
* @return data center id.
|
||||
*/
|
||||
public long getDataCenterIdToDeployIn();
|
||||
public long getDataCenterId();
|
||||
|
||||
/**
|
||||
* @return id of the host it was assigned last time.
|
||||
|
|
@ -280,6 +283,8 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
|
|||
public Date getCreated();
|
||||
|
||||
public long getServiceOfferingId();
|
||||
|
||||
public Long getDiskOfferingId();
|
||||
|
||||
Type getType();
|
||||
|
||||
|
|
@ -287,5 +292,4 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
|
|||
|
||||
public Map<String, String> getDetails();
|
||||
|
||||
boolean canPlugNics();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
// under the License.
|
||||
package org.apache.cloudstack.api;
|
||||
|
||||
import org.omg.CORBA.PUBLIC_MEMBER;
|
||||
|
||||
public class ApiConstants {
|
||||
public static final String ACCOUNT = "account";
|
||||
|
|
@ -438,6 +437,7 @@ public class ApiConstants {
|
|||
public static final String COUNTERPARAM_LIST = "counterparam";
|
||||
public static final String AUTOSCALE_USER_ID = "autoscaleuserid";
|
||||
public static final String BAREMETAL_DISCOVER_NAME = "baremetaldiscovername";
|
||||
public static final String UCS_DN = "ucsdn";
|
||||
|
||||
public enum HostDetails {
|
||||
all, capacity, events, stats, min;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package org.apache.cloudstack.api;
|
||||
|
||||
import org.apache.cloudstack.api.response.AsyncJobResponse;
|
||||
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.user.UserContext;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.query.QueryService;
|
||||
import org.apache.cloudstack.region.RegionService;
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
@ -65,7 +67,6 @@ import com.cloud.user.AccountService;
|
|||
import com.cloud.user.DomainService;
|
||||
import com.cloud.user.ResourceLimitService;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.component.ComponentLocator;
|
||||
import com.cloud.vm.BareMetalVmService;
|
||||
import com.cloud.vm.UserVmService;
|
||||
|
||||
|
|
@ -93,77 +94,42 @@ public abstract class BaseCmd {
|
|||
@Parameter(name = "response", type = CommandType.STRING)
|
||||
private String responseType;
|
||||
|
||||
public static ComponentLocator s_locator;
|
||||
public static ConfigurationService _configService;
|
||||
public static AccountService _accountService;
|
||||
public static UserVmService _userVmService;
|
||||
public static ManagementService _mgr;
|
||||
public static StorageService _storageService;
|
||||
public static ResourceService _resourceService;
|
||||
public static NetworkService _networkService;
|
||||
public static TemplateService _templateService;
|
||||
public static SecurityGroupService _securityGroupService;
|
||||
public static SnapshotService _snapshotService;
|
||||
public static ConsoleProxyService _consoleProxyService;
|
||||
public static VpcVirtualNetworkApplianceService _routerService;
|
||||
public static ResponseGenerator _responseGenerator;
|
||||
public static EntityManager _entityMgr;
|
||||
public static RulesService _rulesService;
|
||||
public static AutoScaleService _autoScaleService;
|
||||
public static LoadBalancingRulesService _lbService;
|
||||
public static RemoteAccessVpnService _ravService;
|
||||
public static BareMetalVmService _bareMetalVmService;
|
||||
public static ProjectService _projectService;
|
||||
public static FirewallService _firewallService;
|
||||
public static DomainService _domainService;
|
||||
public static ResourceLimitService _resourceLimitService;
|
||||
public static IdentityService _identityService;
|
||||
public static StorageNetworkService _storageNetworkService;
|
||||
public static RegionService _regionService;
|
||||
public static TaggedResourceService _taggedResourceService;
|
||||
public static VpcService _vpcService;
|
||||
public static NetworkACLService _networkACLService;
|
||||
public static Site2SiteVpnService _s2sVpnService;
|
||||
@Inject public ConfigurationService _configService;
|
||||
@Inject public AccountService _accountService;
|
||||
@Inject public UserVmService _userVmService;
|
||||
@Inject public ManagementService _mgr;
|
||||
@Inject public StorageService _storageService;
|
||||
@Inject public ResourceService _resourceService;
|
||||
@Inject public NetworkService _networkService;
|
||||
@Inject public TemplateService _templateService;
|
||||
@Inject public SecurityGroupService _securityGroupService;
|
||||
@Inject public SnapshotService _snapshotService;
|
||||
@Inject public ConsoleProxyService _consoleProxyService;
|
||||
@Inject public VpcVirtualNetworkApplianceService _routerService;
|
||||
@Inject public ResponseGenerator _responseGenerator;
|
||||
@Inject public EntityManager _entityMgr;
|
||||
@Inject public RulesService _rulesService;
|
||||
@Inject public AutoScaleService _autoScaleService;
|
||||
@Inject public LoadBalancingRulesService _lbService;
|
||||
@Inject public RemoteAccessVpnService _ravService;
|
||||
@Inject public ProjectService _projectService;
|
||||
@Inject public FirewallService _firewallService;
|
||||
@Inject public DomainService _domainService;
|
||||
@Inject public ResourceLimitService _resourceLimitService;
|
||||
@Inject public IdentityService _identityService;
|
||||
@Inject public StorageNetworkService _storageNetworkService;
|
||||
@Inject public TaggedResourceService _taggedResourceService;
|
||||
@Inject public VpcService _vpcService;
|
||||
@Inject public NetworkACLService _networkACLService;
|
||||
@Inject public Site2SiteVpnService _s2sVpnService;
|
||||
|
||||
public static QueryService _queryService;
|
||||
|
||||
public static void setComponents(ResponseGenerator generator) {
|
||||
ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
|
||||
_mgr = (ManagementService) ComponentLocator.getComponent(ManagementService.Name);
|
||||
_accountService = locator.getManager(AccountService.class);
|
||||
_configService = locator.getManager(ConfigurationService.class);
|
||||
_userVmService = locator.getManager(UserVmService.class);
|
||||
_storageService = locator.getManager(StorageService.class);
|
||||
_resourceService = locator.getManager(ResourceService.class);
|
||||
_networkService = locator.getManager(NetworkService.class);
|
||||
_templateService = locator.getManager(TemplateService.class);
|
||||
_securityGroupService = locator.getManager(SecurityGroupService.class);
|
||||
_snapshotService = locator.getManager(SnapshotService.class);
|
||||
_consoleProxyService = locator.getManager(ConsoleProxyService.class);
|
||||
_routerService = locator.getManager(VpcVirtualNetworkApplianceService.class);
|
||||
_entityMgr = locator.getManager(EntityManager.class);
|
||||
_rulesService = locator.getManager(RulesService.class);
|
||||
_lbService = locator.getManager(LoadBalancingRulesService.class);
|
||||
_autoScaleService = locator.getManager(AutoScaleService.class);
|
||||
_ravService = locator.getManager(RemoteAccessVpnService.class);
|
||||
_responseGenerator = generator;
|
||||
_bareMetalVmService = locator.getManager(BareMetalVmService.class);
|
||||
_projectService = locator.getManager(ProjectService.class);
|
||||
_firewallService = locator.getManager(FirewallService.class);
|
||||
_domainService = locator.getManager(DomainService.class);
|
||||
_resourceLimitService = locator.getManager(ResourceLimitService.class);
|
||||
_identityService = locator.getManager(IdentityService.class);
|
||||
_storageNetworkService = locator.getManager(StorageNetworkService.class);
|
||||
_regionService = locator.getManager(RegionService.class);
|
||||
_taggedResourceService = locator.getManager(TaggedResourceService.class);
|
||||
_vpcService = locator.getManager(VpcService.class);
|
||||
_networkACLService = locator.getManager(NetworkACLService.class);
|
||||
_s2sVpnService = locator.getManager(Site2SiteVpnService.class);
|
||||
_queryService = locator.getManager(QueryService.class);
|
||||
}
|
||||
@Inject public QueryService _queryService;
|
||||
|
||||
public abstract void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException;
|
||||
|
||||
public void configure() {
|
||||
}
|
||||
|
||||
public String getResponseType() {
|
||||
if (responseType == null) {
|
||||
return RESPONSE_TYPE_XML;
|
||||
|
|
@ -180,7 +146,7 @@ public abstract class BaseCmd {
|
|||
/**
|
||||
* For commands the API framework needs to know the owner of the object being acted upon. This method is
|
||||
* used to determine that information.
|
||||
*
|
||||
*
|
||||
* @return the id of the account that owns the object being acted upon
|
||||
*/
|
||||
public abstract long getEntityOwnerId();
|
||||
|
|
@ -493,7 +459,7 @@ public abstract class BaseCmd {
|
|||
if (!enabledOnly || account.getState() == Account.State.enabled) {
|
||||
return account.getId();
|
||||
} else {
|
||||
throw new PermissionDeniedException("Can't add resources to the account id=" + account.getId() + " in state=" + account.getState() + " as it's no longer active");
|
||||
throw new PermissionDeniedException("Can't add resources to the account id=" + account.getId() + " in state=" + account.getState() + " as it's no longer active");
|
||||
}
|
||||
} else {
|
||||
// idList is not used anywhere, so removed it now
|
||||
|
|
@ -510,7 +476,7 @@ public abstract class BaseCmd {
|
|||
return project.getProjectAccountId();
|
||||
} else {
|
||||
PermissionDeniedException ex = new PermissionDeniedException("Can't add resources to the project with specified projectId in state=" + project.getState() + " as it's no longer active");
|
||||
ex.addProxyObject(project, projectId, "projectId");
|
||||
ex.addProxyObject(project, projectId, "projectId");
|
||||
throw ex;
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@ public abstract class BaseListCmd extends BaseCmd {
|
|||
// ///////////////// Accessors ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
public BaseListCmd() {
|
||||
}
|
||||
|
||||
public String getKeyword() {
|
||||
return keyword;
|
||||
}
|
||||
|
|
@ -62,10 +65,14 @@ public abstract class BaseListCmd extends BaseCmd {
|
|||
return pageSize;
|
||||
}
|
||||
|
||||
public static void configure() {
|
||||
if (_configService.getDefaultPageSize().longValue() != PAGESIZE_UNLIMITED) {
|
||||
MAX_PAGESIZE = _configService.getDefaultPageSize();
|
||||
}
|
||||
public void configure() {
|
||||
if(MAX_PAGESIZE == null) {
|
||||
if (_configService.getDefaultPageSize().longValue() != PAGESIZE_UNLIMITED) {
|
||||
MAX_PAGESIZE = _configService.getDefaultPageSize();
|
||||
} else {
|
||||
MAX_PAGESIZE = PAGESIZE_UNLIMITED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@ package org.apache.cloudstack.api;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.response.TemplatePermissionsResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.response.TemplatePermissionsResponse;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
// under the License.
|
||||
package org.apache.cloudstack.api;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ResponseObject;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue