mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
VPC: CS-15827 - register only VpcVirtualNetworkApplianceMgr
Conflicts: api/src/com/cloud/api/BaseCmd.java api/src/com/cloud/network/VpcVirtualNetworkApplianceService.java plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java server/src/com/cloud/configuration/DefaultComponentLibrary.java server/src/com/cloud/ha/UserVmDomRInvestigator.java
This commit is contained in:
parent
6eba8a818a
commit
e7a1862867
@ -14,10 +14,12 @@
|
|||||||
// KIND, either express or implied. See the License for the
|
// KIND, either express or implied. See the License for the
|
||||||
// specific language governing permissions and limitations
|
// specific language governing permissions and limitations
|
||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.api;
|
|
||||||
|
package com.cloud.api;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -39,7 +41,7 @@ import com.cloud.exception.ResourceAllocationException;
|
|||||||
import com.cloud.exception.ResourceUnavailableException;
|
import com.cloud.exception.ResourceUnavailableException;
|
||||||
import com.cloud.network.NetworkService;
|
import com.cloud.network.NetworkService;
|
||||||
import com.cloud.network.StorageNetworkService;
|
import com.cloud.network.StorageNetworkService;
|
||||||
import com.cloud.network.VirtualNetworkApplianceService;
|
import com.cloud.network.VpcVirtualNetworkApplianceService;
|
||||||
import com.cloud.network.firewall.FirewallService;
|
import com.cloud.network.firewall.FirewallService;
|
||||||
import com.cloud.network.firewall.NetworkACLService;
|
import com.cloud.network.firewall.NetworkACLService;
|
||||||
import com.cloud.network.lb.LoadBalancingRulesService;
|
import com.cloud.network.lb.LoadBalancingRulesService;
|
||||||
@ -60,468 +62,469 @@ import com.cloud.user.Account;
|
|||||||
import com.cloud.user.AccountService;
|
import com.cloud.user.AccountService;
|
||||||
import com.cloud.user.DomainService;
|
import com.cloud.user.DomainService;
|
||||||
import com.cloud.user.ResourceLimitService;
|
import com.cloud.user.ResourceLimitService;
|
||||||
|
import com.cloud.utils.IdentityProxy;
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.utils.Pair;
|
||||||
import com.cloud.utils.component.ComponentLocator;
|
import com.cloud.utils.component.ComponentLocator;
|
||||||
import com.cloud.vm.BareMetalVmService;
|
import com.cloud.vm.BareMetalVmService;
|
||||||
import com.cloud.vm.UserVmService;
|
import com.cloud.vm.UserVmService;
|
||||||
|
|
||||||
public abstract class BaseCmd {
|
public abstract class BaseCmd {
|
||||||
private static final Logger s_logger = Logger.getLogger(BaseCmd.class.getName());
|
private static final Logger s_logger = Logger.getLogger(BaseCmd.class.getName());
|
||||||
|
|
||||||
public static final String USER_ERROR_MESSAGE = "Internal error executing command, please contact your system administrator";
|
public static final String USER_ERROR_MESSAGE = "Internal error executing command, please contact your system administrator";
|
||||||
public static final int PROGRESS_INSTANCE_CREATED = 1;
|
public static final int PROGRESS_INSTANCE_CREATED = 1;
|
||||||
|
|
||||||
public static final String RESPONSE_TYPE_XML = "xml";
|
public static final String RESPONSE_TYPE_XML = "xml";
|
||||||
public static final String RESPONSE_TYPE_JSON = "json";
|
public static final String RESPONSE_TYPE_JSON = "json";
|
||||||
|
|
||||||
public enum CommandType {
|
public enum CommandType {
|
||||||
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;
|
||||||
public static final int UNSUPPORTED_ACTION_ERROR = 432;
|
public static final int UNSUPPORTED_ACTION_ERROR = 432;
|
||||||
public static final int PAGE_LIMIT_EXCEED = 433;
|
public static final int PAGE_LIMIT_EXCEED = 433;
|
||||||
|
|
||||||
// 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;
|
||||||
public static final int RESOURCE_IN_USE_ERROR = 536;
|
public static final int RESOURCE_IN_USE_ERROR = 536;
|
||||||
public static final int NETWORK_RULE_CONFLICT_ERROR = 537;
|
public static final int NETWORK_RULE_CONFLICT_ERROR = 537;
|
||||||
|
|
||||||
public static final DateFormat INPUT_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
|
public static final DateFormat INPUT_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
public static final DateFormat NEW_INPUT_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
public static final DateFormat NEW_INPUT_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
public static Pattern newInputDateFormat = Pattern.compile("[\\d]+-[\\d]+-[\\d]+ [\\d]+:[\\d]+:[\\d]+");
|
public static Pattern newInputDateFormat = Pattern.compile("[\\d]+-[\\d]+-[\\d]+ [\\d]+:[\\d]+:[\\d]+");
|
||||||
private static final DateFormat _outputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
|
private static final DateFormat _outputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
|
||||||
|
|
||||||
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;
|
||||||
public static ConfigurationService _configService;
|
public static ConfigurationService _configService;
|
||||||
public static AccountService _accountService;
|
public static AccountService _accountService;
|
||||||
public static UserVmService _userVmService;
|
public static UserVmService _userVmService;
|
||||||
public static ManagementService _mgr;
|
public static ManagementService _mgr;
|
||||||
public static StorageService _storageService;
|
public static StorageService _storageService;
|
||||||
public static ResourceService _resourceService;
|
public static ResourceService _resourceService;
|
||||||
public static NetworkService _networkService;
|
public static NetworkService _networkService;
|
||||||
public static TemplateService _templateService;
|
public static TemplateService _templateService;
|
||||||
public static SecurityGroupService _securityGroupService;
|
public static SecurityGroupService _securityGroupService;
|
||||||
public static SnapshotService _snapshotService;
|
public static SnapshotService _snapshotService;
|
||||||
public static ConsoleProxyService _consoleProxyService;
|
public static ConsoleProxyService _consoleProxyService;
|
||||||
public static VirtualNetworkApplianceService _routerService;
|
public static VpcVirtualNetworkApplianceService _routerService;
|
||||||
public static ResponseGenerator _responseGenerator;
|
public static ResponseGenerator _responseGenerator;
|
||||||
public static EntityManager _entityMgr;
|
public static EntityManager _entityMgr;
|
||||||
public static RulesService _rulesService;
|
public static RulesService _rulesService;
|
||||||
public static LoadBalancingRulesService _lbService;
|
public static LoadBalancingRulesService _lbService;
|
||||||
public static RemoteAccessVpnService _ravService;
|
public static RemoteAccessVpnService _ravService;
|
||||||
public static BareMetalVmService _bareMetalVmService;
|
public static BareMetalVmService _bareMetalVmService;
|
||||||
public static ProjectService _projectService;
|
public static ProjectService _projectService;
|
||||||
public static FirewallService _firewallService;
|
public static FirewallService _firewallService;
|
||||||
public static DomainService _domainService;
|
public static DomainService _domainService;
|
||||||
public static ResourceLimitService _resourceLimitService;
|
public static ResourceLimitService _resourceLimitService;
|
||||||
public static IdentityService _identityService;
|
public static IdentityService _identityService;
|
||||||
public static StorageNetworkService _storageNetworkService;
|
public static StorageNetworkService _storageNetworkService;
|
||||||
public static VpcService _vpcService;
|
public static TaggedResourceService _taggedResourceService;
|
||||||
public static NetworkACLService _networkACLService;
|
public static VpcService _vpcService;
|
||||||
public static TaggedResourceService _taggedResourceService;
|
public static NetworkACLService _networkACLService;
|
||||||
public static Site2SiteVpnService _s2sVpnService;
|
public static Site2SiteVpnService _s2sVpnService;
|
||||||
|
|
||||||
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);
|
||||||
_storageService = locator.getManager(StorageService.class);
|
_storageService = locator.getManager(StorageService.class);
|
||||||
_resourceService = locator.getManager(ResourceService.class);
|
_resourceService = locator.getManager(ResourceService.class);
|
||||||
_networkService = locator.getManager(NetworkService.class);
|
_networkService = locator.getManager(NetworkService.class);
|
||||||
_templateService = locator.getManager(TemplateService.class);
|
_templateService = locator.getManager(TemplateService.class);
|
||||||
_securityGroupService = locator.getManager(SecurityGroupService.class);
|
_securityGroupService = locator.getManager(SecurityGroupService.class);
|
||||||
_snapshotService = locator.getManager(SnapshotService.class);
|
_snapshotService = locator.getManager(SnapshotService.class);
|
||||||
_consoleProxyService = locator.getManager(ConsoleProxyService.class);
|
_consoleProxyService = locator.getManager(ConsoleProxyService.class);
|
||||||
_routerService = locator.getManager(VirtualNetworkApplianceService.class);
|
_routerService = locator.getManager(VpcVirtualNetworkApplianceService.class);
|
||||||
_entityMgr = locator.getManager(EntityManager.class);
|
_entityMgr = locator.getManager(EntityManager.class);
|
||||||
_rulesService = locator.getManager(RulesService.class);
|
_rulesService = locator.getManager(RulesService.class);
|
||||||
_lbService = locator.getManager(LoadBalancingRulesService.class);
|
_lbService = locator.getManager(LoadBalancingRulesService.class);
|
||||||
_ravService = locator.getManager(RemoteAccessVpnService.class);
|
_ravService = locator.getManager(RemoteAccessVpnService.class);
|
||||||
_responseGenerator = generator;
|
_responseGenerator = generator;
|
||||||
_bareMetalVmService = locator.getManager(BareMetalVmService.class);
|
_bareMetalVmService = locator.getManager(BareMetalVmService.class);
|
||||||
_projectService = locator.getManager(ProjectService.class);
|
_projectService = locator.getManager(ProjectService.class);
|
||||||
_firewallService = locator.getManager(FirewallService.class);
|
_firewallService = locator.getManager(FirewallService.class);
|
||||||
_domainService = locator.getManager(DomainService.class);
|
_domainService = locator.getManager(DomainService.class);
|
||||||
_resourceLimitService = locator.getManager(ResourceLimitService.class);
|
_resourceLimitService = locator.getManager(ResourceLimitService.class);
|
||||||
_identityService = locator.getManager(IdentityService.class);
|
_identityService = locator.getManager(IdentityService.class);
|
||||||
_storageNetworkService = locator.getManager(StorageNetworkService.class);
|
_storageNetworkService = locator.getManager(StorageNetworkService.class);
|
||||||
_vpcService = locator.getManager(VpcService.class);
|
_taggedResourceService = locator.getManager(TaggedResourceService.class);
|
||||||
_networkACLService = locator.getManager(NetworkACLService.class);
|
_vpcService = locator.getManager(VpcService.class);
|
||||||
_taggedResourceService = locator.getManager(TaggedResourceService.class);
|
_networkACLService = locator.getManager(NetworkACLService.class);
|
||||||
_s2sVpnService = locator.getManager(Site2SiteVpnService.class);
|
_s2sVpnService = locator.getManager(Site2SiteVpnService.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException;
|
public abstract void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException;
|
||||||
|
|
||||||
public String getResponseType() {
|
public String getResponseType() {
|
||||||
if (responseType == null) {
|
if (responseType == null) {
|
||||||
return RESPONSE_TYPE_XML;
|
return RESPONSE_TYPE_XML;
|
||||||
}
|
}
|
||||||
return responseType;
|
return responseType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setResponseType(String responseType) {
|
public void setResponseType(String responseType) {
|
||||||
this.responseType = responseType;
|
this.responseType = responseType;
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
|
|
||||||
public Object getResponseObject() {
|
public Object getResponseObject() {
|
||||||
return _responseObject;
|
return _responseObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setResponseObject(Object responseObject) {
|
public void setResponseObject(Object responseObject) {
|
||||||
_responseObject = responseObject;
|
_responseObject = responseObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ManagementService getMgmtServiceRef() {
|
public ManagementService getMgmtServiceRef() {
|
||||||
return _mgr;
|
return _mgr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getDateString(Date date) {
|
public static String getDateString(Date date) {
|
||||||
if (date == null) {
|
if (date == null) {
|
||||||
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
|
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 specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arrayStartIndex > 0) {
|
if (arrayStartIndex > 0) {
|
||||||
int arrayEndIndex = key.indexOf(']');
|
int arrayEndIndex = key.indexOf(']');
|
||||||
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
|
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 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
|
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 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse the parameter name as the text before the first '[' character
|
// parse the parameter name as the text before the first '[' character
|
||||||
String paramName = key.substring(0, arrayStartIndex);
|
String paramName = key.substring(0, arrayStartIndex);
|
||||||
paramName = paramName.toLowerCase();
|
paramName = paramName.toLowerCase();
|
||||||
|
|
||||||
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 {
|
||||||
if (indexStr != null) {
|
if (indexStr != null) {
|
||||||
index = Integer.parseInt(indexStr);
|
index = Integer.parseInt(indexStr);
|
||||||
parsedIndex = true;
|
parsedIndex = true;
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException nfe) {
|
} catch (NumberFormatException nfe) {
|
||||||
s_logger.warn("Invalid parameter " + key + " received, unable to parse object array, returning an error.");
|
s_logger.warn("Invalid parameter " + key + " received, unable to parse object array, returning an error.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!parsedIndex) {
|
if (!parsedIndex) {
|
||||||
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
|
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 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);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
// for now, assume object array with sub fields
|
// for now, assume object array with sub fields
|
||||||
mapArray = new HashMap<Integer, Map>();
|
mapArray = new HashMap<Integer, Map>();
|
||||||
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>();
|
||||||
mapArray.put(Integer.valueOf(index), mapValue);
|
mapArray.put(Integer.valueOf(index), mapValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// we are ready to store the value for a particular field into the map for this object
|
// we are ready to store the value for a particular field into the map for this object
|
||||||
mapValue.put(fieldName, params.get(key));
|
mapValue.put(fieldName, params.get(key));
|
||||||
|
|
||||||
lowercaseParams.put(paramName, mapArray);
|
lowercaseParams.put(paramName, mapArray);
|
||||||
} else {
|
} else {
|
||||||
lowercaseParams.put(key.toLowerCase(), params.get(key));
|
lowercaseParams.put(key.toLowerCase(), params.get(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return lowercaseParams;
|
return lowercaseParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String buildResponse(ServerApiException apiException, String responseType) {
|
public String buildResponse(ServerApiException apiException, String responseType) {
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String buildResponse(List<Pair<String, Object>> tagList, String responseType) {
|
public String buildResponse(List<Pair<String, Object>> tagList, String responseType) {
|
||||||
StringBuffer prefixSb = new StringBuffer();
|
StringBuffer prefixSb = new StringBuffer();
|
||||||
StringBuffer suffixSb = new StringBuffer();
|
StringBuffer suffixSb = new StringBuffer();
|
||||||
|
|
||||||
// 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;
|
||||||
for (Pair<String, Object> tagData : tagList) {
|
for (Pair<String, Object> tagData : tagList) {
|
||||||
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;
|
||||||
}
|
}
|
||||||
writeObjectArray(responseType, suffixSb, i++, tagName, subObjects);
|
writeObjectArray(responseType, suffixSb, i++, tagName, subObjects);
|
||||||
} else {
|
} else {
|
||||||
writeNameValuePair(suffixSb, tagName, tagValue, responseType, i++);
|
writeNameValuePair(suffixSb, tagName, tagValue, responseType, i++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (suffixSb.length() > 0) {
|
if (suffixSb.length() > 0) {
|
||||||
if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) { // append comma only if we have some suffix else
|
if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) { // append comma only if we have some suffix else
|
||||||
// not as per strict Json syntax.
|
// not as per strict Json syntax.
|
||||||
prefixSb.append(",");
|
prefixSb.append(",");
|
||||||
}
|
}
|
||||||
prefixSb.append(suffixSb);
|
prefixSb.append(suffixSb);
|
||||||
}
|
}
|
||||||
// close the response
|
// close the response
|
||||||
if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
|
if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
|
||||||
prefixSb.append("} }");
|
prefixSb.append("} }");
|
||||||
} else {
|
} else {
|
||||||
prefixSb.append("</" + getCommandName() + ">");
|
prefixSb.append("</" + getCommandName() + ">");
|
||||||
}
|
}
|
||||||
return prefixSb.toString();
|
return prefixSb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeNameValuePair(StringBuffer sb, String tagName, Object tagValue, String responseType, int propertyCount) {
|
private void writeNameValuePair(StringBuffer sb, String tagName, Object tagValue, String responseType, int propertyCount) {
|
||||||
if (tagValue == null) {
|
if (tagValue == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
writeObjectArray(responseType, sb, propertyCount, tagName, subObjects);
|
writeObjectArray(responseType, sb, propertyCount, tagName, subObjects);
|
||||||
} else {
|
} else {
|
||||||
if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
|
if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
|
||||||
String seperator = ((propertyCount > 0) ? ", " : "");
|
String seperator = ((propertyCount > 0) ? ", " : "");
|
||||||
sb.append(seperator + "\"" + tagName + "\" : \"" + escapeJSON(tagValue.toString()) + "\"");
|
sb.append(seperator + "\"" + tagName + "\" : \"" + escapeJSON(tagValue.toString()) + "\"");
|
||||||
} else {
|
} else {
|
||||||
sb.append("<" + tagName + ">" + escapeXml(tagValue.toString()) + "</" + tagName + ">");
|
sb.append("<" + tagName + ">" + escapeXml(tagValue.toString()) + "</" + tagName + ">");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
private void writeObjectArray(String responseType, StringBuffer sb, int propertyCount, String tagName, Object[] subObjects) {
|
private void writeObjectArray(String responseType, StringBuffer sb, int propertyCount, String tagName, Object[] subObjects) {
|
||||||
if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
|
if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
|
||||||
String separator = ((propertyCount > 0) ? ", " : "");
|
String separator = ((propertyCount > 0) ? ", " : "");
|
||||||
sb.append(separator);
|
sb.append(separator);
|
||||||
}
|
}
|
||||||
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++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
|
if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
|
||||||
sb.append("]");
|
sb.append("]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
private void writeSubObject(StringBuffer sb, String tagName, List tagList, String responseType, int objectCount) {
|
private void writeSubObject(StringBuffer sb, String tagName, List tagList, String responseType, int objectCount) {
|
||||||
if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
|
if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
|
||||||
sb.append(((objectCount == 0) ? "\"" + tagName + "\" : [ { " : ", { "));
|
sb.append(((objectCount == 0) ? "\"" + tagName + "\" : [ { " : ", { "));
|
||||||
} else {
|
} else {
|
||||||
sb.append("<" + tagName + ">");
|
sb.append("<" + tagName + ">");
|
||||||
}
|
}
|
||||||
|
|
||||||
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++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
|
if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
|
||||||
sb.append("}");
|
sb.append("}");
|
||||||
} else {
|
} else {
|
||||||
sb.append("</" + tagName + ">");
|
sb.append("</" + tagName + ">");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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;
|
return xml;
|
||||||
}
|
}
|
||||||
int iLen = xml.length();
|
int iLen = xml.length();
|
||||||
if (iLen == 0) {
|
if (iLen == 0) {
|
||||||
return xml;
|
return xml;
|
||||||
}
|
}
|
||||||
StringBuffer sOUT = new StringBuffer(iLen + 256);
|
StringBuffer sOUT = new StringBuffer(iLen + 256);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (; i < iLen; i++) {
|
for (; i < iLen; i++) {
|
||||||
char c = xml.charAt(i);
|
char c = xml.charAt(i);
|
||||||
if (c == '<') {
|
if (c == '<') {
|
||||||
sOUT.append("<");
|
sOUT.append("<");
|
||||||
} else if (c == '>') {
|
} else if (c == '>') {
|
||||||
sOUT.append(">");
|
sOUT.append(">");
|
||||||
} else if (c == '&') {
|
} else if (c == '&') {
|
||||||
sOUT.append("&");
|
sOUT.append("&");
|
||||||
} else if (c == '"') {
|
} else if (c == '"') {
|
||||||
sOUT.append(""");
|
sOUT.append(""");
|
||||||
} else if (c == '\'') {
|
} else if (c == '\'') {
|
||||||
sOUT.append("'");
|
sOUT.append("'");
|
||||||
} 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_READ_ONLY_ADMIN));
|
(accountType == Account.ACCOUNT_TYPE_DOMAIN_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) {
|
||||||
if (accountName != null) {
|
if (accountName != null) {
|
||||||
if (domainId == null) {
|
if (domainId == null) {
|
||||||
throw new InvalidParameterValueException("Account must be specified with domainId parameter");
|
throw new InvalidParameterValueException("Account must be specified with domainId parameter");
|
||||||
}
|
}
|
||||||
|
|
||||||
Domain domain = _domainService.getDomain(domainId);
|
Domain domain = _domainService.getDomain(domainId);
|
||||||
if (domain == null) {
|
if (domain == null) {
|
||||||
throw new InvalidParameterValueException("Unable to find domain by id=" + domainId);
|
throw new InvalidParameterValueException("Unable to find domain by id");
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
List<IdentityProxy> idList = new ArrayList<IdentityProxy>();
|
||||||
}
|
idList.add(new IdentityProxy("domain", domainId, "domainId"));
|
||||||
}
|
throw new InvalidParameterValueException("Unable to find account by name " + accountName + " in domain with specified id");
|
||||||
|
}
|
||||||
if (projectId != null) {
|
}
|
||||||
Project project = _projectService.getProject(projectId);
|
|
||||||
if (project != null) {
|
if (projectId != null) {
|
||||||
if (!enabledOnly || project.getState() == Project.State.Active) {
|
Project project = _projectService.getProject(projectId);
|
||||||
return project.getProjectAccountId();
|
if (project != null) {
|
||||||
} else {
|
if (!enabledOnly || project.getState() == Project.State.Active) {
|
||||||
PermissionDeniedException ex = new PermissionDeniedException("Can't add resources to the project with specified projectId in state=" + project.getState() + " as it's no longer active");
|
return project.getProjectAccountId();
|
||||||
ex.addProxyObject(project, projectId, "projectId");
|
} else {
|
||||||
throw ex;
|
PermissionDeniedException ex = new PermissionDeniedException("Can't add resources to the project with specified projectId in state=" + project.getState() + " as it's no longer active");
|
||||||
}
|
ex.addProxyObject(project, projectId, "projectId");
|
||||||
} else {
|
throw ex;
|
||||||
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find project with specified projectId");
|
}
|
||||||
ex.addProxyObject(project, projectId, "projectId");
|
} else {
|
||||||
throw ex;
|
throw new InvalidParameterValueException("Unable to find project by id");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,7 +21,7 @@ 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;
|
||||||
|
|
||||||
public interface VpcVirtualNetworkApplianceService {
|
public interface VpcVirtualNetworkApplianceService extends VirtualNetworkApplianceService{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param router
|
* @param router
|
||||||
|
|||||||
@ -71,7 +71,6 @@ import com.cloud.hypervisor.vmware.util.VmwareContext;
|
|||||||
import com.cloud.network.CiscoNexusVSMDeviceVO;
|
import com.cloud.network.CiscoNexusVSMDeviceVO;
|
||||||
import com.cloud.network.NetworkManager;
|
import com.cloud.network.NetworkManager;
|
||||||
import com.cloud.network.dao.CiscoNexusVSMDeviceDao;
|
import com.cloud.network.dao.CiscoNexusVSMDeviceDao;
|
||||||
import com.cloud.network.router.VirtualNetworkApplianceManager;
|
|
||||||
import com.cloud.org.Cluster.ClusterType;
|
import com.cloud.org.Cluster.ClusterType;
|
||||||
import com.cloud.secstorage.CommandExecLogDao;
|
import com.cloud.secstorage.CommandExecLogDao;
|
||||||
import com.cloud.serializer.GsonHelper;
|
import com.cloud.serializer.GsonHelper;
|
||||||
@ -93,7 +92,6 @@ import com.cloud.vm.DomainRouterVO;
|
|||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.vmware.apputils.vim25.ServiceUtil;
|
import com.vmware.apputils.vim25.ServiceUtil;
|
||||||
import com.vmware.vim25.HostConnectSpec;
|
import com.vmware.vim25.HostConnectSpec;
|
||||||
import com.vmware.vim25.HostPortGroupSpec;
|
|
||||||
import com.vmware.vim25.ManagedObjectReference;
|
import com.vmware.vim25.ManagedObjectReference;
|
||||||
|
|
||||||
@Local(value = {VmwareManager.class})
|
@Local(value = {VmwareManager.class})
|
||||||
@ -118,7 +116,6 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis
|
|||||||
@Inject CommandExecLogDao _cmdExecLogDao;
|
@Inject CommandExecLogDao _cmdExecLogDao;
|
||||||
@Inject ClusterManager _clusterMgr;
|
@Inject ClusterManager _clusterMgr;
|
||||||
@Inject CheckPointManager _checkPointMgr;
|
@Inject CheckPointManager _checkPointMgr;
|
||||||
@Inject VirtualNetworkApplianceManager _routerMgr;
|
|
||||||
@Inject SecondaryStorageVmManager _ssvmMgr;
|
@Inject SecondaryStorageVmManager _ssvmMgr;
|
||||||
@Inject CiscoNexusVSMDeviceDao _nexusDao;
|
@Inject CiscoNexusVSMDeviceDao _nexusDao;
|
||||||
@Inject ClusterVSMMapDao _vsmMapDao;
|
@Inject ClusterVSMMapDao _vsmMapDao;
|
||||||
|
|||||||
@ -93,10 +93,10 @@ import com.cloud.network.dao.VirtualRouterProviderDao;
|
|||||||
import com.cloud.network.lb.LoadBalancingRule.LbDestination;
|
import com.cloud.network.lb.LoadBalancingRule.LbDestination;
|
||||||
import com.cloud.network.lb.LoadBalancingRule.LbStickinessPolicy;
|
import com.cloud.network.lb.LoadBalancingRule.LbStickinessPolicy;
|
||||||
import com.cloud.network.lb.dao.ElasticLbVmMapDao;
|
import com.cloud.network.lb.dao.ElasticLbVmMapDao;
|
||||||
import com.cloud.network.router.VirtualNetworkApplianceManager;
|
|
||||||
import com.cloud.network.router.VirtualRouter;
|
import com.cloud.network.router.VirtualRouter;
|
||||||
import com.cloud.network.router.VirtualRouter.RedundantState;
|
import com.cloud.network.router.VirtualRouter.RedundantState;
|
||||||
import com.cloud.network.router.VirtualRouter.Role;
|
import com.cloud.network.router.VirtualRouter.Role;
|
||||||
|
import com.cloud.network.router.VpcVirtualNetworkApplianceManager;
|
||||||
import com.cloud.network.rules.FirewallRule;
|
import com.cloud.network.rules.FirewallRule;
|
||||||
import com.cloud.network.rules.FirewallRule.Purpose;
|
import com.cloud.network.rules.FirewallRule.Purpose;
|
||||||
import com.cloud.network.rules.LoadBalancer;
|
import com.cloud.network.rules.LoadBalancer;
|
||||||
@ -153,7 +153,7 @@ public class ElasticLoadBalancerManagerImpl implements
|
|||||||
@Inject
|
@Inject
|
||||||
LoadBalancingRulesManager _lbMgr;
|
LoadBalancingRulesManager _lbMgr;
|
||||||
@Inject
|
@Inject
|
||||||
VirtualNetworkApplianceManager _routerMgr;
|
VpcVirtualNetworkApplianceManager _routerMgr;
|
||||||
@Inject
|
@Inject
|
||||||
DomainRouterDao _routerDao = null;
|
DomainRouterDao _routerDao = null;
|
||||||
@Inject
|
@Inject
|
||||||
|
|||||||
@ -25,7 +25,7 @@ import com.cloud.consoleproxy.ConsoleProxyManager;
|
|||||||
import com.cloud.ha.HighAvailabilityManager;
|
import com.cloud.ha.HighAvailabilityManager;
|
||||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
import com.cloud.network.NetworkManager;
|
import com.cloud.network.NetworkManager;
|
||||||
import com.cloud.network.router.VirtualNetworkApplianceManager;
|
import com.cloud.network.router.VpcVirtualNetworkApplianceManager;
|
||||||
import com.cloud.server.ManagementServer;
|
import com.cloud.server.ManagementServer;
|
||||||
import com.cloud.storage.StorageManager;
|
import com.cloud.storage.StorageManager;
|
||||||
import com.cloud.storage.allocator.StoragePoolAllocator;
|
import com.cloud.storage.allocator.StoragePoolAllocator;
|
||||||
@ -159,7 +159,7 @@ public enum Config {
|
|||||||
PingTimeout("Advanced", AgentManager.class, Float.class, "ping.timeout", "2.5", "Multiplier to ping.interval before announcing an agent has timed out", null),
|
PingTimeout("Advanced", AgentManager.class, Float.class, "ping.timeout", "2.5", "Multiplier to ping.interval before announcing an agent has timed out", null),
|
||||||
ClusterDeltaSyncInterval("Advanced", AgentManager.class, Integer.class, "sync.interval", "60", "Cluster Delta sync interval in seconds", null),
|
ClusterDeltaSyncInterval("Advanced", AgentManager.class, Integer.class, "sync.interval", "60", "Cluster Delta sync interval in seconds", null),
|
||||||
Port("Advanced", AgentManager.class, Integer.class, "port", "8250", "Port to listen on for agent connection.", null),
|
Port("Advanced", AgentManager.class, Integer.class, "port", "8250", "Port to listen on for agent connection.", null),
|
||||||
RouterCpuMHz("Advanced", NetworkManager.class, Integer.class, "router.cpu.mhz", String.valueOf(VirtualNetworkApplianceManager.DEFAULT_ROUTER_CPU_MHZ), "Default CPU speed (MHz) for router VM.", null),
|
RouterCpuMHz("Advanced", NetworkManager.class, Integer.class, "router.cpu.mhz", String.valueOf(VpcVirtualNetworkApplianceManager.DEFAULT_ROUTER_CPU_MHZ), "Default CPU speed (MHz) for router VM.", null),
|
||||||
RestartRetryInterval("Advanced", HighAvailabilityManager.class, Integer.class, "restart.retry.interval", "600", "Time (in seconds) between retries to restart a vm", null),
|
RestartRetryInterval("Advanced", HighAvailabilityManager.class, Integer.class, "restart.retry.interval", "600", "Time (in seconds) between retries to restart a vm", null),
|
||||||
RouterStatsInterval("Advanced", NetworkManager.class, Integer.class, "router.stats.interval", "300", "Interval (in seconds) to report router statistics.", null),
|
RouterStatsInterval("Advanced", NetworkManager.class, Integer.class, "router.stats.interval", "300", "Interval (in seconds) to report router statistics.", null),
|
||||||
ExternalNetworkStatsInterval("Advanced", NetworkManager.class, Integer.class, "external.network.stats.interval", "300", "Interval (in seconds) to report external network statistics.", null),
|
ExternalNetworkStatsInterval("Advanced", NetworkManager.class, Integer.class, "external.network.stats.interval", "300", "Interval (in seconds) to report external network statistics.", null),
|
||||||
|
|||||||
@ -104,7 +104,6 @@ import com.cloud.network.element.VirtualRouterElement;
|
|||||||
import com.cloud.network.element.VirtualRouterElementService;
|
import com.cloud.network.element.VirtualRouterElementService;
|
||||||
import com.cloud.network.firewall.FirewallManagerImpl;
|
import com.cloud.network.firewall.FirewallManagerImpl;
|
||||||
import com.cloud.network.lb.LoadBalancingRulesManagerImpl;
|
import com.cloud.network.lb.LoadBalancingRulesManagerImpl;
|
||||||
import com.cloud.network.router.VirtualNetworkApplianceManagerImpl;
|
|
||||||
import com.cloud.network.router.VpcVirtualNetworkApplianceManagerImpl;
|
import com.cloud.network.router.VpcVirtualNetworkApplianceManagerImpl;
|
||||||
import com.cloud.network.rules.RulesManagerImpl;
|
import com.cloud.network.rules.RulesManagerImpl;
|
||||||
import com.cloud.network.rules.dao.PortForwardingRulesDaoImpl;
|
import com.cloud.network.rules.dao.PortForwardingRulesDaoImpl;
|
||||||
@ -373,7 +372,6 @@ public class DefaultComponentLibrary extends ComponentLibraryBase implements Com
|
|||||||
addManager("Snapshot Manager", SnapshotManagerImpl.class);
|
addManager("Snapshot Manager", SnapshotManagerImpl.class);
|
||||||
addManager("SnapshotScheduler", SnapshotSchedulerImpl.class);
|
addManager("SnapshotScheduler", SnapshotSchedulerImpl.class);
|
||||||
addManager("SecurityGroupManager", SecurityGroupManagerImpl2.class);
|
addManager("SecurityGroupManager", SecurityGroupManagerImpl2.class);
|
||||||
addManager("DomainRouterManager", VirtualNetworkApplianceManagerImpl.class);
|
|
||||||
addManager("EntityManager", EntityManagerImpl.class);
|
addManager("EntityManager", EntityManagerImpl.class);
|
||||||
addManager("LoadBalancingRulesManager", LoadBalancingRulesManagerImpl.class);
|
addManager("LoadBalancingRulesManager", LoadBalancingRulesManagerImpl.class);
|
||||||
addManager("RulesManager", RulesManagerImpl.class);
|
addManager("RulesManager", RulesManagerImpl.class);
|
||||||
|
|||||||
@ -33,8 +33,8 @@ import com.cloud.host.Status;
|
|||||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
import com.cloud.network.NetworkManager;
|
import com.cloud.network.NetworkManager;
|
||||||
import com.cloud.network.Networks.TrafficType;
|
import com.cloud.network.Networks.TrafficType;
|
||||||
import com.cloud.network.router.VirtualNetworkApplianceManager;
|
|
||||||
import com.cloud.network.router.VirtualRouter;
|
import com.cloud.network.router.VirtualRouter;
|
||||||
|
import com.cloud.network.router.VpcVirtualNetworkApplianceManager;
|
||||||
import com.cloud.utils.component.Inject;
|
import com.cloud.utils.component.Inject;
|
||||||
import com.cloud.vm.Nic;
|
import com.cloud.vm.Nic;
|
||||||
import com.cloud.vm.UserVmVO;
|
import com.cloud.vm.UserVmVO;
|
||||||
@ -50,9 +50,9 @@ public class UserVmDomRInvestigator extends AbstractInvestigatorImpl {
|
|||||||
@Inject private final UserVmDao _userVmDao = null;
|
@Inject private final UserVmDao _userVmDao = null;
|
||||||
@Inject private final AgentManager _agentMgr = null;
|
@Inject private final AgentManager _agentMgr = null;
|
||||||
@Inject private final NetworkManager _networkMgr = null;
|
@Inject private final NetworkManager _networkMgr = null;
|
||||||
@Inject private final VirtualNetworkApplianceManager _vnaMgr = null;
|
@Inject private final VpcVirtualNetworkApplianceManager _vnaMgr = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean isVmAlive(VMInstanceVO vm, HostVO host) {
|
public Boolean isVmAlive(VMInstanceVO vm, HostVO host) {
|
||||||
if (vm.getType() != VirtualMachine.Type.User) {
|
if (vm.getType() != VirtualMachine.Type.User) {
|
||||||
if (s_logger.isDebugEnabled()) {
|
if (s_logger.isDebugEnabled()) {
|
||||||
|
|||||||
@ -16,9 +16,6 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.network;
|
package com.cloud.network;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.agent.AgentManager;
|
import com.cloud.agent.AgentManager;
|
||||||
@ -38,8 +35,6 @@ import com.cloud.host.HostVO;
|
|||||||
import com.cloud.host.Status;
|
import com.cloud.host.Status;
|
||||||
import com.cloud.host.dao.HostDao;
|
import com.cloud.host.dao.HostDao;
|
||||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
import com.cloud.network.router.VirtualNetworkApplianceManager;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class SshKeysDistriMonitor implements Listener {
|
public class SshKeysDistriMonitor implements Listener {
|
||||||
|
|||||||
@ -47,7 +47,6 @@ import com.cloud.network.NetworkManager;
|
|||||||
import com.cloud.network.Networks.TrafficType;
|
import com.cloud.network.Networks.TrafficType;
|
||||||
import com.cloud.network.PhysicalNetworkServiceProvider;
|
import com.cloud.network.PhysicalNetworkServiceProvider;
|
||||||
import com.cloud.network.dao.NetworkDao;
|
import com.cloud.network.dao.NetworkDao;
|
||||||
import com.cloud.network.router.VirtualNetworkApplianceManager;
|
|
||||||
import com.cloud.offering.NetworkOffering;
|
import com.cloud.offering.NetworkOffering;
|
||||||
import com.cloud.service.dao.ServiceOfferingDao;
|
import com.cloud.service.dao.ServiceOfferingDao;
|
||||||
import com.cloud.uservm.UserVm;
|
import com.cloud.uservm.UserVm;
|
||||||
@ -74,8 +73,6 @@ public class CloudZonesNetworkElement extends AdapterBase implements NetworkElem
|
|||||||
@Inject
|
@Inject
|
||||||
NetworkManager _networkMgr;
|
NetworkManager _networkMgr;
|
||||||
@Inject
|
@Inject
|
||||||
VirtualNetworkApplianceManager _routerMgr;
|
|
||||||
@Inject
|
|
||||||
UserVmManager _userVmMgr;
|
UserVmManager _userVmMgr;
|
||||||
@Inject
|
@Inject
|
||||||
UserVmDao _userVmDao;
|
UserVmDao _userVmDao;
|
||||||
|
|||||||
@ -57,8 +57,8 @@ import com.cloud.network.dao.VirtualRouterProviderDao;
|
|||||||
import com.cloud.network.lb.LoadBalancingRule;
|
import com.cloud.network.lb.LoadBalancingRule;
|
||||||
import com.cloud.network.lb.LoadBalancingRule.LbStickinessPolicy;
|
import com.cloud.network.lb.LoadBalancingRule.LbStickinessPolicy;
|
||||||
import com.cloud.network.lb.LoadBalancingRulesManager;
|
import com.cloud.network.lb.LoadBalancingRulesManager;
|
||||||
import com.cloud.network.router.VirtualNetworkApplianceManager;
|
|
||||||
import com.cloud.network.router.VirtualRouter.Role;
|
import com.cloud.network.router.VirtualRouter.Role;
|
||||||
|
import com.cloud.network.router.VpcVirtualNetworkApplianceManager;
|
||||||
import com.cloud.network.rules.FirewallRule;
|
import com.cloud.network.rules.FirewallRule;
|
||||||
import com.cloud.network.rules.LbStickinessMethod;
|
import com.cloud.network.rules.LbStickinessMethod;
|
||||||
import com.cloud.network.rules.LbStickinessMethod.StickinessMethodType;
|
import com.cloud.network.rules.LbStickinessMethod.StickinessMethodType;
|
||||||
@ -105,7 +105,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
|
|||||||
@Inject
|
@Inject
|
||||||
NetworkOfferingDao _networkOfferingDao;
|
NetworkOfferingDao _networkOfferingDao;
|
||||||
@Inject
|
@Inject
|
||||||
VirtualNetworkApplianceManager _routerMgr;
|
VpcVirtualNetworkApplianceManager _routerMgr;
|
||||||
@Inject
|
@Inject
|
||||||
ConfigurationManager _configMgr;
|
ConfigurationManager _configMgr;
|
||||||
@Inject
|
@Inject
|
||||||
|
|||||||
@ -123,6 +123,7 @@ import com.cloud.vm.dao.VMInstanceDao;
|
|||||||
public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplianceManagerImpl implements VpcVirtualNetworkApplianceManager{
|
public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplianceManagerImpl implements VpcVirtualNetworkApplianceManager{
|
||||||
private static final Logger s_logger = Logger.getLogger(VpcVirtualNetworkApplianceManagerImpl.class);
|
private static final Logger s_logger = Logger.getLogger(VpcVirtualNetworkApplianceManagerImpl.class);
|
||||||
|
|
||||||
|
String _name;
|
||||||
@Inject
|
@Inject
|
||||||
VpcDao _vpcDao;
|
VpcDao _vpcDao;
|
||||||
@Inject
|
@Inject
|
||||||
@ -1318,4 +1319,5 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
|
|||||||
_s2sVpnMgr.markDisconnectVpnConnByVpc(vpcId);
|
_s2sVpnMgr.markDisconnectVpnConnByVpc(vpcId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,7 +53,6 @@ import com.cloud.network.dao.IPAddressDao;
|
|||||||
import com.cloud.network.dao.RemoteAccessVpnDao;
|
import com.cloud.network.dao.RemoteAccessVpnDao;
|
||||||
import com.cloud.network.dao.VpnUserDao;
|
import com.cloud.network.dao.VpnUserDao;
|
||||||
import com.cloud.network.element.RemoteAccessVPNServiceProvider;
|
import com.cloud.network.element.RemoteAccessVPNServiceProvider;
|
||||||
import com.cloud.network.router.VirtualNetworkApplianceManager;
|
|
||||||
import com.cloud.network.rules.FirewallManager;
|
import com.cloud.network.rules.FirewallManager;
|
||||||
import com.cloud.network.rules.FirewallRule;
|
import com.cloud.network.rules.FirewallRule;
|
||||||
import com.cloud.network.rules.FirewallRule.Purpose;
|
import com.cloud.network.rules.FirewallRule.Purpose;
|
||||||
@ -90,7 +89,6 @@ public class RemoteAccessVpnManagerImpl implements RemoteAccessVpnService, Manag
|
|||||||
@Inject VpnUserDao _vpnUsersDao;
|
@Inject VpnUserDao _vpnUsersDao;
|
||||||
@Inject RemoteAccessVpnDao _remoteAccessVpnDao;
|
@Inject RemoteAccessVpnDao _remoteAccessVpnDao;
|
||||||
@Inject IPAddressDao _ipAddressDao;
|
@Inject IPAddressDao _ipAddressDao;
|
||||||
@Inject VirtualNetworkApplianceManager _routerMgr;
|
|
||||||
@Inject AccountManager _accountMgr;
|
@Inject AccountManager _accountMgr;
|
||||||
@Inject DomainManager _domainMgr;
|
@Inject DomainManager _domainMgr;
|
||||||
@Inject NetworkManager _networkMgr;
|
@Inject NetworkManager _networkMgr;
|
||||||
|
|||||||
@ -126,7 +126,6 @@ import com.cloud.host.dao.HostDao;
|
|||||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
import com.cloud.hypervisor.HypervisorGuruManager;
|
import com.cloud.hypervisor.HypervisorGuruManager;
|
||||||
import com.cloud.network.NetworkManager;
|
import com.cloud.network.NetworkManager;
|
||||||
import com.cloud.network.router.VirtualNetworkApplianceManager;
|
|
||||||
import com.cloud.org.Grouping;
|
import com.cloud.org.Grouping;
|
||||||
import com.cloud.org.Grouping.AllocationState;
|
import com.cloud.org.Grouping.AllocationState;
|
||||||
import com.cloud.projects.Project.ListProjectResourcesCriteria;
|
import com.cloud.projects.Project.ListProjectResourcesCriteria;
|
||||||
@ -300,8 +299,6 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag
|
|||||||
@Inject
|
@Inject
|
||||||
protected ClusterDao _clusterDao;
|
protected ClusterDao _clusterDao;
|
||||||
@Inject
|
@Inject
|
||||||
protected VirtualNetworkApplianceManager _routerMgr;
|
|
||||||
@Inject
|
|
||||||
protected UsageEventDao _usageEventDao;
|
protected UsageEventDao _usageEventDao;
|
||||||
@Inject
|
@Inject
|
||||||
protected VirtualMachineManager _vmMgr;
|
protected VirtualMachineManager _vmMgr;
|
||||||
|
|||||||
@ -41,7 +41,7 @@ import com.cloud.consoleproxy.ConsoleProxyManager;
|
|||||||
import com.cloud.event.EventTypes;
|
import com.cloud.event.EventTypes;
|
||||||
import com.cloud.event.EventVO;
|
import com.cloud.event.EventVO;
|
||||||
import com.cloud.event.UsageEventVO;
|
import com.cloud.event.UsageEventVO;
|
||||||
import com.cloud.network.router.VirtualNetworkApplianceManager;
|
import com.cloud.network.router.VpcVirtualNetworkApplianceManager;
|
||||||
import com.cloud.storage.secondary.SecondaryStorageVmManager;
|
import com.cloud.storage.secondary.SecondaryStorageVmManager;
|
||||||
import com.cloud.utils.DateUtil;
|
import com.cloud.utils.DateUtil;
|
||||||
import com.cloud.utils.NumbersUtil;
|
import com.cloud.utils.NumbersUtil;
|
||||||
@ -1408,7 +1408,7 @@ public class Upgrade218to22 implements DbUpgrade {
|
|||||||
pstmt.close();
|
pstmt.close();
|
||||||
|
|
||||||
int proxyRamSize = NumbersUtil.parseInt(getConfigValue(conn, "consoleproxy.ram.size"), ConsoleProxyManager.DEFAULT_PROXY_VM_RAMSIZE);
|
int proxyRamSize = NumbersUtil.parseInt(getConfigValue(conn, "consoleproxy.ram.size"), ConsoleProxyManager.DEFAULT_PROXY_VM_RAMSIZE);
|
||||||
int domrRamSize = NumbersUtil.parseInt(getConfigValue(conn, "router.ram.size"), VirtualNetworkApplianceManager.DEFAULT_ROUTER_VM_RAMSIZE);
|
int domrRamSize = NumbersUtil.parseInt(getConfigValue(conn, "router.ram.size"), VpcVirtualNetworkApplianceManager.DEFAULT_ROUTER_VM_RAMSIZE);
|
||||||
int ssvmRamSize = NumbersUtil.parseInt(getConfigValue(conn, "secstorage.vm.ram.size"), SecondaryStorageVmManager.DEFAULT_SS_VM_RAMSIZE);
|
int ssvmRamSize = NumbersUtil.parseInt(getConfigValue(conn, "secstorage.vm.ram.size"), SecondaryStorageVmManager.DEFAULT_SS_VM_RAMSIZE);
|
||||||
|
|
||||||
pstmt = conn
|
pstmt = conn
|
||||||
@ -1567,7 +1567,7 @@ public class Upgrade218to22 implements DbUpgrade {
|
|||||||
pstmt.close();
|
pstmt.close();
|
||||||
|
|
||||||
int proxyCpuMhz = NumbersUtil.parseInt(getConfigValue(conn, "consoleproxy.cpu.mhz"), ConsoleProxyManager.DEFAULT_PROXY_VM_CPUMHZ);
|
int proxyCpuMhz = NumbersUtil.parseInt(getConfigValue(conn, "consoleproxy.cpu.mhz"), ConsoleProxyManager.DEFAULT_PROXY_VM_CPUMHZ);
|
||||||
int domrCpuMhz = NumbersUtil.parseInt(getConfigValue(conn, "router.cpu.mhz"), VirtualNetworkApplianceManager.DEFAULT_ROUTER_CPU_MHZ);
|
int domrCpuMhz = NumbersUtil.parseInt(getConfigValue(conn, "router.cpu.mhz"), VpcVirtualNetworkApplianceManager.DEFAULT_ROUTER_CPU_MHZ);
|
||||||
int ssvmCpuMhz = NumbersUtil.parseInt(getConfigValue(conn, "secstorage.vm.cpu.mhz"), SecondaryStorageVmManager.DEFAULT_SS_VM_CPUMHZ);
|
int ssvmCpuMhz = NumbersUtil.parseInt(getConfigValue(conn, "secstorage.vm.cpu.mhz"), SecondaryStorageVmManager.DEFAULT_SS_VM_CPUMHZ);
|
||||||
|
|
||||||
pstmt = conn
|
pstmt = conn
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user