mirror of https://github.com/apache/cloudstack.git
AutoScale. Bringing in update commands and enable/disable. Not Tested.
This commit is contained in:
parent
21e13657b4
commit
a6a206d3fc
|
|
@ -8,7 +8,7 @@
|
|||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.agent.api.to;
|
||||
|
||||
|
|
@ -35,20 +35,20 @@ public class LoadBalancerTO {
|
|||
String srcIp;
|
||||
int srcPort;
|
||||
String protocol;
|
||||
String algorithm;
|
||||
String algorithm;
|
||||
boolean revoked;
|
||||
boolean alreadyAdded;
|
||||
DestinationTO[] destinations;
|
||||
private StickinessPolicyTO[] stickinessPolicies;
|
||||
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) {
|
||||
this.id = id;
|
||||
this.srcIp = srcIp;
|
||||
this.srcPort = srcPort;
|
||||
this.protocol = protocol;
|
||||
this.algorithm = algorithm;
|
||||
this.algorithm = algorithm;
|
||||
this.revoked = revoked;
|
||||
this.alreadyAdded = alreadyAdded;
|
||||
this.destinations = new DestinationTO[destinations.size()];
|
||||
|
|
@ -58,7 +58,7 @@ public class LoadBalancerTO {
|
|||
this.destinations[i++] = new DestinationTO(destination.getIpAddress(), destination.getDestinationPortStart(), destination.isRevoked(), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public LoadBalancerTO (Long 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.stickinessPolicies = null;
|
||||
|
|
@ -73,17 +73,17 @@ public class LoadBalancerTO {
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (index == 0) {
|
||||
this.stickinessPolicies = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
protected LoadBalancerTO() {
|
||||
}
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
|
@ -111,15 +111,15 @@ public class LoadBalancerTO {
|
|||
public boolean isAlreadyAdded() {
|
||||
return alreadyAdded;
|
||||
}
|
||||
|
||||
|
||||
public StickinessPolicyTO[] getStickinessPolicies() {
|
||||
return stickinessPolicies;
|
||||
}
|
||||
|
||||
|
||||
public DestinationTO[] getDestinations() {
|
||||
return destinations;
|
||||
}
|
||||
|
||||
|
||||
public AutoScaleVmGroupTO getAutoScaleVmGroupTO() {
|
||||
return autoScaleVmGroupTO;
|
||||
}
|
||||
|
|
@ -149,7 +149,7 @@ public class LoadBalancerTO {
|
|||
this._paramsList = paramsList;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class DestinationTO {
|
||||
String destIp;
|
||||
int destPort;
|
||||
|
|
@ -161,18 +161,18 @@ public class LoadBalancerTO {
|
|||
this.revoked = revoked;
|
||||
this.alreadyAdded = alreadyAdded;
|
||||
}
|
||||
|
||||
|
||||
protected DestinationTO() {
|
||||
}
|
||||
|
||||
|
||||
public String getDestIp() {
|
||||
return destIp;
|
||||
}
|
||||
|
||||
|
||||
public int getDestPort() {
|
||||
return destPort;
|
||||
}
|
||||
|
||||
|
||||
public boolean isRevoked() {
|
||||
return revoked;
|
||||
}
|
||||
|
|
@ -343,10 +343,9 @@ public class LoadBalancerTO {
|
|||
private final int interval;
|
||||
private final List<AutoScalePolicyTO> policies;
|
||||
private final AutoScaleVmProfileTO profile;
|
||||
private final boolean revoked;
|
||||
private String state;
|
||||
private final String state;
|
||||
|
||||
AutoScaleVmGroupTO(int minMembers, int maxMembers, int memberPort, int interval, List<AutoScalePolicyTO> policies, AutoScaleVmProfileTO profile, boolean revoked)
|
||||
AutoScaleVmGroupTO(int minMembers, int maxMembers, int memberPort, int interval, List<AutoScalePolicyTO> policies, AutoScaleVmProfileTO profile, String state)
|
||||
{
|
||||
this.minMembers = minMembers;
|
||||
this.maxMembers = maxMembers;
|
||||
|
|
@ -354,7 +353,7 @@ public class LoadBalancerTO {
|
|||
this.interval = interval;
|
||||
this.policies = policies;
|
||||
this.profile = profile;
|
||||
this.revoked = revoked;
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public int getMinMembers() {
|
||||
|
|
@ -384,10 +383,6 @@ public class LoadBalancerTO {
|
|||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public boolean isRevoked() {
|
||||
return revoked;
|
||||
}
|
||||
}
|
||||
|
||||
public void setAutoScaleVmGroup(LbAutoScaleVmGroup lbAutoScaleVmGroup)
|
||||
|
|
@ -418,7 +413,7 @@ public class LoadBalancerTO {
|
|||
|
||||
AutoScaleVmGroup autoScaleVmGroup = lbAutoScaleVmGroup.getVmGroup();
|
||||
autoScaleVmGroupTO = new AutoScaleVmGroupTO(autoScaleVmGroup.getMinMembers(), autoScaleVmGroup.getMaxMembers(), autoScaleVmGroup.getMemberPort(),
|
||||
autoScaleVmGroup.getInterval(),autoScalePolicyTOs, autoScaleVmProfileTO, autoScaleVmGroup.isRevoke());
|
||||
autoScaleVmGroup.getInterval(),autoScalePolicyTOs, autoScaleVmProfileTO, autoScaleVmGroup.getState());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,8 +175,7 @@ public class CreateAutoScaleVmGroupCmd extends BaseAsyncCreateCmd {
|
|||
AutoScaleVmGroup vmGroup = null;
|
||||
try
|
||||
{
|
||||
success = true; // Temporary, till we call configure.
|
||||
// success = _lbService.configureAutoScaleVmGroup(this);
|
||||
// success = _autoScaleService.configureAutoScaleVmGroup(this);
|
||||
vmGroup = _entityMgr.findById(AutoScaleVmGroup.class, getEntityId());
|
||||
AutoScaleVmGroupResponse responseObject = _responseGenerator.createAutoScaleVmGroupResponse(vmGroup);
|
||||
setResponseObject(responseObject);
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ public class EnableAutoScaleVmGroupCmd extends BaseCmd {
|
|||
// ////////////// API parameters /////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@IdentityMapper(entityTableName = "account")
|
||||
@Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "Account id")
|
||||
@IdentityMapper(entityTableName="autoscale_vmgroups")
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the autoscale group")
|
||||
private Long id;
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.ApiConstants;
|
||||
|
|
@ -32,6 +34,10 @@ public class UpdateAutoScalePolicyCmd extends BaseAsyncCmd {
|
|||
@Parameter(name = ApiConstants.QUIETTIME, type = CommandType.INTEGER, description = "the cool down period for which the policy should not be evaluated after the action has been taken")
|
||||
private Integer quietTime;
|
||||
|
||||
@IdentityMapper(entityTableName = "conditions")
|
||||
@Parameter(name = ApiConstants.CONDITION_IDS, type = CommandType.LIST, collectionType = CommandType.LONG, required = true, description = "the list of IDs of the conditions that are being evaluated on every interval")
|
||||
private List<Long> conditionIds;
|
||||
|
||||
@IdentityMapper(entityTableName = "autoscale_policies")
|
||||
@Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = true, description = "the ID of the autoscale policy")
|
||||
private Long id;
|
||||
|
|
@ -65,6 +71,11 @@ public class UpdateAutoScalePolicyCmd extends BaseAsyncCmd {
|
|||
return quietTime;
|
||||
}
|
||||
|
||||
|
||||
public List<Long> getConditionIds() {
|
||||
return conditionIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,9 @@ public class UpdateAutoScaleVmGroupCmd extends BaseAsyncCmd {
|
|||
@Parameter(name = ApiConstants.MAX_MEMBERS, type = CommandType.INTEGER, required = true, description = "the maximum number of members in the vmgroup, The number of instances in the vm group will be equal to or less than this number.")
|
||||
private int maxMembers;
|
||||
|
||||
@Parameter(name=ApiConstants.INTERVAL, type=CommandType.INTEGER, description="the frequency at which the conditions have to be evaluated")
|
||||
private Integer interval;
|
||||
|
||||
@IdentityMapper(entityTableName = "autoscale_policies")
|
||||
@Parameter(name = ApiConstants.SCALEUP_POLICY_IDS, type = CommandType.LIST, collectionType = CommandType.LONG, description = "list of provision autoscale policies")
|
||||
private List<Long> scaleUpPolicyIds;
|
||||
|
|
@ -96,6 +99,10 @@ public class UpdateAutoScaleVmGroupCmd extends BaseAsyncCmd {
|
|||
return maxMembers;
|
||||
}
|
||||
|
||||
public Integer getInterval() {
|
||||
return interval;
|
||||
}
|
||||
|
||||
public List<Long> getScaleUpPolicyIds() {
|
||||
return scaleUpPolicyIds;
|
||||
}
|
||||
|
|
@ -133,5 +140,4 @@ public class UpdateAutoScaleVmGroupCmd extends BaseAsyncCmd {
|
|||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.AutoScaleVmGroup;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,12 +43,12 @@ public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCmd {
|
|||
// ////////////// API parameters /////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@IdentityMapper(entityTableName = "autoscale_vmgroups")
|
||||
@IdentityMapper(entityTableName = "autoscale_vmprofiles")
|
||||
@Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = true, description = "the ID of the autoscale vm profile")
|
||||
private Long id;
|
||||
|
||||
@IdentityMapper(entityTableName = "vm_template")
|
||||
@Parameter(name = ApiConstants.TEMPLATE_ID, type = CommandType.LONG, required = true, description = "the template of the auto deployed virtual machine")
|
||||
@Parameter(name = ApiConstants.TEMPLATE_ID, type = CommandType.LONG, description = "the template of the auto deployed virtual machine")
|
||||
private Long templateId;
|
||||
|
||||
@Parameter(name = ApiConstants.OTHER_DEPLOY_PARAMS, type = CommandType.STRING, description = "parameters other than zoneId/serviceOfferringId/templateId of the auto deployed virtual machine")
|
||||
|
|
|
|||
|
|
@ -8,13 +8,12 @@
|
|||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.api.response;
|
||||
|
||||
import com.cloud.api.ApiConstants;
|
||||
import com.cloud.utils.IdentityProxy;
|
||||
import com.cloud.network.as.AutoScalePolicy;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
|
@ -46,6 +45,10 @@ public class AutoScaleVmGroupResponse extends BaseResponse implements Controlled
|
|||
@Param(description = "the frequency at which the conditions have to be evaluated")
|
||||
private Integer interval;
|
||||
|
||||
@SerializedName(ApiConstants.INTERVAL)
|
||||
@Param(description = "the current state of the AutoScale Vm Group")
|
||||
private String state;
|
||||
|
||||
@SerializedName(ApiConstants.SCALEUP_POLICY_IDS)
|
||||
@Param(description = "list of provision autoscale policies")
|
||||
private List<AutoScalePolicyResponse> scaleUpPolicies;
|
||||
|
|
@ -70,7 +73,7 @@ public class AutoScaleVmGroupResponse extends BaseResponse implements Controlled
|
|||
private String domainName;
|
||||
|
||||
public AutoScaleVmGroupResponse() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
|
|
@ -93,11 +96,15 @@ public class AutoScaleVmGroupResponse extends BaseResponse implements Controlled
|
|||
this.maxMembers = maxMembers;
|
||||
}
|
||||
|
||||
public void setInterval(Integer interval) {
|
||||
this.interval = interval;
|
||||
}
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public void setScaleUpPolicies(List<AutoScalePolicyResponse> scaleUpPolicies) {
|
||||
public void setInterval(Integer interval) {
|
||||
this.interval = interval;
|
||||
}
|
||||
|
||||
public void setScaleUpPolicies(List<AutoScalePolicyResponse> scaleUpPolicies) {
|
||||
this.scaleUpPolicies = scaleUpPolicies;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.event;
|
||||
|
||||
|
|
@ -262,7 +262,7 @@ public class EventTypes {
|
|||
public static final String EVENT_EXTERNAL_FIREWALL_DEVICE_ADD = "PHYSICAL.FIREWALL.ADD";
|
||||
public static final String EVENT_EXTERNAL_FIREWALL_DEVICE_DELETE = "PHYSICAL.FIREWALL.DELETE";
|
||||
public static final String EVENT_EXTERNAL_FIREWALL_DEVICE_CONFIGURE = "PHYSICAL.FIREWALL.CONFIGURE";
|
||||
|
||||
|
||||
// tag related events
|
||||
public static final String EVENT_TAGS_CREATE = "CREATE_TAGS";
|
||||
public static final String EVENT_TAGS_DELETE = "DELETE_TAGS";
|
||||
|
|
@ -272,16 +272,16 @@ public class EventTypes {
|
|||
public static final String EVENT_VPC_UPDATE = "VPC.UPDATE";
|
||||
public static final String EVENT_VPC_DELETE = "VPC.DELETE";
|
||||
public static final String EVENT_VPC_RESTART = "VPC.RESTART";
|
||||
|
||||
|
||||
// VPC offerings
|
||||
public static final String EVENT_VPC_OFFERING_CREATE = "VPC.OFFERING.CREATE";
|
||||
public static final String EVENT_VPC_OFFERING_UPDATE = "VPC.OFFERING.UPDATE";
|
||||
public static final String EVENT_VPC_OFFERING_DELETE = "VPC.OFFERING.DELETE";
|
||||
|
||||
|
||||
// Private gateway
|
||||
public static final String EVENT_PRIVATE_GATEWAY_CREATE = "PRIVATE.GATEWAY.CREATE";
|
||||
public static final String EVENT_PRIVATE_GATEWAY_DELETE = "PRIVATE.GATEWAY.DELETE";
|
||||
|
||||
|
||||
// Static routes
|
||||
public static final String EVENT_STATIC_ROUTE_CREATE = "STATIC.ROUTE.CREATE";
|
||||
public static final String EVENT_STATIC_ROUTE_DELETE = "STATIC.ROUTE.DELETE";
|
||||
|
|
@ -300,4 +300,6 @@ public class EventTypes {
|
|||
public static final String EVENT_AUTOSCALEVMGROUP_CREATE = "AUTOSCALEVMGROUP.CREATE";
|
||||
public static final String EVENT_AUTOSCALEVMGROUP_DELETE = "AUTOSCALEVMGROUP.DELETE";
|
||||
public static final String EVENT_AUTOSCALEVMGROUP_UPDATE = "AUTOSCALEVMGROUP.UPDATE";
|
||||
public static final String EVENT_AUTOSCALEVMGROUP_ENABLE = "AUTOSCALEVMGROUP.ENABLE";
|
||||
public static final String EVENT_AUTOSCALEVMGROUP_DISABLE = "AUTOSCALEVMGROUP.DIABLE";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,16 +25,17 @@ import com.cloud.acl.ControlledEntity;
|
|||
|
||||
public interface AutoScaleVmGroup extends ControlledEntity {
|
||||
|
||||
static enum Operator {
|
||||
EQ, GT, LT, GE, LE
|
||||
};
|
||||
String State_New = "new";
|
||||
String State_Revoke = "revoke";
|
||||
String State_Enabled = "enabled";
|
||||
String State_Disabled = "disabled";
|
||||
|
||||
long getId();
|
||||
|
||||
@Override
|
||||
long getAccountId();
|
||||
|
||||
long getLoadBalancerId();
|
||||
Long getLoadBalancerId();
|
||||
|
||||
long getProfileId();
|
||||
|
||||
|
|
@ -46,8 +47,6 @@ public interface AutoScaleVmGroup extends ControlledEntity {
|
|||
|
||||
int getInterval();
|
||||
|
||||
boolean isRevoke();
|
||||
|
||||
String getState();
|
||||
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.network.resource;
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ public class NetscalerResource implements ServerResource {
|
|||
private String _password;
|
||||
private String _publicInterface;
|
||||
private String _privateInterface;
|
||||
private Integer _numRetries;
|
||||
private Integer _numRetries;
|
||||
private String _guid;
|
||||
private boolean _inline;
|
||||
private boolean _isSdx;
|
||||
|
|
@ -199,8 +199,8 @@ public class NetscalerResource implements ServerResource {
|
|||
login();
|
||||
validateDeviceType(_deviceName);
|
||||
validateInterfaces(_publicInterface, _privateInterface);
|
||||
|
||||
//enable load balancing feature
|
||||
|
||||
//enable load balancing feature
|
||||
enableLoadBalancingFeature();
|
||||
|
||||
//if the the device is cloud stack provisioned then make it part of the public network
|
||||
|
|
@ -210,10 +210,10 @@ public class NetscalerResource implements ServerResource {
|
|||
_publicIPNetmask = (String) params.get("publicipnetmask");
|
||||
_publicIPVlan = (String) params.get("publicipvlan");
|
||||
if ("untagged".equalsIgnoreCase(_publicIPVlan)) {
|
||||
// if public network is un-tagged just add subnet IP
|
||||
// if public network is un-tagged just add subnet IP
|
||||
addSubnetIP(_publicIP, _publicIPNetmask);
|
||||
} else {
|
||||
// if public network is tagged then add vlan and bind subnet IP to the vlan
|
||||
// if public network is tagged then add vlan and bind subnet IP to the vlan
|
||||
addGuestVlanAndSubnet(Long.parseLong(_publicIPVlan), _publicIP, _publicIPNetmask, false);
|
||||
}
|
||||
}
|
||||
|
|
@ -384,7 +384,7 @@ public class NetscalerResource implements ServerResource {
|
|||
|
||||
String[] results = new String[cmd.getIpAddresses().length];
|
||||
int i = 0;
|
||||
try {
|
||||
try {
|
||||
IpAddressTO[] ips = cmd.getIpAddresses();
|
||||
for (IpAddressTO ip : ips) {
|
||||
long guestVlanTag = Long.valueOf(ip.getVlanId());
|
||||
|
|
@ -473,7 +473,7 @@ public class NetscalerResource implements ServerResource {
|
|||
|
||||
// // Set min and max autoscale members to zero
|
||||
// com.citrix.netscaler.nitro.resource.config.lb.lbvserver lbvserver = new
|
||||
// com.citrix.netscaler.nitro.resource.config.lb.lbvserver();
|
||||
// com.citrix.netscaler.nitro.resource.config.lb.lbvserver();
|
||||
// try {
|
||||
// lbvserver.set_name(nsVirtualServerName);
|
||||
// lbvserver.set_minautoscalemembers(0);
|
||||
|
|
@ -676,117 +676,116 @@ public class NetscalerResource implements ServerResource {
|
|||
int snmpPort = profileTO.getSnmpPort();
|
||||
String snmpCommunity = profileTO.getSnmpCommunity();
|
||||
ArrayList<Long> priorities = new ArrayList<Long>();
|
||||
if(!vmGroupTO.isRevoked()) {
|
||||
// Set min and max autoscale members;
|
||||
// add lb vserver lb http 10.102.31.100 80 -minAutoscaleMinMembers 3 -maxAutoscaleMembers 10
|
||||
int minAutoScaleMembers = vmGroupTO.getMinMembers();
|
||||
int maxAutoScaleMembers = vmGroupTO.getMaxMembers();
|
||||
com.citrix.netscaler.nitro.resource.config.lb.lbvserver lbvserver = new com.citrix.netscaler.nitro.resource.config.lb.lbvserver();
|
||||
try {
|
||||
lbvserver.set_name(nsVirtualServerName);
|
||||
lbvserver.set_minautoscalemembers(minAutoScaleMembers);
|
||||
lbvserver.set_maxautoscalemembers(maxAutoScaleMembers);
|
||||
lbvserver.update(_netscalerService, lbvserver);
|
||||
} catch (Exception e) {
|
||||
// Ignore Exception
|
||||
throw e;
|
||||
}
|
||||
|
||||
/* AutoScale Config */
|
||||
// Add AutoScale Profile
|
||||
// add autoscale profile lb_asprofile CLOUDSTACK -url -http:// 10.102.31.34:8080/client/api- -apiKey abcdef
|
||||
// -sharedSecret xyzabc
|
||||
String apiKey = profileTO.getAutoScaleUserApiKey();
|
||||
String secretKey = profileTO.getAutoScaleUserSecretKey();
|
||||
String url = profileTO.getCloudStackApiUrl();
|
||||
// Set min and max autoscale members;
|
||||
// add lb vserver lb http 10.102.31.100 80 -minAutoscaleMinMembers 3 -maxAutoscaleMembers 10
|
||||
int minAutoScaleMembers = vmGroupTO.getMinMembers();
|
||||
int maxAutoScaleMembers = vmGroupTO.getMaxMembers();
|
||||
com.citrix.netscaler.nitro.resource.config.lb.lbvserver lbvserver = new com.citrix.netscaler.nitro.resource.config.lb.lbvserver();
|
||||
try {
|
||||
lbvserver.set_name(nsVirtualServerName);
|
||||
lbvserver.set_minautoscalemembers(minAutoScaleMembers);
|
||||
lbvserver.set_maxautoscalemembers(maxAutoScaleMembers);
|
||||
lbvserver.update(_netscalerService, lbvserver);
|
||||
} catch (Exception e) {
|
||||
// Ignore Exception
|
||||
throw e;
|
||||
}
|
||||
|
||||
com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleprofile autoscaleProfile = new com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleprofile();
|
||||
try {
|
||||
autoscaleProfile.set_name(profileName);
|
||||
autoscaleProfile.set_apikey(apiKey);
|
||||
autoscaleProfile.set_sharedsecret(secretKey);
|
||||
autoscaleProfile.set_url(url);
|
||||
autoscaleProfile.add(_netscalerService, autoscaleProfile);
|
||||
} catch (Exception e) {
|
||||
// Ignore Exception
|
||||
throw e;
|
||||
}
|
||||
/* AutoScale Config */
|
||||
// Add AutoScale Profile
|
||||
// add autoscale profile lb_asprofile CLOUDSTACK -url -http:// 10.102.31.34:8080/client/api- -apiKey abcdef
|
||||
// -sharedSecret xyzabc
|
||||
String apiKey = profileTO.getAutoScaleUserApiKey();
|
||||
String secretKey = profileTO.getAutoScaleUserSecretKey();
|
||||
String url = profileTO.getCloudStackApiUrl();
|
||||
|
||||
// Add Timer
|
||||
com.citrix.netscaler.nitro.resource.config.timer.timertrigger timer = new com.citrix.netscaler.nitro.resource.config.timer.timertrigger();
|
||||
try {
|
||||
timer.set_name(timerName);
|
||||
timer.set_interval(interval);
|
||||
timer.add(_netscalerService, timer);
|
||||
} catch (Exception e) {
|
||||
// Ignore Exception
|
||||
throw e;
|
||||
}
|
||||
com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleprofile autoscaleProfile = new com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleprofile();
|
||||
try {
|
||||
autoscaleProfile.set_name(profileName);
|
||||
autoscaleProfile.set_apikey(apiKey);
|
||||
autoscaleProfile.set_sharedsecret(secretKey);
|
||||
autoscaleProfile.set_url(url);
|
||||
autoscaleProfile.add(_netscalerService, autoscaleProfile);
|
||||
} catch (Exception e) {
|
||||
// Ignore Exception
|
||||
throw e;
|
||||
}
|
||||
|
||||
// AutoScale Actions
|
||||
Integer scaleUpQuietTime = null;
|
||||
Integer scaleDownQuietTime = null;
|
||||
for (AutoScalePolicyTO autoScalePolicyTO : policies) {
|
||||
if(scaleUpQuietTime == null) {
|
||||
if(isScaleUpPolicy(autoScalePolicyTO)) {
|
||||
scaleUpQuietTime = autoScalePolicyTO.getQuietTime();
|
||||
if(scaleDownQuietTime == null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(scaleDownQuietTime == null) {
|
||||
if(isScaleDownPolicy(autoScalePolicyTO)) {
|
||||
scaleDownQuietTime = autoScalePolicyTO.getQuietTime();
|
||||
if(scaleUpQuietTime == null) {
|
||||
break;
|
||||
}
|
||||
// Add Timer
|
||||
com.citrix.netscaler.nitro.resource.config.timer.timertrigger timer = new com.citrix.netscaler.nitro.resource.config.timer.timertrigger();
|
||||
try {
|
||||
timer.set_name(timerName);
|
||||
timer.set_interval(interval);
|
||||
timer.add(_netscalerService, timer);
|
||||
} catch (Exception e) {
|
||||
// Ignore Exception
|
||||
throw e;
|
||||
}
|
||||
|
||||
// AutoScale Actions
|
||||
Integer scaleUpQuietTime = null;
|
||||
Integer scaleDownQuietTime = null;
|
||||
for (AutoScalePolicyTO autoScalePolicyTO : policies) {
|
||||
if(scaleUpQuietTime == null) {
|
||||
if(isScaleUpPolicy(autoScalePolicyTO)) {
|
||||
scaleUpQuietTime = autoScalePolicyTO.getQuietTime();
|
||||
if(scaleDownQuietTime == null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add AutoScale ScaleUp action
|
||||
// add autoscale action lb_scaleUpAction provision -vserver lb -profilename lb_asprofile -params
|
||||
// -lbruleid=1234&command=deployvm&zoneid=10&templateid=5&serviceofferingid=3- -quiettime 300
|
||||
com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction scaleUpAction = new com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction();
|
||||
try {
|
||||
scaleUpAction.set_name(scaleUpActionName);
|
||||
scaleUpAction.set_type("SCALE_UP"); // TODO: will this be called provision?
|
||||
scaleUpAction.set_vserver(nsVirtualServerName); // Actions Vserver, the one that is autoscaled, with CS
|
||||
// now both are same. Not exposed in API.
|
||||
scaleUpAction.set_profilename(profileName);
|
||||
scaleUpAction.set_quiettime(scaleUpQuietTime);
|
||||
String scaleUpParameters = "command=deployVirtualMachine" + "&" +
|
||||
ApiConstants.ZONE_ID + "=" + profileTO.getZoneId()+ "&" +
|
||||
ApiConstants.SERVICE_OFFERING_ID + "=" + profileTO.getServiceOfferingId()+ "&" +
|
||||
ApiConstants.TEMPLATE_ID + "=" + profileTO.getTemplateId()+ "&" +
|
||||
((profileTO.getOtherDeployParams() == null)? "" : (profileTO.getOtherDeployParams() + "&")) +
|
||||
"lbRuleId=" + loadBalancerTO.getId();
|
||||
scaleUpAction.set_parameters(scaleUpParameters);
|
||||
scaleUpAction.add(_netscalerService, scaleUpAction);
|
||||
} catch (Exception e) {
|
||||
// Ignore Exception
|
||||
throw e;
|
||||
if(scaleDownQuietTime == null) {
|
||||
if(isScaleDownPolicy(autoScalePolicyTO)) {
|
||||
scaleDownQuietTime = autoScalePolicyTO.getQuietTime();
|
||||
if(scaleUpQuietTime == null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction scaleDownAction = new com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction();
|
||||
Integer destroyVmGracePeriod = profileTO.getDestroyVmGraceperiod();
|
||||
try {
|
||||
scaleDownAction.set_name(scaleDownActionName);
|
||||
scaleDownAction.set_type("SCALE_DOWN"); // TODO: will this be called de-provision?
|
||||
scaleDownAction.set_vserver(nsVirtualServerName); // TODO: no global option as of now through Nitro.
|
||||
// Testing cannot be done.
|
||||
scaleDownAction.set_profilename(profileName);
|
||||
scaleDownAction.set_quiettime(scaleDownQuietTime);
|
||||
String scaleDownParameters = "command=destroyVirtualMachine" + "&" +
|
||||
"lbRuleId=" + loadBalancerTO.getId();
|
||||
scaleDownAction.set_parameters(scaleDownParameters);
|
||||
scaleDownAction.set_vmdestroygraceperiod(destroyVmGracePeriod);
|
||||
scaleDownAction.add(_netscalerService, scaleDownAction);
|
||||
} catch (Exception e) {
|
||||
// Ignore Exception
|
||||
throw e;
|
||||
}
|
||||
// Add AutoScale ScaleUp action
|
||||
// add autoscale action lb_scaleUpAction provision -vserver lb -profilename lb_asprofile -params
|
||||
// -lbruleid=1234&command=deployvm&zoneid=10&templateid=5&serviceofferingid=3- -quiettime 300
|
||||
com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction scaleUpAction = new com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction();
|
||||
try {
|
||||
scaleUpAction.set_name(scaleUpActionName);
|
||||
scaleUpAction.set_type("SCALE_UP"); // TODO: will this be called provision?
|
||||
scaleUpAction.set_vserver(nsVirtualServerName); // Actions Vserver, the one that is autoscaled, with CS
|
||||
// now both are same. Not exposed in API.
|
||||
scaleUpAction.set_profilename(profileName);
|
||||
scaleUpAction.set_quiettime(scaleUpQuietTime);
|
||||
String scaleUpParameters = "command=deployVirtualMachine" + "&" +
|
||||
ApiConstants.ZONE_ID + "=" + profileTO.getZoneId()+ "&" +
|
||||
ApiConstants.SERVICE_OFFERING_ID + "=" + profileTO.getServiceOfferingId()+ "&" +
|
||||
ApiConstants.TEMPLATE_ID + "=" + profileTO.getTemplateId()+ "&" +
|
||||
((profileTO.getOtherDeployParams() == null)? "" : (profileTO.getOtherDeployParams() + "&")) +
|
||||
"lbRuleId=" + loadBalancerTO.getId();
|
||||
scaleUpAction.set_parameters(scaleUpParameters);
|
||||
scaleUpAction.add(_netscalerService, scaleUpAction);
|
||||
} catch (Exception e) {
|
||||
// Ignore Exception
|
||||
throw e;
|
||||
}
|
||||
|
||||
com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction scaleDownAction = new com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction();
|
||||
Integer destroyVmGracePeriod = profileTO.getDestroyVmGraceperiod();
|
||||
try {
|
||||
scaleDownAction.set_name(scaleDownActionName);
|
||||
scaleDownAction.set_type("SCALE_DOWN"); // TODO: will this be called de-provision?
|
||||
scaleDownAction.set_vserver(nsVirtualServerName); // TODO: no global option as of now through Nitro.
|
||||
// Testing cannot be done.
|
||||
scaleDownAction.set_profilename(profileName);
|
||||
scaleDownAction.set_quiettime(scaleDownQuietTime);
|
||||
String scaleDownParameters = "command=destroyVirtualMachine" + "&" +
|
||||
"lbRuleId=" + loadBalancerTO.getId();
|
||||
scaleDownAction.set_parameters(scaleDownParameters);
|
||||
scaleDownAction.set_vmdestroygraceperiod(destroyVmGracePeriod);
|
||||
scaleDownAction.add(_netscalerService, scaleDownAction);
|
||||
} catch (Exception e) {
|
||||
// Ignore Exception
|
||||
throw e;
|
||||
}
|
||||
|
||||
/* Create Counters */
|
||||
|
|
@ -807,7 +806,7 @@ public class NetscalerResource implements ServerResource {
|
|||
|
||||
if(counterTO.getSource().equals("snmp"))
|
||||
{
|
||||
counterName = counterName.replace(' ', '_');
|
||||
counterName = generateSnmpMetricName(counterName);
|
||||
if(snmpMetrics.size() == 0) {
|
||||
// Create Metric Table
|
||||
//add lb metricTable lb_metric_table
|
||||
|
|
@ -822,7 +821,7 @@ public class NetscalerResource implements ServerResource {
|
|||
|
||||
// Create Monitor
|
||||
// add lb monitor lb_metric_table_mon LOAD -destPort 161 -snmpCommunity public -metricTable
|
||||
// lb_metric_table -interval <policy_interval == 80% >
|
||||
// lb_metric_table -interval <policy_interval == 80% >
|
||||
com.citrix.netscaler.nitro.resource.config.lb.lbmonitor monitor = new com.citrix.netscaler.nitro.resource.config.lb.lbmonitor();
|
||||
try {
|
||||
monitor.set_monitorname(monitorName);
|
||||
|
|
@ -843,7 +842,7 @@ public class NetscalerResource implements ServerResource {
|
|||
monitor_servicegroup_binding.set_monitorname(monitorName);
|
||||
monitor_servicegroup_binding.set_servicegroupname(serviceGroupName);
|
||||
monitor_servicegroup_binding.set_passive(true); // Mark the monitor to do only collect
|
||||
// metrics, basically use it for autoscaling purpose only.
|
||||
// metrics, basically use it for autoscaling purpose only.
|
||||
monitor_servicegroup_binding.add(_netscalerService, monitor_servicegroup_binding);
|
||||
} catch (Exception e) {
|
||||
// Ignore Exception
|
||||
|
|
@ -852,7 +851,7 @@ public class NetscalerResource implements ServerResource {
|
|||
}
|
||||
|
||||
// formatter.format("SYS.CUR_VSERVER.METRIC_TABLE(%s).AVG_VAL.%s(%ld)",counterName, operator,
|
||||
// threshold);
|
||||
// threshold);
|
||||
boolean newMetric = !snmpMetrics.containsKey(counterName);
|
||||
if(newMetric) {
|
||||
snmpMetrics.put(counterName, snmpCounterNumber++);
|
||||
|
|
@ -903,7 +902,7 @@ public class NetscalerResource implements ServerResource {
|
|||
if(!isPolicyRevoked) {
|
||||
// Adding a autoscale policy
|
||||
// add timer policy lb_policy_scaleUp_cpu_mem -rule - (SYS.CUR_VSERVER.METRIC_TABLE(cpu).AVG_VAL.GT(80)-
|
||||
// -action lb_scaleUpAction
|
||||
// -action lb_scaleUpAction
|
||||
com.citrix.netscaler.nitro.resource.config.timer.timerpolicy timerPolicy = new com.citrix.netscaler.nitro.resource.config.timer.timerpolicy();
|
||||
try {
|
||||
timerPolicy.set_name(policyName);
|
||||
|
|
@ -917,7 +916,7 @@ public class NetscalerResource implements ServerResource {
|
|||
|
||||
// bind timer policy
|
||||
// bind timer trigger lb_astimer -policyName lb_policy_scaleUp -vserver lb -priority 1 -samplesize 5
|
||||
// -thresholdsize 5
|
||||
// -thresholdsize 5
|
||||
com.citrix.netscaler.nitro.resource.config.timer.timertrigger_timerpolicy_binding timer_policy_binding = new com.citrix.netscaler.nitro.resource.config.timer.timertrigger_timerpolicy_binding();
|
||||
int sampleSize = autoScalePolicyTO.getDuration()/interval;
|
||||
long priority = allocateNextAvailablePriority(priorities);
|
||||
|
|
@ -927,7 +926,7 @@ public class NetscalerResource implements ServerResource {
|
|||
timer_policy_binding.set_vserver(nsVirtualServerName);
|
||||
timer_policy_binding.set_samplesize(sampleSize);
|
||||
timer_policy_binding.set_thresholdsize(sampleSize); // We are not exposing this parameter as of now.
|
||||
// i.e. n(m) is not exposed to CS user. So thresholdSize == sampleSize
|
||||
// i.e. n(m) is not exposed to CS user. So thresholdSize == sampleSize
|
||||
timer_policy_binding.set_priority(priority);
|
||||
timer_policy_binding.add(_netscalerService, timer_policy_binding);
|
||||
} catch (Exception e) {
|
||||
|
|
@ -999,10 +998,10 @@ public class NetscalerResource implements ServerResource {
|
|||
}
|
||||
|
||||
for (DestinationTO destination : loadBalancer.getDestinations()) {
|
||||
|
||||
|
||||
String nsServerName = generateNSServerName(destination.getDestIp());
|
||||
String nsServiceName = generateNSServiceName(destination.getDestIp(), destination.getDestPort());
|
||||
|
||||
|
||||
if (!destination.isRevoked()) {
|
||||
// add a new destination to deployed load balancing rule
|
||||
|
||||
|
|
@ -1032,13 +1031,13 @@ public class NetscalerResource implements ServerResource {
|
|||
}
|
||||
}
|
||||
|
||||
//bind service to load balancing virtual server
|
||||
//bind service to load balancing virtual server
|
||||
if (!nsServiceBindingExists(nsVirtualServerName, nsServiceName)) {
|
||||
com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding svcBinding = new com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding();
|
||||
svcBinding.set_name(nsVirtualServerName);
|
||||
svcBinding.set_servicename(nsServiceName);
|
||||
apiCallResult = com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding.add(_netscalerService, svcBinding);
|
||||
|
||||
|
||||
if (apiCallResult.errorcode != 0) {
|
||||
throw new ExecutionException("Failed to bind service: " + nsServiceName + " to the lb virtual server: " + nsVirtualServerName + " on Netscaler device");
|
||||
}
|
||||
|
|
@ -1059,7 +1058,7 @@ public class NetscalerResource implements ServerResource {
|
|||
throw new ExecutionException("Failed to delete the binding between the virtual server: " + nsVirtualServerName + " and service:" + nsServiceName + " due to"
|
||||
+ apiCallResult.message);
|
||||
}
|
||||
|
||||
|
||||
// check if service is bound to any other virtual server
|
||||
if (!isServiceBoundToVirtualServer(nsServiceName)) {
|
||||
// no lb virtual servers are bound to this service so delete it
|
||||
|
|
@ -1068,7 +1067,7 @@ public class NetscalerResource implements ServerResource {
|
|||
throw new ExecutionException("Failed to delete service: " + nsServiceName + " due to " + apiCallResult.message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// delete the server if there is no associated services
|
||||
server_service_binding[] services = server_service_binding.get(_netscalerService, nsServerName);
|
||||
if ((services == null) || (services.length == 0)) {
|
||||
|
|
@ -1080,16 +1079,16 @@ public class NetscalerResource implements ServerResource {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// delete the implemented load balancing rule and its destinations
|
||||
// delete the implemented load balancing rule and its destinations
|
||||
lbvserver lbserver = getVirtualServerIfExisits(nsVirtualServerName);
|
||||
if (lbserver != null) {
|
||||
//unbind the all services associated with this virtual server
|
||||
com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding[] serviceBindings = com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding.get(_netscalerService,
|
||||
nsVirtualServerName);
|
||||
|
||||
|
||||
if (serviceBindings != null) {
|
||||
for (com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding binding : serviceBindings) {
|
||||
String serviceName = binding.get_servicename();
|
||||
|
|
@ -1097,7 +1096,7 @@ public class NetscalerResource implements ServerResource {
|
|||
if (apiCallResult.errorcode != 0) {
|
||||
throw new ExecutionException("Failed to unbind service from the lb virtual server: " + nsVirtualServerName + " due to " + apiCallResult.message);
|
||||
}
|
||||
|
||||
|
||||
com.citrix.netscaler.nitro.resource.config.basic.service svc = com.citrix.netscaler.nitro.resource.config.basic.service.get(_netscalerService, serviceName);
|
||||
String nsServerName = svc.get_servername();
|
||||
|
||||
|
|
@ -1145,7 +1144,7 @@ public class NetscalerResource implements ServerResource {
|
|||
} else {
|
||||
return new Answer(cmd, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized Answer execute(CreateLoadBalancerApplianceCommand cmd, int numRetries) {
|
||||
|
|
@ -1177,8 +1176,8 @@ public class NetscalerResource implements ServerResource {
|
|||
// use the first device profile available on the SDX to create an instance of VPX
|
||||
device_profile[] profiles = device_profile.get(_netscalerSdxService);
|
||||
if (!(profiles != null && profiles.length >= 1)) {
|
||||
new Answer(cmd, new ExecutionException("Failed to create VPX instance on the netscaler SDX device " + _ip +
|
||||
" as there are no admin profile to use for creating VPX."));
|
||||
new Answer(cmd, new ExecutionException("Failed to create VPX instance on the netscaler SDX device " + _ip +
|
||||
" as there are no admin profile to use for creating VPX."));
|
||||
}
|
||||
String profileName = profiles[0].get_name();
|
||||
ns_obj.set_nsroot_profile(profileName);
|
||||
|
|
@ -1187,8 +1186,8 @@ public class NetscalerResource implements ServerResource {
|
|||
// TODO: should enable the option to choose the template while adding the SDX device in to CloudStack
|
||||
xen_vpx_image[] vpxImages = xen_vpx_image.get(_netscalerSdxService);
|
||||
if (!(vpxImages != null && vpxImages.length >= 1)) {
|
||||
new Answer(cmd, new ExecutionException("Failed to create VPX instance on the netscaler SDX device " + _ip +
|
||||
" as there are no VPX images on SDX to use for creating VPX."));
|
||||
new Answer(cmd, new ExecutionException("Failed to create VPX instance on the netscaler SDX device " + _ip +
|
||||
" as there are no VPX images on SDX to use for creating VPX."));
|
||||
}
|
||||
String imageName = vpxImages[0].get_file_name();
|
||||
ns_obj.set_image_name(imageName);
|
||||
|
|
@ -1210,7 +1209,7 @@ public class NetscalerResource implements ServerResource {
|
|||
long startTick = System.currentTimeMillis();
|
||||
long startWaitMilliSeconds = 600000;
|
||||
while(!newVpx.get_ns_state().equalsIgnoreCase("up") && System.currentTimeMillis() - startTick < startWaitMilliSeconds) {
|
||||
try {
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch(InterruptedException e) {
|
||||
}
|
||||
|
|
@ -1253,11 +1252,11 @@ public class NetscalerResource implements ServerResource {
|
|||
}
|
||||
|
||||
// physical interfaces on the SDX range from 10/1 to 10/8 & 1/1 to 1/8 of which two different port or same
|
||||
// port can be used for public and private interfaces
|
||||
// port can be used for public and private interfaces
|
||||
// However the VPX instances created will have interface range start from 10/1 but will only have as many
|
||||
// interfaces enabled while creating the VPX instance
|
||||
// interfaces enabled while creating the VPX instance
|
||||
// So due to this, we need to map public & private interface on SDX to correct public & private interface of
|
||||
// VPX
|
||||
// VPX
|
||||
|
||||
int publicIfnum = Integer.parseInt(_publicInterface.substring(_publicInterface.lastIndexOf("/") + 1));
|
||||
int privateIfnum = Integer.parseInt(_privateInterface.substring(_privateInterface.lastIndexOf("/") + 1));
|
||||
|
|
@ -1609,7 +1608,7 @@ public class NetscalerResource implements ServerResource {
|
|||
}
|
||||
|
||||
// unbind the vlan to subnet
|
||||
try {
|
||||
try {
|
||||
vlan_nsip_binding vlanSnipBinding = new vlan_nsip_binding();
|
||||
vlanSnipBinding.set_netmask(vlanNetmask);
|
||||
vlanSnipBinding.set_ipaddress(vlanSelfIp);
|
||||
|
|
@ -1646,7 +1645,7 @@ public class NetscalerResource implements ServerResource {
|
|||
if (apiCallResult.errorcode != 0) {
|
||||
throw new ExecutionException("Failed to remove vlan with tag:" + vlanTag + "due to" + apiCallResult.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (nitro_exception e) {
|
||||
throw new ExecutionException("Failed to delete guest vlan network on the Netscaler device due to " + e.getMessage());
|
||||
} catch (Exception e) {
|
||||
|
|
@ -1754,7 +1753,7 @@ public class NetscalerResource implements ServerResource {
|
|||
throw new ExecutionException("Failed to verify service " + serviceName + " is bound to any virtual server due to " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean nsServiceExists(String serviceName) throws ExecutionException {
|
||||
try {
|
||||
if (com.citrix.netscaler.nitro.resource.config.basic.service.get(_netscalerService, serviceName) != null) {
|
||||
|
|
@ -1898,7 +1897,7 @@ public class NetscalerResource implements ServerResource {
|
|||
List<Pair<String, String>> paramsList = stickinessPolicy.getParams();
|
||||
for(Pair<String,String> param : paramsList) {
|
||||
if ("holdtime".equalsIgnoreCase(param.first())) {
|
||||
timeout = Long.parseLong(param.second());
|
||||
timeout = Long.parseLong(param.second());
|
||||
} else if ("name".equalsIgnoreCase(param.first())) {
|
||||
cookieName = param.second();
|
||||
}
|
||||
|
|
@ -1994,14 +1993,14 @@ public class NetscalerResource implements ServerResource {
|
|||
lbvserver vserver = lbvserver.get(_netscalerService, lbvserverName);
|
||||
if(vserver != null){
|
||||
String lbVirtualServerIp = vserver.get_ipv46();
|
||||
|
||||
|
||||
long[] bytesSentAndReceived = answer.ipBytes.get(lbVirtualServerIp);
|
||||
if (bytesSentAndReceived == null) {
|
||||
bytesSentAndReceived = new long[]{0, 0};
|
||||
}
|
||||
bytesSentAndReceived[0] += stat_entry.get_totalrequestbytes();
|
||||
bytesSentAndReceived[1] += stat_entry.get_totalresponsebytes();
|
||||
|
||||
|
||||
if (bytesSentAndReceived[0] >= 0 && bytesSentAndReceived[1] >= 0) {
|
||||
answer.ipBytes.put(lbVirtualServerIp, bytesSentAndReceived);
|
||||
}
|
||||
|
|
@ -2074,7 +2073,7 @@ public class NetscalerResource implements ServerResource {
|
|||
}
|
||||
|
||||
private String generateSnmpMetricName(String counterName) {
|
||||
return counterName;
|
||||
return counterName.replace(' ', '_');
|
||||
}
|
||||
|
||||
private String generateNSServerName(String serverIP) {
|
||||
|
|
@ -2115,7 +2114,7 @@ public class NetscalerResource implements ServerResource {
|
|||
public void setAgentControl(IAgentControl agentControl) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _name;
|
||||
|
|
@ -2129,7 +2128,7 @@ public class NetscalerResource implements ServerResource {
|
|||
@Override
|
||||
public boolean stop() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnected() {
|
||||
|
|
|
|||
|
|
@ -3826,6 +3826,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
response.setId(vmGroup.getId());
|
||||
response.setMinMembers(vmGroup.getMinMembers());
|
||||
response.setMaxMembers(vmGroup.getMaxMembers());
|
||||
response.setState(vmGroup.getState());
|
||||
response.setInterval(vmGroup.getInterval());
|
||||
response.setProfileId(vmGroup.getProfileId());
|
||||
response.setLoadBalancerId(vmGroup.getProfileId());
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ import com.cloud.event.ActionEvent;
|
|||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.ResourceInUseException;
|
||||
import com.cloud.network.LoadBalancerVMMapVO;
|
||||
import com.cloud.network.LoadBalancerVO;
|
||||
import com.cloud.network.Network.Capability;
|
||||
import com.cloud.network.as.AutoScalePolicy;
|
||||
|
|
@ -275,6 +274,9 @@ public class AutoScaleManagerImpl<Type> implements AutoScaleService, Manager {
|
|||
else {
|
||||
autoscaleUserId = UserContext.current().getCallerUserId();
|
||||
}
|
||||
|
||||
// TODO check template is present or not.
|
||||
|
||||
AutoScaleVmProfileVO profileVO = new AutoScaleVmProfileVO(cmd.getZoneId(), cmd.getDomainId(), cmd.getAccountId(), cmd.getServiceOfferingId(), cmd.getTemplateId(), cmd.getOtherDeployParams(),
|
||||
cmd.getSnmpCommunity(), cmd.getSnmpPort(), cmd.getDestroyVmGraceperiod(), autoscaleUserId);
|
||||
_autoScaleVmProfileDao.persist(profileVO);
|
||||
|
|
@ -325,6 +327,11 @@ public class AutoScaleManagerImpl<Type> implements AutoScaleService, Manager {
|
|||
Long templateId = cmd.getTemplateId();
|
||||
String otherDeployParams = cmd.getOtherDeployParams();
|
||||
AutoScaleVmProfileVO vmProfile = getEntityInDatabase("Auto Scale Vm Profile", profileId, _autoScaleVmProfileDao);
|
||||
AutoScaleVmProfileVO bakUpProfile = getEntityInDatabase("Auto Scale Vm Profile", profileId, _autoScaleVmProfileDao);
|
||||
|
||||
if(templateId == null && otherDeployParams == null) {
|
||||
throw new InvalidParameterValueException("Atleast one parameter should be passed for update");
|
||||
}
|
||||
|
||||
if (templateId != null) {
|
||||
vmProfile.setTemplateId(templateId);
|
||||
|
|
@ -336,17 +343,70 @@ public class AutoScaleManagerImpl<Type> implements AutoScaleService, Manager {
|
|||
|
||||
List<AutoScaleVmGroupVO> vmGroupList = _autoScaleVmGroupDao.listByAll(null, profileId);
|
||||
for (AutoScaleVmGroupVO vmGroupVO : vmGroupList) {
|
||||
if (vmGroupVO.getState() != "disabled") {
|
||||
throw new InvalidParameterValueException("Cannot delete AutoScale Vm Profile when it is being used in one or more Enabled AutoScale Vm Groups.");
|
||||
if (vmGroupVO.getState().equals(AutoScaleVmGroup.State_Disabled)) {
|
||||
throw new InvalidParameterValueException("The AutoScale Vm Profile can be updated only if the Vm Group it is associated with is disabled in state");
|
||||
}
|
||||
}
|
||||
|
||||
boolean success = _autoScaleVmProfileDao.update(profileId, vmProfile);
|
||||
|
||||
if (success) {
|
||||
s_logger.debug("Updated Auto Scale Vm Profile id=" + profileId);
|
||||
s_logger.debug("Updated Auto Scale Vm Profile id:" + profileId);
|
||||
return vmProfile;
|
||||
} else
|
||||
} else {
|
||||
_autoScaleVmProfileDao.update(bakUpProfile.getId(), bakUpProfile);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void isAutoScalePolicyValid(AutoScalePolicyVO autoScalePolicyVO, List<Long> conditionIds) {
|
||||
Integer duration = autoScalePolicyVO.getDuration();
|
||||
Integer quietTime = autoScalePolicyVO.getQuietTime();
|
||||
|
||||
if (duration < 0) {
|
||||
throw new InvalidParameterValueException("duration is an invalid value: " + duration);
|
||||
}
|
||||
|
||||
if (quietTime < 0) {
|
||||
throw new InvalidParameterValueException("quiettime is an invalid value: " + quietTime);
|
||||
}
|
||||
|
||||
SearchBuilder<ConditionVO> policySearch = _conditionDao.createSearchBuilder();
|
||||
policySearch.and("ids", policySearch.entity().getId(), Op.IN);
|
||||
policySearch.done();
|
||||
SearchCriteria<ConditionVO> sc = policySearch.create();
|
||||
|
||||
sc.setParameters("ids", conditionIds.toArray(new Object[0]));
|
||||
List<ConditionVO> conditions = _conditionDao.search(sc, null);
|
||||
|
||||
ControlledEntity[] sameOwnerEntities = conditions.toArray(new ControlledEntity[conditions.size() + 1]);
|
||||
sameOwnerEntities[sameOwnerEntities.length - 1] = autoScalePolicyVO;
|
||||
_accountMgr.checkAccess(UserContext.current().getCaller(), null, true, sameOwnerEntities);
|
||||
|
||||
if (conditionIds.size() != conditions.size()) {
|
||||
// TODO report the condition id which could not be found
|
||||
throw new InvalidParameterValueException("Unable to find a condition specified");
|
||||
}
|
||||
|
||||
ArrayList<Long> counterIds = new ArrayList<Long>();
|
||||
for (ConditionVO condition : conditions) {
|
||||
if (counterIds.contains(condition.getCounterid())) {
|
||||
throw new InvalidParameterValueException("atleast two conditions in the conditionids have the same counter. It is not right to apply two different conditions for the same counter");
|
||||
}
|
||||
counterIds.add(condition.getCounterid());
|
||||
}
|
||||
|
||||
final Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
|
||||
autoScalePolicyVO = _autoScalePolicyDao.persist(autoScalePolicyVO);
|
||||
|
||||
for (Long conditionId : conditionIds) {
|
||||
AutoScalePolicyConditionMapVO policyConditionMapVO = new AutoScalePolicyConditionMapVO(autoScalePolicyVO.getId(), conditionId);
|
||||
_autoScalePolicyConditionMapDao.persist(policyConditionMapVO);
|
||||
}
|
||||
|
||||
txn.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -354,63 +414,22 @@ public class AutoScaleManagerImpl<Type> implements AutoScaleService, Manager {
|
|||
@ActionEvent(eventType = EventTypes.EVENT_AUTOSCALEPOLICY_CREATE, eventDescription = "creating autoscale policy")
|
||||
public AutoScalePolicy createAutoScalePolicy(CreateAutoScalePolicyCmd cmd) {
|
||||
|
||||
// Account owner = _accountDao.findById(cmd.getAccountId());
|
||||
// Account caller = UserContext.current().getCaller();
|
||||
// _accountMgr.checkAccess(caller, null, true, owner);
|
||||
|
||||
Integer duration = cmd.getDuration();
|
||||
Integer quietTime = cmd.getQuietTime();
|
||||
String action = cmd.getAction();
|
||||
|
||||
if (duration != null && duration < 0) {
|
||||
throw new InvalidParameterValueException("duration is an invalid value: " + duration);
|
||||
}
|
||||
|
||||
if (quietTime != null && quietTime < 0) {
|
||||
throw new InvalidParameterValueException("quiettime is an invalid value: " + quietTime);
|
||||
if (quietTime != null) {
|
||||
quietTime = NetUtils.DEFAULT_AUTOSCALE_POLICY_QUIET_TIME;
|
||||
}
|
||||
|
||||
action = action.toLowerCase();
|
||||
if (!NetUtils.isValidAutoScaleAction(action)) {
|
||||
throw new InvalidParameterValueException("action is invalid, only 'provision' and 'de-provision' is supported");
|
||||
}
|
||||
action = action.toLowerCase();
|
||||
|
||||
SearchBuilder<ConditionVO> policySearch = _conditionDao.createSearchBuilder();
|
||||
policySearch.and("ids", policySearch.entity().getId(), Op.IN);
|
||||
policySearch.done();
|
||||
SearchCriteria<ConditionVO> sc = policySearch.create();
|
||||
|
||||
List<Long> conditionIds = cmd.getConditionIds();
|
||||
sc.setParameters("ids", conditionIds.toArray(new Object[0]));
|
||||
List<ConditionVO> conditions = _conditionDao.search(sc, null);
|
||||
|
||||
ArrayList<Long> counterIds = new ArrayList<Long>();
|
||||
ControlledEntity[] sameOwnerEntities = conditions.toArray(new ControlledEntity[conditions.size() + 1]);
|
||||
AutoScalePolicyVO policyVO = new AutoScalePolicyVO(cmd.getDomainId(), cmd.getAccountId(), duration, quietTime, action);
|
||||
sameOwnerEntities[sameOwnerEntities.length - 1] = policyVO;
|
||||
_accountMgr.checkAccess(UserContext.current().getCaller(), null, true, sameOwnerEntities);
|
||||
|
||||
if (conditionIds.size() != conditions.size()) {
|
||||
// TODO report the condition id which could not be found
|
||||
throw new InvalidParameterValueException("Unable to find a condition specified");
|
||||
}
|
||||
for (ConditionVO condition : conditions) {
|
||||
if (counterIds.contains(condition.getCounterid())) {
|
||||
throw new InvalidParameterValueException("atleast two conditions in the conditionids have the same counter. It is not right to apply two different conditions for the same counter");
|
||||
}
|
||||
}
|
||||
|
||||
final Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
|
||||
policyVO = _autoScalePolicyDao.persist(policyVO);
|
||||
|
||||
for (Long conditionId : conditionIds) {
|
||||
AutoScalePolicyConditionMapVO policyConditionMapVO = new AutoScalePolicyConditionMapVO(policyVO.getId(), conditionId);
|
||||
_autoScalePolicyConditionMapDao.persist(policyConditionMapVO);
|
||||
}
|
||||
|
||||
txn.commit();
|
||||
isAutoScalePolicyValid(policyVO, cmd.getConditionIds());
|
||||
|
||||
return policyVO;
|
||||
}
|
||||
|
|
@ -527,11 +546,19 @@ public class AutoScaleManagerImpl<Type> implements AutoScaleService, Manager {
|
|||
}
|
||||
|
||||
@Override
|
||||
@DB
|
||||
@ActionEvent(eventType = EventTypes.EVENT_AUTOSCALEPOLICY_UPDATE, eventDescription = "updating autoscale policy")
|
||||
public AutoScalePolicy updateAutoScalePolicy(UpdateAutoScalePolicyCmd cmd) {
|
||||
Long policyId = cmd.getId();
|
||||
Integer duration = cmd.getDuration();
|
||||
Integer quietTime = cmd.getQuietTime();
|
||||
List<Long> conditionIds = cmd.getConditionIds();
|
||||
AutoScalePolicyVO policy = getEntityInDatabase("Auto Scale Policy", policyId, _autoScalePolicyDao);
|
||||
AutoScalePolicyVO bakUpPolicy = getEntityInDatabase("Auto Scale Policy", policyId, _autoScalePolicyDao);
|
||||
|
||||
if(duration == null && quietTime == null && conditionIds == null) {
|
||||
throw new InvalidParameterValueException("Atleast one parameter should be passed for update");
|
||||
}
|
||||
|
||||
if (duration != null) {
|
||||
policy.setDuration(duration);
|
||||
|
|
@ -544,17 +571,28 @@ public class AutoScaleManagerImpl<Type> implements AutoScaleService, Manager {
|
|||
List<AutoScaleVmGroupPolicyMapVO> vmGroupPolicyList = _autoScaleVmGroupPolicyMapDao.listByPolicyId(policyId);
|
||||
for (AutoScaleVmGroupPolicyMapVO vmGroupPolicy : vmGroupPolicyList) {
|
||||
AutoScaleVmGroupVO vmGroupVO = _autoScaleVmGroupDao.findById(vmGroupPolicy.getVmGroupId());
|
||||
if (vmGroupVO.getState() != "disabled") {
|
||||
throw new InvalidParameterValueException("Cannot delete AutoScale Policy when it is being used in one or more Enabled AutoScale Vm Groups.");
|
||||
if (!vmGroupVO.getState().equals(AutoScaleVmGroup.State_Disabled)) {
|
||||
throw new InvalidParameterValueException("The AutoScale Policy can be updated only if the Vm Group it is associated with is disabled in state");
|
||||
}
|
||||
if(vmGroupVO.getInterval() < duration) {
|
||||
throw new InvalidParameterValueException("duration is less than the associated AutoScaleVmGroup's interval");
|
||||
}
|
||||
if(vmGroupVO.getInterval() < quietTime) {
|
||||
throw new InvalidParameterValueException("quietTime is less than the associated AutoScaleVmGroup's interval");
|
||||
}
|
||||
}
|
||||
|
||||
isAutoScalePolicyValid(policy, conditionIds);
|
||||
|
||||
boolean success = _autoScalePolicyDao.update(policyId, policy);
|
||||
|
||||
if (success) {
|
||||
s_logger.debug("Updated Auto Scale Policy id=" + policyId);
|
||||
s_logger.debug("Updated Auto Scale Policy id:" + policyId);
|
||||
return policy;
|
||||
} else
|
||||
} else {
|
||||
_autoScalePolicyDao.update(bakUpPolicy.getId(), bakUpPolicy);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -563,22 +601,13 @@ public class AutoScaleManagerImpl<Type> implements AutoScaleService, Manager {
|
|||
public AutoScaleVmGroup createAutoScaleVmGroup(CreateAutoScaleVmGroupCmd cmd) {
|
||||
int minMembers = cmd.getMinMembers();
|
||||
int maxMembers = cmd.getMaxMembers();
|
||||
|
||||
if (minMembers < 0) {
|
||||
throw new InvalidParameterValueException(ApiConstants.MIN_MEMBERS + " is an invalid value: " + minMembers);
|
||||
}
|
||||
|
||||
if (maxMembers < 0) {
|
||||
throw new InvalidParameterValueException(ApiConstants.MAX_MEMBERS + " is an invalid value: " + maxMembers);
|
||||
}
|
||||
if (minMembers > maxMembers) {
|
||||
throw new InvalidParameterValueException(ApiConstants.MIN_MEMBERS + " cannot be greater than " + ApiConstants.MAX_MEMBERS + ", range is invalid: " + minMembers + "-" + maxMembers);
|
||||
}
|
||||
|
||||
Integer interval = cmd.getInterval();
|
||||
if (interval != null && interval < 0) {
|
||||
throw new InvalidParameterValueException("interval is an invalid value: " + interval);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(interval == null)
|
||||
interval = NetUtils.DEFAULT_AUTOSCALE_POLICY_INTERVAL_TIME;
|
||||
|
||||
|
||||
LoadBalancerVO loadBalancer = getEntityInDatabase(ApiConstants.LBID, cmd.getLbRuleId(), _lbDao);
|
||||
|
||||
|
|
@ -588,67 +617,64 @@ public class AutoScaleManagerImpl<Type> implements AutoScaleService, Manager {
|
|||
|
||||
Long zoneId = _ipAddressDao.findById(loadBalancer.getSourceIpAddressId()).getDataCenterId();
|
||||
|
||||
AutoScaleVmProfileVO profileVO = getEntityInDatabase(ApiConstants.VMPROFILE_ID, cmd.getProfileId(), _autoScaleVmProfileDao);
|
||||
|
||||
List<AutoScaleVmGroupVO> existingVmGroupVO = _autoScaleVmGroupDao.listByAll(loadBalancer.getId(), null);
|
||||
if (existingVmGroupVO.size() > 0) {
|
||||
if(_autoScaleVmGroupDao.isAutoScaleLoadBalancer(loadBalancer.getId())) {
|
||||
throw new InvalidParameterValueException("an AutoScaleVmGroup is already attached to the lb rule, the existing vm group has to be first deleted");
|
||||
}
|
||||
|
||||
List<LoadBalancerVMMapVO> mappedInstances = _lb2VmMapDao.listByLoadBalancerId(loadBalancer.getId(), false);
|
||||
if (mappedInstances.size() > 0) {
|
||||
if (_lb2VmMapDao.isVmAttachedToLoadBalancer(loadBalancer.getId())) {
|
||||
throw new InvalidParameterValueException("there are Vms already bound to the specified LoadBalancing Rule. User bound Vms and AutoScaled Vm Group cannot co-exist on a Load Balancing Rule");
|
||||
}
|
||||
|
||||
List<Counter> counters = new ArrayList<Counter>();
|
||||
List<AutoScalePolicyVO> policies = new ArrayList<AutoScalePolicyVO>();
|
||||
policies.addAll(getAutoScalePolicies("scaleuppolicyid", cmd.getScaleUpPolicyIds(), counters, interval, true));
|
||||
policies.addAll(getAutoScalePolicies("scaledownpolicyid", cmd.getScaleDownPolicyIds(), counters, interval, false));
|
||||
AutoScaleVmGroupVO vmGroupVO = new AutoScaleVmGroupVO(cmd.getLbRuleId(), zoneId, loadBalancer.getDomainId(), loadBalancer.getAccountId(), minMembers, maxMembers,
|
||||
loadBalancer.getDefaultPortStart(), interval, cmd.getProfileId(), AutoScaleVmGroup.State_New);
|
||||
|
||||
ControlledEntity[] sameOwnerEntities = policies.toArray(new ControlledEntity[policies.size() + 2]);
|
||||
sameOwnerEntities[sameOwnerEntities.length - 2] = loadBalancer;
|
||||
sameOwnerEntities[sameOwnerEntities.length - 1] = profileVO;
|
||||
_accountMgr.checkAccess(UserContext.current().getCaller(), null, true, sameOwnerEntities);
|
||||
isAutoScaleVmGroupValid(vmGroupVO, cmd.getScaleUpPolicyIds(), cmd.getScaleDownPolicyIds());
|
||||
|
||||
// validateAutoScaleCounters(loadBalancer.getNetworkId(), counters);
|
||||
|
||||
final Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
|
||||
AutoScaleVmGroupVO vmGroupVO = new AutoScaleVmGroupVO(cmd.getLbRuleId(), zoneId, loadBalancer.getDomainId(), loadBalancer.getAccountId(), minMembers, maxMembers, loadBalancer.getDefaultPortStart(), interval,
|
||||
cmd.getProfileId(), "enabled");
|
||||
vmGroupVO = _autoScaleVmGroupDao.persist(vmGroupVO);
|
||||
|
||||
for (AutoScalePolicyVO autoScalePolicyVO : policies) {
|
||||
_autoScaleVmGroupPolicyMapDao.persist(new AutoScaleVmGroupPolicyMapVO(vmGroupVO.getId(), autoScalePolicyVO.getId()));
|
||||
}
|
||||
txn.commit();
|
||||
return vmGroupVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean configureAutoScaleVmGroup(CreateAutoScaleVmGroupCmd cmd) {
|
||||
return _lbRulesMgr.configureLbAutoScaleVmGroup(cmd.getEntityId(), true);
|
||||
return configureAutoScaleVmGroup(cmd.getEntityId(), true);
|
||||
}
|
||||
|
||||
public boolean isLoadBalancerBasedAutoScaleVmGroup(AutoScaleVmGroup vmGroup) {
|
||||
return vmGroup.getLoadBalancerId() != null;
|
||||
}
|
||||
|
||||
public boolean configureAutoScaleVmGroup(long vmGroupid, boolean vmGroupCreation) {
|
||||
AutoScaleVmGroup vmGroup = _autoScaleVmGroupDao.findById(vmGroupid);
|
||||
|
||||
if(isLoadBalancerBasedAutoScaleVmGroup(vmGroup))
|
||||
return _lbRulesMgr.configureLbAutoScaleVmGroup(vmGroupid, true);
|
||||
|
||||
// This should never happen, because today loadbalancerruleid is manadatory for AutoScaleVmGroup.
|
||||
throw new InvalidParameterValueException("Only LoadBalancer based AutoScale is supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
@DB
|
||||
@ActionEvent(eventType = EventTypes.EVENT_AUTOSCALEVMGROUP_DELETE, eventDescription = "deleting autoscale vm group")
|
||||
public boolean deleteAutoScaleVmGroup(long id) {
|
||||
/* Check if entity is in database */
|
||||
AutoScaleVmGroupVO autoScaleVmGroupVO = getEntityInDatabase("AutoScale Vm Group", id, _autoScaleVmGroupDao);
|
||||
autoScaleVmGroupVO.setRevoke(true);
|
||||
autoScaleVmGroupVO.setState(AutoScaleVmGroup.State_Revoke);
|
||||
_autoScaleVmGroupDao.persist(autoScaleVmGroupVO);
|
||||
boolean success = false;
|
||||
|
||||
// TODO: call configureAutoScaleVmGroup
|
||||
// success = configureAutoScaleVmGroup(id, false);
|
||||
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
boolean success = _autoScaleVmGroupDao.remove(id);
|
||||
if (success)
|
||||
success = _autoScaleVmGroupPolicyMapDao.remove(id);
|
||||
_autoScaleVmGroupDao.remove(id);
|
||||
|
||||
if (success)
|
||||
success = _autoScaleVmGroupPolicyMapDao.removeByGroupId(id);
|
||||
|
||||
if (success)
|
||||
txn.commit();
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
@ -693,29 +719,79 @@ public class AutoScaleManagerImpl<Type> implements AutoScaleService, Manager {
|
|||
return searchWrapper.search();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AutoScaleVmGroup updateAutoScaleVmGroup(UpdateAutoScaleVmGroupCmd cmd) {
|
||||
Long vmGroupId = cmd.getId();
|
||||
Integer minMembers = cmd.getMinMembers();
|
||||
Integer maxMembers = cmd.getMaxMembers();
|
||||
List<Long> scaleUpPolicyIds = cmd.getScaleUpPolicyIds();
|
||||
List<Long> scaleDownPolicyIds = cmd.getScaleDownPolicyIds();
|
||||
|
||||
AutoScaleVmGroupVO vmGroupVO = getEntityInDatabase("Auto Scale Vm Group", vmGroupId, _autoScaleVmGroupDao);
|
||||
private void isAutoScaleVmGroupValid(AutoScaleVmGroupVO vmGroup, List<Long> scaleUpPolicyIds, List<Long> scaleDownPolicyIds) {
|
||||
Integer minMembers = vmGroup.getMinMembers();
|
||||
Integer maxMembers = vmGroup.getMaxMembers();
|
||||
Integer interval = vmGroup.getInterval();
|
||||
List<Counter> counters = new ArrayList<Counter>();
|
||||
List<AutoScalePolicyVO> policies = new ArrayList<AutoScalePolicyVO>();
|
||||
|
||||
if (minMembers < 0) {
|
||||
throw new InvalidParameterValueException(ApiConstants.MIN_MEMBERS + " is an invalid value: " + minMembers);
|
||||
}
|
||||
|
||||
if (maxMembers < 0) {
|
||||
throw new InvalidParameterValueException(ApiConstants.MAX_MEMBERS + " is an invalid value: " + maxMembers);
|
||||
throw new InvalidParameterValueException(ApiConstants.MAX_MEMBERS + " is an invalid value: " + minMembers);
|
||||
}
|
||||
|
||||
if (minMembers > maxMembers) {
|
||||
throw new InvalidParameterValueException(ApiConstants.MIN_MEMBERS + " cannot be greater than " + ApiConstants.MAX_MEMBERS + ", range is invalid: " + minMembers + "-" + maxMembers);
|
||||
}
|
||||
|
||||
if (vmGroupVO.getState() == "enabled") {
|
||||
throw new InvalidParameterValueException("Cannot delete AutoScale Vm Groups when it is in Enabled state.");
|
||||
if (interval < 0) {
|
||||
throw new InvalidParameterValueException("interval is an invalid value: " + interval);
|
||||
}
|
||||
|
||||
if(scaleUpPolicyIds != null) {
|
||||
policies.addAll(getAutoScalePolicies("scaleuppolicyid", scaleUpPolicyIds, counters, interval, true));
|
||||
}
|
||||
|
||||
if(scaleDownPolicyIds != null) {
|
||||
policies.addAll(getAutoScalePolicies("scaledownpolicyid", scaleDownPolicyIds, counters, interval, false));
|
||||
}
|
||||
|
||||
LoadBalancerVO loadBalancer = getEntityInDatabase(ApiConstants.LBID, vmGroup.getLoadBalancerId(), _lbDao);
|
||||
// validateAutoScaleCounters(loadBalancer.getNetworkId(), counters);
|
||||
|
||||
AutoScaleVmProfileVO profileVO = getEntityInDatabase(ApiConstants.VMPROFILE_ID, vmGroup.getProfileId(), _autoScaleVmProfileDao);
|
||||
|
||||
ControlledEntity[] sameOwnerEntities = policies.toArray(new ControlledEntity[policies.size() + 2]);
|
||||
sameOwnerEntities[sameOwnerEntities.length - 2] = loadBalancer;
|
||||
sameOwnerEntities[sameOwnerEntities.length - 1] = profileVO;
|
||||
_accountMgr.checkAccess(UserContext.current().getCaller(), null, true, sameOwnerEntities);
|
||||
|
||||
final Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
vmGroup = _autoScaleVmGroupDao.persist(vmGroup);
|
||||
|
||||
for (AutoScalePolicyVO autoScalePolicyVO : policies) {
|
||||
_autoScaleVmGroupPolicyMapDao.persist(new AutoScaleVmGroupPolicyMapVO(vmGroup.getId(), autoScalePolicyVO.getId()));
|
||||
}
|
||||
txn.commit();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ActionEvent(eventType = EventTypes.EVENT_AUTOSCALEVMGROUP_UPDATE, eventDescription = "updating autoscale vm group")
|
||||
@DB
|
||||
public AutoScaleVmGroup updateAutoScaleVmGroup(UpdateAutoScaleVmGroupCmd cmd) {
|
||||
Long vmGroupId = cmd.getId();
|
||||
Integer minMembers = cmd.getMinMembers();
|
||||
Integer maxMembers = cmd.getMaxMembers();
|
||||
Integer interval = cmd.getInterval();
|
||||
|
||||
List<Long> scaleUpPolicyIds = cmd.getScaleUpPolicyIds();
|
||||
List<Long> scaleDownPolicyIds = cmd.getScaleDownPolicyIds();
|
||||
|
||||
if(minMembers == null && maxMembers == null && interval == null && scaleUpPolicyIds == null && scaleDownPolicyIds == null) {
|
||||
throw new InvalidParameterValueException("Atleast one parameter should be passed for update");
|
||||
}
|
||||
|
||||
AutoScaleVmGroupVO vmGroupVO = getEntityInDatabase("AutoScale Vm Group", vmGroupId, _autoScaleVmGroupDao);
|
||||
AutoScaleVmGroupVO bakUpVmGroupVO = getEntityInDatabase("AutoScale Vm Group", vmGroupId, _autoScaleVmGroupDao);
|
||||
|
||||
if (!vmGroupVO.getState().equals(AutoScaleVmGroup.State_Disabled)) {
|
||||
throw new InvalidParameterValueException("An AutoScale Vm Group can be updated only when it is in disabled state");
|
||||
}
|
||||
|
||||
if (minMembers != null) {
|
||||
|
|
@ -725,53 +801,82 @@ public class AutoScaleManagerImpl<Type> implements AutoScaleService, Manager {
|
|||
if (maxMembers != null) {
|
||||
vmGroupVO.setMaxMembers(maxMembers);
|
||||
}
|
||||
if (scaleDownPolicyIds != null) {
|
||||
// TODO - checkIDs and set
|
||||
|
||||
if (interval != null) {
|
||||
vmGroupVO.setInterval(interval);
|
||||
}
|
||||
|
||||
if (scaleUpPolicyIds != null) {
|
||||
// TODO - checkIDs and set
|
||||
}
|
||||
boolean success = _autoScaleVmGroupPolicyMapDao.removeByGroupId(vmGroupVO.getId());
|
||||
List<AutoScaleVmGroupPolicyMapVO> bakupPolicyIds = _autoScaleVmGroupPolicyMapDao.listByVmGroupId(vmGroupId);
|
||||
|
||||
boolean success = _autoScaleVmGroupDao.update(vmGroupId, vmGroupVO);
|
||||
isAutoScaleVmGroupValid(vmGroupVO, scaleUpPolicyIds, scaleDownPolicyIds);
|
||||
success = configureAutoScaleVmGroup(vmGroupVO.getId(), false);
|
||||
if (!success) {
|
||||
Transaction.currentTxn().start();
|
||||
for (AutoScaleVmGroupPolicyMapVO backUpPolicies : bakupPolicyIds) {
|
||||
_autoScaleVmGroupPolicyMapDao.persist(new AutoScaleVmGroupPolicyMapVO(backUpPolicies.getVmGroupId(), backUpPolicies.getPolicyId()));
|
||||
}
|
||||
_autoScaleVmGroupDao.update(bakUpVmGroupVO.getId(), bakUpVmGroupVO);
|
||||
Transaction.currentTxn().commit();
|
||||
}
|
||||
|
||||
if (success) {
|
||||
s_logger.debug("Updated Auto Scale VmGroup id=" + vmGroupId);
|
||||
s_logger.debug("Updated Auto Scale VmGroup id:" + vmGroupId);
|
||||
return vmGroupVO;
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@DB
|
||||
@ActionEvent(eventType = EventTypes.EVENT_AUTOSCALEVMGROUP_ENABLE, eventDescription = "enabling autoscale vm group")
|
||||
public AutoScaleVmGroup enableAutoScaleVmGroup(Long id) {
|
||||
AutoScaleVmGroupVO vmGroup = getEntityInDatabase("Auto Scale Vm Group", id, _autoScaleVmGroupDao);
|
||||
AutoScaleVmGroupVO vmGroup = getEntityInDatabase("AutoScale Vm Group", id, _autoScaleVmGroupDao);
|
||||
boolean success = false;
|
||||
if (vmGroup.getState() == "enabled") {
|
||||
throw new InvalidParameterValueException("The AutoScale Vm Group is already in Enabled state.");
|
||||
} else {
|
||||
vmGroup.setState("enabled");
|
||||
success = _lbRulesMgr.configureLbAutoScaleVmGroup(id, false);
|
||||
if (!vmGroup.getState().equals(AutoScaleVmGroup.State_Disabled)) {
|
||||
throw new InvalidParameterValueException("Only a AutoScale Vm Group which is in Disabled state can be enabled.");
|
||||
}
|
||||
if (success)
|
||||
|
||||
vmGroup.setState(AutoScaleVmGroup.State_Enabled);
|
||||
vmGroup = _autoScaleVmGroupDao.persist(vmGroup);
|
||||
|
||||
success = _lbRulesMgr.configureLbAutoScaleVmGroup(id, false);
|
||||
|
||||
if (success) {
|
||||
return vmGroup;
|
||||
else
|
||||
}
|
||||
else {
|
||||
vmGroup.setState(AutoScaleVmGroup.State_Disabled);
|
||||
_autoScaleVmGroupDao.persist(vmGroup);
|
||||
s_logger.warn("Failed to enable AutoScale Vm Group id - " + id);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ActionEvent(eventType = EventTypes.EVENT_AUTOSCALEVMGROUP_DISABLE, eventDescription = "disabling autoscale vm group")
|
||||
@DB
|
||||
public AutoScaleVmGroup disableAutoScaleVmGroup(Long id) {
|
||||
AutoScaleVmGroupVO vmGroup = getEntityInDatabase("Auto Scale Vm Group", id, _autoScaleVmGroupDao);
|
||||
AutoScaleVmGroupVO vmGroup = getEntityInDatabase("AutoScale Vm Group", id, _autoScaleVmGroupDao);
|
||||
boolean success = false;
|
||||
if (vmGroup.getState() == "disabled") {
|
||||
throw new InvalidParameterValueException("The AutoScale Vm Group is already in Disabled state.");
|
||||
} else {
|
||||
vmGroup.setState("disabled");
|
||||
success = _lbRulesMgr.configureLbAutoScaleVmGroup(id, false);
|
||||
if (!vmGroup.getState().equals(AutoScaleVmGroup.State_Enabled)) {
|
||||
throw new InvalidParameterValueException("Only a AutoScale Vm Group which is in Disabled state can be disabled.");
|
||||
}
|
||||
if (success)
|
||||
|
||||
vmGroup.setState(AutoScaleVmGroup.State_Disabled);
|
||||
vmGroup = _autoScaleVmGroupDao.persist(vmGroup);
|
||||
|
||||
success = _lbRulesMgr.configureLbAutoScaleVmGroup(id, false);
|
||||
|
||||
if (success) {
|
||||
return vmGroup;
|
||||
else
|
||||
}
|
||||
else {
|
||||
vmGroup.setState(AutoScaleVmGroup.State_Enabled);
|
||||
_autoScaleVmGroupDao.persist(vmGroup);
|
||||
s_logger.warn("Failed to disable AutoScale Vm Group id - " + id);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.network.as;
|
||||
|
||||
|
|
@ -34,9 +34,6 @@ public class AutoScalePolicyConditionMapVO {
|
|||
@Column(name="condition_id")
|
||||
private long conditionId;
|
||||
|
||||
@Column(name="revoke")
|
||||
private boolean revoke = false;
|
||||
|
||||
public AutoScalePolicyConditionMapVO() { }
|
||||
|
||||
public AutoScalePolicyConditionMapVO(long policyId, long conditionId) {
|
||||
|
|
@ -44,11 +41,6 @@ public class AutoScalePolicyConditionMapVO {
|
|||
this.conditionId = conditionId;
|
||||
}
|
||||
|
||||
public AutoScalePolicyConditionMapVO(long policyId, long conditionId, boolean revoke) {
|
||||
this(policyId, conditionId);
|
||||
this.revoke = revoke;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
|
@ -60,12 +52,4 @@ public class AutoScalePolicyConditionMapVO {
|
|||
public long getConditionId() {
|
||||
return conditionId;
|
||||
}
|
||||
|
||||
public boolean isRevoke() {
|
||||
return revoke;
|
||||
}
|
||||
|
||||
public void setRevoke(boolean revoke) {
|
||||
this.revoke = revoke;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.network.as;
|
||||
|
||||
|
|
@ -33,9 +33,6 @@ public class AutoScaleVmGroupPolicyMapVO {
|
|||
@Column(name="policy_id")
|
||||
private long policyId;
|
||||
|
||||
@Column(name="revoke")
|
||||
private boolean revoke = false;
|
||||
|
||||
public AutoScaleVmGroupPolicyMapVO() { }
|
||||
|
||||
public AutoScaleVmGroupPolicyMapVO(long vmGroupId, long policyId) {
|
||||
|
|
@ -45,7 +42,6 @@ public class AutoScaleVmGroupPolicyMapVO {
|
|||
|
||||
public AutoScaleVmGroupPolicyMapVO(long vmgroupId, long policyId, boolean revoke) {
|
||||
this(vmgroupId, policyId);
|
||||
this.revoke = revoke;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
|
|
@ -59,12 +55,4 @@ public class AutoScaleVmGroupPolicyMapVO {
|
|||
public long getPolicyId() {
|
||||
return policyId;
|
||||
}
|
||||
|
||||
public boolean isRevoke() {
|
||||
return revoke;
|
||||
}
|
||||
|
||||
public void setRevoke(boolean revoke) {
|
||||
this.revoke = revoke;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class AutoScaleVmGroupVO implements AutoScaleVmGroup {
|
|||
private long accountId;
|
||||
|
||||
@Column(name = "load_balancer_id")
|
||||
private long loadBalancerId;
|
||||
private Long loadBalancerId;
|
||||
|
||||
@Column(name = "min_members", updatable = true)
|
||||
private int minMembers;
|
||||
|
|
@ -73,9 +73,6 @@ public class AutoScaleVmGroupVO implements AutoScaleVmGroup {
|
|||
@Column(name = GenericDao.CREATED_COLUMN)
|
||||
protected Date created;
|
||||
|
||||
@Column(name = "revoke")
|
||||
private boolean revoke = false;
|
||||
|
||||
@Column(name = "state")
|
||||
private String state;
|
||||
|
||||
|
|
@ -122,7 +119,7 @@ public class AutoScaleVmGroupVO implements AutoScaleVmGroup {
|
|||
}
|
||||
|
||||
@Override
|
||||
public long getLoadBalancerId() {
|
||||
public Long getLoadBalancerId() {
|
||||
return loadBalancerId;
|
||||
}
|
||||
|
||||
|
|
@ -159,15 +156,6 @@ public class AutoScaleVmGroupVO implements AutoScaleVmGroup {
|
|||
return created;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRevoke() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setRevoke(boolean revoke) {
|
||||
this.revoke = revoke;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getState() {
|
||||
return state;
|
||||
|
|
@ -184,4 +172,9 @@ public class AutoScaleVmGroupVO implements AutoScaleVmGroup {
|
|||
public void setMaxMembers(int maxMembers) {
|
||||
this.maxMembers = maxMembers;
|
||||
}
|
||||
|
||||
public void setInterval(Integer interval) {
|
||||
this.interval = interval;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.network.dao;
|
||||
|
||||
|
|
@ -24,5 +24,5 @@ public interface LoadBalancerVMMapDao extends GenericDao<LoadBalancerVMMapVO, Lo
|
|||
List<LoadBalancerVMMapVO> listByLoadBalancerId(long loadBalancerId);
|
||||
List<LoadBalancerVMMapVO> listByLoadBalancerId(long loadBalancerId, boolean revoke);
|
||||
LoadBalancerVMMapVO findByLoadBalancerIdAndVmId(long loadBalancerId, long instanceId);
|
||||
|
||||
boolean isVmAttachedToLoadBalancer(long loadBalancerId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.network.dao;
|
||||
|
||||
|
|
@ -17,8 +17,11 @@ import java.util.List;
|
|||
import javax.ejb.Local;
|
||||
|
||||
import com.cloud.network.LoadBalancerVMMapVO;
|
||||
import com.cloud.network.as.AutoScaleVmGroupVO;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.GenericSearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.db.SearchCriteria.Func;
|
||||
|
||||
@Local(value={LoadBalancerVMMapDao.class})
|
||||
public class LoadBalancerVMMapDaoImpl extends GenericDaoBase<LoadBalancerVMMapVO, Long> implements LoadBalancerVMMapDao {
|
||||
|
|
@ -67,7 +70,7 @@ public class LoadBalancerVMMapDaoImpl extends GenericDaoBase<LoadBalancerVMMapVO
|
|||
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public LoadBalancerVMMapVO findByLoadBalancerIdAndVmId(long loadBalancerId, long instanceId) {
|
||||
SearchCriteria<LoadBalancerVMMapVO> sc = createSearchCriteria();
|
||||
|
|
@ -76,5 +79,16 @@ public class LoadBalancerVMMapDaoImpl extends GenericDaoBase<LoadBalancerVMMapVO
|
|||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isVmAttachedToLoadBalancer(long loadBalancerId) {
|
||||
GenericSearchBuilder<LoadBalancerVMMapVO, Long> CountByAccount = createSearchBuilder(Long.class);
|
||||
CountByAccount.select(null, Func.COUNT, null);
|
||||
CountByAccount.and("loadBalancerId", CountByAccount.entity().getLoadBalancerId(), SearchCriteria.Op.EQ);
|
||||
|
||||
SearchCriteria<Long> sc = CountByAccount.create();
|
||||
sc.setParameters("loadBalancerId", loadBalancerId);
|
||||
return customSearch(sc, null).get(0) > 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2412,7 +2412,6 @@ CREATE TABLE `cloud`.`autoscale_vmgroups` (
|
|||
`interval` int unsigned NOT NULL,
|
||||
`profile_id` bigint unsigned NOT NULL,
|
||||
`state` varchar(255) NOT NULL COMMENT 'enabled or disabled, a vmgroup is disabled to stop autoscaling activity',
|
||||
`revoke` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT '1 is when a condition needs to be disassociated with a policy',
|
||||
`created` datetime NOT NULL COMMENT 'date created',
|
||||
`removed` datetime COMMENT 'date removed if not null',
|
||||
PRIMARY KEY (`id`),
|
||||
|
|
@ -2428,7 +2427,6 @@ CREATE TABLE `cloud`.`autoscale_policy_condition_map` (
|
|||
`id` bigint unsigned NOT NULL auto_increment,
|
||||
`policy_id` bigint unsigned NOT NULL,
|
||||
`condition_id` bigint unsigned NOT NULL,
|
||||
`revoke` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT '1 is when a condition needs to be disassociated with a policy',
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `fk_autoscale_policy_condition_map__policy_id` FOREIGN KEY `fk_autoscale_policy_condition_map__policy_id` (`policy_id`) REFERENCES `autoscale_policies` (`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_autoscale_policy_condition_map__condition_id` FOREIGN KEY `fk_autoscale_policy_condition_map__condition_id` (`condition_id`) REFERENCES `conditions` (`id`)
|
||||
|
|
@ -2438,7 +2436,6 @@ CREATE TABLE `cloud`.`autoscale_vmgroup_policy_map` (
|
|||
`id` bigint unsigned NOT NULL auto_increment,
|
||||
`vmgroup_id` bigint unsigned NOT NULL,
|
||||
`policy_id` bigint unsigned NOT NULL,
|
||||
`revoke` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT '1 is when a policy needs to be disassociated with a vmgroup',
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `fk_autoscale_vmgroup_policy_map__vmgroup_id` FOREIGN KEY `fk_autoscale_vmgroup_policy_map__vmgroup_id` (`vmgroup_id`) REFERENCES `autoscale_vmgroups` (`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_autoscale_vmgroup_policy_map__policy_id` FOREIGN KEY `fk_autoscale_vmgroup_policy_map__policy_id` (`policy_id`) REFERENCES `autoscale_policies` (`id`)
|
||||
|
|
|
|||
Loading…
Reference in New Issue