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
@ -42,44 +42,58 @@ public interface SecurityChecker extends Adapter {
|
||||
ModifyProject,
|
||||
UseNetwork
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the account owns the object.
|
||||
*
|
||||
* @param caller account to check against.
|
||||
* @param object object that the account is trying to access.
|
||||
* @param caller
|
||||
* account to check against.
|
||||
* @param object
|
||||
* object that the account is trying to access.
|
||||
* @return true if access allowed. false if this adapter cannot authenticate ownership.
|
||||
* @throws PermissionDeniedException if this adapter is suppose to authenticate ownership and the check failed.
|
||||
* @throws PermissionDeniedException
|
||||
* if this adapter is suppose to authenticate ownership and the check failed.
|
||||
*/
|
||||
boolean checkAccess(Account caller, Domain domain) throws PermissionDeniedException;
|
||||
|
||||
/**
|
||||
* Checks if the user belongs to an account that owns the object.
|
||||
*
|
||||
* @param user user to check against.
|
||||
* @param object object that the account is trying to access.
|
||||
* @param user
|
||||
* user to check against.
|
||||
* @param object
|
||||
* object that the account is trying to access.
|
||||
* @return true if access allowed. false if this adapter cannot authenticate ownership.
|
||||
* @throws PermissionDeniedException if this adapter is suppose to authenticate ownership and the check failed.
|
||||
* @throws PermissionDeniedException
|
||||
* if this adapter is suppose to authenticate ownership and the check failed.
|
||||
*/
|
||||
boolean checkAccess(User user, Domain domain) throws PermissionDeniedException;
|
||||
|
||||
/**
|
||||
* Checks if the account can access the object.
|
||||
*
|
||||
* @param caller account to check against.
|
||||
* @param entity object that the account is trying to access.
|
||||
* @param accessType TODO
|
||||
* @param caller
|
||||
* account to check against.
|
||||
* @param entity
|
||||
* object that the account is trying to access.
|
||||
* @param accessType
|
||||
* TODO
|
||||
* @return true if access allowed. false if this adapter cannot provide permission.
|
||||
* @throws PermissionDeniedException if this adapter is suppose to authenticate ownership and the check failed.
|
||||
* @throws PermissionDeniedException
|
||||
* if this adapter is suppose to authenticate ownership and the check failed.
|
||||
*/
|
||||
boolean checkAccess(Account caller, ControlledEntity entity, AccessType accessType) throws PermissionDeniedException;
|
||||
|
||||
/**
|
||||
* Checks if the user belongs to an account that can access the object.
|
||||
*
|
||||
* @param user user to check against.
|
||||
* @param entity object that the account is trying to access.
|
||||
* @param user
|
||||
* user to check against.
|
||||
* @param entity
|
||||
* object that the account is trying to access.
|
||||
* @return true if access allowed. false if this adapter cannot authenticate ownership.
|
||||
* @throws PermissionDeniedException if this adapter is suppose to authenticate ownership and the check failed.
|
||||
* @throws PermissionDeniedException
|
||||
* if this adapter is suppose to authenticate ownership and the check failed.
|
||||
*/
|
||||
boolean checkAccess(User user, ControlledEntity entity) throws PermissionDeniedException;
|
||||
|
||||
|
||||
@ -32,7 +32,6 @@ public abstract class BaseAsyncCmd extends BaseCmd {
|
||||
public static final String ipAddressSyncObject = "ipaddress";
|
||||
public static final String networkSyncObject = "network";
|
||||
|
||||
|
||||
private AsyncJob job;
|
||||
|
||||
@Parameter(name = "starteventid", type = CommandType.LONG)
|
||||
@ -42,6 +41,7 @@ public abstract class BaseAsyncCmd extends BaseCmd {
|
||||
* 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,
|
||||
* started, and completed events are saved to the events table, they have the proper type information.
|
||||
*
|
||||
* @return a string representing the type of event, e.g. VM.START, VOLUME.CREATE.
|
||||
*/
|
||||
public abstract String getEventType();
|
||||
@ -50,6 +50,7 @@ public abstract class BaseAsyncCmd extends BaseCmd {
|
||||
* 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
|
||||
* the scheduled, started, and completed events are saved to the events table, they have a meaningful description.
|
||||
*
|
||||
* @return a string representing a description of the event
|
||||
*/
|
||||
public abstract String getEventDescription();
|
||||
@ -130,4 +131,5 @@ public abstract class BaseAsyncCmd extends BaseCmd {
|
||||
}
|
||||
return _mgr.saveCompletedEvent((userId == null) ? User.UID_SYSTEM : userId, getEntityOwnerId(), level, eventType, description, startEvent);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -53,4 +53,5 @@ public abstract class BaseAsyncCreateCmd extends BaseAsyncCmd {
|
||||
public String getCreateEventDescription() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -28,7 +28,6 @@ import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.response.TrafficTypeImplementorResponse;
|
||||
import com.cloud.configuration.ConfigurationService;
|
||||
import com.cloud.consoleproxy.ConsoleProxyService;
|
||||
import com.cloud.dao.EntityManager;
|
||||
@ -177,6 +176,7 @@ public abstract class BaseCmd {
|
||||
/**
|
||||
* For commands the API framework needs to know the owner of the object being acted upon. This method is
|
||||
* used to determine that information.
|
||||
*
|
||||
* @return the id of the account that owns the object being acted upon
|
||||
*/
|
||||
public abstract long getEntityOwnerId();
|
||||
@ -208,7 +208,8 @@ public abstract class BaseCmd {
|
||||
int arrayStartIndex = key.indexOf('[');
|
||||
int arrayStartLastIndex = key.lastIndexOf('[');
|
||||
if (arrayStartIndex != arrayStartLastIndex) {
|
||||
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
|
||||
+ "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||
}
|
||||
|
||||
if (arrayStartIndex > 0) {
|
||||
@ -216,14 +217,16 @@ public abstract class BaseCmd {
|
||||
int arrayEndLastIndex = key.lastIndexOf(']');
|
||||
if ((arrayEndIndex < arrayStartIndex) || (arrayEndIndex != arrayEndLastIndex)) {
|
||||
// malformed parameter
|
||||
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
|
||||
+ "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||
}
|
||||
|
||||
// Now that we have an array object, check for a field name in the case of a complex object
|
||||
int fieldIndex = key.indexOf('.');
|
||||
String fieldName = null;
|
||||
if (fieldIndex < arrayEndIndex) {
|
||||
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
|
||||
+ "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||
} else {
|
||||
fieldName = key.substring(fieldIndex + 1);
|
||||
}
|
||||
@ -247,7 +250,8 @@ public abstract class BaseCmd {
|
||||
}
|
||||
|
||||
if (!parsedIndex) {
|
||||
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
|
||||
+ "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||
}
|
||||
|
||||
Object value = lowercaseParams.get(paramName);
|
||||
@ -320,7 +324,8 @@ public abstract class BaseCmd {
|
||||
}
|
||||
|
||||
if (suffixSb.length() > 0) {
|
||||
if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)){ // append comma only if we have some suffix else not as per strict Json syntax.
|
||||
if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) { // append comma only if we have some suffix else
|
||||
// not as per strict Json syntax.
|
||||
prefixSb.append(",");
|
||||
}
|
||||
prefixSb.append(suffixSb);
|
||||
@ -449,8 +454,7 @@ public abstract class BaseCmd {
|
||||
public static boolean isAdmin(short accountType) {
|
||||
return ((accountType == Account.ACCOUNT_TYPE_ADMIN) ||
|
||||
(accountType == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN) ||
|
||||
(accountType == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) ||
|
||||
(accountType == Account.ACCOUNT_TYPE_READ_ONLY_ADMIN));
|
||||
(accountType == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) || (accountType == Account.ACCOUNT_TYPE_READ_ONLY_ADMIN));
|
||||
}
|
||||
|
||||
public static boolean isRootAdmin(short accountType) {
|
||||
|
||||
@ -23,7 +23,6 @@ public abstract class BaseListAccountResourcesCmd extends BaseListDomainResource
|
||||
@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "List resources by account. Must be used with the domainId parameter.")
|
||||
private String accountName;
|
||||
|
||||
|
||||
public String getAccountName() {
|
||||
return accountName;
|
||||
}
|
||||
|
||||
@ -40,8 +40,6 @@ public abstract class BaseListCmd extends BaseCmd {
|
||||
@Parameter(name = ApiConstants.PAGE_SIZE, type = CommandType.INTEGER)
|
||||
private Integer pageSize;
|
||||
|
||||
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////////// Accessors ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@ -44,4 +44,3 @@ public class IdentityProxy {
|
||||
_value = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -19,6 +19,8 @@ package com.cloud.api;
|
||||
|
||||
public interface IdentityService {
|
||||
Long getIdentityId(IdentityMapper mapper, String identityString);
|
||||
|
||||
Long getIdentityId(String tableName, String identityString);
|
||||
|
||||
String getIdentityUuid(String tableName, String identityString);
|
||||
}
|
||||
|
||||
@ -28,8 +28,12 @@ import java.lang.annotation.Target;
|
||||
@Target({ TYPE })
|
||||
public @interface Implementation {
|
||||
Class<?> responseObject();
|
||||
|
||||
String description() default "";
|
||||
|
||||
String usage() default "";
|
||||
|
||||
boolean includeInApiDoc() default true;
|
||||
|
||||
String since() default "";
|
||||
}
|
||||
|
||||
@ -30,13 +30,20 @@ import com.cloud.api.BaseCmd.CommandType;
|
||||
@Target({ FIELD })
|
||||
public @interface Parameter {
|
||||
String name() default "";
|
||||
|
||||
String description() default "";
|
||||
|
||||
boolean required() default false;
|
||||
|
||||
CommandType type() default CommandType.OBJECT;
|
||||
|
||||
CommandType collectionType() default CommandType.OBJECT;
|
||||
|
||||
boolean expose() default true;
|
||||
|
||||
boolean includeInApiDoc() default true;
|
||||
|
||||
int length() default 255;
|
||||
|
||||
String since() default "";
|
||||
}
|
||||
|
||||
|
||||
@ -43,11 +43,9 @@ import com.cloud.api.response.IPAddressResponse;
|
||||
import com.cloud.api.response.InstanceGroupResponse;
|
||||
import com.cloud.api.response.IpForwardingRuleResponse;
|
||||
import com.cloud.api.response.LBStickinessResponse;
|
||||
import com.cloud.api.response.LDAPConfigResponse;
|
||||
import com.cloud.api.response.ListResponse;
|
||||
import com.cloud.api.response.LoadBalancerResponse;
|
||||
import com.cloud.api.response.LBStickinessPolicyResponse;
|
||||
import com.cloud.network.rules.StickinessPolicy;
|
||||
import com.cloud.api.response.LDAPConfigResponse;
|
||||
import com.cloud.api.response.NetworkOfferingResponse;
|
||||
import com.cloud.api.response.NetworkResponse;
|
||||
import com.cloud.api.response.PhysicalNetworkResponse;
|
||||
@ -106,9 +104,10 @@ import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.network.rules.LoadBalancer;
|
||||
import com.cloud.network.rules.PortForwardingRule;
|
||||
import com.cloud.network.rules.StaticNatRule;
|
||||
import com.cloud.network.security.SecurityRule;
|
||||
import com.cloud.network.rules.StickinessPolicy;
|
||||
import com.cloud.network.security.SecurityGroup;
|
||||
import com.cloud.network.security.SecurityGroupRules;
|
||||
import com.cloud.network.security.SecurityRule;
|
||||
import com.cloud.offering.DiskOffering;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
@ -205,6 +204,7 @@ public interface ResponseGenerator {
|
||||
VpnUsersResponse createVpnUserResponse(VpnUser user);
|
||||
|
||||
RemoteAccessVpnResponse createRemoteAccessVpnResponse(RemoteAccessVpn vpn);
|
||||
|
||||
List<TemplateResponse> createTemplateResponses(long templateId, Long zoneId, boolean readyOnly);
|
||||
|
||||
List<TemplateResponse> createTemplateResponses(long templateId, Long snapshotId, Long volumeId, boolean readyOnly);
|
||||
|
||||
@ -21,24 +21,28 @@ package com.cloud.api;
|
||||
public interface ResponseObject {
|
||||
/**
|
||||
* Get the name of the API response
|
||||
*
|
||||
* @return the name of the API response
|
||||
*/
|
||||
String getResponseName();
|
||||
|
||||
/**
|
||||
* Set the name of the API response
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
void setResponseName(String name);
|
||||
|
||||
/**
|
||||
* Get the name of the API object
|
||||
*
|
||||
* @return the name of the API object
|
||||
*/
|
||||
String getObjectName();
|
||||
|
||||
/**
|
||||
* Set the name of the APIobject
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
void setObjectName(String name);
|
||||
@ -50,18 +54,21 @@ public interface ResponseObject {
|
||||
|
||||
/**
|
||||
* Returns the job id
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Long getJobId();
|
||||
|
||||
/**
|
||||
* Sets the job id
|
||||
*
|
||||
* @param jobId
|
||||
*/
|
||||
void setJobId(Long jobId);
|
||||
|
||||
/**
|
||||
* Returns the job status
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Integer getJobStatus();
|
||||
|
||||
@ -36,6 +36,7 @@ public class ServerApiException extends RuntimeException {
|
||||
public int getErrorCode() {
|
||||
return _errorCode;
|
||||
}
|
||||
|
||||
public void setErrorCode(int errorCode) {
|
||||
_errorCode = errorCode;
|
||||
}
|
||||
@ -43,6 +44,7 @@ public class ServerApiException extends RuntimeException {
|
||||
public String getDescription() {
|
||||
return _description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
_description = description;
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
/**
|
||||
|
||||
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
|
||||
*
|
||||
* This software is licensed under the GNU General Public License v3 or later.
|
||||
@ -25,7 +26,6 @@ import com.cloud.api.IdentityMapper;
|
||||
import com.cloud.api.Implementation;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.BaseCmd.CommandType;
|
||||
import com.cloud.api.response.SecurityGroupResponse;
|
||||
import com.cloud.network.security.SecurityGroup;
|
||||
import com.cloud.user.Account;
|
||||
@ -58,7 +58,6 @@ public class CreateSecurityGroupCmd extends BaseCmd {
|
||||
@Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.LONG, description = "Deploy vm for the project")
|
||||
private Long projectId;
|
||||
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////////// Accessors ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
@ -83,7 +82,6 @@ public class CreateSecurityGroupCmd extends BaseCmd {
|
||||
return projectId;
|
||||
}
|
||||
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////// API Implementation///////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
@ -109,7 +107,8 @@ public class CreateSecurityGroupCmd extends BaseCmd {
|
||||
return account.getId();
|
||||
}
|
||||
|
||||
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
|
||||
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are
|
||||
// tracked
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -40,27 +40,50 @@ public interface AsyncJob extends Identity{
|
||||
}
|
||||
|
||||
Long getId();
|
||||
|
||||
long getUserId();
|
||||
|
||||
long getAccountId();
|
||||
|
||||
String getCmd();
|
||||
|
||||
int getCmdVersion();
|
||||
|
||||
String getCmdInfo();
|
||||
|
||||
int getCallbackType();
|
||||
|
||||
String getCallbackAddress();
|
||||
|
||||
int getStatus();
|
||||
|
||||
int getProcessStatus();
|
||||
|
||||
int getResultCode();
|
||||
|
||||
String getResult();
|
||||
|
||||
Long getInitMsid();
|
||||
|
||||
Long getCompleteMsid();
|
||||
|
||||
Date getCreated();
|
||||
|
||||
Date getLastUpdated();
|
||||
|
||||
Date getLastPolled();
|
||||
|
||||
Date getRemoved();
|
||||
|
||||
Type getInstanceType();
|
||||
|
||||
Long getInstanceId();
|
||||
|
||||
String getSessionKey();
|
||||
|
||||
String getCmdOriginator();
|
||||
|
||||
boolean isFromPreviousSession();
|
||||
|
||||
SyncQueueItem getSyncSource();
|
||||
}
|
||||
|
||||
@ -21,6 +21,6 @@ package com.cloud.async;
|
||||
public interface SyncQueueItem {
|
||||
|
||||
String getContentType();
|
||||
Long getContentId();
|
||||
|
||||
Long getContentId();
|
||||
}
|
||||
|
||||
@ -36,14 +36,19 @@ public interface Capacity {
|
||||
public long getId();
|
||||
|
||||
public Long getHostOrPoolId();
|
||||
|
||||
public long getDataCenterId();
|
||||
|
||||
public Long getPodId();
|
||||
|
||||
public Long getClusterId();
|
||||
|
||||
public long getUsedCapacity();
|
||||
|
||||
public long getTotalCapacity();
|
||||
|
||||
public short getCapacityType();
|
||||
|
||||
long getReservedCapacity();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -16,18 +16,17 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
package com.cloud.cluster;
|
||||
|
||||
|
||||
public interface ManagementServerHost {
|
||||
|
||||
public static enum State { Up, Starting, Down };
|
||||
public static enum State {
|
||||
Up, Starting, Down
|
||||
};
|
||||
|
||||
long getMsid();
|
||||
|
||||
State getState();
|
||||
|
||||
String getVersion();
|
||||
|
||||
}
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
|
||||
package com.cloud.configuration;
|
||||
|
||||
|
||||
public interface Configuration {
|
||||
|
||||
public String getCategory();
|
||||
@ -33,5 +32,4 @@ public interface Configuration{
|
||||
|
||||
public String getDescription();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -68,7 +68,8 @@ public interface ConfigurationService {
|
||||
* Create a service offering through the API
|
||||
*
|
||||
* @param cmd
|
||||
* the command object that specifies the name, number of cpu cores, amount of RAM, etc. for the service offering
|
||||
* the command object that specifies the name, number of cpu cores, amount of RAM, etc. for the service
|
||||
* offering
|
||||
* @return the newly created service offering if successful, null otherwise
|
||||
*/
|
||||
ServiceOffering createServiceOffering(CreateServiceOfferingCmd cmd);
|
||||
@ -130,13 +131,21 @@ public interface ConfigurationService {
|
||||
|
||||
/**
|
||||
* Creates a new pod based on the parameters specified in the command object
|
||||
* @param zoneId TODO
|
||||
* @param name TODO
|
||||
* @param startIp TODO
|
||||
* @param endIp TODO
|
||||
* @param gateway TODO
|
||||
* @param netmask TODO
|
||||
* @param allocationState TODO
|
||||
*
|
||||
* @param zoneId
|
||||
* TODO
|
||||
* @param name
|
||||
* TODO
|
||||
* @param startIp
|
||||
* TODO
|
||||
* @param endIp
|
||||
* TODO
|
||||
* @param gateway
|
||||
* TODO
|
||||
* @param netmask
|
||||
* TODO
|
||||
* @param allocationState
|
||||
* TODO
|
||||
* @return the new pod if successful, null otherwise
|
||||
* @throws
|
||||
* @throws
|
||||
@ -188,12 +197,14 @@ public interface ConfigurationService {
|
||||
boolean deleteZone(DeleteZoneCmd cmd);
|
||||
|
||||
/**
|
||||
* Adds a VLAN to the database, along with an IP address range. Can add three types of VLANs: (1) zone-wide VLANs on the
|
||||
* Adds a VLAN to the database, along with an IP address range. Can add three types of VLANs: (1) zone-wide VLANs on
|
||||
* the
|
||||
* virtual public network (2) pod-wide direct attached VLANs (3) account-specific direct attached VLANs
|
||||
*
|
||||
* @param userId
|
||||
* @param vlanType
|
||||
* - either "DomR" (VLAN for a virtual public network) or "DirectAttached" (VLAN for IPs that will be directly
|
||||
* - either "DomR" (VLAN for a virtual public network) or "DirectAttached" (VLAN for IPs that will be
|
||||
* directly
|
||||
* attached to UserVMs)
|
||||
* @param zoneId
|
||||
* @param accountId
|
||||
|
||||
@ -72,3 +72,4 @@ public interface EntityManager {
|
||||
|
||||
public <T, K extends Serializable> void remove(Class<T> entityType, K id);
|
||||
}
|
||||
|
||||
|
||||
@ -34,28 +34,49 @@ public interface DataCenter extends Grouping {
|
||||
Basic,
|
||||
Advanced,
|
||||
}
|
||||
|
||||
long getId();
|
||||
|
||||
String getDns1();
|
||||
|
||||
String getDns2();
|
||||
|
||||
String getName();
|
||||
|
||||
Long getDomainId();
|
||||
|
||||
String getDescription();
|
||||
|
||||
String getDomain();
|
||||
|
||||
NetworkType getNetworkType();
|
||||
|
||||
String getInternalDns1();
|
||||
|
||||
String getInternalDns2();
|
||||
|
||||
String getDnsProvider();
|
||||
|
||||
String getGatewayProvider();
|
||||
|
||||
String getFirewallProvider();
|
||||
|
||||
String getDhcpProvider();
|
||||
|
||||
String getLoadBalancerProvider();
|
||||
|
||||
String getUserDataProvider();
|
||||
|
||||
String getVpnProvider();
|
||||
|
||||
boolean isSecurityGroupEnabled();
|
||||
|
||||
Map<String, String> getDetails();
|
||||
|
||||
void setDetails(Map<String, String> details);
|
||||
|
||||
AllocationState getAllocationState();
|
||||
|
||||
String getZoneToken();
|
||||
|
||||
}
|
||||
|
||||
@ -22,7 +22,6 @@
|
||||
package com.cloud.dc;
|
||||
|
||||
import com.cloud.org.Grouping;
|
||||
import com.cloud.org.Grouping.AllocationState;
|
||||
|
||||
/**
|
||||
* Represents one pod in the cloud stack.
|
||||
|
||||
@ -43,9 +43,12 @@ public interface DeploymentPlanner extends Adapter {
|
||||
/**
|
||||
* plan is called to determine where a virtual machine should be running.
|
||||
*
|
||||
* @param vm virtual machine.
|
||||
* @param plan deployment plan that tells you where it's being deployed to.
|
||||
* @param avoid avoid these data centers, pods, clusters, or hosts.
|
||||
* @param vm
|
||||
* virtual machine.
|
||||
* @param plan
|
||||
* deployment plan that tells you where it's being deployed to.
|
||||
* @param avoid
|
||||
* avoid these data centers, pods, clusters, or hosts.
|
||||
* @return DeployDestination for that virtual machine.
|
||||
*/
|
||||
DeployDestination plan(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException;
|
||||
@ -54,21 +57,30 @@ public interface DeploymentPlanner extends Adapter {
|
||||
* check() is called right before the virtual machine starts to make sure
|
||||
* the host has enough capacity.
|
||||
*
|
||||
* @param vm virtual machine in question.
|
||||
* @param plan deployment plan used to determined the deploy destination.
|
||||
* @param dest destination returned by plan.
|
||||
* @param avoid what to avoid.
|
||||
* @return true if it's okay to start; false if not. If false, the exclude list will include what should be excluded.
|
||||
* @param vm
|
||||
* virtual machine in question.
|
||||
* @param plan
|
||||
* deployment plan used to determined the deploy destination.
|
||||
* @param dest
|
||||
* destination returned by plan.
|
||||
* @param avoid
|
||||
* what to avoid.
|
||||
* @return true if it's okay to start; false if not. If false, the exclude list will include what should be
|
||||
* excluded.
|
||||
*/
|
||||
boolean check(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, DeployDestination dest, ExcludeList exclude);
|
||||
|
||||
/**
|
||||
* canHandle is called before plan to determine if the plan can do the allocation. Planers should be exclusive so planner writer must
|
||||
* canHandle is called before plan to determine if the plan can do the allocation. Planers should be exclusive so
|
||||
* planner writer must
|
||||
* make sure only one planer->canHandle return true in the planner list
|
||||
*
|
||||
* @param vm virtual machine.
|
||||
* @param plan deployment plan that tells you where it's being deployed to.
|
||||
* @param avoid avoid these data centers, pods, clusters, or hosts.
|
||||
* @param vm
|
||||
* virtual machine.
|
||||
* @param plan
|
||||
* deployment plan that tells you where it's being deployed to.
|
||||
* @param avoid
|
||||
* avoid these data centers, pods, clusters, or hosts.
|
||||
* @return true if it's okay to allocate; false or not
|
||||
*/
|
||||
boolean canHandle(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid);
|
||||
|
||||
@ -31,7 +31,9 @@ import com.cloud.user.OwnedBy;
|
||||
public interface Domain extends OwnedBy {
|
||||
public static final long ROOT_DOMAIN = 1L;
|
||||
|
||||
enum State {Active, Inactive};
|
||||
enum State {
|
||||
Active, Inactive
|
||||
};
|
||||
|
||||
long getId();
|
||||
|
||||
|
||||
@ -28,7 +28,10 @@ import java.lang.annotation.Target;
|
||||
@Retention(RUNTIME)
|
||||
public @interface ActionEvent {
|
||||
boolean create() default false;
|
||||
|
||||
boolean async() default false;
|
||||
|
||||
String eventType();
|
||||
|
||||
String eventDescription();
|
||||
}
|
||||
|
||||
@ -37,5 +37,4 @@ public class AccountLimitException extends CloudRuntimeException {
|
||||
}
|
||||
|
||||
// TODO: Add the actual thing that causes the exception. Is it ip address, vm, etc?
|
||||
|
||||
}
|
||||
|
||||
@ -20,13 +20,10 @@ package com.cloud.exception;
|
||||
|
||||
public class InternalErrorException extends ManagementServerException {
|
||||
|
||||
|
||||
private static final long serialVersionUID = -3070582946175427902L;
|
||||
|
||||
public InternalErrorException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -25,20 +25,14 @@ import com.cloud.utils.SerialVersionUID;
|
||||
*/
|
||||
public class ManagementServerException extends Exception {
|
||||
|
||||
|
||||
private static final long serialVersionUID = SerialVersionUID.ManagementServerException;
|
||||
|
||||
|
||||
public ManagementServerException() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public ManagementServerException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -24,7 +24,6 @@ import com.cloud.network.Networks.BroadcastDomainType;
|
||||
import com.cloud.network.Networks.Mode;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
|
||||
|
||||
public class NetworkProfile implements Network {
|
||||
private long id;
|
||||
private long dataCenterId;
|
||||
|
||||
@ -132,4 +132,5 @@ public interface NetworkService {
|
||||
Network getExclusiveGuestNetwork(long zoneId);
|
||||
|
||||
List<Pair<TrafficType, String>> listTrafficTypeImplementor(ListTrafficTypeImplementorsCmd cmd);
|
||||
|
||||
}
|
||||
|
||||
@ -161,7 +161,8 @@ public class Networks {
|
||||
|
||||
public <T> URI toUri(T value) {
|
||||
try {
|
||||
//assert(this!=Vlan || value.getClass().isAssignableFrom(Integer.class)) : "Why are you putting non integer into vlan url";
|
||||
// assert(this!=Vlan || value.getClass().isAssignableFrom(Integer.class)) :
|
||||
// "Why are you putting non integer into vlan url";
|
||||
return new URI(scheme + "://" + value.toString());
|
||||
} catch (URISyntaxException e) {
|
||||
throw new CloudRuntimeException("Unable to convert to isolation type URI: " + value);
|
||||
|
||||
@ -25,8 +25,6 @@ import java.util.List;
|
||||
|
||||
import com.cloud.network.Network.Service;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This defines the specifics of a physical network service provider
|
||||
*
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
*/
|
||||
package com.cloud.network;
|
||||
|
||||
|
||||
/**
|
||||
* PhysicalNetworkNames provides the labels to identify per traffic type
|
||||
* the physical networks available to the host .
|
||||
@ -84,5 +83,4 @@ public class PhysicalNetworkSetupInfo {
|
||||
this.mgmtVlan = mgmtVlan;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -23,8 +23,6 @@ package com.cloud.network;
|
||||
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This defines the specifics of a physical network traffic type
|
||||
*
|
||||
|
||||
@ -22,19 +22,22 @@ import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.router.VirtualRouter;
|
||||
import com.cloud.utils.component.PluggableService;
|
||||
|
||||
public interface VirtualNetworkApplianceService {
|
||||
/**
|
||||
* Starts domain router
|
||||
* @param cmd the command specifying router's id
|
||||
*
|
||||
* @param cmd
|
||||
* the command specifying router's id
|
||||
* @return DomainRouter object
|
||||
*/
|
||||
VirtualRouter startRouter(long routerId, boolean reprogramNetwork) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
|
||||
|
||||
/**
|
||||
* Reboots domain router
|
||||
* @param cmd the command specifying router's id
|
||||
*
|
||||
* @param cmd
|
||||
* the command specifying router's id
|
||||
* @return router if successful
|
||||
*/
|
||||
VirtualRouter rebootRouter(long routerId, boolean reprogramNetwork) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
|
||||
@ -43,8 +46,11 @@ public interface VirtualNetworkApplianceService {
|
||||
|
||||
/**
|
||||
* Stops domain router
|
||||
* @param id of the router
|
||||
* @param forced just do it. caller knows best.
|
||||
*
|
||||
* @param id
|
||||
* of the router
|
||||
* @param forced
|
||||
* just do it. caller knows best.
|
||||
* @return router if successful, null otherwise
|
||||
* @throws ResourceUnavailableException
|
||||
* @throws ConcurrentOperationException
|
||||
|
||||
@ -23,8 +23,12 @@ public interface VirtualRouterProvider {
|
||||
VirtualRouter,
|
||||
ElasticLoadBalancerVm
|
||||
}
|
||||
|
||||
public VirtualRouterProviderType getType();
|
||||
|
||||
public long getId();
|
||||
|
||||
public boolean isEnabled();
|
||||
|
||||
public long getNspId();
|
||||
}
|
||||
|
||||
@ -10,11 +10,14 @@ import com.cloud.user.Account;
|
||||
|
||||
public interface FirewallService {
|
||||
FirewallRule createFirewallRule(FirewallRule rule) throws NetworkRuleConflictException;
|
||||
|
||||
List<? extends FirewallRule> listFirewallRules(ListFirewallRulesCmd cmd);
|
||||
|
||||
/**
|
||||
* Revokes a firewall rule
|
||||
* @param ruleId the id of the rule to revoke.
|
||||
*
|
||||
* @param ruleId
|
||||
* the id of the rule to revoke.
|
||||
* @return
|
||||
*/
|
||||
boolean revokeFirewallRule(long ruleId, boolean apply);
|
||||
@ -24,4 +27,5 @@ public interface FirewallService {
|
||||
FirewallRule getFirewallRule(long ruleId);
|
||||
|
||||
boolean revokeRelatedFirewallRule(long ruleId, boolean apply);
|
||||
|
||||
}
|
||||
|
||||
@ -18,28 +18,28 @@
|
||||
package com.cloud.network.lb;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.api.commands.CreateLBStickinessPolicyCmd;
|
||||
import com.cloud.api.commands.CreateLoadBalancerRuleCmd;
|
||||
import com.cloud.api.commands.ListLBStickinessPoliciesCmd;
|
||||
|
||||
import com.cloud.api.commands.ListLoadBalancerRuleInstancesCmd;
|
||||
import com.cloud.api.commands.ListLoadBalancerRulesCmd;
|
||||
import com.cloud.api.commands.UpdateLoadBalancerRuleCmd;
|
||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.rules.StickinessPolicy;
|
||||
import com.cloud.network.rules.LoadBalancer;
|
||||
|
||||
|
||||
import com.cloud.network.rules.StickinessPolicy;
|
||||
import com.cloud.uservm.UserVm;
|
||||
|
||||
|
||||
public interface LoadBalancingRulesService {
|
||||
/**
|
||||
* Create a load balancer rule from the given ipAddress/port to the given private port
|
||||
* @param openFirewall TODO
|
||||
* @param cmd the command specifying the ip address, public port, protocol, private port, and algorithm
|
||||
*
|
||||
* @param openFirewall
|
||||
* TODO
|
||||
* @param cmd
|
||||
* the command specifying the ip address, public port, protocol, private port, and algorithm
|
||||
* @return the newly created LoadBalancerVO if successful, null otherwise
|
||||
* @throws InsufficientAddressCapacityException
|
||||
*/
|
||||
@ -48,9 +48,14 @@ public interface LoadBalancingRulesService {
|
||||
LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd);
|
||||
|
||||
boolean deleteLoadBalancerRule(long lbRuleId, boolean apply);
|
||||
|
||||
/**
|
||||
* Create a stickiness policy to a load balancer from the given stickiness method name and parameters in (name,value) pairs.
|
||||
* @param cmd the command specifying the stickiness method name, params (name,value pairs), policy name and description.
|
||||
* Create a stickiness policy to a load balancer from the given stickiness method name and parameters in
|
||||
* (name,value) pairs.
|
||||
*
|
||||
* @param cmd
|
||||
* the command specifying the stickiness method name, params (name,value pairs), policy name and
|
||||
* description.
|
||||
* @return the newly created stickiness policy if successfull, null otherwise
|
||||
* @thows NetworkRuleConflictException
|
||||
*/
|
||||
@ -59,6 +64,7 @@ public interface LoadBalancingRulesService {
|
||||
public boolean applyLBStickinessPolicy(CreateLBStickinessPolicyCmd cmd) throws ResourceUnavailableException;
|
||||
|
||||
boolean deleteLBStickinessPolicy(long stickinessPolicyId);
|
||||
|
||||
/**
|
||||
* Assign a virtual machine, or list of virtual machines, to a load balancer.
|
||||
*/
|
||||
@ -67,8 +73,11 @@ public interface LoadBalancingRulesService {
|
||||
boolean removeFromLoadBalancer(long lbRuleId, List<Long> vmIds);
|
||||
|
||||
boolean applyLoadBalancerConfig(long lbRuleId) throws ResourceUnavailableException;
|
||||
|
||||
/**
|
||||
* List instances that have either been applied to a load balancer or are eligible to be assigned to a load balancer.
|
||||
* List instances that have either been applied to a load balancer or are eligible to be assigned to a load
|
||||
* balancer.
|
||||
*
|
||||
* @param cmd
|
||||
* @return list of vm instances that have been or can be applied to a load balancer
|
||||
*/
|
||||
@ -76,19 +85,24 @@ public interface LoadBalancingRulesService {
|
||||
|
||||
/**
|
||||
* List load balancer rules based on the given criteria
|
||||
* @param cmd the command that specifies the criteria to use for listing load balancers. Load balancers can be listed
|
||||
*
|
||||
* @param cmd
|
||||
* the command that specifies the criteria to use for listing load balancers. Load balancers can be
|
||||
* listed
|
||||
* by id, name, public ip, and vm instance id
|
||||
* @return list of load balancers that match the criteria
|
||||
*/
|
||||
List<? extends LoadBalancer> searchForLoadBalancers(ListLoadBalancerRulesCmd cmd);
|
||||
|
||||
/**
|
||||
* List stickiness policies based on the given criteria
|
||||
* @param cmd the command specifies the load balancing rule id.
|
||||
*
|
||||
* @param cmd
|
||||
* the command specifies the load balancing rule id.
|
||||
* @return list of stickiness policies that match the criteria.
|
||||
*/
|
||||
List<? extends StickinessPolicy> searchForLBStickinessPolicies(ListLBStickinessPoliciesCmd cmd);
|
||||
|
||||
|
||||
List<LoadBalancingRule> listByNetworkId(long networkId);
|
||||
|
||||
LoadBalancer findById(long LoadBalancer);
|
||||
|
||||
@ -31,24 +31,34 @@ public interface RulesService {
|
||||
/**
|
||||
* Creates a port forwarding rule between two ip addresses or between
|
||||
* an ip address and a virtual machine.
|
||||
* @param rule rule to be created.
|
||||
* @param vmId vm to be linked to. If specified the destination ip address is ignored.
|
||||
* @param openFirewall TODO
|
||||
*
|
||||
* @param rule
|
||||
* rule to be created.
|
||||
* @param vmId
|
||||
* vm to be linked to. If specified the destination ip address is ignored.
|
||||
* @param openFirewall
|
||||
* TODO
|
||||
* @return PortForwardingRule if created.
|
||||
* @throws NetworkRuleConflictException if conflicts in the network rules are detected.
|
||||
* @throws NetworkRuleConflictException
|
||||
* if conflicts in the network rules are detected.
|
||||
*/
|
||||
PortForwardingRule createPortForwardingRule(PortForwardingRule rule, Long vmId, boolean openFirewall) throws NetworkRuleConflictException;
|
||||
|
||||
/**
|
||||
* Revokes a port forwarding rule
|
||||
* @param ruleId the id of the rule to revoke.
|
||||
*
|
||||
* @param ruleId
|
||||
* the id of the rule to revoke.
|
||||
* @param caller
|
||||
* @return
|
||||
*/
|
||||
boolean revokePortForwardingRule(long ruleId, boolean apply);
|
||||
|
||||
/**
|
||||
* List port forwarding rules assigned to an ip address
|
||||
* @param cmd the command object holding the criteria for listing port forwarding rules (the ipAddress)
|
||||
*
|
||||
* @param cmd
|
||||
* the command object holding the criteria for listing port forwarding rules (the ipAddress)
|
||||
* @return list of port forwarding rules on the given address, empty list if no rules exist
|
||||
*/
|
||||
public List<? extends PortForwardingRule> listPortForwardingRules(ListPortForwardingRulesCmd cmd);
|
||||
@ -58,6 +68,7 @@ public interface RulesService {
|
||||
boolean enableStaticNat(long ipAddressId, long vmId) throws NetworkRuleConflictException, ResourceUnavailableException;
|
||||
|
||||
PortForwardingRule getPortForwardigRule(long ruleId);
|
||||
|
||||
FirewallRule getFirewallRule(long ruleId);
|
||||
|
||||
StaticNatRule createStaticNatRule(StaticNatRule rule, boolean openFirewall) throws NetworkRuleConflictException;
|
||||
|
||||
@ -21,7 +21,6 @@ import java.util.List;
|
||||
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
|
||||
/**
|
||||
* Definition for a StickinessPolicy
|
||||
*/
|
||||
|
||||
@ -19,7 +19,6 @@ package com.cloud.offering;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a disk offering that specifies what the end user needs in
|
||||
* the disk offering.
|
||||
|
||||
@ -104,4 +104,5 @@ public interface NetworkOffering {
|
||||
boolean getElasticLb();
|
||||
|
||||
boolean getSpecifyIpRanges();
|
||||
|
||||
}
|
||||
|
||||
@ -31,18 +31,21 @@ package com.cloud.offering;
|
||||
public interface OfferingManager {
|
||||
/**
|
||||
* Creates a service offering.
|
||||
*
|
||||
* @return ServiceOffering
|
||||
*/
|
||||
ServiceOffering createServiceOffering();
|
||||
|
||||
/**
|
||||
* Creates a disk offering.
|
||||
*
|
||||
* @return DiskOffering
|
||||
*/
|
||||
DiskOffering createDiskOffering();
|
||||
|
||||
/**
|
||||
* Creates a network offering.
|
||||
*
|
||||
* @return NetworkOffering
|
||||
*/
|
||||
NetworkOffering createNetworkOffering();
|
||||
|
||||
@ -42,7 +42,6 @@ public interface ServiceOffering {
|
||||
*/
|
||||
String getName();
|
||||
|
||||
|
||||
/**
|
||||
* @return is this a system service offering
|
||||
*/
|
||||
|
||||
@ -33,11 +33,16 @@ public interface Cluster extends Grouping {
|
||||
long getId();
|
||||
|
||||
String getName();
|
||||
|
||||
long getDataCenterId();
|
||||
|
||||
long getPodId();
|
||||
|
||||
HypervisorType getHypervisorType();
|
||||
|
||||
ClusterType getClusterType();
|
||||
|
||||
AllocationState getAllocationState();
|
||||
|
||||
ManagedState getManagedState();
|
||||
}
|
||||
|
||||
@ -23,8 +23,13 @@ import com.cloud.api.Identity;
|
||||
import com.cloud.domain.PartOf;
|
||||
|
||||
public interface Project extends PartOf, Identity {
|
||||
public enum State {Active, Disabled, Suspended}
|
||||
public enum ListProjectResourcesCriteria {ListProjectResourcesOnly, SkipProjectResources}
|
||||
public enum State {
|
||||
Active, Disabled, Suspended
|
||||
}
|
||||
|
||||
public enum ListProjectResourcesCriteria {
|
||||
ListProjectResourcesOnly, SkipProjectResources
|
||||
}
|
||||
|
||||
String getDisplayText();
|
||||
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
package com.cloud.projects;
|
||||
|
||||
|
||||
public interface ProjectAccount {
|
||||
public enum Role {Admin, Regular};
|
||||
public enum Role {
|
||||
Admin, Regular
|
||||
};
|
||||
|
||||
long getAccountId();
|
||||
|
||||
|
||||
@ -5,7 +5,9 @@ import java.util.Date;
|
||||
import com.cloud.acl.ControlledEntity;
|
||||
|
||||
public interface ProjectInvitation extends ControlledEntity {
|
||||
public enum State {Pending, Completed, Expired, Declined}
|
||||
public enum State {
|
||||
Pending, Completed, Expired, Declined
|
||||
}
|
||||
|
||||
long getId();
|
||||
|
||||
|
||||
@ -8,15 +8,18 @@ import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.projects.ProjectAccount.Role;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
|
||||
public interface ProjectService {
|
||||
/**
|
||||
* Creates a new project
|
||||
*
|
||||
* @param name - project name
|
||||
* @param displayText - project display text
|
||||
* @param accountName - account name of the project owner
|
||||
* @param domainId - domainid of the project owner
|
||||
* @param name
|
||||
* - project name
|
||||
* @param displayText
|
||||
* - project display text
|
||||
* @param accountName
|
||||
* - account name of the project owner
|
||||
* @param domainId
|
||||
* - domainid of the project owner
|
||||
* @return the project if created successfully, null otherwise
|
||||
* @throws ResourceAllocationException
|
||||
*/
|
||||
@ -25,7 +28,8 @@ public interface ProjectService {
|
||||
/**
|
||||
* Deletes a project
|
||||
*
|
||||
* @param id - project id
|
||||
* @param id
|
||||
* - project id
|
||||
* @return true if the project was deleted successfully, false otherwise
|
||||
*/
|
||||
boolean deleteProject(long id);
|
||||
@ -33,7 +37,8 @@ public interface ProjectService {
|
||||
/**
|
||||
* Gets a project by id
|
||||
*
|
||||
* @param id - project id
|
||||
* @param id
|
||||
* - project id
|
||||
* @return project object
|
||||
*/
|
||||
Project getProject(long id);
|
||||
@ -58,7 +63,8 @@ public interface ProjectService {
|
||||
|
||||
List<? extends ProjectAccount> listProjectAccounts(long projectId, String accountName, String role, Long startIndex, Long pageSizeVal);
|
||||
|
||||
List<? extends ProjectInvitation> listProjectInvitations(Long id, Long projectId, String accountName, Long domainId, String state, boolean activeOnly, Long startIndex, Long pageSizeVal, boolean isRecursive, boolean listAll);
|
||||
List<? extends ProjectInvitation> listProjectInvitations(Long id, Long projectId, String accountName, Long domainId, String state, boolean activeOnly, Long startIndex, Long pageSizeVal, boolean isRecursive,
|
||||
boolean listAll);
|
||||
|
||||
boolean updateInvitation(long projectId, String accountName, String token, boolean accept);
|
||||
|
||||
|
||||
@ -3,7 +3,6 @@ package com.cloud.resource;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.fsm.StateMachine;
|
||||
|
||||
public enum ResourceState {
|
||||
@ -34,6 +33,7 @@ public enum ResourceState {
|
||||
Unmanaged("Umanage a cluster");
|
||||
|
||||
private final String comment;
|
||||
|
||||
private Event(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
@ -24,10 +24,13 @@ import java.lang.annotation.RetentionPolicy;
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Param {
|
||||
String name() default "";
|
||||
|
||||
String propName() default "";
|
||||
|
||||
String description() default "";
|
||||
|
||||
// 2 parameters below are used by cloudstack api
|
||||
Class<?> responseObject() default Object.class;
|
||||
|
||||
boolean includeInApiDoc() default true;
|
||||
}
|
||||
|
||||
@ -100,7 +100,8 @@ public interface ManagementService {
|
||||
static final String Name = "management-server";
|
||||
|
||||
/**
|
||||
* Retrieves the list of data centers with search criteria. Currently the only search criteria is "available" zones for the
|
||||
* Retrieves the list of data centers with search criteria. Currently the only search criteria is "available" zones
|
||||
* for the
|
||||
* account that invokes the API. By specifying available=true all zones which the account can access. By specifying
|
||||
* available=false the zones where the account has virtual machine instances will be returned.
|
||||
*
|
||||
@ -140,7 +141,8 @@ public interface ManagementService {
|
||||
List<? extends Pod> searchForPods(ListPodsByCmd cmd);
|
||||
|
||||
/**
|
||||
* Searches for servers by the specified search criteria Can search by: "name", "type", "state", "dataCenterId", "podId"
|
||||
* Searches for servers by the specified search criteria Can search by: "name", "type", "state", "dataCenterId",
|
||||
* "podId"
|
||||
*
|
||||
* @param cmd
|
||||
* @return List of Hosts
|
||||
@ -158,7 +160,8 @@ public interface ManagementService {
|
||||
VirtualMachineTemplate updateTemplate(UpdateTemplateCmd cmd);
|
||||
|
||||
/**
|
||||
* Obtains a list of events by the specified search criteria. Can search by: "username", "type", "level", "startDate",
|
||||
* Obtains a list of events by the specified search criteria. Can search by: "username", "type", "level",
|
||||
* "startDate",
|
||||
* "endDate"
|
||||
*
|
||||
* @param c
|
||||
@ -167,7 +170,8 @@ public interface ManagementService {
|
||||
List<? extends Event> searchForEvents(ListEventsCmd c);
|
||||
|
||||
/**
|
||||
* Obtains a list of routers by the specified search criteria. Can search by: "userId", "name", "state", "dataCenterId",
|
||||
* Obtains a list of routers by the specified search criteria. Can search by: "userId", "name", "state",
|
||||
* "dataCenterId",
|
||||
* "podId", "hostId"
|
||||
*
|
||||
* @param cmd
|
||||
@ -175,9 +179,9 @@ public interface ManagementService {
|
||||
*/
|
||||
List<? extends VirtualRouter> searchForRouters(ListRoutersCmd cmd);
|
||||
|
||||
|
||||
/**
|
||||
* Obtains a list of IP Addresses by the specified search criteria. Can search by: "userId", "dataCenterId", "address"
|
||||
* Obtains a list of IP Addresses by the specified search criteria. Can search by: "userId", "dataCenterId",
|
||||
* "address"
|
||||
*
|
||||
* @param cmd
|
||||
* the command that wraps the search criteria
|
||||
@ -236,7 +240,8 @@ public interface ManagementService {
|
||||
* List ISOs that match the specified criteria.
|
||||
*
|
||||
* @param cmd
|
||||
* The command that wraps the (optional) templateId, name, keyword, templateFilter, bootable, account, and zoneId
|
||||
* The command that wraps the (optional) templateId, name, keyword, templateFilter, bootable, account,
|
||||
* and zoneId
|
||||
* parameters.
|
||||
* @return list of ISOs
|
||||
*/
|
||||
@ -246,7 +251,8 @@ public interface ManagementService {
|
||||
* List templates that match the specified criteria.
|
||||
*
|
||||
* @param cmd
|
||||
* The command that wraps the (optional) templateId, name, keyword, templateFilter, bootable, account, and zoneId
|
||||
* The command that wraps the (optional) templateId, name, keyword, templateFilter, bootable, account,
|
||||
* and zoneId
|
||||
* parameters.
|
||||
* @return list of ISOs
|
||||
*/
|
||||
@ -300,7 +306,8 @@ public interface ManagementService {
|
||||
* Extracts the volume to a particular location.
|
||||
*
|
||||
* @param cmd
|
||||
* the command specifying url (where the volume needs to be extracted to), zoneId (zone where the volume exists),
|
||||
* the command specifying url (where the volume needs to be extracted to), zoneId (zone where the volume
|
||||
* exists),
|
||||
* id (the id of the volume)
|
||||
* @throws URISyntaxException
|
||||
* @throws InternalErrorException
|
||||
@ -311,7 +318,9 @@ public interface ManagementService {
|
||||
|
||||
/**
|
||||
* return an array of available hypervisors
|
||||
* @param zoneId TODO
|
||||
*
|
||||
* @param zoneId
|
||||
* TODO
|
||||
*
|
||||
* @return an array of available hypervisors in the cloud
|
||||
*/
|
||||
@ -381,7 +390,8 @@ public interface ManagementService {
|
||||
*
|
||||
* @param cmd
|
||||
* The api command class.
|
||||
* @return A VO containing the key pair name, finger print for the public key and the private key material of the key pair.
|
||||
* @return A VO containing the key pair name, finger print for the public key and the private key material of the
|
||||
* key pair.
|
||||
*/
|
||||
SSHKeyPair createSSHKeyPair(CreateSSHKeyPairCmd cmd);
|
||||
|
||||
@ -406,12 +416,15 @@ public interface ManagementService {
|
||||
Type findSystemVMTypeById(long instanceId);
|
||||
|
||||
/**
|
||||
* List hosts for migrating the given VM. The API returns list of all hosts in the VM's cluster minus the current host and
|
||||
* List hosts for migrating the given VM. The API returns list of all hosts in the VM's cluster minus the current
|
||||
* host and
|
||||
* also a list of hosts that seem to have enough CPU and RAM capacity to host this VM.
|
||||
*
|
||||
* @param Long vmId
|
||||
* @param Long
|
||||
* vmId
|
||||
* Id of The VM to migrate
|
||||
* @return Pair<List<? extends Host>, List<? extends Host>> List of all Hosts in VM's cluster and list of Hosts with enough capacity
|
||||
* @return Pair<List<? extends Host>, List<? extends Host>> List of all Hosts in VM's cluster and list of Hosts with
|
||||
* enough capacity
|
||||
*/
|
||||
Pair<List<? extends Host>, List<? extends Host>> listHostsForMigrationOfVM(Long vmId, Long startIndex, Long pageSize);
|
||||
|
||||
|
||||
@ -21,7 +21,10 @@ package com.cloud.storage;
|
||||
public interface GuestOS {
|
||||
|
||||
long getId();
|
||||
|
||||
String getName();
|
||||
|
||||
String getDisplayName();
|
||||
|
||||
long getCategoryId();
|
||||
}
|
||||
|
||||
@ -70,15 +70,25 @@ public interface Snapshot extends ControlledEntity{
|
||||
public static final long MANUAL_POLICY_ID = 0L;
|
||||
|
||||
Long getId();
|
||||
|
||||
long getAccountId();
|
||||
|
||||
long getVolumeId();
|
||||
|
||||
String getPath();
|
||||
|
||||
String getName();
|
||||
|
||||
Date getCreated();
|
||||
|
||||
Type getType();
|
||||
|
||||
Status getStatus();
|
||||
|
||||
HypervisorType getHypervisorType();
|
||||
|
||||
boolean isRecursive();
|
||||
|
||||
short getsnapshotType();
|
||||
|
||||
}
|
||||
|
||||
@ -114,6 +114,7 @@ public class Storage {
|
||||
return shared;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<StoragePoolType> getNonSharedStoragePoolTypes() {
|
||||
List<StoragePoolType> nonSharedStoragePoolTypes = new ArrayList<StoragePoolType>();
|
||||
for (StoragePoolType storagePoolType : StoragePoolType.values()) {
|
||||
@ -125,5 +126,7 @@ public class Storage {
|
||||
|
||||
}
|
||||
|
||||
public static enum StorageResourceType {STORAGE_POOL, STORAGE_HOST, SECONDARY_STORAGE, LOCAL_SECONDARY_STORAGE}
|
||||
public static enum StorageResourceType {
|
||||
STORAGE_POOL, STORAGE_HOST, SECONDARY_STORAGE, LOCAL_SECONDARY_STORAGE
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,6 +25,8 @@ import com.cloud.utils.component.Adapter;
|
||||
*/
|
||||
public interface StorageGuru extends Adapter {
|
||||
void createVolume();
|
||||
|
||||
void prepareVolume();
|
||||
|
||||
void destroyVolume();
|
||||
}
|
||||
|
||||
@ -19,7 +19,6 @@ package com.cloud.storage;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.cloud.host.Status;
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
|
||||
/**
|
||||
@ -60,7 +59,6 @@ public interface StoragePool {
|
||||
*/
|
||||
Date getUpdateTime();
|
||||
|
||||
|
||||
/**
|
||||
* @return availability zone.
|
||||
*/
|
||||
@ -71,13 +69,11 @@ public interface StoragePool {
|
||||
*/
|
||||
long getCapacityBytes();
|
||||
|
||||
|
||||
/**
|
||||
* @return available storage in bytes
|
||||
*/
|
||||
long getAvailableBytes();
|
||||
|
||||
|
||||
Long getClusterId();
|
||||
|
||||
/**
|
||||
|
||||
@ -38,7 +38,8 @@ public interface StorageService {
|
||||
* Create StoragePool based on uri
|
||||
*
|
||||
* @param cmd
|
||||
* the command object that specifies the zone, cluster/pod, URI, details, etc. to use to create the storage pool.
|
||||
* the command object that specifies the zone, cluster/pod, URI, details, etc. to use to create the
|
||||
* storage pool.
|
||||
* @return
|
||||
* @throws ResourceInUseException
|
||||
* @throws IllegalArgumentException
|
||||
@ -52,7 +53,8 @@ public interface StorageService {
|
||||
* Creates the database object for a volume based on the given criteria
|
||||
*
|
||||
* @param cmd
|
||||
* the API command wrapping the criteria (account/domainId [admin only], zone, diskOffering, snapshot, name)
|
||||
* the API command wrapping the criteria (account/domainId [admin only], zone, diskOffering, snapshot,
|
||||
* name)
|
||||
* @return the volume object
|
||||
* @throws PermissionDeniedException
|
||||
*/
|
||||
@ -62,7 +64,8 @@ public interface StorageService {
|
||||
* Creates the volume based on the given criteria
|
||||
*
|
||||
* @param cmd
|
||||
* the API command wrapping the criteria (account/domainId [admin only], zone, diskOffering, snapshot, name)
|
||||
* the API command wrapping the criteria (account/domainId [admin only], zone, diskOffering, snapshot,
|
||||
* name)
|
||||
* @return the volume object
|
||||
*/
|
||||
Volume createVolume(CreateVolumeCmd cmd);
|
||||
|
||||
@ -21,9 +21,14 @@ import com.cloud.agent.api.to.SwiftTO;
|
||||
|
||||
public interface Swift {
|
||||
public long getId();
|
||||
|
||||
public String getUrl();
|
||||
|
||||
public String getAccount();
|
||||
|
||||
public String getUserName();
|
||||
|
||||
public String getKey();
|
||||
|
||||
public SwiftTO toSwiftTO();
|
||||
}
|
||||
|
||||
@ -22,9 +22,17 @@ import java.util.Date;
|
||||
|
||||
public interface Upload {
|
||||
|
||||
public static enum Status {UNKNOWN, ABANDONED, UPLOADED, NOT_UPLOADED, UPLOAD_ERROR, UPLOAD_IN_PROGRESS, NOT_COPIED, COPY_IN_PROGRESS, COPY_ERROR, COPY_COMPLETE, DOWNLOAD_URL_CREATED, DOWNLOAD_URL_NOT_CREATED, ERROR}
|
||||
public static enum Type {VOLUME, TEMPLATE, ISO}
|
||||
public static enum Mode {FTP_UPLOAD, HTTP_DOWNLOAD}
|
||||
public static enum Status {
|
||||
UNKNOWN, ABANDONED, UPLOADED, NOT_UPLOADED, UPLOAD_ERROR, UPLOAD_IN_PROGRESS, NOT_COPIED, COPY_IN_PROGRESS, COPY_ERROR, COPY_COMPLETE, DOWNLOAD_URL_CREATED, DOWNLOAD_URL_NOT_CREATED, ERROR
|
||||
}
|
||||
|
||||
public static enum Type {
|
||||
VOLUME, TEMPLATE, ISO
|
||||
}
|
||||
|
||||
public static enum Mode {
|
||||
FTP_UPLOAD, HTTP_DOWNLOAD
|
||||
}
|
||||
|
||||
long getHostId();
|
||||
|
||||
|
||||
@ -24,7 +24,9 @@ import java.util.Date;
|
||||
*
|
||||
*/
|
||||
public interface VMTemplateStorageResourceAssoc {
|
||||
public static enum Status {UNKNOWN, DOWNLOAD_ERROR, NOT_DOWNLOADED, DOWNLOAD_IN_PROGRESS, DOWNLOADED, ABANDONED, UPLOADED, NOT_UPLOADED, UPLOAD_ERROR, UPLOAD_IN_PROGRESS}
|
||||
public static enum Status {
|
||||
UNKNOWN, DOWNLOAD_ERROR, NOT_DOWNLOADED, DOWNLOAD_IN_PROGRESS, DOWNLOADED, ABANDONED, UPLOADED, NOT_UPLOADED, UPLOAD_ERROR, UPLOAD_IN_PROGRESS
|
||||
}
|
||||
|
||||
String getInstallPath();
|
||||
|
||||
|
||||
@ -42,19 +42,24 @@ public interface SnapshotService {
|
||||
List<? extends Snapshot> listSnapshots(ListSnapshotsCmd cmd);
|
||||
|
||||
/**
|
||||
* Delete specified snapshot from the specified. If no other policies are assigned it calls destroy snapshot. This will be
|
||||
* Delete specified snapshot from the specified. If no other policies are assigned it calls destroy snapshot. This
|
||||
* will be
|
||||
* used for manual snapshots too.
|
||||
* @param snapshotId TODO
|
||||
*
|
||||
* @param snapshotId
|
||||
* TODO
|
||||
*/
|
||||
boolean deleteSnapshot(long snapshotId);
|
||||
|
||||
/**
|
||||
* Creates a policy with specified schedule. maxSnaps specifies the number of most recent snapshots that are to be retained.
|
||||
* Creates a policy with specified schedule. maxSnaps specifies the number of most recent snapshots that are to be
|
||||
* retained.
|
||||
* If the number of snapshots go beyond maxSnaps the oldest snapshot is deleted
|
||||
*
|
||||
* @param cmd
|
||||
* the command that
|
||||
* @param policyOwner TODO
|
||||
* @param policyOwner
|
||||
* TODO
|
||||
* @return the newly created snapshot policy if success, null otherwise
|
||||
*/
|
||||
SnapshotPolicy createPolicy(CreateSnapshotPolicyCmd cmd, Account policyOwner);
|
||||
@ -84,7 +89,9 @@ public interface SnapshotService {
|
||||
|
||||
/**
|
||||
* Create a snapshot of a volume
|
||||
* @param snapshotOwner TODO
|
||||
*
|
||||
* @param snapshotOwner
|
||||
* TODO
|
||||
* @param cmd
|
||||
* the API command wrapping the parameters for creating the snapshot (mainly volumeId)
|
||||
*
|
||||
|
||||
@ -17,8 +17,6 @@
|
||||
*/
|
||||
package com.cloud.storage.template;
|
||||
|
||||
|
||||
|
||||
public class TemplateInfo {
|
||||
String templateName;
|
||||
String installPath;
|
||||
@ -80,4 +78,5 @@ public class TemplateInfo {
|
||||
public void setSize(long size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -27,13 +27,17 @@ import com.cloud.storage.Storage.TemplateType;
|
||||
|
||||
public interface VirtualMachineTemplate extends ControlledEntity {
|
||||
|
||||
public static enum BootloaderType { PyGrub, HVM, External, CD };
|
||||
public static enum BootloaderType {
|
||||
PyGrub, HVM, External, CD
|
||||
};
|
||||
|
||||
public enum TemplateFilter {
|
||||
featured, // returns templates that have been marked as featured and public
|
||||
self, // returns templates that have been registered or created by the calling user
|
||||
selfexecutable, // same as self, but only returns templates that are ready to be deployed with
|
||||
sharedexecutable, // ready templates that have been granted to the calling user by another user
|
||||
executable, // templates that are owned by the calling user, or public templates, that can be used to deploy a new VM
|
||||
executable, // templates that are owned by the calling user, or public templates, that can be used to deploy a
|
||||
// new VM
|
||||
community, // returns templates that have been marked as public but not featured
|
||||
all // all templates (only usable by admins)
|
||||
}
|
||||
|
||||
@ -51,9 +51,14 @@ public interface Account extends ControlledEntity {
|
||||
public static final long ACCOUNT_ID_SYSTEM = 1;
|
||||
|
||||
public long getId();
|
||||
|
||||
public String getAccountName();
|
||||
|
||||
public short getType();
|
||||
|
||||
public State getState();
|
||||
|
||||
public Date getRemoved();
|
||||
|
||||
public String getNetworkDomain();
|
||||
}
|
||||
|
||||
@ -38,24 +38,38 @@ public interface AccountService {
|
||||
|
||||
/**
|
||||
* Creates a new user and account, stores the password as is so encrypted passwords are recommended.
|
||||
* @param userName TODO
|
||||
* @param password TODO
|
||||
* @param firstName TODO
|
||||
* @param lastName TODO
|
||||
* @param email TODO
|
||||
* @param timezone TODO
|
||||
* @param accountName TODO
|
||||
* @param accountType TODO
|
||||
* @param domainId TODO
|
||||
* @param networkDomain TODO
|
||||
*
|
||||
* @param userName
|
||||
* TODO
|
||||
* @param password
|
||||
* TODO
|
||||
* @param firstName
|
||||
* TODO
|
||||
* @param lastName
|
||||
* TODO
|
||||
* @param email
|
||||
* TODO
|
||||
* @param timezone
|
||||
* TODO
|
||||
* @param accountName
|
||||
* TODO
|
||||
* @param accountType
|
||||
* TODO
|
||||
* @param domainId
|
||||
* TODO
|
||||
* @param networkDomain
|
||||
* TODO
|
||||
*
|
||||
* @return the user if created successfully, null otherwise
|
||||
*/
|
||||
UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long domainId, String networkDomain, Map<String, String> details);
|
||||
UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long domainId, String networkDomain,
|
||||
Map<String, String> details);
|
||||
|
||||
/**
|
||||
* Deletes a user by userId
|
||||
* @param accountId - id of the account do delete
|
||||
*
|
||||
* @param accountId
|
||||
* - id of the account do delete
|
||||
*
|
||||
* @return true if delete was successful, false otherwise
|
||||
*/
|
||||
@ -64,7 +78,8 @@ public interface AccountService {
|
||||
/**
|
||||
* Disables a user by userId
|
||||
*
|
||||
* @param userId - the userId
|
||||
* @param userId
|
||||
* - the userId
|
||||
* @return UserAccount object
|
||||
*/
|
||||
UserAccount disableUser(long userId);
|
||||
@ -72,13 +87,15 @@ public interface AccountService {
|
||||
/**
|
||||
* Enables a user
|
||||
*
|
||||
* @param userId - the userId
|
||||
* @param userId
|
||||
* - the userId
|
||||
* @return UserAccount object
|
||||
*/
|
||||
UserAccount enableUser(long userId);
|
||||
|
||||
/**
|
||||
* Locks a user by userId. A locked user cannot access the API, but will still have running VMs/IP addresses allocated/etc.
|
||||
* Locks a user by userId. A locked user cannot access the API, but will still have running VMs/IP addresses
|
||||
* allocated/etc.
|
||||
*
|
||||
* @param userId
|
||||
* @return UserAccount object
|
||||
@ -95,8 +112,11 @@ public interface AccountService {
|
||||
|
||||
/**
|
||||
* Disables an account by accountName and domainId
|
||||
* @param accountName TODO
|
||||
* @param domainId TODO
|
||||
*
|
||||
* @param accountName
|
||||
* TODO
|
||||
* @param domainId
|
||||
* TODO
|
||||
* @param accountId
|
||||
* @param disabled
|
||||
* account if success
|
||||
@ -109,19 +129,22 @@ public interface AccountService {
|
||||
*
|
||||
* @param accountName
|
||||
* - the enableAccount command defining the accountId to be deleted.
|
||||
* @param domainId TODO
|
||||
* @param domainId
|
||||
* TODO
|
||||
* @param accountId
|
||||
* @return account object
|
||||
*/
|
||||
Account enableAccount(String accountName, Long domainId, Long accountId);
|
||||
|
||||
/**
|
||||
* Locks an account by accountId. A locked account cannot access the API, but will still have running VMs/IP addresses
|
||||
* Locks an account by accountId. A locked account cannot access the API, but will still have running VMs/IP
|
||||
* addresses
|
||||
* allocated/etc.
|
||||
*
|
||||
* @param accountName
|
||||
* - the LockAccount command defining the accountId to be locked.
|
||||
* @param domainId TODO
|
||||
* @param domainId
|
||||
* TODO
|
||||
* @param accountId
|
||||
* @return account object
|
||||
*/
|
||||
@ -142,6 +165,7 @@ public interface AccountService {
|
||||
User getSystemUser();
|
||||
|
||||
User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId);
|
||||
|
||||
boolean deleteUser(DeleteUserCmd deleteUserCmd);
|
||||
|
||||
boolean isAdmin(short accountType);
|
||||
|
||||
@ -46,4 +46,5 @@ public interface DomainService {
|
||||
|
||||
List<? extends Domain> searchForDomainChildren(ListDomainChildrenCmd cmd)
|
||||
throws PermissionDeniedException;
|
||||
|
||||
}
|
||||
|
||||
@ -29,10 +29,15 @@ public interface ResourceLimitService {
|
||||
|
||||
/**
|
||||
* Updates an existing resource limit with the specified details. If a limit doesn't exist, will create one.
|
||||
* @param accountId TODO
|
||||
* @param domainId TODO
|
||||
* @param resourceType TODO
|
||||
* @param max TODO
|
||||
*
|
||||
* @param accountId
|
||||
* TODO
|
||||
* @param domainId
|
||||
* TODO
|
||||
* @param resourceType
|
||||
* TODO
|
||||
* @param max
|
||||
* TODO
|
||||
*
|
||||
* @return the updated/created resource limit
|
||||
*/
|
||||
@ -40,19 +45,28 @@ public interface ResourceLimitService {
|
||||
|
||||
/**
|
||||
* Updates an existing resource count details for the account/domain
|
||||
* @param accountId TODO
|
||||
* @param domainId TODO
|
||||
* @param typeId TODO
|
||||
*
|
||||
* @param accountId
|
||||
* TODO
|
||||
* @param domainId
|
||||
* TODO
|
||||
* @param typeId
|
||||
* TODO
|
||||
* @return the updated/created resource counts
|
||||
*/
|
||||
List<? extends ResourceCount> recalculateResourceCount(Long accountId, Long domainId, Integer typeId);
|
||||
|
||||
/**
|
||||
* Search for resource limits for the given id and/or account and/or type and/or domain.
|
||||
* @param id TODO
|
||||
* @param accountId TODO
|
||||
* @param domainId TODO
|
||||
* @param type TODO
|
||||
*
|
||||
* @param id
|
||||
* TODO
|
||||
* @param accountId
|
||||
* TODO
|
||||
* @param domainId
|
||||
* TODO
|
||||
* @param type
|
||||
* TODO
|
||||
* @return a list of limits that match the criteria
|
||||
*/
|
||||
public List<? extends ResourceLimit> searchForLimits(Long id, Long accountId, Long domainId, Integer type, Long startIndex, Long pageSizeVal);
|
||||
@ -60,6 +74,7 @@ public interface ResourceLimitService {
|
||||
/**
|
||||
* Finds the resource limit for a specified account and type. If the account has an infinite limit, will check
|
||||
* the account's parent domain, and if that limit is also infinite, will return the ROOT domain's limit.
|
||||
*
|
||||
* @param account
|
||||
* @param type
|
||||
* @return resource limit
|
||||
@ -69,6 +84,7 @@ public interface ResourceLimitService {
|
||||
/**
|
||||
* Finds the resource limit for a specified domain and type. If the domain has an infinite limit, will check
|
||||
* up the domain hierarchy
|
||||
*
|
||||
* @param account
|
||||
* @param type
|
||||
* @return resource limit
|
||||
@ -77,6 +93,7 @@ public interface ResourceLimitService {
|
||||
|
||||
/**
|
||||
* Increments the resource count
|
||||
*
|
||||
* @param accountId
|
||||
* @param type
|
||||
* @param delta
|
||||
@ -85,6 +102,7 @@ public interface ResourceLimitService {
|
||||
|
||||
/**
|
||||
* Decrements the resource count
|
||||
*
|
||||
* @param accountId
|
||||
* @param type
|
||||
* @param delta
|
||||
@ -93,15 +111,19 @@ public interface ResourceLimitService {
|
||||
|
||||
/**
|
||||
* Checks if a limit has been exceeded for an account
|
||||
*
|
||||
* @param account
|
||||
* @param type
|
||||
* @param count the number of resources being allocated, count will be added to current allocation and compared against maximum allowed allocation
|
||||
* @param count
|
||||
* the number of resources being allocated, count will be added to current allocation and compared
|
||||
* against maximum allowed allocation
|
||||
* @throws ResourceAllocationException
|
||||
*/
|
||||
public void checkResourceLimit(Account account, ResourceCount.ResourceType type, long... count) throws ResourceAllocationException;
|
||||
|
||||
/**
|
||||
* Gets the count of resources for a resource type and account
|
||||
*
|
||||
* @param account
|
||||
* @param type
|
||||
* @return count of resources
|
||||
|
||||
@ -87,7 +87,8 @@ public class UserContext {
|
||||
// TODO: we should enforce explicit UserContext setup at major entry-points for security concerns,
|
||||
// however, there are many places that run background jobs assume the system context.
|
||||
//
|
||||
// If there is a security concern, all entry points from user (including the front end that takes HTTP request in and
|
||||
// If there is a security concern, all entry points from user (including the front end that takes HTTP
|
||||
// request in and
|
||||
// the core async-job manager that runs commands from user) have explicitly setup the UserContext.
|
||||
//
|
||||
return s_adminContext;
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
|
||||
package com.cloud.vm;
|
||||
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
|
||||
public interface BareMetalVmService extends UserVmService {
|
||||
}
|
||||
|
||||
@ -105,6 +105,7 @@ public class DiskProfile {
|
||||
public void setUseLocalStorage(boolean useLocalStorage) {
|
||||
this.useLocalStorage = useLocalStorage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Is this volume recreatable? A volume is recreatable if the disk's content can be
|
||||
* reconstructed from the template.
|
||||
|
||||
@ -23,8 +23,11 @@ import com.cloud.acl.ControlledEntity;
|
||||
|
||||
public interface InstanceGroup extends ControlledEntity {
|
||||
long getId();
|
||||
|
||||
String getName();
|
||||
|
||||
Date getCreated();
|
||||
|
||||
Short getAccountType();
|
||||
|
||||
}
|
||||
|
||||
@ -92,7 +92,8 @@ public interface Nic {
|
||||
long getId();
|
||||
|
||||
/**
|
||||
* @return reservation id returned by the allocation source. This can be the String version of the database id if the
|
||||
* @return reservation id returned by the allocation source. This can be the String version of the database id if
|
||||
* the
|
||||
* allocation source does not need it's own implementation of the reservation id. This is passed back to the
|
||||
* allocation source to release the resource.
|
||||
*/
|
||||
|
||||
@ -121,9 +121,11 @@ public interface UserVmService {
|
||||
* Create a template database record in preparation for creating a private template.
|
||||
*
|
||||
* @param cmd
|
||||
* the command object that defines the name, display text, snapshot/volume, bits, public/private, etc. for the
|
||||
* the command object that defines the name, display text, snapshot/volume, bits, public/private, etc.
|
||||
* for the
|
||||
* private template
|
||||
* @param templateOwner TODO
|
||||
* @param templateOwner
|
||||
* TODO
|
||||
* @return the vm template object if successful, null otherwise
|
||||
* @throws ResourceAllocationException
|
||||
*/
|
||||
@ -154,10 +156,14 @@ public interface UserVmService {
|
||||
* @param displayName
|
||||
* - an optional user generated name for the virtual machine
|
||||
* @param diskOfferingId
|
||||
* - the ID of the disk offering for the virtual machine. If the template is of ISO format, the diskOfferingId is
|
||||
* for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk volume.
|
||||
* If the templateId parameter passed is from a Template object, the diskOfferingId refers to a DATA Disk Volume
|
||||
* created. If the templateId parameter passed is from an ISO object, the diskOfferingId refers to a ROOT Disk
|
||||
* - the ID of the disk offering for the virtual machine. If the template is of ISO format, the
|
||||
* diskOfferingId is
|
||||
* for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk
|
||||
* volume.
|
||||
* If the templateId parameter passed is from a Template object, the diskOfferingId refers to a DATA Disk
|
||||
* Volume
|
||||
* created. If the templateId parameter passed is from an ISO object, the diskOfferingId refers to a ROOT
|
||||
* Disk
|
||||
* Volume created
|
||||
* @param diskSize
|
||||
* - the arbitrary size for the DATADISK volume. Mutually exclusive with diskOfferingId
|
||||
@ -166,17 +172,22 @@ public interface UserVmService {
|
||||
* @param hypervisor
|
||||
* - the hypervisor on which to deploy the virtual machine
|
||||
* @param userData
|
||||
* - an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary
|
||||
* data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported. Using HTTP
|
||||
* - an optional binary data that can be sent to the virtual machine upon a successful deployment. This
|
||||
* binary
|
||||
* data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported.
|
||||
* Using HTTP
|
||||
* GET (via querystring), you can send up to 2KB of data after base64 encoding
|
||||
* @param sshKeyPair
|
||||
* - name of the ssh key pair used to login to the virtual machine
|
||||
* @param requestedIps TODO
|
||||
* @param defaultIp TODO
|
||||
* @param requestedIps
|
||||
* TODO
|
||||
* @param defaultIp
|
||||
* TODO
|
||||
* @param accountName
|
||||
* - an optional account for the virtual machine. Must be used with domainId
|
||||
* @param domainId
|
||||
* - an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used
|
||||
* - an optional domainId for the virtual machine. If the account parameter is used, domainId must also
|
||||
* be used
|
||||
* @return UserVm object if successful.
|
||||
*
|
||||
* @throws InsufficientCapacityException
|
||||
@ -192,7 +203,8 @@ public interface UserVmService {
|
||||
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
|
||||
|
||||
/**
|
||||
* Creates a User VM in Advanced Zone (Security Group feature is enabled) in the database and returns the VM to the caller.
|
||||
* Creates a User VM in Advanced Zone (Security Group feature is enabled) in the database and returns the VM to the
|
||||
* caller.
|
||||
*
|
||||
* @param zone
|
||||
* - availability zone for the virtual machine
|
||||
@ -209,10 +221,14 @@ public interface UserVmService {
|
||||
* @param displayName
|
||||
* - an optional user generated name for the virtual machine
|
||||
* @param diskOfferingId
|
||||
* - the ID of the disk offering for the virtual machine. If the template is of ISO format, the diskOfferingId is
|
||||
* for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk volume.
|
||||
* If the templateId parameter passed is from a Template object, the diskOfferingId refers to a DATA Disk Volume
|
||||
* created. If the templateId parameter passed is from an ISO object, the diskOfferingId refers to a ROOT Disk
|
||||
* - the ID of the disk offering for the virtual machine. If the template is of ISO format, the
|
||||
* diskOfferingId is
|
||||
* for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk
|
||||
* volume.
|
||||
* If the templateId parameter passed is from a Template object, the diskOfferingId refers to a DATA Disk
|
||||
* Volume
|
||||
* created. If the templateId parameter passed is from an ISO object, the diskOfferingId refers to a ROOT
|
||||
* Disk
|
||||
* Volume created
|
||||
* @param diskSize
|
||||
* - the arbitrary size for the DATADISK volume. Mutually exclusive with diskOfferingId
|
||||
@ -221,17 +237,22 @@ public interface UserVmService {
|
||||
* @param hypervisor
|
||||
* - the hypervisor on which to deploy the virtual machine
|
||||
* @param userData
|
||||
* - an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary
|
||||
* data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported. Using HTTP
|
||||
* - an optional binary data that can be sent to the virtual machine upon a successful deployment. This
|
||||
* binary
|
||||
* data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported.
|
||||
* Using HTTP
|
||||
* GET (via querystring), you can send up to 2KB of data after base64 encoding
|
||||
* @param sshKeyPair
|
||||
* - name of the ssh key pair used to login to the virtual machine
|
||||
* @param requestedIps TODO
|
||||
* @param defaultIp TODO
|
||||
* @param requestedIps
|
||||
* TODO
|
||||
* @param defaultIp
|
||||
* TODO
|
||||
* @param accountName
|
||||
* - an optional account for the virtual machine. Must be used with domainId
|
||||
* @param domainId
|
||||
* - an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used
|
||||
* - an optional domainId for the virtual machine. If the account parameter is used, domainId must also
|
||||
* be used
|
||||
* @return UserVm object if successful.
|
||||
*
|
||||
* @throws InsufficientCapacityException
|
||||
@ -243,11 +264,13 @@ public interface UserVmService {
|
||||
* @throws InsufficientResourcesException
|
||||
*/
|
||||
UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, List<Long> securityGroupIdList,
|
||||
Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, String userData, String sshKeyPair, Map<Long, String> requestedIps, String defaultIp, String keyboard)
|
||||
Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, String userData, String sshKeyPair, Map<Long, String> requestedIps,
|
||||
String defaultIp, String keyboard)
|
||||
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
|
||||
|
||||
/**
|
||||
* Creates a User VM in Advanced Zone (Security Group feature is disabled) in the database and returns the VM to the caller.
|
||||
* Creates a User VM in Advanced Zone (Security Group feature is disabled) in the database and returns the VM to the
|
||||
* caller.
|
||||
*
|
||||
* @param zone
|
||||
* - availability zone for the virtual machine
|
||||
@ -262,10 +285,14 @@ public interface UserVmService {
|
||||
* @param displayName
|
||||
* - an optional user generated name for the virtual machine
|
||||
* @param diskOfferingId
|
||||
* - the ID of the disk offering for the virtual machine. If the template is of ISO format, the diskOfferingId is
|
||||
* for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk volume.
|
||||
* If the templateId parameter passed is from a Template object, the diskOfferingId refers to a DATA Disk Volume
|
||||
* created. If the templateId parameter passed is from an ISO object, the diskOfferingId refers to a ROOT Disk
|
||||
* - the ID of the disk offering for the virtual machine. If the template is of ISO format, the
|
||||
* diskOfferingId is
|
||||
* for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk
|
||||
* volume.
|
||||
* If the templateId parameter passed is from a Template object, the diskOfferingId refers to a DATA Disk
|
||||
* Volume
|
||||
* created. If the templateId parameter passed is from an ISO object, the diskOfferingId refers to a ROOT
|
||||
* Disk
|
||||
* Volume created
|
||||
* @param diskSize
|
||||
* - the arbitrary size for the DATADISK volume. Mutually exclusive with diskOfferingId
|
||||
@ -274,17 +301,22 @@ public interface UserVmService {
|
||||
* @param hypervisor
|
||||
* - the hypervisor on which to deploy the virtual machine
|
||||
* @param userData
|
||||
* - an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary
|
||||
* data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported. Using HTTP
|
||||
* - an optional binary data that can be sent to the virtual machine upon a successful deployment. This
|
||||
* binary
|
||||
* data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported.
|
||||
* Using HTTP
|
||||
* GET (via querystring), you can send up to 2KB of data after base64 encoding
|
||||
* @param sshKeyPair
|
||||
* - name of the ssh key pair used to login to the virtual machine
|
||||
* @param requestedIps TODO
|
||||
* @param defaultIp TODO
|
||||
* @param requestedIps
|
||||
* TODO
|
||||
* @param defaultIp
|
||||
* TODO
|
||||
* @param accountName
|
||||
* - an optional account for the virtual machine. Must be used with domainId
|
||||
* @param domainId
|
||||
* - an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used
|
||||
* - an optional domainId for the virtual machine. If the account parameter is used, domainId must also
|
||||
* be used
|
||||
* @return UserVm object if successful.
|
||||
*
|
||||
* @throws InsufficientCapacityException
|
||||
@ -359,10 +391,14 @@ public interface UserVmService {
|
||||
UserVm getUserVm(long vmId);
|
||||
|
||||
/**
|
||||
* Migrate the given VM to the destination host provided. The API returns the migrated VM if migration succeeds. Only Root
|
||||
* Migrate the given VM to the destination host provided. The API returns the migrated VM if migration succeeds.
|
||||
* Only Root
|
||||
* Admin can migrate a VM.
|
||||
* @param destinationStorage TODO
|
||||
* @param Long vmId
|
||||
*
|
||||
* @param destinationStorage
|
||||
* TODO
|
||||
* @param Long
|
||||
* vmId
|
||||
* vmId of The VM to migrate
|
||||
* @param Host
|
||||
* destinationHost to migrate the VM
|
||||
|
||||
@ -26,7 +26,6 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.utils.fsm.StateMachine2;
|
||||
import com.cloud.utils.fsm.StateObject;
|
||||
|
||||
|
||||
/**
|
||||
* VirtualMachine describes the properties held by a virtual machine
|
||||
*
|
||||
@ -45,7 +44,6 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, S
|
||||
Unknown(false, "VM state is unknown."),
|
||||
Shutdowned(false, "VM is shutdowned from inside");
|
||||
|
||||
|
||||
private final boolean _transitional;
|
||||
String _description;
|
||||
|
||||
@ -73,7 +71,8 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, S
|
||||
s_fsm.addTransition(State.Stopped, VirtualMachine.Event.StopRequested, State.Stopped);
|
||||
s_fsm.addTransition(State.Stopped, VirtualMachine.Event.AgentReportStopped, State.Stopped);
|
||||
|
||||
// please pay attention about state transition to Error state, there should be only one case (failed in VM creation process)
|
||||
// please pay attention about state transition to Error state, there should be only one case (failed in VM
|
||||
// creation process)
|
||||
// that can have such transition
|
||||
s_fsm.addTransition(State.Stopped, VirtualMachine.Event.OperationFailedToError, State.Error);
|
||||
|
||||
@ -247,6 +246,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, S
|
||||
|
||||
/**
|
||||
* returns the guest OS ID
|
||||
*
|
||||
* @return guestOSId
|
||||
*/
|
||||
public long getGuestOSId();
|
||||
@ -265,6 +265,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, S
|
||||
* @return id of the host it was assigned last time.
|
||||
*/
|
||||
public Long getLastHostId();
|
||||
|
||||
@Override
|
||||
public Long getHostId();
|
||||
|
||||
@ -277,6 +278,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, S
|
||||
* @return should limit CPU usage to the service offering?
|
||||
*/
|
||||
public boolean limitCpuUse();
|
||||
|
||||
/**
|
||||
* @return date when machine was created
|
||||
*/
|
||||
|
||||
@ -27,7 +27,6 @@ import com.cloud.template.VirtualMachineTemplate;
|
||||
import com.cloud.template.VirtualMachineTemplate.BootloaderType;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
|
||||
/**
|
||||
* VirtualMachineProfile describes one virtual machine. This object
|
||||
* is passed to various adapters to be processed. Anything that is
|
||||
@ -37,11 +36,11 @@ import com.cloud.user.Account;
|
||||
* on what the virtual machine profile should look like before it is
|
||||
* actually started on the hypervisor.
|
||||
*
|
||||
* @param <T> a VirtualMachine
|
||||
* @param <T>
|
||||
* a VirtualMachine
|
||||
*/
|
||||
public interface VirtualMachineProfile<T extends VirtualMachine> {
|
||||
|
||||
|
||||
public static class Param {
|
||||
|
||||
public static final Param VmPassword = new Param("VmPassword");
|
||||
@ -131,6 +130,7 @@ public interface VirtualMachineProfile<T extends VirtualMachine> {
|
||||
void setParameter(Param name, Object value);
|
||||
|
||||
void setBootLoaderType(BootloaderType bootLoader);
|
||||
|
||||
BootloaderType getBootLoaderType();
|
||||
|
||||
Map<Param, Object> getParameters();
|
||||
|
||||
@ -21,7 +21,9 @@ package com.cloud.vm;
|
||||
public interface VmStats {
|
||||
// vm related stats
|
||||
public double getCPUUtilization();
|
||||
|
||||
public double getNetworkReadKBs();
|
||||
|
||||
public double getNetworkWriteKBs();
|
||||
|
||||
}
|
||||
|
||||
@ -49,7 +49,8 @@ public class ResourceLimitVO implements ResourceLimit {
|
||||
@Column(name = "max")
|
||||
private Long max;
|
||||
|
||||
public ResourceLimitVO() {}
|
||||
public ResourceLimitVO() {
|
||||
}
|
||||
|
||||
public ResourceLimitVO(ResourceCount.ResourceType type, Long max, long ownerId, ResourceOwnerType ownerType) {
|
||||
this.type = type;
|
||||
|
||||
@ -531,12 +531,13 @@ public class XenServerConnectionPool {
|
||||
s_logger.debug(msg);
|
||||
throw new CloudRuntimeException(msg);
|
||||
}
|
||||
Host host = null;
|
||||
synchronized (poolUuid.intern()) {
|
||||
// Let's see if it is an existing connection.
|
||||
mConn = getConnect(poolUuid);
|
||||
if (mConn != null){
|
||||
try{
|
||||
Host.getByUuid(mConn, hostUuid);
|
||||
host = Host.getByUuid(mConn, hostUuid);
|
||||
} catch (Types.SessionInvalid e) {
|
||||
s_logger.debug("Session thgrough ip " + mConn.getIp() + " is invalid for pool(" + poolUuid + ") due to " + e.toString());
|
||||
try {
|
||||
@ -635,6 +636,45 @@ public class XenServerConnectionPool {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( mConn != null ) {
|
||||
if (s_managePool) {
|
||||
try {
|
||||
Map<String, String> args = new HashMap<String, String>();
|
||||
host.callPlugin(mConn, "echo", "main", args);
|
||||
} catch (Types.SessionInvalid e) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
String msg = "Catch Exception: " + e.getClass().getName() + " Can't connect host " + ipAddress + " due to " + e.toString();
|
||||
s_logger.debug(msg);
|
||||
}
|
||||
PoolEmergencyResetMaster(ipAddress, mConn.getIp(), mConn.getUsername(), mConn.getPassword());
|
||||
} catch (Types.CannotContactHost e ) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
String msg = "Catch Exception: " + e.getClass().getName() + " Can't connect host " + ipAddress + " due to " + e.toString();
|
||||
s_logger.debug(msg);
|
||||
}
|
||||
PoolEmergencyResetMaster(ipAddress, mConn.getIp(), mConn.getUsername(), mConn.getPassword());
|
||||
} catch (Types.HostOffline e ) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
String msg = "Catch Exception: " + e.getClass().getName() + " Host is offline " + ipAddress + " due to " + e.toString();
|
||||
s_logger.debug(msg);
|
||||
}
|
||||
PoolEmergencyResetMaster(ipAddress, mConn.getIp(), mConn.getUsername(), mConn.getPassword());
|
||||
} catch (Types.HostNotLive e ) {
|
||||
String msg = "Catch Exception: " + e.getClass().getName() + " Host Not Live " + ipAddress + " due to " + e.toString();
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug(msg);
|
||||
}
|
||||
PoolEmergencyResetMaster(ipAddress, mConn.getIp(), mConn.getUsername(), mConn.getPassword());
|
||||
} catch (Exception e) {
|
||||
String msg = "Master can not talk to Slave " + hostUuid + " IP " + ipAddress;
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug(msg);
|
||||
}
|
||||
throw new CloudRuntimeException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mConn;
|
||||
}
|
||||
|
||||
@ -879,24 +919,6 @@ public class XenServerConnectionPool {
|
||||
}
|
||||
loginWithPassword(this, _username, _password, APIVersion.latest().toString());
|
||||
method_params[0] = getSessionReference();
|
||||
} catch (Types.CannotContactHost e ) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
String msg = "Cannot Contact Host for method: " + method_call + " due to " + e.toString();
|
||||
s_logger.debug(msg);
|
||||
}
|
||||
throw e;
|
||||
} catch (Types.HostOffline e ) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
String msg = "Host Offline for method: " + method_call + " due to " + e.toString();
|
||||
s_logger.debug(msg);
|
||||
}
|
||||
throw e;
|
||||
} catch (Types.HostNotLive e ) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
String msg = "Host is Not alive for method: " + method_call + " due to " + e.toString();
|
||||
s_logger.debug(msg);
|
||||
}
|
||||
throw e;
|
||||
} catch (XmlRpcClientException e) {
|
||||
s_logger.debug("XmlRpcClientException for method: " + method_call + " due to " + e.getMessage());
|
||||
removeConnect(_poolUuid);
|
||||
|
||||
@ -278,7 +278,8 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
Long ipTotal = ApiDBUtils.getResourceCount(ResourceType.public_ip, account.getId());
|
||||
|
||||
Long ips = ipLimit - ipTotal;
|
||||
//check how many free ips are left, and if it's less than max allowed number of ips from account - use this value
|
||||
// check how many free ips are left, and if it's less than max allowed number of ips from account - use this
|
||||
// value
|
||||
Long ipsLeft = ApiDBUtils.countFreePublicIps();
|
||||
boolean unlimited = true;
|
||||
if (ips.longValue() > ipsLeft.longValue()) {
|
||||
@ -354,7 +355,6 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
return accountResponse;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public UserResponse createUserResponse(UserAccount user) {
|
||||
UserResponse userResponse = new UserResponse();
|
||||
@ -529,7 +529,6 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
return policyResponse;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public HostResponse createHostResponse(Host host) {
|
||||
return createHostResponse(host, EnumSet.of(HostDetails.all));
|
||||
@ -1209,7 +1208,6 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<UserVmResponse> createUserVmResponse(String objectName, EnumSet<VMDetails> details, UserVm... userVms) {
|
||||
Account caller = UserContext.current().getCaller();
|
||||
@ -1234,8 +1232,6 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
userVmResponse.setName(userVm.getHostName());
|
||||
userVmResponse.setCreated(userVm.getCreated());
|
||||
|
||||
|
||||
|
||||
userVmResponse.setHaEnable(userVm.isHaEnabled());
|
||||
|
||||
if (userVm.getDisplayName() != null) {
|
||||
@ -1265,7 +1261,6 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
userVmResponse.setZoneId(zone.getId());
|
||||
userVmResponse.setZoneName(zone.getName());
|
||||
|
||||
|
||||
// if user is an admin, display host id
|
||||
if (((caller == null) || (caller.getType() == Account.ACCOUNT_TYPE_ADMIN)) && (userVm.getHostId() != null)) {
|
||||
Host host = hosts.get(userVm.getHostId());
|
||||
@ -1326,7 +1321,6 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (details.contains(VMDetails.all) || details.contains(VMDetails.iso)) {
|
||||
// ISO Info
|
||||
VMTemplateVO iso = templates.get(userVm.getIsoId());
|
||||
@ -1493,7 +1487,6 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
return vmResponses;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public DomainRouterResponse createDomainRouterResponse(VirtualRouter router) {
|
||||
Account caller = UserContext.current().getCaller();
|
||||
@ -1553,7 +1546,6 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
|
||||
populateOwner(routerResponse, router);
|
||||
|
||||
|
||||
DataCenter zone = ApiDBUtils.findZoneById(router.getDataCenterIdToDeployIn());
|
||||
if (zone != null) {
|
||||
routerResponse.setZoneName(zone.getName());
|
||||
@ -1910,6 +1902,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
responses.add(templateResponse);
|
||||
return responses;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TemplateResponse> createIsoResponses(long isoId, Long zoneId, boolean readyOnly) {
|
||||
|
||||
@ -2153,6 +2146,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
response.setResponses(netGrpResponses);
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SecurityGroupResponse createSecurityGroupResponse(SecurityGroup group) {
|
||||
SecurityGroupResponse response = new SecurityGroupResponse();
|
||||
@ -2225,7 +2219,6 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
jobResponse.setObjectName("asyncjobs");
|
||||
return jobResponse;
|
||||
}
|
||||
@ -2272,7 +2265,6 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
return responseEvent;
|
||||
}
|
||||
|
||||
|
||||
private List<CapacityVO> sumCapacities(List<? extends Capacity> hostCapacities) {
|
||||
Map<String, Long> totalCapacityMap = new HashMap<String, Long>();
|
||||
Map<String, Long> usedCapacityMap = new HashMap<String, Long>();
|
||||
@ -2339,11 +2331,16 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
|
||||
if (capacityType == Capacity.CAPACITY_TYPE_CPU || capacityType == Capacity.CAPACITY_TYPE_MEMORY) { // Reserved
|
||||
// Capacity
|
||||
// accounts for
|
||||
// stopped vms
|
||||
// that have been
|
||||
// stopped within
|
||||
// an interval
|
||||
// accounts
|
||||
// for
|
||||
// stopped
|
||||
// vms
|
||||
// that
|
||||
// have been
|
||||
// stopped
|
||||
// within
|
||||
// an
|
||||
// interval
|
||||
usedCapacity += capacity.getReservedCapacity();
|
||||
}
|
||||
|
||||
@ -2376,10 +2373,13 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
// accounts
|
||||
// for
|
||||
// stopped
|
||||
// vms that
|
||||
// have been
|
||||
// vms
|
||||
// that
|
||||
// have
|
||||
// been
|
||||
// stopped
|
||||
// within an
|
||||
// within
|
||||
// an
|
||||
// interval
|
||||
usedCapacity += capacity.getReservedCapacity();
|
||||
}
|
||||
@ -2814,7 +2814,6 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public FirewallResponse createFirewallResponse(FirewallRule fwRule) {
|
||||
FirewallResponse response = new FirewallResponse();
|
||||
@ -2850,8 +2849,6 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public UserVmData newUserVmData(UserVm userVm) {
|
||||
UserVmData userVmData = new UserVmData();
|
||||
userVmData.setId(userVm.getId());
|
||||
@ -3195,7 +3192,6 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public VirtualRouterProviderResponse createVirtualRouterProviderResponse(VirtualRouterProvider result) {
|
||||
VirtualRouterProviderResponse response = new VirtualRouterProviderResponse();
|
||||
@ -3206,6 +3202,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
response.setObjectName("virtualrouterelement");
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LBStickinessResponse createLBStickinessPolicyResponse(
|
||||
StickinessPolicy stickinessPolicy, LoadBalancer lb) {
|
||||
@ -3236,7 +3233,8 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
List<? extends StickinessPolicy> stickinessPolicies, LoadBalancer lb) {
|
||||
LBStickinessResponse spResponse = new LBStickinessResponse();
|
||||
|
||||
if (lb == null) return spResponse ;
|
||||
if (lb == null)
|
||||
return spResponse;
|
||||
spResponse.setlbRuleId(lb.getId());
|
||||
Account account = ApiDBUtils.findAccountById(lb.getAccountId());
|
||||
if (account != null) {
|
||||
@ -3285,4 +3283,5 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
response.setObjectName("storagenetworkiprange");
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
/**
|
||||
|
||||
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
|
||||
*
|
||||
* This software is licensed under the GNU General Public License v3 or later.
|
||||
@ -333,7 +334,8 @@ public class ApiServer implements HttpRequestHandler {
|
||||
if ("response".equalsIgnoreCase(paramValue[0])) {
|
||||
responseType = paramValue[1];
|
||||
} else {
|
||||
// according to the servlet spec, the parameter map should be in the form (name=String, value=String[]), so
|
||||
// according to the servlet spec, the parameter map should be in the form (name=String,
|
||||
// value=String[]), so
|
||||
// parameter values will be stored in an array
|
||||
parameterMap.put(/* name */paramValue[0], /* value */new String[] { paramValue[1] });
|
||||
}
|
||||
@ -557,10 +559,13 @@ public class ApiServer implements HttpRequestHandler {
|
||||
auditTrailSb.append(" " + HttpServletResponse.SC_OK + " ");
|
||||
auditTrailSb.append(result);
|
||||
/*
|
||||
* if (command.equals("queryAsyncJobResult")){ //For this command we need to also log job status and job resultcode for
|
||||
* if (command.equals("queryAsyncJobResult")){ //For this command we need to also log job status and job
|
||||
* resultcode for
|
||||
* (Pair<String,Object> pair : resultValues){ String key = pair.first(); if (key.equals("jobstatus")){
|
||||
* auditTrailSb.append(" "); auditTrailSb.append(key); auditTrailSb.append("="); auditTrailSb.append(pair.second());
|
||||
* }else if (key.equals("jobresultcode")){ auditTrailSb.append(" "); auditTrailSb.append(key); auditTrailSb.append("=");
|
||||
* auditTrailSb.append(" "); auditTrailSb.append(key); auditTrailSb.append("=");
|
||||
* auditTrailSb.append(pair.second());
|
||||
* }else if (key.equals("jobresultcode")){ auditTrailSb.append(" "); auditTrailSb.append(key);
|
||||
* auditTrailSb.append("=");
|
||||
* auditTrailSb.append(pair.second()); } } }else { for (Pair<String,Object> pair : resultValues){ if
|
||||
* (pair.first().equals("jobid")){ // Its an async job so report the jobid auditTrailSb.append(" ");
|
||||
* auditTrailSb.append(pair.first()); auditTrailSb.append("="); auditTrailSb.append(pair.second()); } } }
|
||||
@ -861,7 +866,8 @@ public class ApiServer implements HttpRequestHandler {
|
||||
|
||||
// FIXME: the following two threads are copied from
|
||||
// http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpServer.java
|
||||
// we have to cite a license if we are using this code directly, so we need to add the appropriate citation or modify the
|
||||
// we have to cite a license if we are using this code directly, so we need to add the appropriate citation or
|
||||
// modify the
|
||||
// code to be very specific to our needs
|
||||
static class ListenerThread extends Thread {
|
||||
private HttpService _httpService = null;
|
||||
|
||||
@ -48,13 +48,15 @@ import com.cloud.utils.component.Manager;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
|
||||
/**
|
||||
* ConfigurationManager handles adding pods/zones, changing IP ranges, enabling external firewalls, and editing configuration values
|
||||
* ConfigurationManager handles adding pods/zones, changing IP ranges, enabling external firewalls, and editing
|
||||
* configuration values
|
||||
*
|
||||
*/
|
||||
public interface ConfigurationManager extends ConfigurationService, Manager {
|
||||
|
||||
/**
|
||||
* Updates a configuration entry with a new value
|
||||
*
|
||||
* @param userId
|
||||
* @param name
|
||||
* @param value
|
||||
@ -63,6 +65,7 @@ public interface ConfigurationManager extends ConfigurationService, Manager {
|
||||
|
||||
/**
|
||||
* Creates a new service offering
|
||||
*
|
||||
* @param name
|
||||
* @param cpu
|
||||
* @param ramSize
|
||||
@ -72,15 +75,18 @@ public interface ConfigurationManager extends ConfigurationService, Manager {
|
||||
* @param offerHA
|
||||
* @param domainId
|
||||
* @param hostTag
|
||||
* @param networkRate TODO
|
||||
* @param networkRate
|
||||
* TODO
|
||||
* @param id
|
||||
* @param useVirtualNetwork
|
||||
* @return ID
|
||||
*/
|
||||
ServiceOfferingVO createServiceOffering(long userId, boolean isSystem, VirtualMachine.Type vm_typeType, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired, boolean offerHA, boolean limitResourceUse, String tags, Long domainId, String hostTag, Integer networkRate);
|
||||
ServiceOfferingVO createServiceOffering(long userId, boolean isSystem, VirtualMachine.Type vm_typeType, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired,
|
||||
boolean offerHA, boolean limitResourceUse, String tags, Long domainId, String hostTag, Integer networkRate);
|
||||
|
||||
/**
|
||||
* Creates a new disk offering
|
||||
*
|
||||
* @param domainId
|
||||
* @param name
|
||||
* @param description
|
||||
@ -93,6 +99,7 @@ public interface ConfigurationManager extends ConfigurationService, Manager {
|
||||
|
||||
/**
|
||||
* Creates a new pod
|
||||
*
|
||||
* @param userId
|
||||
* @param podName
|
||||
* @param zoneId
|
||||
@ -101,13 +108,15 @@ public interface ConfigurationManager extends ConfigurationService, Manager {
|
||||
* @param startIp
|
||||
* @param endIp
|
||||
* @param allocationState
|
||||
* @param skipGatewayOverlapCheck (true if it is ok to not validate that gateway IP address overlap with Start/End IP of the POD)
|
||||
* @param skipGatewayOverlapCheck
|
||||
* (true if it is ok to not validate that gateway IP address overlap with Start/End IP of the POD)
|
||||
* @return Pod
|
||||
*/
|
||||
HostPodVO createPod(long userId, String podName, long zoneId, String gateway, String cidr, String startIp, String endIp, String allocationState, boolean skipGatewayOverlapCheck);
|
||||
|
||||
/**
|
||||
* Creates a new zone
|
||||
*
|
||||
* @param userId
|
||||
* @param zoneName
|
||||
* @param dns1
|
||||
@ -116,36 +125,44 @@ public interface ConfigurationManager extends ConfigurationService, Manager {
|
||||
* @param internalDns2
|
||||
* @param zoneType
|
||||
* @param allocationState
|
||||
* @param networkDomain TODO
|
||||
* @param isSecurityGroupEnabled TODO
|
||||
* @param networkDomain
|
||||
* TODO
|
||||
* @param isSecurityGroupEnabled
|
||||
* TODO
|
||||
* @return
|
||||
* @throws
|
||||
* @throws
|
||||
*/
|
||||
DataCenterVO createZone(long userId, String zoneName, String dns1, String dns2, String internalDns1, String internalDns2, String domain, Long domainId, NetworkType zoneType, String allocationState, String networkDomain, boolean isSecurityGroupEnabled);
|
||||
DataCenterVO createZone(long userId, String zoneName, String dns1, String dns2, String internalDns1, String internalDns2, String domain, Long domainId, NetworkType zoneType, String allocationState,
|
||||
String networkDomain, boolean isSecurityGroupEnabled);
|
||||
|
||||
/**
|
||||
* Deletes a VLAN from the database, along with all of its IP addresses. Will not delete VLANs that have allocated IP addresses.
|
||||
* Deletes a VLAN from the database, along with all of its IP addresses. Will not delete VLANs that have allocated
|
||||
* IP addresses.
|
||||
*
|
||||
* @param userId
|
||||
* @param vlanDbId
|
||||
* @return success/failure
|
||||
*/
|
||||
boolean deleteVlanAndPublicIpRange(long userId, long vlanDbId);
|
||||
|
||||
|
||||
/**
|
||||
* Adds/deletes private IPs
|
||||
* @param add - either true or false
|
||||
*
|
||||
* @param add
|
||||
* - either true or false
|
||||
* @param podId
|
||||
* @param startIP
|
||||
* @param endIP
|
||||
* @return Message to display to user
|
||||
* @throws if unable to add private ip range
|
||||
* @throws if
|
||||
* unable to add private ip range
|
||||
*/
|
||||
String changePrivateIPRange(boolean add, long podId, String startIP, String endIP);
|
||||
|
||||
/**
|
||||
* Converts a comma separated list of tags to a List
|
||||
*
|
||||
* @param tags
|
||||
* @return List of tags
|
||||
*/
|
||||
@ -153,6 +170,7 @@ public interface ConfigurationManager extends ConfigurationService, Manager {
|
||||
|
||||
/**
|
||||
* Converts a List of tags to a comma separated list
|
||||
*
|
||||
* @param tags
|
||||
* @return String containing a comma separated list of tags
|
||||
*/
|
||||
@ -167,29 +185,40 @@ public interface ConfigurationManager extends ConfigurationService, Manager {
|
||||
void checkDiskOfferingAccess(Account caller, DiskOffering dof)
|
||||
throws PermissionDeniedException;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new network offering
|
||||
*
|
||||
* @param name
|
||||
* @param displayText
|
||||
* @param trafficType
|
||||
* @param tags
|
||||
* @param networkRate TODO
|
||||
* @param serviceProviderMap TODO
|
||||
* @param isDefault TODO
|
||||
* @param type TODO
|
||||
* @param systemOnly TODO
|
||||
* @param networkRate
|
||||
* TODO
|
||||
* @param serviceProviderMap
|
||||
* TODO
|
||||
* @param isDefault
|
||||
* TODO
|
||||
* @param type
|
||||
* TODO
|
||||
* @param systemOnly
|
||||
* TODO
|
||||
* @param serviceOfferingId
|
||||
* @param specifyIpRanges TODO
|
||||
* @param specifyIpRanges
|
||||
* TODO
|
||||
* @param id
|
||||
* @param specifyVlan;
|
||||
* @param conserveMode;
|
||||
* @param specifyVlan
|
||||
* ;
|
||||
* @param conserveMode
|
||||
* ;
|
||||
* @return network offering object
|
||||
*/
|
||||
|
||||
NetworkOfferingVO createNetworkOffering(long userId, String name, String displayText, TrafficType trafficType, String tags, boolean specifyVlan, Availability availability, Integer networkRate, Map<Service, Set<Provider>> serviceProviderMap, boolean isDefault, Network.GuestType type, boolean systemOnly, Long serviceOfferingId, boolean conserveMode, Map<Service, Map<Capability, String>> serviceCapabilityMap, boolean specifyIpRanges);
|
||||
NetworkOfferingVO createNetworkOffering(long userId, String name, String displayText, TrafficType trafficType, String tags, boolean specifyVlan, Availability availability, Integer networkRate,
|
||||
Map<Service, Set<Provider>> serviceProviderMap, boolean isDefault, Network.GuestType type, boolean systemOnly, Long serviceOfferingId, boolean conserveMode,
|
||||
Map<Service, Map<Capability, String>> serviceCapabilityMap, boolean specifyIpRanges);
|
||||
|
||||
Vlan createVlanAndPublicIpRange(Long userId, Long zoneId, Long podId, String startIP, String endIP, String vlanGateway, String vlanNetmask, boolean forVirtualNetwork, String vlanId, Account account, long networkId, Long physicalNetworkId) throws InsufficientCapacityException, ConcurrentOperationException, InvalidParameterValueException;
|
||||
Vlan createVlanAndPublicIpRange(Long userId, Long zoneId, Long podId, String startIP, String endIP, String vlanGateway, String vlanNetmask, boolean forVirtualNetwork, String vlanId, Account account, long networkId,
|
||||
Long physicalNetworkId) throws InsufficientCapacityException, ConcurrentOperationException, InvalidParameterValueException;
|
||||
|
||||
void createDefaultSystemNetworks(long zoneId) throws ConcurrentOperationException;
|
||||
|
||||
@ -203,6 +232,7 @@ public interface ConfigurationManager extends ConfigurationService, Manager {
|
||||
|
||||
/**
|
||||
* Edits a pod in the database. Will not allow you to edit pods that are being used anywhere in the system.
|
||||
*
|
||||
* @param id
|
||||
* @param name
|
||||
* @param startIp
|
||||
|
||||
@ -341,7 +341,6 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
throw new CloudRuntimeException("Failed to update configuration value. Please contact Cloud Support.");
|
||||
}
|
||||
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
if (Config.XenGuestNetwork.key().equalsIgnoreCase(name)) {
|
||||
String sql = "update host_details set value=? where name=?";
|
||||
@ -705,7 +704,8 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
String checkPodCIDRs = _configDao.getValue("check.pod.cidrs");
|
||||
if (checkPodCIDRs == null || checkPodCIDRs.trim().isEmpty() || Boolean.parseBoolean(checkPodCIDRs)) {
|
||||
checkPodCidrSubnets(zoneId, podId, cidr);
|
||||
/* Commenting out due to Bug 11593 - CIDR conflicts with zone when extending pod but not when creating it
|
||||
/*
|
||||
* Commenting out due to Bug 11593 - CIDR conflicts with zone when extending pod but not when creating it
|
||||
*
|
||||
* checkCidrVlanOverlap(zoneId, cidr);
|
||||
*/
|
||||
@ -1177,8 +1177,10 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
List<HostPodVO> podsInZone = _podDao.listByDataCenterId(zoneId);
|
||||
for (HostPodVO hostPod : podsInZone) {
|
||||
String[] IpRange = hostPod.getDescription().split("-");
|
||||
if (IpRange[0]==null || IpRange[1]==null) continue;
|
||||
if (!NetUtils.isValidIp(IpRange[0]) || !NetUtils.isValidIp(IpRange[1])) continue;
|
||||
if (IpRange[0] == null || IpRange[1] == null)
|
||||
continue;
|
||||
if (!NetUtils.isValidIp(IpRange[0]) || !NetUtils.isValidIp(IpRange[1]))
|
||||
continue;
|
||||
if (NetUtils.ipRangesOverlap(startIp, endIp, IpRange[0], IpRange[1])) {
|
||||
throw new InvalidParameterValueException("The Start IP and endIP address range overlap with private IP :" + IpRange[0] + ":" + IpRange[1]);
|
||||
}
|
||||
@ -1228,7 +1230,6 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@DB
|
||||
public boolean updateLDAP(LDAPConfigCmd cmd) {
|
||||
@ -1266,51 +1267,58 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
DirContext ctx = new InitialDirContext(env);
|
||||
ctx.close();
|
||||
|
||||
|
||||
// store the result in DB COnfiguration
|
||||
ConfigurationVO cvo = _configDao.findByName(LDAPParams.hostname.toString());
|
||||
if (cvo == null) {
|
||||
cvo = new ConfigurationVO("Advanced", "DEFAULT", "management-server", LDAPParams.hostname.toString(), null, "Hostname or ip address of the ldap server eg: my.ldap.com");
|
||||
}
|
||||
cvo.setValue(hostname); _configDao.persist(cvo);
|
||||
cvo.setValue(hostname);
|
||||
_configDao.persist(cvo);
|
||||
|
||||
cvo = _configDao.findByName(LDAPParams.port.toString());
|
||||
if (cvo == null) {
|
||||
cvo = new ConfigurationVO("Advanced", "DEFAULT", "management-server", LDAPParams.port.toString(), null, "Specify the LDAP port if required, default is 389");
|
||||
}
|
||||
cvo.setValue(port.toString()); _configDao.persist(cvo);
|
||||
cvo.setValue(port.toString());
|
||||
_configDao.persist(cvo);
|
||||
|
||||
cvo = _configDao.findByName(LDAPParams.queryfilter.toString());
|
||||
if (cvo == null) {
|
||||
cvo = new ConfigurationVO("Advanced","DEFAULT", "management-server", LDAPParams.queryfilter.toString(), null, "You specify a query filter here, which narrows down the users, who can be part of this domain");
|
||||
cvo = new ConfigurationVO("Advanced", "DEFAULT", "management-server", LDAPParams.queryfilter.toString(), null,
|
||||
"You specify a query filter here, which narrows down the users, who can be part of this domain");
|
||||
}
|
||||
cvo.setValue(queryFilter); _configDao.persist(cvo);
|
||||
cvo.setValue(queryFilter);
|
||||
_configDao.persist(cvo);
|
||||
|
||||
cvo = _configDao.findByName(LDAPParams.searchbase.toString());
|
||||
if (cvo == null) {
|
||||
cvo = new ConfigurationVO("Advanced","DEFAULT", "management-server", LDAPParams.searchbase.toString(), null, "The search base defines the starting point for the search in the directory tree Example: dc=cloud,dc=com.");
|
||||
cvo = new ConfigurationVO("Advanced", "DEFAULT", "management-server", LDAPParams.searchbase.toString(), null,
|
||||
"The search base defines the starting point for the search in the directory tree Example: dc=cloud,dc=com.");
|
||||
}
|
||||
cvo.setValue(searchBase); _configDao.persist(cvo);
|
||||
cvo.setValue(searchBase);
|
||||
_configDao.persist(cvo);
|
||||
|
||||
cvo = _configDao.findByName(LDAPParams.usessl.toString());
|
||||
if (cvo == null) {
|
||||
cvo = new ConfigurationVO("Advanced", "DEFAULT", "management-server", LDAPParams.usessl.toString(), null, "Check Use SSL if the external LDAP server is configured for LDAP over SSL.");
|
||||
}
|
||||
cvo.setValue(useSSL.toString()); _configDao.persist(cvo);
|
||||
cvo.setValue(useSSL.toString());
|
||||
_configDao.persist(cvo);
|
||||
|
||||
cvo = _configDao.findByName(LDAPParams.dn.toString());
|
||||
if (cvo == null) {
|
||||
cvo = new ConfigurationVO("Advanced", "DEFAULT", "management-server", LDAPParams.dn.toString(), null, "Specify the distinguished name of a user with the search permission on the directory");
|
||||
}
|
||||
cvo.setValue(bindDN); _configDao.persist(cvo);
|
||||
cvo.setValue(bindDN);
|
||||
_configDao.persist(cvo);
|
||||
|
||||
cvo = _configDao.findByName(LDAPParams.passwd.toString());
|
||||
if (cvo == null) {
|
||||
cvo = new ConfigurationVO("Advanced", "DEFAULT", "management-server", LDAPParams.passwd.toString(), null, "Enter the password");
|
||||
}
|
||||
cvo.setValue(bindPasswd); _configDao.persist(cvo);
|
||||
}
|
||||
catch (NamingException ne){
|
||||
cvo.setValue(bindPasswd);
|
||||
_configDao.persist(cvo);
|
||||
} catch (NamingException ne) {
|
||||
ne.printStackTrace();
|
||||
throw new InvalidParameterValueException("Naming Exception, check you ldap data ! " + ne.getMessage() + (ne.getCause() != null ? ("Caused by:" + ne.getCause().getMessage()) : ""));
|
||||
}
|
||||
@ -1473,7 +1481,8 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
_networkMgr.getDefaultPhysicalNetworkByZoneAndTrafficType(zoneId, TrafficType.Storage);
|
||||
} catch (InvalidParameterValueException noStorage) {
|
||||
PhysicalNetworkTrafficTypeVO mgmtTraffic = _trafficTypeDao.findBy(mgmtPhyNetwork.getId(), TrafficType.Management);
|
||||
_networkMgr.addTrafficTypeToPhysicalNetwork(mgmtPhyNetwork.getId(), TrafficType.Storage.toString(), mgmtTraffic.getXenNetworkLabel(), mgmtTraffic.getKvmNetworkLabel(), mgmtTraffic.getVmwareNetworkLabel(), mgmtTraffic.getSimulatorNetworkLabel(), mgmtTraffic.getVlan());
|
||||
_networkMgr.addTrafficTypeToPhysicalNetwork(mgmtPhyNetwork.getId(), TrafficType.Storage.toString(), mgmtTraffic.getXenNetworkLabel(), mgmtTraffic.getKvmNetworkLabel(),
|
||||
mgmtTraffic.getVmwareNetworkLabel(), mgmtTraffic.getSimulatorNetworkLabel(), mgmtTraffic.getVlan());
|
||||
s_logger.info("No storage traffic type was specified by admin, create default storage traffic on physical network " + mgmtPhyNetwork.getId() + " with same configure of management traffic type");
|
||||
}
|
||||
} catch (InvalidParameterValueException ex) {
|
||||
@ -1547,7 +1556,6 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void createDefaultSystemNetworks(long zoneId) throws ConcurrentOperationException {
|
||||
DataCenterVO zone = _zoneDao.findById(zoneId);
|
||||
@ -2399,7 +2407,8 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
vlan = _vlanDao.persist(vlan);
|
||||
|
||||
if (!savePublicIPRange(startIP, endIP, zoneId, vlan.getId(), networkId, physicalNetworkId)) {
|
||||
throw new CloudRuntimeException("Failed to save IP range. Please contact Cloud Support."); // It can be Direct IP or
|
||||
throw new CloudRuntimeException("Failed to save IP range. Please contact Cloud Support."); // It can be
|
||||
// Direct IP or
|
||||
// Public IP.
|
||||
}
|
||||
|
||||
@ -3126,7 +3135,6 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void validateStaticNatServiceCapablities(Map<Capability, String> staticNatServiceCapabilityMap) {
|
||||
if (staticNatServiceCapabilityMap != null && !staticNatServiceCapabilityMap.isEmpty()) {
|
||||
if (staticNatServiceCapabilityMap.keySet().size() > 1) {
|
||||
@ -3163,7 +3171,8 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
throw new InvalidParameterValueException("SpecifyIpRanges should be true if network offering's type is " + type);
|
||||
}
|
||||
|
||||
//specifyVlan should always be true for Shared network offerings and Isolated network offerings with specifyIpRanges = true
|
||||
// specifyVlan should always be true for Shared network offerings and Isolated network offerings with
|
||||
// specifyIpRanges = true
|
||||
if (!specifyVlan) {
|
||||
if (type == GuestType.Shared) {
|
||||
throw new InvalidParameterValueException("SpecifyVlan should be true if network offering's type is " + type);
|
||||
@ -3176,7 +3185,8 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
if (availability == NetworkOffering.Availability.Required) {
|
||||
boolean canOffBeRequired = (type == GuestType.Isolated && serviceProviderMap.containsKey(Service.SourceNat));
|
||||
if (!canOffBeRequired) {
|
||||
throw new InvalidParameterValueException("Availability can be " + NetworkOffering.Availability.Required + " only for networkOfferings of type " + GuestType.Isolated + " and with " + Service.SourceNat.getName() + " enabled");
|
||||
throw new InvalidParameterValueException("Availability can be " + NetworkOffering.Availability.Required + " only for networkOfferings of type " + GuestType.Isolated + " and with "
|
||||
+ Service.SourceNat.getName() + " enabled");
|
||||
}
|
||||
|
||||
// only one network offering in the system can be Required
|
||||
@ -3230,7 +3240,8 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
}
|
||||
}
|
||||
|
||||
NetworkOfferingVO offering = new NetworkOfferingVO(name, displayText, trafficType, systemOnly, specifyVlan, networkRate, multicastRate, isDefault, availability, tags, type, conserveMode, dedicatedLb, sharedSourceNat, redundantRouter, elasticIp, elasticLb, specifyIpRanges);
|
||||
NetworkOfferingVO offering = new NetworkOfferingVO(name, displayText, trafficType, systemOnly, specifyVlan, networkRate, multicastRate, isDefault, availability, tags, type, conserveMode, dedicatedLb,
|
||||
sharedSourceNat, redundantRouter, elasticIp, elasticLb, specifyIpRanges);
|
||||
|
||||
if (serviceOfferingId != null) {
|
||||
offering.setServiceOfferingId(serviceOfferingId);
|
||||
@ -3528,7 +3539,8 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
if (availability == NetworkOffering.Availability.Required) {
|
||||
boolean canOffBeRequired = (offeringToUpdate.getGuestType() == GuestType.Isolated && _networkMgr.areServicesSupportedByNetworkOffering(offeringToUpdate.getId(), Service.SourceNat));
|
||||
if (!canOffBeRequired) {
|
||||
throw new InvalidParameterValueException("Availability can be " + NetworkOffering.Availability.Required + " only for networkOfferings of type " + GuestType.Isolated + " and with " + Service.SourceNat.getName() + " enabled");
|
||||
throw new InvalidParameterValueException("Availability can be " + NetworkOffering.Availability.Required + " only for networkOfferings of type " + GuestType.Isolated + " and with "
|
||||
+ Service.SourceNat.getName() + " enabled");
|
||||
}
|
||||
|
||||
// only one network offering in the system can be Required
|
||||
|
||||
@ -28,7 +28,10 @@ import com.cloud.utils.db.GenericDao;
|
||||
public interface ResourceLimitDao extends GenericDao<ResourceLimitVO, Long> {
|
||||
|
||||
List<ResourceLimitVO> listByOwner(Long ownerId, ResourceOwnerType ownerType);
|
||||
|
||||
boolean update(Long id, Long max);
|
||||
|
||||
ResourceCount.ResourceType getLimitType(String type);
|
||||
|
||||
ResourceLimitVO findByOwnerIdAndType(long ownerId, ResourceOwnerType ownerType, ResourceCount.ResourceType type);
|
||||
}
|
||||
|
||||
@ -59,7 +59,6 @@ public class ResourceLimitDaoImpl extends GenericDaoBase<ResourceLimitVO, Long>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean update(Long id, Long max) {
|
||||
ResourceLimitVO limit = findById(id);
|
||||
|
||||
@ -385,7 +385,8 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||
try {
|
||||
if (deviceMapLock.lock(120)) {
|
||||
try {
|
||||
boolean dedicatedLB = offering.getDedicatedLB(); // does network offering supports a dedicated load balancer?
|
||||
boolean dedicatedLB = offering.getDedicatedLB(); // does network offering supports a dedicated
|
||||
// load balancer?
|
||||
long lbDeviceId;
|
||||
|
||||
txn.start();
|
||||
@ -398,7 +399,8 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||
lbDeviceId = lbDevice.getId();
|
||||
|
||||
// persist the load balancer device id that will be used for this network. Once a network
|
||||
// is implemented on a LB device then later on all rules will be programmed on to same device
|
||||
// is implemented on a LB device then later on all rules will be programmed on to same
|
||||
// device
|
||||
NetworkExternalLoadBalancerVO networkLB = new NetworkExternalLoadBalancerVO(guestConfig.getId(), lbDeviceId);
|
||||
_networkExternalLBDao.persist(networkLB);
|
||||
|
||||
@ -415,11 +417,13 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||
// if already attempted to provision load balancer then throw out of capacity exception,
|
||||
if (tryLbProvisioning) {
|
||||
retry = false;
|
||||
//TODO: throwing warning instead of error for now as its possible another provider can service this network
|
||||
// TODO: throwing warning instead of error for now as its possible another provider can
|
||||
// service this network
|
||||
s_logger.warn("There are no load balancer device with the capacity for implementing this network");
|
||||
throw exception;
|
||||
} else {
|
||||
tryLbProvisioning = true; // if possible provision a LB appliance in to the physical network
|
||||
tryLbProvisioning = true; // if possible provision a LB appliance in to the physical
|
||||
// network
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
@ -433,14 +437,16 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||
deviceMapLock.releaseRef();
|
||||
}
|
||||
|
||||
// there are no LB devices or there is no free capacity on the devices in the physical network so provision a new LB appliance
|
||||
// there are no LB devices or there is no free capacity on the devices in the physical network so provision
|
||||
// a new LB appliance
|
||||
if (tryLbProvisioning) {
|
||||
// check if LB appliance can be dynamically provisioned
|
||||
List<ExternalLoadBalancerDeviceVO> providerLbDevices = _externalLoadBalancerDeviceDao.listByProviderAndDeviceAllocationState(physicalNetworkId, provider, LBDeviceAllocationState.Provider);
|
||||
if ((providerLbDevices != null) && (!providerLbDevices.isEmpty())) {
|
||||
for (ExternalLoadBalancerDeviceVO lbProviderDevice : providerLbDevices) {
|
||||
if (lbProviderDevice.getState() == LBDeviceState.Enabled) {
|
||||
// acquire a private IP from the data center which will be used as management IP of provisioned LB appliance,
|
||||
// acquire a private IP from the data center which will be used as management IP of
|
||||
// provisioned LB appliance,
|
||||
DataCenterIpAddressVO dcPrivateIp = _dcDao.allocatePrivateIpAddress(guestConfig.getDataCenterId(), lbProviderDevice.getUuid());
|
||||
if (dcPrivateIp == null) {
|
||||
throw new InsufficientNetworkCapacityException("failed to acquire a priavate IP in the zone " + guestConfig.getDataCenterId() +
|
||||
@ -470,10 +476,12 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||
String publicIf = createLbAnswer.getPublicInterface();
|
||||
String privateIf = createLbAnswer.getPrivateInterface();
|
||||
|
||||
//we have provisioned load balancer so add the appliance as cloudstack provisioned external load balancer
|
||||
// we have provisioned load balancer so add the appliance as cloudstack provisioned external
|
||||
// load balancer
|
||||
String dedicatedLb = offering.getDedicatedLB() ? "true" : "false";
|
||||
|
||||
//acquire a public IP to associate with lb appliance (used as subnet IP to make the appliance part of private network)
|
||||
// acquire a public IP to associate with lb appliance (used as subnet IP to make the
|
||||
// appliance part of private network)
|
||||
PublicIp publicIp = _networkMgr.assignPublicIpAddress(guestConfig.getDataCenterId(), null, _accountMgr.getSystemAccount(), VlanType.VirtualNetwork, null, null, false);
|
||||
String publicIPNetmask = publicIp.getVlanNetmask();
|
||||
String publicIPgateway = publicIp.getVlanGateway();
|
||||
@ -490,7 +498,8 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||
}
|
||||
|
||||
if (lbAppliance != null) {
|
||||
// mark the load balancer as cloudstack managed and set parent host id on which lb appliance is provisioned
|
||||
// mark the load balancer as cloudstack managed and set parent host id on which lb
|
||||
// appliance is provisioned
|
||||
ExternalLoadBalancerDeviceVO managedLb = _externalLoadBalancerDeviceDao.findById(lbAppliance.getId());
|
||||
managedLb.setIsManagedDevice(true);
|
||||
managedLb.setParentHostId(lbProviderDevice.getHostId());
|
||||
@ -504,7 +513,8 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||
if (answer == null || !answer.getResult()) {
|
||||
s_logger.warn("Failed to destroy load balancer appliance created");
|
||||
} else {
|
||||
// release the public & private IP back to dc pool, as the load balancer appliance is now destroyed
|
||||
// release the public & private IP back to dc pool, as the load balancer
|
||||
// appliance is now destroyed
|
||||
_dcDao.releasePrivateIpAddress(lbIP, guestConfig.getDataCenterId(), null);
|
||||
_networkMgr.releasePublicIpAddress(publicIp.getId(), _accountMgr.getSystemUser().getId(), _accountMgr.getSystemAccount());
|
||||
}
|
||||
@ -583,7 +593,8 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||
}
|
||||
}
|
||||
|
||||
// if we are here then there are no existing LB devices in shared use or the devices in shared use has no free capacity left
|
||||
// if we are here then there are no existing LB devices in shared use or the devices in shared use has no
|
||||
// free capacity left
|
||||
// so allocate a new load balancer configured for shared use from the pool of free LB devices
|
||||
lbDevices = _externalLoadBalancerDeviceDao.listByProviderAndDeviceAllocationState(physicalNetworkId, provider, LBDeviceAllocationState.Free);
|
||||
if (lbDevices != null && !lbDevices.isEmpty()) {
|
||||
@ -619,7 +630,8 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||
boolean lbCloudManaged = lbDevice.getIsManagedDevice();
|
||||
|
||||
if (!lbInUse && !lbCloudManaged) {
|
||||
// this is the last network mapped to the load balancer device so set device allocation state to be free
|
||||
// this is the last network mapped to the load balancer device so set device allocation state to be
|
||||
// free
|
||||
lbDevice.setAllocationState(LBDeviceAllocationState.Free);
|
||||
_externalLoadBalancerDeviceDao.update(lbDevice.getId(), lbDevice);
|
||||
}
|
||||
@ -822,7 +834,8 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||
mapping = new InlineLoadBalancerNicMapVO(rule.getId(), srcIp, loadBalancingIpNic.getId());
|
||||
_inlineLoadBalancerNicMapDao.persist(mapping);
|
||||
|
||||
// On the firewall provider for the network, create a static NAT rule between the source IP address and the load balancing IP address
|
||||
// On the firewall provider for the network, create a static NAT rule between the source IP
|
||||
// address and the load balancing IP address
|
||||
applyStaticNatRuleForInlineLBRule(zone, network, firewallProviderHost, revoked, srcIp, loadBalancingIpNic.getIp4Address());
|
||||
} else {
|
||||
loadBalancingIpNic = _nicDao.findById(mapping.getNicId());
|
||||
@ -832,7 +845,8 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||
// Find the NIC that the mapping refers to
|
||||
loadBalancingIpNic = _nicDao.findById(mapping.getNicId());
|
||||
|
||||
// On the firewall provider for the network, delete the static NAT rule between the source IP address and the load balancing IP address
|
||||
// On the firewall provider for the network, delete the static NAT rule between the source IP
|
||||
// address and the load balancing IP address
|
||||
applyStaticNatRuleForInlineLBRule(zone, network, firewallProviderHost, revoked, srcIp, loadBalancingIpNic.getIp4Address());
|
||||
|
||||
// Delete the mapping between the source IP address and the load balancing IP address
|
||||
@ -1212,7 +1226,8 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||
|
||||
/*
|
||||
* Creates/updates all necessary stats entries for an account and zone.
|
||||
* Stats entries are created for source NAT IP addresses, static NAT rules, port forwarding rules, and load balancing rules
|
||||
* Stats entries are created for source NAT IP addresses, static NAT rules, port forwarding rules, and load
|
||||
* balancing rules
|
||||
*/
|
||||
private boolean manageStatsEntries(boolean create, long accountId, long zoneId, Network network,
|
||||
HostVO externalLoadBalancer, ExternalNetworkResourceUsageAnswer lbAnswer) {
|
||||
@ -1390,4 +1405,5 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||
}
|
||||
return new DeleteHostAnswer(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -35,7 +35,6 @@ import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.InsufficientVirtualNetworkCapcityException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.network.Network.Capability;
|
||||
@ -73,11 +72,14 @@ public interface NetworkManager extends NetworkService {
|
||||
* @param owner
|
||||
* @param type
|
||||
* @param networkId
|
||||
* @param requestedIp TODO
|
||||
* @param allocatedBy TODO
|
||||
* @param requestedIp
|
||||
* TODO
|
||||
* @param allocatedBy
|
||||
* TODO
|
||||
* @return
|
||||
* @throws InsufficientAddressCapacityException
|
||||
*/
|
||||
|
||||
PublicIp assignPublicIpAddress(long dcId, Long podId, Account owner, VlanType type, Long networkId, String requestedIp, boolean isElastic) throws InsufficientAddressCapacityException;
|
||||
|
||||
/**
|
||||
@ -169,7 +171,8 @@ public interface NetworkManager extends NetworkService {
|
||||
|
||||
/**
|
||||
* @throws InsufficientCapacityException
|
||||
* Associates an ip address list to an account. The list of ip addresses are all addresses associated with the
|
||||
* Associates an ip address list to an account. The list of ip addresses are all addresses associated
|
||||
* with the
|
||||
* given vlan id.
|
||||
* @param userId
|
||||
* @param accountId
|
||||
|
||||
@ -278,19 +278,32 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
PortForwardingRulesDao _portForwardingDao;
|
||||
@Inject
|
||||
ResourceLimitService _resourceLimitMgr;
|
||||
@Inject DomainRouterDao _routerDao;
|
||||
@Inject DomainManager _domainMgr;
|
||||
@Inject ProjectManager _projectMgr;
|
||||
@Inject NetworkOfferingServiceMapDao _ntwkOfferingSrvcDao;
|
||||
@Inject PhysicalNetworkDao _physicalNetworkDao;
|
||||
@Inject PhysicalNetworkServiceProviderDao _pNSPDao;
|
||||
@Inject PortForwardingRulesDao _portForwardingRulesDao;
|
||||
@Inject LoadBalancerDao _lbDao;
|
||||
@Inject PhysicalNetworkTrafficTypeDao _pNTrafficTypeDao;
|
||||
@Inject AgentManager _agentMgr;
|
||||
@Inject HostDao _hostDao;
|
||||
@Inject NetworkServiceMapDao _ntwkSrvcDao;
|
||||
@Inject StorageNetworkManager _stnwMgr;
|
||||
@Inject
|
||||
DomainRouterDao _routerDao;
|
||||
@Inject
|
||||
DomainManager _domainMgr;
|
||||
@Inject
|
||||
ProjectManager _projectMgr;
|
||||
@Inject
|
||||
NetworkOfferingServiceMapDao _ntwkOfferingSrvcDao;
|
||||
@Inject
|
||||
PhysicalNetworkDao _physicalNetworkDao;
|
||||
@Inject
|
||||
PhysicalNetworkServiceProviderDao _pNSPDao;
|
||||
@Inject
|
||||
PortForwardingRulesDao _portForwardingRulesDao;
|
||||
@Inject
|
||||
LoadBalancerDao _lbDao;
|
||||
@Inject
|
||||
PhysicalNetworkTrafficTypeDao _pNTrafficTypeDao;
|
||||
@Inject
|
||||
AgentManager _agentMgr;
|
||||
@Inject
|
||||
HostDao _hostDao;
|
||||
@Inject
|
||||
NetworkServiceMapDao _ntwkSrvcDao;
|
||||
@Inject
|
||||
StorageNetworkManager _stnwMgr;
|
||||
|
||||
private final HashMap<String, NetworkOfferingVO> _systemNetworks = new HashMap<String, NetworkOfferingVO>(5);
|
||||
|
||||
@ -311,7 +324,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
|
||||
private Map<String, String> _configs;
|
||||
|
||||
|
||||
HashMap<Long, Long> _lastNetworkIdsToFree = new HashMap<Long, Long>();
|
||||
|
||||
private static HashMap<Service, List<Provider>> s_serviceToImplementedProvidersMap = new HashMap<Service, List<Provider>>();
|
||||
@ -378,7 +390,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
}
|
||||
sc.setJoinParameters("vlan", "type", vlanUse);
|
||||
|
||||
|
||||
if (requestedIp != null) {
|
||||
sc.addAnd("address", SearchCriteria.Op.EQ, requestedIp);
|
||||
errorMessage.append(": requested ip " + requestedIp + " is not available");
|
||||
@ -426,8 +437,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
|
||||
long macAddress = NetUtils.createSequenceBasedMacAddress(addr.getMacAddress());
|
||||
|
||||
|
||||
|
||||
return new PublicIp(addr, _vlanDao.findById(addr.getVlanId()), macAddress);
|
||||
}
|
||||
|
||||
@ -598,7 +607,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
markPublicIpAsAllocated(addr);
|
||||
|
||||
} else if (addr.getState() == IpAddress.State.Releasing) {
|
||||
// Cleanup all the resources for ip address if there are any, and only then un-assign ip in the system
|
||||
// Cleanup all the resources for ip address if there are any, and only then un-assign ip in the
|
||||
// system
|
||||
if (cleanupIpResources(addr.getId(), Account.ACCOUNT_ID_SYSTEM, _accountMgr.getSystemAccount())) {
|
||||
_ipAddressDao.unassignIpAddress(addr.getId());
|
||||
} else {
|
||||
@ -665,7 +675,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
}
|
||||
ipToServices.put(ip, services);
|
||||
|
||||
//if IP in allocating state then it will not have any rules attached so skip IPAssoc to network service provider
|
||||
// if IP in allocating state then it will not have any rules attached so skip IPAssoc to network service
|
||||
// provider
|
||||
if (ip.getState() == State.Allocating) {
|
||||
continue;
|
||||
}
|
||||
@ -673,18 +684,21 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
// check if any active rules are applied on the public IP
|
||||
Set<Purpose> purposes = getPublicIpPurposeInRules(ip, false, includingFirewall);
|
||||
if (purposes == null || purposes.isEmpty()) {
|
||||
// since no active rules are there check if any rules are applied on the public IP but are in revoking state
|
||||
// since no active rules are there check if any rules are applied on the public IP but are in
|
||||
// revoking state
|
||||
purposes = getPublicIpPurposeInRules(ip, true, includingFirewall);
|
||||
if (purposes == null || purposes.isEmpty()) {
|
||||
// IP is not being used for any purpose so skip IPAssoc to network service provider
|
||||
continue;
|
||||
} else {
|
||||
if (rulesRevoked) {
|
||||
// no active rules/revoked rules are associated with this public IP, so remove the association with the provider
|
||||
// no active rules/revoked rules are associated with this public IP, so remove the
|
||||
// association with the provider
|
||||
ip.setState(State.Releasing);
|
||||
} else {
|
||||
if (ip.getState() == State.Releasing) {
|
||||
// rules are not revoked yet, so don't let the network service provider revoke the IP association
|
||||
// rules are not revoked yet, so don't let the network service provider revoke the IP
|
||||
// association
|
||||
// mark IP is allocated so that IP association will not be removed from the provider
|
||||
ip.setState(State.Allocated);
|
||||
}
|
||||
@ -945,10 +959,12 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
|
||||
// In Advance zone only allow to do IP assoc for Isolated networks with source nat service enabled
|
||||
if (zone.getNetworkType() == NetworkType.Advanced && !(network.getGuestType() == GuestType.Isolated && areServicesSupportedInNetwork(network.getId(), Service.SourceNat))) {
|
||||
throw new InvalidParameterValueException("In zone of type " + NetworkType.Advanced + " ip address can be associated only to the network of guest type " + GuestType.Isolated + " with the " + Service.SourceNat.getName() + " enabled");
|
||||
throw new InvalidParameterValueException("In zone of type " + NetworkType.Advanced + " ip address can be associated only to the network of guest type " + GuestType.Isolated + " with the "
|
||||
+ Service.SourceNat.getName() + " enabled");
|
||||
}
|
||||
|
||||
// Check that network belongs to IP owner - skip this check for Basic zone as there is just one guest network, and it
|
||||
// Check that network belongs to IP owner - skip this check for Basic zone as there is just one guest network,
|
||||
// and it
|
||||
// belongs to the system
|
||||
if (zone.getNetworkType() != NetworkType.Basic && network.getAccountId() != ipOwner.getId()) {
|
||||
throw new InvalidParameterValueException("The owner of the network is not the same as owner of the IP");
|
||||
@ -1058,7 +1074,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
s_logger.warn("Failed to associate ip address " + ip);
|
||||
_ipAddressDao.markAsUnavailable(ip.getId());
|
||||
if (!applyIpAssociations(network, true)) {
|
||||
// if fail to apply ip assciations again, unassign ip address without updating resource count and
|
||||
// if fail to apply ip assciations again, unassign ip address without updating resource
|
||||
// count and
|
||||
// generating usage event as there is no need to keep it in the db
|
||||
_ipAddressDao.unassignIpAddress(ip.getId());
|
||||
}
|
||||
@ -1112,7 +1129,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
return success;
|
||||
}
|
||||
|
||||
@Override @DB
|
||||
@Override
|
||||
@DB
|
||||
public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
|
||||
_name = name;
|
||||
|
||||
@ -1178,25 +1196,29 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
|
||||
NetworkOfferingVO offering = null;
|
||||
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOfferingWithSGService) == null) {
|
||||
offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.DefaultSharedNetworkOfferingWithSGService, "Offering for Shared Security group enabled networks", TrafficType.Guest, null, true, Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true, null, true);
|
||||
offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.DefaultSharedNetworkOfferingWithSGService, "Offering for Shared Security group enabled networks", TrafficType.Guest,
|
||||
null, true, Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true, null, true);
|
||||
offering.setState(NetworkOffering.State.Enabled);
|
||||
_networkOfferingDao.update(offering.getId(), offering);
|
||||
}
|
||||
|
||||
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOffering) == null) {
|
||||
offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.DefaultSharedNetworkOffering, "Offering for Shared networks", TrafficType.Guest, null, true, Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true, null, true);
|
||||
offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.DefaultSharedNetworkOffering, "Offering for Shared networks", TrafficType.Guest, null, true, Availability.Optional,
|
||||
null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true, null, true);
|
||||
offering.setState(NetworkOffering.State.Enabled);
|
||||
_networkOfferingDao.update(offering.getId(), offering);
|
||||
}
|
||||
|
||||
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService) == null) {
|
||||
offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM,NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService, "Offering for Isolated networks with Source Nat service enabled", TrafficType.Guest, null, false, Availability.Required, null, defaultIsolatedSourceNatEnabledNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null, true, null, false);
|
||||
offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService, "Offering for Isolated networks with Source Nat service enabled",
|
||||
TrafficType.Guest, null, false, Availability.Required, null, defaultIsolatedSourceNatEnabledNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null, true, null, false);
|
||||
offering.setState(NetworkOffering.State.Enabled);
|
||||
_networkOfferingDao.update(offering.getId(), offering);
|
||||
}
|
||||
|
||||
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOffering) == null) {
|
||||
offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.DefaultIsolatedNetworkOffering, "Offering for Isolated networks with no Source Nat service", TrafficType.Guest, null, true, Availability.Optional, null, defaultIsolatedNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null, true, null, true);
|
||||
offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.DefaultIsolatedNetworkOffering, "Offering for Isolated networks with no Source Nat service", TrafficType.Guest, null,
|
||||
true, Availability.Optional, null, defaultIsolatedNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null, true, null, true);
|
||||
offering.setState(NetworkOffering.State.Enabled);
|
||||
_networkOfferingDao.update(offering.getId(), offering);
|
||||
}
|
||||
@ -1338,7 +1360,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
}
|
||||
|
||||
try {
|
||||
if (predefined == null || (offering.getTrafficType() != TrafficType.Guest && predefined.getCidr() == null && predefined.getBroadcastUri() == null && predefined.getBroadcastDomainType() != BroadcastDomainType.Vlan)) {
|
||||
if (predefined == null
|
||||
|| (offering.getTrafficType() != TrafficType.Guest && predefined.getCidr() == null && predefined.getBroadcastUri() == null && predefined.getBroadcastDomainType() != BroadcastDomainType.Vlan)) {
|
||||
List<NetworkVO> configs = _networksDao.listBy(owner.getId(), offering.getId(), plan.getDataCenterId());
|
||||
if (configs.size() > 0) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
@ -1495,7 +1518,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
nics.add(vo);
|
||||
|
||||
Integer networkRate = getNetworkRate(config.getId(), vm.getId());
|
||||
vm.addNic(new NicProfile(vo, network.first(), vo.getBroadcastUri(), vo.getIsolationUri(), networkRate, isSecurityGroupSupportedInNetwork(network.first()), getNetworkTag(vm.getHypervisorType(), network.first())));
|
||||
vm.addNic(new NicProfile(vo, network.first(), vo.getBroadcastUri(), vo.getIsolationUri(), networkRate, isSecurityGroupSupportedInNetwork(network.first()), getNetworkTag(vm.getHypervisorType(),
|
||||
network.first())));
|
||||
}
|
||||
|
||||
if (nics.size() != networks.size()) {
|
||||
@ -1660,7 +1684,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
|
||||
private void implementNetworkElementsAndResources(DeployDestination dest, ReservationContext context, NetworkVO network, NetworkOfferingVO offering)
|
||||
throws ConcurrentOperationException, InsufficientAddressCapacityException, ResourceUnavailableException, InsufficientCapacityException {
|
||||
// If this is a 1) guest virtual network 2) network has sourceNat service 3) network offering does not support a Shared source NAT rule,
|
||||
// If this is a 1) guest virtual network 2) network has sourceNat service 3) network offering does not support a
|
||||
// Shared source NAT rule,
|
||||
// associate a source NAT IP (if one isn't already associated with the network)
|
||||
|
||||
boolean sharedSourceNat = offering.getSharedSourceNat();
|
||||
@ -1737,7 +1762,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
ConcurrentOperationException, ResourceUnavailableException {
|
||||
List<NicVO> nics = _nicDao.listByVmId(vmProfile.getId());
|
||||
|
||||
// we have to implement default nics first - to ensure that default network elements start up first in multiple nics
|
||||
// we have to implement default nics first - to ensure that default network elements start up first in multiple
|
||||
// nics
|
||||
// case)
|
||||
// (need for setting DNS on Dhcp to domR's Ip4 address)
|
||||
Collections.sort(nics, new Comparator<NicVO>() {
|
||||
@ -1933,7 +1959,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated // No one is using this method.
|
||||
@Deprecated
|
||||
// No one is using this method.
|
||||
public AccountVO getNetworkOwner(long networkId) {
|
||||
SearchCriteria<AccountVO> sc = AccountsUsingNetworkSearch.create();
|
||||
sc.setJoinParameters("nc", "config", networkId);
|
||||
@ -1942,7 +1969,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
return accounts.size() != 0 ? accounts.get(0) : null;
|
||||
}
|
||||
|
||||
@Deprecated // No one is using this method.
|
||||
@Deprecated
|
||||
// No one is using this method.
|
||||
public List<NetworkVO> getNetworksforOffering(long offeringId, long dataCenterId, long accountId) {
|
||||
return _networksDao.getNetworksForOffering(offeringId, dataCenterId, accountId);
|
||||
}
|
||||
@ -2201,7 +2229,9 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
}
|
||||
|
||||
// Regular user can create Guest Isolated Source Nat enabled network only
|
||||
if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL && (networkOffering.getTrafficType() != TrafficType.Guest || networkOffering.getGuestType() != Network.GuestType.Isolated && areServicesSupportedByNetworkOffering(networkOffering.getId(), Service.SourceNat))) {
|
||||
if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL
|
||||
&& (networkOffering.getTrafficType() != TrafficType.Guest || networkOffering.getGuestType() != Network.GuestType.Isolated
|
||||
&& areServicesSupportedByNetworkOffering(networkOffering.getId(), Service.SourceNat))) {
|
||||
throw new InvalidParameterValueException("Regular user can create a network only from the network offering having traffic type " + TrafficType.Guest + " and network type "
|
||||
+ Network.GuestType.Isolated + " with a service " + Service.SourceNat.getName() + " enabled");
|
||||
}
|
||||
@ -2304,7 +2334,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
|
||||
// if zone is basic, only Shared network offerings w/o source nat service are allowed
|
||||
if (!(networkOffering.getGuestType() == GuestType.Shared && !areServicesSupportedByNetworkOffering(networkOffering.getId(), Service.SourceNat))) {
|
||||
throw new InvalidParameterValueException("For zone of type " + NetworkType.Basic + " only offerings of guestType " + GuestType.Shared + " with disabled " + Service.SourceNat.getName() + " service are allowed");
|
||||
throw new InvalidParameterValueException("For zone of type " + NetworkType.Basic + " only offerings of guestType " + GuestType.Shared + " with disabled " + Service.SourceNat.getName()
|
||||
+ " service are allowed");
|
||||
}
|
||||
|
||||
// In Basic zone the network should have aclType=Domain, domainId=1, subdomainAccess=true
|
||||
@ -2332,7 +2363,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
|
||||
} else if (zone.getNetworkType() == NetworkType.Advanced) {
|
||||
if (zone.isSecurityGroupEnabled()) {
|
||||
//Only Account specific Isolated network with sourceNat service disabled are allowed in security group enabled zone
|
||||
// Only Account specific Isolated network with sourceNat service disabled are allowed in security group
|
||||
// enabled zone
|
||||
boolean allowCreation = (networkOffering.getGuestType() == GuestType.Isolated && !areServicesSupportedByNetworkOffering(networkOffering.getId(), Service.SourceNat));
|
||||
if (!allowCreation) {
|
||||
throw new InvalidParameterValueException("Only Account specific Isolated network with sourceNat service disabled are allowed in security group enabled zone");
|
||||
@ -2391,11 +2423,14 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
}
|
||||
}
|
||||
|
||||
// In Advance zone Cidr for Shared networks and Isolated networks w/o source nat service can't be NULL - 2.2.x limitation, remove after we introduce support for multiple ip ranges
|
||||
// In Advance zone Cidr for Shared networks and Isolated networks w/o source nat service can't be NULL - 2.2.x
|
||||
// limitation, remove after we introduce support for multiple ip ranges
|
||||
// with different Cidrs for the same Shared network
|
||||
boolean cidrRequired = zone.getNetworkType() == NetworkType.Advanced && networkOffering.getTrafficType() == TrafficType.Guest && (networkOffering.getGuestType() == GuestType.Shared || (networkOffering.getGuestType() == GuestType.Isolated && !areServicesSupportedByNetworkOffering(networkOffering.getId(), Service.SourceNat)));
|
||||
boolean cidrRequired = zone.getNetworkType() == NetworkType.Advanced && networkOffering.getTrafficType() == TrafficType.Guest
|
||||
&& (networkOffering.getGuestType() == GuestType.Shared || (networkOffering.getGuestType() == GuestType.Isolated && !areServicesSupportedByNetworkOffering(networkOffering.getId(), Service.SourceNat)));
|
||||
if (cidr == null && cidrRequired) {
|
||||
throw new InvalidParameterValueException("StartIp/endIp/gateway/netmask are required when create network of type " + Network.GuestType.Shared + " and network of type " + GuestType.Isolated + " with service " + Service.SourceNat.getName() + " disabled");
|
||||
throw new InvalidParameterValueException("StartIp/endIp/gateway/netmask are required when create network of type " + Network.GuestType.Shared + " and network of type " + GuestType.Isolated + " with service "
|
||||
+ Service.SourceNat.getName() + " disabled");
|
||||
}
|
||||
|
||||
// No cidr can be specified in Basic zone
|
||||
@ -2574,16 +2609,24 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
if (isSystem == null || !isSystem) {
|
||||
// Get domain level networks
|
||||
if (domainId != null) {
|
||||
networksToReturn.addAll(listDomainLevelNetworks(buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges), searchFilter, domainId));
|
||||
networksToReturn
|
||||
.addAll(listDomainLevelNetworks(
|
||||
buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges), searchFilter,
|
||||
domainId));
|
||||
}
|
||||
|
||||
if (!permittedAccounts.isEmpty()) {
|
||||
networksToReturn.addAll(listAccountSpecificNetworks(buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges), searchFilter, permittedAccounts));
|
||||
networksToReturn.addAll(listAccountSpecificNetworks(
|
||||
buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges), searchFilter,
|
||||
permittedAccounts));
|
||||
} else if (domainId == null || listAll) {
|
||||
networksToReturn.addAll(listAccountSpecificNetworksByDomainPath(buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges), searchFilter, path, isRecursive));
|
||||
networksToReturn.addAll(listAccountSpecificNetworksByDomainPath(
|
||||
buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges), searchFilter, path,
|
||||
isRecursive));
|
||||
}
|
||||
} else {
|
||||
networksToReturn = _networksDao.search(buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, physicalNetworkId, null, skipProjectNetworks, restartRequired, specifyIpRanges), searchFilter);
|
||||
networksToReturn = _networksDao.search(buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, physicalNetworkId, null, skipProjectNetworks, restartRequired, specifyIpRanges),
|
||||
searchFilter);
|
||||
}
|
||||
|
||||
if (supportedServicesStr != null && !supportedServicesStr.isEmpty() && !networksToReturn.isEmpty()) {
|
||||
@ -2612,7 +2655,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
}
|
||||
}
|
||||
|
||||
private SearchCriteria<NetworkVO> buildNetworkSearchCriteria(SearchBuilder<NetworkVO> sb, String keyword, Long id, Boolean isSystem, Long zoneId, String guestIpType, String trafficType, Long physicalNetworkId, String aclType, boolean skipProjectNetworks, Boolean restartRequired, Boolean specifyIpRanges) {
|
||||
private SearchCriteria<NetworkVO> buildNetworkSearchCriteria(SearchBuilder<NetworkVO> sb, String keyword, Long id, Boolean isSystem, Long zoneId, String guestIpType, String trafficType, Long physicalNetworkId,
|
||||
String aclType, boolean skipProjectNetworks, Boolean restartRequired, Boolean specifyIpRanges) {
|
||||
SearchCriteria<NetworkVO> sc = sb.create();
|
||||
|
||||
if (isSystem != null) {
|
||||
@ -2664,7 +2708,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
return sc;
|
||||
}
|
||||
|
||||
|
||||
private List<NetworkVO> listDomainLevelNetworks(SearchCriteria<NetworkVO> sc, Filter searchFilter, long domainId) {
|
||||
List<Long> networkIds = new ArrayList<Long>();
|
||||
Set<Long> allowedDomains = _domainMgr.getDomainParentIds(domainId);
|
||||
@ -2790,7 +2833,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
}
|
||||
|
||||
private boolean shutdownNetworkElementsAndResources(ReservationContext context, boolean cleanupElements, NetworkVO network) {
|
||||
//1) Cleanup all the rules for the network. If it fails, just log the failure and proceed with shutting down the elements
|
||||
// 1) Cleanup all the rules for the network. If it fails, just log the failure and proceed with shutting down
|
||||
// the elements
|
||||
boolean cleanupResult = true;
|
||||
try {
|
||||
cleanupResult = shutdownNetworkResources(network.getId(), context.getAccount(), context.getCaller().getId());
|
||||
@ -2811,7 +2855,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
if (providersToShutdown.contains(element.getProvider())) {
|
||||
try {
|
||||
if (!isProviderEnabledInPhysicalNetwork(getPhysicalNetworkId(network), "VirtualRouter")) {
|
||||
s_logger.warn("Unable to complete shutdown of the network elements due to element: " + element.getName() + " either doesn't exist or not enabled in the physical network " + getPhysicalNetworkId(network));
|
||||
s_logger.warn("Unable to complete shutdown of the network elements due to element: " + element.getName() + " either doesn't exist or not enabled in the physical network "
|
||||
+ getPhysicalNetworkId(network));
|
||||
success = false;
|
||||
}
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
@ -2886,7 +2931,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
if (providersToDestroy.contains(element.getProvider())) {
|
||||
try {
|
||||
if (!isProviderEnabledInPhysicalNetwork(getPhysicalNetworkId(network), "VirtualRouter")) {
|
||||
s_logger.warn("Unable to complete destroy of the network elements due to element: " + element.getName() + " either doesn't exist or not enabled in the physical network " + getPhysicalNetworkId(network));
|
||||
s_logger.warn("Unable to complete destroy of the network elements due to element: " + element.getName() + " either doesn't exist or not enabled in the physical network "
|
||||
+ getPhysicalNetworkId(network));
|
||||
success = false;
|
||||
}
|
||||
|
||||
@ -2968,6 +3014,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
/* The rules here is only the same kind of rule, e.g. all load balancing rules or all port forwarding rules */
|
||||
public boolean applyRules(List<? extends FirewallRule> rules, boolean continueOnError) throws ResourceUnavailableException {
|
||||
@ -3211,7 +3258,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
_networksDao.update(network.getId(), network);
|
||||
}
|
||||
|
||||
|
||||
// This method re-programs the rules/ips for existing network
|
||||
protected boolean reprogramNetworkRules(long networkId, Account caller, NetworkVO network) throws ResourceUnavailableException {
|
||||
boolean success = true;
|
||||
@ -3271,7 +3317,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
return _networksDao.getActiveNicsIn(networkId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<Service, Map<Capability, String>> getNetworkCapabilities(long networkId) {
|
||||
|
||||
@ -3283,7 +3328,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
Service service = Service.getService(instance.getService());
|
||||
NetworkElement element = getElementImplementingProvider(instance.getProvider());
|
||||
if (element != null) {
|
||||
Map<Service, Map<Capability, String>> elementCapabilities = element.getCapabilities();;
|
||||
Map<Service, Map<Capability, String>> elementCapabilities = element.getCapabilities();
|
||||
;
|
||||
if (elementCapabilities != null) {
|
||||
networkCapabilities.put(service, elementCapabilities.get(service));
|
||||
}
|
||||
@ -3307,7 +3353,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
|
||||
NetworkElement element = getElementImplementingProvider(provider);
|
||||
if (element != null) {
|
||||
Map<Service, Map<Capability, String>> elementCapabilities = element.getCapabilities();;
|
||||
Map<Service, Map<Capability, String>> elementCapabilities = element.getCapabilities();
|
||||
;
|
||||
|
||||
if (elementCapabilities == null || !elementCapabilities.containsKey(service)) {
|
||||
throw new UnsupportedServiceException("Service " + service.getName() + " is not supported by the element=" + element.getName() + " implementing Provider=" + provider);
|
||||
@ -3333,13 +3380,16 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
throw new InvalidParameterValueException("Service " + service.getName() + " is not supported by the network offering " + offering);
|
||||
}
|
||||
|
||||
//FIXME - in post 3.0 we are going to support multiple providers for the same service per network offering, so we have to calculate capabilities for all of them
|
||||
// FIXME - in post 3.0 we are going to support multiple providers for the same service per network offering, so
|
||||
// we have to calculate capabilities for all of them
|
||||
String provider = providers.get(0);
|
||||
|
||||
//FIXME we return the capabilities of the first provider of the service - what if we have multiple providers for same Service?
|
||||
// FIXME we return the capabilities of the first provider of the service - what if we have multiple providers
|
||||
// for same Service?
|
||||
NetworkElement element = getElementImplementingProvider(provider);
|
||||
if (element != null) {
|
||||
Map<Service, Map<Capability, String>> elementCapabilities = element.getCapabilities();;
|
||||
Map<Service, Map<Capability, String>> elementCapabilities = element.getCapabilities();
|
||||
;
|
||||
|
||||
if (elementCapabilities == null || !elementCapabilities.containsKey(service)) {
|
||||
throw new UnsupportedServiceException("Service " + service.getName() + " is not supported by the element=" + element.getName() + " implementing Provider=" + provider);
|
||||
@ -3439,7 +3489,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
return guestNic.getIp4Address();
|
||||
}
|
||||
|
||||
|
||||
private Nic getNicInNetworkIncludingRemoved(long vmId, long networkId) {
|
||||
return _nicDao.findByInstanceIdAndNetworkIdIncludingRemoved(networkId, vmId);
|
||||
}
|
||||
@ -3468,7 +3517,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
if (createNetwork) {
|
||||
List<? extends NetworkOffering> offerings = _configMgr.listNetworkOfferings(TrafficType.Guest, false);
|
||||
PhysicalNetwork physicalNetwork = translateZoneIdToPhysicalNetwork(zoneId);
|
||||
network = createGuestNetwork(offerings.get(0).getId(), owner.getAccountName() + "-network", owner.getAccountName() + "-network", null, null, null, null, owner, false, null, physicalNetwork, zoneId, ACLType.Account, null);
|
||||
network = createGuestNetwork(offerings.get(0).getId(), owner.getAccountName() + "-network", owner.getAccountName() + "-network", null, null, null, null, owner, false, null, physicalNetwork, zoneId,
|
||||
ACLType.Account, null);
|
||||
|
||||
if (network == null) {
|
||||
s_logger.warn("Failed to create default Virtual network for the account " + accountId + "in zone " + zoneId);
|
||||
@ -3578,7 +3628,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
return elements;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean networkIsConfiguredForExternalNetworking(long zoneId, long networkId) {
|
||||
boolean netscalerInNetwork = isProviderForNetwork(Network.Provider.Netscaler, networkId);
|
||||
@ -3649,7 +3698,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
|
||||
// remote access vpn can be enabled only for static nat ip, so this part should never be executed under normal
|
||||
// conditions
|
||||
// only when ip address failed to be cleaned up as a part of account destroy and was marked as Releasing, this part of
|
||||
// only when ip address failed to be cleaned up as a part of account destroy and was marked as Releasing, this
|
||||
// part of
|
||||
// the code would be triggered
|
||||
s_logger.debug("Cleaning up remote access vpns as a part of public IP id=" + ipId + " release...");
|
||||
try {
|
||||
@ -3781,7 +3831,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
}
|
||||
}
|
||||
|
||||
@Override @DB
|
||||
@Override
|
||||
@DB
|
||||
@ActionEvent(eventType = EventTypes.EVENT_NETWORK_UPDATE, eventDescription = "updating network", async = true)
|
||||
public Network updateGuestNetwork(long networkId, String name, String displayText, Account callerAccount, User callerUser, String domainSuffix, Long networkOfferingId) {
|
||||
boolean restartNetwork = false;
|
||||
@ -3881,7 +3932,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
}
|
||||
|
||||
ReservationContext context = new ReservationContextImpl(null, null, callerUser, callerAccount);
|
||||
//1) Shutdown all the elements and cleanup all the rules. Don't allow to shutdown network in intermediate states - Shutdown and Implementing
|
||||
// 1) Shutdown all the elements and cleanup all the rules. Don't allow to shutdown network in intermediate
|
||||
// states - Shutdown and Implementing
|
||||
boolean validStateToShutdown = (network.getState() == Network.State.Implemented || network.getState() == Network.State.Setup || network.getState() == Network.State.Allocated);
|
||||
if (restartNetwork) {
|
||||
if (validStateToShutdown) {
|
||||
@ -3962,7 +4014,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
Network network = getNetwork(networkId);
|
||||
NetworkOffering ntwkOff = _configMgr.getNetworkOffering(network.getNetworkOfferingId());
|
||||
|
||||
// For default userVm Default network and domR guest/public network, get rate information from the service offering; for other situations get information
|
||||
// For default userVm Default network and domR guest/public network, get rate information from the service
|
||||
// offering; for other situations get information
|
||||
// from the network offering
|
||||
boolean isUserVmsDefaultNetwork = false;
|
||||
boolean isDomRGuestOrPublicNetwork = false;
|
||||
@ -4031,7 +4084,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private String getZoneNetworkDomain(long zoneId) {
|
||||
return _dcDao.findById(zoneId).getDomain();
|
||||
}
|
||||
@ -4103,7 +4155,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
}
|
||||
}
|
||||
|
||||
// static NAT rules can not programmed unless IP is associated with network service provider, so run IP association for
|
||||
// static NAT rules can not programmed unless IP is associated with network service provider, so run IP
|
||||
// association for
|
||||
// the network so as to ensure IP is associated before applying rules (in add state)
|
||||
applyIpAssociations(network, false, continueOnError, publicIps);
|
||||
|
||||
@ -4261,7 +4314,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
return canIpsUseOffering(publicIps, newNetworkOfferingId);
|
||||
}
|
||||
|
||||
|
||||
protected boolean canUpgradeProviders(long oldNetworkOfferingId, long newNetworkOfferingId) {
|
||||
// list of services and providers should be the same
|
||||
Map<Service, Set<Provider>> newServices = getNetworkOfferingServiceProvidersMap(newNetworkOfferingId);
|
||||
@ -4454,11 +4506,11 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
if (newVnetRangeString != null) {
|
||||
if (zone.getNetworkType() == NetworkType.Basic
|
||||
|| (zone.getNetworkType() == NetworkType.Advanced && zone.isSecurityGroupEnabled())) {
|
||||
throw new InvalidParameterValueException("Can't add vnet range to the physical network in the zone that supports " + zone.getNetworkType() + " network, Security Group enabled: "+ zone.isSecurityGroupEnabled());
|
||||
throw new InvalidParameterValueException("Can't add vnet range to the physical network in the zone that supports " + zone.getNetworkType() + " network, Security Group enabled: "
|
||||
+ zone.isSecurityGroupEnabled());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (tags != null && tags.size() > 1) {
|
||||
throw new InvalidParameterException("Unable to support more than one tag on network yet");
|
||||
}
|
||||
@ -4545,7 +4597,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
network.setVnet(newVnetRangeString);
|
||||
}
|
||||
|
||||
|
||||
_physicalNetworkDao.update(id, network);
|
||||
|
||||
if (replaceVnet) {
|
||||
@ -4554,7 +4605,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
}
|
||||
|
||||
for (Pair<Integer, Integer> vnetToAdd : vnetsToAdd) {
|
||||
s_logger.debug("Adding vnet range " + vnetToAdd.first() + "-" + vnetToAdd.second() + " for the physicalNetwork id= "+id +" and zone id=" + network.getDataCenterId() + " as a part of updatePhysicalNetwork call");
|
||||
s_logger.debug("Adding vnet range " + vnetToAdd.first() + "-" + vnetToAdd.second() + " for the physicalNetwork id= " + id + " and zone id=" + network.getDataCenterId()
|
||||
+ " as a part of updatePhysicalNetwork call");
|
||||
_dcDao.addVnet(network.getDataCenterId(), network.getId(), vnetToAdd.first(), vnetToAdd.second());
|
||||
}
|
||||
|
||||
@ -4578,7 +4630,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
|
||||
checkIfPhysicalNetworkIsDeletable(physicalNetworkId);
|
||||
|
||||
|
||||
// delete vlans for this zone
|
||||
List<VlanVO> vlans = _vlanDao.listVlansByPhysicalNetworkId(physicalNetworkId);
|
||||
for (VlanVO vlan : vlans) {
|
||||
@ -4602,10 +4653,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
// delete traffic types
|
||||
_pNTrafficTypeDao.deleteTrafficTypes(physicalNetworkId);
|
||||
|
||||
|
||||
boolean success = _physicalNetworkDao.remove(physicalNetworkId);
|
||||
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
@ -4625,11 +4674,13 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
networks.add(2, "there are networks associated to this physical network");
|
||||
tablesToCheck.add(networks);
|
||||
|
||||
/*List<String> privateIP = new ArrayList<String>();
|
||||
privateIP.add(0, "op_dc_ip_address_alloc");
|
||||
privateIP.add(1, "data_center_id");
|
||||
privateIP.add(2, "there are private IP addresses allocated for this zone");
|
||||
tablesToCheck.add(privateIP);*/
|
||||
/*
|
||||
* List<String> privateIP = new ArrayList<String>();
|
||||
* privateIP.add(0, "op_dc_ip_address_alloc");
|
||||
* privateIP.add(1, "data_center_id");
|
||||
* privateIP.add(2, "there are private IP addresses allocated for this zone");
|
||||
* tablesToCheck.add(privateIP);
|
||||
*/
|
||||
|
||||
List<String> publicIP = new ArrayList<String>();
|
||||
publicIP.add(0, "user_ip_address");
|
||||
@ -4637,8 +4688,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
publicIP.add(2, "there are public IP addresses allocated for this physical network");
|
||||
tablesToCheck.add(publicIP);
|
||||
|
||||
|
||||
|
||||
for (List<String> table : tablesToCheck) {
|
||||
String tableName = table.get(0);
|
||||
String column = table.get(1);
|
||||
@ -4982,7 +5031,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
return getPhysicalNetworkServiceProvider(providerId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long findPhysicalNetworkId(long zoneId, String tag) {
|
||||
List<PhysicalNetworkVO> pNtwks = _physicalNetworkDao.listByZone(zoneId);
|
||||
@ -5046,7 +5094,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
return offeringsToReturn;
|
||||
}
|
||||
|
||||
|
||||
private boolean cleanupNetworkResources(long networkId, Account caller, long callerUserId) {
|
||||
boolean success = true;
|
||||
Network network = getNetwork(networkId);
|
||||
@ -5107,7 +5154,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
private boolean shutdownNetworkResources(long networkId, Account caller, long callerUserId) {
|
||||
// This method cleans up network rules on the backend w/o touching them in the DB
|
||||
boolean success = true;
|
||||
@ -5265,7 +5311,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
throw new InvalidParameterValueException("Physical Network id=" + physicalNetworkId + "doesn't exist in the system");
|
||||
}
|
||||
|
||||
|
||||
Networks.TrafficType trafficType = null;
|
||||
if (trafficTypeStr != null && !trafficTypeStr.isEmpty()) {
|
||||
try {
|
||||
@ -5278,7 +5323,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
if (_pNTrafficTypeDao.isTrafficTypeSupported(physicalNetworkId, trafficType)) {
|
||||
throw new CloudRuntimeException("This physical network already supports the traffic type: " + trafficType);
|
||||
}
|
||||
//For Storage, Control, Management, Public check if the zone has any other physical network with this traffictype already present
|
||||
// For Storage, Control, Management, Public check if the zone has any other physical network with this
|
||||
// traffictype already present
|
||||
// If yes, we cant add these traffics to one more physical network in the zone.
|
||||
|
||||
if (TrafficType.isSystemNetwork(trafficType) || TrafficType.Public.equals(trafficType) || TrafficType.Storage.equals(trafficType)) {
|
||||
@ -5290,7 +5336,10 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
if (TrafficType.Storage.equals(trafficType)) {
|
||||
List<SecondaryStorageVmVO> ssvms = _stnwMgr.getSSVMWithNoStorageNetwork(network.getDataCenterId());
|
||||
if (!ssvms.isEmpty()) {
|
||||
StringBuilder sb = new StringBuilder("Cannot add " + trafficType + " traffic type as there are below secondary storage vm still running. Please stop them all and add Storage traffic type again, then destory them all to allow CloudStack recreate them with storage network(If you have added storage network ip range)");
|
||||
StringBuilder sb = new StringBuilder(
|
||||
"Cannot add "
|
||||
+ trafficType
|
||||
+ " traffic type as there are below secondary storage vm still running. Please stop them all and add Storage traffic type again, then destory them all to allow CloudStack recreate them with storage network(If you have added storage network ip range)");
|
||||
sb.append("SSVMs:");
|
||||
for (SecondaryStorageVmVO ssvm : ssvms) {
|
||||
sb.append(ssvm.getInstanceName()).append(":").append(ssvm.getState());
|
||||
@ -5321,15 +5370,20 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
private String getDefaultXenNetworkLabel(TrafficType trafficType) {
|
||||
String xenLabel = null;
|
||||
switch (trafficType) {
|
||||
case Public: xenLabel = _configDao.getValue(Config.XenPublicNetwork.key());
|
||||
case Public:
|
||||
xenLabel = _configDao.getValue(Config.XenPublicNetwork.key());
|
||||
break;
|
||||
case Guest: xenLabel = _configDao.getValue(Config.XenGuestNetwork.key());
|
||||
case Guest:
|
||||
xenLabel = _configDao.getValue(Config.XenGuestNetwork.key());
|
||||
break;
|
||||
case Storage: xenLabel = _configDao.getValue(Config.XenStorageNetwork1.key());
|
||||
case Storage:
|
||||
xenLabel = _configDao.getValue(Config.XenStorageNetwork1.key());
|
||||
break;
|
||||
case Management: xenLabel = _configDao.getValue(Config.XenPrivateNetwork.key());
|
||||
case Management:
|
||||
xenLabel = _configDao.getValue(Config.XenPrivateNetwork.key());
|
||||
break;
|
||||
case Control: xenLabel = "cloud_link_local_network";
|
||||
case Control:
|
||||
xenLabel = "cloud_link_local_network";
|
||||
break;
|
||||
}
|
||||
return xenLabel;
|
||||
@ -5398,7 +5452,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
return _pNTrafficTypeDao.listBy(physicalNetworkId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PhysicalNetwork getDefaultPhysicalNetworkByZoneAndTrafficType(long zoneId, TrafficType trafficType) {
|
||||
|
||||
@ -5559,7 +5612,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
}
|
||||
|
||||
private boolean isProviderEnabled(PhysicalNetworkServiceProvider provider) {
|
||||
if (provider == null || provider.getState() != PhysicalNetworkServiceProvider.State.Enabled) { //TODO: check for other states: Shutdown?
|
||||
if (provider == null || provider.getState() != PhysicalNetworkServiceProvider.State.Enabled) { // TODO: check
|
||||
// for other states: Shutdown?
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -5592,7 +5646,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getNetworkTag(HypervisorType hType, Network network) {
|
||||
// no network tag for control traffic type
|
||||
@ -5631,7 +5684,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
physicalNetworkId = pNtwks.get(0).getId();
|
||||
} else {
|
||||
// locate physicalNetwork with supported traffic type
|
||||
//We can make this assumptions based on the fact that Public/Management/Control traffic types are supported only in one physical network in the zone in 3.0
|
||||
// We can make this assumptions based on the fact that Public/Management/Control traffic types are
|
||||
// supported only in one physical network in the zone in 3.0
|
||||
for (PhysicalNetworkVO pNtwk : pNtwks) {
|
||||
if (_pNTrafficTypeDao.isTrafficTypeSupported(pNtwk.getId(), network.getTrafficType())) {
|
||||
physicalNetworkId = pNtwk.getId();
|
||||
@ -5643,7 +5697,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
return physicalNetworkId;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public NetworkVO getExclusiveGuestNetwork(long zoneId) {
|
||||
List<NetworkVO> networks = _networksDao.listBy(Account.ACCOUNT_ID_SYSTEM, zoneId, GuestType.Shared, TrafficType.Guest);
|
||||
@ -5700,7 +5753,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
|
||||
for (NetworkOfferingServiceMapVO serviceMap : servicesMap) {
|
||||
if (svcProviders.containsKey(serviceMap.getService())) {
|
||||
//FIXME - right now we pick up the first provider from the list, need to add more logic based on provider load, etc
|
||||
// FIXME - right now we pick up the first provider from the list, need to add more logic based on
|
||||
// provider load, etc
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -5824,7 +5878,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
}
|
||||
servicesSet.delete(servicesSet.toString().length() - 2, servicesSet.toString().length());
|
||||
|
||||
throw new InvalidParameterValueException("Cannot enable subset of Services, Please specify the complete list of Services: " + servicesSet.toString() + " for Service Provider " + provider.getName());
|
||||
throw new InvalidParameterValueException("Cannot enable subset of Services, Please specify the complete list of Services: " + servicesSet.toString() + " for Service Provider "
|
||||
+ provider.getName());
|
||||
}
|
||||
}
|
||||
for (Service service : enabledServices) {
|
||||
@ -5929,13 +5984,15 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
|
||||
String value = serviceCapabilities.get(cap);
|
||||
if (value == null || value.isEmpty()) {
|
||||
throw new UnsupportedServiceException("Service " + service.getName() + " doesn't have capability " + cap.getName() + " for element=" + element.getName() + " implementing Provider=" + provider.getName());
|
||||
throw new UnsupportedServiceException("Service " + service.getName() + " doesn't have capability " + cap.getName() + " for element=" + element.getName() + " implementing Provider="
|
||||
+ provider.getName());
|
||||
}
|
||||
|
||||
capValue = capValue.toLowerCase();
|
||||
|
||||
if (!value.contains(capValue)) {
|
||||
throw new UnsupportedServiceException("Service " + service.getName() + " doesn't support value " + capValue + " for capability " + cap.getName() + " for element=" + element.getName() + " implementing Provider=" + provider.getName());
|
||||
throw new UnsupportedServiceException("Service " + service.getName() + " doesn't support value " + capValue + " for capability " + cap.getName() + " for element=" + element.getName()
|
||||
+ " implementing Provider=" + provider.getName());
|
||||
}
|
||||
} else {
|
||||
throw new UnsupportedServiceException("Unable to find network element for provider " + provider.getName());
|
||||
|
||||
@ -56,4 +56,5 @@ public interface FirewallRulesDao extends GenericDao<FirewallRuleVO, Long> {
|
||||
List<FirewallRuleVO> listByIpAndNotRevoked(long ipAddressId);
|
||||
|
||||
long countRulesByIpId(long sourceIpId);
|
||||
|
||||
}
|
||||
|
||||
@ -39,7 +39,8 @@ import com.cloud.utils.db.SearchCriteria.Func;
|
||||
import com.cloud.utils.db.SearchCriteria.Op;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
|
||||
@Local(value=FirewallRulesDao.class) @DB(txn=false)
|
||||
@Local(value = FirewallRulesDao.class)
|
||||
@DB(txn = false)
|
||||
public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> implements FirewallRulesDao {
|
||||
|
||||
protected final SearchBuilder<FirewallRuleVO> AllFieldsSearch;
|
||||
@ -196,7 +197,8 @@ public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> i
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override @DB
|
||||
@Override
|
||||
@DB
|
||||
public FirewallRuleVO persist(FirewallRuleVO firewallRule) {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
@ -208,7 +210,6 @@ public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> i
|
||||
return dbfirewallRule;
|
||||
}
|
||||
|
||||
|
||||
public void saveSourceCidrs(FirewallRuleVO firewallRule, List<String> cidrList) {
|
||||
if (cidrList == null) {
|
||||
return;
|
||||
@ -216,7 +217,6 @@ public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> i
|
||||
_firewallRulesCidrsDao.persist(firewallRule.getId(), cidrList);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<FirewallRuleVO> listByIpPurposeAndProtocolAndNotRevoked(long ipAddressId, Integer startPort, Integer endPort, String protocol, FirewallRule.Purpose purpose) {
|
||||
SearchCriteria<FirewallRuleVO> sc = NotRevokedSearch.create();
|
||||
@ -270,4 +270,5 @@ public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> i
|
||||
sc.setParameters("ipAddressId", sourceIpId);
|
||||
return customSearch(sc, null).get(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -25,9 +25,15 @@ import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public interface LoadBalancerDao extends GenericDao<LoadBalancerVO, Long> {
|
||||
List<Long> listInstancesByLoadBalancer(long loadBalancerId);
|
||||
|
||||
List<LoadBalancerVO> listByIpAddress(long ipAddressId);
|
||||
|
||||
LoadBalancerVO findByIpAddressAndPublicPort(long ipAddressId, String publicPort);
|
||||
|
||||
LoadBalancerVO findByAccountAndName(Long accountId, String name);
|
||||
|
||||
List<LoadBalancerVO> listByNetworkId(long networkId);
|
||||
|
||||
List<LoadBalancerVO> listInTransitionStateByNetworkId(long networkId);
|
||||
|
||||
}
|
||||
|
||||
@ -134,4 +134,5 @@ public class LoadBalancerDaoImpl extends GenericDaoBase<LoadBalancerVO, Long> im
|
||||
sc.setParameters("state", State.Add.toString(), State.Revoke.toString());
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -91,4 +91,5 @@ public interface NetworkDao extends GenericDao<NetworkVO, Long> {
|
||||
boolean update(Long networkId, NetworkVO network, Map<String, String> serviceProviderMap);
|
||||
|
||||
List<NetworkVO> listByZoneAndTrafficType(long zoneId, TrafficType trafficType);
|
||||
|
||||
}
|
||||
|
||||
@ -49,7 +49,8 @@ import com.cloud.utils.db.SequenceFetcher;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
|
||||
@Local(value=NetworkDao.class) @DB(txn=false)
|
||||
@Local(value = NetworkDao.class)
|
||||
@DB(txn = false)
|
||||
public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements NetworkDao {
|
||||
final SearchBuilder<NetworkVO> AllFieldsSearch;
|
||||
final SearchBuilder<NetworkVO> AccountSearch;
|
||||
@ -109,7 +110,6 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
|
||||
AccountNetworkSearch.join("networkSearch", mapJoin, AccountNetworkSearch.entity().getId(), mapJoin.entity().getNetworkId(), JoinBuilder.JoinType.INNER);
|
||||
AccountNetworkSearch.done();
|
||||
|
||||
|
||||
ZoneBroadcastUriSearch = createSearchBuilder();
|
||||
ZoneBroadcastUriSearch.and("dataCenterId", ZoneBroadcastUriSearch.entity().getDataCenterId(), Op.EQ);
|
||||
ZoneBroadcastUriSearch.and("broadcastUri", ZoneBroadcastUriSearch.entity().getBroadcastUri(), Op.EQ);
|
||||
@ -128,7 +128,6 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
|
||||
CountByOfferingId.and("removed", CountByOfferingId.entity().getRemoved(), Op.NULL);
|
||||
CountByOfferingId.done();
|
||||
|
||||
|
||||
PhysicalNetworkSearch = createSearchBuilder();
|
||||
PhysicalNetworkSearch.and("physicalNetworkId", PhysicalNetworkSearch.entity().getPhysicalNetworkId(), Op.EQ);
|
||||
PhysicalNetworkSearch.done();
|
||||
@ -184,7 +183,8 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override @DB
|
||||
@Override
|
||||
@DB
|
||||
public NetworkVO persist(NetworkVO network, boolean gc, Map<String, String> serviceProviderMap) {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
@ -203,8 +203,8 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
|
||||
return newNetwork;
|
||||
}
|
||||
|
||||
|
||||
@Override @DB
|
||||
@Override
|
||||
@DB
|
||||
public boolean update(Long networkId, NetworkVO network, Map<String, String> serviceProviderMap) {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
@ -395,4 +395,5 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
|
||||
|
||||
return listBy(sc, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -79,23 +79,32 @@ import com.cloud.vm.VirtualMachineProfile;
|
||||
import com.cloud.vm.dao.DomainRouterDao;
|
||||
import com.cloud.vm.dao.UserVmDao;
|
||||
|
||||
|
||||
@Local(value = NetworkElement.class)
|
||||
public class CloudZonesNetworkElement extends AdapterBase implements NetworkElement, UserDataServiceProvider {
|
||||
private static final Logger s_logger = Logger.getLogger(CloudZonesNetworkElement.class);
|
||||
|
||||
private static final Map<Service, Map<Capability, String>> capabilities = setCapabilities();
|
||||
|
||||
@Inject NetworkDao _networkConfigDao;
|
||||
@Inject NetworkManager _networkMgr;
|
||||
@Inject VirtualNetworkApplianceManager _routerMgr;
|
||||
@Inject UserVmManager _userVmMgr;
|
||||
@Inject UserVmDao _userVmDao;
|
||||
@Inject DomainRouterDao _routerDao;
|
||||
@Inject ConfigurationManager _configMgr;
|
||||
@Inject DataCenterDao _dcDao;
|
||||
@Inject AgentManager _agentManager;
|
||||
@Inject ServiceOfferingDao _serviceOfferingDao;
|
||||
@Inject
|
||||
NetworkDao _networkConfigDao;
|
||||
@Inject
|
||||
NetworkManager _networkMgr;
|
||||
@Inject
|
||||
VirtualNetworkApplianceManager _routerMgr;
|
||||
@Inject
|
||||
UserVmManager _userVmMgr;
|
||||
@Inject
|
||||
UserVmDao _userVmDao;
|
||||
@Inject
|
||||
DomainRouterDao _routerDao;
|
||||
@Inject
|
||||
ConfigurationManager _configMgr;
|
||||
@Inject
|
||||
DataCenterDao _dcDao;
|
||||
@Inject
|
||||
AgentManager _agentManager;
|
||||
@Inject
|
||||
ServiceOfferingDao _serviceOfferingDao;
|
||||
|
||||
private boolean canHandle(DeployDestination dest, TrafficType trafficType) {
|
||||
DataCenterVO dc = (DataCenterVO) dest.getDataCenter();
|
||||
@ -112,7 +121,8 @@ public class CloudZonesNetworkElement extends AdapterBase implements NetworkElem
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException, ConcurrentOperationException, InsufficientCapacityException {
|
||||
public boolean implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException, ConcurrentOperationException,
|
||||
InsufficientCapacityException {
|
||||
if (!canHandle(dest, offering.getTrafficType())) {
|
||||
return false;
|
||||
}
|
||||
@ -121,7 +131,8 @@ public class CloudZonesNetworkElement extends AdapterBase implements NetworkElem
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
|
||||
public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
|
||||
InsufficientCapacityException, ResourceUnavailableException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -219,7 +230,8 @@ public class CloudZonesNetworkElement extends AdapterBase implements NetworkElem
|
||||
|
||||
cmds.addCommand(
|
||||
"vmdata",
|
||||
generateVmDataCommand(nic.getIp4Address(), userData, serviceOffering, zoneName, nic.getIp4Address(), uservm.getVirtualMachine().getHostName(), uservm.getVirtualMachine().getInstanceName(), uservm.getId(), sshPublicKey));
|
||||
generateVmDataCommand(nic.getIp4Address(), userData, serviceOffering, zoneName, nic.getIp4Address(), uservm.getVirtualMachine().getHostName(), uservm.getVirtualMachine().getInstanceName(),
|
||||
uservm.getId(), sshPublicKey));
|
||||
try {
|
||||
_agentManager.send(dest.getHost().getId(), cmds);
|
||||
} catch (OperationTimedoutException e) {
|
||||
@ -247,4 +259,5 @@ public class CloudZonesNetworkElement extends AdapterBase implements NetworkElem
|
||||
public boolean verifyServicesCombination(List<String> services) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -55,7 +55,8 @@ import com.cloud.vm.VirtualMachineProfile;
|
||||
@Local(value = NetworkElement.class)
|
||||
public class ExternalDhcpElement extends AdapterBase implements NetworkElement, DhcpServiceProvider {
|
||||
private static final Logger s_logger = Logger.getLogger(ExternalDhcpElement.class);
|
||||
@Inject ExternalDhcpManager _dhcpMgr;
|
||||
@Inject
|
||||
ExternalDhcpManager _dhcpMgr;
|
||||
private static final Map<Service, Map<Capability, String>> capabilities = setCapabilities();
|
||||
|
||||
private boolean canHandle(DeployDestination dest, TrafficType trafficType, GuestType networkType) {
|
||||
@ -114,7 +115,6 @@ public class ExternalDhcpElement extends AdapterBase implements NetworkElement,
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean destroy(Network network) throws ConcurrentOperationException, ResourceUnavailableException {
|
||||
return true;
|
||||
|
||||
@ -41,7 +41,6 @@ import com.cloud.api.response.F5LoadBalancerResponse;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.ConfigurationManager;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.deploy.DeployDestination;
|
||||
@ -57,15 +56,15 @@ import com.cloud.host.dao.HostDetailsDao;
|
||||
import com.cloud.network.ExternalLoadBalancerDeviceManager;
|
||||
import com.cloud.network.ExternalLoadBalancerDeviceManagerImpl;
|
||||
import com.cloud.network.ExternalLoadBalancerDeviceVO;
|
||||
import com.cloud.network.NetworkExternalLoadBalancerVO;
|
||||
import com.cloud.network.NetworkVO;
|
||||
import com.cloud.network.ExternalLoadBalancerDeviceVO.LBDeviceState;
|
||||
import com.cloud.network.ExternalNetworkDeviceManager.NetworkDevice;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.Network.Capability;
|
||||
import com.cloud.network.Network.Provider;
|
||||
import com.cloud.network.Network.Service;
|
||||
import com.cloud.network.NetworkExternalLoadBalancerVO;
|
||||
import com.cloud.network.NetworkManager;
|
||||
import com.cloud.network.NetworkVO;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
import com.cloud.network.PhysicalNetworkServiceProvider;
|
||||
import com.cloud.network.PhysicalNetworkVO;
|
||||
@ -96,17 +95,28 @@ public class F5ExternalLoadBalancerElement extends ExternalLoadBalancerDeviceMan
|
||||
|
||||
private static final Logger s_logger = Logger.getLogger(F5ExternalLoadBalancerElement.class);
|
||||
|
||||
@Inject NetworkManager _networkManager;
|
||||
@Inject ConfigurationManager _configMgr;
|
||||
@Inject NetworkServiceMapDao _ntwkSrvcDao;
|
||||
@Inject DataCenterDao _dcDao;
|
||||
@Inject PhysicalNetworkDao _physicalNetworkDao;
|
||||
@Inject HostDao _hostDao;
|
||||
@Inject ExternalLoadBalancerDeviceDao _lbDeviceDao;
|
||||
@Inject NetworkExternalLoadBalancerDao _networkLBDao;
|
||||
@Inject NetworkDao _networkDao;
|
||||
@Inject HostDetailsDao _detailsDao;
|
||||
@Inject ConfigurationDao _configDao;
|
||||
@Inject
|
||||
NetworkManager _networkManager;
|
||||
@Inject
|
||||
ConfigurationManager _configMgr;
|
||||
@Inject
|
||||
NetworkServiceMapDao _ntwkSrvcDao;
|
||||
@Inject
|
||||
DataCenterDao _dcDao;
|
||||
@Inject
|
||||
PhysicalNetworkDao _physicalNetworkDao;
|
||||
@Inject
|
||||
HostDao _hostDao;
|
||||
@Inject
|
||||
ExternalLoadBalancerDeviceDao _lbDeviceDao;
|
||||
@Inject
|
||||
NetworkExternalLoadBalancerDao _networkLBDao;
|
||||
@Inject
|
||||
NetworkDao _networkDao;
|
||||
@Inject
|
||||
HostDetailsDao _detailsDao;
|
||||
@Inject
|
||||
ConfigurationDao _configDao;
|
||||
|
||||
private boolean canHandle(Network config) {
|
||||
if (config.getGuestType() != Network.GuestType.Isolated || config.getTrafficType() != TrafficType.Guest) {
|
||||
@ -114,12 +124,12 @@ public class F5ExternalLoadBalancerElement extends ExternalLoadBalancerDeviceMan
|
||||
return false;
|
||||
}
|
||||
|
||||
return (_networkManager.isProviderForNetwork(getProvider(), config.getId()) &&
|
||||
_ntwkSrvcDao.canProviderSupportServiceInNetwork(config.getId(), Service.Lb, Network.Provider.F5BigIp));
|
||||
return (_networkManager.isProviderForNetwork(getProvider(), config.getId()) && _ntwkSrvcDao.canProviderSupportServiceInNetwork(config.getId(), Service.Lb, Network.Provider.F5BigIp));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean implement(Network guestConfig, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException, ConcurrentOperationException, InsufficientNetworkCapacityException {
|
||||
public boolean implement(Network guestConfig, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException, ConcurrentOperationException,
|
||||
InsufficientNetworkCapacityException {
|
||||
|
||||
if (!canHandle(guestConfig)) {
|
||||
return false;
|
||||
@ -128,13 +138,15 @@ public class F5ExternalLoadBalancerElement extends ExternalLoadBalancerDeviceMan
|
||||
try {
|
||||
return manageGuestNetworkWithExternalLoadBalancer(true, guestConfig);
|
||||
} catch (InsufficientCapacityException capacityException) {
|
||||
// TODO: handle out of capacity exception in graceful manner when multiple providers are avaialble for the network
|
||||
// TODO: handle out of capacity exception in graceful manner when multiple providers are avaialble for the
|
||||
// network
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean prepare(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientNetworkCapacityException, ResourceUnavailableException {
|
||||
public boolean prepare(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
|
||||
InsufficientNetworkCapacityException, ResourceUnavailableException {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -26,6 +26,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.commands.AddExternalFirewallCmd;
|
||||
@ -41,8 +42,8 @@ import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.ConfigurationManager;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.DataCenter.NetworkType;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.deploy.DeployDestination;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
@ -54,14 +55,14 @@ import com.cloud.host.Host;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.host.dao.HostDao;
|
||||
import com.cloud.host.dao.HostDetailsDao;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.ExternalFirewallDeviceManagerImpl;
|
||||
import com.cloud.network.ExternalFirewallDeviceVO;
|
||||
import com.cloud.network.ExternalFirewallDeviceVO.FirewallDeviceState;
|
||||
import com.cloud.network.ExternalNetworkDeviceManager.NetworkDevice;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.Network.Capability;
|
||||
import com.cloud.network.Network.Provider;
|
||||
import com.cloud.network.Network.Service;
|
||||
import com.cloud.network.ExternalFirewallDeviceManagerImpl;
|
||||
import com.cloud.network.ExternalFirewallDeviceVO;
|
||||
import com.cloud.network.NetworkExternalFirewallVO;
|
||||
import com.cloud.network.NetworkManager;
|
||||
import com.cloud.network.NetworkVO;
|
||||
@ -98,19 +99,32 @@ public class JuniperSRXExternalFirewallElement extends ExternalFirewallDeviceMan
|
||||
|
||||
private static final Map<Service, Map<Capability, String>> capabilities = setCapabilities();
|
||||
|
||||
@Inject NetworkManager _networkManager;
|
||||
@Inject HostDao _hostDao;
|
||||
@Inject ConfigurationManager _configMgr;
|
||||
@Inject NetworkOfferingDao _networkOfferingDao;
|
||||
@Inject NetworkDao _networksDao;
|
||||
@Inject DataCenterDao _dcDao;
|
||||
@Inject PhysicalNetworkDao _physicalNetworkDao;
|
||||
@Inject ExternalFirewallDeviceDao _fwDevicesDao;
|
||||
@Inject NetworkExternalFirewallDao _networkFirewallDao;
|
||||
@Inject NetworkDao _networkDao;
|
||||
@Inject NetworkServiceMapDao _ntwkSrvcDao;
|
||||
@Inject HostDetailsDao _hostDetailDao;
|
||||
@Inject ConfigurationDao _configDao;
|
||||
@Inject
|
||||
NetworkManager _networkManager;
|
||||
@Inject
|
||||
HostDao _hostDao;
|
||||
@Inject
|
||||
ConfigurationManager _configMgr;
|
||||
@Inject
|
||||
NetworkOfferingDao _networkOfferingDao;
|
||||
@Inject
|
||||
NetworkDao _networksDao;
|
||||
@Inject
|
||||
DataCenterDao _dcDao;
|
||||
@Inject
|
||||
PhysicalNetworkDao _physicalNetworkDao;
|
||||
@Inject
|
||||
ExternalFirewallDeviceDao _fwDevicesDao;
|
||||
@Inject
|
||||
NetworkExternalFirewallDao _networkFirewallDao;
|
||||
@Inject
|
||||
NetworkDao _networkDao;
|
||||
@Inject
|
||||
NetworkServiceMapDao _ntwkSrvcDao;
|
||||
@Inject
|
||||
HostDetailsDao _hostDetailDao;
|
||||
@Inject
|
||||
ConfigurationDao _configDao;
|
||||
|
||||
private boolean canHandle(Network network, Service service) {
|
||||
DataCenter zone = _configMgr.getZone(network.getDataCenterId());
|
||||
@ -135,7 +149,8 @@ public class JuniperSRXExternalFirewallElement extends ExternalFirewallDeviceMan
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException, ConcurrentOperationException, InsufficientNetworkCapacityException {
|
||||
public boolean implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException, ConcurrentOperationException,
|
||||
InsufficientNetworkCapacityException {
|
||||
DataCenter zone = _configMgr.getZone(network.getDataCenterId());
|
||||
|
||||
// don't have to implement network is Basic zone
|
||||
@ -151,13 +166,15 @@ public class JuniperSRXExternalFirewallElement extends ExternalFirewallDeviceMan
|
||||
try {
|
||||
return manageGuestNetworkWithExternalFirewall(true, network);
|
||||
} catch (InsufficientCapacityException capacityException) {
|
||||
// TODO: handle out of capacity exception in more gracefule manner when multiple providers are present for the network
|
||||
// TODO: handle out of capacity exception in more gracefule manner when multiple providers are present for
|
||||
// the network
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean prepare(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientNetworkCapacityException, ResourceUnavailableException {
|
||||
public boolean prepare(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
|
||||
InsufficientNetworkCapacityException, ResourceUnavailableException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -317,7 +334,8 @@ public class JuniperSRXExternalFirewallElement extends ExternalFirewallDeviceMan
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated // should use more generic addNetworkDevice command to add firewall
|
||||
@Deprecated
|
||||
// should use more generic addNetworkDevice command to add firewall
|
||||
public Host addExternalFirewall(AddExternalFirewallCmd cmd) {
|
||||
Long zoneId = cmd.getZoneId();
|
||||
DataCenterVO zone = null;
|
||||
@ -351,7 +369,8 @@ public class JuniperSRXExternalFirewallElement extends ExternalFirewallDeviceMan
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated // should use more generic listNetworkDevice command
|
||||
@Deprecated
|
||||
// should use more generic listNetworkDevice command
|
||||
public List<Host> listExternalFirewalls(ListExternalFirewallsCmd cmd) {
|
||||
List<Host> firewallHosts = new ArrayList<Host>();
|
||||
Long zoneId = cmd.getZoneId();
|
||||
|
||||
@ -31,15 +31,12 @@ import javax.ejb.Local;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.AgentManager.OnError;
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.routing.LoadBalancerConfigCommand;
|
||||
import com.cloud.agent.api.routing.NetworkElementCommand;
|
||||
import com.cloud.agent.api.routing.SetStaticNatRulesAnswer;
|
||||
import com.cloud.agent.api.routing.SetStaticNatRulesCommand;
|
||||
import com.cloud.agent.api.to.LoadBalancerTO;
|
||||
import com.cloud.agent.api.to.StaticNatRuleTO;
|
||||
import com.cloud.agent.manager.Commands;
|
||||
import com.cloud.api.ApiConstants;
|
||||
import com.cloud.api.commands.AddNetscalerLoadBalancerCmd;
|
||||
import com.cloud.api.commands.ConfigureNetscalerLoadBalancerCmd;
|
||||
@ -51,7 +48,6 @@ import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.ConfigurationManager;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.DataCenter.NetworkType;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.deploy.DeployDestination;
|
||||
@ -67,9 +63,9 @@ import com.cloud.host.dao.HostDetailsDao;
|
||||
import com.cloud.network.ExternalLoadBalancerDeviceManager;
|
||||
import com.cloud.network.ExternalLoadBalancerDeviceManagerImpl;
|
||||
import com.cloud.network.ExternalLoadBalancerDeviceVO;
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.network.ExternalLoadBalancerDeviceVO.LBDeviceState;
|
||||
import com.cloud.network.ExternalNetworkDeviceManager.NetworkDevice;
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.Network.Capability;
|
||||
import com.cloud.network.Network.Provider;
|
||||
@ -90,8 +86,8 @@ import com.cloud.network.lb.LoadBalancingRule;
|
||||
import com.cloud.network.lb.LoadBalancingRule.LbDestination;
|
||||
import com.cloud.network.resource.NetscalerResource;
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.network.rules.LbStickinessMethod;
|
||||
import com.cloud.network.rules.FirewallRule.Purpose;
|
||||
import com.cloud.network.rules.LbStickinessMethod;
|
||||
import com.cloud.network.rules.LbStickinessMethod.StickinessMethodType;
|
||||
import com.cloud.network.rules.StaticNat;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
@ -109,23 +105,37 @@ import com.cloud.vm.VirtualMachineProfile;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
@Local(value = NetworkElement.class)
|
||||
public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl implements LoadBalancingServiceProvider, NetscalerLoadBalancerElementService, ExternalLoadBalancerDeviceManager, IpDeployer, StaticNatServiceProvider {
|
||||
public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl implements LoadBalancingServiceProvider, NetscalerLoadBalancerElementService, ExternalLoadBalancerDeviceManager, IpDeployer,
|
||||
StaticNatServiceProvider {
|
||||
|
||||
private static final Logger s_logger = Logger.getLogger(NetscalerElement.class);
|
||||
|
||||
@Inject NetworkManager _networkManager;
|
||||
@Inject ConfigurationManager _configMgr;
|
||||
@Inject NetworkServiceMapDao _ntwkSrvcDao;
|
||||
@Inject AgentManager _agentMgr;
|
||||
@Inject NetworkManager _networkMgr;
|
||||
@Inject HostDao _hostDao;
|
||||
@Inject DataCenterDao _dcDao;
|
||||
@Inject ExternalLoadBalancerDeviceDao _lbDeviceDao;
|
||||
@Inject NetworkExternalLoadBalancerDao _networkLBDao;
|
||||
@Inject PhysicalNetworkDao _physicalNetworkDao;
|
||||
@Inject NetworkDao _networkDao;
|
||||
@Inject HostDetailsDao _detailsDao;
|
||||
@Inject ConfigurationDao _configDao;
|
||||
@Inject
|
||||
NetworkManager _networkManager;
|
||||
@Inject
|
||||
ConfigurationManager _configMgr;
|
||||
@Inject
|
||||
NetworkServiceMapDao _ntwkSrvcDao;
|
||||
@Inject
|
||||
AgentManager _agentMgr;
|
||||
@Inject
|
||||
NetworkManager _networkMgr;
|
||||
@Inject
|
||||
HostDao _hostDao;
|
||||
@Inject
|
||||
DataCenterDao _dcDao;
|
||||
@Inject
|
||||
ExternalLoadBalancerDeviceDao _lbDeviceDao;
|
||||
@Inject
|
||||
NetworkExternalLoadBalancerDao _networkLBDao;
|
||||
@Inject
|
||||
PhysicalNetworkDao _physicalNetworkDao;
|
||||
@Inject
|
||||
NetworkDao _networkDao;
|
||||
@Inject
|
||||
HostDetailsDao _detailsDao;
|
||||
@Inject
|
||||
ConfigurationDao _configDao;
|
||||
|
||||
private boolean canHandle(Network config, Service service) {
|
||||
DataCenter zone = _dcDao.findById(config.getDataCenterId());
|
||||
@ -137,8 +147,7 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
||||
return false;
|
||||
}
|
||||
|
||||
return (_networkManager.isProviderForNetwork(getProvider(), config.getId()) &&
|
||||
_ntwkSrvcDao.canProviderSupportServiceInNetwork(config.getId(), service, Network.Provider.Netscaler));
|
||||
return (_networkManager.isProviderForNetwork(getProvider(), config.getId()) && _ntwkSrvcDao.canProviderSupportServiceInNetwork(config.getId(), service, Network.Provider.Netscaler));
|
||||
}
|
||||
|
||||
private boolean isBasicZoneNetwok(Network config) {
|
||||
@ -147,7 +156,8 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean implement(Network guestConfig, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException, ConcurrentOperationException, InsufficientNetworkCapacityException {
|
||||
public boolean implement(Network guestConfig, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException, ConcurrentOperationException,
|
||||
InsufficientNetworkCapacityException {
|
||||
|
||||
if (!canHandle(guestConfig, Service.Lb)) {
|
||||
return false;
|
||||
@ -162,7 +172,8 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean prepare(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientNetworkCapacityException, ResourceUnavailableException {
|
||||
public boolean prepare(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
|
||||
InsufficientNetworkCapacityException, ResourceUnavailableException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -256,7 +267,6 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
||||
staticNatCapabilities.put(Capability.ElasticIp, "true");
|
||||
capabilities.put(Service.StaticNat, staticNatCapabilities);
|
||||
|
||||
|
||||
// TODO - Murali, please put correct capabilities here
|
||||
Map<Capability, String> firewallCapabilities = new HashMap<Capability, String>();
|
||||
firewallCapabilities.put(Capability.TrafficStatistics, "per public ip");
|
||||
@ -489,7 +499,8 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
||||
public boolean isReady(PhysicalNetworkServiceProvider provider) {
|
||||
List<ExternalLoadBalancerDeviceVO> lbDevices = _lbDeviceDao.listByPhysicalNetworkAndProvider(provider.getPhysicalNetworkId(), Provider.Netscaler.getName());
|
||||
|
||||
// true if at-least one Netscaler device is added in to physical network and is in configured (in enabled state) state
|
||||
// true if at-least one Netscaler device is added in to physical network and is in configured (in enabled state)
|
||||
// state
|
||||
if (lbDevices != null && !lbDevices.isEmpty()) {
|
||||
for (ExternalLoadBalancerDeviceVO lbDevice : lbDevices) {
|
||||
if (lbDevice.getState() == LBDeviceState.Enabled) {
|
||||
@ -652,4 +663,5 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
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