mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge branch 'master' of ssh://git.cloud.com/var/lib/git/cloudstack-oss
This commit is contained in:
commit
c358f469c0
@ -22,14 +22,14 @@ import com.cloud.user.OwnedBy;
|
||||
|
||||
/**
|
||||
* ControlledEntity defines an object for which the access from an
|
||||
* account can be controlled. Any object that must have limited
|
||||
* account can be controlled. Any object that must have limited
|
||||
* access must inherit this interface.
|
||||
*
|
||||
*/
|
||||
public interface ControlledEntity extends OwnedBy, PartOf {
|
||||
public enum ACLType {
|
||||
Account,
|
||||
Domain
|
||||
}
|
||||
public enum ACLType {
|
||||
Account,
|
||||
Domain
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -42,44 +42,58 @@ public interface SecurityChecker extends Adapter {
|
||||
ModifyProject,
|
||||
UseNetwork
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the account owns the object.
|
||||
*
|
||||
* @param caller account to check against.
|
||||
* @param object object that the account is trying to access.
|
||||
* @return true if access allowed. false if this adapter cannot authenticate ownership.
|
||||
* @throws PermissionDeniedException if this adapter is suppose to authenticate ownership and the check failed.
|
||||
* @param caller
|
||||
* account to check against.
|
||||
* @param object
|
||||
* object that the account is trying to access.
|
||||
* @return true if access allowed. false if this adapter cannot authenticate ownership.
|
||||
* @throws PermissionDeniedException
|
||||
* if this adapter is suppose to authenticate ownership and the check failed.
|
||||
*/
|
||||
boolean checkAccess(Account caller, Domain domain) throws PermissionDeniedException;
|
||||
|
||||
/**
|
||||
* Checks if the user belongs to an account that owns the object.
|
||||
*
|
||||
* @param user user to check against.
|
||||
* @param object object that the account is trying to access.
|
||||
* @return true if access allowed. false if this adapter cannot authenticate ownership.
|
||||
* @throws PermissionDeniedException if this adapter is suppose to authenticate ownership and the check failed.
|
||||
* @param user
|
||||
* user to check against.
|
||||
* @param object
|
||||
* object that the account is trying to access.
|
||||
* @return true if access allowed. false if this adapter cannot authenticate ownership.
|
||||
* @throws PermissionDeniedException
|
||||
* if this adapter is suppose to authenticate ownership and the check failed.
|
||||
*/
|
||||
boolean checkAccess(User user, Domain domain) throws PermissionDeniedException;
|
||||
|
||||
/**
|
||||
* Checks if the account can access the object.
|
||||
*
|
||||
* @param caller account to check against.
|
||||
* @param entity object that the account is trying to access.
|
||||
* @param accessType TODO
|
||||
* @return true if access allowed. false if this adapter cannot provide permission.
|
||||
* @throws PermissionDeniedException if this adapter is suppose to authenticate ownership and the check failed.
|
||||
* @param caller
|
||||
* account to check against.
|
||||
* @param entity
|
||||
* object that the account is trying to access.
|
||||
* @param accessType
|
||||
* TODO
|
||||
* @return true if access allowed. false if this adapter cannot provide permission.
|
||||
* @throws PermissionDeniedException
|
||||
* if this adapter is suppose to authenticate ownership and the check failed.
|
||||
*/
|
||||
boolean checkAccess(Account caller, ControlledEntity entity, AccessType accessType) throws PermissionDeniedException;
|
||||
|
||||
/**
|
||||
* Checks if the user belongs to an account that can access the object.
|
||||
*
|
||||
* @param user user to check against.
|
||||
* @param entity object that the account is trying to access.
|
||||
* @return true if access allowed. false if this adapter cannot authenticate ownership.
|
||||
* @throws PermissionDeniedException if this adapter is suppose to authenticate ownership and the check failed.
|
||||
* @param user
|
||||
* user to check against.
|
||||
* @param entity
|
||||
* object that the account is trying to access.
|
||||
* @return true if access allowed. false if this adapter cannot authenticate ownership.
|
||||
* @throws PermissionDeniedException
|
||||
* if this adapter is suppose to authenticate ownership and the check failed.
|
||||
*/
|
||||
boolean checkAccess(User user, ControlledEntity entity) throws PermissionDeniedException;
|
||||
|
||||
@ -87,5 +101,5 @@ public interface SecurityChecker extends Adapter {
|
||||
|
||||
public boolean checkAccess(Account account, ServiceOffering so) throws PermissionDeniedException;
|
||||
|
||||
boolean checkAccess(Account account, DiskOffering dof) throws PermissionDeniedException;
|
||||
boolean checkAccess(Account account, DiskOffering dof) throws PermissionDeniedException;
|
||||
}
|
||||
|
||||
@ -23,33 +23,34 @@ import com.cloud.user.User;
|
||||
import com.cloud.user.UserContext;
|
||||
|
||||
/**
|
||||
* A base command for supporting asynchronous API calls. When an API command is received, the command will be
|
||||
* A base command for supporting asynchronous API calls. When an API command is received, the command will be
|
||||
* serialized to the queue (currently the async_job table) and a response will be immediately returned with the
|
||||
* id of the queue object. The id can be used to query the status/progress of the command using the
|
||||
* id of the queue object. The id can be used to query the status/progress of the command using the
|
||||
* queryAsyncJobResult API command.
|
||||
*/
|
||||
public abstract class BaseAsyncCmd extends BaseCmd {
|
||||
public static final String ipAddressSyncObject = "ipaddress";
|
||||
public static final String networkSyncObject = "network";
|
||||
|
||||
|
||||
private AsyncJob job;
|
||||
|
||||
@Parameter(name="starteventid", type=CommandType.LONG)
|
||||
@Parameter(name = "starteventid", type = CommandType.LONG)
|
||||
private Long startEventId;
|
||||
|
||||
/**
|
||||
* For proper tracking of async commands through the system, events must be generated when the command is
|
||||
* scheduled, started, and completed. Commands should specify the type of event so that when the scheduled,
|
||||
* scheduled, started, and completed. Commands should specify the type of event so that when the scheduled,
|
||||
* started, and completed events are saved to the events table, they have the proper type information.
|
||||
*
|
||||
* @return a string representing the type of event, e.g. VM.START, VOLUME.CREATE.
|
||||
*/
|
||||
public abstract String getEventType();
|
||||
|
||||
/**
|
||||
* For proper tracking of async commands through the system, events must be generated when the command is
|
||||
* scheduled, started, and completed. Commands should specify a description for these events so that when
|
||||
* scheduled, started, and completed. Commands should specify a description for these events so that when
|
||||
* the scheduled, started, and completed events are saved to the events table, they have a meaningful description.
|
||||
*
|
||||
* @return a string representing a description of the event
|
||||
*/
|
||||
public abstract String getEventDescription();
|
||||
@ -82,11 +83,11 @@ public abstract class BaseAsyncCmd extends BaseCmd {
|
||||
* getObjectType() should return a type from the AsyncJob.Type enumeration
|
||||
*/
|
||||
public Long getInstanceId() {
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.None;
|
||||
return AsyncJob.Type.None;
|
||||
}
|
||||
|
||||
public String getSyncObjType() {
|
||||
@ -101,33 +102,34 @@ public abstract class BaseAsyncCmd extends BaseCmd {
|
||||
return job;
|
||||
}
|
||||
|
||||
protected long saveStartedEvent(){
|
||||
return saveStartedEvent(getEventType(), "Executing job for "+getEventDescription(), getStartEventId());
|
||||
protected long saveStartedEvent() {
|
||||
return saveStartedEvent(getEventType(), "Executing job for " + getEventDescription(), getStartEventId());
|
||||
}
|
||||
|
||||
protected long saveStartedEvent(String eventType, String description, Long startEventId){
|
||||
protected long saveStartedEvent(String eventType, String description, Long startEventId) {
|
||||
UserContext ctx = UserContext.current();
|
||||
Long userId = ctx.getCallerUserId();
|
||||
userId = (userId == null) ? User.UID_SYSTEM : userId;
|
||||
Long startEvent = startEventId;
|
||||
if(startEvent == null){
|
||||
if (startEvent == null) {
|
||||
startEvent = 0L;
|
||||
}
|
||||
return _mgr.saveStartedEvent((userId == null) ? User.UID_SYSTEM : userId, getEntityOwnerId(), eventType, description, startEvent);
|
||||
}
|
||||
|
||||
protected long saveCompletedEvent(String level, String description){
|
||||
protected long saveCompletedEvent(String level, String description) {
|
||||
return saveCompletedEvent(level, getEventType(), description, getStartEventId());
|
||||
}
|
||||
|
||||
protected long saveCompletedEvent(String level, String eventType, String description, Long startEventId){
|
||||
protected long saveCompletedEvent(String level, String eventType, String description, Long startEventId) {
|
||||
UserContext ctx = UserContext.current();
|
||||
Long userId = ctx.getCallerUserId();
|
||||
userId = (userId == null) ? User.UID_SYSTEM : userId;
|
||||
Long startEvent = startEventId;
|
||||
if(startEvent == null){
|
||||
if (startEvent == null) {
|
||||
startEvent = 0L;
|
||||
}
|
||||
return _mgr.saveCompletedEvent((userId == null) ? User.UID_SYSTEM : userId, getEntityOwnerId(), level, eventType, description, startEvent);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ import com.cloud.api.response.CreateCmdResponse;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
|
||||
public abstract class BaseAsyncCreateCmd extends BaseAsyncCmd {
|
||||
@Parameter(name="id", type=CommandType.LONG)
|
||||
@Parameter(name = "id", type = CommandType.LONG)
|
||||
private Long id;
|
||||
|
||||
public abstract void create() throws ResourceAllocationException;
|
||||
@ -53,4 +53,5 @@ public abstract class BaseAsyncCreateCmd extends BaseAsyncCmd {
|
||||
public String getCreateEventDescription() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -28,7 +28,6 @@ import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.response.TrafficTypeImplementorResponse;
|
||||
import com.cloud.configuration.ConfigurationService;
|
||||
import com.cloud.consoleproxy.ConsoleProxyService;
|
||||
import com.cloud.dao.EntityManager;
|
||||
@ -77,7 +76,7 @@ public abstract class BaseCmd {
|
||||
BOOLEAN, DATE, FLOAT, INTEGER, SHORT, LIST, LONG, OBJECT, MAP, STRING, TZDATE
|
||||
}
|
||||
|
||||
// FIXME: Extract these out into a separate file
|
||||
// FIXME: Extract these out into a separate file
|
||||
// Client error codes
|
||||
public static final int MALFORMED_PARAMETER_ERROR = 430;
|
||||
public static final int PARAM_ERROR = 431;
|
||||
@ -87,7 +86,7 @@ public abstract class BaseCmd {
|
||||
// Server error codes
|
||||
public static final int INTERNAL_ERROR = 530;
|
||||
public static final int ACCOUNT_ERROR = 531;
|
||||
public static final int ACCOUNT_RESOURCE_LIMIT_ERROR= 532;
|
||||
public static final int ACCOUNT_RESOURCE_LIMIT_ERROR = 532;
|
||||
public static final int INSUFFICIENT_CAPACITY_ERROR = 533;
|
||||
public static final int RESOURCE_UNAVAILABLE_ERROR = 534;
|
||||
public static final int RESOURCE_ALLOCATION_ERROR = 534;
|
||||
@ -102,7 +101,7 @@ public abstract class BaseCmd {
|
||||
private Object _responseObject = null;
|
||||
private Map<String, String> fullUrlParams;
|
||||
|
||||
@Parameter(name="response", type=CommandType.STRING)
|
||||
@Parameter(name = "response", type = CommandType.STRING)
|
||||
private String responseType;
|
||||
|
||||
public static ComponentLocator s_locator;
|
||||
@ -133,7 +132,7 @@ public abstract class BaseCmd {
|
||||
|
||||
static void setComponents(ResponseGenerator generator) {
|
||||
ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
|
||||
_mgr = (ManagementService)ComponentLocator.getComponent(ManagementService.Name);
|
||||
_mgr = (ManagementService) ComponentLocator.getComponent(ManagementService.Name);
|
||||
_accountService = locator.getManager(AccountService.class);
|
||||
_configService = locator.getManager(ConfigurationService.class);
|
||||
_userVmService = locator.getManager(UserVmService.class);
|
||||
@ -175,8 +174,9 @@ public abstract class BaseCmd {
|
||||
public abstract String getCommandName();
|
||||
|
||||
/**
|
||||
* For commands the API framework needs to know the owner of the object being acted upon. This method is
|
||||
* For commands the API framework needs to know the owner of the object being acted upon. This method is
|
||||
* used to determine that information.
|
||||
*
|
||||
* @return the id of the account that owns the object being acted upon
|
||||
*/
|
||||
public abstract long getEntityOwnerId();
|
||||
@ -194,21 +194,22 @@ public abstract class BaseCmd {
|
||||
return "";
|
||||
}
|
||||
String formattedString = null;
|
||||
synchronized(_outputFormat) {
|
||||
synchronized (_outputFormat) {
|
||||
formattedString = _outputFormat.format(date);
|
||||
}
|
||||
return formattedString;
|
||||
}
|
||||
|
||||
// FIXME: move this to a utils method so that maps can be unpacked and integer/long values can be appropriately cast
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
// FIXME: move this to a utils method so that maps can be unpacked and integer/long values can be appropriately cast
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public Map<String, Object> unpackParams(Map<String, String> params) {
|
||||
Map<String, Object> lowercaseParams = new HashMap<String, Object>();
|
||||
for (String key : params.keySet()) {
|
||||
int arrayStartIndex = key.indexOf('[');
|
||||
int arrayStartLastIndex = key.lastIndexOf('[');
|
||||
if (arrayStartIndex != arrayStartLastIndex) {
|
||||
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
|
||||
+ "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||
}
|
||||
|
||||
if (arrayStartIndex > 0) {
|
||||
@ -216,14 +217,16 @@ public abstract class BaseCmd {
|
||||
int arrayEndLastIndex = key.lastIndexOf(']');
|
||||
if ((arrayEndIndex < arrayStartIndex) || (arrayEndIndex != arrayEndLastIndex)) {
|
||||
// malformed parameter
|
||||
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
|
||||
+ "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||
}
|
||||
|
||||
// Now that we have an array object, check for a field name in the case of a complex object
|
||||
int fieldIndex = key.indexOf('.');
|
||||
String fieldName = null;
|
||||
if (fieldIndex < arrayEndIndex) {
|
||||
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
|
||||
+ "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||
} else {
|
||||
fieldName = key.substring(fieldIndex + 1);
|
||||
}
|
||||
@ -234,7 +237,7 @@ public abstract class BaseCmd {
|
||||
|
||||
Map<Integer, Map> mapArray = null;
|
||||
Map<String, Object> mapValue = null;
|
||||
String indexStr = key.substring(arrayStartIndex+1, arrayEndIndex);
|
||||
String indexStr = key.substring(arrayStartIndex + 1, arrayEndIndex);
|
||||
int index = 0;
|
||||
boolean parsedIndex = false;
|
||||
try {
|
||||
@ -247,7 +250,8 @@ public abstract class BaseCmd {
|
||||
}
|
||||
|
||||
if (!parsedIndex) {
|
||||
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
|
||||
+ "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||
}
|
||||
|
||||
Object value = lowercaseParams.get(paramName);
|
||||
@ -257,7 +261,7 @@ public abstract class BaseCmd {
|
||||
mapValue = new HashMap<String, Object>();
|
||||
mapArray.put(Integer.valueOf(index), mapValue);
|
||||
} else if (value instanceof Map) {
|
||||
mapArray = (HashMap)value;
|
||||
mapArray = (HashMap) value;
|
||||
mapValue = mapArray.get(Integer.valueOf(index));
|
||||
if (mapValue == null) {
|
||||
mapValue = new HashMap<String, Object>();
|
||||
@ -280,14 +284,14 @@ public abstract class BaseCmd {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
|
||||
// JSON response
|
||||
sb.append("{ \"" + getCommandName() + "\" : { " + "\"@attributes\":{\"cloud-stack-version\":\""+_mgr.getVersion()+"\"},");
|
||||
sb.append("{ \"" + getCommandName() + "\" : { " + "\"@attributes\":{\"cloud-stack-version\":\"" + _mgr.getVersion() + "\"},");
|
||||
sb.append("\"errorcode\" : \"" + apiException.getErrorCode() + "\", \"description\" : \"" + apiException.getDescription() + "\" } }");
|
||||
} else {
|
||||
sb.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
|
||||
sb.append("<" + getCommandName() + ">");
|
||||
sb.append("<errorcode>" + apiException.getErrorCode() + "</errorcode>");
|
||||
sb.append("<description>" + escapeXml(apiException.getDescription()) + "</description>");
|
||||
sb.append("</" + getCommandName() + " cloud-stack-version=\""+_mgr.getVersion()+ "\">");
|
||||
sb.append("</" + getCommandName() + " cloud-stack-version=\"" + _mgr.getVersion() + "\">");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
@ -298,10 +302,10 @@ public abstract class BaseCmd {
|
||||
|
||||
// set up the return value with the name of the response
|
||||
if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
|
||||
prefixSb.append("{ \"" + getCommandName() + "\" : { \"@attributes\":{\"cloud-stack-version\":\""+ _mgr.getVersion()+"\"},");
|
||||
prefixSb.append("{ \"" + getCommandName() + "\" : { \"@attributes\":{\"cloud-stack-version\":\"" + _mgr.getVersion() + "\"},");
|
||||
} else {
|
||||
prefixSb.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
|
||||
prefixSb.append("<" + getCommandName() + " cloud-stack-version=\""+_mgr.getVersion()+ "\">");
|
||||
prefixSb.append("<" + getCommandName() + " cloud-stack-version=\"" + _mgr.getVersion() + "\">");
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
@ -309,7 +313,7 @@ public abstract class BaseCmd {
|
||||
String tagName = tagData.first();
|
||||
Object tagValue = tagData.second();
|
||||
if (tagValue instanceof Object[]) {
|
||||
Object[] subObjects = (Object[])tagValue;
|
||||
Object[] subObjects = (Object[]) tagValue;
|
||||
if (subObjects.length < 1) {
|
||||
continue;
|
||||
}
|
||||
@ -319,8 +323,9 @@ public abstract class BaseCmd {
|
||||
}
|
||||
}
|
||||
|
||||
if(suffixSb.length() > 0){
|
||||
if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)){ // append comma only if we have some suffix else not as per strict Json syntax.
|
||||
if (suffixSb.length() > 0) {
|
||||
if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) { // append comma only if we have some suffix else
|
||||
// not as per strict Json syntax.
|
||||
prefixSb.append(",");
|
||||
}
|
||||
prefixSb.append(suffixSb);
|
||||
@ -340,7 +345,7 @@ public abstract class BaseCmd {
|
||||
}
|
||||
|
||||
if (tagValue instanceof Object[]) {
|
||||
Object[] subObjects = (Object[])tagValue;
|
||||
Object[] subObjects = (Object[]) tagValue;
|
||||
if (subObjects.length < 1) {
|
||||
return;
|
||||
}
|
||||
@ -364,7 +369,7 @@ public abstract class BaseCmd {
|
||||
int j = 0;
|
||||
for (Object subObject : subObjects) {
|
||||
if (subObject instanceof List) {
|
||||
List subObjList = (List)subObject;
|
||||
List subObjList = (List) subObject;
|
||||
writeSubObject(sb, tagName, subObjList, responseType, j++);
|
||||
}
|
||||
}
|
||||
@ -385,8 +390,8 @@ public abstract class BaseCmd {
|
||||
int i = 0;
|
||||
for (Object tag : tagList) {
|
||||
if (tag instanceof Pair) {
|
||||
Pair nameValuePair = (Pair)tag;
|
||||
writeNameValuePair(sb, (String)nameValuePair.first(), nameValuePair.second(), responseType, i++);
|
||||
Pair nameValuePair = (Pair) tag;
|
||||
writeNameValuePair(sb, (String) nameValuePair.first(), nameValuePair.second(), responseType, i++);
|
||||
}
|
||||
}
|
||||
|
||||
@ -401,22 +406,22 @@ public abstract class BaseCmd {
|
||||
* Escape xml response set to false by default. API commands to override this method to allow escaping
|
||||
*/
|
||||
public boolean requireXmlEscape() {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private String escapeXml(String xml){
|
||||
if(!requireXmlEscape()){
|
||||
return xml;
|
||||
}
|
||||
int iLen = xml.length();
|
||||
if (iLen == 0) {
|
||||
private String escapeXml(String xml) {
|
||||
if (!requireXmlEscape()) {
|
||||
return xml;
|
||||
}
|
||||
StringBuffer sOUT = new StringBuffer(iLen + 256);
|
||||
int i = 0;
|
||||
for (; i < iLen; i++) {
|
||||
char c = xml.charAt(i);
|
||||
if (c == '<') {
|
||||
int iLen = xml.length();
|
||||
if (iLen == 0) {
|
||||
return xml;
|
||||
}
|
||||
StringBuffer sOUT = new StringBuffer(iLen + 256);
|
||||
int i = 0;
|
||||
for (; i < iLen; i++) {
|
||||
char c = xml.charAt(i);
|
||||
if (c == '<') {
|
||||
sOUT.append("<");
|
||||
} else if (c == '>') {
|
||||
sOUT.append(">");
|
||||
@ -429,40 +434,39 @@ public abstract class BaseCmd {
|
||||
} else {
|
||||
sOUT.append(c);
|
||||
}
|
||||
}
|
||||
return sOUT.toString();
|
||||
}
|
||||
}
|
||||
return sOUT.toString();
|
||||
}
|
||||
|
||||
private static String escapeJSON(String str) {
|
||||
if (str == null) {
|
||||
return str;
|
||||
}
|
||||
private static String escapeJSON(String str) {
|
||||
if (str == null) {
|
||||
return str;
|
||||
}
|
||||
|
||||
return str.replace("\"", "\\\"");
|
||||
}
|
||||
return str.replace("\"", "\\\"");
|
||||
}
|
||||
|
||||
protected long getInstanceIdFromJobSuccessResult(String result) {
|
||||
s_logger.debug("getInstanceIdFromJobSuccessResult not overridden in subclass " + this.getClass().getName());
|
||||
return 0;
|
||||
}
|
||||
protected long getInstanceIdFromJobSuccessResult(String result) {
|
||||
s_logger.debug("getInstanceIdFromJobSuccessResult not overridden in subclass " + this.getClass().getName());
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static boolean isAdmin(short accountType) {
|
||||
return ((accountType == Account.ACCOUNT_TYPE_ADMIN) ||
|
||||
(accountType == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN) ||
|
||||
(accountType == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) ||
|
||||
(accountType == Account.ACCOUNT_TYPE_READ_ONLY_ADMIN));
|
||||
}
|
||||
return ((accountType == Account.ACCOUNT_TYPE_ADMIN) ||
|
||||
(accountType == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN) ||
|
||||
(accountType == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) || (accountType == Account.ACCOUNT_TYPE_READ_ONLY_ADMIN));
|
||||
}
|
||||
|
||||
public static boolean isRootAdmin(short accountType) {
|
||||
return ((accountType == Account.ACCOUNT_TYPE_ADMIN));
|
||||
}
|
||||
|
||||
public void setFullUrlParams(Map<String, String> map) {
|
||||
this.fullUrlParams = map;
|
||||
this.fullUrlParams = map;
|
||||
}
|
||||
|
||||
public Map<String, String> getFullUrlParams() {
|
||||
return this.fullUrlParams;
|
||||
return this.fullUrlParams;
|
||||
}
|
||||
|
||||
public Long finalyzeAccountId(String accountName, Long domainId, Long projectId, boolean enabledOnly) {
|
||||
@ -478,11 +482,11 @@ public abstract class BaseCmd {
|
||||
|
||||
Account account = _accountService.getActiveAccountByName(accountName, domainId);
|
||||
if (account != null && account.getType() != Account.ACCOUNT_TYPE_PROJECT) {
|
||||
if (!enabledOnly || account.getState() == Account.State.enabled) {
|
||||
if (!enabledOnly || account.getState() == Account.State.enabled) {
|
||||
return account.getId();
|
||||
} else {
|
||||
throw new PermissionDeniedException("Can't add resources to the account id=" + account.getId() + " in state=" + account.getState() + " as it's no longer active");
|
||||
}
|
||||
} else {
|
||||
throw new PermissionDeniedException("Can't add resources to the account id=" + account.getId() + " in state=" + account.getState() + " as it's no longer active");
|
||||
}
|
||||
} else {
|
||||
throw new InvalidParameterValueException("Unable to find account by name " + accountName + " in domain id=" + domainId);
|
||||
}
|
||||
|
||||
@ -18,12 +18,11 @@
|
||||
|
||||
package com.cloud.api;
|
||||
|
||||
public abstract class BaseListAccountResourcesCmd extends BaseListDomainResourcesCmd{
|
||||
public abstract class BaseListAccountResourcesCmd extends BaseListDomainResourcesCmd {
|
||||
|
||||
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="List resources by account. Must be used with the domainId parameter.")
|
||||
@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "List resources by account. Must be used with the domainId parameter.")
|
||||
private String accountName;
|
||||
|
||||
|
||||
public String getAccountName() {
|
||||
return accountName;
|
||||
}
|
||||
|
||||
@ -40,8 +40,6 @@ public abstract class BaseListCmd extends BaseCmd {
|
||||
@Parameter(name = ApiConstants.PAGE_SIZE, type = CommandType.INTEGER)
|
||||
private Integer pageSize;
|
||||
|
||||
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////////// Accessors ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
@ -82,11 +80,11 @@ public abstract class BaseListCmd extends BaseCmd {
|
||||
Long defaultPageSize = MAX_PAGESIZE;
|
||||
Integer pageSizeInt = getPageSize();
|
||||
if (pageSizeInt != null) {
|
||||
if (pageSizeInt.longValue() == PAGESIZE_UNLIMITED) {
|
||||
defaultPageSize = null;
|
||||
} else {
|
||||
if (pageSizeInt.longValue() == PAGESIZE_UNLIMITED) {
|
||||
defaultPageSize = null;
|
||||
} else {
|
||||
defaultPageSize = pageSizeInt.longValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
return defaultPageSize;
|
||||
}
|
||||
|
||||
@ -18,16 +18,16 @@
|
||||
|
||||
package com.cloud.api;
|
||||
|
||||
public abstract class BaseListDomainResourcesCmd extends BaseListCmd{
|
||||
public abstract class BaseListDomainResourcesCmd extends BaseListCmd {
|
||||
|
||||
@Parameter(name=ApiConstants.LIST_ALL, type=CommandType.BOOLEAN, description="If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false")
|
||||
@Parameter(name = ApiConstants.LIST_ALL, type = CommandType.BOOLEAN, description = "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false")
|
||||
private Boolean listAll;
|
||||
|
||||
@IdentityMapper(entityTableName="domain")
|
||||
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="list only resources belonging to the domain specified")
|
||||
@IdentityMapper(entityTableName = "domain")
|
||||
@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.LONG, description = "list only resources belonging to the domain specified")
|
||||
private Long domainId;
|
||||
|
||||
@Parameter(name=ApiConstants.IS_RECURSIVE, type=CommandType.BOOLEAN, description="defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.")
|
||||
@Parameter(name = ApiConstants.IS_RECURSIVE, type = CommandType.BOOLEAN, description = "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.")
|
||||
private Boolean recursive;
|
||||
|
||||
public boolean listAll() {
|
||||
|
||||
@ -18,10 +18,10 @@
|
||||
|
||||
package com.cloud.api;
|
||||
|
||||
public abstract class BaseListProjectAndAccountResourcesCmd extends BaseListAccountResourcesCmd{
|
||||
public abstract class BaseListProjectAndAccountResourcesCmd extends BaseListAccountResourcesCmd {
|
||||
|
||||
@IdentityMapper(entityTableName="projects")
|
||||
@Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="list firewall rules by project")
|
||||
@IdentityMapper(entityTableName = "projects")
|
||||
@Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.LONG, description = "list firewall rules by project")
|
||||
private Long projectId;
|
||||
|
||||
public Long getProjectId() {
|
||||
|
||||
@ -18,5 +18,5 @@
|
||||
package com.cloud.api;
|
||||
|
||||
public interface Identity {
|
||||
String getUuid();
|
||||
String getUuid();
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({FIELD})
|
||||
@Target({ FIELD })
|
||||
public @interface IdentityMapper {
|
||||
String entityTableName();
|
||||
String entityTableName();
|
||||
}
|
||||
|
||||
@ -18,30 +18,29 @@
|
||||
package com.cloud.api;
|
||||
|
||||
public class IdentityProxy {
|
||||
private String _tableName;
|
||||
private Long _value;
|
||||
private String _tableName;
|
||||
private Long _value;
|
||||
|
||||
public IdentityProxy() {
|
||||
}
|
||||
public IdentityProxy() {
|
||||
}
|
||||
|
||||
public IdentityProxy(String tableName) {
|
||||
_tableName = tableName;
|
||||
}
|
||||
public IdentityProxy(String tableName) {
|
||||
_tableName = tableName;
|
||||
}
|
||||
|
||||
public String getTableName() {
|
||||
return _tableName;
|
||||
}
|
||||
public String getTableName() {
|
||||
return _tableName;
|
||||
}
|
||||
|
||||
public void setTableName(String tableName) {
|
||||
_tableName = tableName;
|
||||
}
|
||||
public void setTableName(String tableName) {
|
||||
_tableName = tableName;
|
||||
}
|
||||
|
||||
public Long getValue() {
|
||||
return _value;
|
||||
}
|
||||
public Long getValue() {
|
||||
return _value;
|
||||
}
|
||||
|
||||
public void setValue(Long value) {
|
||||
_value = value;
|
||||
}
|
||||
public void setValue(Long value) {
|
||||
_value = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -18,7 +18,9 @@
|
||||
package com.cloud.api;
|
||||
|
||||
public interface IdentityService {
|
||||
Long getIdentityId(IdentityMapper mapper, String identityString);
|
||||
Long getIdentityId(IdentityMapper mapper, String identityString);
|
||||
|
||||
Long getIdentityId(String tableName, String identityString);
|
||||
String getIdentityUuid(String tableName, String identityString);
|
||||
|
||||
String getIdentityUuid(String tableName, String identityString);
|
||||
}
|
||||
|
||||
@ -25,11 +25,15 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({TYPE})
|
||||
@Target({ TYPE })
|
||||
public @interface Implementation {
|
||||
Class<?> responseObject();
|
||||
|
||||
String description() default "";
|
||||
|
||||
String usage() default "";
|
||||
|
||||
boolean includeInApiDoc() default true;
|
||||
|
||||
String since() default "";
|
||||
}
|
||||
|
||||
@ -27,16 +27,23 @@ import java.lang.annotation.Target;
|
||||
import com.cloud.api.BaseCmd.CommandType;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({FIELD})
|
||||
@Target({ FIELD })
|
||||
public @interface Parameter {
|
||||
String name() default "";
|
||||
|
||||
String description() default "";
|
||||
|
||||
boolean required() default false;
|
||||
|
||||
CommandType type() default CommandType.OBJECT;
|
||||
|
||||
CommandType collectionType() default CommandType.OBJECT;
|
||||
|
||||
boolean expose() default true;
|
||||
|
||||
boolean includeInApiDoc() default true;
|
||||
|
||||
int length() default 255;
|
||||
|
||||
String since() default "";
|
||||
}
|
||||
|
||||
|
||||
@ -43,11 +43,9 @@ import com.cloud.api.response.IPAddressResponse;
|
||||
import com.cloud.api.response.InstanceGroupResponse;
|
||||
import com.cloud.api.response.IpForwardingRuleResponse;
|
||||
import com.cloud.api.response.LBStickinessResponse;
|
||||
import com.cloud.api.response.LDAPConfigResponse;
|
||||
import com.cloud.api.response.ListResponse;
|
||||
import com.cloud.api.response.LoadBalancerResponse;
|
||||
import com.cloud.api.response.LBStickinessPolicyResponse;
|
||||
import com.cloud.network.rules.StickinessPolicy;
|
||||
import com.cloud.api.response.LDAPConfigResponse;
|
||||
import com.cloud.api.response.NetworkOfferingResponse;
|
||||
import com.cloud.api.response.NetworkResponse;
|
||||
import com.cloud.api.response.PhysicalNetworkResponse;
|
||||
@ -106,9 +104,10 @@ import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.network.rules.LoadBalancer;
|
||||
import com.cloud.network.rules.PortForwardingRule;
|
||||
import com.cloud.network.rules.StaticNatRule;
|
||||
import com.cloud.network.security.SecurityRule;
|
||||
import com.cloud.network.rules.StickinessPolicy;
|
||||
import com.cloud.network.security.SecurityGroup;
|
||||
import com.cloud.network.security.SecurityGroupRules;
|
||||
import com.cloud.network.security.SecurityRule;
|
||||
import com.cloud.offering.DiskOffering;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
@ -170,7 +169,7 @@ public interface ResponseGenerator {
|
||||
|
||||
LBStickinessResponse createLBStickinessPolicyResponse(List<? extends StickinessPolicy> stickinessPolicies, LoadBalancer lb);
|
||||
|
||||
LBStickinessResponse createLBStickinessPolicyResponse( StickinessPolicy stickinessPolicy, LoadBalancer lb);
|
||||
LBStickinessResponse createLBStickinessPolicyResponse(StickinessPolicy stickinessPolicy, LoadBalancer lb);
|
||||
|
||||
PodResponse createPodResponse(Pod pod, Boolean showCapacities);
|
||||
|
||||
@ -205,6 +204,7 @@ public interface ResponseGenerator {
|
||||
VpnUsersResponse createVpnUserResponse(VpnUser user);
|
||||
|
||||
RemoteAccessVpnResponse createRemoteAccessVpnResponse(RemoteAccessVpn vpn);
|
||||
|
||||
List<TemplateResponse> createTemplateResponses(long templateId, Long zoneId, boolean readyOnly);
|
||||
|
||||
List<TemplateResponse> createTemplateResponses(long templateId, Long snapshotId, Long volumeId, boolean readyOnly);
|
||||
|
||||
@ -21,24 +21,28 @@ package com.cloud.api;
|
||||
public interface ResponseObject {
|
||||
/**
|
||||
* Get the name of the API response
|
||||
*
|
||||
* @return the name of the API response
|
||||
*/
|
||||
String getResponseName();
|
||||
|
||||
/**
|
||||
* Set the name of the API response
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
void setResponseName(String name);
|
||||
|
||||
/**
|
||||
* Get the name of the API object
|
||||
*
|
||||
* @return the name of the API object
|
||||
*/
|
||||
String getObjectName();
|
||||
|
||||
/**
|
||||
* Set the name of the APIobject
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
void setObjectName(String name);
|
||||
@ -50,18 +54,21 @@ public interface ResponseObject {
|
||||
|
||||
/**
|
||||
* Returns the job id
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Long getJobId();
|
||||
|
||||
/**
|
||||
* Sets the job id
|
||||
*
|
||||
* @param jobId
|
||||
*/
|
||||
void setJobId(Long jobId);
|
||||
|
||||
/**
|
||||
* Returns the job status
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Integer getJobStatus();
|
||||
|
||||
@ -36,6 +36,7 @@ public class ServerApiException extends RuntimeException {
|
||||
public int getErrorCode() {
|
||||
return _errorCode;
|
||||
}
|
||||
|
||||
public void setErrorCode(int errorCode) {
|
||||
_errorCode = errorCode;
|
||||
}
|
||||
@ -43,6 +44,7 @@ public class ServerApiException extends RuntimeException {
|
||||
public String getDescription() {
|
||||
return _description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
_description = description;
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
/**
|
||||
|
||||
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
|
||||
*
|
||||
* This software is licensed under the GNU General Public License v3 or later.
|
||||
@ -25,43 +26,41 @@ import com.cloud.api.IdentityMapper;
|
||||
import com.cloud.api.Implementation;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.BaseCmd.CommandType;
|
||||
import com.cloud.api.response.SecurityGroupResponse;
|
||||
import com.cloud.network.security.SecurityGroup;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
||||
@Implementation(responseObject=SecurityGroupResponse.class, description="Creates a security group")
|
||||
@Implementation(responseObject = SecurityGroupResponse.class, description = "Creates a security group")
|
||||
public class CreateSecurityGroupCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CreateSecurityGroupCmd.class.getName());
|
||||
|
||||
private static final String s_name = "createsecuritygroupresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
// ////////////// API parameters /////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="an optional account for the security group. Must be used with domainId.")
|
||||
@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the security group. Must be used with domainId.")
|
||||
private String accountName;
|
||||
|
||||
@IdentityMapper(entityTableName="domain")
|
||||
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="an optional domainId for the security group. If the account parameter is used, domainId must also be used.")
|
||||
@IdentityMapper(entityTableName = "domain")
|
||||
@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.LONG, description = "an optional domainId for the security group. If the account parameter is used, domainId must also be used.")
|
||||
private Long domainId;
|
||||
|
||||
@Parameter(name=ApiConstants.DESCRIPTION, type=CommandType.STRING, description="the description of the security group")
|
||||
@Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "the description of the security group")
|
||||
private String description;
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="name of the security group")
|
||||
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "name of the security group")
|
||||
private String securityGroupName;
|
||||
|
||||
@IdentityMapper(entityTableName="projects")
|
||||
@Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="Deploy vm for the project")
|
||||
@IdentityMapper(entityTableName = "projects")
|
||||
@Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.LONG, description = "Deploy vm for the project")
|
||||
private Long projectId;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////////// Accessors ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
public String getAccountName() {
|
||||
return accountName;
|
||||
@ -83,10 +82,9 @@ public class CreateSecurityGroupCmd extends BaseCmd {
|
||||
return projectId;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////// API Implementation///////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
@ -109,11 +107,12 @@ public class CreateSecurityGroupCmd extends BaseCmd {
|
||||
return account.getId();
|
||||
}
|
||||
|
||||
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
|
||||
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are
|
||||
// tracked
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
public void execute() {
|
||||
SecurityGroup group = _securityGroupService.createSecurityGroup(this);
|
||||
if (group != null) {
|
||||
SecurityGroupResponse response = _responseGenerator.createSecurityGroupResponse(group);
|
||||
|
||||
@ -29,33 +29,33 @@ import com.cloud.api.response.InstanceGroupResponse;
|
||||
import com.cloud.user.UserContext;
|
||||
import com.cloud.vm.InstanceGroup;
|
||||
|
||||
@Implementation(description="Creates a vm group", responseObject=InstanceGroupResponse.class)
|
||||
public class CreateVMGroupCmd extends BaseCmd{
|
||||
@Implementation(description = "Creates a vm group", responseObject = InstanceGroupResponse.class)
|
||||
public class CreateVMGroupCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CreateVMGroupCmd.class.getName());
|
||||
|
||||
private static final String s_name = "createinstancegroupresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
// ////////////// API parameters /////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name of the instance group")
|
||||
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the instance group")
|
||||
private String groupName;
|
||||
|
||||
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account of the instance group. The account parameter must be used with the domainId parameter.")
|
||||
@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "the account of the instance group. The account parameter must be used with the domainId parameter.")
|
||||
private String accountName;
|
||||
|
||||
@IdentityMapper(entityTableName="domain")
|
||||
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the domain ID of account owning the instance group")
|
||||
@IdentityMapper(entityTableName = "domain")
|
||||
@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.LONG, description = "the domain ID of account owning the instance group")
|
||||
private Long domainId;
|
||||
|
||||
@IdentityMapper(entityTableName="projects")
|
||||
@Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="The project of the instance group")
|
||||
@IdentityMapper(entityTableName = "projects")
|
||||
@Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.LONG, description = "The project of the instance group")
|
||||
private Long projectId;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////////// Accessors ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
public String getGroupName() {
|
||||
return groupName;
|
||||
@ -73,9 +73,9 @@ public class CreateVMGroupCmd extends BaseCmd{
|
||||
return projectId;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////// API Implementation///////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
@ -93,7 +93,7 @@ public class CreateVMGroupCmd extends BaseCmd{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
public void execute() {
|
||||
InstanceGroup result = _userVmService.createVmGroup(this);
|
||||
if (result != null) {
|
||||
InstanceGroupResponse response = _responseGenerator.createInstanceGroupResponse(result);
|
||||
|
||||
@ -21,10 +21,10 @@ import java.util.Date;
|
||||
|
||||
import com.cloud.api.Identity;
|
||||
|
||||
public interface AsyncJob extends Identity{
|
||||
public enum Type {
|
||||
public interface AsyncJob extends Identity {
|
||||
public enum Type {
|
||||
None,
|
||||
VirtualMachine,
|
||||
VirtualMachine,
|
||||
DomainRouter,
|
||||
Volume,
|
||||
ConsoleProxy,
|
||||
@ -40,27 +40,50 @@ public interface AsyncJob extends Identity{
|
||||
}
|
||||
|
||||
Long getId();
|
||||
|
||||
long getUserId();
|
||||
|
||||
long getAccountId();
|
||||
|
||||
String getCmd();
|
||||
|
||||
int getCmdVersion();
|
||||
|
||||
String getCmdInfo();
|
||||
|
||||
int getCallbackType();
|
||||
|
||||
String getCallbackAddress();
|
||||
|
||||
int getStatus();
|
||||
|
||||
int getProcessStatus();
|
||||
|
||||
int getResultCode();
|
||||
|
||||
String getResult();
|
||||
|
||||
Long getInitMsid();
|
||||
|
||||
Long getCompleteMsid();
|
||||
|
||||
Date getCreated();
|
||||
|
||||
Date getLastUpdated();
|
||||
|
||||
Date getLastPolled();
|
||||
|
||||
Date getRemoved();
|
||||
|
||||
Type getInstanceType();
|
||||
|
||||
Long getInstanceId();
|
||||
|
||||
String getSessionKey();
|
||||
|
||||
String getCmdOriginator();
|
||||
|
||||
boolean isFromPreviousSession();
|
||||
|
||||
SyncQueueItem getSyncSource();
|
||||
}
|
||||
|
||||
@ -21,6 +21,6 @@ package com.cloud.async;
|
||||
public interface SyncQueueItem {
|
||||
|
||||
String getContentType();
|
||||
Long getContentId();
|
||||
|
||||
Long getContentId();
|
||||
}
|
||||
|
||||
@ -36,14 +36,19 @@ public interface Capacity {
|
||||
public long getId();
|
||||
|
||||
public Long getHostOrPoolId();
|
||||
|
||||
public long getDataCenterId();
|
||||
|
||||
public Long getPodId();
|
||||
|
||||
public Long getClusterId();
|
||||
|
||||
public long getUsedCapacity();
|
||||
|
||||
public long getTotalCapacity();
|
||||
|
||||
public short getCapacityType();
|
||||
|
||||
long getReservedCapacity();
|
||||
|
||||
long getReservedCapacity();
|
||||
|
||||
}
|
||||
|
||||
@ -16,18 +16,17 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
package com.cloud.cluster;
|
||||
|
||||
|
||||
public interface ManagementServerHost {
|
||||
|
||||
public static enum State { Up, Starting, Down };
|
||||
public static enum State {
|
||||
Up, Starting, Down
|
||||
};
|
||||
|
||||
long getMsid();
|
||||
|
||||
State getState();
|
||||
|
||||
String getVersion();
|
||||
|
||||
}
|
||||
|
||||
@ -18,8 +18,7 @@
|
||||
|
||||
package com.cloud.configuration;
|
||||
|
||||
|
||||
public interface Configuration{
|
||||
public interface Configuration {
|
||||
|
||||
public String getCategory();
|
||||
|
||||
@ -33,5 +32,4 @@ public interface Configuration{
|
||||
|
||||
public String getDescription();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -68,7 +68,8 @@ public interface ConfigurationService {
|
||||
* Create a service offering through the API
|
||||
*
|
||||
* @param cmd
|
||||
* the command object that specifies the name, number of cpu cores, amount of RAM, etc. for the service offering
|
||||
* the command object that specifies the name, number of cpu cores, amount of RAM, etc. for the service
|
||||
* offering
|
||||
* @return the newly created service offering if successful, null otherwise
|
||||
*/
|
||||
ServiceOffering createServiceOffering(CreateServiceOfferingCmd cmd);
|
||||
@ -130,13 +131,21 @@ public interface ConfigurationService {
|
||||
|
||||
/**
|
||||
* Creates a new pod based on the parameters specified in the command object
|
||||
* @param zoneId TODO
|
||||
* @param name TODO
|
||||
* @param startIp TODO
|
||||
* @param endIp TODO
|
||||
* @param gateway TODO
|
||||
* @param netmask TODO
|
||||
* @param allocationState TODO
|
||||
*
|
||||
* @param zoneId
|
||||
* TODO
|
||||
* @param name
|
||||
* TODO
|
||||
* @param startIp
|
||||
* TODO
|
||||
* @param endIp
|
||||
* TODO
|
||||
* @param gateway
|
||||
* TODO
|
||||
* @param netmask
|
||||
* TODO
|
||||
* @param allocationState
|
||||
* TODO
|
||||
* @return the new pod if successful, null otherwise
|
||||
* @throws
|
||||
* @throws
|
||||
@ -188,12 +197,14 @@ public interface ConfigurationService {
|
||||
boolean deleteZone(DeleteZoneCmd cmd);
|
||||
|
||||
/**
|
||||
* Adds a VLAN to the database, along with an IP address range. Can add three types of VLANs: (1) zone-wide VLANs on the
|
||||
* Adds a VLAN to the database, along with an IP address range. Can add three types of VLANs: (1) zone-wide VLANs on
|
||||
* the
|
||||
* virtual public network (2) pod-wide direct attached VLANs (3) account-specific direct attached VLANs
|
||||
*
|
||||
* @param userId
|
||||
* @param vlanType
|
||||
* - either "DomR" (VLAN for a virtual public network) or "DirectAttached" (VLAN for IPs that will be directly
|
||||
* - either "DomR" (VLAN for a virtual public network) or "DirectAttached" (VLAN for IPs that will be
|
||||
* directly
|
||||
* attached to UserVMs)
|
||||
* @param zoneId
|
||||
* @param accountId
|
||||
|
||||
@ -19,15 +19,15 @@ package com.cloud.configuration;
|
||||
|
||||
public interface Resource {
|
||||
|
||||
public static final short RESOURCE_UNLIMITED = -1;
|
||||
public static final short RESOURCE_UNLIMITED = -1;
|
||||
|
||||
public enum ResourceType{
|
||||
user_vm ("user_vm", 0, ResourceOwnerType.Account, ResourceOwnerType.Domain),
|
||||
public_ip ("public_ip", 1, ResourceOwnerType.Account, ResourceOwnerType.Domain),
|
||||
volume ("volume", 2, ResourceOwnerType.Account, ResourceOwnerType.Domain),
|
||||
snapshot ("snapshot", 3, ResourceOwnerType.Account, ResourceOwnerType.Domain),
|
||||
template ("template", 4, ResourceOwnerType.Account, ResourceOwnerType.Domain),
|
||||
project ("project", 5, ResourceOwnerType.Account, ResourceOwnerType.Domain);
|
||||
public enum ResourceType {
|
||||
user_vm("user_vm", 0, ResourceOwnerType.Account, ResourceOwnerType.Domain),
|
||||
public_ip("public_ip", 1, ResourceOwnerType.Account, ResourceOwnerType.Domain),
|
||||
volume("volume", 2, ResourceOwnerType.Account, ResourceOwnerType.Domain),
|
||||
snapshot("snapshot", 3, ResourceOwnerType.Account, ResourceOwnerType.Domain),
|
||||
template("template", 4, ResourceOwnerType.Account, ResourceOwnerType.Domain),
|
||||
project("project", 5, ResourceOwnerType.Account, ResourceOwnerType.Domain);
|
||||
|
||||
private String name;
|
||||
private ResourceOwnerType[] supportedOwners;
|
||||
@ -51,7 +51,7 @@ public interface Resource {
|
||||
boolean success = false;
|
||||
if (supportedOwners != null) {
|
||||
int length = supportedOwners.length;
|
||||
for (int i = 0; i< length; i++) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (supportedOwners[i].getName().equalsIgnoreCase(ownerType.getName())) {
|
||||
success = true;
|
||||
break;
|
||||
|
||||
@ -18,12 +18,12 @@
|
||||
|
||||
package com.cloud.configuration;
|
||||
|
||||
public interface ResourceCount extends Resource{
|
||||
public interface ResourceCount extends Resource {
|
||||
|
||||
public Long getId();
|
||||
public Long getId();
|
||||
|
||||
public long getCount();
|
||||
public long getCount();
|
||||
|
||||
public void setCount(long count);
|
||||
public void setCount(long count);
|
||||
|
||||
}
|
||||
|
||||
@ -18,12 +18,12 @@
|
||||
|
||||
package com.cloud.configuration;
|
||||
|
||||
public interface ResourceLimit extends Resource{
|
||||
public interface ResourceLimit extends Resource {
|
||||
|
||||
public Long getId();
|
||||
public Long getId();
|
||||
|
||||
public Long getMax();
|
||||
public Long getMax();
|
||||
|
||||
public void setMax(Long max);
|
||||
public void setMax(Long max);
|
||||
|
||||
}
|
||||
|
||||
@ -72,3 +72,4 @@ public interface EntityManager {
|
||||
|
||||
public <T, K extends Serializable> void remove(Class<T> entityType, K id);
|
||||
}
|
||||
|
||||
|
||||
@ -34,28 +34,49 @@ public interface DataCenter extends Grouping {
|
||||
Basic,
|
||||
Advanced,
|
||||
}
|
||||
|
||||
long getId();
|
||||
|
||||
String getDns1();
|
||||
|
||||
String getDns2();
|
||||
|
||||
String getName();
|
||||
|
||||
Long getDomainId();
|
||||
|
||||
String getDescription();
|
||||
|
||||
String getDomain();
|
||||
|
||||
NetworkType getNetworkType();
|
||||
|
||||
String getInternalDns1();
|
||||
|
||||
String getInternalDns2();
|
||||
|
||||
String getDnsProvider();
|
||||
|
||||
String getGatewayProvider();
|
||||
|
||||
String getFirewallProvider();
|
||||
|
||||
String getDhcpProvider();
|
||||
|
||||
String getLoadBalancerProvider();
|
||||
|
||||
String getUserDataProvider();
|
||||
|
||||
String getVpnProvider();
|
||||
|
||||
boolean isSecurityGroupEnabled();
|
||||
|
||||
Map<String, String> getDetails();
|
||||
|
||||
void setDetails(Map<String, String> details);
|
||||
|
||||
AllocationState getAllocationState();
|
||||
|
||||
String getZoneToken();
|
||||
|
||||
}
|
||||
|
||||
@ -22,7 +22,6 @@
|
||||
package com.cloud.dc;
|
||||
|
||||
import com.cloud.org.Grouping;
|
||||
import com.cloud.org.Grouping.AllocationState;
|
||||
|
||||
/**
|
||||
* Represents one pod in the cloud stack.
|
||||
@ -42,7 +41,7 @@ public interface Pod extends Grouping {
|
||||
|
||||
long getDataCenterId();
|
||||
|
||||
//String getUniqueName();
|
||||
// String getUniqueName();
|
||||
|
||||
String getDescription();
|
||||
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
package com.cloud.dc;
|
||||
|
||||
public interface StorageNetworkIpRange {
|
||||
String getUuid();
|
||||
String getUuid();
|
||||
|
||||
Integer getVlan();
|
||||
Integer getVlan();
|
||||
|
||||
String getPodUuid();
|
||||
String getPodUuid();
|
||||
|
||||
String getStartIp();
|
||||
String getStartIp();
|
||||
|
||||
String getEndIp();
|
||||
String getEndIp();
|
||||
|
||||
String getNetworkUuid();
|
||||
String getNetworkUuid();
|
||||
|
||||
String getZoneUuid();
|
||||
String getZoneUuid();
|
||||
}
|
||||
|
||||
@ -19,29 +19,29 @@
|
||||
package com.cloud.dc;
|
||||
|
||||
public interface Vlan {
|
||||
public enum VlanType {
|
||||
DirectAttached,
|
||||
VirtualNetwork
|
||||
}
|
||||
public enum VlanType {
|
||||
DirectAttached,
|
||||
VirtualNetwork
|
||||
}
|
||||
|
||||
public final static String UNTAGGED = "untagged";
|
||||
public final static String UNTAGGED = "untagged";
|
||||
|
||||
public long getId();
|
||||
public long getId();
|
||||
|
||||
public String getVlanTag();
|
||||
public String getVlanTag();
|
||||
|
||||
public String getVlanGateway();
|
||||
public String getVlanGateway();
|
||||
|
||||
public String getVlanNetmask();
|
||||
public String getVlanNetmask();
|
||||
|
||||
public long getDataCenterId();
|
||||
public long getDataCenterId();
|
||||
|
||||
public String getIpRange();
|
||||
public String getIpRange();
|
||||
|
||||
public VlanType getVlanType();
|
||||
public VlanType getVlanType();
|
||||
|
||||
public Long getNetworkId();
|
||||
public Long getNetworkId();
|
||||
|
||||
public Long getPhysicalNetworkId();
|
||||
public Long getPhysicalNetworkId();
|
||||
|
||||
}
|
||||
@ -58,8 +58,8 @@ public class DataCenterDeployment implements DeploymentPlan {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getHostId(){
|
||||
return _hostId;
|
||||
public Long getHostId() {
|
||||
return _hostId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -66,7 +66,7 @@ public class DeployDestination {
|
||||
}
|
||||
|
||||
public DeployDestination(DataCenter dc, Pod pod, Cluster cluster, Host host, Map<Volume, StoragePool> storage) {
|
||||
this(dc,pod,cluster,host);
|
||||
this(dc, pod, cluster, host);
|
||||
_storage = storage;
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ public class DeployDestination {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
DeployDestination that = (DeployDestination)obj;
|
||||
DeployDestination that = (DeployDestination) obj;
|
||||
if (this._dc == null || that._dc == null) {
|
||||
return false;
|
||||
}
|
||||
@ -129,22 +129,22 @@ public class DeployDestination {
|
||||
hostId = _host.getId();
|
||||
}
|
||||
|
||||
StringBuilder destination = new StringBuilder("Dest[Zone(Id)-Pod(Id)-Cluster(Id)-Host(Id)-Storage(Volume(Id|Type-->Pool(Id))] : Dest[");
|
||||
destination.append("Zone(").append(dcId).append(")").append("-");
|
||||
destination.append("Pod(").append(podId).append(")").append("-");
|
||||
destination.append("Cluster(").append(clusterId).append(")").append("-");
|
||||
destination.append("Host(").append(hostId).append(")").append("-");
|
||||
destination.append("Storage(");
|
||||
if(_storage != null){
|
||||
String storageStr = "";
|
||||
for(Volume vol : _storage.keySet()){
|
||||
if(!storageStr.equals("")){
|
||||
storageStr = storageStr + ", ";
|
||||
}
|
||||
storageStr = storageStr + "Volume(" + vol.getId() + "|"+ vol.getVolumeType().name() + "-->Pool("+_storage.get(vol).getId()+")";
|
||||
}
|
||||
destination.append(storageStr);
|
||||
}
|
||||
StringBuilder destination = new StringBuilder("Dest[Zone(Id)-Pod(Id)-Cluster(Id)-Host(Id)-Storage(Volume(Id|Type-->Pool(Id))] : Dest[");
|
||||
destination.append("Zone(").append(dcId).append(")").append("-");
|
||||
destination.append("Pod(").append(podId).append(")").append("-");
|
||||
destination.append("Cluster(").append(clusterId).append(")").append("-");
|
||||
destination.append("Host(").append(hostId).append(")").append("-");
|
||||
destination.append("Storage(");
|
||||
if (_storage != null) {
|
||||
String storageStr = "";
|
||||
for (Volume vol : _storage.keySet()) {
|
||||
if (!storageStr.equals("")) {
|
||||
storageStr = storageStr + ", ";
|
||||
}
|
||||
storageStr = storageStr + "Volume(" + vol.getId() + "|" + vol.getVolumeType().name() + "-->Pool(" + _storage.get(vol).getId() + ")";
|
||||
}
|
||||
destination.append(storageStr);
|
||||
}
|
||||
return destination.append(")]").toString();
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,9 +23,9 @@ import com.cloud.deploy.DeploymentPlanner.ExcludeList;
|
||||
* Describes how a VM should be deployed.
|
||||
*/
|
||||
public interface DeploymentPlan {
|
||||
// TODO: This interface is not fully developed. It really
|
||||
// should be more complicated than this and allow a
|
||||
// number of parameters to be specified.
|
||||
// TODO: This interface is not fully developed. It really
|
||||
// should be more complicated than this and allow a
|
||||
// number of parameters to be specified.
|
||||
|
||||
/**
|
||||
* @return data center the VM should deploy in.
|
||||
@ -54,13 +54,13 @@ public interface DeploymentPlan {
|
||||
|
||||
/**
|
||||
* @param avoids
|
||||
* Set the ExcludeList to avoid for deployment
|
||||
* Set the ExcludeList to avoid for deployment
|
||||
*/
|
||||
public void setAvoids(ExcludeList avoids);
|
||||
|
||||
/**
|
||||
* @return
|
||||
* the ExcludeList to avoid for deployment
|
||||
* the ExcludeList to avoid for deployment
|
||||
*/
|
||||
public ExcludeList getAvoids();
|
||||
|
||||
|
||||
@ -43,9 +43,12 @@ public interface DeploymentPlanner extends Adapter {
|
||||
/**
|
||||
* plan is called to determine where a virtual machine should be running.
|
||||
*
|
||||
* @param vm virtual machine.
|
||||
* @param plan deployment plan that tells you where it's being deployed to.
|
||||
* @param avoid avoid these data centers, pods, clusters, or hosts.
|
||||
* @param vm
|
||||
* virtual machine.
|
||||
* @param plan
|
||||
* deployment plan that tells you where it's being deployed to.
|
||||
* @param avoid
|
||||
* avoid these data centers, pods, clusters, or hosts.
|
||||
* @return DeployDestination for that virtual machine.
|
||||
*/
|
||||
DeployDestination plan(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException;
|
||||
@ -54,21 +57,30 @@ public interface DeploymentPlanner extends Adapter {
|
||||
* check() is called right before the virtual machine starts to make sure
|
||||
* the host has enough capacity.
|
||||
*
|
||||
* @param vm virtual machine in question.
|
||||
* @param plan deployment plan used to determined the deploy destination.
|
||||
* @param dest destination returned by plan.
|
||||
* @param avoid what to avoid.
|
||||
* @return true if it's okay to start; false if not. If false, the exclude list will include what should be excluded.
|
||||
* @param vm
|
||||
* virtual machine in question.
|
||||
* @param plan
|
||||
* deployment plan used to determined the deploy destination.
|
||||
* @param dest
|
||||
* destination returned by plan.
|
||||
* @param avoid
|
||||
* what to avoid.
|
||||
* @return true if it's okay to start; false if not. If false, the exclude list will include what should be
|
||||
* excluded.
|
||||
*/
|
||||
boolean check(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, DeployDestination dest, ExcludeList exclude);
|
||||
|
||||
/**
|
||||
* canHandle is called before plan to determine if the plan can do the allocation. Planers should be exclusive so planner writer must
|
||||
* canHandle is called before plan to determine if the plan can do the allocation. Planers should be exclusive so
|
||||
* planner writer must
|
||||
* make sure only one planer->canHandle return true in the planner list
|
||||
*
|
||||
* @param vm virtual machine.
|
||||
* @param plan deployment plan that tells you where it's being deployed to.
|
||||
* @param avoid avoid these data centers, pods, clusters, or hosts.
|
||||
* @param vm
|
||||
* virtual machine.
|
||||
* @param plan
|
||||
* deployment plan that tells you where it's being deployed to.
|
||||
* @param avoid
|
||||
* avoid these data centers, pods, clusters, or hosts.
|
||||
* @return true if it's okay to allocate; false or not
|
||||
*/
|
||||
boolean canHandle(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid);
|
||||
@ -87,14 +99,14 @@ public interface DeploymentPlanner extends Adapter {
|
||||
private Set<Long> _hostIds;
|
||||
private Set<Long> _poolIds;
|
||||
|
||||
public ExcludeList(){
|
||||
public ExcludeList() {
|
||||
}
|
||||
|
||||
public ExcludeList(Set<Long> _dcIds, Set<Long> _podIds, Set<Long> _clusterIds, Set<Long> _hostIds, Set<Long> _poolIds){
|
||||
this._dcIds = _dcIds;
|
||||
this._podIds = _podIds;
|
||||
this._clusterIds = _clusterIds;
|
||||
this._poolIds = _poolIds;
|
||||
public ExcludeList(Set<Long> _dcIds, Set<Long> _podIds, Set<Long> _clusterIds, Set<Long> _hostIds, Set<Long> _poolIds) {
|
||||
this._dcIds = _dcIds;
|
||||
this._podIds = _podIds;
|
||||
this._clusterIds = _clusterIds;
|
||||
this._poolIds = _poolIds;
|
||||
}
|
||||
|
||||
public boolean add(InsufficientCapacityException e) {
|
||||
@ -146,9 +158,9 @@ public interface DeploymentPlanner extends Adapter {
|
||||
}
|
||||
|
||||
public void addPool(long poolId) {
|
||||
if (_poolIds == null) {
|
||||
_poolIds = new HashSet<Long>();
|
||||
}
|
||||
if (_poolIds == null) {
|
||||
_poolIds = new HashSet<Long>();
|
||||
}
|
||||
_poolIds.add(poolId);
|
||||
}
|
||||
|
||||
@ -254,24 +266,24 @@ public interface DeploymentPlanner extends Adapter {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Set<Long> getDataCentersToAvoid(){
|
||||
return _dcIds;
|
||||
public Set<Long> getDataCentersToAvoid() {
|
||||
return _dcIds;
|
||||
}
|
||||
|
||||
public Set<Long> getPodsToAvoid(){
|
||||
return _podIds;
|
||||
public Set<Long> getPodsToAvoid() {
|
||||
return _podIds;
|
||||
}
|
||||
|
||||
public Set<Long> getClustersToAvoid(){
|
||||
return _clusterIds;
|
||||
public Set<Long> getClustersToAvoid() {
|
||||
return _clusterIds;
|
||||
}
|
||||
|
||||
public Set<Long> getHostsToAvoid(){
|
||||
return _hostIds;
|
||||
public Set<Long> getHostsToAvoid() {
|
||||
return _hostIds;
|
||||
}
|
||||
|
||||
public Set<Long> getPoolsToAvoid(){
|
||||
return _poolIds;
|
||||
public Set<Long> getPoolsToAvoid() {
|
||||
return _poolIds;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,7 +31,9 @@ import com.cloud.user.OwnedBy;
|
||||
public interface Domain extends OwnedBy {
|
||||
public static final long ROOT_DOMAIN = 1L;
|
||||
|
||||
enum State {Active, Inactive};
|
||||
enum State {
|
||||
Active, Inactive
|
||||
};
|
||||
|
||||
long getId();
|
||||
|
||||
|
||||
@ -24,11 +24,14 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({TYPE, METHOD})
|
||||
@Target({ TYPE, METHOD })
|
||||
@Retention(RUNTIME)
|
||||
public @interface ActionEvent {
|
||||
boolean create() default false;
|
||||
|
||||
boolean async() default false;
|
||||
|
||||
String eventType();
|
||||
|
||||
String eventDescription();
|
||||
}
|
||||
|
||||
@ -19,41 +19,41 @@
|
||||
package com.cloud.event;
|
||||
|
||||
public class EventTypes {
|
||||
// VM Events
|
||||
public static final String EVENT_VM_CREATE = "VM.CREATE";
|
||||
public static final String EVENT_VM_DESTROY = "VM.DESTROY";
|
||||
public static final String EVENT_VM_START = "VM.START";
|
||||
public static final String EVENT_VM_STOP = "VM.STOP";
|
||||
public static final String EVENT_VM_REBOOT = "VM.REBOOT";
|
||||
// VM Events
|
||||
public static final String EVENT_VM_CREATE = "VM.CREATE";
|
||||
public static final String EVENT_VM_DESTROY = "VM.DESTROY";
|
||||
public static final String EVENT_VM_START = "VM.START";
|
||||
public static final String EVENT_VM_STOP = "VM.STOP";
|
||||
public static final String EVENT_VM_REBOOT = "VM.REBOOT";
|
||||
public static final String EVENT_VM_UPDATE = "VM.UPDATE";
|
||||
public static final String EVENT_VM_UPGRADE = "VM.UPGRADE";
|
||||
public static final String EVENT_VM_RESETPASSWORD = "VM.RESETPASSWORD";
|
||||
public static final String EVENT_VM_MIGRATE = "VM.MIGRATE";
|
||||
public static final String EVENT_VM_UPGRADE = "VM.UPGRADE";
|
||||
public static final String EVENT_VM_RESETPASSWORD = "VM.RESETPASSWORD";
|
||||
public static final String EVENT_VM_MIGRATE = "VM.MIGRATE";
|
||||
public static final String EVENT_VM_MOVE = "VM.MOVE";
|
||||
public static final String EVENT_VM_RESTORE = "VM.RESTORE";
|
||||
|
||||
// Domain Router
|
||||
public static final String EVENT_ROUTER_CREATE = "ROUTER.CREATE";
|
||||
public static final String EVENT_ROUTER_DESTROY = "ROUTER.DESTROY";
|
||||
public static final String EVENT_ROUTER_START = "ROUTER.START";
|
||||
public static final String EVENT_ROUTER_STOP = "ROUTER.STOP";
|
||||
public static final String EVENT_ROUTER_REBOOT = "ROUTER.REBOOT";
|
||||
public static final String EVENT_ROUTER_HA = "ROUTER.HA";
|
||||
// Domain Router
|
||||
public static final String EVENT_ROUTER_CREATE = "ROUTER.CREATE";
|
||||
public static final String EVENT_ROUTER_DESTROY = "ROUTER.DESTROY";
|
||||
public static final String EVENT_ROUTER_START = "ROUTER.START";
|
||||
public static final String EVENT_ROUTER_STOP = "ROUTER.STOP";
|
||||
public static final String EVENT_ROUTER_REBOOT = "ROUTER.REBOOT";
|
||||
public static final String EVENT_ROUTER_HA = "ROUTER.HA";
|
||||
public static final String EVENT_ROUTER_UPGRADE = "ROUTER.UPGRADE";
|
||||
|
||||
// Console proxy
|
||||
public static final String EVENT_PROXY_CREATE = "PROXY.CREATE";
|
||||
public static final String EVENT_PROXY_DESTROY = "PROXY.DESTROY";
|
||||
public static final String EVENT_PROXY_START = "PROXY.START";
|
||||
public static final String EVENT_PROXY_STOP = "PROXY.STOP";
|
||||
public static final String EVENT_PROXY_REBOOT = "PROXY.REBOOT";
|
||||
public static final String EVENT_PROXY_HA = "PROXY.HA";
|
||||
// Console proxy
|
||||
public static final String EVENT_PROXY_CREATE = "PROXY.CREATE";
|
||||
public static final String EVENT_PROXY_DESTROY = "PROXY.DESTROY";
|
||||
public static final String EVENT_PROXY_START = "PROXY.START";
|
||||
public static final String EVENT_PROXY_STOP = "PROXY.STOP";
|
||||
public static final String EVENT_PROXY_REBOOT = "PROXY.REBOOT";
|
||||
public static final String EVENT_PROXY_HA = "PROXY.HA";
|
||||
|
||||
// VNC Console Events
|
||||
public static final String EVENT_VNC_CONNECT = "VNC.CONNECT";
|
||||
public static final String EVENT_VNC_DISCONNECT = "VNC.DISCONNECT";
|
||||
// VNC Console Events
|
||||
public static final String EVENT_VNC_CONNECT = "VNC.CONNECT";
|
||||
public static final String EVENT_VNC_DISCONNECT = "VNC.DISCONNECT";
|
||||
|
||||
// Network Events
|
||||
// Network Events
|
||||
public static final String EVENT_NET_IP_ASSIGN = "NET.IPASSIGN";
|
||||
public static final String EVENT_NET_IP_RELEASE = "NET.IPRELEASE";
|
||||
public static final String EVENT_NET_RULE_ADD = "NET.RULEADD";
|
||||
@ -79,43 +79,43 @@ public class EventTypes {
|
||||
public static final String EVENT_ACCOUNT_CREATE = "ACCOUNT.CREATE";
|
||||
public static final String EVENT_ACCOUNT_DELETE = "ACCOUNT.DELETE";
|
||||
|
||||
// UserVO Events
|
||||
public static final String EVENT_USER_LOGIN = "USER.LOGIN";
|
||||
public static final String EVENT_USER_LOGOUT = "USER.LOGOUT";
|
||||
public static final String EVENT_USER_CREATE = "USER.CREATE";
|
||||
public static final String EVENT_USER_DELETE = "USER.DELETE";
|
||||
// UserVO Events
|
||||
public static final String EVENT_USER_LOGIN = "USER.LOGIN";
|
||||
public static final String EVENT_USER_LOGOUT = "USER.LOGOUT";
|
||||
public static final String EVENT_USER_CREATE = "USER.CREATE";
|
||||
public static final String EVENT_USER_DELETE = "USER.DELETE";
|
||||
public static final String EVENT_USER_DISABLE = "USER.DISABLE";
|
||||
public static final String EVENT_USER_UPDATE = "USER.UPDATE";
|
||||
public static final String EVENT_USER_ENABLE = "USER.ENABLE";
|
||||
public static final String EVENT_USER_LOCK = "USER.LOCK";
|
||||
public static final String EVENT_USER_UPDATE = "USER.UPDATE";
|
||||
public static final String EVENT_USER_ENABLE = "USER.ENABLE";
|
||||
public static final String EVENT_USER_LOCK = "USER.LOCK";
|
||||
|
||||
//Template Events
|
||||
public static final String EVENT_TEMPLATE_CREATE = "TEMPLATE.CREATE";
|
||||
public static final String EVENT_TEMPLATE_DELETE = "TEMPLATE.DELETE";
|
||||
public static final String EVENT_TEMPLATE_UPDATE = "TEMPLATE.UPDATE";
|
||||
// Template Events
|
||||
public static final String EVENT_TEMPLATE_CREATE = "TEMPLATE.CREATE";
|
||||
public static final String EVENT_TEMPLATE_DELETE = "TEMPLATE.DELETE";
|
||||
public static final String EVENT_TEMPLATE_UPDATE = "TEMPLATE.UPDATE";
|
||||
public static final String EVENT_TEMPLATE_DOWNLOAD_START = "TEMPLATE.DOWNLOAD.START";
|
||||
public static final String EVENT_TEMPLATE_DOWNLOAD_SUCCESS = "TEMPLATE.DOWNLOAD.SUCCESS";
|
||||
public static final String EVENT_TEMPLATE_DOWNLOAD_FAILED = "TEMPLATE.DOWNLOAD.FAILED";
|
||||
public static final String EVENT_TEMPLATE_COPY = "TEMPLATE.COPY";
|
||||
public static final String EVENT_TEMPLATE_COPY = "TEMPLATE.COPY";
|
||||
public static final String EVENT_TEMPLATE_EXTRACT = "TEMPLATE.EXTRACT";
|
||||
public static final String EVENT_TEMPLATE_UPLOAD = "TEMPLATE.UPLOAD";
|
||||
public static final String EVENT_TEMPLATE_CLEANUP = "TEMPLATE.CLEANUP";
|
||||
|
||||
// Volume Events
|
||||
public static final String EVENT_VOLUME_CREATE = "VOLUME.CREATE";
|
||||
public static final String EVENT_VOLUME_DELETE = "VOLUME.DELETE";
|
||||
public static final String EVENT_VOLUME_ATTACH = "VOLUME.ATTACH";
|
||||
public static final String EVENT_VOLUME_DETACH = "VOLUME.DETACH";
|
||||
public static final String EVENT_VOLUME_EXTRACT = "VOLUME.EXTRACT";
|
||||
public static final String EVENT_VOLUME_UPLOAD = "VOLUME.UPLOAD";
|
||||
public static final String EVENT_VOLUME_MIGRATE = "VOLUME.MIGRATE";
|
||||
// Volume Events
|
||||
public static final String EVENT_VOLUME_CREATE = "VOLUME.CREATE";
|
||||
public static final String EVENT_VOLUME_DELETE = "VOLUME.DELETE";
|
||||
public static final String EVENT_VOLUME_ATTACH = "VOLUME.ATTACH";
|
||||
public static final String EVENT_VOLUME_DETACH = "VOLUME.DETACH";
|
||||
public static final String EVENT_VOLUME_EXTRACT = "VOLUME.EXTRACT";
|
||||
public static final String EVENT_VOLUME_UPLOAD = "VOLUME.UPLOAD";
|
||||
public static final String EVENT_VOLUME_MIGRATE = "VOLUME.MIGRATE";
|
||||
|
||||
// Domains
|
||||
public static final String EVENT_DOMAIN_CREATE = "DOMAIN.CREATE";
|
||||
public static final String EVENT_DOMAIN_DELETE = "DOMAIN.DELETE";
|
||||
public static final String EVENT_DOMAIN_UPDATE = "DOMAIN.UPDATE";
|
||||
// Domains
|
||||
public static final String EVENT_DOMAIN_CREATE = "DOMAIN.CREATE";
|
||||
public static final String EVENT_DOMAIN_DELETE = "DOMAIN.DELETE";
|
||||
public static final String EVENT_DOMAIN_UPDATE = "DOMAIN.UPDATE";
|
||||
|
||||
// Snapshots
|
||||
// Snapshots
|
||||
public static final String EVENT_SNAPSHOT_CREATE = "SNAPSHOT.CREATE";
|
||||
public static final String EVENT_SNAPSHOT_DELETE = "SNAPSHOT.DELETE";
|
||||
public static final String EVENT_SNAPSHOT_POLICY_CREATE = "SNAPSHOTPOLICY.CREATE";
|
||||
@ -129,58 +129,58 @@ public class EventTypes {
|
||||
public static final String EVENT_ISO_ATTACH = "ISO.ATTACH";
|
||||
public static final String EVENT_ISO_DETACH = "ISO.DETACH";
|
||||
public static final String EVENT_ISO_EXTRACT = "ISO.EXTRACT";
|
||||
public static final String EVENT_ISO_UPLOAD = "ISO.UPLOAD";
|
||||
public static final String EVENT_ISO_UPLOAD = "ISO.UPLOAD";
|
||||
|
||||
//SSVM
|
||||
// SSVM
|
||||
public static final String EVENT_SSVM_CREATE = "SSVM.CREATE";
|
||||
public static final String EVENT_SSVM_DESTROY = "SSVM.DESTROY";
|
||||
public static final String EVENT_SSVM_START = "SSVM.START";
|
||||
public static final String EVENT_SSVM_STOP = "SSVM.STOP";
|
||||
public static final String EVENT_SSVM_REBOOT = "SSVM.REBOOT";
|
||||
public static final String EVENT_SSVM_HA = "SSVM.HA";
|
||||
public static final String EVENT_SSVM_DESTROY = "SSVM.DESTROY";
|
||||
public static final String EVENT_SSVM_START = "SSVM.START";
|
||||
public static final String EVENT_SSVM_STOP = "SSVM.STOP";
|
||||
public static final String EVENT_SSVM_REBOOT = "SSVM.REBOOT";
|
||||
public static final String EVENT_SSVM_HA = "SSVM.HA";
|
||||
|
||||
// Service Offerings
|
||||
public static final String EVENT_SERVICE_OFFERING_CREATE = "SERVICE.OFFERING.CREATE";
|
||||
public static final String EVENT_SERVICE_OFFERING_EDIT = "SERVICE.OFFERING.EDIT";
|
||||
public static final String EVENT_SERVICE_OFFERING_DELETE = "SERVICE.OFFERING.DELETE";
|
||||
// Service Offerings
|
||||
public static final String EVENT_SERVICE_OFFERING_CREATE = "SERVICE.OFFERING.CREATE";
|
||||
public static final String EVENT_SERVICE_OFFERING_EDIT = "SERVICE.OFFERING.EDIT";
|
||||
public static final String EVENT_SERVICE_OFFERING_DELETE = "SERVICE.OFFERING.DELETE";
|
||||
|
||||
// Disk Offerings
|
||||
// Disk Offerings
|
||||
public static final String EVENT_DISK_OFFERING_CREATE = "DISK.OFFERING.CREATE";
|
||||
public static final String EVENT_DISK_OFFERING_EDIT = "DISK.OFFERING.EDIT";
|
||||
public static final String EVENT_DISK_OFFERING_DELETE = "DISK.OFFERING.DELETE";
|
||||
|
||||
//Network offerings
|
||||
// Network offerings
|
||||
public static final String EVENT_NETWORK_OFFERING_CREATE = "NETWORK.OFFERING.CREATE";
|
||||
public static final String EVENT_NETWORK_OFFERING_ASSIGN = "NETWORK.OFFERING.ASSIGN";
|
||||
public static final String EVENT_NETWORK_OFFERING_EDIT = "NETWORK.OFFERING.EDIT";
|
||||
public static final String EVENT_NETWORK_OFFERING_REMOVE = "NETWORK.OFFERING.REMOVE";
|
||||
public static final String EVENT_NETWORK_OFFERING_DELETE = "NETWORK.OFFERING.DELETE";
|
||||
|
||||
// Pods
|
||||
public static final String EVENT_POD_CREATE = "POD.CREATE";
|
||||
public static final String EVENT_POD_EDIT = "POD.EDIT";
|
||||
public static final String EVENT_POD_DELETE = "POD.DELETE";
|
||||
// Pods
|
||||
public static final String EVENT_POD_CREATE = "POD.CREATE";
|
||||
public static final String EVENT_POD_EDIT = "POD.EDIT";
|
||||
public static final String EVENT_POD_DELETE = "POD.DELETE";
|
||||
|
||||
// Zones
|
||||
public static final String EVENT_ZONE_CREATE = "ZONE.CREATE";
|
||||
public static final String EVENT_ZONE_EDIT = "ZONE.EDIT";
|
||||
public static final String EVENT_ZONE_DELETE = "ZONE.DELETE";
|
||||
// Zones
|
||||
public static final String EVENT_ZONE_CREATE = "ZONE.CREATE";
|
||||
public static final String EVENT_ZONE_EDIT = "ZONE.EDIT";
|
||||
public static final String EVENT_ZONE_DELETE = "ZONE.DELETE";
|
||||
|
||||
// VLANs/IP ranges
|
||||
public static final String EVENT_VLAN_IP_RANGE_CREATE = "VLAN.IP.RANGE.CREATE";
|
||||
public static final String EVENT_VLAN_IP_RANGE_DELETE = "VLAN.IP.RANGE.DELETE";
|
||||
// VLANs/IP ranges
|
||||
public static final String EVENT_VLAN_IP_RANGE_CREATE = "VLAN.IP.RANGE.CREATE";
|
||||
public static final String EVENT_VLAN_IP_RANGE_DELETE = "VLAN.IP.RANGE.DELETE";
|
||||
|
||||
public static final String EVENT_STORAGE_IP_RANGE_CREATE = "STORAGE.IP.RANGE.CREATE";
|
||||
public static final String EVENT_STORAGE_IP_RANGE_DELETE = "STORAGE.IP.RANGE.DELETE";
|
||||
public static final String EVENT_STORAGE_IP_RANGE_UPDATE = "STORAGE.IP.RANGE.UPDATE";
|
||||
public static final String EVENT_STORAGE_IP_RANGE_CREATE = "STORAGE.IP.RANGE.CREATE";
|
||||
public static final String EVENT_STORAGE_IP_RANGE_DELETE = "STORAGE.IP.RANGE.DELETE";
|
||||
public static final String EVENT_STORAGE_IP_RANGE_UPDATE = "STORAGE.IP.RANGE.UPDATE";
|
||||
|
||||
// Configuration Table
|
||||
public static final String EVENT_CONFIGURATION_VALUE_EDIT = "CONFIGURATION.VALUE.EDIT";
|
||||
// Configuration Table
|
||||
public static final String EVENT_CONFIGURATION_VALUE_EDIT = "CONFIGURATION.VALUE.EDIT";
|
||||
|
||||
// Security Groups
|
||||
public static final String EVENT_SECURITY_GROUP_AUTHORIZE_INGRESS = "SG.AUTH.INGRESS";
|
||||
// Security Groups
|
||||
public static final String EVENT_SECURITY_GROUP_AUTHORIZE_INGRESS = "SG.AUTH.INGRESS";
|
||||
public static final String EVENT_SECURITY_GROUP_REVOKE_INGRESS = "SG.REVOKE.INGRESS";
|
||||
public static final String EVENT_SECURITY_GROUP_AUTHORIZE_EGRESS = "SG.AUTH.EGRESS";
|
||||
public static final String EVENT_SECURITY_GROUP_AUTHORIZE_EGRESS = "SG.AUTH.EGRESS";
|
||||
public static final String EVENT_SECURITY_GROUP_REVOKE_EGRESS = "SG.REVOKE.EGRESS";
|
||||
public static final String EVENT_SECURITY_GROUP_CREATE = "SG.CREATE";
|
||||
public static final String EVENT_SECURITY_GROUP_DELETE = "SG.DELETE";
|
||||
@ -194,60 +194,60 @@ public class EventTypes {
|
||||
public static final String EVENT_MAINTENANCE_PREPARE = "MAINT.PREPARE";
|
||||
public static final String EVENT_MAINTENANCE_PREPARE_PRIMARY_STORAGE = "MAINT.PREPARE.PS";
|
||||
|
||||
//VPN
|
||||
// VPN
|
||||
public static final String EVENT_REMOTE_ACCESS_VPN_CREATE = "VPN.REMOTE.ACCESS.CREATE";
|
||||
public static final String EVENT_REMOTE_ACCESS_VPN_DESTROY = "VPN.REMOTE.ACCESS.DESTROY";
|
||||
public static final String EVENT_VPN_USER_ADD = "VPN.USER.ADD";
|
||||
public static final String EVENT_VPN_USER_REMOVE = "VPN.USER.REMOVE";
|
||||
|
||||
//Network
|
||||
// Network
|
||||
public static final String EVENT_NETWORK_RESTART = "NETWORK.RESTART";
|
||||
|
||||
//Custom certificates
|
||||
public static final String EVENT_UPLOAD_CUSTOM_CERTIFICATE = "UPLOAD.CUSTOM.CERTIFICATE";
|
||||
// Custom certificates
|
||||
public static final String EVENT_UPLOAD_CUSTOM_CERTIFICATE = "UPLOAD.CUSTOM.CERTIFICATE";
|
||||
|
||||
//OneToOnenat
|
||||
public static final String EVENT_ENABLE_STATIC_NAT = "STATICNAT.ENABLE";
|
||||
public static final String EVENT_DISABLE_STATIC_NAT = "STATICNAT.DISABLE";
|
||||
// OneToOnenat
|
||||
public static final String EVENT_ENABLE_STATIC_NAT = "STATICNAT.ENABLE";
|
||||
public static final String EVENT_DISABLE_STATIC_NAT = "STATICNAT.DISABLE";
|
||||
|
||||
public static final String EVENT_ZONE_VLAN_ASSIGN = "ZONE.VLAN.ASSIGN";
|
||||
public static final String EVENT_ZONE_VLAN_RELEASE = "ZONE.VLAN.RELEASE";
|
||||
public static final String EVENT_ZONE_VLAN_ASSIGN = "ZONE.VLAN.ASSIGN";
|
||||
public static final String EVENT_ZONE_VLAN_RELEASE = "ZONE.VLAN.RELEASE";
|
||||
|
||||
//Projects
|
||||
public static final String EVENT_PROJECT_CREATE = "PROJECT.CREATE";
|
||||
public static final String EVENT_PROJECT_UPDATE = "PROJECT.UPDATE";
|
||||
public static final String EVENT_PROJECT_DELETE = "PROJECT.DELETE";
|
||||
public static final String EVENT_PROJECT_ACTIVATE = "PROJECT.ACTIVATE";
|
||||
public static final String EVENT_PROJECT_SUSPEND = "PROJECT.SUSPEND";
|
||||
public static final String EVENT_PROJECT_ACCOUNT_ADD = "PROJECT.ACCOUNT.ADD";
|
||||
public static final String EVENT_PROJECT_INVITATION_UPDATE = "PROJECT.INVITATION.UPDATE";
|
||||
public static final String EVENT_PROJECT_INVITATION_REMOVE = "PROJECT.INVITATION.REMOVE";
|
||||
public static final String EVENT_PROJECT_ACCOUNT_REMOVE = "PROJECT.ACCOUNT.REMOVE";
|
||||
// Projects
|
||||
public static final String EVENT_PROJECT_CREATE = "PROJECT.CREATE";
|
||||
public static final String EVENT_PROJECT_UPDATE = "PROJECT.UPDATE";
|
||||
public static final String EVENT_PROJECT_DELETE = "PROJECT.DELETE";
|
||||
public static final String EVENT_PROJECT_ACTIVATE = "PROJECT.ACTIVATE";
|
||||
public static final String EVENT_PROJECT_SUSPEND = "PROJECT.SUSPEND";
|
||||
public static final String EVENT_PROJECT_ACCOUNT_ADD = "PROJECT.ACCOUNT.ADD";
|
||||
public static final String EVENT_PROJECT_INVITATION_UPDATE = "PROJECT.INVITATION.UPDATE";
|
||||
public static final String EVENT_PROJECT_INVITATION_REMOVE = "PROJECT.INVITATION.REMOVE";
|
||||
public static final String EVENT_PROJECT_ACCOUNT_REMOVE = "PROJECT.ACCOUNT.REMOVE";
|
||||
|
||||
//Network as a Service
|
||||
public static final String EVENT_NETWORK_ELEMENT_CONFIGURE = "NETWORK.ELEMENT.CONFIGURE";
|
||||
// Network as a Service
|
||||
public static final String EVENT_NETWORK_ELEMENT_CONFIGURE = "NETWORK.ELEMENT.CONFIGURE";
|
||||
|
||||
//Physical Network Events
|
||||
// Physical Network Events
|
||||
public static final String EVENT_PHYSICAL_NETWORK_CREATE = "PHYSICAL.NETWORK.CREATE";
|
||||
public static final String EVENT_PHYSICAL_NETWORK_DELETE = "PHYSICAL.NETWORK.DELETE";
|
||||
public static final String EVENT_PHYSICAL_NETWORK_UPDATE = "PHYSICAL.NETWORK.UPDATE";
|
||||
|
||||
//Physical Network Service Provider Events
|
||||
// Physical Network Service Provider Events
|
||||
public static final String EVENT_SERVICE_PROVIDER_CREATE = "SERVICE.PROVIDER.CREATE";
|
||||
public static final String EVENT_SERVICE_PROVIDER_DELETE = "SERVICE.PROVIDER.DELETE";
|
||||
public static final String EVENT_SERVICE_PROVIDER_UPDATE = "SERVICE.PROVIDER.UPDATE";
|
||||
|
||||
//Physical Network TrafficType Events
|
||||
// Physical Network TrafficType Events
|
||||
public static final String EVENT_TRAFFIC_TYPE_CREATE = "TRAFFIC.TYPE.CREATE";
|
||||
public static final String EVENT_TRAFFIC_TYPE_DELETE = "TRAFFIC.TYPE.DELETE";
|
||||
public static final String EVENT_TRAFFIC_TYPE_UPDATE = "TRAFFIC.TYPE.UPDATE";
|
||||
|
||||
// external network device events
|
||||
public static final String EVENT_EXTERAL_LB_DEVICE_ADD = "PHYSICAL.LOADBALANCER.ADD" ;
|
||||
public static final String EVENT_EXTERAL_LB_DEVICE_ADD = "PHYSICAL.LOADBALANCER.ADD";
|
||||
public static final String EVENT_EXTERAL_LB_DEVICE_DELETE = "PHYSICAL.LOADBALANCER.DELETE";
|
||||
public static final String EVENT_EXTERAL_LB_DEVICE_CONFIGURE = "PHYSICAL.LOADBALANCER.CONFIGURE";
|
||||
|
||||
public static final String EVENT_EXTERAL_FIREWALL_DEVICE_ADD = "PHYSICAL.FIREWALL.ADD" ;
|
||||
public static final String EVENT_EXTERAL_FIREWALL_DEVICE_ADD = "PHYSICAL.FIREWALL.ADD";
|
||||
public static final String EVENT_EXTERAL_FIREWALL_DEVICE_DELETE = "PHYSICAL.FIREWALL.DELETE";
|
||||
public static final String EVENT_EXTERAL_FIREWALL_DEVICE_CONFIGURE = "PHYSICAL.FIREWALL.CONFIGURE";
|
||||
}
|
||||
|
||||
@ -36,6 +36,5 @@ public class AccountLimitException extends CloudRuntimeException {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
// TODO: Add the actual thing that causes the exception. Is it ip address, vm, etc?
|
||||
|
||||
// TODO: Add the actual thing that causes the exception. Is it ip address, vm, etc?
|
||||
}
|
||||
|
||||
@ -25,14 +25,14 @@ import com.cloud.utils.SerialVersionUID;
|
||||
*/
|
||||
public class InsufficientAddressCapacityException extends InsufficientNetworkCapacityException {
|
||||
|
||||
private static final long serialVersionUID = SerialVersionUID.InsufficientAddressCapacityException;
|
||||
private static final long serialVersionUID = SerialVersionUID.InsufficientAddressCapacityException;
|
||||
|
||||
public InsufficientAddressCapacityException(String msg, Class<?> scope, Long id) {
|
||||
super(msg, scope, id);
|
||||
}
|
||||
public InsufficientAddressCapacityException(String msg, Class<?> scope, Long id) {
|
||||
super(msg, scope, id);
|
||||
}
|
||||
|
||||
protected InsufficientAddressCapacityException() {
|
||||
super();
|
||||
}
|
||||
protected InsufficientAddressCapacityException() {
|
||||
super();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -20,13 +20,10 @@ package com.cloud.exception;
|
||||
|
||||
public class InternalErrorException extends ManagementServerException {
|
||||
|
||||
private static final long serialVersionUID = -3070582946175427902L;
|
||||
|
||||
private static final long serialVersionUID = -3070582946175427902L;
|
||||
|
||||
public InternalErrorException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
||||
public InternalErrorException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -26,10 +26,10 @@ import com.cloud.utils.exception.CloudRuntimeException;
|
||||
*/
|
||||
public class InvalidParameterValueException extends CloudRuntimeException {
|
||||
|
||||
private static final long serialVersionUID = -2232066904895010203L;
|
||||
private static final long serialVersionUID = -2232066904895010203L;
|
||||
|
||||
public InvalidParameterValueException(String message) {
|
||||
super(message);
|
||||
}
|
||||
public InvalidParameterValueException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -25,20 +25,14 @@ import com.cloud.utils.SerialVersionUID;
|
||||
*/
|
||||
public class ManagementServerException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = SerialVersionUID.ManagementServerException;
|
||||
|
||||
private static final long serialVersionUID = SerialVersionUID.ManagementServerException;
|
||||
|
||||
|
||||
public ManagementServerException() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public ManagementServerException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ManagementServerException() {
|
||||
|
||||
}
|
||||
|
||||
public ManagementServerException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -19,12 +19,12 @@
|
||||
package com.cloud.exception;
|
||||
|
||||
public class NetworkRuleConflictException extends
|
||||
ManagementServerException {
|
||||
ManagementServerException {
|
||||
|
||||
private static final long serialVersionUID = -294905017911859479L;
|
||||
private static final long serialVersionUID = -294905017911859479L;
|
||||
|
||||
public NetworkRuleConflictException(String message) {
|
||||
super(message);
|
||||
}
|
||||
public NetworkRuleConflictException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -30,39 +30,39 @@ import com.cloud.utils.exception.CloudRuntimeException;
|
||||
*/
|
||||
public class PermissionDeniedException extends CloudRuntimeException {
|
||||
|
||||
private static final long serialVersionUID = SerialVersionUID.PermissionDeniedException;
|
||||
private static final long serialVersionUID = SerialVersionUID.PermissionDeniedException;
|
||||
|
||||
public PermissionDeniedException(String message) {
|
||||
super(message);
|
||||
}
|
||||
public PermissionDeniedException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
protected PermissionDeniedException() {
|
||||
super();
|
||||
}
|
||||
protected PermissionDeniedException() {
|
||||
super();
|
||||
}
|
||||
|
||||
List<? extends ControlledEntity> violations;
|
||||
Account account;
|
||||
List<? extends ControlledEntity> violations;
|
||||
Account account;
|
||||
|
||||
public PermissionDeniedException(String message, Account account, List<? extends ControlledEntity> violations) {
|
||||
super(message);
|
||||
this.violations = violations;
|
||||
this.account = account;
|
||||
}
|
||||
public PermissionDeniedException(String message, Account account, List<? extends ControlledEntity> violations) {
|
||||
super(message);
|
||||
this.violations = violations;
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public Account getAccount() {
|
||||
return account;
|
||||
}
|
||||
public Account getAccount() {
|
||||
return account;
|
||||
}
|
||||
|
||||
public List<? extends ControlledEntity> getEntitiesInViolation() {
|
||||
return violations;
|
||||
}
|
||||
public List<? extends ControlledEntity> getEntitiesInViolation() {
|
||||
return violations;
|
||||
}
|
||||
|
||||
public void addDetails(Account account, List<? extends ControlledEntity> violations) {
|
||||
this.account = account;
|
||||
this.violations = violations;
|
||||
}
|
||||
public void addDetails(Account account, List<? extends ControlledEntity> violations) {
|
||||
this.account = account;
|
||||
this.violations = violations;
|
||||
}
|
||||
|
||||
public void addViolations(List<? extends ControlledEntity> violations) {
|
||||
this.violations = violations;
|
||||
}
|
||||
public void addViolations(List<? extends ControlledEntity> violations) {
|
||||
this.violations = violations;
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,16 +22,16 @@ import com.cloud.configuration.Resource.ResourceType;
|
||||
|
||||
public class ResourceAllocationException extends ManagementServerException {
|
||||
|
||||
private static final long serialVersionUID = -2232066904895010203L;
|
||||
private ResourceType resourceType;
|
||||
private static final long serialVersionUID = -2232066904895010203L;
|
||||
private ResourceType resourceType;
|
||||
|
||||
public ResourceAllocationException(String message, ResourceType resourceType) {
|
||||
super(message);
|
||||
this.resourceType = resourceType;
|
||||
}
|
||||
public ResourceAllocationException(String message, ResourceType resourceType) {
|
||||
super(message);
|
||||
this.resourceType = resourceType;
|
||||
}
|
||||
|
||||
public ResourceType getResourceType() {
|
||||
return this.resourceType;
|
||||
}
|
||||
public ResourceType getResourceType() {
|
||||
return this.resourceType;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -23,34 +23,34 @@ package com.cloud.exception;
|
||||
*/
|
||||
public class ResourceInUseException extends ManagementServerException {
|
||||
|
||||
private static final long serialVersionUID = 1383416910411639324L;
|
||||
private String resourceType;
|
||||
private String resourceName;
|
||||
private static final long serialVersionUID = 1383416910411639324L;
|
||||
private String resourceType;
|
||||
private String resourceName;
|
||||
|
||||
public ResourceInUseException(String message) {
|
||||
super(message);
|
||||
}
|
||||
public ResourceInUseException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ResourceInUseException(String message, String resourceType,
|
||||
String resourceName) {
|
||||
super(message);
|
||||
this.resourceType = resourceType;
|
||||
this.resourceName = resourceName;
|
||||
}
|
||||
public ResourceInUseException(String message, String resourceType,
|
||||
String resourceName) {
|
||||
super(message);
|
||||
this.resourceType = resourceType;
|
||||
this.resourceName = resourceName;
|
||||
}
|
||||
|
||||
public void setResourceType(String resourceType) {
|
||||
this.resourceType = resourceType;
|
||||
}
|
||||
public void setResourceType(String resourceType) {
|
||||
this.resourceType = resourceType;
|
||||
}
|
||||
|
||||
public String getResourceType() {
|
||||
return this.resourceType;
|
||||
}
|
||||
public String getResourceType() {
|
||||
return this.resourceType;
|
||||
}
|
||||
|
||||
public void setResourceName(String resourceName) {
|
||||
this.resourceName = resourceName;
|
||||
}
|
||||
public void setResourceName(String resourceName) {
|
||||
this.resourceName = resourceName;
|
||||
}
|
||||
|
||||
public String getResourceName() {
|
||||
return resourceName;
|
||||
}
|
||||
public String getResourceName() {
|
||||
return resourceName;
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ package com.cloud.exception;
|
||||
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
public class UnsupportedServiceException extends CloudRuntimeException{
|
||||
public class UnsupportedServiceException extends CloudRuntimeException {
|
||||
|
||||
public UnsupportedServiceException(String message) {
|
||||
super(message);
|
||||
|
||||
@ -22,7 +22,7 @@ import com.cloud.utils.SerialVersionUID;
|
||||
public class VirtualMachineMigrationException extends Exception {
|
||||
private static final long serialVersionUID = SerialVersionUID.VirtualMachineMigrationException;
|
||||
|
||||
public VirtualMachineMigrationException(String message) {
|
||||
super(message);
|
||||
}
|
||||
public VirtualMachineMigrationException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,23 +26,23 @@ import com.cloud.utils.net.Ip;
|
||||
* IpAddress represents the public ip address to be allocated in the CloudStack.
|
||||
*
|
||||
* When it is not allocated, it should have
|
||||
* - State = Free
|
||||
* - Allocated = null
|
||||
* - AccountId = null
|
||||
* - DomainId = null
|
||||
* - State = Free
|
||||
* - Allocated = null
|
||||
* - AccountId = null
|
||||
* - DomainId = null
|
||||
*
|
||||
* When it is allocated, it should have
|
||||
* - State = Allocated
|
||||
* - AccountId = account owner.
|
||||
* - DomainId = domain of the account owner.
|
||||
* - Allocated = time it was allocated.
|
||||
* - State = Allocated
|
||||
* - AccountId = account owner.
|
||||
* - DomainId = domain of the account owner.
|
||||
* - Allocated = time it was allocated.
|
||||
*/
|
||||
public interface IpAddress extends ControlledEntity{
|
||||
public interface IpAddress extends ControlledEntity {
|
||||
enum State {
|
||||
Allocating, // The IP Address is being propagated to other network elements and is not ready for use yet.
|
||||
Allocated, // The IP address is in used.
|
||||
Releasing, // The IP address is being released for other network elements and is not ready for allocation.
|
||||
Free // The IP address is ready to be allocated.
|
||||
Allocating, // The IP Address is being propagated to other network elements and is not ready for use yet.
|
||||
Allocated, // The IP address is in used.
|
||||
Releasing, // The IP address is being released for other network elements and is not ready for allocation.
|
||||
Free // The IP address is ready to be allocated.
|
||||
}
|
||||
|
||||
long getDataCenterId();
|
||||
@ -74,10 +74,10 @@ public interface IpAddress extends ControlledEntity{
|
||||
|
||||
void setState(IpAddress.State state);
|
||||
|
||||
Long getAllocatedToAccountId();
|
||||
Long getAllocatedToAccountId();
|
||||
|
||||
Long getAllocatedInDomainId();
|
||||
Long getAllocatedInDomainId();
|
||||
|
||||
boolean getElastic();
|
||||
boolean getElastic();
|
||||
|
||||
}
|
||||
|
||||
@ -24,7 +24,6 @@ import com.cloud.network.Networks.BroadcastDomainType;
|
||||
import com.cloud.network.Networks.Mode;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
|
||||
|
||||
public class NetworkProfile implements Network {
|
||||
private long id;
|
||||
private long dataCenterId;
|
||||
@ -184,7 +183,7 @@ public class NetworkProfile implements Network {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Network.GuestType getGuestType(){
|
||||
public Network.GuestType getGuestType() {
|
||||
return guestType;
|
||||
}
|
||||
|
||||
@ -199,11 +198,11 @@ public class NetworkProfile implements Network {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ACLType getAclType() {
|
||||
return aclType;
|
||||
}
|
||||
public ACLType getAclType() {
|
||||
return aclType;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public boolean isSpecifiedCidr() {
|
||||
return specifiedCidr;
|
||||
}
|
||||
@ -212,16 +211,16 @@ public class NetworkProfile implements Network {
|
||||
this.specifiedCidr = specifiedCidr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRestartRequired() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isRestartRequired() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getSpecifyIpRanges() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean getSpecifyIpRanges() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -132,4 +132,5 @@ public interface NetworkService {
|
||||
Network getExclusiveGuestNetwork(long zoneId);
|
||||
|
||||
List<Pair<TrafficType, String>> listTrafficTypeImplementor(ListTrafficTypeImplementorsCmd cmd);
|
||||
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ public class Networks {
|
||||
|
||||
public enum RouterPrivateIpStrategy {
|
||||
None,
|
||||
DcGlobal, //global to data center
|
||||
DcGlobal, // global to data center
|
||||
HostLocal;
|
||||
|
||||
public static String DummyPrivateIp = "169.254.1.1";
|
||||
@ -73,7 +73,7 @@ public class Networks {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return scheme to be used in broadcast uri. Null indicates that this type does not have broadcast tags.
|
||||
* @return scheme to be used in broadcast uri. Null indicates that this type does not have broadcast tags.
|
||||
*/
|
||||
public String scheme() {
|
||||
return scheme;
|
||||
@ -99,7 +99,7 @@ public class Networks {
|
||||
* Different types of network traffic in the data center.
|
||||
*/
|
||||
public enum TrafficType {
|
||||
None,
|
||||
None,
|
||||
Public,
|
||||
Guest,
|
||||
Storage,
|
||||
@ -108,30 +108,30 @@ public class Networks {
|
||||
Vpn;
|
||||
|
||||
public static boolean isSystemNetwork(TrafficType trafficType) {
|
||||
if(Storage.equals(trafficType)
|
||||
if (Storage.equals(trafficType)
|
||||
|| Management.equals(trafficType)
|
||||
|| Control.equals(trafficType)){
|
||||
|| Control.equals(trafficType)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static TrafficType getTrafficType(String type) {
|
||||
if ("Public".equals(type)) {
|
||||
return Public;
|
||||
} else if ("Guest".equals(type)) {
|
||||
return Guest;
|
||||
} else if ("Storage".equals(type)) {
|
||||
return Storage;
|
||||
} else if ("Management".equals(type)) {
|
||||
return Management;
|
||||
} else if ("Control".equals(type)) {
|
||||
return Control;
|
||||
} else if ("Vpn".equals(type)) {
|
||||
return Vpn;
|
||||
} else {
|
||||
return None;
|
||||
}
|
||||
if ("Public".equals(type)) {
|
||||
return Public;
|
||||
} else if ("Guest".equals(type)) {
|
||||
return Guest;
|
||||
} else if ("Storage".equals(type)) {
|
||||
return Storage;
|
||||
} else if ("Management".equals(type)) {
|
||||
return Management;
|
||||
} else if ("Control".equals(type)) {
|
||||
return Control;
|
||||
} else if ("Vpn".equals(type)) {
|
||||
return Vpn;
|
||||
} else {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -161,7 +161,8 @@ public class Networks {
|
||||
|
||||
public <T> URI toUri(T value) {
|
||||
try {
|
||||
//assert(this!=Vlan || value.getClass().isAssignableFrom(Integer.class)) : "Why are you putting non integer into vlan url";
|
||||
// assert(this!=Vlan || value.getClass().isAssignableFrom(Integer.class)) :
|
||||
// "Why are you putting non integer into vlan url";
|
||||
return new URI(scheme + "://" + value.toString());
|
||||
} catch (URISyntaxException e) {
|
||||
throw new CloudRuntimeException("Unable to convert to isolation type URI: " + value);
|
||||
|
||||
@ -49,7 +49,7 @@ public interface PhysicalNetwork {
|
||||
|
||||
BroadcastDomainRange getBroadcastDomainRange();
|
||||
|
||||
//TrafficType getTrafficType();
|
||||
// TrafficType getTrafficType();
|
||||
|
||||
long getDataCenterId();
|
||||
|
||||
@ -67,6 +67,6 @@ public interface PhysicalNetwork {
|
||||
|
||||
String getUuid();
|
||||
|
||||
String getName();
|
||||
String getName();
|
||||
|
||||
}
|
||||
|
||||
@ -25,8 +25,6 @@ import java.util.List;
|
||||
|
||||
import com.cloud.network.Network.Service;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This defines the specifics of a physical network service provider
|
||||
*
|
||||
|
||||
@ -17,23 +17,22 @@
|
||||
*/
|
||||
package com.cloud.network;
|
||||
|
||||
|
||||
/**
|
||||
* PhysicalNetworkNames provides the labels to identify per traffic type
|
||||
* the physical networks available to the host .
|
||||
* PhysicalNetworkNames provides the labels to identify per traffic type
|
||||
* the physical networks available to the host .
|
||||
*/
|
||||
public class PhysicalNetworkSetupInfo {
|
||||
|
||||
//physical network ID as seen by Mgmt server
|
||||
// physical network ID as seen by Mgmt server
|
||||
Long physicalNetworkId;
|
||||
String privateNetworkName;
|
||||
String publicNetworkName;
|
||||
String guestNetworkName;
|
||||
String storageNetworkName;
|
||||
//this is used by VmWare to identify the vlan to use for management traffic
|
||||
// this is used by VmWare to identify the vlan to use for management traffic
|
||||
String mgmtVlan;
|
||||
|
||||
public PhysicalNetworkSetupInfo(){
|
||||
public PhysicalNetworkSetupInfo() {
|
||||
}
|
||||
|
||||
public String getPrivateNetworkName() {
|
||||
@ -84,5 +83,4 @@ public class PhysicalNetworkSetupInfo {
|
||||
this.mgmtVlan = mgmtVlan;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -23,8 +23,6 @@ package com.cloud.network;
|
||||
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This defines the specifics of a physical network traffic type
|
||||
*
|
||||
|
||||
@ -10,11 +10,11 @@ import com.cloud.api.commands.listStorageNetworkIpRangeCmd;
|
||||
import com.cloud.dc.StorageNetworkIpRange;
|
||||
|
||||
public interface StorageNetworkService {
|
||||
StorageNetworkIpRange createIpRange(CreateStorageNetworkIpRangeCmd cmd) throws SQLException;
|
||||
StorageNetworkIpRange createIpRange(CreateStorageNetworkIpRangeCmd cmd) throws SQLException;
|
||||
|
||||
void deleteIpRange(DeleteStorageNetworkIpRangeCmd cmd);
|
||||
void deleteIpRange(DeleteStorageNetworkIpRangeCmd cmd);
|
||||
|
||||
List<StorageNetworkIpRange> listIpRange(listStorageNetworkIpRangeCmd cmd);
|
||||
List<StorageNetworkIpRange> listIpRange(listStorageNetworkIpRangeCmd cmd);
|
||||
|
||||
StorageNetworkIpRange updateIpRange(UpdateStorageNetworkIpRangeCmd cmd);
|
||||
StorageNetworkIpRange updateIpRange(UpdateStorageNetworkIpRangeCmd cmd);
|
||||
}
|
||||
|
||||
@ -22,19 +22,22 @@ import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.router.VirtualRouter;
|
||||
import com.cloud.utils.component.PluggableService;
|
||||
|
||||
public interface VirtualNetworkApplianceService {
|
||||
/**
|
||||
* Starts domain router
|
||||
* @param cmd the command specifying router's id
|
||||
*
|
||||
* @param cmd
|
||||
* the command specifying router's id
|
||||
* @return DomainRouter object
|
||||
*/
|
||||
VirtualRouter startRouter(long routerId, boolean reprogramNetwork) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
|
||||
|
||||
/**
|
||||
* Reboots domain router
|
||||
* @param cmd the command specifying router's id
|
||||
*
|
||||
* @param cmd
|
||||
* the command specifying router's id
|
||||
* @return router if successful
|
||||
*/
|
||||
VirtualRouter rebootRouter(long routerId, boolean reprogramNetwork) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
|
||||
@ -43,8 +46,11 @@ public interface VirtualNetworkApplianceService {
|
||||
|
||||
/**
|
||||
* Stops domain router
|
||||
* @param id of the router
|
||||
* @param forced just do it. caller knows best.
|
||||
*
|
||||
* @param id
|
||||
* of the router
|
||||
* @param forced
|
||||
* just do it. caller knows best.
|
||||
* @return router if successful, null otherwise
|
||||
* @throws ResourceUnavailableException
|
||||
* @throws ConcurrentOperationException
|
||||
|
||||
@ -23,8 +23,12 @@ public interface VirtualRouterProvider {
|
||||
VirtualRouter,
|
||||
ElasticLoadBalancerVm
|
||||
}
|
||||
|
||||
public VirtualRouterProviderType getType();
|
||||
|
||||
public long getId();
|
||||
|
||||
public boolean isEnabled();
|
||||
|
||||
public long getNspId();
|
||||
}
|
||||
|
||||
@ -10,11 +10,14 @@ import com.cloud.user.Account;
|
||||
|
||||
public interface FirewallService {
|
||||
FirewallRule createFirewallRule(FirewallRule rule) throws NetworkRuleConflictException;
|
||||
|
||||
List<? extends FirewallRule> listFirewallRules(ListFirewallRulesCmd cmd);
|
||||
|
||||
/**
|
||||
* Revokes a firewall rule
|
||||
* @param ruleId the id of the rule to revoke.
|
||||
*
|
||||
* @param ruleId
|
||||
* the id of the rule to revoke.
|
||||
* @return
|
||||
*/
|
||||
boolean revokeFirewallRule(long ruleId, boolean apply);
|
||||
@ -24,4 +27,5 @@ public interface FirewallService {
|
||||
FirewallRule getFirewallRule(long ruleId);
|
||||
|
||||
boolean revokeRelatedFirewallRule(long ruleId, boolean apply);
|
||||
|
||||
}
|
||||
|
||||
@ -18,28 +18,28 @@
|
||||
package com.cloud.network.lb;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.api.commands.CreateLBStickinessPolicyCmd;
|
||||
import com.cloud.api.commands.CreateLoadBalancerRuleCmd;
|
||||
import com.cloud.api.commands.ListLBStickinessPoliciesCmd;
|
||||
|
||||
import com.cloud.api.commands.ListLoadBalancerRuleInstancesCmd;
|
||||
import com.cloud.api.commands.ListLoadBalancerRulesCmd;
|
||||
import com.cloud.api.commands.UpdateLoadBalancerRuleCmd;
|
||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.rules.StickinessPolicy;
|
||||
import com.cloud.network.rules.LoadBalancer;
|
||||
|
||||
|
||||
import com.cloud.network.rules.StickinessPolicy;
|
||||
import com.cloud.uservm.UserVm;
|
||||
|
||||
|
||||
public interface LoadBalancingRulesService {
|
||||
/**
|
||||
* Create a load balancer rule from the given ipAddress/port to the given private port
|
||||
* @param openFirewall TODO
|
||||
* @param cmd the command specifying the ip address, public port, protocol, private port, and algorithm
|
||||
*
|
||||
* @param openFirewall
|
||||
* TODO
|
||||
* @param cmd
|
||||
* the command specifying the ip address, public port, protocol, private port, and algorithm
|
||||
* @return the newly created LoadBalancerVO if successful, null otherwise
|
||||
* @throws InsufficientAddressCapacityException
|
||||
*/
|
||||
@ -48,9 +48,14 @@ public interface LoadBalancingRulesService {
|
||||
LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd);
|
||||
|
||||
boolean deleteLoadBalancerRule(long lbRuleId, boolean apply);
|
||||
|
||||
/**
|
||||
* Create a stickiness policy to a load balancer from the given stickiness method name and parameters in (name,value) pairs.
|
||||
* @param cmd the command specifying the stickiness method name, params (name,value pairs), policy name and description.
|
||||
* Create a stickiness policy to a load balancer from the given stickiness method name and parameters in
|
||||
* (name,value) pairs.
|
||||
*
|
||||
* @param cmd
|
||||
* the command specifying the stickiness method name, params (name,value pairs), policy name and
|
||||
* description.
|
||||
* @return the newly created stickiness policy if successfull, null otherwise
|
||||
* @thows NetworkRuleConflictException
|
||||
*/
|
||||
@ -59,6 +64,7 @@ public interface LoadBalancingRulesService {
|
||||
public boolean applyLBStickinessPolicy(CreateLBStickinessPolicyCmd cmd) throws ResourceUnavailableException;
|
||||
|
||||
boolean deleteLBStickinessPolicy(long stickinessPolicyId);
|
||||
|
||||
/**
|
||||
* Assign a virtual machine, or list of virtual machines, to a load balancer.
|
||||
*/
|
||||
@ -67,8 +73,11 @@ public interface LoadBalancingRulesService {
|
||||
boolean removeFromLoadBalancer(long lbRuleId, List<Long> vmIds);
|
||||
|
||||
boolean applyLoadBalancerConfig(long lbRuleId) throws ResourceUnavailableException;
|
||||
|
||||
/**
|
||||
* List instances that have either been applied to a load balancer or are eligible to be assigned to a load balancer.
|
||||
* List instances that have either been applied to a load balancer or are eligible to be assigned to a load
|
||||
* balancer.
|
||||
*
|
||||
* @param cmd
|
||||
* @return list of vm instances that have been or can be applied to a load balancer
|
||||
*/
|
||||
@ -76,19 +85,24 @@ public interface LoadBalancingRulesService {
|
||||
|
||||
/**
|
||||
* List load balancer rules based on the given criteria
|
||||
* @param cmd the command that specifies the criteria to use for listing load balancers. Load balancers can be listed
|
||||
*
|
||||
* @param cmd
|
||||
* the command that specifies the criteria to use for listing load balancers. Load balancers can be
|
||||
* listed
|
||||
* by id, name, public ip, and vm instance id
|
||||
* @return list of load balancers that match the criteria
|
||||
*/
|
||||
List<? extends LoadBalancer> searchForLoadBalancers(ListLoadBalancerRulesCmd cmd);
|
||||
|
||||
/**
|
||||
* List stickiness policies based on the given criteria
|
||||
* @param cmd the command specifies the load balancing rule id.
|
||||
*
|
||||
* @param cmd
|
||||
* the command specifies the load balancing rule id.
|
||||
* @return list of stickiness policies that match the criteria.
|
||||
*/
|
||||
List<? extends StickinessPolicy> searchForLBStickinessPolicies(ListLBStickinessPoliciesCmd cmd);
|
||||
|
||||
|
||||
List<LoadBalancingRule> listByNetworkId(long networkId);
|
||||
|
||||
LoadBalancer findById(long LoadBalancer);
|
||||
|
||||
@ -22,62 +22,62 @@ import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.Command;
|
||||
|
||||
public class OvsCreateGreTunnelAnswer extends Answer {
|
||||
String hostIp;
|
||||
String remoteIp;
|
||||
String bridge;
|
||||
String key;
|
||||
long from;
|
||||
long to;
|
||||
int port;
|
||||
String hostIp;
|
||||
String remoteIp;
|
||||
String bridge;
|
||||
String key;
|
||||
long from;
|
||||
long to;
|
||||
int port;
|
||||
|
||||
public OvsCreateGreTunnelAnswer(Command cmd, boolean success, String details) {
|
||||
super(cmd, success, details);
|
||||
}
|
||||
public OvsCreateGreTunnelAnswer(Command cmd, boolean success, String details) {
|
||||
super(cmd, success, details);
|
||||
}
|
||||
|
||||
public OvsCreateGreTunnelAnswer(Command cmd, boolean success,
|
||||
String details, String hostIp, String bridge) {
|
||||
super(cmd, success, details);
|
||||
OvsCreateGreTunnelCommand c = (OvsCreateGreTunnelCommand)cmd;
|
||||
this.hostIp = hostIp;
|
||||
this.bridge = bridge;
|
||||
this.remoteIp = c.getRemoteIp();
|
||||
this.key = c.getKey();
|
||||
this.port = -1;
|
||||
this.from = c.getFrom();
|
||||
this.to = c.getTo();
|
||||
}
|
||||
public OvsCreateGreTunnelAnswer(Command cmd, boolean success,
|
||||
String details, String hostIp, String bridge) {
|
||||
super(cmd, success, details);
|
||||
OvsCreateGreTunnelCommand c = (OvsCreateGreTunnelCommand) cmd;
|
||||
this.hostIp = hostIp;
|
||||
this.bridge = bridge;
|
||||
this.remoteIp = c.getRemoteIp();
|
||||
this.key = c.getKey();
|
||||
this.port = -1;
|
||||
this.from = c.getFrom();
|
||||
this.to = c.getTo();
|
||||
}
|
||||
|
||||
public OvsCreateGreTunnelAnswer(Command cmd, boolean success,
|
||||
String details, String hostIp, String bridge, int port) {
|
||||
this(cmd, success, details, hostIp, bridge);
|
||||
this.port = port;
|
||||
}
|
||||
public OvsCreateGreTunnelAnswer(Command cmd, boolean success,
|
||||
String details, String hostIp, String bridge, int port) {
|
||||
this(cmd, success, details, hostIp, bridge);
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public String getHostIp() {
|
||||
return hostIp;
|
||||
}
|
||||
public String getHostIp() {
|
||||
return hostIp;
|
||||
}
|
||||
|
||||
public String getRemoteIp() {
|
||||
return remoteIp;
|
||||
}
|
||||
public String getRemoteIp() {
|
||||
return remoteIp;
|
||||
}
|
||||
|
||||
public String getBridge() {
|
||||
return bridge;
|
||||
}
|
||||
public String getBridge() {
|
||||
return bridge;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public long getFrom() {
|
||||
return from;
|
||||
}
|
||||
public long getFrom() {
|
||||
return from;
|
||||
}
|
||||
|
||||
public long getTo() {
|
||||
return to;
|
||||
}
|
||||
public long getTo() {
|
||||
return to;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,36 +21,36 @@ package com.cloud.network.ovs;
|
||||
import com.cloud.agent.api.Command;
|
||||
|
||||
public class OvsCreateGreTunnelCommand extends Command {
|
||||
String remoteIp;
|
||||
String key;
|
||||
long from;
|
||||
long to;
|
||||
String remoteIp;
|
||||
String key;
|
||||
long from;
|
||||
long to;
|
||||
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public OvsCreateGreTunnelCommand(String remoteIp, String key, long from, long to) {
|
||||
this.remoteIp = remoteIp;
|
||||
this.key = key;
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
}
|
||||
public OvsCreateGreTunnelCommand(String remoteIp, String key, long from, long to) {
|
||||
this.remoteIp = remoteIp;
|
||||
this.key = key;
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
}
|
||||
|
||||
public String getRemoteIp() {
|
||||
return remoteIp;
|
||||
}
|
||||
public String getRemoteIp() {
|
||||
return remoteIp;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public long getFrom() {
|
||||
return from;
|
||||
}
|
||||
public long getFrom() {
|
||||
return from;
|
||||
}
|
||||
|
||||
public long getTo() {
|
||||
return to;
|
||||
}
|
||||
public long getTo() {
|
||||
return to;
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,51 +21,51 @@ package com.cloud.network.ovs;
|
||||
import com.cloud.agent.api.Command;
|
||||
|
||||
public class OvsCreateTunnelCommand extends Command {
|
||||
String key;
|
||||
String remoteIp;
|
||||
Long from;
|
||||
Long to;
|
||||
long account;
|
||||
String key;
|
||||
String remoteIp;
|
||||
Long from;
|
||||
Long to;
|
||||
long account;
|
||||
|
||||
//for debug info
|
||||
String fromIp;
|
||||
// for debug info
|
||||
String fromIp;
|
||||
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public OvsCreateTunnelCommand(String remoteIp, String key, Long from, Long to, long account, String fromIp) {
|
||||
this.remoteIp = remoteIp;
|
||||
this.key = key;
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
this.account = account;
|
||||
this.fromIp = fromIp;
|
||||
}
|
||||
public OvsCreateTunnelCommand(String remoteIp, String key, Long from, Long to, long account, String fromIp) {
|
||||
this.remoteIp = remoteIp;
|
||||
this.key = key;
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
this.account = account;
|
||||
this.fromIp = fromIp;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public String getRemoteIp() {
|
||||
return remoteIp;
|
||||
}
|
||||
public String getRemoteIp() {
|
||||
return remoteIp;
|
||||
}
|
||||
|
||||
public Long getFrom() {
|
||||
return from;
|
||||
}
|
||||
public Long getFrom() {
|
||||
return from;
|
||||
}
|
||||
|
||||
public Long getTo() {
|
||||
return to;
|
||||
}
|
||||
public Long getTo() {
|
||||
return to;
|
||||
}
|
||||
|
||||
public long getAccount() {
|
||||
return account;
|
||||
}
|
||||
public long getAccount() {
|
||||
return account;
|
||||
}
|
||||
|
||||
public String getFromIp() {
|
||||
return fromIp;
|
||||
}
|
||||
public String getFromIp() {
|
||||
return fromIp;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -21,18 +21,18 @@ package com.cloud.network.ovs;
|
||||
import com.cloud.agent.api.Command;
|
||||
|
||||
public class OvsDeleteFlowCommand extends Command {
|
||||
String vmName;
|
||||
String vmName;
|
||||
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getVmName() {
|
||||
return vmName;
|
||||
}
|
||||
public String getVmName() {
|
||||
return vmName;
|
||||
}
|
||||
|
||||
public OvsDeleteFlowCommand(String vmName) {
|
||||
this.vmName = vmName;
|
||||
}
|
||||
public OvsDeleteFlowCommand(String vmName) {
|
||||
this.vmName = vmName;
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,21 +22,21 @@ import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.Command;
|
||||
|
||||
public class OvsSetTagAndFlowAnswer extends Answer {
|
||||
Long vmId;
|
||||
Long seqno;
|
||||
Long vmId;
|
||||
Long seqno;
|
||||
|
||||
public OvsSetTagAndFlowAnswer(Command cmd, boolean success, String details) {
|
||||
super(cmd, success, details);
|
||||
OvsSetTagAndFlowCommand c = (OvsSetTagAndFlowCommand)cmd;
|
||||
this.vmId = c.getVmId();
|
||||
this.seqno = Long.parseLong(c.getSeqNo());
|
||||
}
|
||||
public OvsSetTagAndFlowAnswer(Command cmd, boolean success, String details) {
|
||||
super(cmd, success, details);
|
||||
OvsSetTagAndFlowCommand c = (OvsSetTagAndFlowCommand) cmd;
|
||||
this.vmId = c.getVmId();
|
||||
this.seqno = Long.parseLong(c.getSeqNo());
|
||||
}
|
||||
|
||||
public Long getVmId() {
|
||||
return vmId;
|
||||
}
|
||||
public Long getVmId() {
|
||||
return vmId;
|
||||
}
|
||||
|
||||
public Long getSeqNo() {
|
||||
return seqno;
|
||||
}
|
||||
public Long getSeqNo() {
|
||||
return seqno;
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,42 +21,42 @@ package com.cloud.network.ovs;
|
||||
import com.cloud.agent.api.Command;
|
||||
|
||||
public class OvsSetTagAndFlowCommand extends Command {
|
||||
String vlans;
|
||||
String vmName;
|
||||
String seqno;
|
||||
String tag;
|
||||
Long vmId;
|
||||
String vlans;
|
||||
String vmName;
|
||||
String seqno;
|
||||
String tag;
|
||||
Long vmId;
|
||||
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getSeqNo() {
|
||||
return seqno;
|
||||
}
|
||||
public String getSeqNo() {
|
||||
return seqno;
|
||||
}
|
||||
|
||||
public String getVlans() {
|
||||
return vlans;
|
||||
}
|
||||
public String getVlans() {
|
||||
return vlans;
|
||||
}
|
||||
|
||||
public String getVmName() {
|
||||
return vmName;
|
||||
}
|
||||
public String getVmName() {
|
||||
return vmName;
|
||||
}
|
||||
|
||||
public Long getVmId() {
|
||||
return vmId;
|
||||
}
|
||||
public Long getVmId() {
|
||||
return vmId;
|
||||
}
|
||||
|
||||
public String getTag() {
|
||||
return tag;
|
||||
}
|
||||
public String getTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
public OvsSetTagAndFlowCommand(String vmName, String tag, String vlans, String seqno, Long vmId) {
|
||||
this.vmName = vmName;
|
||||
this.tag = tag;
|
||||
this.vlans = vlans;
|
||||
this.seqno = seqno;
|
||||
this.vmId = vmId;
|
||||
}
|
||||
public OvsSetTagAndFlowCommand(String vmName, String tag, String vlans, String seqno, Long vmId) {
|
||||
this.vmName = vmName;
|
||||
this.tag = tag;
|
||||
this.vlans = vlans;
|
||||
this.seqno = seqno;
|
||||
this.vmId = vmId;
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,29 +26,39 @@ import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
public interface RulesService {
|
||||
List<? extends FirewallRule> searchStaticNatRules(Long ipId, Long id, Long vmId, Long start, Long size, String accountName, Long domainId, Long projectId, boolean isRecursive, boolean listAll);
|
||||
List<? extends FirewallRule> searchStaticNatRules(Long ipId, Long id, Long vmId, Long start, Long size, String accountName, Long domainId, Long projectId, boolean isRecursive, boolean listAll);
|
||||
|
||||
/**
|
||||
* Creates a port forwarding rule between two ip addresses or between
|
||||
* an ip address and a virtual machine.
|
||||
* @param rule rule to be created.
|
||||
* @param vmId vm to be linked to. If specified the destination ip address is ignored.
|
||||
* @param openFirewall TODO
|
||||
*
|
||||
* @param rule
|
||||
* rule to be created.
|
||||
* @param vmId
|
||||
* vm to be linked to. If specified the destination ip address is ignored.
|
||||
* @param openFirewall
|
||||
* TODO
|
||||
* @return PortForwardingRule if created.
|
||||
* @throws NetworkRuleConflictException if conflicts in the network rules are detected.
|
||||
* @throws NetworkRuleConflictException
|
||||
* if conflicts in the network rules are detected.
|
||||
*/
|
||||
PortForwardingRule createPortForwardingRule(PortForwardingRule rule, Long vmId, boolean openFirewall) throws NetworkRuleConflictException;
|
||||
|
||||
/**
|
||||
* Revokes a port forwarding rule
|
||||
* @param ruleId the id of the rule to revoke.
|
||||
*
|
||||
* @param ruleId
|
||||
* the id of the rule to revoke.
|
||||
* @param caller
|
||||
* @return
|
||||
*/
|
||||
boolean revokePortForwardingRule(long ruleId, boolean apply);
|
||||
|
||||
/**
|
||||
* List port forwarding rules assigned to an ip address
|
||||
* @param cmd the command object holding the criteria for listing port forwarding rules (the ipAddress)
|
||||
*
|
||||
* @param cmd
|
||||
* the command object holding the criteria for listing port forwarding rules (the ipAddress)
|
||||
* @return list of port forwarding rules on the given address, empty list if no rules exist
|
||||
*/
|
||||
public List<? extends PortForwardingRule> listPortForwardingRules(ListPortForwardingRulesCmd cmd);
|
||||
@ -58,6 +68,7 @@ public interface RulesService {
|
||||
boolean enableStaticNat(long ipAddressId, long vmId) throws NetworkRuleConflictException, ResourceUnavailableException;
|
||||
|
||||
PortForwardingRule getPortForwardigRule(long ruleId);
|
||||
|
||||
FirewallRule getFirewallRule(long ruleId);
|
||||
|
||||
StaticNatRule createStaticNatRule(StaticNatRule rule, boolean openFirewall) throws NetworkRuleConflictException;
|
||||
@ -70,6 +81,6 @@ public interface RulesService {
|
||||
|
||||
List<String> getSourceCidrs(long ruleId);
|
||||
|
||||
boolean disableStaticNat(long ipId) throws ResourceUnavailableException, NetworkRuleConflictException, InsufficientAddressCapacityException;
|
||||
boolean disableStaticNat(long ipId) throws ResourceUnavailableException, NetworkRuleConflictException, InsufficientAddressCapacityException;
|
||||
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ package com.cloud.network.rules;
|
||||
|
||||
import com.cloud.acl.ControlledEntity;
|
||||
|
||||
public interface StaticNatRule extends ControlledEntity, FirewallRule{
|
||||
public interface StaticNatRule extends ControlledEntity, FirewallRule {
|
||||
|
||||
long getId();
|
||||
|
||||
|
||||
@ -21,7 +21,6 @@ import java.util.List;
|
||||
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
|
||||
/**
|
||||
* Definition for a StickinessPolicy
|
||||
*/
|
||||
|
||||
@ -19,7 +19,6 @@ package com.cloud.offering;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a disk offering that specifies what the end user needs in
|
||||
* the disk offering.
|
||||
|
||||
@ -44,7 +44,7 @@ public interface NetworkOffering {
|
||||
public final static String DefaultSharedNetworkOfferingWithSGService = "DefaultSharedNetworkOfferingWithSGService";
|
||||
public final static String DefaultIsolatedNetworkOfferingWithSourceNatService = "DefaultIsolatedNetworkOfferingWithSourceNatService";
|
||||
public final static String DefaultSharedNetworkOffering = "DefaultSharedNetworkOffering";
|
||||
public final static String DefaultIsolatedNetworkOffering= "DefaultIsolatedNetworkOffering";
|
||||
public final static String DefaultIsolatedNetworkOffering = "DefaultIsolatedNetworkOffering";
|
||||
public final static String DefaultSharedEIPandELBNetworkOffering = "DefaultSharedNetscalerEIPandELBNetworkOffering";
|
||||
|
||||
long getId();
|
||||
@ -99,9 +99,10 @@ public interface NetworkOffering {
|
||||
|
||||
boolean isConserveMode();
|
||||
|
||||
boolean getElasticIp();
|
||||
boolean getElasticIp();
|
||||
|
||||
boolean getElasticLb();
|
||||
boolean getElasticLb();
|
||||
|
||||
boolean getSpecifyIpRanges();
|
||||
|
||||
boolean getSpecifyIpRanges();
|
||||
}
|
||||
|
||||
@ -18,31 +18,34 @@
|
||||
package com.cloud.offering;
|
||||
|
||||
/**
|
||||
* An offering is a package of features offered to the end user. OfferingManager
|
||||
* An offering is a package of features offered to the end user. OfferingManager
|
||||
* is responsible for the life cycle of the offerings available from CloudStack.
|
||||
* An administrator can create, delete, enable, and disable offerings.
|
||||
*
|
||||
* There are three types of offerings:
|
||||
* - Service Offering - package of computing power and the root disk.
|
||||
* - Disk Offering - package of disk performance and size specification.
|
||||
* - Network Offering - package of services available on a network.
|
||||
* - Service Offering - package of computing power and the root disk.
|
||||
* - Disk Offering - package of disk performance and size specification.
|
||||
* - Network Offering - package of services available on a network.
|
||||
*
|
||||
*/
|
||||
public interface OfferingManager {
|
||||
/**
|
||||
* Creates a service offering.
|
||||
*
|
||||
* @return ServiceOffering
|
||||
*/
|
||||
ServiceOffering createServiceOffering();
|
||||
|
||||
/**
|
||||
* Creates a disk offering.
|
||||
*
|
||||
* @return DiskOffering
|
||||
*/
|
||||
DiskOffering createDiskOffering();
|
||||
|
||||
/**
|
||||
* Creates a network offering.
|
||||
*
|
||||
* @return NetworkOffering
|
||||
*/
|
||||
NetworkOffering createNetworkOffering();
|
||||
|
||||
@ -37,12 +37,11 @@ public interface ServiceOffering {
|
||||
|
||||
String getTags();
|
||||
|
||||
/**
|
||||
/**
|
||||
* @return user readable description
|
||||
*/
|
||||
String getName();
|
||||
|
||||
|
||||
/**
|
||||
* @return is this a system service offering
|
||||
*/
|
||||
|
||||
@ -26,18 +26,23 @@ import com.cloud.org.Managed.ManagedState;
|
||||
|
||||
public interface Cluster extends Grouping {
|
||||
public static enum ClusterType {
|
||||
CloudManaged,
|
||||
ExternalManaged;
|
||||
CloudManaged,
|
||||
ExternalManaged;
|
||||
};
|
||||
|
||||
long getId();
|
||||
|
||||
String getName();
|
||||
|
||||
long getDataCenterId();
|
||||
|
||||
long getPodId();
|
||||
|
||||
HypervisorType getHypervisorType();
|
||||
|
||||
ClusterType getClusterType();
|
||||
|
||||
AllocationState getAllocationState();
|
||||
|
||||
ManagedState getManagedState();
|
||||
}
|
||||
|
||||
@ -23,8 +23,13 @@ import com.cloud.api.Identity;
|
||||
import com.cloud.domain.PartOf;
|
||||
|
||||
public interface Project extends PartOf, Identity {
|
||||
public enum State {Active, Disabled, Suspended}
|
||||
public enum ListProjectResourcesCriteria {ListProjectResourcesOnly, SkipProjectResources}
|
||||
public enum State {
|
||||
Active, Disabled, Suspended
|
||||
}
|
||||
|
||||
public enum ListProjectResourcesCriteria {
|
||||
ListProjectResourcesOnly, SkipProjectResources
|
||||
}
|
||||
|
||||
String getDisplayText();
|
||||
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
package com.cloud.projects;
|
||||
|
||||
|
||||
public interface ProjectAccount {
|
||||
public enum Role {Admin, Regular};
|
||||
public enum Role {
|
||||
Admin, Regular
|
||||
};
|
||||
|
||||
long getAccountId();
|
||||
|
||||
|
||||
@ -4,8 +4,10 @@ import java.util.Date;
|
||||
|
||||
import com.cloud.acl.ControlledEntity;
|
||||
|
||||
public interface ProjectInvitation extends ControlledEntity{
|
||||
public enum State {Pending, Completed, Expired, Declined}
|
||||
public interface ProjectInvitation extends ControlledEntity {
|
||||
public enum State {
|
||||
Pending, Completed, Expired, Declined
|
||||
}
|
||||
|
||||
long getId();
|
||||
|
||||
|
||||
@ -8,15 +8,18 @@ import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.projects.ProjectAccount.Role;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
|
||||
public interface ProjectService {
|
||||
/**
|
||||
* Creates a new project
|
||||
*
|
||||
* @param name - project name
|
||||
* @param displayText - project display text
|
||||
* @param accountName - account name of the project owner
|
||||
* @param domainId - domainid of the project owner
|
||||
* @param name
|
||||
* - project name
|
||||
* @param displayText
|
||||
* - project display text
|
||||
* @param accountName
|
||||
* - account name of the project owner
|
||||
* @param domainId
|
||||
* - domainid of the project owner
|
||||
* @return the project if created successfully, null otherwise
|
||||
* @throws ResourceAllocationException
|
||||
*/
|
||||
@ -25,7 +28,8 @@ public interface ProjectService {
|
||||
/**
|
||||
* Deletes a project
|
||||
*
|
||||
* @param id - project id
|
||||
* @param id
|
||||
* - project id
|
||||
* @return true if the project was deleted successfully, false otherwise
|
||||
*/
|
||||
boolean deleteProject(long id);
|
||||
@ -33,7 +37,8 @@ public interface ProjectService {
|
||||
/**
|
||||
* Gets a project by id
|
||||
*
|
||||
* @param id - project id
|
||||
* @param id
|
||||
* - project id
|
||||
* @return project object
|
||||
*/
|
||||
Project getProject(long id);
|
||||
@ -58,7 +63,8 @@ public interface ProjectService {
|
||||
|
||||
List<? extends ProjectAccount> listProjectAccounts(long projectId, String accountName, String role, Long startIndex, Long pageSizeVal);
|
||||
|
||||
List<? extends ProjectInvitation> listProjectInvitations(Long id, Long projectId, String accountName, Long domainId, String state, boolean activeOnly, Long startIndex, Long pageSizeVal, boolean isRecursive, boolean listAll);
|
||||
List<? extends ProjectInvitation> listProjectInvitations(Long id, Long projectId, String accountName, Long domainId, String state, boolean activeOnly, Long startIndex, Long pageSizeVal, boolean isRecursive,
|
||||
boolean listAll);
|
||||
|
||||
boolean updateInvitation(long projectId, String accountName, String token, boolean accept);
|
||||
|
||||
|
||||
@ -3,11 +3,10 @@ package com.cloud.resource;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.fsm.StateMachine;
|
||||
|
||||
public enum ResourceState {
|
||||
Creating,
|
||||
Creating,
|
||||
Enabled,
|
||||
Disabled,
|
||||
PrepareForMaintenance,
|
||||
@ -34,6 +33,7 @@ public enum ResourceState {
|
||||
Unmanaged("Umanage a cluster");
|
||||
|
||||
private final String comment;
|
||||
|
||||
private Event(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
@ -43,13 +43,13 @@ public enum ResourceState {
|
||||
}
|
||||
|
||||
public static Event toEvent(String e) {
|
||||
if (Enable.toString().equals(e)) {
|
||||
return Enable;
|
||||
} else if (Disable.toString().equals(e)) {
|
||||
return Disable;
|
||||
}
|
||||
if (Enable.toString().equals(e)) {
|
||||
return Enable;
|
||||
} else if (Disable.toString().equals(e)) {
|
||||
return Disable;
|
||||
}
|
||||
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ public enum ResourceState {
|
||||
|
||||
public static String[] toString(ResourceState... states) {
|
||||
String[] strs = new String[states.length];
|
||||
for (int i=0; i<states.length; i++) {
|
||||
for (int i = 0; i < states.length; i++) {
|
||||
strs[i] = states[i].toString();
|
||||
}
|
||||
return strs;
|
||||
|
||||
@ -23,11 +23,14 @@ import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Param {
|
||||
String name() default "";
|
||||
String propName() default "";
|
||||
String description() default "";
|
||||
String name() default "";
|
||||
|
||||
// 2 parameters below are used by cloudstack api
|
||||
Class<?> responseObject() default Object.class;
|
||||
boolean includeInApiDoc() default true;
|
||||
String propName() default "";
|
||||
|
||||
String description() default "";
|
||||
|
||||
// 2 parameters below are used by cloudstack api
|
||||
Class<?> responseObject() default Object.class;
|
||||
|
||||
boolean includeInApiDoc() default true;
|
||||
}
|
||||
|
||||
@ -100,7 +100,8 @@ public interface ManagementService {
|
||||
static final String Name = "management-server";
|
||||
|
||||
/**
|
||||
* Retrieves the list of data centers with search criteria. Currently the only search criteria is "available" zones for the
|
||||
* Retrieves the list of data centers with search criteria. Currently the only search criteria is "available" zones
|
||||
* for the
|
||||
* account that invokes the API. By specifying available=true all zones which the account can access. By specifying
|
||||
* available=false the zones where the account has virtual machine instances will be returned.
|
||||
*
|
||||
@ -140,7 +141,8 @@ public interface ManagementService {
|
||||
List<? extends Pod> searchForPods(ListPodsByCmd cmd);
|
||||
|
||||
/**
|
||||
* Searches for servers by the specified search criteria Can search by: "name", "type", "state", "dataCenterId", "podId"
|
||||
* Searches for servers by the specified search criteria Can search by: "name", "type", "state", "dataCenterId",
|
||||
* "podId"
|
||||
*
|
||||
* @param cmd
|
||||
* @return List of Hosts
|
||||
@ -158,7 +160,8 @@ public interface ManagementService {
|
||||
VirtualMachineTemplate updateTemplate(UpdateTemplateCmd cmd);
|
||||
|
||||
/**
|
||||
* Obtains a list of events by the specified search criteria. Can search by: "username", "type", "level", "startDate",
|
||||
* Obtains a list of events by the specified search criteria. Can search by: "username", "type", "level",
|
||||
* "startDate",
|
||||
* "endDate"
|
||||
*
|
||||
* @param c
|
||||
@ -167,7 +170,8 @@ public interface ManagementService {
|
||||
List<? extends Event> searchForEvents(ListEventsCmd c);
|
||||
|
||||
/**
|
||||
* Obtains a list of routers by the specified search criteria. Can search by: "userId", "name", "state", "dataCenterId",
|
||||
* Obtains a list of routers by the specified search criteria. Can search by: "userId", "name", "state",
|
||||
* "dataCenterId",
|
||||
* "podId", "hostId"
|
||||
*
|
||||
* @param cmd
|
||||
@ -175,9 +179,9 @@ public interface ManagementService {
|
||||
*/
|
||||
List<? extends VirtualRouter> searchForRouters(ListRoutersCmd cmd);
|
||||
|
||||
|
||||
/**
|
||||
* Obtains a list of IP Addresses by the specified search criteria. Can search by: "userId", "dataCenterId", "address"
|
||||
* Obtains a list of IP Addresses by the specified search criteria. Can search by: "userId", "dataCenterId",
|
||||
* "address"
|
||||
*
|
||||
* @param cmd
|
||||
* the command that wraps the search criteria
|
||||
@ -236,7 +240,8 @@ public interface ManagementService {
|
||||
* List ISOs that match the specified criteria.
|
||||
*
|
||||
* @param cmd
|
||||
* The command that wraps the (optional) templateId, name, keyword, templateFilter, bootable, account, and zoneId
|
||||
* The command that wraps the (optional) templateId, name, keyword, templateFilter, bootable, account,
|
||||
* and zoneId
|
||||
* parameters.
|
||||
* @return list of ISOs
|
||||
*/
|
||||
@ -246,7 +251,8 @@ public interface ManagementService {
|
||||
* List templates that match the specified criteria.
|
||||
*
|
||||
* @param cmd
|
||||
* The command that wraps the (optional) templateId, name, keyword, templateFilter, bootable, account, and zoneId
|
||||
* The command that wraps the (optional) templateId, name, keyword, templateFilter, bootable, account,
|
||||
* and zoneId
|
||||
* parameters.
|
||||
* @return list of ISOs
|
||||
*/
|
||||
@ -300,7 +306,8 @@ public interface ManagementService {
|
||||
* Extracts the volume to a particular location.
|
||||
*
|
||||
* @param cmd
|
||||
* the command specifying url (where the volume needs to be extracted to), zoneId (zone where the volume exists),
|
||||
* the command specifying url (where the volume needs to be extracted to), zoneId (zone where the volume
|
||||
* exists),
|
||||
* id (the id of the volume)
|
||||
* @throws URISyntaxException
|
||||
* @throws InternalErrorException
|
||||
@ -311,7 +318,9 @@ public interface ManagementService {
|
||||
|
||||
/**
|
||||
* return an array of available hypervisors
|
||||
* @param zoneId TODO
|
||||
*
|
||||
* @param zoneId
|
||||
* TODO
|
||||
*
|
||||
* @return an array of available hypervisors in the cloud
|
||||
*/
|
||||
@ -381,7 +390,8 @@ public interface ManagementService {
|
||||
*
|
||||
* @param cmd
|
||||
* The api command class.
|
||||
* @return A VO containing the key pair name, finger print for the public key and the private key material of the key pair.
|
||||
* @return A VO containing the key pair name, finger print for the public key and the private key material of the
|
||||
* key pair.
|
||||
*/
|
||||
SSHKeyPair createSSHKeyPair(CreateSSHKeyPairCmd cmd);
|
||||
|
||||
@ -406,12 +416,15 @@ public interface ManagementService {
|
||||
Type findSystemVMTypeById(long instanceId);
|
||||
|
||||
/**
|
||||
* List hosts for migrating the given VM. The API returns list of all hosts in the VM's cluster minus the current host and
|
||||
* List hosts for migrating the given VM. The API returns list of all hosts in the VM's cluster minus the current
|
||||
* host and
|
||||
* also a list of hosts that seem to have enough CPU and RAM capacity to host this VM.
|
||||
*
|
||||
* @param Long vmId
|
||||
* @param Long
|
||||
* vmId
|
||||
* Id of The VM to migrate
|
||||
* @return Pair<List<? extends Host>, List<? extends Host>> List of all Hosts in VM's cluster and list of Hosts with enough capacity
|
||||
* @return Pair<List<? extends Host>, List<? extends Host>> List of all Hosts in VM's cluster and list of Hosts with
|
||||
* enough capacity
|
||||
*/
|
||||
Pair<List<? extends Host>, List<? extends Host>> listHostsForMigrationOfVM(Long vmId, Long startIndex, Long pageSize);
|
||||
|
||||
|
||||
@ -20,8 +20,11 @@ package com.cloud.storage;
|
||||
|
||||
public interface GuestOS {
|
||||
|
||||
long getId();
|
||||
String getName();
|
||||
String getDisplayName();
|
||||
long getCategoryId();
|
||||
long getId();
|
||||
|
||||
String getName();
|
||||
|
||||
String getDisplayName();
|
||||
|
||||
long getCategoryId();
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ import java.util.Date;
|
||||
import com.cloud.acl.ControlledEntity;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
|
||||
public interface Snapshot extends ControlledEntity{
|
||||
public interface Snapshot extends ControlledEntity {
|
||||
public enum Type {
|
||||
MANUAL,
|
||||
RECURRING,
|
||||
@ -70,15 +70,25 @@ public interface Snapshot extends ControlledEntity{
|
||||
public static final long MANUAL_POLICY_ID = 0L;
|
||||
|
||||
Long getId();
|
||||
|
||||
long getAccountId();
|
||||
|
||||
long getVolumeId();
|
||||
|
||||
String getPath();
|
||||
|
||||
String getName();
|
||||
|
||||
Date getCreated();
|
||||
|
||||
Type getType();
|
||||
|
||||
Status getStatus();
|
||||
|
||||
HypervisorType getHypervisorType();
|
||||
|
||||
boolean isRecursive();
|
||||
|
||||
short getsnapshotType();
|
||||
|
||||
}
|
||||
|
||||
@ -61,10 +61,10 @@ public class Storage {
|
||||
}
|
||||
|
||||
public String getFileExtension() {
|
||||
if(fileExtension == null)
|
||||
return toString().toLowerCase();
|
||||
if (fileExtension == null)
|
||||
return toString().toLowerCase();
|
||||
|
||||
return fileExtension;
|
||||
return fileExtension;
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,24 +84,24 @@ public class Storage {
|
||||
}
|
||||
|
||||
public static enum TemplateType {
|
||||
SYSTEM, /*routing, system vm template*/
|
||||
BUILTIN, /*buildin template*/
|
||||
PERHOST, /* every host has this template, don't need to install it in secondary storage */
|
||||
USER /* User supplied template/iso */
|
||||
SYSTEM, /* routing, system vm template */
|
||||
BUILTIN, /* buildin template */
|
||||
PERHOST, /* every host has this template, don't need to install it in secondary storage */
|
||||
USER /* User supplied template/iso */
|
||||
}
|
||||
|
||||
public static enum StoragePoolType {
|
||||
Filesystem(false), //local directory
|
||||
NetworkFilesystem(true), //NFS or CIFS
|
||||
IscsiLUN(true), //shared LUN, with a clusterfs overlay
|
||||
Iscsi(true), //for e.g., ZFS Comstar
|
||||
ISO(false), // for iso image
|
||||
LVM(false), // XenServer local LVM SR
|
||||
Filesystem(false), // local directory
|
||||
NetworkFilesystem(true), // NFS or CIFS
|
||||
IscsiLUN(true), // shared LUN, with a clusterfs overlay
|
||||
Iscsi(true), // for e.g., ZFS Comstar
|
||||
ISO(false), // for iso image
|
||||
LVM(false), // XenServer local LVM SR
|
||||
CLVM(true),
|
||||
SharedMountPoint(true),
|
||||
VMFS(true), // VMware VMFS storage
|
||||
PreSetup(true), // for XenServer, Storage Pool is set up by customers.
|
||||
EXT(false), // XenServer local EXT SR
|
||||
VMFS(true), // VMware VMFS storage
|
||||
PreSetup(true), // for XenServer, Storage Pool is set up by customers.
|
||||
EXT(false), // XenServer local EXT SR
|
||||
OCFS2(true);
|
||||
|
||||
boolean shared;
|
||||
@ -114,16 +114,19 @@ public class Storage {
|
||||
return shared;
|
||||
}
|
||||
}
|
||||
public static List<StoragePoolType> getNonSharedStoragePoolTypes(){
|
||||
List<StoragePoolType> nonSharedStoragePoolTypes = new ArrayList<StoragePoolType>();
|
||||
for(StoragePoolType storagePoolType : StoragePoolType.values()){
|
||||
if (!storagePoolType.isShared()){
|
||||
nonSharedStoragePoolTypes.add(storagePoolType);
|
||||
}
|
||||
}
|
||||
return nonSharedStoragePoolTypes;
|
||||
|
||||
public static List<StoragePoolType> getNonSharedStoragePoolTypes() {
|
||||
List<StoragePoolType> nonSharedStoragePoolTypes = new ArrayList<StoragePoolType>();
|
||||
for (StoragePoolType storagePoolType : StoragePoolType.values()) {
|
||||
if (!storagePoolType.isShared()) {
|
||||
nonSharedStoragePoolTypes.add(storagePoolType);
|
||||
}
|
||||
}
|
||||
return nonSharedStoragePoolTypes;
|
||||
|
||||
}
|
||||
|
||||
public static enum StorageResourceType {STORAGE_POOL, STORAGE_HOST, SECONDARY_STORAGE, LOCAL_SECONDARY_STORAGE}
|
||||
public static enum StorageResourceType {
|
||||
STORAGE_POOL, STORAGE_HOST, SECONDARY_STORAGE, LOCAL_SECONDARY_STORAGE
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,6 +25,8 @@ import com.cloud.utils.component.Adapter;
|
||||
*/
|
||||
public interface StorageGuru extends Adapter {
|
||||
void createVolume();
|
||||
|
||||
void prepareVolume();
|
||||
|
||||
void destroyVolume();
|
||||
}
|
||||
|
||||
@ -19,7 +19,6 @@ package com.cloud.storage;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.cloud.host.Status;
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
|
||||
/**
|
||||
@ -27,12 +26,12 @@ import com.cloud.storage.Storage.StoragePoolType;
|
||||
*
|
||||
*/
|
||||
|
||||
public interface StoragePool {
|
||||
public interface StoragePool {
|
||||
|
||||
/**
|
||||
* @return id of the pool.
|
||||
*/
|
||||
long getId();
|
||||
long getId();
|
||||
|
||||
/**
|
||||
* @return name of the pool.
|
||||
@ -60,7 +59,6 @@ public interface StoragePool {
|
||||
*/
|
||||
Date getUpdateTime();
|
||||
|
||||
|
||||
/**
|
||||
* @return availability zone.
|
||||
*/
|
||||
@ -71,13 +69,11 @@ public interface StoragePool {
|
||||
*/
|
||||
long getCapacityBytes();
|
||||
|
||||
|
||||
/**
|
||||
* @return available storage in bytes
|
||||
*/
|
||||
long getAvailableBytes();
|
||||
|
||||
|
||||
Long getClusterId();
|
||||
|
||||
/**
|
||||
@ -103,9 +99,9 @@ public interface StoragePool {
|
||||
/**
|
||||
* @return the storage pool status
|
||||
*/
|
||||
StoragePoolStatus getStatus();
|
||||
StoragePoolStatus getStatus();
|
||||
|
||||
int getPort();
|
||||
int getPort();
|
||||
|
||||
Long getPodId();
|
||||
Long getPodId();
|
||||
}
|
||||
|
||||
@ -38,7 +38,8 @@ public interface StorageService {
|
||||
* Create StoragePool based on uri
|
||||
*
|
||||
* @param cmd
|
||||
* the command object that specifies the zone, cluster/pod, URI, details, etc. to use to create the storage pool.
|
||||
* the command object that specifies the zone, cluster/pod, URI, details, etc. to use to create the
|
||||
* storage pool.
|
||||
* @return
|
||||
* @throws ResourceInUseException
|
||||
* @throws IllegalArgumentException
|
||||
@ -52,7 +53,8 @@ public interface StorageService {
|
||||
* Creates the database object for a volume based on the given criteria
|
||||
*
|
||||
* @param cmd
|
||||
* the API command wrapping the criteria (account/domainId [admin only], zone, diskOffering, snapshot, name)
|
||||
* the API command wrapping the criteria (account/domainId [admin only], zone, diskOffering, snapshot,
|
||||
* name)
|
||||
* @return the volume object
|
||||
* @throws PermissionDeniedException
|
||||
*/
|
||||
@ -62,7 +64,8 @@ public interface StorageService {
|
||||
* Creates the volume based on the given criteria
|
||||
*
|
||||
* @param cmd
|
||||
* the API command wrapping the criteria (account/domainId [admin only], zone, diskOffering, snapshot, name)
|
||||
* the API command wrapping the criteria (account/domainId [admin only], zone, diskOffering, snapshot,
|
||||
* name)
|
||||
* @return the volume object
|
||||
*/
|
||||
Volume createVolume(CreateVolumeCmd cmd);
|
||||
@ -106,8 +109,8 @@ public interface StorageService {
|
||||
|
||||
public StoragePool getStoragePool(long id);
|
||||
|
||||
Volume migrateVolume(Long volumeId, Long storagePoolId) throws ConcurrentOperationException;
|
||||
Volume migrateVolume(Long volumeId, Long storagePoolId) throws ConcurrentOperationException;
|
||||
|
||||
List<? extends Volume> searchForVolumes(ListVolumesCmd cmd);
|
||||
List<? extends Volume> searchForVolumes(ListVolumesCmd cmd);
|
||||
|
||||
}
|
||||
|
||||
@ -21,9 +21,14 @@ import com.cloud.agent.api.to.SwiftTO;
|
||||
|
||||
public interface Swift {
|
||||
public long getId();
|
||||
|
||||
public String getUrl();
|
||||
|
||||
public String getAccount();
|
||||
|
||||
public String getUserName();
|
||||
|
||||
public String getKey();
|
||||
|
||||
public SwiftTO toSwiftTO();
|
||||
}
|
||||
|
||||
@ -22,9 +22,17 @@ import java.util.Date;
|
||||
|
||||
public interface Upload {
|
||||
|
||||
public static enum Status {UNKNOWN, ABANDONED, UPLOADED, NOT_UPLOADED, UPLOAD_ERROR, UPLOAD_IN_PROGRESS, NOT_COPIED, COPY_IN_PROGRESS, COPY_ERROR, COPY_COMPLETE, DOWNLOAD_URL_CREATED, DOWNLOAD_URL_NOT_CREATED, ERROR}
|
||||
public static enum Type {VOLUME, TEMPLATE, ISO}
|
||||
public static enum Mode {FTP_UPLOAD, HTTP_DOWNLOAD}
|
||||
public static enum Status {
|
||||
UNKNOWN, ABANDONED, UPLOADED, NOT_UPLOADED, UPLOAD_ERROR, UPLOAD_IN_PROGRESS, NOT_COPIED, COPY_IN_PROGRESS, COPY_ERROR, COPY_COMPLETE, DOWNLOAD_URL_CREATED, DOWNLOAD_URL_NOT_CREATED, ERROR
|
||||
}
|
||||
|
||||
public static enum Type {
|
||||
VOLUME, TEMPLATE, ISO
|
||||
}
|
||||
|
||||
public static enum Mode {
|
||||
FTP_UPLOAD, HTTP_DOWNLOAD
|
||||
}
|
||||
|
||||
long getHostId();
|
||||
|
||||
|
||||
@ -24,44 +24,46 @@ import java.util.Date;
|
||||
*
|
||||
*/
|
||||
public interface VMTemplateStorageResourceAssoc {
|
||||
public static enum Status {UNKNOWN, DOWNLOAD_ERROR, NOT_DOWNLOADED, DOWNLOAD_IN_PROGRESS, DOWNLOADED, ABANDONED, UPLOADED, NOT_UPLOADED, UPLOAD_ERROR, UPLOAD_IN_PROGRESS}
|
||||
public static enum Status {
|
||||
UNKNOWN, DOWNLOAD_ERROR, NOT_DOWNLOADED, DOWNLOAD_IN_PROGRESS, DOWNLOADED, ABANDONED, UPLOADED, NOT_UPLOADED, UPLOAD_ERROR, UPLOAD_IN_PROGRESS
|
||||
}
|
||||
|
||||
String getInstallPath();
|
||||
String getInstallPath();
|
||||
|
||||
long getTemplateId();
|
||||
long getTemplateId();
|
||||
|
||||
void setTemplateId(long templateId);
|
||||
void setTemplateId(long templateId);
|
||||
|
||||
int getDownloadPercent();
|
||||
int getDownloadPercent();
|
||||
|
||||
void setDownloadPercent(int downloadPercent);
|
||||
void setDownloadPercent(int downloadPercent);
|
||||
|
||||
void setDownloadState(Status downloadState);
|
||||
void setDownloadState(Status downloadState);
|
||||
|
||||
long getId();
|
||||
long getId();
|
||||
|
||||
Date getCreated();
|
||||
Date getCreated();
|
||||
|
||||
Date getLastUpdated();
|
||||
Date getLastUpdated();
|
||||
|
||||
void setLastUpdated(Date date);
|
||||
void setLastUpdated(Date date);
|
||||
|
||||
void setInstallPath(String installPath);
|
||||
void setInstallPath(String installPath);
|
||||
|
||||
Status getDownloadState();
|
||||
Status getDownloadState();
|
||||
|
||||
void setLocalDownloadPath(String localPath);
|
||||
void setLocalDownloadPath(String localPath);
|
||||
|
||||
String getLocalDownloadPath();
|
||||
String getLocalDownloadPath();
|
||||
|
||||
void setErrorString(String errorString);
|
||||
void setErrorString(String errorString);
|
||||
|
||||
String getErrorString();
|
||||
String getErrorString();
|
||||
|
||||
void setJobId(String jobId);
|
||||
void setJobId(String jobId);
|
||||
|
||||
String getJobId();;
|
||||
String getJobId();;
|
||||
|
||||
long getTemplateSize();
|
||||
long getTemplateSize();
|
||||
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
package com.cloud.storage;
|
||||
|
||||
public interface VolumeStats {
|
||||
/**
|
||||
/**
|
||||
* @return bytes used by the volume
|
||||
*/
|
||||
public long getBytesUsed();
|
||||
|
||||
@ -42,19 +42,24 @@ public interface SnapshotService {
|
||||
List<? extends Snapshot> listSnapshots(ListSnapshotsCmd cmd);
|
||||
|
||||
/**
|
||||
* Delete specified snapshot from the specified. If no other policies are assigned it calls destroy snapshot. This will be
|
||||
* Delete specified snapshot from the specified. If no other policies are assigned it calls destroy snapshot. This
|
||||
* will be
|
||||
* used for manual snapshots too.
|
||||
* @param snapshotId TODO
|
||||
*
|
||||
* @param snapshotId
|
||||
* TODO
|
||||
*/
|
||||
boolean deleteSnapshot(long snapshotId);
|
||||
|
||||
/**
|
||||
* Creates a policy with specified schedule. maxSnaps specifies the number of most recent snapshots that are to be retained.
|
||||
* Creates a policy with specified schedule. maxSnaps specifies the number of most recent snapshots that are to be
|
||||
* retained.
|
||||
* If the number of snapshots go beyond maxSnaps the oldest snapshot is deleted
|
||||
*
|
||||
* @param cmd
|
||||
* the command that
|
||||
* @param policyOwner TODO
|
||||
* @param policyOwner
|
||||
* TODO
|
||||
* @return the newly created snapshot policy if success, null otherwise
|
||||
*/
|
||||
SnapshotPolicy createPolicy(CreateSnapshotPolicyCmd cmd, Account policyOwner);
|
||||
@ -84,7 +89,9 @@ public interface SnapshotService {
|
||||
|
||||
/**
|
||||
* Create a snapshot of a volume
|
||||
* @param snapshotOwner TODO
|
||||
*
|
||||
* @param snapshotOwner
|
||||
* TODO
|
||||
* @param cmd
|
||||
* the API command wrapping the parameters for creating the snapshot (mainly volumeId)
|
||||
*
|
||||
|
||||
@ -17,8 +17,6 @@
|
||||
*/
|
||||
package com.cloud.storage.template;
|
||||
|
||||
|
||||
|
||||
public class TemplateInfo {
|
||||
String templateName;
|
||||
String installPath;
|
||||
@ -80,4 +78,5 @@ public class TemplateInfo {
|
||||
public void setSize(long size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ public interface TemplateService {
|
||||
|
||||
VirtualMachineTemplate copyTemplate(CopyTemplateCmd cmd) throws StorageUnavailableException, ResourceAllocationException;
|
||||
|
||||
VirtualMachineTemplate prepareTemplate(long templateId, long zoneId) ;
|
||||
VirtualMachineTemplate prepareTemplate(long templateId, long zoneId);
|
||||
|
||||
boolean detachIso(long vmId);
|
||||
|
||||
@ -84,7 +84,7 @@ public interface TemplateService {
|
||||
|
||||
VirtualMachineTemplate getTemplate(long templateId);
|
||||
|
||||
List<String> listTemplatePermissions(ListTemplateOrIsoPermissionsCmd cmd);
|
||||
List<String> listTemplatePermissions(ListTemplateOrIsoPermissionsCmd cmd);
|
||||
|
||||
boolean updateTemplateOrIsoPermissions(UpdateTemplateOrIsoPermissionsCmd cmd);
|
||||
boolean updateTemplateOrIsoPermissions(UpdateTemplateOrIsoPermissionsCmd cmd);
|
||||
}
|
||||
|
||||
@ -27,15 +27,19 @@ import com.cloud.storage.Storage.TemplateType;
|
||||
|
||||
public interface VirtualMachineTemplate extends ControlledEntity {
|
||||
|
||||
public static enum BootloaderType { PyGrub, HVM, External, CD };
|
||||
public static enum BootloaderType {
|
||||
PyGrub, HVM, External, CD
|
||||
};
|
||||
|
||||
public enum TemplateFilter {
|
||||
featured, // returns templates that have been marked as featured and public
|
||||
self, // returns templates that have been registered or created by the calling user
|
||||
selfexecutable, // same as self, but only returns templates that are ready to be deployed with
|
||||
sharedexecutable, // ready templates that have been granted to the calling user by another user
|
||||
executable, // templates that are owned by the calling user, or public templates, that can be used to deploy a new VM
|
||||
community, // returns templates that have been marked as public but not featured
|
||||
all // all templates (only usable by admins)
|
||||
featured, // returns templates that have been marked as featured and public
|
||||
self, // returns templates that have been registered or created by the calling user
|
||||
selfexecutable, // same as self, but only returns templates that are ready to be deployed with
|
||||
sharedexecutable, // ready templates that have been granted to the calling user by another user
|
||||
executable, // templates that are owned by the calling user, or public templates, that can be used to deploy a
|
||||
// new VM
|
||||
community, // returns templates that have been marked as public but not featured
|
||||
all // all templates (only usable by admins)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user