Merge branch 'master' into vim51_win8

Conflicts:
	plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
	plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
	plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareContextFactory.java
	plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
	pom.xml

Signed-off-by: Min Chen <min.chen@citrix.com>
This commit is contained in:
Min Chen 2013-02-05 10:05:39 -08:00
commit a224287403
2502 changed files with 131550 additions and 45677 deletions

2
.gitignore vendored
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,32 @@
// 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.api;
/*
* This is used to schedule an explicit host scan in MS peers. Currently used during
* add host operation so that correct MS can take host ownership. On receiving the
* command the scan is scheduled immediately.
*/
public class ScheduleHostScanTaskCommand extends Command {
public ScheduleHostScanTaskCommand() {
}
@Override
public boolean executeInSequence() {
return false; // standalone command and can be executed independent of other commands
}
}

View File

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

View File

@ -28,7 +28,9 @@ public class DhcpEntryCommand extends NetworkElementCommand {
String defaultRouter;
String staticRoutes;
String defaultDns;
String vmIp6Address;
String ip6Gateway;
String duid;
protected DhcpEntryCommand() {
@ -39,14 +41,15 @@ public class DhcpEntryCommand extends NetworkElementCommand {
return true;
}
public DhcpEntryCommand(String vmMac, String vmIpAddress, String vmName) {
public DhcpEntryCommand(String vmMac, String vmIpAddress, String vmName, String vmIp6Address) {
this.vmMac = vmMac;
this.vmIpAddress = vmIpAddress;
this.vmName = vmName;
this.vmIp6Address = vmIp6Address;
}
public DhcpEntryCommand(String vmMac, String vmIpAddress, String vmName, String dns, String gateway) {
this(vmMac, vmIpAddress, vmName);
public DhcpEntryCommand(String vmMac, String vmIpAddress, String vmName, String vmIp6Address, String dns, String gateway, String ip6Gateway) {
this(vmMac, vmIpAddress, vmName, vmIp6Address);
this.dns = dns;
this.gateway = gateway;
}
@ -102,4 +105,28 @@ public class DhcpEntryCommand extends NetworkElementCommand {
public void setDefaultDns(String defaultDns) {
this.defaultDns = defaultDns;
}
public String getIp6Gateway() {
return ip6Gateway;
}
public void setIp6Gateway(String ip6Gateway) {
this.ip6Gateway = ip6Gateway;
}
public String getDuid() {
return duid;
}
public void setDuid(String duid) {
this.duid = duid;
}
public String getVmIp6Address() {
return vmIp6Address;
}
public void setVmIp6Address(String ip6Address) {
this.vmIp6Address = ip6Address;
}
}

View File

@ -16,7 +16,6 @@
// under the License.
package com.cloud.agent.api.storage;
import com.cloud.agent.api.Command;
public class CreateEntityDownloadURLCommand extends AbstractDownloadCommand {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -44,4 +44,9 @@ public interface Vlan extends InfrastructureEntity, InternalIdentity, Identity {
public Long getPhysicalNetworkId();
public String getIp6Gateway();
public String getIp6Cidr();
public String getIp6Range();
}

View File

@ -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.
*/
@ -58,4 +59,8 @@ public interface Domain extends OwnedBy, Identity, InternalIdentity {
void setState(State state);
String getNetworkDomain();
public String getUuid();
int getRegionId();
}

View File

@ -0,0 +1,55 @@
/*
* 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.event;
import java.util.ArrayList;
import java.util.List;
public class EventCategory {
private static List<EventCategory> eventCategories = new ArrayList<EventCategory>();
private String eventCategoryName;
public EventCategory(String categoryName) {
this.eventCategoryName = categoryName;
eventCategories.add(this);
}
public String getName() {
return eventCategoryName;
}
public static List<EventCategory> listAllEventCategories() {
return eventCategories;
}
public static EventCategory getEventCategory(String categoryName) {
for (EventCategory category : eventCategories) {
if (category.getName().equalsIgnoreCase(categoryName)) {
return category;
}
}
return null;
}
public static final EventCategory ACTION_EVENT = new EventCategory("ActionEvent");
public static final EventCategory ALERT_EVENT = new EventCategory("AlertEvent");
public static final EventCategory USAGE_EVENT = new EventCategory("UsageEvent");
public static final EventCategory RESOURCE_STATE_CHANGE_EVENT = new EventCategory("ResourceStateEvent");
}

View File

@ -16,7 +16,41 @@
// under the License.
package com.cloud.event;
import com.cloud.configuration.Configuration;
import com.cloud.dc.DataCenter;
import com.cloud.dc.Pod;
import com.cloud.dc.StorageNetworkIpRange;
import com.cloud.dc.Vlan;
import com.cloud.domain.Domain;
import com.cloud.host.Host;
import com.cloud.network.*;
import com.cloud.network.as.*;
import com.cloud.network.router.VirtualRouter;
import com.cloud.network.rules.LoadBalancer;
import com.cloud.network.rules.StaticNat;
import com.cloud.network.security.SecurityGroup;
import com.cloud.network.vpc.PrivateGateway;
import com.cloud.network.vpc.StaticRoute;
import com.cloud.network.vpc.Vpc;
import com.cloud.offering.DiskOffering;
import com.cloud.offering.NetworkOffering;
import com.cloud.offering.ServiceOffering;
import com.cloud.projects.Project;
import com.cloud.storage.Snapshot;
import com.cloud.storage.Volume;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.vm.VirtualMachine;
import java.util.HashMap;
import java.util.Map;
public class EventTypes {
//map of Event and corresponding entity for which Event is applicable
private static Map<String, String> entityEventDetails = null;
// VM Events
public static final String EVENT_VM_CREATE = "VM.CREATE";
public static final String EVENT_VM_DESTROY = "VM.DESTROY";
@ -319,10 +353,323 @@ public class EventTypes {
public static final String EVENT_AUTOSCALEVMGROUP_UPDATE = "AUTOSCALEVMGROUP.UPDATE";
public static final String EVENT_AUTOSCALEVMGROUP_ENABLE = "AUTOSCALEVMGROUP.ENABLE";
public static final String EVENT_AUTOSCALEVMGROUP_DISABLE = "AUTOSCALEVMGROUP.DISABLE";
public static final String EVENT_BAREMETAL_DHCP_SERVER_ADD = "PHYSICAL.DHCP.ADD";
public static final String EVENT_BAREMETAL_DHCP_SERVER_DELETE = "PHYSICAL.DHCP.DELETE";
public static final String EVENT_BAREMETAL_PXE_SERVER_ADD = "PHYSICAL.PXE.ADD";
public static final String EVENT_BAREMETAL_PXE_SERVER_DELETE = "PHYSICAL.PXE.DELETE";
static {
// TODO: need a way to force author adding event types to declare the entity details as well, with out braking
// current ActionEvent annotation semantics
entityEventDetails = new HashMap<String, String>();
entityEventDetails.put(EVENT_VM_CREATE, VirtualMachine.class.getName());
entityEventDetails.put(EVENT_VM_DESTROY, VirtualMachine.class.getName());
entityEventDetails.put(EVENT_VM_START, VirtualMachine.class.getName());
entityEventDetails.put(EVENT_VM_STOP, VirtualMachine.class.getName());
entityEventDetails.put(EVENT_VM_REBOOT, VirtualMachine.class.getName());
entityEventDetails.put(EVENT_VM_UPDATE, VirtualMachine.class.getName());
entityEventDetails.put(EVENT_VM_UPGRADE, VirtualMachine.class.getName());
entityEventDetails.put(EVENT_VM_RESETPASSWORD, VirtualMachine.class.getName());
entityEventDetails.put(EVENT_VM_MIGRATE, VirtualMachine.class.getName());
entityEventDetails.put(EVENT_VM_MOVE, VirtualMachine.class.getName());
entityEventDetails.put(EVENT_VM_RESTORE, VirtualMachine.class.getName());
entityEventDetails.put(EVENT_ROUTER_CREATE, VirtualRouter.class.getName());
entityEventDetails.put(EVENT_ROUTER_DESTROY, VirtualRouter.class.getName());
entityEventDetails.put(EVENT_ROUTER_START, VirtualRouter.class.getName());
entityEventDetails.put(EVENT_ROUTER_STOP, VirtualRouter.class.getName());
entityEventDetails.put(EVENT_ROUTER_REBOOT, VirtualRouter.class.getName());
entityEventDetails.put(EVENT_ROUTER_HA, VirtualRouter.class.getName());
entityEventDetails.put(EVENT_ROUTER_UPGRADE, VirtualRouter.class.getName());
entityEventDetails.put(EVENT_PROXY_CREATE, "ConsoleProxy");
entityEventDetails.put(EVENT_PROXY_DESTROY, "ConsoleProxy");
entityEventDetails.put(EVENT_PROXY_START, "ConsoleProxy");
entityEventDetails.put(EVENT_PROXY_STOP, "ConsoleProxy");
entityEventDetails.put(EVENT_PROXY_REBOOT, "ConsoleProxy");
entityEventDetails.put(EVENT_ROUTER_HA, "ConsoleProxy");
entityEventDetails.put(EVENT_PROXY_HA, "ConsoleProxy");
entityEventDetails.put(EVENT_VNC_CONNECT, "VNC");
entityEventDetails.put(EVENT_VNC_DISCONNECT, "VNC");
// Network Events
entityEventDetails.put(EVENT_NETWORK_CREATE, Network.class.getName());
entityEventDetails.put(EVENT_NETWORK_DELETE, Network.class.getName());
entityEventDetails.put(EVENT_NETWORK_UPDATE, Network.class.getName());
entityEventDetails.put(EVENT_NETWORK_RESTART, Network.class.getName());
entityEventDetails.put(EVENT_NET_IP_ASSIGN, PublicIpAddress.class.getName());
entityEventDetails.put(EVENT_NET_IP_RELEASE, PublicIpAddress.class.getName());
entityEventDetails.put(EVENT_NET_RULE_ADD, Network.class.getName());
entityEventDetails.put(EVENT_NET_RULE_DELETE, Network.class.getName());
entityEventDetails.put(EVENT_NET_RULE_MODIFY, Network.class.getName());
entityEventDetails.put(EVENT_FIREWALL_OPEN, Network.class.getName());
entityEventDetails.put(EVENT_FIREWALL_CLOSE, Network.class.getName());
// Load Balancers
entityEventDetails.put(EVENT_ASSIGN_TO_LOAD_BALANCER_RULE, LoadBalancer.class.getName());
entityEventDetails.put(EVENT_REMOVE_FROM_LOAD_BALANCER_RULE, LoadBalancer.class.getName());
entityEventDetails.put(EVENT_LOAD_BALANCER_CREATE, LoadBalancer.class.getName());
entityEventDetails.put(EVENT_LOAD_BALANCER_DELETE, LoadBalancer.class.getName());
entityEventDetails.put(EVENT_LB_STICKINESSPOLICY_CREATE, LoadBalancer.class.getName());
entityEventDetails.put(EVENT_LB_STICKINESSPOLICY_DELETE, LoadBalancer.class.getName());
entityEventDetails.put(EVENT_LOAD_BALANCER_UPDATE, LoadBalancer.class.getName());
// Account events
entityEventDetails.put(EVENT_ACCOUNT_DISABLE, Account.class.getName());
entityEventDetails.put(EVENT_ACCOUNT_CREATE, Account.class.getName());
entityEventDetails.put(EVENT_ACCOUNT_DELETE, Account.class.getName());
entityEventDetails.put(EVENT_ACCOUNT_MARK_DEFAULT_ZONE, Account.class.getName());
// UserVO Events
entityEventDetails.put(EVENT_USER_LOGIN, User.class.getName());
entityEventDetails.put(EVENT_USER_LOGOUT, User.class.getName());
entityEventDetails.put(EVENT_USER_CREATE, User.class.getName());
entityEventDetails.put(EVENT_USER_DELETE, User.class.getName());
entityEventDetails.put(EVENT_USER_DISABLE, User.class.getName());
entityEventDetails.put(EVENT_USER_UPDATE, User.class.getName());
entityEventDetails.put(EVENT_USER_ENABLE, User.class.getName());
entityEventDetails.put(EVENT_USER_LOCK, User.class.getName());
// Template Events
entityEventDetails.put(EVENT_TEMPLATE_CREATE, VirtualMachineTemplate.class.getName());
entityEventDetails.put(EVENT_TEMPLATE_DELETE, VirtualMachineTemplate.class.getName());
entityEventDetails.put(EVENT_TEMPLATE_UPDATE, VirtualMachineTemplate.class.getName());
entityEventDetails.put(EVENT_TEMPLATE_DOWNLOAD_START, VirtualMachineTemplate.class.getName());
entityEventDetails.put(EVENT_TEMPLATE_DOWNLOAD_SUCCESS, VirtualMachineTemplate.class.getName());
entityEventDetails.put(EVENT_TEMPLATE_DOWNLOAD_FAILED, VirtualMachineTemplate.class.getName());
entityEventDetails.put(EVENT_TEMPLATE_COPY, VirtualMachineTemplate.class.getName());
entityEventDetails.put(EVENT_TEMPLATE_EXTRACT, VirtualMachineTemplate.class.getName());
entityEventDetails.put(EVENT_TEMPLATE_UPLOAD, VirtualMachineTemplate.class.getName());
entityEventDetails.put(EVENT_TEMPLATE_CLEANUP, VirtualMachineTemplate.class.getName());
// Volume Events
entityEventDetails.put(EVENT_VOLUME_CREATE, Volume.class.getName());
entityEventDetails.put(EVENT_VOLUME_DELETE, Volume.class.getName());
entityEventDetails.put(EVENT_VOLUME_ATTACH, Volume.class.getName());
entityEventDetails.put(EVENT_VOLUME_DETACH, Volume.class.getName());
entityEventDetails.put(EVENT_VOLUME_EXTRACT, Volume.class.getName());
entityEventDetails.put(EVENT_VOLUME_UPLOAD, Volume.class.getName());
entityEventDetails.put(EVENT_VOLUME_MIGRATE, Volume.class.getName());
entityEventDetails.put(EVENT_VOLUME_RESIZE, Volume.class.getName());
// Domains
entityEventDetails.put(EVENT_DOMAIN_CREATE, Domain.class.getName());
entityEventDetails.put(EVENT_DOMAIN_DELETE, Domain.class.getName());
entityEventDetails.put(EVENT_DOMAIN_UPDATE, Domain.class.getName());
// Snapshots
entityEventDetails.put(EVENT_SNAPSHOT_CREATE, Snapshot.class.getName());
entityEventDetails.put(EVENT_SNAPSHOT_DELETE, Snapshot.class.getName());
entityEventDetails.put(EVENT_SNAPSHOT_POLICY_CREATE, Snapshot.class.getName());
entityEventDetails.put(EVENT_SNAPSHOT_POLICY_UPDATE, Snapshot.class.getName());
entityEventDetails.put(EVENT_SNAPSHOT_POLICY_DELETE, Snapshot.class.getName());
// ISO
entityEventDetails.put(EVENT_ISO_CREATE, "Iso");
entityEventDetails.put(EVENT_ISO_DELETE, "Iso");
entityEventDetails.put(EVENT_ISO_COPY, "Iso");
entityEventDetails.put(EVENT_ISO_ATTACH, "Iso");
entityEventDetails.put(EVENT_ISO_DETACH, "Iso");
entityEventDetails.put(EVENT_ISO_EXTRACT, "Iso");
entityEventDetails.put(EVENT_ISO_UPLOAD, "Iso");
// SSVM
entityEventDetails.put(EVENT_SSVM_CREATE, "SecondaryStorageVm");
entityEventDetails.put(EVENT_SSVM_DESTROY, "SecondaryStorageVm");
entityEventDetails.put(EVENT_SSVM_START, "SecondaryStorageVm");
entityEventDetails.put(EVENT_SSVM_STOP, "SecondaryStorageVm");
entityEventDetails.put(EVENT_SSVM_REBOOT, "SecondaryStorageVm");
entityEventDetails.put(EVENT_SSVM_HA, "SecondaryStorageVm");
// Service Offerings
entityEventDetails.put(EVENT_SERVICE_OFFERING_CREATE, ServiceOffering.class.getName());
entityEventDetails.put(EVENT_SERVICE_OFFERING_EDIT, ServiceOffering.class.getName());
entityEventDetails.put(EVENT_SERVICE_OFFERING_DELETE, ServiceOffering.class.getName());
// Disk Offerings
entityEventDetails.put(EVENT_DISK_OFFERING_CREATE, DiskOffering.class.getName());
entityEventDetails.put(EVENT_DISK_OFFERING_EDIT, DiskOffering.class.getName());
entityEventDetails.put(EVENT_DISK_OFFERING_DELETE, DiskOffering.class.getName());
// Network offerings
entityEventDetails.put(EVENT_NETWORK_OFFERING_CREATE, NetworkOffering.class.getName());
entityEventDetails.put(EVENT_NETWORK_OFFERING_ASSIGN, NetworkOffering.class.getName());
entityEventDetails.put(EVENT_NETWORK_OFFERING_EDIT, NetworkOffering.class.getName());
entityEventDetails.put(EVENT_NETWORK_OFFERING_REMOVE, NetworkOffering.class.getName());
entityEventDetails.put(EVENT_NETWORK_OFFERING_DELETE, NetworkOffering.class.getName());
// Pods
entityEventDetails.put(EVENT_POD_CREATE, Pod.class.getName());
entityEventDetails.put(EVENT_POD_EDIT, Pod.class.getName());
entityEventDetails.put(EVENT_POD_DELETE, Pod.class.getName());
// Zones
entityEventDetails.put(EVENT_ZONE_CREATE, DataCenter.class.getName());
entityEventDetails.put(EVENT_ZONE_EDIT, DataCenter.class.getName());
entityEventDetails.put(EVENT_ZONE_DELETE, DataCenter.class.getName());
// VLANs/IP ranges
entityEventDetails.put(EVENT_VLAN_IP_RANGE_CREATE, Vlan.class.getName());
entityEventDetails.put(EVENT_VLAN_IP_RANGE_DELETE,Vlan.class.getName());
entityEventDetails.put(EVENT_STORAGE_IP_RANGE_CREATE, StorageNetworkIpRange.class.getName());
entityEventDetails.put(EVENT_STORAGE_IP_RANGE_DELETE, StorageNetworkIpRange.class.getName());
entityEventDetails.put(EVENT_STORAGE_IP_RANGE_UPDATE, StorageNetworkIpRange.class.getName());
// Configuration Table
entityEventDetails.put(EVENT_CONFIGURATION_VALUE_EDIT, Configuration.class.getName());
// Security Groups
entityEventDetails.put(EVENT_SECURITY_GROUP_AUTHORIZE_INGRESS, SecurityGroup.class.getName());
entityEventDetails.put(EVENT_SECURITY_GROUP_REVOKE_INGRESS, SecurityGroup.class.getName());
entityEventDetails.put(EVENT_SECURITY_GROUP_AUTHORIZE_EGRESS, SecurityGroup.class.getName());
entityEventDetails.put(EVENT_SECURITY_GROUP_REVOKE_EGRESS, SecurityGroup.class.getName());
entityEventDetails.put(EVENT_SECURITY_GROUP_CREATE, SecurityGroup.class.getName());
entityEventDetails.put(EVENT_SECURITY_GROUP_DELETE, SecurityGroup.class.getName());
entityEventDetails.put(EVENT_SECURITY_GROUP_ASSIGN, SecurityGroup.class.getName());
entityEventDetails.put(EVENT_SECURITY_GROUP_REMOVE, SecurityGroup.class.getName());
// Host
entityEventDetails.put(EVENT_HOST_RECONNECT, Host.class.getName());
// Maintenance
entityEventDetails.put(EVENT_MAINTENANCE_CANCEL, Host.class.getName());
entityEventDetails.put(EVENT_MAINTENANCE_CANCEL_PRIMARY_STORAGE, Host.class.getName());
entityEventDetails.put(EVENT_MAINTENANCE_PREPARE, Host.class.getName());
entityEventDetails.put(EVENT_MAINTENANCE_PREPARE_PRIMARY_STORAGE, Host.class.getName());
// VPN
entityEventDetails.put(EVENT_REMOTE_ACCESS_VPN_CREATE, RemoteAccessVpn.class.getName());
entityEventDetails.put(EVENT_REMOTE_ACCESS_VPN_DESTROY, RemoteAccessVpn.class.getName());
entityEventDetails.put(EVENT_VPN_USER_ADD, RemoteAccessVpn.class.getName());
entityEventDetails.put(EVENT_VPN_USER_REMOVE, RemoteAccessVpn.class.getName());
entityEventDetails.put(EVENT_S2S_VPN_GATEWAY_CREATE, RemoteAccessVpn.class.getName());
entityEventDetails.put(EVENT_S2S_VPN_GATEWAY_DELETE, RemoteAccessVpn.class.getName());
entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_CREATE, RemoteAccessVpn.class.getName());
entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_DELETE, RemoteAccessVpn.class.getName());
entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_UPDATE, RemoteAccessVpn.class.getName());
entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_CREATE, RemoteAccessVpn.class.getName());
entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_DELETE, RemoteAccessVpn.class.getName());
entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_RESET, RemoteAccessVpn.class.getName());
// Custom certificates
entityEventDetails.put(EVENT_UPLOAD_CUSTOM_CERTIFICATE, "Certificate");
// OneToOnenat
entityEventDetails.put(EVENT_ENABLE_STATIC_NAT, StaticNat.class.getName());
entityEventDetails.put(EVENT_DISABLE_STATIC_NAT, StaticNat.class.getName());
entityEventDetails.put(EVENT_ZONE_VLAN_ASSIGN,Vlan.class.getName());
entityEventDetails.put(EVENT_ZONE_VLAN_RELEASE,Vlan.class.getName());
// Projects
entityEventDetails.put(EVENT_PROJECT_CREATE, Project.class.getName());
entityEventDetails.put(EVENT_PROJECT_UPDATE, Project.class.getName());
entityEventDetails.put(EVENT_PROJECT_DELETE, Project.class.getName());
entityEventDetails.put(EVENT_PROJECT_ACTIVATE, Project.class.getName());
entityEventDetails.put(EVENT_PROJECT_SUSPEND, Project.class.getName());
entityEventDetails.put(EVENT_PROJECT_ACCOUNT_ADD, Project.class.getName());
entityEventDetails.put(EVENT_PROJECT_INVITATION_UPDATE, Project.class.getName());
entityEventDetails.put(EVENT_PROJECT_INVITATION_REMOVE, Project.class.getName());
entityEventDetails.put(EVENT_PROJECT_ACCOUNT_REMOVE, Project.class.getName());
// Network as a Service
entityEventDetails.put(EVENT_NETWORK_ELEMENT_CONFIGURE,Network.class.getName());
// Physical Network Events
entityEventDetails.put(EVENT_PHYSICAL_NETWORK_CREATE, PhysicalNetwork.class.getName());
entityEventDetails.put(EVENT_PHYSICAL_NETWORK_DELETE, PhysicalNetwork.class.getName());
entityEventDetails.put(EVENT_PHYSICAL_NETWORK_UPDATE, PhysicalNetwork.class.getName());
// Physical Network Service Provider Events
entityEventDetails.put(EVENT_SERVICE_PROVIDER_CREATE, PhysicalNetworkServiceProvider.class.getName());
entityEventDetails.put(EVENT_SERVICE_PROVIDER_DELETE, PhysicalNetworkServiceProvider.class.getName());
entityEventDetails.put(EVENT_SERVICE_PROVIDER_UPDATE, PhysicalNetworkServiceProvider.class.getName());
// Physical Network TrafficType Events
entityEventDetails.put(EVENT_TRAFFIC_TYPE_CREATE, PhysicalNetworkTrafficType.class.getName());
entityEventDetails.put(EVENT_TRAFFIC_TYPE_DELETE, PhysicalNetworkTrafficType.class.getName());
entityEventDetails.put(EVENT_TRAFFIC_TYPE_UPDATE, PhysicalNetworkTrafficType.class.getName());
// external network device events
entityEventDetails.put(EVENT_EXTERNAL_LB_DEVICE_ADD, PhysicalNetwork.class.getName());
entityEventDetails.put(EVENT_EXTERNAL_LB_DEVICE_DELETE, PhysicalNetwork.class.getName());
entityEventDetails.put(EVENT_EXTERNAL_LB_DEVICE_CONFIGURE, PhysicalNetwork.class.getName());
// external switch management device events (E.g.: Cisco Nexus 1000v Virtual Supervisor Module.
entityEventDetails.put(EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_ADD, "Nexus1000v");
entityEventDetails.put(EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_DELETE, "Nexus1000v");
entityEventDetails.put(EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_CONFIGURE, "Nexus1000v");
entityEventDetails.put(EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_ENABLE, "Nexus1000v");
entityEventDetails.put(EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_DISABLE, "Nexus1000v");
entityEventDetails.put(EVENT_EXTERNAL_FIREWALL_DEVICE_ADD, PhysicalNetwork.class.getName());
entityEventDetails.put(EVENT_EXTERNAL_FIREWALL_DEVICE_DELETE, PhysicalNetwork.class.getName());
entityEventDetails.put(EVENT_EXTERNAL_FIREWALL_DEVICE_CONFIGURE, PhysicalNetwork.class.getName());
// VPC
entityEventDetails.put(EVENT_VPC_CREATE, Vpc.class.getName());
entityEventDetails.put(EVENT_VPC_UPDATE, Vpc.class.getName());
entityEventDetails.put(EVENT_VPC_DELETE, Vpc.class.getName());
entityEventDetails.put(EVENT_VPC_RESTART, Vpc.class.getName());
// VPC offerings
entityEventDetails.put(EVENT_VPC_OFFERING_CREATE, Vpc.class.getName());
entityEventDetails.put(EVENT_VPC_OFFERING_UPDATE, Vpc.class.getName());
entityEventDetails.put(EVENT_VPC_OFFERING_DELETE, Vpc.class.getName());
// Private gateway
entityEventDetails.put(EVENT_PRIVATE_GATEWAY_CREATE, PrivateGateway.class.getName());
entityEventDetails.put(EVENT_PRIVATE_GATEWAY_DELETE, PrivateGateway.class.getName());
// Static routes
entityEventDetails.put(EVENT_STATIC_ROUTE_CREATE, StaticRoute.class.getName());
entityEventDetails.put(EVENT_STATIC_ROUTE_DELETE, StaticRoute.class.getName());
// tag related events
entityEventDetails.put(EVENT_TAGS_CREATE, "Tag");
entityEventDetails.put(EVENT_TAGS_DELETE, "tag");
// external network device events
entityEventDetails.put(EVENT_EXTERNAL_NVP_CONTROLLER_ADD, "NvpController");
entityEventDetails.put(EVENT_EXTERNAL_NVP_CONTROLLER_DELETE, "NvpController");
entityEventDetails.put(EVENT_EXTERNAL_NVP_CONTROLLER_CONFIGURE, "NvpController");
// AutoScale
entityEventDetails.put(EVENT_COUNTER_CREATE, AutoScaleCounter.class.getName());
entityEventDetails.put(EVENT_COUNTER_DELETE, AutoScaleCounter.class.getName());
entityEventDetails.put(EVENT_CONDITION_CREATE, Condition.class.getName());
entityEventDetails.put(EVENT_CONDITION_DELETE, Condition.class.getName());
entityEventDetails.put(EVENT_AUTOSCALEPOLICY_CREATE, AutoScalePolicy.class.getName());
entityEventDetails.put(EVENT_AUTOSCALEPOLICY_UPDATE, AutoScalePolicy.class.getName());
entityEventDetails.put(EVENT_AUTOSCALEPOLICY_DELETE, AutoScalePolicy.class.getName());
entityEventDetails.put(EVENT_AUTOSCALEVMPROFILE_CREATE, AutoScaleVmProfile.class.getName());
entityEventDetails.put(EVENT_AUTOSCALEVMPROFILE_DELETE, AutoScaleVmProfile.class.getName());
entityEventDetails.put(EVENT_AUTOSCALEVMPROFILE_UPDATE, AutoScaleVmProfile.class.getName());
entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_CREATE, AutoScaleVmGroup.class.getName());
entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_DELETE, AutoScaleVmGroup.class.getName());
entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_UPDATE, AutoScaleVmGroup.class.getName());
entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_ENABLE, AutoScaleVmGroup.class.getName());
entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_DISABLE, AutoScaleVmGroup.class.getName());
}
public static String getEntityForEvent (String eventName) {
String entityClassName = entityEventDetails.get(eventName);
if (entityClassName == null || entityClassName.isEmpty()) {
return null;
}
int index = entityClassName.lastIndexOf(".");
String entityName = entityClassName;
if (index != -1) {
entityName = entityClassName.substring(index+1);
}
return entityName;
}
}

View File

@ -17,6 +17,7 @@
package com.cloud.exception;
import java.util.ArrayList;
import com.cloud.utils.exception.CSExceptionErrorCode;
/**

View File

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

View File

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

View File

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

View File

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

View File

@ -16,24 +16,36 @@
// 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.utils.fsm.FiniteState;
import com.cloud.utils.fsm.StateMachine;
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;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
* owned by an account.
*/
public interface Network extends ControlledEntity, InternalIdentity, Identity {
public interface Network extends ControlledEntity, StateObject<Network.State>, InternalIdentity, Identity {
public enum GuestType {
Shared,
@ -47,7 +59,7 @@ public interface Network extends ControlledEntity, InternalIdentity, Identity {
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,
@ -123,7 +135,8 @@ public interface Network extends ControlledEntity, InternalIdentity, Identity {
public static final Provider SecurityGroupProvider = new Provider("SecurityGroupProvider", false);
public static final Provider VPCVirtualRouter = new Provider("VpcVirtualRouter", false);
public static final Provider None = new Provider("None", false);
public static final Provider NiciraNvp = new Provider("NiciraNvp", true);
// NiciraNvp is not an "External" provider, otherwise we get in trouble with NetworkServiceImpl.providersConfiguredForExternalNetworking
public static final Provider NiciraNvp = new Provider("NiciraNvp", false);
public static final Provider MidokuraMidonet = new Provider("MidokuraMidonet", true);
private String name;
@ -204,7 +217,8 @@ public interface Network extends ControlledEntity, InternalIdentity, Identity {
OperationFailed;
}
enum State implements FiniteState<State, Event> {
public enum State {
Allocated("Indicates the network configuration is in allocated but not setup"),
Setup("Indicates the network configuration is setup"),
Implementing("Indicates the network configuration is being implemented"),
@ -212,39 +226,8 @@ public interface Network extends ControlledEntity, InternalIdentity, Identity {
Shutdown("Indicates the network configuration is being destroyed"),
Destroy("Indicates that the network is destroyed");
protected static final StateMachine2<State, Network.Event, Network> s_fsm = new StateMachine2<State, Network.Event, Network>();
@Override
public StateMachine<State, Event> getStateMachine() {
return s_fsm;
}
@Override
public State getNextState(Event event) {
return s_fsm.getNextState(this, event);
}
@Override
public List<State> getFromStates(Event event) {
return s_fsm.getFromStates(this, event);
}
@Override
public Set<Event> getPossibleEvents() {
return s_fsm.getPossibleEvents(this);
}
String _description;
@Override
public String getDescription() {
return _description;
}
private State(String description) {
_description = description;
}
private static StateMachine<State, Event> s_fsm = new StateMachine<State, Event>();
static {
s_fsm.addTransition(State.Allocated, Event.ImplementNetwork, State.Implementing);
s_fsm.addTransition(State.Implementing, Event.OperationSucceeded, State.Implemented);
@ -253,8 +236,43 @@ public interface Network extends ControlledEntity, InternalIdentity, Identity {
s_fsm.addTransition(State.Shutdown, Event.OperationSucceeded, State.Allocated);
s_fsm.addTransition(State.Shutdown, Event.OperationFailed, State.Implemented);
}
public static StateMachine2<State, Network.Event, Network> getStateMachine() {
return s_fsm;
}
String _description;
private State(String description) {
_description = description;
}
}
public class IpAddresses {
private String ip4Address;
private String ip6Address;
public IpAddresses(String ip4Address, String ip6Address) {
this.setIp4Address(ip4Address);
this.setIp6Address(ip6Address);
}
public String getIp4Address() {
return ip4Address;
}
public void setIp4Address(String ip4Address) {
this.ip4Address = ip4Address;
}
public String getIp6Address() {
return ip6Address;
}
public void setIp6Address(String ip6Address) {
this.ip6Address = ip6Address;
}
}
String getName();
Mode getMode();
@ -267,6 +285,10 @@ public interface Network extends ControlledEntity, InternalIdentity, Identity {
String getCidr();
String getIp6Gateway();
String getIp6Cidr();
long getDataCenterId();
long getNetworkOfferingId();

View File

@ -249,4 +249,5 @@ public interface NetworkModel {
boolean isNetworkInlineMode(Network network);
Vlan getVlanForNetwork(long networkId);
}

View File

@ -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;
@ -39,6 +38,8 @@ public class NetworkProfile implements Network {
private TrafficType trafficType;
private String gateway;
private String cidr;
private String ip6Gateway;
private String ip6Cidr;
private long networkOfferingId;
private long related;
private String displayText;
@ -64,6 +65,8 @@ public class NetworkProfile implements Network {
this.trafficType = network.getTrafficType();
this.gateway = network.getGateway();
this.cidr = network.getCidr();
this.ip6Gateway = network.getIp6Gateway();
this.ip6Cidr = network.getIp6Cidr();
this.networkOfferingId = network.getNetworkOfferingId();
this.related = network.getRelated();
this.displayText = network.getDisplayText();
@ -230,4 +233,14 @@ public class NetworkProfile implements Network {
public void setTrafficType(TrafficType type) {
this.trafficType = type;
}
@Override
public String getIp6Gateway() {
return ip6Gateway;
}
@Override
public String getIp6Cidr() {
return ip6Cidr;
}
}

View File

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

View File

@ -48,7 +48,7 @@ public class Networks {
public enum AddressFormat {
Ip4,
Ip6,
Mixed
DualStack
}
/**

View File

@ -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;
/**
*
*/
@ -35,7 +35,8 @@ public interface PhysicalNetwork extends Identity, InternalIdentity {
VLAN,
L3,
GRE,
STT;
STT,
VNS;
}
public enum BroadcastDomainRange {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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
*
@ -110,4 +111,7 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
boolean getSpecifyIpRanges();
boolean isInline();
boolean getIsPersistent();
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -18,12 +18,14 @@ package com.cloud.storage;
import java.util.Date;
import org.apache.cloudstack.acl.ControlledEntity;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
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;
public interface Snapshot extends ControlledEntity, Identity, InternalIdentity {
public interface Snapshot extends ControlledEntity, Identity, InternalIdentity, StateObject<Snapshot.State> {
public enum Type {
MANUAL,
RECURRING,
@ -42,6 +44,7 @@ public interface Snapshot extends ControlledEntity, Identity, InternalIdentity {
return max;
}
@Override
public String toString() {
return this.name();
}
@ -51,13 +54,29 @@ public interface Snapshot extends ControlledEntity, Identity, InternalIdentity {
}
}
public enum Status {
public enum State {
Creating,
CreatedOnPrimary,
BackingUp,
BackedUp,
Error;
private final static StateMachine2<State, Event, Snapshot> s_fsm = new StateMachine2<State, Event, Snapshot>();
public static StateMachine2<State, Event, Snapshot> getStateMachine() {
return s_fsm;
}
static {
s_fsm.addTransition(null, Event.CreateRequested, Creating);
s_fsm.addTransition(Creating, Event.OperationSucceeded, CreatedOnPrimary);
s_fsm.addTransition(Creating, Event.OperationNotPerformed, BackedUp);
s_fsm.addTransition(Creating, Event.OperationFailed, Error);
s_fsm.addTransition(CreatedOnPrimary, Event.BackupToSecondary, BackingUp);
s_fsm.addTransition(BackingUp, Event.OperationSucceeded, BackedUp);
s_fsm.addTransition(BackingUp, Event.OperationFailed, Error);
}
public String toString() {
return this.name();
}
@ -67,6 +86,15 @@ public interface Snapshot extends ControlledEntity, Identity, InternalIdentity {
}
}
enum Event {
CreateRequested,
OperationNotPerformed,
BackupToSecondary,
BackedupToSecondary,
OperationSucceeded,
OperationFailed
}
public static final long MANUAL_POLICY_ID = 0L;
long getAccountId();
@ -81,7 +109,7 @@ public interface Snapshot extends ControlledEntity, Identity, InternalIdentity {
Type getType();
Status getStatus();
State getState();
HypervisorType getHypervisorType();

View File

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

View File

@ -17,6 +17,7 @@
package com.cloud.storage;
public enum StoragePoolStatus {
Creating,
Up,
PrepareForMaintenance,
ErrorInMaintenance,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -62,5 +62,8 @@ public interface Account extends ControlledEntity, InternalIdentity, Identity {
public String getNetworkDomain();
public Long getDefaultZoneId();
public int getRegionId();
public String getUuid();
}

View File

@ -22,16 +22,15 @@ 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.account.UpdateAccountCmd;
import org.apache.cloudstack.api.command.admin.user.RegisterCmd;
import com.cloud.domain.Domain;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.utils.Pair;
public interface AccountService {
@ -63,35 +62,7 @@ public interface AccountService {
* @return the user if created successfully, null otherwise
*/
UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long domainId, String networkDomain,
Map<String, String> details);
/**
* Deletes a user by userId
*
* @param accountId
* - id of the account do delete
*
* @return true if delete was successful, false otherwise
*/
boolean deleteUserAccount(long accountId);
/**
* Disables a user by userId
*
* @param userId
* - the userId
* @return UserAccount object
*/
UserAccount disableUser(long userId);
/**
* Enables a user
*
* @param userId
* - the userId
* @return UserAccount object
*/
UserAccount enableUser(long userId);
Map<String, String> details, String accountUUID, String userUUID, Integer regionId);
/**
* Locks a user by userId. A locked user cannot access the API, but will still have running VMs/IP addresses
@ -102,71 +73,11 @@ public interface AccountService {
*/
UserAccount lockUser(long userId);
/**
* Update a user by userId
*
* @param userId
* @return UserAccount object
*/
UserAccount updateUser(UpdateUserCmd cmd);
/**
* Disables an account by accountName and domainId
*
* @param accountName
* TODO
* @param domainId
* TODO
* @param accountId
* @param disabled
* account if success
* @return true if disable was successful, false otherwise
*/
Account disableAccount(String accountName, Long domainId, Long accountId) throws ConcurrentOperationException, ResourceUnavailableException;
/**
* Enables an account by accountId
*
* @param accountName
* - the enableAccount command defining the accountId to be deleted.
* @param domainId
* TODO
* @param accountId
* @return account object
*/
Account enableAccount(String accountName, Long domainId, Long accountId);
/**
* Locks an account by accountId. A locked account cannot access the API, but will still have running VMs/IP
* addresses
* allocated/etc.
*
* @param accountName
* - the LockAccount command defining the accountId to be locked.
* @param domainId
* TODO
* @param accountId
* @return account object
*/
Account lockAccount(String accountName, Long domainId, Long accountId);
/**
* Updates an account name
*
* @param cmd
* - the parameter containing accountId
* @return updated account object
*/
Account updateAccount(UpdateAccountCmd cmd);
Account getSystemAccount();
User getSystemUser();
User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId);
boolean deleteUser(DeleteUserCmd deleteUserCmd);
User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId, String userUUID, Integer regionId);
boolean isAdmin(short accountType);

View File

@ -20,13 +20,14 @@ import java.util.List;
import org.apache.cloudstack.api.command.admin.domain.ListDomainChildrenCmd;
import org.apache.cloudstack.api.command.admin.domain.ListDomainsCmd;
import com.cloud.domain.Domain;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.utils.Pair;
public interface DomainService {
Domain createDomain(String name, Long parentId, String networkDomain);
Domain createDomain(String name, Long parentId, String networkDomain, String domainUUID, Integer regionId);
Domain getDomain(long id);
@ -40,12 +41,19 @@ public interface DomainService {
*/
boolean isChildDomain(Long parentId, Long childId);
boolean deleteDomain(long domainId, Boolean cleanup);
Pair<List<? extends Domain>, Integer> searchForDomains(ListDomainsCmd cmd)
throws PermissionDeniedException;
Pair<List<? extends Domain>, Integer> searchForDomainChildren(ListDomainChildrenCmd cmd)
throws PermissionDeniedException;
/**
* find the domain by its path
*
* @param domainPath
* the path to use to lookup a domain
* @return domainVO the domain with the matching path, or null if no domain with the given path exists
*/
Domain findDomainByPath(String domainPath);
}

View File

@ -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;
@ -73,4 +73,5 @@ public interface User extends OwnedBy, InternalIdentity {
boolean isRegistered();
public int getRegionId();
}

View File

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

View File

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

View File

@ -0,0 +1,40 @@
// 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.user;
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;
}
public static UserContextInitializer getInstance() {
return s_instance;
}
public UserContext getAdminContext() {
return new UserContext(_accountMgr.getSystemUser().getId(), _accountMgr.getSystemAccount(), null, false);
}
}

View File

@ -17,6 +17,7 @@
package com.cloud.uservm;
import org.apache.cloudstack.acl.ControlledEntity;
import com.cloud.vm.VirtualMachine;
/**

View File

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

View File

@ -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.
@ -144,4 +145,10 @@ public interface Nic extends Identity, InternalIdentity {
VirtualMachine.Type getVmType();
AddressFormat getAddressFormat();
String getIp6Gateway();
String getIp6Cidr();
String getIp6Address();
}

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