mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-8672 : NCC Integration with CloudStack.
This commit is contained in:
parent
b2f7f9abb6
commit
b2b422c7d7
@ -46,6 +46,8 @@ public class LoadBalancerTO {
|
|||||||
boolean alreadyAdded;
|
boolean alreadyAdded;
|
||||||
boolean inline;
|
boolean inline;
|
||||||
String srcIpVlan;
|
String srcIpVlan;
|
||||||
|
String srcIpGateway;
|
||||||
|
String srcIpNetmask;
|
||||||
Long networkId;
|
Long networkId;
|
||||||
DestinationTO[] destinations;
|
DestinationTO[] destinations;
|
||||||
private StickinessPolicyTO[] stickinessPolicies;
|
private StickinessPolicyTO[] stickinessPolicies;
|
||||||
@ -84,6 +86,15 @@ public class LoadBalancerTO {
|
|||||||
this(id, srcIp, srcPort, protocol, algorithm, revoked, alreadyAdded, inline, argDestinations, stickinessPolicies, null, null, null);
|
this(id, srcIp, srcPort, protocol, algorithm, revoked, alreadyAdded, inline, argDestinations, stickinessPolicies, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LoadBalancerTO(String id, List<DestinationTO> destinations) {
|
||||||
|
this.uuid = id;
|
||||||
|
int i = 0;
|
||||||
|
this.destinations = new DestinationTO[destinations.size()];
|
||||||
|
for (DestinationTO destination : destinations) {
|
||||||
|
this.destinations[i++] = new DestinationTO(destination.getDestIp(), destination.getDestPort(), destination.getMonitorState());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public LoadBalancerTO(String id, String srcIp, int srcPort, String protocol, String algorithm, boolean revoked, boolean alreadyAdded, boolean inline,
|
public LoadBalancerTO(String id, String srcIp, int srcPort, String protocol, String algorithm, boolean revoked, boolean alreadyAdded, boolean inline,
|
||||||
List<LbDestination> argDestinations, List<LbStickinessPolicy> stickinessPolicies, List<LbHealthCheckPolicy> healthCheckPolicies, LbSslCert sslCert,
|
List<LbDestination> argDestinations, List<LbStickinessPolicy> stickinessPolicies, List<LbHealthCheckPolicy> healthCheckPolicies, LbSslCert sslCert,
|
||||||
String lbProtocol) {
|
String lbProtocol) {
|
||||||
@ -212,21 +223,37 @@ public class LoadBalancerTO {
|
|||||||
this.networkId = id;
|
this.networkId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSrcIpGateway() {
|
||||||
|
return srcIpGateway;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSrcIpGateway(String srcIpGateway) {
|
||||||
|
this.srcIpGateway = srcIpGateway;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSrcIpNetmask() {
|
||||||
|
return srcIpNetmask;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSrcIpNetmask(String srcIpNetmask) {
|
||||||
|
this.srcIpNetmask = srcIpNetmask;
|
||||||
|
}
|
||||||
|
|
||||||
public static class StickinessPolicyTO {
|
public static class StickinessPolicyTO {
|
||||||
private String _methodName;
|
private String methodName;
|
||||||
private List<Pair<String, String>> _paramsList;
|
private List<Pair<String, String>> params;
|
||||||
|
|
||||||
public String getMethodName() {
|
public String getMethodName() {
|
||||||
return _methodName;
|
return methodName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Pair<String, String>> getParams() {
|
public List<Pair<String, String>> getParams() {
|
||||||
return _paramsList;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StickinessPolicyTO(String methodName, List<Pair<String, String>> paramsList) {
|
public StickinessPolicyTO(String methodName, List<Pair<String, String>> paramsList) {
|
||||||
this._methodName = methodName;
|
this.methodName = methodName;
|
||||||
this._paramsList = paramsList;
|
this.params = paramsList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +264,7 @@ public class LoadBalancerTO {
|
|||||||
private int healthcheckInterval;
|
private int healthcheckInterval;
|
||||||
private int healthcheckThresshold;
|
private int healthcheckThresshold;
|
||||||
private int unhealthThresshold;
|
private int unhealthThresshold;
|
||||||
private boolean revoke = false;
|
private boolean revoked = false;
|
||||||
|
|
||||||
public HealthCheckPolicyTO(String pingPath, String description, int responseTime, int healthcheckInterval, int healthcheckThresshold, int unhealthThresshold,
|
public HealthCheckPolicyTO(String pingPath, String description, int responseTime, int healthcheckInterval, int healthcheckThresshold, int unhealthThresshold,
|
||||||
boolean revoke) {
|
boolean revoke) {
|
||||||
@ -248,7 +275,7 @@ public class LoadBalancerTO {
|
|||||||
this.healthcheckInterval = healthcheckInterval;
|
this.healthcheckInterval = healthcheckInterval;
|
||||||
this.healthcheckThresshold = healthcheckThresshold;
|
this.healthcheckThresshold = healthcheckThresshold;
|
||||||
this.unhealthThresshold = unhealthThresshold;
|
this.unhealthThresshold = unhealthThresshold;
|
||||||
this.revoke = revoke;
|
this.revoked = revoke;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HealthCheckPolicyTO() {
|
public HealthCheckPolicyTO() {
|
||||||
@ -280,11 +307,11 @@ public class LoadBalancerTO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setRevoke(boolean revoke) {
|
public void setRevoke(boolean revoke) {
|
||||||
this.revoke = revoke;
|
this.revoked = revoke;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRevoked() {
|
public boolean isRevoked() {
|
||||||
return revoke;
|
return revoked;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -303,6 +330,12 @@ public class LoadBalancerTO {
|
|||||||
this.alreadyAdded = alreadyAdded;
|
this.alreadyAdded = alreadyAdded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DestinationTO(String destIp, int destPort, String monitorState) {
|
||||||
|
this.destIp = destIp;
|
||||||
|
this.destPort = destPort;
|
||||||
|
this.monitorState = monitorState;
|
||||||
|
}
|
||||||
|
|
||||||
protected DestinationTO() {
|
protected DestinationTO() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -391,6 +391,10 @@ public class EventTypes {
|
|||||||
public static final String EVENT_EXTERNAL_LB_DEVICE_DELETE = "PHYSICAL.LOADBALANCER.DELETE";
|
public static final String EVENT_EXTERNAL_LB_DEVICE_DELETE = "PHYSICAL.LOADBALANCER.DELETE";
|
||||||
public static final String EVENT_EXTERNAL_LB_DEVICE_CONFIGURE = "PHYSICAL.LOADBALANCER.CONFIGURE";
|
public static final String EVENT_EXTERNAL_LB_DEVICE_CONFIGURE = "PHYSICAL.LOADBALANCER.CONFIGURE";
|
||||||
|
|
||||||
|
// external NCC device events
|
||||||
|
public static final String EVENT_EXTERNAL_NCC_DEVICE_ADD = "PHYSICAL.NCC.ADD";
|
||||||
|
public static final String EVENT_EXTERNAL_NCC_DEVICE_DELETE = "PHYSICAL.NCC.DELETE";
|
||||||
|
|
||||||
// external switch management device events (E.g.: Cisco Nexus 1000v Virtual Supervisor Module.
|
// external switch management device events (E.g.: Cisco Nexus 1000v Virtual Supervisor Module.
|
||||||
public static final String EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_ADD = "SWITCH.MGMT.ADD";
|
public static final String EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_ADD = "SWITCH.MGMT.ADD";
|
||||||
public static final String EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_DELETE = "SWITCH.MGMT.DELETE";
|
public static final String EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_DELETE = "SWITCH.MGMT.DELETE";
|
||||||
@ -549,6 +553,9 @@ public class EventTypes {
|
|||||||
public static final String EVENT_NETSCALER_SERVICEPACKAGE_ADD = "NETSCALER.SERVICEPACKAGE.ADD";
|
public static final String EVENT_NETSCALER_SERVICEPACKAGE_ADD = "NETSCALER.SERVICEPACKAGE.ADD";
|
||||||
public static final String EVENT_NETSCALER_SERVICEPACKAGE_DELETE = "NETSCALER.SERVICEPACKAGE.DELETE";
|
public static final String EVENT_NETSCALER_SERVICEPACKAGE_DELETE = "NETSCALER.SERVICEPACKAGE.DELETE";
|
||||||
|
|
||||||
|
public static final String EVENT_NETSCALER_VM_START = "NETSCALERVM.START";
|
||||||
|
public static final String EVENT_NETSCALER_VM_STOP = "NETSCALERVM.STOP";
|
||||||
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package com.cloud.network;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.api.command.admin.address.ReleasePodIpCmdByAdmin;
|
||||||
import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
|
import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
|
import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
|
import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
|
||||||
@ -26,6 +27,7 @@ import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
|
|||||||
import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
|
import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
|
||||||
import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
|
import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
|
||||||
import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
|
import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
|
||||||
|
import org.apache.cloudstack.api.response.AcquirePodIpCmdResponse;
|
||||||
|
|
||||||
import com.cloud.exception.ConcurrentOperationException;
|
import com.cloud.exception.ConcurrentOperationException;
|
||||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||||
@ -38,6 +40,7 @@ import com.cloud.offering.NetworkOffering;
|
|||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
import com.cloud.user.User;
|
import com.cloud.user.User;
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.utils.Pair;
|
||||||
|
import com.cloud.utils.exception.CloudRuntimeException;
|
||||||
import com.cloud.vm.Nic;
|
import com.cloud.vm.Nic;
|
||||||
import com.cloud.vm.NicSecondaryIp;
|
import com.cloud.vm.NicSecondaryIp;
|
||||||
|
|
||||||
@ -182,4 +185,8 @@ public interface NetworkService {
|
|||||||
boolean configureNicSecondaryIp(NicSecondaryIp secIp, boolean isZoneSgEnabled);
|
boolean configureNicSecondaryIp(NicSecondaryIp secIp, boolean isZoneSgEnabled);
|
||||||
|
|
||||||
List<? extends NicSecondaryIp> listVmNicSecondaryIps(ListNicsCmd listNicsCmd);
|
List<? extends NicSecondaryIp> listVmNicSecondaryIps(ListNicsCmd listNicsCmd);
|
||||||
|
|
||||||
|
AcquirePodIpCmdResponse allocatePodIp(Account account, String zoneId, String podId) throws ResourceAllocationException, ConcurrentOperationException;
|
||||||
|
|
||||||
|
boolean releasePodIp(ReleasePodIpCmdByAdmin ip) throws CloudRuntimeException;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,7 +21,7 @@ import org.apache.cloudstack.api.InternalIdentity;
|
|||||||
|
|
||||||
public interface VirtualRouterProvider extends InternalIdentity, Identity {
|
public interface VirtualRouterProvider extends InternalIdentity, Identity {
|
||||||
public enum Type {
|
public enum Type {
|
||||||
VirtualRouter, ElasticLoadBalancerVm, VPCVirtualRouter, InternalLbVm
|
VirtualRouter, ElasticLoadBalancerVm, VPCVirtualRouter, InternalLbVm, NetScalerVm
|
||||||
}
|
}
|
||||||
|
|
||||||
public Type getType();
|
public Type getType();
|
||||||
|
|||||||
@ -23,7 +23,7 @@ import com.cloud.vm.VirtualMachine;
|
|||||||
*/
|
*/
|
||||||
public interface VirtualRouter extends VirtualMachine {
|
public interface VirtualRouter extends VirtualMachine {
|
||||||
public enum Role {
|
public enum Role {
|
||||||
VIRTUAL_ROUTER, LB, INTERNAL_LB_VM
|
VIRTUAL_ROUTER, LB, INTERNAL_LB_VM, NETSCALER_VM
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum UpdateState {
|
public enum UpdateState {
|
||||||
|
|||||||
@ -38,7 +38,7 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum Detail {
|
public enum Detail {
|
||||||
InternalLbProvider, PublicLbProvider
|
InternalLbProvider, PublicLbProvider, servicepackageuuid, servicepackagedescription
|
||||||
}
|
}
|
||||||
|
|
||||||
public final static String SystemPublicNetwork = "System-Public-Network";
|
public final static String SystemPublicNetwork = "System-Public-Network";
|
||||||
@ -133,4 +133,6 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
|
|||||||
boolean getSupportsStrechedL2();
|
boolean getSupportsStrechedL2();
|
||||||
|
|
||||||
boolean getSupportsPublicAccess();
|
boolean getSupportsPublicAccess();
|
||||||
|
|
||||||
|
String getServicePackage();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -214,6 +214,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
|
|||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
User(false), DomainRouter(true), ConsoleProxy(true), SecondaryStorageVm(true), ElasticIpVm(true), ElasticLoadBalancerVm(true), InternalLoadBalancerVm(true),
|
User(false), DomainRouter(true), ConsoleProxy(true), SecondaryStorageVm(true), ElasticIpVm(true), ElasticLoadBalancerVm(true), InternalLoadBalancerVm(true),
|
||||||
|
NetScalerVm(true),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* UserBareMetal is only used for selecting VirtualMachineGuru, there is no
|
* UserBareMetal is only used for selecting VirtualMachineGuru, there is no
|
||||||
|
|||||||
@ -32,7 +32,7 @@ import com.cloud.exception.ConcurrentOperationException;
|
|||||||
import com.cloud.exception.ResourceAllocationException;
|
import com.cloud.exception.ResourceAllocationException;
|
||||||
import com.cloud.exception.ResourceUnavailableException;
|
import com.cloud.exception.ResourceUnavailableException;
|
||||||
|
|
||||||
@APICommand(name = "acquirePodIpAddresses", description = "Allocates IP addresses in respective Pod of a Zone", responseObject = AcquirePodIpCmdResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
@APICommand(name = "acquirePodIpAddress", description = "Allocates IP addresses in respective Pod of a Zone", responseObject = AcquirePodIpCmdResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||||
public class AcquirePodIpCmdByAdmin extends BaseCmd {
|
public class AcquirePodIpCmdByAdmin extends BaseCmd {
|
||||||
|
|
||||||
public static final Logger s_logger = Logger.getLogger(AcquirePodIpCmdByAdmin.class.getName());
|
public static final Logger s_logger = Logger.getLogger(AcquirePodIpCmdByAdmin.class.getName());
|
||||||
@ -42,28 +42,30 @@ public class AcquirePodIpCmdByAdmin extends BaseCmd {
|
|||||||
//////////////// API parameters /////////////////////
|
//////////////// API parameters /////////////////////
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "the ID of the zone in which your pod lies")
|
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.STRING, entityType = ZoneResponse.class, required = true, description = "the ID of the zone")
|
||||||
private Long zoneId;
|
private String zoneId;
|
||||||
|
|
||||||
@Parameter(name = ApiConstants.GUEST_CIDR_ADDRESS, type = CommandType.STRING, entityType = ZoneResponse.class, required = false, description = "CIDR for finding Pod")
|
@Parameter(name = ApiConstants.POD_ID, type = CommandType.STRING, entityType = ZoneResponse.class, required = false, description = "Pod ID")
|
||||||
private String cidr;
|
private String podId;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
/////////////////// Accessors ///////////////////////
|
/////////////////// Accessors ///////////////////////
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
private long getZoneId() {
|
private String getZoneId() {
|
||||||
return zoneId;
|
return zoneId;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getCidr() {
|
public String getPodId() {
|
||||||
return cidr;
|
return podId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
/////////////// API Implementation///////////////////
|
/////////////// API Implementation///////////////////
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCommandName() {
|
public String getCommandName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
@ -71,12 +73,12 @@ public class AcquirePodIpCmdByAdmin extends BaseCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() throws ResourceUnavailableException, ResourceAllocationException, ConcurrentOperationException {
|
public void execute() throws ResourceUnavailableException, ResourceAllocationException, ConcurrentOperationException {
|
||||||
AcquirePodIpCmdResponse pod_ip = null;
|
AcquirePodIpCmdResponse podIp = null;
|
||||||
pod_ip = _networkService.allocatePodIp(_accountService.getAccount(getEntityOwnerId()), getZoneId(), getCidr());
|
podIp = _networkService.allocatePodIp(_accountService.getAccount(getEntityOwnerId()), getZoneId(), getPodId());
|
||||||
if (pod_ip != null) {
|
if (podIp != null) {
|
||||||
pod_ip.setResponseName(getCommandName());
|
podIp.setResponseName(getCommandName());
|
||||||
pod_ip.setObjectName(getCommandName());
|
podIp.setObjectName(getCommandName());
|
||||||
setResponseObject(pod_ip);
|
setResponseObject(podIp);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign IP address");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign IP address");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -273,10 +273,23 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Collection paramsCollection = details.values();
|
Collection paramsCollection = details.values();
|
||||||
Map<String, String> params = (Map<String, String>)(paramsCollection.toArray())[0];
|
Object objlist[]= paramsCollection.toArray();
|
||||||
|
Map<String, String> params = (Map<String, String>)(objlist[0]);
|
||||||
|
for(int i=1; i< objlist.length; i++)
|
||||||
|
{
|
||||||
|
params.putAll((Map<String, String>)(objlist[i]));
|
||||||
|
}
|
||||||
|
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getServicePackageId() {
|
||||||
|
Map<String, String> data = getDetails();
|
||||||
|
if (data == null)
|
||||||
|
return null;
|
||||||
|
return data.get(NetworkOffering.Detail.servicepackageuuid+ "");
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
/////////////// API Implementation///////////////////
|
/////////////// API Implementation///////////////////
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
|
|||||||
@ -64,6 +64,9 @@ public class UpdateLoadBalancerRuleCmd extends BaseAsyncCustomIdCmd {
|
|||||||
@Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin})
|
@Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin})
|
||||||
private Boolean display;
|
private Boolean display;
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "The protocol for the LB")
|
||||||
|
private String lbProtocol;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
/////////////////// Accessors ///////////////////////
|
/////////////////// Accessors ///////////////////////
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
@ -88,6 +91,10 @@ public class UpdateLoadBalancerRuleCmd extends BaseAsyncCustomIdCmd {
|
|||||||
return display;
|
return display;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLbProtocol() {
|
||||||
|
return lbProtocol;
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
/////////////// API Implementation///////////////////
|
/////////////// API Implementation///////////////////
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
|
|||||||
@ -73,6 +73,9 @@ public class UploadSslCertCmd extends BaseCmd {
|
|||||||
@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "domain ID of the account owning the SSL certificate")
|
@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "domain ID of the account owning the SSL certificate")
|
||||||
private Long domainId;
|
private Long domainId;
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.NAME , type = CommandType.STRING, required = true, description = "Name for the uploaded certificate")
|
||||||
|
private String name;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
/////////////////// Accessors ///////////////////////
|
/////////////////// Accessors ///////////////////////
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
@ -105,10 +108,15 @@ public class UploadSslCertCmd extends BaseCmd {
|
|||||||
return projectId;
|
return projectId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
/////////////// API Implementation///////////////////
|
/////////////// API Implementation///////////////////
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
|
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
|
||||||
ResourceAllocationException, NetworkRuleConflictException {
|
ResourceAllocationException, NetworkRuleConflictException {
|
||||||
|
|||||||
@ -150,11 +150,6 @@ public class AcquireIPAddressResponse extends BaseResponse implements Controlle
|
|||||||
@Param(description = "is public ip for display to the regular user", since = "4.4", authorized = {RoleType.Admin})
|
@Param(description = "is public ip for display to the regular user", since = "4.4", authorized = {RoleType.Admin})
|
||||||
private Boolean forDisplay;
|
private Boolean forDisplay;
|
||||||
|
|
||||||
/*
|
|
||||||
@SerializedName(ApiConstants.JOB_ID) @Param(description="shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the volume")
|
|
||||||
private IdentityProxy jobId = new IdentityProxy("async_job");
|
|
||||||
*/
|
|
||||||
|
|
||||||
public void setIpAddress(String ipAddress) {
|
public void setIpAddress(String ipAddress) {
|
||||||
this.ipAddress = ipAddress;
|
this.ipAddress = ipAddress;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,6 +72,10 @@ public class SslCertResponse extends BaseResponse {
|
|||||||
@Param(description = "List of loabalancers this certificate is bound to")
|
@Param(description = "List of loabalancers this certificate is bound to")
|
||||||
List<String> lbIds;
|
List<String> lbIds;
|
||||||
|
|
||||||
|
@SerializedName(ApiConstants.NAME)
|
||||||
|
@Param(description = "name")
|
||||||
|
private String name;
|
||||||
|
|
||||||
public SslCertResponse() {
|
public SslCertResponse() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,6 +87,10 @@ public class SslCertResponse extends BaseResponse {
|
|||||||
this.certificate = cert;
|
this.certificate = cert;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
public void setAccountName(String accountName) {
|
public void setAccountName(String accountName) {
|
||||||
this.accountName = accountName;
|
this.accountName = accountName;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
package org.apache.cloudstack.api.response;
|
package org.apache.cloudstack.api.response;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
@ -141,7 +142,13 @@ public class SystemVmResponse extends BaseResponse {
|
|||||||
@Param(description = "the number of active console sessions for the console proxy system vm")
|
@Param(description = "the number of active console sessions for the console proxy system vm")
|
||||||
private Integer activeViewerSessions;
|
private Integer activeViewerSessions;
|
||||||
|
|
||||||
// private Long objectId;
|
@SerializedName("guestvlan")
|
||||||
|
@Param(description = "guest vlan range")
|
||||||
|
private String guestVlan;
|
||||||
|
|
||||||
|
@SerializedName("publicvlan")
|
||||||
|
@Param(description = "public vlan range")
|
||||||
|
private List<String> publicVlan;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getObjectId() {
|
public String getObjectId() {
|
||||||
@ -355,4 +362,20 @@ public class SystemVmResponse extends BaseResponse {
|
|||||||
public void setLinkLocalNetmask(String linkLocalNetmask) {
|
public void setLinkLocalNetmask(String linkLocalNetmask) {
|
||||||
this.linkLocalNetmask = linkLocalNetmask;
|
this.linkLocalNetmask = linkLocalNetmask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getGuestVlan() {
|
||||||
|
return guestVlan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGuestVlan(String guestVlan) {
|
||||||
|
this.guestVlan = guestVlan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getPublicVlan() {
|
||||||
|
return publicVlan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPublicVlan(List<String> publicVlan) {
|
||||||
|
this.publicVlan = publicVlan;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,5 +31,5 @@ public interface SslCert extends InternalIdentity, Identity, ControlledEntity {
|
|||||||
public String getPassword();
|
public String getPassword();
|
||||||
|
|
||||||
public String getFingerPrint();
|
public String getFingerPrint();
|
||||||
|
public String getName();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,12 +20,21 @@
|
|||||||
package com.cloud.agent.api;
|
package com.cloud.agent.api;
|
||||||
|
|
||||||
public class ExternalNetworkResourceUsageCommand extends Command {
|
public class ExternalNetworkResourceUsageCommand extends Command {
|
||||||
|
Long networkid;
|
||||||
|
|
||||||
public ExternalNetworkResourceUsageCommand() {
|
public ExternalNetworkResourceUsageCommand() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ExternalNetworkResourceUsageCommand(Long networkid) {
|
||||||
|
this.networkid = networkid;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean executeInSequence() {
|
public boolean executeInSequence() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getNetworkid() {
|
||||||
|
return networkid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,15 +26,15 @@ public class NetScalerImplementNetworkCommand extends Command {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Long dcId;
|
private String dcId;
|
||||||
private Long hostId;
|
private Long hostId;
|
||||||
|
|
||||||
public NetScalerImplementNetworkCommand(Long dcId) {
|
public NetScalerImplementNetworkCommand(String dcId) {
|
||||||
super();
|
super();
|
||||||
this.dcId = dcId;
|
this.dcId = dcId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NetScalerImplementNetworkCommand(Long dcId, Long hostId, String networkDetails) {
|
public NetScalerImplementNetworkCommand(String dcId, Long hostId, String networkDetails) {
|
||||||
this(dcId);
|
this(dcId);
|
||||||
this.hostId = hostId;
|
this.hostId = hostId;
|
||||||
this._networkDetails = networkDetails;
|
this._networkDetails = networkDetails;
|
||||||
@ -48,7 +48,7 @@ public class NetScalerImplementNetworkCommand extends Command {
|
|||||||
return _networkDetails;
|
return _networkDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getDataCenterId() {
|
public String getDataCenterId() {
|
||||||
return dcId;
|
return dcId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,16 +26,20 @@ import com.cloud.agent.api.to.LoadBalancerTO;
|
|||||||
*/
|
*/
|
||||||
public class HealthCheckLBConfigCommand extends NetworkElementCommand {
|
public class HealthCheckLBConfigCommand extends NetworkElementCommand {
|
||||||
LoadBalancerTO[] loadBalancers;
|
LoadBalancerTO[] loadBalancers;
|
||||||
|
long networkId;
|
||||||
protected HealthCheckLBConfigCommand() {
|
protected HealthCheckLBConfigCommand() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public HealthCheckLBConfigCommand(LoadBalancerTO[] loadBalancers) {
|
public HealthCheckLBConfigCommand(LoadBalancerTO[] loadBalancers, long networkid) {
|
||||||
this.loadBalancers = loadBalancers;
|
this.loadBalancers = loadBalancers;
|
||||||
|
this.networkId = networkid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoadBalancerTO[] getLoadBalancers() {
|
public LoadBalancerTO[] getLoadBalancers() {
|
||||||
return loadBalancers;
|
return loadBalancers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getNetworkId() {
|
||||||
|
return networkId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -183,7 +183,7 @@ public interface IpAddressManager {
|
|||||||
|
|
||||||
String allocatePublicIpForGuestNic(Network network, Long podId, Account ipOwner, String requestedIp) throws InsufficientAddressCapacityException;
|
String allocatePublicIpForGuestNic(Network network, Long podId, Account ipOwner, String requestedIp) throws InsufficientAddressCapacityException;
|
||||||
|
|
||||||
public AcquirePodIpCmdResponse allocatePodIp(Long zoneId, String cidr) throws ConcurrentOperationException,
|
public AcquirePodIpCmdResponse allocatePodIp(String zoneId, String podId) throws ConcurrentOperationException,
|
||||||
ResourceAllocationException;
|
ResourceAllocationException;
|
||||||
|
|
||||||
public void releasePodIp(Long id) throws CloudRuntimeException;
|
public void releasePodIp(Long id) throws CloudRuntimeException;
|
||||||
|
|||||||
@ -404,6 +404,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (!vmProfile.getBootArgs().contains("ExternalLoadBalancerVm"))
|
||||||
_networkMgr.allocate(vmProfile, auxiliaryNetworks);
|
_networkMgr.allocate(vmProfile, auxiliaryNetworks);
|
||||||
} catch (final ConcurrentOperationException e) {
|
} catch (final ConcurrentOperationException e) {
|
||||||
throw new CloudRuntimeException("Concurrent operation while trying to allocate resources for the VM", e);
|
throw new CloudRuntimeException("Concurrent operation while trying to allocate resources for the VM", e);
|
||||||
|
|||||||
@ -442,7 +442,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||||||
if (_networkOfferingDao.findByUniqueName(NetworkOffering.QuickCloudNoServices) == null) {
|
if (_networkOfferingDao.findByUniqueName(NetworkOffering.QuickCloudNoServices) == null) {
|
||||||
offering = _configMgr.createNetworkOffering(NetworkOffering.QuickCloudNoServices, "Offering for QuickCloud with no services", TrafficType.Guest, null, true,
|
offering = _configMgr.createNetworkOffering(NetworkOffering.QuickCloudNoServices, "Offering for QuickCloud with no services", TrafficType.Guest, null, true,
|
||||||
Availability.Optional, null, new HashMap<Network.Service, Set<Network.Provider>>(), true, Network.GuestType.Shared, false, null, true, null, true,
|
Availability.Optional, null, new HashMap<Network.Service, Set<Network.Provider>>(), true, Network.GuestType.Shared, false, null, true, null, true,
|
||||||
false, null, false, null, true, null);
|
false, null, false, null, true);
|
||||||
offering.setState(NetworkOffering.State.Enabled);
|
offering.setState(NetworkOffering.State.Enabled);
|
||||||
_networkOfferingDao.update(offering.getId(), offering);
|
_networkOfferingDao.update(offering.getId(), offering);
|
||||||
}
|
}
|
||||||
@ -451,7 +451,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||||||
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOfferingWithSGService) == null) {
|
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOfferingWithSGService) == null) {
|
||||||
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOfferingWithSGService, "Offering for Shared Security group enabled networks",
|
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOfferingWithSGService, "Offering for Shared Security group enabled networks",
|
||||||
TrafficType.Guest, null, true, Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true,
|
TrafficType.Guest, null, true, Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true,
|
||||||
null, true, false, null, false, null, true, null);
|
null, true, false, null, false, null, true);
|
||||||
offering.setState(NetworkOffering.State.Enabled);
|
offering.setState(NetworkOffering.State.Enabled);
|
||||||
_networkOfferingDao.update(offering.getId(), offering);
|
_networkOfferingDao.update(offering.getId(), offering);
|
||||||
}
|
}
|
||||||
@ -460,7 +460,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||||||
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOffering) == null) {
|
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOffering) == null) {
|
||||||
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOffering, "Offering for Shared networks", TrafficType.Guest, null, true,
|
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOffering, "Offering for Shared networks", TrafficType.Guest, null, true,
|
||||||
Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true, null, true, false, null, false,
|
Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true, null, true, false, null, false,
|
||||||
null, true, null);
|
null, true);
|
||||||
offering.setState(NetworkOffering.State.Enabled);
|
offering.setState(NetworkOffering.State.Enabled);
|
||||||
_networkOfferingDao.update(offering.getId(), offering);
|
_networkOfferingDao.update(offering.getId(), offering);
|
||||||
}
|
}
|
||||||
@ -470,7 +470,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||||||
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService,
|
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService,
|
||||||
"Offering for Isolated networks with Source Nat service enabled", TrafficType.Guest, null, false, Availability.Required, null,
|
"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, false, null, false, null,
|
defaultIsolatedSourceNatEnabledNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null, true, null, false, false, null, false, null,
|
||||||
true, null);
|
true);
|
||||||
|
|
||||||
offering.setState(NetworkOffering.State.Enabled);
|
offering.setState(NetworkOffering.State.Enabled);
|
||||||
_networkOfferingDao.update(offering.getId(), offering);
|
_networkOfferingDao.update(offering.getId(), offering);
|
||||||
@ -480,7 +480,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||||||
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks) == null) {
|
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks) == null) {
|
||||||
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks,
|
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks,
|
||||||
"Offering for Isolated VPC networks with Source Nat service enabled", TrafficType.Guest, null, false, Availability.Optional, null,
|
"Offering for Isolated VPC networks with Source Nat service enabled", TrafficType.Guest, null, false, Availability.Optional, null,
|
||||||
defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, null);
|
defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true);
|
||||||
offering.setState(NetworkOffering.State.Enabled);
|
offering.setState(NetworkOffering.State.Enabled);
|
||||||
_networkOfferingDao.update(offering.getId(), offering);
|
_networkOfferingDao.update(offering.getId(), offering);
|
||||||
}
|
}
|
||||||
@ -491,7 +491,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||||||
defaultVPCOffProviders.remove(Service.Lb);
|
defaultVPCOffProviders.remove(Service.Lb);
|
||||||
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksNoLB,
|
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksNoLB,
|
||||||
"Offering for Isolated VPC networks with Source Nat service enabled and LB service disabled", TrafficType.Guest, null, false, Availability.Optional,
|
"Offering for Isolated VPC networks with Source Nat service enabled and LB service disabled", TrafficType.Guest, null, false, Availability.Optional,
|
||||||
null, defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, null);
|
null, defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true);
|
||||||
offering.setState(NetworkOffering.State.Enabled);
|
offering.setState(NetworkOffering.State.Enabled);
|
||||||
_networkOfferingDao.update(offering.getId(), offering);
|
_networkOfferingDao.update(offering.getId(), offering);
|
||||||
}
|
}
|
||||||
@ -500,7 +500,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||||||
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOffering) == null) {
|
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOffering) == null) {
|
||||||
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOffering, "Offering for Isolated networks with no Source Nat service",
|
offering = _configMgr.createNetworkOffering(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,
|
TrafficType.Guest, null, true, Availability.Optional, null, defaultIsolatedNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null,
|
||||||
true, null, true, false, null, false, null, true, null);
|
true, null, true, false, null, false, null, true);
|
||||||
offering.setState(NetworkOffering.State.Enabled);
|
offering.setState(NetworkOffering.State.Enabled);
|
||||||
_networkOfferingDao.update(offering.getId(), offering);
|
_networkOfferingDao.update(offering.getId(), offering);
|
||||||
}
|
}
|
||||||
@ -524,7 +524,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||||||
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB) == null) {
|
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB) == null) {
|
||||||
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB,
|
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB,
|
||||||
"Offering for Isolated VPC networks with Internal Lb support", TrafficType.Guest, null, false, Availability.Optional, null, internalLbOffProviders,
|
"Offering for Isolated VPC networks with Internal Lb support", TrafficType.Guest, null, false, Availability.Optional, null, internalLbOffProviders,
|
||||||
true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, null);
|
true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true);
|
||||||
offering.setState(NetworkOffering.State.Enabled);
|
offering.setState(NetworkOffering.State.Enabled);
|
||||||
offering.setInternalLb(true);
|
offering.setInternalLb(true);
|
||||||
offering.setPublicLb(false);
|
offering.setPublicLb(false);
|
||||||
@ -556,7 +556,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||||||
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedEIPandELBNetworkOffering) == null) {
|
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedEIPandELBNetworkOffering) == null) {
|
||||||
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedEIPandELBNetworkOffering,
|
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedEIPandELBNetworkOffering,
|
||||||
"Offering for Shared networks with Elastic IP and Elastic LB capabilities", TrafficType.Guest, null, true, Availability.Optional, null,
|
"Offering for Shared networks with Elastic IP and Elastic LB capabilities", TrafficType.Guest, null, true, Availability.Optional, null,
|
||||||
netscalerServiceProviders, true, Network.GuestType.Shared, false, null, true, serviceCapabilityMap, true, false, null, false, null, true, null);
|
netscalerServiceProviders, true, Network.GuestType.Shared, false, null, true, serviceCapabilityMap, true, false, null, false, null, true);
|
||||||
offering.setState(NetworkOffering.State.Enabled);
|
offering.setState(NetworkOffering.State.Enabled);
|
||||||
offering.setDedicatedLB(false);
|
offering.setDedicatedLB(false);
|
||||||
_networkOfferingDao.update(offering.getId(), offering);
|
_networkOfferingDao.update(offering.getId(), offering);
|
||||||
|
|||||||
@ -181,15 +181,12 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase<DataCenterIpAddre
|
|||||||
if (s_logger.isDebugEnabled()) {
|
if (s_logger.isDebugEnabled()) {
|
||||||
s_logger.debug("Releasing ip address for ID=" + id);
|
s_logger.debug("Releasing ip address for ID=" + id);
|
||||||
}
|
}
|
||||||
// SearchCriteria<DataCenterIpAddressVO> sc = AllFieldsSearch.create();
|
|
||||||
// sc.setParameters("id", id);
|
|
||||||
|
|
||||||
DataCenterIpAddressVO vo = this.findById(id);
|
DataCenterIpAddressVO vo = this.findById(id);
|
||||||
vo.setTakenAt(null);
|
vo.setTakenAt(null);
|
||||||
vo.setInstanceId(null);
|
vo.setInstanceId(null);
|
||||||
vo.setReservationId(null);
|
vo.setReservationId(null);
|
||||||
persist(vo);
|
persist(vo);
|
||||||
//update(vo, sc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -120,4 +120,6 @@ public interface NetworkDao extends GenericDao<NetworkVO, Long>, StateDao<State,
|
|||||||
List<NetworkVO> listByAclId(long aclId);
|
List<NetworkVO> listByAclId(long aclId);
|
||||||
|
|
||||||
int getNonSystemNetworkCountByVpcId(long vpcId);
|
int getNonSystemNetworkCountByVpcId(long vpcId);
|
||||||
|
|
||||||
|
List<NetworkVO> listNetworkVO(List<Long> idset);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,9 +24,10 @@ import javax.annotation.PostConstruct;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.TableGenerator;
|
import javax.persistence.TableGenerator;
|
||||||
|
|
||||||
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
|
||||||
|
|
||||||
import com.cloud.network.Network;
|
import com.cloud.network.Network;
|
||||||
import com.cloud.network.Network.Event;
|
import com.cloud.network.Network.Event;
|
||||||
import com.cloud.network.Network.GuestType;
|
import com.cloud.network.Network.GuestType;
|
||||||
@ -42,6 +43,7 @@ import com.cloud.offerings.dao.NetworkOfferingDao;
|
|||||||
import com.cloud.server.ResourceTag.ResourceObjectType;
|
import com.cloud.server.ResourceTag.ResourceObjectType;
|
||||||
import com.cloud.tags.dao.ResourceTagDao;
|
import com.cloud.tags.dao.ResourceTagDao;
|
||||||
import com.cloud.utils.db.DB;
|
import com.cloud.utils.db.DB;
|
||||||
|
import com.cloud.utils.db.Filter;
|
||||||
import com.cloud.utils.db.GenericDaoBase;
|
import com.cloud.utils.db.GenericDaoBase;
|
||||||
import com.cloud.utils.db.GenericSearchBuilder;
|
import com.cloud.utils.db.GenericSearchBuilder;
|
||||||
import com.cloud.utils.db.JoinBuilder;
|
import com.cloud.utils.db.JoinBuilder;
|
||||||
@ -56,7 +58,7 @@ import com.cloud.utils.net.NetUtils;
|
|||||||
|
|
||||||
@Component
|
@Component
|
||||||
@DB()
|
@DB()
|
||||||
public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements NetworkDao {
|
public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long>implements NetworkDao {
|
||||||
SearchBuilder<NetworkVO> AllFieldsSearch;
|
SearchBuilder<NetworkVO> AllFieldsSearch;
|
||||||
SearchBuilder<NetworkVO> AccountSearch;
|
SearchBuilder<NetworkVO> AccountSearch;
|
||||||
SearchBuilder<NetworkVO> RelatedConfigSearch;
|
SearchBuilder<NetworkVO> RelatedConfigSearch;
|
||||||
@ -275,7 +277,6 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
|
|||||||
return listBy(sc, null);
|
return listBy(sc, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<NetworkVO> findBy(final TrafficType trafficType, final Mode mode, final BroadcastDomainType broadcastType, final long networkOfferingId, final long dataCenterId) {
|
public List<NetworkVO> findBy(final TrafficType trafficType, final Mode mode, final BroadcastDomainType broadcastType, final long networkOfferingId, final long dataCenterId) {
|
||||||
final SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
|
final SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
|
||||||
sc.setParameters("trafficType", trafficType);
|
sc.setParameters("trafficType", trafficType);
|
||||||
@ -680,4 +681,13 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
|
|||||||
final List<Integer> results = customSearch(sc, null);
|
final List<Integer> results = customSearch(sc, null);
|
||||||
return results.get(0);
|
return results.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<NetworkVO> listNetworkVO(List<Long> idset) {
|
||||||
|
final SearchCriteria<NetworkVO> sc_2 = createSearchCriteria();
|
||||||
|
final Filter searchFilter_2 = new Filter(NetworkVO.class, "id", false, null, null);
|
||||||
|
sc_2.addAnd("networkOfferingId", SearchCriteria.Op.IN, idset);
|
||||||
|
sc_2.addAnd("removed", SearchCriteria.Op.EQ, null);
|
||||||
|
return this.search(sc_2, searchFilter_2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,11 +60,14 @@ public class SslCertVO implements SslCert {
|
|||||||
@Column(name = "fingerprint")
|
@Column(name = "fingerprint")
|
||||||
String fingerPrint;
|
String fingerPrint;
|
||||||
|
|
||||||
|
@Column(name = "name")
|
||||||
|
String name;
|
||||||
|
|
||||||
public SslCertVO() {
|
public SslCertVO() {
|
||||||
uuid = UUID.randomUUID().toString();
|
uuid = UUID.randomUUID().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SslCertVO(String cert, String key, String password, String chain, Long accountId, Long domainId, String fingerPrint) {
|
public SslCertVO(String cert, String key, String password, String chain, Long accountId, Long domainId, String fingerPrint, String name) {
|
||||||
certificate = cert;
|
certificate = cert;
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.chain = chain;
|
this.chain = chain;
|
||||||
@ -73,6 +76,7 @@ public class SslCertVO implements SslCert {
|
|||||||
this.domainId = domainId;
|
this.domainId = domainId;
|
||||||
this.fingerPrint = fingerPrint;
|
this.fingerPrint = fingerPrint;
|
||||||
uuid = UUID.randomUUID().toString();
|
uuid = UUID.randomUUID().toString();
|
||||||
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
@ -121,6 +125,11 @@ public class SslCertVO implements SslCert {
|
|||||||
return fingerPrint;
|
return fingerPrint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<?> getEntityType() {
|
public Class<?> getEntityType() {
|
||||||
return SslCert.class;
|
return SslCert.class;
|
||||||
|
|||||||
@ -156,6 +156,9 @@ public class NetworkOfferingVO implements NetworkOffering {
|
|||||||
@Column(name = "public_lb")
|
@Column(name = "public_lb")
|
||||||
boolean publicLb;
|
boolean publicLb;
|
||||||
|
|
||||||
|
@Column(name="service_package_id")
|
||||||
|
String servicePackageUuid = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isKeepAliveEnabled() {
|
public boolean isKeepAliveEnabled() {
|
||||||
return keepAliveEnabled;
|
return keepAliveEnabled;
|
||||||
@ -500,8 +503,17 @@ public class NetworkOfferingVO implements NetworkOffering {
|
|||||||
return supportsStrechedL2;
|
return supportsStrechedL2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setServicePackage(String servicePackageUuid) {
|
||||||
|
this.servicePackageUuid = servicePackageUuid;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getSupportsPublicAccess() {
|
public boolean getSupportsPublicAccess() {
|
||||||
return supportsPublicAccess;
|
return supportsPublicAccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getServicePackage() {
|
||||||
|
return servicePackageUuid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,4 +61,7 @@ public interface NetworkOfferingDao extends GenericDao<NetworkOfferingVO, Long>
|
|||||||
|
|
||||||
NetworkOfferingVO persist(NetworkOfferingVO off, Map<Detail, String> details);
|
NetworkOfferingVO persist(NetworkOfferingVO off, Map<Detail, String> details);
|
||||||
|
|
||||||
|
List<Long> listNetworkOfferingID();
|
||||||
|
|
||||||
|
boolean isUsingServicePackage(String uuid);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.offerings.dao;
|
package com.cloud.offerings.dao;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -32,6 +33,7 @@ import com.cloud.offering.NetworkOffering.Detail;
|
|||||||
import com.cloud.offerings.NetworkOfferingDetailsVO;
|
import com.cloud.offerings.NetworkOfferingDetailsVO;
|
||||||
import com.cloud.offerings.NetworkOfferingVO;
|
import com.cloud.offerings.NetworkOfferingVO;
|
||||||
import com.cloud.utils.db.DB;
|
import com.cloud.utils.db.DB;
|
||||||
|
import com.cloud.utils.db.Filter;
|
||||||
import com.cloud.utils.db.GenericDaoBase;
|
import com.cloud.utils.db.GenericDaoBase;
|
||||||
import com.cloud.utils.db.GenericSearchBuilder;
|
import com.cloud.utils.db.GenericSearchBuilder;
|
||||||
import com.cloud.utils.db.SearchBuilder;
|
import com.cloud.utils.db.SearchBuilder;
|
||||||
@ -189,4 +191,32 @@ public class NetworkOfferingDaoImpl extends GenericDaoBase<NetworkOfferingVO, Lo
|
|||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Long> listNetworkOfferingID() {
|
||||||
|
final SearchCriteria<NetworkOfferingVO> sc_1 = createSearchCriteria();
|
||||||
|
final Filter searchFilter_1 = new Filter(NetworkOfferingVO.class, "created", false, null, null);
|
||||||
|
sc_1.addAnd("servicePackageUuid", SearchCriteria.Op.NEQ, null);
|
||||||
|
sc_1.addAnd("removed", SearchCriteria.Op.EQ, null);
|
||||||
|
List<NetworkOfferingVO> set_of_servicePackageUuid = this.search(sc_1, searchFilter_1);
|
||||||
|
List<Long> id_set = new ArrayList<Long>();
|
||||||
|
for (NetworkOfferingVO node : set_of_servicePackageUuid) {
|
||||||
|
if (node.getServicePackage() != null && !node.getServicePackage().isEmpty()) {
|
||||||
|
id_set.add(node.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return id_set;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUsingServicePackage(String uuid) {
|
||||||
|
final SearchCriteria<NetworkOfferingVO> sc = createSearchCriteria();
|
||||||
|
final Filter searchFilter= new Filter(NetworkOfferingVO.class, "created", false, null, null);
|
||||||
|
sc.addAnd("state", SearchCriteria.Op.EQ, NetworkOffering.State.Enabled);
|
||||||
|
sc.addAnd("servicePackageUuid", SearchCriteria.Op.EQ, uuid);
|
||||||
|
List<NetworkOfferingVO> list = this.search(sc, searchFilter);
|
||||||
|
if(list!=null && !list.isEmpty())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -216,6 +216,10 @@ public class VMwareGuru extends HypervisorGuruBase implements HypervisorGuru, Co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vm.getType() == VirtualMachine.Type.NetScalerVm) {
|
||||||
|
details.put(VmDetailConstants.ROOT_DISK_CONTROLLER, "scsi");
|
||||||
|
}
|
||||||
|
|
||||||
List<NicProfile> nicProfiles = vm.getNics();
|
List<NicProfile> nicProfiles = vm.getNics();
|
||||||
|
|
||||||
for (NicProfile nicProfile : nicProfiles) {
|
for (NicProfile nicProfile : nicProfiles) {
|
||||||
|
|||||||
@ -2022,6 +2022,16 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
|||||||
configNvpExtraOption(extraOptions, vmSpec, nicUuidToDvSwitchUuid);
|
configNvpExtraOption(extraOptions, vmSpec, nicUuidToDvSwitchUuid);
|
||||||
configCustomExtraOption(extraOptions, vmSpec);
|
configCustomExtraOption(extraOptions, vmSpec);
|
||||||
|
|
||||||
|
// config for NCC
|
||||||
|
VirtualMachine.Type vmType = cmd.getVirtualMachine().getType();
|
||||||
|
if (vmType.equals(VirtualMachine.Type.NetScalerVm)) {
|
||||||
|
NicTO mgmtNic = vmSpec.getNics()[0];
|
||||||
|
OptionValue option = new OptionValue();
|
||||||
|
option.setKey("machine.id");
|
||||||
|
option.setValue("ip=" + mgmtNic.getIp() + "&netmask=" + mgmtNic.getNetmask() + "&gateway=" + mgmtNic.getGateway());
|
||||||
|
extraOptions.add(option);
|
||||||
|
}
|
||||||
|
|
||||||
// config VNC
|
// config VNC
|
||||||
String keyboardLayout = null;
|
String keyboardLayout = null;
|
||||||
if (vmSpec.getDetails() != null)
|
if (vmSpec.getDetails() != null)
|
||||||
|
|||||||
@ -86,6 +86,7 @@ import com.cloud.utils.net.NetUtils;
|
|||||||
import com.cloud.utils.script.Script;
|
import com.cloud.utils.script.Script;
|
||||||
import com.cloud.utils.ssh.SSHCmdHelper;
|
import com.cloud.utils.ssh.SSHCmdHelper;
|
||||||
import com.cloud.utils.ssh.SshHelper;
|
import com.cloud.utils.ssh.SshHelper;
|
||||||
|
import com.cloud.vm.VirtualMachine;
|
||||||
import com.cloud.vm.VirtualMachine.PowerState;
|
import com.cloud.vm.VirtualMachine.PowerState;
|
||||||
import com.trilead.ssh2.SCPClient;
|
import com.trilead.ssh2.SCPClient;
|
||||||
import com.xensource.xenapi.Bond;
|
import com.xensource.xenapi.Bond;
|
||||||
@ -1319,6 +1320,18 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
|||||||
|
|
||||||
vmr.VCPUsAtStartup = (long) vmSpec.getCpus();
|
vmr.VCPUsAtStartup = (long) vmSpec.getCpus();
|
||||||
vmr.consoles.clear();
|
vmr.consoles.clear();
|
||||||
|
vmr.xenstoreData.clear();
|
||||||
|
//Add xenstore data for the NetscalerVM
|
||||||
|
if(vmSpec.getType()== VirtualMachine.Type.NetScalerVm) {
|
||||||
|
NicTO mgmtNic = vmSpec.getNics()[0];
|
||||||
|
if(mgmtNic != null ) {
|
||||||
|
Map<String, String> xenstoreData = new HashMap<String, String>(3);
|
||||||
|
xenstoreData.put("vm-data/ip", mgmtNic.getIp().toString().trim());
|
||||||
|
xenstoreData.put("vm-data/gateway", mgmtNic.getGateway().toString().trim());
|
||||||
|
xenstoreData.put("vm-data/netmask", mgmtNic.getNetmask().toString().trim());
|
||||||
|
vmr.xenstoreData = xenstoreData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final VM vm = VM.create(conn, vmr);
|
final VM vm = VM.create(conn, vmr);
|
||||||
if (s_logger.isDebugEnabled()) {
|
if (s_logger.isDebugEnabled()) {
|
||||||
@ -1329,7 +1342,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
|||||||
|
|
||||||
final Integer speed = vmSpec.getMinSpeed();
|
final Integer speed = vmSpec.getMinSpeed();
|
||||||
if (speed != null) {
|
if (speed != null) {
|
||||||
|
|
||||||
int cpuWeight = _maxWeight; // cpu_weight
|
int cpuWeight = _maxWeight; // cpu_weight
|
||||||
int utilization = 0; // max CPU cap, default is unlimited
|
int utilization = 0; // max CPU cap, default is unlimited
|
||||||
|
|
||||||
|
|||||||
@ -87,7 +87,6 @@ public final class CitrixStartCommandWrapper extends CommandWrapper<StartCommand
|
|||||||
|
|
||||||
final Host host = Host.getByUuid(conn, citrixResourceBase.getHost().getUuid());
|
final Host host = Host.getByUuid(conn, citrixResourceBase.getHost().getUuid());
|
||||||
vm = citrixResourceBase.createVmFromTemplate(conn, vmSpec, host);
|
vm = citrixResourceBase.createVmFromTemplate(conn, vmSpec, host);
|
||||||
|
|
||||||
final GPUDeviceTO gpuDevice = vmSpec.getGpuDevice();
|
final GPUDeviceTO gpuDevice = vmSpec.getGpuDevice();
|
||||||
if (gpuDevice != null) {
|
if (gpuDevice != null) {
|
||||||
s_logger.debug("Creating VGPU for of VGPU type: " + gpuDevice.getVgpuType() + " in GPU group " + gpuDevice.getGpuGroup() + " for VM " + vmName);
|
s_logger.debug("Creating VGPU for of VGPU type: " + gpuDevice.getVgpuType() + " in GPU group " + gpuDevice.getGpuGroup() + " for VM " + vmName);
|
||||||
|
|||||||
@ -32,5 +32,5 @@
|
|||||||
<bean id="netscalerElement" class="com.cloud.network.element.NetscalerElement" >
|
<bean id="netscalerElement" class="com.cloud.network.element.NetscalerElement" >
|
||||||
<property name="name" value="Netscaler"/>
|
<property name="name" value="Netscaler"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
<bean id="NetScalerVMManager" class="com.cloud.network.vm.NetScalerVMManagerImpl" />
|
||||||
</beans>
|
</beans>
|
||||||
|
|||||||
@ -0,0 +1,97 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
|
||||||
|
package com.cloud.api.commands;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.persistence.EntityExistsException;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.api.APICommand;
|
||||||
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
|
import org.apache.cloudstack.api.Parameter;
|
||||||
|
import org.apache.cloudstack.api.ServerApiException;
|
||||||
|
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||||
|
import org.apache.cloudstack.context.CallContext;
|
||||||
|
|
||||||
|
import com.cloud.api.response.NetscalerControlCenterResponse;
|
||||||
|
import com.cloud.exception.ConcurrentOperationException;
|
||||||
|
import com.cloud.network.element.NetscalerLoadBalancerElementService;
|
||||||
|
import com.cloud.utils.exception.CloudRuntimeException;
|
||||||
|
|
||||||
|
@APICommand(name = "deleteNetscalerControlCenter", responseObject = SuccessResponse.class, description = "Delete Netscaler Control Center")
|
||||||
|
public class DeleteNetscalerControlCenterCmd extends BaseCmd {
|
||||||
|
|
||||||
|
public static final Logger s_logger = Logger.getLogger(DeleteServicePackageOfferingCmd.class.getName());
|
||||||
|
private static final String s_name = "deleteNetscalerControlCenter";
|
||||||
|
@Inject
|
||||||
|
NetscalerLoadBalancerElementService _netsclarLbService;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.ID, type = CommandType.STRING, entityType = NetscalerControlCenterResponse.class, required = true, description = "Netscaler Control Center ID")
|
||||||
|
private String ID;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() throws ServerApiException, ConcurrentOperationException, EntityExistsException {
|
||||||
|
SuccessResponse response = new SuccessResponse();
|
||||||
|
try {
|
||||||
|
boolean result = _netsclarLbService.deleteNetscalerControlCenter(this);
|
||||||
|
if (response != null && result) {
|
||||||
|
response.setDisplayText("Netscaler Control Center Deleted Successfully");
|
||||||
|
response.setSuccess(result);
|
||||||
|
response.setResponseName(getCommandName());
|
||||||
|
setResponseObject(response);
|
||||||
|
}
|
||||||
|
} catch (CloudRuntimeException runtimeExcp) {
|
||||||
|
response.setDisplayText(runtimeExcp.getMessage());
|
||||||
|
response.setSuccess(false);
|
||||||
|
response.setResponseName(getCommandName());
|
||||||
|
setResponseObject(response);
|
||||||
|
return;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String setId(String iD) {
|
||||||
|
return ID = iD;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandName() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return s_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getEntityOwnerId() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return CallContext.current().getCallingAccount().getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -96,7 +96,7 @@ public class DeleteNetscalerLoadBalancerCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventType() {
|
public String getEventType() {
|
||||||
return EventTypes.EVENT_LOAD_BALANCER_DELETE;
|
return EventTypes.EVENT_EXTERNAL_NCC_DEVICE_DELETE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -34,15 +34,14 @@ import org.apache.cloudstack.api.response.SuccessResponse;
|
|||||||
|
|
||||||
import com.cloud.api.response.NetScalerServicePackageResponse;
|
import com.cloud.api.response.NetScalerServicePackageResponse;
|
||||||
import com.cloud.exception.ConcurrentOperationException;
|
import com.cloud.exception.ConcurrentOperationException;
|
||||||
//import com.cloud.exception.InvalidParameterValueException;
|
|
||||||
import com.cloud.network.element.NetscalerLoadBalancerElementService;
|
import com.cloud.network.element.NetscalerLoadBalancerElementService;
|
||||||
import com.cloud.utils.exception.CloudRuntimeException;
|
import com.cloud.utils.exception.CloudRuntimeException;
|
||||||
|
|
||||||
@APICommand(name = "deleteServicePackageOffering", responseObject = SuccessResponse.class, description = "Delete Service Package Offering")
|
@APICommand(name = "deleteServicePackageOffering", responseObject = SuccessResponse.class, description = "Delete Service Package")
|
||||||
public class DeleteServicePackageOfferingCmd extends BaseCmd {
|
public class DeleteServicePackageOfferingCmd extends BaseCmd {
|
||||||
|
|
||||||
public static final Logger s_logger = Logger.getLogger(DeleteServicePackageOfferingCmd.class.getName());
|
public static final Logger s_logger = Logger.getLogger(DeleteServicePackageOfferingCmd.class.getName());
|
||||||
private static final String s_name = "deleteServicePackageOffering";
|
private static final String s_name = "deleteServicePackage";
|
||||||
@Inject
|
@Inject
|
||||||
NetscalerLoadBalancerElementService _netsclarLbService;
|
NetscalerLoadBalancerElementService _netsclarLbService;
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,148 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
// contributor license agreements. See the NOTICE file distributed with
|
||||||
|
// this work for additional information regarding copyright ownership.
|
||||||
|
// The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
// (the "License"); you may not use this file except in compliance with
|
||||||
|
// the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package com.cloud.api.commands;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.api.ACL;
|
||||||
|
import org.apache.cloudstack.api.APICommand;
|
||||||
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
|
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||||
|
import org.apache.cloudstack.api.Parameter;
|
||||||
|
import org.apache.cloudstack.api.ServerApiException;
|
||||||
|
import org.apache.cloudstack.api.response.NetworkResponse;
|
||||||
|
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
|
||||||
|
import org.apache.cloudstack.api.response.SystemVmResponse;
|
||||||
|
import org.apache.cloudstack.api.response.TemplateResponse;
|
||||||
|
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||||
|
import org.apache.cloudstack.context.CallContext;
|
||||||
|
|
||||||
|
import com.cloud.api.response.NetscalerLoadBalancerResponse;
|
||||||
|
import com.cloud.event.EventTypes;
|
||||||
|
import com.cloud.exception.ConcurrentOperationException;
|
||||||
|
import com.cloud.exception.InsufficientCapacityException;
|
||||||
|
import com.cloud.exception.InvalidParameterValueException;
|
||||||
|
import com.cloud.exception.ResourceAllocationException;
|
||||||
|
import com.cloud.exception.ResourceUnavailableException;
|
||||||
|
import com.cloud.network.element.NetscalerLoadBalancerElementService;
|
||||||
|
import com.cloud.user.Account;
|
||||||
|
import com.cloud.utils.exception.CloudRuntimeException;
|
||||||
|
import com.cloud.vm.VirtualMachine;
|
||||||
|
|
||||||
|
@APICommand(name = "deployNetscalerVpx", responseObject = NetscalerLoadBalancerResponse.class, description = "Creates new NS Vpx",
|
||||||
|
requestHasSensitiveInfo = true, responseHasSensitiveInfo = false)
|
||||||
|
public class DeployNetscalerVpxCmd extends BaseAsyncCmd {
|
||||||
|
|
||||||
|
public static final Logger s_logger = Logger.getLogger(DeployNetscalerVpxCmd.class.getName());
|
||||||
|
private static final String s_name = "deployNetscalerVpx";
|
||||||
|
@Inject
|
||||||
|
NetscalerLoadBalancerElementService _netsclarLbService;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "availability zone for the virtual machine")
|
||||||
|
private Long zoneId;
|
||||||
|
|
||||||
|
@ACL
|
||||||
|
@Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, required = true, description = "the ID of the service offering for the virtual machine")
|
||||||
|
private Long serviceOfferingId;
|
||||||
|
|
||||||
|
@ACL
|
||||||
|
@Parameter(name = ApiConstants.TEMPLATE_ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "the ID of the template for the virtual machine")
|
||||||
|
private Long templateId;
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.NETWORK_ID,
|
||||||
|
type = CommandType.UUID,
|
||||||
|
entityType = NetworkResponse.class, required=false,
|
||||||
|
description = "The network this ip address should be associated to.")
|
||||||
|
private Long networkId;
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
|
||||||
|
ResourceAllocationException {
|
||||||
|
try {
|
||||||
|
Map<String,Object> resp = _netsclarLbService.deployNetscalerServiceVm(this);
|
||||||
|
if (resp.size() > 0) {
|
||||||
|
SystemVmResponse response = _responseGenerator.createSystemVmResponse((VirtualMachine)resp.get("vm"));
|
||||||
|
response.setGuestVlan((String)resp.get("guestvlan"));
|
||||||
|
response.setPublicVlan((List<String>)resp.get("publicvlan"));
|
||||||
|
response.setResponseName(getCommandName());
|
||||||
|
setResponseObject(response);
|
||||||
|
} else {
|
||||||
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to start system vm");
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (InvalidParameterValueException invalidParamExcp) {
|
||||||
|
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
|
||||||
|
} catch (CloudRuntimeException runtimeExcp) {
|
||||||
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getServiceOfferingId() {
|
||||||
|
return serviceOfferingId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getTemplateId() {
|
||||||
|
return templateId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getEventDescription() {
|
||||||
|
return "Adding a netscaler load balancer device";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getEventType() {
|
||||||
|
return EventTypes.EVENT_NETSCALER_VM_START;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandName() {
|
||||||
|
return s_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getZoneId() {
|
||||||
|
return zoneId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getEntityOwnerId() {
|
||||||
|
return CallContext.current().getCallingAccount().getId();
|
||||||
|
}
|
||||||
|
public Account getAccount(){
|
||||||
|
return _accountService.getActiveAccountById(getEntityOwnerId());
|
||||||
|
}
|
||||||
|
public void getReservationContext() {
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,93 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
|
||||||
|
package com.cloud.api.commands;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.api.APICommand;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
|
import org.apache.cloudstack.api.BaseListCmd;
|
||||||
|
import org.apache.cloudstack.api.ServerApiException;
|
||||||
|
import org.apache.cloudstack.api.response.ListResponse;
|
||||||
|
import com.cloud.api.response.NetscalerControlCenterResponse;
|
||||||
|
import com.cloud.exception.ConcurrentOperationException;
|
||||||
|
import com.cloud.exception.InsufficientCapacityException;
|
||||||
|
import com.cloud.exception.InvalidParameterValueException;
|
||||||
|
import com.cloud.exception.ResourceAllocationException;
|
||||||
|
import com.cloud.exception.ResourceUnavailableException;
|
||||||
|
import com.cloud.network.NetScalerControlCenterVO;
|
||||||
|
import com.cloud.network.element.NetscalerLoadBalancerElementService;
|
||||||
|
import com.cloud.utils.exception.CloudRuntimeException;
|
||||||
|
|
||||||
|
@APICommand(name = "listNetscalerControlCenter", responseObject = NetscalerControlCenterResponse.class, description = "list control center", requestHasSensitiveInfo = true, responseHasSensitiveInfo = false)
|
||||||
|
public class ListNetscalerControlCenterCmd extends BaseListCmd {
|
||||||
|
|
||||||
|
public static final Logger s_logger = Logger.getLogger(ListNetscalerControlCenterCmd.class.getName());
|
||||||
|
private static final String s_name = "listNetscalerControlCenter";
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
NetscalerLoadBalancerElementService _netsclarLbService;
|
||||||
|
|
||||||
|
public static String getsName() {
|
||||||
|
return s_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException,
|
||||||
|
ConcurrentOperationException, ResourceAllocationException {
|
||||||
|
try {
|
||||||
|
List<NetScalerControlCenterVO> lncCenters = _netsclarLbService.listNetscalerControlCenter(this);
|
||||||
|
if (lncCenters != null) {
|
||||||
|
ListResponse<NetscalerControlCenterResponse> response = new ListResponse<NetscalerControlCenterResponse>();
|
||||||
|
List<NetscalerControlCenterResponse> lncCentersResponse = new ArrayList<NetscalerControlCenterResponse>();
|
||||||
|
if (lncCenters != null && !lncCenters.isEmpty()) {
|
||||||
|
for (NetScalerControlCenterVO lncCentersVO : lncCenters) {
|
||||||
|
NetscalerControlCenterResponse lncCentreResponse = _netsclarLbService
|
||||||
|
.createNetscalerControlCenterResponse(lncCentersVO);
|
||||||
|
lncCentersResponse.add(lncCentreResponse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
response.setResponses(lncCentersResponse);
|
||||||
|
response.setResponseName(getCommandName());
|
||||||
|
this.setResponseObject(response);
|
||||||
|
} else {
|
||||||
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,
|
||||||
|
"Failed to list Net scalar Control Center due to some internal error.");
|
||||||
|
}
|
||||||
|
} catch (InvalidParameterValueException invalidParamExcp) {
|
||||||
|
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
|
||||||
|
} catch (CloudRuntimeException runtimeExcp) {
|
||||||
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandName() {
|
||||||
|
return s_name;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -27,6 +27,7 @@ import org.apache.cloudstack.api.Parameter;
|
|||||||
import org.apache.cloudstack.api.ServerApiException;
|
import org.apache.cloudstack.api.ServerApiException;
|
||||||
import org.apache.cloudstack.context.CallContext;
|
import org.apache.cloudstack.context.CallContext;
|
||||||
|
|
||||||
|
import com.cloud.api.response.NetscalerControlCenterResponse;
|
||||||
import com.cloud.api.response.NetscalerLoadBalancerResponse;
|
import com.cloud.api.response.NetscalerLoadBalancerResponse;
|
||||||
import com.cloud.event.EventTypes;
|
import com.cloud.event.EventTypes;
|
||||||
import com.cloud.exception.ConcurrentOperationException;
|
import com.cloud.exception.ConcurrentOperationException;
|
||||||
@ -43,7 +44,7 @@ import com.cloud.utils.exception.CloudRuntimeException;
|
|||||||
public class RegisterNetscalerControlCenterCmd extends BaseAsyncCmd {
|
public class RegisterNetscalerControlCenterCmd extends BaseAsyncCmd {
|
||||||
|
|
||||||
public static final Logger s_logger = Logger.getLogger(RegisterNetscalerControlCenterCmd.class.getName());
|
public static final Logger s_logger = Logger.getLogger(RegisterNetscalerControlCenterCmd.class.getName());
|
||||||
private static final String s_name = "registernetscalercontrolcenterrresponse";
|
private static final String s_name = "registernetscalercontrolcenterresponse";
|
||||||
@Inject
|
@Inject
|
||||||
NetscalerLoadBalancerElementService _netsclarLbService;
|
NetscalerLoadBalancerElementService _netsclarLbService;
|
||||||
|
|
||||||
@ -108,10 +109,10 @@ public class RegisterNetscalerControlCenterCmd extends BaseAsyncCmd {
|
|||||||
try {
|
try {
|
||||||
NetScalerControlCenterVO nccVO = _netsclarLbService.registerNetscalerControlCenter(this);
|
NetScalerControlCenterVO nccVO = _netsclarLbService.registerNetscalerControlCenter(this);
|
||||||
if (nccVO != null) {
|
if (nccVO != null) {
|
||||||
/*NetscalerLoadBalancerResponse response = _netsclarLbService.createNetscalerLoadBalancerResponse(lbDeviceVO);
|
NetscalerControlCenterResponse response = _netsclarLbService.createNetscalerControlCenterResponse(nccVO);
|
||||||
response.setObjectName("netscalerloadbalancer");
|
response.setObjectName("netscalerloadbalancer");
|
||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);*/
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add netscaler load balancer due to internal error.");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add netscaler load balancer due to internal error.");
|
||||||
}
|
}
|
||||||
@ -124,12 +125,12 @@ public class RegisterNetscalerControlCenterCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "Adding a netscaler load balancer device";
|
return "Adding a Netscaler Control Center Device";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventType() {
|
public String getEventType() {
|
||||||
return EventTypes.EVENT_EXTERNAL_LB_DEVICE_ADD;
|
return EventTypes.EVENT_EXTERNAL_NCC_DEVICE_ADD;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -52,16 +52,7 @@ public class RegisterServicePackageCmd extends BaseCmd {
|
|||||||
@Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, required = true, description = "Description of Service Package")
|
@Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, required = true, description = "Description of Service Package")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
/* @Override
|
|
||||||
public String getEventType() {
|
|
||||||
return EventTypes.EVENT_NETSCALER_SERVICEPACKAGE_ADD;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getEventDescription() {
|
|
||||||
return "Adding Netscaler Service Package";
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() throws ServerApiException, ConcurrentOperationException, EntityExistsException {
|
public void execute() throws ServerApiException, ConcurrentOperationException, EntityExistsException {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -0,0 +1,132 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
package com.cloud.api.commands;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||||
|
import org.apache.cloudstack.api.ACL;
|
||||||
|
import org.apache.cloudstack.api.APICommand;
|
||||||
|
import org.apache.cloudstack.api.ApiCommandJobType;
|
||||||
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
|
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||||
|
import org.apache.cloudstack.api.Parameter;
|
||||||
|
import org.apache.cloudstack.api.ServerApiException;
|
||||||
|
import org.apache.cloudstack.api.response.DomainRouterResponse;
|
||||||
|
import org.apache.cloudstack.context.CallContext;
|
||||||
|
|
||||||
|
import com.cloud.event.EventTypes;
|
||||||
|
import com.cloud.exception.ConcurrentOperationException;
|
||||||
|
import com.cloud.exception.InvalidParameterValueException;
|
||||||
|
import com.cloud.exception.ResourceUnavailableException;
|
||||||
|
import com.cloud.network.element.NetscalerLoadBalancerElementService;
|
||||||
|
import com.cloud.network.router.VirtualRouter;
|
||||||
|
import com.cloud.network.router.VirtualRouter.Role;
|
||||||
|
import com.cloud.vm.VirtualMachine;
|
||||||
|
|
||||||
|
@APICommand(name = "stopNetScalerVpx", description = "Stops a NetScalervm.", responseObject = DomainRouterResponse.class, entityType = {VirtualMachine.class},
|
||||||
|
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||||
|
public class StopNetScalerVMCmd extends BaseAsyncCmd {
|
||||||
|
public static final Logger s_logger = Logger.getLogger(StopNetScalerVMCmd.class.getName());
|
||||||
|
private static final String s_name = "stopNetScalerVmresponse";
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
NetscalerLoadBalancerElementService _netsclarLbService;
|
||||||
|
// ///////////////////////////////////////////////////
|
||||||
|
// ////////////// API parameters /////////////////////
|
||||||
|
// ///////////////////////////////////////////////////
|
||||||
|
@ACL(accessType = AccessType.OperateEntry)
|
||||||
|
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, required = true, description = "the ID of the NetScaler vm")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM. The caller knows the VM is stopped.")
|
||||||
|
private Boolean forced;
|
||||||
|
|
||||||
|
// ///////////////////////////////////////////////////
|
||||||
|
// ///////////////// Accessors ///////////////////////
|
||||||
|
// ///////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ///////////////////////////////////////////////////
|
||||||
|
// ///////////// API Implementation///////////////////
|
||||||
|
// ///////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandName() {
|
||||||
|
return s_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getEntityOwnerId() {
|
||||||
|
VirtualRouter vm = _entityMgr.findById(VirtualRouter.class, getId());
|
||||||
|
if (vm != null && vm.getRole() == Role.NETSCALER_VM) {
|
||||||
|
return vm.getAccountId();
|
||||||
|
} else {
|
||||||
|
throw new InvalidParameterValueException("Unable to find NetScaler vm by id");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getEventType() {
|
||||||
|
return EventTypes.EVENT_NETSCALER_VM_STOP;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getEventDescription() {
|
||||||
|
return "stopping Netscaler vm: " + getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApiCommandJobType getInstanceType() {
|
||||||
|
return ApiCommandJobType.DomainRouter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getInstanceId() {
|
||||||
|
return getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isForced() {
|
||||||
|
return (forced != null) ? forced : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() throws ConcurrentOperationException, ResourceUnavailableException {
|
||||||
|
CallContext.current().setEventDetails("NetScaler vm Id: " + getId());
|
||||||
|
VirtualRouter result = null;
|
||||||
|
VirtualRouter vm = _routerService.findRouter(getId());
|
||||||
|
if (vm == null || vm.getRole() != Role.NETSCALER_VM) {
|
||||||
|
throw new InvalidParameterValueException("Can't find NetScaler lb vm by id");
|
||||||
|
} else {
|
||||||
|
result = _netsclarLbService.stopNetscalerServiceVm(getId(), isForced(), CallContext.current().getCallingAccount(), CallContext.current().getCallingUserId());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result != null) {
|
||||||
|
DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result);
|
||||||
|
response.setResponseName(getCommandName());
|
||||||
|
setResponseObject(response);
|
||||||
|
} else {
|
||||||
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to stop Netscaler vm");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,98 @@
|
|||||||
|
//Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
|
||||||
|
//contributor license agreements. See the NOTICE file distributed with
|
||||||
|
//this work for additional information regarding copyright ownership.
|
||||||
|
//The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
//(the "License"); you may not use this file except in compliance with
|
||||||
|
//the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
//http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
//Unless required by applicable law or agreed to in writing, software
|
||||||
|
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
//See the License for the specific language governing permissions and
|
||||||
|
//limitations under the License.
|
||||||
|
|
||||||
|
package com.cloud.api.response;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.BaseResponse;
|
||||||
|
import com.cloud.network.NetScalerControlCenterVO;
|
||||||
|
import com.cloud.serializer.Param;
|
||||||
|
|
||||||
|
public class NetscalerControlCenterResponse extends BaseResponse {
|
||||||
|
|
||||||
|
@SerializedName(ApiConstants.ID)
|
||||||
|
@Param(description = "id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@SerializedName(ApiConstants.USERNAME)
|
||||||
|
@Param(description = "username")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
@SerializedName(ApiConstants.UUID)
|
||||||
|
@Param(description = "uuid")
|
||||||
|
private String uuid;
|
||||||
|
|
||||||
|
@SerializedName(ApiConstants.IP_ADDRESS)
|
||||||
|
@Param(description = "ncc_ip")
|
||||||
|
private String nccip;
|
||||||
|
|
||||||
|
@SerializedName(ApiConstants.NUM_RETRIES)
|
||||||
|
@Param(description = "num_retries")
|
||||||
|
private String numretries;
|
||||||
|
|
||||||
|
public NetscalerControlCenterResponse() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public NetscalerControlCenterResponse(NetScalerControlCenterVO controlcenter) {
|
||||||
|
this.id = controlcenter.getUuid();
|
||||||
|
this.username = controlcenter.getUsername();
|
||||||
|
this.uuid = controlcenter.getUuid();
|
||||||
|
this.username = controlcenter.getUsername();
|
||||||
|
this.nccip = controlcenter.getNccip();
|
||||||
|
this.numretries = String.valueOf(controlcenter.getNumRetries());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUuid() {
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUuid(String uuid) {
|
||||||
|
this.uuid = uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNccip() {
|
||||||
|
return nccip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNccip(String nccip) {
|
||||||
|
this.nccip = nccip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNumRetries() {
|
||||||
|
return numretries;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumRetries(String numRetries) {
|
||||||
|
this.numretries = numRetries;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -29,10 +29,9 @@ import org.apache.cloudstack.api.InternalIdentity;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NetScalerPodVO contains information about a EIP deployment where on datacenter L3 router a PBR (policy
|
* NetScalerControlCenterVO contains information about a NetScaler Control Center(NCC) such as Username,
|
||||||
* based routing) is setup between a POD's subnet IP range to a NetScaler device. This VO object
|
* Password used for login, the NCC IP and maximum number of unsuccessful tries a user can make.
|
||||||
* represents a mapping between a POD and NetScaler device where PBR is setup.
|
* By using this information CloudStack can access the NCC.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "external_netscaler_controlcenter")
|
@Table(name = "external_netscaler_controlcenter")
|
||||||
|
|||||||
@ -30,10 +30,8 @@ import org.apache.cloudstack.api.InternalIdentity;
|
|||||||
import com.cloud.api.commands.RegisterServicePackageCmd;
|
import com.cloud.api.commands.RegisterServicePackageCmd;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NetScalerPodVO contains information about a EIP deployment where on datacenter L3 router a PBR (policy
|
* NetScalerServicePackageVO contains information about service packages from NetScaler Control Center(NCC).
|
||||||
* based routing) is setup between a POD's subnet IP range to a NetScaler device. This VO object
|
* By using the service package, CloudStack can choose the kind of NetScaler offering it wants to use.
|
||||||
* represents a mapping between a POD and NetScaler device where PBR is setup.
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = " netscaler_servicepackages")
|
@Table(name = " netscaler_servicepackages")
|
||||||
|
|||||||
@ -26,4 +26,6 @@ public interface NetScalerServicePackageDao extends GenericDao<NetScalerServiceP
|
|||||||
NetScalerServicePackageVO findByPodId(long podId);
|
NetScalerServicePackageVO findByPodId(long podId);
|
||||||
|
|
||||||
List<NetScalerServicePackageVO> listByNetScalerDeviceId(long netscalerDeviceId);
|
List<NetScalerServicePackageVO> listByNetScalerDeviceId(long netscalerDeviceId);
|
||||||
|
|
||||||
|
public void removeAll();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,11 +40,9 @@ public class NetScalerServicePackageDaoImpl extends GenericDaoBase<NetScalerServ
|
|||||||
super();
|
super();
|
||||||
|
|
||||||
podIdSearch = createSearchBuilder();
|
podIdSearch = createSearchBuilder();
|
||||||
//podIdSearch.and("pod_id", podIdSearch.entity().getPodId(), Op.EQ);
|
|
||||||
podIdSearch.done();
|
podIdSearch.done();
|
||||||
|
|
||||||
deviceIdSearch = createSearchBuilder();
|
deviceIdSearch = createSearchBuilder();
|
||||||
//deviceIdSearch.and("netscalerDeviceId", deviceIdSearch.entity().getNetscalerDeviceId(), Op.EQ);
|
|
||||||
deviceIdSearch.done();
|
deviceIdSearch.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,4 +60,11 @@ public class NetScalerServicePackageDaoImpl extends GenericDaoBase<NetScalerServ
|
|||||||
return search(sc, null);
|
return search(sc, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeAll() {
|
||||||
|
List<NetScalerServicePackageVO> list_NetScalerServicePackageVO = this.listAll();
|
||||||
|
for (NetScalerServicePackageVO row : list_NetScalerServicePackageVO) {
|
||||||
|
this.remove(row.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,8 +37,6 @@ import com.google.gson.Gson;
|
|||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
import org.apache.cloudstack.api.ApiErrorCode;
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.ServerApiException;
|
import org.apache.cloudstack.api.ServerApiException;
|
||||||
import org.apache.cloudstack.api.command.admin.address.AcquirePodIpCmdByAdmin;
|
|
||||||
import org.apache.cloudstack.api.command.admin.address.ReleasePodIpCmdByAdmin;
|
|
||||||
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
|
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
|
||||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||||
import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice;
|
import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice;
|
||||||
@ -61,12 +59,14 @@ import com.cloud.api.commands.ConfigureNetscalerLoadBalancerCmd;
|
|||||||
import com.cloud.api.commands.DeleteNetscalerControlCenterCmd;
|
import com.cloud.api.commands.DeleteNetscalerControlCenterCmd;
|
||||||
import com.cloud.api.commands.DeleteNetscalerLoadBalancerCmd;
|
import com.cloud.api.commands.DeleteNetscalerLoadBalancerCmd;
|
||||||
import com.cloud.api.commands.DeleteServicePackageOfferingCmd;
|
import com.cloud.api.commands.DeleteServicePackageOfferingCmd;
|
||||||
|
import com.cloud.api.commands.DeployNetscalerVpxCmd;
|
||||||
import com.cloud.api.commands.ListNetscalerControlCenterCmd;
|
import com.cloud.api.commands.ListNetscalerControlCenterCmd;
|
||||||
import com.cloud.api.commands.ListNetscalerLoadBalancerNetworksCmd;
|
import com.cloud.api.commands.ListNetscalerLoadBalancerNetworksCmd;
|
||||||
import com.cloud.api.commands.ListNetscalerLoadBalancersCmd;
|
import com.cloud.api.commands.ListNetscalerLoadBalancersCmd;
|
||||||
import com.cloud.api.commands.ListRegisteredServicePackageCmd;
|
import com.cloud.api.commands.ListRegisteredServicePackageCmd;
|
||||||
import com.cloud.api.commands.RegisterNetscalerControlCenterCmd;
|
import com.cloud.api.commands.RegisterNetscalerControlCenterCmd;
|
||||||
import com.cloud.api.commands.RegisterServicePackageCmd;
|
import com.cloud.api.commands.RegisterServicePackageCmd;
|
||||||
|
import com.cloud.api.commands.StopNetScalerVMCmd;
|
||||||
import com.cloud.api.response.NetScalerServicePackageResponse;
|
import com.cloud.api.response.NetScalerServicePackageResponse;
|
||||||
import com.cloud.api.response.NetscalerControlCenterResponse;
|
import com.cloud.api.response.NetscalerControlCenterResponse;
|
||||||
import com.cloud.api.response.NetscalerLoadBalancerResponse;
|
import com.cloud.api.response.NetscalerLoadBalancerResponse;
|
||||||
@ -79,7 +79,11 @@ import com.cloud.dc.DataCenterVO;
|
|||||||
import com.cloud.dc.HostPodVO;
|
import com.cloud.dc.HostPodVO;
|
||||||
import com.cloud.dc.dao.DataCenterDao;
|
import com.cloud.dc.dao.DataCenterDao;
|
||||||
import com.cloud.dc.dao.DataCenterIpAddressDao;
|
import com.cloud.dc.dao.DataCenterIpAddressDao;
|
||||||
|
import com.cloud.deploy.DataCenterDeployment;
|
||||||
import com.cloud.deploy.DeployDestination;
|
import com.cloud.deploy.DeployDestination;
|
||||||
|
import com.cloud.deploy.DeploymentPlan;
|
||||||
|
import com.cloud.event.ActionEvent;
|
||||||
|
import com.cloud.event.EventTypes;
|
||||||
import com.cloud.exception.ConcurrentOperationException;
|
import com.cloud.exception.ConcurrentOperationException;
|
||||||
import com.cloud.exception.InsufficientCapacityException;
|
import com.cloud.exception.InsufficientCapacityException;
|
||||||
import com.cloud.exception.InsufficientNetworkCapacityException;
|
import com.cloud.exception.InsufficientNetworkCapacityException;
|
||||||
@ -121,24 +125,26 @@ import com.cloud.network.dao.NetworkServiceMapDao;
|
|||||||
import com.cloud.network.dao.NetworkVO;
|
import com.cloud.network.dao.NetworkVO;
|
||||||
import com.cloud.network.dao.PhysicalNetworkDao;
|
import com.cloud.network.dao.PhysicalNetworkDao;
|
||||||
import com.cloud.network.dao.PhysicalNetworkVO;
|
import com.cloud.network.dao.PhysicalNetworkVO;
|
||||||
//import com.cloud.network.dao.RegisteredServicePackageVO;
|
|
||||||
import com.cloud.network.lb.LoadBalancingRule;
|
import com.cloud.network.lb.LoadBalancingRule;
|
||||||
import com.cloud.network.lb.LoadBalancingRule.LbDestination;
|
import com.cloud.network.lb.LoadBalancingRule.LbDestination;
|
||||||
import com.cloud.network.resource.NetScalerControlCenterResource;
|
import com.cloud.network.resource.NetScalerControlCenterResource;
|
||||||
import com.cloud.network.resource.NetscalerResource;
|
import com.cloud.network.resource.NetscalerResource;
|
||||||
|
import com.cloud.network.router.VirtualRouter;
|
||||||
import com.cloud.network.rules.FirewallRule;
|
import com.cloud.network.rules.FirewallRule;
|
||||||
import com.cloud.network.rules.LbStickinessMethod;
|
import com.cloud.network.rules.LbStickinessMethod;
|
||||||
import com.cloud.network.rules.LbStickinessMethod.StickinessMethodType;
|
import com.cloud.network.rules.LbStickinessMethod.StickinessMethodType;
|
||||||
import com.cloud.network.rules.LoadBalancerContainer;
|
import com.cloud.network.rules.LoadBalancerContainer;
|
||||||
import com.cloud.network.rules.StaticNat;
|
import com.cloud.network.rules.StaticNat;
|
||||||
|
import com.cloud.network.vm.NetScalerVMManager;
|
||||||
import com.cloud.offering.NetworkOffering;
|
import com.cloud.offering.NetworkOffering;
|
||||||
import com.cloud.offerings.dao.NetworkOfferingDao;
|
import com.cloud.offerings.dao.NetworkOfferingDao;
|
||||||
import com.cloud.resource.ResourceManager;
|
import com.cloud.resource.ResourceManager;
|
||||||
import com.cloud.resource.ResourceState;
|
import com.cloud.resource.ResourceState;
|
||||||
import com.cloud.resource.ServerResource;
|
import com.cloud.resource.ServerResource;
|
||||||
|
import com.cloud.user.Account;
|
||||||
import com.cloud.utils.NumbersUtil;
|
import com.cloud.utils.NumbersUtil;
|
||||||
|
import com.cloud.utils.crypt.DBEncryptionUtil;
|
||||||
import com.cloud.utils.db.DB;
|
import com.cloud.utils.db.DB;
|
||||||
import com.cloud.utils.db.SearchCriteria;
|
|
||||||
import com.cloud.utils.db.Transaction;
|
import com.cloud.utils.db.Transaction;
|
||||||
import com.cloud.utils.db.TransactionCallback;
|
import com.cloud.utils.db.TransactionCallback;
|
||||||
import com.cloud.utils.db.TransactionCallbackNoReturn;
|
import com.cloud.utils.db.TransactionCallbackNoReturn;
|
||||||
@ -149,8 +155,9 @@ import com.cloud.vm.NicProfile;
|
|||||||
import com.cloud.vm.ReservationContext;
|
import com.cloud.vm.ReservationContext;
|
||||||
import com.cloud.vm.VirtualMachineProfile;
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
|
|
||||||
public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl implements LoadBalancingServiceProvider, NetscalerLoadBalancerElementService,
|
public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl
|
||||||
ExternalLoadBalancerDeviceManager, IpDeployer, StaticNatServiceProvider, GslbServiceProvider {
|
implements LoadBalancingServiceProvider, NetscalerLoadBalancerElementService, ExternalLoadBalancerDeviceManager,
|
||||||
|
IpDeployer, StaticNatServiceProvider, GslbServiceProvider {
|
||||||
|
|
||||||
private static final Logger s_logger = Logger.getLogger(NetscalerElement.class);
|
private static final Logger s_logger = Logger.getLogger(NetscalerElement.class);
|
||||||
public static final AutoScaleCounterType AutoScaleCounterSnmp = new AutoScaleCounterType("snmp");
|
public static final AutoScaleCounterType AutoScaleCounterSnmp = new AutoScaleCounterType("snmp");
|
||||||
@ -172,10 +179,6 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
|||||||
DataCenterDao _dcDao;
|
DataCenterDao _dcDao;
|
||||||
@Inject
|
@Inject
|
||||||
ExternalLoadBalancerDeviceDao _lbDeviceDao;
|
ExternalLoadBalancerDeviceDao _lbDeviceDao;
|
||||||
|
|
||||||
// @Inject
|
|
||||||
// NetScalerServicePackageDao _lrsPackagesDao;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
NetScalerControlCenterDao _netscalerControlCenterDao;
|
NetScalerControlCenterDao _netscalerControlCenterDao;
|
||||||
@Inject
|
@Inject
|
||||||
@ -206,6 +209,8 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
|||||||
NetworkOrchestrationService _networkService;
|
NetworkOrchestrationService _networkService;
|
||||||
@Inject
|
@Inject
|
||||||
NetworkOfferingDao _networkOfferingDao = null;
|
NetworkOfferingDao _networkOfferingDao = null;
|
||||||
|
@Inject
|
||||||
|
NetScalerVMManager _netScalerVMManager;
|
||||||
|
|
||||||
private boolean canHandle(Network config, Service service) {
|
private boolean canHandle(Network config, Service service) {
|
||||||
DataCenter zone = _dcDao.findById(config.getDataCenterId());
|
DataCenter zone = _dcDao.findById(config.getDataCenterId());
|
||||||
@ -256,8 +261,7 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
|||||||
} else {
|
} else {
|
||||||
// if the network offering has service package implement it with
|
// if the network offering has service package implement it with
|
||||||
// Netscaler Control Center
|
// Netscaler Control Center
|
||||||
manageGuestNetworkWithNetscalerControlCenter(true, guestConfig, offering);
|
return manageGuestNetworkWithNetscalerControlCenter(true, guestConfig, offering);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
} catch (InsufficientCapacityException capacityException) {
|
} catch (InsufficientCapacityException capacityException) {
|
||||||
throw new ResourceUnavailableException(
|
throw new ResourceUnavailableException(
|
||||||
@ -293,7 +297,7 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
|||||||
hostDetails.put("zoneId", Long.toString(guestConfig.getDataCenterId()));
|
hostDetails.put("zoneId", Long.toString(guestConfig.getDataCenterId()));
|
||||||
hostDetails.put("ip", ipAddress);
|
hostDetails.put("ip", ipAddress);
|
||||||
hostDetails.put("username", nccVO.getUsername());
|
hostDetails.put("username", nccVO.getUsername());
|
||||||
hostDetails.put("password", nccVO.getPassword());
|
hostDetails.put("password", DBEncryptionUtil.decrypt(nccVO.getPassword()));
|
||||||
hostDetails.put("deviceName", "netscaler control center");
|
hostDetails.put("deviceName", "netscaler control center");
|
||||||
hostDetails.put("cmdTimeOut", Long.toString(NumbersUtil.parseInt(_configDao.getValue(Config.NCCCmdTimeOut.key()), 600000)));
|
hostDetails.put("cmdTimeOut", Long.toString(NumbersUtil.parseInt(_configDao.getValue(Config.NCCCmdTimeOut.key()), 600000)));
|
||||||
ServerResource resource = new NetScalerControlCenterResource();
|
ServerResource resource = new NetScalerControlCenterResource();
|
||||||
@ -362,7 +366,7 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
|||||||
networkDetails.put("cidr", guestConfig.getCidr());
|
networkDetails.put("cidr", guestConfig.getCidr());
|
||||||
networkDetails.put("gateway", guestConfig.getGateway());
|
networkDetails.put("gateway", guestConfig.getGateway());
|
||||||
networkDetails.put("servicepackage_id", offering.getServicePackage());
|
networkDetails.put("servicepackage_id", offering.getServicePackage());
|
||||||
networkDetails.put("zone_id", zoneId);
|
networkDetails.put("zone_id", zone.getUuid());
|
||||||
networkDetails.put("account_id", guestConfig.getAccountId());
|
networkDetails.put("account_id", guestConfig.getAccountId());
|
||||||
networkDetails.put("add", Boolean.toString(add));
|
networkDetails.put("add", Boolean.toString(add));
|
||||||
selfIp = _ipAddrMgr.acquireGuestIpAddress(guestConfig, null);
|
selfIp = _ipAddrMgr.acquireGuestIpAddress(guestConfig, null);
|
||||||
@ -381,152 +385,30 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
NetScalerImplementNetworkCommand cmd = new NetScalerImplementNetworkCommand(zoneId, netscalerControlCenter.getId(), networkPayload.toString());
|
NetScalerImplementNetworkCommand cmd = new NetScalerImplementNetworkCommand(zone.getUuid(), netscalerControlCenter.getId(), networkPayload.toString());
|
||||||
Answer answer = _agentMgr.easySend(netscalerControlCenter.getId(), cmd);
|
Answer answer = _agentMgr.easySend(netscalerControlCenter.getId(), cmd);
|
||||||
if (add) {
|
if (add) {
|
||||||
//TODO After getting the answer check with the job id and do poll on the job and then save the selfip or acquired guest ip to the Nics table
|
//TODO After getting the answer check with the job id and do poll on the job and then save the selfip or acquired guest ip to the Nics table
|
||||||
if (answer != null) {
|
if (answer != null) {
|
||||||
|
if (answer.getResult() == true) {
|
||||||
if (add) {
|
if (add) {
|
||||||
// Insert a new NIC for this guest network to reserve the self IP
|
// Insert a new NIC for this guest network to reserve the self IP
|
||||||
_networkService.savePlaceholderNic(guestConfig, selfIp, null, null);
|
_networkService.savePlaceholderNic(guestConfig, selfIp, null, null);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// release the self-ip obtained from guest network
|
|
||||||
/*Nic selfipNic = getPlaceholderNic(guestConfig);
|
|
||||||
_nicDao.remove(selfipNic.getId());*/
|
|
||||||
// release the load balancer allocated for the network
|
|
||||||
return true;
|
|
||||||
//write code to remove the self nic or the clean up work
|
|
||||||
}
|
|
||||||
// Send a command to the external load balancer to implement or shutdown the guest network
|
|
||||||
/* long guestVlanTag = Long.parseLong(BroadcastDomainType.getValue(guestConfig.getBroadcastUri()));
|
|
||||||
String selfIp = null;
|
|
||||||
String guestVlanNetmask = NetUtils.cidr2Netmask(guestConfig.getCidr());
|
|
||||||
Integer networkRate = _networkModel.getNetworkRate(guestConfig.getId(), null);
|
|
||||||
if (add) {
|
|
||||||
// on restart network, network could have already been implemented. If already implemented then return
|
|
||||||
Nic selfipNic = getPlaceholderNic(guestConfig);
|
|
||||||
if (selfipNic != null) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// Acquire a self-ip address from the guest network IP address range
|
|
||||||
selfIp = _ipAddrMgr.acquireGuestIpAddress(guestConfig, null);
|
|
||||||
if (selfIp == null) {
|
|
||||||
String msg = "failed to acquire guest IP address so not implementing the network on the external load balancer ";
|
|
||||||
s_logger.error(msg);
|
|
||||||
throw new InsufficientNetworkCapacityException(msg, Network.class, guestConfig.getId());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// get the self-ip used by the load balancer
|
|
||||||
Nic selfipNic = getPlaceholderNic(guestConfig);
|
|
||||||
if (selfipNic == null) {
|
|
||||||
s_logger.warn("Network shutdwon requested on external load balancer element, which did not implement the network."
|
|
||||||
+ " Either network implement failed half way through or already network shutdown is completed. So just returning.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
selfIp = selfipNic.getIp4Address();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// It's a hack, using isOneToOneNat field for indicate if it's inline or not
|
|
||||||
/* boolean inline = _networkMgr.isNetworkInlineMode(guestConfig);
|
|
||||||
IpAddressTO ip =
|
|
||||||
new IpAddressTO(guestConfig.getAccountId(), null, add, false, true, String.valueOf(guestVlanTag), selfIp, guestVlanNetmask, null, networkRate, inline);
|
|
||||||
IpAddressTO[] ips = new IpAddressTO[1];
|
|
||||||
ips[0] = ip;
|
|
||||||
IpAssocCommand cmd = new IpAssocCommand(ips);
|
|
||||||
Answer answer = _agentMgr.easySend(netscalerControlCenter.getId(), cmd);
|
|
||||||
*/
|
|
||||||
/* if (answer == null || !answer.getResult()) {
|
|
||||||
String action = add ? "implement" : "shutdown";
|
|
||||||
String answerDetails = (answer != null) ? answer.getDetails() : null;
|
|
||||||
answerDetails = (answerDetails != null) ? " due to " + answerDetails : "";
|
|
||||||
String msg = "External load balancer was unable to " + action + " the guest network on the external load balancer in zone " + zone.getName() + answerDetails;
|
|
||||||
s_logger.error(msg);
|
|
||||||
throw new ResourceUnavailableException(msg, Network.class, guestConfig.getId());
|
|
||||||
}
|
|
||||||
=======
|
|
||||||
NetScalerImplementNetworkCommand cmd = new NetScalerImplementNetworkCommand(zoneId,
|
|
||||||
netscalerControlCenter.getId(), networkPayload.toString());
|
|
||||||
>>>>>>> Stashed changes
|
|
||||||
if (add) {
|
|
||||||
Answer answer = _agentMgr.easySend(netscalerControlCenter.getId(), cmd);
|
|
||||||
// TODO After getting the answer check with the job id and do poll
|
|
||||||
// on the job and then save the selfip or acquired guest ip to the
|
|
||||||
// Nics table
|
|
||||||
if (answer != null) {
|
if (answer != null) {
|
||||||
if (add) {
|
if (answer.getResult() == true) {
|
||||||
// Insert a new NIC for this guest network to reserve the
|
return true;
|
||||||
// self IP
|
} else {
|
||||||
_networkService.savePlaceholderNic(guestConfig, selfIp, null, null);
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
// Send a command to the external load balancer to implement or shutdown
|
|
||||||
// the guest network
|
|
||||||
/*
|
|
||||||
* long guestVlanTag =
|
|
||||||
* Long.parseLong(BroadcastDomainType.getValue(guestConfig.
|
|
||||||
* getBroadcastUri())); String selfIp = null; String guestVlanNetmask =
|
|
||||||
* NetUtils.cidr2Netmask(guestConfig.getCidr()); Integer networkRate =
|
|
||||||
* _networkModel.getNetworkRate(guestConfig.getId(), null); if (add) {
|
|
||||||
* // on restart network, network could have already been implemented.
|
|
||||||
* If already implemented then return Nic selfipNic =
|
|
||||||
* getPlaceholderNic(guestConfig); if (selfipNic != null) { return true;
|
|
||||||
* } // Acquire a self-ip address from the guest network IP address
|
|
||||||
* range selfIp = _ipAddrMgr.acquireGuestIpAddress(guestConfig, null);
|
|
||||||
* if (selfIp == null) { String msg =
|
|
||||||
* "failed to acquire guest IP address so not implementing the network on the external load balancer "
|
|
||||||
* ; s_logger.error(msg); throw new
|
|
||||||
* InsufficientNetworkCapacityException(msg, Network.class,
|
|
||||||
* guestConfig.getId()); } } else { // get the self-ip used by the load
|
|
||||||
* balancer Nic selfipNic = getPlaceholderNic(guestConfig); if
|
|
||||||
* (selfipNic == null) { s_logger.warn(
|
|
||||||
* "Network shutdwon requested on external load balancer element, which did not implement the network."
|
|
||||||
* +
|
|
||||||
* " Either network implement failed half way through or already network shutdown is completed. So just returning."
|
|
||||||
* ); return true; } selfIp = selfipNic.getIp4Address(); }
|
|
||||||
*/
|
|
||||||
// It's a hack, using isOneToOneNat field for indicate if it's inline or
|
|
||||||
// not
|
|
||||||
/*
|
|
||||||
* boolean inline = _networkMgr.isNetworkInlineMode(guestConfig);
|
|
||||||
* IpAddressTO ip = new IpAddressTO(guestConfig.getAccountId(), null,
|
|
||||||
* add, false, true, String.valueOf(guestVlanTag), selfIp,
|
|
||||||
* guestVlanNetmask, null, networkRate, inline); IpAddressTO[] ips = new
|
|
||||||
* IpAddressTO[1]; ips[0] = ip; IpAssocCommand cmd = new
|
|
||||||
* IpAssocCommand(ips); Answer answer =
|
|
||||||
* _agentMgr.easySend(netscalerControlCenter.getId(), cmd);
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* if (answer == null || !answer.getResult()) { String action = add ?
|
|
||||||
* "implement" : "shutdown"; String answerDetails = (answer != null) ?
|
|
||||||
* answer.getDetails() : null; answerDetails = (answerDetails != null) ?
|
|
||||||
* " due to " + answerDetails : ""; String msg =
|
|
||||||
* "External load balancer was unable to " + action +
|
|
||||||
* " the guest network on the external load balancer in zone " +
|
|
||||||
* zone.getName() + answerDetails; s_logger.error(msg); throw new
|
|
||||||
* ResourceUnavailableException(msg, Network.class,
|
|
||||||
* guestConfig.getId()); } if (add) { // Insert a new NIC for this guest
|
|
||||||
* network to reserve the self IP
|
|
||||||
* _networkMgr.savePlaceholderNic(guestConfig, selfIp, null, null); }
|
|
||||||
* else { // release the self-ip obtained from guest network Nic
|
|
||||||
* selfipNic = getPlaceholderNic(guestConfig);
|
|
||||||
* _nicDao.remove(selfipNic.getId()); // release the load balancer
|
|
||||||
* allocated for the network boolean releasedLB =
|
|
||||||
* freeLoadBalancerForNetwork(guestConfig); if (!releasedLB) { String
|
|
||||||
* msg =
|
|
||||||
* "Failed to release the external load balancer used for the network: "
|
|
||||||
* + guestConfig.getId(); s_logger.error(msg); } } if
|
|
||||||
* (s_logger.isDebugEnabled()) { Account account =
|
|
||||||
* _accountDao.findByIdIncludingRemoved(guestConfig.getAccountId());
|
|
||||||
* String action = add ? "implemented" : "shut down"; s_logger.debug(
|
|
||||||
* "External load balancer has " + action +
|
|
||||||
* " the guest network for account " + account.getAccountName() +
|
|
||||||
* "(id = " + account.getAccountId() + ") with VLAN tag " +
|
|
||||||
* guestVlanTag); }
|
|
||||||
*/
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -557,9 +439,7 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
|||||||
} else {
|
} else {
|
||||||
// if the network offering has service package implement it with Netscaler Control Center
|
// if the network offering has service package implement it with Netscaler Control Center
|
||||||
return manageGuestNetworkWithNetscalerControlCenter(false, guestConfig, networkOffering);
|
return manageGuestNetworkWithNetscalerControlCenter(false, guestConfig, networkOffering);
|
||||||
//return true;
|
|
||||||
}
|
}
|
||||||
//return manageGuestNetworkWithExternalLoadBalancer(false, guestConfig);
|
|
||||||
} catch (InsufficientCapacityException capacityException) {
|
} catch (InsufficientCapacityException capacityException) {
|
||||||
// TODO: handle out of capacity exception gracefully in case of
|
// TODO: handle out of capacity exception gracefully in case of
|
||||||
// multple providers available
|
// multple providers available
|
||||||
@ -618,7 +498,7 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
|||||||
|
|
||||||
// Specifies that load balancing rules can be made for either TCP or UDP
|
// Specifies that load balancing rules can be made for either TCP or UDP
|
||||||
// traffic
|
// traffic
|
||||||
lbCapabilities.put(Capability.SupportedProtocols, "tcp,udp");
|
lbCapabilities.put(Capability.SupportedProtocols, "tcp,udp,http");
|
||||||
|
|
||||||
// Specifies that this element can measure network usage on a per public
|
// Specifies that this element can measure network usage on a per public
|
||||||
// IP basis
|
// IP basis
|
||||||
@ -896,8 +776,8 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
|||||||
cmdList.add(ListNetscalerControlCenterCmd.class);
|
cmdList.add(ListNetscalerControlCenterCmd.class);
|
||||||
cmdList.add(DeleteServicePackageOfferingCmd.class);
|
cmdList.add(DeleteServicePackageOfferingCmd.class);
|
||||||
cmdList.add(DeleteNetscalerControlCenterCmd.class);
|
cmdList.add(DeleteNetscalerControlCenterCmd.class);
|
||||||
cmdList.add(ReleasePodIpCmdByAdmin.class);
|
cmdList.add(DeployNetscalerVpxCmd.class);
|
||||||
cmdList.add(AcquirePodIpCmdByAdmin.class);
|
cmdList.add(StopNetScalerVMCmd.class);
|
||||||
return cmdList;
|
return cmdList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -974,17 +854,25 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
|||||||
@Override
|
@Override
|
||||||
public boolean deleteServicePackageOffering(DeleteServicePackageOfferingCmd cmd) throws CloudRuntimeException {
|
public boolean deleteServicePackageOffering(DeleteServicePackageOfferingCmd cmd) throws CloudRuntimeException {
|
||||||
NetScalerServicePackageVO result = null;
|
NetScalerServicePackageVO result = null;
|
||||||
boolean flag;
|
boolean flag=false;
|
||||||
try {
|
try {
|
||||||
result = _netscalerServicePackageDao.findByUuid(cmd.getId());
|
result = _netscalerServicePackageDao.findByUuid(cmd.getId());
|
||||||
|
if (result == null)
|
||||||
|
throw new CloudRuntimeException("Record does not Exists in the Table");
|
||||||
|
|
||||||
|
if(_networkOfferingDao.isUsingServicePackage(result.getUuid()))
|
||||||
|
{
|
||||||
|
throw new CloudRuntimeException("Network offering is using the service package. First delete the NeworkOffering and then delete ServicePackage");
|
||||||
|
}
|
||||||
|
|
||||||
flag = _netscalerServicePackageDao.remove(result.getId());
|
flag = _netscalerServicePackageDao.remove(result.getId());
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (e instanceof InvalidParameterValueException)
|
if (e instanceof InvalidParameterValueException)
|
||||||
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.getMessage());
|
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.getMessage());
|
||||||
else if (result == null)
|
|
||||||
throw new CloudRuntimeException("Record does not Exists in the Table");
|
|
||||||
else
|
else
|
||||||
throw new CloudRuntimeException("Network offering is using the service package. First delete the nework offering and then delete ServicePackage");
|
throw e;
|
||||||
|
|
||||||
}
|
}
|
||||||
return flag;
|
return flag;
|
||||||
|
|
||||||
@ -998,10 +886,13 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
|||||||
if (result == null)
|
if (result == null)
|
||||||
throw new CloudRuntimeException("External Netscaler Control Center Table does not contain record with this ID");
|
throw new CloudRuntimeException("External Netscaler Control Center Table does not contain record with this ID");
|
||||||
else {
|
else {
|
||||||
List<Long> id_set_1 = _networkOfferingDao.listServicePackageUuid();
|
//ID list of Network Offering which are not removed and have service Package Uuid field not null.
|
||||||
if (id_set_1.size() != 0) {
|
List<Long> servicePackageId_list = _networkOfferingDao.listNetworkOfferingID();
|
||||||
List<NetworkVO> id_set_2 = _networkDao.listNetworkOfferingId(id_set_1);
|
|
||||||
if (id_set_2 != null && id_set_2.size() != 0)
|
if (servicePackageId_list.size() != 0) {
|
||||||
|
//VO list of Networks which are using Network Offering.
|
||||||
|
List<NetworkVO> networkVO_list = _networkDao.listNetworkVO(servicePackageId_list);
|
||||||
|
if (networkVO_list != null && networkVO_list.size() != 0)
|
||||||
throw new CloudRuntimeException(
|
throw new CloudRuntimeException(
|
||||||
"ServicePackages published by NetScalerControlCenter are being used by NetworkOfferings. Try deleting NetworkOffering with ServicePackages and then delete NetScalerControlCenter.");
|
"ServicePackages published by NetScalerControlCenter are being used by NetworkOfferings. Try deleting NetworkOffering with ServicePackages and then delete NetScalerControlCenter.");
|
||||||
}
|
}
|
||||||
@ -1016,14 +907,12 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
|||||||
_netscalerControlCenterDao.remove(result.getId());
|
_netscalerControlCenterDao.remove(result.getId());
|
||||||
|
|
||||||
//Removal of NCC from Host Table
|
//Removal of NCC from Host Table
|
||||||
SearchCriteria<HostVO> sc = _hostDao.createSearchCriteria();
|
List<HostVO> ncc_list = _hostDao.listAll();
|
||||||
sc.addAnd("type", SearchCriteria.Op.EQ, Host.Type.NetScalerControlCenter);
|
|
||||||
List<HostVO> ncc_list = _hostDao.search(sc, null);
|
|
||||||
|
|
||||||
if (ncc_list == null) {
|
if (ncc_list == null) {
|
||||||
throw new CloudRuntimeException("Could not find Netscaler Control Center in Database");
|
throw new CloudRuntimeException("Could not find Netscaler Control Center in Database");
|
||||||
}
|
}
|
||||||
for (HostVO ncc : ncc_list) {
|
for (HostVO ncc : ncc_list) {
|
||||||
|
if (ncc.getType().equals(Host.Type.NetScalerControlCenter)) {
|
||||||
try {
|
try {
|
||||||
// put the host in maintenance state in order for it to be deleted
|
// put the host in maintenance state in order for it to be deleted
|
||||||
ncc.setResourceState(ResourceState.Maintenance);
|
ncc.setResourceState(ResourceState.Maintenance);
|
||||||
@ -1034,7 +923,7 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1415,7 +1304,7 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
|||||||
int numLoadBalancersForCommand = loadBalancersToApply.size();
|
int numLoadBalancersForCommand = loadBalancersToApply.size();
|
||||||
LoadBalancerTO[] loadBalancersForCommand = loadBalancersToApply
|
LoadBalancerTO[] loadBalancersForCommand = loadBalancersToApply
|
||||||
.toArray(new LoadBalancerTO[numLoadBalancersForCommand]);
|
.toArray(new LoadBalancerTO[numLoadBalancersForCommand]);
|
||||||
HealthCheckLBConfigCommand cmd = new HealthCheckLBConfigCommand(loadBalancersForCommand);
|
HealthCheckLBConfigCommand cmd = new HealthCheckLBConfigCommand(loadBalancersForCommand, network.getId());
|
||||||
HostVO externalLoadBalancer = _hostDao.findById(lbDeviceVO.getHostId());
|
HostVO externalLoadBalancer = _hostDao.findById(lbDeviceVO.getHostId());
|
||||||
answer = (HealthCheckLBConfigAnswer)_agentMgr.easySend(externalLoadBalancer.getId(), cmd);
|
answer = (HealthCheckLBConfigAnswer)_agentMgr.easySend(externalLoadBalancer.getId(), cmd);
|
||||||
return answer.getLoadBalancers();
|
return answer.getLoadBalancers();
|
||||||
@ -1566,6 +1455,7 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ActionEvent(eventType = EventTypes.EVENT_NETSCALER_SERVICEPACKAGE_ADD, eventDescription = "Registering NetScaler Service Package")
|
||||||
public NetScalerServicePackageResponse registerNetscalerServicePackage(RegisterServicePackageCmd cmd) {
|
public NetScalerServicePackageResponse registerNetscalerServicePackage(RegisterServicePackageCmd cmd) {
|
||||||
NetScalerServicePackageVO servicePackage = new NetScalerServicePackageVO(cmd);
|
NetScalerServicePackageVO servicePackage = new NetScalerServicePackageVO(cmd);
|
||||||
NetScalerServicePackageResponse response = null;
|
NetScalerServicePackageResponse response = null;
|
||||||
@ -1578,6 +1468,9 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
|||||||
@DB
|
@DB
|
||||||
public NetScalerControlCenterVO registerNetscalerControlCenter(RegisterNetscalerControlCenterCmd cmd) {
|
public NetScalerControlCenterVO registerNetscalerControlCenter(RegisterNetscalerControlCenterCmd cmd) {
|
||||||
|
|
||||||
|
if (_netscalerControlCenterDao.listAll() != null && _netscalerControlCenterDao.listAll().size() != 0)
|
||||||
|
throw new CloudRuntimeException("One Netscaler Control Center already exist in the DataBase. At a time only one Netscaler Control Center is allowed");
|
||||||
|
|
||||||
final RegisterNetscalerControlCenterCmd cmdinfo = cmd;
|
final RegisterNetscalerControlCenterCmd cmdinfo = cmd;
|
||||||
String ipAddress = cmd.getIpaddress();
|
String ipAddress = cmd.getIpaddress();
|
||||||
Map hostDetails = new HashMap<String, String>();
|
Map hostDetails = new HashMap<String, String>();
|
||||||
@ -1599,11 +1492,9 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
|||||||
return Transaction.execute(new TransactionCallback<NetScalerControlCenterVO>() {
|
return Transaction.execute(new TransactionCallback<NetScalerControlCenterVO>() {
|
||||||
@Override
|
@Override
|
||||||
public NetScalerControlCenterVO doInTransaction(TransactionStatus status) {
|
public NetScalerControlCenterVO doInTransaction(TransactionStatus status) {
|
||||||
NetScalerControlCenterVO nccVO = new NetScalerControlCenterVO(cmdinfo.getUsername(), cmdinfo.getPassword(),
|
NetScalerControlCenterVO nccVO = new NetScalerControlCenterVO(cmdinfo.getUsername(), DBEncryptionUtil.encrypt(cmdinfo.getPassword()),
|
||||||
cmdinfo.getIpaddress(), cmdinfo.getNumretries());
|
cmdinfo.getIpaddress(), cmdinfo.getNumretries());
|
||||||
_netscalerControlCenterDao.persist(nccVO);
|
_netscalerControlCenterDao.persist(nccVO);
|
||||||
/*DetailVO hostDetail = new DetailVO(host.getId(), ApiConstants.NETSCALER_CONTROLCENTER_ID , String.valueOf(nccVO.getId()));
|
|
||||||
_hostDetailDao.persist(hostDetail);*/
|
|
||||||
return nccVO;
|
return nccVO;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1612,4 +1503,27 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
|||||||
throw new CloudRuntimeException(e.getMessage());
|
throw new CloudRuntimeException(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String,Object> deployNetscalerServiceVm(DeployNetscalerVpxCmd cmd) {
|
||||||
|
DataCenter zone = _dcDao.findById(cmd.getZoneId());
|
||||||
|
DeployDestination dest = new DeployDestination(zone, null, null, null);
|
||||||
|
Map<String,Object> resp = new HashMap<String, Object>();
|
||||||
|
Long templateId = cmd.getTemplateId();
|
||||||
|
Long serviceOfferingId = cmd.getServiceOfferingId();
|
||||||
|
DeploymentPlan plan = new DataCenterDeployment(dest.getDataCenter().getId());
|
||||||
|
try {
|
||||||
|
resp = _netScalerVMManager.deployNsVpx(cmd.getAccount(), dest, plan, serviceOfferingId, templateId);
|
||||||
|
} catch (InsufficientCapacityException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VirtualRouter stopNetscalerServiceVm(Long id, boolean forced, Account callingAccount, long callingUserId) throws ConcurrentOperationException,
|
||||||
|
ResourceUnavailableException {
|
||||||
|
return _netScalerVMManager.stopNetScalerVm(id, forced, callingAccount, callingUserId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -17,25 +17,31 @@
|
|||||||
package com.cloud.network.element;
|
package com.cloud.network.element;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.cloud.api.commands.AddNetscalerLoadBalancerCmd;
|
import com.cloud.api.commands.AddNetscalerLoadBalancerCmd;
|
||||||
import com.cloud.api.commands.ConfigureNetscalerLoadBalancerCmd;
|
import com.cloud.api.commands.ConfigureNetscalerLoadBalancerCmd;
|
||||||
import com.cloud.api.commands.DeleteNetscalerControlCenterCmd;
|
import com.cloud.api.commands.DeleteNetscalerControlCenterCmd;
|
||||||
import com.cloud.api.commands.DeleteNetscalerLoadBalancerCmd;
|
import com.cloud.api.commands.DeleteNetscalerLoadBalancerCmd;
|
||||||
import com.cloud.api.commands.DeleteServicePackageOfferingCmd;
|
import com.cloud.api.commands.DeleteServicePackageOfferingCmd;
|
||||||
|
import com.cloud.api.commands.DeployNetscalerVpxCmd;
|
||||||
import com.cloud.api.commands.ListNetscalerControlCenterCmd;
|
import com.cloud.api.commands.ListNetscalerControlCenterCmd;
|
||||||
import com.cloud.api.commands.ListNetscalerLoadBalancerNetworksCmd;
|
import com.cloud.api.commands.ListNetscalerLoadBalancerNetworksCmd;
|
||||||
import com.cloud.api.commands.ListNetscalerLoadBalancersCmd;
|
import com.cloud.api.commands.ListNetscalerLoadBalancersCmd;
|
||||||
import com.cloud.api.commands.ListRegisteredServicePackageCmd;
|
import com.cloud.api.commands.ListRegisteredServicePackageCmd;
|
||||||
import com.cloud.api.commands.RegisterNetscalerControlCenterCmd;
|
import com.cloud.api.commands.RegisterNetscalerControlCenterCmd;
|
||||||
import com.cloud.api.commands.RegisterServicePackageCmd;
|
import com.cloud.api.commands.RegisterServicePackageCmd;
|
||||||
import com.cloud.api.response.NetscalerLoadBalancerResponse;
|
|
||||||
import com.cloud.api.response.NetScalerServicePackageResponse;
|
import com.cloud.api.response.NetScalerServicePackageResponse;
|
||||||
import com.cloud.api.response.NetscalerControlCenterResponse;
|
import com.cloud.api.response.NetscalerControlCenterResponse;
|
||||||
|
import com.cloud.api.response.NetscalerLoadBalancerResponse;
|
||||||
|
import com.cloud.exception.ConcurrentOperationException;
|
||||||
|
import com.cloud.exception.ResourceUnavailableException;
|
||||||
import com.cloud.network.NetScalerControlCenterVO;
|
import com.cloud.network.NetScalerControlCenterVO;
|
||||||
import com.cloud.network.NetScalerServicePackageVO;
|
import com.cloud.network.NetScalerServicePackageVO;
|
||||||
import com.cloud.network.Network;
|
import com.cloud.network.Network;
|
||||||
import com.cloud.network.dao.ExternalLoadBalancerDeviceVO;
|
import com.cloud.network.dao.ExternalLoadBalancerDeviceVO;
|
||||||
|
import com.cloud.network.router.VirtualRouter;
|
||||||
|
import com.cloud.user.Account;
|
||||||
import com.cloud.utils.component.PluggableService;
|
import com.cloud.utils.component.PluggableService;
|
||||||
import com.cloud.utils.exception.CloudRuntimeException;
|
import com.cloud.utils.exception.CloudRuntimeException;
|
||||||
|
|
||||||
@ -135,4 +141,7 @@ public interface NetscalerLoadBalancerElementService extends PluggableService {
|
|||||||
|
|
||||||
public NetScalerControlCenterVO registerNetscalerControlCenter(RegisterNetscalerControlCenterCmd registerNetscalerControlCenterCmd);
|
public NetScalerControlCenterVO registerNetscalerControlCenter(RegisterNetscalerControlCenterCmd registerNetscalerControlCenterCmd);
|
||||||
|
|
||||||
|
public Map<String, Object> deployNetscalerServiceVm(DeployNetscalerVpxCmd cmd);
|
||||||
|
|
||||||
|
public VirtualRouter stopNetscalerServiceVm(Long id, boolean forced, Account callingAccount, long callingUserId) throws ConcurrentOperationException, ResourceUnavailableException;
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,41 @@
|
|||||||
|
//Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
//or more contributor license agreements. See the NOTICE file
|
||||||
|
//distributed with this work for additional information
|
||||||
|
//regarding copyright ownership. The ASF licenses this file
|
||||||
|
//to you under the Apache License, Version 2.0 (the
|
||||||
|
//"License"); you may not use this file except in compliance
|
||||||
|
//with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
//http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
//Unless required by applicable law or agreed to in writing,
|
||||||
|
//software distributed under the License is distributed on an
|
||||||
|
//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
//KIND, either express or implied. See the License for the
|
||||||
|
//specific language governing permissions and limitations
|
||||||
|
//under the License.
|
||||||
|
package com.cloud.network.vm;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.cloud.api.commands.DeployNetscalerVpxCmd;
|
||||||
|
import com.cloud.deploy.DeployDestination;
|
||||||
|
import com.cloud.deploy.DeploymentPlan;
|
||||||
|
import com.cloud.exception.ConcurrentOperationException;
|
||||||
|
import com.cloud.exception.InsufficientCapacityException;
|
||||||
|
import com.cloud.exception.ResourceUnavailableException;
|
||||||
|
import com.cloud.network.router.VirtualRouter;
|
||||||
|
import com.cloud.user.Account;
|
||||||
|
|
||||||
|
public interface NetScalerVMManager {
|
||||||
|
|
||||||
|
//RAM/CPU for the system offering used by Internal LB VMs
|
||||||
|
public static final int DEFAULT_NETSCALER_VM_RAMSIZE = 2048; // 2048 MB
|
||||||
|
public static final int DEFAULT_NETSCALER_VM_CPU_MHZ = 1024; // 1024 MHz
|
||||||
|
|
||||||
|
public Map<String, Object> deployNetscalerServiceVm(DeployNetscalerVpxCmd cmd);
|
||||||
|
|
||||||
|
public VirtualRouter stopNetscalerServiceVm(Long id, boolean forced, Account callingAccount, long callingUserId) throws ConcurrentOperationException, ResourceUnavailableException;
|
||||||
|
public Map<String, Object> deployNsVpx(Account owner, DeployDestination dest, DeploymentPlan plan, long svcOffId, long templateId) throws InsufficientCapacityException;
|
||||||
|
|
||||||
|
public VirtualRouter stopNetScalerVm(Long id, boolean forced, Account callingAccount, long callingUserId);
|
||||||
|
}
|
||||||
@ -0,0 +1,448 @@
|
|||||||
|
//Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
//or more contributor license agreements. See the NOTICE file
|
||||||
|
//distributed with this work for additional information
|
||||||
|
//regarding copyright ownership. The ASF licenses this file
|
||||||
|
//to you under the Apache License, Version 2.0 (the
|
||||||
|
//"License"); you may not use this file except in compliance
|
||||||
|
//with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
//http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
//Unless required by applicable law or agreed to in writing,
|
||||||
|
//software distributed under the License is distributed on an
|
||||||
|
//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
//KIND, either express or implied. See the License for the
|
||||||
|
//specific language governing permissions and limitations
|
||||||
|
//under the License.
|
||||||
|
package com.cloud.network.vm;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.ejb.Local;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.naming.ConfigurationException;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.context.CallContext;
|
||||||
|
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
|
||||||
|
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||||
|
import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao;
|
||||||
|
|
||||||
|
import com.cloud.agent.AgentManager;
|
||||||
|
import com.cloud.agent.api.Answer;
|
||||||
|
import com.cloud.agent.manager.Commands;
|
||||||
|
import com.cloud.api.commands.DeployNetscalerVpxCmd;
|
||||||
|
import com.cloud.dc.DataCenter;
|
||||||
|
import com.cloud.dc.DataCenter.NetworkType;
|
||||||
|
import com.cloud.dc.DataCenterVO;
|
||||||
|
import com.cloud.dc.VlanVO;
|
||||||
|
import com.cloud.dc.dao.DataCenterDao;
|
||||||
|
import com.cloud.dc.dao.VlanDao;
|
||||||
|
import com.cloud.deploy.DataCenterDeployment;
|
||||||
|
import com.cloud.deploy.DeployDestination;
|
||||||
|
import com.cloud.deploy.DeploymentPlan;
|
||||||
|
import com.cloud.exception.ConcurrentOperationException;
|
||||||
|
import com.cloud.exception.InsufficientCapacityException;
|
||||||
|
import com.cloud.exception.InvalidParameterValueException;
|
||||||
|
import com.cloud.exception.OperationTimedoutException;
|
||||||
|
import com.cloud.exception.ResourceUnavailableException;
|
||||||
|
import com.cloud.exception.StorageUnavailableException;
|
||||||
|
import com.cloud.network.IpAddressManager;
|
||||||
|
import com.cloud.network.Network;
|
||||||
|
import com.cloud.network.Network.Provider;
|
||||||
|
import com.cloud.network.NetworkModel;
|
||||||
|
import com.cloud.network.Networks.TrafficType;
|
||||||
|
import com.cloud.network.PhysicalNetwork;
|
||||||
|
import com.cloud.network.PhysicalNetworkServiceProvider;
|
||||||
|
import com.cloud.network.VirtualRouterProvider;
|
||||||
|
import com.cloud.network.dao.NetworkDao;
|
||||||
|
import com.cloud.network.dao.NetworkVO;
|
||||||
|
import com.cloud.network.dao.PhysicalNetworkDao;
|
||||||
|
import com.cloud.network.dao.PhysicalNetworkServiceProviderDao;
|
||||||
|
import com.cloud.network.dao.VirtualRouterProviderDao;
|
||||||
|
import com.cloud.network.element.VirtualRouterProviderVO;
|
||||||
|
import com.cloud.network.lb.LoadBalancingRulesManager;
|
||||||
|
import com.cloud.network.router.VirtualRouter;
|
||||||
|
import com.cloud.network.router.VirtualRouter.RedundantState;
|
||||||
|
import com.cloud.network.router.VirtualRouter.Role;
|
||||||
|
import com.cloud.offering.NetworkOffering;
|
||||||
|
import com.cloud.offerings.dao.NetworkOfferingDao;
|
||||||
|
import com.cloud.resource.ResourceManager;
|
||||||
|
import com.cloud.service.ServiceOfferingVO;
|
||||||
|
import com.cloud.service.dao.ServiceOfferingDao;
|
||||||
|
import com.cloud.storage.VMTemplateVO;
|
||||||
|
import com.cloud.storage.dao.VMTemplateDao;
|
||||||
|
import com.cloud.user.Account;
|
||||||
|
import com.cloud.user.AccountManager;
|
||||||
|
import com.cloud.utils.component.ManagerBase;
|
||||||
|
import com.cloud.utils.exception.CloudRuntimeException;
|
||||||
|
import com.cloud.vm.DomainRouterVO;
|
||||||
|
import com.cloud.vm.NicProfile;
|
||||||
|
import com.cloud.vm.ReservationContext;
|
||||||
|
import com.cloud.vm.VMInstanceVO;
|
||||||
|
import com.cloud.vm.VirtualMachine;
|
||||||
|
import com.cloud.vm.VirtualMachineGuru;
|
||||||
|
import com.cloud.vm.VirtualMachineManager;
|
||||||
|
import com.cloud.vm.VirtualMachineName;
|
||||||
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
|
import com.cloud.vm.VirtualMachineProfile.Param;
|
||||||
|
import com.cloud.vm.dao.DomainRouterDao;
|
||||||
|
import com.cloud.vm.dao.NicDao;
|
||||||
|
import com.cloud.vm.dao.VMInstanceDao;
|
||||||
|
|
||||||
|
@Local(value = {NetScalerVMManager.class})
|
||||||
|
public class NetScalerVMManagerImpl extends ManagerBase implements NetScalerVMManager, VirtualMachineGuru {
|
||||||
|
private static final Logger s_logger = Logger.getLogger(NetScalerVMManagerImpl.class);
|
||||||
|
static final private String NetScalerLbVmNamePrefix = "NS";
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
IpAddressManager _ipAddrMgr;
|
||||||
|
@Inject
|
||||||
|
VirtualMachineManager _itMgr;
|
||||||
|
@Inject
|
||||||
|
DomainRouterDao _internalLbVmDao;
|
||||||
|
@Inject
|
||||||
|
ConfigurationDao _configDao;
|
||||||
|
@Inject
|
||||||
|
AgentManager _agentMgr;
|
||||||
|
@Inject
|
||||||
|
DataCenterDao _dcDao;
|
||||||
|
@Inject
|
||||||
|
VirtualRouterProviderDao _vrProviderDao;
|
||||||
|
@Inject
|
||||||
|
ApplicationLoadBalancerRuleDao _lbDao;
|
||||||
|
@Inject
|
||||||
|
NetworkModel _ntwkModel;
|
||||||
|
@Inject
|
||||||
|
LoadBalancingRulesManager _lbMgr;
|
||||||
|
@Inject
|
||||||
|
NicDao _nicDao;
|
||||||
|
@Inject
|
||||||
|
AccountManager _accountMgr;
|
||||||
|
@Inject
|
||||||
|
NetworkDao _networkDao;
|
||||||
|
@Inject
|
||||||
|
NetworkOrchestrationService _networkMgr;
|
||||||
|
@Inject
|
||||||
|
ServiceOfferingDao _serviceOfferingDao;
|
||||||
|
@Inject
|
||||||
|
PhysicalNetworkServiceProviderDao _physicalProviderDao;
|
||||||
|
@Inject
|
||||||
|
NetworkOfferingDao _networkOfferingDao;
|
||||||
|
@Inject
|
||||||
|
VMTemplateDao _templateDao;
|
||||||
|
@Inject
|
||||||
|
ResourceManager _resourceMgr;
|
||||||
|
@Inject
|
||||||
|
VMInstanceDao _vmDao;
|
||||||
|
@Inject
|
||||||
|
NetworkModel _networkModel;
|
||||||
|
@Inject
|
||||||
|
PhysicalNetworkDao _physicalNetworkDao;
|
||||||
|
@Inject
|
||||||
|
VlanDao _vlanDao;
|
||||||
|
@Inject
|
||||||
|
DomainRouterDao _routerDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) {
|
||||||
|
|
||||||
|
//NetScalerLB vm starts up with 3 Nics
|
||||||
|
//Nic #1 - NS IP
|
||||||
|
//Nic #2 - locallink(guest network)
|
||||||
|
//Nic #3 - public nic
|
||||||
|
|
||||||
|
for (final NicProfile nic : profile.getNics()) {
|
||||||
|
if(nic.getTrafficType() == TrafficType.Control) {
|
||||||
|
nic.setTrafficType(TrafficType.Guest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile profile, DeployDestination dest, ReservationContext context)
|
||||||
|
throws ResourceUnavailableException {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean finalizeStart(VirtualMachineProfile profile, long hostId, Commands cmds, ReservationContext context) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile profile) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void finalizeStop(VirtualMachineProfile profile, Answer answer) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void finalizeExpunge(VirtualMachine vm) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void prepareStop(VirtualMachineProfile profile) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
||||||
|
|
||||||
|
_itMgr.registerGuru(VirtualMachine.Type.NetScalerVm, this);
|
||||||
|
if (s_logger.isInfoEnabled()) {
|
||||||
|
s_logger.info(getName() + " has been configured");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return _name;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected VirtualRouter stopInternalLbVm(DomainRouterVO internalLbVm, boolean forced, Account caller, long callerUserId) throws ResourceUnavailableException,
|
||||||
|
ConcurrentOperationException {
|
||||||
|
s_logger.debug("Stopping internal lb vm " + internalLbVm);
|
||||||
|
try {
|
||||||
|
_itMgr.advanceStop(internalLbVm.getUuid(), forced);
|
||||||
|
return _internalLbVmDao.findById(internalLbVm.getId());
|
||||||
|
} catch (OperationTimedoutException e) {
|
||||||
|
throw new CloudRuntimeException("Unable to stop " + internalLbVm, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public VirtualRouterProvider addNetScalerLoadBalancerElement(long ntwkSvcProviderId) {
|
||||||
|
VirtualRouterProviderVO element = _vrProviderDao.findByNspIdAndType(ntwkSvcProviderId, com.cloud.network.VirtualRouterProvider.Type.NetScalerVm);
|
||||||
|
if (element != null) {
|
||||||
|
s_logger.debug("There is already an " + getName() + " with service provider id " + ntwkSvcProviderId);
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
|
PhysicalNetworkServiceProvider provider = _physicalProviderDao.findById(ntwkSvcProviderId);
|
||||||
|
if (provider == null || !provider.getProviderName().equalsIgnoreCase(getName())) {
|
||||||
|
throw new InvalidParameterValueException("Invalid network service provider is specified");
|
||||||
|
}
|
||||||
|
|
||||||
|
element = new VirtualRouterProviderVO(ntwkSvcProviderId, com.cloud.network.VirtualRouterProvider.Type.NetScalerVm);
|
||||||
|
element.setEnabled(true);
|
||||||
|
element = _vrProviderDao.persist(element);
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected long getNetScalerLbProviderId(long physicalNetworkId) {
|
||||||
|
//final long physicalNetworkId = _ntwkModel.getPhysicalNetworkId(guestNetwork);
|
||||||
|
|
||||||
|
final PhysicalNetworkServiceProvider provider = _physicalProviderDao.findByServiceProvider(physicalNetworkId, "Netscaler");
|
||||||
|
if (provider == null) {
|
||||||
|
throw new CloudRuntimeException("Cannot find service provider " + Provider.Netscaler.toString() + " in physical network " + physicalNetworkId);
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: get from type
|
||||||
|
VirtualRouterProvider netScalerLbProvider = _vrProviderDao.findByNspIdAndType(provider.getId(), com.cloud.network.VirtualRouterProvider.Type.NetScalerVm);
|
||||||
|
if (netScalerLbProvider == null) {
|
||||||
|
//create the vrp for netscalerVM.
|
||||||
|
netScalerLbProvider = addNetScalerLoadBalancerElement(provider.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
return netScalerLbProvider.getId();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> deployNsVpx(Account owner, DeployDestination dest, DeploymentPlan plan, long svcOffId, long templateId) throws InsufficientCapacityException {
|
||||||
|
|
||||||
|
VMTemplateVO template = _templateDao.findById(templateId) ;
|
||||||
|
long id = _vmDao.getNextInSequence(Long.class, "id");
|
||||||
|
Account systemAcct = _accountMgr.getSystemAccount();
|
||||||
|
|
||||||
|
if (template == null) {
|
||||||
|
s_logger.error(" Unable to find the NS VPX template");
|
||||||
|
throw new CloudRuntimeException("Unable to find the Template" + templateId);
|
||||||
|
}
|
||||||
|
long dataCenterId = dest.getDataCenter().getId();
|
||||||
|
DataCenterVO dc = _dcDao.findById(dest.getDataCenter().getId());
|
||||||
|
|
||||||
|
String nxVpxName = VirtualMachineName.getSystemVmName(id, "Vpx", NetScalerLbVmNamePrefix);
|
||||||
|
|
||||||
|
ServiceOfferingVO vpxOffering = _serviceOfferingDao.findById(svcOffId); //using 2GB and 2CPU offering
|
||||||
|
if(vpxOffering.getRamSize() < 2048 && vpxOffering.getCpu() <2 ) {
|
||||||
|
throw new InvalidParameterValueException("Specified Service Offering :" + vpxOffering.getUuid() + " NS Vpx cannot be deployed. Min 2GB Ram and 2 CPU are required");
|
||||||
|
}
|
||||||
|
|
||||||
|
long userId = CallContext.current().getCallingUserId();
|
||||||
|
//TODO change the os bits from 142 103 to the actual guest of bits
|
||||||
|
if(template.getGuestOSId() != 103 ) {
|
||||||
|
throw new InvalidParameterValueException("Specified Template " + template.getUuid()+ " not suitable for NS VPX Deployment. Please register the template with guest os type as unknow(64-bit)");
|
||||||
|
}
|
||||||
|
NetworkVO defaultNetwork = null;
|
||||||
|
NetworkVO defaultPublicNetwork = null;
|
||||||
|
if (dc.getNetworkType() == NetworkType.Advanced && dc.isSecurityGroupEnabled()) {
|
||||||
|
List<NetworkVO> networks = _networkDao.listByZoneSecurityGroup(dataCenterId);
|
||||||
|
if (networks == null || networks.size() == 0) {
|
||||||
|
throw new CloudRuntimeException("Can not found security enabled network in SG Zone " + dc);
|
||||||
|
}
|
||||||
|
defaultNetwork = networks.get(0);
|
||||||
|
} else {
|
||||||
|
TrafficType defaultTrafficType = TrafficType.Management;
|
||||||
|
List<NetworkVO> defaultNetworks = _networkDao.listByZoneAndTrafficType(dataCenterId, defaultTrafficType);
|
||||||
|
|
||||||
|
TrafficType publicTrafficType = TrafficType.Public;
|
||||||
|
List<NetworkVO> publicNetworks = _networkDao.listByZoneAndTrafficType(dataCenterId, publicTrafficType);
|
||||||
|
|
||||||
|
// api should never allow this situation to happen
|
||||||
|
if (defaultNetworks.size() != 1) {
|
||||||
|
throw new CloudRuntimeException("Found " + defaultNetworks.size() + " networks of type " + defaultTrafficType + " when expect to find 1");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (publicNetworks.size() != 1) {
|
||||||
|
throw new CloudRuntimeException("Found " + defaultNetworks.size() + " networks of type " + defaultTrafficType + " when expect to find 1");
|
||||||
|
}
|
||||||
|
defaultPublicNetwork = publicNetworks.get(0);
|
||||||
|
defaultNetwork = defaultNetworks.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
LinkedHashMap<Network, List<? extends NicProfile>> networks = new LinkedHashMap<Network, List<? extends NicProfile>>(4);
|
||||||
|
NicProfile defaultNic = new NicProfile();
|
||||||
|
defaultNic.setDefaultNic(true);
|
||||||
|
defaultNic.setDeviceId(0);
|
||||||
|
|
||||||
|
networks.put(_networkMgr.setupNetwork(_accountMgr.getSystemAccount() , _networkOfferingDao.findById(defaultNetwork.getNetworkOfferingId()), plan, null, null, false).get(0),
|
||||||
|
new ArrayList<NicProfile>());
|
||||||
|
|
||||||
|
NicProfile defaultNic1 = new NicProfile();
|
||||||
|
defaultNic1.setDefaultNic(false);
|
||||||
|
defaultNic1.setDeviceId(1);
|
||||||
|
|
||||||
|
NicProfile defaultNic2 = new NicProfile();
|
||||||
|
defaultNic2.setDefaultNic(false);
|
||||||
|
defaultNic2.setDeviceId(2);
|
||||||
|
defaultNic2.setIPv4Address("");
|
||||||
|
defaultNic2.setIPv4Gateway("");
|
||||||
|
defaultNic2.setIPv4Netmask("");
|
||||||
|
String macAddress = _networkDao.getNextAvailableMacAddress(defaultPublicNetwork.getId());
|
||||||
|
defaultNic2.setMacAddress(macAddress);
|
||||||
|
|
||||||
|
networks.put(_networkMgr.setupNetwork(_accountMgr.getSystemAccount(), _networkOfferingDao.findByUniqueName(NetworkOffering.SystemPublicNetwork), plan, null, null, false).get(0),
|
||||||
|
new ArrayList<NicProfile>(Arrays.asList(defaultNic2)));
|
||||||
|
|
||||||
|
networks.put(_networkMgr.setupNetwork(_accountMgr.getSystemAccount(), _networkOfferingDao.findByUniqueName(NetworkOffering.SystemControlNetwork), plan, null, null, false).get(0),
|
||||||
|
new ArrayList<NicProfile>());
|
||||||
|
|
||||||
|
long physicalNetworkId = _networkModel.findPhysicalNetworkId(dataCenterId, _networkOfferingDao.findById(defaultPublicNetwork.getNetworkOfferingId()).getTags(), TrafficType.Public);
|
||||||
|
// Validate physical network
|
||||||
|
PhysicalNetwork physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId);
|
||||||
|
if (physicalNetwork == null) {
|
||||||
|
throw new InvalidParameterValueException("Unable to find physical network with id: " + physicalNetworkId + " and tag: "
|
||||||
|
+ _networkOfferingDao.findById(defaultPublicNetwork.getNetworkOfferingId()).getTags());
|
||||||
|
}
|
||||||
|
String guestvnet = physicalNetwork.getVnetString();
|
||||||
|
|
||||||
|
final List<VlanVO> vlans = _vlanDao.listByZone(dataCenterId);
|
||||||
|
List<String> pvlan = new ArrayList<String>();
|
||||||
|
for (final VlanVO vlan : vlans) {
|
||||||
|
pvlan.add(vlan.getVlanTag());
|
||||||
|
}
|
||||||
|
|
||||||
|
long netScalerProvider = getNetScalerLbProviderId(physicalNetworkId);
|
||||||
|
DomainRouterVO nsVpx = new DomainRouterVO(id, vpxOffering.getId(), netScalerProvider, nxVpxName,
|
||||||
|
template.getId(), template.getHypervisorType(), template.getGuestOSId(), owner.getDomainId(), owner.getId(), userId, false, RedundantState.UNKNOWN, false,
|
||||||
|
false, VirtualMachine.Type.NetScalerVm, null);
|
||||||
|
|
||||||
|
nsVpx.setRole(Role.NETSCALER_VM);
|
||||||
|
|
||||||
|
nsVpx = _routerDao.persist(nsVpx);
|
||||||
|
|
||||||
|
VMInstanceVO vmVO= _vmDao.findVMByHostName(nxVpxName);
|
||||||
|
_itMgr.allocate(nxVpxName, template, vpxOffering, networks, plan, template.getHypervisorType());
|
||||||
|
Map<Param, Object> params = new HashMap<VirtualMachineProfile.Param, Object>(1);
|
||||||
|
try {
|
||||||
|
if (vmVO != null) {
|
||||||
|
startNsVpx(vmVO, params);
|
||||||
|
} else {
|
||||||
|
throw new NullPointerException();
|
||||||
|
}
|
||||||
|
} catch (StorageUnavailableException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (ConcurrentOperationException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (ResourceUnavailableException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
vmVO= _vmDao.findByUuid(nsVpx.getUuid());
|
||||||
|
Map<String, Object> deployResponse = new HashMap<String, Object>();
|
||||||
|
deployResponse.put("vm", vmVO);
|
||||||
|
deployResponse.put("guestvlan", guestvnet);
|
||||||
|
deployResponse.put("publicvlan", pvlan);
|
||||||
|
return deployResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void startNsVpx(VMInstanceVO nsVpx, Map<Param, Object> params) throws StorageUnavailableException,
|
||||||
|
InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException {
|
||||||
|
s_logger.debug("Starting NS Vpx " + nsVpx);
|
||||||
|
_itMgr.start(nsVpx.getUuid(), params, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String,Object> deployNetscalerServiceVm(DeployNetscalerVpxCmd cmd) {
|
||||||
|
DataCenter zone = _dcDao.findById(cmd.getZoneId());
|
||||||
|
DeployDestination dest = new DeployDestination(zone, null, null, null);
|
||||||
|
VMInstanceVO vmvo = null;
|
||||||
|
Map<String,Object> resp = new HashMap<String, Object>();
|
||||||
|
Long templateId = cmd.getTemplateId();
|
||||||
|
Long serviceOfferingId = cmd.getServiceOfferingId();
|
||||||
|
DeploymentPlan plan = new DataCenterDeployment(dest.getDataCenter().getId());
|
||||||
|
try {
|
||||||
|
resp = deployNsVpx(cmd.getAccount(), dest, plan, serviceOfferingId, templateId);
|
||||||
|
} catch (InsufficientCapacityException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected VirtualRouter stopNetScalerVm(final long vmId, final boolean forced, final Account caller, final long callerUserId) throws ResourceUnavailableException,
|
||||||
|
ConcurrentOperationException {
|
||||||
|
final DomainRouterVO netscalerVm = _routerDao.findById(vmId);
|
||||||
|
s_logger.debug("Stopping NetScaler vm " + netscalerVm);
|
||||||
|
|
||||||
|
if (netscalerVm == null || netscalerVm.getRole() != Role.NETSCALER_VM) {
|
||||||
|
throw new InvalidParameterValueException("Can't find NetScaler vm by id specified");
|
||||||
|
}
|
||||||
|
_accountMgr.checkAccess(caller, null, true, netscalerVm);
|
||||||
|
try {
|
||||||
|
_itMgr.expunge(netscalerVm.getUuid());
|
||||||
|
return _routerDao.findById(netscalerVm.getId());
|
||||||
|
} catch (final Exception e) {
|
||||||
|
throw new CloudRuntimeException("Unable to stop " + netscalerVm, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public VirtualRouter stopNetscalerServiceVm(Long id, boolean forced, Account callingAccount, long callingUserId) throws ConcurrentOperationException,
|
||||||
|
ResourceUnavailableException {
|
||||||
|
return stopNetScalerVm(id, forced, callingAccount, callingUserId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VirtualRouter stopNetScalerVm(Long vmId, boolean forced, Account caller, long callingUserId) {
|
||||||
|
final DomainRouterVO netscalerVm = _routerDao.findById(vmId);
|
||||||
|
s_logger.debug("Stopping NetScaler vm " + netscalerVm);
|
||||||
|
|
||||||
|
if (netscalerVm == null || netscalerVm.getRole() != Role.NETSCALER_VM) {
|
||||||
|
throw new InvalidParameterValueException("Can't find NetScaler vm by id specified");
|
||||||
|
}
|
||||||
|
_accountMgr.checkAccess(caller, null, true, netscalerVm);
|
||||||
|
try {
|
||||||
|
_itMgr.expunge(netscalerVm.getUuid());
|
||||||
|
return _routerDao.findById(netscalerVm.getId());
|
||||||
|
} catch (final Exception e) {
|
||||||
|
throw new CloudRuntimeException("Unable to stop " + netscalerVm, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -90,7 +90,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi
|
|||||||
private static final Logger s_logger = Logger.getLogger(AlertManagerImpl.class.getName());
|
private static final Logger s_logger = Logger.getLogger(AlertManagerImpl.class.getName());
|
||||||
private static final Logger s_alertsLogger = Logger.getLogger("org.apache.cloudstack.alerts");
|
private static final Logger s_alertsLogger = Logger.getLogger("org.apache.cloudstack.alerts");
|
||||||
|
|
||||||
private static final long INITIAL_CAPACITY_CHECK_DELAY = 30L * 1000L; // thirty seconds expressed in milliseconds
|
private static final long INITIAL_CAPACITY_CHECK_DELAY = 30L * 1000L;// thirty seconds expressed in milliseconds
|
||||||
|
|
||||||
private static final DecimalFormat DfPct = new DecimalFormat("###.##");
|
private static final DecimalFormat DfPct = new DecimalFormat("###.##");
|
||||||
private static final DecimalFormat DfWhole = new DecimalFormat("########");
|
private static final DecimalFormat DfWhole = new DecimalFormat("########");
|
||||||
@ -126,7 +126,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi
|
|||||||
protected ConfigDepot _configDepot;
|
protected ConfigDepot _configDepot;
|
||||||
|
|
||||||
private Timer _timer = null;
|
private Timer _timer = null;
|
||||||
private long _capacityCheckPeriod = 60L * 60L * 1000L; // one hour by default
|
private long _capacityCheckPeriod = 60L * 60L * 1000L;// one hour by default
|
||||||
private double _publicIPCapacityThreshold = 0.75;
|
private double _publicIPCapacityThreshold = 0.75;
|
||||||
private double _privateIPCapacityThreshold = 0.75;
|
private double _privateIPCapacityThreshold = 0.75;
|
||||||
private double _secondaryStorageCapacityThreshold = 0.75;
|
private double _secondaryStorageCapacityThreshold = 0.75;
|
||||||
@ -367,7 +367,8 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi
|
|||||||
CapacityVO newVlanCapacity = new CapacityVO(null, dcId, null, null, allocatedVlans, totalVlans, Capacity.CAPACITY_TYPE_VLAN);
|
CapacityVO newVlanCapacity = new CapacityVO(null, dcId, null, null, allocatedVlans, totalVlans, Capacity.CAPACITY_TYPE_VLAN);
|
||||||
newVlanCapacity.setCapacityState(vlanCapacityState);
|
newVlanCapacity.setCapacityState(vlanCapacityState);
|
||||||
_capacityDao.persist(newVlanCapacity);
|
_capacityDao.persist(newVlanCapacity);
|
||||||
} else if (!(capacities.get(0).getUsedCapacity() == allocatedVlans && capacities.get(0).getTotalCapacity() == totalVlans && capacities.get(0).getCapacityState() == vlanCapacityState)) {
|
} else if (!(capacities.get(0).getUsedCapacity() == allocatedVlans && capacities.get(0).getTotalCapacity() == totalVlans
|
||||||
|
&& capacities.get(0).getCapacityState() == vlanCapacityState)) {
|
||||||
CapacityVO capacity = capacities.get(0);
|
CapacityVO capacity = capacities.get(0);
|
||||||
capacity.setUsedCapacity(allocatedVlans);
|
capacity.setUsedCapacity(allocatedVlans);
|
||||||
capacity.setTotalCapacity(totalVlans);
|
capacity.setTotalCapacity(totalVlans);
|
||||||
@ -405,7 +406,8 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi
|
|||||||
CapacityVO newPublicIPCapacity = new CapacityVO(null, dcId, podId, null, allocatedIPs, totalIPs, capacityType);
|
CapacityVO newPublicIPCapacity = new CapacityVO(null, dcId, podId, null, allocatedIPs, totalIPs, capacityType);
|
||||||
newPublicIPCapacity.setCapacityState(ipCapacityState);
|
newPublicIPCapacity.setCapacityState(ipCapacityState);
|
||||||
_capacityDao.persist(newPublicIPCapacity);
|
_capacityDao.persist(newPublicIPCapacity);
|
||||||
} else if (!(capacities.get(0).getUsedCapacity() == allocatedIPs && capacities.get(0).getTotalCapacity() == totalIPs && capacities.get(0).getCapacityState() == ipCapacityState)) {
|
} else if (!(capacities.get(0).getUsedCapacity() == allocatedIPs && capacities.get(0).getTotalCapacity() == totalIPs
|
||||||
|
&& capacities.get(0).getCapacityState() == ipCapacityState)) {
|
||||||
CapacityVO capacity = capacities.get(0);
|
CapacityVO capacity = capacities.get(0);
|
||||||
capacity.setUsedCapacity(allocatedIPs);
|
capacity.setUsedCapacity(allocatedIPs);
|
||||||
capacity.setTotalCapacity(totalIPs);
|
capacity.setTotalCapacity(totalIPs);
|
||||||
@ -571,8 +573,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi
|
|||||||
alertType = AlertManager.AlertType.ALERT_TYPE_STORAGE;
|
alertType = AlertManager.AlertType.ALERT_TYPE_STORAGE;
|
||||||
break;
|
break;
|
||||||
case Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED:
|
case Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED:
|
||||||
msgSubject =
|
msgSubject = "System Alert: Remaining unallocated Storage is low in cluster " + cluster.getName() + " pod " + pod.getName() + " of availability zone " +
|
||||||
"System Alert: Remaining unallocated Storage is low in cluster " + cluster.getName() + " pod " + pod.getName() + " of availability zone " +
|
|
||||||
dc.getName();
|
dc.getName();
|
||||||
totalStr = formatBytesToMegabytes(totalCapacity);
|
totalStr = formatBytesToMegabytes(totalCapacity);
|
||||||
usedStr = formatBytesToMegabytes(usedCapacity);
|
usedStr = formatBytesToMegabytes(usedCapacity);
|
||||||
@ -580,8 +581,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi
|
|||||||
alertType = AlertManager.AlertType.ALERT_TYPE_STORAGE_ALLOCATED;
|
alertType = AlertManager.AlertType.ALERT_TYPE_STORAGE_ALLOCATED;
|
||||||
break;
|
break;
|
||||||
case Capacity.CAPACITY_TYPE_LOCAL_STORAGE:
|
case Capacity.CAPACITY_TYPE_LOCAL_STORAGE:
|
||||||
msgSubject =
|
msgSubject = "System Alert: Remaining unallocated Local Storage is low in cluster " + cluster.getName() + " pod " + pod.getName() + " of availability zone " +
|
||||||
"System Alert: Remaining unallocated Local Storage is low in cluster " + cluster.getName() + " pod " + pod.getName() + " of availability zone " +
|
|
||||||
dc.getName();
|
dc.getName();
|
||||||
totalStr = formatBytesToMegabytes(totalCapacity);
|
totalStr = formatBytesToMegabytes(totalCapacity);
|
||||||
usedStr = formatBytesToMegabytes(usedCapacity);
|
usedStr = formatBytesToMegabytes(usedCapacity);
|
||||||
@ -771,7 +771,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi
|
|||||||
newAlert.setClusterId(clusterId);
|
newAlert.setClusterId(clusterId);
|
||||||
newAlert.setPodId(podId);
|
newAlert.setPodId(podId);
|
||||||
newAlert.setDataCenterId(dataCenterId);
|
newAlert.setDataCenterId(dataCenterId);
|
||||||
newAlert.setSentCount(1); // initialize sent count to 1 since we are now sending an alert
|
newAlert.setSentCount(1);// initialize sent count to 1 since we are now sending an alert
|
||||||
newAlert.setLastSent(new Date());
|
newAlert.setLastSent(new Date());
|
||||||
newAlert.setName(alertType.getName());
|
newAlert.setName(alertType.getName());
|
||||||
_alertDao.persist(newAlert);
|
_alertDao.persist(newAlert);
|
||||||
|
|||||||
@ -1267,13 +1267,11 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||||||
@Override
|
@Override
|
||||||
public SystemVmResponse createSystemVmResponse(VirtualMachine vm) {
|
public SystemVmResponse createSystemVmResponse(VirtualMachine vm) {
|
||||||
SystemVmResponse vmResponse = new SystemVmResponse();
|
SystemVmResponse vmResponse = new SystemVmResponse();
|
||||||
if (vm.getType() == Type.SecondaryStorageVm || vm.getType() == Type.ConsoleProxy || vm.getType() == Type.DomainRouter) {
|
if (vm.getType() == Type.SecondaryStorageVm || vm.getType() == Type.ConsoleProxy || vm.getType() == Type.DomainRouter || vm.getType() == Type.NetScalerVm) {
|
||||||
// SystemVm vm = (SystemVm) systemVM;
|
|
||||||
vmResponse.setId(vm.getUuid());
|
vmResponse.setId(vm.getUuid());
|
||||||
// vmResponse.setObjectId(vm.getId());
|
|
||||||
vmResponse.setSystemVmType(vm.getType().toString().toLowerCase());
|
vmResponse.setSystemVmType(vm.getType().toString().toLowerCase());
|
||||||
|
|
||||||
vmResponse.setName(vm.getHostName());
|
vmResponse.setName(vm.getHostName());
|
||||||
|
|
||||||
if (vm.getPodIdToDeployIn() != null) {
|
if (vm.getPodIdToDeployIn() != null) {
|
||||||
HostPodVO pod = ApiDBUtils.findPodById(vm.getPodIdToDeployIn());
|
HostPodVO pod = ApiDBUtils.findPodById(vm.getPodIdToDeployIn());
|
||||||
if (pod != null) {
|
if (pod != null) {
|
||||||
|
|||||||
@ -3917,7 +3917,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||||||
final Boolean egressDefaultPolicy = cmd.getEgressDefaultPolicy();
|
final Boolean egressDefaultPolicy = cmd.getEgressDefaultPolicy();
|
||||||
Integer maxconn = null;
|
Integer maxconn = null;
|
||||||
boolean enableKeepAlive = false;
|
boolean enableKeepAlive = false;
|
||||||
|
String servicePackageuuid = cmd.getServicePackageId();
|
||||||
// Verify traffic type
|
// Verify traffic type
|
||||||
for (final TrafficType tType : TrafficType.values()) {
|
for (final TrafficType tType : TrafficType.values()) {
|
||||||
if (tType.name().equalsIgnoreCase(trafficTypeString)) {
|
if (tType.name().equalsIgnoreCase(trafficTypeString)) {
|
||||||
@ -4293,6 +4293,16 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||||||
final boolean conserveMode, final Map<Service, Map<Capability, String>> serviceCapabilityMap, final boolean specifyIpRanges, final boolean isPersistent,
|
final boolean conserveMode, final Map<Service, Map<Capability, String>> serviceCapabilityMap, final boolean specifyIpRanges, final boolean isPersistent,
|
||||||
final Map<NetworkOffering.Detail, String> details, final boolean egressDefaultPolicy, final Integer maxconn, final boolean enableKeepAlive) {
|
final Map<NetworkOffering.Detail, String> details, final boolean egressDefaultPolicy, final Integer maxconn, final boolean enableKeepAlive) {
|
||||||
|
|
||||||
|
String servicePackageUuid;
|
||||||
|
String spDescription = null;
|
||||||
|
if (details == null) {
|
||||||
|
servicePackageUuid = null;
|
||||||
|
} else {
|
||||||
|
servicePackageUuid = details.get(NetworkOffering.Detail.servicepackageuuid);
|
||||||
|
spDescription = details.get(NetworkOffering.Detail.servicepackagedescription);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
final String multicastRateStr = _configDao.getValue("multicast.throttling.rate");
|
final String multicastRateStr = _configDao.getValue("multicast.throttling.rate");
|
||||||
final int multicastRate = multicastRateStr == null ? 10 : Integer.parseInt(multicastRateStr);
|
final int multicastRate = multicastRateStr == null ? 10 : Integer.parseInt(multicastRateStr);
|
||||||
tags = StringUtils.cleanupTags(tags);
|
tags = StringUtils.cleanupTags(tags);
|
||||||
@ -4451,11 +4461,37 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||||||
offeringFinal.setServiceOfferingId(serviceOfferingId);
|
offeringFinal.setServiceOfferingId(serviceOfferingId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Set Service package id
|
||||||
|
offeringFinal.setServicePackage(servicePackageUuid);
|
||||||
// validate the details
|
// validate the details
|
||||||
if (details != null) {
|
if (details != null) {
|
||||||
validateNtwkOffDetails(details, serviceProviderMap);
|
validateNtwkOffDetails(details, serviceProviderMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean vpcOff = false;
|
||||||
|
boolean nsOff = false;
|
||||||
|
|
||||||
|
if (serviceProviderMap != null && spDescription != null) {
|
||||||
|
for (final Network.Service service : serviceProviderMap.keySet()) {
|
||||||
|
final Set<Provider> providers = serviceProviderMap.get(service);
|
||||||
|
if (providers != null && !providers.isEmpty()) {
|
||||||
|
for (final Network.Provider provider : providers) {
|
||||||
|
if (provider == Provider.VPCVirtualRouter) {
|
||||||
|
vpcOff = true;
|
||||||
|
}
|
||||||
|
if (provider == Provider.Netscaler) {
|
||||||
|
nsOff = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(vpcOff && nsOff) {
|
||||||
|
if(!(spDescription.equalsIgnoreCase("A NetScalerVPX is dedicated per network.") || spDescription.contains("dedicated NetScaler"))) {
|
||||||
|
throw new InvalidParameterValueException("Only NetScaler Service Pacakge with Dedicated Device Mode is Supported in VPC Type Guest Network");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Transaction.execute(new TransactionCallback<NetworkOfferingVO>() {
|
return Transaction.execute(new TransactionCallback<NetworkOfferingVO>() {
|
||||||
@Override
|
@Override
|
||||||
public NetworkOfferingVO doInTransaction(final TransactionStatus status) {
|
public NetworkOfferingVO doInTransaction(final TransactionStatus status) {
|
||||||
@ -4778,6 +4814,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||||||
return vpcProvider || nuageVpcProvider;
|
return vpcProvider || nuageVpcProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DB
|
||||||
@Override
|
@Override
|
||||||
@ActionEvent(eventType = EventTypes.EVENT_NETWORK_OFFERING_DELETE, eventDescription = "deleting network offering")
|
@ActionEvent(eventType = EventTypes.EVENT_NETWORK_OFFERING_DELETE, eventDescription = "deleting network offering")
|
||||||
public boolean deleteNetworkOffering(final DeleteNetworkOfferingCmd cmd) {
|
public boolean deleteNetworkOffering(final DeleteNetworkOfferingCmd cmd) {
|
||||||
|
|||||||
@ -48,6 +48,7 @@ import com.cloud.vm.dao.NicDao;
|
|||||||
import com.cloud.vm.dao.NicSecondaryIpDao;
|
import com.cloud.vm.dao.NicSecondaryIpDao;
|
||||||
import com.cloud.vm.dao.UserVmDetailsDao;
|
import com.cloud.vm.dao.UserVmDetailsDao;
|
||||||
import com.cloud.vm.dao.VMInstanceDao;
|
import com.cloud.vm.dao.VMInstanceDao;
|
||||||
|
import com.cloud.network.Networks.BroadcastDomainType;
|
||||||
|
|
||||||
public abstract class HypervisorGuruBase extends AdapterBase implements HypervisorGuru {
|
public abstract class HypervisorGuruBase extends AdapterBase implements HypervisorGuru {
|
||||||
public static final Logger s_logger = Logger.getLogger(HypervisorGuruBase.class);
|
public static final Logger s_logger = Logger.getLogger(HypervisorGuruBase.class);
|
||||||
@ -134,6 +135,9 @@ public abstract class HypervisorGuruBase extends AdapterBase implements Hypervis
|
|||||||
NicTO[] nics = new NicTO[nicProfiles.size()];
|
NicTO[] nics = new NicTO[nicProfiles.size()];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (NicProfile nicProfile : nicProfiles) {
|
for (NicProfile nicProfile : nicProfiles) {
|
||||||
|
if(vm.getType() == VirtualMachine.Type.NetScalerVm) {
|
||||||
|
nicProfile.setBroadcastType(BroadcastDomainType.Native);
|
||||||
|
}
|
||||||
nics[i++] = toNicTO(nicProfile);
|
nics[i++] = toNicTO(nicProfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -43,6 +43,7 @@ import com.cloud.dc.dao.HostPodDao;
|
|||||||
import com.cloud.dc.dao.VlanDao;
|
import com.cloud.dc.dao.VlanDao;
|
||||||
import com.cloud.host.Host;
|
import com.cloud.host.Host;
|
||||||
import com.cloud.host.HostVO;
|
import com.cloud.host.HostVO;
|
||||||
|
import com.cloud.host.Host.Type;
|
||||||
import com.cloud.host.dao.HostDao;
|
import com.cloud.host.dao.HostDao;
|
||||||
import com.cloud.host.dao.HostDetailsDao;
|
import com.cloud.host.dao.HostDetailsDao;
|
||||||
import com.cloud.network.Networks.BroadcastDomainType;
|
import com.cloud.network.Networks.BroadcastDomainType;
|
||||||
@ -68,6 +69,7 @@ import com.cloud.network.dao.PhysicalNetworkServiceProviderDao;
|
|||||||
import com.cloud.network.rules.LoadBalancerContainer.Scheme;
|
import com.cloud.network.rules.LoadBalancerContainer.Scheme;
|
||||||
import com.cloud.network.rules.PortForwardingRuleVO;
|
import com.cloud.network.rules.PortForwardingRuleVO;
|
||||||
import com.cloud.network.rules.dao.PortForwardingRulesDao;
|
import com.cloud.network.rules.dao.PortForwardingRulesDao;
|
||||||
|
import com.cloud.offering.NetworkOffering;
|
||||||
import com.cloud.offerings.dao.NetworkOfferingDao;
|
import com.cloud.offerings.dao.NetworkOfferingDao;
|
||||||
import com.cloud.resource.ResourceManager;
|
import com.cloud.resource.ResourceManager;
|
||||||
import com.cloud.user.AccountManager;
|
import com.cloud.user.AccountManager;
|
||||||
@ -332,6 +334,21 @@ public class ExternalDeviceUsageManagerImpl extends ManagerBase implements Exter
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isNccServiceProvider(Network network) {
|
||||||
|
NetworkOffering networkOffering = _networkOfferingDao.findById(network.getNetworkOfferingId());
|
||||||
|
if(null!= networkOffering && networkOffering.getServicePackage() != null ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public HostVO getNetScalerControlCenterForNetwork(Network guestConfig) {
|
||||||
|
long zoneId = guestConfig.getDataCenterId();
|
||||||
|
return _hostDao.findByTypeNameAndZoneId(zoneId, "NetscalerControlCenter", Type.NetScalerControlCenter);
|
||||||
|
}
|
||||||
|
|
||||||
protected class ExternalDeviceNetworkUsageTask extends ManagedContextRunnable {
|
protected class ExternalDeviceNetworkUsageTask extends ManagedContextRunnable {
|
||||||
|
|
||||||
public ExternalDeviceNetworkUsageTask() {
|
public ExternalDeviceNetworkUsageTask() {
|
||||||
@ -400,11 +417,20 @@ public class ExternalDeviceUsageManagerImpl extends ManagerBase implements Exter
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExternalFirewallDeviceVO fwDeviceVO = getExternalFirewallForNetwork(network);
|
|
||||||
ExternalLoadBalancerDeviceVO lbDeviceVO = getExternalLoadBalancerForNetwork(network);
|
ExternalLoadBalancerDeviceVO lbDeviceVO = getExternalLoadBalancerForNetwork(network);
|
||||||
if (lbDeviceVO == null && fwDeviceVO == null) {
|
HostVO externalNcc = null;
|
||||||
|
boolean isNccNetwork = isNccServiceProvider(network);
|
||||||
|
if(isNccNetwork) {
|
||||||
|
externalNcc = getNetScalerControlCenterForNetwork(network);
|
||||||
|
}
|
||||||
|
ExternalFirewallDeviceVO fwDeviceVO = getExternalFirewallForNetwork(network);
|
||||||
|
|
||||||
|
if (fwDeviceVO == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if(externalNcc == null && lbDeviceVO == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Get network stats from the external firewall
|
// Get network stats from the external firewall
|
||||||
ExternalNetworkResourceUsageAnswer firewallAnswer = null;
|
ExternalNetworkResourceUsageAnswer firewallAnswer = null;
|
||||||
@ -440,13 +466,17 @@ public class ExternalDeviceUsageManagerImpl extends ManagerBase implements Exter
|
|||||||
// Get network stats from the external load balancer
|
// Get network stats from the external load balancer
|
||||||
ExternalNetworkResourceUsageAnswer lbAnswer = null;
|
ExternalNetworkResourceUsageAnswer lbAnswer = null;
|
||||||
HostVO externalLoadBalancer = null;
|
HostVO externalLoadBalancer = null;
|
||||||
if (lbDeviceVO != null) {
|
if (lbDeviceVO != null || externalNcc != null) {
|
||||||
|
if(isNccNetwork) {
|
||||||
|
externalLoadBalancer = externalNcc;
|
||||||
|
} else {
|
||||||
externalLoadBalancer = _hostDao.findById(lbDeviceVO.getHostId());
|
externalLoadBalancer = _hostDao.findById(lbDeviceVO.getHostId());
|
||||||
|
}
|
||||||
if (externalLoadBalancer != null) {
|
if (externalLoadBalancer != null) {
|
||||||
Long lbDeviceId = new Long(externalLoadBalancer.getId());
|
Long lbDeviceId = new Long(externalLoadBalancer.getId());
|
||||||
if (!lbDeviceUsageAnswerMap.containsKey(lbDeviceId)) {
|
if (!lbDeviceUsageAnswerMap.containsKey(lbDeviceId)) {
|
||||||
try {
|
try {
|
||||||
ExternalNetworkResourceUsageCommand cmd = new ExternalNetworkResourceUsageCommand();
|
ExternalNetworkResourceUsageCommand cmd = new ExternalNetworkResourceUsageCommand(network.getId());
|
||||||
lbAnswer = (ExternalNetworkResourceUsageAnswer)_agentMgr.easySend(externalLoadBalancer.getId(), cmd);
|
lbAnswer = (ExternalNetworkResourceUsageAnswer)_agentMgr.easySend(externalLoadBalancer.getId(), cmd);
|
||||||
if (lbAnswer == null || !lbAnswer.getResult()) {
|
if (lbAnswer == null || !lbAnswer.getResult()) {
|
||||||
String details = (lbAnswer != null) ? lbAnswer.getDetails() : "details unavailable";
|
String details = (lbAnswer != null) ? lbAnswer.getDetails() : "details unavailable";
|
||||||
|
|||||||
@ -27,12 +27,13 @@ import java.util.UUID;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.naming.ConfigurationException;
|
import javax.naming.ConfigurationException;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
import org.apache.cloudstack.api.response.ExternalLoadBalancerResponse;
|
import org.apache.cloudstack.api.response.ExternalLoadBalancerResponse;
|
||||||
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
|
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
|
||||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||||
import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice;
|
import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice;
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
import com.cloud.agent.AgentManager;
|
import com.cloud.agent.AgentManager;
|
||||||
import com.cloud.agent.api.Answer;
|
import com.cloud.agent.api.Answer;
|
||||||
@ -63,8 +64,8 @@ import com.cloud.exception.InvalidParameterValueException;
|
|||||||
import com.cloud.exception.ResourceUnavailableException;
|
import com.cloud.exception.ResourceUnavailableException;
|
||||||
import com.cloud.host.DetailVO;
|
import com.cloud.host.DetailVO;
|
||||||
import com.cloud.host.Host;
|
import com.cloud.host.Host;
|
||||||
import com.cloud.host.HostVO;
|
|
||||||
import com.cloud.host.Host.Type;
|
import com.cloud.host.Host.Type;
|
||||||
|
import com.cloud.host.HostVO;
|
||||||
import com.cloud.host.dao.HostDao;
|
import com.cloud.host.dao.HostDao;
|
||||||
import com.cloud.host.dao.HostDetailsDao;
|
import com.cloud.host.dao.HostDetailsDao;
|
||||||
import com.cloud.network.Network.Provider;
|
import com.cloud.network.Network.Provider;
|
||||||
@ -91,6 +92,7 @@ import com.cloud.network.dao.PhysicalNetworkDao;
|
|||||||
import com.cloud.network.dao.PhysicalNetworkServiceProviderDao;
|
import com.cloud.network.dao.PhysicalNetworkServiceProviderDao;
|
||||||
import com.cloud.network.dao.PhysicalNetworkServiceProviderVO;
|
import com.cloud.network.dao.PhysicalNetworkServiceProviderVO;
|
||||||
import com.cloud.network.dao.PhysicalNetworkVO;
|
import com.cloud.network.dao.PhysicalNetworkVO;
|
||||||
|
import com.cloud.network.dao.VirtualRouterProviderDao;
|
||||||
import com.cloud.network.element.IpDeployer;
|
import com.cloud.network.element.IpDeployer;
|
||||||
import com.cloud.network.element.NetworkElement;
|
import com.cloud.network.element.NetworkElement;
|
||||||
import com.cloud.network.element.StaticNatServiceProvider;
|
import com.cloud.network.element.StaticNatServiceProvider;
|
||||||
@ -111,6 +113,8 @@ import com.cloud.resource.ResourceState;
|
|||||||
import com.cloud.resource.ResourceStateAdapter;
|
import com.cloud.resource.ResourceStateAdapter;
|
||||||
import com.cloud.resource.ServerResource;
|
import com.cloud.resource.ServerResource;
|
||||||
import com.cloud.resource.UnableDeleteHostException;
|
import com.cloud.resource.UnableDeleteHostException;
|
||||||
|
import com.cloud.service.dao.ServiceOfferingDao;
|
||||||
|
import com.cloud.storage.dao.VMTemplateDao;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
import com.cloud.user.AccountManager;
|
import com.cloud.user.AccountManager;
|
||||||
import com.cloud.user.dao.AccountDao;
|
import com.cloud.user.dao.AccountDao;
|
||||||
@ -129,8 +133,10 @@ import com.cloud.utils.net.UrlUtil;
|
|||||||
import com.cloud.vm.Nic;
|
import com.cloud.vm.Nic;
|
||||||
import com.cloud.vm.Nic.ReservationStrategy;
|
import com.cloud.vm.Nic.ReservationStrategy;
|
||||||
import com.cloud.vm.NicVO;
|
import com.cloud.vm.NicVO;
|
||||||
|
import com.cloud.vm.VirtualMachineManager;
|
||||||
import com.cloud.vm.dao.DomainRouterDao;
|
import com.cloud.vm.dao.DomainRouterDao;
|
||||||
import com.cloud.vm.dao.NicDao;
|
import com.cloud.vm.dao.NicDao;
|
||||||
|
import com.cloud.vm.dao.VMInstanceDao;
|
||||||
|
|
||||||
public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase implements ExternalLoadBalancerDeviceManager, ResourceStateAdapter {
|
public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase implements ExternalLoadBalancerDeviceManager, ResourceStateAdapter {
|
||||||
|
|
||||||
@ -194,6 +200,19 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
|||||||
protected HostPodDao _podDao = null;
|
protected HostPodDao _podDao = null;
|
||||||
@Inject
|
@Inject
|
||||||
IpAddressManager _ipAddrMgr;
|
IpAddressManager _ipAddrMgr;
|
||||||
|
@Inject
|
||||||
|
protected
|
||||||
|
VirtualMachineManager _itMgr;
|
||||||
|
@Inject
|
||||||
|
VMInstanceDao _vmDao;
|
||||||
|
@Inject
|
||||||
|
VMTemplateDao _templateDao;
|
||||||
|
@Inject
|
||||||
|
ServiceOfferingDao _serviceOfferingDao;
|
||||||
|
@Inject
|
||||||
|
PhysicalNetworkServiceProviderDao _physicalProviderDao;
|
||||||
|
@Inject
|
||||||
|
VirtualRouterProviderDao _vrProviderDao;
|
||||||
|
|
||||||
private long _defaultLbCapacity;
|
private long _defaultLbCapacity;
|
||||||
private static final org.apache.log4j.Logger s_logger = Logger.getLogger(ExternalLoadBalancerDeviceManagerImpl.class);
|
private static final org.apache.log4j.Logger s_logger = Logger.getLogger(ExternalLoadBalancerDeviceManagerImpl.class);
|
||||||
@ -867,9 +886,9 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
|||||||
return nic;
|
return nic;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isNccServiceProvider(Network network) {
|
public boolean isNccServiceProvider(Network network) {
|
||||||
NetworkOffering networkOffering = _networkOfferingDao.findById(network.getNetworkOfferingId());
|
NetworkOffering networkOffering = _networkOfferingDao.findById(network.getNetworkOfferingId());
|
||||||
if(networkOffering.getServicePackage() != null ) {
|
if(null!= networkOffering && networkOffering.getServicePackage() != null ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -927,11 +946,14 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
|||||||
String uuid = rule.getUuid();
|
String uuid = rule.getUuid();
|
||||||
String srcIp = rule.getSourceIp().addr();
|
String srcIp = rule.getSourceIp().addr();
|
||||||
String srcIpVlan = null;
|
String srcIpVlan = null;
|
||||||
//IpAddress ipAddress = _networkModel.getPublicIpAddress(rule.getSourceIp().addr(), network.getDataCenterId()).getVlanId();
|
String srcIpGateway = null;
|
||||||
|
String srcIpNetmask = null;
|
||||||
Long vlanid = _networkModel.getPublicIpAddress(rule.getSourceIp().addr(), network.getDataCenterId()).getVlanId();
|
Long vlanid = _networkModel.getPublicIpAddress(rule.getSourceIp().addr(), network.getDataCenterId()).getVlanId();
|
||||||
if(vlanid != null ) {
|
if(vlanid != null ) {
|
||||||
VlanVO publicVlan = _vlanDao.findById(vlanid);
|
VlanVO publicVlan = _vlanDao.findById(vlanid);
|
||||||
srcIpVlan = publicVlan.getVlanTag();
|
srcIpVlan = publicVlan.getVlanTag();
|
||||||
|
srcIpGateway = publicVlan.getVlanGateway();
|
||||||
|
srcIpNetmask = publicVlan.getVlanNetmask();
|
||||||
}
|
}
|
||||||
int srcPort = rule.getSourcePortStart();
|
int srcPort = rule.getSourcePortStart();
|
||||||
List<LbDestination> destinations = rule.getDestinations();
|
List<LbDestination> destinations = rule.getDestinations();
|
||||||
@ -956,6 +978,8 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
|||||||
rule.getHealthCheckPolicies(), rule.getLbSslCert(), rule.getLbProtocol());
|
rule.getHealthCheckPolicies(), rule.getLbSslCert(), rule.getLbProtocol());
|
||||||
loadBalancer.setNetworkId(network.getId());
|
loadBalancer.setNetworkId(network.getId());
|
||||||
loadBalancer.setSrcIpVlan(srcIpVlan);
|
loadBalancer.setSrcIpVlan(srcIpVlan);
|
||||||
|
loadBalancer.setSrcIpNetmask(srcIpNetmask);
|
||||||
|
loadBalancer.setSrcIpGateway(srcIpGateway);
|
||||||
if (rule.isAutoScaleConfig()) {
|
if (rule.isAutoScaleConfig()) {
|
||||||
loadBalancer.setAutoScaleVmGroup(rule.getAutoScaleVmGroup());
|
loadBalancer.setAutoScaleVmGroup(rule.getAutoScaleVmGroup());
|
||||||
}
|
}
|
||||||
@ -1197,13 +1221,19 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HostVO externalLoadBalancer = null;
|
||||||
|
|
||||||
|
if(isNccServiceProvider(network)) {
|
||||||
|
externalLoadBalancer = getNetScalerControlCenterForNetwork(network);
|
||||||
|
} else {
|
||||||
ExternalLoadBalancerDeviceVO lbDeviceVO = getExternalLoadBalancerForNetwork(network);
|
ExternalLoadBalancerDeviceVO lbDeviceVO = getExternalLoadBalancerForNetwork(network);
|
||||||
if (lbDeviceVO == null) {
|
if (lbDeviceVO == null) {
|
||||||
s_logger.warn("There is no external load balancer device assigned to this network either network is not implement are already shutdown so just returning");
|
s_logger.warn("There is no external load balancer device assigned to this network either network is not implement are already shutdown so just returning");
|
||||||
return null;
|
return null;
|
||||||
|
} else {
|
||||||
|
externalLoadBalancer = _hostDao.findById(lbDeviceVO.getHostId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HostVO externalLoadBalancer = _hostDao.findById(lbDeviceVO.getHostId());
|
|
||||||
|
|
||||||
boolean externalLoadBalancerIsInline = _networkMgr.isNetworkInlineMode(network);
|
boolean externalLoadBalancerIsInline = _networkMgr.isNetworkInlineMode(network);
|
||||||
|
|
||||||
@ -1253,7 +1283,7 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
|||||||
LoadBalancerTO[] loadBalancersForCommand = loadBalancersToApply.toArray(new LoadBalancerTO[numLoadBalancersForCommand]);
|
LoadBalancerTO[] loadBalancersForCommand = loadBalancersToApply.toArray(new LoadBalancerTO[numLoadBalancersForCommand]);
|
||||||
// LoadBalancerConfigCommand cmd = new
|
// LoadBalancerConfigCommand cmd = new
|
||||||
// LoadBalancerConfigCommand(loadBalancersForCommand, null);
|
// LoadBalancerConfigCommand(loadBalancersForCommand, null);
|
||||||
HealthCheckLBConfigCommand cmd = new HealthCheckLBConfigCommand(loadBalancersForCommand);
|
HealthCheckLBConfigCommand cmd = new HealthCheckLBConfigCommand(loadBalancersForCommand, network.getId());
|
||||||
long guestVlanTag = Integer.parseInt(BroadcastDomainType.getValue(network.getBroadcastUri()));
|
long guestVlanTag = Integer.parseInt(BroadcastDomainType.getValue(network.getBroadcastUri()));
|
||||||
cmd.setAccessDetail(NetworkElementCommand.GUEST_VLAN_TAG, String.valueOf(guestVlanTag));
|
cmd.setAccessDetail(NetworkElementCommand.GUEST_VLAN_TAG, String.valueOf(guestVlanTag));
|
||||||
|
|
||||||
@ -1280,4 +1310,5 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,7 +52,6 @@ import com.cloud.configuration.Resource.ResourceType;
|
|||||||
import com.cloud.dc.AccountVlanMapVO;
|
import com.cloud.dc.AccountVlanMapVO;
|
||||||
import com.cloud.dc.DataCenter;
|
import com.cloud.dc.DataCenter;
|
||||||
import com.cloud.dc.DataCenter.NetworkType;
|
import com.cloud.dc.DataCenter.NetworkType;
|
||||||
import com.cloud.dc.DomainVlanMapVO;
|
|
||||||
import com.cloud.dc.DataCenterIpAddressVO;
|
import com.cloud.dc.DataCenterIpAddressVO;
|
||||||
import com.cloud.dc.HostPodVO;
|
import com.cloud.dc.HostPodVO;
|
||||||
import com.cloud.dc.Pod;
|
import com.cloud.dc.Pod;
|
||||||
@ -287,6 +286,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
|||||||
VpcDao _vpcDao;
|
VpcDao _vpcDao;
|
||||||
@Inject
|
@Inject
|
||||||
DataCenterIpAddressDao _privateIPAddressDao;
|
DataCenterIpAddressDao _privateIPAddressDao;
|
||||||
|
@Inject
|
||||||
HostPodDao _hpDao;
|
HostPodDao _hpDao;
|
||||||
|
|
||||||
SearchBuilder<IPAddressVO> AssignIpAddressSearch;
|
SearchBuilder<IPAddressVO> AssignIpAddressSearch;
|
||||||
@ -1024,9 +1024,9 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
|||||||
|
|
||||||
@DB
|
@DB
|
||||||
@Override
|
@Override
|
||||||
public AcquirePodIpCmdResponse allocatePodIp(Long zoneId, String cidr) throws ConcurrentOperationException, ResourceAllocationException {
|
public AcquirePodIpCmdResponse allocatePodIp(String zoneId, String podId) throws ConcurrentOperationException, ResourceAllocationException {
|
||||||
|
|
||||||
DataCenter zone = _entityMgr.findById(DataCenter.class, zoneId);
|
DataCenter zone = _entityMgr.findByUuid(DataCenter.class, zoneId);
|
||||||
Account caller = CallContext.current().getCallingAccount();
|
Account caller = CallContext.current().getCallingAccount();
|
||||||
if (Grouping.AllocationState.Disabled == zone.getAllocationState() && !_accountMgr.isRootAdmin(caller.getId())) {
|
if (Grouping.AllocationState.Disabled == zone.getAllocationState() && !_accountMgr.isRootAdmin(caller.getId())) {
|
||||||
ResourceAllocationException ex = new ResourceAllocationException("Cannot perform this operation, " + "Zone is currently disabled" + "zoneId=" + zone.getUuid(),
|
ResourceAllocationException ex = new ResourceAllocationException("Cannot perform this operation, " + "Zone is currently disabled" + "zoneId=" + zone.getUuid(),
|
||||||
@ -1035,15 +1035,18 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
|||||||
}
|
}
|
||||||
|
|
||||||
DataCenterIpAddressVO vo = null;
|
DataCenterIpAddressVO vo = null;
|
||||||
if (cidr != null) {
|
if (podId == null)
|
||||||
List<HostPodVO> pod_list = _hpDao.listAllPodsByCidr(zoneId, cidr);
|
throw new ResourceAllocationException("Please do not provide NULL podId", ResourceType.network);
|
||||||
if (pod_list.get(0) == null)
|
HostPodVO podvo = null;
|
||||||
|
podvo = _hpDao.findByUuid(podId);
|
||||||
|
if (podvo == null)
|
||||||
throw new ResourceAllocationException("No sush pod exists", ResourceType.network);
|
throw new ResourceAllocationException("No sush pod exists", ResourceType.network);
|
||||||
vo = _privateIPAddressDao.takeIpAddress(zoneId, pod_list.get(0).getId(), 0, caller.getId() + "");
|
|
||||||
|
vo = _privateIPAddressDao.takeIpAddress(zone.getId(), podvo.getId(), 0, caller.getId() + "");
|
||||||
|
if(vo == null)
|
||||||
|
throw new ResourceAllocationException("Unable to allocate IP from this Pod", ResourceType.network);
|
||||||
if (vo.getIpAddress() == null)
|
if (vo.getIpAddress() == null)
|
||||||
throw new ResourceAllocationException("Unable to allocate IP from this Pod", ResourceType.network);
|
throw new ResourceAllocationException("Unable to allocate IP from this Pod", ResourceType.network);
|
||||||
} else
|
|
||||||
vo = _privateIPAddressDao.takeDataCenterIpAddress(zoneId, caller.getId() + "");
|
|
||||||
|
|
||||||
HostPodVO pod_vo = _hpDao.findById(vo.getPodId());
|
HostPodVO pod_vo = _hpDao.findById(vo.getPodId());
|
||||||
AcquirePodIpCmdResponse ret = new AcquirePodIpCmdResponse();
|
AcquirePodIpCmdResponse ret = new AcquirePodIpCmdResponse();
|
||||||
@ -1956,7 +1959,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
|||||||
boolean ipv4 = false;
|
boolean ipv4 = false;
|
||||||
|
|
||||||
if (network.getGateway() != null) {
|
if (network.getGateway() != null) {
|
||||||
if (nic.getIp4Address() == null) {
|
if (nic.getIPv4Address() == null) {
|
||||||
ipv4 = true;
|
ipv4 = true;
|
||||||
PublicIp ip = null;
|
PublicIp ip = null;
|
||||||
|
|
||||||
@ -1964,9 +1967,9 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
|||||||
if (requestedIpv4 != null && vm.getType() == VirtualMachine.Type.DomainRouter) {
|
if (requestedIpv4 != null && vm.getType() == VirtualMachine.Type.DomainRouter) {
|
||||||
Nic placeholderNic = _networkModel.getPlaceholderNicForRouter(network, null);
|
Nic placeholderNic = _networkModel.getPlaceholderNicForRouter(network, null);
|
||||||
if (placeholderNic != null) {
|
if (placeholderNic != null) {
|
||||||
IPAddressVO userIp = _ipAddressDao.findByIpAndSourceNetworkId(network.getId(), placeholderNic.getIp4Address());
|
IPAddressVO userIp = _ipAddressDao.findByIpAndSourceNetworkId(network.getId(), placeholderNic.getIPv4Address());
|
||||||
ip = PublicIp.createFromAddrAndVlan(userIp, _vlanDao.findById(userIp.getVlanId()));
|
ip = PublicIp.createFromAddrAndVlan(userIp, _vlanDao.findById(userIp.getVlanId()));
|
||||||
s_logger.debug("Nic got an ip address " + placeholderNic.getIp4Address() + " stored in placeholder nic for the network " + network);
|
s_logger.debug("Nic got an ip address " + placeholderNic.getIPv4Address() + " stored in placeholder nic for the network " + network);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1974,12 +1977,10 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
|||||||
ip = assignPublicIpAddress(dc.getId(), null, vm.getOwner(), VlanType.DirectAttached, network.getId(), requestedIpv4, false);
|
ip = assignPublicIpAddress(dc.getId(), null, vm.getOwner(), VlanType.DirectAttached, network.getId(), requestedIpv4, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
nic.setIp4Address(ip.getAddress().toString());
|
nic.setIPv4Address(ip.getAddress().toString());
|
||||||
nic.setGateway(ip.getGateway());
|
nic.setIPv4Gateway(ip.getGateway());
|
||||||
nic.setNetmask(ip.getNetmask());
|
nic.setIPv4Netmask(ip.getNetmask());
|
||||||
nic.setIsolationUri(IsolationType.Vlan.toUri(ip.getVlanTag()));
|
nic.setIsolationUri(IsolationType.Vlan.toUri(ip.getVlanTag()));
|
||||||
//nic.setBroadcastType(BroadcastDomainType.Vlan);
|
|
||||||
//nic.setBroadcastUri(BroadcastDomainType.Vlan.toUri(ip.getVlanTag()));
|
|
||||||
nic.setBroadcastType(network.getBroadcastDomainType());
|
nic.setBroadcastType(network.getBroadcastDomainType());
|
||||||
if (network.getBroadcastUri() != null)
|
if (network.getBroadcastUri() != null)
|
||||||
nic.setBroadcastUri(network.getBroadcastUri());
|
nic.setBroadcastUri(network.getBroadcastUri());
|
||||||
@ -1989,18 +1990,18 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
|||||||
nic.setReservationId(String.valueOf(ip.getVlanTag()));
|
nic.setReservationId(String.valueOf(ip.getVlanTag()));
|
||||||
nic.setMacAddress(ip.getMacAddress());
|
nic.setMacAddress(ip.getMacAddress());
|
||||||
}
|
}
|
||||||
nic.setDns1(dc.getDns1());
|
nic.setIPv4Dns1(dc.getDns1());
|
||||||
nic.setDns2(dc.getDns2());
|
nic.setIPv4Dns2(dc.getDns2());
|
||||||
}
|
}
|
||||||
|
|
||||||
//FIXME - get ipv6 address from the placeholder if it's stored there
|
//FIXME - get ipv6 address from the placeholder if it's stored there
|
||||||
if (network.getIp6Gateway() != null) {
|
if (network.getIp6Gateway() != null) {
|
||||||
if (nic.getIp6Address() == null) {
|
if (nic.getIPv6Address() == null) {
|
||||||
UserIpv6Address ip = _ipv6Mgr.assignDirectIp6Address(dc.getId(), vm.getOwner(), network.getId(), requestedIpv6);
|
UserIpv6Address ip = _ipv6Mgr.assignDirectIp6Address(dc.getId(), vm.getOwner(), network.getId(), requestedIpv6);
|
||||||
Vlan vlan = _vlanDao.findById(ip.getVlanId());
|
Vlan vlan = _vlanDao.findById(ip.getVlanId());
|
||||||
nic.setIp6Address(ip.getAddress().toString());
|
nic.setIPv6Address(ip.getAddress().toString());
|
||||||
nic.setIp6Gateway(vlan.getIp6Gateway());
|
nic.setIPv6Gateway(vlan.getIp6Gateway());
|
||||||
nic.setIp6Cidr(vlan.getIp6Cidr());
|
nic.setIPv6Cidr(vlan.getIp6Cidr());
|
||||||
if (ipv4) {
|
if (ipv4) {
|
||||||
nic.setFormat(AddressFormat.DualStack);
|
nic.setFormat(AddressFormat.DualStack);
|
||||||
} else {
|
} else {
|
||||||
@ -2012,8 +2013,8 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
|||||||
nic.setMacAddress(ip.getMacAddress());
|
nic.setMacAddress(ip.getMacAddress());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nic.setIp6Dns1(dc.getIp6Dns1());
|
nic.setIPv6Dns1(dc.getIp6Dns1());
|
||||||
nic.setIp6Dns2(dc.getIp6Dns2());
|
nic.setIPv6Dns2(dc.getIp6Dns2());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -42,6 +42,7 @@ import javax.naming.ConfigurationException;
|
|||||||
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
|
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
|
||||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.command.admin.address.ReleasePodIpCmdByAdmin;
|
||||||
import org.apache.cloudstack.api.command.admin.network.CreateNetworkCmdByAdmin;
|
import org.apache.cloudstack.api.command.admin.network.CreateNetworkCmdByAdmin;
|
||||||
import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
|
import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
|
import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
|
||||||
@ -50,6 +51,7 @@ import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
|
|||||||
import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
|
import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
|
||||||
import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
|
import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
|
||||||
import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
|
import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
|
||||||
|
import org.apache.cloudstack.api.response.AcquirePodIpCmdResponse;
|
||||||
import org.apache.cloudstack.context.CallContext;
|
import org.apache.cloudstack.context.CallContext;
|
||||||
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
|
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
|
||||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||||
@ -4210,4 +4212,27 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||||||
return _ipAddressDao.findById(id);
|
return _ipAddressDao.findById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AcquirePodIpCmdResponse allocatePodIp(Account ipOwner, String zoneId, String podId) throws ResourceAllocationException {
|
||||||
|
|
||||||
|
Account caller = CallContext.current().getCallingAccount();
|
||||||
|
long callerUserId = CallContext.current().getCallingUserId();
|
||||||
|
DataCenter zone = _entityMgr.findByUuid(DataCenter.class, zoneId);
|
||||||
|
|
||||||
|
if (zone == null)
|
||||||
|
throw new InvalidParameterValueException("Invalid zone Id ");
|
||||||
|
if (_accountMgr.checkAccessAndSpecifyAuthority(caller, zone.getId()) != zone.getId())
|
||||||
|
throw new InvalidParameterValueException("Caller does not have permission for this Zone" + "(" + zoneId + ")");
|
||||||
|
if (s_logger.isDebugEnabled())
|
||||||
|
s_logger.debug("Associate IP address called by the user " + callerUserId + " account " + ipOwner.getId());
|
||||||
|
return _ipAddrMgr.allocatePodIp(zoneId, podId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean releasePodIp(ReleasePodIpCmdByAdmin ip) throws CloudRuntimeException {
|
||||||
|
_ipAddrMgr.releasePodIp(ip.getId());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -875,14 +875,11 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
|
|||||||
for (LoadBalancerVO lb : rules) {
|
for (LoadBalancerVO lb : rules) {
|
||||||
List<LbDestination> dstList = getExistingDestinations(lb.getId());
|
List<LbDestination> dstList = getExistingDestinations(lb.getId());
|
||||||
List<LbHealthCheckPolicy> hcPolicyList = getHealthCheckPolicies(lb.getId());
|
List<LbHealthCheckPolicy> hcPolicyList = getHealthCheckPolicies(lb.getId());
|
||||||
// adding to lbrules list only if the LB rule
|
// Now retrive the status of services from NS even there are no policies. because there is default monitor
|
||||||
// hashealtChecks
|
|
||||||
if (hcPolicyList != null && hcPolicyList.size() > 0) {
|
|
||||||
Ip sourceIp = getSourceIp(lb);
|
Ip sourceIp = getSourceIp(lb);
|
||||||
LoadBalancingRule loadBalancing = new LoadBalancingRule(lb, dstList, null, hcPolicyList, sourceIp, null, lb.getLbProtocol());
|
LoadBalancingRule loadBalancing = new LoadBalancingRule(lb, dstList, null, hcPolicyList, sourceIp, null, lb.getLbProtocol());
|
||||||
lbrules.add(loadBalancing);
|
lbrules.add(loadBalancing);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (lbrules.size() > 0) {
|
if (lbrules.size() > 0) {
|
||||||
isHandled = false;
|
isHandled = false;
|
||||||
for (LoadBalancingServiceProvider lbElement : _lbProviders) {
|
for (LoadBalancingServiceProvider lbElement : _lbProviders) {
|
||||||
@ -2124,10 +2121,11 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
|
|||||||
throw new InvalidParameterValueException("Modifications in lb rule " + lbRuleId + " are not supported.");
|
throw new InvalidParameterValueException("Modifications in lb rule " + lbRuleId + " are not supported.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LoadBalancerVO tmplbVo = _lbDao.findById(lbRuleId);
|
||||||
boolean success = _lbDao.update(lbRuleId, lb);
|
boolean success = _lbDao.update(lbRuleId, lb);
|
||||||
|
|
||||||
// If algorithm is changed, have to reapply the lb config
|
// If algorithm is changed, have to reapply the lb config
|
||||||
if (algorithm != null) {
|
if ((algorithm!= null) && (tmplbVo.getAlgorithm().compareTo(algorithm)!=0)){
|
||||||
try {
|
try {
|
||||||
lb.setState(FirewallRule.State.Add);
|
lb.setState(FirewallRule.State.Add);
|
||||||
_lbDao.persist(lb);
|
_lbDao.persist(lb);
|
||||||
|
|||||||
@ -48,8 +48,10 @@ import org.apache.cloudstack.api.command.admin.account.EnableAccountCmd;
|
|||||||
import org.apache.cloudstack.api.command.admin.account.ListAccountsCmdByAdmin;
|
import org.apache.cloudstack.api.command.admin.account.ListAccountsCmdByAdmin;
|
||||||
import org.apache.cloudstack.api.command.admin.account.LockAccountCmd;
|
import org.apache.cloudstack.api.command.admin.account.LockAccountCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.account.UpdateAccountCmd;
|
import org.apache.cloudstack.api.command.admin.account.UpdateAccountCmd;
|
||||||
|
import org.apache.cloudstack.api.command.admin.address.AcquirePodIpCmdByAdmin;
|
||||||
import org.apache.cloudstack.api.command.admin.address.AssociateIPAddrCmdByAdmin;
|
import org.apache.cloudstack.api.command.admin.address.AssociateIPAddrCmdByAdmin;
|
||||||
import org.apache.cloudstack.api.command.admin.address.ListPublicIpAddressesCmdByAdmin;
|
import org.apache.cloudstack.api.command.admin.address.ListPublicIpAddressesCmdByAdmin;
|
||||||
|
import org.apache.cloudstack.api.command.admin.address.ReleasePodIpCmdByAdmin;
|
||||||
import org.apache.cloudstack.api.command.admin.affinitygroup.UpdateVMAffinityGroupCmdByAdmin;
|
import org.apache.cloudstack.api.command.admin.affinitygroup.UpdateVMAffinityGroupCmdByAdmin;
|
||||||
import org.apache.cloudstack.api.command.admin.alert.GenerateAlertCmd;
|
import org.apache.cloudstack.api.command.admin.alert.GenerateAlertCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.autoscale.CreateCounterCmd;
|
import org.apache.cloudstack.api.command.admin.autoscale.CreateCounterCmd;
|
||||||
@ -3019,6 +3021,9 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||||||
cmdList.add(ChangeOutOfBandManagementPasswordCmd.class);
|
cmdList.add(ChangeOutOfBandManagementPasswordCmd.class);
|
||||||
cmdList.add(GetUserKeysCmd.class);
|
cmdList.add(GetUserKeysCmd.class);
|
||||||
|
|
||||||
|
cmdList.add(AcquirePodIpCmdByAdmin.class);
|
||||||
|
cmdList.add(ReleasePodIpCmdByAdmin.class);
|
||||||
|
|
||||||
return cmdList;
|
return cmdList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -123,6 +123,7 @@ public class CertServiceImpl implements CertService {
|
|||||||
final String key = certCmd.getKey();
|
final String key = certCmd.getKey();
|
||||||
final String password = certCmd.getPassword();
|
final String password = certCmd.getPassword();
|
||||||
final String chain = certCmd.getChain();
|
final String chain = certCmd.getChain();
|
||||||
|
final String name = certCmd.getName();
|
||||||
|
|
||||||
validate(cert, key, password, chain);
|
validate(cert, key, password, chain);
|
||||||
s_logger.debug("Certificate Validation succeeded");
|
s_logger.debug("Certificate Validation succeeded");
|
||||||
@ -142,7 +143,7 @@ public class CertServiceImpl implements CertService {
|
|||||||
final Long accountId = owner.getId();
|
final Long accountId = owner.getId();
|
||||||
final Long domainId = owner.getDomainId();
|
final Long domainId = owner.getDomainId();
|
||||||
|
|
||||||
final SslCertVO certVO = new SslCertVO(cert, key, password, chain, accountId, domainId, fingerPrint);
|
final SslCertVO certVO = new SslCertVO(cert, key, password, chain, accountId, domainId, fingerPrint, name);
|
||||||
_sslCertDao.persist(certVO);
|
_sslCertDao.persist(certVO);
|
||||||
|
|
||||||
return createCertResponse(certVO, null);
|
return createCertResponse(certVO, null);
|
||||||
@ -325,10 +326,10 @@ public class CertServiceImpl implements CertService {
|
|||||||
response.setId(cert.getUuid());
|
response.setId(cert.getUuid());
|
||||||
response.setCertificate(cert.getCertificate());
|
response.setCertificate(cert.getCertificate());
|
||||||
response.setFingerprint(cert.getFingerPrint());
|
response.setFingerprint(cert.getFingerPrint());
|
||||||
|
response.setName(cert.getName());
|
||||||
|
|
||||||
if (cert.getChain() != null) {
|
if (cert.getChain() != null)
|
||||||
response.setCertchain(cert.getChain());
|
response.setCertchain(cert.getChain());
|
||||||
}
|
|
||||||
|
|
||||||
if (lbCertMap != null && !lbCertMap.isEmpty()) {
|
if (lbCertMap != null && !lbCertMap.isEmpty()) {
|
||||||
final List<String> lbIds = new ArrayList<String>();
|
final List<String> lbIds = new ArrayList<String>();
|
||||||
|
|||||||
@ -61,16 +61,21 @@ import com.cloud.network.dao.NetworkExternalLoadBalancerVO;
|
|||||||
import com.cloud.network.dao.NetworkServiceMapDao;
|
import com.cloud.network.dao.NetworkServiceMapDao;
|
||||||
import com.cloud.network.dao.PhysicalNetworkDao;
|
import com.cloud.network.dao.PhysicalNetworkDao;
|
||||||
import com.cloud.network.dao.PhysicalNetworkServiceProviderDao;
|
import com.cloud.network.dao.PhysicalNetworkServiceProviderDao;
|
||||||
|
import com.cloud.network.dao.VirtualRouterProviderDao;
|
||||||
import com.cloud.network.lb.LoadBalancingRule;
|
import com.cloud.network.lb.LoadBalancingRule;
|
||||||
import com.cloud.network.rules.dao.PortForwardingRulesDao;
|
import com.cloud.network.rules.dao.PortForwardingRulesDao;
|
||||||
import com.cloud.offerings.dao.NetworkOfferingDao;
|
import com.cloud.offerings.dao.NetworkOfferingDao;
|
||||||
import com.cloud.resource.ResourceManager;
|
import com.cloud.resource.ResourceManager;
|
||||||
|
import com.cloud.service.dao.ServiceOfferingDao;
|
||||||
|
import com.cloud.storage.dao.VMTemplateDao;
|
||||||
import com.cloud.user.AccountManager;
|
import com.cloud.user.AccountManager;
|
||||||
import com.cloud.user.dao.AccountDao;
|
import com.cloud.user.dao.AccountDao;
|
||||||
import com.cloud.user.dao.UserStatisticsDao;
|
import com.cloud.user.dao.UserStatisticsDao;
|
||||||
import com.cloud.utils.net.Ip;
|
import com.cloud.utils.net.Ip;
|
||||||
|
import com.cloud.vm.VirtualMachineManager;
|
||||||
import com.cloud.vm.dao.DomainRouterDao;
|
import com.cloud.vm.dao.DomainRouterDao;
|
||||||
import com.cloud.vm.dao.NicDao;
|
import com.cloud.vm.dao.NicDao;
|
||||||
|
import com.cloud.vm.dao.VMInstanceDao;
|
||||||
|
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
public class ExternalLoadBalancerDeviceManagerImplTest {
|
public class ExternalLoadBalancerDeviceManagerImplTest {
|
||||||
@ -135,9 +140,20 @@ public class ExternalLoadBalancerDeviceManagerImplTest {
|
|||||||
protected HostPodDao _podDao = null;
|
protected HostPodDao _podDao = null;
|
||||||
@Mock
|
@Mock
|
||||||
IpAddressManager _ipAddrMgr;
|
IpAddressManager _ipAddrMgr;
|
||||||
|
@Mock
|
||||||
|
protected VirtualMachineManager _itMgr;
|
||||||
@Mock
|
@Mock
|
||||||
Network network;
|
Network network;
|
||||||
|
@Mock
|
||||||
|
VMInstanceDao _vmDao;
|
||||||
|
@Mock
|
||||||
|
VMTemplateDao _templateDao;
|
||||||
|
@Mock
|
||||||
|
ServiceOfferingDao _serviceOfferingDao;
|
||||||
|
@Mock
|
||||||
|
PhysicalNetworkServiceProviderDao _physicalProviderDao;
|
||||||
|
@Mock
|
||||||
|
VirtualRouterProviderDao _vrProviderDao;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
LoadBalancingRule rule;
|
LoadBalancingRule rule;
|
||||||
@ -192,6 +208,7 @@ public class ExternalLoadBalancerDeviceManagerImplTest {
|
|||||||
|
|
||||||
private void setupLBHealthChecksMocks() throws URISyntaxException {
|
private void setupLBHealthChecksMocks() throws URISyntaxException {
|
||||||
Mockito.when(network.getId()).thenReturn(42l);
|
Mockito.when(network.getId()).thenReturn(42l);
|
||||||
|
Mockito.when(network.getNetworkOfferingId()).thenReturn(1l);
|
||||||
Mockito.when(network.getBroadcastUri()).thenReturn(new URI("vlan://1"));
|
Mockito.when(network.getBroadcastUri()).thenReturn(new URI("vlan://1"));
|
||||||
NetworkExternalLoadBalancerVO externalLb = Mockito
|
NetworkExternalLoadBalancerVO externalLb = Mockito
|
||||||
.mock(NetworkExternalLoadBalancerVO.class);
|
.mock(NetworkExternalLoadBalancerVO.class);
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import javax.inject.Inject;
|
|||||||
import javax.naming.ConfigurationException;
|
import javax.naming.ConfigurationException;
|
||||||
|
|
||||||
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
|
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
|
||||||
|
import org.apache.cloudstack.api.command.admin.address.ReleasePodIpCmdByAdmin;
|
||||||
import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
|
import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
|
import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
|
import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
|
||||||
@ -32,6 +33,7 @@ import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
|
|||||||
import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
|
import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
|
||||||
import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
|
import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
|
||||||
import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
|
import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
|
||||||
|
import org.apache.cloudstack.api.response.AcquirePodIpCmdResponse;
|
||||||
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
|
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@ -72,6 +74,7 @@ import com.cloud.user.Account;
|
|||||||
import com.cloud.user.User;
|
import com.cloud.user.User;
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.utils.Pair;
|
||||||
import com.cloud.utils.component.ManagerBase;
|
import com.cloud.utils.component.ManagerBase;
|
||||||
|
import com.cloud.utils.exception.CloudRuntimeException;
|
||||||
import com.cloud.vm.Nic;
|
import com.cloud.vm.Nic;
|
||||||
import com.cloud.vm.NicProfile;
|
import com.cloud.vm.NicProfile;
|
||||||
import com.cloud.vm.NicSecondaryIp;
|
import com.cloud.vm.NicSecondaryIp;
|
||||||
@ -907,30 +910,17 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkOrches
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
<<<<<<< db052a96b18391ae5f972960d1f496f5396b8684
|
|
||||||
public List<? extends NicSecondaryIp> listVmNicSecondaryIps(ListNicsCmd listNicsCmd) {
|
public List<? extends NicSecondaryIp> listVmNicSecondaryIps(ListNicsCmd listNicsCmd) {
|
||||||
return null;
|
return null;
|
||||||
=======
|
|
||||||
public AcquirePodIpCmdResponse allocatePodIp(Account ipOwner, long zoneId, String cidr) throws ResourceAllocationException, ConcurrentOperationException {
|
|
||||||
|
|
||||||
Account caller = CallContext.current().getCallingAccount();
|
|
||||||
long callerUserId = CallContext.current().getCallingUserId();
|
|
||||||
DataCenter zone = _entityMgr.findById(DataCenter.class, zoneId);
|
|
||||||
|
|
||||||
if (zone == null)
|
|
||||||
throw new InvalidParameterValueException("Invalid zone Id is Null");
|
|
||||||
if (_accountMgr.checkAccessAndSpecifyAuthority(caller, zoneId) != zoneId)
|
|
||||||
throw new InvalidParameterValueException("Caller does not have permission for this Zone" + "(" + zoneId + ")");
|
|
||||||
if (s_logger.isDebugEnabled())
|
|
||||||
s_logger.debug("Associate IP address called by the user " + callerUserId + " account " + ipOwner.getId());
|
|
||||||
return _ipAddrMgr.allocatePodIp(zoneId, cidr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean releasePodIp(ReleasePodIpCmdByAdmin ip) throws CloudRuntimeException {
|
public boolean releasePodIp(ReleasePodIpCmdByAdmin ip) throws CloudRuntimeException {
|
||||||
_ipAddrMgr.releasePodIp(ip.getId());
|
|
||||||
return true;
|
return true;
|
||||||
>>>>>>> CLOUDSTACK-8672 : NCC Integration with CloudStack.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AcquirePodIpCmdResponse allocatePodIp(Account account, String zoneId, String podId) throws ResourceAllocationException, ConcurrentOperationException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -381,4 +381,10 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
|
|||||||
public int getNonSystemNetworkCountByVpcId(final long vpcId) {
|
public int getNonSystemNetworkCountByVpcId(final long vpcId) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<NetworkVO> listNetworkVO(List<Long> idset) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -171,6 +171,16 @@ known_categories = {
|
|||||||
'StratosphereSsp' : ' Stratosphere SSP',
|
'StratosphereSsp' : ' Stratosphere SSP',
|
||||||
'Metrics' : 'Metrics',
|
'Metrics' : 'Metrics',
|
||||||
'Infrastructure' : 'Metrics',
|
'Infrastructure' : 'Metrics',
|
||||||
|
'listNetscalerControlCenter' : 'Load Balancer',
|
||||||
|
'listRegisteredServicePackages': 'Load Balancer',
|
||||||
|
'listNsVpx' : 'Load Balancer',
|
||||||
|
'destroyNsVPx': 'Load Balancer',
|
||||||
|
'deployNetscalerVpx' : 'Load Balancer',
|
||||||
|
'deleteNetscalerControlCenter' : 'Load Balancer',
|
||||||
|
'stopNetScalerVpx' : 'Load Balancer',
|
||||||
|
'deleteServicePackageOffering' : 'Load Balancer',
|
||||||
|
'destroyNsVpx' : 'Load Balancer',
|
||||||
|
'startNsVpx' : 'Load Balancer'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1837,6 +1837,7 @@
|
|||||||
<script type="text/javascript" src="scripts/ui-custom/projects.js"></script>
|
<script type="text/javascript" src="scripts/ui-custom/projects.js"></script>
|
||||||
<script type="text/javascript" src="scripts/cloudStack.js"></script>
|
<script type="text/javascript" src="scripts/cloudStack.js"></script>
|
||||||
<script type="text/javascript" src="scripts/lbStickyPolicy.js"></script>
|
<script type="text/javascript" src="scripts/lbStickyPolicy.js"></script>
|
||||||
|
<script type="text/javascript" src="scripts/lbCertificatePolicy.js"></script>
|
||||||
<script type="text/javascript" src="scripts/ui-custom/autoscaler.js"></script>
|
<script type="text/javascript" src="scripts/ui-custom/autoscaler.js"></script>
|
||||||
<script type="text/javascript" src="scripts/ui-custom/healthCheck.js"></script>
|
<script type="text/javascript" src="scripts/ui-custom/healthCheck.js"></script>
|
||||||
<script type="text/javascript" src="scripts/autoscaler.js"></script>
|
<script type="text/javascript" src="scripts/autoscaler.js"></script>
|
||||||
|
|||||||
@ -254,6 +254,7 @@ var dictionary = {"ICMP.code":"ICMP Code",
|
|||||||
"label.action.reboot.systemvm.processing":"Rebooting System VM....",
|
"label.action.reboot.systemvm.processing":"Rebooting System VM....",
|
||||||
"label.action.recurring.snapshot":"Recurring Snapshots",
|
"label.action.recurring.snapshot":"Recurring Snapshots",
|
||||||
"label.action.register.iso":"Register ISO",
|
"label.action.register.iso":"Register ISO",
|
||||||
|
"label.action.register.ncc":"Register NCC",
|
||||||
"label.action.register.template":"Register Template from URL",
|
"label.action.register.template":"Register Template from URL",
|
||||||
"label.action.release.ip":"Release IP",
|
"label.action.release.ip":"Release IP",
|
||||||
"label.action.release.ip.processing":"Releasing IP....",
|
"label.action.release.ip.processing":"Releasing IP....",
|
||||||
@ -318,6 +319,7 @@ var dictionary = {"ICMP.code":"ICMP Code",
|
|||||||
"label.add.by":"Add by",
|
"label.add.by":"Add by",
|
||||||
"label.add.by.cidr":"Add By CIDR",
|
"label.add.by.cidr":"Add By CIDR",
|
||||||
"label.add.by.group":"Add By Group",
|
"label.add.by.group":"Add By Group",
|
||||||
|
"label.add.certificate":"Add Certificate",
|
||||||
"label.add.ciscoASA1000v":"Add CiscoASA1000v Resource",
|
"label.add.ciscoASA1000v":"Add CiscoASA1000v Resource",
|
||||||
"label.add.cluster":"Add Cluster",
|
"label.add.cluster":"Add Cluster",
|
||||||
"label.add.compute.offering":"Add compute offering",
|
"label.add.compute.offering":"Add compute offering",
|
||||||
@ -502,6 +504,10 @@ var dictionary = {"ICMP.code":"ICMP Code",
|
|||||||
"label.capacity.bytes":"Capacity Bytes",
|
"label.capacity.bytes":"Capacity Bytes",
|
||||||
"label.capacity.iops":"Capacity IOPS",
|
"label.capacity.iops":"Capacity IOPS",
|
||||||
"label.certificate":"Server certificate",
|
"label.certificate":"Server certificate",
|
||||||
|
"label.certificate.details":"Certificate Details",
|
||||||
|
"label.certificate.name":"Certificate",
|
||||||
|
"label.certificateid":"Certificate ID",
|
||||||
|
"label.chain":"Chain",
|
||||||
"label.change.affinity":"Change Affinity",
|
"label.change.affinity":"Change Affinity",
|
||||||
"label.change.ipaddress":"Change IP address for NIC",
|
"label.change.ipaddress":"Change IP address for NIC",
|
||||||
"label.change.service.offering":"Change service offering",
|
"label.change.service.offering":"Change service offering",
|
||||||
@ -617,6 +623,7 @@ var dictionary = {"ICMP.code":"ICMP Code",
|
|||||||
"label.delete.project":"Delete project",
|
"label.delete.project":"Delete project",
|
||||||
"label.delete.role":"Delete Role",
|
"label.delete.role":"Delete Role",
|
||||||
"label.delete.secondary.staging.store":"Delete Secondary Staging Store",
|
"label.delete.secondary.staging.store":"Delete Secondary Staging Store",
|
||||||
|
"label.delete.sslcertificate":"Delete SSL Certificate",
|
||||||
"label.delete.ucs.manager":"Delete UCS Manager",
|
"label.delete.ucs.manager":"Delete UCS Manager",
|
||||||
"label.delete.vpn.user":"Delete VPN user",
|
"label.delete.vpn.user":"Delete VPN user",
|
||||||
"label.deleting.failed":"Deleting Failed",
|
"label.deleting.failed":"Deleting Failed",
|
||||||
@ -941,6 +948,10 @@ var dictionary = {"ICMP.code":"ICMP Code",
|
|||||||
"label.lb.algorithm.leastconn":"Least connections",
|
"label.lb.algorithm.leastconn":"Least connections",
|
||||||
"label.lb.algorithm.roundrobin":"Round-robin",
|
"label.lb.algorithm.roundrobin":"Round-robin",
|
||||||
"label.lb.algorithm.source":"Source",
|
"label.lb.algorithm.source":"Source",
|
||||||
|
"label.lb.protocol.http":"HTTP",
|
||||||
|
"label.lb.protocol.ssl":"SSL",
|
||||||
|
"label.lb.protocol.tcp":"TCP",
|
||||||
|
"label.lb.protocol.udp":"UDP",
|
||||||
"label.ldap.configuration":"LDAP Configuration",
|
"label.ldap.configuration":"LDAP Configuration",
|
||||||
"label.ldap.group.name":"LDAP Group",
|
"label.ldap.group.name":"LDAP Group",
|
||||||
"label.ldap.link.type":"Type",
|
"label.ldap.link.type":"Type",
|
||||||
@ -1101,9 +1112,14 @@ var dictionary = {"ICMP.code":"ICMP Code",
|
|||||||
"label.name.lower":"name",
|
"label.name.lower":"name",
|
||||||
"label.name.optional":"Name (Optional)",
|
"label.name.optional":"Name (Optional)",
|
||||||
"label.nat.port.range":"NAT Port Range",
|
"label.nat.port.range":"NAT Port Range",
|
||||||
|
"label.ncc":"NCC",
|
||||||
|
"label.ncc.delete":"Delete NCC",
|
||||||
|
"label.ncc.details":"NCC Details",
|
||||||
"label.netScaler":"NetScaler",
|
"label.netScaler":"NetScaler",
|
||||||
"label.netmask":"Netmask",
|
"label.netmask":"Netmask",
|
||||||
"label.netscaler.details":"NetScaler details",
|
"label.netscaler.details":"NetScaler details",
|
||||||
|
"label.netscaler.service.packages":"Netscaler Service Packages",
|
||||||
|
"label.netscaler.service.packages.description":"Service Package Description",
|
||||||
"label.network":"Network",
|
"label.network":"Network",
|
||||||
"label.network.ACL":"Network ACL",
|
"label.network.ACL":"Network ACL",
|
||||||
"label.network.ACL.total":"Network ACL Total",
|
"label.network.ACL.total":"Network ACL Total",
|
||||||
@ -1263,6 +1279,8 @@ var dictionary = {"ICMP.code":"ICMP Code",
|
|||||||
"label.private.port":"Private Port",
|
"label.private.port":"Private Port",
|
||||||
"label.private.zone":"Private Zone",
|
"label.private.zone":"Private Zone",
|
||||||
"label.privatekey":"PKCS#8 Private Key",
|
"label.privatekey":"PKCS#8 Private Key",
|
||||||
|
"label.privatekey.name":"Private Key",
|
||||||
|
"label.privatekey.password":"Private Key Password",
|
||||||
"label.profile":"Profile",
|
"label.profile":"Profile",
|
||||||
"label.project":"Project",
|
"label.project":"Project",
|
||||||
"label.project.dashboard":"Project dashboard",
|
"label.project.dashboard":"Project dashboard",
|
||||||
@ -1520,6 +1538,7 @@ var dictionary = {"ICMP.code":"ICMP Code",
|
|||||||
"label.ssh.key.pair":"SSH Key Pair",
|
"label.ssh.key.pair":"SSH Key Pair",
|
||||||
"label.ssh.key.pair.details":"SSH Key Pair Details",
|
"label.ssh.key.pair.details":"SSH Key Pair Details",
|
||||||
"label.ssh.key.pairs":"SSH Key Pairs",
|
"label.ssh.key.pairs":"SSH Key Pairs",
|
||||||
|
"label.sslcertificates":"SSL Certificates",
|
||||||
"label.standard.us.keyboard":"Standard (US) keyboard",
|
"label.standard.us.keyboard":"Standard (US) keyboard",
|
||||||
"label.start.IP":"Start IP",
|
"label.start.IP":"Start IP",
|
||||||
"label.start.lb.vm":"Start LB VM",
|
"label.start.lb.vm":"Start LB VM",
|
||||||
@ -1667,6 +1686,7 @@ var dictionary = {"ICMP.code":"ICMP Code",
|
|||||||
"label.username":"Username",
|
"label.username":"Username",
|
||||||
"label.username.lower":"username",
|
"label.username.lower":"username",
|
||||||
"label.users":"Users",
|
"label.users":"Users",
|
||||||
|
"label.uuid":"UUID",
|
||||||
"label.vSwitch.type":"vSwitch Type",
|
"label.vSwitch.type":"vSwitch Type",
|
||||||
"label.value":"Value",
|
"label.value":"Value",
|
||||||
"label.vcdcname":"vCenter DC name",
|
"label.vcdcname":"vCenter DC name",
|
||||||
@ -2020,6 +2040,7 @@ var dictionary = {"ICMP.code":"ICMP Code",
|
|||||||
"message.delete.affinity.group":"Please confirm that you would like to remove this affinity group.",
|
"message.delete.affinity.group":"Please confirm that you would like to remove this affinity group.",
|
||||||
"message.delete.gateway":"Please confirm you want to delete the gateway",
|
"message.delete.gateway":"Please confirm you want to delete the gateway",
|
||||||
"message.delete.project":"Are you sure you want to delete this project?",
|
"message.delete.project":"Are you sure you want to delete this project?",
|
||||||
|
"message.delete.sslcertificate":"Please confirm that you would like to delete this certificate.",
|
||||||
"message.delete.user":"Please confirm that you would like to delete this user.",
|
"message.delete.user":"Please confirm that you would like to delete this user.",
|
||||||
"message.desc.add.new.lb.sticky.rule":"Add new LB sticky rule",
|
"message.desc.add.new.lb.sticky.rule":"Add new LB sticky rule",
|
||||||
"message.desc.advanced.zone":"For more sophisticated network topologies. This network model provides the most flexibility in defining guest networks and providing custom network offerings such as firewall, VPN, or load balancer support.",
|
"message.desc.advanced.zone":"For more sophisticated network topologies. This network model provides the most flexibility in defining guest networks and providing custom network offerings such as firewall, VPN, or load balancer support.",
|
||||||
@ -2122,6 +2143,7 @@ var dictionary = {"ICMP.code":"ICMP Code",
|
|||||||
"message.migrate.router.confirm":"Please confirm the host you wish to migrate the router to:",
|
"message.migrate.router.confirm":"Please confirm the host you wish to migrate the router to:",
|
||||||
"message.migrate.systemvm.confirm":"Please confirm the host you wish to migrate the system VM to:",
|
"message.migrate.systemvm.confirm":"Please confirm the host you wish to migrate the system VM to:",
|
||||||
"message.migrate.volume":"Please confirm that you want to migrate volume to another primary storage.",
|
"message.migrate.volume":"Please confirm that you want to migrate volume to another primary storage.",
|
||||||
|
"message.ncc.delete.confirm":"Please confirm you want to delete this NCC",
|
||||||
"message.network.addVM.desc":"Please specify the network that you would like to add this VM to. A new NIC will be added for this network.",
|
"message.network.addVM.desc":"Please specify the network that you would like to add this VM to. A new NIC will be added for this network.",
|
||||||
"message.network.addVMNIC":"Please confirm that you would like to add a new VM NIC for this network.",
|
"message.network.addVMNIC":"Please confirm that you would like to add a new VM NIC for this network.",
|
||||||
"message.network.remote.access.vpn.configuration":"Remote Access VPN configuration has been generated, but it failed to apply. Please check connectivity of the network element, then re-try.",
|
"message.network.remote.access.vpn.configuration":"Remote Access VPN configuration has been generated, but it failed to apply. Please check connectivity of the network element, then re-try.",
|
||||||
@ -2165,6 +2187,8 @@ var dictionary = {"ICMP.code":"ICMP Code",
|
|||||||
"message.read.admin.guide.scaling.up":"Please read the dynamic scaling section in the admin guide before scaling up.",
|
"message.read.admin.guide.scaling.up":"Please read the dynamic scaling section in the admin guide before scaling up.",
|
||||||
"message.recover.vm":"Please confirm that you would like to recover this VM.",
|
"message.recover.vm":"Please confirm that you would like to recover this VM.",
|
||||||
"message.redirecting.region":"Redirecting to region...",
|
"message.redirecting.region":"Redirecting to region...",
|
||||||
|
"message.register.failed":"Registration Failed",
|
||||||
|
"message.register.succeeded":"Registration Succeeded",
|
||||||
"message.reinstall.vm":"NOTE: Proceed with caution. This will cause the VM to be reinstalled from the template; data on the root disk will be lost. Extra data volumes, if any, will not be touched.",
|
"message.reinstall.vm":"NOTE: Proceed with caution. This will cause the VM to be reinstalled from the template; data on the root disk will be lost. Extra data volumes, if any, will not be touched.",
|
||||||
"message.remove.ldap":"Are you sure you want to delete the LDAP configuration?",
|
"message.remove.ldap":"Are you sure you want to delete the LDAP configuration?",
|
||||||
"message.remove.region":"Are you sure you want to remove this region from this management server?",
|
"message.remove.region":"Are you sure you want to remove this region from this management server?",
|
||||||
|
|||||||
@ -895,6 +895,199 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
sslCertificates: {
|
||||||
|
title: 'label.sslcertificates',
|
||||||
|
listView: {
|
||||||
|
id: 'sslCertificates',
|
||||||
|
|
||||||
|
fields: {
|
||||||
|
name: {
|
||||||
|
label: 'label.name'
|
||||||
|
},
|
||||||
|
id: {
|
||||||
|
label: 'label.certificateid'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
dataProvider: function(args) {
|
||||||
|
var data = {};
|
||||||
|
listViewDataProvider(args, data);
|
||||||
|
if (args.context != null) {
|
||||||
|
if ("accounts" in args.context) {
|
||||||
|
$.extend(data, {
|
||||||
|
accountid: args.context.accounts[0].id
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: createURL('listSslCerts'),
|
||||||
|
data: data,
|
||||||
|
success: function(json) {
|
||||||
|
var items = json.listsslcertsresponse.sslcert;
|
||||||
|
args.response.success({
|
||||||
|
data: items
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
add: {
|
||||||
|
label: 'label.add.certificate',
|
||||||
|
|
||||||
|
messages: {
|
||||||
|
notification: function(args) {
|
||||||
|
return 'label.add.certificate';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
createForm: {
|
||||||
|
title: 'label.add.certificate',
|
||||||
|
fields: {
|
||||||
|
name: {
|
||||||
|
label: 'label.name',
|
||||||
|
validation: {
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
certificate: {
|
||||||
|
label: 'label.certificate.name',
|
||||||
|
isTextarea: true,
|
||||||
|
validation: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
},
|
||||||
|
privatekey: {
|
||||||
|
label: 'label.privatekey.name',
|
||||||
|
isTextarea: true,
|
||||||
|
validation: {
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
certchain: {
|
||||||
|
label: "label.chain",
|
||||||
|
isTextarea: true,
|
||||||
|
validation: {
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
password: {
|
||||||
|
label: "label.privatekey.password",
|
||||||
|
isPassword: true,
|
||||||
|
validation: {
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
action: function(args) {
|
||||||
|
var data = {
|
||||||
|
name: args.data.name,
|
||||||
|
certificate: args.data.certificate,
|
||||||
|
privatekey: args.data.privatekey
|
||||||
|
};
|
||||||
|
|
||||||
|
if (args.data.certchain != null && args.data.certchain.length > 0) {
|
||||||
|
$.extend(data, {
|
||||||
|
certchain: args.data.certchain
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.data.password != null && args.data.password.length > 0) {
|
||||||
|
$.extend(data, {
|
||||||
|
password: args.data.password
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: createURL('uploadSslCert'),
|
||||||
|
data: data,
|
||||||
|
success: function(json) {
|
||||||
|
var item = json.uploadsslcertresponse.sslcert;
|
||||||
|
args.response.success({
|
||||||
|
data: item
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: function(json) {
|
||||||
|
args.response.error(parseXMLHttpResponse(json));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
detailView: {
|
||||||
|
actions: {
|
||||||
|
remove: {
|
||||||
|
label: 'label.delete.sslcertificate',
|
||||||
|
messages: {
|
||||||
|
confirm: function(args) {
|
||||||
|
return 'message.delete.sslcertificate';
|
||||||
|
},
|
||||||
|
notification: function(args) {
|
||||||
|
return 'label.delete.sslcertificate';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
action: function(args) {
|
||||||
|
$.ajax({
|
||||||
|
url: createURL('deleteSslCert'),
|
||||||
|
data: {
|
||||||
|
id: args.context.sslCertificates[0].id
|
||||||
|
},
|
||||||
|
success: function(json) {
|
||||||
|
var items = json.deletesslcertresponse.sslcert;
|
||||||
|
args.response.success({
|
||||||
|
data: items
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
tabs: {
|
||||||
|
details: {
|
||||||
|
title: 'label.certificate.details',
|
||||||
|
fields: {
|
||||||
|
name: {
|
||||||
|
label: 'label.name'
|
||||||
|
},
|
||||||
|
certificate: {
|
||||||
|
label: 'label.certificate.name'
|
||||||
|
},
|
||||||
|
certchain: {
|
||||||
|
label: 'label.chain'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
dataProvider: function(args) {
|
||||||
|
var data = {};
|
||||||
|
|
||||||
|
if (args.context != null) {
|
||||||
|
if ("sslCertificates" in args.context) {
|
||||||
|
$.extend(data, {
|
||||||
|
certid: args.context.sslCertificates[0].id
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: createURL('listSslCerts'),
|
||||||
|
data: data,
|
||||||
|
success: function(json) {
|
||||||
|
var items = json.listsslcertsresponse.sslcert[0];
|
||||||
|
args.response.success({
|
||||||
|
data: items
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// Granular settings for account
|
// Granular settings for account
|
||||||
settings: {
|
settings: {
|
||||||
title: 'label.settings',
|
title: 'label.settings',
|
||||||
|
|||||||
@ -2639,11 +2639,17 @@
|
|||||||
args.$form.find('.form-item[rel=\"egressdefaultpolicy\"]').css('display', 'none');
|
args.$form.find('.form-item[rel=\"egressdefaultpolicy\"]').css('display', 'none');
|
||||||
}
|
}
|
||||||
|
|
||||||
//show LB Isolation dropdown only when (1)LB Service is checked (2)Service Provider is Netscaler OR F5
|
//show Netscaler service packages only when (1)LB Service is checked (2)Service Provider is Netscaler
|
||||||
if ((args.$form.find('.form-item[rel=\"service.Lb.isEnabled\"]').find('input[type=checkbox]').is(':checked') == true) && (args.$form.find('.form-item[rel=\"service.Lb.provider\"]').find('select').val() == 'Netscaler' || args.$form.find('.form-item[rel=\"service.Lb.provider\"]').find('select').val() == 'F5BigIp')) {
|
if ((args.$form.find('.form-item[rel=\"service.Lb.isEnabled\"]').find('input[type=checkbox]').is(':checked') == true) && (args.$form.find('.form-item[rel=\"service.Lb.provider\"]').find('select').val() == 'Netscaler')) {
|
||||||
args.$form.find('.form-item[rel=\"service.Lb.lbIsolationDropdown\"]').css('display', 'inline-block');
|
args.$form.find('.form-item[rel=\"service.Lb.Netscaler.servicePackages\"]').css('display', 'inline-block');
|
||||||
|
args.$form.find('.form-item[rel=\"service.Lb.Netscaler.servicePackages.description\"]').css('display', 'inline-block');
|
||||||
|
args.$form.find('.form-item[rel=\"service.Lb.Netscaler.servicePackages.description\"]').find("#label_netscaler_service_packages_description").attr("disabled", "disabled");
|
||||||
|
args.$form.find('.form-item[rel=\"service.Lb.Netscaler.servicePackages.description\"]').find("#label_netscaler_service_packages_description").text(args.$form.find('.form-item[rel=\"service.Lb.Netscaler.servicePackages\"]').find('#label_netscaler_service_packages option:selected').data("json-obj").desc);
|
||||||
} else {
|
} else {
|
||||||
args.$form.find('.form-item[rel=\"service.Lb.lbIsolationDropdown\"]').hide();
|
args.$form.find('.form-item[rel=\"service.Lb.Netscaler.servicePackages\"]').hide();
|
||||||
|
args.$form.find('.form-item[rel=\"service.Lb.Netscaler.servicePackages.description\"]').hide();
|
||||||
|
args.$form.find('.form-item[rel=\"service.Lb.Netscaler.servicePackages.description\"]').find("#label_netscaler_service_packages_description").attr("disabled", "disabled");
|
||||||
|
args.$form.find('.form-item[rel=\"service.Lb.Netscaler.servicePackages.description\"]').find("#label_netscaler_service_packages_description").text("");
|
||||||
}
|
}
|
||||||
|
|
||||||
//show Elastic LB checkbox only when (1)LB Service is checked (2)Service Provider is Netscaler (3)Guest IP Type is Shared
|
//show Elastic LB checkbox only when (1)LB Service is checked (2)Service Provider is Netscaler (3)Guest IP Type is Shared
|
||||||
@ -3014,22 +3020,7 @@
|
|||||||
isHidden: true,
|
isHidden: true,
|
||||||
isBoolean: true
|
isBoolean: true
|
||||||
},
|
},
|
||||||
"service.Lb.lbIsolationDropdown": {
|
|
||||||
label: 'label.LB.isolation',
|
|
||||||
docID: 'helpNetworkOfferingLBIsolation',
|
|
||||||
isHidden: true,
|
|
||||||
select: function(args) {
|
|
||||||
args.response.success({
|
|
||||||
data: [{
|
|
||||||
id: 'dedicated',
|
|
||||||
description: 'Dedicated'
|
|
||||||
}, {
|
|
||||||
id: 'shared',
|
|
||||||
description: 'Shared'
|
|
||||||
}]
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"service.Lb.inlineModeDropdown": {
|
"service.Lb.inlineModeDropdown": {
|
||||||
label: 'label.mode',
|
label: 'label.mode',
|
||||||
docID: 'helpNetworkOfferingMode',
|
docID: 'helpNetworkOfferingMode',
|
||||||
@ -3049,6 +3040,62 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"service.Lb.Netscaler.servicePackages": {
|
||||||
|
label: 'label.netscaler.service.packages',
|
||||||
|
docID: 'helpNetscalerServicePackages',
|
||||||
|
isHidden: true,
|
||||||
|
select: function(args) {
|
||||||
|
$.ajax({
|
||||||
|
url: createURL('listRegisteredServicePackages'),
|
||||||
|
dataType: 'json',
|
||||||
|
async: true,
|
||||||
|
success: function(data) {
|
||||||
|
var servicePackages = data.listregisteredservicepackage.registeredServicepackage;
|
||||||
|
|
||||||
|
if (servicePackages == undefined || servicePackages == null || !servicePackages) {
|
||||||
|
servicePackages = data.listregisteredservicepackage;
|
||||||
|
}
|
||||||
|
|
||||||
|
args.response.success({
|
||||||
|
data: $.map(servicePackages, function(elem) {
|
||||||
|
return {
|
||||||
|
id: elem.id,
|
||||||
|
description: elem.name,
|
||||||
|
desc: elem.description
|
||||||
|
};
|
||||||
|
})
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: function(data) {
|
||||||
|
args.response.error(parseXMLHttpResponse(data));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"service.Lb.Netscaler.servicePackages.description": {
|
||||||
|
label: 'label.netscaler.service.packages.description',
|
||||||
|
isHidden: true,
|
||||||
|
isTextarea: true
|
||||||
|
},
|
||||||
|
|
||||||
|
"service.Lb.lbIsolationDropdown": {
|
||||||
|
label: 'label.LB.isolation',
|
||||||
|
docID: 'helpNetworkOfferingLBIsolation',
|
||||||
|
isHidden: true,
|
||||||
|
select: function(args) {
|
||||||
|
args.response.success({
|
||||||
|
data: [{
|
||||||
|
id: 'dedicated',
|
||||||
|
description: 'Dedicated'
|
||||||
|
}, {
|
||||||
|
id: 'shared',
|
||||||
|
description: 'Shared'
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
"service.StaticNat.elasticIpCheckbox": {
|
"service.StaticNat.elasticIpCheckbox": {
|
||||||
label: "label.elastic.IP",
|
label: "label.elastic.IP",
|
||||||
isHidden: true,
|
isHidden: true,
|
||||||
@ -3129,6 +3176,12 @@
|
|||||||
$.each(formData, function(key, value) {
|
$.each(formData, function(key, value) {
|
||||||
var serviceData = key.split('.');
|
var serviceData = key.split('.');
|
||||||
|
|
||||||
|
if (key == 'service.Lb.Netscaler.servicePackages' && value != "") {
|
||||||
|
inputData['details[' + 0 + '].servicepackageuuid'] = value;
|
||||||
|
inputData['details[' + 1 + '].servicepackagedescription'] = args.$form.find('#label_netscaler_service_packages option:selected').data().jsonObj.desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (serviceData.length > 1) {
|
if (serviceData.length > 1) {
|
||||||
if (serviceData[0] == 'service' &&
|
if (serviceData[0] == 'service' &&
|
||||||
serviceData[2] == 'isEnabled' &&
|
serviceData[2] == 'isEnabled' &&
|
||||||
|
|||||||
@ -568,6 +568,10 @@ cloudStack.docs = {
|
|||||||
desc: 'Number of guest networks/accounts that will share this device',
|
desc: 'Number of guest networks/accounts that will share this device',
|
||||||
externalLink: ''
|
externalLink: ''
|
||||||
},
|
},
|
||||||
|
helpNetscalerServicePackages: {
|
||||||
|
desc: 'Choose the Netscaler Service Package you want to use.',
|
||||||
|
externalLink: ''
|
||||||
|
},
|
||||||
// Add network offering
|
// Add network offering
|
||||||
helpNetworkOfferingName: {
|
helpNetworkOfferingName: {
|
||||||
desc: 'Any desired name for the network offering',
|
desc: 'Any desired name for the network offering',
|
||||||
|
|||||||
183
ui/scripts/lbCertificatePolicy.js
Normal file
183
ui/scripts/lbCertificatePolicy.js
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
|
||||||
|
(function($, cloudStack) {
|
||||||
|
cloudStack.lbCertificatePolicy = {
|
||||||
|
dialog: function(args) {
|
||||||
|
return function(args) {
|
||||||
|
var success = args.response.success;
|
||||||
|
var context = args.context;
|
||||||
|
|
||||||
|
var certid = {
|
||||||
|
certificate: {
|
||||||
|
label: 'label.certificate.name',
|
||||||
|
select: function(args) {
|
||||||
|
var data = {};
|
||||||
|
var item = {};
|
||||||
|
|
||||||
|
if (context != null) {
|
||||||
|
if (context.networks != null) {
|
||||||
|
$.extend(data, {account: context.networks[0].account});
|
||||||
|
$.extend(data, {domain: context.networks[0].domain});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: createURL('listAccounts'),
|
||||||
|
async: false,
|
||||||
|
data: data,
|
||||||
|
success: function(json) {
|
||||||
|
var items = json.listaccountsresponse.account;
|
||||||
|
$.extend(item, {accountid: items[0].id});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: createURL('listSslCerts'),
|
||||||
|
async: false,
|
||||||
|
data: item,
|
||||||
|
success: function(json) {
|
||||||
|
var items = json.listsslcertsresponse.sslcert;
|
||||||
|
args.response.success({
|
||||||
|
data: $.map(items, function(item) {
|
||||||
|
return {
|
||||||
|
id: item.id,
|
||||||
|
description: item.id
|
||||||
|
};
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var $item = args.$item;
|
||||||
|
|
||||||
|
cloudStack.dialog.createForm({
|
||||||
|
form: {
|
||||||
|
title: 'Configure Certificate',
|
||||||
|
desc: 'Please complete the following fields',
|
||||||
|
fields: certid
|
||||||
|
},
|
||||||
|
after: function(args) {
|
||||||
|
// Remove fields not applicable to sticky method
|
||||||
|
args.$form.find('.form-item:hidden').remove();
|
||||||
|
|
||||||
|
var data = cloudStack.serializeForm(args.$form);
|
||||||
|
|
||||||
|
/* $item indicates that this is an existing sticky rule;
|
||||||
|
re-create sticky rule with new parameters */
|
||||||
|
if ($item) {
|
||||||
|
var $loading = $('<div>').addClass('loading-overlay');
|
||||||
|
|
||||||
|
$loading.prependTo($item);
|
||||||
|
cloudStack.lbStickyPolicy.actions.recreate(
|
||||||
|
$item.data('multi-custom-data').id,
|
||||||
|
$item.data('multi-custom-data').lbRuleID,
|
||||||
|
data,
|
||||||
|
function() { // Complete
|
||||||
|
$(window).trigger('cloudStack.fullRefresh');
|
||||||
|
},
|
||||||
|
function(error) { // Error
|
||||||
|
$(window).trigger('cloudStack.fullRefresh');
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
success({
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
add: function(lbRuleID, data, complete, error) {
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: createURL('assignCertToLoadBalancer'),
|
||||||
|
data: {certid: data.certificate, lbruleid: lbRuleID},
|
||||||
|
success: function(json) {
|
||||||
|
cloudStack.ui.notifications.add({
|
||||||
|
desc: 'Add new LB Certificate',
|
||||||
|
section: 'Network',
|
||||||
|
poll: pollAsyncJobResult,
|
||||||
|
_custom: {
|
||||||
|
jobId: json.assigncerttoloadbalancerresponse.jobid
|
||||||
|
}
|
||||||
|
},
|
||||||
|
complete, {},
|
||||||
|
error, {}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
error: function(json) {
|
||||||
|
complete();
|
||||||
|
cloudStack.dialog.notice({
|
||||||
|
message: parseXMLHttpResponse(json)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
'delete': function(stickyRuleID, complete, error) {
|
||||||
|
$.ajax({
|
||||||
|
url: createURL('deleteLBStickinessPolicy'),
|
||||||
|
data: {
|
||||||
|
id: stickyRuleID
|
||||||
|
},
|
||||||
|
success: function(json) {
|
||||||
|
cloudStack.ui.notifications.add({
|
||||||
|
desc: 'Remove previous LB sticky rule',
|
||||||
|
section: 'Network',
|
||||||
|
poll: pollAsyncJobResult,
|
||||||
|
_custom: {
|
||||||
|
jobId: json.deleteLBstickinessrruleresponse.jobid
|
||||||
|
}
|
||||||
|
},
|
||||||
|
complete, {},
|
||||||
|
error, {}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
error: function(json) {
|
||||||
|
complete();
|
||||||
|
cloudStack.dialog.notice({
|
||||||
|
message: parseXMLHttpResponse(json)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
recreate: function(stickyRuleID, lbRuleID, data, complete, error) {
|
||||||
|
var addStickyPolicy = function() {
|
||||||
|
cloudStack.lbStickyPolicy.actions.add(
|
||||||
|
lbRuleID,
|
||||||
|
data,
|
||||||
|
complete,
|
||||||
|
error
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Delete existing rule
|
||||||
|
if (data.methodname !== 'None') {
|
||||||
|
addStickyPolicy();
|
||||||
|
} else {
|
||||||
|
cloudStack.lbStickyPolicy.actions['delete'](stickyRuleID, complete, error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}(jQuery, cloudStack));
|
||||||
311
ui/scripts/network.js
Executable file → Normal file
311
ui/scripts/network.js
Executable file → Normal file
@ -3025,112 +3025,6 @@
|
|||||||
|
|
||||||
vmDetails: cloudStack.sections.instances.listView.detailView,
|
vmDetails: cloudStack.sections.instances.listView.detailView,
|
||||||
|
|
||||||
|
|
||||||
//"NAT Port Range" multiEdit screen for StaticNAT is obsolete in cloudstack 3.0 because createIpForwardingRule/deleteIpForwardingRule/listIpForwardingRules API are obsolete in cloudstack 3.0.
|
|
||||||
//cloudstack 3.0 is using createFirewallRule/listFirewallRules/deleteFirewallRule API for both staticNAT and non-staticNAT .
|
|
||||||
/*
|
|
||||||
staticNAT: {
|
|
||||||
noSelect: true,
|
|
||||||
fields: {
|
|
||||||
'protocol': {
|
|
||||||
label: 'label.protocol',
|
|
||||||
select: function(args) {
|
|
||||||
args.response.success({
|
|
||||||
data: [
|
|
||||||
{ name: 'tcp', description: 'TCP' },
|
|
||||||
{ name: 'udp', description: 'UDP' }
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'startport': { edit: true, label: 'label.start.port' },
|
|
||||||
'endport': { edit: true, label: 'label.end.port' },
|
|
||||||
'add-rule': {
|
|
||||||
label: 'label.add.rule',
|
|
||||||
addButton: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
add: {
|
|
||||||
label: 'label.add',
|
|
||||||
action: function(args) {
|
|
||||||
$.ajax({
|
|
||||||
url: createURL('createIpForwardingRule'),
|
|
||||||
data: $.extend(args.data, {
|
|
||||||
ipaddressid: args.context.ipAddresses[0].id
|
|
||||||
}),
|
|
||||||
dataType: 'json',
|
|
||||||
success: function(data) {
|
|
||||||
args.response.success({
|
|
||||||
_custom: {
|
|
||||||
jobId: data.createipforwardingruleresponse.jobid
|
|
||||||
},
|
|
||||||
notification: {
|
|
||||||
label: 'label.add.static.nat.rule',
|
|
||||||
poll: pollAsyncJobResult
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
error: function(data) {
|
|
||||||
args.response.error(parseXMLHttpResponse(data));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
destroy: {
|
|
||||||
label: 'label.remove.rule',
|
|
||||||
action: function(args) {
|
|
||||||
$.ajax({
|
|
||||||
url: createURL('deleteIpForwardingRule'),
|
|
||||||
data: {
|
|
||||||
id: args.context.multiRule[0].id
|
|
||||||
},
|
|
||||||
dataType: 'json',
|
|
||||||
async: true,
|
|
||||||
success: function(data) {
|
|
||||||
var jobID = data.deleteipforwardingruleresponse.jobid;
|
|
||||||
args.response.success({
|
|
||||||
_custom: {
|
|
||||||
jobId: jobID
|
|
||||||
},
|
|
||||||
notification: {
|
|
||||||
label: 'label.remove.static.nat.rule',
|
|
||||||
poll: pollAsyncJobResult
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
error: function(data) {
|
|
||||||
args.response.error(parseXMLHttpResponse(data));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
dataProvider: function(args) {
|
|
||||||
setTimeout(function() {
|
|
||||||
$.ajax({
|
|
||||||
url: createURL('listIpForwardingRules'),
|
|
||||||
data: {
|
|
||||||
listAll: true,
|
|
||||||
ipaddressid: args.context.ipAddresses[0].id
|
|
||||||
},
|
|
||||||
dataType: 'json',
|
|
||||||
async: true,
|
|
||||||
success: function(data) {
|
|
||||||
args.response.success({
|
|
||||||
data: data.listipforwardingrulesresponse.ipforwardingrule
|
|
||||||
});
|
|
||||||
},
|
|
||||||
error: function(data) {
|
|
||||||
args.response.error(parseXMLHttpResponse(data));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}, 100);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// Load balancing rules
|
// Load balancing rules
|
||||||
loadBalancing: {
|
loadBalancing: {
|
||||||
listView: $.extend(true, {}, cloudStack.sections.instances, {
|
listView: $.extend(true, {}, cloudStack.sections.instances, {
|
||||||
@ -3360,6 +3254,41 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'protocol': {
|
||||||
|
label: 'label.protocol',
|
||||||
|
isEditable: true,
|
||||||
|
select: function(args) {
|
||||||
|
var data = [{
|
||||||
|
id: 'ssl',
|
||||||
|
name: 'ssl',
|
||||||
|
description: _l('label.lb.protocol.ssl')
|
||||||
|
}, {
|
||||||
|
id: 'tcp',
|
||||||
|
name: 'tcp',
|
||||||
|
description: _l('label.lb.protocol.tcp')
|
||||||
|
}, {
|
||||||
|
id: 'udp',
|
||||||
|
name: 'udp',
|
||||||
|
description: _l('label.lb.protocol.udp')
|
||||||
|
}];
|
||||||
|
if (typeof args.context != 'undefined') {
|
||||||
|
var lbProtocols = getLBProtocols(args.context.networks[0]);
|
||||||
|
data = (lbProtocols.length == 0) ? data : lbProtocols;
|
||||||
|
}
|
||||||
|
args.response.success({
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
'sslcertificate': {
|
||||||
|
label: 'label.update.ssl',
|
||||||
|
custom: {
|
||||||
|
buttonLabel: 'label.configure',
|
||||||
|
action: cloudStack.lbCertificatePolicy.dialog()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
'health-check': {
|
'health-check': {
|
||||||
label: 'label.health.check',
|
label: 'label.health.check',
|
||||||
custom: {
|
custom: {
|
||||||
@ -3441,12 +3370,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
'add-vm': {
|
'add-vm': {
|
||||||
label: 'label.add.vms',
|
label: 'label.add.vms',
|
||||||
addButton: true
|
addButton: true
|
||||||
},
|
},
|
||||||
|
|
||||||
'state' : {
|
'state' : {
|
||||||
edit: 'ignore',
|
edit: 'ignore',
|
||||||
label: 'label.state'
|
label: 'label.state'
|
||||||
@ -3478,10 +3405,12 @@
|
|||||||
publicport: args.data.publicport,
|
publicport: args.data.publicport,
|
||||||
openfirewall: false,
|
openfirewall: false,
|
||||||
networkid: networkid,
|
networkid: networkid,
|
||||||
publicipid: args.context.ipAddresses[0].id
|
publicipid: args.context.ipAddresses[0].id,
|
||||||
|
protocol: args.data.protocol
|
||||||
};
|
};
|
||||||
|
|
||||||
var stickyData = $.extend(true, {}, args.data.sticky);
|
var stickyData = $.extend(true, {}, args.data.sticky);
|
||||||
|
var certificateData = $.extend(true, {}, args.data.sslcertificate);
|
||||||
|
|
||||||
//***** create new LB rule > Add VMs *****
|
//***** create new LB rule > Add VMs *****
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -3498,25 +3427,6 @@
|
|||||||
id: data.createloadbalancerruleresponse.id
|
id: data.createloadbalancerruleresponse.id
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
var inputData = {
|
|
||||||
id: data.createloadbalancerruleresponse.id,
|
|
||||||
virtualmachineids: $.map(itemData, function(elem) {
|
|
||||||
return elem.id;
|
|
||||||
}).join(',')
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
//virtualmachineids parameter has been replaced with vmidipmap parameter, so comment out the 6 lines above.
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* e.g. first VM(xxx) has two IPs(10.1.1.~), second VM(yyy) has three IPs(10.2.2.~):
|
|
||||||
* vmidipmap[0].vmid=xxx vmidipmap[0].vmip=10.1.1.11
|
|
||||||
* vmidipmap[1].vmid=xxx vmidipmap[1].vmip=10.1.1.12
|
|
||||||
* vmidipmap[2].vmid=yyy vmidipmap[2].vmip=10.2.2.77
|
|
||||||
* vmidipmap[3].vmid=yyy vmidipmap[3].vmip=10.2.2.78
|
|
||||||
* vmidipmap[4].vmid=yyy vmidipmap[4].vmip=10.2.2.79
|
|
||||||
*/
|
|
||||||
var selectedVMs = args.itemData;
|
var selectedVMs = args.itemData;
|
||||||
if (selectedVMs != null) {
|
if (selectedVMs != null) {
|
||||||
var vmidipmapIndex = 0;
|
var vmidipmapIndex = 0;
|
||||||
@ -3536,12 +3446,56 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*$.ajax({
|
||||||
|
url: createURL('assignCertToLoadBalancer'),
|
||||||
|
data: {certid: certificateData.certificate, lbruleid: lbID},
|
||||||
|
success: function(data) {
|
||||||
|
var jobID = data.assigncerttoloadbalancerresponse.jobid;
|
||||||
|
var lbProtocolCreated = false;
|
||||||
|
|
||||||
|
args.response.success({
|
||||||
|
_custom: {
|
||||||
|
jobId: jobID
|
||||||
|
},
|
||||||
|
notification: {
|
||||||
|
label: 'label.add.certificate',
|
||||||
|
poll: function(args) {
|
||||||
|
var complete = args.complete;
|
||||||
|
var error = args.error;
|
||||||
|
|
||||||
|
pollAsyncJobResult({
|
||||||
|
_custom: {
|
||||||
|
jobId: jobID
|
||||||
|
},
|
||||||
|
complete: function(args) {
|
||||||
|
if (lbProtocolCreated) return;
|
||||||
|
|
||||||
|
lbProtocolCreated = true;
|
||||||
|
|
||||||
|
if (certificateData && certificateData.certificate) {
|
||||||
|
cloudStack.lbCertificatePolicy.actions.add(lbID, certificateData, complete, error);
|
||||||
|
} else {
|
||||||
|
complete();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: error
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: function(data) {
|
||||||
|
args.response.error(parseXMLHttpResponse(data));
|
||||||
|
}
|
||||||
|
});*/
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: createURL('assignToLoadBalancerRule'),
|
url: createURL('assignToLoadBalancerRule'),
|
||||||
data: inputData,
|
data: inputData,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
var jobID = data.assigntoloadbalancerruleresponse.jobid;
|
var jobID = data.assigntoloadbalancerruleresponse.jobid;
|
||||||
var lbStickyCreated = false;
|
var lbStickyCreated = false;
|
||||||
|
var lbCertificateCreated = false;
|
||||||
|
|
||||||
args.response.success({
|
args.response.success({
|
||||||
_custom: {
|
_custom: {
|
||||||
@ -3558,17 +3512,26 @@
|
|||||||
jobId: jobID
|
jobId: jobID
|
||||||
},
|
},
|
||||||
complete: function(args) {
|
complete: function(args) {
|
||||||
if (lbStickyCreated) return;
|
if (lbStickyCreated && lbCertificateCreated) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!lbStickyCreated) {
|
||||||
lbStickyCreated = true;
|
lbStickyCreated = true;
|
||||||
|
|
||||||
// Create stickiness policy
|
if (stickyData && stickyData.methodname && stickyData.methodname != 'None') {
|
||||||
if (stickyData &&
|
cloudStack.lbStickyPolicy.actions.add(lbID, stickyData, complete, error);
|
||||||
stickyData.methodname &&
|
}
|
||||||
stickyData.methodname != 'None') {
|
}
|
||||||
cloudStack.lbStickyPolicy.actions.add(lbID,
|
|
||||||
stickyData,
|
if (!lbCertificateCreated) {
|
||||||
complete, error);
|
lbCertificateCreated = true;
|
||||||
|
|
||||||
|
if (certificateData && certificateData.certificate && certificateData.certificate != 'None') {
|
||||||
|
cloudStack.lbCertificatePolicy.actions.add(lbID, certificateData, complete, error);
|
||||||
|
} else {
|
||||||
|
complete();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
complete();
|
complete();
|
||||||
}
|
}
|
||||||
@ -3761,7 +3724,7 @@
|
|||||||
$(loadbalancerrules).each(function() {
|
$(loadbalancerrules).each(function() {
|
||||||
var lbRule = this;
|
var lbRule = this;
|
||||||
var stickyData = {};
|
var stickyData = {};
|
||||||
|
var sslCertData = {};
|
||||||
//var lbInstances = [];
|
//var lbInstances = [];
|
||||||
var itemData = [];
|
var itemData = [];
|
||||||
|
|
||||||
@ -3822,6 +3785,21 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Get SSL Certificate data
|
||||||
|
$.ajax({
|
||||||
|
url: createURL('listSslCerts'),
|
||||||
|
data: {
|
||||||
|
listAll: true,
|
||||||
|
lbruleid: lbRule.id
|
||||||
|
},
|
||||||
|
async: false,
|
||||||
|
success: function(json) {
|
||||||
|
if (json.listsslcertsresponse != null) {
|
||||||
|
lbRule._hideFields.push('sslcertificate');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Get instances
|
// Get instances
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: createURL('listLoadBalancerRuleInstances'),
|
url: createURL('listLoadBalancerRuleInstances'),
|
||||||
@ -6562,4 +6540,63 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var getLBProtocols = function(networkObj) {
|
||||||
|
if (!networkObj || !networkObj.service) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
var lbService = $.grep(networkObj.service, function(service) {
|
||||||
|
return service.name == 'Lb';
|
||||||
|
})[0];
|
||||||
|
|
||||||
|
if (!lbService || !lbService.capability) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
var protocolCapabilities = $.grep(
|
||||||
|
lbService.capability,
|
||||||
|
function(capability) {
|
||||||
|
return (capability.name == 'SupportedProtocols');
|
||||||
|
}
|
||||||
|
)[0];
|
||||||
|
|
||||||
|
if (!protocolCapabilities) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
var protocols = protocolCapabilities.value.split(',');
|
||||||
|
|
||||||
|
if (!protocols) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = [];
|
||||||
|
$(protocols).each(function() {
|
||||||
|
data.push({id: this.valueOf(), name: this.valueOf(), description: _l('label.lb.protocol.' + this.valueOf())});
|
||||||
|
});
|
||||||
|
|
||||||
|
protocolCapabilities = $.grep(
|
||||||
|
lbService.capability,
|
||||||
|
function(capability) {
|
||||||
|
return (capability.name == 'SslTermination' && (capability.value == 'true' || capability.value == true));
|
||||||
|
}
|
||||||
|
)[0];
|
||||||
|
|
||||||
|
if (!protocolCapabilities) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var protocols = protocolCapabilities.value.split(',');
|
||||||
|
|
||||||
|
if (!protocols) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(protocols).each(function() {
|
||||||
|
data.push({id: 'ssl', name: 'ssl', description: _l('label.lb.protocol.ssl')});
|
||||||
|
});
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
})(cloudStack, jQuery);
|
})(cloudStack, jQuery);
|
||||||
|
|||||||
@ -159,6 +159,9 @@
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
path: 'regions.NCC',
|
||||||
|
label: 'label.ncc'
|
||||||
}],
|
}],
|
||||||
actions: {
|
actions: {
|
||||||
edit: {
|
edit: {
|
||||||
@ -258,6 +261,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
GSLB: {
|
GSLB: {
|
||||||
id: 'GSLB',
|
id: 'GSLB',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
@ -1021,6 +1025,224 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
NCC: {
|
||||||
|
id: 'NCC',
|
||||||
|
type: 'select',
|
||||||
|
title: 'NCC',
|
||||||
|
listView: {
|
||||||
|
id: 'NCC',
|
||||||
|
label: 'label.ncc',
|
||||||
|
|
||||||
|
fields: {
|
||||||
|
uuid: {
|
||||||
|
label: 'label.id'
|
||||||
|
},
|
||||||
|
ipaddress: {
|
||||||
|
label: 'label.ipaddress'
|
||||||
|
},
|
||||||
|
numretries: {
|
||||||
|
label: 'label.numretries'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
add: {
|
||||||
|
label: 'label.action.register.ncc',
|
||||||
|
|
||||||
|
preFilter: function(args) {
|
||||||
|
var isRegisterButtonShown = false;
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: createURL('listNetscalerControlCenter'),
|
||||||
|
async: false,
|
||||||
|
success: function(json) {
|
||||||
|
isRegisterButtonShown = json.listNetscalerControlCenter.netscalercontrolcenter ? false : true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return isRegisterButtonShown;
|
||||||
|
},
|
||||||
|
|
||||||
|
messages: {
|
||||||
|
confirm: function(args) {
|
||||||
|
return 'label.action.register.ncc';
|
||||||
|
},
|
||||||
|
notification: function(args) {
|
||||||
|
return 'label.action.register.ncc';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
createForm: {
|
||||||
|
title: 'label.action.register.ncc',
|
||||||
|
fields: {
|
||||||
|
ipaddress: {
|
||||||
|
label: 'label.ipaddress',
|
||||||
|
validation: {
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
username: {
|
||||||
|
label: 'label.username',
|
||||||
|
validation : {
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
password: {
|
||||||
|
label: 'label.password',
|
||||||
|
isPassword: true,
|
||||||
|
validation : {
|
||||||
|
required: true,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
numretries: {
|
||||||
|
label: 'label.numretries',
|
||||||
|
defaultValue: '2',
|
||||||
|
validation : {
|
||||||
|
required: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
action: function(args) {
|
||||||
|
var $loading = $('<div>').addClass('loading-overlay');
|
||||||
|
$('.system-dashboard-view:visible').prepend($loading);
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
ipaddress: args.data.ipaddress,
|
||||||
|
username: args.data.username,
|
||||||
|
password: args.data.password,
|
||||||
|
numretries: args.data.numretries
|
||||||
|
};
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: createURL('registerNetscalerControlCenter'),
|
||||||
|
data: data,
|
||||||
|
dataType: 'json',
|
||||||
|
type: "POST",
|
||||||
|
success: function(json) {
|
||||||
|
var jid = json.registernetscalercontrolcenterresponse.jobid;
|
||||||
|
var registerNetscalerControlCenterIntervalID = setInterval(function() {
|
||||||
|
$.ajax({
|
||||||
|
url: createURL("queryAsyncJobResult&jobId=" + jid),
|
||||||
|
dataType: "json",
|
||||||
|
success: function(json) {
|
||||||
|
var result = json.queryasyncjobresultresponse;
|
||||||
|
if (result.jobstatus == 0) {
|
||||||
|
return; //Job has not completed
|
||||||
|
} else {
|
||||||
|
clearInterval(registerNetscalerControlCenterIntervalID);
|
||||||
|
if (result.jobstatus == 1) {
|
||||||
|
cloudStack.dialog.notice({
|
||||||
|
message: 'message.register.succeeded'
|
||||||
|
});
|
||||||
|
$loading.remove();
|
||||||
|
} else if (result.jobstatus == 2) {
|
||||||
|
cloudStack.dialog.notice({
|
||||||
|
message: _l('message.register.failed') + ' ' + _s(result.jobresult.errortext)
|
||||||
|
});
|
||||||
|
$loading.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(XMLHttpResponse) {
|
||||||
|
cloudStack.dialog.notice({
|
||||||
|
message: _l('message.register.failed') + ' ' + parseXMLHttpResponse(XMLHttpResponse)
|
||||||
|
});
|
||||||
|
$loading.remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, g_queryAsyncJobResultInterval);
|
||||||
|
},
|
||||||
|
error: function(XMLHttpResponse) {
|
||||||
|
cloudStack.dialog.notice({
|
||||||
|
message: _l('message.register.failed') + ' ' + parseXMLHttpResponse(XMLHttpResponse)
|
||||||
|
});
|
||||||
|
$loading.remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
notification: {
|
||||||
|
poll: pollAsyncJobResult
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
dataProvider: function(args) {
|
||||||
|
$.ajax({
|
||||||
|
url: createURL('listNetscalerControlCenter'),
|
||||||
|
success: function(json) {
|
||||||
|
var item = json.listNetscalerControlCenter.netscalercontrolcenter ? json.listNetscalerControlCenter.netscalercontrolcenter : null;
|
||||||
|
args.response.success({
|
||||||
|
data: item
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
detailView: {
|
||||||
|
name: 'label.ncc.details',
|
||||||
|
actions: {
|
||||||
|
remove: {
|
||||||
|
label: 'label.ncc.delete',
|
||||||
|
messages: {
|
||||||
|
confirm: function(args) {
|
||||||
|
return 'message.ncc.delete.confirm';
|
||||||
|
},
|
||||||
|
notification: function(args) {
|
||||||
|
return 'label.ncc.delete';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
action: function(args) {
|
||||||
|
var data = {
|
||||||
|
id: args.context.NCC[0].uuid
|
||||||
|
};
|
||||||
|
$.ajax({
|
||||||
|
url: createURL("deleteNetscalerControlCenter"),
|
||||||
|
data: data,
|
||||||
|
success: function(json) {
|
||||||
|
var status = json.deleteNetscalerControlCenter ? json.deleteNetscalerControlCenter.success : null;
|
||||||
|
args.response.success({
|
||||||
|
data: status
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tabs: {
|
||||||
|
details: {
|
||||||
|
title: 'label.details',
|
||||||
|
fields: [{
|
||||||
|
uuid: {
|
||||||
|
label: 'label.id'
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
ipaddress: {
|
||||||
|
label: 'label.ipaddress'
|
||||||
|
},
|
||||||
|
numretries: {
|
||||||
|
label: 'label.numretries',
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
dataProvider: function(args) {
|
||||||
|
$.ajax({
|
||||||
|
url: createURL('listNetscalerControlCenter'),
|
||||||
|
success: function(json) {
|
||||||
|
var item = json.listNetscalerControlCenter.netscalercontrolcenter ? json.listNetscalerControlCenter.netscalercontrolcenter[0] : null;
|
||||||
|
args.response.success({
|
||||||
|
data: item
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
55
ui/scripts/system.js
Normal file → Executable file
55
ui/scripts/system.js
Normal file → Executable file
@ -21472,6 +21472,61 @@
|
|||||||
nspMap[id]: {
|
nspMap[id]: {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (id == "netscaler") {
|
||||||
|
var netscalerControlCenter = null;
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: createURL("listNetscalerControlCenter"),
|
||||||
|
dataType: "json",
|
||||||
|
async: false,
|
||||||
|
success: function(json) {
|
||||||
|
var items = json.listNetscalerControlCenter.netscalercontrolcenter;
|
||||||
|
if (items != null && items.length > 0) {
|
||||||
|
netscalerControlCenter = items[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (netscalerControlCenter != null) {
|
||||||
|
if (jsonObj.state == undefined) {
|
||||||
|
$.ajax({
|
||||||
|
url: createURL("addNetworkServiceProvider&name=Netscaler&physicalnetworkid=" + selectedPhysicalNetworkObj.id),
|
||||||
|
dataType: "json",
|
||||||
|
async: true,
|
||||||
|
success: function (json) {
|
||||||
|
var jobId = json.addnetworkserviceproviderresponse.jobid;
|
||||||
|
var addNetscalerProviderIntervalID = setInterval(function () {
|
||||||
|
$.ajax({
|
||||||
|
url: createURL("queryAsyncJobResult&jobId=" + jobId),
|
||||||
|
dataType: "json",
|
||||||
|
success: function (json) {
|
||||||
|
var result = json.queryasyncjobresultresponse;
|
||||||
|
if (result.jobstatus == 0) {
|
||||||
|
return; //Job has not completed
|
||||||
|
} else {
|
||||||
|
clearInterval(addNetscalerProviderIntervalID);
|
||||||
|
if (result.jobstatus == 1) {
|
||||||
|
nspMap[ "netscaler"] = result.jobresult.networkserviceprovider;
|
||||||
|
addExternalLoadBalancer(args, selectedPhysicalNetworkObj, "addNetscalerLoadBalancer", "addnetscalerloadbalancerresponse", "netscalerloadbalancer");
|
||||||
|
} else if (result.jobstatus == 2) {
|
||||||
|
alert("addNetworkServiceProvider&name=Netscaler failed. Error: " + _s(result.jobresult.errortext));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (XMLHttpResponse) {
|
||||||
|
var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
|
||||||
|
alert("addNetworkServiceProvider&name=Netscaler failed. Error: " + errorMsg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
g_queryAsyncJobResultInterval);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
jsonObj.state = "Disabled";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (jsonObj.state) {
|
if (jsonObj.state) {
|
||||||
if (jsonObj.state == "Enabled")
|
if (jsonObj.state == "Enabled")
|
||||||
allowedActions.push("disable"); else if (jsonObj.state == "Disabled")
|
allowedActions.push("disable"); else if (jsonObj.state == "Disabled")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user