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