mirror of https://github.com/apache/cloudstack.git
InternalLB:
1) Added new set of Interfaces - including the new VO - for the internal load balancer 2) DB change - added source_ip_address/source_ip_address_network_id/scheme (Internal/Public) fields to the load_balancer table
This commit is contained in:
parent
f66b9b570f
commit
08f855d4e4
|
|
@ -49,7 +49,8 @@ public interface AsyncJob extends Identity, InternalIdentity {
|
|||
AutoScalePolicy,
|
||||
AutoScaleVmProfile,
|
||||
AutoScaleVmGroup,
|
||||
GlobalLoadBalancerRule
|
||||
GlobalLoadBalancerRule,
|
||||
LoadBalancerRule
|
||||
}
|
||||
|
||||
long getUserId();
|
||||
|
|
|
|||
|
|
@ -89,5 +89,7 @@ public interface IpAddress extends ControlledEntity, Identity, InternalIdentity
|
|||
void setVpcId(Long vpcId);
|
||||
String getVmIp();
|
||||
void setVmIp(String vmIp);
|
||||
|
||||
Long getNetworkId();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -263,4 +263,7 @@ public interface NetworkModel {
|
|||
boolean isProviderEnabledInZone(long zoneId, String provider);
|
||||
|
||||
Nic getPlaceholderNicForRouter(Network network, Long podId);
|
||||
|
||||
IpAddress getPublicIpAddress(String ipAddress, long networkId);
|
||||
|
||||
}
|
||||
|
|
@ -27,7 +27,7 @@ import com.cloud.network.rules.FirewallRule;
|
|||
import com.cloud.network.rules.LoadBalancer;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
public class LoadBalancingRule implements FirewallRule, LoadBalancer {
|
||||
public class LoadBalancingRule {
|
||||
private LoadBalancer lb;
|
||||
private List<LbDestination> destinations;
|
||||
private List<LbStickinessPolicy> stickinessPolicies;
|
||||
|
|
@ -42,94 +42,66 @@ public class LoadBalancingRule implements FirewallRule, LoadBalancer {
|
|||
this.healthCheckPolicies = healthCheckPolicies;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getId() {
|
||||
return lb.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAccountId() {
|
||||
return lb.getAccountId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDomainId() {
|
||||
return lb.getDomainId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return lb.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return lb.getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDefaultPortStart() {
|
||||
return lb.getDefaultPortStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDefaultPortEnd() {
|
||||
return lb.getDefaultPortEnd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAlgorithm() {
|
||||
return lb.getAlgorithm();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
return lb.getUuid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getXid() {
|
||||
return lb.getXid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getSourceIpAddressId() {
|
||||
return lb.getSourceIpAddressId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getSourcePortStart() {
|
||||
return lb.getSourcePortStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getSourcePortEnd() {
|
||||
return lb.getSourcePortEnd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProtocol() {
|
||||
return lb.getProtocol();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Purpose getPurpose() {
|
||||
return Purpose.LoadBalancing;
|
||||
public FirewallRule.Purpose getPurpose() {
|
||||
return FirewallRule.Purpose.LoadBalancing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public State getState() {
|
||||
public FirewallRule.State getState() {
|
||||
return lb.getState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getNetworkId() {
|
||||
return lb.getNetworkId();
|
||||
}
|
||||
|
||||
public LoadBalancer getLb() {
|
||||
return lb;
|
||||
}
|
||||
|
||||
public void setDestinations(List<LbDestination> destinations) {
|
||||
this.destinations = destinations;
|
||||
|
|
@ -287,36 +259,6 @@ public class LoadBalancingRule implements FirewallRule, LoadBalancer {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getIcmpCode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getIcmpType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getSourceCidrList() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getRelated() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TrafficType getTrafficType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FirewallRuleType getType() {
|
||||
return FirewallRuleType.User;
|
||||
}
|
||||
|
||||
public LbAutoScaleVmGroup getAutoScaleVmGroup() {
|
||||
return autoScaleVmGroup;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@
|
|||
package com.cloud.network.lb;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLBHealthCheckPolicyCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLBStickinessPolicyCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLoadBalancerRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.ListLBHealthCheckPoliciesCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.ListLBStickinessPoliciesCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.ListLoadBalancerRuleInstancesCmd;
|
||||
|
|
@ -30,12 +30,12 @@ import org.apache.cloudstack.api.command.user.loadbalancer.UpdateLoadBalancerRul
|
|||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.lb.LoadBalancingRule.LbStickinessPolicy;
|
||||
import com.cloud.network.rules.HealthCheckPolicy;
|
||||
import com.cloud.network.rules.LoadBalancer;
|
||||
import com.cloud.network.rules.StickinessPolicy;
|
||||
import com.cloud.uservm.UserVm;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.net.Ip;
|
||||
|
||||
|
||||
public interface LoadBalancingRulesService {
|
||||
|
|
@ -49,7 +49,9 @@ public interface LoadBalancingRulesService {
|
|||
* @return the newly created LoadBalancerVO if successful, null otherwise
|
||||
* @throws InsufficientAddressCapacityException
|
||||
*/
|
||||
LoadBalancer createLoadBalancerRule(CreateLoadBalancerRuleCmd lb, boolean openFirewall) throws NetworkRuleConflictException, InsufficientAddressCapacityException;
|
||||
LoadBalancer createPublicLoadBalancerRule(String xId, String name, String description,
|
||||
int srcPortStart, int srcPortEnd, int defPortStart, int defPortEnd, Long ipAddrId, String protocol, String algorithm,
|
||||
long networkId, long lbOwnerId, boolean openFirewall) throws NetworkRuleConflictException, InsufficientAddressCapacityException;
|
||||
|
||||
LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd);
|
||||
|
||||
|
|
@ -134,8 +136,9 @@ public interface LoadBalancingRulesService {
|
|||
|
||||
List<? extends HealthCheckPolicy> searchForLBHealthCheckPolicies(ListLBHealthCheckPoliciesCmd cmd);
|
||||
|
||||
List<LoadBalancingRule> listByNetworkId(long networkId);
|
||||
|
||||
LoadBalancer findById(long LoadBalancer);
|
||||
public void updateLBHealthChecks() throws ResourceUnavailableException;
|
||||
|
||||
public void updateLBHealthChecks() throws ResourceUnavailableException;
|
||||
|
||||
Map<Ip, UserVm> getLbInstances(long lbId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
// 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.rules;
|
||||
|
||||
import com.cloud.utils.net.Ip;
|
||||
|
||||
public interface ApplicationLoadBalancerContainer extends LoadBalancerContainer{
|
||||
|
||||
public String getSourceIpNetworkUuid();
|
||||
|
||||
public Ip getSourceIpAddress();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
// 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.rules;
|
||||
|
||||
public interface ApplicationLoadBalancerRule extends ApplicationLoadBalancerContainer, LoadBalancer{
|
||||
int getInstancePort();
|
||||
}
|
||||
|
|
@ -19,16 +19,10 @@ package com.cloud.network.rules;
|
|||
/**
|
||||
* Definition for a LoadBalancer
|
||||
*/
|
||||
public interface LoadBalancer extends FirewallRule {
|
||||
|
||||
String getName();
|
||||
|
||||
String getDescription();
|
||||
|
||||
public interface LoadBalancer extends FirewallRule, LoadBalancerContainer {
|
||||
|
||||
int getDefaultPortStart();
|
||||
|
||||
int getDefaultPortEnd();
|
||||
|
||||
String getAlgorithm();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
// 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.rules;
|
||||
|
||||
public interface LoadBalancerContainer {
|
||||
|
||||
public enum Scheme {
|
||||
Public, Internal;
|
||||
}
|
||||
|
||||
String getName();
|
||||
|
||||
String getDescription();
|
||||
|
||||
String getAlgorithm();
|
||||
|
||||
Scheme getScheme();
|
||||
|
||||
}
|
||||
|
|
@ -473,6 +473,11 @@ public class ApiConstants {
|
|||
public static final String HEALTHCHECK_HEALTHY_THRESHOLD = "healthythreshold";
|
||||
public static final String HEALTHCHECK_UNHEALTHY_THRESHOLD = "unhealthythreshold";
|
||||
public static final String HEALTHCHECK_PINGPATH = "pingpath";
|
||||
public static final String SOURCE_PORT = "sourceport";
|
||||
public static final String INSTANCE_PORT = "instanceport";
|
||||
public static final String SOURCE_IP = "sourceipaddress";
|
||||
public static final String SOURCE_IP_NETWORK_ID = "sourceipaddressnetworkid";
|
||||
public static final String SCHEME = "scheme";
|
||||
|
||||
public enum HostDetails {
|
||||
all, capacity, events, stats, min;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import java.util.regex.Pattern;
|
|||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.network.lb.ApplicationLoadBalancerService;
|
||||
import org.apache.cloudstack.query.QueryService;
|
||||
import org.apache.cloudstack.usage.UsageService;
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
@ -41,6 +42,7 @@ import com.cloud.exception.NetworkRuleConflictException;
|
|||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.NetworkModel;
|
||||
import com.cloud.network.NetworkService;
|
||||
import com.cloud.network.NetworkUsageService;
|
||||
import com.cloud.network.StorageNetworkService;
|
||||
|
|
@ -132,6 +134,9 @@ public abstract class BaseCmd {
|
|||
@Inject public VMSnapshotService _vmSnapshotService;
|
||||
@Inject public DataStoreProviderApiService dataStoreProviderApiService;
|
||||
@Inject public VpcProvisioningService _vpcProvSvc;
|
||||
@Inject public ApplicationLoadBalancerService _newLbSvc;
|
||||
@Inject public NetworkModel _ntwkModel;
|
||||
@Inject public ApplicationLoadBalancerService _appLbService;
|
||||
|
||||
public abstract void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException;
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package org.apache.cloudstack.api;
|
|||
import java.text.DecimalFormat;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants.HostDetails;
|
||||
import org.apache.cloudstack.api.ApiConstants.VMDetails;
|
||||
|
|
@ -50,6 +51,7 @@ import org.apache.cloudstack.api.response.IpForwardingRuleResponse;
|
|||
import org.apache.cloudstack.api.response.LBHealthCheckResponse;
|
||||
import org.apache.cloudstack.api.response.LBStickinessResponse;
|
||||
import org.apache.cloudstack.api.response.LDAPConfigResponse;
|
||||
import org.apache.cloudstack.api.response.ApplicationLoadBalancerResponse;
|
||||
import org.apache.cloudstack.api.response.LoadBalancerResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkACLResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkOfferingResponse;
|
||||
|
|
@ -148,6 +150,7 @@ import com.cloud.user.Account;
|
|||
import com.cloud.user.User;
|
||||
import com.cloud.user.UserAccount;
|
||||
import com.cloud.uservm.UserVm;
|
||||
import com.cloud.utils.net.Ip;
|
||||
import com.cloud.vm.InstanceGroup;
|
||||
import com.cloud.vm.Nic;
|
||||
import com.cloud.vm.NicSecondaryIp;
|
||||
|
|
@ -392,4 +395,6 @@ public interface ResponseGenerator {
|
|||
NicSecondaryIpResponse createSecondaryIPToNicResponse(String ip,
|
||||
Long nicId, Long networkId);
|
||||
public NicResponse createNicResponse(Nic result);
|
||||
|
||||
ApplicationLoadBalancerResponse createLoadBalancerContainerReponse(LoadBalancer lb, Map<Ip, UserVm> lbInstances);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,240 @@
|
|||
// 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 org.apache.cloudstack.api.command.user.loadbalancer;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.ApplicationLoadBalancerResponse;
|
||||
import org.apache.cloudstack.api.response.DomainResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
import com.cloud.network.rules.LoadBalancer;
|
||||
import com.cloud.network.rules.LoadBalancerContainer.Scheme;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
|
||||
@APICommand(name = "createLoadBalancer", description="Creates a Load Balancer", responseObject=ApplicationLoadBalancerResponse.class)
|
||||
public class CreateApplicationLoadBalancerCmd extends BaseAsyncCreateCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CreateApplicationLoadBalancerCmd.class.getName());
|
||||
|
||||
private static final String s_name = "createloadbalancerresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="name of the Load Balancer")
|
||||
private String loadBalancerName;
|
||||
|
||||
@Parameter(name=ApiConstants.DESCRIPTION, type=CommandType.STRING, description="the description of the Load Balancer", length=4096)
|
||||
private String description;
|
||||
|
||||
@Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, required=true, entityType = NetworkResponse.class,
|
||||
description="The guest network the Load Balancer will be created for")
|
||||
private Long networkId;
|
||||
|
||||
@Parameter(name=ApiConstants.SOURCE_PORT, type=CommandType.INTEGER, required=true, description="the source port the network traffic will be load balanced from")
|
||||
private Integer sourcePort;
|
||||
|
||||
@Parameter(name=ApiConstants.ALGORITHM, type=CommandType.STRING, required=true, description="load balancer algorithm (source, roundrobin, leastconn)")
|
||||
private String algorithm;
|
||||
|
||||
@Parameter(name=ApiConstants.INSTANCE_PORT, type=CommandType.INTEGER, required=true, description="the TCP port of the virtual machine where the network traffic will be load balanced to")
|
||||
private Integer instancePort;
|
||||
|
||||
@Parameter(name=ApiConstants.SOURCE_IP, type=CommandType.STRING, description="the source ip address the network traffic will be load balanced from")
|
||||
private String sourceIp;
|
||||
|
||||
@Parameter(name=ApiConstants.SOURCE_IP_NETWORK_ID, type=CommandType.LONG, required=true, description="the network id of the source ip address")
|
||||
private Long sourceIpNetworkId;
|
||||
|
||||
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account associated with the load balancer." +
|
||||
" Must be used with the domainId parameter.")
|
||||
private String accountName;
|
||||
|
||||
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType = DomainResponse.class,
|
||||
description="the domain ID associated with the load balancer")
|
||||
private Long domainId;
|
||||
|
||||
@Parameter(name=ApiConstants.SCHEME, type=CommandType.STRING, required=true, description="the load balancer scheme. Supported value in this release is Internal")
|
||||
private String scheme;
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getAlgorithm() {
|
||||
return algorithm;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public String getLoadBalancerName() {
|
||||
return loadBalancerName;
|
||||
}
|
||||
|
||||
public Integer getPrivatePort() {
|
||||
return instancePort;
|
||||
}
|
||||
|
||||
|
||||
public long getNetworkId() {
|
||||
return networkId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return loadBalancerName;
|
||||
}
|
||||
|
||||
public Integer getSourcePort() {
|
||||
return sourcePort.intValue();
|
||||
}
|
||||
|
||||
public String getProtocol() {
|
||||
return NetUtils.TCP_PROTO;
|
||||
}
|
||||
|
||||
public long getAccountId() {
|
||||
Account account = null;
|
||||
//get account info from the network object if it's a guest network
|
||||
Network ntwk = _networkService.getNetwork(networkId);
|
||||
if (ntwk.getTrafficType() == TrafficType.Guest){
|
||||
return ntwk.getAccountId();
|
||||
} else if (sourceIp != null) {
|
||||
//get account info from the ip address object if the traffic type is public
|
||||
|
||||
} if ((domainId != null) && (accountName != null)) {
|
||||
account = _responseGenerator.findAccountByNameDomain(accountName, domainId);
|
||||
if (account != null) {
|
||||
return account.getId();
|
||||
} else {
|
||||
throw new InvalidParameterValueException("Unable to find account " + account + " in domain id=" + domainId);
|
||||
}
|
||||
} else {
|
||||
throw new InvalidParameterValueException("Can't define the Load Balancer owner. Either specify guest" +
|
||||
" network in networkId, or Public Ip address in sourceIpAddress, or account/domainId parameters");
|
||||
}
|
||||
}
|
||||
|
||||
public int getInstancePort() {
|
||||
return instancePort.intValue();
|
||||
}
|
||||
|
||||
public String getAccountName() {
|
||||
return accountName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_LOAD_BALANCER_CREATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "creating load balancer: " + getName() + " account: " + getAccountName();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.LoadBalancerRule;
|
||||
}
|
||||
|
||||
public String getSourceIp() {
|
||||
return sourceIp;
|
||||
}
|
||||
|
||||
public long getSourceIpNetworkId() {
|
||||
return sourceIpNetworkId;
|
||||
}
|
||||
|
||||
public Scheme getScheme() {
|
||||
if (scheme.equalsIgnoreCase(Scheme.Internal.toString())) {
|
||||
return Scheme.Internal;
|
||||
} else {
|
||||
throw new InvalidParameterValueException("Invalid value for sheme. Supported value is Internal");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
return getAccountId();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws ResourceAllocationException, ResourceUnavailableException {
|
||||
LoadBalancer rule = null;
|
||||
try {
|
||||
UserContext.current().setEventDetails("Load Balancer Id: " + getEntityId());
|
||||
// State might be different after the rule is applied, so get new object here
|
||||
rule = _entityMgr.findById(LoadBalancer.class, getEntityId());
|
||||
ApplicationLoadBalancerResponse lbResponse = _responseGenerator.createLoadBalancerContainerReponse(rule, _lbService.getLbInstances(getEntityId()));
|
||||
setResponseObject(lbResponse);
|
||||
lbResponse.setResponseName(getCommandName());
|
||||
} catch (Exception ex) {
|
||||
s_logger.warn("Failed to create Load Balancer due to exception ", ex);
|
||||
} finally {
|
||||
if (rule == null) {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Load Balancer");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create() {
|
||||
try {
|
||||
|
||||
LoadBalancer result = _appLbService.createApplicationLoadBalancer(getName(), getDescription(), getScheme(), getSourceIpNetworkId(), getSourceIp(), getSourcePort(),
|
||||
getInstancePort(), getAlgorithm(), getNetworkId(), getEntityOwnerId());
|
||||
this.setEntityId(result.getId());
|
||||
this.setEntityUuid(result.getUuid());
|
||||
}catch (NetworkRuleConflictException e) {
|
||||
s_logger.warn("Exception: ", e);
|
||||
throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
|
||||
} catch (InsufficientAddressCapacityException e) {
|
||||
s_logger.warn("Exception: ", e);
|
||||
throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -148,7 +148,7 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements
|
|||
}
|
||||
|
||||
|
||||
public Long getNetworkId() {
|
||||
public long getNetworkId() {
|
||||
if (networkId != null) {
|
||||
return networkId;
|
||||
}
|
||||
|
|
@ -278,7 +278,9 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements
|
|||
throw new InvalidParameterValueException("Parameter cidrList is deprecated; if you need to open firewall rule for the specific cidr, please refer to createFirewallRule command");
|
||||
}
|
||||
try {
|
||||
LoadBalancer result = _lbService.createLoadBalancerRule(this, getOpenFirewall());
|
||||
LoadBalancer result = _lbService.createPublicLoadBalancerRule(getXid(), getName(), getDescription(),
|
||||
getSourcePortStart(), getSourcePortEnd(), getDefaultPortStart(), getDefaultPortEnd(), getSourceIpAddressId(), getProtocol(), getAlgorithm(),
|
||||
getNetworkId(), getEntityOwnerId(), getOpenFirewall());
|
||||
this.setEntityId(result.getId());
|
||||
this.setEntityUuid(result.getUuid());
|
||||
} catch (NetworkRuleConflictException e) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,116 @@
|
|||
// 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 org.apache.cloudstack.api.command.user.loadbalancer;
|
||||
|
||||
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.FirewallRuleResponse;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.network.rules.LoadBalancer;
|
||||
import com.cloud.user.UserContext;
|
||||
|
||||
@APICommand(name = "deleteLoadBalancer", description="Deletes a load balancer", responseObject=SuccessResponse.class)
|
||||
public class DeleteApplicationLoadBalancerCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteApplicationLoadBalancerCmd.class.getName());
|
||||
private static final String s_name = "deleteloadbalancerresponse";
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = FirewallRuleResponse.class,
|
||||
required=true, description="the ID of the Load Balancer")
|
||||
private Long id;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
LoadBalancer lb = _entityMgr.findById(LoadBalancer.class, getId());
|
||||
if (lb != null) {
|
||||
return lb.getAccountId();
|
||||
} else {
|
||||
throw new InvalidParameterValueException("Can't find load balancer by id specified");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_LOAD_BALANCER_DELETE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "deleting load balancer: " + getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
UserContext.current().setEventDetails("Load balancer Id: " + getId());
|
||||
boolean result = _appLbService.deleteApplicationLoadBalancer(getId());
|
||||
|
||||
if (result) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete load balancer");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyncObjType() {
|
||||
return BaseAsyncCmd.networkSyncObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getSyncObjId() {
|
||||
LoadBalancer lb = _lbService.findById(id);
|
||||
if(lb == null){
|
||||
throw new InvalidParameterValueException("Unable to find load balancer by id ");
|
||||
}
|
||||
return lb.getNetworkId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.FirewallRule;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
// 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 org.apache.cloudstack.api.command.user.loadbalancer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.response.ApplicationLoadBalancerResponse;
|
||||
import org.apache.cloudstack.api.response.FirewallRuleResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.network.rules.ApplicationLoadBalancerRule;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
@APICommand(name = "listLoadBalancers", description = "Lists Load Balancers", responseObject = ApplicationLoadBalancerResponse.class)
|
||||
public class ListApplicationLoadBalancersCmd extends BaseListTaggedResourcesCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListLoadBalancerRulesCmd.class.getName());
|
||||
|
||||
private static final String s_name = "listloadbalancerssresponse";
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ////////////// API parameters /////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class,
|
||||
description = "the ID of the Load Balancer")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the Load Balancer")
|
||||
private String loadBalancerName;
|
||||
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////////// Accessors ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getLoadBalancerRuleName() {
|
||||
return loadBalancerName;
|
||||
}
|
||||
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////// API Implementation///////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
Pair<List<? extends ApplicationLoadBalancerRule>, Integer> loadBalancers = _appLbService.listApplicationLoadBalancers();
|
||||
ListResponse<ApplicationLoadBalancerResponse> response = new ListResponse<ApplicationLoadBalancerResponse>();
|
||||
List<ApplicationLoadBalancerResponse> lbResponses = new ArrayList<ApplicationLoadBalancerResponse>();
|
||||
for (ApplicationLoadBalancerRule loadBalancer : loadBalancers.first()) {
|
||||
ApplicationLoadBalancerResponse lbResponse = _responseGenerator.createLoadBalancerContainerReponse(loadBalancer, _lbService.getLbInstances(loadBalancer.getId()));
|
||||
lbResponse.setObjectName("loadbalancer");
|
||||
lbResponses.add(lbResponse);
|
||||
}
|
||||
response.setResponses(lbResponses, loadBalancers.second());
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
// 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 org.apache.cloudstack.api.response;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
*
|
||||
* Load Balancer instance is the User Vm instance participating in the Load Balancer
|
||||
*
|
||||
*/
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class ApplicationLoadBalancerInstanceResponse extends BaseResponse{
|
||||
|
||||
@SerializedName(ApiConstants.ID) @Param(description = "the instance ID")
|
||||
private String id;
|
||||
|
||||
@SerializedName(ApiConstants.NAME) @Param(description = "the name of the instance")
|
||||
private String name;
|
||||
|
||||
@SerializedName(ApiConstants.STATE) @Param(description="the state of the instance")
|
||||
private String state;
|
||||
|
||||
@SerializedName(ApiConstants.IP_ADDRESS)
|
||||
@Param(description="the ip address of the instance")
|
||||
private String ipAddress;
|
||||
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public void setIpAddress(String ipAddress) {
|
||||
this.ipAddress = ipAddress;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
// 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 org.apache.cloudstack.api.response;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class ApplicationLoadBalancerResponse extends BaseResponse implements ControlledEntityResponse{
|
||||
@SerializedName(ApiConstants.ID) @Param(description = "the Load Balancer ID")
|
||||
private String id;
|
||||
|
||||
@SerializedName(ApiConstants.NAME) @Param(description = "the name of the Load Balancer")
|
||||
private String name;
|
||||
|
||||
@SerializedName(ApiConstants.DESCRIPTION) @Param(description = "the description of the Load Balancer")
|
||||
private String description;
|
||||
|
||||
@SerializedName(ApiConstants.ALGORITHM) @Param(description = "the load balancer algorithm (source, roundrobin, leastconn)")
|
||||
private String algorithm;
|
||||
|
||||
@SerializedName(ApiConstants.NETWORK_ID) @Param(description="Load Balancer network id")
|
||||
private String networkId;
|
||||
|
||||
@SerializedName(ApiConstants.SOURCE_IP) @Param(description="Load Balancer source ip")
|
||||
private String sourceIp;
|
||||
|
||||
@SerializedName(ApiConstants.SOURCE_IP_NETWORK_ID) @Param(description="Load Balancer source ip network id")
|
||||
private String sourceIpNetworkId;
|
||||
|
||||
@SerializedName(ApiConstants.ACCOUNT)
|
||||
@Param(description = "the account of the Load Balancer")
|
||||
private String accountName;
|
||||
|
||||
@SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the Load Balancer")
|
||||
private String projectId;
|
||||
|
||||
@SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the Load Balancer")
|
||||
private String projectName;
|
||||
|
||||
@SerializedName(ApiConstants.DOMAIN_ID)
|
||||
@Param(description = "the domain ID of the Load Balancer")
|
||||
private String domainId;
|
||||
|
||||
@SerializedName(ApiConstants.DOMAIN)
|
||||
@Param(description = "the domain of the Load Balancer")
|
||||
private String domainName;
|
||||
|
||||
@SerializedName("loadbalancerrule") @Param(description="the list of rules associated with the Load Balancer", responseObject = ApplicationLoadBalancerRuleResponse.class)
|
||||
private List<ApplicationLoadBalancerRuleResponse> lbRules;
|
||||
|
||||
@SerializedName("loadbalancerinstance") @Param(description="the list of instances associated with the Load Balancer", responseObject = ApplicationLoadBalancerInstanceResponse.class)
|
||||
private List<ApplicationLoadBalancerInstanceResponse> lbInstances;
|
||||
|
||||
@SerializedName(ApiConstants.TAGS) @Param(description="the list of resource tags associated with the Load Balancer", responseObject = ResourceTagResponse.class)
|
||||
private List<ResourceTagResponse> tags;
|
||||
|
||||
public void setAccountName(String accountName) {
|
||||
this.accountName = accountName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDomainId(String domainId) {
|
||||
this.domainId = domainId;
|
||||
}
|
||||
|
||||
public void setDomainName(String domainName) {
|
||||
this.domainName = domainName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProjectId(String projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
public void setTags(List<ResourceTagResponse> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setAlgorithm(String algorithm) {
|
||||
this.algorithm = algorithm;
|
||||
}
|
||||
|
||||
public void setNetworkId(String networkId) {
|
||||
this.networkId = networkId;
|
||||
}
|
||||
|
||||
public void setSourceIp(String sourceIp) {
|
||||
this.sourceIp = sourceIp;
|
||||
}
|
||||
|
||||
public void setSourceIpNetworkId(String sourceIpNetworkId) {
|
||||
this.sourceIpNetworkId = sourceIpNetworkId;
|
||||
}
|
||||
|
||||
public void setLbRules(List<ApplicationLoadBalancerRuleResponse> lbRules) {
|
||||
this.lbRules = lbRules;
|
||||
}
|
||||
|
||||
public void setLbInstances(List<ApplicationLoadBalancerInstanceResponse> lbInstances) {
|
||||
this.lbInstances = lbInstances;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
// 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 org.apache.cloudstack.api.response;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Subobject of the load balancer container response
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class ApplicationLoadBalancerRuleResponse extends BaseResponse{
|
||||
@SerializedName(ApiConstants.SOURCE_PORT) @Param(description = "source port of the load balancer rule")
|
||||
private Integer sourcePort;
|
||||
|
||||
@SerializedName(ApiConstants.INSTANCE_PORT) @Param(description = "instance port of the load balancer rule")
|
||||
private Integer instancePort;
|
||||
|
||||
@SerializedName(ApiConstants.STATE) @Param(description = "the state of the load balancer rule")
|
||||
private String state;
|
||||
|
||||
public void setSourcePort(Integer sourcePort) {
|
||||
this.sourcePort = sourcePort;
|
||||
}
|
||||
|
||||
public void setInstancePort(Integer instancePort) {
|
||||
this.instancePort = instancePort;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
// 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 org.apache.cloudstack.network.lb;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.network.rules.ApplicationLoadBalancerRule;
|
||||
import com.cloud.network.rules.LoadBalancerContainer.Scheme;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
public interface ApplicationLoadBalancerService {
|
||||
|
||||
ApplicationLoadBalancerRule createApplicationLoadBalancer(String name, String description, Scheme scheme, long sourceIpNetworkId, String sourceIp,
|
||||
int sourcePort, int instancePort, String algorithm, long networkId, long lbOwnerId) throws InsufficientAddressCapacityException,
|
||||
NetworkRuleConflictException;
|
||||
|
||||
boolean deleteApplicationLoadBalancer(long id);
|
||||
|
||||
Pair<List<? extends ApplicationLoadBalancerRule>, Integer> listApplicationLoadBalancers();
|
||||
|
||||
}
|
||||
|
|
@ -785,6 +785,8 @@
|
|||
<bean id="vMSnapshotManagerImpl" class="com.cloud.vm.snapshot.VMSnapshotManagerImpl" />
|
||||
<bean id="volumeManagerImpl" class="com.cloud.storage.VolumeManagerImpl" />
|
||||
<bean id="ClassicalPrimaryDataStoreProvider" class="org.apache.cloudstack.storage.datastore.provider.CloudStackPrimaryDataStoreProviderImpl" />
|
||||
<bean id="ApplicationLoadBalancerService" class="org.apache.cloudstack.network.lb.ApplicationLoadBalancerManagerImpl" />
|
||||
|
||||
|
||||
|
||||
<!--=======================================================================================================-->
|
||||
|
|
|
|||
|
|
@ -568,3 +568,9 @@ revertToSnapshot=15
|
|||
|
||||
#### Baremetal commands
|
||||
addBaremetalHost=1
|
||||
|
||||
#### New Load Balancer commands
|
||||
createLoadBalancer=15
|
||||
listLoadBalancers=15
|
||||
deleteLoadBalancer=15
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public interface ElasticLoadBalancerManager {
|
|||
public static final int DEFAULT_ELB_VM_CPU_MHZ = 256; // 500 MHz
|
||||
|
||||
public boolean applyLoadBalancerRules(Network network,
|
||||
List<? extends FirewallRule> rules)
|
||||
List<LoadBalancingRule> rules)
|
||||
throws ResourceUnavailableException;
|
||||
|
||||
public LoadBalancer handleCreateLoadBalancerRule(CreateLoadBalancerRuleCmd lb, Account caller, long networkId) throws InsufficientAddressCapacityException, NetworkRuleConflictException;
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ ElasticLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
|
|||
return sendCommandsToRouter(elbVm, cmds);
|
||||
}
|
||||
|
||||
protected DomainRouterVO findElbVmForLb(FirewallRule lb) {//TODO: use a table to lookup
|
||||
protected DomainRouterVO findElbVmForLb(LoadBalancingRule lb) {//TODO: use a table to lookup
|
||||
ElasticLbVmMapVO map = _elbVmMapDao.findOneByIp(lb.getSourceIpAddressId());
|
||||
if (map == null) {
|
||||
return null;
|
||||
|
|
@ -342,15 +342,11 @@ ElasticLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
|
|||
|
||||
@Override
|
||||
public boolean applyLoadBalancerRules(Network network,
|
||||
List<? extends FirewallRule> rules)
|
||||
List<LoadBalancingRule> rules)
|
||||
throws ResourceUnavailableException {
|
||||
if (rules == null || rules.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
if (rules.get(0).getPurpose() != Purpose.LoadBalancing) {
|
||||
s_logger.warn("ELB: Not handling non-LB firewall rules");
|
||||
return false;
|
||||
}
|
||||
|
||||
DomainRouterVO elbVm = findElbVmForLb(rules.get(0));
|
||||
|
||||
|
|
@ -656,7 +652,10 @@ ElasticLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
|
|||
LoadBalancer result = null;
|
||||
try {
|
||||
lb.setSourceIpAddressId(ipId);
|
||||
result = _lbMgr.createLoadBalancer(lb, false);
|
||||
|
||||
result = _lbMgr.createPublicLoadBalancer(lb.getXid(), lb.getName(), lb.getDescription(),
|
||||
lb.getSourcePortStart(), lb.getSourcePortEnd(), lb.getDefaultPortStart(), ipId.longValue(),
|
||||
lb.getProtocol(), lb.getAlgorithm(), false, UserContext.current());
|
||||
} catch (NetworkRuleConflictException e) {
|
||||
s_logger.warn("Failed to create LB rule, not continuing with ELB deployment");
|
||||
if (newIp) {
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@ import org.apache.cloudstack.api.BaseCmd;
|
|||
import org.apache.cloudstack.api.ResponseGenerator;
|
||||
import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd;
|
||||
import org.apache.cloudstack.api.response.AccountResponse;
|
||||
import org.apache.cloudstack.api.response.ApplicationLoadBalancerInstanceResponse;
|
||||
import org.apache.cloudstack.api.response.ApplicationLoadBalancerResponse;
|
||||
import org.apache.cloudstack.api.response.ApplicationLoadBalancerRuleResponse;
|
||||
import org.apache.cloudstack.api.response.AsyncJobResponse;
|
||||
import org.apache.cloudstack.api.response.AutoScalePolicyResponse;
|
||||
import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse;
|
||||
|
|
@ -204,10 +207,12 @@ import com.cloud.network.dao.IPAddressVO;
|
|||
import com.cloud.network.dao.NetworkVO;
|
||||
import com.cloud.network.dao.PhysicalNetworkVO;
|
||||
import com.cloud.network.router.VirtualRouter;
|
||||
import com.cloud.network.rules.ApplicationLoadBalancerRule;
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.network.rules.FirewallRuleVO;
|
||||
import com.cloud.network.rules.HealthCheckPolicy;
|
||||
import com.cloud.network.rules.LoadBalancer;
|
||||
import com.cloud.network.rules.LoadBalancerContainer.Scheme;
|
||||
import com.cloud.network.rules.PortForwardingRule;
|
||||
import com.cloud.network.rules.StaticNatRule;
|
||||
import com.cloud.network.rules.StickinessPolicy;
|
||||
|
|
@ -261,6 +266,7 @@ import com.cloud.user.UserContext;
|
|||
import com.cloud.uservm.UserVm;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.StringUtils;
|
||||
import com.cloud.utils.net.Ip;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
import com.cloud.vm.ConsoleProxyVO;
|
||||
import com.cloud.vm.InstanceGroup;
|
||||
|
|
@ -721,7 +727,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
}
|
||||
|
||||
//set tag information
|
||||
List<? extends ResourceTag> tags = ApiDBUtils.listByResourceTypeAndId(TaggedResourceType.UserVm, loadBalancer.getId());
|
||||
List<? extends ResourceTag> tags = ApiDBUtils.listByResourceTypeAndId(TaggedResourceType.LoadBalancer, loadBalancer.getId());
|
||||
List<ResourceTagResponse> tagResponses = new ArrayList<ResourceTagResponse>();
|
||||
for (ResourceTag tag : tags) {
|
||||
ResourceTagResponse tagResponse = createResourceTagResponse(tag, true);
|
||||
|
|
@ -3620,4 +3626,69 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
response.setIsDefault(result.isDefaultNic());
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationLoadBalancerResponse createLoadBalancerContainerReponse(LoadBalancer lb, Map<Ip, UserVm> lbInstances) {
|
||||
|
||||
ApplicationLoadBalancerResponse lbResponse = new ApplicationLoadBalancerResponse();
|
||||
lbResponse.setId(lb.getUuid());
|
||||
lbResponse.setName(lb.getName());
|
||||
lbResponse.setDescription(lb.getDescription());
|
||||
lbResponse.setAlgorithm(lb.getAlgorithm());
|
||||
Network nw = ApiDBUtils.findNetworkById(lb.getNetworkId());
|
||||
lbResponse.setNetworkId(nw.getUuid());
|
||||
populateOwner(lbResponse, lb);
|
||||
|
||||
if (lb.getScheme() == Scheme.Internal) {
|
||||
ApplicationLoadBalancerRule ruleInternal = (ApplicationLoadBalancerRule)lb;
|
||||
lbResponse.setSourceIp(ruleInternal.getSourceIpAddress().addr());
|
||||
lbResponse.setSourceIpNetworkId(ruleInternal.getSourceIpNetworkUuid());
|
||||
} else {
|
||||
//for public, populate the ip information from the ip address
|
||||
IpAddress publicIp = ApiDBUtils.findIpAddressById(lb.getSourceIpAddressId());
|
||||
lbResponse.setSourceIp(publicIp.getAddress().addr());
|
||||
Network ntwk = ApiDBUtils.findNetworkById(publicIp.getNetworkId());
|
||||
lbResponse.setSourceIpNetworkId(ntwk.getUuid());
|
||||
}
|
||||
|
||||
//set load balancer rules information (only one rule per load balancer in this release)
|
||||
List<ApplicationLoadBalancerRuleResponse> ruleResponses = new ArrayList<ApplicationLoadBalancerRuleResponse>();
|
||||
ApplicationLoadBalancerRuleResponse ruleResponse = new ApplicationLoadBalancerRuleResponse();
|
||||
ruleResponse.setInstancePort(lb.getDefaultPortStart());
|
||||
ruleResponse.setSourcePort(lb.getSourcePortStart());
|
||||
String stateToSet = lb.getState().toString();
|
||||
if (stateToSet.equals(FirewallRule.State.Revoke)) {
|
||||
stateToSet = "Deleting";
|
||||
}
|
||||
ruleResponse.setState(stateToSet);
|
||||
ruleResponse.setObjectName("loadbalancerrule");
|
||||
ruleResponses.add(ruleResponse);
|
||||
lbResponse.setLbRules(ruleResponses);
|
||||
|
||||
//set Lb instances information
|
||||
List<ApplicationLoadBalancerInstanceResponse> instanceResponses = new ArrayList<ApplicationLoadBalancerInstanceResponse>();
|
||||
for (Ip ip : lbInstances.keySet()) {
|
||||
ApplicationLoadBalancerInstanceResponse instanceResponse = new ApplicationLoadBalancerInstanceResponse();
|
||||
instanceResponse.setIpAddress(ip.addr());
|
||||
UserVm vm = lbInstances.get(ip);
|
||||
instanceResponse.setId(vm.getUuid());
|
||||
instanceResponse.setName(vm.getInstanceName());
|
||||
instanceResponse.setObjectName("loadbalancerinstance");
|
||||
instanceResponses.add(instanceResponse);
|
||||
}
|
||||
|
||||
lbResponse.setLbInstances(instanceResponses);
|
||||
|
||||
//set tag information
|
||||
List<? extends ResourceTag> tags = ApiDBUtils.listByResourceTypeAndId(TaggedResourceType.LoadBalancer, lb.getId());
|
||||
List<ResourceTagResponse> tagResponses = new ArrayList<ResourceTagResponse>();
|
||||
for (ResourceTag tag : tags) {
|
||||
ResourceTagResponse tagResponse = createResourceTagResponse(tag, true);
|
||||
tagResponses.add(tagResponse);
|
||||
}
|
||||
lbResponse.setTags(tagResponses);
|
||||
|
||||
lbResponse.setObjectName("loadbalancer");
|
||||
return lbResponse;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2033,4 +2033,9 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IpAddress getPublicIpAddress(String ipAddress, long networkId) {
|
||||
return _ipAddressDao.findByIpAndSourceNetworkId(networkId, ipAddress);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,78 @@
|
|||
// 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.dao;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.DiscriminatorValue;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.PrimaryKeyJoinColumn;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.cloud.network.rules.ApplicationLoadBalancerRule;
|
||||
import com.cloud.utils.net.Ip;
|
||||
|
||||
/**
|
||||
* This VO represent Internal Load Balancer rule.
|
||||
* Instead of pointing to the public ip address id directly as External Load Balancer rule does, it refers to the ip address by its value/sourceNetworkid
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
@Table(name=("load_balancing_rules"))
|
||||
@DiscriminatorValue(value="LoadBalancing")
|
||||
@PrimaryKeyJoinColumn(name="id")
|
||||
public class ApplicationLoadBalancerRuleVO extends LoadBalancerVO implements ApplicationLoadBalancerRule{
|
||||
|
||||
|
||||
@Column(name="source_ip_address_network_id")
|
||||
String sourceIpNetworkUuid;
|
||||
|
||||
@Id
|
||||
@Column(name="source_ip_address")
|
||||
@Enumerated(value=EnumType.STRING)
|
||||
private Ip sourceIpAddress = null;
|
||||
|
||||
|
||||
public ApplicationLoadBalancerRuleVO() {
|
||||
}
|
||||
|
||||
public ApplicationLoadBalancerRuleVO(String xId, String name, String description, int srcPort, int dstPort, String algorithm, long networkId,
|
||||
long accountId, long domainId, Ip sourceIp, String sourceIpNtwkUuid) {
|
||||
|
||||
super(xId, name, description, srcPort, dstPort, algorithm, networkId, accountId, domainId);
|
||||
this.sourceIpAddress = sourceIp;
|
||||
this.sourceIpNetworkUuid = sourceIpNtwkUuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSourceIpNetworkUuid() {
|
||||
return sourceIpNetworkUuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ip getSourceIpAddress() {
|
||||
return sourceIpAddress;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInstancePort() {
|
||||
return super.getDefaultPortStart();
|
||||
}
|
||||
}
|
||||
|
|
@ -31,12 +31,8 @@ import javax.persistence.Temporal;
|
|||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.network.IpAddress.State;
|
||||
import com.cloud.utils.net.Ip;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
/**
|
||||
* A bean representing a public IP Address
|
||||
|
|
@ -306,4 +302,9 @@ public class IPAddressVO implements IpAddress {
|
|||
public void setVmIp(String vmIp) {
|
||||
this.vmIp = vmIp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getNetworkId() {
|
||||
return sourceNetworkId;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ package com.cloud.network.dao;
|
|||
import javax.persistence.Column;
|
||||
import javax.persistence.DiscriminatorValue;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
import javax.persistence.PrimaryKeyJoinColumn;
|
||||
import javax.persistence.Table;
|
||||
|
||||
|
|
@ -26,6 +28,12 @@ import com.cloud.network.rules.FirewallRuleVO;
|
|||
import com.cloud.network.rules.LoadBalancer;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
|
||||
/**
|
||||
* This VO represent Public Load Balancer
|
||||
* It references source ip address by its Id.
|
||||
* To get the VO for Internal Load Balancer rule, please refer to LoadBalancerRuleVO
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
@Table(name=("load_balancing_rules"))
|
||||
@DiscriminatorValue(value="LoadBalancing")
|
||||
|
|
@ -46,6 +54,10 @@ public class LoadBalancerVO extends FirewallRuleVO implements LoadBalancer {
|
|||
|
||||
@Column(name="default_port_end")
|
||||
private int defaultPortEnd;
|
||||
|
||||
@Enumerated(value=EnumType.STRING)
|
||||
@Column(name="scheme")
|
||||
Scheme scheme;
|
||||
|
||||
public LoadBalancerVO() {
|
||||
}
|
||||
|
|
@ -57,6 +69,19 @@ public class LoadBalancerVO extends FirewallRuleVO implements LoadBalancer {
|
|||
this.algorithm = algorithm;
|
||||
this.defaultPortStart = dstPort;
|
||||
this.defaultPortEnd = dstPort;
|
||||
this.scheme = Scheme.Public;
|
||||
}
|
||||
|
||||
|
||||
protected LoadBalancerVO(String xId, String name, String description, int srcPort, int dstPort, String algorithm, long networkId, long accountId, long domainId) {
|
||||
super(xId, null, srcPort, dstPort, NetUtils.TCP_PROTO, networkId, accountId, domainId, Purpose.LoadBalancing, null, null,
|
||||
null, null, null);
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.algorithm = algorithm;
|
||||
this.defaultPortStart = dstPort;
|
||||
this.defaultPortEnd = dstPort;
|
||||
this.scheme = Scheme.Internal;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -94,5 +119,10 @@ public class LoadBalancerVO extends FirewallRuleVO implements LoadBalancer {
|
|||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Scheme getScheme() {
|
||||
return scheme;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -358,8 +358,8 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!_routerMgr.applyFirewallRules(network, rules, routers)) {
|
||||
throw new CloudRuntimeException("Failed to apply firewall rules in network " + network.getId());
|
||||
if (!_routerMgr.applyLoadBalancingRules(network, rules, routers)) {
|
||||
throw new CloudRuntimeException("Failed to apply load balancing rules in network " + network.getId());
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,16 +27,11 @@ import javax.ejb.Local;
|
|||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.firewall.ListEgressFirewallRulesCmd;
|
||||
import org.apache.cloudstack.api.command.user.firewall.ListFirewallRulesCmd;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.mysql.jdbc.ConnectionPropertiesImpl;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.BaseListCmd;
|
||||
import org.apache.cloudstack.api.command.user.firewall.ListEgressFirewallRulesCmd;
|
||||
import org.apache.cloudstack.api.command.user.firewall.ListFirewallRulesCmd;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.domain.dao.DomainDao;
|
||||
|
|
@ -52,7 +47,6 @@ import com.cloud.network.IpAddress;
|
|||
import com.cloud.network.Network;
|
||||
import com.cloud.network.Network.Capability;
|
||||
import com.cloud.network.Network.Service;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
import com.cloud.network.NetworkManager;
|
||||
import com.cloud.network.NetworkModel;
|
||||
import com.cloud.network.NetworkRuleApplier;
|
||||
|
|
@ -64,10 +58,15 @@ import com.cloud.network.element.FirewallServiceProvider;
|
|||
import com.cloud.network.element.NetworkACLServiceProvider;
|
||||
import com.cloud.network.element.PortForwardingServiceProvider;
|
||||
import com.cloud.network.element.StaticNatServiceProvider;
|
||||
import com.cloud.network.rules.*;
|
||||
import com.cloud.network.rules.FirewallManager;
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.network.rules.FirewallRule.FirewallRuleType;
|
||||
import com.cloud.network.rules.FirewallRule.Purpose;
|
||||
import com.cloud.network.rules.FirewallRule.State;
|
||||
import com.cloud.network.rules.FirewallRuleVO;
|
||||
import com.cloud.network.rules.PortForwardingRule;
|
||||
import com.cloud.network.rules.PortForwardingRuleVO;
|
||||
import com.cloud.network.rules.StaticNat;
|
||||
import com.cloud.network.rules.dao.PortForwardingRulesDao;
|
||||
import com.cloud.network.vpc.VpcManager;
|
||||
import com.cloud.projects.Project.ListProjectResourcesCriteria;
|
||||
|
|
@ -86,8 +85,8 @@ import com.cloud.utils.db.Filter;
|
|||
import com.cloud.utils.db.JoinBuilder;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.db.*;
|
||||
import com.cloud.utils.db.SearchCriteria.Op;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
import com.cloud.vm.UserVmVO;
|
||||
|
|
@ -434,22 +433,28 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService,
|
|||
return;
|
||||
}
|
||||
|
||||
if (ipAddress!=null){
|
||||
if (ipAddress.getAssociatedWithNetworkId() == null) {
|
||||
throw new InvalidParameterValueException("Unable to create firewall rule ; ip with specified id is not associated with any network");
|
||||
} else {
|
||||
networkId = ipAddress.getAssociatedWithNetworkId();
|
||||
}
|
||||
|
||||
if (ipAddress != null){
|
||||
if (ipAddress.getAssociatedWithNetworkId() == null) {
|
||||
throw new InvalidParameterValueException("Unable to create firewall rule ; ip with specified id is not associated with any network");
|
||||
} else {
|
||||
networkId = ipAddress.getAssociatedWithNetworkId();
|
||||
}
|
||||
|
||||
// Validate ip address
|
||||
_accountMgr.checkAccess(caller, null, true, ipAddress);
|
||||
|
||||
}
|
||||
|
||||
//network id either has to be passed explicitly, or implicitly as a part of ipAddress object
|
||||
if (networkId == null) {
|
||||
throw new InvalidParameterValueException("Unable to retrieve network id to validate the rule");
|
||||
}
|
||||
|
||||
Network network = _networkModel.getNetwork(networkId);
|
||||
assert network != null : "Can't create port forwarding rule as network associated with public ip address is null?";
|
||||
assert network != null : "Can't create rule as network associated with public ip address is null?";
|
||||
|
||||
if (trafficType == FirewallRule.TrafficType.Egress) {
|
||||
_accountMgr.checkAccess(caller, null, true, network);
|
||||
}
|
||||
if (trafficType == FirewallRule.TrafficType.Egress) {
|
||||
_accountMgr.checkAccess(caller, null, true, network);
|
||||
}
|
||||
|
||||
// Verify that the network guru supports the protocol specified
|
||||
Map<Network.Capability, String> caps = null;
|
||||
|
|
@ -460,32 +465,32 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService,
|
|||
}
|
||||
} else if (purpose == Purpose.PortForwarding) {
|
||||
caps = _networkModel.getNetworkServiceCapabilities(network.getId(), Service.PortForwarding);
|
||||
}else if (purpose == Purpose.Firewall){
|
||||
caps = _networkModel.getNetworkServiceCapabilities(network.getId(),Service.Firewall);
|
||||
} else if (purpose == Purpose.Firewall){
|
||||
caps = _networkModel.getNetworkServiceCapabilities(network.getId(),Service.Firewall);
|
||||
}
|
||||
|
||||
if (caps != null) {
|
||||
String supportedProtocols;
|
||||
String supportedTrafficTypes = null;
|
||||
if (purpose == FirewallRule.Purpose.Firewall) {
|
||||
supportedTrafficTypes = caps.get(Capability.SupportedTrafficDirection).toLowerCase();
|
||||
}
|
||||
String supportedProtocols;
|
||||
String supportedTrafficTypes = null;
|
||||
if (purpose == FirewallRule.Purpose.Firewall) {
|
||||
supportedTrafficTypes = caps.get(Capability.SupportedTrafficDirection).toLowerCase();
|
||||
}
|
||||
|
||||
if (purpose == FirewallRule.Purpose.Firewall && trafficType == FirewallRule.TrafficType.Egress) {
|
||||
supportedProtocols = caps.get(Capability.SupportedEgressProtocols).toLowerCase();
|
||||
} else {
|
||||
supportedProtocols = caps.get(Capability.SupportedProtocols).toLowerCase();
|
||||
}
|
||||
if (purpose == FirewallRule.Purpose.Firewall && trafficType == FirewallRule.TrafficType.Egress) {
|
||||
supportedProtocols = caps.get(Capability.SupportedEgressProtocols).toLowerCase();
|
||||
} else {
|
||||
supportedProtocols = caps.get(Capability.SupportedProtocols).toLowerCase();
|
||||
}
|
||||
|
||||
if (!supportedProtocols.contains(proto.toLowerCase())) {
|
||||
throw new InvalidParameterValueException("Protocol " + proto + " is not supported in zone " + network.getDataCenterId());
|
||||
} else if (proto.equalsIgnoreCase(NetUtils.ICMP_PROTO) && purpose != Purpose.Firewall) {
|
||||
throw new InvalidParameterValueException("Protocol " + proto + " is currently supported only for rules with purpose " + Purpose.Firewall);
|
||||
} else if (purpose == Purpose.Firewall && !supportedTrafficTypes.contains(trafficType.toString().toLowerCase())) {
|
||||
throw new InvalidParameterValueException("Traffic Type " + trafficType + " is currently supported by Firewall in network " + networkId);
|
||||
}
|
||||
} else if (purpose == Purpose.Firewall && !supportedTrafficTypes.contains(trafficType.toString().toLowerCase())) {
|
||||
throw new InvalidParameterValueException("Traffic Type " + trafficType + " is currently supported by Firewall in network " + networkId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -16,23 +16,23 @@
|
|||
// under the License.
|
||||
package com.cloud.network.lb;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.lb.LoadBalancingRule.LbDestination;
|
||||
import com.cloud.network.lb.LoadBalancingRule.LbHealthCheckPolicy;
|
||||
import com.cloud.network.lb.LoadBalancingRule.LbStickinessPolicy;
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.network.rules.LbStickinessMethod;
|
||||
import com.cloud.network.rules.LoadBalancer;
|
||||
import com.cloud.user.Account;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLoadBalancerRuleCmd;
|
||||
|
||||
import java.util.List;
|
||||
import com.cloud.user.UserContext;
|
||||
|
||||
public interface LoadBalancingRulesManager extends LoadBalancingRulesService {
|
||||
|
||||
LoadBalancer createLoadBalancer(CreateLoadBalancerRuleCmd lb, boolean openFirewall) throws NetworkRuleConflictException;
|
||||
LoadBalancer createPublicLoadBalancer(String xId, String name, String description,
|
||||
int srcPortStart, int srcPortEnd, int defPortStart, long sourceIpId, String protocol, String algorithm, boolean openFirewall, UserContext caller)
|
||||
throws NetworkRuleConflictException;
|
||||
|
||||
boolean removeAllLoadBalanacersForIp(long ipId, Account caller, long callerUserId);
|
||||
boolean removeAllLoadBalanacersForNetwork(long networkId, Account caller, long callerUserId);
|
||||
|
|
@ -47,7 +47,6 @@ public interface LoadBalancingRulesManager extends LoadBalancingRulesService {
|
|||
* @return true if removal is successful
|
||||
*/
|
||||
boolean removeVmFromLoadBalancers(long vmId);
|
||||
boolean applyRules(Network network, FirewallRule.Purpose purpose, List<? extends FirewallRule> rules) throws ResourceUnavailableException ;
|
||||
boolean applyLoadBalancersForNetwork(long networkId) throws ResourceUnavailableException;
|
||||
String getLBCapability(long networkid, String capabilityName);
|
||||
boolean configureLbAutoScaleVmGroup(long vmGroupid, String currentState) throws ResourceUnavailableException;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,32 @@
|
|||
// under the License.
|
||||
package com.cloud.network.lb;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLBHealthCheckPolicyCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLBStickinessPolicyCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.ListLBHealthCheckPoliciesCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.ListLBStickinessPoliciesCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.ListLoadBalancerRuleInstancesCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.ListLoadBalancerRulesCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.UpdateLoadBalancerRuleCmd;
|
||||
import org.apache.cloudstack.api.response.ServiceResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.agent.api.to.LoadBalancerTO;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.ConfigurationManager;
|
||||
|
|
@ -30,21 +56,70 @@ import com.cloud.event.EventTypes;
|
|||
import com.cloud.event.UsageEventUtils;
|
||||
import com.cloud.event.dao.EventDao;
|
||||
import com.cloud.event.dao.UsageEventDao;
|
||||
import com.cloud.exception.*;
|
||||
import com.cloud.network.*;
|
||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.ExternalLoadBalancerUsageManager;
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.network.LBHealthCheckPolicyVO;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.Network.Capability;
|
||||
import com.cloud.network.Network.Provider;
|
||||
import com.cloud.network.Network.Service;
|
||||
import com.cloud.network.as.*;
|
||||
import com.cloud.network.NetworkManager;
|
||||
import com.cloud.network.NetworkModel;
|
||||
import com.cloud.network.addr.PublicIp;
|
||||
import com.cloud.network.as.AutoScalePolicy;
|
||||
import com.cloud.network.as.AutoScalePolicyConditionMapVO;
|
||||
import com.cloud.network.as.AutoScaleVmGroup;
|
||||
import com.cloud.network.as.AutoScaleVmGroupPolicyMapVO;
|
||||
import com.cloud.network.as.AutoScaleVmGroupVO;
|
||||
import com.cloud.network.as.AutoScaleVmProfile;
|
||||
import com.cloud.network.as.Condition;
|
||||
import com.cloud.network.as.dao.*;
|
||||
import com.cloud.network.dao.*;
|
||||
import com.cloud.network.as.Counter;
|
||||
import com.cloud.network.as.dao.AutoScalePolicyConditionMapDao;
|
||||
import com.cloud.network.as.dao.AutoScalePolicyDao;
|
||||
import com.cloud.network.as.dao.AutoScaleVmGroupDao;
|
||||
import com.cloud.network.as.dao.AutoScaleVmGroupPolicyMapDao;
|
||||
import com.cloud.network.as.dao.AutoScaleVmProfileDao;
|
||||
import com.cloud.network.as.dao.ConditionDao;
|
||||
import com.cloud.network.as.dao.CounterDao;
|
||||
import com.cloud.network.dao.FirewallRulesCidrsDao;
|
||||
import com.cloud.network.dao.FirewallRulesDao;
|
||||
import com.cloud.network.dao.IPAddressDao;
|
||||
import com.cloud.network.dao.IPAddressVO;
|
||||
import com.cloud.network.dao.LBHealthCheckPolicyDao;
|
||||
import com.cloud.network.dao.LBStickinessPolicyDao;
|
||||
import com.cloud.network.dao.LBStickinessPolicyVO;
|
||||
import com.cloud.network.dao.LoadBalancerDao;
|
||||
import com.cloud.network.dao.LoadBalancerVMMapDao;
|
||||
import com.cloud.network.dao.LoadBalancerVMMapVO;
|
||||
import com.cloud.network.dao.LoadBalancerVO;
|
||||
import com.cloud.network.dao.NetworkDao;
|
||||
import com.cloud.network.dao.NetworkServiceMapDao;
|
||||
import com.cloud.network.dao.NetworkVO;
|
||||
import com.cloud.network.element.LoadBalancingServiceProvider;
|
||||
import com.cloud.network.lb.LoadBalancingRule.*;
|
||||
import com.cloud.network.rules.*;
|
||||
import com.cloud.network.lb.LoadBalancingRule.LbAutoScalePolicy;
|
||||
import com.cloud.network.lb.LoadBalancingRule.LbAutoScaleVmGroup;
|
||||
import com.cloud.network.lb.LoadBalancingRule.LbAutoScaleVmProfile;
|
||||
import com.cloud.network.lb.LoadBalancingRule.LbCondition;
|
||||
import com.cloud.network.lb.LoadBalancingRule.LbDestination;
|
||||
import com.cloud.network.lb.LoadBalancingRule.LbHealthCheckPolicy;
|
||||
import com.cloud.network.lb.LoadBalancingRule.LbStickinessPolicy;
|
||||
import com.cloud.network.rules.FirewallManager;
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.network.rules.FirewallRule.FirewallRuleType;
|
||||
import com.cloud.network.rules.FirewallRule.Purpose;
|
||||
import com.cloud.network.rules.FirewallRuleVO;
|
||||
import com.cloud.network.rules.HealthCheckPolicy;
|
||||
import com.cloud.network.rules.LbStickinessMethod;
|
||||
import com.cloud.network.rules.LbStickinessMethod.LbStickinessMethodParam;
|
||||
import com.cloud.network.rules.LoadBalancer;
|
||||
import com.cloud.network.rules.LoadBalancerContainer.Scheme;
|
||||
import com.cloud.network.rules.RulesManager;
|
||||
import com.cloud.network.rules.StickinessPolicy;
|
||||
import com.cloud.network.vpc.VpcManager;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
import com.cloud.projects.Project.ListProjectResourcesCriteria;
|
||||
|
|
@ -53,15 +128,25 @@ import com.cloud.service.dao.ServiceOfferingDao;
|
|||
import com.cloud.storage.dao.VMTemplateDao;
|
||||
import com.cloud.tags.ResourceTagVO;
|
||||
import com.cloud.tags.dao.ResourceTagDao;
|
||||
import com.cloud.user.*;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.AccountManager;
|
||||
import com.cloud.user.DomainService;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.user.UserContext;
|
||||
import com.cloud.user.dao.AccountDao;
|
||||
import com.cloud.user.dao.UserDao;
|
||||
import com.cloud.uservm.UserVm;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.Ternary;
|
||||
import com.cloud.utils.component.ManagerBase;
|
||||
import com.cloud.utils.db.*;
|
||||
import com.cloud.utils.db.DB;
|
||||
import com.cloud.utils.db.Filter;
|
||||
import com.cloud.utils.db.JoinBuilder;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.net.Ip;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
import com.cloud.vm.Nic;
|
||||
import com.cloud.vm.UserVmVO;
|
||||
|
|
@ -70,21 +155,11 @@ import com.cloud.vm.dao.NicDao;
|
|||
import com.cloud.vm.dao.UserVmDao;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.*;
|
||||
import org.apache.cloudstack.api.response.ServiceResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Local(value = { LoadBalancingRulesManager.class, LoadBalancingRulesService.class })
|
||||
public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements LoadBalancingRulesManager,
|
||||
LoadBalancingRulesService, NetworkRuleApplier {
|
||||
LoadBalancingRulesService {
|
||||
private static final Logger s_logger = Logger.getLogger(LoadBalancingRulesManagerImpl.class);
|
||||
|
||||
@Inject
|
||||
|
|
@ -273,7 +348,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
|
|||
|
||||
List<LoadBalancingRule> rules = Arrays.asList(rule);
|
||||
|
||||
if (!_networkMgr.applyRules(rules, FirewallRule.Purpose.LoadBalancing, this, false)) {
|
||||
if (!applyLbRules(rules, false)) {
|
||||
s_logger.debug("LB rules' autoscale config are not completely applied");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1168,12 +1243,10 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
|
|||
|
||||
@Override
|
||||
@ActionEvent(eventType = EventTypes.EVENT_LOAD_BALANCER_CREATE, eventDescription = "creating load balancer")
|
||||
public LoadBalancer createLoadBalancerRule(CreateLoadBalancerRuleCmd lb, boolean openFirewall)
|
||||
public LoadBalancer createPublicLoadBalancerRule(String xId, String name, String description,
|
||||
int srcPortStart, int srcPortEnd, int defPortStart, int defPortEnd, Long ipAddrId, String protocol, String algorithm, long networkId, long lbOwnerId, boolean openFirewall)
|
||||
throws NetworkRuleConflictException, InsufficientAddressCapacityException {
|
||||
Account lbOwner = _accountMgr.getAccount(lb.getEntityOwnerId());
|
||||
|
||||
int defPortStart = lb.getDefaultPortStart();
|
||||
int defPortEnd = lb.getDefaultPortEnd();
|
||||
Account lbOwner = _accountMgr.getAccount(lbOwnerId);
|
||||
|
||||
if (!NetUtils.isValidPort(defPortEnd)) {
|
||||
throw new InvalidParameterValueException("privatePort is an invalid value: " + defPortEnd);
|
||||
|
|
@ -1182,17 +1255,16 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
|
|||
throw new InvalidParameterValueException("private port range is invalid: " + defPortStart + "-"
|
||||
+ defPortEnd);
|
||||
}
|
||||
if ((lb.getAlgorithm() == null) || !NetUtils.isValidAlgorithm(lb.getAlgorithm())) {
|
||||
throw new InvalidParameterValueException("Invalid algorithm: " + lb.getAlgorithm());
|
||||
if ((algorithm == null) || !NetUtils.isValidAlgorithm(algorithm)) {
|
||||
throw new InvalidParameterValueException("Invalid algorithm: " + algorithm);
|
||||
}
|
||||
|
||||
Long ipAddrId = lb.getSourceIpAddressId();
|
||||
IPAddressVO ipVO = null;
|
||||
if (ipAddrId != null) {
|
||||
ipVO = _ipAddressDao.findById(ipAddrId);
|
||||
}
|
||||
|
||||
Network network = _networkModel.getNetwork(lb.getNetworkId());
|
||||
Network network = _networkModel.getNetwork(networkId);
|
||||
|
||||
// FIXME: breaking the dependency on ELB manager. This breaks
|
||||
// functionality of ELB using virtual router
|
||||
|
|
@ -1204,8 +1276,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
|
|||
IpAddress systemIp = null;
|
||||
NetworkOffering off = _configMgr.getNetworkOffering(network.getNetworkOfferingId());
|
||||
if (off.getElasticLb() && ipVO == null && network.getVpcId() == null) {
|
||||
systemIp = _networkMgr.assignSystemIp(lb.getNetworkId(), lbOwner, true, false);
|
||||
lb.setSourceIpAddressId(systemIp.getId());
|
||||
systemIp = _networkMgr.assignSystemIp(networkId, lbOwner, true, false);
|
||||
ipVO = _ipAddressDao.findById(systemIp.getId());
|
||||
}
|
||||
|
||||
|
|
@ -1224,11 +1295,11 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
|
|||
&& ipVO.getVpcId().longValue() == network.getVpcId();
|
||||
if (assignToVpcNtwk) {
|
||||
// set networkId just for verification purposes
|
||||
_networkModel.checkIpForService(ipVO, Service.Lb, lb.getNetworkId());
|
||||
_networkModel.checkIpForService(ipVO, Service.Lb, networkId);
|
||||
|
||||
s_logger.debug("The ip is not associated with the VPC network id=" + lb.getNetworkId()
|
||||
s_logger.debug("The ip is not associated with the VPC network id=" + networkId
|
||||
+ " so assigning");
|
||||
ipVO = _networkMgr.associateIPToGuestNetwork(ipAddrId, lb.getNetworkId(), false);
|
||||
ipVO = _networkMgr.associateIPToGuestNetwork(ipAddrId, networkId, false);
|
||||
performedIpAssoc = true;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1240,10 +1311,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
|
|||
+ network);
|
||||
}
|
||||
|
||||
if (lb.getSourceIpAddressId() == null) {
|
||||
throw new CloudRuntimeException("No ip address is defined to assign the LB to");
|
||||
}
|
||||
result = createLoadBalancer(lb, openFirewall);
|
||||
result = createPublicLoadBalancer(xId, name, description, srcPortStart, srcPortEnd, defPortStart, ipVO.getId(), protocol, algorithm, openFirewall, UserContext.current());
|
||||
} catch (Exception ex) {
|
||||
s_logger.warn("Failed to create load balancer due to ", ex);
|
||||
if (ex instanceof NetworkRuleConflictException) {
|
||||
|
|
@ -1258,27 +1326,23 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
|
|||
// release ip address if ipassoc was perfored
|
||||
if (performedIpAssoc) {
|
||||
ipVO = _ipAddressDao.findById(ipVO.getId());
|
||||
_vpcMgr.unassignIPFromVpcNetwork(ipVO.getId(), lb.getNetworkId());
|
||||
_vpcMgr.unassignIPFromVpcNetwork(ipVO.getId(), networkId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result == null) {
|
||||
throw new CloudRuntimeException("Failed to create load balancer rule: " + lb.getName());
|
||||
throw new CloudRuntimeException("Failed to create load balancer rule: " + name);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@DB
|
||||
public LoadBalancer createLoadBalancer(CreateLoadBalancerRuleCmd lb, boolean openFirewall)
|
||||
@Override
|
||||
public LoadBalancer createPublicLoadBalancer(String xId, String name, String description,
|
||||
int srcPortStart, int srcPortEnd, int defPortStart, long sourceIpId, String protocol, String algorithm, boolean openFirewall, UserContext caller)
|
||||
throws NetworkRuleConflictException {
|
||||
UserContext caller = UserContext.current();
|
||||
int srcPortStart = lb.getSourcePortStart();
|
||||
int defPortStart = lb.getDefaultPortStart();
|
||||
int srcPortEnd = lb.getSourcePortEnd();
|
||||
long sourceIpId = lb.getSourceIpAddressId();
|
||||
|
||||
IPAddressVO ipAddr = _ipAddressDao.findById(sourceIpId);
|
||||
// make sure ip address exists
|
||||
|
|
@ -1302,7 +1366,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
|
|||
throw ex;
|
||||
}
|
||||
|
||||
_firewallMgr.validateFirewallRule(caller.getCaller(), ipAddr, srcPortStart, srcPortEnd, lb.getProtocol(),
|
||||
_firewallMgr.validateFirewallRule(caller.getCaller(), ipAddr, srcPortStart, srcPortEnd, protocol,
|
||||
Purpose.LoadBalancing, FirewallRuleType.User, networkId, null);
|
||||
NetworkVO network = _networkDao.findById(networkId);
|
||||
_accountMgr.checkAccess(caller.getCaller(), null, true, ipAddr);
|
||||
|
|
@ -1318,8 +1382,8 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
|
|||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
|
||||
LoadBalancerVO newRule = new LoadBalancerVO(lb.getXid(), lb.getName(), lb.getDescription(),
|
||||
lb.getSourceIpAddressId(), lb.getSourcePortEnd(), lb.getDefaultPortStart(), lb.getAlgorithm(),
|
||||
LoadBalancerVO newRule = new LoadBalancerVO(xId, name, description,
|
||||
sourceIpId, srcPortEnd, srcPortStart, algorithm,
|
||||
network.getId(), ipAddr.getAllocatedToAccountId(), ipAddr.getAllocatedInDomainId());
|
||||
|
||||
// verify rule is supported by Lb provider of the network
|
||||
|
|
@ -1332,8 +1396,8 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
|
|||
newRule = _lbDao.persist(newRule);
|
||||
|
||||
if (openFirewall) {
|
||||
_firewallMgr.createRuleForAllCidrs(sourceIpId, caller.getCaller(), lb.getSourcePortStart(),
|
||||
lb.getSourcePortEnd(), lb.getProtocol(), null, null, newRule.getId(), networkId);
|
||||
_firewallMgr.createRuleForAllCidrs(sourceIpId, caller.getCaller(), srcPortStart,
|
||||
srcPortEnd, protocol, null, null, newRule.getId(), networkId);
|
||||
}
|
||||
|
||||
boolean success = true;
|
||||
|
|
@ -1410,10 +1474,9 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applyRules(Network network, Purpose purpose, List<? extends FirewallRule> rules)
|
||||
|
||||
protected boolean applyLbRules(Network network, List<LoadBalancingRule> rules)
|
||||
throws ResourceUnavailableException {
|
||||
assert (purpose == Purpose.LoadBalancing) : "LB Manager asked to handle non-LB rules";
|
||||
boolean handled = false;
|
||||
for (LoadBalancingServiceProvider lbElement : _lbProviders) {
|
||||
Provider provider = lbElement.getProvider();
|
||||
|
|
@ -1422,7 +1485,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
|
|||
if (!isLbProvider) {
|
||||
continue;
|
||||
}
|
||||
handled = lbElement.applyLBRules(network, (List<LoadBalancingRule>) rules);
|
||||
handled = lbElement.applyLBRules(network, rules);
|
||||
if (handled)
|
||||
break;
|
||||
}
|
||||
|
|
@ -1458,7 +1521,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
|
|||
rules.add(getLoadBalancerRuleToApply(lb));
|
||||
}
|
||||
|
||||
if (!_networkMgr.applyRules(rules, FirewallRule.Purpose.LoadBalancing, this, false)) {
|
||||
if (!applyLbRules(rules, false)) {
|
||||
s_logger.debug("LB rules are not completely applied");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1902,24 +1965,14 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
|
|||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
//list only Public load balancers using this command
|
||||
sc.setParameters("scheme", Scheme.Public);
|
||||
|
||||
Pair<List<LoadBalancerVO>, Integer> result = _lbDao.searchAndCount(sc, searchFilter);
|
||||
return new Pair<List<? extends LoadBalancer>, Integer>(result.first(), result.second());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LoadBalancingRule> listByNetworkId(long networkId) {
|
||||
List<LoadBalancerVO> lbs = _lbDao.listByNetworkId(networkId);
|
||||
List<LoadBalancingRule> lbRules = new ArrayList<LoadBalancingRule>();
|
||||
for (LoadBalancerVO lb : lbs) {
|
||||
List<LbDestination> dstList = getExistingDestinations(lb.getId());
|
||||
List<LbStickinessPolicy> policyList = this.getStickinessPolicies(lb.getId());
|
||||
List<LbHealthCheckPolicy> hcPolicyList = this.getHealthCheckPolicies(lb.getId());
|
||||
LoadBalancingRule loadBalancing = new LoadBalancingRule(lb, dstList, policyList, hcPolicyList);
|
||||
lbRules.add(loadBalancing);
|
||||
}
|
||||
return lbRules;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoadBalancerVO findById(long lbId) {
|
||||
|
|
@ -1930,4 +1983,65 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
|
|||
// remove the rule
|
||||
_lbDao.remove(rule.getId());
|
||||
}
|
||||
|
||||
|
||||
public boolean applyLbRules(List<LoadBalancingRule> rules, boolean continueOnError) throws ResourceUnavailableException {
|
||||
if (rules == null || rules.size() == 0) {
|
||||
s_logger.debug("There are no rules to forward to the network elements");
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean success = true;
|
||||
Network network = _networkModel.getNetwork(rules.get(0).getNetworkId());
|
||||
List<PublicIp> publicIps = new ArrayList<PublicIp>();
|
||||
|
||||
|
||||
// get the list of public ip's owned by the network
|
||||
List<IPAddressVO> userIps = _ipAddressDao.listByAssociatedNetwork(network.getId(), null);
|
||||
if (userIps != null && !userIps.isEmpty()) {
|
||||
for (IPAddressVO userIp : userIps) {
|
||||
PublicIp publicIp = PublicIp.createFromAddrAndVlan(userIp, _vlanDao.findById(userIp.getVlanId()));
|
||||
publicIps.add(publicIp);
|
||||
}
|
||||
}
|
||||
|
||||
// rules can not programmed unless IP is associated with network
|
||||
// service provider, so run IP assoication for
|
||||
// the network so as to ensure IP is associated before applying
|
||||
// rules (in add state)
|
||||
_networkMgr.applyIpAssociations(network, false, continueOnError, publicIps);
|
||||
|
||||
|
||||
try {
|
||||
applyLbRules(network, rules);
|
||||
} catch (ResourceUnavailableException e) {
|
||||
if (!continueOnError) {
|
||||
throw e;
|
||||
}
|
||||
s_logger.warn("Problems with applying load balancing rules but pushing on", e);
|
||||
success = false;
|
||||
}
|
||||
|
||||
// if all the rules configured on public IP are revoked then
|
||||
// dis-associate IP with network service provider
|
||||
_networkMgr.applyIpAssociations(network, true, continueOnError, publicIps);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Ip, UserVm> getLbInstances(long lbId) {
|
||||
Map<Ip, UserVm> dstList = new HashMap<Ip, UserVm>();
|
||||
List<LoadBalancerVMMapVO> lbVmMaps = _lb2VmMapDao.listByLoadBalancerId(lbId);
|
||||
LoadBalancerVO lb = _lbDao.findById(lbId);
|
||||
|
||||
for (LoadBalancerVMMapVO lbVmMap : lbVmMaps) {
|
||||
UserVm vm = _vmDao.findById(lbVmMap.getInstanceId());
|
||||
Nic nic = _nicDao.findByInstanceIdAndNetworkIdIncludingRemoved(lb.getNetworkId(), vm.getId());
|
||||
Ip ip = new Ip(nic.getIp4Address());
|
||||
dstList.put(ip, vm);
|
||||
}
|
||||
return dstList;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import com.cloud.network.PublicIpAddress;
|
|||
import com.cloud.network.RemoteAccessVpn;
|
||||
import com.cloud.network.VirtualNetworkApplianceService;
|
||||
import com.cloud.network.VpnUser;
|
||||
import com.cloud.network.lb.LoadBalancingRule;
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.network.rules.StaticNat;
|
||||
import com.cloud.user.Account;
|
||||
|
|
@ -103,4 +104,6 @@ public interface VirtualNetworkApplianceManager extends Manager, VirtualNetworkA
|
|||
|
||||
boolean applyUserData(Network config, NicProfile nic, VirtualMachineProfile<UserVm> vm, DeployDestination dest,
|
||||
List<DomainRouterVO> routers) throws ResourceUnavailableException;
|
||||
|
||||
boolean applyLoadBalancingRules(Network network, List<? extends LoadBalancingRule> rules, List<? extends VirtualRouter> routers) throws ResourceUnavailableException;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3316,6 +3316,31 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean applyLoadBalancingRules(Network network, final List<? extends LoadBalancingRule> rules, List<? extends VirtualRouter> routers) throws ResourceUnavailableException {
|
||||
if (rules == null || rules.isEmpty()) {
|
||||
s_logger.debug("No lb rules to be applied for network " + network.getId());
|
||||
return true;
|
||||
}
|
||||
return applyRules(network, routers, "loadbalancing rules", false, null, false, new RuleApplier() {
|
||||
@Override
|
||||
public boolean execute(Network network, VirtualRouter router) throws ResourceUnavailableException {
|
||||
// for load balancer we have to resend all lb rules for the network
|
||||
List<LoadBalancerVO> lbs = _loadBalancerDao.listByNetworkId(network.getId());
|
||||
List<LoadBalancingRule> lbRules = new ArrayList<LoadBalancingRule>();
|
||||
for (LoadBalancerVO lb : lbs) {
|
||||
List<LbDestination> dstList = _lbMgr.getExistingDestinations(lb.getId());
|
||||
List<LbStickinessPolicy> policyList = _lbMgr.getStickinessPolicies(lb.getId());
|
||||
List<LbHealthCheckPolicy> hcPolicyList = _lbMgr.getHealthCheckPolicies(lb.getId() );
|
||||
LoadBalancingRule loadBalancing = new LoadBalancingRule(lb, dstList, policyList, hcPolicyList);
|
||||
lbRules.add(loadBalancing);
|
||||
}
|
||||
return sendLBRules(router, lbRules, network.getId());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected boolean sendLBRules(VirtualRouter router, List<LoadBalancingRule> rules, long guestNetworkId) throws ResourceUnavailableException {
|
||||
Commands cmds = new Commands(OnError.Continue);
|
||||
|
|
|
|||
|
|
@ -37,76 +37,352 @@ import java.util.concurrent.Executors;
|
|||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import javax.inject.Inject;
|
||||
import javax.management.InstanceAlreadyExistsException;
|
||||
import javax.management.MBeanRegistrationException;
|
||||
import javax.management.MalformedObjectNameException;
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.storage.dao.*;
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
|
||||
import com.cloud.event.ActionEventUtils;
|
||||
import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoCmd;
|
||||
import org.apache.cloudstack.api.command.admin.account.*;
|
||||
import org.apache.cloudstack.api.command.admin.autoscale.*;
|
||||
import org.apache.cloudstack.api.command.admin.cluster.*;
|
||||
import org.apache.cloudstack.api.command.admin.config.*;
|
||||
import org.apache.cloudstack.api.command.admin.domain.*;
|
||||
import org.apache.cloudstack.api.command.admin.host.*;
|
||||
import org.apache.cloudstack.api.command.admin.ldap.*;
|
||||
import org.apache.cloudstack.api.command.admin.network.*;
|
||||
import org.apache.cloudstack.api.command.admin.offering.*;
|
||||
import org.apache.cloudstack.api.command.admin.pod.*;
|
||||
import org.apache.cloudstack.api.command.admin.region.*;
|
||||
import org.apache.cloudstack.api.command.admin.resource.*;
|
||||
import org.apache.cloudstack.api.command.admin.router.*;
|
||||
import org.apache.cloudstack.api.command.admin.storage.*;
|
||||
import org.apache.cloudstack.api.command.admin.swift.*;
|
||||
import org.apache.cloudstack.api.command.admin.systemvm.*;
|
||||
import org.apache.cloudstack.api.command.admin.template.*;
|
||||
import org.apache.cloudstack.api.command.admin.usage.*;
|
||||
import org.apache.cloudstack.api.command.admin.user.*;
|
||||
import org.apache.cloudstack.api.command.admin.vlan.*;
|
||||
import org.apache.cloudstack.api.command.admin.vm.*;
|
||||
import org.apache.cloudstack.api.command.admin.vpc.*;
|
||||
import org.apache.cloudstack.api.command.admin.zone.*;
|
||||
import org.apache.cloudstack.api.command.user.account.*;
|
||||
import org.apache.cloudstack.api.command.user.address.*;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.*;
|
||||
import org.apache.cloudstack.api.command.user.config.*;
|
||||
import org.apache.cloudstack.api.command.user.event.*;
|
||||
import org.apache.cloudstack.api.command.user.firewall.*;
|
||||
import org.apache.cloudstack.api.command.user.guest.*;
|
||||
import org.apache.cloudstack.api.command.user.iso.*;
|
||||
import org.apache.cloudstack.api.command.user.job.*;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.*;
|
||||
import org.apache.cloudstack.api.command.user.nat.*;
|
||||
import org.apache.cloudstack.api.command.user.network.*;
|
||||
import org.apache.cloudstack.api.command.user.offering.*;
|
||||
import org.apache.cloudstack.api.command.user.project.*;
|
||||
import org.apache.cloudstack.api.command.user.region.*;
|
||||
import org.apache.cloudstack.api.command.user.resource.*;
|
||||
import org.apache.cloudstack.api.command.user.securitygroup.*;
|
||||
import org.apache.cloudstack.api.command.user.snapshot.*;
|
||||
import org.apache.cloudstack.api.command.user.ssh.*;
|
||||
import org.apache.cloudstack.api.command.user.tag.*;
|
||||
import org.apache.cloudstack.api.command.user.template.*;
|
||||
import org.apache.cloudstack.api.command.user.vm.*;
|
||||
import org.apache.cloudstack.api.command.user.vmgroup.*;
|
||||
import org.apache.cloudstack.api.command.user.volume.*;
|
||||
import org.apache.cloudstack.api.command.user.vpc.*;
|
||||
import org.apache.cloudstack.api.command.user.vpn.*;
|
||||
import org.apache.cloudstack.api.command.user.zone.*;
|
||||
import org.apache.cloudstack.api.command.admin.account.CreateAccountCmd;
|
||||
import org.apache.cloudstack.api.command.admin.account.DeleteAccountCmd;
|
||||
import org.apache.cloudstack.api.command.admin.account.DisableAccountCmd;
|
||||
import org.apache.cloudstack.api.command.admin.account.EnableAccountCmd;
|
||||
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.autoscale.CreateCounterCmd;
|
||||
import org.apache.cloudstack.api.command.admin.autoscale.DeleteCounterCmd;
|
||||
import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
|
||||
import org.apache.cloudstack.api.command.admin.cluster.DeleteClusterCmd;
|
||||
import org.apache.cloudstack.api.command.admin.cluster.ListClustersCmd;
|
||||
import org.apache.cloudstack.api.command.admin.cluster.UpdateClusterCmd;
|
||||
import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd;
|
||||
import org.apache.cloudstack.api.command.admin.config.ListHypervisorCapabilitiesCmd;
|
||||
import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
|
||||
import org.apache.cloudstack.api.command.admin.config.UpdateHypervisorCapabilitiesCmd;
|
||||
import org.apache.cloudstack.api.command.admin.domain.CreateDomainCmd;
|
||||
import org.apache.cloudstack.api.command.admin.domain.DeleteDomainCmd;
|
||||
import org.apache.cloudstack.api.command.admin.domain.ListDomainChildrenCmd;
|
||||
import org.apache.cloudstack.api.command.admin.domain.ListDomainsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.domain.UpdateDomainCmd;
|
||||
import org.apache.cloudstack.api.command.admin.host.AddHostCmd;
|
||||
import org.apache.cloudstack.api.command.admin.host.AddSecondaryStorageCmd;
|
||||
import org.apache.cloudstack.api.command.admin.host.CancelMaintenanceCmd;
|
||||
import org.apache.cloudstack.api.command.admin.host.DeleteHostCmd;
|
||||
import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.host.PrepareForMaintenanceCmd;
|
||||
import org.apache.cloudstack.api.command.admin.host.ReconnectHostCmd;
|
||||
import org.apache.cloudstack.api.command.admin.host.UpdateHostCmd;
|
||||
import org.apache.cloudstack.api.command.admin.host.UpdateHostPasswordCmd;
|
||||
import org.apache.cloudstack.api.command.admin.ldap.LDAPConfigCmd;
|
||||
import org.apache.cloudstack.api.command.admin.ldap.LDAPRemoveCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.AddNetworkDeviceCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.AddNetworkServiceProviderCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.CreateNetworkOfferingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.CreatePhysicalNetworkCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.CreateStorageNetworkIpRangeCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.DeleteNetworkDeviceCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.DeleteNetworkOfferingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.DeleteNetworkServiceProviderCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.DeletePhysicalNetworkCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.DeleteStorageNetworkIpRangeCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.ListNetworkDeviceCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.ListNetworkServiceProvidersCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.ListPhysicalNetworksCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.ListStorageNetworkIpRangeCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.ListSupportedNetworkServicesCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.UpdateNetworkOfferingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.UpdateNetworkServiceProviderCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.UpdatePhysicalNetworkCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.UpdateStorageNetworkIpRangeCmd;
|
||||
import org.apache.cloudstack.api.command.admin.offering.CreateDiskOfferingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.offering.CreateServiceOfferingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.offering.DeleteDiskOfferingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.offering.DeleteServiceOfferingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.offering.UpdateDiskOfferingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.offering.UpdateServiceOfferingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.pod.CreatePodCmd;
|
||||
import org.apache.cloudstack.api.command.admin.pod.DeletePodCmd;
|
||||
import org.apache.cloudstack.api.command.admin.pod.ListPodsByCmd;
|
||||
import org.apache.cloudstack.api.command.admin.pod.UpdatePodCmd;
|
||||
import org.apache.cloudstack.api.command.admin.region.AddRegionCmd;
|
||||
import org.apache.cloudstack.api.command.admin.region.RemoveRegionCmd;
|
||||
import org.apache.cloudstack.api.command.admin.region.UpdateRegionCmd;
|
||||
import org.apache.cloudstack.api.command.admin.resource.ArchiveAlertsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.resource.DeleteAlertsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.resource.ListAlertsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.resource.ListCapacityCmd;
|
||||
import org.apache.cloudstack.api.command.admin.resource.UploadCustomCertificateCmd;
|
||||
import org.apache.cloudstack.api.command.admin.router.ConfigureVirtualRouterElementCmd;
|
||||
import org.apache.cloudstack.api.command.admin.router.CreateVirtualRouterElementCmd;
|
||||
import org.apache.cloudstack.api.command.admin.router.DestroyRouterCmd;
|
||||
import org.apache.cloudstack.api.command.admin.router.ListRoutersCmd;
|
||||
import org.apache.cloudstack.api.command.admin.router.ListVirtualRouterElementsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.router.RebootRouterCmd;
|
||||
import org.apache.cloudstack.api.command.admin.router.StartRouterCmd;
|
||||
import org.apache.cloudstack.api.command.admin.router.StopRouterCmd;
|
||||
import org.apache.cloudstack.api.command.admin.router.UpgradeRouterCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.AddS3Cmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaintenanceCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.CreateStoragePoolCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.DeletePoolCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.ListS3sCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.ListStorageProvidersCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.PreparePrimaryStorageForMaintenanceCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.UpdateStoragePoolCmd;
|
||||
import org.apache.cloudstack.api.command.admin.swift.AddSwiftCmd;
|
||||
import org.apache.cloudstack.api.command.admin.swift.ListSwiftsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.systemvm.DestroySystemVmCmd;
|
||||
import org.apache.cloudstack.api.command.admin.systemvm.ListSystemVMsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.systemvm.MigrateSystemVMCmd;
|
||||
import org.apache.cloudstack.api.command.admin.systemvm.RebootSystemVmCmd;
|
||||
import org.apache.cloudstack.api.command.admin.systemvm.StartSystemVMCmd;
|
||||
import org.apache.cloudstack.api.command.admin.systemvm.StopSystemVmCmd;
|
||||
import org.apache.cloudstack.api.command.admin.systemvm.UpgradeSystemVMCmd;
|
||||
import org.apache.cloudstack.api.command.admin.template.PrepareTemplateCmd;
|
||||
import org.apache.cloudstack.api.command.admin.usage.AddTrafficMonitorCmd;
|
||||
import org.apache.cloudstack.api.command.admin.usage.AddTrafficTypeCmd;
|
||||
import org.apache.cloudstack.api.command.admin.usage.DeleteTrafficMonitorCmd;
|
||||
import org.apache.cloudstack.api.command.admin.usage.DeleteTrafficTypeCmd;
|
||||
import org.apache.cloudstack.api.command.admin.usage.GenerateUsageRecordsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.usage.GetUsageRecordsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.usage.ListTrafficMonitorsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypesCmd;
|
||||
import org.apache.cloudstack.api.command.admin.usage.ListUsageTypesCmd;
|
||||
import org.apache.cloudstack.api.command.admin.usage.UpdateTrafficTypeCmd;
|
||||
import org.apache.cloudstack.api.command.admin.user.CreateUserCmd;
|
||||
import org.apache.cloudstack.api.command.admin.user.DeleteUserCmd;
|
||||
import org.apache.cloudstack.api.command.admin.user.DisableUserCmd;
|
||||
import org.apache.cloudstack.api.command.admin.user.EnableUserCmd;
|
||||
import org.apache.cloudstack.api.command.admin.user.GetUserCmd;
|
||||
import org.apache.cloudstack.api.command.admin.user.ListUsersCmd;
|
||||
import org.apache.cloudstack.api.command.admin.user.LockUserCmd;
|
||||
import org.apache.cloudstack.api.command.admin.user.RegisterCmd;
|
||||
import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vlan.CreateVlanIpRangeCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vlan.DeleteVlanIpRangeCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vlan.ListVlanIpRangesCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vm.AssignVMCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vm.MigrateVMCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vpc.CreatePrivateGatewayCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vpc.CreateVPCOfferingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vpc.DeletePrivateGatewayCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vpc.DeleteVPCOfferingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vpc.UpdateVPCOfferingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.zone.CreateZoneCmd;
|
||||
import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd;
|
||||
import org.apache.cloudstack.api.command.admin.zone.MarkDefaultZoneForAccountCmd;
|
||||
import org.apache.cloudstack.api.command.admin.zone.UpdateZoneCmd;
|
||||
import org.apache.cloudstack.api.command.user.account.AddAccountToProjectCmd;
|
||||
import org.apache.cloudstack.api.command.user.account.DeleteAccountFromProjectCmd;
|
||||
import org.apache.cloudstack.api.command.user.account.ListAccountsCmd;
|
||||
import org.apache.cloudstack.api.command.user.account.ListProjectAccountsCmd;
|
||||
import org.apache.cloudstack.api.command.user.address.AssociateIPAddrCmd;
|
||||
import org.apache.cloudstack.api.command.user.address.DisassociateIPAddrCmd;
|
||||
import org.apache.cloudstack.api.command.user.address.ListPublicIpAddressesCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScalePolicyCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScaleVmGroupCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScaleVmProfileCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.CreateConditionCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.DeleteAutoScalePolicyCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.DeleteAutoScaleVmGroupCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.DeleteAutoScaleVmProfileCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.DeleteConditionCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.DisableAutoScaleVmGroupCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.EnableAutoScaleVmGroupCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.ListAutoScalePoliciesCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.ListAutoScaleVmGroupsCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.ListAutoScaleVmProfilesCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.ListConditionsCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.ListCountersCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScalePolicyCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScaleVmGroupCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScaleVmProfileCmd;
|
||||
import org.apache.cloudstack.api.command.user.config.ListCapabilitiesCmd;
|
||||
import org.apache.cloudstack.api.command.user.event.ArchiveEventsCmd;
|
||||
import org.apache.cloudstack.api.command.user.event.DeleteEventsCmd;
|
||||
import org.apache.cloudstack.api.command.user.event.ListEventTypesCmd;
|
||||
import org.apache.cloudstack.api.command.user.event.ListEventsCmd;
|
||||
import org.apache.cloudstack.api.command.user.firewall.CreateEgressFirewallRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.firewall.CreateFirewallRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.firewall.CreatePortForwardingRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.firewall.DeleteEgressFirewallRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.firewall.DeleteFirewallRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.firewall.DeletePortForwardingRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.firewall.ListEgressFirewallRulesCmd;
|
||||
import org.apache.cloudstack.api.command.user.firewall.ListFirewallRulesCmd;
|
||||
import org.apache.cloudstack.api.command.user.firewall.ListPortForwardingRulesCmd;
|
||||
import org.apache.cloudstack.api.command.user.firewall.UpdatePortForwardingRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.guest.ListGuestOsCategoriesCmd;
|
||||
import org.apache.cloudstack.api.command.user.guest.ListGuestOsCmd;
|
||||
import org.apache.cloudstack.api.command.user.iso.AttachIsoCmd;
|
||||
import org.apache.cloudstack.api.command.user.iso.CopyIsoCmd;
|
||||
import org.apache.cloudstack.api.command.user.iso.DeleteIsoCmd;
|
||||
import org.apache.cloudstack.api.command.user.iso.DetachIsoCmd;
|
||||
import org.apache.cloudstack.api.command.user.iso.ExtractIsoCmd;
|
||||
import org.apache.cloudstack.api.command.user.iso.ListIsoPermissionsCmd;
|
||||
import org.apache.cloudstack.api.command.user.iso.ListIsosCmd;
|
||||
import org.apache.cloudstack.api.command.user.iso.RegisterIsoCmd;
|
||||
import org.apache.cloudstack.api.command.user.iso.UpdateIsoCmd;
|
||||
import org.apache.cloudstack.api.command.user.iso.UpdateIsoPermissionsCmd;
|
||||
import org.apache.cloudstack.api.command.user.job.ListAsyncJobsCmd;
|
||||
import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.AssignToLoadBalancerRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.CreateApplicationLoadBalancerCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLBHealthCheckPolicyCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLBStickinessPolicyCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLoadBalancerRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.DeleteApplicationLoadBalancerCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.DeleteLBHealthCheckPolicyCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.DeleteLBStickinessPolicyCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.DeleteLoadBalancerRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.ListApplicationLoadBalancersCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.ListLBHealthCheckPoliciesCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.ListLBStickinessPoliciesCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.ListLoadBalancerRuleInstancesCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.ListLoadBalancerRulesCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.RemoveFromLoadBalancerRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.UpdateLoadBalancerRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.nat.CreateIpForwardingRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.nat.DeleteIpForwardingRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.nat.DisableStaticNatCmd;
|
||||
import org.apache.cloudstack.api.command.user.nat.EnableStaticNatCmd;
|
||||
import org.apache.cloudstack.api.command.user.nat.ListIpForwardingRulesCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.CreateNetworkACLCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.DeleteNetworkACLCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.DeleteNetworkCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.ListNetworkACLsCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd;
|
||||
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.UpdateNetworkCmd;
|
||||
import org.apache.cloudstack.api.command.user.offering.ListDiskOfferingsCmd;
|
||||
import org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd;
|
||||
import org.apache.cloudstack.api.command.user.project.ActivateProjectCmd;
|
||||
import org.apache.cloudstack.api.command.user.project.CreateProjectCmd;
|
||||
import org.apache.cloudstack.api.command.user.project.DeleteProjectCmd;
|
||||
import org.apache.cloudstack.api.command.user.project.DeleteProjectInvitationCmd;
|
||||
import org.apache.cloudstack.api.command.user.project.ListProjectInvitationsCmd;
|
||||
import org.apache.cloudstack.api.command.user.project.ListProjectsCmd;
|
||||
import org.apache.cloudstack.api.command.user.project.SuspendProjectCmd;
|
||||
import org.apache.cloudstack.api.command.user.project.UpdateProjectCmd;
|
||||
import org.apache.cloudstack.api.command.user.project.UpdateProjectInvitationCmd;
|
||||
import org.apache.cloudstack.api.command.user.region.ListRegionsCmd;
|
||||
import org.apache.cloudstack.api.command.user.region.ha.gslb.AssignToGlobalLoadBalancerRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.region.ha.gslb.CreateGlobalLoadBalancerRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.region.ha.gslb.DeleteGlobalLoadBalancerRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.region.ha.gslb.ListGlobalLoadBalancerRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.region.ha.gslb.RemoveFromGlobalLoadBalancerRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.resource.GetCloudIdentifierCmd;
|
||||
import org.apache.cloudstack.api.command.user.resource.ListHypervisorsCmd;
|
||||
import org.apache.cloudstack.api.command.user.resource.ListResourceLimitsCmd;
|
||||
import org.apache.cloudstack.api.command.user.resource.UpdateResourceCountCmd;
|
||||
import org.apache.cloudstack.api.command.user.resource.UpdateResourceLimitCmd;
|
||||
import org.apache.cloudstack.api.command.user.securitygroup.AuthorizeSecurityGroupEgressCmd;
|
||||
import org.apache.cloudstack.api.command.user.securitygroup.AuthorizeSecurityGroupIngressCmd;
|
||||
import org.apache.cloudstack.api.command.user.securitygroup.CreateSecurityGroupCmd;
|
||||
import org.apache.cloudstack.api.command.user.securitygroup.DeleteSecurityGroupCmd;
|
||||
import org.apache.cloudstack.api.command.user.securitygroup.ListSecurityGroupsCmd;
|
||||
import org.apache.cloudstack.api.command.user.securitygroup.RevokeSecurityGroupEgressCmd;
|
||||
import org.apache.cloudstack.api.command.user.securitygroup.RevokeSecurityGroupIngressCmd;
|
||||
import org.apache.cloudstack.api.command.user.snapshot.CreateSnapshotCmd;
|
||||
import org.apache.cloudstack.api.command.user.snapshot.CreateSnapshotPolicyCmd;
|
||||
import org.apache.cloudstack.api.command.user.snapshot.DeleteSnapshotCmd;
|
||||
import org.apache.cloudstack.api.command.user.snapshot.DeleteSnapshotPoliciesCmd;
|
||||
import org.apache.cloudstack.api.command.user.snapshot.ListSnapshotPoliciesCmd;
|
||||
import org.apache.cloudstack.api.command.user.snapshot.ListSnapshotsCmd;
|
||||
import org.apache.cloudstack.api.command.user.ssh.CreateSSHKeyPairCmd;
|
||||
import org.apache.cloudstack.api.command.user.ssh.DeleteSSHKeyPairCmd;
|
||||
import org.apache.cloudstack.api.command.user.ssh.ListSSHKeyPairsCmd;
|
||||
import org.apache.cloudstack.api.command.user.ssh.RegisterSSHKeyPairCmd;
|
||||
import org.apache.cloudstack.api.command.user.tag.CreateTagsCmd;
|
||||
import org.apache.cloudstack.api.command.user.tag.DeleteTagsCmd;
|
||||
import org.apache.cloudstack.api.command.user.tag.ListTagsCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.CopyTemplateCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.CreateTemplateCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.DeleteTemplateCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.ExtractTemplateCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.ListTemplatePermissionsCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.ListTemplatesCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.RegisterTemplateCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.UpdateTemplateCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.UpdateTemplatePermissionsCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.AddIpToVmNicCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.AddNicToVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.DeployVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.DestroyVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.GetVMPasswordCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.ListVMsCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.RebootVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.RemoveIpFromVmNicCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.RemoveNicFromVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.ResetVMPasswordCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.ResetVMSSHKeyCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.RestoreVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.ScaleVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.StartVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.StopVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.UpdateDefaultNicForVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.UpdateVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.UpgradeVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd;
|
||||
import org.apache.cloudstack.api.command.user.vmgroup.DeleteVMGroupCmd;
|
||||
import org.apache.cloudstack.api.command.user.vmgroup.ListVMGroupsCmd;
|
||||
import org.apache.cloudstack.api.command.user.vmgroup.UpdateVMGroupCmd;
|
||||
import org.apache.cloudstack.api.command.user.vmsnapshot.CreateVMSnapshotCmd;
|
||||
import org.apache.cloudstack.api.command.user.vmsnapshot.DeleteVMSnapshotCmd;
|
||||
import org.apache.cloudstack.api.command.user.vmsnapshot.ListVMSnapshotCmd;
|
||||
import org.apache.cloudstack.api.command.user.vmsnapshot.RevertToSnapshotCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.DeleteVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.ExtractVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.ListVolumesCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.MigrateVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.UploadVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpc.CreateStaticRouteCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpc.CreateVPCCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpc.DeleteStaticRouteCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpc.DeleteVPCCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpc.ListPrivateGatewaysCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpc.ListStaticRoutesCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpc.ListVPCOfferingsCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpc.ListVPCsCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpc.RestartVPCCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpc.UpdateVPCCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.AddVpnUserCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.CreateRemoteAccessVpnCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.CreateVpnConnectionCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.CreateVpnCustomerGatewayCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.CreateVpnGatewayCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.DeleteRemoteAccessVpnCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.DeleteVpnConnectionCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.DeleteVpnCustomerGatewayCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.DeleteVpnGatewayCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.ListRemoteAccessVpnsCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.ListVpnConnectionsCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.ListVpnCustomerGatewaysCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.ListVpnGatewaysCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.ListVpnUsersCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.RemoveVpnUserCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.ResetVpnConnectionCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpn.UpdateVpnCustomerGatewayCmd;
|
||||
import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd;
|
||||
import org.apache.cloudstack.api.response.ExtractResponse;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.api.GetVncPortAnswer;
|
||||
|
|
@ -119,7 +395,11 @@ import com.cloud.alert.AlertManager;
|
|||
import com.cloud.alert.AlertVO;
|
||||
import com.cloud.alert.dao.AlertDao;
|
||||
import com.cloud.api.ApiDBUtils;
|
||||
import com.cloud.async.*;
|
||||
import com.cloud.async.AsyncJobExecutor;
|
||||
import com.cloud.async.AsyncJobManager;
|
||||
import com.cloud.async.AsyncJobResult;
|
||||
import com.cloud.async.AsyncJobVO;
|
||||
import com.cloud.async.BaseAsyncJobExecutor;
|
||||
import com.cloud.capacity.Capacity;
|
||||
import com.cloud.capacity.CapacityVO;
|
||||
import com.cloud.capacity.dao.CapacityDao;
|
||||
|
|
@ -132,9 +412,21 @@ import com.cloud.configuration.ConfigurationVO;
|
|||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.consoleproxy.ConsoleProxyManagementState;
|
||||
import com.cloud.consoleproxy.ConsoleProxyManager;
|
||||
import com.cloud.dc.*;
|
||||
import com.cloud.dc.AccountVlanMapVO;
|
||||
import com.cloud.dc.ClusterVO;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.HostPodVO;
|
||||
import com.cloud.dc.Pod;
|
||||
import com.cloud.dc.PodVlanMapVO;
|
||||
import com.cloud.dc.Vlan;
|
||||
import com.cloud.dc.Vlan.VlanType;
|
||||
import com.cloud.dc.dao.*;
|
||||
import com.cloud.dc.VlanVO;
|
||||
import com.cloud.dc.dao.AccountVlanMapDao;
|
||||
import com.cloud.dc.dao.ClusterDao;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.dc.dao.HostPodDao;
|
||||
import com.cloud.dc.dao.PodVlanMapDao;
|
||||
import com.cloud.dc.dao.VlanDao;
|
||||
import com.cloud.deploy.DataCenterDeployment;
|
||||
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
|
||||
import com.cloud.domain.DomainVO;
|
||||
|
|
@ -144,7 +436,12 @@ import com.cloud.event.ActionEventUtils;
|
|||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.event.EventVO;
|
||||
import com.cloud.event.dao.EventDao;
|
||||
import com.cloud.exception.*;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.OperationTimedoutException;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.exception.StorageUnavailableException;
|
||||
import com.cloud.ha.HighAvailabilityManager;
|
||||
import com.cloud.host.DetailVO;
|
||||
import com.cloud.host.Host;
|
||||
|
|
@ -161,7 +458,12 @@ import com.cloud.hypervisor.dao.HypervisorCapabilitiesDao;
|
|||
import com.cloud.info.ConsoleProxyInfo;
|
||||
import com.cloud.keystore.KeystoreManager;
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.network.dao.*;
|
||||
import com.cloud.network.dao.IPAddressDao;
|
||||
import com.cloud.network.dao.IPAddressVO;
|
||||
import com.cloud.network.dao.LoadBalancerDao;
|
||||
import com.cloud.network.dao.LoadBalancerVO;
|
||||
import com.cloud.network.dao.NetworkDao;
|
||||
import com.cloud.network.dao.NetworkVO;
|
||||
import com.cloud.org.Cluster;
|
||||
import com.cloud.org.Grouping.AllocationState;
|
||||
import com.cloud.projects.Project;
|
||||
|
|
@ -172,10 +474,26 @@ import com.cloud.server.ResourceTag.TaggedResourceType;
|
|||
import com.cloud.server.auth.UserAuthenticator;
|
||||
import com.cloud.service.ServiceOfferingVO;
|
||||
import com.cloud.service.dao.ServiceOfferingDao;
|
||||
import com.cloud.storage.*;
|
||||
import com.cloud.storage.GuestOS;
|
||||
import com.cloud.storage.GuestOSCategoryVO;
|
||||
import com.cloud.storage.GuestOSVO;
|
||||
import com.cloud.storage.GuestOsCategory;
|
||||
import com.cloud.storage.Storage;
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.storage.StorageManager;
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.storage.Upload;
|
||||
import com.cloud.storage.Upload.Mode;
|
||||
import com.cloud.storage.dao.*;
|
||||
import com.cloud.storage.UploadVO;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.storage.VolumeVO;
|
||||
import com.cloud.storage.dao.DiskOfferingDao;
|
||||
import com.cloud.storage.dao.GuestOSCategoryDao;
|
||||
import com.cloud.storage.dao.GuestOSDao;
|
||||
import com.cloud.storage.dao.UploadDao;
|
||||
import com.cloud.storage.dao.VMTemplateDao;
|
||||
import com.cloud.storage.dao.VolumeDao;
|
||||
import com.cloud.storage.s3.S3Manager;
|
||||
import com.cloud.storage.secondary.SecondaryStorageVmManager;
|
||||
import com.cloud.storage.snapshot.SnapshotManager;
|
||||
|
|
@ -185,7 +503,13 @@ import com.cloud.tags.ResourceTagVO;
|
|||
import com.cloud.tags.dao.ResourceTagDao;
|
||||
import com.cloud.template.TemplateManager;
|
||||
import com.cloud.template.VirtualMachineTemplate.TemplateFilter;
|
||||
import com.cloud.user.*;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.AccountManager;
|
||||
import com.cloud.user.SSHKeyPair;
|
||||
import com.cloud.user.SSHKeyPairVO;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.user.UserContext;
|
||||
import com.cloud.user.UserVO;
|
||||
import com.cloud.user.dao.AccountDao;
|
||||
import com.cloud.user.dao.SSHKeyPairDao;
|
||||
import com.cloud.user.dao.UserDao;
|
||||
|
|
@ -193,142 +517,42 @@ import com.cloud.utils.EnumUtils;
|
|||
import com.cloud.utils.NumbersUtil;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.PasswordGenerator;
|
||||
import com.cloud.utils.ReflectUtil;
|
||||
import com.cloud.utils.Ternary;
|
||||
import com.cloud.utils.component.Adapter;
|
||||
import com.cloud.utils.component.AdapterBase;
|
||||
import com.cloud.utils.component.ComponentContext;
|
||||
import com.cloud.utils.component.ComponentLifecycle;
|
||||
import com.cloud.utils.component.ManagerBase;
|
||||
import com.cloud.utils.concurrency.NamedThreadFactory;
|
||||
import com.cloud.utils.crypt.DBEncryptionUtil;
|
||||
import com.cloud.utils.db.*;
|
||||
import com.cloud.utils.db.DB;
|
||||
import com.cloud.utils.db.Filter;
|
||||
import com.cloud.utils.db.GlobalLock;
|
||||
import com.cloud.utils.db.JoinBuilder;
|
||||
import com.cloud.utils.db.JoinBuilder.JoinType;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.net.MacAddress;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
import com.cloud.utils.ssh.SSHKeysHelper;
|
||||
import com.cloud.vm.*;
|
||||
import com.cloud.vm.ConsoleProxyVO;
|
||||
import com.cloud.vm.InstanceGroupVO;
|
||||
import com.cloud.vm.SecondaryStorageVmVO;
|
||||
import com.cloud.vm.UserVmVO;
|
||||
import com.cloud.vm.VMInstanceVO;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachine.State;
|
||||
import com.cloud.vm.dao.*;
|
||||
import com.cloud.vm.VirtualMachineManager;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
import com.cloud.vm.VirtualMachineProfileImpl;
|
||||
import com.cloud.vm.dao.ConsoleProxyDao;
|
||||
import com.cloud.vm.dao.DomainRouterDao;
|
||||
import com.cloud.vm.dao.InstanceGroupDao;
|
||||
import com.cloud.vm.dao.SecondaryStorageVmDao;
|
||||
import com.cloud.vm.dao.UserVmDao;
|
||||
import com.cloud.vm.dao.VMInstanceDao;
|
||||
|
||||
import edu.emory.mathcs.backport.java.util.Arrays;
|
||||
import edu.emory.mathcs.backport.java.util.Collections;
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoCmd;
|
||||
import org.apache.cloudstack.api.command.admin.account.*;
|
||||
import org.apache.cloudstack.api.command.admin.autoscale.CreateCounterCmd;
|
||||
import org.apache.cloudstack.api.command.admin.autoscale.DeleteCounterCmd;
|
||||
import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
|
||||
import org.apache.cloudstack.api.command.admin.cluster.DeleteClusterCmd;
|
||||
import org.apache.cloudstack.api.command.admin.cluster.ListClustersCmd;
|
||||
import org.apache.cloudstack.api.command.admin.cluster.UpdateClusterCmd;
|
||||
import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd;
|
||||
import org.apache.cloudstack.api.command.admin.config.ListHypervisorCapabilitiesCmd;
|
||||
import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
|
||||
import org.apache.cloudstack.api.command.admin.config.UpdateHypervisorCapabilitiesCmd;
|
||||
import org.apache.cloudstack.api.command.admin.domain.*;
|
||||
import org.apache.cloudstack.api.command.admin.host.*;
|
||||
import org.apache.cloudstack.api.command.admin.ldap.LDAPConfigCmd;
|
||||
import org.apache.cloudstack.api.command.admin.ldap.LDAPRemoveCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.*;
|
||||
import org.apache.cloudstack.api.command.admin.offering.*;
|
||||
import org.apache.cloudstack.api.command.admin.pod.CreatePodCmd;
|
||||
import org.apache.cloudstack.api.command.admin.pod.DeletePodCmd;
|
||||
import org.apache.cloudstack.api.command.admin.pod.ListPodsByCmd;
|
||||
import org.apache.cloudstack.api.command.admin.pod.UpdatePodCmd;
|
||||
import org.apache.cloudstack.api.command.admin.region.AddRegionCmd;
|
||||
import org.apache.cloudstack.api.command.admin.region.RemoveRegionCmd;
|
||||
import org.apache.cloudstack.api.command.admin.region.UpdateRegionCmd;
|
||||
import org.apache.cloudstack.api.command.admin.resource.*;
|
||||
import org.apache.cloudstack.api.command.admin.router.*;
|
||||
import org.apache.cloudstack.api.command.admin.storage.*;
|
||||
import org.apache.cloudstack.api.command.admin.swift.AddSwiftCmd;
|
||||
import org.apache.cloudstack.api.command.admin.swift.ListSwiftsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.systemvm.*;
|
||||
import org.apache.cloudstack.api.command.admin.template.PrepareTemplateCmd;
|
||||
import org.apache.cloudstack.api.command.admin.usage.*;
|
||||
import org.apache.cloudstack.api.command.admin.user.*;
|
||||
import org.apache.cloudstack.api.command.admin.vlan.CreateVlanIpRangeCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vlan.DeleteVlanIpRangeCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vlan.ListVlanIpRangesCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vm.AssignVMCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vm.MigrateVMCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vpc.*;
|
||||
import org.apache.cloudstack.api.command.admin.zone.CreateZoneCmd;
|
||||
import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd;
|
||||
import org.apache.cloudstack.api.command.admin.zone.MarkDefaultZoneForAccountCmd;
|
||||
import org.apache.cloudstack.api.command.admin.zone.UpdateZoneCmd;
|
||||
import org.apache.cloudstack.api.command.user.account.AddAccountToProjectCmd;
|
||||
import org.apache.cloudstack.api.command.user.account.DeleteAccountFromProjectCmd;
|
||||
import org.apache.cloudstack.api.command.user.account.ListAccountsCmd;
|
||||
import org.apache.cloudstack.api.command.user.account.ListProjectAccountsCmd;
|
||||
import org.apache.cloudstack.api.command.user.address.AssociateIPAddrCmd;
|
||||
import org.apache.cloudstack.api.command.user.address.DisassociateIPAddrCmd;
|
||||
import org.apache.cloudstack.api.command.user.address.ListPublicIpAddressesCmd;
|
||||
import org.apache.cloudstack.api.command.user.autoscale.*;
|
||||
import org.apache.cloudstack.api.command.user.config.ListCapabilitiesCmd;
|
||||
import org.apache.cloudstack.api.command.user.event.ArchiveEventsCmd;
|
||||
import org.apache.cloudstack.api.command.user.event.DeleteEventsCmd;
|
||||
import org.apache.cloudstack.api.command.user.event.ListEventTypesCmd;
|
||||
import org.apache.cloudstack.api.command.user.event.ListEventsCmd;
|
||||
import org.apache.cloudstack.api.command.user.firewall.*;
|
||||
import org.apache.cloudstack.api.command.user.guest.ListGuestOsCategoriesCmd;
|
||||
import org.apache.cloudstack.api.command.user.guest.ListGuestOsCmd;
|
||||
import org.apache.cloudstack.api.command.user.iso.*;
|
||||
import org.apache.cloudstack.api.command.user.job.ListAsyncJobsCmd;
|
||||
import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.*;
|
||||
import org.apache.cloudstack.api.command.user.nat.*;
|
||||
import org.apache.cloudstack.api.command.user.network.*;
|
||||
import org.apache.cloudstack.api.command.user.offering.ListDiskOfferingsCmd;
|
||||
import org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd;
|
||||
import org.apache.cloudstack.api.command.user.project.*;
|
||||
import org.apache.cloudstack.api.command.user.region.ListRegionsCmd;
|
||||
import org.apache.cloudstack.api.command.user.region.ha.gslb.*;
|
||||
import org.apache.cloudstack.api.command.user.resource.*;
|
||||
import org.apache.cloudstack.api.command.user.securitygroup.*;
|
||||
import org.apache.cloudstack.api.command.user.snapshot.*;
|
||||
import org.apache.cloudstack.api.command.user.ssh.CreateSSHKeyPairCmd;
|
||||
import org.apache.cloudstack.api.command.user.ssh.DeleteSSHKeyPairCmd;
|
||||
import org.apache.cloudstack.api.command.user.ssh.ListSSHKeyPairsCmd;
|
||||
import org.apache.cloudstack.api.command.user.ssh.RegisterSSHKeyPairCmd;
|
||||
import org.apache.cloudstack.api.command.user.tag.CreateTagsCmd;
|
||||
import org.apache.cloudstack.api.command.user.tag.DeleteTagsCmd;
|
||||
import org.apache.cloudstack.api.command.user.tag.ListTagsCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.*;
|
||||
import org.apache.cloudstack.api.command.user.vm.*;
|
||||
import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd;
|
||||
import org.apache.cloudstack.api.command.user.vmgroup.DeleteVMGroupCmd;
|
||||
import org.apache.cloudstack.api.command.user.vmgroup.ListVMGroupsCmd;
|
||||
import org.apache.cloudstack.api.command.user.vmgroup.UpdateVMGroupCmd;
|
||||
import org.apache.cloudstack.api.command.user.vmsnapshot.CreateVMSnapshotCmd;
|
||||
import org.apache.cloudstack.api.command.user.vmsnapshot.DeleteVMSnapshotCmd;
|
||||
import org.apache.cloudstack.api.command.user.vmsnapshot.ListVMSnapshotCmd;
|
||||
import org.apache.cloudstack.api.command.user.vmsnapshot.RevertToSnapshotCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.*;
|
||||
import org.apache.cloudstack.api.command.user.vpc.*;
|
||||
import org.apache.cloudstack.api.command.user.vpn.*;
|
||||
import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd;
|
||||
import org.apache.cloudstack.api.response.ExtractResponse;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class ManagementServerImpl extends ManagerBase implements ManagementServer {
|
||||
public static final Logger s_logger = Logger.getLogger(ManagementServerImpl.class.getName());
|
||||
|
|
@ -2301,6 +2525,9 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||
cmdList.add(AssignToGlobalLoadBalancerRuleCmd.class);
|
||||
cmdList.add(RemoveFromGlobalLoadBalancerRuleCmd.class);
|
||||
cmdList.add(ListStorageProvidersCmd.class);
|
||||
cmdList.add(CreateApplicationLoadBalancerCmd.class);
|
||||
cmdList.add(ListApplicationLoadBalancersCmd.class);
|
||||
cmdList.add(DeleteApplicationLoadBalancerCmd.class);
|
||||
return cmdList;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
// 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 org.apache.cloudstack.network.lb;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.network.NetworkModel;
|
||||
import com.cloud.network.rules.ApplicationLoadBalancerRule;
|
||||
import com.cloud.network.rules.LoadBalancerContainer.Scheme;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.component.ManagerBase;
|
||||
|
||||
@Component
|
||||
@Local(value = { ApplicationLoadBalancerService.class })
|
||||
public class ApplicationLoadBalancerManagerImpl extends ManagerBase implements ApplicationLoadBalancerService {
|
||||
private static final Logger s_logger = Logger.getLogger(ApplicationLoadBalancerManagerImpl.class);
|
||||
|
||||
@Inject NetworkModel _networkModel;
|
||||
|
||||
@Override
|
||||
public ApplicationLoadBalancerRule createApplicationLoadBalancer(String name, String description, Scheme scheme, long sourceIpNetworkId, String sourceIp,
|
||||
int sourcePort, int instancePort, String algorithm, long networkId, long lbOwnerId) throws InsufficientAddressCapacityException,
|
||||
NetworkRuleConflictException {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteApplicationLoadBalancer(long id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<List<? extends ApplicationLoadBalancerRule>, Integer> listApplicationLoadBalancers() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -850,4 +850,10 @@ public class MockNetworkModelImpl extends ManagerBase implements NetworkModel {
|
|||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IpAddress getPublicIpAddress(String ipAddress, long networkId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -863,4 +863,10 @@ public class MockNetworkModelImpl extends ManagerBase implements NetworkModel {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IpAddress getPublicIpAddress(String ipAddress, long networkId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ import com.cloud.network.RemoteAccessVpn;
|
|||
import com.cloud.network.Site2SiteVpnConnection;
|
||||
import com.cloud.network.VpcVirtualNetworkApplianceService;
|
||||
import com.cloud.network.VpnUser;
|
||||
import com.cloud.network.lb.LoadBalancingRule;
|
||||
import com.cloud.network.router.VirtualRouter;
|
||||
import com.cloud.network.router.VpcVirtualNetworkApplianceManager;
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
|
|
@ -402,4 +403,10 @@ VpcVirtualNetworkApplianceService {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applyLoadBalancingRules(Network network, List<? extends LoadBalancingRule> rules, List<? extends VirtualRouter> routers) throws ResourceUnavailableException {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -448,3 +448,10 @@ CREATE TABLE `cloud`.`vm_snapshots` (
|
|||
ALTER TABLE `cloud`.`hypervisor_capabilities` ADD COLUMN `vm_snapshot_enabled` tinyint(1) DEFAULT 0 NOT NULL COMMENT 'Whether VM snapshot is supported by hypervisor';
|
||||
UPDATE `cloud`.`hypervisor_capabilities` SET `vm_snapshot_enabled`=1 WHERE `hypervisor_type` in ('VMware', 'XenServer');
|
||||
|
||||
|
||||
ALTER TABLE `cloud`.`load_balancing_rules` ADD COLUMN `source_ip_address` varchar(40) COMMENT 'source ip address for the load balancer rule';
|
||||
ALTER TABLE `cloud`.`load_balancing_rules` ADD COLUMN `source_ip_address_network_id` varchar(40) COMMENT 'the UUID of the network where source ip belongs to';
|
||||
ALTER TABLE `cloud`.`load_balancing_rules` ADD COLUMN `scheme` varchar(40) NOT NULL COMMENT 'load balancer scheme; can be Internal or Public';
|
||||
UPDATE `cloud`.`load_balancing_rules` SET `scheme`='Public';
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue