mirror of https://github.com/apache/cloudstack.git
CS-15644-Autoscale: Implemented UUIDs for templateId-serviceOff Reviewed-By:Vijay
This commit is contained in:
parent
3e32a29048
commit
bf1e6ed991
|
|
@ -36,7 +36,7 @@ import com.cloud.utils.Pair;
|
||||||
|
|
||||||
|
|
||||||
public class LoadBalancerTO {
|
public class LoadBalancerTO {
|
||||||
Long id;
|
String uuid;
|
||||||
String srcIp;
|
String srcIp;
|
||||||
int srcPort;
|
int srcPort;
|
||||||
String protocol;
|
String protocol;
|
||||||
|
|
@ -48,11 +48,11 @@ public class LoadBalancerTO {
|
||||||
private AutoScaleVmGroupTO autoScaleVmGroupTO;
|
private AutoScaleVmGroupTO autoScaleVmGroupTO;
|
||||||
final static int MAX_STICKINESS_POLICIES = 1;
|
final static int MAX_STICKINESS_POLICIES = 1;
|
||||||
|
|
||||||
public LoadBalancerTO (Long id, String srcIp, int srcPort, String protocol, String algorithm, boolean revoked, boolean alreadyAdded, List<LbDestination> destinations) {
|
public LoadBalancerTO(String uuid, String srcIp, int srcPort, String protocol, String algorithm, boolean revoked, boolean alreadyAdded, List<LbDestination> destinations) {
|
||||||
if (destinations == null) { // for autoscaleconfig destinations will be null;
|
if(destinations == null) { // for autoscaleconfig destinations will be null;
|
||||||
destinations = new ArrayList<LbDestination>();
|
destinations = new ArrayList<LbDestination>();
|
||||||
}
|
}
|
||||||
this.id = id;
|
this.uuid = uuid;
|
||||||
this.srcIp = srcIp;
|
this.srcIp = srcIp;
|
||||||
this.srcPort = srcPort;
|
this.srcPort = srcPort;
|
||||||
this.protocol = protocol;
|
this.protocol = protocol;
|
||||||
|
|
@ -67,7 +67,7 @@ public class LoadBalancerTO {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoadBalancerTO (Long id, String srcIp, int srcPort, String protocol, String algorithm, boolean revoked, boolean alreadyAdded, List<LbDestination> arg_destinations, List<LbStickinessPolicy> stickinessPolicies) {
|
public LoadBalancerTO(String id, String srcIp, int srcPort, String protocol, String algorithm, boolean revoked, boolean alreadyAdded, List<LbDestination> arg_destinations, List<LbStickinessPolicy> stickinessPolicies) {
|
||||||
this(id, srcIp, srcPort, protocol, algorithm, revoked, alreadyAdded, arg_destinations);
|
this(id, srcIp, srcPort, protocol, algorithm, revoked, alreadyAdded, arg_destinations);
|
||||||
this.stickinessPolicies = null;
|
this.stickinessPolicies = null;
|
||||||
if (stickinessPolicies != null && stickinessPolicies.size() > 0) {
|
if (stickinessPolicies != null && stickinessPolicies.size() > 0) {
|
||||||
|
|
@ -78,19 +78,18 @@ public class LoadBalancerTO {
|
||||||
this.stickinessPolicies[index] = new StickinessPolicyTO(stickinesspolicy.getMethodName(), stickinesspolicy.getParams());
|
this.stickinessPolicies[index] = new StickinessPolicyTO(stickinesspolicy.getMethodName(), stickinesspolicy.getParams());
|
||||||
index++;
|
index++;
|
||||||
if (index == MAX_STICKINESS_POLICIES) break;
|
if (index == MAX_STICKINESS_POLICIES) break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (index == 0) this.stickinessPolicies = null;
|
if (index == 0) this.stickinessPolicies = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected LoadBalancerTO() {
|
protected LoadBalancerTO() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getUuid() {
|
||||||
public Long getId() {
|
return uuid;
|
||||||
return id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSrcIp() {
|
public String getSrcIp() {
|
||||||
|
|
@ -186,7 +185,7 @@ public class LoadBalancerTO {
|
||||||
return alreadyAdded;
|
return alreadyAdded;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static class CounterTO implements Serializable {
|
public static class CounterTO implements Serializable{
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String source;
|
private final String source;
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|
@ -210,7 +209,7 @@ public class LoadBalancerTO {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ConditionTO implements Serializable {
|
public static class ConditionTO implements Serializable{
|
||||||
private final long threshold;
|
private final long threshold;
|
||||||
private final String relationalOperator;
|
private final String relationalOperator;
|
||||||
private final CounterTO counter;
|
private final CounterTO counter;
|
||||||
|
|
@ -235,7 +234,7 @@ public class LoadBalancerTO {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class AutoScalePolicyTO implements Serializable {
|
public static class AutoScalePolicyTO implements Serializable{
|
||||||
private final long id;
|
private final long id;
|
||||||
private final int duration;
|
private final int duration;
|
||||||
private final int quietTime;
|
private final int quietTime;
|
||||||
|
|
@ -277,11 +276,11 @@ public class LoadBalancerTO {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class AutoScaleVmProfileTO implements Serializable {
|
public static class AutoScaleVmProfileTO implements Serializable{
|
||||||
private final Long zoneId;
|
private final String zoneId;
|
||||||
private final Long domainId;
|
private final String domainId;
|
||||||
private final Long serviceOfferingId;
|
private final String serviceOfferingId;
|
||||||
private final Long templateId;
|
private final String templateId;
|
||||||
private final String otherDeployParams;
|
private final String otherDeployParams;
|
||||||
private final String snmpCommunity;
|
private final String snmpCommunity;
|
||||||
private final Integer snmpPort;
|
private final Integer snmpPort;
|
||||||
|
|
@ -290,7 +289,7 @@ public class LoadBalancerTO {
|
||||||
private final String autoScaleUserApiKey;
|
private final String autoScaleUserApiKey;
|
||||||
private final String autoScaleUserSecretKey;
|
private final String autoScaleUserSecretKey;
|
||||||
|
|
||||||
public AutoScaleVmProfileTO(Long zoneId, Long domainId, String cloudStackApiUrl, String autoScaleUserApiKey, String autoScaleUserSecretKey, Long serviceOfferingId, Long templateId,
|
public AutoScaleVmProfileTO(String zoneId, String domainId, String cloudStackApiUrl, String autoScaleUserApiKey, String autoScaleUserSecretKey, String serviceOfferingId, String templateId,
|
||||||
String otherDeployParams, String snmpCommunity, Integer snmpPort, Integer destroyVmGraceperiod) {
|
String otherDeployParams, String snmpCommunity, Integer snmpPort, Integer destroyVmGraceperiod) {
|
||||||
this.zoneId = zoneId;
|
this.zoneId = zoneId;
|
||||||
this.domainId = domainId;
|
this.domainId = domainId;
|
||||||
|
|
@ -305,19 +304,19 @@ public class LoadBalancerTO {
|
||||||
this.autoScaleUserSecretKey = autoScaleUserSecretKey;
|
this.autoScaleUserSecretKey = autoScaleUserSecretKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getZoneId() {
|
public String getZoneId() {
|
||||||
return zoneId;
|
return zoneId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getDomainId() {
|
public String getDomainId() {
|
||||||
return domainId;
|
return domainId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getServiceOfferingId() {
|
public String getServiceOfferingId() {
|
||||||
return serviceOfferingId;
|
return serviceOfferingId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getTemplateId() {
|
public String getTemplateId() {
|
||||||
return templateId;
|
return templateId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -350,7 +349,7 @@ public class LoadBalancerTO {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class AutoScaleVmGroupTO implements Serializable {
|
public static class AutoScaleVmGroupTO implements Serializable{
|
||||||
private final int minMembers;
|
private final int minMembers;
|
||||||
private final int maxMembers;
|
private final int maxMembers;
|
||||||
private final int memberPort;
|
private final int memberPort;
|
||||||
|
|
@ -402,7 +401,7 @@ public class LoadBalancerTO {
|
||||||
|
|
||||||
public String getCurrentState() {
|
public String getCurrentState() {
|
||||||
return currentState;
|
return currentState;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAutoScaleVmGroup(LbAutoScaleVmGroup lbAutoScaleVmGroup)
|
public void setAutoScaleVmGroup(LbAutoScaleVmGroup lbAutoScaleVmGroup)
|
||||||
|
|
@ -427,9 +426,9 @@ public class LoadBalancerTO {
|
||||||
LbAutoScaleVmProfile lbAutoScaleVmProfile = lbAutoScaleVmGroup.getProfile();
|
LbAutoScaleVmProfile lbAutoScaleVmProfile = lbAutoScaleVmGroup.getProfile();
|
||||||
AutoScaleVmProfile autoScaleVmProfile = lbAutoScaleVmProfile.getProfile();
|
AutoScaleVmProfile autoScaleVmProfile = lbAutoScaleVmProfile.getProfile();
|
||||||
|
|
||||||
AutoScaleVmProfileTO autoScaleVmProfileTO = new AutoScaleVmProfileTO(autoScaleVmProfile.getZoneId(), autoScaleVmProfile.getDomainId(),
|
AutoScaleVmProfileTO autoScaleVmProfileTO = new AutoScaleVmProfileTO(lbAutoScaleVmProfile.getZoneId(), lbAutoScaleVmProfile.getDomainId(),
|
||||||
lbAutoScaleVmProfile.getCsUrl(), lbAutoScaleVmProfile.getAutoScaleUserApiKey(), lbAutoScaleVmProfile.getAutoScaleUserSecretKey(),
|
lbAutoScaleVmProfile.getCsUrl(), lbAutoScaleVmProfile.getAutoScaleUserApiKey(), lbAutoScaleVmProfile.getAutoScaleUserSecretKey(),
|
||||||
autoScaleVmProfile.getServiceOfferingId(), autoScaleVmProfile.getTemplateId(), autoScaleVmProfile.getOtherDeployParams(),
|
lbAutoScaleVmProfile.getServiceOfferingId(), lbAutoScaleVmProfile.getTemplateId(), autoScaleVmProfile.getOtherDeployParams(),
|
||||||
autoScaleVmProfile.getSnmpCommunity(), autoScaleVmProfile.getSnmpPort(), autoScaleVmProfile.getDestroyVmGraceperiod());
|
autoScaleVmProfile.getSnmpCommunity(), autoScaleVmProfile.getSnmpPort(), autoScaleVmProfile.getDestroyVmGraceperiod());
|
||||||
|
|
||||||
AutoScaleVmGroup autoScaleVmGroup = lbAutoScaleVmGroup.getVmGroup();
|
AutoScaleVmGroup autoScaleVmGroup = lbAutoScaleVmGroup.getVmGroup();
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,19 @@
|
||||||
// Licensed to the Apache Software Foundation (ASF) under one
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
// or more contributor license agreements. See the NOTICE file
|
// or more contributor license agreements. See the NOTICE file
|
||||||
// distributed with this work for additional information
|
// distributed with this work for additional information
|
||||||
// regarding copyright ownership. The ASF licenses this file
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
// to you under the Apache License, Version 2.0 (the
|
// to you under the Apache License, Version 2.0 (the
|
||||||
// "License"); you may not use this file except in compliance
|
// "License"); you may not use this file except in compliance
|
||||||
// with the License. You may obtain a copy of the License at
|
// with the License. You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
// Unless required by applicable law or agreed to in writing,
|
// Unless required by applicable law or agreed to in writing,
|
||||||
// software distributed under the License is distributed on an
|
// software distributed under the License is distributed on an
|
||||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
// KIND, either express or implied. See the License for the
|
// KIND, either express or implied. See the License for the
|
||||||
// specific language governing permissions and limitations
|
// specific language governing permissions and limitations
|
||||||
// under the License.
|
// under the License.
|
||||||
|
|
||||||
package com.cloud.network.as;
|
package com.cloud.network.as;
|
||||||
|
|
||||||
|
|
@ -46,4 +46,6 @@ public interface AutoScaleVmGroup extends ControlledEntity {
|
||||||
|
|
||||||
String getState();
|
String getState();
|
||||||
|
|
||||||
|
String getUuid();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,11 @@ public class LoadBalancingRule implements FirewallRule, LoadBalancer {
|
||||||
return lb.getAlgorithm();
|
return lb.getAlgorithm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUuid() {
|
||||||
|
return lb.getUuid();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getXid() {
|
public String getXid() {
|
||||||
return lb.getXid();
|
return lb.getXid();
|
||||||
|
|
@ -297,12 +302,20 @@ public class LoadBalancingRule implements FirewallRule, LoadBalancer {
|
||||||
private final String autoScaleUserApiKey;
|
private final String autoScaleUserApiKey;
|
||||||
private final String autoScaleUserSecretKey;
|
private final String autoScaleUserSecretKey;
|
||||||
private final String csUrl;
|
private final String csUrl;
|
||||||
|
private final String zoneId;
|
||||||
|
private final String domainId;
|
||||||
|
private final String serviceOfferingId;
|
||||||
|
private final String templateId;
|
||||||
|
|
||||||
public LbAutoScaleVmProfile(AutoScaleVmProfile profile, String autoScaleUserApiKey, String autoScaleUserSecretKey, String csUrl) {
|
public LbAutoScaleVmProfile(AutoScaleVmProfile profile, String autoScaleUserApiKey, String autoScaleUserSecretKey, String csUrl, String zoneId, String domainId, String serviceOfferingId, String templateId) {
|
||||||
this.profile = profile;
|
this.profile = profile;
|
||||||
this.autoScaleUserApiKey = autoScaleUserApiKey;
|
this.autoScaleUserApiKey = autoScaleUserApiKey;
|
||||||
this.autoScaleUserSecretKey = autoScaleUserSecretKey;
|
this.autoScaleUserSecretKey = autoScaleUserSecretKey;
|
||||||
this.csUrl = csUrl;
|
this.csUrl = csUrl;
|
||||||
|
this.zoneId = zoneId;
|
||||||
|
this.domainId = domainId;
|
||||||
|
this.serviceOfferingId = serviceOfferingId;
|
||||||
|
this.templateId = templateId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AutoScaleVmProfile getProfile() {
|
public AutoScaleVmProfile getProfile() {
|
||||||
|
|
@ -316,11 +329,28 @@ public class LoadBalancingRule implements FirewallRule, LoadBalancer {
|
||||||
public String getAutoScaleUserSecretKey() {
|
public String getAutoScaleUserSecretKey() {
|
||||||
return autoScaleUserSecretKey;
|
return autoScaleUserSecretKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCsUrl() {
|
public String getCsUrl() {
|
||||||
return csUrl;
|
return csUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getZoneId() {
|
||||||
|
return zoneId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDomainId() {
|
||||||
|
return domainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getServiceOfferingId() {
|
||||||
|
return serviceOfferingId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTemplateId() {
|
||||||
|
return templateId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class LbAutoScaleVmGroup {
|
public static class LbAutoScaleVmGroup {
|
||||||
AutoScaleVmGroup vmGroup;
|
AutoScaleVmGroup vmGroup;
|
||||||
private final List<LbAutoScalePolicy> policies;
|
private final List<LbAutoScalePolicy> policies;
|
||||||
|
|
@ -350,4 +380,5 @@ public class LoadBalancingRule implements FirewallRule, LoadBalancer {
|
||||||
return currentState;
|
return currentState;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
package com.cloud.network.rules;
|
package com.cloud.network.rules;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Definition for a LoadBalancer
|
* Definition for a LoadBalancer
|
||||||
*/
|
*/
|
||||||
public interface LoadBalancer extends FirewallRule {
|
public interface LoadBalancer extends FirewallRule {
|
||||||
|
|
||||||
|
|
@ -26,9 +26,10 @@ public interface LoadBalancer extends FirewallRule {
|
||||||
String getDescription();
|
String getDescription();
|
||||||
|
|
||||||
int getDefaultPortStart();
|
int getDefaultPortStart();
|
||||||
|
|
||||||
int getDefaultPortEnd();
|
int getDefaultPortEnd();
|
||||||
|
|
||||||
String getAlgorithm();
|
String getAlgorithm();
|
||||||
|
|
||||||
|
String getUuid();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ import com.cloud.vm.dao.NicDao;
|
||||||
public class ElasticLoadBalancerManagerImpl implements
|
public class ElasticLoadBalancerManagerImpl implements
|
||||||
ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
private static final Logger s_logger = Logger
|
private static final Logger s_logger = Logger
|
||||||
.getLogger(ElasticLoadBalancerManagerImpl.class);
|
.getLogger(ElasticLoadBalancerManagerImpl.class);
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
IPAddressDao _ipAddressDao;
|
IPAddressDao _ipAddressDao;
|
||||||
|
|
@ -184,9 +184,9 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
PodVlanMapDao _podVlanMapDao;
|
PodVlanMapDao _podVlanMapDao;
|
||||||
@Inject
|
@Inject
|
||||||
ElasticLbVmMapDao _elbVmMapDao;
|
ElasticLbVmMapDao _elbVmMapDao;
|
||||||
@Inject
|
@Inject
|
||||||
NetworkDao _networksDao;
|
NetworkDao _networksDao;
|
||||||
@Inject
|
@Inject
|
||||||
AccountDao _accountDao;
|
AccountDao _accountDao;
|
||||||
@Inject
|
@Inject
|
||||||
PhysicalNetworkServiceProviderDao _physicalProviderDao;
|
PhysicalNetworkServiceProviderDao _physicalProviderDao;
|
||||||
|
|
@ -195,7 +195,6 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
@Inject
|
@Inject
|
||||||
NicDao _nicDao;
|
NicDao _nicDao;
|
||||||
|
|
||||||
|
|
||||||
String _name;
|
String _name;
|
||||||
String _instance;
|
String _instance;
|
||||||
static final private String _elbVmNamePrefix = "l";
|
static final private String _elbVmNamePrefix = "l";
|
||||||
|
|
@ -225,8 +224,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DomainRouterVO deployLoadBalancerVM(Long networkId, IPAddressVO ipAddr, Long accountId) {
|
||||||
public DomainRouterVO deployLoadBalancerVM(Long networkId, IPAddressVO ipAddr, Long accountId) {
|
|
||||||
NetworkVO network = _networkDao.findById(networkId);
|
NetworkVO network = _networkDao.findById(networkId);
|
||||||
DataCenter dc = _dcDao.findById(network.getDataCenterId());
|
DataCenter dc = _dcDao.findById(network.getDataCenterId());
|
||||||
Long podId = getPodIdForDirectIp(ipAddr);
|
Long podId = getPodIdForDirectIp(ipAddr);
|
||||||
|
|
@ -285,7 +283,6 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
private void createApplyLoadBalancingRulesCommands(
|
private void createApplyLoadBalancingRulesCommands(
|
||||||
List<LoadBalancingRule> rules, DomainRouterVO elbVm, Commands cmds, long guestNetworkId) {
|
List<LoadBalancingRule> rules, DomainRouterVO elbVm, Commands cmds, long guestNetworkId) {
|
||||||
|
|
||||||
|
|
||||||
LoadBalancerTO[] lbs = new LoadBalancerTO[rules.size()];
|
LoadBalancerTO[] lbs = new LoadBalancerTO[rules.size()];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (LoadBalancingRule rule : rules) {
|
for (LoadBalancingRule rule : rules) {
|
||||||
|
|
@ -295,11 +292,12 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
String algorithm = rule.getAlgorithm();
|
String algorithm = rule.getAlgorithm();
|
||||||
|
|
||||||
String elbIp = _networkMgr.getIp(rule.getSourceIpAddressId()).getAddress()
|
String elbIp = _networkMgr.getIp(rule.getSourceIpAddressId()).getAddress()
|
||||||
.addr();
|
.addr();
|
||||||
int srcPort = rule.getSourcePortStart();
|
int srcPort = rule.getSourcePortStart();
|
||||||
|
String uuid = rule.getUuid();
|
||||||
List<LbDestination> destinations = rule.getDestinations();
|
List<LbDestination> destinations = rule.getDestinations();
|
||||||
LoadBalancerTO lb = new LoadBalancerTO(rule.getId(), elbIp, srcPort, protocol, algorithm, revoked, false, destinations);
|
LoadBalancerTO lb = new LoadBalancerTO(uuid, elbIp, srcPort, protocol, algorithm, revoked, false, destinations);
|
||||||
lbs[i++] = lb;
|
lbs[i++] = lb;
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(lbs,elbVm.getPublicIpAddress(),
|
LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(lbs,elbVm.getPublicIpAddress(),
|
||||||
|
|
@ -339,7 +337,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
@Override
|
@Override
|
||||||
public boolean applyLoadBalancerRules(Network network,
|
public boolean applyLoadBalancerRules(Network network,
|
||||||
List<? extends FirewallRule> rules)
|
List<? extends FirewallRule> rules)
|
||||||
throws ResourceUnavailableException {
|
throws ResourceUnavailableException {
|
||||||
if (rules == null || rules.isEmpty()) {
|
if (rules == null || rules.isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -366,7 +364,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
List<LbStickinessPolicy> policyList = _lbMgr.getStickinessPolicies(lb.getId());
|
List<LbStickinessPolicy> policyList = _lbMgr.getStickinessPolicies(lb.getId());
|
||||||
LoadBalancingRule loadBalancing = new LoadBalancingRule(
|
LoadBalancingRule loadBalancing = new LoadBalancingRule(
|
||||||
lb, dstList, policyList);
|
lb, dstList, policyList);
|
||||||
lbRules.add(loadBalancing);
|
lbRules.add(loadBalancing);
|
||||||
}
|
}
|
||||||
return applyLBRules(elbVm, lbRules, network.getId());
|
return applyLBRules(elbVm, lbRules, network.getId());
|
||||||
} else if (elbVm.getState() == State.Stopped
|
} else if (elbVm.getState() == State.Stopped
|
||||||
|
|
@ -386,7 +384,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean configure(String name, Map<String, Object> params)
|
public boolean configure(String name, Map<String, Object> params)
|
||||||
throws ConfigurationException {
|
throws ConfigurationException {
|
||||||
_name = name;
|
_name = name;
|
||||||
final Map<String, String> configs = _configDao.getConfiguration("AgentManager", params);
|
final Map<String, String> configs = _configDao.getConfiguration("AgentManager", params);
|
||||||
_systemAcct = _accountService.getSystemAccount();
|
_systemAcct = _accountService.getSystemAccount();
|
||||||
|
|
@ -402,14 +400,12 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
_elasticLbVmRamSize = NumbersUtil.parseInt(configs.get(Config.ElasticLoadBalancerVmMemory.key()), DEFAULT_ELB_VM_RAMSIZE);
|
_elasticLbVmRamSize = NumbersUtil.parseInt(configs.get(Config.ElasticLoadBalancerVmMemory.key()), DEFAULT_ELB_VM_RAMSIZE);
|
||||||
_elasticLbvmCpuMHz = NumbersUtil.parseInt(configs.get(Config.ElasticLoadBalancerVmCpuMhz.key()), DEFAULT_ELB_VM_CPU_MHZ);
|
_elasticLbvmCpuMHz = NumbersUtil.parseInt(configs.get(Config.ElasticLoadBalancerVmCpuMhz.key()), DEFAULT_ELB_VM_CPU_MHZ);
|
||||||
_elasticLbvmNumCpu = NumbersUtil.parseInt(configs.get(Config.ElasticLoadBalancerVmNumVcpu.key()), 1);
|
_elasticLbvmNumCpu = NumbersUtil.parseInt(configs.get(Config.ElasticLoadBalancerVmNumVcpu.key()), 1);
|
||||||
_elasticLbVmOffering = new ServiceOfferingVO("System Offering For Elastic LB VM", _elasticLbvmNumCpu,
|
_elasticLbVmOffering = new ServiceOfferingVO("System Offering For Elastic LB VM", _elasticLbvmNumCpu,
|
||||||
_elasticLbVmRamSize, _elasticLbvmCpuMHz, 0, 0, true, null, useLocalStorage,
|
_elasticLbVmRamSize, _elasticLbvmCpuMHz, 0, 0, true, null, useLocalStorage,
|
||||||
true, null, true, VirtualMachine.Type.ElasticLoadBalancerVm, true);
|
true, null, true, VirtualMachine.Type.ElasticLoadBalancerVm, true);
|
||||||
_elasticLbVmOffering.setUniqueName(ServiceOffering.elbVmDefaultOffUniqueName);
|
_elasticLbVmOffering.setUniqueName(ServiceOffering.elbVmDefaultOffUniqueName);
|
||||||
_elasticLbVmOffering = _serviceOfferingDao.persistSystemServiceOffering(_elasticLbVmOffering);
|
_elasticLbVmOffering = _serviceOfferingDao.persistSystemServiceOffering(_elasticLbVmOffering);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String enabled = _configDao.getValue(Config.ElasticLoadBalancerEnabled.key());
|
String enabled = _configDao.getValue(Config.ElasticLoadBalancerEnabled.key());
|
||||||
_enabled = (enabled == null) ? false: Boolean.parseBoolean(enabled);
|
_enabled = (enabled == null) ? false: Boolean.parseBoolean(enabled);
|
||||||
s_logger.info("Elastic Load balancer enabled: " + _enabled);
|
s_logger.info("Elastic Load balancer enabled: " + _enabled);
|
||||||
|
|
@ -423,7 +419,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
throw new ConfigurationException("ELB: Traffic type for front end of load balancer has to be guest or public; found : " + traffType);
|
throw new ConfigurationException("ELB: Traffic type for front end of load balancer has to be guest or public; found : " + traffType);
|
||||||
s_logger.info("ELB: Elastic Load Balancer: will balance on " + traffType );
|
s_logger.info("ELB: Elastic Load Balancer: will balance on " + traffType );
|
||||||
int gcIntervalMinutes = NumbersUtil.parseInt(configs.get(Config.ElasticLoadBalancerVmGcInterval.key()), 5);
|
int gcIntervalMinutes = NumbersUtil.parseInt(configs.get(Config.ElasticLoadBalancerVmGcInterval.key()), 5);
|
||||||
if (gcIntervalMinutes < 5)
|
if (gcIntervalMinutes < 5)
|
||||||
gcIntervalMinutes = 5;
|
gcIntervalMinutes = 5;
|
||||||
s_logger.info("ELB: Elastic Load Balancer: scheduling GC to run every " + gcIntervalMinutes + " minutes" );
|
s_logger.info("ELB: Elastic Load Balancer: scheduling GC to run every " + gcIntervalMinutes + " minutes" );
|
||||||
_gcThreadPool = Executors.newScheduledThreadPool(1, new NamedThreadFactory("ELBVM-GC"));
|
_gcThreadPool = Executors.newScheduledThreadPool(1, new NamedThreadFactory("ELBVM-GC"));
|
||||||
|
|
@ -431,7 +427,6 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
_itMgr.registerGuru(VirtualMachine.Type.ElasticLoadBalancerVm, this);
|
_itMgr.registerGuru(VirtualMachine.Type.ElasticLoadBalancerVm, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -484,10 +479,9 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
if (s_logger.isDebugEnabled()) {
|
if (s_logger.isDebugEnabled()) {
|
||||||
s_logger.debug("Starting a ELB vm for network configurations: " + guestNetwork + " in " + dest);
|
s_logger.debug("Starting a ELB vm for network configurations: " + guestNetwork + " in " + dest);
|
||||||
}
|
}
|
||||||
assert guestNetwork.getState() == Network.State.Implemented
|
assert guestNetwork.getState() == Network.State.Implemented
|
||||||
|| guestNetwork.getState() == Network.State.Setup
|
|| guestNetwork.getState() == Network.State.Setup
|
||||||
|| guestNetwork.getState() == Network.State.Implementing
|
|| guestNetwork.getState() == Network.State.Implementing : "Network is not yet fully implemented: " + guestNetwork;
|
||||||
: "Network is not yet fully implemented: "+ guestNetwork;
|
|
||||||
|
|
||||||
DataCenterDeployment plan = null;
|
DataCenterDeployment plan = null;
|
||||||
DomainRouterVO elbVm = null;
|
DomainRouterVO elbVm = null;
|
||||||
|
|
@ -537,7 +531,6 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
elbVm = this.start(elbVm, _accountService.getSystemUser(), _accountService.getSystemAccount(), params);
|
elbVm = this.start(elbVm, _accountService.getSystemUser(), _accountService.getSystemAccount(), params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return elbVm;
|
return elbVm;
|
||||||
} finally {
|
} finally {
|
||||||
_networkDao.releaseFromLockTable(guestNetworkId);
|
_networkDao.releaseFromLockTable(guestNetworkId);
|
||||||
|
|
@ -554,7 +547,6 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private DomainRouterVO stop(DomainRouterVO elbVm, boolean forced, User user, Account caller) throws ConcurrentOperationException, ResourceUnavailableException {
|
private DomainRouterVO stop(DomainRouterVO elbVm, boolean forced, User user, Account caller) throws ConcurrentOperationException, ResourceUnavailableException {
|
||||||
s_logger.debug("Stopping ELB vm " + elbVm);
|
s_logger.debug("Stopping ELB vm " + elbVm);
|
||||||
try {
|
try {
|
||||||
|
|
@ -570,7 +562,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
|
|
||||||
protected List<LoadBalancerVO> findExistingLoadBalancers(String lbName, Long ipId, Long accountId, Long domainId, Integer publicPort) {
|
protected List<LoadBalancerVO> findExistingLoadBalancers(String lbName, Long ipId, Long accountId, Long domainId, Integer publicPort) {
|
||||||
SearchBuilder<LoadBalancerVO> sb = _lbDao.createSearchBuilder();
|
SearchBuilder<LoadBalancerVO> sb = _lbDao.createSearchBuilder();
|
||||||
sb.and("name", sb.entity().getName(), SearchCriteria.Op.EQ);
|
sb.and("name", sb.entity().getName(), SearchCriteria.Op.EQ);
|
||||||
sb.and("accountId", sb.entity().getAccountId(), SearchCriteria.Op.EQ);
|
sb.and("accountId", sb.entity().getAccountId(), SearchCriteria.Op.EQ);
|
||||||
sb.and("publicPort", sb.entity().getSourcePortStart(), SearchCriteria.Op.EQ);
|
sb.and("publicPort", sb.entity().getSourcePortStart(), SearchCriteria.Op.EQ);
|
||||||
if (ipId != null) {
|
if (ipId != null) {
|
||||||
|
|
@ -587,7 +579,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
sc.setParameters("accountId", accountId);
|
sc.setParameters("accountId", accountId);
|
||||||
if (ipId != null) {
|
if (ipId != null) {
|
||||||
sc.setParameters("sourceIpAddress", ipId);
|
sc.setParameters("sourceIpAddress", ipId);
|
||||||
}
|
}
|
||||||
if (domainId != null) {
|
if (domainId != null) {
|
||||||
sc.setParameters("domainId",domainId);
|
sc.setParameters("domainId",domainId);
|
||||||
}
|
}
|
||||||
|
|
@ -607,7 +599,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
|
|
||||||
PublicIp ip = _networkMgr.assignPublicIpAddress(frontEndNetwork.getDataCenterId(), null, account, VlanType.DirectAttached, frontEndNetwork.getId(), null, true);
|
PublicIp ip = _networkMgr.assignPublicIpAddress(frontEndNetwork.getDataCenterId(), null, account, VlanType.DirectAttached, frontEndNetwork.getId(), null, true);
|
||||||
IPAddressVO ipvo = _ipAddressDao.findById(ip.getId());
|
IPAddressVO ipvo = _ipAddressDao.findById(ip.getId());
|
||||||
ipvo.setAssociatedWithNetworkId(frontEndNetwork.getId());
|
ipvo.setAssociatedWithNetworkId(frontEndNetwork.getId());
|
||||||
_ipAddressDao.update(ipvo.getId(), ipvo);
|
_ipAddressDao.update(ipvo.getId(), ipvo);
|
||||||
txn.commit();
|
txn.commit();
|
||||||
s_logger.info("Acquired frontend IP for ELB " + ip);
|
s_logger.info("Acquired frontend IP for ELB " + ip);
|
||||||
|
|
@ -618,7 +610,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
public void releaseIp(long ipId, long userId, Account caller) {
|
public void releaseIp(long ipId, long userId, Account caller) {
|
||||||
s_logger.info("ELB: Release public IP for loadbalancing " + ipId);
|
s_logger.info("ELB: Release public IP for loadbalancing " + ipId);
|
||||||
IPAddressVO ipvo = _ipAddressDao.findById(ipId);
|
IPAddressVO ipvo = _ipAddressDao.findById(ipId);
|
||||||
ipvo.setAssociatedWithNetworkId(null);
|
ipvo.setAssociatedWithNetworkId(null);
|
||||||
_ipAddressDao.update(ipvo.getId(), ipvo);
|
_ipAddressDao.update(ipvo.getId(), ipvo);
|
||||||
_networkMgr.disassociatePublicIpAddress(ipId, userId, caller);
|
_networkMgr.disassociatePublicIpAddress(ipId, userId, caller);
|
||||||
_ipAddressDao.unassignIpAddress(ipId);
|
_ipAddressDao.unassignIpAddress(ipId);
|
||||||
|
|
@ -651,7 +643,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
existingLbs = findExistingLoadBalancers(lb.getName(), null, lb.getAccountId(), lb.getDomainId(), null);
|
existingLbs = findExistingLoadBalancers(lb.getName(), null, lb.getAccountId(), lb.getDomainId(), null);
|
||||||
if (existingLbs != null) {
|
if (existingLbs != null) {
|
||||||
throw new InvalidParameterValueException("Supplied LB name " + lb.getName() + " is not associated with IP " + lb.getSourceIpAddressId() );
|
throw new InvalidParameterValueException("Supplied LB name " + lb.getName() + " is not associated with IP " + lb.getSourceIpAddressId() );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
s_logger.debug("Could not find any existing frontend ips for this account for this LB rule, acquiring a new frontent IP for ELB");
|
s_logger.debug("Could not find any existing frontend ips for this account for this LB rule, acquiring a new frontent IP for ELB");
|
||||||
PublicIp ip = allocDirectIp(account, networkId);
|
PublicIp ip = allocDirectIp(account, networkId);
|
||||||
|
|
@ -684,7 +676,6 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
|
|
||||||
DomainRouterVO elbVm = null;
|
DomainRouterVO elbVm = null;
|
||||||
|
|
||||||
|
|
||||||
if (existingLbs == null) {
|
if (existingLbs == null) {
|
||||||
elbVm = findELBVmWithCapacity(network, ipAddr);
|
elbVm = findELBVmWithCapacity(network, ipAddr);
|
||||||
if (elbVm == null) {
|
if (elbVm == null) {
|
||||||
|
|
@ -788,7 +779,6 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DomainRouterVO findByName(String name) {
|
public DomainRouterVO findByName(String name) {
|
||||||
if (!VirtualMachineName.isValidSystemVmName(name, _instance, _elbVmNamePrefix)) {
|
if (!VirtualMachineName.isValidSystemVmName(name, _instance, _elbVmNamePrefix)) {
|
||||||
|
|
@ -798,19 +788,16 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
return _routerDao.findById(VirtualMachineName.getSystemVmId(name));
|
return _routerDao.findById(VirtualMachineName.getSystemVmId(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DomainRouterVO findById(long id) {
|
public DomainRouterVO findById(long id) {
|
||||||
return _routerDao.findById(id);
|
return _routerDao.findById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DomainRouterVO persist(DomainRouterVO elbVm) {
|
public DomainRouterVO persist(DomainRouterVO elbVm) {
|
||||||
return _routerDao.persist(elbVm);
|
return _routerDao.persist(elbVm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean finalizeVirtualMachineProfile(VirtualMachineProfile<DomainRouterVO> profile, DeployDestination dest, ReservationContext context) {
|
public boolean finalizeVirtualMachineProfile(VirtualMachineProfile<DomainRouterVO> profile, DeployDestination dest, ReservationContext context) {
|
||||||
DomainRouterVO elbVm = profile.getVirtualMachine();
|
DomainRouterVO elbVm = profile.getVirtualMachine();
|
||||||
|
|
@ -874,7 +861,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
String domain = guestNetwork.getNetworkDomain();
|
String domain = guestNetwork.getNetworkDomain();
|
||||||
if (domain != null) {
|
if (domain != null) {
|
||||||
buf.append(" domain=" + domain);
|
buf.append(" domain=" + domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
buf.append(" dns1=").append(defaultDns1);
|
buf.append(" dns1=").append(defaultDns1);
|
||||||
if (defaultDns2 != null) {
|
if (defaultDns2 != null) {
|
||||||
|
|
@ -892,7 +879,6 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException {
|
public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException {
|
||||||
DomainRouterVO elbVm = profile.getVirtualMachine();
|
DomainRouterVO elbVm = profile.getVirtualMachine();
|
||||||
|
|
@ -914,7 +900,6 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean finalizeStart(VirtualMachineProfile<DomainRouterVO> profile, long hostId, Commands cmds, ReservationContext context) {
|
public boolean finalizeStart(VirtualMachineProfile<DomainRouterVO> profile, long hostId, Commands cmds, ReservationContext context) {
|
||||||
CheckSshAnswer answer = (CheckSshAnswer) cmds.getAnswer("checkSsh");
|
CheckSshAnswer answer = (CheckSshAnswer) cmds.getAnswer("checkSsh");
|
||||||
|
|
@ -926,7 +911,6 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile) {
|
public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile) {
|
||||||
DomainRouterVO elbVm = profile.getVirtualMachine();
|
DomainRouterVO elbVm = profile.getVirtualMachine();
|
||||||
|
|
@ -979,7 +963,6 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void finalizeStop(VirtualMachineProfile<DomainRouterVO> profile, StopAnswer answer) {
|
public void finalizeStop(VirtualMachineProfile<DomainRouterVO> profile, StopAnswer answer) {
|
||||||
if (answer != null) {
|
if (answer != null) {
|
||||||
|
|
@ -993,7 +976,6 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
//TODO: process network usage stats
|
//TODO: process network usage stats
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void finalizeExpunge(DomainRouterVO vm) {
|
public void finalizeExpunge(DomainRouterVO vm) {
|
||||||
// no-op
|
// no-op
|
||||||
|
|
@ -1017,7 +999,6 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru<DomainRouterVO> {
|
||||||
throw new UnsupportedOperationException("Plug nic is not supported for vm of type " + vm.getType());
|
throw new UnsupportedOperationException("Plug nic is not supported for vm of type " + vm.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean unplugNic(Network network, NicTO nic, VirtualMachineTO vm,
|
public boolean unplugNic(Network network, NicTO nic, VirtualMachineTO vm,
|
||||||
ReservationContext context, DeployDestination dest) throws ConcurrentOperationException, ResourceUnavailableException {
|
ReservationContext context, DeployDestination dest) throws ConcurrentOperationException, ResourceUnavailableException {
|
||||||
|
|
|
||||||
|
|
@ -371,7 +371,7 @@ StaticNatServiceProvider {
|
||||||
HostPodVO pod = _podDao.findById(podId);
|
HostPodVO pod = _podDao.findById(podId);
|
||||||
if (pod == null) {
|
if (pod == null) {
|
||||||
throw new InvalidParameterValueException("Can't find pod by id " + podId);
|
throw new InvalidParameterValueException("Can't find pod by id " + podId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Long podId: newPodsConfig) {
|
for (Long podId: newPodsConfig) {
|
||||||
|
|
@ -669,12 +669,13 @@ StaticNatServiceProvider {
|
||||||
boolean revoked = (rule.getState().equals(FirewallRule.State.Revoke));
|
boolean revoked = (rule.getState().equals(FirewallRule.State.Revoke));
|
||||||
String protocol = rule.getProtocol();
|
String protocol = rule.getProtocol();
|
||||||
String algorithm = rule.getAlgorithm();
|
String algorithm = rule.getAlgorithm();
|
||||||
|
String lbUuid = rule.getUuid();
|
||||||
String srcIp = _networkMgr.getIp(rule.getSourceIpAddressId()).getAddress().addr();
|
String srcIp = _networkMgr.getIp(rule.getSourceIpAddressId()).getAddress().addr();
|
||||||
int srcPort = rule.getSourcePortStart();
|
int srcPort = rule.getSourcePortStart();
|
||||||
List<LbDestination> destinations = rule.getDestinations();
|
List<LbDestination> destinations = rule.getDestinations();
|
||||||
|
|
||||||
if ((destinations != null && !destinations.isEmpty()) || rule.isAutoScaleConfig()) {
|
if ((destinations != null && !destinations.isEmpty()) || rule.isAutoScaleConfig()) {
|
||||||
LoadBalancerTO loadBalancer = new LoadBalancerTO(rule.getId(), srcIp, srcPort, protocol, algorithm, revoked, false, destinations, rule.getStickinessPolicies());
|
LoadBalancerTO loadBalancer = new LoadBalancerTO(lbUuid, srcIp, srcPort, protocol, algorithm, revoked, false, destinations, rule.getStickinessPolicies());
|
||||||
if(rule.isAutoScaleConfig()) {
|
if(rule.isAutoScaleConfig()) {
|
||||||
loadBalancer.setAutoScaleVmGroup(rule.getAutoScaleVmGroup());
|
loadBalancer.setAutoScaleVmGroup(rule.getAutoScaleVmGroup());
|
||||||
}
|
}
|
||||||
|
|
@ -711,41 +712,41 @@ StaticNatServiceProvider {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!multiNetScalerDeployment) {
|
if (!multiNetScalerDeployment) {
|
||||||
String errMsg;
|
String errMsg;
|
||||||
ExternalLoadBalancerDeviceVO lbDevice = getExternalLoadBalancerForNetwork(config);
|
ExternalLoadBalancerDeviceVO lbDevice = getExternalLoadBalancerForNetwork(config);
|
||||||
if (lbDevice == null) {
|
if (lbDevice == null) {
|
||||||
try {
|
try {
|
||||||
lbDevice = allocateLoadBalancerForNetwork(config);
|
lbDevice = allocateLoadBalancerForNetwork(config);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
errMsg = "Could not allocate a NetSclaer load balancer for configuring static NAT rules due to" + e.getMessage();
|
errMsg = "Could not allocate a NetSclaer load balancer for configuring static NAT rules due to" + e.getMessage();
|
||||||
s_logger.error(errMsg);
|
s_logger.error(errMsg);
|
||||||
throw new ResourceUnavailableException(errMsg, this.getClass(), 0);
|
throw new ResourceUnavailableException(errMsg, this.getClass(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isNetscalerDevice(lbDevice.getDeviceName())) {
|
if (!isNetscalerDevice(lbDevice.getDeviceName())) {
|
||||||
errMsg = "There are no NetScaler load balancer assigned for this network. So NetScaler element will not be handling the static nat rules.";
|
errMsg = "There are no NetScaler load balancer assigned for this network. So NetScaler element will not be handling the static nat rules.";
|
||||||
s_logger.error(errMsg);
|
s_logger.error(errMsg);
|
||||||
throw new ResourceUnavailableException(errMsg, this.getClass(), 0);
|
throw new ResourceUnavailableException(errMsg, this.getClass(), 0);
|
||||||
}
|
}
|
||||||
SetStaticNatRulesAnswer answer = null;
|
SetStaticNatRulesAnswer answer = null;
|
||||||
List<StaticNatRuleTO> rulesTO = null;
|
List<StaticNatRuleTO> rulesTO = null;
|
||||||
if (rules != null) {
|
if (rules != null) {
|
||||||
rulesTO = new ArrayList<StaticNatRuleTO>();
|
rulesTO = new ArrayList<StaticNatRuleTO>();
|
||||||
for (StaticNat rule : rules) {
|
for (StaticNat rule : rules) {
|
||||||
IpAddress sourceIp = _networkMgr.getIp(rule.getSourceIpAddressId());
|
IpAddress sourceIp = _networkMgr.getIp(rule.getSourceIpAddressId());
|
||||||
StaticNatRuleTO ruleTO = new StaticNatRuleTO(0, sourceIp.getAddress().addr(), null, null, rule.getDestIpAddress(), null, null, null, rule.isForRevoke(), false);
|
StaticNatRuleTO ruleTO = new StaticNatRuleTO(0, sourceIp.getAddress().addr(), null, null, rule.getDestIpAddress(), null, null, null, rule.isForRevoke(), false);
|
||||||
rulesTO.add(ruleTO);
|
rulesTO.add(ruleTO);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SetStaticNatRulesCommand cmd = new SetStaticNatRulesCommand(rulesTO, null);
|
SetStaticNatRulesCommand cmd = new SetStaticNatRulesCommand(rulesTO, null);
|
||||||
answer = (SetStaticNatRulesAnswer) _agentMgr.send(lbDevice.getHostId(), cmd);
|
answer = (SetStaticNatRulesAnswer) _agentMgr.send(lbDevice.getHostId(), cmd);
|
||||||
if (answer == null) {
|
if (answer == null) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return answer.getResult();
|
return answer.getResult();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (rules != null) {
|
if (rules != null) {
|
||||||
for (StaticNat rule : rules) {
|
for (StaticNat rule : rules) {
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.citrix.netscaler.nitro.exception.nitro_exception;
|
import com.citrix.netscaler.nitro.exception.nitro_exception;
|
||||||
import com.citrix.netscaler.nitro.resource.base.base_response;
|
import com.citrix.netscaler.nitro.resource.base.base_response;
|
||||||
|
import com.citrix.netscaler.nitro.resource.config.autoscale.autoscalepolicy;
|
||||||
import com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleprofile;
|
import com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleprofile;
|
||||||
import com.citrix.netscaler.nitro.resource.config.basic.server_service_binding;
|
import com.citrix.netscaler.nitro.resource.config.basic.server_service_binding;
|
||||||
import com.citrix.netscaler.nitro.resource.config.basic.servicegroup;
|
import com.citrix.netscaler.nitro.resource.config.basic.servicegroup;
|
||||||
|
|
@ -49,7 +50,6 @@ import com.citrix.netscaler.nitro.resource.config.ns.nshardware;
|
||||||
import com.citrix.netscaler.nitro.resource.config.ns.nsip;
|
import com.citrix.netscaler.nitro.resource.config.ns.nsip;
|
||||||
import com.citrix.netscaler.nitro.resource.config.ns.nstimer;
|
import com.citrix.netscaler.nitro.resource.config.ns.nstimer;
|
||||||
import com.citrix.netscaler.nitro.resource.config.ns.nstimer_autoscalepolicy_binding;
|
import com.citrix.netscaler.nitro.resource.config.ns.nstimer_autoscalepolicy_binding;
|
||||||
import com.citrix.netscaler.nitro.resource.config.autoscale.*;
|
|
||||||
import com.citrix.netscaler.nitro.resource.stat.lb.lbvserver_stats;
|
import com.citrix.netscaler.nitro.resource.stat.lb.lbvserver_stats;
|
||||||
import com.citrix.netscaler.nitro.service.nitro_service;
|
import com.citrix.netscaler.nitro.service.nitro_service;
|
||||||
import com.citrix.netscaler.nitro.util.filtervalue;
|
import com.citrix.netscaler.nitro.util.filtervalue;
|
||||||
|
|
@ -619,14 +619,14 @@ public class NetscalerResource implements ServerResource {
|
||||||
saveConfiguration();
|
saveConfiguration();
|
||||||
return new Answer(cmd);
|
return new Answer(cmd);
|
||||||
} catch (ExecutionException e) {
|
} catch (ExecutionException e) {
|
||||||
s_logger.error("Failed to execute LoadBalancerConfigCommand due to " + e.getMessage());
|
s_logger.error("Failed to execute LoadBalancerConfigCommand due to ", e);
|
||||||
if (shouldRetry(numRetries)) {
|
if (shouldRetry(numRetries)) {
|
||||||
return retry(cmd, numRetries);
|
return retry(cmd, numRetries);
|
||||||
} else {
|
} else {
|
||||||
return new Answer(cmd, e);
|
return new Answer(cmd, e);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
s_logger.error("Failed to execute LoadBalancerConfigCommand due to " + e.getMessage());
|
s_logger.error("Failed to execute LoadBalancerConfigCommand due to ", e);
|
||||||
if (shouldRetry(numRetries)) {
|
if (shouldRetry(numRetries)) {
|
||||||
return retry(cmd, numRetries);
|
return retry(cmd, numRetries);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1367,7 +1367,8 @@ public class NetscalerResource implements ServerResource {
|
||||||
return nsProtocol;
|
return nsProtocol;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addLBVirtualServer(String virtualServerName, String publicIp, int publicPort, String lbAlgorithm, String protocol, StickinessPolicyTO[] stickyPolicies, AutoScaleVmGroupTO vmGroupTO) throws ExecutionException {
|
private void addLBVirtualServer(String virtualServerName, String publicIp, int publicPort, String lbAlgorithm, String protocol, StickinessPolicyTO[] stickyPolicies, AutoScaleVmGroupTO vmGroupTO)
|
||||||
|
throws ExecutionException {
|
||||||
try {
|
try {
|
||||||
String lbMethod;
|
String lbMethod;
|
||||||
if ("roundrobin".equalsIgnoreCase(lbAlgorithm)) {
|
if ("roundrobin".equalsIgnoreCase(lbAlgorithm)) {
|
||||||
|
|
@ -1516,6 +1517,7 @@ public class NetscalerResource implements ServerResource {
|
||||||
int srcPort = loadBalancerTO.getSrcPort();
|
int srcPort = loadBalancerTO.getSrcPort();
|
||||||
String lbProtocol = getNetScalerProtocol(loadBalancerTO);
|
String lbProtocol = getNetScalerProtocol(loadBalancerTO);
|
||||||
String lbAlgorithm = loadBalancerTO.getAlgorithm();
|
String lbAlgorithm = loadBalancerTO.getAlgorithm();
|
||||||
|
String vmGroupIdentifier = generateAutoScaleVmGroupIdentifier(loadBalancerTO);
|
||||||
String nsVirtualServerName = generateNSVirtualServerName(srcIp, srcPort);
|
String nsVirtualServerName = generateNSVirtualServerName(srcIp, srcPort);
|
||||||
AutoScaleVmGroupTO vmGroupTO = loadBalancerTO.getAutoScaleVmGroupTO();
|
AutoScaleVmGroupTO vmGroupTO = loadBalancerTO.getAutoScaleVmGroupTO();
|
||||||
if (s_logger.isDebugEnabled()) {
|
if (s_logger.isDebugEnabled()) {
|
||||||
|
|
@ -1523,7 +1525,7 @@ public class NetscalerResource implements ServerResource {
|
||||||
}
|
}
|
||||||
addLBVirtualServer(nsVirtualServerName, srcIp, srcPort, lbAlgorithm, lbProtocol, loadBalancerTO.getStickinessPolicies(), vmGroupTO);
|
addLBVirtualServer(nsVirtualServerName, srcIp, srcPort, lbAlgorithm, lbProtocol, loadBalancerTO.getStickinessPolicies(), vmGroupTO);
|
||||||
|
|
||||||
String serviceGroupName = generateAutoScaleServiceGroupName(srcIp, srcPort);
|
String serviceGroupName = generateAutoScaleServiceGroupName(vmGroupIdentifier);
|
||||||
if(!nsServiceGroupExists(serviceGroupName)) {
|
if(!nsServiceGroupExists(serviceGroupName)) {
|
||||||
// add servicegroup lb_autoscaleGroup -autoscale POLICY -memberPort 80
|
// add servicegroup lb_autoscaleGroup -autoscale POLICY -memberPort 80
|
||||||
int memberPort = vmGroupTO.getMemberPort();
|
int memberPort = vmGroupTO.getMemberPort();
|
||||||
|
|
@ -1562,15 +1564,16 @@ public class NetscalerResource implements ServerResource {
|
||||||
private synchronized boolean removeAutoScaleConfig(LoadBalancerTO loadBalancerTO) throws Exception, ExecutionException {
|
private synchronized boolean removeAutoScaleConfig(LoadBalancerTO loadBalancerTO) throws Exception, ExecutionException {
|
||||||
String srcIp = loadBalancerTO.getSrcIp();
|
String srcIp = loadBalancerTO.getSrcIp();
|
||||||
int srcPort = loadBalancerTO.getSrcPort();
|
int srcPort = loadBalancerTO.getSrcPort();
|
||||||
|
String vmGroupIdentifier = generateAutoScaleVmGroupIdentifier(loadBalancerTO);
|
||||||
|
|
||||||
String nsVirtualServerName = generateNSVirtualServerName(srcIp, srcPort);
|
String nsVirtualServerName = generateNSVirtualServerName(srcIp, srcPort);
|
||||||
String serviceGroupName = generateAutoScaleServiceGroupName(srcIp, srcPort);
|
String serviceGroupName = generateAutoScaleServiceGroupName(vmGroupIdentifier);
|
||||||
|
|
||||||
if (loadBalancerTO.getAutoScaleVmGroupTO().getCurrentState().equals("enabled")) {
|
if (loadBalancerTO.getAutoScaleVmGroupTO().getCurrentState().equals("enabled")) {
|
||||||
disableAutoScaleConfig(loadBalancerTO, false);
|
disableAutoScaleConfig(loadBalancerTO, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isServiceGroupBoundToVirtualServer(nsVirtualServerName, serviceGroupName)) {
|
if(isServiceGroupBoundToVirtualServer(nsVirtualServerName, serviceGroupName)) {
|
||||||
// UnBind autoscale service group
|
// UnBind autoscale service group
|
||||||
// unbind lb vserver lb lb_autoscaleGroup
|
// unbind lb vserver lb lb_autoscaleGroup
|
||||||
lbvserver_servicegroup_binding vserver_servicegroup_binding = new lbvserver_servicegroup_binding();
|
lbvserver_servicegroup_binding vserver_servicegroup_binding = new lbvserver_servicegroup_binding();
|
||||||
|
|
@ -1601,17 +1604,18 @@ public class NetscalerResource implements ServerResource {
|
||||||
|
|
||||||
@SuppressWarnings("static-access")
|
@SuppressWarnings("static-access")
|
||||||
private synchronized boolean enableAutoScaleConfig(LoadBalancerTO loadBalancerTO, boolean isCleanUp) throws Exception {
|
private synchronized boolean enableAutoScaleConfig(LoadBalancerTO loadBalancerTO, boolean isCleanUp) throws Exception {
|
||||||
|
String vmGroupIdentifier = generateAutoScaleVmGroupIdentifier(loadBalancerTO);
|
||||||
String srcIp = loadBalancerTO.getSrcIp();
|
String srcIp = loadBalancerTO.getSrcIp();
|
||||||
int srcPort = loadBalancerTO.getSrcPort();
|
int srcPort = loadBalancerTO.getSrcPort();
|
||||||
|
|
||||||
String nsVirtualServerName = generateNSVirtualServerName(srcIp, srcPort);
|
String nsVirtualServerName = generateNSVirtualServerName(srcIp, srcPort);
|
||||||
String serviceGroupName = generateAutoScaleServiceGroupName(srcIp, srcPort);
|
String serviceGroupName = generateAutoScaleServiceGroupName(vmGroupIdentifier);
|
||||||
String profileName = generateAutoScaleProfileName(srcIp, srcPort);
|
String profileName = generateAutoScaleProfileName(vmGroupIdentifier);
|
||||||
String timerName = generateAutoScaleTimerName(srcIp, srcPort);
|
String timerName = generateAutoScaleTimerName(vmGroupIdentifier);
|
||||||
String scaleDownActionName = generateAutoScaleScaleDownActionName(srcIp, srcPort);
|
String scaleDownActionName = generateAutoScaleScaleDownActionName(vmGroupIdentifier);
|
||||||
String scaleUpActionName = generateAutoScaleScaleUpActionName(srcIp, srcPort);
|
String scaleUpActionName = generateAutoScaleScaleUpActionName(vmGroupIdentifier);
|
||||||
String mtName = generateSnmpMetricTableName(srcIp, srcPort);
|
String mtName = generateSnmpMetricTableName(vmGroupIdentifier);
|
||||||
String monitorName = generateSnmpMonitorName(srcIp, srcPort);
|
String monitorName = generateSnmpMonitorName(vmGroupIdentifier);
|
||||||
AutoScaleVmGroupTO vmGroupTO = loadBalancerTO.getAutoScaleVmGroupTO();
|
AutoScaleVmGroupTO vmGroupTO = loadBalancerTO.getAutoScaleVmGroupTO();
|
||||||
AutoScaleVmProfileTO profileTO = vmGroupTO.getProfile();
|
AutoScaleVmProfileTO profileTO = vmGroupTO.getProfile();
|
||||||
List<AutoScalePolicyTO> policies = vmGroupTO.getPolicies();
|
List<AutoScalePolicyTO> policies = vmGroupTO.getPolicies();
|
||||||
|
|
@ -1634,7 +1638,8 @@ public class NetscalerResource implements ServerResource {
|
||||||
vserver.update(_netscalerService, vserver);
|
vserver.update(_netscalerService, vserver);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Ignore Exception on cleanup
|
// Ignore Exception on cleanup
|
||||||
if(!isCleanUp) throw e;
|
if (!isCleanUp)
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* AutoScale Config */
|
/* AutoScale Config */
|
||||||
|
|
@ -1655,7 +1660,8 @@ public class NetscalerResource implements ServerResource {
|
||||||
autoscaleProfile.add(_netscalerService, autoscaleProfile);
|
autoscaleProfile.add(_netscalerService, autoscaleProfile);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Ignore Exception on cleanup
|
// Ignore Exception on cleanup
|
||||||
if(!isCleanUp) throw e;
|
if (!isCleanUp)
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add Timer
|
// Add Timer
|
||||||
|
|
@ -1666,7 +1672,8 @@ public class NetscalerResource implements ServerResource {
|
||||||
timer.add(_netscalerService, timer);
|
timer.add(_netscalerService, timer);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Ignore Exception on cleanup
|
// Ignore Exception on cleanup
|
||||||
if(!isCleanUp) throw e;
|
if (!isCleanUp)
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
// AutoScale Actions
|
// AutoScale Actions
|
||||||
|
|
@ -1707,12 +1714,13 @@ public class NetscalerResource implements ServerResource {
|
||||||
ApiConstants.SERVICE_OFFERING_ID + "=" + profileTO.getServiceOfferingId()+ "&" +
|
ApiConstants.SERVICE_OFFERING_ID + "=" + profileTO.getServiceOfferingId()+ "&" +
|
||||||
ApiConstants.TEMPLATE_ID + "=" + profileTO.getTemplateId()+ "&" +
|
ApiConstants.TEMPLATE_ID + "=" + profileTO.getTemplateId()+ "&" +
|
||||||
((profileTO.getOtherDeployParams() == null)? "" : (profileTO.getOtherDeployParams() + "&")) +
|
((profileTO.getOtherDeployParams() == null)? "" : (profileTO.getOtherDeployParams() + "&")) +
|
||||||
"lbruleid=" + loadBalancerTO.getId();
|
"lbruleid=" + loadBalancerTO.getUuid();
|
||||||
scaleUpAction.set_parameters(scaleUpParameters);
|
scaleUpAction.set_parameters(scaleUpParameters);
|
||||||
scaleUpAction.add(_netscalerService, scaleUpAction);
|
scaleUpAction.add(_netscalerService, scaleUpAction);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Ignore Exception on cleanup
|
// Ignore Exception on cleanup
|
||||||
if(!isCleanUp) throw e;
|
if (!isCleanUp)
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction scaleDownAction = new com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction();
|
com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction scaleDownAction = new com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction();
|
||||||
|
|
@ -1725,23 +1733,24 @@ public class NetscalerResource implements ServerResource {
|
||||||
scaleDownAction.set_profilename(profileName);
|
scaleDownAction.set_profilename(profileName);
|
||||||
scaleDownAction.set_quiettime(scaleDownQuietTime);
|
scaleDownAction.set_quiettime(scaleDownQuietTime);
|
||||||
String scaleDownParameters = "command=destroyVirtualMachine" + "&" +
|
String scaleDownParameters = "command=destroyVirtualMachine" + "&" +
|
||||||
"lbruleid=" + loadBalancerTO.getId();
|
"lbruleid=" + loadBalancerTO.getUuid();
|
||||||
scaleDownAction.set_parameters(scaleDownParameters);
|
scaleDownAction.set_parameters(scaleDownParameters);
|
||||||
scaleDownAction.set_vmdestroygraceperiod(destroyVmGracePeriod);
|
scaleDownAction.set_vmdestroygraceperiod(destroyVmGracePeriod);
|
||||||
scaleDownAction.add(_netscalerService, scaleDownAction);
|
scaleDownAction.add(_netscalerService, scaleDownAction);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Ignore Exception on cleanup
|
// Ignore Exception on cleanup
|
||||||
if(!isCleanUp) throw e;
|
if (!isCleanUp)
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create min member policy */
|
/* Create min member policy */
|
||||||
String minMemberPolicyName = generateAutoScaleMinPolicyName(srcIp, srcPort);
|
String minMemberPolicyName = generateAutoScaleMinPolicyName(vmGroupIdentifier);
|
||||||
String minMemberPolicyExp = "SYS.VSERVER(\"" + nsVirtualServerName + "\").ACTIVESERVICES.LT(SYS.VSERVER(\"" + nsVirtualServerName + "\").MINAUTOSCALEMEMBERS)";
|
String minMemberPolicyExp = "SYS.VSERVER(\"" + nsVirtualServerName + "\").ACTIVESERVICES.LT(SYS.VSERVER(\"" + nsVirtualServerName + "\").MINAUTOSCALEMEMBERS)";
|
||||||
addAutoScalePolicy(timerName, minMemberPolicyName, cur_prirotiy++, minMemberPolicyExp, scaleUpActionName,
|
addAutoScalePolicy(timerName, minMemberPolicyName, cur_prirotiy++, minMemberPolicyExp, scaleUpActionName,
|
||||||
interval, interval, isCleanUp);
|
interval, interval, isCleanUp);
|
||||||
|
|
||||||
/* Create max member policy */
|
/* Create max member policy */
|
||||||
String maxMemberPolicyName = generateAutoScaleMaxPolicyName(srcIp, srcPort);
|
String maxMemberPolicyName = generateAutoScaleMaxPolicyName(vmGroupIdentifier);
|
||||||
String maxMemberPolicyExp = "SYS.VSERVER(\"" + nsVirtualServerName + "\").ACTIVESERVICES.GT(SYS.VSERVER(\"" + nsVirtualServerName + "\").MAXAUTOSCALEMEMBERS)";
|
String maxMemberPolicyExp = "SYS.VSERVER(\"" + nsVirtualServerName + "\").ACTIVESERVICES.GT(SYS.VSERVER(\"" + nsVirtualServerName + "\").MAXAUTOSCALEMEMBERS)";
|
||||||
addAutoScalePolicy(timerName, maxMemberPolicyName, cur_prirotiy++, maxMemberPolicyExp, scaleDownActionName,
|
addAutoScalePolicy(timerName, maxMemberPolicyName, cur_prirotiy++, maxMemberPolicyExp, scaleDownActionName,
|
||||||
interval, interval, isCleanUp);
|
interval, interval, isCleanUp);
|
||||||
|
|
@ -1773,7 +1782,8 @@ public class NetscalerResource implements ServerResource {
|
||||||
metricTable.add(_netscalerService, metricTable);
|
metricTable.add(_netscalerService, metricTable);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Ignore Exception on cleanup
|
// Ignore Exception on cleanup
|
||||||
if(!isCleanUp) throw e;
|
if (!isCleanUp)
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create Monitor
|
// Create Monitor
|
||||||
|
|
@ -1790,7 +1800,8 @@ public class NetscalerResource implements ServerResource {
|
||||||
monitor.add(_netscalerService, monitor);
|
monitor.add(_netscalerService, monitor);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Ignore Exception on cleanup
|
// Ignore Exception on cleanup
|
||||||
if(!isCleanUp) throw e;
|
if (!isCleanUp)
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bind monitor to servicegroup.
|
// Bind monitor to servicegroup.
|
||||||
|
|
@ -1807,7 +1818,8 @@ public class NetscalerResource implements ServerResource {
|
||||||
servicegroup_lbmonitor_binding.add(_netscalerService, servicegroup_monitor_binding);
|
servicegroup_lbmonitor_binding.add(_netscalerService, servicegroup_monitor_binding);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Ignore Exception on cleanup
|
// Ignore Exception on cleanup
|
||||||
if(!isCleanUp) throw e;
|
if (!isCleanUp)
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1828,7 +1840,8 @@ public class NetscalerResource implements ServerResource {
|
||||||
metrictable_metric_binding.add(_netscalerService, metrictable_metric_binding);
|
metrictable_metric_binding.add(_netscalerService, metrictable_metric_binding);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Ignore Exception on cleanup
|
// Ignore Exception on cleanup
|
||||||
if(!isCleanUp) throw e;
|
if (!isCleanUp)
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
// bind lb monitor lb_metric_table_mon -metric cpu -metricThreshold 1
|
// bind lb monitor lb_metric_table_mon -metric cpu -metricThreshold 1
|
||||||
|
|
@ -1845,11 +1858,13 @@ public class NetscalerResource implements ServerResource {
|
||||||
monitor_metric_binding.add(_netscalerService, monitor_metric_binding);
|
monitor_metric_binding.add(_netscalerService, monitor_metric_binding);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Ignore Exception on cleanup
|
// Ignore Exception on cleanup
|
||||||
if(!isCleanUp) throw e;
|
if (!isCleanUp)
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// SYS.VSERVER("abcd").SNMP_TABLE(0).AVERAGE_VALUE.GT(80)
|
// SYS.VSERVER("abcd").SNMP_TABLE(0).AVERAGE_VALUE.GT(80)
|
||||||
int counterIndex = snmpMetrics.get(counterName); // TODO: temporary fix. later on counter name will be added as a param to SNMP_TABLE.
|
int counterIndex = snmpMetrics.get(counterName); // TODO: temporary fix. later on counter name
|
||||||
|
// will be added as a param to SNMP_TABLE.
|
||||||
formatter.format("SYS.VSERVER(\"%s\").SNMP_TABLE(%d).AVERAGE_VALUE.%s(%d)",nsVirtualServerName, counterIndex, operator, threshold);
|
formatter.format("SYS.VSERVER(\"%s\").SNMP_TABLE(%d).AVERAGE_VALUE.%s(%d)",nsVirtualServerName, counterIndex, operator, threshold);
|
||||||
}
|
}
|
||||||
else if (counterTO.getSource().equals("netscaler"))
|
else if (counterTO.getSource().equals("netscaler"))
|
||||||
|
|
@ -1865,7 +1880,7 @@ public class NetscalerResource implements ServerResource {
|
||||||
policyExpression = "(" + policyExpression + ")";
|
policyExpression = "(" + policyExpression + ")";
|
||||||
|
|
||||||
String policyId = Long.toString(autoScalePolicyTO.getId());
|
String policyId = Long.toString(autoScalePolicyTO.getId());
|
||||||
String policyName = generateAutoScalePolicyName(srcIp, srcPort, policyId);
|
String policyName = generateAutoScalePolicyName(vmGroupIdentifier, policyId);
|
||||||
String action = null;
|
String action = null;
|
||||||
if(isScaleUpPolicy(autoScalePolicyTO)) {
|
if(isScaleUpPolicy(autoScalePolicyTO)) {
|
||||||
action = scaleUpActionName;
|
action = scaleUpActionName;
|
||||||
|
|
@ -1896,24 +1911,22 @@ public class NetscalerResource implements ServerResource {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("static-access")
|
@SuppressWarnings("static-access")
|
||||||
private synchronized boolean disableAutoScaleConfig(LoadBalancerTO loadBalancerTO, boolean isCleanUp) throws Exception {
|
private synchronized boolean disableAutoScaleConfig(LoadBalancerTO loadBalancerTO, boolean isCleanUp) throws Exception {
|
||||||
String srcIp = loadBalancerTO.getSrcIp();
|
|
||||||
int srcPort = loadBalancerTO.getSrcPort();
|
|
||||||
|
|
||||||
String nsVirtualServerName = generateNSVirtualServerName(srcIp, srcPort);
|
String vmGroupIdentifier = generateAutoScaleVmGroupIdentifier(loadBalancerTO);
|
||||||
String profileName = generateAutoScaleProfileName(srcIp, srcPort);
|
|
||||||
String timerName = generateAutoScaleTimerName(srcIp, srcPort);
|
String profileName = generateAutoScaleProfileName(vmGroupIdentifier);
|
||||||
String scaleDownActionName = generateAutoScaleScaleDownActionName(srcIp, srcPort);
|
String timerName = generateAutoScaleTimerName(vmGroupIdentifier);
|
||||||
String scaleUpActionName = generateAutoScaleScaleUpActionName(srcIp, srcPort);
|
String scaleDownActionName = generateAutoScaleScaleDownActionName(vmGroupIdentifier);
|
||||||
String mtName = generateSnmpMetricTableName(srcIp, srcPort);
|
String scaleUpActionName = generateAutoScaleScaleUpActionName(vmGroupIdentifier);
|
||||||
String monitorName = generateSnmpMonitorName(srcIp, srcPort);
|
String mtName = generateSnmpMetricTableName(vmGroupIdentifier);
|
||||||
String serviceGroupName = generateAutoScaleServiceGroupName(srcIp, srcPort);
|
String monitorName = generateSnmpMonitorName(vmGroupIdentifier);
|
||||||
|
String serviceGroupName = generateAutoScaleServiceGroupName(vmGroupIdentifier);
|
||||||
AutoScaleVmGroupTO vmGroupTO = loadBalancerTO.getAutoScaleVmGroupTO();
|
AutoScaleVmGroupTO vmGroupTO = loadBalancerTO.getAutoScaleVmGroupTO();
|
||||||
List<AutoScalePolicyTO> policies = vmGroupTO.getPolicies();
|
List<AutoScalePolicyTO> policies = vmGroupTO.getPolicies();
|
||||||
String minMemberPolicyName = generateAutoScaleMinPolicyName(srcIp, srcPort);
|
String minMemberPolicyName = generateAutoScaleMinPolicyName(vmGroupIdentifier);
|
||||||
String maxMemberPolicyName = generateAutoScaleMaxPolicyName(srcIp, srcPort);
|
String maxMemberPolicyName = generateAutoScaleMaxPolicyName(vmGroupIdentifier);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
@ -1935,7 +1948,7 @@ public class NetscalerResource implements ServerResource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String policyId = Long.toString(autoScalePolicyTO.getId());
|
String policyId = Long.toString(autoScalePolicyTO.getId());
|
||||||
String policyName = generateAutoScalePolicyName(srcIp, srcPort,policyId);
|
String policyName = generateAutoScalePolicyName(vmGroupIdentifier, policyId);
|
||||||
|
|
||||||
// Removing Timer policy
|
// Removing Timer policy
|
||||||
removeAutoScalePolicy(timerName, policyName, isCleanUp);
|
removeAutoScalePolicy(timerName, policyName, isCleanUp);
|
||||||
|
|
@ -1949,7 +1962,8 @@ public class NetscalerResource implements ServerResource {
|
||||||
scaleDownAction.delete(_netscalerService, scaleDownAction);
|
scaleDownAction.delete(_netscalerService, scaleDownAction);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Ignore Exception on cleanup
|
// Ignore Exception on cleanup
|
||||||
if(!isCleanUp) throw e;
|
if (!isCleanUp)
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete AutoScale ScaleUp action
|
// Delete AutoScale ScaleUp action
|
||||||
|
|
@ -1959,7 +1973,8 @@ public class NetscalerResource implements ServerResource {
|
||||||
scaleUpAction.delete(_netscalerService, scaleUpAction);
|
scaleUpAction.delete(_netscalerService, scaleUpAction);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Ignore Exception on cleanup
|
// Ignore Exception on cleanup
|
||||||
if(!isCleanUp) throw e;
|
if (!isCleanUp)
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete Timer
|
// Delete Timer
|
||||||
|
|
@ -1969,7 +1984,8 @@ public class NetscalerResource implements ServerResource {
|
||||||
timer.delete(_netscalerService, timer);
|
timer.delete(_netscalerService, timer);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Ignore Exception on cleanup
|
// Ignore Exception on cleanup
|
||||||
if(!isCleanUp) throw e;
|
if (!isCleanUp)
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete AutoScale Profile
|
// Delete AutoScale Profile
|
||||||
|
|
@ -1979,7 +1995,8 @@ public class NetscalerResource implements ServerResource {
|
||||||
autoscaleProfile.delete(_netscalerService, autoscaleProfile);
|
autoscaleProfile.delete(_netscalerService, autoscaleProfile);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Ignore Exception on cleanup
|
// Ignore Exception on cleanup
|
||||||
if(!isCleanUp) throw e;
|
if (!isCleanUp)
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isSnmp) {
|
if(isSnmp) {
|
||||||
|
|
@ -1990,7 +2007,8 @@ public class NetscalerResource implements ServerResource {
|
||||||
servicegroup_lbmonitor_binding.delete(_netscalerService, servicegroup_monitor_binding);
|
servicegroup_lbmonitor_binding.delete(_netscalerService, servicegroup_monitor_binding);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Ignore Exception on cleanup
|
// Ignore Exception on cleanup
|
||||||
if(!isCleanUp) throw e;
|
if (!isCleanUp)
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete Monitor
|
// Delete Monitor
|
||||||
|
|
@ -2002,7 +2020,8 @@ public class NetscalerResource implements ServerResource {
|
||||||
monitor.delete(_netscalerService, monitor);
|
monitor.delete(_netscalerService, monitor);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Ignore Exception on cleanup
|
// Ignore Exception on cleanup
|
||||||
if(!isCleanUp) throw e;
|
if (!isCleanUp)
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete Metric Table
|
// Delete Metric Table
|
||||||
|
|
@ -2012,7 +2031,8 @@ public class NetscalerResource implements ServerResource {
|
||||||
metricTable.delete(_netscalerService, metricTable);
|
metricTable.delete(_netscalerService, metricTable);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Ignore Exception on cleanup
|
// Ignore Exception on cleanup
|
||||||
if(!isCleanUp) throw e;
|
if (!isCleanUp)
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
|
@ -2029,7 +2049,6 @@ public class NetscalerResource implements ServerResource {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private synchronized void addAutoScalePolicy(String timerName,String policyName, long priority, String policyExpression, String action,
|
private synchronized void addAutoScalePolicy(String timerName,String policyName, long priority, String policyExpression, String action,
|
||||||
int duration, int interval, boolean isCleanUp) throws Exception {
|
int duration, int interval, boolean isCleanUp) throws Exception {
|
||||||
// Adding a autoscale policy
|
// Adding a autoscale policy
|
||||||
|
|
@ -2043,13 +2062,15 @@ public class NetscalerResource implements ServerResource {
|
||||||
timerPolicy.add(_netscalerService, timerPolicy);
|
timerPolicy.add(_netscalerService, timerPolicy);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Ignore Exception on cleanup
|
// Ignore Exception on cleanup
|
||||||
if(!isCleanUp) throw e;
|
if (!isCleanUp)
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
// bind timer policy
|
// bind timer policy
|
||||||
// For now it is bound globally.
|
// For now it is bound globally.
|
||||||
// bind timer trigger lb_astimer -policyName lb_policy_scaleUp -vserver lb -priority 1 -samplesize 5
|
// bind timer trigger lb_astimer -policyName lb_policy_scaleUp -vserver lb -priority 1 -samplesize 5
|
||||||
// TODO: later bind to lbvserver. bind timer trigger lb_astimer -policyName lb_policy_scaleUp -vserver lb -priority 1 -samplesize 5
|
// TODO: later bind to lbvserver. bind timer trigger lb_astimer -policyName lb_policy_scaleUp -vserver lb
|
||||||
|
// -priority 1 -samplesize 5
|
||||||
// -thresholdsize 5
|
// -thresholdsize 5
|
||||||
nstimer_autoscalepolicy_binding timer_policy_binding = new nstimer_autoscalepolicy_binding();
|
nstimer_autoscalepolicy_binding timer_policy_binding = new nstimer_autoscalepolicy_binding();
|
||||||
int sampleSize = duration/interval;
|
int sampleSize = duration/interval;
|
||||||
|
|
@ -2063,7 +2084,8 @@ public class NetscalerResource implements ServerResource {
|
||||||
timer_policy_binding.add(_netscalerService, timer_policy_binding);
|
timer_policy_binding.add(_netscalerService, timer_policy_binding);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Ignore Exception on cleanup
|
// Ignore Exception on cleanup
|
||||||
if(!isCleanUp) throw e;
|
if (!isCleanUp)
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2077,7 +2099,8 @@ public class NetscalerResource implements ServerResource {
|
||||||
timer_policy_binding.delete(_netscalerService, timer_policy_binding);
|
timer_policy_binding.delete(_netscalerService, timer_policy_binding);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Ignore Exception on cleanup
|
// Ignore Exception on cleanup
|
||||||
if(!isCleanUp) throw e;
|
if (!isCleanUp)
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Removing Timer policy
|
// Removing Timer policy
|
||||||
|
|
@ -2088,12 +2111,12 @@ public class NetscalerResource implements ServerResource {
|
||||||
timerPolicy.delete(_netscalerService, timerPolicy);
|
timerPolicy.delete(_netscalerService, timerPolicy);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Ignore Exception on cleanup
|
// Ignore Exception on cleanup
|
||||||
if(!isCleanUp) throw e;
|
if (!isCleanUp)
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean isAutoScaleSupportedInNetScaler() throws ExecutionException {
|
private boolean isAutoScaleSupportedInNetScaler() throws ExecutionException {
|
||||||
autoscaleprofile autoscaleProfile = new autoscaleprofile();
|
autoscaleprofile autoscaleProfile = new autoscaleprofile();
|
||||||
try {
|
try {
|
||||||
|
|
@ -2200,44 +2223,48 @@ public class NetscalerResource implements ServerResource {
|
||||||
return genObjectName("Cloud-Service", ip, port);
|
return genObjectName("Cloud-Service", ip, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String generateAutoScaleServiceGroupName(String srcIp, long srcPort) {
|
private String generateAutoScaleVmGroupIdentifier(LoadBalancerTO lbTO) {
|
||||||
return genObjectName("Cloud-AutoScaleServiceGroup", srcIp, srcPort);
|
return lbTO.getSrcIp() + "-" + lbTO.getSrcPort();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String generateAutoScaleTimerName(String srcIp, long srcPort) {
|
private String generateAutoScaleServiceGroupName(String vmGroupIdentifier) {
|
||||||
return genObjectName("Cloud-AutoScale-Timer", srcIp, srcPort);
|
return genObjectName("Cloud-AutoScale-SvcGrp", vmGroupIdentifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String generateAutoScaleProfileName(String srcIp, long srcPort) {
|
private String generateAutoScaleTimerName(String vmGroupIdentifier) {
|
||||||
return genObjectName("Cloud-AutoScale-Profile", srcIp, srcPort);
|
return genObjectName("Cloud-AutoScale-Timer", vmGroupIdentifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String generateAutoScaleScaleUpActionName(String srcIp, long srcPort) {
|
private String generateAutoScaleProfileName(String vmGroupIdentifier) {
|
||||||
return genObjectName("Cloud-AutoScale-ScaleUpAction", srcIp, srcPort);
|
return genObjectName("Cloud-AutoScale-Profile", vmGroupIdentifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String generateAutoScaleScaleDownActionName(String srcIp, long srcPort) {
|
private String generateAutoScaleScaleUpActionName(String vmGroupIdentifier) {
|
||||||
return genObjectName("Cloud-AutoScale-ScaleDownAction", srcIp, srcPort);
|
return genObjectName("Cloud-AutoScale-ScaleUpAction", vmGroupIdentifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String generateAutoScalePolicyName(String srcIp, long srcPort, String poilcyId) {
|
private String generateAutoScaleScaleDownActionName(String vmGroupIdentifier) {
|
||||||
return genObjectName("Cloud-AutoScale-Policy", srcIp, srcPort, poilcyId);
|
return genObjectName("Cloud-AutoScale-ScaleDownAction", vmGroupIdentifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String generateAutoScaleMinPolicyName(String srcIp, long srcPort) {
|
private String generateAutoScalePolicyName(String vmGroupIdentifier, String poilcyId) {
|
||||||
return genObjectName("Cloud-AutoScale-Policy-Min", srcIp, srcPort);
|
return genObjectName("Cloud-AutoScale-Policy", vmGroupIdentifier, poilcyId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String generateAutoScaleMaxPolicyName(String srcIp, long srcPort) {
|
private String generateAutoScaleMinPolicyName(String vmGroupIdentifier) {
|
||||||
return genObjectName("Cloud-AutoScale-Policy-Max", srcIp, srcPort);
|
return genObjectName("Cloud-AutoScale-Policy-Min", vmGroupIdentifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String generateSnmpMetricTableName(String srcIp, long srcPort) {
|
private String generateAutoScaleMaxPolicyName(String vmGroupIdentifier) {
|
||||||
return genObjectName("Cloud-MTbl", srcIp, srcPort);
|
return genObjectName("Cloud-AutoScale-Policy-Max", vmGroupIdentifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String generateSnmpMonitorName(String srcIp, long srcPort) {
|
private String generateSnmpMetricTableName(String vmGroupIdentifier) {
|
||||||
return genObjectName("Cloud-Mon", srcIp, srcPort);
|
return genObjectName("Cloud-MTbl", vmGroupIdentifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String generateSnmpMonitorName(String vmGroupIdentifier) {
|
||||||
|
return genObjectName("Cloud-Mon", vmGroupIdentifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String generateSnmpMetricName(String counterName) {
|
private String generateSnmpMetricName(String counterName) {
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,7 @@ import com.cloud.vm.Nic.State;
|
||||||
import com.cloud.vm.NicVO;
|
import com.cloud.vm.NicVO;
|
||||||
import com.cloud.vm.dao.DomainRouterDao;
|
import com.cloud.vm.dao.DomainRouterDao;
|
||||||
import com.cloud.vm.dao.NicDao;
|
import com.cloud.vm.dao.NicDao;
|
||||||
|
|
||||||
public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase implements ExternalLoadBalancerDeviceManager, ResourceStateAdapter {
|
public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase implements ExternalLoadBalancerDeviceManager, ResourceStateAdapter {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
@ -384,7 +385,7 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||||
if (deviceMapLock.lock(120)) {
|
if (deviceMapLock.lock(120)) {
|
||||||
try {
|
try {
|
||||||
boolean dedicatedLB = offering.getDedicatedLB(); // does network offering supports a dedicated
|
boolean dedicatedLB = offering.getDedicatedLB(); // does network offering supports a dedicated
|
||||||
// load balancer?
|
// load balancer?
|
||||||
long lbDeviceId;
|
long lbDeviceId;
|
||||||
|
|
||||||
txn.start();
|
txn.start();
|
||||||
|
|
@ -398,7 +399,7 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||||
|
|
||||||
// persist the load balancer device id that will be used for this network. Once a network
|
// persist the load balancer device id that will be used for this network. Once a network
|
||||||
// is implemented on a LB device then later on all rules will be programmed on to same
|
// is implemented on a LB device then later on all rules will be programmed on to same
|
||||||
// device
|
// device
|
||||||
NetworkExternalLoadBalancerVO networkLB = new NetworkExternalLoadBalancerVO(guestConfig.getId(), lbDeviceId);
|
NetworkExternalLoadBalancerVO networkLB = new NetworkExternalLoadBalancerVO(guestConfig.getId(), lbDeviceId);
|
||||||
_networkExternalLBDao.persist(networkLB);
|
_networkExternalLBDao.persist(networkLB);
|
||||||
|
|
||||||
|
|
@ -416,12 +417,12 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||||
if (tryLbProvisioning) {
|
if (tryLbProvisioning) {
|
||||||
retry = false;
|
retry = false;
|
||||||
// TODO: throwing warning instead of error for now as its possible another provider can
|
// TODO: throwing warning instead of error for now as its possible another provider can
|
||||||
// service this network
|
// service this network
|
||||||
s_logger.warn("There are no load balancer device with the capacity for implementing this network");
|
s_logger.warn("There are no load balancer device with the capacity for implementing this network");
|
||||||
throw exception;
|
throw exception;
|
||||||
} else {
|
} else {
|
||||||
tryLbProvisioning = true; // if possible provision a LB appliance in to the physical
|
tryLbProvisioning = true; // if possible provision a LB appliance in to the physical
|
||||||
// network
|
// network
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
|
@ -436,7 +437,7 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||||
}
|
}
|
||||||
|
|
||||||
// there are no LB devices or there is no free capacity on the devices in the physical network so provision
|
// there are no LB devices or there is no free capacity on the devices in the physical network so provision
|
||||||
// a new LB appliance
|
// a new LB appliance
|
||||||
if (tryLbProvisioning) {
|
if (tryLbProvisioning) {
|
||||||
// check if LB appliance can be dynamically provisioned
|
// check if LB appliance can be dynamically provisioned
|
||||||
List<ExternalLoadBalancerDeviceVO> providerLbDevices = _externalLoadBalancerDeviceDao.listByProviderAndDeviceAllocationState(physicalNetworkId, provider, LBDeviceAllocationState.Provider);
|
List<ExternalLoadBalancerDeviceVO> providerLbDevices = _externalLoadBalancerDeviceDao.listByProviderAndDeviceAllocationState(physicalNetworkId, provider, LBDeviceAllocationState.Provider);
|
||||||
|
|
@ -444,7 +445,7 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||||
for (ExternalLoadBalancerDeviceVO lbProviderDevice : providerLbDevices) {
|
for (ExternalLoadBalancerDeviceVO lbProviderDevice : providerLbDevices) {
|
||||||
if (lbProviderDevice.getState() == LBDeviceState.Enabled) {
|
if (lbProviderDevice.getState() == LBDeviceState.Enabled) {
|
||||||
// acquire a private IP from the data center which will be used as management IP of
|
// acquire a private IP from the data center which will be used as management IP of
|
||||||
// provisioned LB appliance,
|
// provisioned LB appliance,
|
||||||
DataCenterIpAddressVO dcPrivateIp = _dcDao.allocatePrivateIpAddress(guestConfig.getDataCenterId(), lbProviderDevice.getUuid());
|
DataCenterIpAddressVO dcPrivateIp = _dcDao.allocatePrivateIpAddress(guestConfig.getDataCenterId(), lbProviderDevice.getUuid());
|
||||||
if (dcPrivateIp == null) {
|
if (dcPrivateIp == null) {
|
||||||
throw new InsufficientNetworkCapacityException("failed to acquire a priavate IP in the zone " + guestConfig.getDataCenterId() +
|
throw new InsufficientNetworkCapacityException("failed to acquire a priavate IP in the zone " + guestConfig.getDataCenterId() +
|
||||||
|
|
@ -475,12 +476,12 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||||
String privateIf = createLbAnswer.getPrivateInterface();
|
String privateIf = createLbAnswer.getPrivateInterface();
|
||||||
|
|
||||||
// we have provisioned load balancer so add the appliance as cloudstack provisioned external
|
// we have provisioned load balancer so add the appliance as cloudstack provisioned external
|
||||||
// load balancer
|
// load balancer
|
||||||
String dedicatedLb = offering.getDedicatedLB() ? "true" : "false";
|
String dedicatedLb = offering.getDedicatedLB() ? "true" : "false";
|
||||||
String capacity = Long.toString(lbProviderDevice.getCapacity());
|
String capacity = Long.toString(lbProviderDevice.getCapacity());
|
||||||
|
|
||||||
// acquire a public IP to associate with lb appliance (used as subnet IP to make the
|
// acquire a public IP to associate with lb appliance (used as subnet IP to make the
|
||||||
// appliance part of private network)
|
// appliance part of private network)
|
||||||
PublicIp publicIp = _networkMgr.assignPublicIpAddress(guestConfig.getDataCenterId(), null, _accountMgr.getSystemAccount(), VlanType.VirtualNetwork, null, null, false);
|
PublicIp publicIp = _networkMgr.assignPublicIpAddress(guestConfig.getDataCenterId(), null, _accountMgr.getSystemAccount(), VlanType.VirtualNetwork, null, null, false);
|
||||||
String publicIPNetmask = publicIp.getVlanNetmask();
|
String publicIPNetmask = publicIp.getVlanNetmask();
|
||||||
String publicIPgateway = publicIp.getVlanGateway();
|
String publicIPgateway = publicIp.getVlanGateway();
|
||||||
|
|
@ -488,8 +489,8 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||||
String publicIP = publicIp.getAddress().toString();
|
String publicIP = publicIp.getAddress().toString();
|
||||||
|
|
||||||
String url = "https://" + lbIP + "?publicinterface=" + publicIf + "&privateinterface=" + privateIf + "&lbdevicededicated=" + dedicatedLb +
|
String url = "https://" + lbIP + "?publicinterface=" + publicIf + "&privateinterface=" + privateIf + "&lbdevicededicated=" + dedicatedLb +
|
||||||
"&cloudmanaged=true" + "&publicip=" + publicIP + "&publicipnetmask=" + publicIPNetmask + "&lbdevicecapacity=" + capacity +
|
"&cloudmanaged=true" + "&publicip=" + publicIP + "&publicipnetmask=" + publicIPNetmask + "&lbdevicecapacity=" + capacity +
|
||||||
"&publicipvlan=" + publicIPVlanTag + "&publicipgateway=" + publicIPgateway;
|
"&publicipvlan=" + publicIPVlanTag + "&publicipgateway=" + publicIPgateway;
|
||||||
ExternalLoadBalancerDeviceVO lbAppliance = null;
|
ExternalLoadBalancerDeviceVO lbAppliance = null;
|
||||||
try {
|
try {
|
||||||
lbAppliance = addExternalLoadBalancer(physicalNetworkId, url, username, password, createLbAnswer.getDeviceName(), createLbAnswer.getServerResource());
|
lbAppliance = addExternalLoadBalancer(physicalNetworkId, url, username, password, createLbAnswer.getDeviceName(), createLbAnswer.getServerResource());
|
||||||
|
|
@ -499,7 +500,7 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||||
|
|
||||||
if (lbAppliance != null) {
|
if (lbAppliance != null) {
|
||||||
// mark the load balancer as cloudstack managed and set parent host id on which lb
|
// mark the load balancer as cloudstack managed and set parent host id on which lb
|
||||||
// appliance is provisioned
|
// appliance is provisioned
|
||||||
ExternalLoadBalancerDeviceVO managedLb = _externalLoadBalancerDeviceDao.findById(lbAppliance.getId());
|
ExternalLoadBalancerDeviceVO managedLb = _externalLoadBalancerDeviceDao.findById(lbAppliance.getId());
|
||||||
managedLb.setIsManagedDevice(true);
|
managedLb.setIsManagedDevice(true);
|
||||||
managedLb.setParentHostId(lbProviderDevice.getHostId());
|
managedLb.setParentHostId(lbProviderDevice.getHostId());
|
||||||
|
|
@ -514,7 +515,7 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||||
s_logger.warn("Failed to destroy load balancer appliance created");
|
s_logger.warn("Failed to destroy load balancer appliance created");
|
||||||
} else {
|
} else {
|
||||||
// release the public & private IP back to dc pool, as the load balancer
|
// release the public & private IP back to dc pool, as the load balancer
|
||||||
// appliance is now destroyed
|
// appliance is now destroyed
|
||||||
_dcDao.releasePrivateIpAddress(lbIP, guestConfig.getDataCenterId(), null);
|
_dcDao.releasePrivateIpAddress(lbIP, guestConfig.getDataCenterId(), null);
|
||||||
_networkMgr.disassociatePublicIpAddress(publicIp.getId(), _accountMgr.getSystemUser().getId(), _accountMgr.getSystemAccount());
|
_networkMgr.disassociatePublicIpAddress(publicIp.getId(), _accountMgr.getSystemUser().getId(), _accountMgr.getSystemAccount());
|
||||||
}
|
}
|
||||||
|
|
@ -594,7 +595,7 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we are here then there are no existing LB devices in shared use or the devices in shared use has no
|
// if we are here then there are no existing LB devices in shared use or the devices in shared use has no
|
||||||
// free capacity left
|
// free capacity left
|
||||||
// so allocate a new load balancer configured for shared use from the pool of free LB devices
|
// so allocate a new load balancer configured for shared use from the pool of free LB devices
|
||||||
lbDevices = _externalLoadBalancerDeviceDao.listByProviderAndDeviceAllocationState(physicalNetworkId, provider, LBDeviceAllocationState.Free);
|
lbDevices = _externalLoadBalancerDeviceDao.listByProviderAndDeviceAllocationState(physicalNetworkId, provider, LBDeviceAllocationState.Free);
|
||||||
if (lbDevices != null && !lbDevices.isEmpty()) {
|
if (lbDevices != null && !lbDevices.isEmpty()) {
|
||||||
|
|
@ -631,7 +632,7 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||||
|
|
||||||
if (!lbInUse && !lbCloudManaged) {
|
if (!lbInUse && !lbCloudManaged) {
|
||||||
// this is the last network mapped to the load balancer device so set device allocation state to be
|
// this is the last network mapped to the load balancer device so set device allocation state to be
|
||||||
// free
|
// free
|
||||||
lbDevice.setAllocationState(LBDeviceAllocationState.Free);
|
lbDevice.setAllocationState(LBDeviceAllocationState.Free);
|
||||||
_externalLoadBalancerDeviceDao.update(lbDevice.getId(), lbDevice);
|
_externalLoadBalancerDeviceDao.update(lbDevice.getId(), lbDevice);
|
||||||
}
|
}
|
||||||
|
|
@ -797,9 +798,9 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||||
LoadBalancingRule rule = loadBalancingRules.get(i);
|
LoadBalancingRule rule = loadBalancingRules.get(i);
|
||||||
|
|
||||||
boolean revoked = (rule.getState().equals(FirewallRule.State.Revoke));
|
boolean revoked = (rule.getState().equals(FirewallRule.State.Revoke));
|
||||||
Long lbId = rule.getId();
|
|
||||||
String protocol = rule.getProtocol();
|
String protocol = rule.getProtocol();
|
||||||
String algorithm = rule.getAlgorithm();
|
String algorithm = rule.getAlgorithm();
|
||||||
|
String uuid = rule.getUuid();
|
||||||
String srcIp = _networkMgr.getIp(rule.getSourceIpAddressId()).getAddress().addr();
|
String srcIp = _networkMgr.getIp(rule.getSourceIpAddressId()).getAddress().addr();
|
||||||
int srcPort = rule.getSourcePortStart();
|
int srcPort = rule.getSourcePortStart();
|
||||||
List<LbDestination> destinations = rule.getDestinations();
|
List<LbDestination> destinations = rule.getDestinations();
|
||||||
|
|
@ -836,7 +837,7 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||||
_inlineLoadBalancerNicMapDao.persist(mapping);
|
_inlineLoadBalancerNicMapDao.persist(mapping);
|
||||||
|
|
||||||
// On the firewall provider for the network, create a static NAT rule between the source IP
|
// On the firewall provider for the network, create a static NAT rule between the source IP
|
||||||
// address and the load balancing IP address
|
// address and the load balancing IP address
|
||||||
applyStaticNatRuleForInlineLBRule(zone, network, firewallProviderHost, revoked, srcIp, loadBalancingIpNic.getIp4Address());
|
applyStaticNatRuleForInlineLBRule(zone, network, firewallProviderHost, revoked, srcIp, loadBalancingIpNic.getIp4Address());
|
||||||
} else {
|
} else {
|
||||||
loadBalancingIpNic = _nicDao.findById(mapping.getNicId());
|
loadBalancingIpNic = _nicDao.findById(mapping.getNicId());
|
||||||
|
|
@ -847,7 +848,7 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||||
loadBalancingIpNic = _nicDao.findById(mapping.getNicId());
|
loadBalancingIpNic = _nicDao.findById(mapping.getNicId());
|
||||||
|
|
||||||
// On the firewall provider for the network, delete the static NAT rule between the source IP
|
// On the firewall provider for the network, delete the static NAT rule between the source IP
|
||||||
// address and the load balancing IP address
|
// address and the load balancing IP address
|
||||||
applyStaticNatRuleForInlineLBRule(zone, network, firewallProviderHost, revoked, srcIp, loadBalancingIpNic.getIp4Address());
|
applyStaticNatRuleForInlineLBRule(zone, network, firewallProviderHost, revoked, srcIp, loadBalancingIpNic.getIp4Address());
|
||||||
|
|
||||||
// Delete the mapping between the source IP address and the load balancing IP address
|
// Delete the mapping between the source IP address and the load balancing IP address
|
||||||
|
|
@ -866,7 +867,7 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((destinations != null && !destinations.isEmpty()) || rule.isAutoScaleConfig()) {
|
if ((destinations != null && !destinations.isEmpty()) || rule.isAutoScaleConfig()) {
|
||||||
LoadBalancerTO loadBalancer = new LoadBalancerTO(lbId, srcIp, srcPort, protocol, algorithm, revoked, false, destinations, rule.getStickinessPolicies());
|
LoadBalancerTO loadBalancer = new LoadBalancerTO(uuid, srcIp, srcPort, protocol, algorithm, revoked, false, destinations, rule.getStickinessPolicies());
|
||||||
if(rule.isAutoScaleConfig()) {
|
if(rule.isAutoScaleConfig()) {
|
||||||
loadBalancer.setAutoScaleVmGroup(rule.getAutoScaleVmGroup());
|
loadBalancer.setAutoScaleVmGroup(rule.getAutoScaleVmGroup());
|
||||||
}
|
}
|
||||||
|
|
@ -917,7 +918,7 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||||
ExternalLoadBalancerDeviceVO lbDeviceVO = getExternalLoadBalancerForNetwork(guestConfig);
|
ExternalLoadBalancerDeviceVO lbDeviceVO = getExternalLoadBalancerForNetwork(guestConfig);
|
||||||
if (lbDeviceVO == null) {
|
if (lbDeviceVO == null) {
|
||||||
s_logger.warn("Network shutdwon requested on external load balancer element, which did not implement the network." +
|
s_logger.warn("Network shutdwon requested on external load balancer element, which did not implement the network." +
|
||||||
" Either network implement failed half way through or already network shutdown is completed. So just returning.");
|
" Either network implement failed half way through or already network shutdown is completed. So just returning.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -944,7 +945,7 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||||
NicVO selfipNic = getPlaceholderNic(guestConfig);
|
NicVO selfipNic = getPlaceholderNic(guestConfig);
|
||||||
if (selfipNic == null) {
|
if (selfipNic == null) {
|
||||||
s_logger.warn("Network shutdwon requested on external load balancer element, which did not implement the network." +
|
s_logger.warn("Network shutdwon requested on external load balancer element, which did not implement the network." +
|
||||||
" Either network implement failed half way through or already network shutdown is completed. So just returning.");
|
" Either network implement failed half way through or already network shutdown is completed. So just returning.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
selfIp = selfipNic.getIp4Address();
|
selfIp = selfipNic.getIp4Address();
|
||||||
|
|
|
||||||
|
|
@ -182,4 +182,9 @@ public class AutoScaleVmGroupVO implements AutoScaleVmGroup {
|
||||||
public void setLoadBalancerId(Long loadBalancerId) {
|
public void setLoadBalancerId(Long loadBalancerId) {
|
||||||
this.loadBalancerId = loadBalancerId;
|
this.loadBalancerId = loadBalancerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUuid() {
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,8 @@ import com.cloud.network.vpc.VpcManager;
|
||||||
import com.cloud.offering.NetworkOffering;
|
import com.cloud.offering.NetworkOffering;
|
||||||
import com.cloud.projects.Project.ListProjectResourcesCriteria;
|
import com.cloud.projects.Project.ListProjectResourcesCriteria;
|
||||||
import com.cloud.server.ResourceTag.TaggedResourceType;
|
import com.cloud.server.ResourceTag.TaggedResourceType;
|
||||||
|
import com.cloud.service.dao.ServiceOfferingDao;
|
||||||
|
import com.cloud.storage.dao.VMTemplateDao;
|
||||||
import com.cloud.tags.ResourceTagVO;
|
import com.cloud.tags.ResourceTagVO;
|
||||||
import com.cloud.tags.dao.ResourceTagDao;
|
import com.cloud.tags.dao.ResourceTagDao;
|
||||||
import com.cloud.template.TemplateManager;
|
import com.cloud.template.TemplateManager;
|
||||||
|
|
@ -199,6 +201,10 @@ public class LoadBalancingRulesManagerImpl<Type> implements LoadBalancingRulesMa
|
||||||
@Inject
|
@Inject
|
||||||
VpcManager _vpcMgr;
|
VpcManager _vpcMgr;
|
||||||
@Inject
|
@Inject
|
||||||
|
VMTemplateDao _templateDao;
|
||||||
|
@Inject
|
||||||
|
ServiceOfferingDao _offeringsDao;
|
||||||
|
@Inject
|
||||||
CounterDao _counterDao;
|
CounterDao _counterDao;
|
||||||
@Inject
|
@Inject
|
||||||
ConditionDao _conditionDao;
|
ConditionDao _conditionDao;
|
||||||
|
|
@ -263,20 +269,24 @@ public class LoadBalancingRulesManagerImpl<Type> implements LoadBalancingRulesMa
|
||||||
String apiKey = user.getApiKey();
|
String apiKey = user.getApiKey();
|
||||||
String secretKey = user.getSecretKey();
|
String secretKey = user.getSecretKey();
|
||||||
String csUrl = _configDao.getValue(Config.EndpointeUrl.key());
|
String csUrl = _configDao.getValue(Config.EndpointeUrl.key());
|
||||||
|
String zoneId = _dcDao.findById(autoScaleVmProfile.getZoneId()).getUuid();
|
||||||
|
String domainId = _domainDao.findById(autoScaleVmProfile.getDomainId()).getUuid();
|
||||||
|
String serviceOfferingId = _offeringsDao.findById(autoScaleVmProfile.getServiceOfferingId()).getUuid();
|
||||||
|
String templateId = _templateDao.findById(autoScaleVmProfile.getTemplateId()).getUuid();
|
||||||
|
|
||||||
if (apiKey == null) {
|
if(apiKey == null) {
|
||||||
throw new InvalidParameterValueException("apiKey for user: " + user.getUsername() + " is empty. Please generate it");
|
throw new InvalidParameterValueException("apiKey for user: " + user.getUsername() + " is empty. Please generate it");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (secretKey == null) {
|
if(secretKey == null) {
|
||||||
throw new InvalidParameterValueException("secretKey for user: " + user.getUsername() + " is empty. Please generate it");
|
throw new InvalidParameterValueException("secretKey for user: " + user.getUsername() + " is empty. Please generate it");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (csUrl == null || csUrl.contains("localhost")) {
|
if(csUrl == null || csUrl.contains("localhost")) {
|
||||||
throw new InvalidParameterValueException("Global setting endpointe.url has to be set to the Management Server's API end point");
|
throw new InvalidParameterValueException("Global setting endpointe.url has to be set to the Management Server's API end point");
|
||||||
}
|
}
|
||||||
|
|
||||||
LbAutoScaleVmProfile lbAutoScaleVmProfile = new LbAutoScaleVmProfile(autoScaleVmProfile, apiKey, secretKey, csUrl);
|
LbAutoScaleVmProfile lbAutoScaleVmProfile = new LbAutoScaleVmProfile(autoScaleVmProfile, apiKey, secretKey, csUrl, zoneId, domainId, serviceOfferingId, templateId);
|
||||||
return new LbAutoScaleVmGroup(vmGroup, autoScalePolicies, lbAutoScaleVmProfile, currentState);
|
return new LbAutoScaleVmGroup(vmGroup, autoScalePolicies, lbAutoScaleVmProfile, currentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -326,11 +336,11 @@ public class LoadBalancingRulesManagerImpl<Type> implements LoadBalancingRulesMa
|
||||||
success = applyAutoScaleConfig(loadBalancer, vmGroup, currentState);
|
success = applyAutoScaleConfig(loadBalancer, vmGroup, currentState);
|
||||||
} catch (ResourceUnavailableException e) {
|
} catch (ResourceUnavailableException e) {
|
||||||
s_logger.warn("Unable to configure AutoScaleVmGroup to the lb rule: " + loadBalancer.getId() + " because resource is unavaliable:", e);
|
s_logger.warn("Unable to configure AutoScaleVmGroup to the lb rule: " + loadBalancer.getId() + " because resource is unavaliable:", e);
|
||||||
if (isRollBackAllowedForProvider(loadBalancer)) {
|
if (isRollBackAllowedForProvider(loadBalancer)) {
|
||||||
loadBalancer.setState(backupState);
|
loadBalancer.setState(backupState);
|
||||||
_lbDao.persist(loadBalancer);
|
_lbDao.persist(loadBalancer);
|
||||||
s_logger.debug("LB Rollback rule id: " + loadBalancer.getId() + " lb state rolback while creating AutoscaleVmGroup");
|
s_logger.debug("LB Rollback rule id: " + loadBalancer.getId() + " lb state rolback while creating AutoscaleVmGroup");
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
} finally {
|
} finally {
|
||||||
if (!success) {
|
if (!success) {
|
||||||
|
|
@ -829,10 +839,10 @@ public class LoadBalancingRulesManagerImpl<Type> implements LoadBalancingRulesMa
|
||||||
|
|
||||||
if (apply) {
|
if (apply) {
|
||||||
try {
|
try {
|
||||||
if (!applyLoadBalancerConfig(loadBalancerId)) {
|
if (!applyLoadBalancerConfig(loadBalancerId)) {
|
||||||
s_logger.warn("Unable to apply the load balancer config");
|
s_logger.warn("Unable to apply the load balancer config");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (ResourceUnavailableException e) {
|
} catch (ResourceUnavailableException e) {
|
||||||
if (rollBack && isRollBackAllowedForProvider(lb)) {
|
if (rollBack && isRollBackAllowedForProvider(lb)) {
|
||||||
if (backupMaps != null) {
|
if (backupMaps != null) {
|
||||||
|
|
|
||||||
|
|
@ -2795,12 +2795,13 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
||||||
boolean revoked = (rule.getState().equals(FirewallRule.State.Revoke));
|
boolean revoked = (rule.getState().equals(FirewallRule.State.Revoke));
|
||||||
String protocol = rule.getProtocol();
|
String protocol = rule.getProtocol();
|
||||||
String algorithm = rule.getAlgorithm();
|
String algorithm = rule.getAlgorithm();
|
||||||
|
String uuid = rule.getUuid();
|
||||||
|
|
||||||
String srcIp = _networkMgr.getIp(rule.getSourceIpAddressId()).getAddress().addr();
|
String srcIp = _networkMgr.getIp(rule.getSourceIpAddressId()).getAddress().addr();
|
||||||
int srcPort = rule.getSourcePortStart();
|
int srcPort = rule.getSourcePortStart();
|
||||||
List<LbDestination> destinations = rule.getDestinations();
|
List<LbDestination> destinations = rule.getDestinations();
|
||||||
List<LbStickinessPolicy> stickinessPolicies = rule.getStickinessPolicies();
|
List<LbStickinessPolicy> stickinessPolicies = rule.getStickinessPolicies();
|
||||||
LoadBalancerTO lb = new LoadBalancerTO(rule.getId(), srcIp, srcPort, protocol, algorithm, revoked, false, destinations, stickinessPolicies);
|
LoadBalancerTO lb = new LoadBalancerTO(uuid, srcIp, srcPort, protocol, algorithm, revoked, false, destinations, stickinessPolicies);
|
||||||
lbs[i++] = lb;
|
lbs[i++] = lb;
|
||||||
}
|
}
|
||||||
String routerPublicIp = null;
|
String routerPublicIp = null;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue