diff --git a/api/src/main/java/com/cloud/agent/api/to/LoadBalancerTO.java b/api/src/main/java/com/cloud/agent/api/to/LoadBalancerTO.java index 1c896d2cfc85..966d24886fef 100644 --- a/api/src/main/java/com/cloud/agent/api/to/LoadBalancerTO.java +++ b/api/src/main/java/com/cloud/agent/api/to/LoadBalancerTO.java @@ -18,17 +18,13 @@ import java.io.Serializable; import java.util.ArrayList; +import java.util.Date; import java.util.List; import com.cloud.network.as.AutoScalePolicy; import com.cloud.network.as.AutoScaleVmGroup; -import com.cloud.network.as.AutoScaleVmProfile; import com.cloud.network.as.Condition; import com.cloud.network.as.Counter; -import com.cloud.network.lb.LoadBalancingRule.LbAutoScalePolicy; -import com.cloud.network.lb.LoadBalancingRule.LbAutoScaleVmGroup; -import com.cloud.network.lb.LoadBalancingRule.LbAutoScaleVmProfile; -import com.cloud.network.lb.LoadBalancingRule.LbCondition; import com.cloud.network.lb.LoadBalancingRule.LbDestination; import com.cloud.network.lb.LoadBalancingRule.LbHealthCheckPolicy; import com.cloud.network.lb.LoadBalancingRule.LbSslCert; @@ -377,46 +373,64 @@ public String getMonitorState() { public static class CounterTO implements Serializable { private static final long serialVersionUID = 2L; + private final Long id; private final String name; - private final String source; + private final Counter.Source source; private final String value; + private final String provider; - public CounterTO(String name, String source, String value) { + public CounterTO(Long id, String name, Counter.Source source, String value, String provider) { + this.id = id; this.name = name; this.source = source; this.value = value; + this.provider = provider; + } + + public Long getId() { + return id; } public String getName() { return name; } - public String getSource() { + public Counter.Source getSource() { return source; } public String getValue() { return value; } + + public String getProvider() { + return provider; + } } public static class ConditionTO implements Serializable { private static final long serialVersionUID = 2L; + private final Long id; private final long threshold; - private final String relationalOperator; + private final Condition.Operator relationalOperator; private final CounterTO counter; - public ConditionTO(long threshold, String relationalOperator, CounterTO counter) { + public ConditionTO(Long id, long threshold, Condition.Operator relationalOperator, CounterTO counter) { + this.id = id; this.threshold = threshold; this.relationalOperator = relationalOperator; this.counter = counter; } + public Long getId() { + return id; + } + public long getThreshold() { return threshold; } - public String getRelationalOperator() { + public Condition.Operator getRelationalOperator() { return relationalOperator; } @@ -430,14 +444,16 @@ public static class AutoScalePolicyTO implements Serializable { private final long id; private final int duration; private final int quietTime; - private String action; + private final Date lastQuietTime; + private AutoScalePolicy.Action action; boolean revoked; private final List conditions; - public AutoScalePolicyTO(long id, int duration, int quietTime, String action, List conditions, boolean revoked) { + public AutoScalePolicyTO(long id, int duration, int quietTime, Date lastQuietTime, AutoScalePolicy.Action action, List conditions, boolean revoked) { this.id = id; this.duration = duration; this.quietTime = quietTime; + this.lastQuietTime = lastQuietTime; this.conditions = conditions; this.action = action; this.revoked = revoked; @@ -455,7 +471,11 @@ public int getQuietTime() { return quietTime; } - public String getAction() { + public Date getLastQuietTime() { + return lastQuietTime; + } + + public AutoScalePolicy.Action getAction() { return action; } @@ -476,7 +496,7 @@ public static class AutoScaleVmProfileTO implements Serializable { private final String templateId; private final String otherDeployParams; private final List> counterParamList; - private final Integer destroyVmGraceperiod; + private final Integer expungeVmGracePeriod; private final String cloudStackApiUrl; private final String autoScaleUserApiKey; private final String autoScaleUserSecretKey; @@ -485,14 +505,14 @@ public static class AutoScaleVmProfileTO implements Serializable { public AutoScaleVmProfileTO(String zoneId, String domainId, String cloudStackApiUrl, String autoScaleUserApiKey, String autoScaleUserSecretKey, String serviceOfferingId, String templateId, String vmName, String networkId, String otherDeployParams, List> counterParamList, - Integer destroyVmGraceperiod) { + Integer expungeVmGracePeriod) { this.zoneId = zoneId; this.domainId = domainId; this.serviceOfferingId = serviceOfferingId; this.templateId = templateId; this.otherDeployParams = otherDeployParams; this.counterParamList = counterParamList; - this.destroyVmGraceperiod = destroyVmGraceperiod; + this.expungeVmGracePeriod = expungeVmGracePeriod; this.cloudStackApiUrl = cloudStackApiUrl; this.autoScaleUserApiKey = autoScaleUserApiKey; this.autoScaleUserSecretKey = autoScaleUserSecretKey; @@ -524,8 +544,8 @@ public List> getCounterParamList() { return counterParamList; } - public Integer getDestroyVmGraceperiod() { - return destroyVmGraceperiod; + public Integer getExpungeVmGracePeriod() { + return expungeVmGracePeriod; } public String getCloudStackApiUrl() { @@ -551,6 +571,8 @@ public String getNetworkId() { public static class AutoScaleVmGroupTO implements Serializable { private static final long serialVersionUID = 2L; + + private final Long id; private final String uuid; private final int minMembers; private final int maxMembers; @@ -558,11 +580,13 @@ public static class AutoScaleVmGroupTO implements Serializable { private final int interval; private final List policies; private final AutoScaleVmProfileTO profile; - private final String state; - private final String currentState; + private final AutoScaleVmGroup.State state; + private final AutoScaleVmGroup.State currentState; + private final Long loadBalancerId; - AutoScaleVmGroupTO(String uuid, int minMembers, int maxMembers, int memberPort, int interval, List policies, AutoScaleVmProfileTO profile, - String state, String currentState) { + public AutoScaleVmGroupTO(Long id, String uuid, int minMembers, int maxMembers, int memberPort, int interval, List policies, AutoScaleVmProfileTO profile, + AutoScaleVmGroup.State state, AutoScaleVmGroup.State currentState, Long loadBalancerId) { + this.id = id; this.uuid = uuid; this.minMembers = minMembers; this.maxMembers = maxMembers; @@ -572,6 +596,11 @@ public static class AutoScaleVmGroupTO implements Serializable { this.profile = profile; this.state = state; this.currentState = currentState; + this.loadBalancerId = loadBalancerId; + } + + public Long getId() { + return id; } public String getUuid() { @@ -602,44 +631,16 @@ public AutoScaleVmProfileTO getProfile() { return profile; } - public String getState() { + public AutoScaleVmGroup.State getState() { return state; } - public String getCurrentState() { + public AutoScaleVmGroup.State getCurrentState() { return currentState; } - } - public void setAutoScaleVmGroup(LbAutoScaleVmGroup lbAutoScaleVmGroup) { - List lbAutoScalePolicies = lbAutoScaleVmGroup.getPolicies(); - List autoScalePolicyTOs = new ArrayList(lbAutoScalePolicies.size()); - for (LbAutoScalePolicy lbAutoScalePolicy : lbAutoScalePolicies) { - List lbConditions = lbAutoScalePolicy.getConditions(); - List conditionTOs = new ArrayList(lbConditions.size()); - for (LbCondition lbCondition : lbConditions) { - Counter counter = lbCondition.getCounter(); - CounterTO counterTO = new CounterTO(counter.getName(), counter.getSource().toString(), "" + counter.getValue()); - Condition condition = lbCondition.getCondition(); - ConditionTO conditionTO = new ConditionTO(condition.getThreshold(), condition.getRelationalOperator().toString(), counterTO); - conditionTOs.add(conditionTO); - } - AutoScalePolicy autoScalePolicy = lbAutoScalePolicy.getPolicy(); - autoScalePolicyTOs.add(new AutoScalePolicyTO(autoScalePolicy.getId(), autoScalePolicy.getDuration(), autoScalePolicy.getQuietTime(), - autoScalePolicy.getAction(), conditionTOs, lbAutoScalePolicy.isRevoked())); - } - LbAutoScaleVmProfile lbAutoScaleVmProfile = lbAutoScaleVmGroup.getProfile(); - AutoScaleVmProfile autoScaleVmProfile = lbAutoScaleVmProfile.getProfile(); - - AutoScaleVmProfileTO autoScaleVmProfileTO = - new AutoScaleVmProfileTO(lbAutoScaleVmProfile.getZoneId(), lbAutoScaleVmProfile.getDomainId(), lbAutoScaleVmProfile.getCsUrl(), - lbAutoScaleVmProfile.getAutoScaleUserApiKey(), lbAutoScaleVmProfile.getAutoScaleUserSecretKey(), lbAutoScaleVmProfile.getServiceOfferingId(), - lbAutoScaleVmProfile.getTemplateId(), lbAutoScaleVmProfile.getVmName(), lbAutoScaleVmProfile.getNetworkId(), autoScaleVmProfile.getOtherDeployParams(), - autoScaleVmProfile.getCounterParams(), autoScaleVmProfile.getDestroyVmGraceperiod()); - - AutoScaleVmGroup autoScaleVmGroup = lbAutoScaleVmGroup.getVmGroup(); - autoScaleVmGroupTO = - new AutoScaleVmGroupTO(autoScaleVmGroup.getUuid(), autoScaleVmGroup.getMinMembers(), autoScaleVmGroup.getMaxMembers(), autoScaleVmGroup.getMemberPort(), - autoScaleVmGroup.getInterval(), autoScalePolicyTOs, autoScaleVmProfileTO, autoScaleVmGroup.getState(), lbAutoScaleVmGroup.getCurrentState()); + public Long getLoadBalancerId() { + return loadBalancerId; + } } } diff --git a/api/src/main/java/com/cloud/event/EventTypes.java b/api/src/main/java/com/cloud/event/EventTypes.java index ac7a612a2029..93dee22e4df7 100644 --- a/api/src/main/java/com/cloud/event/EventTypes.java +++ b/api/src/main/java/com/cloud/event/EventTypes.java @@ -559,6 +559,7 @@ public class EventTypes { public static final String EVENT_COUNTER_DELETE = "COUNTER.DELETE"; public static final String EVENT_CONDITION_CREATE = "CONDITION.CREATE"; public static final String EVENT_CONDITION_DELETE = "CONDITION.DELETE"; + public static final String EVENT_CONDITION_UPDATE = "CONDITION.UPDATE"; public static final String EVENT_AUTOSCALEPOLICY_CREATE = "AUTOSCALEPOLICY.CREATE"; public static final String EVENT_AUTOSCALEPOLICY_UPDATE = "AUTOSCALEPOLICY.UPDATE"; public static final String EVENT_AUTOSCALEPOLICY_DELETE = "AUTOSCALEPOLICY.DELETE"; @@ -570,6 +571,8 @@ public class EventTypes { 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.DISABLE"; + public static final String EVENT_AUTOSCALEVMGROUP_SCALEDOWN = "AUTOSCALEVMGROUP.SCALEDOWN"; + public static final String EVENT_AUTOSCALEVMGROUP_SCALEUP = "AUTOSCALEVMGROUP.SCALEUP"; public static final String EVENT_BAREMETAL_DHCP_SERVER_ADD = "PHYSICAL.DHCP.ADD"; public static final String EVENT_BAREMETAL_DHCP_SERVER_DELETE = "PHYSICAL.DHCP.DELETE"; @@ -1038,6 +1041,8 @@ public class EventTypes { entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_UPDATE, AutoScaleVmGroup.class); entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_ENABLE, AutoScaleVmGroup.class); entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_DISABLE, AutoScaleVmGroup.class); + entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_SCALEDOWN, AutoScaleVmGroup.class); + entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_SCALEUP, AutoScaleVmGroup.class); entityEventDetails.put(EVENT_GUEST_VLAN_RANGE_DEDICATE, GuestVlan.class); entityEventDetails.put(EVENT_DEDICATED_GUEST_VLAN_RANGE_RELEASE, GuestVlan.class); diff --git a/api/src/main/java/com/cloud/network/Network.java b/api/src/main/java/com/cloud/network/Network.java index 0fee5c04d25c..8fce2502a606 100644 --- a/api/src/main/java/com/cloud/network/Network.java +++ b/api/src/main/java/com/cloud/network/Network.java @@ -285,6 +285,7 @@ public static class Capability { public static final Capability NoVlan = new Capability("NoVlan"); public static final Capability PublicAccess = new Capability("PublicAccess"); public static final Capability ExtraDhcpOptions = new Capability("ExtraDhcpOptions"); + public static final Capability VmAutoScaling = new Capability("VmAutoScaling"); private final String name; diff --git a/api/src/main/java/com/cloud/network/as/AutoScaleCounter.java b/api/src/main/java/com/cloud/network/as/AutoScaleCounter.java index f25d6699a006..7f83bf05a66a 100644 --- a/api/src/main/java/com/cloud/network/as/AutoScaleCounter.java +++ b/api/src/main/java/com/cloud/network/as/AutoScaleCounter.java @@ -25,10 +25,11 @@ public class AutoScaleCounter { public static class AutoScaleCounterType { private String _name; - public static final AutoScaleCounterType Snmp = new AutoScaleCounterType("snmp"); - public static final AutoScaleCounterType Netscaler = new AutoScaleCounterType("netscaler"); - public static final AutoScaleCounterType Cpu = new AutoScaleCounterType("cpu"); - public static final AutoScaleCounterType Memory = new AutoScaleCounterType("memory"); + public static final AutoScaleCounterType Snmp = new AutoScaleCounterType(Counter.Source.SNMP.name()); + public static final AutoScaleCounterType Cpu = new AutoScaleCounterType(Counter.Source.CPU.name()); + public static final AutoScaleCounterType Memory = new AutoScaleCounterType(Counter.Source.MEMORY.name()); + public static final AutoScaleCounterType Netscaler = new AutoScaleCounterType(Counter.Source.NETSCALER.name()); + public static final AutoScaleCounterType VirtualRouter = new AutoScaleCounterType(Counter.Source.VIRTUALROUTER.name()); public AutoScaleCounterType(String name) { _name = name; diff --git a/api/src/main/java/com/cloud/network/as/AutoScalePolicy.java b/api/src/main/java/com/cloud/network/as/AutoScalePolicy.java index 56ea3f5f7f72..77c55c8ba47e 100644 --- a/api/src/main/java/com/cloud/network/as/AutoScalePolicy.java +++ b/api/src/main/java/com/cloud/network/as/AutoScalePolicy.java @@ -21,9 +21,26 @@ import org.apache.cloudstack.acl.ControlledEntity; import org.apache.cloudstack.api.InternalIdentity; +import org.apache.commons.lang3.StringUtils; public interface AutoScalePolicy extends ControlledEntity, InternalIdentity { + enum Action { + SCALEUP, SCALEDOWN; + + public static Action fromValue(String action) { + if (StringUtils.isBlank(action)) { + return null; + } else if (action.equalsIgnoreCase("ScaleUp")) { + return SCALEUP; + } else if (action.equalsIgnoreCase("ScaleDown")) { + return SCALEDOWN; + } else { + throw new IllegalArgumentException("Unexpected AutoScale action : " + action); + } + } + } + @Override long getId(); @@ -33,8 +50,8 @@ public interface AutoScalePolicy extends ControlledEntity, InternalIdentity { public int getQuietTime(); - public Date getLastQuiteTime(); + public Date getLastQuietTime(); - public String getAction(); + public Action getAction(); } diff --git a/api/src/main/java/com/cloud/network/as/AutoScaleService.java b/api/src/main/java/com/cloud/network/as/AutoScaleService.java index 32d693d7b8a4..ceca4de68428 100644 --- a/api/src/main/java/com/cloud/network/as/AutoScaleService.java +++ b/api/src/main/java/com/cloud/network/as/AutoScaleService.java @@ -31,6 +31,7 @@ import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScalePolicyCmd; import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScaleVmGroupCmd; import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScaleVmProfileCmd; +import org.apache.cloudstack.api.command.user.autoscale.UpdateConditionCmd; import com.cloud.exception.ResourceInUseException; import com.cloud.exception.ResourceUnavailableException; @@ -57,7 +58,7 @@ public interface AutoScaleService { boolean configureAutoScaleVmGroup(CreateAutoScaleVmGroupCmd cmd) throws ResourceUnavailableException; - boolean deleteAutoScaleVmGroup(long vmGroupId); + boolean deleteAutoScaleVmGroup(long vmGroupId, Boolean cleanup); AutoScaleVmGroup updateAutoScaleVmGroup(UpdateAutoScaleVmGroupCmd cmd); @@ -78,4 +79,6 @@ public interface AutoScaleService { List listConditions(ListConditionsCmd cmd); boolean deleteCondition(long conditionId) throws ResourceInUseException; + + Condition updateCondition(UpdateConditionCmd cmd) throws ResourceInUseException; } diff --git a/api/src/main/java/com/cloud/network/as/AutoScaleVmGroup.java b/api/src/main/java/com/cloud/network/as/AutoScaleVmGroup.java index cf2c15c42166..c265c1f36a0a 100644 --- a/api/src/main/java/com/cloud/network/as/AutoScaleVmGroup.java +++ b/api/src/main/java/com/cloud/network/as/AutoScaleVmGroup.java @@ -22,13 +22,31 @@ import org.apache.cloudstack.acl.ControlledEntity; import org.apache.cloudstack.api.Displayable; import org.apache.cloudstack.api.InternalIdentity; +import org.apache.commons.lang3.StringUtils; public interface AutoScaleVmGroup extends ControlledEntity, InternalIdentity, Displayable { - String State_New = "new"; - String State_Revoke = "revoke"; - String State_Enabled = "enabled"; - String State_Disabled = "disabled"; + enum State { + NEW, REVOKE, ENABLED, DISABLED, SCALING; + + public static State fromValue(String state) { + if (StringUtils.isBlank(state)) { + return null; + } else if (state.equalsIgnoreCase("new")) { + return NEW; + } else if (state.equalsIgnoreCase("revoke")) { + return REVOKE; + } else if (state.equalsIgnoreCase("enabled")) { + return ENABLED; + } else if (state.equalsIgnoreCase("disabled")) { + return DISABLED; + } else if (state.equalsIgnoreCase("scaling")) { + return SCALING; + } else { + throw new IllegalArgumentException("Unexpected AutoScale VM group state : " + state); + } + } + } @Override long getId(); @@ -40,6 +58,8 @@ public interface AutoScaleVmGroup extends ControlledEntity, InternalIdentity, Di long getProfileId(); + String getName(); + int getMinMembers(); int getMaxMembers(); @@ -50,11 +70,12 @@ public interface AutoScaleVmGroup extends ControlledEntity, InternalIdentity, Di Date getLastInterval(); - String getState(); + State getState(); String getUuid(); @Override boolean isDisplay(); + Date getCreated(); } diff --git a/api/src/main/java/com/cloud/network/as/AutoScaleVmProfile.java b/api/src/main/java/com/cloud/network/as/AutoScaleVmProfile.java index 495446a6e837..afeba0bd7498 100644 --- a/api/src/main/java/com/cloud/network/as/AutoScaleVmProfile.java +++ b/api/src/main/java/com/cloud/network/as/AutoScaleVmProfile.java @@ -33,6 +33,8 @@ public interface AutoScaleVmProfile extends ControlledEntity, InternalIdentity, @Override public long getId(); + String getUserData(); + public String getUuid(); public Long getZoneId(); @@ -43,11 +45,13 @@ public interface AutoScaleVmProfile extends ControlledEntity, InternalIdentity, public String getOtherDeployParams(); + public List> getOtherDeployParamsList(); + List> getCounterParams(); - public Integer getDestroyVmGraceperiod(); + public Integer getExpungeVmGracePeriod(); - public long getAutoScaleUserId(); + public Long getAutoScaleUserId(); @Override boolean isDisplay(); diff --git a/api/src/main/java/com/cloud/network/as/Condition.java b/api/src/main/java/com/cloud/network/as/Condition.java index b09dc2e91a89..fa49c466110e 100644 --- a/api/src/main/java/com/cloud/network/as/Condition.java +++ b/api/src/main/java/com/cloud/network/as/Condition.java @@ -27,7 +27,7 @@ static enum Operator { EQ, GT, LT, GE, LE }; - long getCounterid(); + long getCounterId(); long getThreshold(); diff --git a/api/src/main/java/com/cloud/network/as/Counter.java b/api/src/main/java/com/cloud/network/as/Counter.java index 286bf517c79d..fd958fe8f69e 100644 --- a/api/src/main/java/com/cloud/network/as/Counter.java +++ b/api/src/main/java/com/cloud/network/as/Counter.java @@ -20,19 +20,27 @@ import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; +import java.util.Arrays; +import java.util.List; + public interface Counter extends InternalIdentity, Identity { - public static enum Source { - netscaler, - snmp, - cpu, - memory + enum Source { + NETSCALER, + SNMP, + CPU, + MEMORY, + VIRTUALROUTER } + final List NativeSources = Arrays.asList(Source.CPU, Source.MEMORY); + String getName(); String getValue(); Source getSource(); + String getProvider(); + } diff --git a/api/src/main/java/com/cloud/network/lb/LoadBalancingRule.java b/api/src/main/java/com/cloud/network/lb/LoadBalancingRule.java index bba008fd70ff..64b2aeedf128 100644 --- a/api/src/main/java/com/cloud/network/lb/LoadBalancingRule.java +++ b/api/src/main/java/com/cloud/network/lb/LoadBalancingRule.java @@ -406,9 +406,9 @@ public static class LbAutoScaleVmGroup { AutoScaleVmGroup vmGroup; private final List policies; private final LbAutoScaleVmProfile profile; - private final String currentState; + private final AutoScaleVmGroup.State currentState; - public LbAutoScaleVmGroup(AutoScaleVmGroup vmGroup, List policies, LbAutoScaleVmProfile profile, String currentState) { + public LbAutoScaleVmGroup(AutoScaleVmGroup vmGroup, List policies, LbAutoScaleVmProfile profile, AutoScaleVmGroup.State currentState) { this.vmGroup = vmGroup; this.policies = policies; this.profile = profile; @@ -427,7 +427,7 @@ public LbAutoScaleVmProfile getProfile() { return profile; } - public String getCurrentState() { + public AutoScaleVmGroup.State getCurrentState() { return currentState; } } diff --git a/api/src/main/java/com/cloud/network/lb/LoadBalancingRulesService.java b/api/src/main/java/com/cloud/network/lb/LoadBalancingRulesService.java index 5a2f3d21916f..46f17237e029 100644 --- a/api/src/main/java/com/cloud/network/lb/LoadBalancingRulesService.java +++ b/api/src/main/java/com/cloud/network/lb/LoadBalancingRulesService.java @@ -98,11 +98,11 @@ LoadBalancer createPublicLoadBalancerRule(String xId, String name, String descri /** * Assign a virtual machine or list of virtual machines, or Map of to a load balancer. */ - boolean assignToLoadBalancer(long lbRuleId, List vmIds, Map> vmIdIpMap); + boolean assignToLoadBalancer(long lbRuleId, List vmIds, Map> vmIdIpMap, boolean isAutoScaleVM); boolean assignSSLCertToLoadBalancerRule(Long lbRuleId, String certName, String publicCert, String privateKey); - boolean removeFromLoadBalancer(long lbRuleId, List vmIds, Map> vmIdIpMap); + boolean removeFromLoadBalancer(long lbRuleId, List vmIds, Map> vmIdIpMap, boolean isAutoScaleVM); boolean applyLoadBalancerConfig(long lbRuleId) throws ResourceUnavailableException; diff --git a/api/src/main/java/com/cloud/network/router/VirtualRouterAutoScale.java b/api/src/main/java/com/cloud/network/router/VirtualRouterAutoScale.java new file mode 100644 index 000000000000..ecd7e4affbd9 --- /dev/null +++ b/api/src/main/java/com/cloud/network/router/VirtualRouterAutoScale.java @@ -0,0 +1,132 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.network.router; + +/** + * bridge internal and external traffic. + */ +public interface VirtualRouterAutoScale { + + int MBITS_TO_BYTES = 1024 * 1024 / 8; + + enum VirtualRouterAutoScaleCounter { + NETWORK_RECEIVED_AVERAGE_MBPS("public.network.received.average.mbps"), + NETWORK_TRANSMIT_AVERAGE_MBPS("public.network.transmit.average.mbps"), + LB_AVERAGE_CONNECTIONS("virtual.network.lb.average.connections"); + + String value; + VirtualRouterAutoScaleCounter(String value) { + this.value = value; + } + + String getValue() { + return value; + } + public static VirtualRouterAutoScaleCounter fromValue(String value) { + VirtualRouterAutoScaleCounter[] values = VirtualRouterAutoScaleCounter.values(); + for(VirtualRouterAutoScaleCounter v : values) { + if(v.getValue().equals(value)) { + return v; + } + } + return null; + } + + @Override + public String toString() { + return getValue(); + } + } + + enum AutoScaleValueType { + INSTANT_VM ("Instant data for a VM"), + INSTANT_VM_GROUP ("Instant data for AutoScale VM group"), + AGGREGATED_VM ("Aggregated data for a VM"), + AGGREGATED_VM_GROUP ("Aggregated data for AutoScale VM group"); + + String description; + + private AutoScaleValueType(String description) { + this.description = description; + } + + public String getDescription() { + return description; + } + } + + public class AutoScaleMetrics { + VirtualRouterAutoScaleCounter counter; + Long policyId; + Long conditionId; + Long counterId; + Integer duration; + + public AutoScaleMetrics(VirtualRouterAutoScaleCounter counter, Long policyId, Long conditionId, Long counterId, Integer duration) { + this.counter = counter; + this.policyId = policyId; + this.conditionId = conditionId; + this.counterId = counterId; + this.duration = duration; + } + + public VirtualRouterAutoScaleCounter getCounter() { + return counter; + } + + public Long getPolicyId() { + return policyId; + } + + public Long getConditionId() { + return conditionId; + } + + public Long getCounterId() { + return counterId; + } + + public Integer getDuration() { + return duration; + } + } + + public class AutoScaleMetricsValue { + AutoScaleMetrics metrics; + AutoScaleValueType type; + Double value; + + public AutoScaleMetricsValue(AutoScaleMetrics metrics, AutoScaleValueType type, Double value) { + this.metrics = metrics; + this.type = type; + this.value = value; + } + + public AutoScaleMetrics getMetrics() { + return metrics; + } + + public AutoScaleValueType getType() { + return type; + } + + public Double getValue() { + return value; + } + } + +} diff --git a/api/src/main/java/com/cloud/offering/NetworkOffering.java b/api/src/main/java/com/cloud/offering/NetworkOffering.java index bf9044191769..5825431c6bdf 100644 --- a/api/src/main/java/com/cloud/offering/NetworkOffering.java +++ b/api/src/main/java/com/cloud/offering/NetworkOffering.java @@ -143,6 +143,8 @@ public enum Detail { boolean isSupportingPublicAccess(); + boolean isSupportsVmAutoScaling(); + String getServicePackage(); Date getCreated(); diff --git a/api/src/main/java/com/cloud/server/ResourceTag.java b/api/src/main/java/com/cloud/server/ResourceTag.java index ba5ab8ad0ff5..d502b6f9d81b 100644 --- a/api/src/main/java/com/cloud/server/ResourceTag.java +++ b/api/src/main/java/com/cloud/server/ResourceTag.java @@ -31,6 +31,7 @@ public enum ResourceObjectType { Snapshot(true, false), Backup(true, false), Network(true, true, true), + DomainRouter(false, false), Nic(false, true), LoadBalancer(true, true), PortForwardingRule(true, true), diff --git a/api/src/main/java/org/apache/cloudstack/annotation/AnnotationService.java b/api/src/main/java/org/apache/cloudstack/annotation/AnnotationService.java index 6e47347ad712..c72fba22ba1f 100644 --- a/api/src/main/java/org/apache/cloudstack/annotation/AnnotationService.java +++ b/api/src/main/java/org/apache/cloudstack/annotation/AnnotationService.java @@ -44,7 +44,8 @@ enum EntityType { TEMPLATE(true), ISO(true), KUBERNETES_CLUSTER(true), SERVICE_OFFERING(false), DISK_OFFERING(false), NETWORK_OFFERING(false), ZONE(false), POD(false), CLUSTER(false), HOST(false), DOMAIN(false), - PRIMARY_STORAGE(false), SECONDARY_STORAGE(false), VR(false), SYSTEM_VM(false); + PRIMARY_STORAGE(false), SECONDARY_STORAGE(false), VR(false), SYSTEM_VM(false), + AUTOSCALE_VM_GROUP(true); private final boolean usersAllowed; diff --git a/api/src/main/java/org/apache/cloudstack/api/ApiConstants.java b/api/src/main/java/org/apache/cloudstack/api/ApiConstants.java index 7a52ade4dd8e..96110dbb57ff 100644 --- a/api/src/main/java/org/apache/cloudstack/api/ApiConstants.java +++ b/api/src/main/java/org/apache/cloudstack/api/ApiConstants.java @@ -40,6 +40,7 @@ public class ApiConstants { public static final String LIVE_PATCH = "livepatch"; public static final String AVAILABLE = "available"; public static final String AVAILABLE_SUBNETS = "availablesubnets"; + public static final String AVAILABLE_VIRTUAL_MACHINE_COUNT = "availablevirtualmachinecount"; public static final String BACKUP_ID = "backupid"; public static final String BACKUP_OFFERING_NAME = "backupofferingname"; public static final String BACKUP_OFFERING_ID = "backupofferingid"; @@ -266,6 +267,7 @@ public class ApiConstants { public static final String LOCK = "lock"; public static final String LUN = "lun"; public static final String LBID = "lbruleid"; + public static final String LB_PROVIDER = "lbprovider"; public static final String MAC_ADDRESS = "macaddress"; public static final String MAX = "max"; public static final String MAX_SNAPS = "maxsnaps"; @@ -736,7 +738,7 @@ public class ApiConstants { public static final String OTHER_DEPLOY_PARAMS = "otherdeployparams"; public static final String MIN_MEMBERS = "minmembers"; public static final String MAX_MEMBERS = "maxmembers"; - public static final String AUTOSCALE_VM_DESTROY_TIME = "destroyvmgraceperiod"; + public static final String AUTOSCALE_EXPUNGE_VM_GRACE_PERIOD = "expungevmgraceperiod"; public static final String VMPROFILE_ID = "vmprofileid"; public static final String VMGROUP_ID = "vmgroupid"; public static final String CS_URL = "csurl"; @@ -752,6 +754,8 @@ public class ApiConstants { public static final String CONDITION_IDS = "conditionids"; public static final String COUNTERPARAM_LIST = "counterparam"; public static final String AUTOSCALE_USER_ID = "autoscaleuserid"; + public static final String AUTOSCALE_VMGROUP_ID = "autoscalevmgroupid"; + public static final String AUTOSCALE_VMGROUP_NAME = "autoscalevmgroupname"; public static final String BAREMETAL_DISCOVER_NAME = "baremetaldiscovername"; public static final String BAREMETAL_RCT_URL = "baremetalrcturl"; public static final String UCS_DN = "ucsdn"; @@ -833,6 +837,7 @@ public class ApiConstants { public static final String SUPPORTS_REGION_LEVEL_VPC = "supportsregionLevelvpc"; public static final String SUPPORTS_STRECHED_L2_SUBNET = "supportsstrechedl2subnet"; public static final String SUPPORTS_PUBLIC_ACCESS = "supportspublicaccess"; + public static final String SUPPORTS_VM_AUTOSCALING = "supportsvmautoscaling"; public static final String REGION_LEVEL_VPC = "regionlevelvpc"; public static final String STRECHED_L2_SUBNET = "strechedl2subnet"; public static final String NETWORK_NAME = "networkname"; diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java index 6c49a23aa586..617d1104eda5 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java @@ -32,7 +32,7 @@ import com.cloud.network.as.Counter; import com.cloud.user.Account; -@APICommand(name = "createCounter", description = "Adds metric counter", responseObject = CounterResponse.class, +@APICommand(name = "createCounter", description = "Adds metric counter for VM auto scaling", responseObject = CounterResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateCounterCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreateCounterCmd.class.getName()); @@ -51,6 +51,9 @@ public class CreateCounterCmd extends BaseAsyncCreateCmd { @Parameter(name = ApiConstants.VALUE, type = CommandType.STRING, required = true, description = "Value of the counter e.g. oid in case of snmp.") private String value; + @Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING, required = true, description = "Network provider of the counter.", since = "4.18.0") + private String provider; + // ///////////////////////////////////////////////// // ///////////////// Accessors /////////////////////// // /////////////////////////////////////////////////// @@ -67,6 +70,10 @@ public String getValue() { return value; } + public String getProvider() { + return provider; + } + // /////////////////////////////////////////////////// // ///////////// API Implementation/////////////////// // /////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java index 6575bf940baf..16406b730e14 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java @@ -33,7 +33,7 @@ import com.cloud.exception.ResourceInUseException; import com.cloud.user.Account; -@APICommand(name = "deleteCounter", description = "Deletes a counter", responseObject = SuccessResponse.class, +@APICommand(name = "deleteCounter", description = "Deletes a counter for VM auto scaling", responseObject = SuccessResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteCounterCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteCounterCmd.class.getName()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java index 7ab9f276b8dd..eff93522b626 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java @@ -51,6 +51,12 @@ public class CreateAutoScalePolicyCmd extends BaseAsyncCreateCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// + @Parameter(name = ApiConstants.NAME, + type = CommandType.STRING, + description = "the name of the autoscale policy", + since = "4.18.0") + private String name; + @Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, required = true, @@ -60,12 +66,12 @@ public class CreateAutoScalePolicyCmd extends BaseAsyncCreateCmd { @Parameter(name = ApiConstants.DURATION, type = CommandType.INTEGER, required = true, - description = "the duration for which the conditions have to be true before action is taken") + description = "the duration in which the conditions have to be true before action is taken") private int duration; @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") + description = "the cool down period in which the policy should not be evaluated after the action has been taken") private Integer quietTime; @Parameter(name = ApiConstants.CONDITION_IDS, @@ -83,6 +89,10 @@ public class CreateAutoScalePolicyCmd extends BaseAsyncCreateCmd { private Long conditionDomainId; private Long conditionAccountId; + public String getName() { + return name; + } + public int getDuration() { return duration; } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java index 45881f2bc7ee..b4f152eedfb1 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java @@ -60,6 +60,12 @@ public class CreateAutoScaleVmGroupCmd extends BaseAsyncCreateCmd { description = "the ID of the load balancer rule") private long lbRuleId; + @Parameter(name = ApiConstants.NAME, + type = CommandType.STRING, + description = "the name of the autoscale vmgroup", + since = "4.18.0") + private String name; + @Parameter(name = ApiConstants.MIN_MEMBERS, type = CommandType.INTEGER, required = true, @@ -72,7 +78,7 @@ public class CreateAutoScaleVmGroupCmd extends BaseAsyncCreateCmd { 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") + @Parameter(name = ApiConstants.INTERVAL, type = CommandType.INTEGER, description = "the frequency in which the performance counters to be collected") private Integer interval; @Parameter(name = ApiConstants.SCALEUP_POLICY_IDS, @@ -105,6 +111,11 @@ public class CreateAutoScaleVmGroupCmd extends BaseAsyncCreateCmd { // ///////////////// Accessors /////////////////////// // /////////////////////////////////////////////////// + + public String getName() { + return name; + } + public int getMinMembers() { return minMembers; } @@ -225,7 +236,7 @@ public void execute() { s_logger.warn("Failed to create autoscale vm group", ex); } finally { if (!success || vmGroup == null) { - _autoScaleService.deleteAutoScaleVmGroup(getEntityId()); + _autoScaleService.deleteAutoScaleVmGroup(getEntityId(), true); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Autoscale Vm Group"); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java index d62b93676766..ba7149ea3d8f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java @@ -19,6 +19,7 @@ import java.util.HashMap; import java.util.Map; +import org.apache.commons.collections.MapUtils; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.RoleType; @@ -30,6 +31,8 @@ import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse; +import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.ServiceOfferingResponse; import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.response.UserResponse; @@ -37,11 +40,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.event.EventTypes; -import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceAllocationException; import com.cloud.network.as.AutoScaleVmProfile; -import com.cloud.user.Account; -import com.cloud.user.User; @APICommand(name = "createAutoScaleVmProfile", description = "Creates a profile that contains information about the virtual machine which will be provisioned automatically by autoscale feature.", @@ -80,20 +80,33 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd { 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") - private String otherDeployParams; + type = CommandType.MAP, + description = "parameters other than zoneId/serviceOfferringId/templateId of the auto deployed virtual machine.\n" + + "Example: otherdeployparams[0].name=serviceofferingid&otherdeployparams[0].value=a7fb50f6-01d9-11ed-8bc1-77f8f0228926&otherdeployparams[1].name=rootdisksize&otherdeployparams[1].value=10 .\n" + + "Possible parameters are \"rootdisksize\", \"diskofferingid\",\"size\", \"securitygroupids\", \"overridediskofferingid\", \"keypairs\", \"affinitygroupids'\" and \"networkids\".") + private Map> otherDeployParams; - @Parameter(name = ApiConstants.AUTOSCALE_VM_DESTROY_TIME, + @Parameter(name = ApiConstants.AUTOSCALE_EXPUNGE_VM_GRACE_PERIOD, type = CommandType.INTEGER, - description = "the time allowed for existing connections to get closed before a vm is destroyed") - private Integer destroyVmGraceperiod; + description = "the time allowed for existing connections to get closed before a vm is expunged") + private Integer expungeVmGracePeriod; @Parameter(name = ApiConstants.COUNTERPARAM_LIST, type = CommandType.MAP, description = "counterparam list. Example: counterparam[0].name=snmpcommunity&counterparam[0].value=public&counterparam[1].name=snmpport&counterparam[1].value=161") private Map counterParamList; + @Parameter(name = ApiConstants.USER_DATA, + type = CommandType.STRING, + description = "an optional binary data that can be sent to the virtual machine upon a successful deployment. " + + "This binary data must be base64 encoded before adding it to the request. " + + "Using HTTP GET (via querystring), you can send up to 4KB of data after base64 encoding. " + + "Using HTTP POST(via POST body), you can send up to 1MB of data after base64 encoding." + + "You also need to change vm.userdata.max.length value", + length = 1048576, + since = "4.18.0") + private String userData; + @Parameter(name = ApiConstants.AUTOSCALE_USER_ID, type = CommandType.UUID, entityType = UserResponse.class, @@ -103,21 +116,18 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd { @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the profile to the end user or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; - private Map otherDeployParamMap; + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "account that will own the autoscale VM profile") + private String accountName; - // /////////////////////////////////////////////////// - // ///////////////// Accessors /////////////////////// - // /////////////////////////////////////////////////// + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "an optional project for the autoscale VM profile") + private Long projectId; + @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "domain ID of the account owning a autoscale VM profile") private Long domainId; - private Long accountId; - public Long getDomainId() { - if (domainId == null) { - getAccountId(); - } - return domainId; - } + // /////////////////////////////////////////////////// + // ///////////////// Accessors /////////////////////// + // /////////////////////////////////////////////////// public Long getZoneId() { return zoneId; @@ -138,69 +148,31 @@ public Boolean getDisplay() { @Override public boolean isDisplay() { - if(display == null) - return true; - else - return display; + return display == null || display; } public Map getCounterParamList() { return counterParamList; } - public String getOtherDeployParams() { + public Map> getOtherDeployParams() { return otherDeployParams; } - public long getAutoscaleUserId() { - if (autoscaleUserId != null) { - return autoscaleUserId; - } else { - return CallContext.current().getCallingUserId(); - } + public String getUserData() { + return userData; } - public Integer getDestroyVmGraceperiod() { - return destroyVmGraceperiod; + public Long getAutoscaleUserId() { + return autoscaleUserId; } - public long getAccountId() { - if (accountId != null) { - return accountId; - } - Account account = null; - if (autoscaleUserId != null) { - User user = _entityMgr.findById(User.class, autoscaleUserId); - account = _entityMgr.findById(Account.class, user.getAccountId()); - } else { - account = CallContext.current().getCallingAccount(); - } - accountId = account.getAccountId(); - domainId = account.getDomainId(); - return accountId; - } - - private void createOtherDeployParamMap() { - if (otherDeployParamMap == null) { - otherDeployParamMap = new HashMap(); - } - if (otherDeployParams == null) - return; - String[] keyValues = otherDeployParams.split("&"); // hostid=123, hypervisor=xenserver - for (String keyValue : keyValues) { // keyValue == "hostid=123" - String[] keyAndValue = keyValue.split("="); // keyValue = hostid, 123 - if (keyAndValue.length != 2) { - throw new InvalidParameterValueException("Invalid parameter in otherDeployParam : " + keyValue); - } - String paramName = keyAndValue[0]; // hostid - String paramValue = keyAndValue[1]; // 123 - otherDeployParamMap.put(paramName, paramValue); - } + public Integer getExpungeVmGracePeriod() { + return expungeVmGracePeriod; } public HashMap getDeployParamMap() { - createOtherDeployParamMap(); - HashMap deployParams = new HashMap(otherDeployParamMap); + HashMap deployParams = new HashMap<>(getOtherDeployParamsMap()); deployParams.put("command", "deployVirtualMachine"); deployParams.put("zoneId", zoneId.toString()); deployParams.put("serviceOfferingId", serviceOfferingId.toString()); @@ -208,12 +180,28 @@ public HashMap getDeployParamMap() { return deployParams; } - public String getOtherDeployParam(String param) { - if (param == null) { - return null; + private Map getOtherDeployParamsMap() { + Map otherDeployParamsMap = new HashMap<>(); + if (MapUtils.isNotEmpty(otherDeployParams)) { + for (HashMap paramKVpair : otherDeployParams.values()) { + String paramName = paramKVpair.get("name"); + String paramValue = paramKVpair.get("value"); + otherDeployParamsMap.put(paramName,paramValue); + } } - createOtherDeployParamMap(); - return otherDeployParamMap.get(param); + return otherDeployParamsMap; + } + + public String getAccountName() { + return accountName; + } + + public Long getProjectId() { + return projectId; + } + + public Long getDomainId() { + return domainId; } // /////////////////////////////////////////////////// @@ -231,7 +219,12 @@ public static String getResultObjectName() { @Override public long getEntityOwnerId() { - return getAccountId(); + Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); + if (accountId == null) { + return CallContext.current().getCallingAccount().getId(); + } + + return accountId; } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java index 655fcfceb362..77bc15b1e0f1 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java @@ -29,13 +29,14 @@ import org.apache.cloudstack.api.response.ConditionResponse; import org.apache.cloudstack.api.response.CounterResponse; import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.context.CallContext; import com.cloud.event.EventTypes; import com.cloud.exception.ResourceAllocationException; import com.cloud.network.as.Condition; -@APICommand(name = "createCondition", description = "Creates a condition", responseObject = ConditionResponse.class, entityType = {Condition.class}, +@APICommand(name = "createCondition", description = "Creates a condition for VM auto scaling", responseObject = ConditionResponse.class, entityType = {Condition.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateConditionCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreateConditionCmd.class.getName()); @@ -48,15 +49,18 @@ public class CreateConditionCmd extends BaseAsyncCreateCmd { @Parameter(name = ApiConstants.COUNTER_ID, type = CommandType.UUID, entityType = CounterResponse.class, required = true, description = "ID of the Counter.") private long counterId; - @Parameter(name = ApiConstants.RELATIONAL_OPERATOR, type = CommandType.STRING, required = true, description = "Relational Operator to be used with threshold.") + @Parameter(name = ApiConstants.RELATIONAL_OPERATOR, type = CommandType.STRING, required = true, description = "Relational Operator to be used with threshold. Valid values are EQ, GT, LT, GE, LE.") private String relationalOperator; - @Parameter(name = ApiConstants.THRESHOLD, type = CommandType.LONG, required = true, description = "Threshold value.") + @Parameter(name = ApiConstants.THRESHOLD, type = CommandType.LONG, required = true, description = "Value for which the Counter will be evaluated with the Operator selected.") private Long threshold; @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "the account of the condition. " + "Must be used with the domainId parameter.") private String accountName; + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "an optional project for condition") + private Long projectId; + @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "the domain ID of the account.") private Long domainId; @@ -103,17 +107,14 @@ public String getRelationalOperator() { } public String getAccountName() { - if (accountName == null) { - return CallContext.current().getCallingAccount().getAccountName(); - } - return accountName; } + public Long getProjectId() { + return projectId; + } + public Long getDomainId() { - if (domainId == null) { - return CallContext.current().getCallingAccount().getDomainId(); - } return domainId; } @@ -138,7 +139,7 @@ public String getEventType() { @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, null, true); + Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java index 0cc9571a685f..cb458b2daf2a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java @@ -52,6 +52,12 @@ public class DeleteAutoScaleVmGroupCmd extends BaseAsyncCmd { description = "the ID of the autoscale group") private Long id; + @Parameter(name = ApiConstants.CLEANUP, + type = CommandType.BOOLEAN, + description = "true if all VMs have to be cleaned up, false otherwise", + since = "4.18.0") + private Boolean cleanup; + // /////////////////////////////////////////////////// // ///////////////// Accessors /////////////////////// // /////////////////////////////////////////////////// @@ -60,6 +66,10 @@ public Long getId() { return id; } + public Boolean getCleanup() { + return cleanup != null && cleanup; + } + // /////////////////////////////////////////////////// // ///////////// API Implementation/////////////////// // /////////////////////////////////////////////////// @@ -93,7 +103,7 @@ public String getEventDescription() { @Override public void execute() { CallContext.current().setEventDetails("AutoScale Vm Group Id: " + getId()); - boolean result = _autoScaleService.deleteAutoScaleVmGroup(id); + boolean result = _autoScaleService.deleteAutoScaleVmGroup(id, getCleanup()); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java index 8c3e56d43ba7..3d21c3c04125 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java @@ -36,7 +36,7 @@ import com.cloud.network.as.Condition; import com.cloud.user.Account; -@APICommand(name = "deleteCondition", description = "Removes a condition", responseObject = SuccessResponse.class, entityType = {Condition.class}, +@APICommand(name = "deleteCondition", description = "Removes a condition for VM auto scaling", responseObject = SuccessResponse.class, entityType = {Condition.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteConditionCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteConditionCmd.class.getName()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java index c2b244f2a7fe..18d52092828c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java @@ -23,7 +23,7 @@ import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseListAccountResourcesCmd; +import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.AutoScalePolicyResponse; import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse; @@ -34,7 +34,7 @@ @APICommand(name = "listAutoScalePolicies", description = "Lists autoscale policies.", responseObject = AutoScalePolicyResponse.class, entityType = {AutoScalePolicy.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) -public class ListAutoScalePoliciesCmd extends BaseListAccountResourcesCmd { +public class ListAutoScalePoliciesCmd extends BaseListProjectAndAccountResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListAutoScalePoliciesCmd.class.getName()); private static final String s_name = "listautoscalepoliciesresponse"; @@ -46,6 +46,9 @@ public class ListAutoScalePoliciesCmd extends BaseListAccountResourcesCmd { @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AutoScalePolicyResponse.class, description = "the ID of the autoscale policy") private Long id; + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the autoscale policy", since = "4.18.0") + private String name; + @Parameter(name = ApiConstants.CONDITION_ID, type = CommandType.UUID, entityType = ConditionResponse.class, description = "the ID of the condition of the policy") private Long conditionId; @@ -65,6 +68,10 @@ public Long getId() { return id; } + public String getName() { + return name; + } + public Long getConditionId() { return conditionId; } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java index 37c90b9bfdb3..8035117b3e16 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java @@ -50,6 +50,9 @@ public class ListAutoScaleVmGroupsCmd extends BaseListProjectAndAccountResources @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AutoScaleVmGroupResponse.class, description = "the ID of the autoscale vm group") private Long id; + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the autoscale vmgroup", since = "4.18.0") + private String name; + @Parameter(name = ApiConstants.LBID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, description = "the ID of the loadbalancer") private Long loadBalancerId; @@ -73,6 +76,10 @@ public Long getId() { return id; } + public String getName() { + return name; + } + public Long getLoadBalancerId() { return loadBalancerId; } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java index d75d64942f90..00d937d28b0a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java @@ -24,7 +24,7 @@ import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseListAccountResourcesCmd; +import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.AutoScalePolicyResponse; import org.apache.cloudstack.api.response.ConditionResponse; @@ -33,9 +33,9 @@ import com.cloud.network.as.Condition; -@APICommand(name = "listConditions", description = "List Conditions for the specific user", responseObject = ConditionResponse.class, +@APICommand(name = "listConditions", description = "List Conditions for VM auto scaling", responseObject = ConditionResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) -public class ListConditionsCmd extends BaseListAccountResourcesCmd { +public class ListConditionsCmd extends BaseListProjectAndAccountResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListConditionsCmd.class.getName()); private static final String s_name = "listconditionsresponse"; diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java index 6a9ac8dfdcbc..7da8bd40b61a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java @@ -32,7 +32,7 @@ import com.cloud.network.as.Counter; import com.cloud.user.Account; -@APICommand(name = "listCounters", description = "List the counters", responseObject = CounterResponse.class, +@APICommand(name = "listCounters", description = "List the counters for VM auto scaling", responseObject = CounterResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListCountersCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListCountersCmd.class.getName()); @@ -51,6 +51,9 @@ public class ListCountersCmd extends BaseListCmd { @Parameter(name = ApiConstants.SOURCE, type = CommandType.STRING, description = "Source of the counter.") private String source; + @Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING, description = "Network provider of the counter.", since = "4.18.0") + private String provider; + // /////////////////////////////////////////////////// // ///////////// API Implementation/////////////////// // /////////////////////////////////////////////////// @@ -92,6 +95,10 @@ public String getSource() { return source; } + public String getProvider() { + return provider; + } + @Override public long getEntityOwnerId() { return Account.ACCOUNT_ID_SYSTEM; diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java index b1089a5ee0ba..08e0676b5428 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java @@ -49,12 +49,18 @@ public class UpdateAutoScalePolicyCmd extends BaseAsyncCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.DURATION, type = CommandType.INTEGER, description = "the duration for which the conditions have to be true before action is taken") + @Parameter(name = ApiConstants.NAME, + type = CommandType.STRING, + description = "the name of the autoscale policy", + since = "4.18.0") + private String name; + + @Parameter(name = ApiConstants.DURATION, type = CommandType.INTEGER, description = "the duration in which the conditions have to be true before action is taken") private Integer duration; @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") + description = "the cool down period in which the policy should not be evaluated after the action has been taken") private Integer quietTime; @Parameter(name = ApiConstants.CONDITION_IDS, @@ -93,6 +99,10 @@ public Long getId() { return id; } + public String getName() { + return name; + } + public Integer getDuration() { return duration; } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java index c086c3290e22..ac3ade3c50bf 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java @@ -50,6 +50,12 @@ public class UpdateAutoScaleVmGroupCmd extends BaseAsyncCustomIdCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// + @Parameter(name = ApiConstants.NAME, + type = CommandType.STRING, + description = "the name of the autoscale vmgroup", + since = "4.18.0") + private String name; + @Parameter(name = ApiConstants.MIN_MEMBERS, type = CommandType.INTEGER, description = "the minimum number of members in the vmgroup, the number of instances in the vm group will be equal to or more than this number.") @@ -60,7 +66,7 @@ public class UpdateAutoScaleVmGroupCmd extends BaseAsyncCustomIdCmd { 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 Integer maxMembers; - @Parameter(name = ApiConstants.INTERVAL, type = CommandType.INTEGER, description = "the frequency at which the conditions have to be evaluated") + @Parameter(name = ApiConstants.INTERVAL, type = CommandType.INTEGER, description = "the frequency in which the performance counters to be collected") private Integer interval; @Parameter(name = ApiConstants.SCALEUP_POLICY_IDS, @@ -113,6 +119,10 @@ public Long getId() { return id; } + public String getName() { + return name; + } + public Integer getMinMembers() { return minMembers; } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java index 2f4445a20d2a..0056051b336b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java @@ -17,6 +17,7 @@ package org.apache.cloudstack.api.command.user.autoscale; +import java.util.HashMap; import java.util.Map; import org.apache.log4j.Logger; @@ -32,6 +33,7 @@ import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse; +import org.apache.cloudstack.api.response.ServiceOfferingResponse; import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.response.UserResponse; import org.apache.cloudstack.context.CallContext; @@ -59,22 +61,48 @@ public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCustomIdCmd { description = "the ID of the autoscale vm profile") private Long id; + @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, + type = CommandType.UUID, + entityType = ServiceOfferingResponse.class, + description = "the service offering of the auto deployed virtual machine", + since = "4.18.0") + private Long serviceOfferingId; + @Parameter(name = ApiConstants.TEMPLATE_ID, type = CommandType.UUID, entityType = TemplateResponse.class, description = "the template of the auto deployed virtual machine") private Long templateId; - @Parameter(name = ApiConstants.AUTOSCALE_VM_DESTROY_TIME, + @Parameter(name = ApiConstants.AUTOSCALE_EXPUNGE_VM_GRACE_PERIOD, type = CommandType.INTEGER, description = "the time allowed for existing connections to get closed before a vm is destroyed") - private Integer destroyVmGraceperiod; + private Integer expungeVmGracePeriod; @Parameter(name = ApiConstants.COUNTERPARAM_LIST, type = CommandType.MAP, description = "counterparam list. Example: counterparam[0].name=snmpcommunity&counterparam[0].value=public&counterparam[1].name=snmpport&counterparam[1].value=161") private Map counterParamList; + @Parameter(name = ApiConstants.OTHER_DEPLOY_PARAMS, + type = CommandType.MAP, + description = "parameters other than zoneId/serviceOfferringId/templateId of the auto deployed virtual machine. \n" + + "Example: otherdeployparams[0].name=serviceofferingid&otherdeployparams[0].value=a7fb50f6-01d9-11ed-8bc1-77f8f0228926&otherdeployparams[1].name=rootdisksize&otherdeployparams[1].value=10 .\n" + + "Possible parameters are \"rootdisksize\", \"diskofferingid\",\"size\", \"securitygroupids\", \"overridediskofferingid\", \"keypairs\", \"affinitygroupids'\" and \"networkids\".", + since = "4.18.0") + private Map> otherDeployParams; + + @Parameter(name = ApiConstants.USER_DATA, + type = CommandType.STRING, + description = "an optional binary data that can be sent to the virtual machine upon a successful deployment. " + + "This binary data must be base64 encoded before adding it to the request. " + + "Using HTTP GET (via querystring), you can send up to 4KB of data after base64 encoding. " + + "Using HTTP POST(via POST body), you can send up to 1MB of data after base64 encoding." + + "You also need to change vm.userdata.max.length value", + length = 1048576, + since = "4.18.0") + private String userData; + @Parameter(name = ApiConstants.AUTOSCALE_USER_ID, type = CommandType.UUID, entityType = UserResponse.class, @@ -109,20 +137,32 @@ public Long getId() { return id; } + public Long getServiceOfferingId() { + return serviceOfferingId; + } + public Long getTemplateId() { return templateId; } + public Map> getOtherDeployParams() { + return otherDeployParams; + } + public Map getCounterParamList() { return counterParamList; } + public String getUserData() { + return userData; + } + public Long getAutoscaleUserId() { return autoscaleUserId; } - public Integer getDestroyVmGraceperiod() { - return destroyVmGraceperiod; + public Integer getExpungeVmGracePeriod() { + return expungeVmGracePeriod; } public Boolean getDisplay() { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateConditionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateConditionCmd.java new file mode 100644 index 000000000000..b0e79e7e8aeb --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateConditionCmd.java @@ -0,0 +1,124 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.cloudstack.api.command.user.autoscale; + +import org.apache.log4j.Logger; + +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.acl.SecurityChecker.AccessType; +import org.apache.cloudstack.api.ACL; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiCommandResourceType; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.ConditionResponse; +import org.apache.cloudstack.api.response.SuccessResponse; + +import com.cloud.event.EventTypes; +import com.cloud.exception.ResourceInUseException; +import com.cloud.network.as.Condition; +import com.cloud.user.Account; + +@APICommand(name = UpdateConditionCmd.API_NAME, description = "Updates a condition for VM auto scaling", responseObject = SuccessResponse.class, entityType = {Condition.class}, + authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.18.0") +public class UpdateConditionCmd extends BaseAsyncCmd { + public static final Logger LOGGER = Logger.getLogger(UpdateConditionCmd.class.getName()); + public static final String API_NAME = "updateCondition"; + + // /////////////////////////////////////////////////// + // ////////////// API parameters ///////////////////// + // /////////////////////////////////////////////////// + + @ACL(accessType = AccessType.OperateEntry) + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ConditionResponse.class, required = true, description = "the ID of the condition.") + private Long id; + + @Parameter(name = ApiConstants.RELATIONAL_OPERATOR, type = CommandType.STRING, required = true, description = "Relational Operator to be used with threshold. Valid values are EQ, GT, LT, GE, LE.") + private String relationalOperator; + + @Parameter(name = ApiConstants.THRESHOLD, type = CommandType.LONG, required = true, description = "Value for which the Counter will be evaluated with the Operator selected.") + private Long threshold; + + // /////////////////////////////////////////////////// + // ///////////// API Implementation/////////////////// + // /////////////////////////////////////////////////// + + @Override + public void execute() { + try { + Condition condition = _autoScaleService.updateCondition(this); + ConditionResponse response = _responseGenerator.createConditionResponse(condition); + response.setResponseName(getCommandName()); + setResponseObject(response); + } catch (ResourceInUseException ex) { + LOGGER.warn("Exception: ", ex); + throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, ex.getMessage()); + } + } + + // /////////////////////////////////////////////////// + // ///////////////// Accessors /////////////////////// + // /////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + public String getRelationalOperator() { + return relationalOperator; + } + + public Long getThreshold() { + return threshold; + } + + @Override + public ApiCommandResourceType getApiResourceType() { + return ApiCommandResourceType.Condition; + } + + @Override + public String getCommandName() { + return API_NAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX; + } + + @Override + public long getEntityOwnerId() { + Condition condition = _entityMgr.findById(Condition.class, getId()); + if (condition != null) { + return condition.getAccountId(); + } + + return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are + } + + @Override + public String getEventType() { + return EventTypes.EVENT_CONDITION_UPDATE; + } + + @Override + public String getEventDescription() { + return "Updating a condition."; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java index 6fda59d7fcbb..0e2e86de1c78 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java @@ -169,7 +169,7 @@ public void execute() { boolean result = false; try { - result = _lbService.assignToLoadBalancer(getLoadBalancerId(), virtualMachineIds, vmIdIpsMap); + result = _lbService.assignToLoadBalancer(getLoadBalancerId(), virtualMachineIds, vmIdIpsMap, false); }catch (CloudRuntimeException ex) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign load balancer rule"); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java index 048de308dc14..b0be9613748e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java @@ -159,7 +159,7 @@ public void execute() { CallContext.current().setEventDetails("Load balancer Id: " + getId() + " VmIds: " + StringUtils.join(getVirtualMachineIds(), ",")); Map> vmIdIpsMap = getVmIdIpListMap(); try { - boolean result = _lbService.removeFromLoadBalancer(id, virtualMachineIds, vmIdIpsMap); + boolean result = _lbService.removeFromLoadBalancer(id, virtualMachineIds, vmIdIpsMap, false); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java index bb105d2b2bb3..e609655c580a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java @@ -30,6 +30,7 @@ import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ResponseObject.ResponseView; import org.apache.cloudstack.api.command.user.UserCmd; +import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse; import org.apache.cloudstack.api.response.BackupOfferingResponse; import org.apache.cloudstack.api.response.InstanceGroupResponse; import org.apache.cloudstack.api.response.IsoVmResponse; @@ -132,6 +133,9 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd implements UserCmd { @Parameter(name = ApiConstants.HA_ENABLE, type = CommandType.BOOLEAN, description = "list by the High Availability offering; true if filtering VMs with HA enabled; false for VMs with HA disabled", since = "4.15") private Boolean haEnabled; + @Parameter(name = ApiConstants.AUTOSCALE_VMGROUP_ID, type = CommandType.UUID, entityType = AutoScaleVmGroupResponse.class, description = "the ID of AutoScaling VM Group", since = "4.18.0") + private Long autoScaleVmGroupId; + @Parameter(name = ApiConstants.SHOW_RESOURCE_ICON, type = CommandType.BOOLEAN, description = "flag to display the resource icon for VMs", since = "4.16.0.0") private Boolean showIcon; @@ -227,6 +231,10 @@ public Boolean getShowUserData() { return this.showUserData; } + public Long getAutoScaleVmGroupId() { + return autoScaleVmGroupId; + } + public EnumSet getDetails() throws InvalidParameterValueException { EnumSet dv; if (viewDetails == null || viewDetails.size() <= 0) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/AutoScalePolicyResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/AutoScalePolicyResponse.java index bf85d8b227f2..ae3462f1fec2 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/AutoScalePolicyResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/AutoScalePolicyResponse.java @@ -34,6 +34,10 @@ public class AutoScalePolicyResponse extends BaseResponse implements ControlledE @Param(description = "the autoscale policy ID") private String id; + @SerializedName(ApiConstants.NAME) + @Param(description = "name of the autoscale policy") + private String name; + @SerializedName(ApiConstants.ACTION) @Param(description = "the action to be executed if all the conditions evaluate to true for the specified duration.") private String action; @@ -79,6 +83,10 @@ public void setId(String id) { this.id = id; } + public void setName(String name) { + this.name = name; + } + public void setDuration(Integer duration) { this.duration = duration; } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java index 572d4626fd9e..656a62ddda35 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java @@ -16,11 +16,12 @@ // under the License. package org.apache.cloudstack.api.response; +import java.util.Date; import java.util.List; import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.BaseResponseWithAnnotations; import org.apache.cloudstack.api.EntityReference; import com.cloud.network.as.AutoScaleVmGroup; @@ -28,16 +29,48 @@ import com.google.gson.annotations.SerializedName; @EntityReference(value = AutoScaleVmGroup.class) -public class AutoScaleVmGroupResponse extends BaseResponse implements ControlledEntityResponse { +public class AutoScaleVmGroupResponse extends BaseResponseWithAnnotations implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) @Param(description = "the autoscale vm group ID") private String id; + @SerializedName(ApiConstants.NAME) + @Param(description = "the name of the autoscale vm group ") + private String name; + @SerializedName(ApiConstants.LBID) @Param(description = "the load balancer rule ID") private String loadBalancerId; + @SerializedName(ApiConstants.ASSOCIATED_NETWORK_NAME) + @Param(description = "the name of the guest network the lb rule belongs to") + private String networkName; + + @SerializedName(ApiConstants.ASSOCIATED_NETWORK_ID) + @Param(description = "the id of the guest network the lb rule belongs to") + private String networkId; + + @SerializedName(ApiConstants.LB_PROVIDER) + @Param(description = "the lb provider of the guest network the lb rule belongs to") + private String lbProvider; + + @SerializedName(ApiConstants.PUBLIC_IP_ID) + @Param(description = "the public ip address id") + private String publicIpId; + + @SerializedName(ApiConstants.PUBLIC_IP) + @Param(description = "the public ip address") + private String publicIp; + + @SerializedName(ApiConstants.PUBLIC_PORT) + @Param(description = "the public port") + private String publicPort; + + @SerializedName(ApiConstants.PRIVATE_PORT) + @Param(description = "the private port") + private String privatePort; + @SerializedName(ApiConstants.VMPROFILE_ID) @Param(description = "the autoscale profile that contains information about the vms in the vm group.") private String profileId; @@ -50,6 +83,10 @@ public class AutoScaleVmGroupResponse extends BaseResponse implements Controlled @Param(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; + @SerializedName(ApiConstants.AVAILABLE_VIRTUAL_MACHINE_COUNT) + @Param(description = "the number of available virtual machines (in Running, Starting, Stopping or Migrating state) in the vmgroup", since = "4.18.0") + private int availableVirtualMachineCount; + @SerializedName(ApiConstants.INTERVAL) @Param(description = "the frequency at which the conditions have to be evaluated") private int interval; @@ -67,31 +104,35 @@ public class AutoScaleVmGroupResponse extends BaseResponse implements Controlled private List scaleDownPolicies; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account owning the instance group") + @Param(description = "the account owning the vm group") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id vm profile") + @Param(description = "the project id of the vm group") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the vm profile") + @Param(description = "the project name of the vm group") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID of the vm profile") + @Param(description = "the domain ID of the vm group") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name of the vm profile") + @Param(description = "the domain name of the vm group") private String domainName; @SerializedName(ApiConstants.FOR_DISPLAY) @Param(description = "is group for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) private Boolean forDisplay; - public AutoScaleVmGroupResponse() { + @SerializedName(ApiConstants.CREATED) + @Param(description = "the date when this vm group was created") + private Date created; + public AutoScaleVmGroupResponse() { + // Empty constructor } @Override @@ -103,10 +144,42 @@ public void setId(String id) { this.id = id; } + public void setName(String name) { + this.name = name; + } + public void setLoadBalancerId(String loadBalancerId) { this.loadBalancerId = loadBalancerId; } + public void setNetworkName(String networkName) { + this.networkName = networkName; + } + + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + public void setLbProvider(String lbProvider) { + this.lbProvider = lbProvider; + } + + public void setPublicIpId(String publicIpId) { + this.publicIpId = publicIpId; + } + + public void setPublicIp(String publicIp) { + this.publicIp = publicIp; + } + + public void setPublicPort(String publicPort) { + this.publicPort = publicPort; + } + + public void setPrivatePort(String privatePort) { + this.privatePort = privatePort; + } + public void setProfileId(String profileId) { this.profileId = profileId; } @@ -119,6 +192,10 @@ public void setMaxMembers(int maxMembers) { this.maxMembers = maxMembers; } + public void setAvailableVirtualMachineCount(int availableVirtualMachineCount) { + this.availableVirtualMachineCount = availableVirtualMachineCount; + } + public void setState(String state) { this.state = state; } @@ -163,4 +240,52 @@ public void setProjectName(String projectName) { public void setForDisplay(Boolean forDisplay) { this.forDisplay = forDisplay; } + + public void setCreated(Date created) { + this.created = created; + } + + public String getName() { + return name; + } + + public int getMinMembers() { + return minMembers; + } + + public int getMaxMembers() { + return maxMembers; + } + + public int getAvailableVirtualMachineCount() { + return availableVirtualMachineCount; + } + + public int getInterval() { + return interval; + } + + public String getState() { + return state; + } + + public String getNetworkName() { + return networkName; + } + + public String getLbProvider() { + return lbProvider; + } + + public String getPublicIp() { + return publicIp; + } + + public String getPublicPort() { + return publicPort; + } + + public String getPrivatePort() { + return privatePort; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java index 412af1c27362..66d7296f406b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java @@ -54,12 +54,12 @@ public class AutoScaleVmProfileResponse extends BaseResponse implements Controll @SerializedName(ApiConstants.OTHER_DEPLOY_PARAMS) @Param(description = "parameters other than zoneId/serviceOfferringId/templateId to be used while deploying a virtual machine") - private String otherDeployParams; + private Map otherDeployParams; /* Parameters related to destroying a virtual machine */ - @SerializedName(ApiConstants.AUTOSCALE_VM_DESTROY_TIME) + @SerializedName(ApiConstants.AUTOSCALE_EXPUNGE_VM_GRACE_PERIOD) @Param(description = "the time allowed for existing connections to get closed before a vm is destroyed") - private Integer destroyVmGraceperiod; + private Integer expungeVmGracePeriod; /* Parameters related to a running virtual machine - monitoring aspects */ @SerializedName(ApiConstants.COUNTERPARAM_LIST) @@ -68,6 +68,10 @@ public class AutoScaleVmProfileResponse extends BaseResponse implements Controll description = "counterparam list. Example: counterparam[0].name=snmpcommunity&counterparam[0].value=public&counterparam[1].name=snmpport&counterparam[1].value=161") private Map counterParams; + @SerializedName(ApiConstants.USER_DATA) + @Param(description = "Base 64 encoded VM user data") + private String userData; + @SerializedName(ApiConstants.AUTOSCALE_USER_ID) @Param(description = "the ID of the user used to launch and destroy the VMs") private String autoscaleUserId; @@ -103,6 +107,7 @@ public class AutoScaleVmProfileResponse extends BaseResponse implements Controll private Boolean forDisplay; public AutoScaleVmProfileResponse() { + // Empty constructor } @Override @@ -126,12 +131,17 @@ public void setTemplateId(String templateId) { this.templateId = templateId; } - public void setOtherDeployParams(String otherDeployParams) { - this.otherDeployParams = otherDeployParams; + public void setOtherDeployParams(List> otherDeployParams) { + this.otherDeployParams = new HashMap<>(); + for (Pair paramKV : otherDeployParams) { + String key = paramKV.first(); + String value = paramKV.second(); + this.otherDeployParams.put(key, value); + } } public void setCounterParams(List> counterParams) { - this.counterParams = new HashMap(); + this.counterParams = new HashMap<>(); for (Pair paramKV : counterParams) { String key = paramKV.first(); String value = paramKV.second(); @@ -139,6 +149,10 @@ public void setCounterParams(List> counterParams) { } } + public void setUserData(String userData) { + this.userData = userData; + } + @Override public void setAccountName(String accountName) { this.accountName = accountName; @@ -168,8 +182,8 @@ public void setAutoscaleUserId(String autoscaleUserId) { this.autoscaleUserId = autoscaleUserId; } - public void setDestroyVmGraceperiod(Integer destroyVmGraceperiod) { - this.destroyVmGraceperiod = destroyVmGraceperiod; + public void setExpungeVmGracePeriod(Integer expungeVmGracePeriod) { + this.expungeVmGracePeriod = expungeVmGracePeriod; } public void setCsUrl(String csUrl) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ConditionResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ConditionResponse.java index 94175f34a997..15671430bf17 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ConditionResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ConditionResponse.java @@ -17,8 +17,6 @@ package org.apache.cloudstack.api.response; -import java.util.List; - import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.ApiConstants; @@ -43,9 +41,17 @@ public class ConditionResponse extends BaseResponse implements ControlledEntityR @Param(description = "Relational Operator to be used with threshold.") private String relationalOperator; + @SerializedName("counterid") + @Param(description = "the Id of the Counter.") + private String counterId; + + @SerializedName("countername") + @Param(description = "the Name of the Counter.") + private String counterName; + @SerializedName("counter") @Param(description = "Details of the Counter.") - private List counterResponse; + private CounterResponse counterResponse; @SerializedName(ApiConstants.DOMAIN_ID) @Param(description = "the domain id of the Condition owner") @@ -84,6 +90,14 @@ public String getObjectId() { return this.id; } + public void setCounterId(String counterId) { + this.counterId = counterId; + } + + public void setCounterName(String counterName) { + this.counterName = counterName; + } + public void setThreshold(long threshold) { this.threshold = threshold; } @@ -92,7 +106,7 @@ public void setRelationalOperator(String relationalOperator) { this.relationalOperator = relationalOperator; } - public void setCounterResponse(List counterResponse) { + public void setCounterResponse(CounterResponse counterResponse) { this.counterResponse = counterResponse; } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/CounterResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/CounterResponse.java index a9bac00c8ac0..f013690b64cc 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/CounterResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/CounterResponse.java @@ -49,6 +49,10 @@ public class CounterResponse extends BaseResponse { @Param(description = "zone id of counter") private String zoneId; + @SerializedName(value = ApiConstants.PROVIDER) + @Param(description = "Provider of the counter.") + private String provider; + @Override public String getObjectId() { return this.id; @@ -69,4 +73,8 @@ public void setSource(String source) { public void setValue(String value) { this.value = value; } + + public void setProvider(String provider) { + this.provider = provider; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/NetworkResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/NetworkResponse.java index 19edc1b3944f..51b3ade17ab0 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/NetworkResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/NetworkResponse.java @@ -255,6 +255,10 @@ public class NetworkResponse extends BaseResponseWithAssociatedNetwork implement @Param(description = "If the network has redundant routers enabled", since = "4.11.1") private Boolean redundantRouter; + @SerializedName(ApiConstants.SUPPORTS_VM_AUTOSCALING) + @Param(description = "if network offering supports vm autoscaling feature", since = "4.18.0") + private Boolean supportsVmAutoScaling; + @SerializedName(ApiConstants.RESOURCE_ICON) @Param(description = "Base64 string representation of the resource icon", since = "4.16.0.0") ResourceIconResponse icon; @@ -534,6 +538,14 @@ public void setRedundantRouter(Boolean redundantRouter) { this.redundantRouter = redundantRouter; } + public Boolean getSupportsVmAutoScaling() { + return supportsVmAutoScaling; + } + + public void setSupportsVmAutoScaling(Boolean supportsVmAutoScaling) { + this.supportsVmAutoScaling = supportsVmAutoScaling; + } + public String getVpcName() { return vpcName; } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java index d7ebe90ebdee..108e480deb0b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java @@ -329,9 +329,17 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co private Long bytesSent; @SerializedName(ApiConstants.RESOURCE_ICON) - @Param(description = "Base64 string representation of the resource icon", since = "4.16.0.0") + @Param(description = "Base64 string representation of the resource icon", since = "4.16.0") ResourceIconResponse resourceIconResponse; + @SerializedName(ApiConstants.AUTOSCALE_VMGROUP_ID) + @Param(description = "ID of AutoScale VM group", since = "4.18.0") + String autoScaleVmGroupId; + + @SerializedName(ApiConstants.AUTOSCALE_VMGROUP_NAME) + @Param(description = "Name of AutoScale VM group", since = "4.18.0") + String autoScaleVmGroupName; + @SerializedName(ApiConstants.USER_DATA) @Param(description = "Base64 string containing the user data", since = "4.18.0.0") private String userData; @@ -349,11 +357,11 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co private String userDataDetails; public UserVmResponse() { - securityGroupList = new LinkedHashSet(); + securityGroupList = new LinkedHashSet<>(); nics = new TreeSet<>(Comparator.comparingInt(x -> Integer.parseInt(x.getDeviceId()))); - tags = new LinkedHashSet(); - tagIds = new LinkedHashSet(); - affinityGroupList = new LinkedHashSet(); + tags = new LinkedHashSet<>(); + tagIds = new LinkedHashSet<>(); + affinityGroupList = new LinkedHashSet<>(); } public void setHypervisor(String hypervisor) { @@ -973,6 +981,22 @@ public void setBytesSent(Long bytesSent) { this.bytesSent = bytesSent; } + public void setAutoScaleVmGroupId(String autoScaleVmGroupId) { + this.autoScaleVmGroupId = autoScaleVmGroupId; + } + + public void setAutoScaleVmGroupName(String autoScaleVmGroupName) { + this.autoScaleVmGroupName = autoScaleVmGroupName; + } + + public String getAutoScaleVmGroupId() { + return autoScaleVmGroupId; + } + + public String getAutoScaleVmGroupName() { + return autoScaleVmGroupName; + } + public void setUserData(String userData) { this.userData = userData; } diff --git a/api/src/test/java/com/cloud/agent/api/to/LoadBalancerTOTest.java b/api/src/test/java/com/cloud/agent/api/to/LoadBalancerTOTest.java new file mode 100644 index 000000000000..ab0324e9d2da --- /dev/null +++ b/api/src/test/java/com/cloud/agent/api/to/LoadBalancerTOTest.java @@ -0,0 +1,176 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.agent.api.to; + +import com.cloud.network.as.AutoScalePolicy; +import com.cloud.network.as.AutoScaleVmGroup; +import com.cloud.network.as.Condition; +import com.cloud.network.as.Counter; +import com.cloud.utils.Pair; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.List; + +public class LoadBalancerTOTest { + + LoadBalancerTO.CounterTO counter; + LoadBalancerTO.ConditionTO condition; + LoadBalancerTO.AutoScalePolicyTO scaleUpPolicy; + LoadBalancerTO.AutoScalePolicyTO scaleDownPolicy; + + LoadBalancerTO.AutoScaleVmProfileTO vmProfile; + LoadBalancerTO.AutoScaleVmGroupTO vmGroup; + + private static final Long counterId = 1L; + private static final String counterName = "counter name"; + private static final Counter.Source counterSource = Counter.Source.CPU; + private static final String counterValue = "counter value"; + private static final String counterProvider = "VIRTUALROUTER"; + + private static final Long conditionId = 2L; + private static final Long threshold = 100L; + private static final Condition.Operator relationalOperator = Condition.Operator.GT; + + private static final Long scaleUpPolicyId = 11L; + private static final int scaleUpPolicyDuration = 61; + private static final int scaleUpPolicyQuietTime = 31; + private static final Date scaleUpPolicyLastQuietTime = new Date(); + + private static final Long scaleDownPolicyId = 12L; + private static final int scaleDownPolicyDuration = 62; + private static final int scaleDownPolicyQuietTime = 32; + private static final Date scaleDownPolicyLastQuietTime = new Date(); + + private static final String zoneId = "1111-1111-1112"; + private static final String domainId = "1111-1111-1113"; + private static final String serviceOfferingId = "1111-1111-1114"; + private static final String templateId = "1111-1111-1115"; + private static final String otherDeployParams = "otherDeployParams"; + private static final List> counterParamList = new ArrayList<>(); + private static final Integer expungeVmGracePeriod = 33; + private static final String cloudStackApiUrl = "cloudstack url"; + private static final String autoScaleUserApiKey = "cloudstack api key"; + private static final String autoScaleUserSecretKey = "cloudstack secret key"; + private static final String vmName = "vm name"; + private static final String networkId = "1111-1111-1116"; + + private static final Long vmGroupId = 22L; + private static final String vmGroupUuid = "2222-2222-1111"; + private static final int minMembers = 2; + private static final int maxMembers = 3; + private static final int memberPort = 8080; + private static final int interval = 30; + private static final AutoScaleVmGroup.State state = AutoScaleVmGroup.State.ENABLED; + private static final AutoScaleVmGroup.State currentState = AutoScaleVmGroup.State.DISABLED; + private static final Long loadBalancerId = 21L; + + @Before + public void setUp() { + counter = new LoadBalancerTO.CounterTO(counterId, counterName, counterSource, counterValue, counterProvider); + condition = new LoadBalancerTO.ConditionTO(conditionId, threshold, relationalOperator, counter); + scaleUpPolicy = new LoadBalancerTO.AutoScalePolicyTO(scaleUpPolicyId, scaleUpPolicyDuration, scaleUpPolicyQuietTime, + scaleUpPolicyLastQuietTime, AutoScalePolicy.Action.SCALEUP, + Arrays.asList(new LoadBalancerTO.ConditionTO[]{ condition }), false); + scaleDownPolicy = new LoadBalancerTO.AutoScalePolicyTO(scaleDownPolicyId, scaleDownPolicyDuration, scaleDownPolicyQuietTime, + scaleDownPolicyLastQuietTime, AutoScalePolicy.Action.SCALEDOWN, + Arrays.asList(new LoadBalancerTO.ConditionTO[]{ condition }), false); + vmProfile = new LoadBalancerTO.AutoScaleVmProfileTO(zoneId, domainId, cloudStackApiUrl, autoScaleUserApiKey, + autoScaleUserSecretKey, serviceOfferingId, templateId, vmName, networkId, otherDeployParams, + counterParamList, expungeVmGracePeriod); + vmGroup = new LoadBalancerTO.AutoScaleVmGroupTO(vmGroupId, vmGroupUuid, minMembers, maxMembers, memberPort, + interval, Arrays.asList(new LoadBalancerTO.AutoScalePolicyTO[]{ scaleUpPolicy, scaleDownPolicy }), + vmProfile, state, currentState, loadBalancerId); + } + + @Test + public void testCounterTO() { + Assert.assertEquals(counterId, counter.getId()); + Assert.assertEquals(counterName, counter.getName()); + Assert.assertEquals(counterSource, counter.getSource()); + Assert.assertEquals(counterValue, counter.getValue()); + Assert.assertEquals(counterProvider, counter.getProvider()); + } + + @Test + public void testConditionTO() { + Assert.assertEquals(conditionId, condition.getId()); + Assert.assertEquals((long) threshold, condition.getThreshold()); + Assert.assertEquals(relationalOperator, condition.getRelationalOperator()); + Assert.assertEquals(counter, condition.getCounter()); + } + + @Test + public void testAutoScalePolicyTO() { + Assert.assertEquals((long) scaleUpPolicyId, scaleUpPolicy.getId()); + Assert.assertEquals(scaleUpPolicyDuration, scaleUpPolicy.getDuration()); + Assert.assertEquals(scaleUpPolicyQuietTime, scaleUpPolicy.getQuietTime()); + Assert.assertEquals(scaleUpPolicyLastQuietTime, scaleUpPolicy.getLastQuietTime()); + Assert.assertEquals(AutoScalePolicy.Action.SCALEUP, scaleUpPolicy.getAction()); + Assert.assertFalse(scaleUpPolicy.isRevoked()); + List scaleUpPolicyConditions = scaleUpPolicy.getConditions(); + Assert.assertEquals(1, scaleUpPolicyConditions.size()); + Assert.assertEquals(condition, scaleUpPolicyConditions.get(0)); + + Assert.assertEquals((long) scaleDownPolicyId, scaleDownPolicy.getId()); + Assert.assertEquals(scaleDownPolicyDuration, scaleDownPolicy.getDuration()); + Assert.assertEquals(scaleDownPolicyQuietTime, scaleDownPolicy.getQuietTime()); + Assert.assertEquals(scaleDownPolicyLastQuietTime, scaleDownPolicy.getLastQuietTime()); + Assert.assertEquals(AutoScalePolicy.Action.SCALEDOWN, scaleDownPolicy.getAction()); + Assert.assertFalse(scaleDownPolicy.isRevoked()); + List scaleDownPolicyConditions = scaleDownPolicy.getConditions(); + Assert.assertEquals(1, scaleDownPolicyConditions.size()); + Assert.assertEquals(condition, scaleDownPolicyConditions.get(0)); + } + + @Test + public void testAutoScaleVmProfileTO() { + Assert.assertEquals(zoneId, vmProfile.getZoneId()); + Assert.assertEquals(domainId, vmProfile.getDomainId()); + Assert.assertEquals(templateId, vmProfile.getTemplateId()); + Assert.assertEquals(serviceOfferingId, vmProfile.getServiceOfferingId()); + Assert.assertEquals(otherDeployParams, vmProfile.getOtherDeployParams()); + Assert.assertEquals(counterParamList, vmProfile.getCounterParamList()); + Assert.assertEquals(expungeVmGracePeriod, vmProfile.getExpungeVmGracePeriod()); + Assert.assertEquals(cloudStackApiUrl, vmProfile.getCloudStackApiUrl()); + Assert.assertEquals(autoScaleUserApiKey, vmProfile.getAutoScaleUserApiKey()); + Assert.assertEquals(autoScaleUserSecretKey, vmProfile.getAutoScaleUserSecretKey()); + Assert.assertEquals(vmName, vmProfile.getVmName()); + Assert.assertEquals(networkId, vmProfile.getNetworkId()); + } + + @Test + public void testAutoScaleVmGroupTO() { + Assert.assertEquals(vmGroupId, vmGroup.getId()); + Assert.assertEquals(vmGroupUuid, vmGroup.getUuid()); + Assert.assertEquals(minMembers, vmGroup.getMinMembers()); + Assert.assertEquals(maxMembers, vmGroup.getMaxMembers()); + Assert.assertEquals(memberPort, vmGroup.getMemberPort()); + Assert.assertEquals(interval, vmGroup.getInterval()); + Assert.assertEquals(vmProfile, vmGroup.getProfile()); + Assert.assertEquals(state, vmGroup.getState()); + Assert.assertEquals(currentState, vmGroup.getCurrentState()); + Assert.assertEquals(loadBalancerId, vmGroup.getLoadBalancerId()); + + List policies = vmGroup.getPolicies(); + Assert.assertEquals(2, policies.size()); + } +} \ No newline at end of file diff --git a/api/src/test/java/com/cloud/network/as/AutoScalePolicyTest.java b/api/src/test/java/com/cloud/network/as/AutoScalePolicyTest.java new file mode 100644 index 000000000000..b1a41c55e8e8 --- /dev/null +++ b/api/src/test/java/com/cloud/network/as/AutoScalePolicyTest.java @@ -0,0 +1,55 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.network.as; + +import org.junit.Assert; +import org.junit.Test; + +public class AutoScalePolicyTest { + + @Test + public void testScaleUpAction() { + AutoScalePolicy.Action action = AutoScalePolicy.Action.fromValue("scaleup"); + Assert.assertEquals(AutoScalePolicy.Action.SCALEUP, action); + } + + @Test + public void testScaleDownAction() { + AutoScalePolicy.Action action = AutoScalePolicy.Action.fromValue("scaledown"); + Assert.assertEquals(AutoScalePolicy.Action.SCALEDOWN, action); + } + + @Test + public void testNullAction() { + AutoScalePolicy.Action action = AutoScalePolicy.Action.fromValue(null); + Assert.assertNull(action); + } + + @Test + public void testBlankAction() { + AutoScalePolicy.Action action = AutoScalePolicy.Action.fromValue(""); + Assert.assertNull(action); + + action = AutoScalePolicy.Action.fromValue(" "); + Assert.assertNull(action); + } + + @Test(expected = IllegalArgumentException.class) + public void testInvalidAction() { + AutoScalePolicy.Action action = AutoScalePolicy.Action.fromValue("invalid"); + } +} \ No newline at end of file diff --git a/api/src/test/java/com/cloud/network/as/AutoScaleVmGroupTest.java b/api/src/test/java/com/cloud/network/as/AutoScaleVmGroupTest.java new file mode 100644 index 000000000000..133180143901 --- /dev/null +++ b/api/src/test/java/com/cloud/network/as/AutoScaleVmGroupTest.java @@ -0,0 +1,51 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.network.as; + +import org.junit.Assert; +import org.junit.Test; + +public class AutoScaleVmGroupTest { + + private void testAutoScaleVmGroupState(String stateString) { + AutoScaleVmGroup.State state = AutoScaleVmGroup.State.fromValue(stateString); + Assert.assertEquals(state.toString().toLowerCase(), stateString.toLowerCase()); + } + + @Test + public void testAutoScaleVmGroupStates() { + testAutoScaleVmGroupState("new"); + testAutoScaleVmGroupState("Enabled"); + testAutoScaleVmGroupState("DisableD"); + testAutoScaleVmGroupState("REVOKE"); + testAutoScaleVmGroupState("scaling"); + } + + @Test + public void testBlankStates() { + AutoScaleVmGroup.State state = AutoScaleVmGroup.State.fromValue(""); + Assert.assertNull(state); + + state = AutoScaleVmGroup.State.fromValue(" "); + Assert.assertNull(state); + } + + @Test(expected = IllegalArgumentException.class) + public void testInvalidState() { + testAutoScaleVmGroupState("invalid"); + } +} \ No newline at end of file diff --git a/api/src/test/java/com/cloud/network/router/VirtualRouterAutoScaleTest.java b/api/src/test/java/com/cloud/network/router/VirtualRouterAutoScaleTest.java new file mode 100644 index 000000000000..c9c0db45655c --- /dev/null +++ b/api/src/test/java/com/cloud/network/router/VirtualRouterAutoScaleTest.java @@ -0,0 +1,68 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.network.router; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +import com.cloud.network.router.VirtualRouterAutoScale.VirtualRouterAutoScaleCounter; +import com.cloud.network.router.VirtualRouterAutoScale.AutoScaleMetrics; +import com.cloud.network.router.VirtualRouterAutoScale.AutoScaleMetricsValue; +import com.cloud.network.router.VirtualRouterAutoScale.AutoScaleValueType; + +public class VirtualRouterAutoScaleTest { + + private void testVirtualRouterAutoScaleCounter(VirtualRouterAutoScaleCounter counter, String value) { + VirtualRouterAutoScaleCounter counterFromValue = VirtualRouterAutoScaleCounter.fromValue(value); + assertEquals(counter, counterFromValue); + if (counterFromValue != null) { + assertEquals(value, counterFromValue.getValue()); + assertEquals(value, counterFromValue.toString()); + } + } + + @Test + public void testVirtualRouterAutoScaleCounters() { + testVirtualRouterAutoScaleCounter(VirtualRouterAutoScaleCounter.NETWORK_RECEIVED_AVERAGE_MBPS, "public.network.received.average.mbps"); + testVirtualRouterAutoScaleCounter(VirtualRouterAutoScaleCounter.NETWORK_TRANSMIT_AVERAGE_MBPS, "public.network.transmit.average.mbps"); + testVirtualRouterAutoScaleCounter(VirtualRouterAutoScaleCounter.LB_AVERAGE_CONNECTIONS, "virtual.network.lb.average.connections"); + testVirtualRouterAutoScaleCounter(null, "invalid"); + } + + @Test + public void testAutoScaleMetrics() { + AutoScaleMetrics metrics = new AutoScaleMetrics(VirtualRouterAutoScaleCounter.LB_AVERAGE_CONNECTIONS, 1L, 2L, 3L, 4); + + assertEquals(VirtualRouterAutoScaleCounter.LB_AVERAGE_CONNECTIONS, metrics.getCounter()); + assertEquals(1L, (long) metrics.getPolicyId()); + assertEquals(2L, (long) metrics.getConditionId()); + assertEquals(3L, (long) metrics.getCounterId()); + assertEquals(4, (int) metrics.getDuration()); + } + + @Test + public void testAutoScaleMetricsValue() { + AutoScaleMetrics metrics = new AutoScaleMetrics(VirtualRouterAutoScaleCounter.LB_AVERAGE_CONNECTIONS, 1L, 2L, 3L, 4); + + AutoScaleMetricsValue value = new AutoScaleMetricsValue(metrics, AutoScaleValueType.INSTANT_VM, 123.45); + + assertEquals(metrics, value.getMetrics()); + assertEquals(AutoScaleValueType.INSTANT_VM, value.getType()); + assertEquals(123.45, (double) value.getValue(), 0); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/test/CreateAutoScaleVmProfileCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/test/CreateAutoScaleVmProfileCmdTest.java new file mode 100644 index 000000000000..b459b1a358cc --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/test/CreateAutoScaleVmProfileCmdTest.java @@ -0,0 +1,176 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.cloudstack.api.command.test; + +import com.cloud.event.EventTypes; +import com.cloud.exception.ResourceAllocationException; +import com.cloud.network.as.AutoScaleService; +import com.cloud.network.as.AutoScaleVmProfile; +import com.cloud.utils.db.EntityManager; +import org.apache.cloudstack.api.ApiCommandResourceType; +import org.apache.cloudstack.api.ResponseGenerator; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScaleVmProfileCmd; +import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.springframework.test.util.ReflectionTestUtils; + +import java.util.HashMap; +import java.util.Map; + +import static org.mockito.Mockito.when; + +public class CreateAutoScaleVmProfileCmdTest { + private CreateAutoScaleVmProfileCmd createAutoScaleVmProfileCmd; + private AutoScaleService autoScaleService; + private AutoScaleVmProfile autoScaleVmProfile; + private EntityManager entityMgr; + private ResponseGenerator responseGenerator; + private AutoScaleVmProfileResponse response; + + private static final Long domainId = 1L; + private static final Long projectId = 2L; + private static final String accountName = "testuser"; + + private static final Long zoneId = 1L; + private static final Long serviceOfferingId = 2L; + private static final Long templateId = 3L; + private static final String userData = "This is userdata"; + private static final int expungeVmGracePeriod = 30; + private static final Long autoscaleUserId = 4L; + final Map otherDeployParams = new HashMap<>(); + final Map counterParamList = new HashMap<>(); + + @Before + public void setUp() { + otherDeployParams.put("0", new HashMap<>(Map.ofEntries( + Map.entry("name", "rootdisksize"), + Map.entry("value", "10") + ))); + otherDeployParams.put("1", new HashMap<>(Map.ofEntries( + Map.entry("name", "diskofferingid"), + Map.entry("value", "2222-3333-4444") + ))); + otherDeployParams.put("2", new HashMap<>(Map.ofEntries( + Map.entry("name", "size"), + Map.entry("value", "20") + ))); + + autoScaleService = Mockito.spy(AutoScaleService.class); + entityMgr = Mockito.spy(EntityManager.class); + responseGenerator = Mockito.spy(ResponseGenerator.class); + + createAutoScaleVmProfileCmd = new CreateAutoScaleVmProfileCmd(); + ReflectionTestUtils.setField(createAutoScaleVmProfileCmd,"_autoScaleService", autoScaleService); + ReflectionTestUtils.setField(createAutoScaleVmProfileCmd,"_entityMgr", entityMgr); + ReflectionTestUtils.setField(createAutoScaleVmProfileCmd,"_responseGenerator", responseGenerator); + + ReflectionTestUtils.setField(createAutoScaleVmProfileCmd,"zoneId", zoneId); + ReflectionTestUtils.setField(createAutoScaleVmProfileCmd,"serviceOfferingId", serviceOfferingId); + ReflectionTestUtils.setField(createAutoScaleVmProfileCmd,"templateId", templateId); + ReflectionTestUtils.setField(createAutoScaleVmProfileCmd,"userData", userData); + ReflectionTestUtils.setField(createAutoScaleVmProfileCmd,"expungeVmGracePeriod", expungeVmGracePeriod); + ReflectionTestUtils.setField(createAutoScaleVmProfileCmd,"autoscaleUserId", autoscaleUserId); + ReflectionTestUtils.setField(createAutoScaleVmProfileCmd,"otherDeployParams", otherDeployParams); + ReflectionTestUtils.setField(createAutoScaleVmProfileCmd,"counterParamList", counterParamList); + ReflectionTestUtils.setField(createAutoScaleVmProfileCmd,"domainId", domainId); + ReflectionTestUtils.setField(createAutoScaleVmProfileCmd,"projectId", projectId); + ReflectionTestUtils.setField(createAutoScaleVmProfileCmd,"accountName", accountName); + + autoScaleVmProfile = Mockito.mock(AutoScaleVmProfile.class); + + response = new AutoScaleVmProfileResponse(); + response.setUserData(userData); + response.setExpungeVmGracePeriod(expungeVmGracePeriod); + } + + @Test + public void verifyCreateAutoScaleVmProfileCmd() { + Assert.assertEquals(zoneId, createAutoScaleVmProfileCmd.getZoneId()); + Assert.assertEquals(serviceOfferingId, createAutoScaleVmProfileCmd.getServiceOfferingId()); + Assert.assertEquals(templateId, createAutoScaleVmProfileCmd.getTemplateId()); + Assert.assertNull(createAutoScaleVmProfileCmd.getDisplay()); + Assert.assertTrue(createAutoScaleVmProfileCmd.isDisplay()); + Assert.assertEquals(userData, createAutoScaleVmProfileCmd.getUserData()); + Assert.assertEquals(autoscaleUserId, createAutoScaleVmProfileCmd.getAutoscaleUserId()); + Assert.assertEquals(expungeVmGracePeriod, (long) createAutoScaleVmProfileCmd.getExpungeVmGracePeriod()); + Assert.assertEquals(counterParamList, createAutoScaleVmProfileCmd.getCounterParamList()); + Assert.assertEquals(otherDeployParams, createAutoScaleVmProfileCmd.getOtherDeployParams()); + Assert.assertEquals(domainId, createAutoScaleVmProfileCmd.getDomainId()); + Assert.assertEquals(projectId, createAutoScaleVmProfileCmd.getProjectId()); + Assert.assertEquals(accountName, createAutoScaleVmProfileCmd.getAccountName()); + + Assert.assertEquals("autoscalevmprofileresponse", createAutoScaleVmProfileCmd.getCommandName()); + Assert.assertEquals("autoscalevmprofile", CreateAutoScaleVmProfileCmd.getResultObjectName()); + Assert.assertEquals(EventTypes.EVENT_AUTOSCALEVMPROFILE_CREATE, createAutoScaleVmProfileCmd.getEventType()); + Assert.assertEquals("creating AutoScale Vm Profile", createAutoScaleVmProfileCmd.getEventDescription()); + Assert.assertEquals(ApiCommandResourceType.AutoScaleVmProfile, createAutoScaleVmProfileCmd.getApiResourceType()); + } + + @Test + public void verifyCreateAutoScaleVmProfileCmdParams() { + HashMap deployParamMap = createAutoScaleVmProfileCmd.getDeployParamMap(); + Assert.assertEquals(otherDeployParams.size() + 4, deployParamMap.size()); + Assert.assertEquals("deployVirtualMachine", deployParamMap.get("command")); + Assert.assertEquals(zoneId.toString(), deployParamMap.get("zoneId")); + Assert.assertEquals(serviceOfferingId.toString(), deployParamMap.get("serviceOfferingId")); + Assert.assertEquals(templateId.toString(), deployParamMap.get("templateId")); + Assert.assertEquals("10", deployParamMap.get("rootdisksize")); + Assert.assertEquals("2222-3333-4444", deployParamMap.get("diskofferingid")); + Assert.assertEquals("20", deployParamMap.get("size")); + } + + @Test + public void testCreateAutoScaleVmProfileSuccess() { + when(autoScaleVmProfile.getId()).thenReturn(1L); + when(autoScaleVmProfile.getUuid()).thenReturn("1111-2222-3333-4444"); + when(autoScaleService.createAutoScaleVmProfile(createAutoScaleVmProfileCmd)).thenReturn(autoScaleVmProfile); + + try { + createAutoScaleVmProfileCmd.create(); + } catch (ResourceAllocationException ex) { + Assert.fail("Got exception: " + ex.getMessage()); + } + Assert.assertEquals(1L, (long) createAutoScaleVmProfileCmd.getEntityId()); + + when(entityMgr.findById(AutoScaleVmProfile.class, 1L)).thenReturn(autoScaleVmProfile); + when(responseGenerator.createAutoScaleVmProfileResponse(autoScaleVmProfile)).thenReturn(response); + + createAutoScaleVmProfileCmd.execute(); + + AutoScaleVmProfileResponse autoScaleVmProfileResponse = (AutoScaleVmProfileResponse) createAutoScaleVmProfileCmd.getResponseObject(); + Assert.assertEquals(createAutoScaleVmProfileCmd.getCommandName(), autoScaleVmProfileResponse.getResponseName()); + Assert.assertEquals(userData, ReflectionTestUtils.getField(autoScaleVmProfileResponse, "userData")); + Assert.assertEquals(expungeVmGracePeriod, (int) ReflectionTestUtils.getField(autoScaleVmProfileResponse, "expungeVmGracePeriod")); + } + + @Test(expected = ServerApiException.class) + public void testCreateAutoScaleVmProfileFail() { + when(autoScaleService.createAutoScaleVmProfile(createAutoScaleVmProfileCmd)).thenReturn(null); + + try { + createAutoScaleVmProfileCmd.create(); + } catch (ResourceAllocationException ex) { + Assert.fail("Got exception: " + ex.getMessage()); + } + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/test/UpdateAutoScaleVmProfileCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/test/UpdateAutoScaleVmProfileCmdTest.java new file mode 100644 index 000000000000..bf387e8216e8 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/test/UpdateAutoScaleVmProfileCmdTest.java @@ -0,0 +1,129 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.cloudstack.api.command.test; + +import com.cloud.event.EventTypes; +import com.cloud.network.as.AutoScaleService; +import com.cloud.network.as.AutoScaleVmProfile; +import com.cloud.utils.db.EntityManager; +import org.apache.cloudstack.api.ResponseGenerator; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScaleVmProfileCmd; +import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.springframework.test.util.ReflectionTestUtils; + +import java.util.HashMap; +import java.util.Map; + +import static org.mockito.Mockito.when; + +public class UpdateAutoScaleVmProfileCmdTest { + private UpdateAutoScaleVmProfileCmd updateAutoScaleVmProfileCmd; + private AutoScaleService autoScaleService; + private AutoScaleVmProfile autoScaleVmProfile; + private EntityManager entityMgr; + private ResponseGenerator responseGenerator; + private AutoScaleVmProfileResponse response; + + private static final Long profileId = 1L; + private static final Long serviceOfferingId = 2L; + private static final Long templateId = 3L; + private static final String userData = "This is userdata"; + private static final int expungeVmGracePeriod = 30; + private static final Long autoscaleUserId = 4L; + final Map otherDeployParams = new HashMap<>(); + final Map counterParamList = new HashMap<>(); + + @Before + public void setUp() { + otherDeployParams.put("rootdiskdize", "10"); + otherDeployParams.put("diskofferingid", "2222-3333-4444"); + otherDeployParams.put("size", "20"); + + autoScaleService = Mockito.spy(AutoScaleService.class); + entityMgr = Mockito.spy(EntityManager.class); + responseGenerator = Mockito.spy(ResponseGenerator.class); + + updateAutoScaleVmProfileCmd = new UpdateAutoScaleVmProfileCmd(); + ReflectionTestUtils.setField(updateAutoScaleVmProfileCmd,"_autoScaleService", autoScaleService); + ReflectionTestUtils.setField(updateAutoScaleVmProfileCmd,"_entityMgr", entityMgr); + ReflectionTestUtils.setField(updateAutoScaleVmProfileCmd,"_responseGenerator", responseGenerator); + + ReflectionTestUtils.setField(updateAutoScaleVmProfileCmd,"id", profileId); + ReflectionTestUtils.setField(updateAutoScaleVmProfileCmd,"serviceOfferingId", serviceOfferingId); + ReflectionTestUtils.setField(updateAutoScaleVmProfileCmd,"templateId", templateId); + ReflectionTestUtils.setField(updateAutoScaleVmProfileCmd,"userData", userData); + ReflectionTestUtils.setField(updateAutoScaleVmProfileCmd,"expungeVmGracePeriod", expungeVmGracePeriod); + ReflectionTestUtils.setField(updateAutoScaleVmProfileCmd,"autoscaleUserId", autoscaleUserId); + ReflectionTestUtils.setField(updateAutoScaleVmProfileCmd,"otherDeployParams", otherDeployParams); + ReflectionTestUtils.setField(updateAutoScaleVmProfileCmd,"counterParamList", counterParamList); + + autoScaleVmProfile = Mockito.mock(AutoScaleVmProfile.class); + + response = new AutoScaleVmProfileResponse(); + response.setUserData(userData); + response.setExpungeVmGracePeriod(expungeVmGracePeriod); + } + + @Test + public void verifyUpdateAutoScaleVmProfileCmd() { + Assert.assertEquals(profileId, updateAutoScaleVmProfileCmd.getId()); + Assert.assertEquals(serviceOfferingId, updateAutoScaleVmProfileCmd.getServiceOfferingId()); + Assert.assertEquals(templateId, updateAutoScaleVmProfileCmd.getTemplateId()); + Assert.assertNull(updateAutoScaleVmProfileCmd.getDisplay()); + Assert.assertTrue(updateAutoScaleVmProfileCmd.isDisplay()); + Assert.assertEquals(userData, updateAutoScaleVmProfileCmd.getUserData()); + Assert.assertEquals(autoscaleUserId, updateAutoScaleVmProfileCmd.getAutoscaleUserId()); + Assert.assertEquals(expungeVmGracePeriod, (long) updateAutoScaleVmProfileCmd.getExpungeVmGracePeriod()); + Assert.assertEquals(counterParamList, updateAutoScaleVmProfileCmd.getCounterParamList()); + Assert.assertEquals(otherDeployParams, updateAutoScaleVmProfileCmd.getOtherDeployParams()); + + Assert.assertEquals("updateautoscalevmprofileresponse", updateAutoScaleVmProfileCmd.getCommandName()); + Assert.assertEquals(EventTypes.EVENT_AUTOSCALEVMPROFILE_UPDATE, updateAutoScaleVmProfileCmd.getEventType()); + Assert.assertEquals("Updating AutoScale Vm Profile. Vm Profile Id: " + profileId, updateAutoScaleVmProfileCmd.getEventDescription()); + } + + @Test + public void testUpdateAutoScaleVmProfileSuccess() { + when(autoScaleVmProfile.getId()).thenReturn(1L); + when(autoScaleVmProfile.getUuid()).thenReturn("1111-2222-3333-4444"); + when(autoScaleService.updateAutoScaleVmProfile(updateAutoScaleVmProfileCmd)).thenReturn(autoScaleVmProfile); + + when(entityMgr.findById(AutoScaleVmProfile.class, 1L)).thenReturn(autoScaleVmProfile); + when(responseGenerator.createAutoScaleVmProfileResponse(autoScaleVmProfile)).thenReturn(response); + + updateAutoScaleVmProfileCmd.execute(); + + AutoScaleVmProfileResponse autoScaleVmProfileResponse = (AutoScaleVmProfileResponse) updateAutoScaleVmProfileCmd.getResponseObject(); + Assert.assertEquals(updateAutoScaleVmProfileCmd.getCommandName(), autoScaleVmProfileResponse.getResponseName()); + Assert.assertEquals(userData, ReflectionTestUtils.getField(autoScaleVmProfileResponse, "userData")); + Assert.assertEquals(expungeVmGracePeriod, (int) ReflectionTestUtils.getField(autoScaleVmProfileResponse, "expungeVmGracePeriod")); + } + + @Test(expected = ServerApiException.class) + public void testUpdateAutoScaleVmProfileFail() { + when(autoScaleService.updateAutoScaleVmProfile(updateAutoScaleVmProfileCmd)).thenReturn(null); + + updateAutoScaleVmProfileCmd.execute(); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/test/UpdateConditionCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/test/UpdateConditionCmdTest.java new file mode 100644 index 000000000000..7d6f8dc35b7e --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/test/UpdateConditionCmdTest.java @@ -0,0 +1,132 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.cloudstack.api.command.test; + +import com.cloud.event.EventTypes; +import com.cloud.exception.ResourceInUseException; +import com.cloud.network.as.AutoScaleService; +import com.cloud.network.as.Condition; +import com.cloud.user.Account; +import com.cloud.utils.db.EntityManager; + +import org.apache.cloudstack.api.ApiCommandResourceType; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.ResponseGenerator; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.command.user.autoscale.UpdateConditionCmd; +import org.apache.cloudstack.api.response.ConditionResponse; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.springframework.test.util.ReflectionTestUtils; + +import static org.mockito.Mockito.when; + +public class UpdateConditionCmdTest { + + private UpdateConditionCmd updateConditionCmd; + private Condition condition; + + private AutoScaleService autoScaleService; + private EntityManager entityMgr; + private ResponseGenerator responseGenerator; + + private static final Long conditionId = 10L; + private static final String relationalOperator = "GT"; + private static final Long threshold = 100L; + + private static final long accountId = 5L; + + @Before + public void setUp() { + + autoScaleService = Mockito.spy(AutoScaleService.class); + entityMgr = Mockito.spy(EntityManager.class); + responseGenerator = Mockito.spy(ResponseGenerator.class); + + updateConditionCmd = new UpdateConditionCmd(); + + ReflectionTestUtils.setField(updateConditionCmd,"_autoScaleService", autoScaleService); + ReflectionTestUtils.setField(updateConditionCmd,"_entityMgr", entityMgr); + ReflectionTestUtils.setField(updateConditionCmd,"_responseGenerator", responseGenerator); + + ReflectionTestUtils.setField(updateConditionCmd,"id", conditionId); + ReflectionTestUtils.setField(updateConditionCmd,"relationalOperator", relationalOperator); + ReflectionTestUtils.setField(updateConditionCmd,"threshold", threshold); + + condition = Mockito.mock(Condition.class); + } + + @Test + public void verifyUpdateConditionCmd() { + Assert.assertEquals(conditionId, updateConditionCmd.getId()); + Assert.assertEquals(relationalOperator, updateConditionCmd.getRelationalOperator()); + Assert.assertEquals(threshold, updateConditionCmd.getThreshold()); + + Assert.assertEquals(ApiCommandResourceType.Condition, updateConditionCmd.getApiResourceType()); + Assert.assertEquals("updateconditionresponse", updateConditionCmd.getCommandName()); + Assert.assertEquals(EventTypes.EVENT_CONDITION_UPDATE, updateConditionCmd.getEventType()); + Assert.assertEquals("Updating a condition.", updateConditionCmd.getEventDescription()); + + when(entityMgr.findById(Condition.class, conditionId)).thenReturn(condition); + when(condition.getAccountId()).thenReturn(accountId); + Assert.assertEquals(accountId, updateConditionCmd.getEntityOwnerId()); + + when(entityMgr.findById(Condition.class, conditionId)).thenReturn(null); + Assert.assertEquals(Account.ACCOUNT_ID_SYSTEM, updateConditionCmd.getEntityOwnerId()); + } + + @Test + public void testCreateSuccess() { + try { + Mockito.when(autoScaleService.updateCondition(Mockito.any(UpdateConditionCmd.class))).thenReturn(condition); + } catch (ResourceInUseException ex) { + Assert.fail("Got exception: " + ex.getMessage()); + } + ConditionResponse conditionResponse = Mockito.mock(ConditionResponse.class); + Mockito.when(responseGenerator.createConditionResponse(condition)).thenReturn(conditionResponse); + + try { + updateConditionCmd.execute(); + } catch (Exception ex) { + Assert.fail("Got exception: " + ex.getMessage()); + } + + Mockito.verify(responseGenerator).createConditionResponse(condition); + } + + @Test + public void testCreateFailure() { + + ResourceInUseException exception = new ResourceInUseException("Resource in use"); + try { + Mockito.when(autoScaleService.updateCondition(Mockito.any(UpdateConditionCmd.class))).thenThrow(exception); + } catch (ResourceInUseException ex) { + Assert.fail("Got exception: " + ex.getMessage()); + } + + try { + updateConditionCmd.execute(); + } catch (ServerApiException ex) { + Assert.assertEquals(ApiErrorCode.RESOURCE_IN_USE_ERROR, ex.getErrorCode()); + Assert.assertEquals("Resource in use", ex.getDescription()); + } + } +} diff --git a/core/src/main/java/com/cloud/agent/api/NetworkUsageCommand.java b/core/src/main/java/com/cloud/agent/api/NetworkUsageCommand.java index 66d44e9110de..abbf4428c7d5 100644 --- a/core/src/main/java/com/cloud/agent/api/NetworkUsageCommand.java +++ b/core/src/main/java/com/cloud/agent/api/NetworkUsageCommand.java @@ -21,7 +21,7 @@ import com.cloud.agent.api.LogLevel.Log4jLevel; -@LogLevel(Log4jLevel.Trace) +@LogLevel(Log4jLevel.Debug) public class NetworkUsageCommand extends Command { private String privateIP; private String domRName; diff --git a/core/src/main/java/com/cloud/agent/api/routing/GetAutoScaleMetricsAnswer.java b/core/src/main/java/com/cloud/agent/api/routing/GetAutoScaleMetricsAnswer.java new file mode 100644 index 000000000000..80491ad9c73c --- /dev/null +++ b/core/src/main/java/com/cloud/agent/api/routing/GetAutoScaleMetricsAnswer.java @@ -0,0 +1,51 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package com.cloud.agent.api.routing; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.Command; +import com.cloud.agent.api.LogLevel; +import com.cloud.agent.api.LogLevel.Log4jLevel; +import com.cloud.network.router.VirtualRouterAutoScale.AutoScaleMetricsValue; + +import java.util.ArrayList; +import java.util.List; + +@LogLevel(Log4jLevel.Debug) +public class GetAutoScaleMetricsAnswer extends Answer { + private List values; + + public GetAutoScaleMetricsAnswer(Command cmd, boolean success) { + super(cmd, success, null); + this.values = new ArrayList<>(); + } + + public GetAutoScaleMetricsAnswer(Command cmd, boolean success, List values) { + super(cmd, success, null); + this.values = values; + } + + + public void addValue(AutoScaleMetricsValue value) { + this.values.add(value); + } + + public List getValues() { + return values; + } +} diff --git a/core/src/main/java/com/cloud/agent/api/routing/GetAutoScaleMetricsCommand.java b/core/src/main/java/com/cloud/agent/api/routing/GetAutoScaleMetricsCommand.java new file mode 100644 index 000000000000..2614c23220f7 --- /dev/null +++ b/core/src/main/java/com/cloud/agent/api/routing/GetAutoScaleMetricsCommand.java @@ -0,0 +1,65 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package com.cloud.agent.api.routing; + +import com.cloud.agent.api.Command; +import com.cloud.network.router.VirtualRouterAutoScale.AutoScaleMetrics; + +import java.util.List; + +public class GetAutoScaleMetricsCommand extends Command { + + private String privateIP; + boolean forVpc = false; + private String publicIP; + private Integer port; + private List metrics; + + public GetAutoScaleMetricsCommand(String privateIP, boolean forVpc, String publicIP, Integer port, List metrics) { + this.privateIP = privateIP; + this.forVpc = forVpc; + this.publicIP = publicIP; + this.port = port; + this.metrics = metrics; + } + + public String getPrivateIP() { + return privateIP; + } + + public boolean isForVpc() { + return forVpc; + } + + public String getPublicIP() { + return publicIP; + } + + public Integer getPort() { + return port; + } + + public List getMetrics() { + return metrics; + } + + @Override + public boolean executeInSequence() { + return false; + } +} \ No newline at end of file diff --git a/core/src/main/java/com/cloud/network/HAProxyConfigurator.java b/core/src/main/java/com/cloud/network/HAProxyConfigurator.java index 98eeef8d3aad..32077c1665ee 100644 --- a/core/src/main/java/com/cloud/network/HAProxyConfigurator.java +++ b/core/src/main/java/com/cloud/network/HAProxyConfigurator.java @@ -44,10 +44,10 @@ public class HAProxyConfigurator implements LoadBalancerConfigurator { private static final Logger s_logger = Logger.getLogger(HAProxyConfigurator.class); private static final String blankLine = "\t "; private static String[] globalSection = {"global", "\tlog 127.0.0.1:3914 local0 warning", "\tmaxconn 4096", "\tmaxpipes 1024", "\tchroot /var/lib/haproxy", - "\tuser haproxy", "\tgroup haproxy", "\tdaemon"}; + "\tuser haproxy", "\tgroup haproxy", "\tstats socket /run/haproxy/admin.sock", "\tdaemon"}; private static String[] defaultsSection = {"defaults", "\tlog global", "\tmode tcp", "\toption dontlognull", "\tretries 3", "\toption redispatch", - "\toption forwardfor", "\toption forceclose", "\ttimeout connect 5000", "\ttimeout client 50000", "\ttimeout server 50000"}; + "\toption forwardfor", "\toption httpclose", "\ttimeout connect 5000", "\ttimeout client 50000", "\ttimeout server 50000"}; private static String[] defaultListen = {"listen vmops", "\tbind 0.0.0.0:9", "\toption transparent"}; @@ -603,7 +603,7 @@ public String[] generateConfiguration(final LoadBalancerConfigCommand lbCmd) { result.add(blankLine); final List dSection = Arrays.asList(defaultsSection); if (lbCmd.keepAliveEnabled) { - dSection.set(7, "\tno option forceclose"); + dSection.set(7, "\tno option httpclose"); } if (s_logger.isDebugEnabled()) { diff --git a/core/src/test/java/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResourceTest.java b/core/src/test/java/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResourceTest.java index 6eb30aeeed9e..1e384abcd613 100644 --- a/core/src/test/java/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResourceTest.java +++ b/core/src/test/java/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResourceTest.java @@ -829,7 +829,7 @@ protected void verifyFile(final LoadBalancerConfigCommand cmd, final String path "\tretries 3\n" + "\toption redispatch\n" + "\toption forwardfor\n" + - "\toption forceclose\n" + + "\toption httpclose\n" + "\ttimeout connect 5000\n" + "\ttimeout client 50000\n" + "\ttimeout server 50000\n" + diff --git a/core/src/test/java/org/apache/cloudstack/api/agent/test/GetAutoScaleMetricsAnswerTest.java b/core/src/test/java/org/apache/cloudstack/api/agent/test/GetAutoScaleMetricsAnswerTest.java new file mode 100644 index 000000000000..3123751dfbd6 --- /dev/null +++ b/core/src/test/java/org/apache/cloudstack/api/agent/test/GetAutoScaleMetricsAnswerTest.java @@ -0,0 +1,93 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// + +package org.apache.cloudstack.api.agent.test; + +import com.cloud.agent.api.routing.GetAutoScaleMetricsAnswer; +import com.cloud.agent.api.routing.GetAutoScaleMetricsCommand; +import com.cloud.network.router.VirtualRouterAutoScale; +import com.cloud.network.router.VirtualRouterAutoScale.AutoScaleMetrics; +import com.cloud.network.router.VirtualRouterAutoScale.AutoScaleMetricsValue; +import com.cloud.network.router.VirtualRouterAutoScale.VirtualRouterAutoScaleCounter; + +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.Assert.*; + +public class GetAutoScaleMetricsAnswerTest { + private GetAutoScaleMetricsCommand command; + + private static final String privateIp = "privateip"; + private static final String publicIP = "publicIP"; + private static final Integer port = 8080; + + List metrics = new ArrayList<>(); + + @Before + public void setUp() { + metrics.add(new AutoScaleMetrics(VirtualRouterAutoScaleCounter.LB_AVERAGE_CONNECTIONS, 1L, 2L, 3L, 4)); + metrics.add(new AutoScaleMetrics(VirtualRouterAutoScaleCounter.NETWORK_RECEIVED_AVERAGE_MBPS, 1L, 2L, 3L, 4)); + metrics.add(new AutoScaleMetrics(VirtualRouterAutoScaleCounter.NETWORK_TRANSMIT_AVERAGE_MBPS, 1L, 2L, 3L, 4)); + + command = new GetAutoScaleMetricsCommand(privateIp, true, publicIP, port, metrics); + } + + @Test + public void testFalseAnswer() { + GetAutoScaleMetricsAnswer answer = new GetAutoScaleMetricsAnswer(command, false); + + assertFalse(answer.getResult()); + assertEquals(0, answer.getValues().size()); + } + + @Test + public void testTrueAnswer() { + GetAutoScaleMetricsAnswer answer = new GetAutoScaleMetricsAnswer(command, true); + + assertTrue(answer.getResult()); + assertEquals(0, answer.getValues().size()); + } + + @Test + public void testAnswerWithValue() { + GetAutoScaleMetricsAnswer answer = new GetAutoScaleMetricsAnswer(command, true, new ArrayList<>()); + + assertTrue(answer.getResult()); + assertEquals(0, answer.getValues().size()); + + answer.addValue(new AutoScaleMetricsValue(metrics.get(0), VirtualRouterAutoScale.AutoScaleValueType.INSTANT_VM, Double.valueOf(1))); + assertEquals(1, answer.getValues().size()); + assertEquals(metrics.get(0), answer.getValues().get(0).getMetrics()); + assertEquals(Double.valueOf(1), answer.getValues().get(0).getValue()); + + answer.addValue(new AutoScaleMetricsValue(metrics.get(1), VirtualRouterAutoScale.AutoScaleValueType.INSTANT_VM, Double.valueOf(2))); + assertEquals(2, answer.getValues().size()); + assertEquals(metrics.get(1), answer.getValues().get(1).getMetrics()); + assertEquals(Double.valueOf(2), answer.getValues().get(1).getValue()); + + answer.addValue(new AutoScaleMetricsValue(metrics.get(2), VirtualRouterAutoScale.AutoScaleValueType.INSTANT_VM, Double.valueOf(3))); + assertEquals(3, answer.getValues().size()); + assertEquals(metrics.get(2), answer.getValues().get(2).getMetrics()); + assertEquals(Double.valueOf(3), answer.getValues().get(2).getValue()); + } +} diff --git a/core/src/test/java/org/apache/cloudstack/api/agent/test/GetAutoScaleMetricsCommandTest.java b/core/src/test/java/org/apache/cloudstack/api/agent/test/GetAutoScaleMetricsCommandTest.java new file mode 100644 index 000000000000..648b8ffa32b9 --- /dev/null +++ b/core/src/test/java/org/apache/cloudstack/api/agent/test/GetAutoScaleMetricsCommandTest.java @@ -0,0 +1,77 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// + +package org.apache.cloudstack.api.agent.test; + +import com.cloud.agent.api.routing.GetAutoScaleMetricsCommand; +import org.junit.Before; +import org.junit.Test; + +import com.cloud.network.router.VirtualRouterAutoScale.AutoScaleMetrics; +import com.cloud.network.router.VirtualRouterAutoScale.VirtualRouterAutoScaleCounter; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +public class GetAutoScaleMetricsCommandTest { + + private static final String privateIp = "privateip"; + private static final String publicIP = "publicIP"; + private static final Integer port = 8080; + + List metrics = new ArrayList<>(); + + @Before + public void setUp() { + metrics.add(new AutoScaleMetrics(VirtualRouterAutoScaleCounter.LB_AVERAGE_CONNECTIONS, 1L, 2L, 3L, 4)); + metrics.add(new AutoScaleMetrics(VirtualRouterAutoScaleCounter.NETWORK_RECEIVED_AVERAGE_MBPS, 1L, 2L, 3L, 4)); + metrics.add(new AutoScaleMetrics(VirtualRouterAutoScaleCounter.NETWORK_TRANSMIT_AVERAGE_MBPS, 1L, 2L, 3L, 4)); + } + + @Test + public void testCommandForVpc() { + GetAutoScaleMetricsCommand command = new GetAutoScaleMetricsCommand(privateIp, true, publicIP, port, metrics); + + assertEquals(privateIp, command.getPrivateIP()); + assertEquals(publicIP, command.getPublicIP()); + assertTrue(command.isForVpc()); + assertEquals(port, command.getPort()); + assertNotNull(command.getMetrics()); + assertEquals(3, command.getMetrics().size()); + assertFalse(command.executeInSequence()); + } + @Test + + public void testCommandForNetwork() { + GetAutoScaleMetricsCommand command = new GetAutoScaleMetricsCommand(privateIp, false, publicIP, port, metrics); + + assertEquals(privateIp, command.getPrivateIP()); + assertEquals(publicIP, command.getPublicIP()); + assertFalse(command.isForVpc()); + assertEquals(port, command.getPort()); + assertNotNull(command.getMetrics()); + assertEquals(3, command.getMetrics().size()); + assertFalse(command.executeInSequence()); + } +} diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntity.java b/engine/api/src/main/java/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntity.java index 7b34077676c3..c0a4655a387d 100644 --- a/engine/api/src/main/java/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntity.java +++ b/engine/api/src/main/java/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntity.java @@ -132,7 +132,7 @@ void deploy(String reservationId, String caller, Map getEntityType() { @Override public String getName() { - return null; + return name; } + public void setName(String name) { + this.name = name; + } } diff --git a/engine/schema/src/main/java/com/cloud/network/as/AutoScaleVmGroupStatisticsVO.java b/engine/schema/src/main/java/com/cloud/network/as/AutoScaleVmGroupStatisticsVO.java new file mode 100644 index 000000000000..8ca88abc226e --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/network/as/AutoScaleVmGroupStatisticsVO.java @@ -0,0 +1,168 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.network.as; + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import com.cloud.network.router.VirtualRouterAutoScale; +import com.cloud.server.ResourceTag; +import org.apache.cloudstack.api.InternalIdentity; + +@Entity +@Table(name = "autoscale_vmgroup_statistics") +public class AutoScaleVmGroupStatisticsVO implements InternalIdentity { + + public enum State { + ACTIVE, INACTIVE + } + + public static final double INVALID_VALUE = -1; + public static final long DUMMY_ID = 0L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name = "vmgroup_id") + private long vmGroupId; + + @Column(name = "policy_id") + private long policyId; + + @Column(name = "counter_id") + private long counterId; + + @Column(name = "resource_id") + private Long resourceId; + + @Column(name = "resource_type") + @Enumerated(value = EnumType.STRING) + private ResourceTag.ResourceObjectType resourceType; + + @Column(name = "raw_value") + private Double rawValue = null; + + @Column(name = "value_type") + @Enumerated(value = EnumType.STRING) + private VirtualRouterAutoScale.AutoScaleValueType valueType; + + @Column(name = "created") + @Temporal(value = TemporalType.TIMESTAMP) + private Date created = null; + + @Column(name = "state") + @Enumerated(EnumType.STRING) + State state; + + public AutoScaleVmGroupStatisticsVO() { + } + + public AutoScaleVmGroupStatisticsVO(long vmGroupId, long policyId, long counterId, Long resourceId, ResourceTag.ResourceObjectType resourceType, + Double rawValue, VirtualRouterAutoScale.AutoScaleValueType valueType, Date created) { + this.vmGroupId = vmGroupId; + this.policyId = policyId; + this.counterId = counterId; + this.resourceId = resourceId; + this.resourceType = resourceType; + this.rawValue = rawValue; + this.valueType = valueType; + this.created = created; + this.state = State.ACTIVE; + } + + public AutoScaleVmGroupStatisticsVO(long vmGroupId, long policyId, long counterId, Long resourceId, ResourceTag.ResourceObjectType resourceType, + VirtualRouterAutoScale.AutoScaleValueType valueType, Date created) { + this.vmGroupId = vmGroupId; + this.policyId = policyId; + this.counterId = counterId; + this.resourceId = resourceId; + this.resourceType = resourceType; + this.rawValue = INVALID_VALUE; + this.valueType = valueType; + this.created = created; + this.state = State.INACTIVE; + } + + public AutoScaleVmGroupStatisticsVO(long vmGroupId) { + this.vmGroupId = vmGroupId; + this.policyId = DUMMY_ID; + this.counterId = DUMMY_ID; + this.resourceId = vmGroupId; + this.resourceType = ResourceTag.ResourceObjectType.AutoScaleVmGroup; + this.rawValue = INVALID_VALUE; + this.valueType = VirtualRouterAutoScale.AutoScaleValueType.INSTANT_VM_GROUP; + this.created = new Date(); + this.state = State.INACTIVE; + } + + @Override + public long getId() { + return id; + } + + public long getVmGroupId() { + return vmGroupId; + } + + public long getPolicyId() { + return policyId; + } + + public long getCounterId() { + return counterId; + } + + public Long getResourceId() { + return resourceId; + } + + public ResourceTag.ResourceObjectType getResourceType() { + return resourceType; + } + + public Double getRawValue() { + return rawValue; + } + + public VirtualRouterAutoScale.AutoScaleValueType getValueType() { + return valueType; + } + + public Date getCreated() { + return created; + } + + public State getState() { + return state; + } + + public void setState(State state) { + this.state = state; + } +} diff --git a/engine/schema/src/main/java/com/cloud/network/as/AutoScaleVmGroupVO.java b/engine/schema/src/main/java/com/cloud/network/as/AutoScaleVmGroupVO.java index ea8eaf68806d..652cbb340a32 100644 --- a/engine/schema/src/main/java/com/cloud/network/as/AutoScaleVmGroupVO.java +++ b/engine/schema/src/main/java/com/cloud/network/as/AutoScaleVmGroupVO.java @@ -30,14 +30,16 @@ import javax.persistence.Temporal; import javax.persistence.TemporalType; +import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; +import org.apache.commons.lang3.StringUtils; import com.cloud.utils.db.GenericDao; @Entity @Table(name = "autoscale_vmgroups") @Inheritance(strategy = InheritanceType.JOINED) -public class AutoScaleVmGroupVO implements AutoScaleVmGroup, InternalIdentity { +public class AutoScaleVmGroupVO implements AutoScaleVmGroup, InternalIdentity, Identity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @@ -59,6 +61,9 @@ public class AutoScaleVmGroupVO implements AutoScaleVmGroup, InternalIdentity { @Column(name = "load_balancer_id") private Long loadBalancerId; + @Column(name = "name") + String name; + @Column(name = "min_members", updatable = true) private int minMembers; @@ -85,20 +90,28 @@ public class AutoScaleVmGroupVO implements AutoScaleVmGroup, InternalIdentity { protected Date created; @Column(name = "state") - private String state; + private State state; @Column(name = "display", updatable = true, nullable = false) protected boolean display = true; + @Column(name = "next_vm_seq") + private long nextVmSeq = 1L; + public AutoScaleVmGroupVO() { } public AutoScaleVmGroupVO(long lbRuleId, long zoneId, long domainId, - long accountId, int minMembers, int maxMembers, int memberPort, - int interval, Date lastInterval, long profileId, String state) { + long accountId, String name, int minMembers, int maxMembers, int memberPort, + int interval, Date lastInterval, long profileId, State state) { uuid = UUID.randomUUID().toString(); loadBalancerId = lbRuleId; + if (StringUtils.isBlank(name)) { + this.name = uuid; + } else { + this.name = name; + } this.minMembers = minMembers; this.maxMembers = maxMembers; this.memberPort = memberPort; @@ -113,7 +126,11 @@ public AutoScaleVmGroupVO(long lbRuleId, long zoneId, long domainId, @Override public String toString() { - return new StringBuilder("AutoScaleVmGroupVO[").append("id").append("]").toString(); + return new StringBuilder("AutoScaleVmGroupVO[").append("id=").append(id) + .append("|name=").append(name) + .append("|loadBalancerId=").append(loadBalancerId) + .append("|profileId=").append(profileId) + .append("]").toString(); } @Override @@ -140,6 +157,11 @@ public Long getLoadBalancerId() { return loadBalancerId; } + @Override + public String getName() { + return name; + } + @Override public int getMinMembers() { return minMembers; @@ -174,19 +196,24 @@ public Date getRemoved() { return removed; } + @Override public Date getCreated() { return created; } @Override - public String getState() { + public State getState() { return state; } - public void setState(String state) { + public void setState(State state) { this.state = state; } + public void setName(String name) { + this.name = name; + } + public void setMinMembers(int minMembers) { this.minMembers = minMembers; } @@ -225,13 +252,16 @@ public boolean isDisplay() { return display; } - @Override - public Class getEntityType() { - return AutoScaleVmGroup.class; + public long getNextVmSeq() { + return nextVmSeq; + } + + public void setNextVmSeq(long nextVmSeq) { + this.nextVmSeq = nextVmSeq; } @Override - public String getName() { - return null; + public Class getEntityType() { + return AutoScaleVmGroup.class; } } diff --git a/engine/schema/src/main/java/com/cloud/network/as/AutoScaleVmProfileVO.java b/engine/schema/src/main/java/com/cloud/network/as/AutoScaleVmProfileVO.java index eb7e34a8789a..0a0ba1e62aa0 100644 --- a/engine/schema/src/main/java/com/cloud/network/as/AutoScaleVmProfileVO.java +++ b/engine/schema/src/main/java/com/cloud/network/as/AutoScaleVmProfileVO.java @@ -24,8 +24,10 @@ import java.util.Map; import java.util.UUID; +import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @@ -35,6 +37,8 @@ import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; +import org.apache.commons.collections.MapUtils; +import org.apache.commons.lang3.StringUtils; import com.cloud.utils.Pair; import com.cloud.utils.db.GenericDao; @@ -63,7 +67,7 @@ public class AutoScaleVmProfileVO implements AutoScaleVmProfile, Identity, Inter private long accountId; @Column(name = "autoscale_user_id") - private long autoscaleUserId; + private Long autoscaleUserId; @Column(name = "service_offering_id", updatable = true, nullable = false) private Long serviceOfferingId; @@ -74,12 +78,16 @@ public class AutoScaleVmProfileVO implements AutoScaleVmProfile, Identity, Inter @Column(name = "other_deploy_params", updatable = true, length = 1024) private String otherDeployParams; - @Column(name = "destroy_vm_grace_period", updatable = true) - private Integer destroyVmGraceperiod = NetUtils.DEFAULT_AUTOSCALE_VM_DESTROY_TIME; + @Column(name = "expunge_vm_grace_period", updatable = true) + private Integer expungeVmGracePeriod = NetUtils.DEFAULT_AUTOSCALE_EXPUNGE_VM_GRACE_PERIOD; @Column(name = "counter_params", updatable = true) private String counterParams; + @Column(name = "user_data", updatable = true, nullable = true, length = 1048576) + @Basic(fetch = FetchType.LAZY) + private String userData; + @Column(name = GenericDao.REMOVED_COLUMN) protected Date removed; @@ -92,20 +100,22 @@ public class AutoScaleVmProfileVO implements AutoScaleVmProfile, Identity, Inter public AutoScaleVmProfileVO() { } - public AutoScaleVmProfileVO(long zoneId, long domainId, long accountId, long serviceOfferingId, long templateId, String otherDeployParams, Map counterParamList, - Integer destroyVmGraceperiod, long autoscaleUserId) { + public AutoScaleVmProfileVO(long zoneId, long domainId, long accountId, long serviceOfferingId, long templateId, + Map> otherDeployParamsMap, Map counterParamList, + String userData, Integer expungeVmGracePeriod, Long autoscaleUserId) { uuid = UUID.randomUUID().toString(); this.zoneId = zoneId; this.domainId = domainId; this.accountId = accountId; this.serviceOfferingId = serviceOfferingId; this.templateId = templateId; - this.otherDeployParams = otherDeployParams; this.autoscaleUserId = autoscaleUserId; - if (destroyVmGraceperiod != null) { - this.destroyVmGraceperiod = destroyVmGraceperiod; + if (expungeVmGracePeriod != null) { + this.expungeVmGracePeriod = expungeVmGracePeriod; } + this.userData = userData; setCounterParamsForUpdate(counterParamList); + setOtherDeployParamsForUpdate(otherDeployParamsMap); } @Override @@ -127,29 +137,61 @@ public Long getServiceOfferingId() { return serviceOfferingId; } + public void setServiceOfferingId(Long serviceOfferingId) { + this.serviceOfferingId = serviceOfferingId; + } + @Override public String getOtherDeployParams() { return otherDeployParams; } + @Override + public List> getOtherDeployParamsList() { + List> paramsList = new ArrayList<>(); + if (otherDeployParams != null) { + String[] params = otherDeployParams.split("[=&]"); + for (int i = 0; i < (params.length - 1); i = i + 2) { + paramsList.add(new Pair<>(params[i], params[i + 1])); + } + } + return paramsList; + } + public void setOtherDeployParams(String otherDeployParams) { this.otherDeployParams = otherDeployParams; } + public void setOtherDeployParamsForUpdate(Map> otherDeployParamsMap) { + if (MapUtils.isNotEmpty(otherDeployParamsMap)) { + List params = new ArrayList<>(); + for (HashMap paramKVpair : otherDeployParamsMap.values()) { + String paramName = paramKVpair.get("name"); + String paramValue = paramKVpair.get("value"); + params.add(paramName + "=" + paramValue); + } + setOtherDeployParams(StringUtils.join(params, "&")); + } + } + @Override public List> getCounterParams() { - List> paramsList = new ArrayList>(); + List> paramsList = new ArrayList<>(); if (counterParams != null) { String[] params = counterParams.split("[=&]"); for (int i = 0; i < (params.length - 1); i = i + 2) { - paramsList.add(new Pair(params[i], params[i + 1])); + paramsList.add(new Pair<>(params[i], params[i + 1])); } } return paramsList; } + public String getCounterParamsString() { + return this.counterParams; + } + public void setCounterParams(String counterParam) { - counterParams = counterParam; + this.counterParams = counterParam; } public void setCounterParamsForUpdate(Map counterParamList) { @@ -177,12 +219,21 @@ public void setCounterParamsForUpdate(Map counterParamList) { setCounterParams(sb.toString()); } + public void setUserData(String userData) { + this.userData = userData; + } + + @Override + public String getUserData() { + return userData; + } + @Override public String getUuid() { return uuid; } - public void setAutoscaleUserId(long autoscaleUserId) { + public void setAutoscaleUserId(Long autoscaleUserId) { this.autoscaleUserId = autoscaleUserId; } @@ -207,16 +258,16 @@ public long getId() { } @Override - public Integer getDestroyVmGraceperiod() { - return destroyVmGraceperiod; + public Integer getExpungeVmGracePeriod() { + return expungeVmGracePeriod; } - public void setDestroyVmGraceperiod(Integer destroyVmGraceperiod) { - this.destroyVmGraceperiod = destroyVmGraceperiod; + public void setExpungeVmGracePeriod(Integer expungeVmGracePeriod) { + this.expungeVmGracePeriod = expungeVmGracePeriod; } @Override - public long getAutoScaleUserId() { + public Long getAutoScaleUserId() { return autoscaleUserId; } diff --git a/engine/schema/src/main/java/com/cloud/network/as/ConditionVO.java b/engine/schema/src/main/java/com/cloud/network/as/ConditionVO.java index 5a512abda415..18e67a4af61c 100644 --- a/engine/schema/src/main/java/com/cloud/network/as/ConditionVO.java +++ b/engine/schema/src/main/java/com/cloud/network/as/ConditionVO.java @@ -44,7 +44,7 @@ public class ConditionVO implements Condition, Identity, InternalIdentity { private long id; @Column(name = "counter_id") - private long counterid; + private long counterId; @Column(name = "threshold") private long threshold; @@ -71,8 +71,8 @@ public class ConditionVO implements Condition, Identity, InternalIdentity { public ConditionVO() { } - public ConditionVO(long counterid, long threshold, long accountId, long domainId, Operator relationalOperator) { - this.counterid = counterid; + public ConditionVO(long counterId, long threshold, long accountId, long domainId, Operator relationalOperator) { + this.counterId = counterId; this.threshold = threshold; this.relationalOperator = relationalOperator; this.accountId = accountId; @@ -95,8 +95,8 @@ public String toString() { } @Override - public long getCounterid() { - return counterid; + public long getCounterId() { + return counterId; } @Override @@ -138,4 +138,11 @@ public String getName() { return null; } + public void setThreshold(long threshold) { + this.threshold = threshold; + } + + public void setRelationalOperator(Operator relationalOperator) { + this.relationalOperator = relationalOperator; + } } diff --git a/engine/schema/src/main/java/com/cloud/network/as/CounterVO.java b/engine/schema/src/main/java/com/cloud/network/as/CounterVO.java index 2ba71f0ced35..e5ab9886dda7 100644 --- a/engine/schema/src/main/java/com/cloud/network/as/CounterVO.java +++ b/engine/schema/src/main/java/com/cloud/network/as/CounterVO.java @@ -32,6 +32,7 @@ import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.network.Network; import com.cloud.utils.db.GenericDao; @Entity @@ -62,14 +63,18 @@ public class CounterVO implements Counter, Identity, InternalIdentity { @Column(name = GenericDao.CREATED_COLUMN) Date created; + @Column(name = "provider") + private String provider; + public CounterVO() { } - public CounterVO(Source source, String name, String value) { + public CounterVO(Source source, String name, String value, Network.Provider provider) { this.source = source; this.name = name; this.value = value; this.uuid = UUID.randomUUID().toString(); + this.provider = provider.getName(); } @Override @@ -109,4 +114,9 @@ public Date getRemoved() { public Date getCreated() { return created; } + + @Override + public String getProvider() { + return provider; + } } diff --git a/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupDao.java b/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupDao.java index 16d110410288..97bccb6a6fdc 100644 --- a/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupDao.java +++ b/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupDao.java @@ -18,6 +18,7 @@ import java.util.List; +import com.cloud.network.as.AutoScaleVmGroup; import com.cloud.network.as.AutoScaleVmGroupVO; import com.cloud.utils.db.GenericDao; @@ -27,4 +28,12 @@ public interface AutoScaleVmGroupDao extends GenericDao listByLoadBalancer(Long loadBalancerId); + + List listByProfile(Long profileId); + + List listByAccount(Long accountId); } diff --git a/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupDaoImpl.java b/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupDaoImpl.java index eb4716529c9c..18c1b7f3f3ce 100644 --- a/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupDaoImpl.java @@ -18,46 +18,96 @@ import java.util.List; - import org.springframework.stereotype.Component; +import com.cloud.network.as.AutoScaleVmGroup; import com.cloud.network.as.AutoScaleVmGroupVO; import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.GenericSearchBuilder; +import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.SearchCriteria.Func; +import javax.annotation.PostConstruct; + @Component public class AutoScaleVmGroupDaoImpl extends GenericDaoBase implements AutoScaleVmGroupDao { + SearchBuilder AllFieldsSearch; + + @PostConstruct + public void init() { + AllFieldsSearch = createSearchBuilder(); + AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), SearchCriteria.Op.EQ); + AllFieldsSearch.and("loadBalancerId", AllFieldsSearch.entity().getLoadBalancerId(), SearchCriteria.Op.EQ); + AllFieldsSearch.and("profileId", AllFieldsSearch.entity().getProfileId(), SearchCriteria.Op.EQ); + AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), SearchCriteria.Op.EQ); + AllFieldsSearch.and("accountId", AllFieldsSearch.entity().getAccountId(), SearchCriteria.Op.EQ); + AllFieldsSearch.done(); + } + @Override public List listByAll(Long loadBalancerId, Long profileId) { - SearchCriteria sc = createSearchCriteria(); + SearchCriteria sc = AllFieldsSearch.create(); if (loadBalancerId != null) - sc.addAnd("loadBalancerId", SearchCriteria.Op.EQ, loadBalancerId); + sc.setParameters("loadBalancerId", loadBalancerId); if (profileId != null) - sc.addAnd("profileId", SearchCriteria.Op.EQ, profileId); + sc.setParameters("profileId", profileId); return listBy(sc); } @Override public boolean isProfileInUse(long profileId) { - SearchCriteria sc = createSearchCriteria(); - sc.addAnd("profileId", SearchCriteria.Op.EQ, profileId); + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("profileId", profileId); return findOneBy(sc) != null; } @Override public boolean isAutoScaleLoadBalancer(Long loadBalancerId) { - GenericSearchBuilder CountByAccount = createSearchBuilder(Long.class); - CountByAccount.select(null, Func.COUNT, null); - CountByAccount.and("loadBalancerId", CountByAccount.entity().getLoadBalancerId(), SearchCriteria.Op.EQ); + GenericSearchBuilder countByLoadBalancer = createSearchBuilder(Long.class); + countByLoadBalancer.select(null, Func.COUNT, null); + countByLoadBalancer.and("loadBalancerId", countByLoadBalancer.entity().getLoadBalancerId(), SearchCriteria.Op.EQ); - SearchCriteria sc = CountByAccount.create(); + SearchCriteria sc = countByLoadBalancer.create(); sc.setParameters("loadBalancerId", loadBalancerId); return customSearch(sc, null).get(0) > 0; } + + @Override + public boolean updateState(long groupId, AutoScaleVmGroup.State oldState, AutoScaleVmGroup.State newState) { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("id", groupId); + sc.setParameters("state", oldState); + AutoScaleVmGroupVO group = findOneBy(sc); + if (group == null) { + return false; + } + group.setState(newState); + return update(groupId, group); + } + + @Override + public List listByLoadBalancer(Long loadBalancerId) { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("loadBalancerId", loadBalancerId); + return listBy(sc); + } + + @Override + public List listByProfile(Long profileId) { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("profileId", profileId); + return listBy(sc); + } + + @Override + public List listByAccount(Long accountId) { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("accountId", accountId); + return listBy(sc); + } } diff --git a/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupStatisticsDao.java b/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupStatisticsDao.java new file mode 100644 index 000000000000..de4a15bed053 --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupStatisticsDao.java @@ -0,0 +1,41 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.network.as.dao; + +import java.util.Date; +import java.util.List; + +import com.cloud.network.as.AutoScaleVmGroupStatisticsVO; +import com.cloud.utils.db.GenericDao; + +public interface AutoScaleVmGroupStatisticsDao extends GenericDao { + boolean removeByGroupId(long vmGroupId); + + boolean removeByGroupId(long vmGroupId, Date beforeDate); + + boolean removeByGroupAndPolicy(long vmGroupId, long policyId, Date beforeDate); + + List listDummyRecordsByVmGroup(long vmGroupId, Date afterDate); + + List listInactiveByVmGroupAndPolicy(long vmGroupId, long policyId, Date afterDate); + + List listByVmGroupAndPolicyAndCounter(long vmGroupId, long policyId, long counterId, Date afterDate); + + void updateStateByGroup(Long groupId, Long policyId, AutoScaleVmGroupStatisticsVO.State state); + + AutoScaleVmGroupStatisticsVO createInactiveDummyRecord(Long groupId); +} diff --git a/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupStatisticsDaoImpl.java b/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupStatisticsDaoImpl.java new file mode 100644 index 000000000000..eee1b6c11913 --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupStatisticsDaoImpl.java @@ -0,0 +1,138 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.network.as.dao; + +import java.util.Date; +import java.util.List; + + +import org.springframework.stereotype.Component; + +import com.cloud.network.as.AutoScaleVmGroupStatisticsVO; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.SearchCriteria.Op; + +import javax.annotation.PostConstruct; + +@Component +public class AutoScaleVmGroupStatisticsDaoImpl extends GenericDaoBase implements AutoScaleVmGroupStatisticsDao { + + SearchBuilder groupAndCounterSearch; + + @PostConstruct + protected void init() { + groupAndCounterSearch = createSearchBuilder(); + groupAndCounterSearch.and("vmGroupId", groupAndCounterSearch.entity().getVmGroupId(), Op.EQ); + groupAndCounterSearch.and("policyId", groupAndCounterSearch.entity().getPolicyId(), Op.EQ); + groupAndCounterSearch.and("counterId", groupAndCounterSearch.entity().getCounterId(), Op.EQ); + groupAndCounterSearch.and("createdLT", groupAndCounterSearch.entity().getCreated(), Op.LT); + groupAndCounterSearch.and("createdGT", groupAndCounterSearch.entity().getCreated(), Op.GT); + groupAndCounterSearch.and("state", groupAndCounterSearch.entity().getState(), Op.EQ); + groupAndCounterSearch.and("stateNEQ", groupAndCounterSearch.entity().getState(), Op.NEQ); + groupAndCounterSearch.done(); + } + + @Override + public boolean removeByGroupId(long vmGroupId) { + SearchCriteria sc = groupAndCounterSearch.create(); + sc.setParameters("vmGroupId", vmGroupId); + + return expunge(sc) > 0; + } + + @Override + public boolean removeByGroupId(long vmGroupId, Date beforeDate) { + SearchCriteria sc = groupAndCounterSearch.create(); + sc.setParameters("vmGroupId", vmGroupId); + if (beforeDate != null) { + sc.setParameters("createdLT", beforeDate); + } + return expunge(sc) > 0; + } + + @Override + public boolean removeByGroupAndPolicy(long vmGroupId, long policyId, Date beforeDate) { + SearchCriteria sc = groupAndCounterSearch.create(); + sc.setParameters("vmGroupId", vmGroupId); + sc.setParameters("policyId", policyId); + if (beforeDate != null) { + sc.setParameters("createdLT", beforeDate); + } + return expunge(sc) > 0; + } + + @Override + public List listDummyRecordsByVmGroup(long vmGroupId, Date afterDate) { + SearchCriteria sc = groupAndCounterSearch.create(); + sc.setParameters("vmGroupId", vmGroupId); + sc.setParameters("policyId", AutoScaleVmGroupStatisticsVO.DUMMY_ID); + if (afterDate != null) { + sc.setParameters("createdGT", afterDate); + } + sc.setParameters("state", AutoScaleVmGroupStatisticsVO.State.INACTIVE); + return listBy(sc); + } + + @Override + public List listInactiveByVmGroupAndPolicy(long vmGroupId, long policyId, Date afterDate) { + SearchCriteria sc = groupAndCounterSearch.create(); + sc.setParameters("vmGroupId", vmGroupId); + sc.setParameters("policyId", policyId); + if (afterDate != null) { + sc.setParameters("createdGT", afterDate); + } + sc.setParameters("state", AutoScaleVmGroupStatisticsVO.State.INACTIVE); + return listBy(sc); + } + + @Override + public List listByVmGroupAndPolicyAndCounter(long vmGroupId, long policyId, long counterId, Date afterDate) { + SearchCriteria sc = groupAndCounterSearch.create(); + sc.setParameters("vmGroupId", vmGroupId); + sc.setParameters("policyId", policyId); + sc.setParameters("counterId", counterId); + if (afterDate != null) { + sc.setParameters("createdGT", afterDate); + } + sc.setParameters("state", AutoScaleVmGroupStatisticsVO.State.ACTIVE); + return listBy(sc); + } + + @Override + public void updateStateByGroup(Long groupId, Long policyId, AutoScaleVmGroupStatisticsVO.State state) { + SearchCriteria sc = groupAndCounterSearch.create(); + if (groupId != null) { + sc.setParameters("vmGroupId", groupId); + } + if (policyId != null) { + sc.setParameters("policyId", policyId); + } + sc.setParameters("stateNEQ", state); + + AutoScaleVmGroupStatisticsVO vo = createForUpdate(); + vo.setState(state); + update(vo, sc); + } + + @Override + public AutoScaleVmGroupStatisticsVO createInactiveDummyRecord(Long groupId) { + AutoScaleVmGroupStatisticsVO vo = new AutoScaleVmGroupStatisticsVO(groupId); + return persist(vo); + } +} diff --git a/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDao.java b/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDao.java index 1a8acf3c00a8..4b25c63403e2 100644 --- a/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDao.java +++ b/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDao.java @@ -22,10 +22,17 @@ import com.cloud.utils.db.GenericDao; public interface AutoScaleVmGroupVmMapDao extends GenericDao { + int countAvailableVmsByGroup(long vmGroupId); + public Integer countByGroup(long vmGroupId); public List listByGroup(long vmGroupId); + public List listByVm(long vmId); + public int remove(long vmGroupId, long vmId); + public boolean removeByVm(long vmId); + + public boolean removeByGroup(long vmGroupId); } diff --git a/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDaoImpl.java b/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDaoImpl.java index 410d40bc9718..8fca4c26f9a7 100644 --- a/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDaoImpl.java @@ -23,32 +23,96 @@ import com.cloud.network.as.AutoScaleVmGroupVmMapVO; import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.GenericSearchBuilder; +import com.cloud.utils.db.JoinBuilder; +import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; +import com.cloud.vm.VMInstanceVO; +import com.cloud.vm.VirtualMachine.State; +import com.cloud.vm.dao.VMInstanceDao; + +import javax.annotation.PostConstruct; +import javax.inject.Inject; @Component public class AutoScaleVmGroupVmMapDaoImpl extends GenericDaoBase implements AutoScaleVmGroupVmMapDao { + @Inject + VMInstanceDao vmInstanceDao; + + GenericSearchBuilder CountBy; + + SearchBuilder AllFieldsSearch; + + @PostConstruct + protected void init() { + CountBy = createSearchBuilder(Integer.class); + CountBy.select(null, SearchCriteria.Func.COUNT, CountBy.entity().getId()); + CountBy.and("vmGroupId", CountBy.entity().getVmGroupId(), SearchCriteria.Op.EQ); + final SearchBuilder vmSearch = vmInstanceDao.createSearchBuilder(); + vmSearch.and("states", vmSearch.entity().getState(), SearchCriteria.Op.IN); + CountBy.join("vmSearch", vmSearch, CountBy.entity().getInstanceId(), vmSearch.entity().getId(), JoinBuilder.JoinType.INNER); + CountBy.done(); + + AllFieldsSearch = createSearchBuilder(); + AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), SearchCriteria.Op.EQ); + AllFieldsSearch.and("vmGroupId", AllFieldsSearch.entity().getVmGroupId(), SearchCriteria.Op.EQ); + AllFieldsSearch.and("instanceId", AllFieldsSearch.entity().getInstanceId(), SearchCriteria.Op.EQ); + AllFieldsSearch.done(); + } + + @Override + public int countAvailableVmsByGroup(long vmGroupId) { + + SearchCriteria sc = CountBy.create(); + sc.setParameters("vmGroupId", vmGroupId); + sc.setJoinParameters("vmSearch", "states", + State.Starting, State.Running, State.Stopping, State.Migrating); + final List results = customSearch(sc, null); + return results.get(0); + } + @Override public Integer countByGroup(long vmGroupId) { - SearchCriteria sc = createSearchCriteria(); - sc.addAnd("vmGroupId", SearchCriteria.Op.EQ, vmGroupId); + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("vmGroupId", vmGroupId); return getCountIncludingRemoved(sc); } @Override public List listByGroup(long vmGroupId) { - SearchCriteria sc = createSearchCriteria(); - sc.addAnd("vmGroupId", SearchCriteria.Op.EQ, vmGroupId); + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("vmGroupId", vmGroupId); + return listBy(sc); + } + + @Override + public List listByVm(long vmId) { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("instanceId", vmId); return listBy(sc); } @Override public int remove(long vmGroupId, long vmId) { - SearchCriteria sc = createSearchCriteria(); - sc.addAnd("vmGroupId", SearchCriteria.Op.EQ, vmGroupId); - sc.addAnd("instanceId", SearchCriteria.Op.EQ, vmId); + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("vmGroupId", vmGroupId); + sc.setParameters("instanceId", vmId); return remove(sc); } + @Override + public boolean removeByVm(long vmId) { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("instanceId", vmId); + return remove(sc) >= 0; + } + + @Override + public boolean removeByGroup(long vmGroupId) { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("vmGroupId", vmGroupId); + return remove(sc) >= 0; + } } diff --git a/engine/schema/src/main/java/com/cloud/network/as/dao/ConditionDaoImpl.java b/engine/schema/src/main/java/com/cloud/network/as/dao/ConditionDaoImpl.java index db4f781bebf9..0c17146c5312 100644 --- a/engine/schema/src/main/java/com/cloud/network/as/dao/ConditionDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/network/as/dao/ConditionDaoImpl.java @@ -33,7 +33,7 @@ public class ConditionDaoImpl extends GenericDaoBase implemen protected ConditionDaoImpl() { AllFieldsSearch = createSearchBuilder(); AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), Op.EQ); - AllFieldsSearch.and("counterId", AllFieldsSearch.entity().getCounterid(), Op.EQ); + AllFieldsSearch.and("counterId", AllFieldsSearch.entity().getCounterId(), Op.EQ); AllFieldsSearch.done(); } diff --git a/engine/schema/src/main/java/com/cloud/network/as/dao/CounterDao.java b/engine/schema/src/main/java/com/cloud/network/as/dao/CounterDao.java index 47b0d4876faa..4c9df8e749fe 100644 --- a/engine/schema/src/main/java/com/cloud/network/as/dao/CounterDao.java +++ b/engine/schema/src/main/java/com/cloud/network/as/dao/CounterDao.java @@ -24,6 +24,6 @@ import com.cloud.utils.db.GenericDao; public interface CounterDao extends GenericDao { - public List listCounters(Long id, String name, String source, String keyword, Filter filter); + public List listCounters(Long id, String name, String source, String provider, String keyword, Filter filter); } diff --git a/engine/schema/src/main/java/com/cloud/network/as/dao/CounterDaoImpl.java b/engine/schema/src/main/java/com/cloud/network/as/dao/CounterDaoImpl.java index dde7d0307843..2d3906b83414 100644 --- a/engine/schema/src/main/java/com/cloud/network/as/dao/CounterDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/network/as/dao/CounterDaoImpl.java @@ -38,11 +38,12 @@ protected CounterDaoImpl() { AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), Op.EQ); AllFieldsSearch.and("name", AllFieldsSearch.entity().getName(), Op.LIKE); AllFieldsSearch.and("source", AllFieldsSearch.entity().getSource(), Op.EQ); + AllFieldsSearch.and("provider", AllFieldsSearch.entity().getProvider(), Op.EQ); AllFieldsSearch.done(); } @Override - public List listCounters(Long id, String name, String source, String keyword, Filter filter) { + public List listCounters(Long id, String name, String source, String provider, String keyword, Filter filter) { SearchCriteria sc = AllFieldsSearch.create(); if (keyword != null) { @@ -52,15 +53,18 @@ public List listCounters(Long id, String name, String source, String } if (name != null) { - sc.addAnd("name", SearchCriteria.Op.LIKE, "%" + name + "%"); + sc.setParameters("name", "%" + name + "%"); } if (id != null) { - sc.addAnd("id", SearchCriteria.Op.EQ, id); + sc.setParameters("id", id); } if (source != null) { - sc.addAnd("source", SearchCriteria.Op.EQ, source); + sc.setParameters("source", source); + } + if (provider != null) { + sc.setParameters("provider", provider); } return listBy(sc, filter); } diff --git a/engine/schema/src/main/java/com/cloud/offerings/NetworkOfferingVO.java b/engine/schema/src/main/java/com/cloud/offerings/NetworkOfferingVO.java index ff187687fdf4..a3ceb9cce438 100644 --- a/engine/schema/src/main/java/com/cloud/offerings/NetworkOfferingVO.java +++ b/engine/schema/src/main/java/com/cloud/offerings/NetworkOfferingVO.java @@ -148,6 +148,9 @@ public class NetworkOfferingVO implements NetworkOffering { @Column(name="supports_public_access") boolean supportsPublicAccess = false; + @Column(name = "supports_vm_autoscaling") + boolean supportsVmAutoScaling = false; + @Override public String getDisplayText() { return displayText; @@ -534,4 +537,13 @@ public boolean isSupportingPublicAccess() { public String getServicePackage() { return servicePackageUuid; } + + public void setSupportsVmAutoScaling(boolean supportsVmAutoScaling) { + this.supportsVmAutoScaling = supportsVmAutoScaling; + } + + @Override + public boolean isSupportsVmAutoScaling() { + return supportsVmAutoScaling; + } } diff --git a/engine/schema/src/main/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml b/engine/schema/src/main/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml index b35054ecd8ac..511dccd00838 100644 --- a/engine/schema/src/main/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml +++ b/engine/schema/src/main/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml @@ -50,6 +50,7 @@ + diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41710to41800.sql b/engine/schema/src/main/resources/META-INF/db/schema-41710to41800.sql index 8be5cb31b399..de2903cfb9d0 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-41710to41800.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41710to41800.sql @@ -252,6 +252,200 @@ FROM role_permissions role_perm INNER JOIN roles ON role_perm.role_id = roles.id WHERE roles.role_type != 'Admin' AND roles.is_default = 1 AND role_perm.rule = 'migrateVolume'; +-- VM autoscaling + +-- Idempotent ADD COLUMN +DROP PROCEDURE IF EXISTS `cloud`.`IDEMPOTENT_ADD_COLUMN`; +CREATE PROCEDURE `cloud`.`IDEMPOTENT_ADD_COLUMN` ( + IN in_table_name VARCHAR(200) +, IN in_column_name VARCHAR(200) +, IN in_column_definition VARCHAR(1000) +) +BEGIN + DECLARE CONTINUE HANDLER FOR 1060 BEGIN END; SET @ddl = CONCAT('ALTER TABLE ', in_table_name); SET @ddl = CONCAT(@ddl, ' ', 'ADD COLUMN') ; SET @ddl = CONCAT(@ddl, ' ', in_column_name); SET @ddl = CONCAT(@ddl, ' ', in_column_definition); PREPARE stmt FROM @ddl; EXECUTE stmt; DEALLOCATE PREPARE stmt; END; + +-- Idempotent RENAME COLUMN +DROP PROCEDURE IF EXISTS `cloud`.`IDEMPOTENT_CHANGE_COLUMN`; +CREATE PROCEDURE `cloud`.`IDEMPOTENT_CHANGE_COLUMN` ( + IN in_table_name VARCHAR(200) +, IN in_column_name VARCHAR(200) +, IN in_column_new_name VARCHAR(200) +, IN in_column_new_definition VARCHAR(1000) +) +BEGIN + DECLARE CONTINUE HANDLER FOR 1054 BEGIN END; SET @ddl = CONCAT('ALTER TABLE ', in_table_name); SET @ddl = CONCAT(@ddl, ' ', 'CHANGE COLUMN') ; SET @ddl = CONCAT(@ddl, ' ', in_column_name); SET @ddl = CONCAT(@ddl, ' ', in_column_new_name); SET @ddl = CONCAT(@ddl, ' ', in_column_new_definition); PREPARE stmt FROM @ddl; EXECUTE stmt; DEALLOCATE PREPARE stmt; END; + +-- Idempotent ADD UNIQUE KEY +DROP PROCEDURE IF EXISTS `cloud`.`IDEMPOTENT_ADD_UNIQUE_KEY`; +CREATE PROCEDURE `cloud`.`IDEMPOTENT_ADD_UNIQUE_KEY` ( + IN in_table_name VARCHAR(200) +, IN in_key_name VARCHAR(200) +, IN in_key_definition VARCHAR(1000) +) +BEGIN + DECLARE CONTINUE HANDLER FOR 1061 BEGIN END; SET @ddl = CONCAT('ALTER TABLE ', in_table_name); SET @ddl = CONCAT(@ddl, ' ', 'ADD UNIQUE KEY ', in_key_name); SET @ddl = CONCAT(@ddl, ' ', in_key_definition); PREPARE stmt FROM @ddl; EXECUTE stmt; DEALLOCATE PREPARE stmt; END; + +-- Idempotent DROP FOREIGN KEY +DROP PROCEDURE IF EXISTS `cloud`.`IDEMPOTENT_DROP_FOREIGN_KEY`; +CREATE PROCEDURE `cloud`.`IDEMPOTENT_DROP_FOREIGN_KEY` ( + IN in_table_name VARCHAR(200) +, IN in_foreign_key_name VARCHAR(200) +) +BEGIN + DECLARE CONTINUE HANDLER FOR 1091, 1025 BEGIN END; SET @ddl = CONCAT('ALTER TABLE ', in_table_name); SET @ddl = CONCAT(@ddl, ' ', ' DROP FOREIGN KEY '); SET @ddl = CONCAT(@ddl, ' ', in_foreign_key_name); PREPARE stmt FROM @ddl; EXECUTE stmt; DEALLOCATE PREPARE stmt; END; + +-- Add column 'supports_vm_autoscaling' to 'network_offerings' table +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.network_offerings', 'supports_vm_autoscaling', 'boolean default false'); + +-- Update column 'supports_vm_autoscaling' to 1 if network offerings support Lb +UPDATE `cloud`.`network_offerings` +JOIN `cloud`.`ntwk_offering_service_map` +ON network_offerings.id = ntwk_offering_service_map.network_offering_id +SET network_offerings.supports_vm_autoscaling = 1 +WHERE ntwk_offering_service_map.service = 'Lb' + AND ntwk_offering_service_map.provider IN ('VirtualRouter', 'VpcVirtualRouter', 'Netscaler') + AND network_offerings.removed IS NULL; + +-- Add column 'name' to 'autoscale_vmgroups' table +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.autoscale_vmgroups', 'name', 'VARCHAR(255) DEFAULT NULL COMMENT "name of the autoscale vm group" AFTER `load_balancer_id`'); +UPDATE `cloud`.`autoscale_vmgroups` SET `name` = CONCAT('AutoScale-VmGroup-',id) WHERE `name` IS NULL; + +-- Add column 'next_vm_seq' to 'autoscale_vmgroups' table +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.autoscale_vmgroups', 'next_vm_seq', 'BIGINT UNSIGNED NOT NULL DEFAULT 1'); + +-- Add column 'user_data' to 'autoscale_vmprofiles' table +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.autoscale_vmprofiles', 'user_data', 'TEXT(32768) AFTER `counter_params`'); + +-- Add column 'name' to 'autoscale_policies' table +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.autoscale_policies', 'name', 'VARCHAR(255) DEFAULT NULL COMMENT "name of the autoscale policy" AFTER `uuid`'); + +-- Add column 'provider' and update values +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.counter', 'provider', 'VARCHAR(255) NOT NULL COMMENT "Network provider name" AFTER `uuid`'); +UPDATE `cloud`.`counter` SET provider = 'Netscaler' WHERE `provider` IS NULL OR `provider` = ''; + +CALL `cloud`.`IDEMPOTENT_ADD_UNIQUE_KEY`('cloud.counter', 'uc_counter__provider__source__value', '(provider, source, value)'); + +-- Add new counters for VM autoscaling + +INSERT IGNORE INTO `cloud`.`counter` (uuid, provider, source, name, value, created) VALUES (UUID(), 'VirtualRouter', 'cpu', 'VM CPU - average percentage', 'vm.cpu.average.percentage', NOW()); +INSERT IGNORE INTO `cloud`.`counter` (uuid, provider, source, name, value, created) VALUES (UUID(), 'VirtualRouter', 'memory', 'VM Memory - average percentage', 'vm.memory.average.percentage', NOW()); +INSERT IGNORE INTO `cloud`.`counter` (uuid, provider, source, name, value, created) VALUES (UUID(), 'VirtualRouter', 'virtualrouter', 'Public Network - mbps received per vm', 'public.network.received.average.mbps', NOW()); +INSERT IGNORE INTO `cloud`.`counter` (uuid, provider, source, name, value, created) VALUES (UUID(), 'VirtualRouter', 'virtualrouter', 'Public Network - mbps transmit per vm', 'public.network.transmit.average.mbps', NOW()); +INSERT IGNORE INTO `cloud`.`counter` (uuid, provider, source, name, value, created) VALUES (UUID(), 'VirtualRouter', 'virtualrouter', 'Load Balancer - average connections per vm', 'virtual.network.lb.average.connections', NOW()); + +INSERT IGNORE INTO `cloud`.`counter` (uuid, provider, source, name, value, created) VALUES (UUID(), 'VpcVirtualRouter', 'cpu', 'VM CPU - average percentage', 'vm.cpu.average.percentage', NOW()); +INSERT IGNORE INTO `cloud`.`counter` (uuid, provider, source, name, value, created) VALUES (UUID(), 'VpcVirtualRouter', 'memory', 'VM Memory - average percentage', 'vm.memory.average.percentage', NOW()); +INSERT IGNORE INTO `cloud`.`counter` (uuid, provider, source, name, value, created) VALUES (UUID(), 'VpcVirtualRouter', 'virtualrouter', 'Public Network - mbps received per vm', 'public.network.received.average.mbps', NOW()); +INSERT IGNORE INTO `cloud`.`counter` (uuid, provider, source, name, value, created) VALUES (UUID(), 'VpcVirtualRouter', 'virtualrouter', 'Public Network - mbps transmit per vm', 'public.network.transmit.average.mbps', NOW()); +INSERT IGNORE INTO `cloud`.`counter` (uuid, provider, source, name, value, created) VALUES (UUID(), 'VpcVirtualRouter', 'virtualrouter', 'Load Balancer - average connections per vm', 'virtual.network.lb.average.connections', NOW()); + +INSERT IGNORE INTO `cloud`.`counter` (uuid, provider, source, name, value, created) VALUES (UUID(), 'None', 'cpu', 'VM CPU - average percentage', 'vm.cpu.average.percentage', NOW()); +INSERT IGNORE INTO `cloud`.`counter` (uuid, provider, source, name, value, created) VALUES (UUID(), 'None', 'memory', 'VM Memory - average percentage', 'vm.memory.average.percentage', NOW()); + +-- Update autoscale_vmgroups to new state + +UPDATE `cloud`.`autoscale_vmgroups` SET state= UPPER(state); + +-- Update autoscale_vmgroups so records will not be removed when LB rule is removed + +CALL `cloud`.`IDEMPOTENT_DROP_FOREIGN_KEY`('cloud.autoscale_vmgroups', 'fk_autoscale_vmgroup__load_balancer_id'); + +-- Update autoscale_vmprofiles to make autoscale_user_id optional + +ALTER TABLE `cloud`.`autoscale_vmprofiles` MODIFY COLUMN `autoscale_user_id` bigint unsigned; + +-- Update autoscale_vmprofiles to rename destroy_vm_grace_period + +CALL `cloud`.`IDEMPOTENT_CHANGE_COLUMN`('cloud.autoscale_vmprofiles', 'destroy_vm_grace_period', 'expunge_vm_grace_period', 'int unsigned COMMENT "the time allowed for existing connections to get closed before a vm is expunged"'); + +-- Create table for VM autoscaling historic data + +CREATE TABLE IF NOT EXISTS `cloud`.`autoscale_vmgroup_statistics` ( + `id` bigint unsigned NOT NULL auto_increment, + `vmgroup_id` bigint unsigned NOT NULL, + `policy_id` bigint unsigned NOT NULL, + `counter_id` bigint unsigned NOT NULL, + `resource_id` bigint unsigned DEFAULT NULL, + `resource_type` varchar(255) NOT NULL, + `raw_value` double NOT NULL, + `value_type` varchar(255) NOT NULL, + `created` datetime NOT NULL COMMENT 'Date this data is created', + `state` varchar(255) NOT NULL COMMENT 'State of the data', + PRIMARY KEY (`id`), + CONSTRAINT `fk_autoscale_vmgroup_statistics__vmgroup_id` FOREIGN KEY `fk_autoscale_vmgroup_statistics__vmgroup_id` (`vmgroup_id`) REFERENCES `autoscale_vmgroups` (`id`) ON DELETE CASCADE, + INDEX `i_autoscale_vmgroup_statistics__vmgroup_id`(`vmgroup_id`), + INDEX `i_autoscale_vmgroup_statistics__policy_id`(`policy_id`), + INDEX `i_autoscale_vmgroup_statistics__counter_id`(`counter_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + + +-- Update Network offering view with supports_vm_autoscaling +DROP VIEW IF EXISTS `cloud`.`network_offering_view`; +CREATE VIEW `cloud`.`network_offering_view` AS + SELECT + `network_offerings`.`id` AS `id`, + `network_offerings`.`uuid` AS `uuid`, + `network_offerings`.`name` AS `name`, + `network_offerings`.`unique_name` AS `unique_name`, + `network_offerings`.`display_text` AS `display_text`, + `network_offerings`.`nw_rate` AS `nw_rate`, + `network_offerings`.`mc_rate` AS `mc_rate`, + `network_offerings`.`traffic_type` AS `traffic_type`, + `network_offerings`.`tags` AS `tags`, + `network_offerings`.`system_only` AS `system_only`, + `network_offerings`.`specify_vlan` AS `specify_vlan`, + `network_offerings`.`service_offering_id` AS `service_offering_id`, + `network_offerings`.`conserve_mode` AS `conserve_mode`, + `network_offerings`.`created` AS `created`, + `network_offerings`.`removed` AS `removed`, + `network_offerings`.`default` AS `default`, + `network_offerings`.`availability` AS `availability`, + `network_offerings`.`dedicated_lb_service` AS `dedicated_lb_service`, + `network_offerings`.`shared_source_nat_service` AS `shared_source_nat_service`, + `network_offerings`.`sort_key` AS `sort_key`, + `network_offerings`.`redundant_router_service` AS `redundant_router_service`, + `network_offerings`.`state` AS `state`, + `network_offerings`.`guest_type` AS `guest_type`, + `network_offerings`.`elastic_ip_service` AS `elastic_ip_service`, + `network_offerings`.`eip_associate_public_ip` AS `eip_associate_public_ip`, + `network_offerings`.`elastic_lb_service` AS `elastic_lb_service`, + `network_offerings`.`specify_ip_ranges` AS `specify_ip_ranges`, + `network_offerings`.`inline` AS `inline`, + `network_offerings`.`is_persistent` AS `is_persistent`, + `network_offerings`.`internal_lb` AS `internal_lb`, + `network_offerings`.`public_lb` AS `public_lb`, + `network_offerings`.`egress_default_policy` AS `egress_default_policy`, + `network_offerings`.`concurrent_connections` AS `concurrent_connections`, + `network_offerings`.`keep_alive_enabled` AS `keep_alive_enabled`, + `network_offerings`.`supports_streched_l2` AS `supports_streched_l2`, + `network_offerings`.`supports_public_access` AS `supports_public_access`, + `network_offerings`.`supports_vm_autoscaling` AS `supports_vm_autoscaling`, + `network_offerings`.`for_vpc` AS `for_vpc`, + `network_offerings`.`service_package_id` AS `service_package_id`, + GROUP_CONCAT(DISTINCT(domain.id)) AS domain_id, + GROUP_CONCAT(DISTINCT(domain.uuid)) AS domain_uuid, + GROUP_CONCAT(DISTINCT(domain.name)) AS domain_name, + GROUP_CONCAT(DISTINCT(domain.path)) AS domain_path, + GROUP_CONCAT(DISTINCT(zone.id)) AS zone_id, + GROUP_CONCAT(DISTINCT(zone.uuid)) AS zone_uuid, + GROUP_CONCAT(DISTINCT(zone.name)) AS zone_name, + `offering_details`.value AS internet_protocol + FROM + `cloud`.`network_offerings` + LEFT JOIN + `cloud`.`network_offering_details` AS `domain_details` ON `domain_details`.`network_offering_id` = `network_offerings`.`id` AND `domain_details`.`name`='domainid' + LEFT JOIN + `cloud`.`domain` AS `domain` ON FIND_IN_SET(`domain`.`id`, `domain_details`.`value`) + LEFT JOIN + `cloud`.`network_offering_details` AS `zone_details` ON `zone_details`.`network_offering_id` = `network_offerings`.`id` AND `zone_details`.`name`='zoneid' + LEFT JOIN + `cloud`.`data_center` AS `zone` ON FIND_IN_SET(`zone`.`id`, `zone_details`.`value`) + LEFT JOIN + `cloud`.`network_offering_details` AS `offering_details` ON `offering_details`.`network_offering_id` = `network_offerings`.`id` AND `offering_details`.`name`='internetProtocol' + GROUP BY + `network_offerings`.`id`; + +-- UserData as first class resource (PR #6202) CREATE TABLE `cloud`.`user_data` ( `id` bigint unsigned NOT NULL auto_increment COMMENT 'id', `uuid` varchar(40) NOT NULL COMMENT 'UUID of the user data', @@ -524,6 +718,9 @@ SELECT `affinity_group`.`uuid` AS `affinity_group_uuid`, `affinity_group`.`name` AS `affinity_group_name`, `affinity_group`.`description` AS `affinity_group_description`, + `autoscale_vmgroups`.`id` AS `autoscale_vmgroup_id`, + `autoscale_vmgroups`.`uuid` AS `autoscale_vmgroup_uuid`, + `autoscale_vmgroups`.`name` AS `autoscale_vmgroup_name`, `vm_instance`.`dynamically_scalable` AS `dynamically_scalable`, `user_data`.`id` AS `user_data_id`, `user_data`.`uuid` AS `user_data_uuid`, @@ -531,7 +728,7 @@ SELECT `user_vm`.`user_data_details` AS `user_data_details`, `vm_template`.`user_data_link_policy` AS `user_data_policy` FROM - (((((((((((((((((((((((((((((((((`user_vm` + (((((((((((((((((((((((((((((((((((`user_vm` JOIN `vm_instance` ON (((`vm_instance`.`id` = `user_vm`.`id`) AND ISNULL(`vm_instance`.`removed`)))) JOIN `account` ON ((`vm_instance`.`account_id` = `account`.`id`))) @@ -569,6 +766,8 @@ FROM AND (`async_job`.`job_status` = 0)))) LEFT JOIN `affinity_group_vm_map` ON ((`vm_instance`.`id` = `affinity_group_vm_map`.`instance_id`))) LEFT JOIN `affinity_group` ON ((`affinity_group_vm_map`.`affinity_group_id` = `affinity_group`.`id`))) + LEFT JOIN `autoscale_vmgroup_vm_map` ON ((`autoscale_vmgroup_vm_map`.`instance_id` = `vm_instance`.`id`))) + LEFT JOIN `autoscale_vmgroups` ON ((`autoscale_vmgroup_vm_map`.`vmgroup_id` = `autoscale_vmgroups`.`id`))) LEFT JOIN `user_vm_details` `custom_cpu` ON (((`custom_cpu`.`vm_id` = `vm_instance`.`id`) AND (`custom_cpu`.`name` = 'CpuNumber')))) LEFT JOIN `user_vm_details` `custom_speed` ON (((`custom_speed`.`vm_id` = `vm_instance`.`id`) diff --git a/engine/schema/src/test/java/com/cloud/network/as/AutoScaleVmProfileVOTest.java b/engine/schema/src/test/java/com/cloud/network/as/AutoScaleVmProfileVOTest.java new file mode 100755 index 000000000000..ff922986f882 --- /dev/null +++ b/engine/schema/src/test/java/com/cloud/network/as/AutoScaleVmProfileVOTest.java @@ -0,0 +1,65 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.network.as; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.cloud.utils.Pair; +import org.junit.Assert; +import org.junit.Test; + +public class AutoScaleVmProfileVOTest { + + @Test + public void testCounterParamsForUpdate() { + AutoScaleVmProfileVO profile = new AutoScaleVmProfileVO(); + + Map> counterParamList = new HashMap<>(); + counterParamList.put("0", new HashMap<>() {{ put("name", "snmpcommunity"); put("value", "public"); }}); + counterParamList.put("1", new HashMap<>() {{ put("name", "snmpport"); put("value", "161"); }}); + + profile.setCounterParamsForUpdate(counterParamList); + Assert.assertEquals("snmpcommunity=public&snmpport=161", profile.getCounterParamsString()); + + List> counterParams = profile.getCounterParams(); + Assert.assertEquals(2, counterParams.size()); + Assert.assertEquals("snmpcommunity", counterParams.get(0).first()); + Assert.assertEquals("public", counterParams.get(0).second()); + Assert.assertEquals("snmpport", counterParams.get(1).first()); + Assert.assertEquals("161", counterParams.get(1).second()); + } + + @Test + public void tstSetOtherDeployParamsForUpdate() { + AutoScaleVmProfileVO profile = new AutoScaleVmProfileVO(); + + Map> otherDeployParamsMap = new HashMap<>(); + otherDeployParamsMap.put("0", new HashMap<>() {{ put("name", "serviceofferingid"); put("value", "a7fb50f6-01d9-11ed-8bc1-77f8f0228926"); }}); + otherDeployParamsMap.put("1", new HashMap<>() {{ put("name", "rootdisksize"); put("value", "10"); }}); + + profile.setOtherDeployParamsForUpdate(otherDeployParamsMap); + + List> otherDeployParamsList = profile.getOtherDeployParamsList(); + Assert.assertEquals(2, otherDeployParamsList.size()); + Assert.assertEquals("serviceofferingid", otherDeployParamsList.get(0).first()); + Assert.assertEquals("a7fb50f6-01d9-11ed-8bc1-77f8f0228926", otherDeployParamsList.get(0).second()); + Assert.assertEquals("rootdisksize", otherDeployParamsList.get(1).first()); + Assert.assertEquals("10", otherDeployParamsList.get(1).second()); + } +} \ No newline at end of file diff --git a/engine/schema/src/test/java/com/cloud/network/as/dao/AutoScaleVmGroupDaoImplTest.java b/engine/schema/src/test/java/com/cloud/network/as/dao/AutoScaleVmGroupDaoImplTest.java new file mode 100644 index 000000000000..bcfcdf9868c3 --- /dev/null +++ b/engine/schema/src/test/java/com/cloud/network/as/dao/AutoScaleVmGroupDaoImplTest.java @@ -0,0 +1,137 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.cloud.network.as.dao; + +import com.cloud.network.as.AutoScaleVmGroup; +import com.cloud.network.as.AutoScaleVmGroupVO; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.Spy; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.modules.junit4.PowerMockRunner; + +import java.util.List; + +@RunWith(PowerMockRunner.class) +public class AutoScaleVmGroupDaoImplTest { + + @Mock + SearchBuilder searchBuilderAutoScaleVmGroupVOMock; + + @Mock + SearchCriteria searchCriteriaAutoScaleVmGroupVOMock; + + @Mock + List listAutoScaleVmGroupVOMock; + + @Mock + AutoScaleVmGroupVO autoScaleVmGroupVOMock; + + @Spy + AutoScaleVmGroupDaoImpl AutoScaleVmGroupDaoImplSpy = PowerMockito.spy(new AutoScaleVmGroupDaoImpl()); + + @Before + public void setUp() { + AutoScaleVmGroupDaoImplSpy.AllFieldsSearch = searchBuilderAutoScaleVmGroupVOMock; + Mockito.doReturn(searchCriteriaAutoScaleVmGroupVOMock).when(searchBuilderAutoScaleVmGroupVOMock).create(); + } + + @Test + public void testListByLoadBalancer() throws Exception { + Mockito.doNothing().when(searchCriteriaAutoScaleVmGroupVOMock).setParameters(Mockito.anyString(), Mockito.any()); + PowerMockito.doReturn(listAutoScaleVmGroupVOMock).when(AutoScaleVmGroupDaoImplSpy, "listBy", Mockito.any(SearchCriteria.class)); + + long loadBalancerId = 100L; + + List result = AutoScaleVmGroupDaoImplSpy.listByLoadBalancer(loadBalancerId); + + Assert.assertEquals(listAutoScaleVmGroupVOMock, result); + + Mockito.verify(searchCriteriaAutoScaleVmGroupVOMock).setParameters("loadBalancerId", loadBalancerId); + } + + @Test + public void testListByProfile() throws Exception { + Mockito.doNothing().when(searchCriteriaAutoScaleVmGroupVOMock).setParameters(Mockito.anyString(), Mockito.any()); + PowerMockito.doReturn(listAutoScaleVmGroupVOMock).when(AutoScaleVmGroupDaoImplSpy, "listBy", Mockito.any(SearchCriteria.class)); + + long profileId = 101L; + + List result = AutoScaleVmGroupDaoImplSpy.listByProfile(profileId); + + Assert.assertEquals(listAutoScaleVmGroupVOMock, result); + + Mockito.verify(searchCriteriaAutoScaleVmGroupVOMock).setParameters("profileId", profileId); + } + + @Test + public void testListByAccount() throws Exception { + Mockito.doNothing().when(searchCriteriaAutoScaleVmGroupVOMock).setParameters(Mockito.anyString(), Mockito.any()); + PowerMockito.doReturn(listAutoScaleVmGroupVOMock).when(AutoScaleVmGroupDaoImplSpy, "listBy", Mockito.any(SearchCriteria.class)); + + long accountId = 102L; + + List result = AutoScaleVmGroupDaoImplSpy.listByAccount(accountId); + + Assert.assertEquals(listAutoScaleVmGroupVOMock, result); + + Mockito.verify(searchCriteriaAutoScaleVmGroupVOMock).setParameters("accountId", accountId); + } + + @Test + public void testUpdateState1() throws Exception { + Mockito.doNothing().when(searchCriteriaAutoScaleVmGroupVOMock).setParameters(Mockito.anyString(), Mockito.any()); + PowerMockito.doReturn(null).when(AutoScaleVmGroupDaoImplSpy, "findOneBy", Mockito.any(SearchCriteria.class)); + + long groupId = 10L; + AutoScaleVmGroup.State oldState = AutoScaleVmGroup.State.ENABLED; + AutoScaleVmGroup.State newState = AutoScaleVmGroup.State.DISABLED; + + boolean result = AutoScaleVmGroupDaoImplSpy.updateState(groupId, oldState, newState); + Assert.assertFalse(result); + } + + @Test + public void testUpdateState2() throws Exception { + Mockito.doNothing().when(searchCriteriaAutoScaleVmGroupVOMock).setParameters(Mockito.anyString(), Mockito.any()); + PowerMockito.doReturn(autoScaleVmGroupVOMock).when(AutoScaleVmGroupDaoImplSpy, "findOneBy", Mockito.any(SearchCriteria.class)); + Mockito.doNothing().when(autoScaleVmGroupVOMock).setState(Mockito.any(AutoScaleVmGroup.State.class)); + PowerMockito.doReturn(true).when(AutoScaleVmGroupDaoImplSpy).update(Mockito.anyLong(), Mockito.any(AutoScaleVmGroupVO.class)); + + long groupId = 10L; + AutoScaleVmGroup.State oldState = AutoScaleVmGroup.State.ENABLED; + AutoScaleVmGroup.State newState = AutoScaleVmGroup.State.DISABLED; + + boolean result = AutoScaleVmGroupDaoImplSpy.updateState(groupId, oldState, newState); + Assert.assertTrue(result); + + Mockito.verify(searchCriteriaAutoScaleVmGroupVOMock, Mockito.times(1)).setParameters("id", groupId); + Mockito.verify(searchCriteriaAutoScaleVmGroupVOMock, Mockito.times(1)).setParameters("state", oldState); + Mockito.verify(autoScaleVmGroupVOMock, Mockito.times(1)).setState(newState); + Mockito.verify(AutoScaleVmGroupDaoImplSpy, Mockito.times(1)).update(groupId, autoScaleVmGroupVOMock); + } +} diff --git a/engine/schema/src/test/java/com/cloud/network/as/dao/AutoScaleVmGroupStatisticsDaoImplTest.java b/engine/schema/src/test/java/com/cloud/network/as/dao/AutoScaleVmGroupStatisticsDaoImplTest.java new file mode 100644 index 000000000000..965abac11647 --- /dev/null +++ b/engine/schema/src/test/java/com/cloud/network/as/dao/AutoScaleVmGroupStatisticsDaoImplTest.java @@ -0,0 +1,247 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.cloud.network.as.dao; + +import com.cloud.network.as.AutoScaleVmGroupStatisticsVO; +import com.cloud.server.ResourceTag; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.modules.junit4.PowerMockRunner; + +import java.util.Date; +import java.util.List; + +@RunWith(PowerMockRunner.class) +public class AutoScaleVmGroupStatisticsDaoImplTest { + + @Mock + SearchCriteria searchCriteriaAutoScaleVmGroupStatisticsVOMock; + + @Mock + SearchBuilder searchBuilderAutoScaleVmGroupStatisticsVOMock; + + @Mock + List listAutoScaleVmGroupStatisticsVOMock; + + AutoScaleVmGroupStatisticsDaoImpl AutoScaleVmGroupStatisticsDaoImplSpy = PowerMockito.spy(new AutoScaleVmGroupStatisticsDaoImpl()); + + long groupId = 4L; + long policyId = 5L; + long counterId = 6L; + Date date = new Date(); + AutoScaleVmGroupStatisticsVO autoScaleVmGroupStatisticsVO = new AutoScaleVmGroupStatisticsVO(groupId); + AutoScaleVmGroupStatisticsVO.State state = AutoScaleVmGroupStatisticsVO.State.INACTIVE; + + @Before + public void setUp() throws Exception { + AutoScaleVmGroupStatisticsDaoImplSpy.groupAndCounterSearch = searchBuilderAutoScaleVmGroupStatisticsVOMock; + PowerMockito.doReturn(searchBuilderAutoScaleVmGroupStatisticsVOMock).when(AutoScaleVmGroupStatisticsDaoImplSpy).createSearchBuilder(); + Mockito.doReturn(searchCriteriaAutoScaleVmGroupStatisticsVOMock).when(searchBuilderAutoScaleVmGroupStatisticsVOMock).create(); + Mockito.doNothing().when(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters(Mockito.anyString(), Mockito.any()); + + PowerMockito.doReturn(listAutoScaleVmGroupStatisticsVOMock).when(AutoScaleVmGroupStatisticsDaoImplSpy, "listBy", Mockito.any(SearchCriteria.class)); + + PowerMockito.doReturn(autoScaleVmGroupStatisticsVO).when(AutoScaleVmGroupStatisticsDaoImplSpy).createForUpdate(); + PowerMockito.doReturn(1).when(AutoScaleVmGroupStatisticsDaoImplSpy).update(Mockito.any(AutoScaleVmGroupStatisticsVO.class), Mockito.any(SearchCriteria.class)); + PowerMockito.doReturn(autoScaleVmGroupStatisticsVO).when(AutoScaleVmGroupStatisticsDaoImplSpy).persist(Mockito.any(AutoScaleVmGroupStatisticsVO.class)); + } + + @Test + public void testRemoveByGroupId1() { + PowerMockito.doReturn(2).when(AutoScaleVmGroupStatisticsDaoImplSpy).expunge(Mockito.any(SearchCriteria.class)); + boolean result = AutoScaleVmGroupStatisticsDaoImplSpy.removeByGroupId(groupId); + Assert.assertTrue(result); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("vmGroupId", groupId); + } + + @Test + public void testRemoveByGroupId2() { + PowerMockito.doReturn(-1).when(AutoScaleVmGroupStatisticsDaoImplSpy).expunge(Mockito.any(SearchCriteria.class)); + boolean result = AutoScaleVmGroupStatisticsDaoImplSpy.removeByGroupId(groupId); + Assert.assertFalse(result); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("vmGroupId", groupId); + + } + + @Test + public void testRemoveByGroupId3() { + PowerMockito.doReturn(-1).when(AutoScaleVmGroupStatisticsDaoImplSpy).expunge(Mockito.any(SearchCriteria.class)); + boolean result = AutoScaleVmGroupStatisticsDaoImplSpy.removeByGroupId(groupId, date); + Assert.assertFalse(result); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("vmGroupId", groupId); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("createdLT", date); + + } + + @Test + public void testRemoveByGroupAndPolicy1() { + PowerMockito.doReturn(2).when(AutoScaleVmGroupStatisticsDaoImplSpy).expunge(Mockito.any(SearchCriteria.class)); + + boolean result = AutoScaleVmGroupStatisticsDaoImplSpy.removeByGroupAndPolicy(groupId, policyId, null); + + Assert.assertTrue(result); + + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("vmGroupId", groupId); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("policyId", policyId); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock, Mockito.never()).setParameters("createdLT", date); + } + + @Test + public void testRemoveByGroupAndPolicy2() { + PowerMockito.doReturn(-1).when(AutoScaleVmGroupStatisticsDaoImplSpy).expunge(Mockito.any(SearchCriteria.class)); + + boolean result = AutoScaleVmGroupStatisticsDaoImplSpy.removeByGroupAndPolicy(groupId, policyId, date); + + Assert.assertFalse(result); + + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("vmGroupId", groupId); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("policyId", policyId); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("createdLT", date); + } + + @Test + public void testListDummyRecordsByVmGroup1() { + List result = AutoScaleVmGroupStatisticsDaoImplSpy.listDummyRecordsByVmGroup(groupId, null); + + Assert.assertEquals(listAutoScaleVmGroupStatisticsVOMock, result); + + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("vmGroupId", groupId); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("policyId", AutoScaleVmGroupStatisticsVO.DUMMY_ID); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("state", AutoScaleVmGroupStatisticsVO.State.INACTIVE); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock, Mockito.never()).setParameters(Mockito.eq("createdGT"), Mockito.any()); + } + + @Test + public void testListDummyRecordsByVmGroup2() { + List result = AutoScaleVmGroupStatisticsDaoImplSpy.listDummyRecordsByVmGroup(groupId, date); + + Assert.assertEquals(listAutoScaleVmGroupStatisticsVOMock, result); + + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("vmGroupId", groupId); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("policyId", AutoScaleVmGroupStatisticsVO.DUMMY_ID); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("state", AutoScaleVmGroupStatisticsVO.State.INACTIVE); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("createdGT", date); + } + + @Test + public void testListInactiveByVmGroupAndPolicy1() { + List result = AutoScaleVmGroupStatisticsDaoImplSpy.listInactiveByVmGroupAndPolicy(groupId, policyId, null); + + Assert.assertEquals(listAutoScaleVmGroupStatisticsVOMock, result); + + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("vmGroupId", groupId); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("policyId", policyId); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("state", AutoScaleVmGroupStatisticsVO.State.INACTIVE); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock, Mockito.never()).setParameters(Mockito.eq("createdGT"), Mockito.any()); + } + + @Test + public void testListInactiveByVmGroupAndPolicy2() { + List result = AutoScaleVmGroupStatisticsDaoImplSpy.listInactiveByVmGroupAndPolicy(groupId, policyId, date); + + Assert.assertEquals(listAutoScaleVmGroupStatisticsVOMock, result); + + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("vmGroupId", groupId); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("policyId", policyId); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("state", AutoScaleVmGroupStatisticsVO.State.INACTIVE); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("createdGT", date); + } + + @Test + public void testlistByVmGroupAndPolicyAndCounter1() { + List result = AutoScaleVmGroupStatisticsDaoImplSpy.listByVmGroupAndPolicyAndCounter(groupId, policyId, counterId, null); + + Assert.assertEquals(listAutoScaleVmGroupStatisticsVOMock, result); + + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("vmGroupId", groupId); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("policyId", policyId); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("state", AutoScaleVmGroupStatisticsVO.State.ACTIVE); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock, Mockito.never()).setParameters("createdGT", date); + } + + @Test + public void testlistByVmGroupAndPolicyAndCounter2() { + List result = AutoScaleVmGroupStatisticsDaoImplSpy.listByVmGroupAndPolicyAndCounter(groupId, policyId, counterId, date); + + Assert.assertEquals(listAutoScaleVmGroupStatisticsVOMock, result); + + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("vmGroupId", groupId); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("policyId", policyId); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("state", AutoScaleVmGroupStatisticsVO.State.ACTIVE); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("createdGT", date); + } + + @Test + public void testUpdateStateByGroup1() { + AutoScaleVmGroupStatisticsDaoImplSpy.updateStateByGroup(groupId, policyId, state); + + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("vmGroupId", groupId); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("policyId", policyId); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("stateNEQ", state); + Mockito.verify(AutoScaleVmGroupStatisticsDaoImplSpy).update(autoScaleVmGroupStatisticsVO, searchCriteriaAutoScaleVmGroupStatisticsVOMock); + + Assert.assertEquals(state, autoScaleVmGroupStatisticsVO.getState()); + } + + @Test + public void testUpdateStateByGroup2() { + AutoScaleVmGroupStatisticsDaoImplSpy.updateStateByGroup(null, null, state); + + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock, Mockito.never()).setParameters("vmGroupId", groupId); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock, Mockito.never()).setParameters("policyId", policyId); + Mockito.verify(searchCriteriaAutoScaleVmGroupStatisticsVOMock).setParameters("stateNEQ", state); + Mockito.verify(AutoScaleVmGroupStatisticsDaoImplSpy).update(autoScaleVmGroupStatisticsVO, searchCriteriaAutoScaleVmGroupStatisticsVOMock); + + Assert.assertEquals(state, autoScaleVmGroupStatisticsVO.getState()); + } + + @Test + public void testCreateInactiveDummyRecord() { + AutoScaleVmGroupStatisticsVO result = AutoScaleVmGroupStatisticsDaoImplSpy.createInactiveDummyRecord(groupId); + + Assert.assertEquals(groupId, result.getVmGroupId()); + Assert.assertEquals(AutoScaleVmGroupStatisticsVO.DUMMY_ID, result.getPolicyId()); + Assert.assertEquals(AutoScaleVmGroupStatisticsVO.DUMMY_ID, result.getCounterId()); + Assert.assertEquals(groupId, (long) result.getResourceId()); + Assert.assertEquals(ResourceTag.ResourceObjectType.AutoScaleVmGroup, result.getResourceType()); + Assert.assertEquals(AutoScaleVmGroupStatisticsVO.INVALID_VALUE, result.getRawValue(), 0); + Assert.assertEquals(AutoScaleVmGroupStatisticsVO.State.INACTIVE, result.getState()); + } + + @Test + public void testInit() { + Mockito.when(searchBuilderAutoScaleVmGroupStatisticsVOMock.entity()).thenReturn(autoScaleVmGroupStatisticsVO); + + AutoScaleVmGroupStatisticsDaoImplSpy.init(); + + Mockito.verify(searchBuilderAutoScaleVmGroupStatisticsVOMock, Mockito.times(4)).and(Mockito.anyString(), Mockito.any(), Mockito.eq(SearchCriteria.Op.EQ)); + Mockito.verify(searchBuilderAutoScaleVmGroupStatisticsVOMock, Mockito.times(1)).and(Mockito.anyString(), Mockito.any(), Mockito.eq(SearchCriteria.Op.LT)); + Mockito.verify(searchBuilderAutoScaleVmGroupStatisticsVOMock, Mockito.times(1)).and(Mockito.anyString(), Mockito.any(), Mockito.eq(SearchCriteria.Op.GT)); + + } +} diff --git a/engine/schema/src/test/java/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDaoImplTest.java b/engine/schema/src/test/java/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDaoImplTest.java new file mode 100644 index 000000000000..2dde1008e6b2 --- /dev/null +++ b/engine/schema/src/test/java/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDaoImplTest.java @@ -0,0 +1,204 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.cloud.network.as.dao; + +import com.cloud.network.as.AutoScaleVmGroupVmMapVO; +import com.cloud.utils.db.GenericSearchBuilder; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.vm.VirtualMachine; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.Spy; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.modules.junit4.PowerMockRunner; + +import java.util.Arrays; +import java.util.List; + +@RunWith(PowerMockRunner.class) +public class AutoScaleVmGroupVmMapDaoImplTest { + + @Mock + SearchBuilder searchBuilderAutoScaleVmGroupVmMapVOMock; + + @Mock + SearchCriteria searchCriteriaAutoScaleVmGroupVmMapVOMock; + + @Mock + List listAutoScaleVmGroupVmMapVOMock; + + @Mock + GenericSearchBuilder searchBuilderCountAvailableVmsByGroup; + + @Mock + SearchCriteria searchCriteriaCountAvailableVmsByGroup; + + @Spy + AutoScaleVmGroupVmMapDaoImpl AutoScaleVmGroupVmMapDaoImplSpy = PowerMockito.spy(new AutoScaleVmGroupVmMapDaoImpl()); + + @Before + public void setUp() { + AutoScaleVmGroupVmMapDaoImplSpy.AllFieldsSearch = searchBuilderAutoScaleVmGroupVmMapVOMock; + AutoScaleVmGroupVmMapDaoImplSpy.CountBy = searchBuilderCountAvailableVmsByGroup; + Mockito.doReturn(searchCriteriaAutoScaleVmGroupVmMapVOMock).when(searchBuilderAutoScaleVmGroupVmMapVOMock).create(); + Mockito.doReturn(searchCriteriaCountAvailableVmsByGroup).when(searchBuilderCountAvailableVmsByGroup).create(); + } + + @Test + public void testCountAvailableVmsByGroup() throws Exception { + Mockito.doNothing().when(searchCriteriaAutoScaleVmGroupVmMapVOMock).setParameters(Mockito.anyString(), Mockito.any()); + Mockito.doNothing().when(searchCriteriaAutoScaleVmGroupVmMapVOMock).setJoinParameters(Mockito.anyString(), Mockito.anyString(), Mockito.any()); + PowerMockito.doReturn(Arrays.asList(5)).when(AutoScaleVmGroupVmMapDaoImplSpy).customSearch(Mockito.any(SearchCriteria.class), Mockito.eq(null)); + + long groupId = 4L; + + int result = AutoScaleVmGroupVmMapDaoImplSpy.countAvailableVmsByGroup(groupId); + + Assert.assertEquals(5, result); + + Mockito.verify(searchCriteriaCountAvailableVmsByGroup).setParameters("vmGroupId", groupId); + Mockito.verify(searchCriteriaCountAvailableVmsByGroup).setJoinParameters("vmSearch", "states", new Object[] {VirtualMachine.State.Starting, VirtualMachine.State.Running, VirtualMachine.State.Stopping, VirtualMachine.State.Migrating}); + } + + @Test + public void testCountByGroup() throws Exception { + Mockito.doNothing().when(searchCriteriaAutoScaleVmGroupVmMapVOMock).setParameters(Mockito.anyString(), Mockito.any()); + PowerMockito.doReturn(6).when(AutoScaleVmGroupVmMapDaoImplSpy, "getCountIncludingRemoved", Mockito.any(SearchCriteria.class)); + + long groupId = 4L; + + int result = AutoScaleVmGroupVmMapDaoImplSpy.countByGroup(groupId); + + Assert.assertEquals(6, result); + + Mockito.verify(searchCriteriaAutoScaleVmGroupVmMapVOMock).setParameters("vmGroupId", groupId); + } + + @Test + public void testListByGroup() throws Exception { + Mockito.doNothing().when(searchCriteriaAutoScaleVmGroupVmMapVOMock).setParameters(Mockito.anyString(), Mockito.any()); + PowerMockito.doReturn(listAutoScaleVmGroupVmMapVOMock).when(AutoScaleVmGroupVmMapDaoImplSpy, "listBy", Mockito.any(SearchCriteria.class)); + + long groupId = 4L; + + List result = AutoScaleVmGroupVmMapDaoImplSpy.listByGroup(groupId); + + Assert.assertEquals(listAutoScaleVmGroupVmMapVOMock, result); + + Mockito.verify(searchCriteriaAutoScaleVmGroupVmMapVOMock).setParameters("vmGroupId", groupId); + } + + @Test + public void testListByVm() throws Exception { + Mockito.doNothing().when(searchCriteriaAutoScaleVmGroupVmMapVOMock).setParameters(Mockito.anyString(), Mockito.any()); + PowerMockito.doReturn(listAutoScaleVmGroupVmMapVOMock).when(AutoScaleVmGroupVmMapDaoImplSpy, "listBy", Mockito.any(SearchCriteria.class)); + + long vmId = 100L; + + List result = AutoScaleVmGroupVmMapDaoImplSpy.listByVm(vmId); + + Assert.assertEquals(listAutoScaleVmGroupVmMapVOMock, result); + + Mockito.verify(searchCriteriaAutoScaleVmGroupVmMapVOMock).setParameters("instanceId", vmId); + } + + @Test + public void testRemoveByVm() { + Mockito.doNothing().when(searchCriteriaAutoScaleVmGroupVmMapVOMock).setParameters(Mockito.anyString(), Mockito.any()); + PowerMockito.doReturn(2).when(AutoScaleVmGroupVmMapDaoImplSpy).remove(Mockito.any(SearchCriteria.class)); + + long vmId = 3L; + + boolean result = AutoScaleVmGroupVmMapDaoImplSpy.removeByVm(vmId); + + Assert.assertTrue(result); + + Mockito.verify(searchCriteriaAutoScaleVmGroupVmMapVOMock).setParameters("instanceId", vmId); + Mockito.verify(AutoScaleVmGroupVmMapDaoImplSpy).remove(searchCriteriaAutoScaleVmGroupVmMapVOMock); + } + + @Test + public void testRemoveByGroup() { + Mockito.doNothing().when(searchCriteriaAutoScaleVmGroupVmMapVOMock).setParameters(Mockito.anyString(), Mockito.any()); + PowerMockito.doReturn(2).when(AutoScaleVmGroupVmMapDaoImplSpy).remove(Mockito.any(SearchCriteria.class)); + + long groupId = 4L; + + boolean result = AutoScaleVmGroupVmMapDaoImplSpy.removeByGroup(groupId); + + Assert.assertTrue(result); + + Mockito.verify(searchCriteriaAutoScaleVmGroupVmMapVOMock).setParameters("vmGroupId", groupId); + Mockito.verify(AutoScaleVmGroupVmMapDaoImplSpy).remove(searchCriteriaAutoScaleVmGroupVmMapVOMock); + } + + @Test + public void testRemoveByGroupAndVm() { + Mockito.doNothing().when(searchCriteriaAutoScaleVmGroupVmMapVOMock).setParameters(Mockito.anyString(), Mockito.any()); + PowerMockito.doReturn(2).when(AutoScaleVmGroupVmMapDaoImplSpy).remove(Mockito.any(SearchCriteria.class)); + + long vmId = 3L; + long groupId = 4L; + + int result = AutoScaleVmGroupVmMapDaoImplSpy.remove(groupId, vmId); + + Assert.assertEquals(2, result); + + Mockito.verify(searchCriteriaAutoScaleVmGroupVmMapVOMock).setParameters("vmGroupId", groupId); + Mockito.verify(searchCriteriaAutoScaleVmGroupVmMapVOMock).setParameters("instanceId", vmId); + Mockito.verify(AutoScaleVmGroupVmMapDaoImplSpy).remove(searchCriteriaAutoScaleVmGroupVmMapVOMock); + } + + @Test + public void testRemoveByVmFailed() { + Mockito.doNothing().when(searchCriteriaAutoScaleVmGroupVmMapVOMock).setParameters(Mockito.anyString(), Mockito.any()); + PowerMockito.doReturn(-1).when(AutoScaleVmGroupVmMapDaoImplSpy).remove(Mockito.any(SearchCriteria.class)); + + long vmId = 3L; + + boolean result = AutoScaleVmGroupVmMapDaoImplSpy.removeByVm(vmId); + + Assert.assertFalse(result); + + Mockito.verify(searchCriteriaAutoScaleVmGroupVmMapVOMock).setParameters("instanceId", vmId); + Mockito.verify(AutoScaleVmGroupVmMapDaoImplSpy).remove(searchCriteriaAutoScaleVmGroupVmMapVOMock); + } + + @Test + public void testRemoveByGroupFailed() { + Mockito.doNothing().when(searchCriteriaAutoScaleVmGroupVmMapVOMock).setParameters(Mockito.anyString(), Mockito.any()); + PowerMockito.doReturn(-1).when(AutoScaleVmGroupVmMapDaoImplSpy).remove(Mockito.any(SearchCriteria.class)); + + long groupId = 4L; + + boolean result = AutoScaleVmGroupVmMapDaoImplSpy.removeByGroup(groupId); + + Assert.assertFalse(result); + + Mockito.verify(searchCriteriaAutoScaleVmGroupVmMapVOMock).setParameters("vmGroupId", groupId); + Mockito.verify(AutoScaleVmGroupVmMapDaoImplSpy).remove(searchCriteriaAutoScaleVmGroupVmMapVOMock); + } +} diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java index b1e31e55a282..bac5b89c39d9 100644 --- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java +++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java @@ -2346,11 +2346,18 @@ public PowerState getVmState(final Connect conn, final String vmName) { } public String networkUsage(final String privateIpAddress, final String option, final String vif) { + return networkUsage(privateIpAddress, option, vif, null); + } + + public String networkUsage(final String privateIpAddress, final String option, final String vif, String publicIp) { final Script getUsage = new Script(_routerProxyPath, s_logger); getUsage.add("netusage.sh"); getUsage.add(privateIpAddress); if (option.equals("get")) { getUsage.add("-g"); + if (StringUtils.isNotEmpty(publicIp)) { + getUsage.add("-l", publicIp); + } } else if (option.equals("create")) { getUsage.add("-c"); } else if (option.equals("reset")) { @@ -2371,7 +2378,11 @@ public String networkUsage(final String privateIpAddress, final String option, f } public long[] getNetworkStats(final String privateIP) { - final String result = networkUsage(privateIP, "get", null); + return getNetworkStats(privateIP, null); + } + + public long[] getNetworkStats(final String privateIP, String publicIp) { + final String result = networkUsage(privateIP, "get", null, publicIp); final long[] stats = new long[2]; if (result != null) { final String[] splitResult = result.split(":"); @@ -2384,6 +2395,32 @@ public long[] getNetworkStats(final String privateIP) { return stats; } + public String getHaproxyStats(final String privateIP, final String publicIp, final Integer port) { + final Script getHaproxyStatsScript = new Script(_routerProxyPath, s_logger); + getHaproxyStatsScript.add("get_haproxy_stats.sh"); + getHaproxyStatsScript.add(privateIP); + getHaproxyStatsScript.add(publicIp); + getHaproxyStatsScript.add(String.valueOf(port)); + + final OutputInterpreter.OneLineParser statsParser = new OutputInterpreter.OneLineParser(); + final String result = getHaproxyStatsScript.execute(statsParser); + if (result != null) { + s_logger.debug("Failed to execute haproxy stats:" + result); + return null; + } + return statsParser.getLine(); + } + + public long[] getNetworkLbStats(final String privateIp, final String publicIp, final Integer port) { + final String result = getHaproxyStats(privateIp, publicIp, port); + final long[] stats = new long[1]; + if (result != null) { + final String[] splitResult = result.split(","); + stats[0] += Long.parseLong(splitResult[0]); + } + return stats; + } + public String configureVPCNetworkUsage(final String privateIpAddress, final String publicIp, final String option, final String vpcCIDR) { final Script getUsage = new Script(_routerProxyPath, s_logger); getUsage.add("vpc_netusage.sh"); diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetAutoScaleMetricsCommandWrapper.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetAutoScaleMetricsCommandWrapper.java new file mode 100644 index 000000000000..71f15762713d --- /dev/null +++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetAutoScaleMetricsCommandWrapper.java @@ -0,0 +1,76 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// + +package com.cloud.hypervisor.kvm.resource.wrapper; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.routing.GetAutoScaleMetricsAnswer; +import com.cloud.agent.api.routing.GetAutoScaleMetricsCommand; +import com.cloud.hypervisor.kvm.resource.LibvirtComputingResource; +import com.cloud.network.router.VirtualRouterAutoScale; +import com.cloud.network.router.VirtualRouterAutoScale.AutoScaleMetrics; +import com.cloud.network.router.VirtualRouterAutoScale.AutoScaleMetricsValue; +import com.cloud.network.router.VirtualRouterAutoScale.AutoScaleValueType; +import com.cloud.resource.CommandWrapper; +import com.cloud.resource.ResourceWrapper; + +import java.util.ArrayList; +import java.util.List; + +@ResourceWrapper(handles = GetAutoScaleMetricsCommand.class) +public class LibvirtGetAutoScaleMetricsCommandWrapper extends CommandWrapper { + + static final String NETWORK_USAGE_GET_OPTION = "get"; + + @Override + public Answer execute(final GetAutoScaleMetricsCommand command, final LibvirtComputingResource libvirtComputingResource) { + + Long bytesSent; + Long bytesReceived; + if (command.isForVpc()) { + final long[] stats = libvirtComputingResource.getVPCNetworkStats(command.getPrivateIP(), command.getPublicIP(), NETWORK_USAGE_GET_OPTION); + bytesSent = stats[0]; + bytesReceived = stats[1]; + } else { + final long [] stats = libvirtComputingResource.getNetworkStats(command.getPrivateIP(), command.getPublicIP()); + bytesSent = stats[0]; + bytesReceived = stats[1]; + } + final long [] lbStats = libvirtComputingResource.getNetworkLbStats(command.getPrivateIP(), command.getPublicIP(), command.getPort()); + final long lbConnections = lbStats[0]; + + List values = new ArrayList<>(); + + for (AutoScaleMetrics metrics : command.getMetrics()) { + switch (metrics.getCounter()) { + case NETWORK_RECEIVED_AVERAGE_MBPS: + values.add(new AutoScaleMetricsValue(metrics, AutoScaleValueType.AGGREGATED_VM_GROUP, Double.valueOf(bytesReceived) / VirtualRouterAutoScale.MBITS_TO_BYTES)); + break; + case NETWORK_TRANSMIT_AVERAGE_MBPS: + values.add(new AutoScaleMetricsValue(metrics, AutoScaleValueType.AGGREGATED_VM_GROUP, Double.valueOf(bytesSent) / VirtualRouterAutoScale.MBITS_TO_BYTES)); + break; + case LB_AVERAGE_CONNECTIONS: + values.add(new AutoScaleMetricsValue(metrics, AutoScaleValueType.INSTANT_VM, Double.valueOf(lbConnections))); + break; + } + } + + return new GetAutoScaleMetricsAnswer(command, true, values); + } +} diff --git a/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java b/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java index ad5f991f483b..1d444b744bec 100644 --- a/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java +++ b/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java @@ -19,13 +19,16 @@ package com.cloud.hypervisor.kvm.resource; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.ArgumentMatchers.nullable; import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; @@ -54,7 +57,6 @@ import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; -import com.cloud.utils.ssh.SshHelper; import org.apache.cloudstack.storage.command.AttachAnswer; import org.apache.cloudstack.storage.command.AttachCommand; import org.apache.cloudstack.utils.bytescale.ByteScaleUtils; @@ -212,6 +214,8 @@ import com.cloud.utils.Pair; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.script.Script; +import com.cloud.utils.script.OutputInterpreter.OneLineParser; +import com.cloud.utils.ssh.SshHelper; import com.cloud.vm.DiskProfile; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachine.PowerState; @@ -236,7 +240,7 @@ public class LibvirtComputingResourceTest { LibvirtDomainXMLParser parserMock; @Spy - private LibvirtComputingResource libvirtComputingResourceSpy = Mockito.spy(LibvirtComputingResource.class); + private LibvirtComputingResource libvirtComputingResourceSpy = Mockito.spy(new LibvirtComputingResource()); @Mock Domain domainMock; @@ -254,6 +258,17 @@ public class LibvirtComputingResourceTest { "Active: 4260808 kB\n" + "Inactive: 949392 kB\n"; + final static long[] defaultStats = new long[2]; + final static long[] vpcStats = { 1L, 2L }; + final static long[] networkStats = { 3L, 4L }; + final static long[] lbStats = { 5L }; + final static String privateIp = "192.168.1.1"; + final static String publicIp = "10.10.10.10"; + final static Integer port = 8080; + + final Script scriptMock = Mockito.mock(Script.class); + final OneLineParser statsParserMock = Mockito.mock(OneLineParser.class); + @Before public void setup() throws Exception { libvirtComputingResourceSpy._qemuSocketsPath = new File("/var/run/qemu"); @@ -5942,6 +5957,114 @@ public void testConfigureLocalStorageWithInvalidUUID() throws ConfigurationExcep configLocalStorageTests(params); } + @Test + public void testGetNetworkStats() { + doReturn(networkStats[0] + ":" + networkStats[1]).when(libvirtComputingResourceSpy).networkUsage(privateIp, "get", null, publicIp); + doReturn(defaultStats[0] + ":" + defaultStats[1]).when(libvirtComputingResourceSpy).networkUsage(privateIp, "get", null, null); + + long[] stats = libvirtComputingResourceSpy.getNetworkStats(privateIp, publicIp); + assertEquals(2, stats.length); + assertEquals(networkStats[0], stats[0]); + assertEquals(networkStats[1], stats[1]); + + stats = libvirtComputingResourceSpy.getNetworkStats(privateIp); + assertEquals(2, stats.length); + Assert.assertEquals(0, stats[0]); + Assert.assertEquals(0, stats[1]); + } + + @Test + public void testGetVPCNetworkStats() { + doReturn(vpcStats[0] + ":" + vpcStats[1]).when(libvirtComputingResourceSpy).configureVPCNetworkUsage(privateIp, publicIp, "get", null); + doReturn(defaultStats[0] + ":" + defaultStats[1]).when(libvirtComputingResourceSpy).configureVPCNetworkUsage(privateIp, null, "get", null); + + long[] stats = libvirtComputingResourceSpy.getVPCNetworkStats(privateIp, publicIp, "get"); + assertEquals(2, stats.length); + assertEquals(vpcStats[0], stats[0]); + assertEquals(vpcStats[1], stats[1]); + + stats = libvirtComputingResourceSpy.getVPCNetworkStats(privateIp, null, "get"); + assertEquals(2, stats.length); + Assert.assertEquals(0, stats[0]); + Assert.assertEquals(0, stats[1]); + } + + @Test + public void testGetHaproxyStats() { + doReturn(lbStats[0] + "").when(libvirtComputingResourceSpy).getHaproxyStats(privateIp, publicIp, port); + long[] stats = libvirtComputingResourceSpy.getNetworkLbStats(privateIp, publicIp, port); + assertEquals(1, stats.length); + assertEquals(lbStats[0], stats[0]); + + doReturn("0").when(libvirtComputingResourceSpy).getHaproxyStats(privateIp, publicIp, port); + stats = libvirtComputingResourceSpy.getNetworkLbStats(privateIp, publicIp, port); + assertEquals(1, stats.length); + Assert.assertEquals(0, stats[0]); + } + + @Test + @PrepareForTest(value = {LibvirtComputingResource.class}) + public void testGetHaproxyStatsMethod() throws Exception { + PowerMockito.whenNew(Script.class).withAnyArguments().thenReturn(scriptMock); + doNothing().when(scriptMock).add(Mockito.anyString()); + when(scriptMock.execute()).thenReturn(null); + when(scriptMock.execute(Mockito.any())).thenReturn(null); + + PowerMockito.whenNew(OneLineParser.class).withNoArguments().thenReturn(statsParserMock); + when(statsParserMock.getLine()).thenReturn("result"); + + String result = libvirtComputingResourceSpy.getHaproxyStats(privateIp, publicIp, port); + + Assert.assertEquals("result", result); + verify(scriptMock, times(4)).add(anyString()); + verify(scriptMock).add("get_haproxy_stats.sh"); + verify(scriptMock).add(privateIp); + verify(scriptMock).add(publicIp); + verify(scriptMock).add(String.valueOf(port)); + } + + @Test + @PrepareForTest(value = {LibvirtComputingResource.class}) + public void testNetworkUsageMethod1() throws Exception { + PowerMockito.whenNew(Script.class).withAnyArguments().thenReturn(scriptMock); + doNothing().when(scriptMock).add(Mockito.anyString()); + when(scriptMock.execute()).thenReturn(null); + when(scriptMock.execute(Mockito.any())).thenReturn(null); + + PowerMockito.whenNew(OneLineParser.class).withNoArguments().thenReturn(statsParserMock); + when(statsParserMock.getLine()).thenReturn("result"); + + String result = libvirtComputingResourceSpy.networkUsage(privateIp, "get", "eth0", publicIp); + + Assert.assertEquals("result", result); + verify(scriptMock, times(3)).add(anyString()); + verify(scriptMock).add("netusage.sh"); + verify(scriptMock).add(privateIp); + verify(scriptMock).add("-g"); + + verify(scriptMock).add("-l", publicIp); + } + + @Test + @PrepareForTest(value = {LibvirtComputingResource.class}) + public void testNetworkUsageMethod2() throws Exception { + PowerMockito.whenNew(Script.class).withAnyArguments().thenReturn(scriptMock); + doNothing().when(scriptMock).add(Mockito.anyString()); + when(scriptMock.execute()).thenReturn(null); + when(scriptMock.execute(Mockito.any())).thenReturn(null); + + PowerMockito.whenNew(OneLineParser.class).withNoArguments().thenReturn(statsParserMock); + when(statsParserMock.getLine()).thenReturn("result"); + + String result = libvirtComputingResourceSpy.networkUsage(privateIp, "get", "eth0", null); + + Assert.assertEquals("result", result); + verify(scriptMock, times(3)).add(anyString()); + verify(scriptMock).add("netusage.sh"); + verify(scriptMock).add(privateIp); + verify(scriptMock).add("-g"); + } + @Test public void getVmsToSetMemoryBalloonStatsPeriodTestLibvirtError() throws LibvirtException { Mockito.when(connMock.listDomains()).thenThrow(LibvirtException.class); diff --git a/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetAutoScaleMetricsCommandWrapperTest.java b/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetAutoScaleMetricsCommandWrapperTest.java new file mode 100644 index 000000000000..1c8094c51b6e --- /dev/null +++ b/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetAutoScaleMetricsCommandWrapperTest.java @@ -0,0 +1,120 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.cloud.hypervisor.kvm.resource.wrapper; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.routing.GetAutoScaleMetricsAnswer; +import com.cloud.agent.api.routing.GetAutoScaleMetricsCommand; +import com.cloud.hypervisor.kvm.resource.LibvirtComputingResource; +import com.cloud.network.router.VirtualRouterAutoScale; +import com.cloud.network.router.VirtualRouterAutoScale.AutoScaleMetrics; +import com.cloud.network.router.VirtualRouterAutoScale.AutoScaleMetricsValue; +import com.cloud.network.router.VirtualRouterAutoScale.VirtualRouterAutoScaleCounter; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.Spy; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.modules.junit4.PowerMockRunner; + +import java.util.ArrayList; +import java.util.List; + +@RunWith(PowerMockRunner.class) +public class LibvirtGetAutoScaleMetricsCommandWrapperTest { + + @Spy + LibvirtGetAutoScaleMetricsCommandWrapper libvirtGetAutoScaleMetricsCommandWrapperSpy = Mockito.spy(LibvirtGetAutoScaleMetricsCommandWrapper.class); + + @Mock + LibvirtComputingResource libvirtComputingResourceMock; + + @Mock + GetAutoScaleMetricsCommand getAutoScaleMetricsCommandMock; + + final static long[] vpcStats = { 1000L, 2000L }; + final static long[] networkStats = { 3000L, 4000L }; + final static long[] lbStats = { 5L }; + + @Before + public void init() { + List metrics = new ArrayList<>(); + metrics.add(new AutoScaleMetrics(VirtualRouterAutoScaleCounter.LB_AVERAGE_CONNECTIONS, 1L, 2L, 3L, 4)); + metrics.add(new AutoScaleMetrics(VirtualRouterAutoScaleCounter.NETWORK_RECEIVED_AVERAGE_MBPS, 1L, 2L, 3L, 4)); + metrics.add(new AutoScaleMetrics(VirtualRouterAutoScaleCounter.NETWORK_TRANSMIT_AVERAGE_MBPS, 1L, 2L, 3L, 4)); + + Mockito.when(getAutoScaleMetricsCommandMock.getMetrics()).thenReturn(metrics); + } + + @Test + public void validateVpcStats() { + + Mockito.when(getAutoScaleMetricsCommandMock.isForVpc()).thenReturn(true); + PowerMockito.when(libvirtComputingResourceMock.getVPCNetworkStats(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(vpcStats); + PowerMockito.when(libvirtComputingResourceMock.getNetworkLbStats(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(lbStats); + + Answer answer = libvirtGetAutoScaleMetricsCommandWrapperSpy.execute(getAutoScaleMetricsCommandMock, libvirtComputingResourceMock); + assertTrue(answer instanceof GetAutoScaleMetricsAnswer); + + GetAutoScaleMetricsAnswer getAutoScaleMetricsAnswer = (GetAutoScaleMetricsAnswer) answer; + List values = getAutoScaleMetricsAnswer.getValues(); + + assertEquals(3, values.size()); + for (AutoScaleMetricsValue value : values) { + if (value.getMetrics().getCounter().equals(VirtualRouterAutoScaleCounter.LB_AVERAGE_CONNECTIONS)) { + assertEquals(Double.valueOf(lbStats[0]), value.getValue()); + } else if (value.getMetrics().getCounter().equals(VirtualRouterAutoScaleCounter.NETWORK_TRANSMIT_AVERAGE_MBPS)) { + assertEquals(Double.valueOf(Double.valueOf(vpcStats[0]) / VirtualRouterAutoScale.MBITS_TO_BYTES), value.getValue()); + } else if (value.getMetrics().getCounter().equals(VirtualRouterAutoScaleCounter.NETWORK_RECEIVED_AVERAGE_MBPS)) { + assertEquals(Double.valueOf(Double.valueOf(vpcStats[1]) / VirtualRouterAutoScale.MBITS_TO_BYTES), value.getValue()); + } + } + + Mockito.verify(libvirtComputingResourceMock, Mockito.never()).getNetworkStats(Mockito.any(), Mockito.any()); + } + + @Test + public void validateNetworkStats() { + + Mockito.when(getAutoScaleMetricsCommandMock.isForVpc()).thenReturn(false); + PowerMockito.when(libvirtComputingResourceMock.getNetworkStats(Mockito.any(), Mockito.any())).thenReturn(networkStats); + PowerMockito.when(libvirtComputingResourceMock.getNetworkLbStats(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(lbStats); + + Answer answer = libvirtGetAutoScaleMetricsCommandWrapperSpy.execute(getAutoScaleMetricsCommandMock, libvirtComputingResourceMock); + assertTrue(answer instanceof GetAutoScaleMetricsAnswer); + + GetAutoScaleMetricsAnswer getAutoScaleMetricsAnswer = (GetAutoScaleMetricsAnswer) answer; + List values = getAutoScaleMetricsAnswer.getValues(); + + assertEquals(3, values.size()); + for (AutoScaleMetricsValue value : values) { + if (value.getMetrics().getCounter().equals(VirtualRouterAutoScaleCounter.LB_AVERAGE_CONNECTIONS)) { + assertEquals(Double.valueOf(lbStats[0]), value.getValue()); + } else if (value.getMetrics().getCounter().equals(VirtualRouterAutoScaleCounter.NETWORK_TRANSMIT_AVERAGE_MBPS)) { + assertEquals(Double.valueOf(Double.valueOf(networkStats[0]) / VirtualRouterAutoScale.MBITS_TO_BYTES), value.getValue()); + } else if (value.getMetrics().getCounter().equals(VirtualRouterAutoScaleCounter.NETWORK_RECEIVED_AVERAGE_MBPS)) { + assertEquals(Double.valueOf(Double.valueOf(networkStats[1]) / VirtualRouterAutoScale.MBITS_TO_BYTES), value.getValue()); + } + } + + Mockito.verify(libvirtComputingResourceMock, Mockito.never()).getVPCNetworkStats(Mockito.any(), Mockito.any(), Mockito.any()); + } +} diff --git a/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java index fe469b08e7a0..8b922dca356e 100644 --- a/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java +++ b/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java @@ -183,6 +183,8 @@ import com.cloud.agent.api.VolumeStatsEntry; import com.cloud.agent.api.check.CheckSshAnswer; import com.cloud.agent.api.check.CheckSshCommand; +import com.cloud.agent.api.routing.GetAutoScaleMetricsAnswer; +import com.cloud.agent.api.routing.GetAutoScaleMetricsCommand; import com.cloud.agent.api.routing.IpAssocCommand; import com.cloud.agent.api.routing.IpAssocVpcCommand; import com.cloud.agent.api.routing.NetworkElementCommand; @@ -255,6 +257,7 @@ import com.cloud.network.Networks.BroadcastDomainType; import com.cloud.network.Networks.TrafficType; import com.cloud.network.VmwareTrafficLabel; +import com.cloud.network.router.VirtualRouterAutoScale; import com.cloud.resource.ServerResource; import com.cloud.serializer.GsonHelper; import com.cloud.storage.Storage; @@ -599,6 +602,8 @@ public Answer executeRequest(Command cmd) { answer = execute((SetupPersistentNetworkCommand) cmd); } else if (clz == GetVmVncTicketCommand.class) { answer = execute((GetVmVncTicketCommand) cmd); + } else if (clz == GetAutoScaleMetricsCommand.class) { + answer = execute((GetAutoScaleMetricsCommand) cmd); } else { answer = Answer.createUnsupportedCommandAnswer(cmd); } @@ -1094,7 +1099,7 @@ protected Answer execute(NetworkUsageCommand cmd) { NetworkUsageAnswer answer = new NetworkUsageAnswer(cmd, result, 0L, 0L); return answer; } - long[] stats = getNetworkStats(cmd.getPrivateIP()); + long[] stats = getNetworkStats(cmd.getPrivateIP(), null); NetworkUsageAnswer answer = new NetworkUsageAnswer(cmd, "", stats[0], stats[1]); return answer; @@ -1104,13 +1109,18 @@ protected NetworkUsageAnswer VPCNetworkUsage(NetworkUsageCommand cmd) { String privateIp = cmd.getPrivateIP(); String option = cmd.getOption(); String publicIp = cmd.getGatewayIP(); + String vpcCIDR = cmd.getVpcCIDR(); + final long[] stats = getVPCNetworkStats(privateIp, publicIp, option, vpcCIDR); + return new NetworkUsageAnswer(cmd, "", stats[0], stats[1]); + } + + protected long[] getVPCNetworkStats(String privateIp, String publicIp, String option, String vpcCIDR) { String args = "-l " + publicIp + " "; if (option.equals("get")) { args += "-g"; } else if (option.equals("create")) { args += "-c"; - String vpcCIDR = cmd.getVpcCIDR(); args += " -v " + vpcCIDR; } else if (option.equals("reset")) { args += "-r"; @@ -1119,7 +1129,7 @@ protected NetworkUsageAnswer VPCNetworkUsage(NetworkUsageCommand cmd) { } else if (option.equals("remove")) { args += "-d"; } else { - return new NetworkUsageAnswer(cmd, "success", 0L, 0L); + return new long[2]; } ExecutionResult callResult = executeInVR(privateIp, "vpc_netusage.sh", args); @@ -1141,10 +1151,66 @@ protected NetworkUsageAnswer VPCNetworkUsage(NetworkUsageCommand cmd) { stats[0] += Long.parseLong(splitResult[i++]); stats[1] += Long.parseLong(splitResult[i++]); } - return new NetworkUsageAnswer(cmd, "success", stats[0], stats[1]); + return stats; + } + } + return new long[2]; + } + + protected long[] getNetworkLbStats(String privateIp, String publicIp, Integer port) { + String args = publicIp + " " + port; + ExecutionResult callResult = executeInVR(privateIp, "get_haproxy_stats.sh", args); + + String result = callResult.getDetails(); + if (!Boolean.TRUE.equals(callResult.isSuccess())) { + s_logger.error(String.format("Unable to get network loadbalancer stats on DomR (%s), domR may not be ready yet. failure due to %s", privateIp, callResult.getDetails())); + result = null; + } else if (result == null || result.isEmpty()) { + s_logger.error("Get network loadbalancer stats returns empty result"); + } + long[] stats = new long[1]; + if (result != null) { + final String[] splitResult = result.split(","); + stats[0] += Long.parseLong(splitResult[0]); + } + return stats; + } + + protected Answer execute(GetAutoScaleMetricsCommand cmd) { + Long bytesSent; + Long bytesReceived; + if (cmd.isForVpc()) { + long[] stats = getVPCNetworkStats(cmd.getPrivateIP(), cmd.getPublicIP(), "get", ""); + bytesSent = stats[0]; + bytesReceived = stats[1]; + } else { + long [] stats = getNetworkStats(cmd.getPrivateIP(), cmd.getPublicIP()); + bytesSent = stats[0]; + bytesReceived = stats[1]; + } + + long [] lbStats = getNetworkLbStats(cmd.getPrivateIP(), cmd.getPublicIP(), cmd.getPort()); + long lbConnections = lbStats[0]; + + List values = new ArrayList<>(); + + for (VirtualRouterAutoScale.AutoScaleMetrics metrics : cmd.getMetrics()) { + switch (metrics.getCounter()) { + case NETWORK_RECEIVED_AVERAGE_MBPS: + values.add(new VirtualRouterAutoScale.AutoScaleMetricsValue(metrics, VirtualRouterAutoScale.AutoScaleValueType.AGGREGATED_VM_GROUP, + Double.valueOf(bytesReceived) / VirtualRouterAutoScale.MBITS_TO_BYTES)); + break; + case NETWORK_TRANSMIT_AVERAGE_MBPS: + values.add(new VirtualRouterAutoScale.AutoScaleMetricsValue(metrics, VirtualRouterAutoScale.AutoScaleValueType.AGGREGATED_VM_GROUP, + Double.valueOf(bytesSent) / VirtualRouterAutoScale.MBITS_TO_BYTES)); + break; + case LB_AVERAGE_CONNECTIONS: + values.add(new VirtualRouterAutoScale.AutoScaleMetricsValue(metrics, VirtualRouterAutoScale.AutoScaleValueType.INSTANT_VM, Double.valueOf(lbConnections))); + break; } } - return new NetworkUsageAnswer(cmd, "success", 0L, 0L); + + return new GetAutoScaleMetricsAnswer(cmd, true, values); } @Override @@ -6549,9 +6615,16 @@ private HashMap getVmStats(List vmNames) throws Ex } protected String networkUsage(final String privateIpAddress, final String option, final String ethName) { + return networkUsage(privateIpAddress, option, ethName, null); + } + + protected String networkUsage(final String privateIpAddress, final String option, final String ethName, final String publicIp) { String args = null; if (option.equals("get")) { args = "-g"; + if (StringUtils.isNotEmpty(publicIp)) { + args += " -l " + publicIp; + } } else if (option.equals("create")) { args = "-c"; } else if (option.equals("reset")) { @@ -6573,8 +6646,8 @@ protected String networkUsage(final String privateIpAddress, final String option return result.getDetails(); } - private long[] getNetworkStats(String privateIP) { - String result = networkUsage(privateIP, "get", null); + protected long[] getNetworkStats(String privateIP, String publicIp) { + String result = networkUsage(privateIP, "get", null, publicIp); long[] stats = new long[2]; if (result != null) { try { diff --git a/plugins/hypervisors/vmware/src/test/java/com/cloud/hypervisor/vmware/resource/VmwareResourceTest.java b/plugins/hypervisors/vmware/src/test/java/com/cloud/hypervisor/vmware/resource/VmwareResourceTest.java index 7a2a45d2f287..e974c236589e 100644 --- a/plugins/hypervisors/vmware/src/test/java/com/cloud/hypervisor/vmware/resource/VmwareResourceTest.java +++ b/plugins/hypervisors/vmware/src/test/java/com/cloud/hypervisor/vmware/resource/VmwareResourceTest.java @@ -32,6 +32,7 @@ import java.util.Arrays; import java.util.EnumMap; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.apache.cloudstack.storage.command.CopyCommand; @@ -50,9 +51,12 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; +import com.cloud.agent.api.Answer; import com.cloud.agent.api.Command; import com.cloud.agent.api.ScaleVmAnswer; import com.cloud.agent.api.ScaleVmCommand; +import com.cloud.agent.api.routing.GetAutoScaleMetricsAnswer; +import com.cloud.agent.api.routing.GetAutoScaleMetricsCommand; import com.cloud.agent.api.to.DataTO; import com.cloud.agent.api.to.NfsTO; import com.cloud.agent.api.to.NicTO; @@ -65,9 +69,14 @@ import com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost; import com.cloud.hypervisor.vmware.util.VmwareClient; import com.cloud.hypervisor.vmware.util.VmwareContext; +import com.cloud.network.router.VirtualRouterAutoScale; +import com.cloud.network.router.VirtualRouterAutoScale.AutoScaleMetrics; +import com.cloud.network.router.VirtualRouterAutoScale.AutoScaleMetricsValue; +import com.cloud.network.router.VirtualRouterAutoScale.VirtualRouterAutoScaleCounter; import com.cloud.storage.resource.VmwareStorageProcessor; import com.cloud.storage.resource.VmwareStorageProcessor.VmwareStorageProcessorConfigurableFields; import com.cloud.storage.resource.VmwareStorageSubsystemCommandHandler; +import com.cloud.utils.ExecutionResult; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.vm.VmDetailConstants; import com.vmware.vim25.HostCapability; @@ -79,11 +88,15 @@ import com.vmware.vim25.VirtualMachineVideoCard; @RunWith(PowerMockRunner.class) -@PrepareForTest({CopyCommand.class, DatacenterMO.class, VmwareResource.class}) +@PrepareForTest({CopyCommand.class}) public class VmwareResourceTest { private static final String VOLUME_PATH = "XXXXXXXXXXXX"; + @Spy + @InjectMocks + VmwareResource vmwareResource = new VmwareResource(); + @Mock VmwareStorageProcessor storageProcessor; @Mock @@ -163,6 +176,10 @@ public VmwareHypervisorHost getHyperHost(VmwareContext context, Command cmd) { private static final long VIDEO_CARD_MEMORY_SIZE = 65536l; private static final Boolean FULL_CLONE_FLAG = true; + final static long[] vpcStats = { 1000L, 2000L }; + final static long[] networkStats = { 3000L, 4000L }; + final static long[] lbStats = { 5L }; + private Map specsArray = new HashMap(); @Before @@ -403,6 +420,7 @@ public void testFindVmOnDatacenterNullHyperHostReference() throws Exception { } @Test + @PrepareForTest({DatacenterMO.class, VmwareResource.class}) public void testFindVmOnDatacenter() throws Exception { when(hyperHost.getHyperHostDatacenter()).thenReturn(mor); when(datacenter.getMor()).thenReturn(mor); @@ -435,4 +453,105 @@ public void testConfigNestedHVSupportFlagFalse() throws Exception{ verify(vmMo, never()).getRunningHost(); } + @Test + public void testGetAutoScaleMetricsCommandForVpc() { + List metrics = new ArrayList<>(); + metrics.add(new AutoScaleMetrics(VirtualRouterAutoScaleCounter.LB_AVERAGE_CONNECTIONS, 1L, 2L, 3L, 4)); + metrics.add(new AutoScaleMetrics(VirtualRouterAutoScaleCounter.NETWORK_RECEIVED_AVERAGE_MBPS, 1L, 2L, 3L, 4)); + metrics.add(new AutoScaleMetrics(VirtualRouterAutoScaleCounter.NETWORK_TRANSMIT_AVERAGE_MBPS, 1L, 2L, 3L, 4)); + + GetAutoScaleMetricsCommand getAutoScaleMetricsCommand = new GetAutoScaleMetricsCommand("192.168.10.1", true, "10.10.10.10", 8080, metrics); + + doReturn(vpcStats).when(vmwareResource).getVPCNetworkStats(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString()); + doReturn(lbStats).when(vmwareResource).getNetworkLbStats(Mockito.nullable(String.class), Mockito.nullable(String.class), Mockito.nullable(Integer.class)); + + Answer answer = vmwareResource.executeRequest(getAutoScaleMetricsCommand); + assertTrue(answer instanceof GetAutoScaleMetricsAnswer); + + GetAutoScaleMetricsAnswer getAutoScaleMetricsAnswer = (GetAutoScaleMetricsAnswer) answer; + List values = getAutoScaleMetricsAnswer.getValues(); + + assertEquals(3, values.size()); + for (AutoScaleMetricsValue value : values) { + if (value.getMetrics().getCounter().equals(VirtualRouterAutoScaleCounter.LB_AVERAGE_CONNECTIONS)) { + assertEquals(Double.valueOf(lbStats[0]), value.getValue()); + } else if (value.getMetrics().getCounter().equals(VirtualRouterAutoScaleCounter.NETWORK_TRANSMIT_AVERAGE_MBPS)) { + assertEquals(Double.valueOf(Double.valueOf(vpcStats[0]) / VirtualRouterAutoScale.MBITS_TO_BYTES), value.getValue()); + } else if (value.getMetrics().getCounter().equals(VirtualRouterAutoScaleCounter.NETWORK_RECEIVED_AVERAGE_MBPS)) { + assertEquals(Double.valueOf(Double.valueOf(vpcStats[1]) / VirtualRouterAutoScale.MBITS_TO_BYTES), value.getValue()); + } + } + } + + @Test + public void testGetAutoScaleMetricsCommandForNetwork() { + List metrics = new ArrayList<>(); + metrics.add(new AutoScaleMetrics(VirtualRouterAutoScaleCounter.LB_AVERAGE_CONNECTIONS, 1L, 2L, 3L, 4)); + metrics.add(new AutoScaleMetrics(VirtualRouterAutoScaleCounter.NETWORK_RECEIVED_AVERAGE_MBPS, 1L, 2L, 3L, 4)); + metrics.add(new AutoScaleMetrics(VirtualRouterAutoScaleCounter.NETWORK_TRANSMIT_AVERAGE_MBPS, 1L, 2L, 3L, 4)); + + GetAutoScaleMetricsCommand getAutoScaleMetricsCommand = new GetAutoScaleMetricsCommand("192.168.10.1", false, "10.10.10.10", 8080, metrics); + + doReturn(networkStats).when(vmwareResource).getNetworkStats(Mockito.anyString(), Mockito.anyString()); + doReturn(lbStats).when(vmwareResource).getNetworkLbStats(Mockito.nullable(String.class), Mockito.nullable(String.class), Mockito.nullable(Integer.class)); + + Answer answer = vmwareResource.executeRequest(getAutoScaleMetricsCommand); + assertTrue(answer instanceof GetAutoScaleMetricsAnswer); + + GetAutoScaleMetricsAnswer getAutoScaleMetricsAnswer = (GetAutoScaleMetricsAnswer) answer; + List values = getAutoScaleMetricsAnswer.getValues(); + + assertEquals(3, values.size()); + for (AutoScaleMetricsValue value : values) { + if (value.getMetrics().getCounter().equals(VirtualRouterAutoScale.VirtualRouterAutoScaleCounter.LB_AVERAGE_CONNECTIONS)) { + assertEquals(Double.valueOf(lbStats[0]), value.getValue()); + } else if (value.getMetrics().getCounter().equals(VirtualRouterAutoScale.VirtualRouterAutoScaleCounter.NETWORK_TRANSMIT_AVERAGE_MBPS)) { + assertEquals(Double.valueOf(Double.valueOf(networkStats[0]) / VirtualRouterAutoScale.MBITS_TO_BYTES), value.getValue()); + } else if (value.getMetrics().getCounter().equals(VirtualRouterAutoScale.VirtualRouterAutoScaleCounter.NETWORK_RECEIVED_AVERAGE_MBPS)) { + assertEquals(Double.valueOf(Double.valueOf(networkStats[1]) / VirtualRouterAutoScale.MBITS_TO_BYTES), value.getValue()); + } + } + } + + @Test + public void testGetStatsForVpcStats() { + GetAutoScaleMetricsCommand getAutoScaleMetricsCommand = new GetAutoScaleMetricsCommand("192.168.10.1", true, "10.10.10.10", 8080, null); + + String args = "-l " + getAutoScaleMetricsCommand.getPublicIP() + " -g"; + ExecutionResult executionResult = new ExecutionResult(true, vpcStats[0] + ":" + vpcStats[1]); + doReturn(executionResult).when(vmwareResource).executeInVR(getAutoScaleMetricsCommand.getPrivateIP(), "vpc_netusage.sh", args); + + long[] stats = vmwareResource.getVPCNetworkStats(getAutoScaleMetricsCommand.getPrivateIP(), getAutoScaleMetricsCommand.getPublicIP(), "get", ""); + assertEquals(2, stats.length); + assertEquals(vpcStats[0], stats[0]); + assertEquals(vpcStats[1], stats[1]); + } + + @Test + public void testGetStatsForNetworkStats() { + GetAutoScaleMetricsCommand getAutoScaleMetricsCommand = new GetAutoScaleMetricsCommand("192.168.10.1", false, "10.10.10.10", 8080, null); + + String args = "-g -l " + getAutoScaleMetricsCommand.getPublicIP(); + ExecutionResult executionResult = new ExecutionResult(true, networkStats[0] + ":" + networkStats[1]); + doReturn(executionResult).when(vmwareResource).executeInVR(getAutoScaleMetricsCommand.getPrivateIP(), "netusage.sh", args); + + long[] stats = vmwareResource.getNetworkStats(getAutoScaleMetricsCommand.getPrivateIP(), getAutoScaleMetricsCommand.getPublicIP()); + assertEquals(2, stats.length); + assertEquals(networkStats[0], stats[0]); + assertEquals(networkStats[1], stats[1]); + } + + @Test + public void testGetStatsForLbStats() { + GetAutoScaleMetricsCommand getAutoScaleMetricsCommand = new GetAutoScaleMetricsCommand("192.168.10.1", true, "10.10.10.10", 8080, null); + + String args = getAutoScaleMetricsCommand.getPublicIP() + " " + getAutoScaleMetricsCommand.getPort(); + ExecutionResult executionResult = new ExecutionResult(true, String.valueOf(lbStats[0])); + doReturn(executionResult).when(vmwareResource).executeInVR(getAutoScaleMetricsCommand.getPrivateIP(), "get_haproxy_stats.sh", args); + + long[] stats = vmwareResource.getNetworkLbStats(getAutoScaleMetricsCommand.getPrivateIP(), getAutoScaleMetricsCommand.getPublicIP(), getAutoScaleMetricsCommand.getPort()); + + assertEquals(1, stats.length); + assertEquals(lbStats[0], stats[0]); + } } diff --git a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java index 49af92cd51d0..e0adf512c29e 100644 --- a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java +++ b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java @@ -2977,8 +2977,8 @@ public XsLocalNetwork getNetworkByName(final Connection conn, final String name) return earliestNetwork != null ? new XsLocalNetwork(this, earliestNetwork, earliestNetworkRecord, null, null) : null; } - public long[] getNetworkStats(final Connection conn, final String privateIP) { - final String result = networkUsage(conn, privateIP, "get", null); + public long[] getNetworkStats(final Connection conn, final String privateIP, final String publicIp) { + final String result = networkUsage(conn, privateIP, "get", null, publicIp); final long[] stats = new long[2]; if (result != null) { final String[] splitResult = result.split(":"); @@ -2991,6 +2991,37 @@ public long[] getNetworkStats(final Connection conn, final String privateIP) { return stats; } + public long[] getVPCNetworkStats(final String privateIP, final String publicIp) { + String args = " -l " + publicIp + " -g"; + final ExecutionResult result = executeInVR(privateIP, "vpc_netusage.sh", args); + final String detail = result.getDetails(); + final long[] stats = new long[2]; + if (detail != null) { + final String[] splitResult = detail.split(":"); + int i = 0; + while (i < splitResult.length - 1) { + stats[0] += Long.parseLong(splitResult[i++]); + stats[1] += Long.parseLong(splitResult[i++]); + } + } + return stats; + } + + public long[] getNetworkLbStats(final String privateIp, final String publicIp, final Integer port) { + String args = publicIp + " " + port; + ExecutionResult callResult = executeInVR(privateIp, "get_haproxy_stats.sh", args); + String detail = callResult.getDetails(); + if (detail == null || detail.isEmpty()) { + s_logger.error("Get network loadbalancer stats returns empty result"); + } + final long[] stats = new long[1]; + if (detail != null) { + final String[] splitResult = detail.split(","); + stats[0] += Long.parseLong(splitResult[0]); + } + return stats; + } + public SR getNfsSR(final Connection conn, final String poolid, final String uuid, final String server, String serverpath, final String pooldesc) { final Map deviceConfig = new HashMap(); try { @@ -3526,7 +3557,7 @@ public HashMap getVmStats(final Connection conn, final Get } else if (param.matches("vbd_.*_write")) { vmStatsAnswer.setDiskWriteKBs(vmStatsAnswer.getDiskWriteKBs() + getDataAverage(dataNode, col, numRows) / BASE_TO_CONVERT_BYTES_INTO_KILOBYTES); } else if (param.contains("memory_internal_free")) { - vmStatsAnswer.setIntFreeMemoryKBs(vmStatsAnswer.getIntFreeMemoryKBs() + getDataAverage(dataNode, col, numRows) / BASE_TO_CONVERT_BYTES_INTO_KILOBYTES); + vmStatsAnswer.setIntFreeMemoryKBs(vmStatsAnswer.getIntFreeMemoryKBs() + getDataAverage(dataNode, col, numRows)); } else if (param.contains("memory_target")) { vmStatsAnswer.setTargetMemoryKBs(vmStatsAnswer.getTargetMemoryKBs() + getDataAverage(dataNode, col, numRows) / BASE_TO_CONVERT_BYTES_INTO_KILOBYTES); } else if (param.contains("memory")) { @@ -4020,7 +4051,12 @@ public VDI mount(final Connection conn, final String vmName, final DiskTO volume } } + public String networkUsage(final Connection conn, final String privateIpAddress, final String option, final String vif) { + return networkUsage(conn, privateIpAddress, option, vif, null); + } + + public String networkUsage(final Connection conn, final String privateIpAddress, final String option, final String vif, final String publicIp) { if (option.equals("get")) { return "0:0"; } diff --git a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/XcpServerResource.java b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/XcpServerResource.java index b6f326ace472..9de2b2996bc8 100644 --- a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/XcpServerResource.java +++ b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/XcpServerResource.java @@ -16,6 +16,7 @@ // under the License. package com.cloud.hypervisor.xenserver.resource; +import org.apache.commons.lang3.StringUtils; import org.apache.log4j.Logger; import org.apache.xmlrpc.XmlRpcException; @@ -101,4 +102,27 @@ public boolean isDmcEnabled(final Connection conn, final Host host) { //For the supported XCPs dmc is default enabled, XCP 1.0.0, 1.1.0, 1.4.x, 1.5 beta, 1.6.x; return true; } + + @Override + public String networkUsage(final Connection conn, final String privateIpAddress, final String option, final String vif, final String publicIp) { + String args = ""; + if (option.equals("get")) { + args += "-g"; + if (StringUtils.isNotEmpty(publicIp)) { + args += " -l " + publicIp; + } + } else if (option.equals("create")) { + args += "-c"; + } else if (option.equals("reset")) { + args += "-r"; + } else if (option.equals("addVif")) { + args += "-a "; + args += vif; + } else if (option.equals("deleteVif")) { + args += "-d "; + args += vif; + } + + return executeInVR(privateIpAddress, "netusage.sh", args).getDetails(); + } } diff --git a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/XenServer56Resource.java b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/XenServer56Resource.java index 0c2b2c1e6f26..4d322b87104f 100644 --- a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/XenServer56Resource.java +++ b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/XenServer56Resource.java @@ -16,6 +16,7 @@ // under the License. package com.cloud.hypervisor.xenserver.resource; +import org.apache.commons.lang3.StringUtils; import org.apache.log4j.Logger; import com.cloud.agent.api.StartupCommand; @@ -82,10 +83,13 @@ public void disableVlanNetwork(final Connection conn, final Network network, boo } @Override - public String networkUsage(final Connection conn, final String privateIpAddress, final String option, final String vif) { + public String networkUsage(final Connection conn, final String privateIpAddress, final String option, final String vif, final String publicIp) { String args = ""; if (option.equals("get")) { args += "-g"; + if (StringUtils.isNotEmpty(publicIp)) { + args += " -l " + publicIp; + } } else if (option.equals("create")) { args += "-c"; } else if (option.equals("reset")) { diff --git a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xcp/XcpServerGetAutoScaleMetricsCommandWrapper.java b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xcp/XcpServerGetAutoScaleMetricsCommandWrapper.java new file mode 100644 index 000000000000..9cb083a55569 --- /dev/null +++ b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xcp/XcpServerGetAutoScaleMetricsCommandWrapper.java @@ -0,0 +1,85 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// + +package com.cloud.hypervisor.xenserver.resource.wrapper.xcp; + +import com.cloud.hypervisor.xenserver.resource.XcpServerResource; +import org.apache.log4j.Logger; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.routing.GetAutoScaleMetricsAnswer; +import com.cloud.agent.api.routing.GetAutoScaleMetricsCommand; +import com.cloud.network.router.VirtualRouterAutoScale; +import com.cloud.resource.CommandWrapper; +import com.cloud.resource.ResourceWrapper; +import com.xensource.xenapi.Connection; + +import java.util.ArrayList; +import java.util.List; + +@ResourceWrapper(handles = GetAutoScaleMetricsCommand.class) +public final class XcpServerGetAutoScaleMetricsCommandWrapper extends CommandWrapper { + + private static final Logger s_logger = Logger.getLogger(XcpServerGetAutoScaleMetricsCommandWrapper.class); + + @Override + public Answer execute(final GetAutoScaleMetricsCommand command, final XcpServerResource xcpServer) { + final Connection conn = xcpServer.getConnection(); + try { + Long bytesSent; + Long bytesReceived; + if (command.isForVpc()) { + final long[] stats = xcpServer.getVPCNetworkStats(command.getPrivateIP(), command.getPublicIP()); + bytesSent = stats[0]; + bytesReceived = stats[1]; + } else { + final long[] stats = xcpServer.getNetworkStats(conn, command.getPrivateIP(), command.getPublicIP()); + bytesSent = stats[0]; + bytesReceived = stats[1]; + } + + final long [] lbStats = xcpServer.getNetworkLbStats(command.getPrivateIP(), command.getPublicIP(), command.getPort()); + final long lbConnections = lbStats[0]; + + List values = new ArrayList<>(); + + for (VirtualRouterAutoScale.AutoScaleMetrics metrics : command.getMetrics()) { + switch (metrics.getCounter()) { + case NETWORK_RECEIVED_AVERAGE_MBPS: + values.add(new VirtualRouterAutoScale.AutoScaleMetricsValue(metrics, VirtualRouterAutoScale.AutoScaleValueType.AGGREGATED_VM_GROUP, + Double.valueOf(bytesReceived) / VirtualRouterAutoScale.MBITS_TO_BYTES)); + break; + case NETWORK_TRANSMIT_AVERAGE_MBPS: + values.add(new VirtualRouterAutoScale.AutoScaleMetricsValue(metrics, VirtualRouterAutoScale.AutoScaleValueType.AGGREGATED_VM_GROUP, + Double.valueOf(bytesSent) / VirtualRouterAutoScale.MBITS_TO_BYTES)); + break; + case LB_AVERAGE_CONNECTIONS: + values.add(new VirtualRouterAutoScale.AutoScaleMetricsValue(metrics, VirtualRouterAutoScale.AutoScaleValueType.INSTANT_VM, Double.valueOf(lbConnections))); + break; + } + } + + return new GetAutoScaleMetricsAnswer(command, true, values); + } catch (final Exception ex) { + s_logger.warn("Failed to get autoscale metrics due to ", ex); + return new GetAutoScaleMetricsAnswer(command, false); + } + } + +} \ No newline at end of file diff --git a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xcp/XcpServerNetworkUsageCommandWrapper.java b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xcp/XcpServerNetworkUsageCommandWrapper.java index e034021be938..cb1cc102a818 100644 --- a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xcp/XcpServerNetworkUsageCommandWrapper.java +++ b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xcp/XcpServerNetworkUsageCommandWrapper.java @@ -43,7 +43,7 @@ public Answer execute(final NetworkUsageCommand command, final XcpServerResource final NetworkUsageAnswer answer = new NetworkUsageAnswer(command, result, 0L, 0L); return answer; } - final long[] stats = xcpServerResource.getNetworkStats(conn, command.getPrivateIP()); + final long[] stats = xcpServerResource.getNetworkStats(conn, command.getPrivateIP(), null); final NetworkUsageAnswer answer = new NetworkUsageAnswer(command, "", stats[0], stats[1]); return answer; } catch (final Exception ex) { diff --git a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xen56/XenServer56GetAutoScaleMetricsCommandWrapper.java b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xen56/XenServer56GetAutoScaleMetricsCommandWrapper.java new file mode 100644 index 000000000000..d6889ba8899f --- /dev/null +++ b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xen56/XenServer56GetAutoScaleMetricsCommandWrapper.java @@ -0,0 +1,85 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// + +package com.cloud.hypervisor.xenserver.resource.wrapper.xen56; + +import org.apache.log4j.Logger; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.routing.GetAutoScaleMetricsAnswer; +import com.cloud.agent.api.routing.GetAutoScaleMetricsCommand; +import com.cloud.hypervisor.xenserver.resource.XenServer56Resource; +import com.cloud.network.router.VirtualRouterAutoScale; +import com.cloud.resource.CommandWrapper; +import com.cloud.resource.ResourceWrapper; +import com.xensource.xenapi.Connection; + +import java.util.ArrayList; +import java.util.List; + +@ResourceWrapper(handles = GetAutoScaleMetricsCommand.class) +public final class XenServer56GetAutoScaleMetricsCommandWrapper extends CommandWrapper { + + private static final Logger s_logger = Logger.getLogger(XenServer56GetAutoScaleMetricsCommandWrapper.class); + + @Override + public Answer execute(final GetAutoScaleMetricsCommand command, final XenServer56Resource xenServer56) { + final Connection conn = xenServer56.getConnection(); + try { + Long bytesSent; + Long bytesReceived; + if (command.isForVpc()) { + final long[] stats = xenServer56.getVPCNetworkStats(command.getPrivateIP(), command.getPublicIP()); + bytesSent = stats[0]; + bytesReceived = stats[1]; + } else { + final long[] stats = xenServer56.getNetworkStats(conn, command.getPrivateIP(), command.getPublicIP()); + bytesSent = stats[0]; + bytesReceived = stats[1]; + } + + final long [] lbStats = xenServer56.getNetworkLbStats(command.getPrivateIP(), command.getPublicIP(), command.getPort()); + final long lbConnections = lbStats[0]; + + List values = new ArrayList<>(); + + for (VirtualRouterAutoScale.AutoScaleMetrics metrics : command.getMetrics()) { + switch (metrics.getCounter()) { + case NETWORK_RECEIVED_AVERAGE_MBPS: + values.add(new VirtualRouterAutoScale.AutoScaleMetricsValue(metrics, VirtualRouterAutoScale.AutoScaleValueType.AGGREGATED_VM_GROUP, + Double.valueOf(bytesReceived) / VirtualRouterAutoScale.MBITS_TO_BYTES)); + break; + case NETWORK_TRANSMIT_AVERAGE_MBPS: + values.add(new VirtualRouterAutoScale.AutoScaleMetricsValue(metrics, VirtualRouterAutoScale.AutoScaleValueType.AGGREGATED_VM_GROUP, + Double.valueOf(bytesSent) / VirtualRouterAutoScale.MBITS_TO_BYTES)); + break; + case LB_AVERAGE_CONNECTIONS: + values.add(new VirtualRouterAutoScale.AutoScaleMetricsValue(metrics, VirtualRouterAutoScale.AutoScaleValueType.INSTANT_VM, Double.valueOf(lbConnections))); + break; + } + } + + return new GetAutoScaleMetricsAnswer(command, true, values); + } catch (final Exception ex) { + s_logger.warn("Failed to get autoscale metrics due to ", ex); + return new GetAutoScaleMetricsAnswer(command, false); + } + } + +} \ No newline at end of file diff --git a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xen56/XenServer56NetworkUsageCommandWrapper.java b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xen56/XenServer56NetworkUsageCommandWrapper.java index ad414a4ea321..7b6b0d85efcd 100644 --- a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xen56/XenServer56NetworkUsageCommandWrapper.java +++ b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xen56/XenServer56NetworkUsageCommandWrapper.java @@ -47,7 +47,7 @@ public Answer execute(final NetworkUsageCommand command, final XenServer56Resour final NetworkUsageAnswer answer = new NetworkUsageAnswer(command, result, 0L, 0L); return answer; } - final long[] stats = xenServer56.getNetworkStats(conn, command.getPrivateIP()); + final long[] stats = xenServer56.getNetworkStats(conn, command.getPrivateIP(), null); final NetworkUsageAnswer answer = new NetworkUsageAnswer(command, "", stats[0], stats[1]); return answer; } catch (final Exception ex) { diff --git a/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBaseTest.java b/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBaseTest.java index e40c7e89cee5..df9e9a424960 100644 --- a/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBaseTest.java +++ b/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBaseTest.java @@ -23,7 +23,6 @@ import java.util.Map; import java.util.Set; -import com.cloud.utils.StringUtils; import org.apache.xmlrpc.XmlRpcException; import org.junit.Assert; import org.junit.Before; @@ -44,6 +43,8 @@ import com.cloud.storage.Storage.StoragePoolType; import com.cloud.storage.Storage.StorageResourceType; import com.cloud.template.TemplateManager; +import com.cloud.utils.ExecutionResult; +import com.cloud.utils.StringUtils; import com.cloud.utils.script.Script; import com.xensource.xenapi.Connection; import com.xensource.xenapi.Host; @@ -53,6 +54,8 @@ import com.xensource.xenapi.Types.XenAPIException; import static com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.PLATFORM_CORES_PER_SOCKET_KEY; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doReturn; @RunWith(PowerMockRunner.class) @PrepareForTest({Host.class, Script.class, SR.class}) @@ -77,6 +80,13 @@ protected String getPatchFilePath() { private static final String platformString = "device-model:qemu-upstream-compat;vga:std;videoram:8;apic:true;viridian:false;timeoffset:0;pae:true;acpi:1;hpet:true;secureboot:false;nx:true"; + final static long[] vpcStats = { 1L, 2L }; + final static long[] networkStats = { 3L, 4L }; + final static long[] lbStats = { 5L }; + final static String privateIp = "192.168.1.1"; + final static String publicIp = "10.10.10.10"; + final static Integer port = 8080; + @Before public void beforeTest() throws XenAPIException, XmlRpcException { citrixResourceBase._host.setUuid(hostUuidMock); @@ -402,4 +412,58 @@ public void syncPlatformAndCoresPerSocketSettingsUpdateCoresPerSocketOnPlatform( Assert.assertTrue(platform.containsKey(PLATFORM_CORES_PER_SOCKET_KEY)); Assert.assertEquals(coresPerSocket, platform.get(PLATFORM_CORES_PER_SOCKET_KEY)); } + + @Test + public void testGetStatsForVpcStats() { + CitrixResourceBase citrixResourceBaseSpy = Mockito.spy(CitrixResourceBase.class); + + String args = " -l " + publicIp + " -g"; + ExecutionResult executionResult = new ExecutionResult(true, vpcStats[0] + ":" + vpcStats[1]); + doReturn(executionResult).when(citrixResourceBaseSpy).executeInVR(privateIp, "vpc_netusage.sh", args); + + long[] stats = citrixResourceBaseSpy.getVPCNetworkStats(privateIp, publicIp); + assertEquals(2, stats.length); + assertEquals(vpcStats[0], stats[0]); + assertEquals(vpcStats[1], stats[1]); + } + + @Test + public void testGetStatsForNetworkStats() { + CitrixResourceBase citrixResourceBaseSpy = Mockito.spy(CitrixResourceBase.class); + Connection connection = Mockito.mock(Connection.class); + + String args = "-g -l " + publicIp; + doReturn(networkStats[0] + ":" + networkStats[1]).when(citrixResourceBaseSpy).networkUsage(Mockito.any(Connection.class), + Mockito.eq(privateIp), Mockito.eq("get"), Mockito.any(), Mockito.eq(publicIp)); + + long[] stats = citrixResourceBaseSpy.getNetworkStats(connection, privateIp, publicIp); + assertEquals(2, stats.length); + assertEquals(networkStats[0], stats[0]); + assertEquals(networkStats[1], stats[1]); + } + + @Test + public void testGetStatsForLbStats() { + CitrixResourceBase citrixResourceBaseSpy = Mockito.spy(CitrixResourceBase.class); + + String args = publicIp + " " + port; + ExecutionResult executionResult = new ExecutionResult(true, String.valueOf(lbStats[0])); + doReturn(executionResult).when(citrixResourceBaseSpy).executeInVR(privateIp, "get_haproxy_stats.sh", args); + + long[] stats = citrixResourceBaseSpy.getNetworkLbStats(privateIp, publicIp, port); + + assertEquals(1, stats.length); + assertEquals(lbStats[0], stats[0]); + } + + @Test + public void testNetworkUsage() { + CitrixResourceBase citrixResourceBaseSpy = Mockito.spy(CitrixResourceBase.class); + + String result = citrixResourceBaseSpy.networkUsage(connectionMock, null, "get", null); + Assert.assertEquals("0:0", result); + + result = citrixResourceBaseSpy.networkUsage(connectionMock, null, "put", null); + Assert.assertNull(result); + } } diff --git a/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/XcpServerResourceTest.java b/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/XcpServerResourceTest.java index f1022cf435aa..6a926a7e75a7 100644 --- a/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/XcpServerResourceTest.java +++ b/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/XcpServerResourceTest.java @@ -21,9 +21,13 @@ import org.junit.Test; import org.mockito.Mockito; +import com.cloud.utils.ExecutionResult; import com.cloud.utils.exception.CloudRuntimeException; import com.xensource.xenapi.Types.XenAPIException; +import static org.mockito.Mockito.anyString; +import static org.mockito.Mockito.doReturn; + public class XcpServerResourceTest extends CitrixResourceBaseTest { @Before @@ -50,4 +54,25 @@ public void testGetFilesExeption() { public void testGetFilesListReturned() { testGetPathFilesListReturned(); } + + private void testNetworkUsageInternal(String option, String publicIp, String expectedArgs) { + String result = citrixResourceBase.networkUsage(null, "10.10.10.10", option, "eth0", publicIp); + + Assert.assertEquals("result", result); + Mockito.verify(citrixResourceBase).executeInVR("10.10.10.10", "netusage.sh", expectedArgs); + } + + @Test + public void testNetworkUsage() { + ExecutionResult executionResult = new ExecutionResult(true, "result"); + + doReturn(executionResult).when(citrixResourceBase).executeInVR(anyString(), anyString(), anyString()); + + testNetworkUsageInternal("get", "", "-g"); + testNetworkUsageInternal("get", "20.20.20.20", "-g -l 20.20.20.20"); + testNetworkUsageInternal("create", "", "-c"); + testNetworkUsageInternal("reset", "", "-r"); + testNetworkUsageInternal("addVif", "", "-a eth0"); + testNetworkUsageInternal("deleteVif", "", "-d eth0"); + } } diff --git a/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/XenServer56ResourceTest.java b/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/XenServer56ResourceTest.java index 7d8d5d9b6638..1762772736d2 100644 --- a/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/XenServer56ResourceTest.java +++ b/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/XenServer56ResourceTest.java @@ -21,9 +21,13 @@ import org.junit.Test; import org.mockito.Mockito; +import com.cloud.utils.ExecutionResult; import com.cloud.utils.exception.CloudRuntimeException; import com.xensource.xenapi.Types.XenAPIException; +import static org.mockito.Mockito.anyString; +import static org.mockito.Mockito.doReturn; + public class XenServer56ResourceTest extends CitrixResourceBaseTest { @Override @@ -50,4 +54,25 @@ public void testGetFiles() { public void testGetFilesListReturned() { testGetPathFilesListReturned(); } + + private void testNetworkUsageInternal(String option, String publicIp, String expectedArgs) { + String result = citrixResourceBase.networkUsage(null, "10.10.10.10", option, "eth0", publicIp); + + Assert.assertEquals("result", result); + Mockito.verify(citrixResourceBase).executeInVR("10.10.10.10", "netusage.sh", expectedArgs); + } + + @Test + public void testNetworkUsage() { + ExecutionResult executionResult = new ExecutionResult(true, "result"); + + doReturn(executionResult).when(citrixResourceBase).executeInVR(anyString(), anyString(), anyString()); + + testNetworkUsageInternal("get", "", "-g"); + testNetworkUsageInternal("get", "20.20.20.20", "-g -l 20.20.20.20"); + testNetworkUsageInternal("create", "", "-c"); + testNetworkUsageInternal("reset", "", "-r"); + testNetworkUsageInternal("addVif", "", "-a eth0"); + testNetworkUsageInternal("deleteVif", "", "-d eth0"); + } } diff --git a/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/XcpServerWrapperTest.java b/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/XcpServerWrapperTest.java index 6b9f9a9ba39a..7d2f6aeb426e 100644 --- a/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/XcpServerWrapperTest.java +++ b/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/XcpServerWrapperTest.java @@ -16,6 +16,7 @@ // under the License. package com.cloud.hypervisor.xenserver.resource.wrapper.xenbase; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -23,6 +24,9 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import com.cloud.agent.api.routing.GetAutoScaleMetricsAnswer; +import com.cloud.agent.api.routing.GetAutoScaleMetricsCommand; +import com.cloud.network.router.VirtualRouterAutoScale; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; @@ -35,6 +39,9 @@ import com.cloud.utils.exception.CloudRuntimeException; import com.xensource.xenapi.Connection; +import java.util.ArrayList; +import java.util.List; + @RunWith(PowerMockRunner.class) public class XcpServerWrapperTest { @@ -42,6 +49,10 @@ public class XcpServerWrapperTest { protected XcpServerResource XcpServerResource; + final static long[] vpcStats = { 1000L, 2000L }; + final static long[] networkStats = { 3000L, 4000L }; + final static long[] lbStats = { 5L }; + @Test public void testNetworkUsageCommandCreate() { final Connection conn = Mockito.mock(Connection.class); @@ -81,7 +92,7 @@ public void testNetworkUsageCommandGet() { assertNotNull(wrapper); when(XcpServerResource.getConnection()).thenReturn(conn); - when(XcpServerResource.getNetworkStats(conn, usageCommand.getPrivateIP())).thenReturn(new long[]{1l, 1l}); + when(XcpServerResource.getNetworkStats(conn, usageCommand.getPrivateIP(), null)).thenReturn(new long[]{1l, 1l}); final Answer answer = wrapper.execute(usageCommand, XcpServerResource); @@ -113,4 +124,92 @@ public void testNetworkUsageCommandExceptiopn() { assertFalse(answer.getResult()); } + + + @Test + public void testGetAutoScaleMetricsCommandForVpc() { + List metrics = new ArrayList<>(); + metrics.add(new VirtualRouterAutoScale.AutoScaleMetrics(VirtualRouterAutoScale.VirtualRouterAutoScaleCounter.LB_AVERAGE_CONNECTIONS, 1L, 2L, 3L, 4)); + metrics.add(new VirtualRouterAutoScale.AutoScaleMetrics(VirtualRouterAutoScale.VirtualRouterAutoScaleCounter.NETWORK_RECEIVED_AVERAGE_MBPS, 1L, 2L, 3L, 4)); + metrics.add(new VirtualRouterAutoScale.AutoScaleMetrics(VirtualRouterAutoScale.VirtualRouterAutoScaleCounter.NETWORK_TRANSMIT_AVERAGE_MBPS, 1L, 2L, 3L, 4)); + + final GetAutoScaleMetricsCommand getAutoScaleMetricsCommand = new GetAutoScaleMetricsCommand("192.168.10.10", true, "10.10.10.10", 8080, metrics); + + final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance(); + assertNotNull(wrapper); + + when(XcpServerResource.getVPCNetworkStats(getAutoScaleMetricsCommand.getPrivateIP(), getAutoScaleMetricsCommand.getPublicIP())).thenReturn(vpcStats); + when(XcpServerResource.getNetworkLbStats(getAutoScaleMetricsCommand.getPrivateIP(), getAutoScaleMetricsCommand.getPublicIP(), getAutoScaleMetricsCommand.getPort())).thenReturn(lbStats); + + final Answer answer = wrapper.execute(getAutoScaleMetricsCommand, XcpServerResource); + assertTrue(answer.getResult()); + assertTrue(answer instanceof GetAutoScaleMetricsAnswer); + + GetAutoScaleMetricsAnswer getAutoScaleMetricsAnswer = (GetAutoScaleMetricsAnswer) answer; + List values = getAutoScaleMetricsAnswer.getValues(); + + assertEquals(3, values.size()); + for (VirtualRouterAutoScale.AutoScaleMetricsValue value : values) { + if (value.getMetrics().getCounter().equals(VirtualRouterAutoScale.VirtualRouterAutoScaleCounter.LB_AVERAGE_CONNECTIONS)) { + assertEquals(Double.valueOf(lbStats[0]), value.getValue()); + } else if (value.getMetrics().getCounter().equals(VirtualRouterAutoScale.VirtualRouterAutoScaleCounter.NETWORK_TRANSMIT_AVERAGE_MBPS)) { + assertEquals(Double.valueOf(Double.valueOf(vpcStats[0]) / VirtualRouterAutoScale.MBITS_TO_BYTES), value.getValue()); + } else if (value.getMetrics().getCounter().equals(VirtualRouterAutoScale.VirtualRouterAutoScaleCounter.NETWORK_RECEIVED_AVERAGE_MBPS)) { + assertEquals(Double.valueOf(Double.valueOf(vpcStats[1]) / VirtualRouterAutoScale.MBITS_TO_BYTES), value.getValue()); + } + } + } + + @Test + public void testGetAutoScaleMetricsCommandForNetwork() { + List metrics = new ArrayList<>(); + metrics.add(new VirtualRouterAutoScale.AutoScaleMetrics(VirtualRouterAutoScale.VirtualRouterAutoScaleCounter.LB_AVERAGE_CONNECTIONS, 1L, 2L, 3L, 4)); + metrics.add(new VirtualRouterAutoScale.AutoScaleMetrics(VirtualRouterAutoScale.VirtualRouterAutoScaleCounter.NETWORK_RECEIVED_AVERAGE_MBPS, 1L, 2L, 3L, 4)); + metrics.add(new VirtualRouterAutoScale.AutoScaleMetrics(VirtualRouterAutoScale.VirtualRouterAutoScaleCounter.NETWORK_TRANSMIT_AVERAGE_MBPS, 1L, 2L, 3L, 4)); + + final GetAutoScaleMetricsCommand getAutoScaleMetricsCommand = new GetAutoScaleMetricsCommand("192.168.10.10", false, "10.10.10.10", 8080, metrics); + + final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance(); + assertNotNull(wrapper); + + final Connection conn = Mockito.mock(Connection.class); + when(XcpServerResource.getConnection()).thenReturn(conn); + when(XcpServerResource.getNetworkStats(conn, getAutoScaleMetricsCommand.getPrivateIP(), getAutoScaleMetricsCommand.getPublicIP())).thenReturn(networkStats); + when(XcpServerResource.getNetworkLbStats(getAutoScaleMetricsCommand.getPrivateIP(), getAutoScaleMetricsCommand.getPublicIP(), getAutoScaleMetricsCommand.getPort())).thenReturn(lbStats); + + final Answer answer = wrapper.execute(getAutoScaleMetricsCommand, XcpServerResource); + assertTrue(answer.getResult()); + assertTrue(answer instanceof GetAutoScaleMetricsAnswer); + + GetAutoScaleMetricsAnswer getAutoScaleMetricsAnswer = (GetAutoScaleMetricsAnswer) answer; + List values = getAutoScaleMetricsAnswer.getValues(); + + assertEquals(3, values.size()); + for (VirtualRouterAutoScale.AutoScaleMetricsValue value : values) { + if (value.getMetrics().getCounter().equals(VirtualRouterAutoScale.VirtualRouterAutoScaleCounter.LB_AVERAGE_CONNECTIONS)) { + assertEquals(Double.valueOf(lbStats[0]), value.getValue()); + } else if (value.getMetrics().getCounter().equals(VirtualRouterAutoScale.VirtualRouterAutoScaleCounter.NETWORK_TRANSMIT_AVERAGE_MBPS)) { + assertEquals(Double.valueOf(Double.valueOf(networkStats[0]) / VirtualRouterAutoScale.MBITS_TO_BYTES), value.getValue()); + } else if (value.getMetrics().getCounter().equals(VirtualRouterAutoScale.VirtualRouterAutoScaleCounter.NETWORK_RECEIVED_AVERAGE_MBPS)) { + assertEquals(Double.valueOf(Double.valueOf(networkStats[1]) / VirtualRouterAutoScale.MBITS_TO_BYTES), value.getValue()); + } + } + } + + @Test + public void testGetAutoScaleMetricsCommandWithException() { + List metrics = new ArrayList<>(); + + final GetAutoScaleMetricsCommand getAutoScaleMetricsCommand = new GetAutoScaleMetricsCommand("192.168.10.10", false, "10.10.10.10", 8080, metrics); + final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance(); + assertNotNull(wrapper); + + final Connection conn = Mockito.mock(Connection.class); + when(XcpServerResource.getConnection()).thenReturn(conn); + when(XcpServerResource.getNetworkStats(conn, getAutoScaleMetricsCommand.getPrivateIP(), getAutoScaleMetricsCommand.getPublicIP())).thenThrow(NumberFormatException.class); + + final Answer answer = wrapper.execute(getAutoScaleMetricsCommand, XcpServerResource); + assertFalse(answer.getResult()); + assertTrue(answer instanceof GetAutoScaleMetricsAnswer); + } } \ No newline at end of file diff --git a/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/XenServer56WrapperTest.java b/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/XenServer56WrapperTest.java index d69e265e386d..d3bdd2374443 100644 --- a/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/XenServer56WrapperTest.java +++ b/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/XenServer56WrapperTest.java @@ -16,6 +16,7 @@ // under the License. package com.cloud.hypervisor.xenserver.resource.wrapper.xenbase; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -34,20 +35,33 @@ import com.cloud.agent.api.FenceCommand; import com.cloud.agent.api.NetworkUsageCommand; import com.cloud.agent.api.SetupCommand; +import com.cloud.agent.api.routing.GetAutoScaleMetricsAnswer; +import com.cloud.agent.api.routing.GetAutoScaleMetricsCommand; import com.cloud.host.Host; import com.cloud.host.HostEnvironment; import com.cloud.hypervisor.xenserver.resource.XenServer56Resource; import com.cloud.hypervisor.xenserver.resource.XsHost; +import com.cloud.network.router.VirtualRouterAutoScale; +import com.cloud.network.router.VirtualRouterAutoScale.AutoScaleMetrics; +import com.cloud.network.router.VirtualRouterAutoScale.AutoScaleMetricsValue; +import com.cloud.network.router.VirtualRouterAutoScale.VirtualRouterAutoScaleCounter; import com.cloud.utils.ExecutionResult; import com.cloud.vm.VMInstanceVO; import com.xensource.xenapi.Connection; +import java.util.ArrayList; +import java.util.List; + @RunWith(PowerMockRunner.class) public class XenServer56WrapperTest { @Mock private XenServer56Resource xenServer56Resource; + final static long[] vpcStats = { 1000L, 2000L }; + final static long[] networkStats = { 3000L, 4000L }; + final static long[] lbStats = { 5L }; + @Test public void testCheckOnHostCommand() { final com.cloud.host.Host host = Mockito.mock(com.cloud.host.Host.class); @@ -93,7 +107,7 @@ public void testNetworkUsageCommandSuccess() { assertNotNull(wrapper); when(xenServer56Resource.getConnection()).thenReturn(conn); - when(xenServer56Resource.getNetworkStats(conn, networkCommand.getPrivateIP())).thenReturn(new long[]{1, 1}); + when(xenServer56Resource.getNetworkStats(conn, networkCommand.getPrivateIP(), null)).thenReturn(new long[]{1, 1}); final Answer answer = wrapper.execute(networkCommand, xenServer56Resource); @@ -112,7 +126,7 @@ public void testNetworkUsageCommandFailure() { assertNotNull(wrapper); when(xenServer56Resource.getConnection()).thenReturn(conn); - when(xenServer56Resource.getNetworkStats(conn, networkCommand.getPrivateIP())).thenReturn(new long[0]); + when(xenServer56Resource.getNetworkStats(conn, networkCommand.getPrivateIP(), null)).thenReturn(new long[0]); final Answer answer = wrapper.execute(networkCommand, xenServer56Resource); @@ -157,6 +171,93 @@ public void testNetworkUsageCommandCreateVpcFailure() { assertFalse(answer.getResult()); } + @Test + public void testGetAutoScaleMetricsCommandForVpc() { + List metrics = new ArrayList<>(); + metrics.add(new AutoScaleMetrics(VirtualRouterAutoScaleCounter.LB_AVERAGE_CONNECTIONS, 1L, 2L, 3L, 4)); + metrics.add(new AutoScaleMetrics(VirtualRouterAutoScaleCounter.NETWORK_RECEIVED_AVERAGE_MBPS, 1L, 2L, 3L, 4)); + metrics.add(new AutoScaleMetrics(VirtualRouterAutoScaleCounter.NETWORK_TRANSMIT_AVERAGE_MBPS, 1L, 2L, 3L, 4)); + + final GetAutoScaleMetricsCommand getAutoScaleMetricsCommand = new GetAutoScaleMetricsCommand("192.168.10.10", true, "10.10.10.10", 8080, metrics); + + final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance(); + assertNotNull(wrapper); + + when(xenServer56Resource.getVPCNetworkStats(getAutoScaleMetricsCommand.getPrivateIP(), getAutoScaleMetricsCommand.getPublicIP())).thenReturn(vpcStats); + when(xenServer56Resource.getNetworkLbStats(getAutoScaleMetricsCommand.getPrivateIP(), getAutoScaleMetricsCommand.getPublicIP(), getAutoScaleMetricsCommand.getPort())).thenReturn(lbStats); + + final Answer answer = wrapper.execute(getAutoScaleMetricsCommand, xenServer56Resource); + assertTrue(answer.getResult()); + assertTrue(answer instanceof GetAutoScaleMetricsAnswer); + + GetAutoScaleMetricsAnswer getAutoScaleMetricsAnswer = (GetAutoScaleMetricsAnswer) answer; + List values = getAutoScaleMetricsAnswer.getValues(); + + assertEquals(3, values.size()); + for (AutoScaleMetricsValue value : values) { + if (value.getMetrics().getCounter().equals(VirtualRouterAutoScale.VirtualRouterAutoScaleCounter.LB_AVERAGE_CONNECTIONS)) { + assertEquals(Double.valueOf(lbStats[0]), value.getValue()); + } else if (value.getMetrics().getCounter().equals(VirtualRouterAutoScale.VirtualRouterAutoScaleCounter.NETWORK_TRANSMIT_AVERAGE_MBPS)) { + assertEquals(Double.valueOf(Double.valueOf(vpcStats[0]) / VirtualRouterAutoScale.MBITS_TO_BYTES), value.getValue()); + } else if (value.getMetrics().getCounter().equals(VirtualRouterAutoScale.VirtualRouterAutoScaleCounter.NETWORK_RECEIVED_AVERAGE_MBPS)) { + assertEquals(Double.valueOf(Double.valueOf(vpcStats[1]) / VirtualRouterAutoScale.MBITS_TO_BYTES), value.getValue()); + } + } + } + + @Test + public void testGetAutoScaleMetricsCommandForNetwork() { + List metrics = new ArrayList<>(); + metrics.add(new AutoScaleMetrics(VirtualRouterAutoScaleCounter.LB_AVERAGE_CONNECTIONS, 1L, 2L, 3L, 4)); + metrics.add(new AutoScaleMetrics(VirtualRouterAutoScaleCounter.NETWORK_RECEIVED_AVERAGE_MBPS, 1L, 2L, 3L, 4)); + metrics.add(new AutoScaleMetrics(VirtualRouterAutoScaleCounter.NETWORK_TRANSMIT_AVERAGE_MBPS, 1L, 2L, 3L, 4)); + + final GetAutoScaleMetricsCommand getAutoScaleMetricsCommand = new GetAutoScaleMetricsCommand("192.168.10.10", false, "10.10.10.10", 8080, metrics); + + final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance(); + assertNotNull(wrapper); + + final Connection conn = Mockito.mock(Connection.class); + when(xenServer56Resource.getConnection()).thenReturn(conn); + when(xenServer56Resource.getNetworkStats(conn, getAutoScaleMetricsCommand.getPrivateIP(), getAutoScaleMetricsCommand.getPublicIP())).thenReturn(networkStats); + when(xenServer56Resource.getNetworkLbStats(getAutoScaleMetricsCommand.getPrivateIP(), getAutoScaleMetricsCommand.getPublicIP(), getAutoScaleMetricsCommand.getPort())).thenReturn(lbStats); + + final Answer answer = wrapper.execute(getAutoScaleMetricsCommand, xenServer56Resource); + assertTrue(answer.getResult()); + assertTrue(answer instanceof GetAutoScaleMetricsAnswer); + + GetAutoScaleMetricsAnswer getAutoScaleMetricsAnswer = (GetAutoScaleMetricsAnswer) answer; + List values = getAutoScaleMetricsAnswer.getValues(); + + assertEquals(3, values.size()); + for (AutoScaleMetricsValue value : values) { + if (value.getMetrics().getCounter().equals(VirtualRouterAutoScale.VirtualRouterAutoScaleCounter.LB_AVERAGE_CONNECTIONS)) { + assertEquals(Double.valueOf(lbStats[0]), value.getValue()); + } else if (value.getMetrics().getCounter().equals(VirtualRouterAutoScale.VirtualRouterAutoScaleCounter.NETWORK_TRANSMIT_AVERAGE_MBPS)) { + assertEquals(Double.valueOf(Double.valueOf(networkStats[0]) / VirtualRouterAutoScale.MBITS_TO_BYTES), value.getValue()); + } else if (value.getMetrics().getCounter().equals(VirtualRouterAutoScale.VirtualRouterAutoScaleCounter.NETWORK_RECEIVED_AVERAGE_MBPS)) { + assertEquals(Double.valueOf(Double.valueOf(networkStats[1]) / VirtualRouterAutoScale.MBITS_TO_BYTES), value.getValue()); + } + } + } + + @Test + public void testGetAutoScaleMetricsCommandWithException() { + List metrics = new ArrayList<>(); + + final GetAutoScaleMetricsCommand getAutoScaleMetricsCommand = new GetAutoScaleMetricsCommand("192.168.10.10", false, "10.10.10.10", 8080, metrics); + final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance(); + assertNotNull(wrapper); + + final Connection conn = Mockito.mock(Connection.class); + when(xenServer56Resource.getConnection()).thenReturn(conn); + when(xenServer56Resource.getNetworkStats(conn, getAutoScaleMetricsCommand.getPrivateIP(), getAutoScaleMetricsCommand.getPublicIP())).thenThrow(NumberFormatException.class); + + final Answer answer = wrapper.execute(getAutoScaleMetricsCommand, xenServer56Resource); + assertFalse(answer.getResult()); + assertTrue(answer instanceof GetAutoScaleMetricsAnswer); + } + @Test public void testSetupCommand() { final XsHost xsHost = Mockito.mock(XsHost.class); diff --git a/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java b/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java index e1c205e29cb2..36fb30015244 100644 --- a/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java +++ b/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java @@ -1576,6 +1576,7 @@ public boolean start() { true, false, false, false, false, false, false, false, true, true, false, false, true, false, false); + defaultKubernetesServiceNetworkOffering.setSupportsVmAutoScaling(true); defaultKubernetesServiceNetworkOffering.setState(NetworkOffering.State.Enabled); defaultKubernetesServiceNetworkOffering = networkOfferingDao.persistDefaultNetworkOffering(defaultKubernetesServiceNetworkOffering); diff --git a/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterDestroyWorker.java b/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterDestroyWorker.java index 47acf31f10f7..88ecbf2d5d45 100644 --- a/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterDestroyWorker.java +++ b/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterDestroyWorker.java @@ -92,7 +92,7 @@ private boolean destroyClusterVMs() { } try { UserVm vm = userVmService.destroyVm(vmID, true); - if (!userVmManager.expunge(userVM, CallContext.current().getCallingUserId(), CallContext.current().getCallingAccount())) { + if (!userVmManager.expunge(userVM)) { LOGGER.warn(String.format("Unable to expunge VM %s : %s, destroying Kubernetes cluster will probably fail", vm.getInstanceName() , vm.getUuid())); } diff --git a/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterScaleWorker.java b/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterScaleWorker.java index dbd55b95e07c..a335757450bd 100644 --- a/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterScaleWorker.java +++ b/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterScaleWorker.java @@ -27,7 +27,6 @@ import javax.inject.Inject; import org.apache.cloudstack.api.InternalIdentity; -import org.apache.cloudstack.context.CallContext; import org.apache.commons.collections.CollectionUtils; import org.apache.log4j.Level; @@ -313,7 +312,7 @@ private void removeNodesFromCluster(List vmMaps) throw } try { UserVm vm = userVmService.destroyVm(userVM.getId(), true); - if (!userVmManager.expunge(userVM, CallContext.current().getCallingUserId(), CallContext.current().getCallingAccount())) { + if (!userVmManager.expunge(userVM)) { logTransitStateAndThrow(Level.ERROR, String.format("Scaling Kubernetes cluster %s failed, unable to expunge VM '%s'." , kubernetesCluster.getName(), vm.getDisplayName()), kubernetesCluster.getId(), KubernetesCluster.Event.OperationFailed); } diff --git a/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterStartWorker.java b/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterStartWorker.java index 679f2e8f59b2..39e45d1f9edf 100644 --- a/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterStartWorker.java +++ b/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterStartWorker.java @@ -393,7 +393,7 @@ private void provisionLoadBalancerRule(final IpAddress publicIp, final Network n ips.add(controlVmNic.getIPv4Address()); vmIdIpMap.put(clusterVMIds.get(i), ips); } - lbService.assignToLoadBalancer(lb.getId(), null, vmIdIpMap); + lbService.assignToLoadBalancer(lb.getId(), null, vmIdIpMap, false); } /** diff --git a/plugins/network-elements/netscaler/src/main/java/com/cloud/network/element/NetscalerElement.java b/plugins/network-elements/netscaler/src/main/java/com/cloud/network/element/NetscalerElement.java index 1df16404d399..1339113711e4 100644 --- a/plugins/network-elements/netscaler/src/main/java/com/cloud/network/element/NetscalerElement.java +++ b/plugins/network-elements/netscaler/src/main/java/com/cloud/network/element/NetscalerElement.java @@ -124,6 +124,7 @@ import com.cloud.network.dao.PhysicalNetworkDao; import com.cloud.network.dao.PhysicalNetworkVO; import com.cloud.network.lb.LoadBalancingRule; +import com.cloud.network.lb.LoadBalancingRulesManager; import com.cloud.network.lb.LoadBalancingRule.LbDestination; import com.cloud.network.resource.NetScalerControlCenterResource; import com.cloud.network.resource.NetscalerResource; @@ -159,8 +160,6 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl IpDeployer, StaticNatServiceProvider, GslbServiceProvider { private static final Logger s_logger = Logger.getLogger(NetscalerElement.class); - public static final AutoScaleCounterType AutoScaleCounterSnmp = new AutoScaleCounterType("snmp"); - public static final AutoScaleCounterType AutoScaleCounterNetscaler = new AutoScaleCounterType("netscaler"); @Inject NetworkModel _networkManager; @@ -210,6 +209,8 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl NetworkOfferingDao _networkOfferingDao = null; @Inject NetScalerVMManager _netScalerVMManager; + @Inject + LoadBalancingRulesManager lbRulesManager; private boolean canHandle(Network config, Service service) { DataCenter zone = _dcDao.findById(config.getDataCenterId()); @@ -514,18 +515,19 @@ public Map> getCapabilities() { // list of counters it supports AutoScaleCounter counter; List counterList = new ArrayList(); - counter = new AutoScaleCounter(AutoScaleCounterSnmp); + counter = new AutoScaleCounter(AutoScaleCounterType.Snmp); counterList.add(counter); counter.addParam("snmpcommunity", true, "the community string that has to be used to do a SNMP GET on the AutoScaled Vm", false); counter.addParam("snmpport", false, "the port at which SNMP agent is running on the AutoScaled Vm", false); - counter = new AutoScaleCounter(AutoScaleCounterNetscaler); + counter = new AutoScaleCounter(AutoScaleCounterType.Netscaler); counterList.add(counter); Gson gson = new Gson(); String autoScaleCounterList = gson.toJson(counterList); lbCapabilities.put(Capability.AutoScaleCounters, autoScaleCounterList); + lbCapabilities.put(Capability.VmAutoScaling, "true"); LbStickinessMethod method; List methodList = new ArrayList(); @@ -1128,7 +1130,7 @@ public boolean applyElasticLoadBalancerRules(Network network, List policies = vmGroupTO.getPolicies(); final int interval = vmGroupTO.getInterval(); - profileTO.getCounterParamList(); String snmpCommunity = null; int snmpPort = DEFAULT_SNMP_PORT; long cur_prirotiy = 1; @@ -3084,7 +3087,7 @@ private synchronized boolean enableAutoScaleConfig(final LoadBalancerTO loadBala final com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction scaleDownAction = new com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction(); - final Integer destroyVmGracePeriod = profileTO.getDestroyVmGraceperiod(); + final Integer expungeVmGracePeriod = profileTO.getExpungeVmGracePeriod(); try { scaleDownAction.set_name(scaleDownActionName); scaleDownAction.set_type("SCALE_DOWN"); // TODO: will this be called de-provision? @@ -3094,7 +3097,7 @@ private synchronized boolean enableAutoScaleConfig(final LoadBalancerTO loadBala scaleDownAction.set_quiettime(scaleDownQuietTime); final String scaleDownParameters = "command=destroyVirtualMachine" + "&" + "lbruleid=" + loadBalancerTO.getUuid(); scaleDownAction.set_parameters(scaleDownParameters); - scaleDownAction.set_vmdestroygraceperiod(destroyVmGracePeriod); + scaleDownAction.set_vmdestroygraceperiod(expungeVmGracePeriod); autoscaleaction.add(_netscalerService, scaleDownAction); } catch (final Exception e) { // Ignore Exception on cleanup @@ -3124,13 +3127,13 @@ private synchronized boolean enableAutoScaleConfig(final LoadBalancerTO loadBala for (final ConditionTO conditionTO : conditions) { final CounterTO counterTO = conditionTO.getCounter(); String counterName = counterTO.getName(); - final String operator = conditionTO.getRelationalOperator(); + final Condition.Operator operator = conditionTO.getRelationalOperator(); final long threshold = conditionTO.getThreshold(); final StringBuilder conditionExpression = new StringBuilder(); try(Formatter formatter = new Formatter(conditionExpression, Locale.US);) { - if (counterTO.getSource().equals("snmp")) { + if (counterTO.getSource().equals(Counter.Source.SNMP)) { counterName = generateSnmpMetricName(counterName); if (snmpMetrics.size() == 0) { // Create Metric Table @@ -3230,7 +3233,7 @@ private synchronized boolean enableAutoScaleConfig(final LoadBalancerTO loadBala final 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); - } else if (counterTO.getSource().equals("netscaler")) { + } else if (counterTO.getSource().equals(Counter.Source.NETSCALER)) { //SYS.VSERVER("abcd").RESPTIME.GT(10) formatter.format("SYS.VSERVER(\"%s\").%s.%s(%d)", nsVirtualServerName, counterTO.getValue(), operator, threshold); } @@ -3307,7 +3310,7 @@ private synchronized boolean disableAutoScaleConfig(final LoadBalancerTO loadBal final List conditions = autoScalePolicyTO.getConditions(); for (final ConditionTO conditionTO : conditions) { final CounterTO counterTO = conditionTO.getCounter(); - if (counterTO.getSource().equals("snmp")) { + if (counterTO.getSource().equals(Counter.Source.SNMP)) { isSnmp = true; break; } @@ -3511,11 +3514,11 @@ private boolean isAutoScaleSupportedInNetScaler() throws ExecutionException { } private boolean isScaleUpPolicy(final AutoScalePolicyTO autoScalePolicyTO) { - return autoScalePolicyTO.getAction().equals("scaleup"); + return autoScalePolicyTO.getAction().equals(AutoScalePolicy.Action.SCALEUP); } private boolean isScaleDownPolicy(final AutoScalePolicyTO autoScalePolicyTO) { - return autoScalePolicyTO.getAction().equals("scaledown"); + return autoScalePolicyTO.getAction().equals(AutoScalePolicy.Action.SCALEDOWN); } private void saveConfiguration() throws ExecutionException { diff --git a/scripts/vm/hypervisor/xenserver/perfmon.py b/scripts/vm/hypervisor/xenserver/perfmon.py index 7e0fdd11567c..c310cdcf3568 100755 --- a/scripts/vm/hypervisor/xenserver/perfmon.py +++ b/scripts/vm/hypervisor/xenserver/perfmon.py @@ -75,7 +75,7 @@ def get_vm_param_list(self, uuid): return report.keys() def get_total_cpu_core(self, uuid): - report = self.vm_reports[uuid] + report = self.vm_reports[uuid] if not report: return 0 else: @@ -87,8 +87,8 @@ def get_total_cpu_core(self, uuid): return result def get_vm_data(self, uuid, param, row): - #pp = pprint.PrettyPrinter(indent=4) - #pp.pprint(self.vm_reports) + #pp = pprint.PrettyPrinter(indent=4) + #pp.pprint(self.vm_reports) report = self.vm_reports[uuid] col = report[param] return self.__lookup_data(col, row) @@ -135,15 +135,15 @@ def refresh(self, login, starttime, session, override_params): paramstr = "&".join(["%s=%s" % (k, params[k]) for k in params]) # this is better than urllib.urlopen() as it raises an Exception on http 401 'Unauthorised' error # rather than drop into interactive mode - for host in login.host.get_all(): - #print "http://" + str(login.host.get_address(host)) + "/rrd_updates?%s" % paramstr - sock = urllib.URLopener().open("http://" + str(login.host.get_address(host)) + "/rrd_updates?%s" % paramstr) - xmlsource = sock.read() - sock.close() - xmldoc = minidom.parseString(xmlsource) - self.__parse_xmldoc(xmldoc) - # Update the time used on the next run - self.params['start'] = self.end_time + 1 # avoid retrieving same data twice + for host in login.host.get_all(): + #print "http://" + str(login.host.get_address(host)) + "/rrd_updates?%s" % paramstr + sock = urllib.URLopener().open("http://" + str(login.host.get_address(host)) + "/rrd_updates?%s" % paramstr) + xmlsource = sock.read() + sock.close() + xmldoc = minidom.parseString(xmlsource) + self.__parse_xmldoc(xmldoc) + # Update the time used on the next run + self.params['start'] = self.end_time + 1 # avoid retrieving same data twice def __parse_xmldoc(self, xmldoc): # The 1st node contains meta data (description of the data) @@ -165,7 +165,7 @@ def lookup_metadata_bytag(name): self.legend = self.meta_node.getElementsByTagName('legend')[0] # vm_reports matches uuid to per VM report if not hasattr(self,'vm_reports'): - self.vm_reports = {} + self.vm_reports = {} # There is just one host_report and its uuid should not change! self.host_report = None # Handle each column. (I.e. each variable) @@ -198,7 +198,7 @@ def __handle_col(self, col): def getuuid(vm_name): status, output = commands.getstatusoutput("xe vm-list | grep "+vm_name+" -B 1 | head -n 1 | awk -F':' '{print $2}' | tr -d ' '") if (status != 0): - raise PerfMonException("Invalid vm name: %s" % vm_name) + raise PerfMonException("Invalid vm name: %s" % vm_name) return output def get_vm_group_perfmon(args={}): @@ -228,19 +228,19 @@ def get_vm_group_perfmon(args={}): #for uuid in rrd_updates.get_vm_list(): for vm_count in xrange(1, total_vm + 1): - vm_name = args['vmname' + str(vm_count)] + vm_name = args['vmname' + str(vm_count)] vm_uuid = getuuid(vm_name) #print "Got values for VM: " + str(vm_count) + " " + vm_uuid for counter_count in xrange(1, total_counter + 1): - #refresh average - average_cpu = 0 - average_memory = 0 + #refresh average + average_cpu = 0 + average_memory = 0 counter = args['counter' + str(counter_count)] total_row = rrd_updates.get_nrows() duration = int(args['duration' + str(counter_count)]) / 60 duration_diff = total_row - duration if counter == "cpu": - total_cpu = rrd_updates.get_total_cpu_core(vm_uuid) + total_cpu = rrd_updates.get_total_cpu_core(vm_uuid) for row in xrange(duration_diff, total_row): for cpu in xrange(0, total_cpu): average_cpu += rrd_updates.get_vm_data(vm_uuid, "cpu" + str(cpu), row) diff --git a/server/src/main/java/com/cloud/api/ApiDBUtils.java b/server/src/main/java/com/cloud/api/ApiDBUtils.java index 6780a3a98f94..162b1f38addd 100644 --- a/server/src/main/java/com/cloud/api/ApiDBUtils.java +++ b/server/src/main/java/com/cloud/api/ApiDBUtils.java @@ -128,6 +128,7 @@ import com.cloud.network.as.dao.AutoScalePolicyDao; import com.cloud.network.as.dao.AutoScaleVmGroupDao; import com.cloud.network.as.dao.AutoScaleVmGroupPolicyMapDao; +import com.cloud.network.as.dao.AutoScaleVmGroupVmMapDao; import com.cloud.network.as.dao.AutoScaleVmProfileDao; import com.cloud.network.as.dao.ConditionDao; import com.cloud.network.as.dao.CounterDao; @@ -418,6 +419,7 @@ public class ApiDBUtils { static ConditionDao s_asConditionDao; static AutoScalePolicyConditionMapDao s_asPolicyConditionMapDao; static AutoScaleVmGroupPolicyMapDao s_asVmGroupPolicyMapDao; + static AutoScaleVmGroupVmMapDao s_autoScaleVmGroupVmMapDao; static AutoScalePolicyDao s_asPolicyDao; static AutoScaleVmProfileDao s_asVmProfileDao; static AutoScaleVmGroupDao s_asVmGroupDao; @@ -619,6 +621,8 @@ public class ApiDBUtils { @Inject private AutoScaleVmGroupPolicyMapDao asVmGroupPolicyMapDao; @Inject + private AutoScaleVmGroupVmMapDao autoScaleVmGroupVmMapDao; + @Inject private AutoScalePolicyDao asPolicyDao; @Inject private AutoScaleVmProfileDao asVmProfileDao; @@ -799,6 +803,7 @@ void init() { s_asPolicyConditionMapDao = asPolicyConditionMapDao; s_counterDao = counterDao; s_asVmGroupPolicyMapDao = asVmGroupPolicyMapDao; + s_autoScaleVmGroupVmMapDao = autoScaleVmGroupVmMapDao; s_tagJoinDao = tagJoinDao; s_vmGroupJoinDao = vmGroupJoinDao; s_eventJoinDao = eventJoinDao; @@ -1552,7 +1557,7 @@ public static void getAutoScaleVmGroupPolicyIds(long vmGroupId, List scale List vos = s_asVmGroupPolicyMapDao.listByVmGroupId(vmGroupId); for (AutoScaleVmGroupPolicyMapVO vo : vos) { AutoScalePolicy autoScalePolicy = s_asPolicyDao.findById(vo.getPolicyId()); - if (autoScalePolicy.getAction().equals("scaleup")) { + if (autoScalePolicy.getAction().equals(AutoScalePolicy.Action.SCALEUP)) { scaleUpPolicyIds.add(autoScalePolicy.getId()); } else { scaleDownPolicyIds.add(autoScalePolicy.getId()); @@ -1577,7 +1582,7 @@ public static void getAutoScaleVmGroupPolicies(long vmGroupId, List vos = s_asVmGroupPolicyMapDao.listByVmGroupId(vmGroupId); for (AutoScaleVmGroupPolicyMapVO vo : vos) { AutoScalePolicy autoScalePolicy = s_asPolicyDao.findById(vo.getPolicyId()); - if (autoScalePolicy.getAction().equals("scaleup")) { + if (autoScalePolicy.getAction().equals(AutoScalePolicy.Action.SCALEUP)) { scaleUpPolicies.add(autoScalePolicy); } else { scaleDownPolicies.add(autoScalePolicy); @@ -1621,6 +1626,10 @@ public static AutoScaleVmGroupVO findAutoScaleVmGroupById(long groupId) { return s_asVmGroupDao.findById(groupId); } + public static int countAvailableVmsByGroupId(long groupId) { + return s_autoScaleVmGroupVmMapDao.countAvailableVmsByGroup(groupId); + } + public static GuestOSCategoryVO findGuestOsCategoryById(long catId) { return s_guestOSCategoryDao.findById(catId); } diff --git a/server/src/main/java/com/cloud/api/ApiResponseHelper.java b/server/src/main/java/com/cloud/api/ApiResponseHelper.java index af746ef6f748..e08ba5250e9e 100644 --- a/server/src/main/java/com/cloud/api/ApiResponseHelper.java +++ b/server/src/main/java/com/cloud/api/ApiResponseHelper.java @@ -295,11 +295,11 @@ import com.cloud.network.dao.NetworkDao; import com.cloud.network.dao.NetworkDetailVO; import com.cloud.network.dao.NetworkDetailsDao; +import com.cloud.network.dao.NetworkServiceMapDao; import com.cloud.network.dao.NetworkVO; import com.cloud.network.dao.PhysicalNetworkVO; import com.cloud.network.router.VirtualRouter; import com.cloud.network.rules.FirewallRule; -import com.cloud.network.rules.FirewallRuleVO; import com.cloud.network.rules.HealthCheckPolicy; import com.cloud.network.rules.LoadBalancer; import com.cloud.network.rules.LoadBalancerContainer.Scheme; @@ -448,6 +448,8 @@ public class ApiResponseHelper implements ResponseGenerator { Ipv6Service ipv6Service; @Inject UserVmJoinDao userVmJoinDao; + @Inject + NetworkServiceMapDao ntwkSrvcDao; @Override public UserResponse createUserResponse(User user) { @@ -2178,6 +2180,11 @@ public NetworkOfferingResponse createNetworkOfferingResponse(NetworkOffering off inline.setValue(offering.isInline() ? "true" : "false"); lbCapResponse.add(inline); + CapabilityResponse vmAutoScaling = new CapabilityResponse(); + vmAutoScaling.setName(Capability.VmAutoScaling.getName()); + vmAutoScaling.setValue(offering.isSupportsVmAutoScaling() ? "true" : "false"); + lbCapResponse.add(vmAutoScaling); + svcRsp.setCapabilities(lbCapResponse); } else if (Service.SourceNat == service) { List capabilities = new ArrayList(); @@ -2523,6 +2530,7 @@ public NetworkResponse createNetworkResponse(ResponseView view, Network network) response.setExternalId(network.getExternalId()); response.setRedundantRouter(network.isRedundant()); response.setCreated(network.getCreated()); + response.setSupportsVmAutoScaling(networkOfferingDao.findByIdIncludingRemoved(network.getNetworkOfferingId()).isSupportsVmAutoScaling()); Long bytesReceived = 0L; Long bytesSent = 0L; @@ -3296,6 +3304,7 @@ public CounterResponse createCounterResponse(Counter counter) { response.setSource(counter.getSource().toString()); response.setName(counter.getName()); response.setValue(counter.getValue()); + response.setProvider(counter.getProvider()); response.setObjectName("counter"); return response; } @@ -3304,9 +3313,11 @@ public CounterResponse createCounterResponse(Counter counter) { public ConditionResponse createConditionResponse(Condition condition) { ConditionResponse response = new ConditionResponse(); response.setId(condition.getUuid()); - List counterResponseList = new ArrayList(); - counterResponseList.add(createCounterResponse(ApiDBUtils.getCounter(condition.getCounterid()))); - response.setCounterResponse(counterResponseList); + Counter counter = ApiDBUtils.getCounter(condition.getCounterId()); + response.setCounterId(counter.getUuid()); + response.setCounterName(counter.getName()); + CounterResponse counterResponse = createCounterResponse(counter); + response.setCounterResponse(counterResponse); response.setRelationalOperator(condition.getRelationalOperator().toString()); response.setThreshold(condition.getThreshold()); response.setObjectName("condition"); @@ -3336,9 +3347,10 @@ public AutoScaleVmProfileResponse createAutoScaleVmProfileResponse(AutoScaleVmPr response.setTemplateId(template.getUuid()); } } - response.setOtherDeployParams(profile.getOtherDeployParams()); + response.setUserData(profile.getUserData()); + response.setOtherDeployParams(profile.getOtherDeployParamsList()); response.setCounterParams(profile.getCounterParams()); - response.setDestroyVmGraceperiod(profile.getDestroyVmGraceperiod()); + response.setExpungeVmGracePeriod(profile.getExpungeVmGracePeriod()); User user = ApiDBUtils.findUserById(profile.getAutoScaleUserId()); if (user != null) { response.setAutoscaleUserId(user.getUuid()); @@ -3354,9 +3366,10 @@ public AutoScaleVmProfileResponse createAutoScaleVmProfileResponse(AutoScaleVmPr public AutoScalePolicyResponse createAutoScalePolicyResponse(AutoScalePolicy policy) { AutoScalePolicyResponse response = new AutoScalePolicyResponse(); response.setId(policy.getUuid()); + response.setName(policy.getName()); response.setDuration(policy.getDuration()); response.setQuietTime(policy.getQuietTime()); - response.setAction(policy.getAction()); + response.setAction(policy.getAction().toString()); List vos = ApiDBUtils.getAutoScalePolicyConditions(policy.getId()); ArrayList conditions = new ArrayList(vos.size()); for (ConditionVO vo : vos) { @@ -3375,18 +3388,43 @@ public AutoScalePolicyResponse createAutoScalePolicyResponse(AutoScalePolicy pol public AutoScaleVmGroupResponse createAutoScaleVmGroupResponse(AutoScaleVmGroup vmGroup) { AutoScaleVmGroupResponse response = new AutoScaleVmGroupResponse(); response.setId(vmGroup.getUuid()); + response.setName(vmGroup.getName()); response.setMinMembers(vmGroup.getMinMembers()); response.setMaxMembers(vmGroup.getMaxMembers()); - response.setState(vmGroup.getState()); + response.setState(vmGroup.getState().toString()); response.setInterval(vmGroup.getInterval()); response.setForDisplay(vmGroup.isDisplay()); + response.setCreated(vmGroup.getCreated()); AutoScaleVmProfileVO profile = ApiDBUtils.findAutoScaleVmProfileById(vmGroup.getProfileId()); if (profile != null) { response.setProfileId(profile.getUuid()); } - FirewallRuleVO fw = ApiDBUtils.findFirewallRuleById(vmGroup.getLoadBalancerId()); + response.setAvailableVirtualMachineCount(ApiDBUtils.countAvailableVmsByGroupId(vmGroup.getId())); + LoadBalancerVO fw = ApiDBUtils.findLoadBalancerById(vmGroup.getLoadBalancerId()); if (fw != null) { response.setLoadBalancerId(fw.getUuid()); + + NetworkVO network = ApiDBUtils.findNetworkById(fw.getNetworkId()); + + if (network != null) { + response.setNetworkName(network.getName()); + response.setNetworkId(network.getUuid()); + + String provider = ntwkSrvcDao.getProviderForServiceInNetwork(network.getId(), Service.Lb); + if (provider != null) { + response.setLbProvider(provider); + } else { + response.setLbProvider(Network.Provider.None.toString()); + } + } + + IPAddressVO publicIp = ApiDBUtils.findIpAddressById(fw.getSourceIpAddressId()); + if (publicIp != null) { + response.setPublicIpId(publicIp.getUuid()); + response.setPublicIp(publicIp.getAddress().addr()); + response.setPublicPort(Integer.toString(fw.getSourcePortStart())); + response.setPrivatePort(Integer.toString(fw.getDefaultPortStart())); + } } List scaleUpPoliciesResponse = new ArrayList(); @@ -3407,6 +3445,10 @@ public AutoScaleVmGroupResponse createAutoScaleVmGroupResponse(AutoScaleVmGroup scaleDownPoliciesResponse.add(createAutoScalePolicyResponse(autoScalePolicy)); } + response.setHasAnnotation(annotationDao.hasAnnotations(vmGroup.getUuid(), AnnotationService.EntityType.AUTOSCALE_VM_GROUP.name(), + _accountMgr.isRootAdmin(CallContext.current().getCallingAccount().getId()))); + + populateOwner(response, vmGroup); return response; } diff --git a/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java b/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java index d115a0b774bd..fbf9525993a4 100644 --- a/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java +++ b/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java @@ -1035,6 +1035,7 @@ private Pair, Integer> searchForUserVMsInternal(ListVMsCmd cm Object securityGroupId = cmd.getSecurityGroupId(); Object backupOfferingId = cmd.getBackupOfferingId(); Object isHaEnabled = cmd.getHaEnabled(); + Object autoScaleVmGroupId = cmd.getAutoScaleVmGroupId(); Object pod = null; Long clusterId = null; Object hostId = null; @@ -1079,7 +1080,6 @@ private Pair, Integer> searchForUserVMsInternal(ListVMsCmd cm sb.and("haEnabled", sb.entity().isHaEnabled(), SearchCriteria.Op.EQ); } - if (groupId != null && (Long)groupId != -1) { sb.and("instanceGroupId", sb.entity().getInstanceGroupId(), SearchCriteria.Op.EQ); } @@ -1121,6 +1121,10 @@ private Pair, Integer> searchForUserVMsInternal(ListVMsCmd cm sb.and("securityGroupId", sb.entity().getSecurityGroupId(), SearchCriteria.Op.EQ); } + if (autoScaleVmGroupId != null) { + sb.and("autoScaleVmGroupId", sb.entity().getAutoScaleVmGroupId(), SearchCriteria.Op.EQ); + } + // populate the search criteria with the values passed in SearchCriteria sc = sb.create(); @@ -1165,6 +1169,10 @@ private Pair, Integer> searchForUserVMsInternal(ListVMsCmd cm sc.setParameters("securityGroupId", securityGroupId); } + if (autoScaleVmGroupId != null) { + sc.setParameters("autoScaleVmGroupId", autoScaleVmGroupId); + } + if (display != null) { sc.setParameters("display", display); } diff --git a/server/src/main/java/com/cloud/api/query/dao/UserVmJoinDaoImpl.java b/server/src/main/java/com/cloud/api/query/dao/UserVmJoinDaoImpl.java index 6f9cc614232a..55a328e83c16 100644 --- a/server/src/main/java/com/cloud/api/query/dao/UserVmJoinDaoImpl.java +++ b/server/src/main/java/com/cloud/api/query/dao/UserVmJoinDaoImpl.java @@ -398,6 +398,13 @@ public UserVmResponse newUserVmResponse(ResponseView view, String objectName, Us userVmResponse.setDynamicallyScalable(userVm.isDynamicallyScalable()); } + if (userVm.getAutoScaleVmGroupName() != null) { + userVmResponse.setAutoScaleVmGroupName(userVm.getAutoScaleVmGroupName()); + } + if (userVm.getAutoScaleVmGroupUuid() != null) { + userVmResponse.setAutoScaleVmGroupId(userVm.getAutoScaleVmGroupUuid()); + } + if (userVm.getUserDataId() != null) { userVmResponse.setUserDataId(userVm.getUserDataUUid()); userVmResponse.setUserDataName(userVm.getUserDataName()); diff --git a/server/src/main/java/com/cloud/api/query/vo/NetworkOfferingJoinVO.java b/server/src/main/java/com/cloud/api/query/vo/NetworkOfferingJoinVO.java index 981acc8bbffd..59bb3691fa03 100644 --- a/server/src/main/java/com/cloud/api/query/vo/NetworkOfferingJoinVO.java +++ b/server/src/main/java/com/cloud/api/query/vo/NetworkOfferingJoinVO.java @@ -148,6 +148,9 @@ public class NetworkOfferingJoinVO extends BaseViewVO implements NetworkOffering @Column(name = "supports_public_access") private boolean supportsPublicAccess = false; + @Column(name = "supports_vm_autoscaling") + boolean supportsVmAutoScaling = false; + @Column(name = "for_vpc") private boolean forVpc; @@ -401,4 +404,9 @@ public void setZoneName(String zoneName) { public String getInternetProtocol() { return internetProtocol; } + + @Override + public boolean isSupportsVmAutoScaling() { + return supportsVmAutoScaling; + } } diff --git a/server/src/main/java/com/cloud/api/query/vo/UserVmJoinVO.java b/server/src/main/java/com/cloud/api/query/vo/UserVmJoinVO.java index 4e89cbeb512b..9a17a89c4b5e 100644 --- a/server/src/main/java/com/cloud/api/query/vo/UserVmJoinVO.java +++ b/server/src/main/java/com/cloud/api/query/vo/UserVmJoinVO.java @@ -379,6 +379,15 @@ public class UserVmJoinVO extends BaseViewWithTagInformationVO implements Contro @Column(name = "affinity_group_description") private String affinityGroupDescription; + @Column(name = "autoscale_vmgroup_id") + private long autoScaleVmGroupId; + + @Column(name = "autoscale_vmgroup_uuid") + private String autoScaleVmGroupUuid; + + @Column(name = "autoscale_vmgroup_name") + private String autoScaleVmGroupName; + @Column(name = "user_data_id") private Long userDataId; @@ -407,6 +416,7 @@ public class UserVmJoinVO extends BaseViewWithTagInformationVO implements Contro public UserVmJoinVO() { + // Empty constructor } @Override @@ -522,10 +532,6 @@ public String getInstanceName() { return instanceName; } - public long getGuestOSId() { - return guestOsId; - } - public String getGuestOsUuid() { return guestOsUuid; } @@ -808,7 +814,7 @@ public String getPoolUuid() { return poolUuid; } - public String getVolume_uuid() { + public String getVolumeUuid() { return volumeUuid; } @@ -882,6 +888,18 @@ public String getAffinityGroupDescription() { return affinityGroupDescription; } + public long getAutoScaleVmGroupId() { + return autoScaleVmGroupId; + } + + public String getAutoScaleVmGroupUuid() { + return autoScaleVmGroupUuid; + } + + public String getAutoScaleVmGroupName() { + return autoScaleVmGroupName; + } + public Boolean isDynamicallyScalable() { return isDynamicallyScalable; } diff --git a/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java index 30edca3e8d08..b7ed11a61abe 100755 --- a/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java @@ -6043,9 +6043,10 @@ public NetworkOffering createNetworkOffering(final CreateNetworkOfferingCmd cmd) void validateLoadBalancerServiceCapabilities(final Map lbServiceCapabilityMap) { if (lbServiceCapabilityMap != null && !lbServiceCapabilityMap.isEmpty()) { - if (lbServiceCapabilityMap.keySet().size() > 3 || !lbServiceCapabilityMap.containsKey(Capability.SupportedLBIsolation)) { - throw new InvalidParameterValueException("Only " + Capability.SupportedLBIsolation.getName() + ", " + Capability.ElasticLb.getName() + ", " - + Capability.InlineMode.getName() + " capabilities can be sepcified for LB service"); + if (lbServiceCapabilityMap.keySet().size() > 4 || !lbServiceCapabilityMap.containsKey(Capability.SupportedLBIsolation)) { + throw new InvalidParameterValueException(String.format("Only %s capabilities can be specified for LB service", + StringUtils.join(Capability.SupportedLBIsolation.getName(), Capability.ElasticLb.getName(), + Capability.InlineMode.getName(), Capability.LbSchemes.getName(), Capability.VmAutoScaling.getName()))); } for (final Capability cap : lbServiceCapabilityMap.keySet()) { @@ -6074,9 +6075,16 @@ void validateLoadBalancerServiceCapabilities(final Map lbSer if (!internalLb && !publicLb) { throw new InvalidParameterValueException("Unknown specified value for " + Capability.LbSchemes.getName()); } + } else if (cap == Capability.VmAutoScaling) { + final boolean enabled = value.contains("true"); + final boolean disabled = value.contains("false"); + if (!enabled && !disabled) { + throw new InvalidParameterValueException("Unknown specified value for " + Capability.VmAutoScaling.getName()); + } } else { - throw new InvalidParameterValueException("Only " + Capability.SupportedLBIsolation.getName() + ", " + Capability.ElasticLb.getName() + ", " - + Capability.InlineMode.getName() + ", " + Capability.LbSchemes.getName() + " capabilities can be sepcified for LB service"); + throw new InvalidParameterValueException(String.format("Only %s capabilities can be specified for LB service", + StringUtils.join(Capability.SupportedLBIsolation.getName(), Capability.ElasticLb.getName(), + Capability.InlineMode.getName(), Capability.LbSchemes.getName(), Capability.VmAutoScaling.getName()))); } } } @@ -6236,6 +6244,7 @@ public NetworkOfferingVO createNetworkOffering(final String name, final String d boolean internalLb = false; boolean strechedL2Subnet = false; boolean publicAccess = false; + boolean vmAutoScaling = false; if (serviceCapabilityMap != null && !serviceCapabilityMap.isEmpty()) { final Map lbServiceCapabilityMap = serviceCapabilityMap.get(Service.Lb); @@ -6270,6 +6279,12 @@ public NetworkOfferingVO createNetworkOffering(final String name, final String d publicLb = publicLbStr.contains("public"); } } + + final String vmAutoScalingStr = lbServiceCapabilityMap.get(Capability.VmAutoScaling); + if (vmAutoScalingStr != null) { + _networkModel.checkCapabilityForProvider(serviceProviderMap.get(Service.Lb), Service.Lb, Capability.VmAutoScaling, vmAutoScalingStr); + vmAutoScaling = vmAutoScalingStr.contains("true"); + } } // in the current version of the code, publicLb and specificLb can't @@ -6340,6 +6355,9 @@ public NetworkOfferingVO createNetworkOffering(final String name, final String d offeringFinal.setState(NetworkOffering.State.Enabled); } + // Set VM AutoScaling capability + offeringFinal.setSupportsVmAutoScaling(vmAutoScaling); + //Set Service package id offeringFinal.setServicePackage(servicePackageUuid); // validate the details diff --git a/server/src/main/java/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java b/server/src/main/java/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java index df8e371e8bc4..34f1c4b2bcae 100644 --- a/server/src/main/java/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java +++ b/server/src/main/java/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java @@ -97,6 +97,7 @@ import com.cloud.network.element.NetworkElement; import com.cloud.network.element.StaticNatServiceProvider; import com.cloud.network.lb.LoadBalancingRule; +import com.cloud.network.lb.LoadBalancingRulesManager; import com.cloud.network.lb.LoadBalancingRule.LbDestination; import com.cloud.network.resource.CreateLoadBalancerApplianceAnswer; import com.cloud.network.resource.DestroyLoadBalancerApplianceAnswer; @@ -213,6 +214,8 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase PhysicalNetworkServiceProviderDao _physicalProviderDao; @Inject VirtualRouterProviderDao _vrProviderDao; + @Inject + private LoadBalancingRulesManager lbRulesManager; private long _defaultLbCapacity; private static final org.apache.log4j.Logger s_logger = Logger.getLogger(ExternalLoadBalancerDeviceManagerImpl.class); @@ -981,7 +984,7 @@ public boolean applyLoadBalancerRules(Network network, List l loadBalancer.setSrcIpNetmask(srcIpNetmask); loadBalancer.setSrcIpGateway(srcIpGateway); if (rule.isAutoScaleConfig()) { - loadBalancer.setAutoScaleVmGroup(rule.getAutoScaleVmGroup()); + loadBalancer.setAutoScaleVmGroupTO(lbRulesManager.toAutoScaleVmGroupTO(rule.getAutoScaleVmGroup())); } loadBalancersToApply.add(loadBalancer); } diff --git a/server/src/main/java/com/cloud/network/as/AutoScaleManager.java b/server/src/main/java/com/cloud/network/as/AutoScaleManager.java index 410fb8f923ef..1d829b1fcc53 100644 --- a/server/src/main/java/com/cloud/network/as/AutoScaleManager.java +++ b/server/src/main/java/com/cloud/network/as/AutoScaleManager.java @@ -16,11 +16,43 @@ // under the License. package com.cloud.network.as; +import org.apache.cloudstack.framework.config.ConfigKey; + public interface AutoScaleManager extends AutoScaleService { + ConfigKey AutoScaleStatsInterval = new ConfigKey<>(ConfigKey.CATEGORY_ADVANCED, Integer.class, + "autoscale.stats.interval", + "60", + "The interval (in seconds) when VM auto scaling statistics are processed to determine and perform scale action. Less than 1 means disabled.", + false); + + ConfigKey AutoScaleStatsCleanupDelay = new ConfigKey<>(ConfigKey.CATEGORY_ADVANCED, Integer.class, + "autoscale.stats.cleanup.delay", + "7200", + "Determines how long (in seconds) to wait before actually removing auto scaling statistics from database. The default value is 7200 (2 hours).", + false); + + ConfigKey AutoScaleStatsWorker = new ConfigKey<>(ConfigKey.CATEGORY_ADVANCED, Integer.class, + "autoscale.stats.worker", + "10", + "The Number of worker threads to scan the autoscale vm groups.", + false); + + void checkAutoScaleUser(Long autoscaleUserId, long accountId); + + boolean deleteAutoScaleVmGroupsByAccount(Long accountId); + void cleanUpAutoScaleResources(Long accountId); void doScaleUp(long groupId, Integer numVm); void doScaleDown(long groupId); + + void checkAllAutoScaleVmGroups(); + + void checkAutoScaleVmGroup(AutoScaleVmGroupVO asGroup); + + void checkIfVmActionAllowed(Long vmId); + + void removeVmFromVmGroup(Long vmId); } diff --git a/server/src/main/java/com/cloud/network/as/AutoScaleManagerImpl.java b/server/src/main/java/com/cloud/network/as/AutoScaleManagerImpl.java index 0c21437da08f..bd522b23891e 100644 --- a/server/src/main/java/com/cloud/network/as/AutoScaleManagerImpl.java +++ b/server/src/main/java/com/cloud/network/as/AutoScaleManagerImpl.java @@ -16,30 +16,46 @@ // under the License. package com.cloud.network.as; -import java.security.InvalidParameterException; -import java.text.SimpleDateFormat; +import java.security.SecureRandom; import java.util.ArrayList; +import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.Callable; +import java.util.concurrent.CompletionService; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorCompletionService; +import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import javax.inject.Inject; -import com.cloud.offering.DiskOffering; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.MapUtils; +import org.apache.commons.lang3.RandomStringUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.log4j.Logger; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import org.apache.cloudstack.acl.ControlledEntity; +import org.apache.cloudstack.affinity.AffinityGroupVO; +import org.apache.cloudstack.affinity.dao.AffinityGroupDao; +import org.apache.cloudstack.annotation.AnnotationService; +import org.apache.cloudstack.annotation.dao.AnnotationDao; +import org.apache.cloudstack.api.ApiCommandResourceType; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseCmd.HTTPMethod; -import org.apache.cloudstack.api.BaseListAccountResourcesCmd; +import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.command.admin.autoscale.CreateCounterCmd; import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScalePolicyCmd; @@ -54,11 +70,27 @@ import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScalePolicyCmd; import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScaleVmGroupCmd; import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScaleVmProfileCmd; +import org.apache.cloudstack.api.command.user.autoscale.UpdateConditionCmd; import org.apache.cloudstack.api.command.user.vm.DeployVMCmd; import org.apache.cloudstack.config.ApiServiceConfiguration; import org.apache.cloudstack.context.CallContext; +import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; +import org.apache.cloudstack.framework.config.ConfigKey; +import org.apache.cloudstack.framework.config.Configurable; import org.apache.cloudstack.framework.config.dao.ConfigurationDao; - +import org.apache.cloudstack.managed.context.ManagedContextRunnable; + +import com.cloud.agent.AgentManager; +import com.cloud.agent.api.PerformanceMonitorAnswer; +import com.cloud.agent.api.PerformanceMonitorCommand; +import com.cloud.agent.api.VmStatsEntry; +import com.cloud.agent.api.routing.GetAutoScaleMetricsAnswer; +import com.cloud.agent.api.routing.GetAutoScaleMetricsCommand; +import com.cloud.agent.api.to.LoadBalancerTO.AutoScaleVmProfileTO; +import com.cloud.agent.api.to.LoadBalancerTO.AutoScaleVmGroupTO; +import com.cloud.agent.api.to.LoadBalancerTO.AutoScalePolicyTO; +import com.cloud.agent.api.to.LoadBalancerTO.ConditionTO; +import com.cloud.agent.api.to.LoadBalancerTO.CounterTO; import com.cloud.api.ApiDBUtils; import com.cloud.api.dispatch.DispatchChainFactory; import com.cloud.api.dispatch.DispatchTask; @@ -67,7 +99,9 @@ import com.cloud.dc.DataCenter.NetworkType; import com.cloud.dc.dao.DataCenterDao; import com.cloud.event.ActionEvent; +import com.cloud.event.ActionEventUtils; import com.cloud.event.EventTypes; +import com.cloud.event.EventVO; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.InsufficientServerCapacityException; @@ -75,7 +109,10 @@ import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceInUseException; import com.cloud.exception.ResourceUnavailableException; +import com.cloud.host.HostVO; +import com.cloud.host.dao.HostDao; import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.network.Network; import com.cloud.network.Network.Capability; import com.cloud.network.Network.IpAddresses; import com.cloud.network.as.AutoScaleCounter.AutoScaleCounterParam; @@ -83,11 +120,13 @@ import com.cloud.network.as.dao.AutoScalePolicyDao; import com.cloud.network.as.dao.AutoScaleVmGroupDao; import com.cloud.network.as.dao.AutoScaleVmGroupPolicyMapDao; +import com.cloud.network.as.dao.AutoScaleVmGroupStatisticsDao; import com.cloud.network.as.dao.AutoScaleVmGroupVmMapDao; import com.cloud.network.as.dao.AutoScaleVmProfileDao; import com.cloud.network.as.dao.ConditionDao; import com.cloud.network.as.dao.CounterDao; import com.cloud.network.dao.IPAddressDao; +import com.cloud.network.dao.IPAddressVO; import com.cloud.network.dao.LoadBalancerDao; import com.cloud.network.dao.LoadBalancerVMMapDao; import com.cloud.network.dao.LoadBalancerVMMapVO; @@ -95,25 +134,42 @@ import com.cloud.network.dao.NetworkDao; import com.cloud.network.lb.LoadBalancingRulesManager; import com.cloud.network.lb.LoadBalancingRulesService; +import com.cloud.network.router.RouterControlHelper; +import com.cloud.network.router.VirtualRouter; +import com.cloud.network.router.VirtualRouterAutoScale.AutoScaleMetrics; +import com.cloud.network.router.VirtualRouterAutoScale.AutoScaleMetricsValue; +import com.cloud.network.router.VirtualRouterAutoScale.AutoScaleValueType; +import com.cloud.network.router.VirtualRouterAutoScale.VirtualRouterAutoScaleCounter; +import com.cloud.offering.DiskOffering; +import com.cloud.offering.NetworkOffering; import com.cloud.offering.ServiceOffering; +import com.cloud.offerings.dao.NetworkOfferingDao; import com.cloud.projects.Project.ListProjectResourcesCriteria; +import com.cloud.server.ResourceTag; +import com.cloud.service.ServiceOfferingVO; +import com.cloud.service.dao.ServiceOfferingDao; +import com.cloud.storage.dao.DiskOfferingDao; import com.cloud.template.TemplateManager; import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.Account; import com.cloud.user.AccountManager; import com.cloud.user.AccountService; +import com.cloud.user.SSHKeyPairVO; import com.cloud.user.User; import com.cloud.user.dao.AccountDao; +import com.cloud.user.dao.SSHKeyPairDao; import com.cloud.user.dao.UserDao; import com.cloud.uservm.UserVm; import com.cloud.utils.Pair; import com.cloud.utils.Ternary; import com.cloud.utils.component.ComponentContext; import com.cloud.utils.component.ManagerBase; +import com.cloud.utils.concurrency.NamedThreadFactory; import com.cloud.utils.db.DB; import com.cloud.utils.db.EntityManager; import com.cloud.utils.db.Filter; import com.cloud.utils.db.GenericDao; +import com.cloud.utils.db.GenericSearchBuilder; import com.cloud.utils.db.JoinBuilder; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; @@ -121,71 +177,153 @@ import com.cloud.utils.db.SearchCriteria.Op; import com.cloud.utils.db.Transaction; import com.cloud.utils.db.TransactionStatus; +import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.net.NetUtils; +import com.cloud.vm.DomainRouterVO; import com.cloud.vm.UserVmManager; import com.cloud.vm.UserVmService; - -public class AutoScaleManagerImpl extends ManagerBase implements AutoScaleManager, AutoScaleService { +import com.cloud.vm.UserVmVO; +import com.cloud.vm.VMInstanceVO; +import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VmDetailConstants; +import com.cloud.vm.dao.DomainRouterDao; +import com.cloud.vm.dao.UserVmDao; +import com.cloud.vm.dao.VMInstanceDao; + +public class AutoScaleManagerImpl extends ManagerBase implements AutoScaleManager, AutoScaleService, Configurable { private static final Logger s_logger = Logger.getLogger(AutoScaleManagerImpl.class); - private ScheduledExecutorService _executor = Executors.newScheduledThreadPool(1); @Inject protected DispatchChainFactory dispatchChainFactory = null; @Inject - EntityManager _entityMgr; + EntityManager entityMgr; + @Inject + AccountDao accountDao; + @Inject + AccountManager accountMgr; + @Inject + ConfigurationManager configMgr; + @Inject + TemplateManager templateMgr; + @Inject + LoadBalancingRulesManager lbRulesMgr; + @Inject + NetworkDao networkDao; + @Inject + CounterDao counterDao; + @Inject + ConditionDao conditionDao; + @Inject + LoadBalancerDao lbDao; + @Inject + AutoScaleVmProfileDao autoScaleVmProfileDao; + @Inject + AutoScalePolicyDao autoScalePolicyDao; + @Inject + AutoScalePolicyConditionMapDao autoScalePolicyConditionMapDao; @Inject - AccountDao _accountDao; + AutoScaleVmGroupDao autoScaleVmGroupDao; @Inject - AccountManager _accountMgr; + AutoScaleVmGroupPolicyMapDao autoScaleVmGroupPolicyMapDao; @Inject - ConfigurationManager _configMgr; + AutoScaleVmGroupVmMapDao autoScaleVmGroupVmMapDao; @Inject - TemplateManager _templateMgr; + DataCenterDao dcDao = null; @Inject - LoadBalancingRulesManager _lbRulesMgr; + UserDao userDao; @Inject - NetworkDao _networkDao; + ConfigurationDao configDao; @Inject - CounterDao _counterDao; + IPAddressDao ipAddressDao; @Inject - ConditionDao _conditionDao; + AccountService accountService; @Inject - LoadBalancerVMMapDao _lb2VmMapDao; + UserVmService userVmService; @Inject - LoadBalancerDao _lbDao; + LoadBalancerVMMapDao lbVmMapDao; @Inject - AutoScaleVmProfileDao _autoScaleVmProfileDao; + LoadBalancingRulesService loadBalancingRulesService; @Inject - AutoScalePolicyDao _autoScalePolicyDao; + private VMInstanceDao vmInstanceDao; @Inject - AutoScalePolicyConditionMapDao _autoScalePolicyConditionMapDao; + private AgentManager agentMgr; @Inject - AutoScaleVmGroupDao _autoScaleVmGroupDao; + private ServiceOfferingDao serviceOfferingDao; @Inject - AutoScaleVmGroupPolicyMapDao _autoScaleVmGroupPolicyMapDao; + NetworkOrchestrationService networkMgr; @Inject - AutoScaleVmGroupVmMapDao _autoScaleVmGroupVmMapDao; + private UserVmManager userVmMgr; @Inject - DataCenterDao _dcDao = null; + private UserVmDao userVmDao; @Inject - UserDao _userDao; + private HostDao hostDao; @Inject - ConfigurationDao _configDao; + private AutoScaleVmGroupStatisticsDao asGroupStatisticsDao; @Inject - IPAddressDao _ipAddressDao; + private DomainRouterDao routerDao; @Inject - AccountService _accountService; + private AnnotationDao annotationDao; @Inject - UserVmService _userVmService; + protected RouterControlHelper routerControlHelper; @Inject - UserVmManager _userVmManager; + private DiskOfferingDao diskOfferingDao; @Inject - LoadBalancerVMMapDao _lbVmMapDao; + private SSHKeyPairDao sshKeyPairDao; @Inject - LoadBalancingRulesService _loadBalancingRulesService; + private AffinityGroupDao affinityGroupDao; + @Inject + private NetworkOfferingDao networkOfferingDao; + + private static final String PARAM_ROOT_DISK_SIZE = "rootdisksize"; + private static final String PARAM_DISK_OFFERING_ID = "diskofferingid"; + private static final String PARAM_DISK_SIZE = "disksize"; + private static final String PARAM_OVERRIDE_DISK_OFFERING_ID = "overridediskofferingid"; + private static final String PARAM_SECURITY_GROUP_IDS = "securitygroupids"; + private static final String PARAM_SSH_KEYPAIRS = "keypairs"; + private static final String PARAM_AFFINITY_GROUP_IDS = "affinitygroupids"; + private static final String PARAM_NETWORK_IDS = "networkids"; + + private static final List supportedDeployParams = Arrays.asList(PARAM_ROOT_DISK_SIZE, PARAM_DISK_OFFERING_ID, PARAM_DISK_SIZE, PARAM_SECURITY_GROUP_IDS, + PARAM_OVERRIDE_DISK_OFFERING_ID, PARAM_SSH_KEYPAIRS, PARAM_AFFINITY_GROUP_IDS, PARAM_NETWORK_IDS); + + protected static final String VM_HOSTNAME_PREFIX = "autoScaleVm-"; + protected static final int VM_HOSTNAME_RANDOM_SUFFIX_LENGTH = 6; + + private static final Long DEFAULT_HOST_ID = -1L; + + ExecutorService groupExecutor; + + CompletionService> completionService; + + Map vmGroupMonitorMaps = new HashMap<>(); + + @Override + public boolean start() { + // create thread pool and blocking queue + final int workersCount = AutoScaleStatsWorker.value(); + groupExecutor = Executors.newFixedThreadPool(workersCount); + s_logger.info("AutoScale Manager created a thread pool to check autoscale vm groups. The pool size is : " + workersCount); + + final BlockingQueue>> queue = new LinkedBlockingQueue<>(workersCount); + s_logger.info("AutoScale Manager created a blocking queue to check autoscale vm groups. The queue size is : " + workersCount); + + completionService = new ExecutorCompletionService<>(groupExecutor, queue); + + scheduleMonitorTasks(); + + return true; + } + + @Override + public boolean stop() { + if (groupExecutor != null) { + groupExecutor.shutdown(); + } + return true; + } public List getSupportedAutoScaleCounters(long networkid) { - String capability = _lbRulesMgr.getLBCapability(networkid, Capability.AutoScaleCounters.getName()); + String capability = lbRulesMgr.getLBCapability(networkid, Capability.AutoScaleCounters.getName()); if (capability == null) { return null; } @@ -196,13 +334,24 @@ public List getSupportedAutoScaleCounters(long networkid) { return result; } + public void validateNetworkCapability(long networkId) { + Network network = networkDao.findById(networkId); + if (network == null) { + throw new CloudRuntimeException(String.format("Unable to find network with id: %s ", networkId)); + } + NetworkOffering offering = networkOfferingDao.findByIdIncludingRemoved(network.getNetworkOfferingId()); + if (!offering.isSupportsVmAutoScaling()) { + throw new InvalidParameterValueException("Vm AutoScaling is not supported by this network."); + } + } + public void validateAutoScaleCounters(long networkid, List counters, List> counterParamPassed) { List supportedCounters = getSupportedAutoScaleCounters(networkid); if (supportedCounters == null) { - throw new InvalidParameterException("AutoScale is not supported in the network"); + throw new InvalidParameterValueException("AutoScale is not supported in the network"); } for (Counter counter : counters) { - String counterName = counter.getSource().name().toString(); + String counterName = counter.getSource().name(); boolean isCounterSupported = false; for (AutoScaleCounter autoScaleCounter : supportedCounters) { if (autoScaleCounter.getName().equals(counterName)) { @@ -218,7 +367,7 @@ public void validateAutoScaleCounters(long networkid, List counters, Li } if (!isRequiredParamPresent) { - throw new InvalidParameterException("Parameter " + autoScaleCounterParam.getParamName() + " has to be set in AutoScaleVmProfile's " + + throw new InvalidParameterValueException("Parameter " + autoScaleCounterParam.getParamName() + " has to be set in AutoScaleVmProfile's " + ApiConstants.COUNTERPARAM_LIST); } } @@ -227,7 +376,7 @@ public void validateAutoScaleCounters(long networkid, List counters, Li } } if (!isCounterSupported) { - throw new InvalidParameterException("AutoScale counter with source='" + counter.getSource().name() + "' is not supported " + "in the network"); + throw new InvalidParameterValueException("AutoScale counter with source='" + counter.getSource().name() + "' is not supported " + "in the network"); } } } @@ -240,40 +389,30 @@ private VO getEntityInDatabase(Account caller, Str throw new InvalidParameterValueException("Unable to find " + paramName); } - _accountMgr.checkAccess(caller, null, false, (ControlledEntity)vo); + accountMgr.checkAccess(caller, null, false, (ControlledEntity)vo); return vo; } private boolean isAutoScaleScaleUpPolicy(AutoScalePolicy policyVO) { - return policyVO.getAction().equals("scaleup"); + return policyVO.getAction().equals(AutoScalePolicy.Action.SCALEUP); } - private List getAutoScalePolicies(String paramName, List policyIds, List counters, int interval, boolean scaleUpPolicies) { - SearchBuilder policySearch = _autoScalePolicyDao.createSearchBuilder(); + private List getAutoScalePolicies(List policyIds, List counters, int interval, boolean scaleUpPolicies) { + SearchBuilder policySearch = autoScalePolicyDao.createSearchBuilder(); policySearch.and("ids", policySearch.entity().getId(), Op.IN); policySearch.done(); SearchCriteria sc = policySearch.create(); sc.setParameters("ids", policyIds.toArray(new Object[0])); - List policies = _autoScalePolicyDao.search(sc, null); - - int prevQuietTime = 0; + List policies = autoScalePolicyDao.search(sc, null); for (AutoScalePolicyVO policy : policies) { - int quietTime = policy.getQuietTime(); - if (prevQuietTime == 0) { - prevQuietTime = quietTime; - } int duration = policy.getDuration(); if (duration < interval) { throw new InvalidParameterValueException("duration : " + duration + " specified in a policy cannot be less than vm group's interval : " + interval); } - if (quietTime != prevQuietTime) { - throw new InvalidParameterValueException("quietTime should be same for all the policies specified in " + paramName); - } - if (scaleUpPolicies) { if (!isAutoScaleScaleUpPolicy(policy)) { throw new InvalidParameterValueException("Only scaleup policies can be specified in scaleuppolicyids"); @@ -283,11 +422,11 @@ private List getAutoScalePolicies(String paramName, List policyConditionMapVOs = _autoScalePolicyConditionMapDao.listByAll(policy.getId(), null); + List policyConditionMapVOs = autoScalePolicyConditionMapDao.listByAll(policy.getId(), null); for (AutoScalePolicyConditionMapVO policyConditionMapVO : policyConditionMapVOs) { long conditionid = policyConditionMapVO.getConditionId(); - Condition condition = _conditionDao.findById(conditionid); - Counter counter = _counterDao.findById(condition.getCounterid()); + Condition condition = conditionDao.findById(conditionid); + Counter counter = counterDao.findById(condition.getCounterId()); counters.add(counter); } } @@ -295,23 +434,72 @@ private List getAutoScalePolicies(String paramName, List vmGroups = autoScaleVmGroupDao.listByProfile(vmProfile.getId()); + for (AutoScaleVmGroupVO vmGroup : vmGroups) { + Network.Provider provider = getLoadBalancerServiceProvider(vmGroup.getLoadBalancerId()); + if (Network.Provider.Netscaler.equals(provider)) { + checkAutoScaleUser(autoscaleUserId, vmProfile.getAccountId()); + } + } + } + + Integer autoScaleStatsInterval = AutoScaleStatsInterval.value(); + if (autoScaleStatsInterval <= 0) { + throw new InvalidParameterValueException(String.format("Global setting %s has to be set to larger than 0", AutoScaleStatsInterval.key())); + } + + List> otherDeployParams = vmProfile.getOtherDeployParamsList(); + if (CollectionUtils.isNotEmpty(otherDeployParams)) { + for (Pair kvPair : otherDeployParams) { + String key = kvPair.first(); + if (!supportedDeployParams.contains(key)) { + throw new InvalidParameterValueException(String.format("Unsupported otherdeployparams key: %s. Supported values are %s", key, supportedDeployParams)); + } + } + } + vmProfile = autoScaleVmProfileDao.persist(vmProfile); + + return vmProfile; + } + + @Override + public void checkAutoScaleUser(Long autoscaleUserId, long accountId) { + if (autoscaleUserId == null) { + throw new InvalidParameterValueException("autoscaleuserid is required but not passed"); + } + User user = userDao.findById(autoscaleUserId); + if (user == null) { + throw new InvalidParameterValueException("Unable to find autoscale user id: " + autoscaleUserId); } - User user = _userDao.findById(autoscaleUserId); - if (user.getAccountId() != vmProfile.getAccountId()) { + if (user.getAccountId() != accountId) { throw new InvalidParameterValueException("AutoScale User id does not belong to the same account"); } @@ -330,41 +518,33 @@ protected AutoScaleVmProfileVO checkValidityAndPersist(AutoScaleVmProfileVO vmPr if (csUrl == null || csUrl.contains("localhost")) { throw new InvalidParameterValueException(String.format("Global setting %s has to be set to the Management Server's API end point", ApiServiceConfiguration.ApiServletPath.key())); } - - vmProfile = _autoScaleVmProfileDao.persist(vmProfile); - - return vmProfile; } - @Override @ActionEvent(eventType = EventTypes.EVENT_AUTOSCALEVMPROFILE_CREATE, eventDescription = "creating autoscale vm profile", create = true) public AutoScaleVmProfile createAutoScaleVmProfile(CreateAutoScaleVmProfileCmd cmd) { - Account owner = _accountDao.findById(cmd.getAccountId()); Account caller = CallContext.current().getCallingAccount(); - _accountMgr.checkAccess(caller, null, true, owner); + Account owner = accountMgr.finalizeOwner(caller, cmd.getAccountName(), cmd.getDomainId(), cmd.getProjectId()); + accountMgr.checkAccess(caller, null, true, owner); long zoneId = cmd.getZoneId(); long serviceOfferingId = cmd.getServiceOfferingId(); - long autoscaleUserId = cmd.getAutoscaleUserId(); + Long autoscaleUserId = cmd.getAutoscaleUserId(); + String userData = cmd.getUserData(); - DataCenter zone = _entityMgr.findById(DataCenter.class, zoneId); + DataCenter zone = entityMgr.findById(DataCenter.class, zoneId); if (zone == null) { throw new InvalidParameterValueException("Unable to find zone by id"); } - ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId); + ServiceOffering serviceOffering = entityMgr.findById(ServiceOffering.class, serviceOfferingId); if (serviceOffering == null) { throw new InvalidParameterValueException("Unable to find service offering by id"); } // validations HashMap deployParams = cmd.getDeployParamMap(); - if (deployParams.containsKey("networks") && deployParams.get("networks").length() > 0) { - throw new InvalidParameterValueException( - "'networks' is not a valid parameter, network for an AutoScaled VM is chosen automatically. An autoscaled VM is deployed in the loadbalancer's network"); - } /* * Just for making sure the values are right in other deploy params. * For ex. if projectId is given as a string instead of an long value, this @@ -373,14 +553,18 @@ public AutoScaleVmProfile createAutoScaleVmProfile(CreateAutoScaleVmProfileCmd c dispatchChainFactory.getStandardDispatchChain().dispatch(new DispatchTask(ComponentContext.inject(DeployVMCmd.class), deployParams)); AutoScaleVmProfileVO profileVO = - new AutoScaleVmProfileVO(cmd.getZoneId(), cmd.getDomainId(), cmd.getAccountId(), cmd.getServiceOfferingId(), cmd.getTemplateId(), cmd.getOtherDeployParams(), - cmd.getCounterParamList(), cmd.getDestroyVmGraceperiod(), autoscaleUserId); + new AutoScaleVmProfileVO(cmd.getZoneId(), owner.getDomainId(), owner.getAccountId(), cmd.getServiceOfferingId(), cmd.getTemplateId(), cmd.getOtherDeployParams(), + cmd.getCounterParamList(), cmd.getUserData(), cmd.getExpungeVmGracePeriod(), autoscaleUserId); if (cmd.getDisplay() != null) { profileVO.setDisplay(cmd.getDisplay()); } - profileVO = checkValidityAndPersist(profileVO); + if (userData != null) { + profileVO.setUserData(userData); + } + + profileVO = checkValidityAndPersist(profileVO, true); s_logger.info("Successfully create AutoScale Vm Profile with Id: " + profileVO.getId()); return profileVO; @@ -390,15 +574,22 @@ public AutoScaleVmProfile createAutoScaleVmProfile(CreateAutoScaleVmProfileCmd c @ActionEvent(eventType = EventTypes.EVENT_AUTOSCALEVMPROFILE_UPDATE, eventDescription = "updating autoscale vm profile") public AutoScaleVmProfile updateAutoScaleVmProfile(UpdateAutoScaleVmProfileCmd cmd) { Long profileId = cmd.getId(); + Long serviceOfferingId = cmd.getServiceOfferingId(); Long templateId = cmd.getTemplateId(); Long autoscaleUserId = cmd.getAutoscaleUserId(); + Map> otherDeployParams = cmd.getOtherDeployParams(); Map counterParamList = cmd.getCounterParamList(); + String userData = cmd.getUserData(); - Integer destroyVmGraceperiod = cmd.getDestroyVmGraceperiod(); + Integer expungeVmGracePeriod = cmd.getExpungeVmGracePeriod(); - AutoScaleVmProfileVO vmProfile = getEntityInDatabase(CallContext.current().getCallingAccount(), "Auto Scale Vm Profile", profileId, _autoScaleVmProfileDao); + AutoScaleVmProfileVO vmProfile = getEntityInDatabase(CallContext.current().getCallingAccount(), "Auto Scale Vm Profile", profileId, autoScaleVmProfileDao); - boolean physicalParameterUpdate = (templateId != null || autoscaleUserId != null || counterParamList != null || destroyVmGraceperiod != null); + boolean physicalParameterUpdate = (templateId != null || autoscaleUserId != null || counterParamList != null || otherDeployParams != null || expungeVmGracePeriod != null || userData != null); + + if (serviceOfferingId != null) { + vmProfile.setServiceOfferingId(serviceOfferingId); + } if (templateId != null) { vmProfile.setTemplateId(templateId); @@ -408,12 +599,20 @@ public AutoScaleVmProfile updateAutoScaleVmProfile(UpdateAutoScaleVmProfileCmd c vmProfile.setAutoscaleUserId(autoscaleUserId); } + if (otherDeployParams != null) { + vmProfile.setOtherDeployParamsForUpdate(otherDeployParams); + } + if (counterParamList != null) { vmProfile.setCounterParamsForUpdate(counterParamList); } - if (destroyVmGraceperiod != null) { - vmProfile.setDestroyVmGraceperiod(destroyVmGraceperiod); + if (userData != null) { + vmProfile.setUserData(userData); + } + + if (expungeVmGracePeriod != null) { + vmProfile.setExpungeVmGracePeriod(expungeVmGracePeriod); } if (cmd.getCustomId() != null) { @@ -424,14 +623,14 @@ public AutoScaleVmProfile updateAutoScaleVmProfile(UpdateAutoScaleVmProfileCmd c vmProfile.setDisplay(cmd.getDisplay()); } - List vmGroupList = _autoScaleVmGroupDao.listByAll(null, profileId); + List vmGroupList = autoScaleVmGroupDao.listByAll(null, profileId); for (AutoScaleVmGroupVO vmGroupVO : vmGroupList) { - if (physicalParameterUpdate && !vmGroupVO.getState().equals(AutoScaleVmGroup.State_Disabled)) { + if (physicalParameterUpdate && !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"); } } - vmProfile = checkValidityAndPersist(vmProfile); + vmProfile = checkValidityAndPersist(vmProfile, false); s_logger.info("Updated Auto Scale Vm Profile id:" + vmProfile.getId()); return vmProfile; @@ -441,11 +640,12 @@ public AutoScaleVmProfile updateAutoScaleVmProfile(UpdateAutoScaleVmProfileCmd c @ActionEvent(eventType = EventTypes.EVENT_AUTOSCALEVMPROFILE_DELETE, eventDescription = "deleting autoscale vm profile") public boolean deleteAutoScaleVmProfile(long id) { /* Check if entity is in database */ - getEntityInDatabase(CallContext.current().getCallingAccount(), "AutoScale Vm Profile", id, _autoScaleVmProfileDao); - if (_autoScaleVmGroupDao.isProfileInUse(id)) { + getEntityInDatabase(CallContext.current().getCallingAccount(), "AutoScale Vm Profile", id, autoScaleVmProfileDao); + if (autoScaleVmGroupDao.isProfileInUse(id)) { throw new InvalidParameterValueException("Cannot delete AutoScale Vm Profile when it is in use by one more vm groups"); } - boolean success = _autoScaleVmProfileDao.remove(id); + + boolean success = autoScaleVmProfileDao.remove(id); if (success) { s_logger.info("Successfully deleted AutoScale Vm Profile with Id: " + id); } @@ -461,7 +661,7 @@ public List listAutoScaleVmProfiles(ListAutoScaleV Long zoneId = cmd.getZoneId(); Boolean display = cmd.getDisplay(); - SearchWrapper searchWrapper = new SearchWrapper(_autoScaleVmProfileDao, AutoScaleVmProfileVO.class, cmd, cmd.getId()); + SearchWrapper searchWrapper = new SearchWrapper<>(autoScaleVmProfileDao, AutoScaleVmProfileVO.class, cmd, cmd.getId()); SearchBuilder sb = searchWrapper.getSearchBuilder(); sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ); @@ -507,26 +707,29 @@ protected AutoScalePolicyVO checkValidityAndPersist(final AutoScalePolicyVO auto } if (quietTime < 0) { - throw new InvalidParameterValueException("quiettime is an invalid value: " + quietTime); + throw new InvalidParameterValueException("quietTime is an invalid value: " + quietTime); } return Transaction.execute(new TransactionCallback() { @Override public AutoScalePolicyVO doInTransaction(TransactionStatus status) { - AutoScalePolicyVO autoScalePolicyVO = _autoScalePolicyDao.persist(autoScalePolicyVOFinal); + AutoScalePolicyVO autoScalePolicyVO = autoScalePolicyDao.persist(autoScalePolicyVOFinal); if (conditionIds != null) { - SearchBuilder conditionsSearch = _conditionDao.createSearchBuilder(); + if (CollectionUtils.isEmpty(conditionIds)) { + throw new InvalidParameterValueException("AutoScale policy must have at least one condition"); + } + SearchBuilder conditionsSearch = conditionDao.createSearchBuilder(); conditionsSearch.and("ids", conditionsSearch.entity().getId(), Op.IN); conditionsSearch.done(); SearchCriteria sc = conditionsSearch.create(); sc.setParameters("ids", conditionIds.toArray(new Object[0])); - List conditions = _conditionDao.search(sc, null); + List conditions = conditionDao.search(sc, null); ControlledEntity[] sameOwnerEntities = conditions.toArray(new ControlledEntity[conditions.size() + 1]); sameOwnerEntities[sameOwnerEntities.length - 1] = autoScalePolicyVO; - _accountMgr.checkAccess(CallContext.current().getCallingAccount(), null, true, sameOwnerEntities); + accountMgr.checkAccess(CallContext.current().getCallingAccount(), null, true, sameOwnerEntities); if (conditionIds.size() != conditions.size()) { // TODO report the condition id which could not be found @@ -535,19 +738,19 @@ public AutoScalePolicyVO doInTransaction(TransactionStatus status) { ArrayList counterIds = new ArrayList(); for (ConditionVO condition : conditions) { - if (counterIds.contains(condition.getCounterid())) { + if (counterIds.contains(condition.getCounterId())) { throw new InvalidParameterValueException( "at least 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()); + counterIds.add(condition.getCounterId()); } /* For update case remove the existing mappings and create fresh ones */ - _autoScalePolicyConditionMapDao.removeByAutoScalePolicyId(autoScalePolicyVO.getId()); + autoScalePolicyConditionMapDao.removeByAutoScalePolicyId(autoScalePolicyVO.getId()); for (Long conditionId : conditionIds) { AutoScalePolicyConditionMapVO policyConditionMapVO = new AutoScalePolicyConditionMapVO(autoScalePolicyVO.getId(), conditionId); - _autoScalePolicyConditionMapDao.persist(policyConditionMapVO); + autoScalePolicyConditionMapDao.persist(policyConditionMapVO); } } @@ -568,12 +771,14 @@ public AutoScalePolicy createAutoScalePolicy(CreateAutoScalePolicyCmd cmd) { quietTime = NetUtils.DEFAULT_AUTOSCALE_POLICY_QUIET_TIME; } - action = action.toLowerCase(); - if (!NetUtils.isValidAutoScaleAction(action)) { - throw new InvalidParameterValueException("action is invalid, only 'scaleup' and 'scaledown' is supported"); + AutoScalePolicy.Action scaleAction = null; + try { + scaleAction = AutoScalePolicy.Action.fromValue(action); + } catch (IllegalArgumentException ex) { + throw new InvalidParameterValueException("action is invalid. Supported actions are: " + Arrays.toString(AutoScalePolicy.Action.values())); } - AutoScalePolicyVO policyVO = new AutoScalePolicyVO(cmd.getDomainId(), cmd.getAccountId(), duration, quietTime, null, action); + AutoScalePolicyVO policyVO = new AutoScalePolicyVO(cmd.getName(), cmd.getDomainId(), cmd.getAccountId(), duration, quietTime, null, scaleAction); policyVO = checkValidityAndPersist(policyVO, cmd.getConditionIds()); s_logger.info("Successfully created AutoScale Policy with Id: " + policyVO.getId()); @@ -585,9 +790,9 @@ public AutoScalePolicy createAutoScalePolicy(CreateAutoScalePolicyCmd cmd) { @ActionEvent(eventType = EventTypes.EVENT_AUTOSCALEPOLICY_DELETE, eventDescription = "deleting autoscale policy") public boolean deleteAutoScalePolicy(final long id) { /* Check if entity is in database */ - getEntityInDatabase(CallContext.current().getCallingAccount(), "AutoScale Policy", id, _autoScalePolicyDao); + getEntityInDatabase(CallContext.current().getCallingAccount(), "AutoScale Policy", id, autoScalePolicyDao); - if (_autoScaleVmGroupPolicyMapDao.isAutoScalePolicyInUse(id)) { + if (autoScaleVmGroupPolicyMapDao.isAutoScalePolicyInUse(id)) { throw new InvalidParameterValueException("Cannot delete AutoScale Policy when it is in use by one or more AutoScale Vm Groups"); } @@ -595,12 +800,12 @@ public boolean deleteAutoScalePolicy(final long id) { @Override public Boolean doInTransaction(TransactionStatus status) { boolean success = true; - success = _autoScalePolicyDao.remove(id); + success = autoScalePolicyDao.remove(id); if (!success) { s_logger.warn("Failed to remove AutoScale Policy db object"); return false; } - success = _autoScalePolicyConditionMapDao.removeByAutoScalePolicyId(id); + success = autoScalePolicyConditionMapDao.removeByAutoScalePolicyId(id); if (!success) { s_logger.warn("Failed to remove AutoScale Policy Condition mappings"); return false; @@ -612,17 +817,6 @@ public Boolean doInTransaction(TransactionStatus status) { }); } - public void checkCallerAccess(String accountName, Long domainId) { - Account caller = CallContext.current().getCallingAccount(); - Account owner = _accountDao.findActiveAccount(accountName, domainId); - if (owner == null) { - List idList = new ArrayList(); - idList.add(ApiDBUtils.findDomainById(domainId).getUuid()); - throw new InvalidParameterValueException("Unable to find account " + accountName + " in domain with specifed domainId"); - } - _accountMgr.checkAccess(caller, null, false, owner); - } - private class SearchWrapper { GenericDao dao; SearchBuilder searchBuilder; @@ -633,7 +827,7 @@ private class SearchWrapper { ListProjectResourcesCriteria listProjectResourcesCriteria; Filter searchFilter; - public SearchWrapper(GenericDao dao, Class entityClass, BaseListAccountResourcesCmd cmd, Long id) + public SearchWrapper(GenericDao dao, Class entityClass, BaseListProjectAndAccountResourcesCmd cmd, Long id) { this.dao = dao; this.searchBuilder = dao.createSearchBuilder(); @@ -647,12 +841,13 @@ public SearchWrapper(GenericDao dao, Class entityClass, BaseListAc Ternary domainIdRecursiveListProject = new Ternary(domainId, isRecursive, null); - _accountMgr.buildACLSearchParameters(caller, id, accountName, null, permittedAccounts, domainIdRecursiveListProject, + accountMgr.buildACLSearchParameters(caller, id, accountName, cmd.getProjectId(), permittedAccounts, domainIdRecursiveListProject, listAll, false); domainId = domainIdRecursiveListProject.first(); isRecursive = domainIdRecursiveListProject.second(); - ListProjectResourcesCriteria listProjectResourcesCriteria = domainIdRecursiveListProject.third(); - _accountMgr.buildACLSearchBuilder(searchBuilder, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria); + listProjectResourcesCriteria = domainIdRecursiveListProject.third(); + + accountMgr.buildACLSearchBuilder(searchBuilder, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria); searchFilter = new Filter(entityClass, "id", false, startIndex, pageSizeVal); } @@ -662,7 +857,7 @@ public SearchBuilder getSearchBuilder() { public SearchCriteria buildSearchCriteria() { searchCriteria = searchBuilder.create(); - _accountMgr.buildACLSearchCriteria(searchCriteria, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria); + accountMgr.buildACLSearchCriteria(searchCriteria, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria); return searchCriteria; } @@ -673,24 +868,35 @@ public List search() { @Override public List listAutoScalePolicies(ListAutoScalePoliciesCmd cmd) { - SearchWrapper searchWrapper = new SearchWrapper(_autoScalePolicyDao, AutoScalePolicyVO.class, cmd, cmd.getId()); + SearchWrapper searchWrapper = new SearchWrapper<>(autoScalePolicyDao, AutoScalePolicyVO.class, cmd, cmd.getId()); SearchBuilder sb = searchWrapper.getSearchBuilder(); Long id = cmd.getId(); + String name = cmd.getName(); Long conditionId = cmd.getConditionId(); String action = cmd.getAction(); Long vmGroupId = cmd.getVmGroupId(); + AutoScalePolicy.Action scaleAction = null; + if (action != null) { + try { + scaleAction = AutoScalePolicy.Action.fromValue(action); + } catch (IllegalArgumentException ex) { + throw new InvalidParameterValueException("action is invalid. Supported actions are: " + Arrays.toString(AutoScalePolicy.Action.values())); + } + } + sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ); + sb.and("name", sb.entity().getName(), SearchCriteria.Op.EQ); sb.and("action", sb.entity().getAction(), SearchCriteria.Op.EQ); if (conditionId != null) { - SearchBuilder asPolicyConditionSearch = _autoScalePolicyConditionMapDao.createSearchBuilder(); + SearchBuilder asPolicyConditionSearch = autoScalePolicyConditionMapDao.createSearchBuilder(); asPolicyConditionSearch.and("conditionId", asPolicyConditionSearch.entity().getConditionId(), SearchCriteria.Op.EQ); sb.join("asPolicyConditionSearch", asPolicyConditionSearch, sb.entity().getId(), asPolicyConditionSearch.entity().getPolicyId(), JoinBuilder.JoinType.INNER); } if (vmGroupId != null) { - SearchBuilder asVmGroupPolicySearch = _autoScaleVmGroupPolicyMapDao.createSearchBuilder(); + SearchBuilder asVmGroupPolicySearch = autoScaleVmGroupPolicyMapDao.createSearchBuilder(); asVmGroupPolicySearch.and("vmGroupId", asVmGroupPolicySearch.entity().getVmGroupId(), SearchCriteria.Op.EQ); sb.join("asVmGroupPolicySearch", asVmGroupPolicySearch, sb.entity().getId(), asVmGroupPolicySearch.entity().getPolicyId(), JoinBuilder.JoinType.INNER); } @@ -701,8 +907,12 @@ public List listAutoScalePolicies(ListAutoScalePolici sc.setParameters("id", id); } - if (action != null) { - sc.setParameters("action", action); + if (name != null) { + sc.setParameters("name", name); + } + + if (scaleAction != null) { + sc.setParameters("action", scaleAction); } if (conditionId != null) { @@ -720,10 +930,15 @@ public List listAutoScalePolicies(ListAutoScalePolici @ActionEvent(eventType = EventTypes.EVENT_AUTOSCALEPOLICY_UPDATE, eventDescription = "updating autoscale policy") public AutoScalePolicy updateAutoScalePolicy(UpdateAutoScalePolicyCmd cmd) { Long policyId = cmd.getId(); + String name = cmd.getName(); Integer duration = cmd.getDuration(); Integer quietTime = cmd.getQuietTime(); List conditionIds = cmd.getConditionIds(); - AutoScalePolicyVO policy = getEntityInDatabase(CallContext.current().getCallingAccount(), "Auto Scale Policy", policyId, _autoScalePolicyDao); + AutoScalePolicyVO policy = getEntityInDatabase(CallContext.current().getCallingAccount(), "Auto Scale Policy", policyId, autoScalePolicyDao); + + if (name != null) { + policy.setName(name); + } if (duration != null) { policy.setDuration(duration); @@ -733,16 +948,16 @@ public AutoScalePolicy updateAutoScalePolicy(UpdateAutoScalePolicyCmd cmd) { policy.setQuietTime(quietTime); } - List vmGroupPolicyList = _autoScaleVmGroupPolicyMapDao.listByPolicyId(policyId); + List vmGroupPolicyList = autoScaleVmGroupPolicyMapDao.listByPolicyId(policyId); for (AutoScaleVmGroupPolicyMapVO vmGroupPolicy : vmGroupPolicyList) { - AutoScaleVmGroupVO vmGroupVO = _autoScaleVmGroupDao.findById(vmGroupPolicy.getVmGroupId()); + AutoScaleVmGroupVO vmGroupVO = autoScaleVmGroupDao.findById(vmGroupPolicy.getVmGroupId()); if (vmGroupVO == null) { s_logger.warn("Stale database entry! There is an entry in VmGroupPolicyMap but the vmGroup is missing:" + vmGroupPolicy.getVmGroupId()); continue; } - if (!vmGroupVO.getState().equals(AutoScaleVmGroup.State_Disabled)) { + 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 (policy.getDuration() < vmGroupVO.getInterval()) { @@ -752,12 +967,18 @@ public AutoScalePolicy updateAutoScalePolicy(UpdateAutoScalePolicyCmd cmd) { policy = checkValidityAndPersist(policy, conditionIds); s_logger.info("Successfully updated Auto Scale Policy id:" + policyId); + + if (CollectionUtils.isNotEmpty(conditionIds)) { + markStatisticsAsInactive(null, policyId); + } + return policy; } @Override @ActionEvent(eventType = EventTypes.EVENT_AUTOSCALEVMGROUP_CREATE, eventDescription = "creating autoscale vm group", create = true) public AutoScaleVmGroup createAutoScaleVmGroup(CreateAutoScaleVmGroupCmd cmd) { + String name = cmd.getName(); int minMembers = cmd.getMinMembers(); int maxMembers = cmd.getMaxMembers(); Integer interval = cmd.getInterval(); @@ -767,21 +988,21 @@ public AutoScaleVmGroup createAutoScaleVmGroup(CreateAutoScaleVmGroupCmd cmd) { interval = NetUtils.DEFAULT_AUTOSCALE_POLICY_INTERVAL_TIME; } - LoadBalancerVO loadBalancer = getEntityInDatabase(CallContext.current().getCallingAccount(), ApiConstants.LBID, cmd.getLbRuleId(), _lbDao); + LoadBalancerVO loadBalancer = getEntityInDatabase(CallContext.current().getCallingAccount(), ApiConstants.LBID, cmd.getLbRuleId(), lbDao); - Long zoneId = _ipAddressDao.findById(loadBalancer.getSourceIpAddressId()).getDataCenterId(); + Long zoneId = ipAddressDao.findById(loadBalancer.getSourceIpAddressId()).getDataCenterId(); - if (_autoScaleVmGroupDao.isAutoScaleLoadBalancer(loadBalancer.getId())) { + 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"); } - if (_lb2VmMapDao.isVmAttachedToLoadBalancer(loadBalancer.getId())) { + if (lbVmMapDao.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"); } - AutoScaleVmGroupVO vmGroupVO = new AutoScaleVmGroupVO(cmd.getLbRuleId(), zoneId, loadBalancer.getDomainId(), loadBalancer.getAccountId(), minMembers, maxMembers, - loadBalancer.getDefaultPortStart(), interval, null, cmd.getProfileId(), AutoScaleVmGroup.State_New); + AutoScaleVmGroupVO vmGroupVO = new AutoScaleVmGroupVO(cmd.getLbRuleId(), zoneId, loadBalancer.getDomainId(), loadBalancer.getAccountId(), name, minMembers, maxMembers, + loadBalancer.getDefaultPortStart(), interval, null, cmd.getProfileId(), AutoScaleVmGroup.State.NEW); if (forDisplay != null) { vmGroupVO.setDisplay(forDisplay); @@ -790,25 +1011,28 @@ public AutoScaleVmGroup createAutoScaleVmGroup(CreateAutoScaleVmGroupCmd cmd) { vmGroupVO = checkValidityAndPersist(vmGroupVO, cmd.getScaleUpPolicyIds(), cmd.getScaleDownPolicyIds()); s_logger.info("Successfully created Autoscale Vm Group with Id: " + vmGroupVO.getId()); + createInactiveDummyRecord(vmGroupVO.getId()); + scheduleMonitorTask(vmGroupVO.getId()); + return vmGroupVO; } @Override @ActionEvent(eventType = EventTypes.EVENT_AUTOSCALEVMGROUP_CREATE, eventDescription = "creating autoscale vm group", async = true) public boolean configureAutoScaleVmGroup(CreateAutoScaleVmGroupCmd cmd) throws ResourceUnavailableException { - return configureAutoScaleVmGroup(cmd.getEntityId(), AutoScaleVmGroup.State_New); + return configureAutoScaleVmGroup(cmd.getEntityId(), AutoScaleVmGroup.State.NEW); } public boolean isLoadBalancerBasedAutoScaleVmGroup(AutoScaleVmGroup vmGroup) { return vmGroup.getLoadBalancerId() != null; } - private boolean configureAutoScaleVmGroup(long vmGroupid, String currentState) throws ResourceUnavailableException { - AutoScaleVmGroup vmGroup = _autoScaleVmGroupDao.findById(vmGroupid); + protected boolean configureAutoScaleVmGroup(long vmGroupid, AutoScaleVmGroup.State currentState) throws ResourceUnavailableException { + AutoScaleVmGroup vmGroup = autoScaleVmGroupDao.findById(vmGroupid); if (isLoadBalancerBasedAutoScaleVmGroup(vmGroup)) { try { - return _lbRulesMgr.configureLbAutoScaleVmGroup(vmGroupid, currentState); + return lbRulesMgr.configureLbAutoScaleVmGroup(vmGroupid, currentState); } catch (ResourceUnavailableException re) { throw re; } catch (Exception e) { @@ -824,23 +1048,41 @@ private boolean configureAutoScaleVmGroup(long vmGroupid, String currentState) t @Override @DB @ActionEvent(eventType = EventTypes.EVENT_AUTOSCALEVMGROUP_DELETE, eventDescription = "deleting autoscale vm group", async = true) - public boolean deleteAutoScaleVmGroup(final long id) { - AutoScaleVmGroupVO autoScaleVmGroupVO = getEntityInDatabase(CallContext.current().getCallingAccount(), "AutoScale Vm Group", id, _autoScaleVmGroupDao); + public boolean deleteAutoScaleVmGroup(final long id, final Boolean cleanup) { + AutoScaleVmGroupVO autoScaleVmGroupVO = getEntityInDatabase(CallContext.current().getCallingAccount(), "AutoScale Vm Group", id, autoScaleVmGroupDao); - if (autoScaleVmGroupVO.getState().equals(AutoScaleVmGroup.State_New)) { + if (autoScaleVmGroupVO.getState().equals(AutoScaleVmGroup.State.NEW)) { /* This condition is for handling failures during creation command */ - return _autoScaleVmGroupDao.remove(id); + return autoScaleVmGroupDao.remove(id); + } + + if (!autoScaleVmGroupVO.getState().equals(AutoScaleVmGroup.State.DISABLED) && !Boolean.TRUE.equals(cleanup)) { + throw new InvalidParameterValueException(String.format("Cannot delete autoscale vm group id : %d because it is in %s state. Please disable it or pass cleanup=true flag which will destroy all VMs.", id, autoScaleVmGroupVO.getState())); + } + + Integer currentVM = autoScaleVmGroupVmMapDao.countByGroup(id); + if (currentVM > 0 && !Boolean.TRUE.equals(cleanup)) { + throw new InvalidParameterValueException(String.format("Cannot delete autoscale vm group id : %d because there are %d VMs. Please remove the VMs or pass cleanup=true flag which will destroy all VMs.", id, currentVM)); } - String bakupState = autoScaleVmGroupVO.getState(); - autoScaleVmGroupVO.setState(AutoScaleVmGroup.State_Revoke); - _autoScaleVmGroupDao.persist(autoScaleVmGroupVO); + + AutoScaleVmGroup.State bakupState = autoScaleVmGroupVO.getState(); + autoScaleVmGroupVO.setState(AutoScaleVmGroup.State.REVOKE); + autoScaleVmGroupDao.persist(autoScaleVmGroupVO); boolean success = false; + if (Boolean.TRUE.equals(cleanup)) { + List asGroupVmVOs = autoScaleVmGroupVmMapDao.listByGroup(id); + for (AutoScaleVmGroupVmMapVO asGroupVmVO : asGroupVmVOs) { + Long vmId = asGroupVmVO.getInstanceId(); + destroyVm(vmId); + } + } + try { success = configureAutoScaleVmGroup(id, bakupState); } catch (ResourceUnavailableException e) { autoScaleVmGroupVO.setState(bakupState); - _autoScaleVmGroupDao.persist(autoScaleVmGroupVO); + autoScaleVmGroupDao.persist(autoScaleVmGroupVO); } finally { if (!success) { s_logger.warn("Could not delete AutoScale Vm Group id : " + id); @@ -848,22 +1090,39 @@ public boolean deleteAutoScaleVmGroup(final long id) { } } + // Remove comments (if any) + annotationDao.removeByEntityType(AnnotationService.EntityType.AUTOSCALE_VM_GROUP.name(), autoScaleVmGroupVO.getUuid()); + return Transaction.execute(new TransactionCallback() { @Override public Boolean doInTransaction(TransactionStatus status) { - boolean success = _autoScaleVmGroupDao.remove(id); + boolean success = autoScaleVmGroupDao.remove(id); if (!success) { s_logger.warn("Failed to remove AutoScale Group db object"); return false; } - success = _autoScaleVmGroupPolicyMapDao.removeByGroupId(id); + cancelMonitorTask(id); + + success = autoScaleVmGroupPolicyMapDao.removeByGroupId(id); if (!success) { s_logger.warn("Failed to remove AutoScale Group Policy mappings"); return false; } + success = autoScaleVmGroupVmMapDao.removeByGroup(id); + if (!success) { + s_logger.warn("Failed to remove AutoScale Group VM mappings"); + return false; + } + + success = asGroupStatisticsDao.removeByGroupId(id); + if (!success) { + s_logger.warn("Failed to remove AutoScale Group statistics"); + return false; + } + s_logger.info("Successfully deleted autoscale vm group id : " + id); return success; // Successfull } @@ -874,23 +1133,25 @@ public Boolean doInTransaction(TransactionStatus status) { @Override public List listAutoScaleVmGroups(ListAutoScaleVmGroupsCmd cmd) { Long id = cmd.getId(); + String name = cmd.getName(); Long policyId = cmd.getPolicyId(); Long loadBalancerId = cmd.getLoadBalancerId(); Long profileId = cmd.getProfileId(); Long zoneId = cmd.getZoneId(); Boolean forDisplay = cmd.getDisplay(); - SearchWrapper searchWrapper = new SearchWrapper(_autoScaleVmGroupDao, AutoScaleVmGroupVO.class, cmd, cmd.getId()); + SearchWrapper searchWrapper = new SearchWrapper<>(autoScaleVmGroupDao, AutoScaleVmGroupVO.class, cmd, cmd.getId()); SearchBuilder sb = searchWrapper.getSearchBuilder(); sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ); + sb.and("name", sb.entity().getName(), SearchCriteria.Op.EQ); sb.and("loadBalancerId", sb.entity().getLoadBalancerId(), SearchCriteria.Op.EQ); sb.and("profileId", sb.entity().getProfileId(), SearchCriteria.Op.EQ); sb.and("zoneId", sb.entity().getZoneId(), SearchCriteria.Op.EQ); sb.and("display", sb.entity().isDisplay(), SearchCriteria.Op.EQ); if (policyId != null) { - SearchBuilder asVmGroupPolicySearch = _autoScaleVmGroupPolicyMapDao.createSearchBuilder(); + SearchBuilder asVmGroupPolicySearch = autoScaleVmGroupPolicyMapDao.createSearchBuilder(); asVmGroupPolicySearch.and("policyId", asVmGroupPolicySearch.entity().getPolicyId(), SearchCriteria.Op.EQ); sb.join("asVmGroupPolicySearch", asVmGroupPolicySearch, sb.entity().getId(), asVmGroupPolicySearch.entity().getVmGroupId(), JoinBuilder.JoinType.INNER); } @@ -899,6 +1160,9 @@ public List listAutoScaleVmGroups(ListAutoScaleVmGro if (id != null) { sc.setParameters("id", id); } + if (name != null) { + sc.setParameters("name", name); + } if (loadBalancerId != null) { sc.setParameters("loadBalancerId", loadBalancerId); } @@ -920,6 +1184,9 @@ public List listAutoScaleVmGroups(ListAutoScaleVmGro @DB protected AutoScaleVmGroupVO checkValidityAndPersist(final AutoScaleVmGroupVO vmGroup, final List passedScaleUpPolicyIds, final List passedScaleDownPolicyIds) { + + checkAutoScaleVmGroupName(vmGroup.getName()); + int minMembers = vmGroup.getMinMembers(); int maxMembers = vmGroup.getMaxMembers(); int interval = vmGroup.getInterval(); @@ -932,11 +1199,11 @@ protected AutoScaleVmGroupVO checkValidityAndPersist(final AutoScaleVmGroupVO vm ApiDBUtils.getAutoScaleVmGroupPolicyIds(vmGroup.getId(), currentScaleUpPolicyIds, currentScaleDownPolicyIds); } - if (minMembers < 0) { + if (minMembers <= 0) { throw new InvalidParameterValueException(ApiConstants.MIN_MEMBERS + " is an invalid value: " + minMembers); } - if (maxMembers < 0) { + if (maxMembers <= 0) { throw new InvalidParameterValueException(ApiConstants.MAX_MEMBERS + " is an invalid value: " + maxMembers); } @@ -945,48 +1212,60 @@ protected AutoScaleVmGroupVO checkValidityAndPersist(final AutoScaleVmGroupVO vm maxMembers + ")"); } - if (interval < 0) { + if (interval <= 0) { throw new InvalidParameterValueException("interval is an invalid value: " + interval); } if (passedScaleUpPolicyIds != null) { - policies.addAll(getAutoScalePolicies("scaleuppolicyid", passedScaleUpPolicyIds, counters, interval, true)); + if (CollectionUtils.isEmpty(passedScaleUpPolicyIds)) { + throw new InvalidParameterValueException("AutoScale VM group must have at least one ScaleUp policy"); + } + policies.addAll(getAutoScalePolicies(passedScaleUpPolicyIds, counters, interval, true)); policyIds.addAll(passedScaleUpPolicyIds); } else { // Run the interval check for existing policies - getAutoScalePolicies("scaleuppolicyid", currentScaleUpPolicyIds, counters, interval, true); + getAutoScalePolicies(currentScaleUpPolicyIds, counters, interval, true); policyIds.addAll(currentScaleUpPolicyIds); } if (passedScaleDownPolicyIds != null) { - policies.addAll(getAutoScalePolicies("scaledownpolicyid", passedScaleDownPolicyIds, counters, interval, false)); + if (CollectionUtils.isEmpty(passedScaleDownPolicyIds)) { + throw new InvalidParameterValueException("AutoScale VM group must have at least one ScaleDown policy"); + } + policies.addAll(getAutoScalePolicies(passedScaleDownPolicyIds, counters, interval, false)); policyIds.addAll(passedScaleDownPolicyIds); } else { // Run the interval check for existing policies - getAutoScalePolicies("scaledownpolicyid", currentScaleDownPolicyIds, counters, interval, false); + getAutoScalePolicies(currentScaleDownPolicyIds, counters, interval, false); policyIds.addAll(currentScaleDownPolicyIds); } AutoScaleVmProfileVO profileVO = - getEntityInDatabase(CallContext.current().getCallingAccount(), ApiConstants.VMPROFILE_ID, vmGroup.getProfileId(), _autoScaleVmProfileDao); + getEntityInDatabase(CallContext.current().getCallingAccount(), ApiConstants.VMPROFILE_ID, vmGroup.getProfileId(), autoScaleVmProfileDao); - LoadBalancerVO loadBalancer = getEntityInDatabase(CallContext.current().getCallingAccount(), ApiConstants.LBID, vmGroup.getLoadBalancerId(), _lbDao); + LoadBalancerVO loadBalancer = getEntityInDatabase(CallContext.current().getCallingAccount(), ApiConstants.LBID, vmGroup.getLoadBalancerId(), lbDao); + validateNetworkCapability(loadBalancer.getNetworkId()); validateAutoScaleCounters(loadBalancer.getNetworkId(), counters, profileVO.getCounterParams()); + Network.Provider provider = getLoadBalancerServiceProvider(vmGroup.getLoadBalancerId()); + if (Network.Provider.Netscaler.equals(provider)) { + checkAutoScaleUser(profileVO.getAutoScaleUserId(), vmGroup.getAccountId()); + } + ControlledEntity[] sameOwnerEntities = policies.toArray(new ControlledEntity[policies.size() + 2]); sameOwnerEntities[sameOwnerEntities.length - 2] = loadBalancer; sameOwnerEntities[sameOwnerEntities.length - 1] = profileVO; - _accountMgr.checkAccess(CallContext.current().getCallingAccount(), null, true, sameOwnerEntities); + accountMgr.checkAccess(CallContext.current().getCallingAccount(), null, true, sameOwnerEntities); return Transaction.execute(new TransactionCallback() { @Override public AutoScaleVmGroupVO doInTransaction(TransactionStatus status) { - AutoScaleVmGroupVO vmGroupNew = _autoScaleVmGroupDao.persist(vmGroup); + AutoScaleVmGroupVO vmGroupNew = autoScaleVmGroupDao.persist(vmGroup); if (passedScaleUpPolicyIds != null || passedScaleDownPolicyIds != null) { - _autoScaleVmGroupPolicyMapDao.removeByGroupId(vmGroupNew.getId()); + autoScaleVmGroupPolicyMapDao.removeByGroupId(vmGroupNew.getId()); for (Long policyId : policyIds) { - _autoScaleVmGroupPolicyMapDao.persist(new AutoScaleVmGroupPolicyMapVO(vmGroupNew.getId(), policyId)); + autoScaleVmGroupPolicyMapDao.persist(new AutoScaleVmGroupPolicyMapVO(vmGroupNew.getId(), policyId)); } } @@ -1000,6 +1279,7 @@ public AutoScaleVmGroupVO doInTransaction(TransactionStatus status) { @ActionEvent(eventType = EventTypes.EVENT_AUTOSCALEVMGROUP_UPDATE, eventDescription = "updating autoscale vm group", async = true) public AutoScaleVmGroup updateAutoScaleVmGroup(UpdateAutoScaleVmGroupCmd cmd) { Long vmGroupId = cmd.getId(); + String name = cmd.getName(); Integer minMembers = cmd.getMinMembers(); Integer maxMembers = cmd.getMaxMembers(); Integer interval = cmd.getInterval(); @@ -1008,14 +1288,19 @@ public AutoScaleVmGroup updateAutoScaleVmGroup(UpdateAutoScaleVmGroupCmd cmd) { List scaleUpPolicyIds = cmd.getScaleUpPolicyIds(); List scaleDownPolicyIds = cmd.getScaleDownPolicyIds(); - AutoScaleVmGroupVO vmGroupVO = getEntityInDatabase(CallContext.current().getCallingAccount(), "AutoScale Vm Group", vmGroupId, _autoScaleVmGroupDao); + AutoScaleVmGroupVO vmGroupVO = getEntityInDatabase(CallContext.current().getCallingAccount(), "AutoScale Vm Group", vmGroupId, autoScaleVmGroupDao); + int currentInterval = vmGroupVO.getInterval(); - boolean physicalParametersUpdate = (minMembers != null || maxMembers != null || interval != null); + boolean physicalParametersUpdate = (minMembers != null || maxMembers != null || (interval != null && interval != currentInterval) || CollectionUtils.isNotEmpty(scaleUpPolicyIds) || CollectionUtils.isNotEmpty(scaleDownPolicyIds)); - if (physicalParametersUpdate && !vmGroupVO.getState().equals(AutoScaleVmGroup.State_Disabled)) { + if (physicalParametersUpdate && !vmGroupVO.getState().equals(AutoScaleVmGroup.State.DISABLED)) { throw new InvalidParameterValueException("An AutoScale Vm Group can be updated with minMembers/maxMembers/Interval only when it is in disabled state"); } + if (StringUtils.isNotBlank(name)) { + vmGroupVO.setName(name); + } + if (minMembers != null) { vmGroupVO.setMinMembers(minMembers); } @@ -1024,7 +1309,7 @@ public AutoScaleVmGroup updateAutoScaleVmGroup(UpdateAutoScaleVmGroupCmd cmd) { vmGroupVO.setMaxMembers(maxMembers); } - if (maxMembers != null) { + if (interval != null) { vmGroupVO.setInterval(interval); } @@ -1039,6 +1324,11 @@ public AutoScaleVmGroup updateAutoScaleVmGroup(UpdateAutoScaleVmGroupCmd cmd) { vmGroupVO = checkValidityAndPersist(vmGroupVO, scaleUpPolicyIds, scaleDownPolicyIds); if (vmGroupVO != null) { s_logger.debug("Updated Auto Scale VmGroup id:" + vmGroupId); + + if ((interval != null && interval != currentInterval) || CollectionUtils.isNotEmpty(scaleUpPolicyIds) || CollectionUtils.isNotEmpty(scaleDownPolicyIds)) { + markStatisticsAsInactive(vmGroupId, null); + } + return vmGroupVO; } else return null; @@ -1048,25 +1338,32 @@ public AutoScaleVmGroup updateAutoScaleVmGroup(UpdateAutoScaleVmGroupCmd cmd) { @DB @ActionEvent(eventType = EventTypes.EVENT_AUTOSCALEVMGROUP_ENABLE, eventDescription = "enabling autoscale vm group", async = true) public AutoScaleVmGroup enableAutoScaleVmGroup(Long id) { - AutoScaleVmGroupVO vmGroup = getEntityInDatabase(CallContext.current().getCallingAccount(), "AutoScale Vm Group", id, _autoScaleVmGroupDao); + AutoScaleVmGroupVO vmGroup = getEntityInDatabase(CallContext.current().getCallingAccount(), "AutoScale Vm Group", id, autoScaleVmGroupDao); boolean success = false; - if (!vmGroup.getState().equals(AutoScaleVmGroup.State_Disabled)) { + + if (vmGroup.getState().equals(AutoScaleVmGroup.State.ENABLED)) { + return vmGroup; + } + + if (!vmGroup.getState().equals(AutoScaleVmGroup.State.DISABLED)) { throw new InvalidParameterValueException("Only a AutoScale Vm Group which is in Disabled state can be enabled."); } try { - vmGroup.setState(AutoScaleVmGroup.State_Enabled); - vmGroup = _autoScaleVmGroupDao.persist(vmGroup); - success = configureAutoScaleVmGroup(id, AutoScaleVmGroup.State_Disabled); + vmGroup.setState(AutoScaleVmGroup.State.ENABLED); + vmGroup = autoScaleVmGroupDao.persist(vmGroup); + success = configureAutoScaleVmGroup(id, AutoScaleVmGroup.State.DISABLED); + scheduleMonitorTask(vmGroup.getId()); } catch (ResourceUnavailableException e) { - vmGroup.setState(AutoScaleVmGroup.State_Disabled); - _autoScaleVmGroupDao.persist(vmGroup); + vmGroup.setState(AutoScaleVmGroup.State.DISABLED); + autoScaleVmGroupDao.persist(vmGroup); } finally { if (!success) { s_logger.warn("Failed to enable AutoScale Vm Group id : " + id); return null; } s_logger.info("Successfully enabled AutoScale Vm Group with Id:" + id); + createInactiveDummyRecord(vmGroup.getId()); } return vmGroup; } @@ -1075,19 +1372,26 @@ public AutoScaleVmGroup enableAutoScaleVmGroup(Long id) { @ActionEvent(eventType = EventTypes.EVENT_AUTOSCALEVMGROUP_DISABLE, eventDescription = "disabling autoscale vm group", async = true) @DB public AutoScaleVmGroup disableAutoScaleVmGroup(Long id) { - AutoScaleVmGroupVO vmGroup = getEntityInDatabase(CallContext.current().getCallingAccount(), "AutoScale Vm Group", id, _autoScaleVmGroupDao); + AutoScaleVmGroupVO vmGroup = getEntityInDatabase(CallContext.current().getCallingAccount(), "AutoScale Vm Group", id, autoScaleVmGroupDao); boolean success = false; - if (!vmGroup.getState().equals(AutoScaleVmGroup.State_Enabled)) { - throw new InvalidParameterValueException("Only a AutoScale Vm Group which is in Enabled state can be disabled."); + + if (vmGroup.getState().equals(AutoScaleVmGroup.State.DISABLED)) { + return vmGroup; + } + + if (!vmGroup.getState().equals(AutoScaleVmGroup.State.ENABLED) && !vmGroup.getState().equals(AutoScaleVmGroup.State.SCALING)) { + throw new InvalidParameterValueException("Only a AutoScale Vm Group which is in Enabled or Scaling state can be disabled."); } try { - vmGroup.setState(AutoScaleVmGroup.State_Disabled); - vmGroup = _autoScaleVmGroupDao.persist(vmGroup); - success = configureAutoScaleVmGroup(id, AutoScaleVmGroup.State_Enabled); + vmGroup.setState(AutoScaleVmGroup.State.DISABLED); + vmGroup = autoScaleVmGroupDao.persist(vmGroup); + success = configureAutoScaleVmGroup(id, AutoScaleVmGroup.State.ENABLED); + createInactiveDummyRecord(vmGroup.getId()); + cancelMonitorTask(vmGroup.getId()); } catch (ResourceUnavailableException e) { - vmGroup.setState(AutoScaleVmGroup.State_Enabled); - _autoScaleVmGroupDao.persist(vmGroup); + vmGroup.setState(AutoScaleVmGroup.State.ENABLED); + autoScaleVmGroupDao.persist(vmGroup); } finally { if (!success) { s_logger.warn("Failed to disable AutoScale Vm Group id : " + id); @@ -1102,7 +1406,7 @@ public AutoScaleVmGroup disableAutoScaleVmGroup(Long id) { @ActionEvent(eventType = EventTypes.EVENT_COUNTER_CREATE, eventDescription = "Counter", create = true) @DB public Counter createCounter(CreateCounterCmd cmd) { - String source = cmd.getSource().toLowerCase(); + String source = cmd.getSource().toUpperCase(); String name = cmd.getName(); Counter.Source src; // Validate Source @@ -1112,10 +1416,16 @@ public Counter createCounter(CreateCounterCmd cmd) { throw new InvalidParameterValueException("The Source " + source + " does not exist; Unable to create Counter"); } + // Validate Provider + Network.Provider provider = Network.Provider.getProvider(cmd.getProvider()); + if (provider == null) { + throw new InvalidParameterValueException("The Provider " + cmd.getProvider() + " does not exist; Unable to create Counter"); + } + CounterVO counter = null; s_logger.debug("Adding Counter " + name); - counter = _counterDao.persist(new CounterVO(src, name, cmd.getValue())); + counter = counterDao.persist(new CounterVO(src, name, cmd.getValue(), provider)); CallContext.current().setEventDetails(" Id: " + counter.getId() + " Name: " + name); return counter; @@ -1124,7 +1434,10 @@ public Counter createCounter(CreateCounterCmd cmd) { @Override @ActionEvent(eventType = EventTypes.EVENT_CONDITION_CREATE, eventDescription = "Condition", create = true) public Condition createCondition(CreateConditionCmd cmd) { - checkCallerAccess(cmd.getAccountName(), cmd.getDomainId()); + Account caller = CallContext.current().getCallingAccount(); + Account owner = accountMgr.finalizeOwner(caller, cmd.getAccountName(), cmd.getDomainId(), cmd.getProjectId()); + accountMgr.checkAccess(caller, null, true, owner); + String opr = cmd.getRelationalOperator().toUpperCase(); long cid = cmd.getCounterId(); long threshold = cmd.getThreshold(); @@ -1135,16 +1448,18 @@ public Condition createCondition(CreateConditionCmd cmd) { } catch (IllegalArgumentException ex) { throw new InvalidParameterValueException("The Operator " + opr + " does not exist; Unable to create Condition."); } - // TODO - Validate threshold + if (threshold < 0) { + throw new InvalidParameterValueException("The threshold " + threshold + " must be equal to or greater than 0."); + } - CounterVO counter = _counterDao.findById(cid); + CounterVO counter = counterDao.findById(cid); if (counter == null) { throw new InvalidParameterValueException("Unable to find counter"); } ConditionVO condition = null; - condition = _conditionDao.persist(new ConditionVO(cid, threshold, cmd.getEntityOwnerId(), cmd.getDomainId(), op)); + condition = conditionDao.persist(new ConditionVO(cid, threshold, owner.getAccountId(), owner.getDomainId(), op)); s_logger.info("Successfully created condition with Id: " + condition.getId()); CallContext.current().setEventDetails(" Id: " + condition.getId()); @@ -1156,14 +1471,21 @@ public List listCounters(ListCountersCmd cmd) { String name = cmd.getName(); Long id = cmd.getId(); String source = cmd.getSource(); - if (source != null) - source = source.toLowerCase(); + if (source != null) { + source = source.toUpperCase(); + } + String providerStr = cmd.getProvider(); + if (providerStr != null) { + Network.Provider provider = Network.Provider.getProvider(providerStr); + if (provider == null) { + throw new InvalidParameterValueException("The Provider " + providerStr + " does not exist; Unable to list Counter"); + } + providerStr = provider.getName(); + } Filter searchFilter = new Filter(CounterVO.class, "created", false, cmd.getStartIndex(), cmd.getPageSizeVal()); - List counters = _counterDao.listCounters(id, name, source, cmd.getKeyword(), searchFilter); - - return counters; + return counterDao.listCounters(id, name, source, providerStr, cmd.getKeyword(), searchFilter); } @Override @@ -1171,17 +1493,17 @@ public List listConditions(ListConditionsCmd cmd) { Long id = cmd.getId(); Long counterId = cmd.getCounterId(); Long policyId = cmd.getPolicyId(); - SearchWrapper searchWrapper = new SearchWrapper(_conditionDao, ConditionVO.class, cmd, cmd.getId()); + SearchWrapper searchWrapper = new SearchWrapper<>(conditionDao, ConditionVO.class, cmd, cmd.getId()); SearchBuilder sb = searchWrapper.getSearchBuilder(); if (policyId != null) { - SearchBuilder asPolicyConditionSearch = _autoScalePolicyConditionMapDao.createSearchBuilder(); + SearchBuilder asPolicyConditionSearch = autoScalePolicyConditionMapDao.createSearchBuilder(); asPolicyConditionSearch.and("policyId", asPolicyConditionSearch.entity().getPolicyId(), SearchCriteria.Op.EQ); sb.join("asPolicyConditionSearch", asPolicyConditionSearch, sb.entity().getId(), asPolicyConditionSearch.entity().getConditionId(), JoinBuilder.JoinType.INNER); } sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ); - sb.and("counterId", sb.entity().getCounterid(), SearchCriteria.Op.EQ); + sb.and("counterId", sb.entity().getCounterId(), SearchCriteria.Op.EQ); // now set the SC criteria... SearchCriteria sc = searchWrapper.buildSearchCriteria(); @@ -1205,20 +1527,20 @@ public List listConditions(ListConditionsCmd cmd) { @ActionEvent(eventType = EventTypes.EVENT_COUNTER_DELETE, eventDescription = "counter") public boolean deleteCounter(long counterId) throws ResourceInUseException { // Verify Counter id - CounterVO counter = _counterDao.findById(counterId); + CounterVO counter = counterDao.findById(counterId); if (counter == null) { throw new InvalidParameterValueException("Unable to find Counter"); } // Verify if it is used in any Condition - ConditionVO condition = _conditionDao.findByCounterId(counterId); + ConditionVO condition = conditionDao.findByCounterId(counterId); if (condition != null) { s_logger.info("Cannot delete counter " + counter.getName() + " as it is being used in a condition."); throw new ResourceInUseException("Counter is in use."); } - boolean success = _counterDao.remove(counterId); + boolean success = counterDao.remove(counterId); if (success) { s_logger.info("Successfully deleted counter with Id: " + counterId); } @@ -1227,39 +1549,117 @@ public boolean deleteCounter(long counterId) throws ResourceInUseException { } @Override - @ActionEvent(eventType = EventTypes.EVENT_CONDITION_DELETE, eventDescription = "condition") + @ActionEvent(eventType = EventTypes.EVENT_CONDITION_DELETE, eventDescription = "delete a condition") public boolean deleteCondition(long conditionId) throws ResourceInUseException { /* Check if entity is in database */ - ConditionVO condition = getEntityInDatabase(CallContext.current().getCallingAccount(), "Condition", conditionId, _conditionDao); + ConditionVO condition = getEntityInDatabase(CallContext.current().getCallingAccount(), "Condition", conditionId, conditionDao); if (condition == null) { throw new InvalidParameterValueException("Unable to find Condition"); } // Verify if condition is used in any autoscale policy - if (_autoScalePolicyConditionMapDao.isConditionInUse(conditionId)) { + if (autoScalePolicyConditionMapDao.isConditionInUse(conditionId)) { s_logger.info("Cannot delete condition " + conditionId + " as it is being used in a condition."); throw new ResourceInUseException("Cannot delete Condition when it is in use by one or more AutoScale Policies."); } - boolean success = _conditionDao.remove(conditionId); + boolean success = conditionDao.remove(conditionId); if (success) { s_logger.info("Successfully deleted condition " + condition.getId()); } return success; } + @Override + @ActionEvent(eventType = EventTypes.EVENT_CONDITION_UPDATE, eventDescription = "update a condition") + public Condition updateCondition(UpdateConditionCmd cmd) throws ResourceInUseException { + Long conditionId = cmd.getId(); + /* Check if entity is in database */ + ConditionVO condition = getEntityInDatabase(CallContext.current().getCallingAccount(), "Condition", conditionId, conditionDao); + + String operator = cmd.getRelationalOperator().toUpperCase(); + Long threshold = cmd.getThreshold(); + + Condition.Operator op; + // Validate Relational Operator + try { + op = Condition.Operator.valueOf(operator); + } catch (IllegalArgumentException ex) { + throw new InvalidParameterValueException("The Operator " + operator + " does not exist; Unable to update Condition."); + } + if (threshold < 0) { + throw new InvalidParameterValueException("The threshold " + threshold + " must be equal to or greater than 0."); + } + + // Verify if condition is used in any autoscale vmgroup + GenericSearchBuilder conditionSearch = autoScalePolicyConditionMapDao.createSearchBuilder(Long.class); + conditionSearch.selectFields(conditionSearch.entity().getPolicyId()); + conditionSearch.and("conditionId", conditionSearch.entity().getConditionId(), Op.EQ); + SearchCriteria sc = conditionSearch.create(); + sc.setParameters("conditionId", conditionId); + List policyIds = autoScalePolicyConditionMapDao.customSearch(sc, null); + + if (CollectionUtils.isNotEmpty(policyIds)) { + SearchBuilder policySearch = autoScaleVmGroupPolicyMapDao.createSearchBuilder(); + policySearch.and("policyId", policySearch.entity().getPolicyId(), Op.IN); + SearchBuilder vmGroupSearch = autoScaleVmGroupDao.createSearchBuilder(); + vmGroupSearch.and("stateNEQ", vmGroupSearch.entity().getState(), Op.NEQ); + vmGroupSearch.join("policySearch", policySearch, vmGroupSearch.entity().getId(), policySearch.entity().getVmGroupId(), JoinBuilder.JoinType.INNER); + vmGroupSearch.done(); + + SearchCriteria sc2 = vmGroupSearch.create(); + sc2.setParameters("stateNEQ", AutoScaleVmGroup.State.DISABLED); + sc2.setJoinParameters("policySearch", "policyId", policyIds.toArray((new Object[policyIds.size()]))); + List groups = autoScaleVmGroupDao.search(sc2, null); + if (CollectionUtils.isNotEmpty(groups)) { + String msg = String.format("Cannot update condition %d as it is being used in %d vm groups NOT in Disabled state.", conditionId, groups.size()); + s_logger.info(msg); + throw new ResourceInUseException(msg); + } + } + + condition.setRelationalOperator(op); + condition.setThreshold(threshold); + boolean success = conditionDao.update(conditionId, condition); + if (success) { + s_logger.info("Successfully updated condition " + condition.getId()); + + for (Long policyId : policyIds) { + markStatisticsAsInactive(null, policyId); + } + } + return condition; + } + + @Override + public boolean deleteAutoScaleVmGroupsByAccount(Long accountId) { + boolean success = true; + List groups = autoScaleVmGroupDao.listByAccount(accountId); + for (AutoScaleVmGroupVO group : groups) { + s_logger.debug("Deleting AutoScale Vm Group " + group + " for account Id: " + accountId); + try { + deleteAutoScaleVmGroup(group.getId(), true); + s_logger.debug("AutoScale Vm Group " + group + " has been successfully deleted for account Id: " + accountId); + } catch (Exception e) { + s_logger.warn("Failed to delete AutoScale Vm Group " + group + " for account Id: " + accountId + " due to: ", e); + success = false; + } + } + return success; + } + @Override public void cleanUpAutoScaleResources(Long accountId) { // cleans Autoscale VmProfiles, AutoScale Policies and Conditions belonging to an account int count = 0; - count = _autoScaleVmProfileDao.removeByAccountId(accountId); + count = autoScaleVmProfileDao.removeByAccountId(accountId); if (count > 0) { s_logger.debug("Deleted " + count + " AutoScale Vm Profile for account Id: " + accountId); } - count = _autoScalePolicyDao.removeByAccountId(accountId); + count = autoScalePolicyDao.removeByAccountId(accountId); if (count > 0) { s_logger.debug("Deleted " + count + " AutoScale Policies for account Id: " + accountId); } - count = _conditionDao.removeByAccountId(accountId); + count = conditionDao.removeByAccountId(accountId); if (count > 0) { s_logger.debug("Deleted " + count + " Conditions for account Id: " + accountId); } @@ -1267,7 +1667,7 @@ public void cleanUpAutoScaleResources(Long accountId) { private boolean checkConditionUp(AutoScaleVmGroupVO asGroup, Integer numVm) { // check maximum - Integer currentVM = _autoScaleVmGroupVmMapDao.countByGroup(asGroup.getId()); + Integer currentVM = autoScaleVmGroupVmMapDao.countAvailableVmsByGroup(asGroup.getId()); Integer maxVm = asGroup.getMaxMembers(); if (currentVM + numVm > maxVm) { s_logger.warn("number of VM will greater than the maximum in this group if scaling up, so do nothing more"); @@ -1277,7 +1677,7 @@ private boolean checkConditionUp(AutoScaleVmGroupVO asGroup, Integer numVm) { } private boolean checkConditionDown(AutoScaleVmGroupVO asGroup) { - Integer currentVM = _autoScaleVmGroupVmMapDao.countByGroup(asGroup.getId()); + Integer currentVM = autoScaleVmGroupVmMapDao.countAvailableVmsByGroup(asGroup.getId()); Integer minVm = asGroup.getMinMembers(); if (currentVM - 1 < minVm) { s_logger.warn("number of VM will less than the minimum in this group if scaling down, so do nothing more"); @@ -1286,8 +1686,20 @@ private boolean checkConditionDown(AutoScaleVmGroupVO asGroup) { return true; } - private long createNewVM(AutoScaleVmGroupVO asGroup) { - AutoScaleVmProfileVO profileVo = _autoScaleVmProfileDao.findById(asGroup.getProfileId()); + protected Map getDeployParams (String otherDeployParams) { + Map deployParams = new HashMap<>(); + if (StringUtils.isNotBlank(otherDeployParams)) { + for (String param : otherDeployParams.split("&")) { + if (param.split("=").length >= 2) { + deployParams.put(param.split("=")[0], param.split("=")[1]); + } + } + } + return deployParams; + } + + protected long createNewVM(AutoScaleVmGroupVO asGroup) { + AutoScaleVmProfileVO profileVo = autoScaleVmProfileDao.findById(asGroup.getProfileId()); long templateId = profileVo.getTemplateId(); long serviceOfferingId = profileVo.getServiceOfferingId(); if (templateId == -1) { @@ -1296,24 +1708,24 @@ private long createNewVM(AutoScaleVmGroupVO asGroup) { // create new VM into DB try { //Verify that all objects exist before passing them to the service - Account owner = _accountService.getActiveAccountById(profileVo.getAccountId()); + Account owner = accountService.getActiveAccountById(profileVo.getAccountId()); - DataCenter zone = _entityMgr.findById(DataCenter.class, profileVo.getZoneId()); + DataCenter zone = entityMgr.findById(DataCenter.class, profileVo.getZoneId()); if (zone == null) { throw new InvalidParameterValueException("Unable to find zone by id=" + profileVo.getZoneId()); } - ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId); + ServiceOffering serviceOffering = entityMgr.findById(ServiceOffering.class, serviceOfferingId); if (serviceOffering == null) { throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId); } - DiskOffering diskOffering = _entityMgr.findById(DiskOffering.class, serviceOffering.getDiskOfferingId()); + DiskOffering diskOffering = entityMgr.findById(DiskOffering.class, serviceOffering.getDiskOfferingId()); if (diskOffering == null) { throw new InvalidParameterValueException("Unable to find disk offering: " + serviceOffering.getDiskOfferingId()); } - VirtualMachineTemplate template = _entityMgr.findById(VirtualMachineTemplate.class, templateId); + VirtualMachineTemplate template = entityMgr.findById(VirtualMachineTemplate.class, templateId); // Make sure a valid template ID was specified if (template == null) { throw new InvalidParameterValueException("Unable to use template " + templateId); @@ -1325,23 +1737,46 @@ private long createNewVM(AutoScaleVmGroupVO asGroup) { } } + String userData = profileVo.getUserData(); + UserVm vm = null; IpAddresses addrs = new IpAddresses(null, null); + HypervisorType hypervisorType = template.getHypervisorType(); + final Network network = getNetwork(asGroup.getLoadBalancerId()); + final Map customParameters = new HashMap<>(); + final Map deployParams = getDeployParams(profileVo.getOtherDeployParams()); + + final List networkIds = getVmNetworkIds(deployParams, network.getId()); + Long overrideDiskOfferingId = getVmOverrideDiskOfferingId(deployParams); + Long diskOfferingId = getVmDiskOfferingId(deployParams); + Long dataDiskSize = getVmDataDiskSize(deployParams); + List sshKeyPairs = getVmSshKeyPairs(deployParams, owner); + List affinityGroupIdList = getVmAffinityGroupId(deployParams); + updateVmDetails(deployParams, customParameters); + + String vmHostName = getNextVmHostName(asGroup); + asGroup.setNextVmSeq(asGroup.getNextVmSeq() + 1); + autoScaleVmGroupDao.persist(asGroup); + if (zone.getNetworkType() == NetworkType.Basic) { - vm = _userVmService.createBasicSecurityGroupVirtualMachine(zone, serviceOffering, template, null, owner, "autoScaleVm-" + asGroup.getId() + "-" + - getCurrentTimeStampString(), - "autoScaleVm-" + asGroup.getId() + "-" + getCurrentTimeStampString(), null, null, null, HypervisorType.XenServer, HTTPMethod.GET, null, null, null, null, null, - null, true, null, null, null, null, null, null, null, true, null); + vm = userVmService.createBasicSecurityGroupVirtualMachine(zone, serviceOffering, template, null, owner, vmHostName, + vmHostName, diskOfferingId, dataDiskSize, null, + hypervisorType, HTTPMethod.GET, userData, null, null, sshKeyPairs, + null, null, true, null, affinityGroupIdList, customParameters, null, null, null, + null, true, overrideDiskOfferingId); } else { if (zone.isSecurityGroupEnabled()) { - vm = _userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, template, null, null, - owner, "autoScaleVm-" + asGroup.getId() + "-" + getCurrentTimeStampString(), - "autoScaleVm-" + asGroup.getId() + "-" + getCurrentTimeStampString(), null, null, null, HypervisorType.XenServer, HTTPMethod.GET, null, null, null, null,null, null, true, null, null, null, null, null, null, null, true, null, null); + vm = userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, template, networkIds, null, + owner, vmHostName,vmHostName, diskOfferingId, dataDiskSize, null, + hypervisorType, HTTPMethod.GET, userData, null, null, sshKeyPairs, + null, null, true, null, affinityGroupIdList, customParameters, null, null, null, + null, true, overrideDiskOfferingId, null); } else { - vm = _userVmService.createAdvancedVirtualMachine(zone, serviceOffering, template, null, owner, "autoScaleVm-" + asGroup.getId() + "-" + - getCurrentTimeStampString(), "autoScaleVm-" + asGroup.getId() + "-" + getCurrentTimeStampString(), - null, null, null, HypervisorType.XenServer, HTTPMethod.GET, null, null, null, null, null, addrs, true, null, null, null, null, null, null, null, true, null, null); - + vm = userVmService.createAdvancedVirtualMachine(zone, serviceOffering, template, networkIds, owner, vmHostName, vmHostName, + diskOfferingId, dataDiskSize, null, + hypervisorType, HTTPMethod.GET, userData, null, null, sshKeyPairs, + null, addrs, true, null, affinityGroupIdList, customParameters, null, null, null, + null, true, null, overrideDiskOfferingId); } } @@ -1366,17 +1801,133 @@ private long createNewVM(AutoScaleVmGroupVO asGroup) { } } - private String getCurrentTimeStampString() { - Date current = new Date(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); + protected List getVmNetworkIds(Map deployParams, long defaultNetworkId) { + final List networkIds = new ArrayList<>(); + networkIds.add(defaultNetworkId); + if (deployParams.get(PARAM_NETWORK_IDS) != null) { // networkids, append to LB networkid + String[] networkids = deployParams.get(PARAM_NETWORK_IDS).split(","); + for (String networkid : networkids) { + Network otherNetwork = networkDao.findByUuid(networkid); + if (otherNetwork != null && otherNetwork.getId() != defaultNetworkId) { + networkIds.add(otherNetwork.getId()); + } + } + } + return networkIds; + } + + protected Long getVmOverrideDiskOfferingId(Map deployParams) { + Long overrideDiskOfferingId = null; // override ROOT disk offering + if (deployParams.get(PARAM_OVERRIDE_DISK_OFFERING_ID) != null) { + String overrideDiskOfferingUuid = deployParams.get(PARAM_OVERRIDE_DISK_OFFERING_ID); + DiskOffering overrideDiskOfferingInParam = diskOfferingDao.findByUuid(overrideDiskOfferingUuid); + if (overrideDiskOfferingInParam != null) { + overrideDiskOfferingId = overrideDiskOfferingInParam.getId(); + } else { + s_logger.warn("Cannot find disk offering by overridediskofferingid from otherdeployparams in AutoScale Vm profile"); + } + } + return overrideDiskOfferingId; + } + + protected final Long getVmDiskOfferingId(Map deployParams) { + Long diskOfferingId = null; // DATA disk offering ID + if (deployParams.get(PARAM_DISK_OFFERING_ID) != null) { + String diskOfferingUuid = deployParams.get(PARAM_DISK_OFFERING_ID); + DiskOffering diskOfferingInParam = diskOfferingDao.findByUuid(diskOfferingUuid); + if (diskOfferingInParam != null) { + diskOfferingId = diskOfferingInParam.getId(); + } else { + s_logger.warn("Cannot find disk offering by diskofferingid from otherdeployparams in AutoScale Vm profile"); + } + } + return diskOfferingId; + } + + protected Long getVmDataDiskSize(Map deployParams) { + Long dataDiskSize = null; // DATA disk size + if (deployParams.get(PARAM_DISK_SIZE) != null) { + String dataDiskSizeInParam = deployParams.get(PARAM_DISK_SIZE); + try { + dataDiskSize = Long.parseLong(dataDiskSizeInParam); + } catch (NumberFormatException ex) { + s_logger.warn("Cannot parse size from otherdeployparams in AutoScale Vm profile"); + } + } + return dataDiskSize; + } + + protected List getVmSshKeyPairs(Map deployParams, Account owner) { + List sshKeyPairs = new ArrayList<>(); + if (deployParams.get(PARAM_SSH_KEYPAIRS) != null) { // SSH keypairs + String[] keypairs = deployParams.get(PARAM_SSH_KEYPAIRS).split(","); + for (String keypair : keypairs) { + SSHKeyPairVO s = sshKeyPairDao.findByName(owner.getAccountId(), owner.getDomainId(), keypair); + if (s != null) { + sshKeyPairs.add(s.getName()); + } else { + s_logger.warn("Cannot find ssh keypair by name in sshkeypairs from otherdeployparams in AutoScale Vm profile"); + } + } + } + return sshKeyPairs; + } + + protected List getVmAffinityGroupId(Map deployParams) { + List affinityGroupIdList = new ArrayList<>(); + if (deployParams.get(PARAM_AFFINITY_GROUP_IDS) != null) { // Affinity groups + String[] affinityGroupIds = deployParams.get(PARAM_AFFINITY_GROUP_IDS).split(","); + for (String affinityGroupId : affinityGroupIds) { + AffinityGroupVO affintyGroup = affinityGroupDao.findByUuid(affinityGroupId); + if (affintyGroup != null) { + affinityGroupIdList.add(affintyGroup.getId()); + } else { + s_logger.warn("Cannot find affinity group by affinitygroupids from otherdeployparams in AutoScale Vm profile"); + } + } + } + return affinityGroupIdList; + } + + public void updateVmDetails(Map deployParams, Map customParameters) { + if (deployParams.get(PARAM_ROOT_DISK_SIZE) != null) { // ROOT disk size + String value = deployParams.get(PARAM_ROOT_DISK_SIZE); + try { + Long rootDiskSize = Long.parseLong(value); + customParameters.put(VmDetailConstants.ROOT_DISK_SIZE, String.valueOf(rootDiskSize)); + } catch (NumberFormatException ex) { + s_logger.warn("Cannot parse rootdisksize from otherdeployparams in AutoScale Vm profile"); + } + } + } + + private String getNextVmHostName(AutoScaleVmGroupVO asGroup) { + String vmHostNameSuffix = "-" + asGroup.getNextVmSeq() + "-" + + RandomStringUtils.random(VM_HOSTNAME_RANDOM_SUFFIX_LENGTH, 0, 0, true, false, (char[])null, new SecureRandom()).toLowerCase(); + // Truncate vm group name because max length of vm name is 63 + int subStringLength = Math.min(asGroup.getName().length(), 63 - VM_HOSTNAME_PREFIX.length() - vmHostNameSuffix.length()); + return VM_HOSTNAME_PREFIX + asGroup.getName().substring(0, subStringLength) + vmHostNameSuffix; + } - return sdf.format(current); + private void checkAutoScaleVmGroupName(String groupName) { + String errorMessage = ""; + if (groupName == null || groupName.length() > 255 || groupName.length() < 1) { + errorMessage = "AutoScale Vm Group name must be between 1 and 255 characters long"; + } else if (!groupName.toLowerCase().matches("[a-z0-9-]*")) { + errorMessage = "AutoScale Vm Group name may contain only the ASCII letters 'a' through 'z' (in a case-insensitive manner), " + + "the digits '0' through '9' and the hyphen ('-')"; + } + if (StringUtils.isNotBlank(errorMessage)) { + s_logger.warn(errorMessage); + throw new InvalidParameterValueException("Invalid AutoScale VM group name. It can contain the ASCII letters 'a' through 'z', " + + "'A' through 'Z', the digits '0' through '9' and the hyphen ('-'), must be between 1 and 255 characters long."); + } } private boolean startNewVM(long vmId) { try { CallContext.current().setEventDetails("Vm Id: " + vmId); - _userVmManager.startVirtualMachine(vmId, null, null, null); + userVmMgr.startVirtualMachine(vmId, null, null, null); } catch (final ResourceUnavailableException ex) { s_logger.warn("Exception: ", ex); throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); @@ -1404,9 +1955,9 @@ private boolean assignLBruleToNewVm(long vmId, AutoScaleVmGroupVO asGroup) { List lstVmId = new ArrayList(); long lbId = asGroup.getLoadBalancerId(); - List LbVmMapVos = _lbVmMapDao.listByLoadBalancerId(lbId); - if ((LbVmMapVos != null) && (LbVmMapVos.size() > 0)) { - for (LoadBalancerVMMapVO LbVmMapVo : LbVmMapVos) { + List lbVmMapVos = lbVmMapDao.listByLoadBalancerId(lbId); + if (CollectionUtils.isNotEmpty(lbVmMapVos)) { + for (LoadBalancerVMMapVO LbVmMapVo : lbVmMapVos) { long instanceId = LbVmMapVo.getInstanceId(); if (instanceId == vmId) { s_logger.warn("the new VM is already mapped to LB rule. What's wrong?"); @@ -1415,16 +1966,20 @@ private boolean assignLBruleToNewVm(long vmId, AutoScaleVmGroupVO asGroup) { } } lstVmId.add(new Long(vmId)); - return _loadBalancingRulesService.assignToLoadBalancer(lbId, lstVmId, new HashMap>()); - + try { + return loadBalancingRulesService.assignToLoadBalancer(lbId, lstVmId, new HashMap<>(), true); + } catch (CloudRuntimeException ex) { + s_logger.warn("Caught exception: ", ex); + return false; + } } private long removeLBrule(AutoScaleVmGroupVO asGroup) { long lbId = asGroup.getLoadBalancerId(); long instanceId = -1; - List LbVmMapVos = _lbVmMapDao.listByLoadBalancerId(lbId); - if ((LbVmMapVos != null) && (LbVmMapVos.size() > 0)) { - for (LoadBalancerVMMapVO LbVmMapVo : LbVmMapVos) { + List lbVmMapVos = lbVmMapDao.listByLoadBalancerId(lbId); + if (CollectionUtils.isNotEmpty(lbVmMapVos)) { + for (LoadBalancerVMMapVO LbVmMapVo : lbVmMapVos) { instanceId = LbVmMapVo.getInstanceId(); } } @@ -1432,7 +1987,7 @@ private long removeLBrule(AutoScaleVmGroupVO asGroup) { List lstVmId = new ArrayList(); if (instanceId != -1) lstVmId.add(instanceId); - if (_loadBalancingRulesService.removeFromLoadBalancer(lbId, lstVmId, new HashMap>())) + if (loadBalancingRulesService.removeFromLoadBalancer(lbId, lstVmId, new HashMap<>(), true)) return instanceId; else return -1; @@ -1440,7 +1995,7 @@ private long removeLBrule(AutoScaleVmGroupVO asGroup) { @Override public void doScaleUp(long groupId, Integer numVm) { - AutoScaleVmGroupVO asGroup = _autoScaleVmGroupDao.findById(groupId); + AutoScaleVmGroupVO asGroup = autoScaleVmGroupDao.findById(groupId); if (asGroup == null) { s_logger.error("Can not find the groupid " + groupId + " for scaling up"); return; @@ -1448,46 +2003,73 @@ public void doScaleUp(long groupId, Integer numVm) { if (!checkConditionUp(asGroup, numVm)) { return; } - for (int i = 0; i < numVm; i++) { - long vmId = createNewVM(asGroup); - if (vmId == -1) { - s_logger.error("Can not deploy new VM for scaling up in the group " - + asGroup.getId() + ". Waiting for next round"); - break; - } - if (startNewVM(vmId)) { - if (assignLBruleToNewVm(vmId, asGroup)) { - // persist to DB - AutoScaleVmGroupVmMapVO GroupVmVO = new AutoScaleVmGroupVmMapVO( - asGroup.getId(), vmId); - _autoScaleVmGroupVmMapDao.persist(GroupVmVO); - // update last_quiettime - List GroupPolicyVOs = _autoScaleVmGroupPolicyMapDao - .listByVmGroupId(groupId); - for (AutoScaleVmGroupPolicyMapVO GroupPolicyVO : GroupPolicyVOs) { - AutoScalePolicyVO vo = _autoScalePolicyDao - .findById(GroupPolicyVO.getPolicyId()); - if (vo.getAction().equals("scaleup")) { - vo.setLastQuiteTime(new Date()); - _autoScalePolicyDao.persist(vo); - break; + AutoScaleVmGroup.State oldState = asGroup.getState(); + AutoScaleVmGroup.State newState = AutoScaleVmGroup.State.SCALING; + if (!autoScaleVmGroupDao.updateState(groupId, oldState, newState)) { + s_logger.error(String.format("Can not update vmgroup state from %s to %s, groupId: %s", oldState, newState, groupId)); + return; + } + try { + for (int i = 0; i < numVm; i++) { + ActionEventUtils.onStartedActionEvent(User.UID_SYSTEM, asGroup.getAccountId(), EventTypes.EVENT_AUTOSCALEVMGROUP_SCALEUP, + "Scaling Up AutoScale VM group " + groupId, groupId, ApiCommandResourceType.AutoScaleVmGroup.toString(), + true, 0); + long vmId = createNewVM(asGroup); + if (vmId == -1) { + s_logger.error("Can not deploy new VM for scaling up in the group " + + asGroup.getId() + ". Waiting for next round"); + break; + } + // persist to DB + AutoScaleVmGroupVmMapVO groupVmMapVO = new AutoScaleVmGroupVmMapVO(asGroup.getId(), vmId); + autoScaleVmGroupVmMapDao.persist(groupVmMapVO); + + // Add an Inactive-dummy record to statistics table + createInactiveDummyRecord(asGroup.getId()); + + try { + startNewVM(vmId); + createInactiveDummyRecord(asGroup.getId()); + if (assignLBruleToNewVm(vmId, asGroup)) { + // update last_quietTime + List groupPolicyVOs = autoScaleVmGroupPolicyMapDao + .listByVmGroupId(groupId); + for (AutoScaleVmGroupPolicyMapVO groupPolicyVO : groupPolicyVOs) { + AutoScalePolicyVO vo = autoScalePolicyDao + .findById(groupPolicyVO.getPolicyId()); + if (vo.getAction().equals(AutoScalePolicy.Action.SCALEUP)) { + vo.setLastQuietTime(new Date()); + autoScalePolicyDao.persist(vo); + break; + } } + ActionEventUtils.onCompletedActionEvent(User.UID_SYSTEM, asGroup.getAccountId(), EventVO.LEVEL_INFO, EventTypes.EVENT_AUTOSCALEVMGROUP_SCALEUP, + String.format("Started and assigned LB rule for VM %d in AutoScale VM group %d", vmId, groupId), groupId, ApiCommandResourceType.AutoScaleVmGroup.toString(), 0); + } else { + s_logger.error("Can not assign LB rule for this new VM"); + ActionEventUtils.onCompletedActionEvent(User.UID_SYSTEM, asGroup.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_AUTOSCALEVMGROUP_SCALEUP, + String.format("Failed to assign LB rule for VM %d in AutoScale VM group %d", vmId, groupId), groupId, ApiCommandResourceType.AutoScaleVmGroup.toString(), 0); + break; } - } else { - s_logger.error("Can not assign LB rule for this new VM"); + } catch (ServerApiException e) { + s_logger.error("Can not deploy new VM for scaling up in the group " + + asGroup.getId() + ". Waiting for next round"); + ActionEventUtils.onCompletedActionEvent(User.UID_SYSTEM, asGroup.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_AUTOSCALEVMGROUP_SCALEUP, + String.format("Failed to start VM %d in AutoScale VM group %d", vmId, groupId), groupId, ApiCommandResourceType.AutoScaleVmGroup.toString(), 0); + destroyVm(vmId); break; } - } else { - s_logger.error("Can not deploy new VM for scaling up in the group " - + asGroup.getId() + ". Waiting for next round"); - break; + } + } finally { + if (!autoScaleVmGroupDao.updateState(groupId, newState, oldState)) { + s_logger.error(String.format("Can not update vmgroup state from %s back to %s, groupId: %s", newState, oldState, groupId)); } } } @Override public void doScaleDown(final long groupId) { - AutoScaleVmGroupVO asGroup = _autoScaleVmGroupDao.findById(groupId); + AutoScaleVmGroupVO asGroup = autoScaleVmGroupDao.findById(groupId); if (asGroup == null) { s_logger.error("Can not find the groupid " + groupId + " for scaling down"); return; @@ -1495,45 +2077,931 @@ public void doScaleDown(final long groupId) { if (!checkConditionDown(asGroup)) { return; } - final long vmId = removeLBrule(asGroup); - if (vmId != -1) { - long profileId = asGroup.getProfileId(); - - // update group-vm mapping - _autoScaleVmGroupVmMapDao.remove(groupId, vmId); - // update last_quiettime - List GroupPolicyVOs = _autoScaleVmGroupPolicyMapDao.listByVmGroupId(groupId); - for (AutoScaleVmGroupPolicyMapVO GroupPolicyVO : GroupPolicyVOs) { - AutoScalePolicyVO vo = _autoScalePolicyDao.findById(GroupPolicyVO.getPolicyId()); - if (vo.getAction().equals("scaledown")) { - vo.setLastQuiteTime(new Date()); - _autoScalePolicyDao.persist(vo); - break; - } + AutoScaleVmGroup.State oldState = asGroup.getState(); + AutoScaleVmGroup.State newState = AutoScaleVmGroup.State.SCALING; + if (!autoScaleVmGroupDao.updateState(groupId, oldState, newState)) { + s_logger.error(String.format("Can not update vmgroup state from %s to %s, groupId: %s", oldState, newState, groupId)); + return; + } + ActionEventUtils.onStartedActionEvent(User.UID_SYSTEM, asGroup.getAccountId(), EventTypes.EVENT_AUTOSCALEVMGROUP_SCALEDOWN, + "Scaling down AutoScale VM group " + groupId, groupId, ApiCommandResourceType.AutoScaleVmGroup.toString(), + true, 0); + try { + long vmId = -1; + try { + vmId = removeLBrule(asGroup); + } catch (Exception ex) { + s_logger.info("Got exception when remove LB rule for a VM in AutoScale VM group %d: " + groupId, ex); + ActionEventUtils.onCompletedActionEvent(User.UID_SYSTEM, asGroup.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_AUTOSCALEVMGROUP_SCALEDOWN, + String.format("Failed to remove LB rule for a VM in AutoScale VM group %d", groupId), groupId, ApiCommandResourceType.AutoScaleVmGroup.toString(), 0); + throw ex; } + if (vmId != -1) { + long profileId = asGroup.getProfileId(); + + // update group-vm mapping + autoScaleVmGroupVmMapDao.remove(groupId, vmId); + // update last_quietTime + List groupPolicyVOs = autoScaleVmGroupPolicyMapDao.listByVmGroupId(groupId); + for (AutoScaleVmGroupPolicyMapVO groupPolicyVO : groupPolicyVOs) { + AutoScalePolicyVO vo = autoScalePolicyDao.findById(groupPolicyVO.getPolicyId()); + if (vo.getAction().equals(AutoScalePolicy.Action.SCALEUP)) { + vo.setLastQuietTime(new Date()); + autoScalePolicyDao.persist(vo); + break; + } + } - // get destroyvmgrace param - AutoScaleVmProfileVO asProfile = _autoScaleVmProfileDao.findById(profileId); - Integer destroyVmGracePeriod = asProfile.getDestroyVmGraceperiod(); - if (destroyVmGracePeriod >= 0) { - _executor.schedule(new Runnable() { - @Override - public void run() { - try { + // Add an Inactive-dummy record to statistics table + createInactiveDummyRecord(asGroup.getId()); + + // get expungeVmGracePeriod param + AutoScaleVmProfileVO asProfile = autoScaleVmProfileDao.findById(profileId); + Integer expungeVmGracePeriod = asProfile.getExpungeVmGracePeriod(); + if (expungeVmGracePeriod > 0) { + try { + Thread.sleep(expungeVmGracePeriod * 1000L); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new CloudRuntimeException(String.format("Error while waiting %s seconds to destroy the VM %s", expungeVmGracePeriod, vmId)); + } + } + if (destroyVm(vmId)) { + ActionEventUtils.onCompletedActionEvent(User.UID_SYSTEM, asGroup.getAccountId(), EventVO.LEVEL_INFO, EventTypes.EVENT_AUTOSCALEVMGROUP_SCALEDOWN, + String.format("Destroyed VM %d in AutoScale VM group %d", vmId, groupId), groupId, ApiCommandResourceType.AutoScaleVmGroup.toString(), 0); + } else { + ActionEventUtils.onCompletedActionEvent(User.UID_SYSTEM, asGroup.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_AUTOSCALEVMGROUP_SCALEDOWN, + String.format("Failed to destroy VM %d in AutoScale VM group %d", vmId, groupId), groupId, ApiCommandResourceType.AutoScaleVmGroup.toString(), 0); + } + } else { + s_logger.error("Can not remove LB rule for the VM being destroyed. Do nothing more."); + ActionEventUtils.onCompletedActionEvent(User.UID_SYSTEM, asGroup.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_AUTOSCALEVMGROUP_SCALEDOWN, + String.format("Failed to remove LB rule for a VM in AutoScale VM group %d", groupId), groupId, ApiCommandResourceType.AutoScaleVmGroup.toString(), 0); + } + } finally { + if (!autoScaleVmGroupDao.updateState(groupId, newState, oldState)) { + s_logger.error(String.format("Can not update vmgroup state from %s back to %s, groupId: %s", newState, oldState, groupId)); + } + } + } + + @Override + public String getConfigComponentName() { + return AutoScaleManager.class.getSimpleName(); + } + + @Override + public ConfigKey[] getConfigKeys() { + return new ConfigKey[] { + AutoScaleStatsInterval, + AutoScaleStatsCleanupDelay, + AutoScaleStatsWorker + }; + } + + @Override + public void checkAllAutoScaleVmGroups() { + // list all AS VMGroups + List asGroups = autoScaleVmGroupDao.listAll(); + for (AutoScaleVmGroupVO asGroup : asGroups) { + completionService.submit(new CheckAutoScaleVmGroupAsync(asGroup)); + } + for (int i = 0; i < asGroups.size(); i++) { + try { + Future> future = completionService.take(); + Pair result = future.get(); + s_logger.debug("Checked AutoScale vm group " + result.first() + " with result: " + result.second()); + } catch (ExecutionException ex) { + s_logger.warn("Failed to get result of checking AutoScale vm group due to Exception: " , ex); + } catch (InterruptedException ex) { + s_logger.warn("Failed to get result of checking AutoScale vm group due to Exception: " , ex); + Thread.currentThread().interrupt(); + } + } + } + + protected class CheckAutoScaleVmGroupAsync implements Callable> { + AutoScaleVmGroupVO asGroup; + + public CheckAutoScaleVmGroupAsync(AutoScaleVmGroupVO asGroup) { + this.asGroup = asGroup; + } + + @Override + public Pair call() { + try { + s_logger.debug("Checking AutoScale vm group " + asGroup); + checkAutoScaleVmGroup(asGroup); + } catch (Exception ex) { + s_logger.warn("Failed to check AutoScale vm group " + asGroup + " due to Exception: " , ex); + return new Pair<>(asGroup.getId(), false); + } + return new Pair<>(asGroup.getId(), true); + } + } + + @Override + public void checkAutoScaleVmGroup(AutoScaleVmGroupVO asGroup) { + // check group state + if (asGroup.getState().equals(AutoScaleVmGroup.State.ENABLED)) { + Network.Provider provider = getLoadBalancerServiceProvider(asGroup.getLoadBalancerId()); + if (Network.Provider.Netscaler.equals(provider)) { + checkNetScalerAsGroup(asGroup); + } else if (Network.Provider.VirtualRouter.equals(provider) || Network.Provider.VPCVirtualRouter.equals(provider)) { + checkVirtualRouterAsGroup(asGroup); + } + } + } + + protected boolean isNative(AutoScaleVmGroupTO groupTO) { + for (AutoScalePolicyTO policyTO : groupTO.getPolicies()) { + for (ConditionTO conditionTO : policyTO.getConditions()) { + CounterTO counterTO = conditionTO.getCounter(); + if (Counter.NativeSources.contains(counterTO.getSource())) { + return true; + } + } + } + return false; + } + + protected boolean hasSourceVirtualRouter(AutoScaleVmGroupTO groupTO) { + for (AutoScalePolicyTO policyTO : groupTO.getPolicies()) { + for (ConditionTO conditionTO : policyTO.getConditions()) { + CounterTO counterTO = conditionTO.getCounter(); + if (Counter.Source.VIRTUALROUTER.equals(counterTO.getSource())) { + return true; + } + } + } + return false; + } + + protected Map> getHostAndVmIdsMap(AutoScaleVmGroupTO groupTO) { + Map> hostAndVmIdsMap = new HashMap<>(); + + List asGroupVmVOs = autoScaleVmGroupVmMapDao.listByGroup(groupTO.getId()); + for (AutoScaleVmGroupVmMapVO asGroupVmVO : asGroupVmVOs) { + updateHostAndVmIdsMap(hostAndVmIdsMap, asGroupVmVO); + } + return hostAndVmIdsMap; + } + + protected void updateHostAndVmIdsMap(Map> hostAndVmIdsMap, AutoScaleVmGroupVmMapVO asGroupVmVO) { + Long vmId = asGroupVmVO.getInstanceId(); + UserVmVO vm = userVmDao.findById(vmId); + Long vmHostId = DEFAULT_HOST_ID; + if (VirtualMachine.State.Running.equals(vm.getState())) { + vmHostId = vm.getHostId(); + } else if (VirtualMachine.State.Migrating.equals(vm.getState())) { + vmHostId = vm.getLastHostId(); + } + List vmIds = hostAndVmIdsMap.get(vmHostId); + if (vmIds == null) { + vmIds = new ArrayList<>(); + } + vmIds.add(vmId); + hostAndVmIdsMap.put(vmHostId, vmIds); + } + + protected Map> getPolicyCounters(AutoScaleVmGroupTO groupTO) { + Map> counters = new HashMap<>(); + for (AutoScalePolicyTO policyTO : groupTO.getPolicies()) { + List counterTOs = new ArrayList<>(); + for (ConditionTO conditionTO : policyTO.getConditions()) { + CounterTO counterTO = conditionTO.getCounter(); + counterTOs.add(counterTO); + } + counters.put(policyTO.getId(), counterTOs); + } + return counters; + } + + protected AutoScalePolicy.Action getAutoscaleAction(Map countersMap, Map countersNumberMap, AutoScaleVmGroupTO groupTO) { + s_logger.debug("[AutoScale] Getting autoscale action for group : " + groupTO.getId()); + + Network.Provider provider = getLoadBalancerServiceProvider(groupTO.getLoadBalancerId()); + + for (AutoScalePolicyTO policyTO : groupTO.getPolicies()) { + if (isQuitTimePassForPolicy(policyTO)) { + AutoScalePolicy.Action determinedAction = checkConditionsForPolicy(countersMap, countersNumberMap, policyTO, provider); + if (determinedAction != null) { + return determinedAction; + } + } + } + return null; + } + + protected boolean isQuitTimePassForPolicy(AutoScalePolicyTO policyTO) { + int quietTime = policyTO.getQuietTime(); + Date quietTimeDate = policyTO.getLastQuietTime(); + long lastQuiettime = 0L; + if (quietTimeDate != null) { + lastQuiettime = policyTO.getLastQuietTime().getTime(); + } + long currentTime = (new Date()).getTime(); + return (currentTime - lastQuiettime) >= quietTime * 1000L; + } + + protected AutoScalePolicy.Action checkConditionsForPolicy(Map countersMap, Map countersNumberMap, AutoScalePolicyTO policyTO, Network.Provider provider) { + boolean bValid = true; + for (ConditionTO conditionTO : policyTO.getConditions()) { + CounterTO counter = conditionTO.getCounter(); + long thresholdValue = conditionTO.getThreshold(); + Double thresholdPercent = (double)thresholdValue; + + String key = generateKeyFromPolicyAndConditionAndCounter(policyTO.getId(), conditionTO.getId(), counter.getId()); + if (Network.Provider.Netscaler.equals(provider)) { + key = generateKeyFromPolicyAndConditionAndCounter(0L, conditionTO.getId(), counter.getId()); + } + Double sum = countersMap.get(key); + Integer number = countersNumberMap.get(key); + s_logger.debug(String.format("Checking policyId = %d, conditionId = %d, counter = \"%s\", sum = %f, number = %s", policyTO.getId(), conditionTO.getId(), counter.getName(), sum, number)); + if (number == null || number == 0) { + bValid = false; + s_logger.debug(String.format("Skipping policyId = %d, conditionId = %d, counter = \"%s\" because the number is %s", policyTO.getId(), conditionTO.getId(), counter.getName(), number)); + break; + } + Double avg = sum / number; + Condition.Operator op = conditionTO.getRelationalOperator(); + boolean bConditionCheck = ((op == com.cloud.network.as.Condition.Operator.EQ) && (thresholdPercent.equals(avg))) + || ((op == com.cloud.network.as.Condition.Operator.GE) && (avg.doubleValue() >= thresholdPercent.doubleValue())) + || ((op == com.cloud.network.as.Condition.Operator.GT) && (avg.doubleValue() > thresholdPercent.doubleValue())) + || ((op == com.cloud.network.as.Condition.Operator.LE) && (avg.doubleValue() <= thresholdPercent.doubleValue())) + || ((op == com.cloud.network.as.Condition.Operator.LT) && (avg.doubleValue() < thresholdPercent.doubleValue())); + + s_logger.debug(String.format("Check result on policyId = %d, conditionId = %d, counter = %s is : %s" + + " (actual result = %f, operator = %s, threshold = %f)", + policyTO.getId(), conditionTO.getId(), counter.getSource(), bConditionCheck, avg, op, thresholdPercent)); + + if (!bConditionCheck) { + bValid = false; + break; + } + } + AutoScalePolicy.Action action = bValid ? policyTO.getAction() : null; + s_logger.debug(String.format("Check result on policyId = %d is %s", policyTO.getId(), action)); + + return action; + } + + private List> getPairofCounternameAndDuration(AutoScaleVmGroupTO groupTO) { + List> result = new ArrayList<>(); + + for (AutoScalePolicyTO policyTO : groupTO.getPolicies()) { + //get duration + Integer duration = policyTO.getDuration(); + for (ConditionTO conditionTO : policyTO.getConditions()) { + CounterTO counter = conditionTO.getCounter(); + StringBuilder buff = new StringBuilder(); + buff.append(counter.getName()); + buff.append(","); + buff.append(conditionTO.getId()); + // add to result + Pair pair = new Pair<>(buff.toString(), duration); + result.add(pair); + } + } + return result; + } + + protected Network getNetwork(Long loadBalancerId) { + final LoadBalancerVO loadBalancer = lbDao.findById(loadBalancerId); + if (loadBalancer == null) { + throw new CloudRuntimeException(String.format("Unable to find load balancer with id: %s ", loadBalancerId)); + } + Network network = networkDao.findById(loadBalancer.getNetworkId()); + if (network == null) { + throw new CloudRuntimeException(String.format("Unable to find network with id: %s ", loadBalancer.getNetworkId())); + } + return network; + } + + protected Pair getPublicIpAndPort(Long loadBalancerId) { + final LoadBalancerVO loadBalancer = lbDao.findById(loadBalancerId); + if (loadBalancer == null) { + throw new CloudRuntimeException(String.format("Unable to find load balancer with id: %s ", loadBalancerId)); + } + IPAddressVO ipAddress = ipAddressDao.findById(loadBalancer.getSourceIpAddressId()); + if (ipAddress == null) { + throw new CloudRuntimeException(String.format("Unable to find IP Address with id: %s ", loadBalancer.getSourceIpAddressId())); + } + return new Pair<>(ipAddress.getAddress().addr(), loadBalancer.getSourcePortStart()); + } + + protected Network.Provider getLoadBalancerServiceProvider(Long loadBalancerId) { + final LoadBalancerVO loadBalancer = lbDao.findById(loadBalancerId); + if (loadBalancer == null) { + throw new CloudRuntimeException(String.format("Unable to find load balancer with id: %s ", loadBalancerId)); + } + return lbRulesMgr.getLoadBalancerServiceProvider(loadBalancer); + } + + protected boolean checkAsGroupMaxAndMinMembers(AutoScaleVmGroupVO asGroup) { + // check minimum vm of group + Integer currentVM = autoScaleVmGroupVmMapDao.countAvailableVmsByGroup(asGroup.getId()); + if (currentVM < asGroup.getMinMembers()) { + s_logger.debug(String.format("There are currently %s available VMs which is less than the minimum member of " + + "the AS group (%s), scaling up %d VMs", currentVM, asGroup.getMinMembers(), asGroup.getMinMembers() - currentVM)); + doScaleUp(asGroup.getId(), asGroup.getMinMembers() - currentVM); + return false; + } + + // check maximum vm of group + if (currentVM > asGroup.getMaxMembers()) { + s_logger.debug(String.format("There are currently %s available VMs which is more than the maximum member of " + + "the AS group (%s), scaling down %d VMs", currentVM, asGroup.getMaxMembers(), currentVM - asGroup.getMaxMembers())); + for (int i = 0; i < currentVM - asGroup.getMaxMembers(); i++) { + doScaleDown(asGroup.getId()); + } + return false; + } + return true; + } + + protected void checkNetScalerAsGroup(AutoScaleVmGroupVO asGroup) { + AutoScaleVmGroupTO groupTO = lbRulesMgr.toAutoScaleVmGroupTO(asGroup); + + if (!isNative(groupTO)) { + return; + } + + if (!checkAsGroupMaxAndMinMembers(asGroup)) { + return; + } + + //check interval + long now = (new Date()).getTime(); + if (asGroup.getLastInterval() != null && (now - asGroup.getLastInterval().getTime()) < asGroup.getInterval()) { + return; + } + + // update last_interval + asGroup.setLastInterval(new Date()); + autoScaleVmGroupDao.persist(asGroup); + + if (s_logger.isDebugEnabled()) { + s_logger.debug("[Netscaler AutoScale] Collecting RRDs data..."); + } + Map params = new HashMap<>(); + List asGroupVmVOs = autoScaleVmGroupVmMapDao.listByGroup(asGroup.getId()); + params.put("total_vm", String.valueOf(asGroupVmVOs.size())); + for (int i = 0; i < asGroupVmVOs.size(); i++) { + long vmId = asGroupVmVOs.get(i).getInstanceId(); + VMInstanceVO vmVO = vmInstanceDao.findById(vmId); + //xe vm-list | grep vmname -B 1 | head -n 1 | awk -F':' '{print $2}' + params.put("vmname" + (i + 1), vmVO.getInstanceName()); + params.put("vmid" + (i + 1), String.valueOf(vmVO.getId())); + + } + // get random hostid because all vms are in a cluster + long vmId = asGroupVmVOs.get(0).getInstanceId(); + VMInstanceVO vmVO = vmInstanceDao.findById(vmId); + Long receiveHost = vmVO.getHostId(); + + setPerformanceMonitorCommandParams(groupTO, params); + + PerformanceMonitorCommand perfMon = new PerformanceMonitorCommand(params, 20); + + try { + PerformanceMonitorAnswer answer = (PerformanceMonitorAnswer) agentMgr.send(receiveHost, perfMon); + if (answer == null || !answer.getResult()) { + s_logger.debug("Failed to send data to node !"); + } else { + String result = answer.getDetails(); + s_logger.debug("[AutoScale] RRDs collection answer: " + result); + HashMap countersMap = new HashMap<>(); + HashMap countersNumberMap = new HashMap<>(); + + processPerformanceMonitorAnswer(countersMap, countersNumberMap, groupTO, params, result); + + AutoScalePolicy.Action scaleAction = getAutoscaleAction(countersMap, countersNumberMap, groupTO); + if (scaleAction != null) { + s_logger.debug("[AutoScale] Doing scale action: " + scaleAction + " for group " + asGroup.getId()); + if (AutoScalePolicy.Action.SCALEUP.equals(scaleAction)) { + doScaleUp(asGroup.getId(), 1); + } else { + doScaleDown(asGroup.getId()); + } + } + } + + } catch (Exception e) { + s_logger.error("Cannot sent PerformanceMonitorCommand to host " + receiveHost + " or process the answer due to Exception: ", e); + } + } + + protected void setPerformanceMonitorCommandParams(AutoScaleVmGroupTO groupTO, Map params) { + // setup parameters phase: duration and counter + // list pair [counter, duration] + List> lstPair = getPairofCounternameAndDuration(groupTO); + int totalCounter = 0; + String[] lstCounter = new String[lstPair.size()]; + for (int i = 0; i < lstPair.size(); i++) { + Pair pair = lstPair.get(i); + String strCounterNames = pair.first(); + Integer duration = pair.second(); + + lstCounter[i] = strCounterNames.split(",")[0]; // counter name + totalCounter++; + params.put("duration" + totalCounter, duration.toString()); + params.put("counter" + totalCounter, lstCounter[i]); + params.put("con" + totalCounter, strCounterNames.split(",")[1]); // condition id + } + params.put("totalCounter", String.valueOf(totalCounter)); + } + + protected void processPerformanceMonitorAnswer(Map countersMap, Map countersNumberMap, + AutoScaleVmGroupTO groupTO, Map params, String details) { + // extract data + String[] counterElements = details.split(","); + if ((counterElements != null) && (counterElements.length > 0)) { + for (String string : counterElements) { + try { + String[] counterVals = string.split(":"); + String[] counterVm = counterVals[0].split("\\."); + + Long counterId = Long.parseLong(counterVm[1]); + + Long conditionId = Long.parseLong(params.get("con" + counterVm[0])); + + Long policyId = 0L; // For NetScaler, the policyId is not returned in PerformanceMonitorAnswer + + Double coVal = Double.parseDouble(counterVals[1]); + + updateCountersMapWithInstantData(countersMap, countersNumberMap, groupTO, counterId, conditionId, policyId, coVal, AutoScaleValueType.INSTANT_VM); + + } catch (Exception e) { + s_logger.error("Cannot process PerformanceMonitorAnswer due to Exception: ", e); + } + } + } + } + + protected void updateCountersMapWithInstantData(Map countersMap, Map countersNumberMap, AutoScaleVmGroupTO groupTO, + Long counterId, Long conditionId, Long policyId, Double coVal, AutoScaleValueType valueType) { + // Summary of all counter by counterId key + String key = generateKeyFromPolicyAndConditionAndCounter(policyId, conditionId, counterId); + + CounterVO counter = counterDao.findById(counterId); + if (counter == null) { + return; + } + if (Counter.Source.MEMORY.equals(counter.getSource())) { + // calculate memory in percent + AutoScaleVmProfileTO profile = groupTO.getProfile(); + ServiceOfferingVO serviceOff = serviceOfferingDao.findByUuidIncludingRemoved(profile.getServiceOfferingId()); + int maxRAM = serviceOff.getRamSize(); + + // get current RAM percent + coVal = coVal / maxRAM * 100; + } else if (Counter.Source.CPU.equals(counter.getSource())) { + // cpu + coVal = coVal * 100; + } + + if (AutoScaleValueType.INSTANT_VM_GROUP.equals(valueType)) { + Integer currentVM = autoScaleVmGroupVmMapDao.countAvailableVmsByGroup(groupTO.getId()); + if (currentVM == 0) { + s_logger.debug(String.format("Skipping updating countersMap for group %s and policy %s and counter %s due to no VMs", groupTO.getId(), policyId, counterId)); + return; + } + coVal = coVal / currentVM; + } + + updateCountersMapWithProcessedData(countersMap, countersNumberMap, key, coVal); + } + + protected void updateCountersMapWithProcessedData(Map countersMap, Map countersNumberMap, String key, Double coVal) { + /* initialize if data is not set */ + countersMap.computeIfAbsent(key, k -> Double.valueOf(0)); + countersNumberMap.computeIfAbsent(key, k -> 0); + + // update data entry + countersMap.put(key, countersMap.get(key) + coVal); + countersNumberMap.put(key, countersNumberMap.get(key) + 1); + } + + protected void monitorVirtualRouterAsGroup(AutoScaleVmGroupVO asGroup) { + if (!checkAsGroupMaxAndMinMembers(asGroup)) { + return; + } + + //check interval + long now = (new Date()).getTime(); + if (asGroup.getLastInterval() != null && (now - asGroup.getLastInterval().getTime()) < asGroup.getInterval()) { + return; + } + + // update last_interval + asGroup.setLastInterval(new Date()); + autoScaleVmGroupDao.persist(asGroup); + + s_logger.debug("[AutoScale] Collecting performance data ..."); + + AutoScaleVmGroupTO groupTO = lbRulesMgr.toAutoScaleVmGroupTO(asGroup); + + if (isNative(groupTO)) { + s_logger.debug("[AutoScale] Collecting performance data from hosts ..."); + getVmStatsFromHosts(groupTO); + } + + if (hasSourceVirtualRouter(groupTO)) { + s_logger.debug("[AutoScale] Collecting performance data from virtual router ..."); + getNetworkStatsFromVirtualRouter(groupTO); + } + } + + protected void checkVirtualRouterAsGroup(AutoScaleVmGroupVO asGroup) { + AutoScaleVmGroupTO groupTO = lbRulesMgr.toAutoScaleVmGroupTO(asGroup); - _userVmManager.destroyVm(vmId, false); + Map countersMap = new HashMap<>(); + Map countersNumberMap = new HashMap<>(); + + try { + // update counter maps in memory + if (!updateCountersMap(groupTO, countersMap, countersNumberMap)) { + return; + } + } finally { + // Remove old statistics from database + cleanupAsVmGroupStatistics(groupTO); + } - } catch (ResourceUnavailableException e) { - e.printStackTrace(); - } catch (ConcurrentOperationException e) { - e.printStackTrace(); + // get scale action + AutoScalePolicy.Action scaleAction = getAutoscaleAction(countersMap, countersNumberMap, groupTO); + if (scaleAction != null) { + s_logger.debug("[AutoScale] Doing scale action: " + scaleAction + " for group " + asGroup.getId()); + if (AutoScalePolicy.Action.SCALEUP.equals(scaleAction)) { + doScaleUp(asGroup.getId(), 1); + } else { + doScaleDown(asGroup.getId()); + } + } + } + + protected void getVmStatsFromHosts(AutoScaleVmGroupTO groupTO) { + // group vms by host id + Map> hostAndVmIdsMap = getHostAndVmIdsMap(groupTO); + + Map> policyCountersMap = getPolicyCounters(groupTO); + + // get vm stats from each host and update database + for (Map.Entry> hostAndVmIds : hostAndVmIdsMap.entrySet()) { + Long hostId = hostAndVmIds.getKey(); + List vmIds = hostAndVmIds.getValue(); + + if (!DEFAULT_HOST_ID.equals(hostId)) { + Map vmStatsById = getVmStatsByIdFromHost(hostId, vmIds); + processVmStatsByIdFromHost(groupTO, vmIds, vmStatsById, policyCountersMap); + } + } + } + + protected Map getVmStatsByIdFromHost(Long hostId, List vmIds) { + Map vmStatsById = new HashMap<>(); + HostVO host = hostDao.findById(hostId); + if (host == null) { + s_logger.debug("Failed to get VM stats from non-existing host : " + hostId); + return vmStatsById; + } + try { + vmStatsById = userVmMgr.getVirtualMachineStatistics(host.getId(), host.getName(), vmIds); + if (MapUtils.isEmpty(vmStatsById)) { + s_logger.warn("Got empty result for virtual machine statistics from host: " + host); + } + } catch (Exception e) { + s_logger.debug("Failed to get VM stats from host : " + host.getName()); + } + return vmStatsById; + } + + protected void processVmStatsByIdFromHost(AutoScaleVmGroupTO groupTO, List vmIds, Map vmStatsById, Map> policyCountersMap) { + Date timestamp = new Date(); + for (Long vmId : vmIds) { + VmStatsEntry vmStats = vmStatsById == null ? null : vmStatsById.get(vmId); + for (Map.Entry> policyCounters : policyCountersMap.entrySet()) { + Long policyId = policyCounters.getKey(); + List counters = policyCounters.getValue(); + for (CounterTO counter : counters) { + if (!Counter.NativeSources.contains(counter.getSource())) { + continue; + } + Double counterValue = null; + if (vmStats != null) { + if (Counter.Source.CPU.equals(counter.getSource())) { + counterValue = vmStats.getCPUUtilization() / 100; + } else if (Counter.Source.MEMORY.equals(counter.getSource())) { + if (vmStats.getIntFreeMemoryKBs() >= 0 && vmStats.getIntFreeMemoryKBs() <= vmStats.getMemoryKBs()) { + counterValue = (vmStats.getMemoryKBs() - vmStats.getIntFreeMemoryKBs()) / 1024; + } else { + // In some scenarios, the free memory is greater than VM memory + // see https://github.com/apache/cloudstack/issues/4566 + s_logger.warn(String.format("Getting virtual machine statistics return invalid free memory KBs for VM %d: %f", vmId, vmStats.getIntFreeMemoryKBs())); + } } } - }, destroyVmGracePeriod, TimeUnit.SECONDS); + if (counterValue == null) { + asGroupStatisticsDao.persist(new AutoScaleVmGroupStatisticsVO(groupTO.getId(), policyId, counter.getId(), vmId, ResourceTag.ResourceObjectType.UserVm, + AutoScaleValueType.INSTANT_VM, timestamp)); + } else { + asGroupStatisticsDao.persist(new AutoScaleVmGroupStatisticsVO(groupTO.getId(), policyId, counter.getId(), vmId, ResourceTag.ResourceObjectType.UserVm, + counterValue, AutoScaleValueType.INSTANT_VM, timestamp)); + } + } } - } else { - s_logger.error("Can not remove LB rule for the VM being destroyed. Do nothing more."); } } + protected void getNetworkStatsFromVirtualRouter(AutoScaleVmGroupTO groupTO) { + Network network = getNetwork(groupTO.getLoadBalancerId()); + Pair publicIpAddr = getPublicIpAndPort(groupTO.getLoadBalancerId()); + List routers = routerDao.listByNetworkAndRole(network.getId(), VirtualRouter.Role.VIRTUAL_ROUTER); + if (CollectionUtils.isEmpty(routers)) { + processGetAutoScaleMetricsAnswer(groupTO, new ArrayList<>(), null); + return; + } + List metrics = setGetAutoScaleMetricsCommandMetrics(groupTO); + for (DomainRouterVO router : routers) { + if (VirtualMachine.State.Running.equals(router.getState())) { + final GetAutoScaleMetricsCommand command = new GetAutoScaleMetricsCommand(router.getPrivateIpAddress(), network.getVpcId() != null, publicIpAddr.first(), publicIpAddr.second(), metrics); + command.setWait(30); + GetAutoScaleMetricsAnswer answer = (GetAutoScaleMetricsAnswer) agentMgr.easySend(router.getHostId(), command); + if (answer == null || !answer.getResult()) { + s_logger.error("Failed to get autoscale metrics from virtual router " + router.getName()); + processGetAutoScaleMetricsAnswer(groupTO, new ArrayList<>(), router.getId()); + } else { + processGetAutoScaleMetricsAnswer(groupTO, answer.getValues(), router.getId()); + } + } else { + processGetAutoScaleMetricsAnswer(groupTO, new ArrayList<>(), router.getId()); + } + } + } + protected List setGetAutoScaleMetricsCommandMetrics(AutoScaleVmGroupTO groupTO) { + List metrics = new ArrayList<>(); + for (AutoScalePolicyTO policyTO : groupTO.getPolicies()) { + for (ConditionTO conditionTO : policyTO.getConditions()) { + CounterTO counter = conditionTO.getCounter(); + + String provider = counter.getProvider(); + if (! Network.Provider.VirtualRouter.getName().equals(provider) && ! Network.Provider.VPCVirtualRouter.getName().equals(provider)) { + continue; + } + VirtualRouterAutoScaleCounter vrCounter = VirtualRouterAutoScaleCounter.fromValue(counter.getValue()); + if (vrCounter == null) { + continue; + } + metrics.add(new AutoScaleMetrics(vrCounter, policyTO.getId(), conditionTO.getId(), counter.getId(), policyTO.getDuration())); + } + } + return metrics; + } + + protected void processGetAutoScaleMetricsAnswer(AutoScaleVmGroupTO groupTO, List values, Long routerId) { + Date timestamp = new Date(); + Map> policyCountersMap = getPolicyCounters(groupTO); + for (Map.Entry> policyCounters : policyCountersMap.entrySet()) { + Long policyId = policyCounters.getKey(); + List counters = policyCounters.getValue(); + for (CounterTO counter : counters) { + if (!Counter.Source.VIRTUALROUTER.equals(counter.getSource())) { + continue; + } + boolean found = false; + for (AutoScaleMetricsValue value : values) { + AutoScaleMetrics metrics = value.getMetrics(); + if (policyId.equals(metrics.getPolicyId()) && counter.getId().equals(metrics.getCounterId())) { + asGroupStatisticsDao.persist(new AutoScaleVmGroupStatisticsVO(groupTO.getId(), policyId, counter.getId(), routerId, + ResourceTag.ResourceObjectType.DomainRouter, value.getValue(), value.getType(), timestamp)); + found = true; + break; + } + } + if (!found) { + asGroupStatisticsDao.persist(new AutoScaleVmGroupStatisticsVO(groupTO.getId(), policyId, counter.getId(), routerId, + ResourceTag.ResourceObjectType.DomainRouter, AutoScaleValueType.INSTANT_VM, timestamp)); + } + } + } + } + + protected boolean updateCountersMap(AutoScaleVmGroupTO groupTO, Map countersMap, Map countersNumberMap) { + s_logger.debug("Updating countersMap for as group: " + groupTO.getId()); + for (AutoScalePolicyTO policyTO : groupTO.getPolicies()) { + Date afterDate = new Date(System.currentTimeMillis() - ((long)policyTO.getDuration() << 10)); + List dummyStats = asGroupStatisticsDao.listDummyRecordsByVmGroup(groupTO.getId(), afterDate); + if (CollectionUtils.isNotEmpty(dummyStats)) { + s_logger.error(String.format("Failed to update counters map as there are %d dummy statistics in as group %d", dummyStats.size(), groupTO.getId())); + return false; + } + List inactiveStats = asGroupStatisticsDao.listInactiveByVmGroupAndPolicy(groupTO.getId(), policyTO.getId(), afterDate); + if (CollectionUtils.isNotEmpty(inactiveStats)) { + s_logger.error(String.format("Failed to update counters map as there are %d Inactive statistics in as group %d and policy %s", inactiveStats.size(), groupTO.getId(), policyTO.getId())); + continue; + } + for (ConditionTO conditionTO : policyTO.getConditions()) { + updateCountersMapPerCondition(groupTO, policyTO, conditionTO, afterDate, countersMap, countersNumberMap); + } + } + s_logger.debug("DONE Updating countersMap for as group: " + groupTO.getId()); + return true; + } + + private void updateCountersMapPerCondition(AutoScaleVmGroupTO groupTO, AutoScalePolicyTO policyTO, ConditionTO conditionTO, Date afterDate, + Map countersMap, Map countersNumberMap) { + Long conditionId = conditionTO.getId(); + CounterTO counter = conditionTO.getCounter(); + List stats = asGroupStatisticsDao.listByVmGroupAndPolicyAndCounter(groupTO.getId(), policyTO.getId(), counter.getId(), afterDate); + if (CollectionUtils.isEmpty(stats)) { + s_logger.debug(String.format("Skipping updating countersMap for group %s and policy %s and counter %s due to no stats", groupTO.getId(), policyTO.getId(), counter.getId())); + return; + } + s_logger.debug(String.format("Updating countersMap with %d stats for group %s and policy %s and counter %s", stats.size(), groupTO.getId(), policyTO.getId(), counter.getId())); + Map> aggregatedRecords = new HashMap<>(); + List incorrectRecords = new ArrayList<>(); + for (AutoScaleVmGroupStatisticsVO stat : stats) { + if (Arrays.asList(AutoScaleValueType.INSTANT_VM, AutoScaleValueType.INSTANT_VM_GROUP).contains(stat.getValueType())) { + updateCountersMapWithInstantData(countersMap, countersNumberMap, groupTO, counter.getId(), conditionId, policyTO.getId(), stat.getRawValue(), stat.getValueType()); + } else if (Arrays.asList(AutoScaleValueType.AGGREGATED_VM, AutoScaleValueType.AGGREGATED_VM_GROUP).contains(stat.getValueType())) { + String key = stat.getCounterId() + "-" + stat.getResourceId(); + if (incorrectRecords.contains(key)) { + continue; + } + if (!aggregatedRecords.containsKey(key)) { + List aggregatedRecordList = new ArrayList<>(); + aggregatedRecordList.add(stat); + aggregatedRecords.put(key, aggregatedRecordList); + continue; + } + List aggregatedRecordList = aggregatedRecords.get(key); + AutoScaleVmGroupStatisticsVO lastRecord = aggregatedRecordList.get(aggregatedRecordList.size() - 1); + if (stat.getCreated().after(lastRecord.getCreated())) { + if (stat.getRawValue() >= lastRecord.getRawValue()) { + aggregatedRecordList.add(stat); + } else { + s_logger.info("The new raw value is less than the previous raw value, which means the data is incorrect. The key is " + key); + aggregatedRecords.remove(key); + incorrectRecords.add(key); + } + } + } + } + + updateCountersMapByAggregatedRecords(countersMap, countersNumberMap, aggregatedRecords, conditionId, policyTO.getId(), groupTO.getId()); + } + + public void updateCountersMapByAggregatedRecords(Map countersMap, Map countersNumberMap, + Map> aggregatedRecords, + Long conditionId, Long policyId, Long groupId) { + if (MapUtils.isNotEmpty(aggregatedRecords)) { + s_logger.debug("Processing aggregated data"); + for (Map.Entry> aggregatedRecord : aggregatedRecords.entrySet()) { + String recordKey = aggregatedRecord.getKey(); + Long counterId = Long.valueOf(recordKey.split("-")[0]); + List records = aggregatedRecord.getValue(); + if (records.size() <= 1) { + s_logger.info(String.format("Ignoring aggregated records, conditionId = %s, counterId = %s", conditionId, counterId)); + continue; + } + AutoScaleVmGroupStatisticsVO firstRecord = records.get(0); + AutoScaleVmGroupStatisticsVO lastRecord = records.get(records.size() - 1); + Double coVal = (lastRecord.getRawValue() - firstRecord.getRawValue()) * 1000 / (lastRecord.getCreated().getTime() - firstRecord.getCreated().getTime()); + if (AutoScaleValueType.AGGREGATED_VM_GROUP.equals(firstRecord.getValueType())) { + Integer currentVM = autoScaleVmGroupVmMapDao.countAvailableVmsByGroup(groupId); + if (currentVM == 0) { + s_logger.debug(String.format("Skipping updating countersMap for group %s and policy %s and counter %s due to no VMs", groupId, policyId, counterId)); + return; + } + coVal = coVal / currentVM; + } + String key = generateKeyFromPolicyAndConditionAndCounter(policyId, conditionId, counterId); + updateCountersMapWithProcessedData(countersMap, countersNumberMap, key, coVal); + } + } + } + + private String generateKeyFromPolicyAndConditionAndCounter(Long policyId, Long conditionId, Long counterId) { + return policyId + "-" + conditionId + "-" + counterId; + } + + protected void cleanupAsVmGroupStatistics(AutoScaleVmGroupTO groupTO) { + Integer cleanupDelay = AutoScaleStatsCleanupDelay.value(); + Integer maxDelaySecs = cleanupDelay; + for (AutoScalePolicyTO policyTO : groupTO.getPolicies()) { + Integer duration = policyTO.getDuration(); + Integer delaySecs = cleanupDelay >= duration ? cleanupDelay : duration; + Date beforeDate = new Date(System.currentTimeMillis() - ((long)delaySecs * 1000)); + s_logger.debug(String.format("Removing stats for policy %d in as group %d, before %s", policyTO.getId(), groupTO.getId(), beforeDate)); + asGroupStatisticsDao.removeByGroupAndPolicy(groupTO.getId(), policyTO.getId(), beforeDate); + if (delaySecs > maxDelaySecs) { + maxDelaySecs = delaySecs; + } + } + Date beforeDate = new Date(System.currentTimeMillis() - ((long)maxDelaySecs * 1000)); + s_logger.debug(String.format("Removing stats for other policies in as group %d, before %s", groupTO.getId(), beforeDate)); + asGroupStatisticsDao.removeByGroupId(groupTO.getId(), beforeDate); + } + + protected void scheduleMonitorTasks() { + List vmGroups = autoScaleVmGroupDao.listAll(); + for (AutoScaleVmGroupVO vmGroup : vmGroups) { + if (vmGroup.getState().equals(AutoScaleVmGroup.State.ENABLED)) { + scheduleMonitorTask(vmGroup.getId()); + } + } + } + + protected void scheduleMonitorTask(Long groupId) { + ScheduledExecutorService vmGroupExecutor = vmGroupMonitorMaps.get(groupId); + if (vmGroupExecutor == null) { + AutoScaleVmGroupVO vmGroup = autoScaleVmGroupDao.findById(groupId); + s_logger.debug("Scheduling monitor task for autoscale vm group " + vmGroup); + vmGroupExecutor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("VmGroup-Monitor-" + groupId)); + vmGroupExecutor.scheduleWithFixedDelay(new MonitorTask(groupId), vmGroup.getInterval(), vmGroup.getInterval(), TimeUnit.SECONDS); + vmGroupMonitorMaps.put(groupId, vmGroupExecutor); + } + } + + protected void cancelMonitorTask(Long groupId) { + ScheduledExecutorService vmGroupExecutor = vmGroupMonitorMaps.get(groupId); + if (vmGroupExecutor != null) { + s_logger.debug("Cancelling monitor task for autoscale vm group " + groupId); + vmGroupExecutor.shutdown(); + vmGroupMonitorMaps.remove(groupId); + } + } + + protected class MonitorTask extends ManagedContextRunnable { + + Long groupId; + + public MonitorTask(Long groupId) { + this.groupId = groupId; + } + + @Override + protected synchronized void runInContext() { + try { + AutoScaleVmGroupVO asGroup = autoScaleVmGroupDao.findById(groupId); + if (asGroup == null) { + s_logger.error("Can not find the groupid " + groupId + " for monitoring"); + return; + } + s_logger.debug("Start monitoring on AutoScale VmGroup " + asGroup); + // check group state + if (asGroup.getState().equals(AutoScaleVmGroup.State.ENABLED)) { + Network.Provider provider = getLoadBalancerServiceProvider(asGroup.getLoadBalancerId()); + if (Network.Provider.Netscaler.equals(provider)) { + s_logger.debug("Skipping the monitoring on AutoScale VmGroup with Netscaler provider: " + asGroup); + } else if (Network.Provider.VirtualRouter.equals(provider) || Network.Provider.VPCVirtualRouter.equals(provider)) { + monitorVirtualRouterAsGroup(asGroup); + } + } + } catch (final Exception e) { + s_logger.warn("Caught the following exception on monitoring AutoScale Vm Group", e); + } + } + } + + @Override + public void checkIfVmActionAllowed(Long vmId) { + List asGroupVmVOs = autoScaleVmGroupVmMapDao.listByVm(vmId); + if (CollectionUtils.isNotEmpty(asGroupVmVOs)) { + for (AutoScaleVmGroupVmMapVO asGroupVmVO : asGroupVmVOs) { + AutoScaleVmGroupVO group = autoScaleVmGroupDao.findById(asGroupVmVO.getVmGroupId()); + if (group != null && !AutoScaleVmGroup.State.DISABLED.equals(group.getState())) { + throw new InvalidParameterValueException("Cannot perform actions on VM in an AutoScale VM group, Please disable the VM group and retry."); + } + } + } + } + + @Override + public void removeVmFromVmGroup(Long vmId) { + autoScaleVmGroupVmMapDao.removeByVm(vmId); + } + + protected boolean destroyVm(Long vmId) { + try { + UserVmVO vm = userVmDao.findById(vmId); + if (vm != null) { + userVmMgr.destroyVm(vmId, true); + userVmMgr.expunge(vm); + } + return true; + } catch (Exception ex) { + s_logger.error("Cannot destroy vm with id: " + vmId + "due to Exception: ", ex); + return false; + } + } + + private void markStatisticsAsInactive(Long groupId, Long policyId) { + asGroupStatisticsDao.updateStateByGroup(groupId, policyId, AutoScaleVmGroupStatisticsVO.State.INACTIVE); + } + + private void createInactiveDummyRecord(Long groupId) { + asGroupStatisticsDao.createInactiveDummyRecord(groupId); + } } diff --git a/server/src/main/java/com/cloud/network/element/VirtualRouterElement.java b/server/src/main/java/com/cloud/network/element/VirtualRouterElement.java index 0900509aad5c..839ab9ae0af2 100644 --- a/server/src/main/java/com/cloud/network/element/VirtualRouterElement.java +++ b/server/src/main/java/com/cloud/network/element/VirtualRouterElement.java @@ -122,8 +122,6 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl StaticNatServiceProvider, FirewallServiceProvider, LoadBalancingServiceProvider, PortForwardingServiceProvider, RemoteAccessVPNServiceProvider, IpDeployer, NetworkMigrationResponder, AggregatedCommandExecutor, RedundantResource, DnsServiceProvider{ private static final Logger s_logger = Logger.getLogger(VirtualRouterElement.class); - public static final AutoScaleCounterType AutoScaleCounterCpu = new AutoScaleCounterType("cpu"); - public static final AutoScaleCounterType AutoScaleCounterMemory = new AutoScaleCounterType("memory"); protected static final Map> capabilities = setCapabilities(); @Inject @@ -539,15 +537,11 @@ private static Map> setCapabilities() { // specifies that LB rules can support autoscaling and the list of // counters it supports - AutoScaleCounter counter; - final List counterList = new ArrayList(); - counter = new AutoScaleCounter(AutoScaleCounterCpu); - counterList.add(counter); - counter = new AutoScaleCounter(AutoScaleCounterMemory); - counterList.add(counter); + final List counterList = getAutoScaleCounters(); final Gson gson = new Gson(); final String autoScaleCounterList = gson.toJson(counterList); lbCapabilities.put(Capability.AutoScaleCounters, autoScaleCounterList); + lbCapabilities.put(Capability.VmAutoScaling, "true"); capabilities.put(Service.Lb, lbCapabilities); // Set capabilities for Firewall service @@ -591,6 +585,18 @@ private static Map> setCapabilities() { return capabilities; } + protected static List getAutoScaleCounters() { + AutoScaleCounter counter; + final List counterList = new ArrayList(); + counter = new AutoScaleCounter(AutoScaleCounterType.Cpu); + counterList.add(counter); + counter = new AutoScaleCounter(AutoScaleCounterType.Memory); + counterList.add(counter); + counter = new AutoScaleCounter(AutoScaleCounterType.VirtualRouter); + counterList.add(counter); + return counterList; + } + @Override public boolean applyStaticNats(final Network network, final List rules) throws ResourceUnavailableException { boolean result = true; diff --git a/server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java b/server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java index 8d3bf1f2ca65..3c51e1210b8d 100644 --- a/server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java +++ b/server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java @@ -49,6 +49,7 @@ import org.apache.cloudstack.framework.config.dao.ConfigurationDao; import org.apache.cloudstack.lb.ApplicationLoadBalancerRuleVO; import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.log4j.Logger; @@ -79,6 +80,7 @@ import com.cloud.network.Network.Service; import com.cloud.network.NetworkModel; import com.cloud.network.addr.PublicIp; +import com.cloud.network.as.AutoScaleManager; import com.cloud.network.as.AutoScalePolicy; import com.cloud.network.as.AutoScalePolicyConditionMapVO; import com.cloud.network.as.AutoScaleVmGroup; @@ -91,6 +93,7 @@ import com.cloud.network.as.dao.AutoScalePolicyDao; import com.cloud.network.as.dao.AutoScaleVmGroupDao; import com.cloud.network.as.dao.AutoScaleVmGroupPolicyMapDao; +import com.cloud.network.as.dao.AutoScaleVmGroupVmMapDao; import com.cloud.network.as.dao.AutoScaleVmProfileDao; import com.cloud.network.as.dao.ConditionDao; import com.cloud.network.as.dao.CounterDao; @@ -250,6 +253,10 @@ public class LoadBalancingRulesManagerImpl extends ManagerBase implements @Inject AutoScaleVmGroupPolicyMapDao _autoScaleVmGroupPolicyMapDao; @Inject + AutoScaleVmGroupVmMapDao autoScaleVmGroupVmMapDao; + @Inject + AutoScaleManager autoScaleManager; + @Inject ConfigurationDao _configDao; @Inject DataCenterDao _dcDao = null; @@ -293,7 +300,7 @@ public String getLBCapability(long networkid, String capabilityName) { return null; } - private LbAutoScaleVmGroup getLbAutoScaleVmGroup(AutoScaleVmGroupVO vmGroup, String currentState, LoadBalancerVO lb) { + private LbAutoScaleVmGroup getLbAutoScaleVmGroup(AutoScaleVmGroupVO vmGroup, AutoScaleVmGroup.State currentState, LoadBalancerVO lb) { long lbNetworkId = lb.getNetworkId(); String lbName = lb.getName(); List vmGroupPolicyMapList = _autoScaleVmGroupPolicyMapDao.listByVmGroupId(vmGroup.getId()); @@ -304,17 +311,12 @@ private LbAutoScaleVmGroup getLbAutoScaleVmGroup(AutoScaleVmGroupVO vmGroup, Str List lbConditions = new ArrayList(); for (AutoScalePolicyConditionMapVO autoScalePolicyConditionMap : autoScalePolicyConditionMapList) { Condition condition = _conditionDao.findById(autoScalePolicyConditionMap.getConditionId()); - Counter counter = _counterDao.findById(condition.getCounterid()); + Counter counter = _counterDao.findById(condition.getCounterId()); lbConditions.add(new LbCondition(counter, condition)); } autoScalePolicies.add(new LbAutoScalePolicy(autoScalePolicy, lbConditions)); } AutoScaleVmProfile autoScaleVmProfile = _autoScaleVmProfileDao.findById(vmGroup.getProfileId()); - Long autoscaleUserId = autoScaleVmProfile.getAutoScaleUserId(); - User user = _userDao.findByIdIncludingRemoved(autoscaleUserId); - String apiKey = user.getApiKey(); - String secretKey = user.getSecretKey(); - String csUrl = ApiServiceConfiguration.ApiServletPath.value(); String zoneId = _dcDao.findById(autoScaleVmProfile.getZoneId()).getUuid(); String domainId = _domainDao.findById(autoScaleVmProfile.getDomainId()).getUuid(); String serviceOfferingId = _offeringsDao.findById(autoScaleVmProfile.getServiceOfferingId()).getUuid(); @@ -334,16 +336,32 @@ private LbAutoScaleVmGroup getLbAutoScaleVmGroup(AutoScaleVmGroupVO vmGroup, Str } } - if (apiKey == null) { - throw new InvalidParameterValueException("apiKey for user: " + user.getUsername() + " is empty. Please generate it"); - } + String apiKey = null; + String secretKey = null; + String csUrl = ApiServiceConfiguration.ApiServletPath.value(); + Network.Provider provider = getLoadBalancerServiceProvider(lb); + if (Network.Provider.Netscaler.equals(provider)) { + Long autoscaleUserId = autoScaleVmProfile.getAutoScaleUserId(); + if (autoscaleUserId == null) { + throw new InvalidParameterValueException("autoscaleUserId is required but not specified"); + } + User user = _userDao.findById(autoscaleUserId); + if (user == null) { + throw new InvalidParameterValueException("Unable to find user by id " + autoscaleUserId); + } + apiKey = user.getApiKey(); + secretKey = user.getSecretKey(); + if (apiKey == null) { + throw new InvalidParameterValueException("apiKey for user: " + user.getUsername() + " is empty. Please generate it"); + } - if (secretKey == null) { - throw new InvalidParameterValueException("secretKey for user: " + user.getUsername() + " is empty. Please generate it"); - } + if (secretKey == null) { + throw new InvalidParameterValueException("secretKey for user: " + user.getUsername() + " is empty. Please generate it"); + } - if (csUrl == null || csUrl.contains("localhost")) { - throw new InvalidParameterValueException(String.format("Global setting %s has to be set to the Management Server's API end point", ApiServiceConfiguration.ApiServletPath.key())); + if (csUrl == null || csUrl.contains("localhost")) { + throw new InvalidParameterValueException(String.format("Global setting %s has to be set to the Management Server's API end point", ApiServiceConfiguration.ApiServletPath.key())); + } } LbAutoScaleVmProfile lbAutoScaleVmProfile = @@ -351,7 +369,60 @@ private LbAutoScaleVmGroup getLbAutoScaleVmGroup(AutoScaleVmGroupVO vmGroup, Str return new LbAutoScaleVmGroup(vmGroup, autoScalePolicies, lbAutoScaleVmProfile, currentState); } - private boolean applyAutoScaleConfig(LoadBalancerVO lb, AutoScaleVmGroupVO vmGroup, String currentState) throws ResourceUnavailableException { + @Override + public LoadBalancerTO.AutoScaleVmGroupTO toAutoScaleVmGroupTO(LbAutoScaleVmGroup lbAutoScaleVmGroup) { + List lbAutoScalePolicies = lbAutoScaleVmGroup.getPolicies(); + List autoScalePolicyTOs = new ArrayList<>(lbAutoScalePolicies.size()); + for (LbAutoScalePolicy lbAutoScalePolicy : lbAutoScalePolicies) { + List lbConditions = lbAutoScalePolicy.getConditions(); + List conditionTOs = new ArrayList<>(lbConditions.size()); + for (LbCondition lbCondition : lbConditions) { + Counter counter = lbCondition.getCounter(); + LoadBalancerTO.CounterTO counterTO = new LoadBalancerTO.CounterTO(counter.getId(), counter.getName(), counter.getSource(), "" + counter.getValue(), counter.getProvider()); + Condition condition = lbCondition.getCondition(); + LoadBalancerTO.ConditionTO conditionTO = new LoadBalancerTO.ConditionTO(condition.getId(), condition.getThreshold(), condition.getRelationalOperator(), counterTO); + conditionTOs.add(conditionTO); + } + AutoScalePolicy autoScalePolicy = lbAutoScalePolicy.getPolicy(); + autoScalePolicyTOs.add(new LoadBalancerTO.AutoScalePolicyTO(autoScalePolicy.getId(), autoScalePolicy.getDuration(), autoScalePolicy.getQuietTime(), autoScalePolicy.getLastQuietTime(), + autoScalePolicy.getAction(), conditionTOs, lbAutoScalePolicy.isRevoked())); + } + LbAutoScaleVmProfile lbAutoScaleVmProfile = lbAutoScaleVmGroup.getProfile(); + AutoScaleVmProfile autoScaleVmProfile = lbAutoScaleVmProfile.getProfile(); + + LoadBalancerTO.AutoScaleVmProfileTO autoScaleVmProfileTO = + new LoadBalancerTO.AutoScaleVmProfileTO(lbAutoScaleVmProfile.getZoneId(), lbAutoScaleVmProfile.getDomainId(), lbAutoScaleVmProfile.getCsUrl(), + lbAutoScaleVmProfile.getAutoScaleUserApiKey(), lbAutoScaleVmProfile.getAutoScaleUserSecretKey(), lbAutoScaleVmProfile.getServiceOfferingId(), + lbAutoScaleVmProfile.getTemplateId(), lbAutoScaleVmProfile.getVmName(), lbAutoScaleVmProfile.getNetworkId(), autoScaleVmProfile.getOtherDeployParams(), + autoScaleVmProfile.getCounterParams(), autoScaleVmProfile.getExpungeVmGracePeriod()); + + AutoScaleVmGroup autoScaleVmGroup = lbAutoScaleVmGroup.getVmGroup(); + return + new LoadBalancerTO.AutoScaleVmGroupTO(autoScaleVmGroup.getId(), autoScaleVmGroup.getUuid(), autoScaleVmGroup.getMinMembers(), autoScaleVmGroup.getMaxMembers(), autoScaleVmGroup.getMemberPort(), + autoScaleVmGroup.getInterval(), autoScalePolicyTOs, autoScaleVmProfileTO, autoScaleVmGroup.getState(), lbAutoScaleVmGroup.getCurrentState(), autoScaleVmGroup.getLoadBalancerId()); + } + + @Override + public LoadBalancerTO.AutoScaleVmGroupTO toAutoScaleVmGroupTO(AutoScaleVmGroupVO vmGroup) { + final LoadBalancerVO loadBalancer = _lbDao.findById(vmGroup.getLoadBalancerId()); + if (loadBalancer == null) { + throw new CloudRuntimeException("Unable to find load balancer with id: " + vmGroup.getLoadBalancerId()); + } + LbAutoScaleVmGroup lbAutoScaleVmGroup = getLbAutoScaleVmGroup(vmGroup, vmGroup.getState(), loadBalancer); + return toAutoScaleVmGroupTO(lbAutoScaleVmGroup); + } + + @Override + public Network.Provider getLoadBalancerServiceProvider(LoadBalancerVO loadBalancer) { + Network network = _networkDao.findById(loadBalancer.getNetworkId()); + List providers = _networkMgr.getProvidersForServiceInNetwork(network, Network.Service.Lb); + if (CollectionUtils.isEmpty(providers)) { + throw new CloudRuntimeException(String.format("Unable to find LB provider for network with id: %s ", network.getId())); + } + return providers.get(0); + } + + private boolean applyAutoScaleConfig(LoadBalancerVO lb, AutoScaleVmGroupVO vmGroup, AutoScaleVmGroup.State currentState) throws ResourceUnavailableException { LbAutoScaleVmGroup lbAutoScaleVmGroup = getLbAutoScaleVmGroup(vmGroup, currentState, lb); /* * Regular config like destinations need not be packed for applying @@ -370,7 +441,7 @@ private boolean applyAutoScaleConfig(LoadBalancerVO lb, AutoScaleVmGroupVO vmGro List rules = Arrays.asList(rule); - if (!applyLbRules(rules, false)) { + if (!applyLbRules(new ArrayList<>(rules), false)) { s_logger.debug("LB rules' autoscale config are not completely applied"); return false; } @@ -391,7 +462,7 @@ private Ip getSourceIp(LoadBalancer lb) { @Override @DB - public boolean configureLbAutoScaleVmGroup(final long vmGroupid, String currentState) throws ResourceUnavailableException { + public boolean configureLbAutoScaleVmGroup(final long vmGroupid, AutoScaleVmGroup.State currentState) throws ResourceUnavailableException { final AutoScaleVmGroupVO vmGroup = _autoScaleVmGroupDao.findById(vmGroupid); boolean success = false; @@ -399,10 +470,8 @@ public boolean configureLbAutoScaleVmGroup(final long vmGroupid, String currentS FirewallRule.State backupState = loadBalancer.getState(); - if (vmGroup.getState().equals(AutoScaleVmGroup.State_New)) { - loadBalancer.setState(FirewallRule.State.Add); - _lbDao.persist(loadBalancer); - } else if (loadBalancer.getState() == FirewallRule.State.Active && vmGroup.getState().equals(AutoScaleVmGroup.State_Revoke)) { + if (vmGroup.getState().equals(AutoScaleVmGroup.State.NEW) + || (loadBalancer.getState() == FirewallRule.State.Active && vmGroup.getState().equals(AutoScaleVmGroup.State.REVOKE))) { loadBalancer.setState(FirewallRule.State.Add); _lbDao.persist(loadBalancer); } @@ -424,14 +493,14 @@ public boolean configureLbAutoScaleVmGroup(final long vmGroupid, String currentS } if (success) { - if (vmGroup.getState().equals(AutoScaleVmGroup.State_New)) { + if (vmGroup.getState().equals(AutoScaleVmGroup.State.NEW)) { Transaction.execute(new TransactionCallbackNoReturn() { @Override public void doInTransactionWithoutResult(TransactionStatus status) { loadBalancer.setState(FirewallRule.State.Active); s_logger.debug("LB rule " + loadBalancer.getId() + " state is set to Active"); _lbDao.persist(loadBalancer); - vmGroup.setState(AutoScaleVmGroup.State_Enabled); + vmGroup.setState(AutoScaleVmGroup.State.ENABLED); _autoScaleVmGroupDao.persist(vmGroup); s_logger.debug("LB Auto Scale Vm Group with Id: " + vmGroupid + " is set to Enabled state."); } @@ -937,7 +1006,7 @@ private boolean isRollBackAllowedForProvider(LoadBalancerVO loadBalancer) { return false; } if (provider.get(0) == Provider.Netscaler || provider.get(0) == Provider.F5BigIp || - provider.get(0) == Provider.VirtualRouter) { + provider.get(0) == Provider.VirtualRouter || provider.get(0) == Provider.VPCVirtualRouter) { return true; } return false; @@ -946,7 +1015,7 @@ private boolean isRollBackAllowedForProvider(LoadBalancerVO loadBalancer) { @Override @DB @ActionEvent(eventType = EventTypes.EVENT_ASSIGN_TO_LOAD_BALANCER_RULE, eventDescription = "assigning to load balancer", async = true) - public boolean assignToLoadBalancer(long loadBalancerId, List instanceIds, Map> vmIdIpMap) { + public boolean assignToLoadBalancer(long loadBalancerId, List instanceIds, Map> vmIdIpMap, boolean isAutoScaleVM) { CallContext ctx = CallContext.current(); Account caller = ctx.getCallingAccount(); @@ -955,6 +1024,9 @@ public boolean assignToLoadBalancer(long loadBalancerId, List instanceIds, throw new InvalidParameterValueException("Failed to assign to load balancer " + loadBalancerId + ", the load balancer was not found."); } + if (!isAutoScaleVM && _autoScaleVmGroupDao.isAutoScaleLoadBalancer(loadBalancerId)) { + throw new InvalidParameterValueException("Failed to assign to load balancer " + loadBalancerId + " because it is being used by an Autoscale VM group."); + } if (instanceIds == null && vmIdIpMap.isEmpty()) { throw new InvalidParameterValueException("Both instanceids and vmidipmap can't be null"); @@ -1111,10 +1183,13 @@ public void doInTransactionWithoutResult(TransactionStatus status) { }); if (_autoScaleVmGroupDao.isAutoScaleLoadBalancer(loadBalancerId)) { - // For autoscaled loadbalancer, the rules need not be applied, - // meaning the call need not reach the resource layer. - // We can consider the job done. - return true; + Network.Provider provider = getLoadBalancerServiceProvider(loadBalancer); + if (Network.Provider.Netscaler.equals(provider)) { + // For netscaler autoscale loadbalancer, the rules need not be applied, + // meaning the call need not reach the resource layer. + // We can consider the job done. + return true; + } } boolean success = false; FirewallRule.State backupState = loadBalancer.getState(); @@ -1166,8 +1241,8 @@ public boolean assignSSLCertToLoadBalancerRule(Long lbId, String certName, Strin @Override @ActionEvent(eventType = EventTypes.EVENT_REMOVE_FROM_LOAD_BALANCER_RULE, eventDescription = "removing from load balancer", async = true) - public boolean removeFromLoadBalancer(long loadBalancerId, List instanceIds, Map> vmIdIpsMap) { - return removeFromLoadBalancerInternal(loadBalancerId, instanceIds, true, vmIdIpsMap); + public boolean removeFromLoadBalancer(long loadBalancerId, List instanceIds, Map> vmIdIpsMap, boolean isAutoScaleVM) { + return removeFromLoadBalancerInternal(loadBalancerId, instanceIds, true, vmIdIpsMap, isAutoScaleVM); } @Override @@ -1301,7 +1376,7 @@ public boolean removeCertFromLoadBalancer(long lbRuleId) { return success; } - private boolean removeFromLoadBalancerInternal(long loadBalancerId, List instanceIds, boolean rollBack, Map> vmIdIpMap) { + private boolean removeFromLoadBalancerInternal(long loadBalancerId, List instanceIds, boolean rollBack, Map> vmIdIpMap, boolean isAutoScaleVM) { CallContext caller = CallContext.current(); LoadBalancerVO loadBalancer = _lbDao.findById(Long.valueOf(loadBalancerId)); @@ -1337,6 +1412,13 @@ private boolean removeFromLoadBalancerInternal(long loadBalancerId, List i boolean success = false; FirewallRule.State backupState = loadBalancer.getState(); Set vmIds = vmIdIpMap.keySet(); + + if (!isAutoScaleVM) { + for (long instanceId : vmIds) { + autoScaleManager.checkIfVmActionAllowed(instanceId); + } + } + try { loadBalancer.setState(FirewallRule.State.Add); _lbDao.persist(loadBalancer); @@ -1372,21 +1454,21 @@ private boolean removeFromLoadBalancerInternal(long loadBalancerId, List i } } - if (_autoScaleVmGroupDao.isAutoScaleLoadBalancer(loadBalancerId)) { - // For autoscaled loadbalancer, the rules need not be applied, - // meaning the call need not reach the resource layer. - // We can consider the job done and only need to remove the - // rules in DB - _lb2VmMapDao.remove(loadBalancer.getId(), instanceIds, null); - return true; - } - if (!applyLoadBalancerConfig(loadBalancerId)) { s_logger.warn("Failed to remove load balancer rule id " + loadBalancerId + " for vms " + instanceIds); CloudRuntimeException ex = new CloudRuntimeException("Failed to remove specified load balancer rule id for vms " + instanceIds); ex.addProxyObject(loadBalancer.getUuid(), "loadBalancerId"); throw ex; } + + if (_autoScaleVmGroupDao.isAutoScaleLoadBalancer(loadBalancerId)) { + List vmIdsList = new ArrayList<>(vmIdIpMap.keySet()); + _lb2VmMapDao.remove(loadBalancer.getId(), vmIdsList, null); + for (Long instanceId: vmIdsList){ + autoScaleVmGroupVmMapDao.removeByVm(instanceId); + } + } + success = true; } catch (ResourceUnavailableException e) { if (rollBack && isRollBackAllowedForProvider(loadBalancer)) { @@ -1452,7 +1534,7 @@ public boolean removeVmFromLoadBalancers(long instanceId) { // Reapply all lbs that had the vm assigned if (lbsToReconfigure != null) { for (Map.Entry> lb : lbsToReconfigure.entrySet()) { - if (!removeFromLoadBalancerInternal(lb.getKey(), lb.getValue(), false, new HashMap>())) { + if (!removeFromLoadBalancerInternal(lb.getKey(), lb.getValue(), false, new HashMap<>(), false)) { success = false; } } @@ -1482,6 +1564,11 @@ public boolean deleteLoadBalancerRule(long loadBalancerId, boolean apply) { @DB public boolean deleteLoadBalancerRule(final long loadBalancerId, boolean apply, Account caller, long callerUserId, boolean rollBack) { + List vmGroups = _autoScaleVmGroupDao.listByLoadBalancer(loadBalancerId); + if (CollectionUtils.isNotEmpty(vmGroups)) { + throw new CloudRuntimeException(String.format("Cannot delete load balancer rule %d because it is being used by %s Autoscale VM group.", loadBalancerId, vmGroups.size())); + } + final LoadBalancerVO lb = _lbDao.findById(loadBalancerId); FirewallRule.State backupState = lb.getState(); diff --git a/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java b/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java index b50e345c6372..96d0f2ac3c38 100644 --- a/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java +++ b/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java @@ -1043,6 +1043,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) { Network.GuestType.Isolated, true, false, false, false, true, false); defaultIsolatedSourceNatEnabledNetworkOffering.setState(NetworkOffering.State.Enabled); + defaultIsolatedSourceNatEnabledNetworkOffering.setSupportsVmAutoScaling(true); defaultIsolatedSourceNatEnabledNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(defaultIsolatedSourceNatEnabledNetworkOffering); for (Service service : defaultIsolatedSourceNatEnabledNetworkOfferingProviders.keySet()) { @@ -1075,6 +1076,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) { Availability.Optional, null, Network.GuestType.Shared, true, false, false, false, true, true, true, false, false, true, true, false, false, false, false, false); defaultNetscalerNetworkOffering.setState(NetworkOffering.State.Enabled); + defaultNetscalerNetworkOffering.setSupportsVmAutoScaling(true); defaultNetscalerNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(defaultNetscalerNetworkOffering); for (Service service : netscalerServiceProviders.keySet()) { @@ -1091,6 +1093,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) { null, Network.GuestType.Isolated, false, false, false, false, true, true); defaultNetworkOfferingForVpcNetworks.setState(NetworkOffering.State.Enabled); + defaultNetworkOfferingForVpcNetworks.setSupportsVmAutoScaling(true); defaultNetworkOfferingForVpcNetworks = _networkOfferingDao.persistDefaultNetworkOffering(defaultNetworkOfferingForVpcNetworks); Map defaultVpcNetworkOfferingProviders = new HashMap(); diff --git a/server/src/main/java/com/cloud/server/ManagementServerImpl.java b/server/src/main/java/com/cloud/server/ManagementServerImpl.java index 5c5fdd34e4a4..1e02b3675600 100644 --- a/server/src/main/java/com/cloud/server/ManagementServerImpl.java +++ b/server/src/main/java/com/cloud/server/ManagementServerImpl.java @@ -373,6 +373,7 @@ import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScalePolicyCmd; import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScaleVmGroupCmd; import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScaleVmProfileCmd; +import org.apache.cloudstack.api.command.user.autoscale.UpdateConditionCmd; import org.apache.cloudstack.api.command.user.config.ListCapabilitiesCmd; import org.apache.cloudstack.api.command.user.consoleproxy.CreateConsoleEndpointCmd; import org.apache.cloudstack.api.command.user.event.ArchiveEventsCmd; @@ -3351,6 +3352,7 @@ public List> getCommands() { cmdList.add(UpdateAutoScalePolicyCmd.class); cmdList.add(UpdateAutoScaleVmGroupCmd.class); cmdList.add(UpdateAutoScaleVmProfileCmd.class); + cmdList.add(UpdateConditionCmd.class); cmdList.add(ListCapabilitiesCmd.class); cmdList.add(ListEventsCmd.class); cmdList.add(ListEventTypesCmd.class); diff --git a/server/src/main/java/com/cloud/server/StatsCollector.java b/server/src/main/java/com/cloud/server/StatsCollector.java index 4a353a1aa1c8..fa9584a9adb9 100644 --- a/server/src/main/java/com/cloud/server/StatsCollector.java +++ b/server/src/main/java/com/cloud/server/StatsCollector.java @@ -79,7 +79,6 @@ import com.cloud.agent.api.Answer; import com.cloud.agent.api.GetStorageStatsCommand; import com.cloud.agent.api.HostStatsEntry; -import com.cloud.agent.api.PerformanceMonitorCommand; import com.cloud.agent.api.VgpuTypesInfo; import com.cloud.agent.api.VmDiskStatsEntry; import com.cloud.agent.api.VmNetworkStatsEntry; @@ -108,30 +107,10 @@ import com.cloud.host.dao.HostDao; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.network.as.AutoScaleManager; -import com.cloud.network.as.AutoScalePolicyConditionMapVO; -import com.cloud.network.as.AutoScalePolicyVO; -import com.cloud.network.as.AutoScaleVmGroupPolicyMapVO; -import com.cloud.network.as.AutoScaleVmGroupVO; -import com.cloud.network.as.AutoScaleVmGroupVmMapVO; -import com.cloud.network.as.AutoScaleVmProfileVO; -import com.cloud.network.as.Condition.Operator; -import com.cloud.network.as.ConditionVO; -import com.cloud.network.as.Counter; -import com.cloud.network.as.CounterVO; -import com.cloud.network.as.dao.AutoScalePolicyConditionMapDao; -import com.cloud.network.as.dao.AutoScalePolicyDao; -import com.cloud.network.as.dao.AutoScaleVmGroupDao; -import com.cloud.network.as.dao.AutoScaleVmGroupPolicyMapDao; -import com.cloud.network.as.dao.AutoScaleVmGroupVmMapDao; -import com.cloud.network.as.dao.AutoScaleVmProfileDao; -import com.cloud.network.as.dao.ConditionDao; -import com.cloud.network.as.dao.CounterDao; import com.cloud.org.Cluster; import com.cloud.resource.ResourceManager; import com.cloud.resource.ResourceState; import com.cloud.serializer.GsonHelper; -import com.cloud.service.ServiceOfferingVO; -import com.cloud.service.dao.ServiceOfferingDao; import com.cloud.storage.ImageStoreDetailsUtil; import com.cloud.storage.ScopeType; import com.cloud.storage.Storage; @@ -147,7 +126,6 @@ import com.cloud.user.dao.VmDiskStatisticsDao; import com.cloud.utils.LogUtils; import com.cloud.utils.NumbersUtil; -import com.cloud.utils.Pair; import com.cloud.utils.component.ComponentMethodInterceptable; import com.cloud.utils.component.ManagerBase; import com.cloud.utils.concurrency.NamedThreadFactory; @@ -338,28 +316,10 @@ public String toString() { @Inject private VlanDao _vlanDao; @Inject - private AutoScaleVmGroupDao _asGroupDao; - @Inject - private AutoScaleVmGroupVmMapDao _asGroupVmDao; - @Inject private AutoScaleManager _asManager; @Inject private VMInstanceDao _vmInstance; @Inject - private AutoScaleVmGroupPolicyMapDao _asGroupPolicyDao; - @Inject - private AutoScalePolicyDao _asPolicyDao; - @Inject - private AutoScalePolicyConditionMapDao _asConditionMapDao; - @Inject - private ConditionDao _asConditionDao; - @Inject - private CounterDao _asCounterDao; - @Inject - private AutoScaleVmProfileDao _asProfileDao; - @Inject - private ServiceOfferingDao _serviceOfferingDao; - @Inject private HostGpuGroupsDao _hostGpuGroupsDao; @Inject private ImageStoreDetailsUtil imageStoreDetailsUtil; @@ -452,7 +412,7 @@ protected void init(Map configs) { vmStatsInterval = NumbersUtil.parseLong(configs.get("vm.stats.interval"), ONE_MINUTE_IN_MILLISCONDS); storageStatsInterval = NumbersUtil.parseLong(configs.get("storage.stats.interval"), ONE_MINUTE_IN_MILLISCONDS); volumeStatsInterval = NumbersUtil.parseLong(configs.get("volume.stats.interval"), ONE_MINUTE_IN_MILLISCONDS); - autoScaleStatsInterval = NumbersUtil.parseLong(configs.get("autoscale.stats.interval"), ONE_MINUTE_IN_MILLISCONDS); + autoScaleStatsInterval = AutoScaleManager.AutoScaleStatsInterval.value(); ManagementServerStatusAdministrator managementServerStatusAdministrator = new ManagementServerStatusAdministrator(); clusterManager.registerStatusAdministrator(managementServerStatusAdministrator); clusterManager.registerListener(managementServerStatusAdministrator); @@ -515,7 +475,7 @@ protected void init(Map configs) { } if (autoScaleStatsInterval > 0) { - _executor.scheduleWithFixedDelay(new AutoScaleMonitor(), DEFAULT_INITIAL_DELAY, autoScaleStatsInterval, TimeUnit.MILLISECONDS); + _executor.scheduleWithFixedDelay(new AutoScaleMonitor(), DEFAULT_INITIAL_DELAY, autoScaleStatsInterval * 1000L, TimeUnit.MILLISECONDS); } if (vmDiskStatsInterval.value() > 0) { @@ -1768,275 +1728,21 @@ protected void runInContext() { if (LOGGER.isDebugEnabled()) { LOGGER.debug("AutoScaling Monitor is running..."); } - // list all AS VMGroups - List asGroups = _asGroupDao.listAll(); - for (AutoScaleVmGroupVO asGroup : asGroups) { - // check group state - if ((asGroup.getState().equals("enabled")) && (is_native(asGroup.getId()))) { - // check minimum vm of group - Integer currentVM = _asGroupVmDao.countByGroup(asGroup.getId()); - if (currentVM < asGroup.getMinMembers()) { - _asManager.doScaleUp(asGroup.getId(), asGroup.getMinMembers() - currentVM); - continue; - } - - //check interval - long now = (new Date()).getTime(); - if (asGroup.getLastInterval() != null) - if ((now - asGroup.getLastInterval().getTime()) < asGroup.getInterval()) { - continue; - } - - // update last_interval - asGroup.setLastInterval(new Date()); - _asGroupDao.persist(asGroup); - - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("[AutoScale] Collecting RRDs data..."); - } - Map params = new HashMap(); - List asGroupVmVOs = _asGroupVmDao.listByGroup(asGroup.getId()); - params.put("total_vm", String.valueOf(asGroupVmVOs.size())); - for (int i = 0; i < asGroupVmVOs.size(); i++) { - long vmId = asGroupVmVOs.get(i).getInstanceId(); - VMInstanceVO vmVO = _vmInstance.findById(vmId); - //xe vm-list | grep vmname -B 1 | head -n 1 | awk -F':' '{print $2}' - params.put("vmname" + String.valueOf(i + 1), vmVO.getInstanceName()); - params.put("vmid" + String.valueOf(i + 1), String.valueOf(vmVO.getId())); - - } - // get random hostid because all vms are in a cluster - long vmId = asGroupVmVOs.get(0).getInstanceId(); - VMInstanceVO vmVO = _vmInstance.findById(vmId); - Long receiveHost = vmVO.getHostId(); - - // setup parameters phase: duration and counter - // list pair [counter, duration] - List> lstPair = getPairofCounternameAndDuration(asGroup.getId()); - int total_counter = 0; - String[] lstCounter = new String[lstPair.size()]; - for (int i = 0; i < lstPair.size(); i++) { - Pair pair = lstPair.get(i); - String strCounterNames = pair.first(); - Integer duration = pair.second(); - - lstCounter[i] = strCounterNames.split(",")[0]; - total_counter++; - params.put("duration" + String.valueOf(total_counter), duration.toString()); - params.put("counter" + String.valueOf(total_counter), lstCounter[i]); - params.put("con" + String.valueOf(total_counter), strCounterNames.split(",")[1]); - } - params.put("total_counter", String.valueOf(total_counter)); - - PerformanceMonitorCommand perfMon = new PerformanceMonitorCommand(params, 20); - - try { - Answer answer = _agentMgr.send(receiveHost, perfMon); - if (answer == null || !answer.getResult()) { - LOGGER.debug("Failed to send data to node !"); - } else { - String result = answer.getDetails(); - LOGGER.debug("[AutoScale] RRDs collection answer: " + result); - HashMap avgCounter = new HashMap(); - - // extract data - String[] counterElements = result.split(","); - if ((counterElements != null) && (counterElements.length > 0)) { - for (String string : counterElements) { - try { - String[] counterVals = string.split(":"); - String[] counter_vm = counterVals[0].split("\\."); - - Long counterId = Long.parseLong(counter_vm[1]); - Long conditionId = Long.parseLong(params.get("con" + counter_vm[1])); - Double coVal = Double.parseDouble(counterVals[1]); - - // Summary of all counter by counterId key - if (avgCounter.get(counterId) == null) { - /* initialize if data is not set */ - avgCounter.put(counterId, new Double(0)); - } - - String counterName = getCounternamebyCondition(conditionId.longValue()); - if (Counter.Source.memory.toString().equals(counterName)) { - // calculate memory in percent - Long profileId = asGroup.getProfileId(); - AutoScaleVmProfileVO profileVo = _asProfileDao.findById(profileId); - ServiceOfferingVO serviceOff = _serviceOfferingDao.findById(profileVo.getServiceOfferingId()); - int maxRAM = serviceOff.getRamSize(); - - // get current RAM percent - coVal = coVal / maxRAM; - } else { - // cpu - coVal = coVal * 100; - } - - // update data entry - avgCounter.put(counterId, avgCounter.get(counterId) + coVal); - - } catch (Exception e) { - e.printStackTrace(); - } - } - - String scaleAction = getAutoscaleAction(avgCounter, asGroup.getId(), currentVM, params); - if (scaleAction != null) { - LOGGER.debug("[AutoScale] Doing scale action: " + scaleAction + " for group " + asGroup.getId()); - if (scaleAction.equals("scaleup")) { - _asManager.doScaleUp(asGroup.getId(), 1); - } else { - _asManager.doScaleDown(asGroup.getId()); - } - } - } - } - - } catch (Exception e) { - e.printStackTrace(); - } - - } + //msHost in UP state with min id should run the job + ManagementServerHostVO msHost = managementServerHostDao.findOneInUpState(new Filter(ManagementServerHostVO.class, "id", true, 0L, 1L)); + if (msHost == null || (msHost.getMsid() != mgmtSrvrId)) { + LOGGER.debug("Skipping AutoScaling Monitor"); + return; } + _asManager.checkAllAutoScaleVmGroups(); + } catch (Throwable t) { LOGGER.error("Error trying to monitor autoscaling", t); } } - private boolean is_native(long groupId) { - List vos = _asGroupPolicyDao.listByVmGroupId(groupId); - for (AutoScaleVmGroupPolicyMapVO vo : vos) { - List ConditionPolicies = _asConditionMapDao.findByPolicyId(vo.getPolicyId()); - for (AutoScalePolicyConditionMapVO ConditionPolicy : ConditionPolicies) { - ConditionVO condition = _asConditionDao.findById(ConditionPolicy.getConditionId()); - CounterVO counter = _asCounterDao.findById(condition.getCounterid()); - if (counter.getSource() == Counter.Source.cpu || counter.getSource() == Counter.Source.memory) - return true; - } - } - return false; - } - - private String getAutoscaleAction(HashMap avgCounter, long groupId, long currentVM, Map params) { - - List listMap = _asGroupPolicyDao.listByVmGroupId(groupId); - if ((listMap == null) || (listMap.size() == 0)) - return null; - for (AutoScaleVmGroupPolicyMapVO asVmgPmap : listMap) { - AutoScalePolicyVO policyVO = _asPolicyDao.findById(asVmgPmap.getPolicyId()); - if (policyVO != null) { - int quitetime = policyVO.getQuietTime(); - Date quitetimeDate = policyVO.getLastQuiteTime(); - long last_quitetime = 0L; - if (quitetimeDate != null) { - last_quitetime = policyVO.getLastQuiteTime().getTime(); - } - long current_time = (new Date()).getTime(); - - // check quite time for this policy - if ((current_time - last_quitetime) >= (long)quitetime) { - - // list all condition of this policy - boolean bValid = true; - List lstConditions = getConditionsbyPolicyId(policyVO.getId()); - if ((lstConditions != null) && (lstConditions.size() > 0)) { - // check whole conditions of this policy - for (ConditionVO conditionVO : lstConditions) { - long thresholdValue = conditionVO.getThreshold(); - Double thresholdPercent = (double)thresholdValue / 100; - CounterVO counterVO = _asCounterDao.findById(conditionVO.getCounterid()); - long counter_count = 1; - do { - String counter_param = params.get("counter" + String.valueOf(counter_count)); - Counter.Source counter_source = counterVO.getSource(); - if (counter_param.equals(counter_source.toString())) - break; - counter_count++; - } while (true); - - Double sum = avgCounter.get(counter_count); - Double avg = sum / currentVM; - Operator op = conditionVO.getRelationalOperator(); - boolean bConditionCheck = ((op == com.cloud.network.as.Condition.Operator.EQ) && (thresholdPercent.equals(avg))) - || ((op == com.cloud.network.as.Condition.Operator.GE) && (avg.doubleValue() >= thresholdPercent.doubleValue())) - || ((op == com.cloud.network.as.Condition.Operator.GT) && (avg.doubleValue() > thresholdPercent.doubleValue())) - || ((op == com.cloud.network.as.Condition.Operator.LE) && (avg.doubleValue() <= thresholdPercent.doubleValue())) - || ((op == com.cloud.network.as.Condition.Operator.LT) && (avg.doubleValue() < thresholdPercent.doubleValue())); - - if (!bConditionCheck) { - bValid = false; - break; - } - } - if (bValid) { - return policyVO.getAction(); - } - } - } - } - } - return null; - } - - private List getConditionsbyPolicyId(long policyId) { - List conditionMap = _asConditionMapDao.findByPolicyId(policyId); - if ((conditionMap == null) || (conditionMap.size() == 0)) - return null; - - List lstResult = new ArrayList(); - for (AutoScalePolicyConditionMapVO asPCmap : conditionMap) { - lstResult.add(_asConditionDao.findById(asPCmap.getConditionId())); - } - - return lstResult; - } - - public List> getPairofCounternameAndDuration(long groupId) { - AutoScaleVmGroupVO groupVo = _asGroupDao.findById(groupId); - if (groupVo == null) - return null; - List> result = new ArrayList>(); - //list policy map - List groupPolicymap = _asGroupPolicyDao.listByVmGroupId(groupVo.getId()); - if (groupPolicymap == null) - return null; - for (AutoScaleVmGroupPolicyMapVO gpMap : groupPolicymap) { - //get duration - AutoScalePolicyVO policyVo = _asPolicyDao.findById(gpMap.getPolicyId()); - Integer duration = policyVo.getDuration(); - //get collection of counter name - - StringBuffer buff = new StringBuffer(); - List lstPCmap = _asConditionMapDao.findByPolicyId(policyVo.getId()); - for (AutoScalePolicyConditionMapVO pcMap : lstPCmap) { - String counterName = getCounternamebyCondition(pcMap.getConditionId()); - buff.append(counterName); - buff.append(","); - buff.append(pcMap.getConditionId()); - } - // add to result - Pair pair = new Pair(buff.toString(), duration); - result.add(pair); - } - - return result; - } - - public String getCounternamebyCondition(long conditionId) { - - ConditionVO condition = _asConditionDao.findById(conditionId); - if (condition == null) - return ""; - - long counterId = condition.getCounterid(); - CounterVO counter = _asCounterDao.findById(counterId); - if (counter == null) - return ""; - - return counter.getSource().toString(); - } } /** diff --git a/server/src/main/java/com/cloud/user/AccountManagerImpl.java b/server/src/main/java/com/cloud/user/AccountManagerImpl.java index cdc98d28385a..44205bbfa229 100644 --- a/server/src/main/java/com/cloud/user/AccountManagerImpl.java +++ b/server/src/main/java/com/cloud/user/AccountManagerImpl.java @@ -774,6 +774,12 @@ protected boolean cleanupAccount(AccountVO account, long callerUserId, Account c } } + // delete autoscaling VM groups + if (!_autoscaleMgr.deleteAutoScaleVmGroupsByAccount(accountId)) { + accountCleanupNeeded = true; + } + + // delete global load balancer rules for the account. List gslbRules = _gslbRuleDao.listByAccount(accountId); if (gslbRules != null && !gslbRules.isEmpty()) { @@ -849,7 +855,7 @@ protected boolean cleanupAccount(AccountVO account, long callerUserId, Account c } // no need to catch exception at this place as expunging vm // should pass in order to perform further cleanup - if (!_vmMgr.expunge(vm, callerUserId, caller)) { + if (!_vmMgr.expunge(vm)) { s_logger.error("Unable to expunge vm: " + vm.getId()); accountCleanupNeeded = true; } diff --git a/server/src/main/java/com/cloud/vm/UserVmManager.java b/server/src/main/java/com/cloud/vm/UserVmManager.java index 37338b9755f5..680c18eee327 100644 --- a/server/src/main/java/com/cloud/vm/UserVmManager.java +++ b/server/src/main/java/com/cloud/vm/UserVmManager.java @@ -37,7 +37,6 @@ import com.cloud.exception.VirtualMachineMigrationException; import com.cloud.service.ServiceOfferingVO; import com.cloud.storage.Storage.StoragePoolType; -import com.cloud.user.Account; import com.cloud.uservm.UserVm; import com.cloud.utils.Pair; @@ -102,7 +101,7 @@ public interface UserVmManager extends UserVmService { boolean isVMUsingLocalStorage(VMInstanceVO vm); - boolean expunge(UserVmVO vm, long callerUserId, Account caller); + boolean expunge(UserVmVO vm); Pair> startVirtualMachine(long vmId, Long hostId, Map additionalParams, String deploymentPlannerToUse) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException; diff --git a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java index f9bf52ea32b3..72a439a4d95e 100644 --- a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java @@ -244,6 +244,7 @@ import com.cloud.network.NetworkModel; import com.cloud.network.Networks.TrafficType; import com.cloud.network.PhysicalNetwork; +import com.cloud.network.as.AutoScaleManager; import com.cloud.network.dao.FirewallRulesDao; import com.cloud.network.dao.IPAddressDao; import com.cloud.network.dao.IPAddressVO; @@ -578,6 +579,9 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir @Inject protected SnapshotHelper snapshotHelper; + @Inject + private AutoScaleManager autoScaleManager; + private ScheduledExecutorService _executor = null; private ScheduledExecutorService _vmIpFetchExecutor = null; private int _expungeInterval; @@ -2444,7 +2448,7 @@ public String getRandomPrivateTemplateName() { } @Override - public boolean expunge(UserVmVO vm, long callerUserId, Account caller) { + public boolean expunge(UserVmVO vm) { vm = _vmDao.acquireInLockTable(vm.getId()); if (vm == null) { return false; @@ -2463,6 +2467,8 @@ public boolean expunge(UserVmVO vm, long callerUserId, Account caller) { } } + autoScaleManager.removeVmFromVmGroup(vm.getId()); + releaseNetworkResourcesOnExpunge(vm.getId()); List rootVol = _volsDao.findByInstanceAndType(vm.getId(), Volume.Type.ROOT); @@ -3284,6 +3290,9 @@ public UserVm destroyVm(DestroyVMCmd cmd) throws ResourceUnavailableException, C return vm; } + // check if vm belongs to AutoScale vm group in Disabled state + autoScaleManager.checkIfVmActionAllowed(vmId); + // check if there are active volume snapshots tasks s_logger.debug("Checking if there are any ongoing snapshots on the ROOT volumes associated with VM with ID " + vmId); if (checkStatusOfVolumeSnapshots(vmId, Volume.Type.ROOT)) { @@ -3306,12 +3315,12 @@ public UserVm destroyVm(DestroyVMCmd cmd) throws ResourceUnavailableException, C detachVolumesFromVm(dataVols); UserVm destroyedVm = destroyVm(vmId, expunge); - if (expunge) { - if (!expunge(vm, ctx.getCallingUserId(), ctx.getCallingAccount())) { - throw new CloudRuntimeException("Failed to expunge vm " + destroyedVm); - } + if (expunge && !expunge(vm)) { + throw new CloudRuntimeException("Failed to expunge vm " + destroyedVm); } + autoScaleManager.removeVmFromVmGroup(vmId); + deleteVolumesFromVm(volumesToBeDeleted, expunge); return destroyedVm; @@ -4636,7 +4645,7 @@ public void validateRootDiskResize(final HypervisorType hypervisorType, Long roo // rootdisksize must be larger than template. boolean isIso = ImageFormat.ISO == templateVO.getFormat(); if ((rootDiskSize << 30) < templateVO.getSize()) { - String error = "Unsupported: rootdisksize override is smaller than template size " + toHumanReadableSize(templateVO.getSize()); + String error = String.format("Unsupported: rootdisksize override (%s GB) is smaller than template size %s", rootDiskSize, toHumanReadableSize(templateVO.getSize())); s_logger.error(error); throw new InvalidParameterValueException(error); } else if ((rootDiskSize << 30) > templateVO.getSize()) { @@ -5211,7 +5220,9 @@ public UserVm stopVirtualMachine(long vmId, boolean forced) throws ConcurrentOpe throw new InvalidParameterValueException("unable to find a virtual machine with id " + vmId); } - _userDao.findById(userId); + // check if vm belongs to AutoScale vm group in Disabled state + autoScaleManager.checkIfVmActionAllowed(vmId); + boolean status = false; try { VirtualMachineEntity vmEntity = _orchSrvc.getVirtualMachine(vm.getUuid()); @@ -5508,10 +5519,6 @@ private Host getDestinationHost(Long hostId, boolean isRootAdmin, boolean isExpl @Override public UserVm destroyVm(long vmId, boolean expunge) throws ResourceUnavailableException, ConcurrentOperationException { - // Account caller = CallContext.current().getCallingAccount(); - // Long userId = CallContext.current().getCallingUserId(); - Long userId = 2L; - // Verify input parameters UserVmVO vm = _vmDao.findById(vmId); if (vm == null || vm.getRemoved() != null) { @@ -5531,7 +5538,7 @@ public UserVm destroyVm(long vmId, boolean expunge) throws ResourceUnavailableEx try { VirtualMachineEntity vmEntity = _orchSrvc.getVirtualMachine(vm.getUuid()); - status = vmEntity.destroy(Long.toString(userId), expunge); + status = vmEntity.destroy(expunge); } catch (CloudException e) { CloudRuntimeException ex = new CloudRuntimeException("Unable to destroy with specified vmId", e); ex.addProxyObject(vm.getUuid(), "vmId"); @@ -5695,7 +5702,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) { @ActionEvent(eventType = EventTypes.EVENT_VM_EXPUNGE, eventDescription = "expunging Vm", async = true) public UserVm expungeVm(long vmId) throws ResourceUnavailableException, ConcurrentOperationException { Account caller = CallContext.current().getCallingAccount(); - Long userId = caller.getId(); + Long callerId = caller.getId(); // Verify input parameters UserVmVO vm = _vmDao.findById(vmId); @@ -5717,15 +5724,18 @@ public UserVm expungeVm(long vmId) throws ResourceUnavailableException, Concurre } // When trying to expunge, permission is denied when the caller is not an admin and the AllowUserExpungeRecoverVm is false for the caller. - if (!_accountMgr.isAdmin(userId) && !AllowUserExpungeRecoverVm.valueIn(userId)) { + if (!_accountMgr.isAdmin(callerId) && !AllowUserExpungeRecoverVm.valueIn(callerId)) { throw new PermissionDeniedException("Expunging a vm can only be done by an Admin. Or when the allow.user.expunge.recover.vm key is set."); } + // check if vm belongs to AutoScale vm group in Disabled state + autoScaleManager.checkIfVmActionAllowed(vmId); + _vmSnapshotMgr.deleteVMSnapshotsFromDB(vmId, false); boolean status; - status = expunge(vm, userId, caller); + status = expunge(vm); if (status) { return _vmDao.findByIdIncludingRemoved(vmId); } else { diff --git a/server/src/main/java/org/apache/cloudstack/annotation/AnnotationManagerImpl.java b/server/src/main/java/org/apache/cloudstack/annotation/AnnotationManagerImpl.java index 5c43dbd30c4e..cc5984699e86 100644 --- a/server/src/main/java/org/apache/cloudstack/annotation/AnnotationManagerImpl.java +++ b/server/src/main/java/org/apache/cloudstack/annotation/AnnotationManagerImpl.java @@ -64,6 +64,7 @@ import com.cloud.host.HostVO; import com.cloud.host.dao.HostDao; import com.cloud.kubernetes.cluster.KubernetesClusterHelper; +import com.cloud.network.as.dao.AutoScaleVmGroupDao; import com.cloud.network.dao.IPAddressDao; import com.cloud.network.dao.NetworkDao; import com.cloud.network.dao.NetworkVO; @@ -153,6 +154,8 @@ public final class AnnotationManagerImpl extends ManagerBase implements Annotati @Inject private NetworkOfferingDao networkOfferingDao; @Inject + private AutoScaleVmGroupDao autoScaleVmGroupDao; + @Inject private UserDataDao userDataDao; @Inject EntityManager entityManager; @@ -188,6 +191,7 @@ public final class AnnotationManagerImpl extends ManagerBase implements Annotati s_typeMap.put(EntityType.SECONDARY_STORAGE, ApiCommandResourceType.ImageStore); s_typeMap.put(EntityType.VR, ApiCommandResourceType.DomainRouter); s_typeMap.put(EntityType.SYSTEM_VM, ApiCommandResourceType.SystemVm); + s_typeMap.put(EntityType.AUTOSCALE_VM_GROUP, ApiCommandResourceType.AutoScaleVmGroup); } public List getKubernetesClusterHelpers() { @@ -526,6 +530,8 @@ private ControlledEntity getEntityFromUuidAndType(String entityUuid, EntityType return templateDao.findByUuid(entityUuid); case KUBERNETES_CLUSTER: return kubernetesClusterHelpers.get(0).findByUuid(entityUuid); + case AUTOSCALE_VM_GROUP: + return autoScaleVmGroupDao.findByUuid(entityUuid); default: throw new CloudRuntimeException("Invalid entity type " + type); } diff --git a/server/src/test/java/com/cloud/api/ApiResponseHelperTest.java b/server/src/test/java/com/cloud/api/ApiResponseHelperTest.java index 6dc96cfee1ff..f7cf7f58b2c8 100644 --- a/server/src/test/java/com/cloud/api/ApiResponseHelperTest.java +++ b/server/src/test/java/com/cloud/api/ApiResponseHelperTest.java @@ -17,7 +17,9 @@ package com.cloud.api; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Matchers.anyLong; import static org.mockito.Mockito.when; @@ -26,27 +28,45 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; +import java.util.UUID; +import org.apache.cloudstack.annotation.dao.AnnotationDao; +import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse; import org.apache.cloudstack.api.response.DirectDownloadCertificateResponse; import org.apache.cloudstack.api.response.NicSecondaryIpResponse; import org.apache.cloudstack.api.response.UsageRecordResponse; +import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.usage.UsageService; +import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; +import org.mockito.Spy; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import com.cloud.domain.DomainVO; +import com.cloud.network.as.AutoScaleVmGroup; +import com.cloud.network.as.AutoScaleVmGroupVO; +import com.cloud.network.as.dao.AutoScaleVmGroupVmMapDao; +import com.cloud.network.dao.IPAddressVO; +import com.cloud.network.dao.LoadBalancerVO; +import com.cloud.network.dao.NetworkServiceMapDao; +import com.cloud.network.dao.NetworkVO; import com.cloud.usage.UsageVO; +import com.cloud.user.Account; +import com.cloud.user.AccountManager; import com.cloud.user.AccountVO; +import com.cloud.user.User; +import com.cloud.user.UserVO; +import com.cloud.utils.net.Ip; import com.cloud.vm.NicSecondaryIp; @RunWith(PowerMockRunner.class) -@PrepareForTest(ApiDBUtils.class) public class ApiResponseHelperTest { @Mock @@ -54,6 +74,22 @@ public class ApiResponseHelperTest { ApiResponseHelper helper; + @Mock + AccountManager accountManagerMock; + + @Mock + AnnotationDao annotationDaoMock; + + @Mock + NetworkServiceMapDao ntwkSrvcDaoMock; + + @Mock + AutoScaleVmGroupVmMapDao autoScaleVmGroupVmMapDaoMock; + + @Spy + @InjectMocks + ApiResponseHelper apiResponseHelper = new ApiResponseHelper(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss ZZZ"); @Before @@ -66,6 +102,21 @@ public void injectMocks() throws SecurityException, NoSuchFieldException, usageSvcField.set(helper, usageService); } + @Before + public void setup() { + AccountVO account = new AccountVO("testaccount", 1L, "networkdomain", Account.Type.NORMAL, "uuid"); + account.setId(1); + UserVO user = new UserVO(1, "testuser", "password", "firstname", "lastName", "email", "timezone", + UUID.randomUUID().toString(), User.Source.UNKNOWN); + + CallContext.register(user, account); + } + + @After + public void cleanup() { + CallContext.unregister(); + } + @Test public void getDateStringInternal() throws ParseException { Mockito.when(usageService.getUsageTimezone()).thenReturn( @@ -83,6 +134,7 @@ public void getDateStringInternal() throws ParseException { } @Test + @PrepareForTest(ApiDBUtils.class) public void testUsageRecordResponse(){ //Creating the usageVO object to be passed to the createUsageResponse. Long zoneId = null; @@ -184,4 +236,65 @@ public void testHandleCertificateResponse() { assertEquals("3", response.getVersion()); assertEquals("CN=*.apache.org", response.getSubject()); } + + @Test + @PrepareForTest(ApiDBUtils.class) + public void testAutoScaleVmGroupResponse() { + AutoScaleVmGroupVO vmGroup = new AutoScaleVmGroupVO(1L, 2L, 3L, 4L, "test", 5, 6, 7, 8, new Date(), 9L, AutoScaleVmGroup.State.ENABLED); + + PowerMockito.mockStatic(ApiDBUtils.class); + when(ApiDBUtils.findAutoScaleVmProfileById(anyLong())).thenReturn(null); + when(ApiDBUtils.findLoadBalancerById(anyLong())).thenReturn(null); + when(ApiDBUtils.findAccountById(anyLong())).thenReturn(new AccountVO()); + when(ApiDBUtils.findDomainById(anyLong())).thenReturn(new DomainVO()); + when(ApiDBUtils.countAvailableVmsByGroupId(anyLong())).thenReturn(9); + + AutoScaleVmGroupResponse response = apiResponseHelper.createAutoScaleVmGroupResponse(vmGroup); + assertEquals("test", response.getName()); + assertEquals(5, response.getMinMembers()); + assertEquals(6, response.getMaxMembers()); + assertEquals(8, response.getInterval()); + assertEquals(9, response.getAvailableVirtualMachineCount()); + assertEquals(AutoScaleVmGroup.State.ENABLED.toString(), response.getState()); + + assertNull(response.getNetworkName()); + assertNull(response.getLbProvider()); + assertNull(response.getPublicIp()); + assertNull(response.getPublicPort()); + assertNull(response.getPrivatePort()); + } + + @Test + @PrepareForTest(ApiDBUtils.class) + public void testAutoScaleVmGroupResponseWithNetwork() { + AutoScaleVmGroupVO vmGroup = new AutoScaleVmGroupVO(1L, 2L, 3L, 4L, "test", 5, 6, 7, 8, new Date(), 9L, AutoScaleVmGroup.State.ENABLED); + + LoadBalancerVO lb = new LoadBalancerVO(null, null, null, 0L, 8080, 8081, null, 0L, 0L, 1L, null, null); + NetworkVO network = new NetworkVO(1L, null, null, null, 2L, 1L, 2L, 3L, + "testnetwork", "displaytext", "networkdomain", null, 1L, null, null, false, null, false); + IPAddressVO ipAddressVO = new IPAddressVO(new Ip("10.10.10.10"), 1L, 1L, 1L,false); + + PowerMockito.mockStatic(ApiDBUtils.class); + when(ApiDBUtils.findAutoScaleVmProfileById(anyLong())).thenReturn(null); + when(ApiDBUtils.findAccountById(anyLong())).thenReturn(new AccountVO()); + when(ApiDBUtils.findDomainById(anyLong())).thenReturn(new DomainVO()); + when(ApiDBUtils.findLoadBalancerById(anyLong())).thenReturn(lb); + + when(ApiDBUtils.findNetworkById(anyLong())).thenReturn(network); + when(ntwkSrvcDaoMock.getProviderForServiceInNetwork(anyLong(), any())).thenReturn("VirtualRouter"); + when(ApiDBUtils.findIpAddressById(anyLong())).thenReturn(ipAddressVO); + + AutoScaleVmGroupResponse response = apiResponseHelper.createAutoScaleVmGroupResponse(vmGroup); + assertEquals("test", response.getName()); + assertEquals(5, response.getMinMembers()); + assertEquals(6, response.getMaxMembers()); + assertEquals(8, response.getInterval()); + assertEquals(AutoScaleVmGroup.State.ENABLED.toString(), response.getState()); + + assertEquals("testnetwork", response.getNetworkName()); + assertEquals("VirtualRouter", response.getLbProvider()); + assertEquals("10.10.10.10", response.getPublicIp()); + assertEquals("8080", response.getPublicPort()); + assertEquals("8081", response.getPrivatePort()); + } } diff --git a/server/src/test/java/com/cloud/network/ExternalLoadBalancerDeviceManagerImplTest.java b/server/src/test/java/com/cloud/network/ExternalLoadBalancerDeviceManagerImplTest.java index 9776eaa408d8..50b021ab910d 100644 --- a/server/src/test/java/com/cloud/network/ExternalLoadBalancerDeviceManagerImplTest.java +++ b/server/src/test/java/com/cloud/network/ExternalLoadBalancerDeviceManagerImplTest.java @@ -63,6 +63,7 @@ import com.cloud.network.dao.PhysicalNetworkServiceProviderDao; import com.cloud.network.dao.VirtualRouterProviderDao; import com.cloud.network.lb.LoadBalancingRule; +import com.cloud.network.lb.LoadBalancingRulesManager; import com.cloud.network.rules.dao.PortForwardingRulesDao; import com.cloud.offerings.dao.NetworkOfferingDao; import com.cloud.resource.ResourceManager; @@ -154,6 +155,8 @@ public class ExternalLoadBalancerDeviceManagerImplTest { PhysicalNetworkServiceProviderDao _physicalProviderDao; @Mock VirtualRouterProviderDao _vrProviderDao; + @Mock + LoadBalancingRulesManager lbRulesManager; @Mock LoadBalancingRule rule; diff --git a/server/src/test/java/com/cloud/network/as/AutoScaleManagerImplTest.java b/server/src/test/java/com/cloud/network/as/AutoScaleManagerImplTest.java new file mode 100644 index 000000000000..870f76d2c36d --- /dev/null +++ b/server/src/test/java/com/cloud/network/as/AutoScaleManagerImplTest.java @@ -0,0 +1,2447 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.network.as; + +import com.cloud.agent.AgentManager; +import com.cloud.agent.api.PerformanceMonitorAnswer; +import com.cloud.agent.api.PerformanceMonitorCommand; +import com.cloud.agent.api.VmStatsEntry; +import com.cloud.agent.api.routing.GetAutoScaleMetricsAnswer; +import com.cloud.agent.api.routing.GetAutoScaleMetricsCommand; +import com.cloud.agent.api.to.LoadBalancerTO.AutoScaleVmProfileTO; +import com.cloud.agent.api.to.LoadBalancerTO.AutoScaleVmGroupTO; +import com.cloud.agent.api.to.LoadBalancerTO.AutoScalePolicyTO; +import com.cloud.agent.api.to.LoadBalancerTO.ConditionTO; +import com.cloud.agent.api.to.LoadBalancerTO.CounterTO; +import com.cloud.api.dispatch.DispatchChain; +import com.cloud.api.dispatch.DispatchChainFactory; +import com.cloud.dc.DataCenter; +import com.cloud.dc.DataCenterVO; +import com.cloud.event.ActionEventUtils; +import com.cloud.exception.AgentUnavailableException; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.exception.OperationTimedoutException; +import com.cloud.exception.ResourceAllocationException; +import com.cloud.exception.ResourceInUseException; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.host.HostVO; +import com.cloud.host.dao.HostDao; +import com.cloud.network.Network; +import com.cloud.network.as.dao.AutoScalePolicyConditionMapDao; +import com.cloud.network.as.dao.AutoScalePolicyDao; +import com.cloud.network.as.dao.AutoScaleVmGroupDao; +import com.cloud.network.as.dao.AutoScaleVmGroupPolicyMapDao; +import com.cloud.network.as.dao.AutoScaleVmGroupStatisticsDao; +import com.cloud.network.as.dao.AutoScaleVmGroupVmMapDao; +import com.cloud.network.as.dao.AutoScaleVmProfileDao; +import com.cloud.network.as.dao.ConditionDao; +import com.cloud.network.as.dao.CounterDao; +import com.cloud.network.dao.IPAddressDao; +import com.cloud.network.dao.IPAddressVO; +import com.cloud.network.dao.LoadBalancerDao; +import com.cloud.network.dao.LoadBalancerVMMapDao; +import com.cloud.network.dao.LoadBalancerVMMapVO; +import com.cloud.network.dao.LoadBalancerVO; +import com.cloud.network.dao.NetworkDao; +import com.cloud.network.dao.NetworkVO; +import com.cloud.network.lb.LoadBalancingRulesManager; +import com.cloud.network.lb.LoadBalancingRulesService; +import com.cloud.network.router.VirtualRouter; +import com.cloud.network.router.VirtualRouterAutoScale; +import com.cloud.network.router.VirtualRouterAutoScale.AutoScaleValueType; +import com.cloud.network.router.VirtualRouterAutoScale.VirtualRouterAutoScaleCounter; +import com.cloud.network.rules.LoadBalancer; +import com.cloud.offering.DiskOffering; +import com.cloud.offering.ServiceOffering; +import com.cloud.offerings.NetworkOfferingVO; +import com.cloud.offerings.dao.NetworkOfferingDao; +import com.cloud.server.ResourceTag; +import com.cloud.service.ServiceOfferingVO; +import com.cloud.service.dao.ServiceOfferingDao; +import com.cloud.storage.DiskOfferingVO; +import com.cloud.storage.VMTemplateVO; +import com.cloud.storage.dao.DiskOfferingDao; +import com.cloud.template.VirtualMachineTemplate; +import com.cloud.user.Account; +import com.cloud.user.AccountManager; +import com.cloud.user.AccountService; +import com.cloud.user.AccountVO; +import com.cloud.user.SSHKeyPairVO; +import com.cloud.user.User; +import com.cloud.user.UserVO; +import com.cloud.user.dao.SSHKeyPairDao; +import com.cloud.user.dao.UserDao; +import com.cloud.utils.Pair; +import com.cloud.utils.component.ComponentContext; +import com.cloud.utils.db.EntityManager; +import com.cloud.utils.db.GenericSearchBuilder; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.utils.net.Ip; +import com.cloud.vm.DomainRouterVO; +import com.cloud.vm.UserVmManager; +import com.cloud.vm.UserVmService; +import com.cloud.vm.UserVmVO; +import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachineProfile; +import com.cloud.vm.dao.DomainRouterDao; +import com.cloud.vm.dao.UserVmDao; +import com.cloud.vm.dao.VMInstanceDao; +import org.apache.cloudstack.affinity.AffinityGroupVO; +import org.apache.cloudstack.affinity.dao.AffinityGroupDao; +import org.apache.cloudstack.annotation.AnnotationService; +import org.apache.cloudstack.annotation.dao.AnnotationDao; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.command.admin.autoscale.CreateCounterCmd; +import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScalePolicyCmd; +import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScaleVmGroupCmd; +import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScaleVmProfileCmd; +import org.apache.cloudstack.api.command.user.autoscale.CreateConditionCmd; +import org.apache.cloudstack.api.command.user.autoscale.ListCountersCmd; +import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScaleVmGroupCmd; +import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScaleVmProfileCmd; +import org.apache.cloudstack.api.command.user.autoscale.UpdateConditionCmd; +import org.apache.cloudstack.api.command.user.vm.DeployVMCmd; +import org.apache.cloudstack.config.ApiServiceConfiguration; +import org.apache.cloudstack.context.CallContext; +import org.apache.cloudstack.framework.config.ConfigKey; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.Spy; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; +import org.springframework.test.util.ReflectionTestUtils; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.CompletionService; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.ScheduledExecutorService; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.matches; +import static org.mockito.ArgumentMatchers.nullable; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.when; + +@RunWith(PowerMockRunner.class) +@PowerMockIgnore("javax.management.*") +public class AutoScaleManagerImplTest { + + @Spy + @InjectMocks + AutoScaleManagerImpl autoScaleManagerImplSpy = new AutoScaleManagerImpl(); + + @Mock + CounterDao counterDao; + + @Mock + ConditionDao conditionDao; + + @Mock + AutoScalePolicyDao asPolicyDao; + + @Mock + AccountManager accountManager; + + @Mock + AccountService accountService; + + @Mock + UserVmService userVmService; + + @Mock + UserVmManager userVmMgr; + + @Mock + EntityManager entityManager; + + @Mock + DispatchChainFactory dispatchChainFactory; + + @Mock + AutoScalePolicyConditionMapDao autoScalePolicyConditionMapDao; + + @Mock + AutoScaleVmGroupPolicyMapDao autoScaleVmGroupPolicyMapDao; + + @Mock + AutoScaleVmGroupDao autoScaleVmGroupDao; + + @Mock + AutoScaleVmProfileDao autoScaleVmProfileDao; + + @Mock + UserDao userDao; + + @Mock + LoadBalancerDao lbDao; + + @Mock + IPAddressDao ipAddressDao; + @Mock + LoadBalancerVMMapDao lbVmMapDao; + @Mock + AutoScaleVmGroupStatisticsDao asGroupStatisticsDao; + @Mock + NetworkDao networkDao; + @Mock + NetworkOfferingDao networkOfferingDao; + @Mock + ServiceOfferingDao serviceOfferingDao; + @Mock + DiskOfferingDao diskOfferingDao; + @Mock + SSHKeyPairDao sshKeyPairDao; + @Mock + AffinityGroupDao affinityGroupDao; + @Mock + AutoScaleVmGroupVmMapDao autoScaleVmGroupVmMapDao; + @Mock + AnnotationDao annotationDao; + @Mock + LoadBalancingRulesManager lbRulesMgr; + @Mock + HostDao hostDao; + @Mock + DomainRouterDao routerDao; + @Mock + AgentManager agentMgr; + @Mock + UserVmDao userVmDao; + @Mock + LoadBalancingRulesService loadBalancingRulesService; + @Mock + VMInstanceDao vmInstanceDao; + + AccountVO account; + UserVO user; + + final static String INVALID = "invalid"; + + private static final Long counterId = 1L; + private static final String counterName = "counter name"; + private static final Counter.Source counterSource = Counter.Source.CPU; + private static final String counterValue = "counter value"; + private static final String counterProvider = "VIRTUALROUTER"; + + private static final Long conditionId = 2L; + private static final Long threshold = 100L; + private static final Condition.Operator relationalOperator = Condition.Operator.GT; + + private static final Long scaleUpPolicyId = 11L; + private static final int scaleUpPolicyDuration = 61; + private static final int scaleUpPolicyQuietTime = 31; + private static final Date scaleUpPolicyLastQuietTime = new Date(); + + private static final Long scaleDownPolicyId = 12L; + private static final int scaleDownPolicyDuration = 62; + private static final int scaleDownPolicyQuietTime = 32; + private static final Date scaleDownPolicyLastQuietTime = new Date(); + + private static final String zoneUuid = "1111-1111-1112"; + private static final String domainUuid = "1111-1111-1113"; + private static final String serviceOfferingUuid = "1111-1111-1114"; + private static final String templateUuid = "1111-1111-1115"; + private static final Long zoneId = 1L; + private static final Long domainId = 2L; + private static final Long serviceOfferingId = 3L; + private static final Long templateId = 4L; + private static final Long accountId = 5L; + private static final String accountName = "test-user"; + private static final Map> otherDeployParams = new HashMap<>(); + private static final Map> counterParamList = new HashMap<>(); + private static final Integer expungeVmGracePeriod = 33; + private static final String cloudStackApiUrl = "cloudstack url"; + private static final String autoScaleUserApiKey = "cloudstack api key"; + private static final String autoScaleUserSecretKey = "cloudstack secret key"; + private static final String vmName = "vm name"; + private static final String networkUuid = "1111-1111-1116"; + private static final Long vmProfileId = 23L; + + private static final Long vmGroupId = 22L; + private static final String vmGroupName = "test-vmgroup"; + private static final String vmGroupNameWithMaxLength = "12345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" + + "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345"; + private static final String vmGroupUuid = "2222-2222-1111"; + private static final int minMembers = 2; + private static final int maxMembers = 3; + private static final int memberPort = 8080; + private static final int interval = 30; + private static final Long loadBalancerId = 21L; + + private static final Long autoScaleUserId = 24L; + private static final Long ipAddressId = 25L; + private static final String ipAddress = "192.168.10.10"; + private static final Long networkId = 26L; + + private static final String overrideDiskOfferingUuid = "1111-1111-1117"; + private static final Long overrideDiskOfferingId = 27L; + private static final String diskOfferingUuid = "1111-1111-1117"; + private static final Long diskOfferingId = 28L; + private static final Long dataDiskSize = 29L; + private static final Long rootDiskSize = 30L; + private static final Long affinityGroupId = 31L; + private static final Long virtualMachineId = 32L; + + private static final Long hostId= 33L; + private static final String hostName= "Host-1"; + private static final Long domainRouterId= 34L; + private static final int ramSize = 1024; + + private static final Long scaleUpConditionId = 35L; + private static final Long scaleUpCounterId = 36L; + private static final Long scaleDownConditionId = 37L; + private static final Long scaleDownCounterId = 38L; + private static final Long nextVmSeq = 39L; + private static final Long networkOfferingId = 40L; + + @Mock + DataCenterVO zoneMock; + @Mock + ServiceOfferingVO serviceOfferingMock; + @Mock + DiskOfferingVO diskOfferingMock; + @Mock + VMTemplateVO templateMock; + @Mock + NetworkVO networkMock; + @Mock + NetworkOfferingVO networkOfferingMock; + @Mock + CounterVO counterMock; + @Mock + ConditionVO conditionMock; + @Mock + AutoScaleVmGroupVO asVmGroupMock; + @Mock + AutoScaleVmProfileVO asVmProfileMock; + @Mock + AutoScalePolicyVO asScaleUpPolicyMock; + @Mock + AutoScalePolicyVO asScaleDownPolicyMock; + @Mock + AutoScalePolicyConditionMapVO autoScalePolicyConditionMapVOMock; + @Mock + AutoScaleVmGroupPolicyMapVO autoScaleVmGroupPolicyMapVOMock; + @Mock + AutoScaleVmGroupVmMapVO autoScaleVmGroupVmMapVOMock; + @Mock + UserVO userMock; + @Mock + LoadBalancerVO loadBalancerMock; + @Mock + IPAddressVO ipAddressMock; + @Mock + UserVmVO userVmMock; + @Mock + HostVO hostMock; + @Mock + DomainRouterVO domainRouterMock; + @Mock + LoadBalancerVMMapVO loadBalancerVMMapMock; + + @Before + public void setUp() { + + account = new AccountVO("testaccount", 1L, "networkdomain", Account.Type.NORMAL, "uuid"); + account.setId(2L); + user = new UserVO(1, "testuser", "password", "firstname", "lastName", "email", "timezone", + UUID.randomUUID().toString(), User.Source.UNKNOWN); + CallContext.register(user, account); + + when(counterDao.persist(any(CounterVO.class))).thenReturn(counterMock); + when(counterDao.findById(anyLong())).thenReturn(counterMock); + when(conditionDao.findById(any())).thenReturn(conditionMock); + when(conditionDao.persist(any(ConditionVO.class))).thenReturn(conditionMock); + + when(accountManager.finalizeOwner(nullable(Account.class), nullable(String.class), nullable(Long.class), nullable(Long.class))).thenReturn(account); + Mockito.doNothing().when(accountManager).checkAccess(Mockito.any(Account.class), Mockito.isNull(), Mockito.anyBoolean(), Mockito.any()); + + when(asPolicyDao.persist(any(AutoScalePolicyVO.class))).thenReturn(asScaleUpPolicyMock); + } + + @After + public void tearDown() { + CallContext.unregister(); + } + + @Test + public void testCreateCounterCmd() throws IllegalArgumentException { + CreateCounterCmd cmd = new CreateCounterCmd(); + ReflectionTestUtils.setField(cmd, ApiConstants.NAME, counterName); + ReflectionTestUtils.setField(cmd, ApiConstants.PROVIDER, counterProvider); + ReflectionTestUtils.setField(cmd, ApiConstants.SOURCE, counterSource.toString()); + ReflectionTestUtils.setField(cmd, ApiConstants.VALUE, counterValue); + + Counter counter = autoScaleManagerImplSpy.createCounter(cmd); + + Assert.assertEquals(counterMock, counter); + Mockito.verify(counterDao).persist(Mockito.any()); + } + + @Test(expected = InvalidParameterValueException.class) + public void testCreateCounterCmdWithInvalidSource() throws IllegalArgumentException { + CreateCounterCmd cmd = new CreateCounterCmd(); + ReflectionTestUtils.setField(cmd, ApiConstants.NAME, counterName); + ReflectionTestUtils.setField(cmd, ApiConstants.PROVIDER, counterProvider); + ReflectionTestUtils.setField(cmd, ApiConstants.SOURCE, INVALID); + ReflectionTestUtils.setField(cmd, ApiConstants.VALUE, counterValue); + + Counter counter = autoScaleManagerImplSpy.createCounter(cmd); + + Mockito.verify(counterDao, never()).persist(Mockito.any()); + } + + @Test(expected = InvalidParameterValueException.class) + public void testCreateCounterCmdWithInvalidProvider() throws IllegalArgumentException { + CreateCounterCmd cmd = new CreateCounterCmd(); + ReflectionTestUtils.setField(cmd, ApiConstants.NAME, counterName); + ReflectionTestUtils.setField(cmd, ApiConstants.PROVIDER, INVALID); + ReflectionTestUtils.setField(cmd, ApiConstants.SOURCE, counterSource.toString()); + ReflectionTestUtils.setField(cmd, ApiConstants.VALUE, counterValue); + + Counter counter = autoScaleManagerImplSpy.createCounter(cmd); + + Mockito.verify(counterDao, never()).persist(Mockito.any()); + } + + @Test + public void testListCounters() { + List countersMock = Arrays.asList(counterMock); + when(counterDao.listCounters(any(), any(), any(), any(), any(), any())).thenReturn(countersMock); + + ListCountersCmd cmd = new ListCountersCmd(); + ReflectionTestUtils.setField(cmd, ApiConstants.PROVIDER, counterProvider); + + List counters = autoScaleManagerImplSpy.listCounters(cmd); + Assert.assertEquals(countersMock, counters); + } + + @Test(expected = InvalidParameterValueException.class) + public void testListCountersWithInvalidProvider() { + ListCountersCmd cmd = new ListCountersCmd(); + ReflectionTestUtils.setField(cmd, ApiConstants.PROVIDER, INVALID); + + List counters = autoScaleManagerImplSpy.listCounters(cmd); + } + + @Test + public void testDeleteCounter() throws ResourceInUseException { + when(counterDao.remove(counterId)).thenReturn(true); + + boolean success = autoScaleManagerImplSpy.deleteCounter(counterId); + + Assert.assertTrue(success); + Mockito.verify(counterDao).remove(counterId); + } + + @Test(expected = InvalidParameterValueException.class) + public void testDeleteCounterInvalidCounter() throws ResourceInUseException { + when(counterDao.findById(counterId)).thenReturn(null); + + boolean success = autoScaleManagerImplSpy.deleteCounter(counterId); + Mockito.verify(counterDao, never()).remove(counterId); + } + + @Test(expected = ResourceInUseException.class) + public void testDeleteCounterWithUsedCounter() throws ResourceInUseException { + when(conditionDao.findByCounterId(counterId)).thenReturn(conditionMock); + + boolean success = autoScaleManagerImplSpy.deleteCounter(counterId); + Mockito.verify(counterDao, never()).remove(counterId); + } + + @Test + public void testCreateConditionCmd() throws IllegalArgumentException { + CreateConditionCmd cmd = new CreateConditionCmd(); + + ReflectionTestUtils.setField(cmd, "counterId", counterId); + ReflectionTestUtils.setField(cmd, "relationalOperator", String.valueOf(relationalOperator)); + ReflectionTestUtils.setField(cmd, "threshold", threshold); + + Condition condition = autoScaleManagerImplSpy.createCondition(cmd); + + Assert.assertEquals(conditionMock, condition); + Mockito.verify(conditionDao).persist(Mockito.any()); + } + + @Test(expected = InvalidParameterValueException.class) + public void testCreateConditionCmdWithInvalidOperator() throws IllegalArgumentException { + CreateConditionCmd cmd = new CreateConditionCmd(); + + ReflectionTestUtils.setField(cmd, "counterId", counterId); + ReflectionTestUtils.setField(cmd, "relationalOperator", INVALID); + ReflectionTestUtils.setField(cmd, "threshold", threshold); + + Condition condition = autoScaleManagerImplSpy.createCondition(cmd); + + Mockito.verify(counterDao, never()).persist(Mockito.any()); + } + + @Test(expected = InvalidParameterValueException.class) + public void testCreateConditionCmdWithInvalidThreshold() throws IllegalArgumentException { + CreateConditionCmd cmd = new CreateConditionCmd(); + + ReflectionTestUtils.setField(cmd, "counterId", counterId); + ReflectionTestUtils.setField(cmd, "relationalOperator", String.valueOf(relationalOperator)); + ReflectionTestUtils.setField(cmd, "threshold", -1L); + + Condition condition = autoScaleManagerImplSpy.createCondition(cmd); + + Mockito.verify(counterDao, never()).persist(Mockito.any()); + } + + @Test + public void testDeleteCondition() throws ResourceInUseException { + when(autoScalePolicyConditionMapDao.isConditionInUse(conditionId)).thenReturn(false); + when(conditionDao.remove(conditionId)).thenReturn(true); + + boolean success = autoScaleManagerImplSpy.deleteCondition(conditionId); + + Assert.assertTrue(success); + Mockito.verify(conditionDao).remove(conditionId); + } + + @Test(expected = ResourceInUseException.class) + public void testDeleteConditionWithUsedCondition() throws ResourceInUseException { + when(autoScalePolicyConditionMapDao.isConditionInUse(conditionId)).thenReturn(true); + + boolean success = autoScaleManagerImplSpy.deleteCondition(conditionId); + + Mockito.verify(conditionDao, never()).remove(conditionId); + } + + @Test + public void testUpdateCondition() throws ResourceInUseException { + GenericSearchBuilder searchBuilderMock = Mockito.mock(GenericSearchBuilder.class); + SearchCriteria searchCriteriaMock = Mockito.mock(SearchCriteria.class); + + Mockito.doReturn(searchBuilderMock).when(autoScalePolicyConditionMapDao).createSearchBuilder(any()); + when(searchBuilderMock.entity()).thenReturn(autoScalePolicyConditionMapVOMock); + Mockito.doReturn(searchCriteriaMock).when(searchBuilderMock).create(); + Mockito.doReturn(Arrays.asList()).when(autoScalePolicyConditionMapDao).customSearch(searchCriteriaMock, null); + + when(conditionDao.update(eq(conditionId), any())).thenReturn(true); + + UpdateConditionCmd cmd = new UpdateConditionCmd(); + + ReflectionTestUtils.setField(cmd, "id", conditionId); + ReflectionTestUtils.setField(cmd, "relationalOperator", String.valueOf(relationalOperator)); + ReflectionTestUtils.setField(cmd, "threshold", 100L); + + Condition condition = autoScaleManagerImplSpy.updateCondition(cmd); + + Assert.assertEquals(conditionMock, condition); + Mockito.verify(conditionDao).update(eq(conditionId), Mockito.any()); + } + + @Test(expected = InvalidParameterValueException.class) + public void testUpdateConditionWithInvalidOperator() throws ResourceInUseException { + UpdateConditionCmd cmd = new UpdateConditionCmd(); + + ReflectionTestUtils.setField(cmd, "id", conditionId); + ReflectionTestUtils.setField(cmd, "relationalOperator", INVALID); + ReflectionTestUtils.setField(cmd, "threshold", 100L); + + Condition condition = autoScaleManagerImplSpy.updateCondition(cmd); + + Mockito.verify(conditionDao, never()).update(eq(conditionId), Mockito.any()); + } + + @Test(expected = InvalidParameterValueException.class) + public void testUpdateConditionWithInvalidThreshold() throws ResourceInUseException { + UpdateConditionCmd cmd = new UpdateConditionCmd(); + + ReflectionTestUtils.setField(cmd, "id", conditionId); + ReflectionTestUtils.setField(cmd, "relationalOperator", String.valueOf(relationalOperator)); + ReflectionTestUtils.setField(cmd, "threshold", -1L); + + Condition condition = autoScaleManagerImplSpy.updateCondition(cmd); + + Mockito.verify(conditionDao, never()).update(eq(conditionId), Mockito.any()); + } + + @Test(expected = ResourceInUseException.class) + public void testUpdateConditionWithPolicies() throws ResourceInUseException { + GenericSearchBuilder genericSearchBuilderMock = Mockito.mock(GenericSearchBuilder.class); + SearchCriteria searchCriteriaLongMock = Mockito.mock(SearchCriteria.class); + + Mockito.doReturn(genericSearchBuilderMock).when(autoScalePolicyConditionMapDao).createSearchBuilder(Long.class); + when(genericSearchBuilderMock.entity()).thenReturn(autoScalePolicyConditionMapVOMock); + Mockito.doReturn(searchCriteriaLongMock).when(genericSearchBuilderMock).create(); + Mockito.doReturn(Arrays.asList(scaleUpPolicyId)).when(autoScalePolicyConditionMapDao).customSearch(searchCriteriaLongMock, null); + + SearchBuilder searchBuilderMock1 = Mockito.mock(SearchBuilder.class); + Mockito.doReturn(searchBuilderMock1).when(autoScaleVmGroupPolicyMapDao).createSearchBuilder(); + when(searchBuilderMock1.entity()).thenReturn(autoScaleVmGroupPolicyMapVOMock); + + SearchBuilder searchBuilderMock2 = Mockito.mock(SearchBuilder.class); + SearchCriteria searchCriteriaMock2 = Mockito.mock(SearchCriteria.class); + + Mockito.doReturn(searchBuilderMock2).when(autoScaleVmGroupDao).createSearchBuilder(); + when(searchBuilderMock2.entity()).thenReturn(asVmGroupMock); + Mockito.doReturn(searchCriteriaMock2).when(searchBuilderMock2).create(); + Mockito.doReturn(Arrays.asList(asVmGroupMock)).when(autoScaleVmGroupDao).search(searchCriteriaMock2, null); + + UpdateConditionCmd cmd = new UpdateConditionCmd(); + + ReflectionTestUtils.setField(cmd, "id", conditionId); + ReflectionTestUtils.setField(cmd, "relationalOperator", String.valueOf(relationalOperator)); + ReflectionTestUtils.setField(cmd, "threshold", 100L); + + Condition condition = autoScaleManagerImplSpy.updateCondition(cmd); + + Mockito.verify(conditionDao, never()).update(eq(conditionId), Mockito.any()); + } + + @Test + public void testCreateAutoScalePolicyCmd() throws IllegalArgumentException { + CreateAutoScalePolicyCmd cmd = new CreateAutoScalePolicyCmd(); + + when(entityManager.findById(Condition.class, conditionId)).thenReturn(conditionMock); + when(conditionMock.getAccountId()).thenReturn(2L); + when(conditionMock.getDomainId()).thenReturn(1L); + + SearchBuilder searchBuilderMock = Mockito.mock(SearchBuilder.class); + SearchCriteria searchCriteriaMock = Mockito.mock(SearchCriteria.class); + List conditions = Arrays.asList(conditionMock); + + Mockito.doReturn(searchBuilderMock).when(conditionDao).createSearchBuilder(); + when(searchBuilderMock.entity()).thenReturn(conditionMock); + Mockito.doReturn(searchCriteriaMock).when(searchBuilderMock).create(); + Mockito.doReturn(conditions).when(conditionDao).search(searchCriteriaMock, null); + + ReflectionTestUtils.setField(cmd, "_entityMgr", entityManager); + ReflectionTestUtils.setField(cmd, "conditionIds", Arrays.asList(conditionId)); + ReflectionTestUtils.setField(cmd, "action", AutoScalePolicy.Action.SCALEUP.toString()); + ReflectionTestUtils.setField(cmd, "duration", 300); + ReflectionTestUtils.setField(cmd, "quietTime", 60); + + AutoScalePolicy policy = autoScaleManagerImplSpy.createAutoScalePolicy(cmd); + + Assert.assertEquals(asScaleUpPolicyMock, policy); + Mockito.verify(asPolicyDao).persist(Mockito.any(AutoScalePolicyVO.class)); + Mockito.verify(autoScalePolicyConditionMapDao).persist(Mockito.any(AutoScalePolicyConditionMapVO.class)); + } + + @Test(expected = InvalidParameterValueException.class) + public void testCreateAutoScalePolicyCmdWithInvalidAction() throws IllegalArgumentException { + CreateAutoScalePolicyCmd cmd = new CreateAutoScalePolicyCmd(); + + ReflectionTestUtils.setField(cmd, "action", INVALID); + ReflectionTestUtils.setField(cmd, "duration", 300); + ReflectionTestUtils.setField(cmd, "quietTime", 60); + + AutoScalePolicy policy = autoScaleManagerImplSpy.createAutoScalePolicy(cmd); + + Mockito.verify(asPolicyDao, never()).persist(Mockito.any()); + } + + @Test(expected = InvalidParameterValueException.class) + public void testCreateAutoScalePolicyCmdWithInvalidDuration() throws IllegalArgumentException { + CreateAutoScalePolicyCmd cmd = new CreateAutoScalePolicyCmd(); + + EntityManager entityMgr = Mockito.spy(EntityManager.class); + when(entityMgr.findById(Condition.class, conditionId)).thenReturn(conditionMock); + when(conditionMock.getAccountId()).thenReturn(2L); + when(conditionMock.getDomainId()).thenReturn(1L); + + ReflectionTestUtils.setField(cmd, "_entityMgr", entityMgr); + ReflectionTestUtils.setField(cmd, "conditionIds", Arrays.asList(conditionId)); + ReflectionTestUtils.setField(cmd, "action", AutoScalePolicy.Action.SCALEUP.toString()); + ReflectionTestUtils.setField(cmd, "duration", -1); + ReflectionTestUtils.setField(cmd, "quietTime", 60); + + AutoScalePolicy policy = autoScaleManagerImplSpy.createAutoScalePolicy(cmd); + + Mockito.verify(asPolicyDao, never()).persist(Mockito.any()); + } + + @Test(expected = InvalidParameterValueException.class) + public void testCreateAutoScalePolicyCmdWithInvalidQuietTime() throws IllegalArgumentException { + CreateAutoScalePolicyCmd cmd = new CreateAutoScalePolicyCmd(); + + EntityManager entityMgr = Mockito.spy(EntityManager.class); + when(entityMgr.findById(Condition.class, conditionId)).thenReturn(conditionMock); + when(conditionMock.getAccountId()).thenReturn(2L); + when(conditionMock.getDomainId()).thenReturn(1L); + + ReflectionTestUtils.setField(cmd, "_entityMgr", entityMgr); + ReflectionTestUtils.setField(cmd, "conditionIds", Arrays.asList(conditionId)); + ReflectionTestUtils.setField(cmd, "action", AutoScalePolicy.Action.SCALEUP.toString()); + ReflectionTestUtils.setField(cmd, "duration", 300); + ReflectionTestUtils.setField(cmd, "quietTime", -1); + + AutoScalePolicy policy = autoScaleManagerImplSpy.createAutoScalePolicy(cmd); + + Mockito.verify(asPolicyDao, never()).persist(Mockito.any()); + } + + @Test + @PrepareForTest(ComponentContext.class) + public void testCreateAutoScaleVmProfile() { + when(entityManager.findById(DataCenter.class, zoneId)).thenReturn(zoneMock); + when(entityManager.findById(ServiceOffering.class, serviceOfferingId)).thenReturn(serviceOfferingMock); + when(entityManager.findByIdIncludingRemoved(ServiceOffering.class, serviceOfferingId)).thenReturn(serviceOfferingMock); + when(entityManager.findById(VirtualMachineTemplate.class, templateId)).thenReturn(templateMock); + when(serviceOfferingMock.isDynamic()).thenReturn(false); + + DispatchChain dispatchChainMock = Mockito.mock(DispatchChain.class); + when(dispatchChainFactory.getStandardDispatchChain()).thenReturn(dispatchChainMock); + Mockito.doNothing().when(dispatchChainMock).dispatch(any()); + PowerMockito.mockStatic(ComponentContext.class); + when(ComponentContext.inject(DeployVMCmd.class)).thenReturn(Mockito.mock(DeployVMCmd.class)); + + when(autoScaleVmProfileDao.persist(any())).thenReturn(asVmProfileMock); + CreateAutoScaleVmProfileCmd cmd = new CreateAutoScaleVmProfileCmd(); + + ReflectionTestUtils.setField(cmd, "zoneId", zoneId); + ReflectionTestUtils.setField(cmd, "serviceOfferingId", serviceOfferingId); + ReflectionTestUtils.setField(cmd, "templateId", templateId); + ReflectionTestUtils.setField(cmd, "expungeVmGracePeriod", expungeVmGracePeriod); + ReflectionTestUtils.setField(cmd, "otherDeployParams", otherDeployParams); + ReflectionTestUtils.setField(cmd, "counterParamList", counterParamList); + + AutoScaleVmProfile vmProfile = autoScaleManagerImplSpy.createAutoScaleVmProfile(cmd); + + Assert.assertEquals(asVmProfileMock, vmProfile); + Mockito.verify(autoScaleVmProfileDao).persist(Mockito.any()); + } + + @Test + public void testUpdateAutoScaleVmProfile() { + when(autoScaleVmProfileDao.findById(vmProfileId)).thenReturn(asVmProfileMock); + when(autoScaleVmGroupDao.listByAll(null, vmProfileId)).thenReturn(new ArrayList<>()); + when(autoScaleVmGroupDao.listByProfile(vmProfileId)).thenReturn(new ArrayList<>()); + when(autoScaleVmProfileDao.persist(any())).thenReturn(asVmProfileMock); + + when(asVmProfileMock.getServiceOfferingId()).thenReturn(serviceOfferingId); + when(asVmProfileMock.getTemplateId()).thenReturn(templateId); + when(entityManager.findById(ServiceOffering.class, serviceOfferingId)).thenReturn(serviceOfferingMock); + when(entityManager.findByIdIncludingRemoved(ServiceOffering.class, serviceOfferingId)).thenReturn(serviceOfferingMock); + when(entityManager.findById(VirtualMachineTemplate.class, templateId)).thenReturn(templateMock); + when(serviceOfferingMock.isDynamic()).thenReturn(false); + + UpdateAutoScaleVmProfileCmd cmd = new UpdateAutoScaleVmProfileCmd(); + + ReflectionTestUtils.setField(cmd, "id", vmProfileId); + ReflectionTestUtils.setField(cmd, "serviceOfferingId", serviceOfferingId); + ReflectionTestUtils.setField(cmd, "templateId", templateId); + + AutoScaleVmProfile vmProfile = autoScaleManagerImplSpy.updateAutoScaleVmProfile(cmd); + + Assert.assertEquals(asVmProfileMock, vmProfile); + Mockito.verify(autoScaleVmProfileDao).persist(Mockito.any()); + } + + @Test + public void testDeleteAutoScaleVmProfile() { + when(autoScaleVmProfileDao.findById(vmProfileId)).thenReturn(asVmProfileMock); + when(autoScaleVmGroupDao.isProfileInUse(vmProfileId)).thenReturn(false); + when(autoScaleVmProfileDao.remove(vmProfileId)).thenReturn(true); + + boolean result = autoScaleManagerImplSpy.deleteAutoScaleVmProfile(vmProfileId); + + Assert.assertTrue(result); + } + + @Test(expected = InvalidParameterValueException.class) + public void testDeleteAutoScaleVmProfileInUse() { + when(autoScaleVmProfileDao.findById(vmProfileId)).thenReturn(asVmProfileMock); + when(autoScaleVmGroupDao.isProfileInUse(vmProfileId)).thenReturn(true); + + boolean result = autoScaleManagerImplSpy.deleteAutoScaleVmProfile(vmProfileId); + } + + @Test + public void testDeleteAutoScaleVmProfileFail() { + when(autoScaleVmProfileDao.findById(vmProfileId)).thenReturn(asVmProfileMock); + when(autoScaleVmGroupDao.isProfileInUse(vmProfileId)).thenReturn(false); + when(autoScaleVmProfileDao.remove(vmProfileId)).thenReturn(false); + + boolean result = autoScaleManagerImplSpy.deleteAutoScaleVmProfile(vmProfileId); + + Assert.assertFalse(result); + } + + @Test + public void testCheckAutoScaleUserSucceed() throws NoSuchFieldException, IllegalAccessException { + when(userDao.findById(any())).thenReturn(userMock); + when(userMock.getAccountId()).thenReturn(accountId); + when(userMock.getApiKey()).thenReturn(autoScaleUserApiKey); + when(userMock.getSecretKey()).thenReturn(autoScaleUserSecretKey); + + final Field f = ConfigKey.class.getDeclaredField("_defaultValue"); + f.setAccessible(true); + f.set(ApiServiceConfiguration.ApiServletPath, "http://10.10.10.10:8080/client/api"); + + autoScaleManagerImplSpy.checkAutoScaleUser(autoScaleUserId, accountId); + } + + @Test(expected = InvalidParameterValueException.class) + public void testCheckAutoScaleUserFail1() { + when(userDao.findById(any())).thenReturn(userMock); + when(userMock.getAccountId()).thenReturn(accountId); + when(userMock.getApiKey()).thenReturn(autoScaleUserApiKey); + when(userMock.getSecretKey()).thenReturn(null); + + autoScaleManagerImplSpy.checkAutoScaleUser(autoScaleUserId, accountId); + } + + @Test(expected = InvalidParameterValueException.class) + public void testCheckAutoScaleUserFail2() { + when(userDao.findById(any())).thenReturn(userMock); + when(userMock.getAccountId()).thenReturn(accountId); + when(userMock.getApiKey()).thenReturn(null); + + autoScaleManagerImplSpy.checkAutoScaleUser(autoScaleUserId, accountId); + } + + @Test(expected = InvalidParameterValueException.class) + public void testCheckAutoScaleUserFail3() { + when(userDao.findById(any())).thenReturn(userMock); + when(userMock.getAccountId()).thenReturn(accountId + 1L); + + autoScaleManagerImplSpy.checkAutoScaleUser(autoScaleUserId, accountId); + } + + @Test(expected = InvalidParameterValueException.class) + public void testCheckAutoScaleUserFail4() { + when(userDao.findById(any())).thenReturn(null); + + autoScaleManagerImplSpy.checkAutoScaleUser(autoScaleUserId, accountId); + } + + @Test(expected = InvalidParameterValueException.class) + public void testCheckAutoScaleUserFail5() throws NoSuchFieldException, IllegalAccessException { + when(userDao.findById(any())).thenReturn(userMock); + when(userMock.getAccountId()).thenReturn(accountId); + when(userMock.getApiKey()).thenReturn(autoScaleUserApiKey); + when(userMock.getSecretKey()).thenReturn(autoScaleUserSecretKey); + + final Field f = ConfigKey.class.getDeclaredField("_defaultValue"); + f.setAccessible(true); + f.set(ApiServiceConfiguration.ApiServletPath, "http://localhost:8080/client/api"); + + autoScaleManagerImplSpy.checkAutoScaleUser(autoScaleUserId, accountId); + } + + @Test + public void testCreateAutoScaleVmGroup() { + CreateAutoScaleVmGroupCmd cmd = new CreateAutoScaleVmGroupCmd(); + + ReflectionTestUtils.setField(cmd, "lbRuleId", loadBalancerId); + ReflectionTestUtils.setField(cmd, "name", vmGroupName); + ReflectionTestUtils.setField(cmd, "minMembers", minMembers); + ReflectionTestUtils.setField(cmd, "maxMembers", maxMembers); + ReflectionTestUtils.setField(cmd, "interval", interval); + ReflectionTestUtils.setField(cmd, "scaleUpPolicyIds", Arrays.asList(scaleUpPolicyId)); + ReflectionTestUtils.setField(cmd, "scaleDownPolicyIds", Arrays.asList(scaleDownPolicyId)); + ReflectionTestUtils.setField(cmd, "profileId", vmProfileId); + + when(entityManager.findById(LoadBalancer.class, loadBalancerId)).thenReturn(loadBalancerMock); + when(loadBalancerMock.getAccountId()).thenReturn(accountId); + when(loadBalancerMock.getDomainId()).thenReturn(domainId); + when(loadBalancerMock.getDefaultPortStart()).thenReturn(memberPort); + when(lbDao.findById(loadBalancerId)).thenReturn(loadBalancerMock); + when(loadBalancerMock.getSourceIpAddressId()).thenReturn(ipAddressId); + when(loadBalancerMock.getNetworkId()).thenReturn(networkId); + when(ipAddressDao.findById(ipAddressId)).thenReturn(ipAddressMock); + when(ipAddressMock.getDataCenterId()).thenReturn(zoneId); + when(loadBalancerMock.getId()).thenReturn(loadBalancerId); + when(autoScaleVmGroupDao.isAutoScaleLoadBalancer(loadBalancerId)).thenReturn(false); + when(lbVmMapDao.isVmAttachedToLoadBalancer(loadBalancerId)).thenReturn(false); + + SearchBuilder searchBuilderMock = Mockito.mock(SearchBuilder.class); + SearchCriteria searchCriteriaMock = Mockito.mock(SearchCriteria.class); + when(asScaleUpPolicyMock.getDuration()).thenReturn(scaleUpPolicyDuration); + when(asScaleUpPolicyMock.getQuietTime()).thenReturn(scaleUpPolicyQuietTime); + when(asScaleUpPolicyMock.getAction()).thenReturn(AutoScalePolicy.Action.SCALEUP); + when(asScaleDownPolicyMock.getDuration()).thenReturn(scaleDownPolicyDuration); + when(asScaleDownPolicyMock.getQuietTime()).thenReturn(scaleDownPolicyQuietTime); + when(asScaleDownPolicyMock.getAction()).thenReturn(AutoScalePolicy.Action.SCALEDOWN); + + Mockito.doReturn(searchBuilderMock).when(asPolicyDao).createSearchBuilder(); + when(searchBuilderMock.entity()).thenReturn(asScaleUpPolicyMock); + Mockito.doReturn(searchCriteriaMock).when(searchBuilderMock).create(); + when(asPolicyDao.search(searchCriteriaMock, null)).thenReturn(Arrays.asList(asScaleUpPolicyMock)).thenReturn(Arrays.asList(asScaleDownPolicyMock)); + + when(autoScaleVmProfileDao.findById(vmProfileId)).thenReturn(asVmProfileMock); + PowerMockito.doReturn(Network.Provider.VirtualRouter).when(autoScaleManagerImplSpy).getLoadBalancerServiceProvider(loadBalancerId); + PowerMockito.doNothing().when(autoScaleManagerImplSpy).validateAutoScaleCounters(anyLong(), any(), any()); + when(loadBalancerMock.getNetworkId()).thenReturn(networkId); + when(networkDao.findById(networkId)).thenReturn(networkMock); + when(networkMock.getNetworkOfferingId()).thenReturn(networkOfferingId); + when(networkOfferingDao.findByIdIncludingRemoved(networkOfferingId)).thenReturn(networkOfferingMock); + when(networkOfferingMock.isSupportsVmAutoScaling()).thenReturn(true); + + when(autoScaleVmGroupDao.persist(any())).thenReturn(asVmGroupMock); + + PowerMockito.doNothing().when(autoScaleManagerImplSpy).scheduleMonitorTask(anyLong()); + + AutoScaleVmGroup vmGroup = autoScaleManagerImplSpy.createAutoScaleVmGroup(cmd); + + Assert.assertEquals(asVmGroupMock, vmGroup); + Mockito.verify(asGroupStatisticsDao).createInactiveDummyRecord(anyLong()); + Mockito.verify(autoScaleManagerImplSpy).scheduleMonitorTask(anyLong()); + } + + @Test + public void testValidateAutoScaleCounters() { + Counter counterCpuMock = Mockito.mock(Counter.class); + when(counterCpuMock.getSource()).thenReturn(Counter.Source.CPU); + Counter counterMemoryMock = Mockito.mock(Counter.class); + when(counterMemoryMock.getSource()).thenReturn(Counter.Source.MEMORY); + + List counters = Arrays.asList(counterCpuMock, counterMemoryMock); + + List supportedAutoScaleCounters = Arrays.asList(new AutoScaleCounter(AutoScaleCounter.AutoScaleCounterType.Cpu), + new AutoScaleCounter(AutoScaleCounter.AutoScaleCounterType.Memory), + new AutoScaleCounter(AutoScaleCounter.AutoScaleCounterType.VirtualRouter)); + PowerMockito.doReturn(supportedAutoScaleCounters).when(autoScaleManagerImplSpy).getSupportedAutoScaleCounters(networkId); + + autoScaleManagerImplSpy.validateAutoScaleCounters(networkId, counters, new ArrayList<>()); + + Mockito.verify(autoScaleManagerImplSpy).getSupportedAutoScaleCounters(networkId); + } + + @Test(expected = InvalidParameterValueException.class) + public void testValidateAutoScaleCountersFail() { + Counter counterCpuMock = Mockito.mock(Counter.class); + when(counterCpuMock.getSource()).thenReturn(Counter.Source.CPU); + Counter counterMemoryMock = Mockito.mock(Counter.class); + when(counterMemoryMock.getSource()).thenReturn(Counter.Source.MEMORY); + + List counters = Arrays.asList(counterCpuMock, counterMemoryMock); + + List supportedAutoScaleCounters = Arrays.asList(new AutoScaleCounter(AutoScaleCounter.AutoScaleCounterType.Cpu), + new AutoScaleCounter(AutoScaleCounter.AutoScaleCounterType.VirtualRouter)); + PowerMockito.doReturn(supportedAutoScaleCounters).when(autoScaleManagerImplSpy).getSupportedAutoScaleCounters(networkId); + + autoScaleManagerImplSpy.validateAutoScaleCounters(networkId, counters, new ArrayList<>()); + + Mockito.verify(autoScaleManagerImplSpy).getSupportedAutoScaleCounters(networkId); + } + + @Test + public void testUpdateAutoScaleVmGroup() { + UpdateAutoScaleVmGroupCmd cmd = new UpdateAutoScaleVmGroupCmd(); + + ReflectionTestUtils.setField(cmd, "id", vmGroupId); + ReflectionTestUtils.setField(cmd, "name", vmGroupNameWithMaxLength); + ReflectionTestUtils.setField(cmd, "minMembers", minMembers + 1); + ReflectionTestUtils.setField(cmd, "maxMembers", maxMembers + 1); + ReflectionTestUtils.setField(cmd, "interval", interval); + + when(autoScaleVmGroupDao.findById(vmGroupId)).thenReturn(asVmGroupMock); + when(asVmGroupMock.getName()).thenReturn(vmGroupNameWithMaxLength); + when(asVmGroupMock.getInterval()).thenReturn(interval); + when(asVmGroupMock.getMaxMembers()).thenReturn(maxMembers); + when(asVmGroupMock.getMinMembers()).thenReturn(minMembers); + when(asVmGroupMock.getState()).thenReturn(AutoScaleVmGroup.State.DISABLED); + when(asVmGroupMock.getProfileId()).thenReturn(vmProfileId); + when(asVmGroupMock.getLoadBalancerId()).thenReturn(loadBalancerId); + + SearchBuilder searchBuilderMock = Mockito.mock(SearchBuilder.class); + SearchCriteria searchCriteriaMock = Mockito.mock(SearchCriteria.class); + when(asScaleUpPolicyMock.getDuration()).thenReturn(scaleUpPolicyDuration); + when(asScaleUpPolicyMock.getQuietTime()).thenReturn(scaleUpPolicyQuietTime); + when(asScaleUpPolicyMock.getAction()).thenReturn(AutoScalePolicy.Action.SCALEUP); + when(asScaleDownPolicyMock.getDuration()).thenReturn(scaleDownPolicyDuration); + when(asScaleDownPolicyMock.getQuietTime()).thenReturn(scaleDownPolicyQuietTime); + when(asScaleDownPolicyMock.getAction()).thenReturn(AutoScalePolicy.Action.SCALEDOWN); + + Mockito.doReturn(searchBuilderMock).when(asPolicyDao).createSearchBuilder(); + when(searchBuilderMock.entity()).thenReturn(asScaleUpPolicyMock); + Mockito.doReturn(searchCriteriaMock).when(searchBuilderMock).create(); + when(asPolicyDao.search(searchCriteriaMock, null)).thenReturn(Arrays.asList(asScaleUpPolicyMock)).thenReturn(Arrays.asList(asScaleDownPolicyMock)); + + when(lbDao.findById(loadBalancerId)).thenReturn(loadBalancerMock); + when(autoScaleVmProfileDao.findById(vmProfileId)).thenReturn(asVmProfileMock); + PowerMockito.doReturn(Network.Provider.VirtualRouter).when(autoScaleManagerImplSpy).getLoadBalancerServiceProvider(loadBalancerId); + PowerMockito.doNothing().when(autoScaleManagerImplSpy).validateAutoScaleCounters(anyLong(), any(), any()); + when(loadBalancerMock.getNetworkId()).thenReturn(networkId); + when(networkDao.findById(networkId)).thenReturn(networkMock); + when(networkMock.getNetworkOfferingId()).thenReturn(networkOfferingId); + when(networkOfferingDao.findByIdIncludingRemoved(networkOfferingId)).thenReturn(networkOfferingMock); + when(networkOfferingMock.isSupportsVmAutoScaling()).thenReturn(true); + + when(autoScaleVmGroupDao.persist(any())).thenReturn(asVmGroupMock); + + PowerMockito.doNothing().when(autoScaleManagerImplSpy).scheduleMonitorTask(anyLong()); + + AutoScaleVmGroup vmGroup = autoScaleManagerImplSpy.updateAutoScaleVmGroup(cmd); + + Assert.assertEquals(asVmGroupMock, vmGroup); + + Mockito.verify(asVmGroupMock).setName(vmGroupNameWithMaxLength); + Mockito.verify(asVmGroupMock).setMinMembers(minMembers + 1); + Mockito.verify(asVmGroupMock).setMaxMembers(maxMembers + 1); + Mockito.verify(asVmGroupMock).setInterval(interval); + } + + @Test(expected = InvalidParameterValueException.class) + public void testUpdateAutoScaleVmGroupFail() { + UpdateAutoScaleVmGroupCmd cmd = new UpdateAutoScaleVmGroupCmd(); + + ReflectionTestUtils.setField(cmd, "id", vmGroupId); + ReflectionTestUtils.setField(cmd, "name", vmGroupName + "-new"); + ReflectionTestUtils.setField(cmd, "minMembers", minMembers + 1); + ReflectionTestUtils.setField(cmd, "maxMembers", maxMembers + 1); + ReflectionTestUtils.setField(cmd, "interval", interval); + + when(autoScaleVmGroupDao.findById(vmGroupId)).thenReturn(asVmGroupMock); + when(asVmGroupMock.getInterval()).thenReturn(interval); + when(asVmGroupMock.getMaxMembers()).thenReturn(maxMembers); + when(asVmGroupMock.getMinMembers()).thenReturn(minMembers); + when(asVmGroupMock.getState()).thenReturn(AutoScaleVmGroup.State.ENABLED); + when(asVmGroupMock.getProfileId()).thenReturn(vmProfileId); + + AutoScaleVmGroup vmGroup = autoScaleManagerImplSpy.updateAutoScaleVmGroup(cmd); + } + + @Test(expected = InvalidParameterValueException.class) + public void testUpdateAutoScaleVmGroupFail2() { + UpdateAutoScaleVmGroupCmd cmd = new UpdateAutoScaleVmGroupCmd(); + + ReflectionTestUtils.setField(cmd, "id", vmGroupId); + String newName = vmGroupName + "!"; + ReflectionTestUtils.setField(cmd, "name", newName); + when(asVmGroupMock.getName()).thenReturn(newName); + + when(autoScaleVmGroupDao.findById(vmGroupId)).thenReturn(asVmGroupMock); + + AutoScaleVmGroup vmGroup = autoScaleManagerImplSpy.updateAutoScaleVmGroup(cmd); + } + + @Test(expected = InvalidParameterValueException.class) + public void testUpdateAutoScaleVmGroupFail3() { + UpdateAutoScaleVmGroupCmd cmd = new UpdateAutoScaleVmGroupCmd(); + + ReflectionTestUtils.setField(cmd, "id", vmGroupId); + String newName = vmGroupNameWithMaxLength + "6"; + ReflectionTestUtils.setField(cmd, "name", newName); + when(asVmGroupMock.getName()).thenReturn(newName); + + when(autoScaleVmGroupDao.findById(vmGroupId)).thenReturn(asVmGroupMock); + + AutoScaleVmGroup vmGroup = autoScaleManagerImplSpy.updateAutoScaleVmGroup(cmd); + } + + @Test + public void testEnableAutoScaleVmGroupInEnabledState() { + when(autoScaleVmGroupDao.findById(vmGroupId)).thenReturn(asVmGroupMock); + when(asVmGroupMock.getState()).thenReturn(AutoScaleVmGroup.State.ENABLED); + + AutoScaleVmGroup vmGroup = autoScaleManagerImplSpy.enableAutoScaleVmGroup(vmGroupId); + + Assert.assertEquals(asVmGroupMock, vmGroup); + } + + @Test + public void testEnableAutoScaleVmGroupInDisabledState() throws ResourceUnavailableException { + when(autoScaleVmGroupDao.findById(vmGroupId)).thenReturn(asVmGroupMock); + when(asVmGroupMock.getId()).thenReturn(vmGroupId); + when(asVmGroupMock.getState()).thenReturn(AutoScaleVmGroup.State.DISABLED); + when(autoScaleVmGroupDao.persist(any())).thenReturn(asVmGroupMock); + PowerMockito.doReturn(true).when(autoScaleManagerImplSpy).configureAutoScaleVmGroup(vmGroupId, AutoScaleVmGroup.State.DISABLED); + PowerMockito.doNothing().when(autoScaleManagerImplSpy).scheduleMonitorTask(anyLong()); + + AutoScaleVmGroup vmGroup = autoScaleManagerImplSpy.enableAutoScaleVmGroup(vmGroupId); + + Assert.assertEquals(asVmGroupMock, vmGroup); + + Mockito.verify(autoScaleManagerImplSpy).configureAutoScaleVmGroup(vmGroupId, AutoScaleVmGroup.State.DISABLED); + Mockito.verify(asGroupStatisticsDao).createInactiveDummyRecord(anyLong()); + Mockito.verify(autoScaleManagerImplSpy).scheduleMonitorTask(anyLong()); + } + + @Test(expected = InvalidParameterValueException.class) + public void testEnableAutoScaleVmGroupInOtherStates() { + when(autoScaleVmGroupDao.findById(vmGroupId)).thenReturn(asVmGroupMock); + when(asVmGroupMock.getState()).thenReturn(AutoScaleVmGroup.State.SCALING); + + AutoScaleVmGroup vmGroup = autoScaleManagerImplSpy.enableAutoScaleVmGroup(vmGroupId); + } + + @Test + public void testDisableAutoScaleVmGroupInDisableState() { + when(autoScaleVmGroupDao.findById(vmGroupId)).thenReturn(asVmGroupMock); + when(asVmGroupMock.getState()).thenReturn(AutoScaleVmGroup.State.DISABLED); + + AutoScaleVmGroup vmGroup = autoScaleManagerImplSpy.disableAutoScaleVmGroup(vmGroupId); + + Assert.assertEquals(asVmGroupMock, vmGroup); + } + + @Test + public void testDisableAutoScaleVmGroupInEnabledState() throws ResourceUnavailableException { + when(autoScaleVmGroupDao.findById(vmGroupId)).thenReturn(asVmGroupMock); + when(asVmGroupMock.getState()).thenReturn(AutoScaleVmGroup.State.ENABLED); + when(autoScaleVmGroupDao.persist(any())).thenReturn(asVmGroupMock); + PowerMockito.doReturn(true).when(autoScaleManagerImplSpy).configureAutoScaleVmGroup(vmGroupId, AutoScaleVmGroup.State.ENABLED); + PowerMockito.doNothing().when(autoScaleManagerImplSpy).scheduleMonitorTask(anyLong()); + + AutoScaleVmGroup vmGroup = autoScaleManagerImplSpy.disableAutoScaleVmGroup(vmGroupId); + + Assert.assertEquals(asVmGroupMock, vmGroup); + + Mockito.verify(autoScaleManagerImplSpy).configureAutoScaleVmGroup(vmGroupId, AutoScaleVmGroup.State.ENABLED); + } + + @Test(expected = InvalidParameterValueException.class) + public void testDisableAutoScaleVmGroupInOtherStates() { + when(autoScaleVmGroupDao.findById(vmGroupId)).thenReturn(asVmGroupMock); + when(asVmGroupMock.getState()).thenReturn(AutoScaleVmGroup.State.NEW); + + AutoScaleVmGroup vmGroup = autoScaleManagerImplSpy.disableAutoScaleVmGroup(vmGroupId); + } + + @Test + public void testDeleteAutoScaleVmGroupsByAccount() throws ResourceUnavailableException { + when(autoScaleVmGroupDao.listByAccount(accountId)).thenReturn(Arrays.asList(asVmGroupMock)); + when(asVmGroupMock.getId()).thenReturn(vmGroupId); + when(asVmGroupMock.getUuid()).thenReturn(vmGroupUuid); + when(autoScaleVmGroupDao.findById(vmGroupId)).thenReturn(asVmGroupMock); + when(asVmGroupMock.getState()).thenReturn(AutoScaleVmGroup.State.ENABLED); + when(autoScaleVmGroupVmMapDao.countByGroup(vmGroupId)).thenReturn(1); + when(autoScaleVmGroupVmMapDao.listByGroup(vmGroupId)).thenReturn(Arrays.asList(autoScaleVmGroupVmMapVOMock)); + when(autoScaleVmGroupVmMapVOMock.getInstanceId()).thenReturn(virtualMachineId); + PowerMockito.doReturn(true).when(autoScaleManagerImplSpy).destroyVm(virtualMachineId); + PowerMockito.doReturn(true).when(autoScaleManagerImplSpy).configureAutoScaleVmGroup(vmGroupId, AutoScaleVmGroup.State.ENABLED); + when(autoScaleVmGroupDao.remove(vmGroupId)).thenReturn(true); + PowerMockito.doNothing().when(autoScaleManagerImplSpy).cancelMonitorTask(vmGroupId); + when(autoScaleVmGroupPolicyMapDao.removeByGroupId(vmGroupId)).thenReturn(true); + when(autoScaleVmGroupVmMapDao.removeByGroup(vmGroupId)).thenReturn(true); + when(asGroupStatisticsDao.removeByGroupId(vmGroupId)).thenReturn(true); + + boolean result = autoScaleManagerImplSpy.deleteAutoScaleVmGroupsByAccount(accountId); + + Assert.assertTrue(result); + + Mockito.verify(autoScaleManagerImplSpy).destroyVm(virtualMachineId); + Mockito.verify(autoScaleManagerImplSpy).configureAutoScaleVmGroup(vmGroupId, AutoScaleVmGroup.State.ENABLED); + Mockito.verify(annotationDao).removeByEntityType(AnnotationService.EntityType.AUTOSCALE_VM_GROUP.name(), vmGroupUuid); + Mockito.verify(autoScaleManagerImplSpy).cancelMonitorTask(vmGroupId); + } + + @Test + public void testCleanUpAutoScaleResources() { + when(autoScaleVmProfileDao.removeByAccountId(accountId)).thenReturn(1); + when(asPolicyDao.removeByAccountId(accountId)).thenReturn(2); + when(conditionDao.removeByAccountId(accountId)).thenReturn(3); + + autoScaleManagerImplSpy.cleanUpAutoScaleResources(accountId); + + Mockito.verify(autoScaleVmProfileDao).removeByAccountId(accountId); + Mockito.verify(asPolicyDao).removeByAccountId(accountId); + Mockito.verify(conditionDao).removeByAccountId(accountId); + } + + @Test + public void testGetDeployParams() { + String otherDeployParamsString = String.format("networkid=%s&diskofferingid=%s", networkUuid, diskOfferingUuid); + + Map deployParams = autoScaleManagerImplSpy.getDeployParams(otherDeployParamsString); + + Assert.assertEquals(2, deployParams.size()); + Assert.assertEquals(networkUuid, deployParams.get("networkid")); + Assert.assertEquals(diskOfferingUuid, deployParams.get("diskofferingid")); + } + + @Test + public void testCreateNewVM1() throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException { + when(asVmGroupMock.getProfileId()).thenReturn(vmProfileId); + when(asVmGroupMock.getLoadBalancerId()).thenReturn(loadBalancerId); + when(asVmGroupMock.getNextVmSeq()).thenReturn(nextVmSeq); + when(asVmGroupMock.getName()).thenReturn(vmGroupName); + + when(autoScaleVmProfileDao.findById(vmProfileId)).thenReturn(asVmProfileMock); + when(asVmProfileMock.getTemplateId()).thenReturn(templateId); + when(asVmProfileMock.getServiceOfferingId()).thenReturn(serviceOfferingId); + when(asVmProfileMock.getAccountId()).thenReturn(accountId); + when(asVmProfileMock.getZoneId()).thenReturn(zoneId); + when(asVmProfileMock.getOtherDeployParams()).thenReturn(""); + + when(accountService.getActiveAccountById(accountId)).thenReturn(account); + when(entityManager.findById(DataCenter.class, zoneId)).thenReturn(zoneMock); + when(entityManager.findById(ServiceOffering.class, serviceOfferingId)).thenReturn(serviceOfferingMock); + when(serviceOfferingMock.getDiskOfferingId()).thenReturn(diskOfferingId); + when(entityManager.findById(DiskOffering.class, diskOfferingId)).thenReturn(diskOfferingMock); + when(entityManager.findById(VirtualMachineTemplate.class, templateId)).thenReturn(templateMock); + when(zoneMock.isLocalStorageEnabled()).thenReturn(false); + when(diskOfferingMock.isUseLocalStorage()).thenReturn(false); + + PowerMockito.doReturn(networkMock).when(autoScaleManagerImplSpy).getNetwork(loadBalancerId); + when(networkMock.getId()).thenReturn(networkId); + + when(userVmMock.getId()).thenReturn(virtualMachineId); + when(zoneMock.getNetworkType()).thenReturn(DataCenter.NetworkType.Basic); + when(userVmService.createBasicSecurityGroupVirtualMachine(any(), any(), any(), any(), any(), any(), any(), + any(), any(), any(), any(), any(), any(), any(), any(), any(), any(), any(), eq(true), any(), any(), any(), + any(), any(), any(), any(), eq(true), any())).thenReturn(userVmMock); + + long result = autoScaleManagerImplSpy.createNewVM(asVmGroupMock); + + Assert.assertEquals((long) virtualMachineId, result); + + String vmHostNamePattern = autoScaleManagerImplSpy.VM_HOSTNAME_PREFIX + vmGroupName + + "-" + asVmGroupMock.getNextVmSeq() + "-[a-z]{6}"; + Mockito.verify(userVmService).createBasicSecurityGroupVirtualMachine(any(), any(), any(), any(), any(), + matches(vmHostNamePattern), matches(vmHostNamePattern), + any(), any(), any(), any(), any(), any(), any(), any(), any(), any(), any(), eq(true), any(), any(), any(), + any(), any(), any(), any(), eq(true), any()); + Mockito.verify(asVmGroupMock).setNextVmSeq(nextVmSeq + 1); + } + + @Test + public void testCreateNewVM2() throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException { + when(asVmGroupMock.getProfileId()).thenReturn(vmProfileId); + when(asVmGroupMock.getLoadBalancerId()).thenReturn(loadBalancerId); + when(asVmGroupMock.getNextVmSeq()).thenReturn(nextVmSeq + 1); + when(asVmGroupMock.getName()).thenReturn(vmGroupName); + + when(autoScaleVmProfileDao.findById(vmProfileId)).thenReturn(asVmProfileMock); + when(asVmProfileMock.getTemplateId()).thenReturn(templateId); + when(asVmProfileMock.getServiceOfferingId()).thenReturn(serviceOfferingId); + when(asVmProfileMock.getAccountId()).thenReturn(accountId); + when(asVmProfileMock.getZoneId()).thenReturn(zoneId); + when(asVmProfileMock.getOtherDeployParams()).thenReturn(""); + + when(accountService.getActiveAccountById(accountId)).thenReturn(account); + when(entityManager.findById(DataCenter.class, zoneId)).thenReturn(zoneMock); + when(entityManager.findById(ServiceOffering.class, serviceOfferingId)).thenReturn(serviceOfferingMock); + when(serviceOfferingMock.getDiskOfferingId()).thenReturn(diskOfferingId); + when(entityManager.findById(DiskOffering.class, diskOfferingId)).thenReturn(diskOfferingMock); + when(entityManager.findById(VirtualMachineTemplate.class, templateId)).thenReturn(templateMock); + when(zoneMock.isLocalStorageEnabled()).thenReturn(false); + when(diskOfferingMock.isUseLocalStorage()).thenReturn(false); + + PowerMockito.doReturn(networkMock).when(autoScaleManagerImplSpy).getNetwork(loadBalancerId); + when(networkMock.getId()).thenReturn(networkId); + + when(userVmMock.getId()).thenReturn(virtualMachineId); + when(zoneMock.getNetworkType()).thenReturn(DataCenter.NetworkType.Advanced); + when(zoneMock.isSecurityGroupEnabled()).thenReturn(true); + when(userVmService.createAdvancedSecurityGroupVirtualMachine(any(), any(), any(), any(), any(), any(), any(), + any(), any(), any(), any(), any(), any(), any(), any(), any(), any(), any(), any(), any(), any(), any(), + any(), any(), any(), any(), any(), eq(true), any(), any())).thenReturn(userVmMock); + + long result = autoScaleManagerImplSpy.createNewVM(asVmGroupMock); + + Assert.assertEquals((long) virtualMachineId, result); + + String vmHostNamePattern = autoScaleManagerImplSpy.VM_HOSTNAME_PREFIX + vmGroupName + + "-" + asVmGroupMock.getNextVmSeq() + "-[a-z]{6}"; + Mockito.verify(userVmService).createAdvancedSecurityGroupVirtualMachine(any(), any(), any(), any(), any(), any(), + matches(vmHostNamePattern), matches(vmHostNamePattern), + any(), any(), any(), any(), any(), any(), any(), any(), any(), any(), any(), any(), any(), any(), + any(), any(), any(), any(), any(), eq(true), any(), any()); + Mockito.verify(asVmGroupMock).setNextVmSeq(nextVmSeq + 2); + } + + @Test + public void testCreateNewVM3() throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException { + when(asVmGroupMock.getProfileId()).thenReturn(vmProfileId); + when(asVmGroupMock.getLoadBalancerId()).thenReturn(loadBalancerId); + when(asVmGroupMock.getNextVmSeq()).thenReturn(nextVmSeq + 2); + when(asVmGroupMock.getName()).thenReturn(vmGroupNameWithMaxLength); + + when(autoScaleVmProfileDao.findById(vmProfileId)).thenReturn(asVmProfileMock); + when(asVmProfileMock.getTemplateId()).thenReturn(templateId); + when(asVmProfileMock.getServiceOfferingId()).thenReturn(serviceOfferingId); + when(asVmProfileMock.getAccountId()).thenReturn(accountId); + when(asVmProfileMock.getZoneId()).thenReturn(zoneId); + when(asVmProfileMock.getOtherDeployParams()).thenReturn(""); + + when(accountService.getActiveAccountById(accountId)).thenReturn(account); + when(entityManager.findById(DataCenter.class, zoneId)).thenReturn(zoneMock); + when(entityManager.findById(ServiceOffering.class, serviceOfferingId)).thenReturn(serviceOfferingMock); + when(serviceOfferingMock.getDiskOfferingId()).thenReturn(diskOfferingId); + when(entityManager.findById(DiskOffering.class, diskOfferingId)).thenReturn(diskOfferingMock); + when(entityManager.findById(VirtualMachineTemplate.class, templateId)).thenReturn(templateMock); + when(zoneMock.isLocalStorageEnabled()).thenReturn(false); + when(diskOfferingMock.isUseLocalStorage()).thenReturn(false); + + PowerMockito.doReturn(networkMock).when(autoScaleManagerImplSpy).getNetwork(loadBalancerId); + when(networkMock.getId()).thenReturn(networkId); + + when(userVmMock.getId()).thenReturn(virtualMachineId); + when(zoneMock.getNetworkType()).thenReturn(DataCenter.NetworkType.Advanced); + when(zoneMock.isSecurityGroupEnabled()).thenReturn(false); + when(userVmService.createAdvancedVirtualMachine(any(), any(), any(), any(), any(), any(), any(), + any(), any(), any(), any(), any(), any(), any(), any(), any(), any(), any(), eq(true), any(), any(), any(), + any(), any(), any(), any(), eq(true), any(), any())).thenReturn(userVmMock); + + long result = autoScaleManagerImplSpy.createNewVM(asVmGroupMock); + + Assert.assertEquals((long) virtualMachineId, result); + + String vmHostNamePattern = autoScaleManagerImplSpy.VM_HOSTNAME_PREFIX + vmGroupNameWithMaxLength.substring(0, 41) + + "-" + asVmGroupMock.getNextVmSeq() + "-[a-z]{6}"; + Mockito.verify(userVmService).createAdvancedVirtualMachine(any(), any(), any(), any(), any(), + matches(vmHostNamePattern), matches(vmHostNamePattern), + any(), any(), any(), any(), any(), any(), any(), any(), any(), any(), any(), eq(true), any(), any(), any(), + any(), any(), any(), any(), eq(true), any(), any()); + Mockito.verify(asVmGroupMock).setNextVmSeq(nextVmSeq + 3); + } + + @Test + public void getVmNetworkIds1() { + NetworkVO networkMock = Mockito.mock(NetworkVO.class); + when(networkDao.findByUuid(networkUuid)).thenReturn(networkMock); + when(networkMock.getId()).thenReturn(networkId); + + Map deployParams = new HashMap<>(); + deployParams.put("networkids", networkUuid); + + List result = autoScaleManagerImplSpy.getVmNetworkIds(deployParams, networkId); + Assert.assertEquals(1, result.size()); + } + + @Test + public void getVmNetworkIds2() { + NetworkVO networkMock = Mockito.mock(NetworkVO.class); + when(networkDao.findByUuid(networkUuid)).thenReturn(networkMock); + when(networkMock.getId()).thenReturn(networkId); + + Map deployParams = new HashMap<>(); + deployParams.put("networkids", networkUuid); + + List result = autoScaleManagerImplSpy.getVmNetworkIds(deployParams, networkId + 1L); + Assert.assertEquals(2, result.size()); + } + + @Test + public void getVmOverrideDiskOfferingId() { + DiskOfferingVO diskOfferingMock = Mockito.mock(DiskOfferingVO.class); + when(diskOfferingDao.findByUuid(overrideDiskOfferingUuid)).thenReturn(diskOfferingMock); + when(diskOfferingMock.getId()).thenReturn(overrideDiskOfferingId); + + Map deployParams = new HashMap<>(); + deployParams.put("overridediskofferingid", overrideDiskOfferingUuid); + + Long result = autoScaleManagerImplSpy.getVmOverrideDiskOfferingId(deployParams); + + Assert.assertEquals(overrideDiskOfferingId, result); + } + + @Test + public void getVmDiskOfferingId() { + DiskOfferingVO diskOfferingMock = Mockito.mock(DiskOfferingVO.class); + when(diskOfferingDao.findByUuid(diskOfferingUuid)).thenReturn(diskOfferingMock); + when(diskOfferingMock.getId()).thenReturn(diskOfferingId); + + Map deployParams = new HashMap<>(); + deployParams.put("diskofferingid", diskOfferingUuid); + + Long result = autoScaleManagerImplSpy.getVmDiskOfferingId(deployParams); + + Assert.assertEquals(diskOfferingId, result); + } + + @Test + public void getVmDataDiskSize() { + Map deployParams = new HashMap<>(); + deployParams.put("disksize", String.valueOf(dataDiskSize)); + + Long result = autoScaleManagerImplSpy.getVmDataDiskSize(deployParams); + + Assert.assertEquals(dataDiskSize, result); + } + + @Test + public void getVmSshKeyPairs1() { + SSHKeyPairVO keypair1 = Mockito.mock(SSHKeyPairVO.class); + SSHKeyPairVO keypair2 = Mockito.mock(SSHKeyPairVO.class); + when(sshKeyPairDao.findByName(anyLong(), anyLong(), anyString())).thenReturn(keypair1).thenReturn(keypair2); + when(keypair1.getName()).thenReturn("name1"); + when(keypair2.getName()).thenReturn("name2"); + + Map deployParams = new HashMap<>(); + deployParams.put("keypairs", "keypair1,keypair2"); + + List result = autoScaleManagerImplSpy.getVmSshKeyPairs(deployParams, account); + + Assert.assertEquals(2, result.size()); + } + + @Test + public void getVmAffinityGroupId() { + AffinityGroupVO affintyGroup1 = Mockito.mock(AffinityGroupVO.class); + AffinityGroupVO affintyGroup2 = Mockito.mock(AffinityGroupVO.class); + when(affinityGroupDao.findByUuid(anyString())).thenReturn(affintyGroup1).thenReturn(affintyGroup2); + when(affintyGroup1.getId()).thenReturn(affinityGroupId); + when(affintyGroup2.getId()).thenReturn(affinityGroupId + 1L); + + Map deployParams = new HashMap<>(); + deployParams.put("affinitygroupids", "affinitygroup1,affinitygroup2"); + + List result = autoScaleManagerImplSpy.getVmAffinityGroupId(deployParams); + + Assert.assertEquals(2, result.size()); + } + + @Test + public void updateVmDetails() { + Map deployParams = new HashMap<>(); + deployParams.put("rootdisksize", String.valueOf(rootDiskSize)); + + Map customParameters = new HashMap<>(); + autoScaleManagerImplSpy.updateVmDetails(deployParams, customParameters); + + Assert.assertEquals(1, customParameters.size()); + Assert.assertEquals(String.valueOf(rootDiskSize), customParameters.get("rootdisksize")); + } + + @Test + @PrepareForTest(ActionEventUtils.class) + public void testDoScaleUp() throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException { + PowerMockito.mockStatic(ActionEventUtils.class); + + when(autoScaleVmGroupDao.findById(vmGroupId)).thenReturn(asVmGroupMock); + when(asVmGroupMock.getId()).thenReturn(vmGroupId); + when(asVmGroupMock.getMaxMembers()).thenReturn(maxMembers); + when(autoScaleVmGroupVmMapDao.countAvailableVmsByGroup(vmGroupId)).thenReturn(maxMembers - 1); + when(asVmGroupMock.getState()).thenReturn(AutoScaleVmGroup.State.ENABLED); + + when(autoScaleVmGroupDao.updateState(vmGroupId, AutoScaleVmGroup.State.ENABLED, AutoScaleVmGroup.State.SCALING)).thenReturn(true); + when(autoScaleVmGroupDao.updateState(vmGroupId, AutoScaleVmGroup.State.SCALING, AutoScaleVmGroup.State.ENABLED)).thenReturn(true); + PowerMockito.doReturn(virtualMachineId).when(autoScaleManagerImplSpy).createNewVM(asVmGroupMock); + Pair> startVm = Mockito.mock(Pair.class); + when(userVmMgr.startVirtualMachine(virtualMachineId, null, null, null)).thenReturn(startVm); + + when(asVmGroupMock.getLoadBalancerId()).thenReturn(loadBalancerId); + when(lbVmMapDao.listByLoadBalancerId(loadBalancerId)).thenReturn(Arrays.asList(loadBalancerVMMapMock)); + when(loadBalancerVMMapMock.getInstanceId()).thenReturn(virtualMachineId + 1); + + when(loadBalancingRulesService.assignToLoadBalancer(anyLong(), any(), any(), eq(true))).thenReturn(true); + + autoScaleManagerImplSpy.doScaleUp(vmGroupId, 1); + + Mockito.verify(autoScaleManagerImplSpy).createNewVM(asVmGroupMock); + Mockito.verify(loadBalancingRulesService).assignToLoadBalancer(anyLong(), any(), any(), eq(true)); + } + + @Test + @PrepareForTest(ActionEventUtils.class) + public void testDoScaleDown() { + PowerMockito.mockStatic(ActionEventUtils.class); + + when(autoScaleVmGroupDao.findById(vmGroupId)).thenReturn(asVmGroupMock); + when(asVmGroupMock.getId()).thenReturn(vmGroupId); + + when(asVmGroupMock.getMinMembers()).thenReturn(minMembers); + when(autoScaleVmGroupVmMapDao.countAvailableVmsByGroup(vmGroupId)).thenReturn(minMembers + 1); + when(asVmGroupMock.getState()).thenReturn(AutoScaleVmGroup.State.ENABLED); + + when(autoScaleVmGroupDao.updateState(vmGroupId, AutoScaleVmGroup.State.ENABLED, AutoScaleVmGroup.State.SCALING)).thenReturn(true); + when(autoScaleVmGroupDao.updateState(vmGroupId, AutoScaleVmGroup.State.SCALING, AutoScaleVmGroup.State.ENABLED)).thenReturn(true); + + when(asVmGroupMock.getLoadBalancerId()).thenReturn(loadBalancerId); + when(lbVmMapDao.listByLoadBalancerId(loadBalancerId)).thenReturn(Arrays.asList(loadBalancerVMMapMock)); + when(loadBalancerVMMapMock.getInstanceId()).thenReturn(virtualMachineId); + + when(loadBalancingRulesService.removeFromLoadBalancer(anyLong(), any(), any(), eq(true))).thenReturn(true); + + when(asVmGroupMock.getProfileId()).thenReturn(vmProfileId); + when(autoScaleVmProfileDao.findById(vmProfileId)).thenReturn(asVmProfileMock); + when(asVmProfileMock.getExpungeVmGracePeriod()).thenReturn(expungeVmGracePeriod); + + autoScaleManagerImplSpy.doScaleDown(vmGroupId); + + Mockito.verify(loadBalancingRulesService).removeFromLoadBalancer(anyLong(), any(), any(), eq(true)); + } + + @Test + public void checkAllAutoScaleVmGroups() throws InterruptedException, ExecutionException { + CompletionService> completionService = Mockito.mock(CompletionService.class); + ReflectionTestUtils.setField(autoScaleManagerImplSpy, "completionService", completionService); + + when(autoScaleVmGroupDao.listAll()).thenReturn(Arrays.asList(asVmGroupMock)); + + Future> future = Mockito.mock(Future.class); + Pair result = Mockito.mock(Pair.class); + when(completionService.take()).thenReturn(future); + when(future.get()).thenReturn(result); + + autoScaleManagerImplSpy.checkAllAutoScaleVmGroups(); + + Mockito.verify(completionService, Mockito.times(1)).submit(any()); + Mockito.verify(completionService, Mockito.times(1)).take(); + Mockito.verify(future, Mockito.times(1)).get(); + } + + @Test + public void checkAutoScaleVmGroup1() { + when(asVmGroupMock.getState()).thenReturn(AutoScaleVmGroup.State.ENABLED); + when(asVmGroupMock.getLoadBalancerId()).thenReturn(loadBalancerId); + PowerMockito.doReturn(Network.Provider.VirtualRouter).when(autoScaleManagerImplSpy).getLoadBalancerServiceProvider(loadBalancerId); + PowerMockito.doNothing().when(autoScaleManagerImplSpy).checkNetScalerAsGroup(asVmGroupMock); + PowerMockito.doNothing().when(autoScaleManagerImplSpy).checkVirtualRouterAsGroup(asVmGroupMock); + + autoScaleManagerImplSpy.checkAutoScaleVmGroup(asVmGroupMock); + + Mockito.verify(autoScaleManagerImplSpy).checkVirtualRouterAsGroup(asVmGroupMock); + Mockito.verify(autoScaleManagerImplSpy, never()).checkNetScalerAsGroup(asVmGroupMock); + } + + @Test + public void checkAutoScaleVmGroup2() { + when(asVmGroupMock.getState()).thenReturn(AutoScaleVmGroup.State.ENABLED); + when(asVmGroupMock.getLoadBalancerId()).thenReturn(loadBalancerId); + PowerMockito.doReturn(Network.Provider.VPCVirtualRouter).when(autoScaleManagerImplSpy).getLoadBalancerServiceProvider(loadBalancerId); + PowerMockito.doNothing().when(autoScaleManagerImplSpy).checkNetScalerAsGroup(asVmGroupMock); + PowerMockito.doNothing().when(autoScaleManagerImplSpy).checkVirtualRouterAsGroup(asVmGroupMock); + + autoScaleManagerImplSpy.checkAutoScaleVmGroup(asVmGroupMock); + + Mockito.verify(autoScaleManagerImplSpy).checkVirtualRouterAsGroup(asVmGroupMock); + Mockito.verify(autoScaleManagerImplSpy, never()).checkNetScalerAsGroup(asVmGroupMock); + } + + @Test + public void checkAutoScaleVmGroup3() { + when(asVmGroupMock.getState()).thenReturn(AutoScaleVmGroup.State.ENABLED); + when(asVmGroupMock.getLoadBalancerId()).thenReturn(loadBalancerId); + PowerMockito.doReturn(Network.Provider.Netscaler).when(autoScaleManagerImplSpy).getLoadBalancerServiceProvider(loadBalancerId); + PowerMockito.doNothing().when(autoScaleManagerImplSpy).checkNetScalerAsGroup(asVmGroupMock); + PowerMockito.doNothing().when(autoScaleManagerImplSpy).checkVirtualRouterAsGroup(asVmGroupMock); + + autoScaleManagerImplSpy.checkAutoScaleVmGroup(asVmGroupMock); + + Mockito.verify(autoScaleManagerImplSpy, never()).checkVirtualRouterAsGroup(asVmGroupMock); + Mockito.verify(autoScaleManagerImplSpy).checkNetScalerAsGroup(asVmGroupMock); + } + + @Test + public void isNativeTrue() { + AutoScaleVmGroupTO groupTO = Mockito.mock(AutoScaleVmGroupTO.class); + AutoScalePolicyTO policyTO = Mockito.mock(AutoScalePolicyTO.class); + ConditionTO conditionTO = Mockito.mock(ConditionTO.class); + CounterTO counterTO = Mockito.mock(CounterTO.class); + AutoScaleVmProfileTO profileTO = Mockito.mock(AutoScaleVmProfileTO.class); + + when(groupTO.getPolicies()).thenReturn(Arrays.asList(policyTO)); + when(policyTO.getConditions()).thenReturn(Arrays.asList(conditionTO)); + when(conditionTO.getCounter()).thenReturn(counterTO); + when(counterTO.getSource()).thenReturn(Counter.Source.CPU); + + boolean result = autoScaleManagerImplSpy.isNative(groupTO); + Assert.assertTrue(result); + } + + @Test + public void isNativeFalse() { + AutoScaleVmGroupTO groupTO = Mockito.mock(AutoScaleVmGroupTO.class); + AutoScalePolicyTO policyTO = Mockito.mock(AutoScalePolicyTO.class); + ConditionTO conditionTO = Mockito.mock(ConditionTO.class); + CounterTO counterTO = Mockito.mock(CounterTO.class); + AutoScaleVmProfileTO profileTO = Mockito.mock(AutoScaleVmProfileTO.class); + + when(groupTO.getPolicies()).thenReturn(Arrays.asList(policyTO)); + when(policyTO.getConditions()).thenReturn(Arrays.asList(conditionTO)); + when(conditionTO.getCounter()).thenReturn(counterTO); + when(counterTO.getSource()).thenReturn(Counter.Source.VIRTUALROUTER); + + boolean result = autoScaleManagerImplSpy.isNative(groupTO); + Assert.assertFalse(result); + } + + @Test + public void hasSourceVirtualRouterTrue() { + AutoScaleVmGroupTO groupTO = Mockito.mock(AutoScaleVmGroupTO.class); + AutoScalePolicyTO policyTO = Mockito.mock(AutoScalePolicyTO.class); + ConditionTO conditionTO = Mockito.mock(ConditionTO.class); + CounterTO counterTO = Mockito.mock(CounterTO.class); + AutoScaleVmProfileTO profileTO = Mockito.mock(AutoScaleVmProfileTO.class); + + when(groupTO.getPolicies()).thenReturn(Arrays.asList(policyTO)); + when(policyTO.getConditions()).thenReturn(Arrays.asList(conditionTO)); + when(conditionTO.getCounter()).thenReturn(counterTO); + when(counterTO.getSource()).thenReturn(Counter.Source.VIRTUALROUTER); + + boolean result = autoScaleManagerImplSpy.hasSourceVirtualRouter(groupTO); + Assert.assertTrue(result); + } + + @Test + public void hasSourceVirtualRouterFalse() { + AutoScaleVmGroupTO groupTO = Mockito.mock(AutoScaleVmGroupTO.class); + AutoScalePolicyTO policyTO = Mockito.mock(AutoScalePolicyTO.class); + ConditionTO conditionTO = Mockito.mock(ConditionTO.class); + CounterTO counterTO = Mockito.mock(CounterTO.class); + AutoScaleVmProfileTO profileTO = Mockito.mock(AutoScaleVmProfileTO.class); + + when(groupTO.getPolicies()).thenReturn(Arrays.asList(policyTO)); + when(policyTO.getConditions()).thenReturn(Arrays.asList(conditionTO)); + when(conditionTO.getCounter()).thenReturn(counterTO); + when(counterTO.getSource()).thenReturn(Counter.Source.CPU); + + boolean result = autoScaleManagerImplSpy.hasSourceVirtualRouter(groupTO); + Assert.assertFalse(result); + } + + @Test + public void getHostAndVmIdsMap() { + AutoScaleVmGroupTO groupTO = Mockito.mock(AutoScaleVmGroupTO.class); + when(groupTO.getId()).thenReturn(vmGroupId); + when(autoScaleVmGroupVmMapDao.listByGroup(vmGroupId)).thenReturn(Arrays.asList(autoScaleVmGroupVmMapVOMock)); + when(autoScaleVmGroupVmMapVOMock.getInstanceId()).thenReturn(virtualMachineId); + when(userVmDao.findById(virtualMachineId)).thenReturn(userVmMock); + when(userVmMock.getHostId()).thenReturn(null); + + Map> result = autoScaleManagerImplSpy.getHostAndVmIdsMap(groupTO); + + Assert.assertEquals(1, result.size()); + List vmIds = result.get(-1L); + Assert.assertNotNull(vmIds); + Assert.assertEquals(1, vmIds.size()); + Assert.assertEquals(virtualMachineId, vmIds.get(0)); + } + + @Test + public void getPolicyCounters() { + AutoScaleVmGroupTO groupTO = Mockito.mock(AutoScaleVmGroupTO.class); + AutoScalePolicyTO policyTO = Mockito.mock(AutoScalePolicyTO.class); + ConditionTO conditionTO1 = Mockito.mock(ConditionTO.class); + CounterTO counterTO1 = Mockito.mock(CounterTO.class); + ConditionTO conditionTO2 = Mockito.mock(ConditionTO.class); + CounterTO counterTO2 = Mockito.mock(CounterTO.class); + + when(groupTO.getPolicies()).thenReturn(Arrays.asList(policyTO)); + when(policyTO.getConditions()).thenReturn(Arrays.asList(conditionTO1, conditionTO2)); + when(conditionTO1.getCounter()).thenReturn(counterTO1); + when(conditionTO2.getCounter()).thenReturn(counterTO2); + when(policyTO.getId()).thenReturn(scaleUpPolicyId); + + Map> result = autoScaleManagerImplSpy.getPolicyCounters(groupTO); + + Assert.assertEquals(1, result.size()); + List counters = result.get(scaleUpPolicyId); + Assert.assertEquals(2, counters.size()); + Assert.assertTrue(counters.contains(counterTO1)); + Assert.assertTrue(counters.contains(counterTO2)); + } + + @Test + public void getAutoscaleAction() { + AutoScaleVmGroupTO groupTO = Mockito.mock(AutoScaleVmGroupTO.class); + AutoScalePolicyTO policyTO = Mockito.mock(AutoScalePolicyTO.class); + when(groupTO.getPolicies()).thenReturn(Arrays.asList(policyTO)); + + Map countersMap = new HashMap<>(); + Map countersNumberMap = new HashMap<>(); + when(groupTO.getId()).thenReturn(vmGroupId); + when(groupTO.getLoadBalancerId()).thenReturn(loadBalancerId); + PowerMockito.doReturn(Network.Provider.VirtualRouter).when(autoScaleManagerImplSpy).getLoadBalancerServiceProvider(loadBalancerId); + PowerMockito.doReturn(true).when(autoScaleManagerImplSpy).isQuitTimePassForPolicy(policyTO); + PowerMockito.doReturn(AutoScalePolicy.Action.SCALEUP).when(autoScaleManagerImplSpy).checkConditionsForPolicy(countersMap, countersNumberMap, policyTO, Network.Provider.VirtualRouter); + + AutoScalePolicy.Action result = autoScaleManagerImplSpy.getAutoscaleAction(countersMap, countersNumberMap, groupTO); + + Assert.assertEquals(AutoScalePolicy.Action.SCALEUP, result); + } + + @Test + public void isQuitTimePassForPolicy() { + AutoScalePolicyTO policyTO = Mockito.mock(AutoScalePolicyTO.class); + + when(policyTO.getQuietTime()).thenReturn(60); + + boolean result = autoScaleManagerImplSpy.isQuitTimePassForPolicy(policyTO); + Assert.assertTrue(result); + } + + @Test + public void checkConditionsForPolicy1() { + AutoScalePolicyTO policyTO = Mockito.mock(AutoScalePolicyTO.class); + ConditionTO conditionTO1 = Mockito.mock(ConditionTO.class); + CounterTO counterTO1 = Mockito.mock(CounterTO.class); + ConditionTO conditionTO2 = Mockito.mock(ConditionTO.class); + CounterTO counterTO2 = Mockito.mock(CounterTO.class); + when(conditionTO1.getCounter()).thenReturn(counterTO1); + when(conditionTO2.getCounter()).thenReturn(counterTO2); + when(policyTO.getConditions()).thenReturn(Arrays.asList(conditionTO1, conditionTO2)); + when(policyTO.getId()).thenReturn(scaleUpPolicyId); + when(policyTO.getAction()).thenReturn(AutoScalePolicy.Action.SCALEUP); + + Long counterId2 = counterId + 1; + Long conditionId2 = conditionId + 1; + when(conditionTO1.getId()).thenReturn(conditionId); + when(conditionTO2.getId()).thenReturn(conditionId2); + when(counterTO1.getId()).thenReturn(counterId); + when(counterTO2.getId()).thenReturn(counterId2); + + String key1 = policyTO.getId() + "-" + conditionTO1.getId() + "-" + counterTO1.getId(); + String key2 = policyTO.getId() + "-" + conditionTO2.getId() + "-" + counterTO2.getId(); + + Map countersMap = new HashMap<>(); + Map countersNumberMap = new HashMap<>(); + + countersMap.put(key1, (double) 100); + countersNumberMap.put(key1, 2); + countersMap.put(key2, (double) 100); + countersNumberMap.put(key2, 1); + + when(conditionTO1.getRelationalOperator()).thenReturn(Condition.Operator.GT); + when(conditionTO2.getRelationalOperator()).thenReturn(Condition.Operator.GE); + when(conditionTO1.getThreshold()).thenReturn(40L); + when(conditionTO2.getThreshold()).thenReturn(60L); + + AutoScalePolicy.Action result = autoScaleManagerImplSpy.checkConditionsForPolicy(countersMap, countersNumberMap, + policyTO, Network.Provider.VirtualRouter); + + Assert.assertEquals(AutoScalePolicy.Action.SCALEUP, result); + + Mockito.verify(conditionTO1).getRelationalOperator(); + Mockito.verify(conditionTO2).getRelationalOperator(); + } + + @Test + public void checkConditionsForPolicy2() { + AutoScalePolicyTO policyTO = Mockito.mock(AutoScalePolicyTO.class); + ConditionTO conditionTO1 = Mockito.mock(ConditionTO.class); + CounterTO counterTO1 = Mockito.mock(CounterTO.class); + ConditionTO conditionTO2 = Mockito.mock(ConditionTO.class); + CounterTO counterTO2 = Mockito.mock(CounterTO.class); + when(conditionTO1.getCounter()).thenReturn(counterTO1); + when(conditionTO2.getCounter()).thenReturn(counterTO2); + when(policyTO.getConditions()).thenReturn(Arrays.asList(conditionTO1, conditionTO2)); + when(policyTO.getId()).thenReturn(scaleUpPolicyId); + when(policyTO.getAction()).thenReturn(AutoScalePolicy.Action.SCALEUP); + + Long counterId2 = counterId + 1; + Long conditionId2 = conditionId + 1; + when(conditionTO1.getId()).thenReturn(conditionId); + when(conditionTO2.getId()).thenReturn(conditionId2); + when(counterTO1.getId()).thenReturn(counterId); + when(counterTO2.getId()).thenReturn(counterId2); + + String key1 = policyTO.getId() + "-" + conditionTO1.getId() + "-" + counterTO1.getId(); + String key2 = policyTO.getId() + "-" + conditionTO2.getId() + "-" + counterTO2.getId(); + + Map countersMap = new HashMap<>(); + Map countersNumberMap = new HashMap<>(); + + countersMap.put(key1, (double) 100); + countersNumberMap.put(key1, 2); + countersMap.put(key2, (double) 100); + countersNumberMap.put(key2, 1); + + when(conditionTO1.getRelationalOperator()).thenReturn(Condition.Operator.LT); + when(conditionTO2.getRelationalOperator()).thenReturn(Condition.Operator.LE); + when(conditionTO1.getThreshold()).thenReturn(40L); + when(conditionTO2.getThreshold()).thenReturn(60L); + + AutoScalePolicy.Action result = autoScaleManagerImplSpy.checkConditionsForPolicy(countersMap, countersNumberMap, + policyTO, Network.Provider.VirtualRouter); + + Assert.assertNull(result); + + Mockito.verify(conditionTO1).getRelationalOperator(); + Mockito.verify(conditionTO2, never()).getRelationalOperator(); + } + + @Test + public void setPerformanceMonitorCommandParams() { + AutoScaleVmGroupTO groupTO = Mockito.mock(AutoScaleVmGroupTO.class); + AutoScalePolicyTO policyTO = Mockito.mock(AutoScalePolicyTO.class); + ConditionTO conditionTO1 = Mockito.mock(ConditionTO.class); + CounterTO counterTO1 = Mockito.mock(CounterTO.class); + ConditionTO conditionTO2 = Mockito.mock(ConditionTO.class); + CounterTO counterTO2 = Mockito.mock(CounterTO.class); + + when(groupTO.getPolicies()).thenReturn(Arrays.asList(policyTO)); + when(policyTO.getConditions()).thenReturn(Arrays.asList(conditionTO1, conditionTO2)); + when(policyTO.getDuration()).thenReturn(scaleUpPolicyDuration); + when(conditionTO1.getCounter()).thenReturn(counterTO1); + when(conditionTO2.getCounter()).thenReturn(counterTO2); + when(conditionTO1.getId()).thenReturn(conditionId); + when(conditionTO2.getId()).thenReturn(conditionId + 1L); + when(counterTO1.getName()).thenReturn(counterName + "-1"); + when(counterTO2.getName()).thenReturn(counterName + "-2"); + + Map params = new LinkedHashMap<>(); + + autoScaleManagerImplSpy.setPerformanceMonitorCommandParams(groupTO, params); + + Assert.assertEquals(7, params.size()); + Assert.assertEquals("2", params.get("totalCounter")); + Assert.assertEquals(String.valueOf(scaleUpPolicyDuration), params.get("duration1")); + Assert.assertEquals(String.valueOf(scaleUpPolicyDuration), params.get("duration2")); + Assert.assertEquals(counterName + "-1", params.get("counter1")); + Assert.assertEquals(counterName + "-2", params.get("counter2")); + Assert.assertEquals(String.valueOf(conditionId), params.get("con1")); + Assert.assertEquals(String.valueOf(conditionId + 1L), params.get("con2")); + } + + @Test + public void getNetwork() { + when(lbDao.findById(loadBalancerId)).thenReturn(loadBalancerMock); + when(loadBalancerMock.getNetworkId()).thenReturn(networkId); + when(networkDao.findById(networkId)).thenReturn(networkMock); + + Network result = autoScaleManagerImplSpy.getNetwork(loadBalancerId); + + Assert.assertEquals(networkMock, result); + } + + @Test(expected = CloudRuntimeException.class) + public void getNetworkFail1() { + when(lbDao.findById(loadBalancerId)).thenReturn(null); + + Network result = autoScaleManagerImplSpy.getNetwork(loadBalancerId); + } + + @Test(expected = CloudRuntimeException.class) + public void getNetworkFail2() { + when(lbDao.findById(loadBalancerId)).thenReturn(loadBalancerMock); + when(loadBalancerMock.getNetworkId()).thenReturn(networkId); + when(networkDao.findById(networkId)).thenReturn(null); + + Network result = autoScaleManagerImplSpy.getNetwork(loadBalancerId); + } + + @Test + public void getPublicIpAndPort() { + when(lbDao.findById(loadBalancerId)).thenReturn(loadBalancerMock); + when(loadBalancerMock.getSourceIpAddressId()).thenReturn(ipAddressId); + when(ipAddressDao.findById(ipAddressId)).thenReturn(ipAddressMock); + when(ipAddressMock.getAddress()).thenReturn(new Ip(ipAddress)); + when(loadBalancerMock.getSourcePortStart()).thenReturn(memberPort); + + Pair result = autoScaleManagerImplSpy.getPublicIpAndPort(loadBalancerId); + + Assert.assertEquals(ipAddress, result.first()); + Assert.assertEquals(memberPort, (long) result.second()); + } + + @Test(expected = CloudRuntimeException.class) + public void getPublicIpAndPortFail1() { + when(lbDao.findById(loadBalancerId)).thenReturn(null); + Pair result = autoScaleManagerImplSpy.getPublicIpAndPort(loadBalancerId); + } + + @Test(expected = CloudRuntimeException.class) + public void getPublicIpAndPortFail2() { + when(lbDao.findById(loadBalancerId)).thenReturn(loadBalancerMock); + when(loadBalancerMock.getSourceIpAddressId()).thenReturn(ipAddressId); + when(ipAddressDao.findById(ipAddressId)).thenReturn(null); + + Pair result = autoScaleManagerImplSpy.getPublicIpAndPort(loadBalancerId); + } + + @Test + public void checkNetScalerAsGroup() throws OperationTimedoutException, AgentUnavailableException { + when(asVmGroupMock.getId()).thenReturn(vmGroupId); + AutoScaleVmGroupTO groupTO = Mockito.mock(AutoScaleVmGroupTO.class); + when(lbRulesMgr.toAutoScaleVmGroupTO(asVmGroupMock)).thenReturn(groupTO); + PowerMockito.doReturn(true).when(autoScaleManagerImplSpy).isNative(groupTO); + + when(autoScaleVmGroupVmMapDao.countAvailableVmsByGroup(vmGroupId)).thenReturn(minMembers); + when(asVmGroupMock.getMinMembers()).thenReturn(minMembers); + when(asVmGroupMock.getMaxMembers()).thenReturn(maxMembers); + + when(autoScaleVmGroupVmMapDao.listByGroup(vmGroupId)).thenReturn(Arrays.asList(autoScaleVmGroupVmMapVOMock)); + when(autoScaleVmGroupVmMapVOMock.getInstanceId()).thenReturn(virtualMachineId); + when(vmInstanceDao.findById(virtualMachineId)).thenReturn(userVmMock); + when(userVmMock.getHostId()).thenReturn(hostId); + when(userVmMock.getInstanceName()).thenReturn(vmName); + + PowerMockito.doNothing().when(autoScaleManagerImplSpy).setPerformanceMonitorCommandParams(any(), any()); + PerformanceMonitorCommand command = Mockito.mock(PerformanceMonitorCommand.class); + PerformanceMonitorAnswer answer = new PerformanceMonitorAnswer(command, true, "result"); + when(agentMgr.send(eq(hostId), any(PerformanceMonitorCommand.class))).thenReturn(answer); + + PowerMockito.doNothing().when(autoScaleManagerImplSpy).processPerformanceMonitorAnswer(any(), any(), any(), any(), any()); + + PowerMockito.doReturn(AutoScalePolicy.Action.SCALEUP).when(autoScaleManagerImplSpy).getAutoscaleAction(any(), any(), any()); + PowerMockito.doNothing().when(autoScaleManagerImplSpy).doScaleUp(vmGroupId, 1); + PowerMockito.doNothing().when(autoScaleManagerImplSpy).cleanupAsVmGroupStatistics(groupTO); + + autoScaleManagerImplSpy.checkNetScalerAsGroup(asVmGroupMock); + + Mockito.verify(autoScaleManagerImplSpy).doScaleUp(vmGroupId, 1); + } + + @Test + public void processPerformanceMonitorAnswer() { + AutoScaleVmGroupTO groupTO = Mockito.mock(AutoScaleVmGroupTO.class); + + Map countersMap = new HashMap<>(); + Map countersNumberMap = new HashMap<>(); + + Map params = new HashMap<>(); + params.put("con1", String.valueOf(scaleUpConditionId)); + params.put("con2", String.valueOf(scaleDownConditionId)); + + double value1 = 50; + double value2 = 100; + + String details = String.format("1.%s:%s,2.%s:%s", scaleUpCounterId, value1, scaleDownCounterId, value2); + + autoScaleManagerImplSpy.processPerformanceMonitorAnswer(countersMap, countersNumberMap, groupTO, params, details); + + Mockito.verify(autoScaleManagerImplSpy).updateCountersMapWithInstantData(any(), any(), eq(groupTO), eq(scaleUpCounterId), eq(scaleUpConditionId), eq(0L), eq(value1), eq(AutoScaleValueType.INSTANT_VM)); + Mockito.verify(autoScaleManagerImplSpy).updateCountersMapWithInstantData(any(), any(), eq(groupTO), eq(scaleDownCounterId), eq(scaleDownConditionId), eq(0L), eq(value2), eq(AutoScaleValueType.INSTANT_VM)); + } + + @Test + public void checkVirtualRouterAsGroupAndScaleUp() { + when(asVmGroupMock.getId()).thenReturn(vmGroupId); + AutoScaleVmGroupTO groupTO = Mockito.mock(AutoScaleVmGroupTO.class); + when(lbRulesMgr.toAutoScaleVmGroupTO(asVmGroupMock)).thenReturn(groupTO); + + PowerMockito.doReturn(true).when(autoScaleManagerImplSpy).updateCountersMap(any(), any(), any()); + PowerMockito.doReturn(AutoScalePolicy.Action.SCALEUP).when(autoScaleManagerImplSpy).getAutoscaleAction(any(), any(), any()); + PowerMockito.doNothing().when(autoScaleManagerImplSpy).doScaleUp(vmGroupId, 1); + PowerMockito.doNothing().when(autoScaleManagerImplSpy).cleanupAsVmGroupStatistics(groupTO); + + autoScaleManagerImplSpy.checkVirtualRouterAsGroup(asVmGroupMock); + + Mockito.verify(autoScaleManagerImplSpy).doScaleUp(vmGroupId, 1); + } + + @Test + public void checkVirtualRouterAsGroupAndScaleDown() { + when(asVmGroupMock.getId()).thenReturn(vmGroupId); + AutoScaleVmGroupTO groupTO = Mockito.mock(AutoScaleVmGroupTO.class); + when(lbRulesMgr.toAutoScaleVmGroupTO(asVmGroupMock)).thenReturn(groupTO); + + PowerMockito.doReturn(true).when(autoScaleManagerImplSpy).updateCountersMap(any(), any(), any()); + PowerMockito.doReturn(AutoScalePolicy.Action.SCALEDOWN).when(autoScaleManagerImplSpy).getAutoscaleAction(any(), any(), any()); + PowerMockito.doNothing().when(autoScaleManagerImplSpy).doScaleDown(vmGroupId); + PowerMockito.doNothing().when(autoScaleManagerImplSpy).cleanupAsVmGroupStatistics(groupTO); + + autoScaleManagerImplSpy.checkVirtualRouterAsGroup(asVmGroupMock); + + Mockito.verify(autoScaleManagerImplSpy).doScaleDown(vmGroupId); + } + + @Test + public void updateCountersMap1() { + AutoScaleVmGroupTO groupTO = Mockito.mock(AutoScaleVmGroupTO.class); + when(groupTO.getId()).thenReturn(vmGroupId); + + AutoScalePolicyTO scaleUpPolicyTO = Mockito.mock(AutoScalePolicyTO.class); + when(scaleUpPolicyTO.getId()).thenReturn(scaleUpPolicyId); + when(scaleUpPolicyTO.getDuration()).thenReturn(scaleUpPolicyDuration); + ConditionTO scaleUpConditionTO = Mockito.mock(ConditionTO.class); + CounterTO scaleUpCounterTO = Mockito.mock(CounterTO.class); + when(scaleUpPolicyTO.getConditions()).thenReturn(Arrays.asList(scaleUpConditionTO)); + when(scaleUpConditionTO.getId()).thenReturn(scaleUpConditionId); + when(scaleUpConditionTO.getCounter()).thenReturn(scaleUpCounterTO); + when(scaleUpCounterTO.getId()).thenReturn(scaleUpCounterId); + when(scaleUpCounterTO.getSource()).thenReturn(Counter.Source.CPU); + + AutoScalePolicyTO scaleDownPolicyTO = Mockito.mock(AutoScalePolicyTO.class); + when(scaleDownPolicyTO.getId()).thenReturn(scaleDownPolicyId); + when(scaleDownPolicyTO.getDuration()).thenReturn(scaleDownPolicyDuration); + ConditionTO scaleDownConditionTO = Mockito.mock(ConditionTO.class); + CounterTO scaleDownCounterTO = Mockito.mock(CounterTO.class); + when(scaleDownPolicyTO.getConditions()).thenReturn(Arrays.asList(scaleDownConditionTO)); + when(scaleDownConditionTO.getId()).thenReturn(scaleDownConditionId); + when(scaleDownConditionTO.getCounter()).thenReturn(scaleDownCounterTO); + when(scaleDownCounterTO.getId()).thenReturn(scaleDownCounterId); + when(scaleDownCounterTO.getSource()).thenReturn(Counter.Source.VIRTUALROUTER); + + when(groupTO.getPolicies()).thenReturn(Arrays.asList(scaleUpPolicyTO, scaleDownPolicyTO)); + + when(asGroupStatisticsDao.listDummyRecordsByVmGroup(eq(vmGroupId), any())) + .thenReturn(new ArrayList<>()) + .thenReturn(new ArrayList<>()); + + List stats = new ArrayList<>(); + Date timestamp = new Date(); + stats.add(new AutoScaleVmGroupStatisticsVO(vmGroupId, scaleUpPolicyId, scaleUpCounterId, virtualMachineId, ResourceTag.ResourceObjectType.UserVm, + (double) 1, AutoScaleValueType.INSTANT_VM, timestamp)); + stats.add(new AutoScaleVmGroupStatisticsVO(vmGroupId, scaleUpPolicyId, scaleUpCounterId, virtualMachineId, ResourceTag.ResourceObjectType.UserVm, + (double) 2, AutoScaleValueType.INSTANT_VM, timestamp)); + stats.add(new AutoScaleVmGroupStatisticsVO(vmGroupId, scaleUpPolicyId, scaleUpCounterId, virtualMachineId, ResourceTag.ResourceObjectType.UserVm, + (double) 3, AutoScaleValueType.INSTANT_VM, timestamp)); + + when(asGroupStatisticsDao.listByVmGroupAndPolicyAndCounter(eq(vmGroupId), eq(scaleUpPolicyId), eq(scaleUpCounterId), any())).thenReturn(stats); + when(asGroupStatisticsDao.listByVmGroupAndPolicyAndCounter(eq(vmGroupId), eq(scaleDownPolicyId), eq(scaleDownCounterId), any())).thenReturn(stats); + + PowerMockito.doNothing().when(autoScaleManagerImplSpy).updateCountersMapWithInstantData(any(), any(), any(), + any(), any(), any(), any(), any()); + + Map countersMap = new HashMap<>(); + Map countersNumberMap = new HashMap<>(); + + autoScaleManagerImplSpy.updateCountersMap(groupTO, countersMap, countersNumberMap); + + Mockito.verify(autoScaleManagerImplSpy, times(6)).updateCountersMapWithInstantData(any(), any(), any(), + any(), any(), any(), any(), any()); + } + + @Test + public void updateCountersMap2() { + AutoScaleVmGroupTO groupTO = Mockito.mock(AutoScaleVmGroupTO.class); + when(groupTO.getId()).thenReturn(vmGroupId); + + AutoScalePolicyTO scaleUpPolicyTO = Mockito.mock(AutoScalePolicyTO.class); + when(scaleUpPolicyTO.getId()).thenReturn(scaleUpPolicyId); + when(scaleUpPolicyTO.getDuration()).thenReturn(scaleUpPolicyDuration); + ConditionTO scaleUpConditionTO = Mockito.mock(ConditionTO.class); + CounterTO scaleUpCounterTO = Mockito.mock(CounterTO.class); + when(scaleUpPolicyTO.getConditions()).thenReturn(Arrays.asList(scaleUpConditionTO)); + when(scaleUpConditionTO.getId()).thenReturn(scaleUpConditionId); + when(scaleUpConditionTO.getCounter()).thenReturn(scaleUpCounterTO); + when(scaleUpCounterTO.getId()).thenReturn(scaleUpCounterId); + when(scaleUpCounterTO.getSource()).thenReturn(Counter.Source.VIRTUALROUTER); + + when(groupTO.getPolicies()).thenReturn(Arrays.asList(scaleUpPolicyTO)); + + when(asGroupStatisticsDao.listDummyRecordsByVmGroup(eq(vmGroupId), any())) + .thenReturn(new ArrayList<>()) + .thenReturn(new ArrayList<>()); + when(asGroupStatisticsDao.listInactiveByVmGroupAndPolicy(eq(vmGroupId), eq(scaleUpPolicyId), any())) + .thenReturn(new ArrayList<>()); + when(asGroupStatisticsDao.listInactiveByVmGroupAndPolicy(eq(vmGroupId), eq(scaleDownPolicyId), any())) + .thenReturn(new ArrayList<>()); + + List stats = new ArrayList<>(); + Date timestamp = new Date(); + stats.add(new AutoScaleVmGroupStatisticsVO(vmGroupId, scaleUpPolicyId, scaleUpCounterId, domainRouterId, ResourceTag.ResourceObjectType.DomainRouter, + (double) 11, AutoScaleValueType.AGGREGATED_VM_GROUP, timestamp)); + stats.add(new AutoScaleVmGroupStatisticsVO(vmGroupId, scaleUpPolicyId, scaleUpCounterId, domainRouterId, ResourceTag.ResourceObjectType.DomainRouter, + (double) 31, AutoScaleValueType.AGGREGATED_VM_GROUP, new Date(timestamp.getTime() + 10 * 1000))); + stats.add(new AutoScaleVmGroupStatisticsVO(vmGroupId, scaleUpPolicyId, scaleUpCounterId, domainRouterId, ResourceTag.ResourceObjectType.DomainRouter, + (double) 51, AutoScaleValueType.AGGREGATED_VM_GROUP, new Date(timestamp.getTime() + 20 * 1000))); + + when(asGroupStatisticsDao.listByVmGroupAndPolicyAndCounter(eq(vmGroupId), eq(scaleUpPolicyId), eq(scaleUpCounterId), any())).thenReturn(stats); + when(autoScaleVmGroupVmMapDao.countAvailableVmsByGroup(vmGroupId)).thenReturn(1); + + PowerMockito.doNothing().when(autoScaleManagerImplSpy).updateCountersMapWithProcessedData(any(), any(), any(), any()); + + Map countersMap = new HashMap<>(); + Map countersNumberMap = new HashMap<>(); + + autoScaleManagerImplSpy.updateCountersMap(groupTO, countersMap, countersNumberMap); + + Mockito.verify(autoScaleManagerImplSpy, times(1)).updateCountersMapWithProcessedData(any(), any(), any(), eq((double) 2)); // average per second + } + + @Test + public void updateCountersMapWithInstantDataForMemory() { + AutoScaleVmGroupTO groupTO = Mockito.mock(AutoScaleVmGroupTO.class); + AutoScaleVmProfileTO profileTO = Mockito.mock(AutoScaleVmProfileTO.class); + + when(counterDao.findById(counterId)).thenReturn(counterMock); + when(counterMock.getSource()).thenReturn(Counter.Source.MEMORY); + + when(groupTO.getProfile()).thenReturn(profileTO); + when(profileTO.getServiceOfferingId()).thenReturn(serviceOfferingUuid); + when(serviceOfferingDao.findByUuidIncludingRemoved(serviceOfferingUuid)).thenReturn(serviceOfferingMock); + when(serviceOfferingMock.getRamSize()).thenReturn(ramSize); + + Map countersMap = new HashMap<>(); + Map countersNumberMap = new HashMap<>(); + + String key = scaleUpPolicyId + "-" + conditionId + "-" + counterId; + countersMap.put(key, (double) 10); + countersNumberMap.put(key, 1); + + double value = 512; + autoScaleManagerImplSpy.updateCountersMapWithInstantData(countersMap, countersNumberMap, + groupTO, counterId, conditionId, scaleUpPolicyId, value, AutoScaleValueType.INSTANT_VM); + + Assert.assertEquals(1, countersMap.size()); + Assert.assertEquals(1, countersNumberMap.size()); + + Assert.assertEquals(60, (double) countersMap.get(key), 0); + Assert.assertEquals(2, (long) countersNumberMap.get(key)); + } + + @Test + public void updateCountersMapWithInstantDataForCPU() { + AutoScaleVmGroupTO groupTO = Mockito.mock(AutoScaleVmGroupTO.class); + AutoScaleVmProfileTO profileTO = Mockito.mock(AutoScaleVmProfileTO.class); + + when(counterDao.findById(counterId)).thenReturn(counterMock); + when(counterMock.getSource()).thenReturn(Counter.Source.CPU); + + Map countersMap = new HashMap<>(); + Map countersNumberMap = new HashMap<>(); + + String key = scaleUpPolicyId + "-" + conditionId + "-" + counterId; + countersMap.put(key, (double) 10); + countersNumberMap.put(key, 1); + + double value = 0.5; + autoScaleManagerImplSpy.updateCountersMapWithInstantData(countersMap, countersNumberMap, + groupTO, counterId, conditionId, scaleUpPolicyId, value, AutoScaleValueType.INSTANT_VM); + + Assert.assertEquals(1, countersMap.size()); + Assert.assertEquals(1, countersNumberMap.size()); + + Assert.assertEquals(60, (double) countersMap.get(key), 0); + Assert.assertEquals(2, (long) countersNumberMap.get(key)); + } + + @Test + public void updateCountersMapWithProcessedData() { + Map countersMap = new HashMap<>(); + Map countersNumberMap = new HashMap<>(); + + String key = scaleUpPolicyId + "-" + conditionId + "-" + counterId; + countersMap.put(key, (double) 10); + countersNumberMap.put(key, 1); + + double value = 20; + + autoScaleManagerImplSpy.updateCountersMapWithProcessedData(countersMap, countersNumberMap, key, value); + + Assert.assertEquals(1, countersMap.size()); + Assert.assertEquals(1, countersNumberMap.size()); + + Assert.assertEquals(30, (double) countersMap.get(key), 0); + Assert.assertEquals(2, (long) countersNumberMap.get(key)); + } + + @Test + public void monitorVirtualRouterAsGroup() { + AutoScaleVmGroupTO groupTO = Mockito.mock(AutoScaleVmGroupTO.class); + + AutoScalePolicyTO scaleUpPolicyTO = Mockito.mock(AutoScalePolicyTO.class); + ConditionTO scaleUpConditionTO = Mockito.mock(ConditionTO.class); + CounterTO scaleUpCounterTO = Mockito.mock(CounterTO.class); + when(scaleUpPolicyTO.getConditions()).thenReturn(Arrays.asList(scaleUpConditionTO)); + when(scaleUpConditionTO.getCounter()).thenReturn(scaleUpCounterTO); + when(scaleUpCounterTO.getSource()).thenReturn(Counter.Source.CPU); + + AutoScalePolicyTO scaleDownPolicyTO = Mockito.mock(AutoScalePolicyTO.class); + ConditionTO scaleDownConditionTO = Mockito.mock(ConditionTO.class); + CounterTO scaleDownCounterTO = Mockito.mock(CounterTO.class); + when(scaleDownPolicyTO.getConditions()).thenReturn(Arrays.asList(scaleDownConditionTO)); + when(scaleDownConditionTO.getCounter()).thenReturn(scaleDownCounterTO); + when(scaleDownCounterTO.getSource()).thenReturn(Counter.Source.VIRTUALROUTER); + + when(groupTO.getPolicies()).thenReturn(Arrays.asList(scaleUpPolicyTO, scaleDownPolicyTO)); + + when(asVmGroupMock.getId()).thenReturn(vmGroupId); + when(asVmGroupMock.getMinMembers()).thenReturn(minMembers); + when(asVmGroupMock.getMaxMembers()).thenReturn(maxMembers); + when(autoScaleVmGroupVmMapDao.countAvailableVmsByGroup(vmGroupId)).thenReturn(minMembers); + when(lbRulesMgr.toAutoScaleVmGroupTO(asVmGroupMock)).thenReturn(groupTO); + + PowerMockito.doNothing().when(autoScaleManagerImplSpy).getVmStatsFromHosts(groupTO); + PowerMockito.doNothing().when(autoScaleManagerImplSpy).getNetworkStatsFromVirtualRouter(groupTO); + + autoScaleManagerImplSpy.monitorVirtualRouterAsGroup(asVmGroupMock); + + Mockito.verify(autoScaleManagerImplSpy).getVmStatsFromHosts(groupTO); + Mockito.verify(autoScaleManagerImplSpy).getNetworkStatsFromVirtualRouter(groupTO); + } + + @Test + public void getVmStatsFromHosts() { + Map> hostAndVmIdsMap = new HashMap<>(); + hostAndVmIdsMap.put(1L, Arrays.asList(2L, 3L)); + hostAndVmIdsMap.put(4L, Arrays.asList(5L, 6L)); + + CounterTO scaleUpCounter = Mockito.mock(CounterTO.class); + CounterTO scaleDownCounter = Mockito.mock(CounterTO.class); + Map> policyCountersMap = new HashMap<>(); + policyCountersMap.put(scaleUpPolicyId, Arrays.asList(scaleUpCounter)); + policyCountersMap.put(scaleDownPolicyId, Arrays.asList(scaleDownCounter)); + + AutoScaleVmGroupTO groupTO = Mockito.mock(AutoScaleVmGroupTO.class); + PowerMockito.doReturn(hostAndVmIdsMap).when(autoScaleManagerImplSpy).getHostAndVmIdsMap(groupTO); + PowerMockito.doReturn(policyCountersMap).when(autoScaleManagerImplSpy).getPolicyCounters(groupTO); + + Map vmStatsById = new HashMap<>(); + PowerMockito.doReturn(vmStatsById).doReturn(vmStatsById).when(autoScaleManagerImplSpy).getVmStatsByIdFromHost(anyLong(), any()); + PowerMockito.doNothing().doNothing().when(autoScaleManagerImplSpy).processVmStatsByIdFromHost(any(), any(), any(), any()); + + autoScaleManagerImplSpy.getVmStatsFromHosts(groupTO); + + Mockito.verify(autoScaleManagerImplSpy, times(2)).getVmStatsByIdFromHost(anyLong(), any()); + Mockito.verify(autoScaleManagerImplSpy, times(2)).processVmStatsByIdFromHost(any(), any(), any(), any()); + } + + @Test + public void getVmStatsByIdFromHost() { + List vmIds = Mockito.mock(ArrayList.class); + HashMap vmStatsById = Mockito.mock(HashMap.class); + when(userVmMgr.getVirtualMachineStatistics(anyLong(), anyString(), any())).thenReturn(vmStatsById); + + Map result = autoScaleManagerImplSpy.getVmStatsByIdFromHost(-1L, vmIds); + + Assert.assertEquals(0, result.size()); + + Mockito.verify(userVmMgr, never()).getVirtualMachineStatistics(anyLong(), anyString(), any()); + } + + @Test + public void getVmStatsByIdFromHost2() { + List vmIds = Mockito.mock(ArrayList.class); + VmStatsEntry vmStats = new VmStatsEntry(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, "vm"); + HashMap vmStatsById = new HashMap<>(); + vmStatsById.put(virtualMachineId, vmStats); + when(hostDao.findById(hostId)).thenReturn(hostMock); + when(hostMock.getId()).thenReturn(hostId); + when(hostMock.getName()).thenReturn(hostName); + when(userVmMgr.getVirtualMachineStatistics(anyLong(), anyString(), any())).thenReturn(vmStatsById); + + Map result = autoScaleManagerImplSpy.getVmStatsByIdFromHost(hostId, vmIds); + + Assert.assertEquals(vmStatsById, result); + + Mockito.verify(userVmMgr).getVirtualMachineStatistics(anyLong(), anyString(), any()); + } + + @Test + public void processVmStatsByIdFromHost() { + AutoScaleVmGroupTO groupTO = Mockito.mock(AutoScaleVmGroupTO.class); + when(groupTO.getId()).thenReturn(vmGroupId); + + List vmIds = Arrays.asList(virtualMachineId); + double cpuUtilization = 6; + double memoryKBs = 3; + Map vmStatsById = new HashMap<>(); + VmStatsEntry vmStats = new VmStatsEntry(virtualMachineId, memoryKBs, 4, 5, + cpuUtilization, 7, 8, 9, + 10, 11, 12, 13, "vm"); + vmStatsById.put(virtualMachineId, vmStats); + + Map> policyCountersMap = new HashMap<>(); + CounterTO counter1 = new CounterTO(counterId, counterName, Counter.Source.CPU, counterValue, counterProvider); + CounterTO counter2 = new CounterTO(counterId + 1, counterName, Counter.Source.MEMORY, counterValue, counterProvider); + CounterTO counter3 = new CounterTO(counterId + 2, counterName, Counter.Source.VIRTUALROUTER, counterValue, counterProvider); + policyCountersMap.put(scaleUpPolicyId, Arrays.asList(counter1, counter2, counter3)); + + when(asGroupStatisticsDao.persist(any())).thenReturn(Mockito.mock(AutoScaleVmGroupStatisticsVO.class)); + autoScaleManagerImplSpy.processVmStatsByIdFromHost(groupTO, vmIds, vmStatsById, policyCountersMap); + + Mockito.verify(asGroupStatisticsDao, times(2)).persist(any()); + } + + @Test + public void getNetworkStatsFromVirtualRouterWithoutRouter() { + AutoScaleVmGroupTO groupTO = Mockito.mock(AutoScaleVmGroupTO.class); + when(groupTO.getLoadBalancerId()).thenReturn(loadBalancerId); + PowerMockito.doReturn(networkMock).when(autoScaleManagerImplSpy).getNetwork(loadBalancerId); + when(networkMock.getId()).thenReturn(networkId); + Pair publicIpAddr = new Pair<>(ipAddress, memberPort); + PowerMockito.doReturn(publicIpAddr).when(autoScaleManagerImplSpy).getPublicIpAndPort(loadBalancerId); + when(routerDao.listByNetworkAndRole(networkId, VirtualRouter.Role.VIRTUAL_ROUTER)).thenReturn(new ArrayList<>()); + PowerMockito.doNothing().when(autoScaleManagerImplSpy).processGetAutoScaleMetricsAnswer(any(), any(), nullable(Long.class)); + + autoScaleManagerImplSpy.getNetworkStatsFromVirtualRouter(groupTO); + + Mockito.verify(autoScaleManagerImplSpy).processGetAutoScaleMetricsAnswer(eq(groupTO), any(), eq(null)); + } + + @Test + public void getNetworkStatsFromVirtualRouterWithOneRouter() { + AutoScaleVmGroupTO groupTO = Mockito.mock(AutoScaleVmGroupTO.class); + when(groupTO.getLoadBalancerId()).thenReturn(loadBalancerId); + PowerMockito.doReturn(networkMock).when(autoScaleManagerImplSpy).getNetwork(loadBalancerId); + when(networkMock.getId()).thenReturn(networkId); + Pair publicIpAddr = new Pair<>(ipAddress, memberPort); + PowerMockito.doReturn(publicIpAddr).when(autoScaleManagerImplSpy).getPublicIpAndPort(loadBalancerId); + when(routerDao.listByNetworkAndRole(networkId, VirtualRouter.Role.VIRTUAL_ROUTER)).thenReturn(Arrays.asList(domainRouterMock)); + when(domainRouterMock.getState()).thenReturn(VirtualMachine.State.Running); + when(domainRouterMock.getId()).thenReturn(domainRouterId); + when(domainRouterMock.getHostId()).thenReturn(hostId); + + List metrics = Mockito.mock(ArrayList.class); + PowerMockito.doReturn(metrics).when(autoScaleManagerImplSpy).setGetAutoScaleMetricsCommandMetrics(groupTO); + GetAutoScaleMetricsCommand command = Mockito.mock(GetAutoScaleMetricsCommand.class); + List values = Mockito.mock(ArrayList.class); + GetAutoScaleMetricsAnswer answer = new GetAutoScaleMetricsAnswer(command, true, values); + when(agentMgr.easySend(eq(hostId), any(GetAutoScaleMetricsCommand.class))).thenReturn(answer); + PowerMockito.doNothing().when(autoScaleManagerImplSpy).processGetAutoScaleMetricsAnswer(any(), any(), nullable(Long.class)); + + autoScaleManagerImplSpy.getNetworkStatsFromVirtualRouter(groupTO); + + Mockito.verify(agentMgr).easySend(eq(hostId), any()); + Mockito.verify(autoScaleManagerImplSpy).processGetAutoScaleMetricsAnswer(groupTO, values, domainRouterId); + } + + @Test + public void setGetAutoScaleMetricsCommandMetrics() { + AutoScaleVmGroupTO groupTO = Mockito.mock(AutoScaleVmGroupTO.class); + + AutoScalePolicyTO scaleUpPolicyTO = Mockito.mock(AutoScalePolicyTO.class); + ConditionTO scaleUpConditionTO = Mockito.mock(ConditionTO.class); + CounterTO scaleUpCounterTO = Mockito.mock(CounterTO.class); + when(scaleUpPolicyTO.getId()).thenReturn(scaleUpPolicyId); + when(scaleUpPolicyTO.getConditions()).thenReturn(Arrays.asList(scaleUpConditionTO)); + when(scaleUpConditionTO.getCounter()).thenReturn(scaleUpCounterTO); + when(scaleUpCounterTO.getSource()).thenReturn(Counter.Source.CPU); + when(scaleUpCounterTO.getProvider()).thenReturn(Network.Provider.VirtualRouter.getName()); + when(scaleUpCounterTO.getValue()).thenReturn(VirtualRouterAutoScaleCounter.NETWORK_RECEIVED_AVERAGE_MBPS.toString()); + + AutoScalePolicyTO scaleDownPolicyTO = Mockito.mock(AutoScalePolicyTO.class); + ConditionTO scaleDownConditionTO = Mockito.mock(ConditionTO.class); + CounterTO scaleDownCounterTO = Mockito.mock(CounterTO.class); + when(scaleDownPolicyTO.getId()).thenReturn(scaleDownPolicyId); + when(scaleDownPolicyTO.getConditions()).thenReturn(Arrays.asList(scaleDownConditionTO)); + when(scaleDownConditionTO.getCounter()).thenReturn(scaleDownCounterTO); + when(scaleDownCounterTO.getSource()).thenReturn(Counter.Source.VIRTUALROUTER); + when(scaleDownCounterTO.getProvider()).thenReturn(Network.Provider.VirtualRouter.getName()); + when(scaleDownCounterTO.getValue()).thenReturn(VirtualRouterAutoScaleCounter.NETWORK_TRANSMIT_AVERAGE_MBPS.toString()); + + when(groupTO.getPolicies()).thenReturn(Arrays.asList(scaleUpPolicyTO, scaleDownPolicyTO)); + + List result = autoScaleManagerImplSpy.setGetAutoScaleMetricsCommandMetrics(groupTO); + + Assert.assertEquals(2, result.size()); + Assert.assertEquals(VirtualRouterAutoScaleCounter.NETWORK_RECEIVED_AVERAGE_MBPS, result.get(0).getCounter()); + Assert.assertEquals(VirtualRouterAutoScaleCounter.NETWORK_TRANSMIT_AVERAGE_MBPS, result.get(1).getCounter()); + } + + @Test + public void processGetAutoScaleMetricsAnswer() { + CounterTO scaleUpCounter = Mockito.mock(CounterTO.class); + CounterTO scaleDownCounter = Mockito.mock(CounterTO.class); + Map> policyCountersMap = new HashMap<>(); + policyCountersMap.put(scaleUpPolicyId, Arrays.asList(scaleUpCounter)); + policyCountersMap.put(scaleDownPolicyId, Arrays.asList(scaleDownCounter)); + + AutoScaleVmGroupTO groupTO = Mockito.mock(AutoScaleVmGroupTO.class); + PowerMockito.doReturn(policyCountersMap).when(autoScaleManagerImplSpy).getPolicyCounters(groupTO); + + when(scaleUpCounter.getSource()).thenReturn(Counter.Source.VIRTUALROUTER); + when(scaleUpCounter.getId()).thenReturn(counterId); + when(scaleDownCounter.getSource()).thenReturn(Counter.Source.VIRTUALROUTER); + when(scaleDownCounter.getId()).thenReturn(counterId); + + List metrics = new ArrayList<>(); + metrics.add(new VirtualRouterAutoScale.AutoScaleMetrics(VirtualRouterAutoScaleCounter.LB_AVERAGE_CONNECTIONS, scaleUpPolicyId, 2L, counterId, 4)); + metrics.add(new VirtualRouterAutoScale.AutoScaleMetrics(VirtualRouterAutoScaleCounter.NETWORK_RECEIVED_AVERAGE_MBPS, scaleUpPolicyId, 2L, counterId, 4)); + metrics.add(new VirtualRouterAutoScale.AutoScaleMetrics(VirtualRouterAutoScaleCounter.NETWORK_TRANSMIT_AVERAGE_MBPS, scaleDownPolicyId, 2L, counterId, 4)); + List values = new ArrayList<>(); + values.add(new VirtualRouterAutoScale.AutoScaleMetricsValue(metrics.get(0), AutoScaleValueType.INSTANT_VM, Double.valueOf(1))); + values.add(new VirtualRouterAutoScale.AutoScaleMetricsValue(metrics.get(1), AutoScaleValueType.INSTANT_VM, Double.valueOf(2))); + values.add(new VirtualRouterAutoScale.AutoScaleMetricsValue(metrics.get(2), AutoScaleValueType.INSTANT_VM, Double.valueOf(3))); + + autoScaleManagerImplSpy.processGetAutoScaleMetricsAnswer(groupTO, values, domainRouterId); + + Mockito.verify(asGroupStatisticsDao, times(2)).persist(any()); + } + + @Test + public void cleanupAsVmGroupStatistics() { + AutoScaleVmGroupTO groupTO = Mockito.mock(AutoScaleVmGroupTO.class); + AutoScalePolicyTO policyTO = Mockito.mock(AutoScalePolicyTO.class); + when(groupTO.getPolicies()).thenReturn(Arrays.asList(policyTO)); + when(groupTO.getId()).thenReturn(vmGroupId); + when(policyTO.getId()).thenReturn(scaleUpPolicyId); + + autoScaleManagerImplSpy.cleanupAsVmGroupStatistics(groupTO); + + Mockito.verify(asGroupStatisticsDao).removeByGroupAndPolicy(eq(vmGroupId), eq(scaleUpPolicyId), any()); + Mockito.verify(asGroupStatisticsDao).removeByGroupId(eq(vmGroupId), any()); + } + + @Test + @PrepareForTest(Executors.class) + public void scheduleMonitorTasks() { + when(autoScaleVmGroupDao.listAll()).thenReturn(Arrays.asList(asVmGroupMock)); + when(asVmGroupMock.getState()).thenReturn(AutoScaleVmGroup.State.ENABLED); + when(asVmGroupMock.getId()).thenReturn(vmGroupId); + when(asVmGroupMock.getInterval()).thenReturn(interval); + + Map vmGroupMonitorMaps = new HashMap<>(); + ReflectionTestUtils.setField(autoScaleManagerImplSpy, "vmGroupMonitorMaps", vmGroupMonitorMaps); + when(autoScaleVmGroupDao.findById(vmGroupId)).thenReturn(asVmGroupMock); + ScheduledExecutorService vmGroupExecutor = Mockito.mock(ScheduledExecutorService.class); + PowerMockito.mockStatic(Executors.class); + when(Executors.newScheduledThreadPool(eq(1), any())).thenReturn(vmGroupExecutor); + + autoScaleManagerImplSpy.scheduleMonitorTasks(); + + Assert.assertEquals(1, vmGroupMonitorMaps.size()); + Assert.assertNotNull(vmGroupMonitorMaps.get(vmGroupId)); + } + + @Test + public void cancelMonitorTask() { + Map vmGroupMonitorMaps = new HashMap<>(); + ScheduledExecutorService vmGroupExecutor = Mockito.mock(ScheduledExecutorService.class); + vmGroupMonitorMaps.put(vmGroupId, vmGroupExecutor); + PowerMockito.doNothing().when(vmGroupExecutor).shutdown(); + + ReflectionTestUtils.setField(autoScaleManagerImplSpy, "vmGroupMonitorMaps", vmGroupMonitorMaps); + + autoScaleManagerImplSpy.cancelMonitorTask(vmGroupId); + + Assert.assertEquals(0, vmGroupMonitorMaps.size()); + } + + @Test + public void checkIfVmActionAllowed() { + when(autoScaleVmGroupVmMapDao.listByVm(virtualMachineId)).thenReturn(Arrays.asList(autoScaleVmGroupVmMapVOMock)); + when(autoScaleVmGroupVmMapVOMock.getVmGroupId()).thenReturn(vmGroupId); + when(autoScaleVmGroupDao.findById(vmGroupId)).thenReturn(asVmGroupMock); + when(asVmGroupMock.getState()).thenReturn(AutoScaleVmGroup.State.DISABLED); + + autoScaleManagerImplSpy.checkIfVmActionAllowed(virtualMachineId); + + Mockito.verify(asVmGroupMock).getState(); + } + + @Test(expected = InvalidParameterValueException.class) + public void checkIfVmActionAllowedFail() { + when(autoScaleVmGroupVmMapDao.listByVm(virtualMachineId)).thenReturn(Arrays.asList(autoScaleVmGroupVmMapVOMock)); + when(autoScaleVmGroupVmMapVOMock.getVmGroupId()).thenReturn(vmGroupId); + when(autoScaleVmGroupDao.findById(vmGroupId)).thenReturn(asVmGroupMock); + when(asVmGroupMock.getState()).thenReturn(AutoScaleVmGroup.State.ENABLED); + + autoScaleManagerImplSpy.checkIfVmActionAllowed(virtualMachineId); + } + + @Test + public void destroyVm() { + when(userVmDao.findById(virtualMachineId)).thenReturn(userVmMock); + PowerMockito.doReturn(true).when(userVmMgr).expunge(eq(userVmMock)); + + autoScaleManagerImplSpy.destroyVm(virtualMachineId); + + Mockito.verify(userVmMgr).expunge(eq(userVmMock)); + } +} diff --git a/server/src/test/java/com/cloud/network/as/AutoScaleManagerTest.java b/server/src/test/java/com/cloud/network/as/AutoScaleManagerTest.java new file mode 100644 index 000000000000..d89e057d1696 --- /dev/null +++ b/server/src/test/java/com/cloud/network/as/AutoScaleManagerTest.java @@ -0,0 +1,61 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.network.as; + +import org.apache.cloudstack.framework.config.ConfigKey; +import org.junit.Assert; +import org.junit.Test; +import org.mockito.Mockito; + +public class AutoScaleManagerTest { + + @Test + public void testAutoScaleStatsInterval() { + AutoScaleManager asManager = Mockito.mock(AutoScaleManager.class); + + ConfigKey config = asManager.AutoScaleStatsInterval; + Assert.assertEquals("Advanced", config.category()); + Assert.assertEquals(Integer.class, config.type()); + Assert.assertEquals("autoscale.stats.interval", config.key()); + Assert.assertEquals("60", config.defaultValue()); + Assert.assertFalse(config.isDynamic()); + } + + @Test + public void testAutoScaleStatsCleanupDelay() { + AutoScaleManager asManager = Mockito.mock(AutoScaleManager.class); + + ConfigKey config = asManager.AutoScaleStatsCleanupDelay; + Assert.assertEquals("Advanced", config.category()); + Assert.assertEquals(Integer.class, config.type()); + Assert.assertEquals("autoscale.stats.cleanup.delay", config.key()); + Assert.assertEquals("7200", config.defaultValue()); + Assert.assertFalse(config.isDynamic()); + } + + @Test + public void testAutoScaleStatsWorker() { + AutoScaleManager asManager = Mockito.mock(AutoScaleManager.class); + + ConfigKey config = asManager.AutoScaleStatsWorker; + Assert.assertEquals("Advanced", config.category()); + Assert.assertEquals(Integer.class, config.type()); + Assert.assertEquals("autoscale.stats.worker", config.key()); + Assert.assertEquals("10", config.defaultValue()); + Assert.assertFalse(config.isDynamic()); + } +} \ No newline at end of file diff --git a/server/src/test/java/com/cloud/network/element/VirtualRouterElementTest.java b/server/src/test/java/com/cloud/network/element/VirtualRouterElementTest.java index 592332b5cec3..0fb8020b01c3 100644 --- a/server/src/test/java/com/cloud/network/element/VirtualRouterElementTest.java +++ b/server/src/test/java/com/cloud/network/element/VirtualRouterElementTest.java @@ -16,6 +16,7 @@ // under the License. package com.cloud.network.element; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyBoolean; @@ -27,7 +28,10 @@ import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; +import com.cloud.network.as.AutoScaleCounter; +import com.cloud.network.as.AutoScaleCounter.AutoScaleCounterType; import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; import org.apache.cloudstack.framework.config.dao.ConfigurationDao; import org.apache.cloudstack.network.router.deployment.RouterDeploymentDefinitionBuilder; @@ -501,4 +505,17 @@ public void testAddPasswordAndUserdata() throws Exception { assertTrue(virtualRouterElement.addPasswordAndUserdata(network, nic, vm, dest, context)); } + + @Test + public void verifyAutoScaleCounters() { + final List counterList = VirtualRouterElement.getAutoScaleCounters(); + assertEquals(3, counterList.size()); + + List counterNames = counterList.stream().map(counter -> counter.getName()).collect(Collectors.toList()); + + assertEquals(3, counterNames.size()); + assertTrue(counterNames.contains(AutoScaleCounterType.Cpu.getName())); + assertTrue(counterNames.contains(AutoScaleCounterType.Memory.getName())); + assertTrue(counterNames.contains(AutoScaleCounterType.VirtualRouter.getName())); + } } diff --git a/server/src/test/java/com/cloud/network/lb/AssignLoadBalancerTest.java b/server/src/test/java/com/cloud/network/lb/AssignLoadBalancerTest.java index 060f2e1a5fdc..12affd274ea6 100644 --- a/server/src/test/java/com/cloud/network/lb/AssignLoadBalancerTest.java +++ b/server/src/test/java/com/cloud/network/lb/AssignLoadBalancerTest.java @@ -24,6 +24,7 @@ import com.cloud.hypervisor.Hypervisor; import com.cloud.network.Network; import com.cloud.network.NetworkModelImpl; +import com.cloud.network.as.dao.AutoScaleVmGroupDao; import com.cloud.network.dao.LoadBalancerDao; import com.cloud.network.dao.LoadBalancerVMMapDao; import com.cloud.network.dao.LoadBalancerVMMapVO; @@ -139,9 +140,13 @@ public void testBothArgsEmpty() throws ResourceAllocationException, ResourceUnav LoadBalancerDao lbdao = Mockito.mock(LoadBalancerDao.class); _lbMgr._lbDao = lbdao; + AutoScaleVmGroupDao autoScaleVmGroupDao = Mockito.mock(AutoScaleVmGroupDao.class); + _lbMgr._autoScaleVmGroupDao = autoScaleVmGroupDao; + when(lbdao.findById(anyLong())).thenReturn(Mockito.mock(LoadBalancerVO.class)); + when(autoScaleVmGroupDao.isAutoScaleLoadBalancer(anyLong())).thenReturn(Boolean.FALSE); - _lbMgr.assignToLoadBalancer(1L, null, emptyMap); + _lbMgr.assignToLoadBalancer(1L, null, emptyMap, false); } @@ -165,6 +170,7 @@ public void testNicIsNotInNw() throws ResourceAllocationException, ResourceUnava AccountDao accountDao = Mockito.mock(AccountDao.class); NetworkDao networkDao = Mockito.mock(NetworkDao.class); AccountManager accountMgr = Mockito.mock(AccountManager.class); + AutoScaleVmGroupDao autoScaleVmGroupDao = Mockito.mock(AutoScaleVmGroupDao.class); _lbMgr._lbDao = lbDao; _lbMgr._lb2VmMapDao = lb2VmMapDao; @@ -175,14 +181,16 @@ public void testNicIsNotInNw() throws ResourceAllocationException, ResourceUnava _lbvmMapList = new ArrayList<>(); _lbMgr._rulesMgr = _rulesMgr; _lbMgr._networkModel = _networkModel; + _lbMgr._autoScaleVmGroupDao = autoScaleVmGroupDao; when(lbDao.findById(anyLong())).thenReturn(Mockito.mock(LoadBalancerVO.class)); when(userVmDao.findById(anyLong())).thenReturn(vm); when(lb2VmMapDao.listByLoadBalancerId(anyLong(), anyBoolean())).thenReturn(_lbvmMapList); when(accountDao.findById(anyLong())).thenReturn(Mockito.mock(AccountVO.class)); Mockito.doNothing().when(accountMgr).checkAccess(any(Account.class), any(SecurityChecker.AccessType.class), any(Boolean.class), any(Network.class)); + when(autoScaleVmGroupDao.isAutoScaleLoadBalancer(anyLong())).thenReturn(Boolean.FALSE); - _lbMgr.assignToLoadBalancer(1L, null, vmIdIpMap); + _lbMgr.assignToLoadBalancer(1L, null, vmIdIpMap, false); } @@ -209,6 +217,7 @@ public void tesSecIpNotSetToVm() throws ResourceAllocationException, ResourceUna NetworkDao networkDao = Mockito.mock(NetworkDao.class); AccountManager accountMgr = Mockito.mock(AccountManager.class); NicSecondaryIpDao nicSecIpDao = Mockito.mock(NicSecondaryIpDao.class); + AutoScaleVmGroupDao autoScaleVmGroupDao = Mockito.mock(AutoScaleVmGroupDao.class); _lbMgr._lbDao = lbDao; _lbMgr._lb2VmMapDao = lb2VmMapDao; @@ -220,13 +229,15 @@ public void tesSecIpNotSetToVm() throws ResourceAllocationException, ResourceUna _lbvmMapList = new ArrayList<>(); _lbMgr._rulesMgr = _rulesMgr; _lbMgr._networkModel = _networkModel; + _lbMgr._autoScaleVmGroupDao = autoScaleVmGroupDao; when(lbDao.findById(anyLong())).thenReturn(lbVO); when(userVmDao.findById(anyLong())).thenReturn(vm); when(lb2VmMapDao.listByLoadBalancerId(anyLong(), anyBoolean())).thenReturn(_lbvmMapList); when (nicSecIpDao.findByIp4AddressAndNicId(anyString(), anyLong())).thenReturn(null); + when(autoScaleVmGroupDao.isAutoScaleLoadBalancer(anyLong())).thenReturn(Boolean.FALSE); - _lbMgr.assignToLoadBalancer(1L, null, vmIdIpMap); + _lbMgr.assignToLoadBalancer(1L, null, vmIdIpMap, false); } @@ -255,6 +266,7 @@ public void testVmIdAlreadyExist() throws ResourceAllocationException, ResourceU NetworkDao networkDao = Mockito.mock(NetworkDao.class); NicSecondaryIpDao nicSecIpDao = Mockito.mock(NicSecondaryIpDao.class); LoadBalancerVMMapVO lbVmMapVO = new LoadBalancerVMMapVO(1L, 1L, "10.1.1.175", false); + AutoScaleVmGroupDao autoScaleVmGroupDao = Mockito.mock(AutoScaleVmGroupDao.class); _lbMgr._lbDao = lbDao; _lbMgr._lb2VmMapDao = lb2VmMapDao; @@ -267,13 +279,15 @@ public void testVmIdAlreadyExist() throws ResourceAllocationException, ResourceU _lbvmMapList.add(lbVmMapVO); _lbMgr._rulesMgr = _rulesMgr; _lbMgr._networkModel = _networkModel; + _lbMgr._autoScaleVmGroupDao = autoScaleVmGroupDao; when(lbDao.findById(anyLong())).thenReturn(lbVO); when(userVmDao.findById(anyLong())).thenReturn(vm); when(lb2VmMapDao.listByLoadBalancerId(anyLong(), anyBoolean())).thenReturn(_lbvmMapList); when (nicSecIpDao.findByIp4AddressAndNicId(anyString(), anyLong())).thenReturn(null); + when(autoScaleVmGroupDao.isAutoScaleLoadBalancer(anyLong())).thenReturn(Boolean.FALSE); - _lbMgr.assignToLoadBalancer(1L, null, vmIdIpMap); + _lbMgr.assignToLoadBalancer(1L, null, vmIdIpMap, false); } @After @@ -281,4 +295,4 @@ public void tearDown() { CallContext.unregister(); } -} \ No newline at end of file +} diff --git a/server/src/test/java/com/cloud/network/lb/LoadBalancingRulesManagerImplTest.java b/server/src/test/java/com/cloud/network/lb/LoadBalancingRulesManagerImplTest.java index d5789c016932..184c853637b6 100644 --- a/server/src/test/java/com/cloud/network/lb/LoadBalancingRulesManagerImplTest.java +++ b/server/src/test/java/com/cloud/network/lb/LoadBalancingRulesManagerImplTest.java @@ -17,25 +17,49 @@ package com.cloud.network.lb; +import com.cloud.network.Network; +import com.cloud.network.dao.LoadBalancerVO; +import com.cloud.network.dao.NetworkDao; +import com.cloud.network.dao.NetworkVO; +import com.cloud.utils.exception.CloudRuntimeException; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; import org.junit.Assert; import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import static org.mockito.Mockito.when; + +@RunWith(MockitoJUnitRunner.class) public class LoadBalancingRulesManagerImplTest{ + @Mock + NetworkDao _networkDao; + + @Mock + NetworkOrchestrationService _networkMgr; + + @Spy + @InjectMocks + LoadBalancingRulesManagerImpl lbr = new LoadBalancingRulesManagerImpl(); + @Test public void generateCidrStringTestNullCidrList() { - LoadBalancingRulesManagerImpl lbr = new LoadBalancingRulesManagerImpl(); String result = lbr.generateCidrString(null); Assert.assertNull(result); } @Test public void generateCidrStringTestWithCidrList() { - LoadBalancingRulesManagerImpl lbr = new LoadBalancingRulesManagerImpl(); List cidrList = new ArrayList<>(); cidrList.add("1.1.1.1"); cidrList.add("2.2.2.2/24"); @@ -45,11 +69,36 @@ public void generateCidrStringTestWithCidrList() { @Test (expected = ServerApiException.class) public void generateCidrStringTestWithInvalidCidrList() { - LoadBalancingRulesManagerImpl lbr = new LoadBalancingRulesManagerImpl(); List cidrList = new ArrayList<>(); cidrList.add("1.1"); cidrList.add("2.2.2.2/24"); String result = lbr.generateCidrString(cidrList); Assert.assertEquals("1.1.1.1 2.2.2.2/24", result); } + + @Test + public void testGetLoadBalancerServiceProvider() { + LoadBalancerVO loadBalancerMock = Mockito.mock(LoadBalancerVO.class); + NetworkVO networkMock = Mockito.mock(NetworkVO.class); + List providers = Arrays.asList(Network.Provider.VirtualRouter); + + when(loadBalancerMock.getNetworkId()).thenReturn(10L); + when(_networkDao.findById(Mockito.anyLong())).thenReturn(networkMock); + when(_networkMgr.getProvidersForServiceInNetwork(networkMock, Network.Service.Lb)).thenReturn(providers); + + Network.Provider provider = lbr.getLoadBalancerServiceProvider(loadBalancerMock); + + Assert.assertEquals(Network.Provider.VirtualRouter, provider); + } + + @Test(expected = CloudRuntimeException.class) + public void testGetLoadBalancerServiceProviderFail() { + LoadBalancerVO loadBalancerMock = Mockito.mock(LoadBalancerVO.class); + NetworkVO networkMock = Mockito.mock(NetworkVO.class); + + when(_networkDao.findById(Mockito.any())).thenReturn(networkMock); + when(_networkMgr.getProvidersForServiceInNetwork(networkMock, Network.Service.Lb)).thenReturn(new ArrayList<>()); + + Network.Provider provider = lbr.getLoadBalancerServiceProvider(loadBalancerMock); + } } diff --git a/server/src/test/java/com/cloud/user/AccountManagerImplTest.java b/server/src/test/java/com/cloud/user/AccountManagerImplTest.java index b695e512a6a9..2484ead3df4e 100644 --- a/server/src/test/java/com/cloud/user/AccountManagerImplTest.java +++ b/server/src/test/java/com/cloud/user/AccountManagerImplTest.java @@ -141,6 +141,7 @@ public void deleteUserAccount() { Mockito.lenient().when(_domainMgr.getDomain(Mockito.anyLong())).thenReturn(domain); Mockito.lenient().when(securityChecker.checkAccess(Mockito.any(Account.class), Mockito.any(Domain.class))).thenReturn(true); Mockito.when(_vmSnapshotDao.listByAccountId(Mockito.anyLong())).thenReturn(new ArrayList()); + Mockito.when(_autoscaleMgr.deleteAutoScaleVmGroupsByAccount(42l)).thenReturn(true); List sshkeyList = new ArrayList(); SSHKeyPairVO sshkey = new SSHKeyPairVO(); @@ -164,7 +165,7 @@ public void deleteUserAccountCleanup() { Mockito.when(_accountDao.remove(42l)).thenReturn(true); Mockito.when(_configMgr.releaseAccountSpecificVirtualRanges(42l)).thenReturn(true); Mockito.when(_userVmDao.listByAccountId(42l)).thenReturn(Arrays.asList(Mockito.mock(UserVmVO.class))); - Mockito.when(_vmMgr.expunge(Mockito.any(UserVmVO.class), Mockito.anyLong(), Mockito.any(Account.class))).thenReturn(false); + Mockito.when(_vmMgr.expunge(Mockito.any(UserVmVO.class))).thenReturn(false); Mockito.lenient().when(_domainMgr.getDomain(Mockito.anyLong())).thenReturn(domain); Mockito.lenient().when(securityChecker.checkAccess(Mockito.any(Account.class), Mockito.any(Domain.class))).thenReturn(true); diff --git a/server/src/test/java/com/cloud/user/AccountManagerImplVolumeDeleteEventTest.java b/server/src/test/java/com/cloud/user/AccountManagerImplVolumeDeleteEventTest.java index 5b4c15463950..278703954874 100644 --- a/server/src/test/java/com/cloud/user/AccountManagerImplVolumeDeleteEventTest.java +++ b/server/src/test/java/com/cloud/user/AccountManagerImplVolumeDeleteEventTest.java @@ -18,7 +18,6 @@ import static org.mockito.ArgumentMatchers.nullable; import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyLong; import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -126,7 +125,7 @@ protected void defineMocksBehavior() throws AgentUnavailableException, Concurren VirtualMachineEntity vmEntity = mock(VirtualMachineEntity.class); when(_orchSrvc.getVirtualMachine(nullable(String.class))).thenReturn(vmEntity); - when(vmEntity.destroy(nullable(String.class), nullable(Boolean.class))).thenReturn(true); + when(vmEntity.destroy(nullable(Boolean.class))).thenReturn(true); Mockito.lenient().doReturn(vm).when(_vmDao).findById(nullable(Long.class)); @@ -153,7 +152,7 @@ protected void defineMocksBehavior() throws AgentUnavailableException, Concurren lenient().when(_domainMgr.getDomain(nullable(Long.class))).thenReturn(domain); - Mockito.lenient().doReturn(true).when(_vmMgr).expunge(any(UserVmVO.class), anyLong(), any(Account.class)); + Mockito.lenient().doReturn(true).when(_vmMgr).expunge(any(UserVmVO.class)); } diff --git a/systemvm/debian/etc/haproxy/haproxy.cfg b/systemvm/debian/etc/haproxy/haproxy.cfg index 63da1ea694dd..21964f297c25 100644 --- a/systemvm/debian/etc/haproxy/haproxy.cfg +++ b/systemvm/debian/etc/haproxy/haproxy.cfg @@ -16,7 +16,7 @@ defaults stats uri /admin?stats stats realm Haproxy\ Statistics stats auth admin1:AdMiN123 - option forceclose + option httpclose timeout connect 5000 timeout client 50000 timeout server 50000 diff --git a/systemvm/debian/opt/cloud/bin/cs/CsAddress.py b/systemvm/debian/opt/cloud/bin/cs/CsAddress.py index 058075edaf10..c6aeb9b58cef 100755 --- a/systemvm/debian/opt/cloud/bin/cs/CsAddress.py +++ b/systemvm/debian/opt/cloud/bin/cs/CsAddress.py @@ -430,6 +430,20 @@ def fw_router(self): "-I VPN_%s -m state --state RELATED,ESTABLISHED -j ACCEPT" % self.address['public_ip']]) self.fw.append(["mangle", "", "-A VPN_%s -j RETURN" % self.address['public_ip']]) + self.fw.append( + ["", "front", "-A FORWARD -j NETWORK_STATS_%s" % self.dev]) + self.fw.append( + ["", "front", "-A INPUT -j NETWORK_STATS_%s" % self.dev]) + self.fw.append( + ["", "front", "-A OUTPUT -j NETWORK_STATS_%s" % self.dev]) + self.fw.append( + ["", "", "-A NETWORK_STATS_%s -i eth0 -o %s" % (self.dev, self.dev)]) + self.fw.append( + ["", "", "-A NETWORK_STATS_%s -i %s -o eth0" % (self.dev, self.dev)]) + self.fw.append( + ["", "", "-A NETWORK_STATS_%s -o %s ! -i eth0 -p tcp" % (self.dev, self.dev)]) + self.fw.append( + ["", "", "-A NETWORK_STATS_%s -i %s ! -o eth0 -p tcp" % (self.dev, self.dev)]) self.fw.append(["nat", "", "-A POSTROUTING -o %s -j SNAT --to-source %s" % (self.dev, self.cl.get_eth2_ip())]) self.fw.append(["mangle", "", @@ -556,18 +570,17 @@ def fw_vpcrouter(self): self.fw.append( ["", "front", "-A FORWARD -j NETWORK_STATS_%s" % self.dev]) self.fw.append( - ["", "front", "-A NETWORK_STATS_%s -s %s -o %s" % (self.dev, self.cl.get_vpccidr(), self.dev)]) + ["", "front", "-A INPUT -j NETWORK_STATS_%s" % self.dev]) self.fw.append( - ["", "front", "-A NETWORK_STATS_%s -d %s -i %s" % (self.dev, self.cl.get_vpccidr(), self.dev)]) - - self.fw.append(["", "front", "-A FORWARD -j NETWORK_STATS"]) - self.fw.append(["", "front", "-A INPUT -j NETWORK_STATS"]) - self.fw.append(["", "front", "-A OUTPUT -j NETWORK_STATS"]) - - self.fw.append(["", "", "-A NETWORK_STATS -i eth0 -o eth2 -p tcp"]) - self.fw.append(["", "", "-A NETWORK_STATS -i eth2 -o eth0 -p tcp"]) - self.fw.append(["", "", "-A NETWORK_STATS ! -i eth0 -o eth2 -p tcp"]) - self.fw.append(["", "", "-A NETWORK_STATS -i eth2 ! -o eth0 -p tcp"]) + ["", "front", "-A OUTPUT -j NETWORK_STATS_%s" % self.dev]) + self.fw.append( + ["", "", "-A NETWORK_STATS_%s -s %s -o %s" % (self.dev, self.cl.get_vpccidr(), self.dev)]) + self.fw.append( + ["", "", "-A NETWORK_STATS_%s -d %s -i %s" % (self.dev, self.cl.get_vpccidr(), self.dev)]) + self.fw.append( + ["", "", "-A NETWORK_STATS_%s ! -s %s -o %s -p tcp" % (self.dev, self.cl.get_vpccidr(), self.dev)]) + self.fw.append( + ["", "", "-A NETWORK_STATS_%s ! -d %s -i %s -p tcp" % (self.dev, self.cl.get_vpccidr(), self.dev)]) self.fw.append(["filter", "", "-A INPUT -d 224.0.0.18/32 -j ACCEPT"]) self.fw.append(["filter", "", "-A INPUT -d 225.0.0.50/32 -j ACCEPT"]) diff --git a/systemvm/debian/opt/cloud/bin/get_haproxy_stats.sh b/systemvm/debian/opt/cloud/bin/get_haproxy_stats.sh new file mode 100755 index 000000000000..9a3213e5b740 --- /dev/null +++ b/systemvm/debian/opt/cloud/bin/get_haproxy_stats.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +publicIp=$1 +port=$2 + +poolName=$(echo $publicIp-$port | tr "." "_") + +# read "scur" from haproxy stats socket. The values are +# pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,wretr,wredis,status,weight,act,bck,chkfail,chkdown,lastchg,downtime,qlimit,pid,iid,sid,throttle,lbtot,tracked,type,rate,rate_lim,rate_max,check_status,check_code,check_duration,hrsp_1xx,hrsp_2xx,hrsp_3xx,hrsp_4xx,hrsp_5xx,hrsp_other,hanafail,req_rate,req_rate_max,req_tot,cli_abrt,srv_abrt,comp_in,comp_out,comp_byp,comp_rsp,lastsess,last_chk,last_agt,qtime,ctime,rtime,ttime,agent_status,agent_code,agent_duration,check_desc,agent_desc,check_rise,check_fall,check_health,agent_rise,agent_fall,agent_health,addr,cookie,mode,algo,conn_rate,conn_rate_max,conn_tot,intercepted,dcon,dses,wrew,connect,reuse,cache_lookups,cache_hits,srv_icur,src_ilim,qtime_max,ctime_max,rtime_max,ttime_max,eint,idle_conn_cur,safe_conn_cur,used_conn_cur,need_conn_est, + +current_sessions=$(echo "show stat" | socat stdio unix-connect:/run/haproxy/admin.sock | grep "^$poolName,$poolName" | cut -d "," -f5,18) + +sum=0 +count=0 +for session in $current_sessions;do + stat=$(echo $session |cut -d "," -f1) + state=$(echo $session |cut -d "," -f2) + if [ "$state" = "UP" ];then + sum=$((sum+stat)) + count=$((count+1)) + fi +done + +average=0 +if [[ $count -gt 0 ]];then + average=$((sum/count)) +fi + +echo -n $average diff --git a/systemvm/debian/opt/cloud/bin/netusage.sh b/systemvm/debian/opt/cloud/bin/netusage.sh index 5e20b0c4d9e1..54d76ae1a9e6 100755 --- a/systemvm/debian/opt/cloud/bin/netusage.sh +++ b/systemvm/debian/opt/cloud/bin/netusage.sh @@ -21,6 +21,7 @@ # netusage.sh -- create iptable rules to gather network stats, running within DomR source /root/func.sh +source /opt/cloud/bin/vpc_func.sh lock="biglock" locked=$(getLockFile $lock) @@ -30,7 +31,7 @@ then fi usage() { - printf "Usage: %s -[c|g|r] [-[a|d] ]\n" $(basename $0) >&2 + printf "Usage: %s -[c|g|r] [-[a|d] ] [-l] \n" $(basename $0) >&2 } create_usage_rules () { @@ -71,7 +72,13 @@ delete_public_interface () { } get_usage () { - iptables -L NETWORK_STATS -n -v -x | awk '$1 ~ /^[0-9]+$/ { printf "%s:", $2}'; > /dev/null + if [ $1 ];then + chain=NETWORK_STATS_$1 + else + chain=NETWORK_STATS + fi + iptables -L $chain -n -v -x | awk '$1 ~ /^[0-9]+$/ { printf "%s:", $2}'; > /dev/null + # The following code are NOT in use any more if [ -f /root/removedVifs ] ; then iptables -Z NETWORK_STATS ; fi; > /dev/null /root/clearUsageRules.sh > /dev/null if [ $? -gt 0 -a $? -ne 2 ] @@ -94,11 +101,12 @@ reset_usage () { cflag= gflag= rflag= +lflag= iflag= aflag= dflag= -while getopts 'cgria:d:' OPTION +while getopts 'cgria:d:l:' OPTION do case $OPTION in c) cflag=1 @@ -107,6 +115,9 @@ do ;; r) rflag=1 ;; + l) lflag=1 + publicIp="$OPTARG" + ;; a) aflag=1 publicIf="$OPTARG" ;; @@ -129,7 +140,14 @@ fi if [ "$gflag" == "1" ] then - get_usage + if [ "$lflag" == "1" ] + then + #get usage of a specific public interface + ethDev=$(getEthByIp $publicIp) + get_usage $ethDev + else + get_usage + fi unlock_exit $? $lock $locked fi diff --git a/systemvm/debian/opt/cloud/bin/vpc_netusage.sh b/systemvm/debian/opt/cloud/bin/vpc_netusage.sh index 5f5dc3ed0802..03ad3834e7f9 100755 --- a/systemvm/debian/opt/cloud/bin/vpc_netusage.sh +++ b/systemvm/debian/opt/cloud/bin/vpc_netusage.sh @@ -124,8 +124,6 @@ if [ "$cflag" == "1" ] then if [ "$ethDev" != "" ] then - create_usage_rules - create_vpn_usage_rules unlock_exit 0 $lock $locked fi fi diff --git a/test/integration/component/test_escalations_ipaddresses.py b/test/integration/component/test_escalations_ipaddresses.py index 54e86cd8b0ab..fbcff2a5fd0b 100644 --- a/test/integration/component/test_escalations_ipaddresses.py +++ b/test/integration/component/test_escalations_ipaddresses.py @@ -3730,7 +3730,7 @@ def test_18_create_update_autoscaleprofiles(self): Step13: Listing Autoscale VM Profile by id Step14: Verifying details of the created autoscale vm profile are matching with listed autoscal vm profile - Step15: Updating Autoscale VM profile with destroy vm grace period + Step15: Updating Autoscale VM profile with expunge vm grace period Step16: Verifying that Autoscale VM is updated """ if self.hypervisor.lower() == 'kvm': @@ -3943,7 +3943,7 @@ def test_18_create_update_autoscaleprofiles(self): zoneid=self.zone.id, templateid=list_templates_featured[0].id, autoscaleuserid=list_users[0].id, - destroyvmgraceperiod='100', + expungevmgraceperiod='100', counterparam=counterparam ) self.assertIsNotNone( @@ -3989,8 +3989,8 @@ def test_18_create_update_autoscaleprofiles(self): "serviceofferingid": list_service_offerings[0].id, "zoneid": self.zone.id, "templateid": list_templates_featured[0].id, - "destroyvmgraceperiod": - autoscalevm_profile.destroyvmgraceperiod} + "expungevmgraceperiod": + autoscalevm_profile.expungevmgraceperiod} actual_dict = { "id": list_autoscalvmprofile[0].id, "account": list_autoscalvmprofile[0].account, @@ -4001,8 +4001,8 @@ def test_18_create_update_autoscaleprofiles(self): list_autoscalvmprofile[0].serviceofferingid, "zoneid": list_autoscalvmprofile[0].zoneid, "templateid": list_autoscalvmprofile[0].templateid, - "destroyvmgraceperiod": - list_autoscalvmprofile[0].destroyvmgraceperiod} + "expungevmgraceperiod": + list_autoscalvmprofile[0].expungevmgraceperiod} autoscalevm_profile_status = self.__verify_values( expected_dict, actual_dict @@ -4017,19 +4017,19 @@ def test_18_create_update_autoscaleprofiles(self): self.userapiclient, id=autoscalevm_profile.id, autoscaleuserid=list_users[0].id, - destroyvmgraceperiod='200', + expungevmgraceperiod='200', templateid=list_templates_featured[0].id, ) self.assertIsNotNone( autoscalevm_profile_updated, "Failed to update Autoscale VM Profile" ) - # Verifyign that Destroy VM Graceperiod is updated in autoscale VM + # Verifyign that Expunge VM Grace period is updated in autoscale VM # Profile self.assertEqual( 200, - autoscalevm_profile_updated.destroyvmgraceperiod, - "Failed to update destroy vm grace period" + autoscalevm_profile_updated.expungevmgraceperiod, + "Failed to update expunge vm grace period" ) # Destroying the VM vm_created.delete(self.apiClient) @@ -4267,7 +4267,7 @@ def test_19_create_update_autoscalevmgroup(self): zoneid=self.zone.id, templateid=self.template.id, autoscaleuserid=list_users[0].id, - destroyvmgraceperiod='30', + expungevmgraceperiod='30', counterparam=counterparam ) self.assertIsNotNone( diff --git a/test/integration/smoke/test_deploy_vm_root_resize.py b/test/integration/smoke/test_deploy_vm_root_resize.py index b71276f5377a..1ef5d7d6ea69 100644 --- a/test/integration/smoke/test_deploy_vm_root_resize.py +++ b/test/integration/smoke/test_deploy_vm_root_resize.py @@ -386,7 +386,7 @@ def test_02_deploy_vm_root_resize(self): rootdisksize=newrootsize ) except Exception as ex: - if "rootdisksize override is smaller than template size" in str(ex): + if "rootdisksize override (" + str(newrootsize) + " GB) is smaller than template size" in str(ex): success = True else: self.debug("Virtual machine create did not fail appropriately. Error was actually : " + str(ex)); diff --git a/test/integration/smoke/test_vm_autoscaling.py b/test/integration/smoke/test_vm_autoscaling.py new file mode 100644 index 000000000000..6dc7a0755d0f --- /dev/null +++ b/test/integration/smoke/test_vm_autoscaling.py @@ -0,0 +1,1103 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +""" +Tests of VM Autoscaling +""" + +import logging +import time +import datetime + +from nose.plugins.attrib import attr +from marvin.cloudstackTestCase import cloudstackTestCase +from marvin.cloudstackAPI import stopVirtualMachine + +from marvin.lib.base import (Account, + Autoscale, + AutoScaleCondition, + AutoScalePolicy, + AutoScaleVmProfile, + AutoScaleVmGroup, + Configurations, + DiskOffering, + Domain, + Project, + ServiceOffering, + VirtualMachine, + Volume, + Zone, + Network, + NetworkOffering, + PublicIPAddress, + LoadBalancerRule, + VPC, + VpcOffering, + SSHKeyPair) + +from marvin.lib.common import (get_domain, + get_zone, + get_template) +from marvin.lib.utils import wait_until + +MIN_MEMBER = 1 +MAX_MEMBER = 2 +DEFAULT_EXPUNGE_VM_GRACE_PERIOD = 60 +DEFAULT_DURATION = 120 +DEFAULT_INTERVAL = 30 +DEFAULT_QUIETTIME = 60 +NAME_PREFIX = "AS-VmGroup-" + +CONFIG_NAME_DISK_CONTROLLER = "vmware.root.disk.controller" +OS_DEFAULT = "osdefault" + +class TestVmAutoScaling(cloudstackTestCase): + """ + Test VM autoscaling + """ + @classmethod + def setUpClass(cls): + cls.testClient = super( + TestVmAutoScaling, + cls).getClsTestClient() + cls.apiclient = cls.testClient.getApiClient() + cls.services = cls.testClient.getParsedTestDataConfig() + + cls.initial_vmware_root_disk_controller = Configurations.list( + cls.apiclient, + name=CONFIG_NAME_DISK_CONTROLLER)[0].value + Configurations.update(cls.apiclient, + CONFIG_NAME_DISK_CONTROLLER, + OS_DEFAULT) + + cls.hypervisor = cls.testClient.getHypervisorInfo() + zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests()) + cls.zone = Zone(zone.__dict__) + cls.template = get_template(cls.apiclient, cls.zone.id) + cls.templatesize = int(cls.template.size / (1024 ** 3)) + cls._cleanup = [] + + cls.logger = logging.getLogger("TestVmAutoScaling") + cls.stream_handler = logging.StreamHandler() + cls.logger.setLevel(logging.DEBUG) + cls.logger.addHandler(cls.stream_handler) + + cls.domain = get_domain(cls.apiclient) + + # 1. Create small service offering + cls.service_offering = ServiceOffering.create( + cls.apiclient, + cls.services["service_offerings"]["small"] + ) + cls._cleanup.append(cls.service_offering) + + cls.service_offering_new = ServiceOffering.create( + cls.apiclient, + cls.services["service_offerings"]["small"] + ) + cls._cleanup.append(cls.service_offering_new) + + # 2. Create disk offerings (fixed and custom) + cls.disk_offering_override = DiskOffering.create( + cls.apiclient, + cls.services["disk_offering"], + disksize=cls.templatesize + 1 + ) + cls._cleanup.append(cls.disk_offering_override) + + cls.disk_offering_custom = DiskOffering.create( + cls.apiclient, + cls.services["disk_offering"], + custom=True + ) + cls._cleanup.append(cls.disk_offering_custom) + + cls.disk_offering_custom_new = DiskOffering.create( + cls.apiclient, + cls.services["disk_offering"], + custom=True + ) + cls._cleanup.append(cls.disk_offering_custom_new) + + # 3. Create network offering for isolated networks + cls.services["isolated_network_offering"]["serviceCapabilityList"] = { + "Lb": { + "SupportedLbIsolation": 'dedicated', + "VmAutoScaling": 'true' + }, + } + cls.network_offering_isolated = NetworkOffering.create( + cls.apiclient, + cls.services["isolated_network_offering"] + ) + cls.network_offering_isolated.update(cls.apiclient, state='Enabled') + cls._cleanup.append(cls.network_offering_isolated) + + # 4. Create sub-domain + cls.sub_domain = Domain.create( + cls.apiclient, + cls.services["acl"]["domain1"] + ) + cls._cleanup.append(cls.sub_domain) + + # 5. Create regular user + cls.regular_user = Account.create( + cls.apiclient, + cls.services["acl"]["accountD11A"], + domainid=cls.sub_domain.id + ) + cls._cleanup.append(cls.regular_user) + + # 5. Create api clients for regular user + cls.regular_user_user = cls.regular_user.user[0] + cls.regular_user_apiclient = cls.testClient.getUserApiClient( + cls.regular_user_user.username, cls.sub_domain.name + ) + + # 7. Create networks for regular user + cls.services["network"]["name"] = "Test Network Isolated - Regular user - 1" + cls.user_network_1 = Network.create( + cls.regular_user_apiclient, + cls.services["network"], + networkofferingid=cls.network_offering_isolated.id, + zoneid=cls.zone.id + ) + + cls.services["network"]["name"] = "Test Network Isolated - Regular user - 2" + cls.user_network_2 = Network.create( + cls.regular_user_apiclient, + cls.services["network"], + networkofferingid=cls.network_offering_isolated.id, + zoneid=cls.zone.id + ) + + # 8. Create SSH Keypairs + cls.keypair_1 = SSHKeyPair.create( + cls.regular_user_apiclient, + name="keypair1" + ) + cls.keypair_2 = SSHKeyPair.create( + cls.regular_user_apiclient, + name="keypair2" + ) + + # 9. Get counters for cpu and memory + counters = Autoscale.listCounters( + cls.regular_user_apiclient, + provider="VirtualRouter" + ) + for counter in counters: + if counter.source == 'CPU': + cls.counter_cpu_id = counter.id + elif counter.source == 'MEMORY': + cls.counter_memory_id = counter.id + elif counter.source == 'VIRTUALROUTER' and counter.value == 'public.network.received.average.mbps': + cls.counter_network_received_id = counter.id + elif counter.source == 'VIRTUALROUTER' and counter.value == 'public.network.transmit.average.mbps': + cls.counter_network_transmit_id = counter.id + elif counter.source == 'VIRTUALROUTER' and counter.value == 'virtual.network.lb.average.connections': + cls.counter_lb_connection_id = counter.id + + if cls.hypervisor.lower() == 'vmware': + cls.counter_cpu_or_memory_id = cls.counter_memory_id + else: + cls.counter_cpu_or_memory_id = cls.counter_cpu_id + + # 10. Create AS conditions + cls.scale_up_condition = AutoScaleCondition.create( + cls.regular_user_apiclient, + counterid = cls.counter_cpu_id, + relationaloperator = "GE", + threshold = 1 + ) + + cls.scale_down_condition = AutoScaleCondition.create( + cls.regular_user_apiclient, + counterid = cls.counter_cpu_or_memory_id, + relationaloperator = "LE", + threshold = 100 + ) + + cls._cleanup.append(cls.scale_up_condition) + cls._cleanup.append(cls.scale_down_condition) + + # 11. Create AS policies + cls.scale_up_policy = AutoScalePolicy.create( + cls.regular_user_apiclient, + action='ScaleUp', + conditionids=','.join([cls.scale_up_condition.id]), + quiettime=DEFAULT_QUIETTIME, + duration=DEFAULT_DURATION + ) + + cls.scale_down_policy = AutoScalePolicy.create( + cls.regular_user_apiclient, + action='ScaleDown', + conditionids=cls.scale_down_condition.id, + quiettime=DEFAULT_QUIETTIME, + duration=DEFAULT_DURATION + ) + + cls._cleanup.append(cls.scale_up_policy) + cls._cleanup.append(cls.scale_down_policy) + + # 12. Create AS VM Profile + cls.otherdeployparams = [] + cls.addOtherDeployParam(cls.otherdeployparams, "overridediskofferingid", cls.disk_offering_override.id) + cls.addOtherDeployParam(cls.otherdeployparams, "diskofferingid", cls.disk_offering_custom.id) + cls.addOtherDeployParam(cls.otherdeployparams, "disksize", 3) + cls.addOtherDeployParam(cls.otherdeployparams, "keypairs", cls.keypair_1.name + "," + cls.keypair_2.name) + cls.addOtherDeployParam(cls.otherdeployparams, "networkids", cls.user_network_1.id + "," + cls.user_network_2.id) + + cls.autoscaling_vmprofile = AutoScaleVmProfile.create( + cls.regular_user_apiclient, + serviceofferingid=cls.service_offering.id, + zoneid=cls.zone.id, + templateid=cls.template.id, + expungevmgraceperiod=DEFAULT_EXPUNGE_VM_GRACE_PERIOD, + otherdeployparams=cls.otherdeployparams + ) + + cls._cleanup.append(cls.autoscaling_vmprofile) + + # 13. Acquire Public IP and create LoadBalancer rule + cls.public_ip_address = PublicIPAddress.create( + cls.regular_user_apiclient, + services=cls.services["network"], + networkid=cls.user_network_1.id + ) + + cls.services["lbrule"]["openfirewall"] = False + cls.load_balancer_rule = LoadBalancerRule.create( + cls.regular_user_apiclient, + cls.services["lbrule"], + ipaddressid=cls.public_ip_address.ipaddress.id, + networkid=cls.user_network_1.id + ) + + # 14. Create AS VM Group + cls.autoscaling_vmgroup = AutoScaleVmGroup.create( + cls.regular_user_apiclient, + name=NAME_PREFIX + format(datetime.datetime.now(), '%Y%m%d-%H%M%S'), + lbruleid=cls.load_balancer_rule.id, + minmembers=MIN_MEMBER, + maxmembers=MAX_MEMBER, + scaledownpolicyids=cls.scale_down_policy.id, + scaleuppolicyids=cls.scale_up_policy.id, + vmprofileid=cls.autoscaling_vmprofile.id, + interval=DEFAULT_INTERVAL + ) + + # 15. Get global config + check_interval_config = Configurations.list(cls.apiclient, name="autoscale.stats.interval") + cls.check_interval_seconds = int(check_interval_config[0].value) + + # 16. define VMs not be checked + cls.excluded_vm_ids = [] + + @classmethod + def message(cls, msg): + cls.logger.debug("=== " + str(datetime.datetime.now()) + " " + msg) + + @classmethod + def addOtherDeployParam(cls, otherdeployparams, name, value): + otherdeployparams.append({ + 'name': name, + 'value': value + }) + + @classmethod + def tearDownClass(cls): + Configurations.update(cls.apiclient, + CONFIG_NAME_DISK_CONTROLLER, + cls.initial_vmware_root_disk_controller) + super(TestVmAutoScaling, cls).tearDownClass() + + def setUp(self): + self.apiclient = self.testClient.getApiClient() + self.cleanup = [] + + def tearDown(self): + super(TestVmAutoScaling, self).tearDown() + + def delete_vmgroup(self, vmgroup, apiclient, cleanup=None, expected=True): + result = True + try: + AutoScaleVmGroup.delete( + vmgroup, + apiclient, + cleanup=cleanup + ) + except Exception as ex: + result = False + if expected: + self.fail(f"Failed to remove Autoscaling VM Group, but expected to succeed : {ex}") + if result and not expected: + self.fail("Autoscaling VM Group is removed successfully, but expected to fail") + + def verifyVmCountAndProfiles(self, vmCount, autoscalevmgroupid=None, autoscalevmprofileid=None, networkid=None, projectid=None): + if autoscalevmgroupid is None: + autoscalevmgroupid = self.autoscaling_vmgroup.id + + if autoscalevmprofileid is None: + autoscalevmprofileid = self.autoscaling_vmprofile.id + + if networkid is None: + networkid = self.user_network_1.id + + vms = VirtualMachine.list( + self.regular_user_apiclient, + autoscalevmgroupid=autoscalevmgroupid, + projectid=projectid, + listall=True + ) + self.assertEqual( + isinstance(vms, list), + True, + "List virtual machines should return a valid list" + ) + + new_vm_ids = [] + for vm in vms: + new_vm_ids.append(vm.id) + for vm_id in self.excluded_vm_ids: + if vm_id not in new_vm_ids: + self.logger.debug("VM (id: %s) is not found in VM group" % vm_id) + self.excluded_vm_ids.remove(vm_id) + + self.assertEqual( + len(vms), + vmCount, + "The number of virtual machines (%s) should be equal to %s" % (len(vms), vmCount) + ) + + for vm in vms: + if vm.id not in self.excluded_vm_ids: + self.excluded_vm_ids.append(vm.id) + self.wait_for_vm_start(vm, projectid) + self.verifyVmProfile(vm, autoscalevmprofileid, networkid, projectid) + + def verifyVmProfile(self, vm, autoscalevmprofileid, networkid=None, projectid=None): + self.message("Verifying profiles of new VM %s (%s)" % (vm.name, vm.id)) + datadisksizeInBytes = None + diskofferingid = None + rootdisksizeInBytes = None + sshkeypairs = None + + affinitygroupIdsArray = [] + for affinitygroup in vm.affinitygroup: + affinitygroupIdsArray.append(affinitygroup.id) + affinitygroupids = ",".join(affinitygroupIdsArray) + + if vm.diskofferingid: + diskofferingid = vm.diskofferingid + if vm.keypairs: + sshkeypairs = vm.keypairs + serviceofferingid = vm.serviceofferingid + templateid = vm.templateid + + networkIdsArray = [] + for nic in vm.nic: + networkIdsArray.append(nic.networkid) + networkids = ",".join(networkIdsArray) + + volumes = Volume.list( + self.regular_user_apiclient, + virtualmachineid=vm.id, + projectid=projectid, + listall=True + ) + for volume in volumes: + if volume.type == 'ROOT': + rootdisksizeInBytes = volume.size + elif volume.type == 'DATADISK': + datadisksizeInBytes = volume.size + diskofferingid = volume.diskofferingid + + vmprofiles_list = AutoScaleVmProfile.list( + self.regular_user_apiclient, + listall=True, + projectid=projectid, + id=autoscalevmprofileid + ) + vmprofile = vmprofiles_list[0] + vmprofile_otherdeployparams = vmprofile.otherdeployparams + + self.logger.debug("vmprofile_otherdeployparams = " + str(vmprofile_otherdeployparams)) + self.logger.debug("templateid = " + templateid) + self.logger.debug("serviceofferingid = " + serviceofferingid) + self.logger.debug("rootdisksizeInBytes = " + str(rootdisksizeInBytes)) + self.logger.debug("datadisksizeInBytes = " + str(datadisksizeInBytes)) + self.logger.debug("diskofferingid = " + str(diskofferingid)) + self.logger.debug("sshkeypairs = " + str(sshkeypairs)) + self.logger.debug("networkids = " + networkids) + self.logger.debug("affinitygroupids = " + affinitygroupids) + + self.assertEquals(templateid, vmprofile.templateid) + self.assertEquals(serviceofferingid, vmprofile.serviceofferingid) + + if vmprofile_otherdeployparams.rootdisksize: + self.assertEquals(int(rootdisksizeInBytes), int(vmprofile_otherdeployparams.rootdisksize) * (1024 ** 3)) + elif vmprofile_otherdeployparams.overridediskofferingid: + self.assertEquals(vmprofile_otherdeployparams.overridediskofferingid, self.disk_offering_override.id) + self.assertEquals(int(rootdisksizeInBytes), int(self.disk_offering_override.disksize) * (1024 ** 3)) + else: + self.assertEquals(int(rootdisksizeInBytes), int(self.templatesize) * (1024 ** 3)) + + if vmprofile_otherdeployparams.diskofferingid: + self.assertEquals(diskofferingid, vmprofile_otherdeployparams.diskofferingid) + if vmprofile_otherdeployparams.disksize: + self.assertEquals(int(datadisksizeInBytes), int(vmprofile_otherdeployparams.disksize) * (1024 ** 3)) + + if vmprofile_otherdeployparams.keypairs: + self.assertEquals(sshkeypairs, vmprofile_otherdeployparams.keypairs) + else: + self.assertIsNone(sshkeypairs) + + if vmprofile_otherdeployparams.networkids: + self.assertEquals(networkids, vmprofile_otherdeployparams.networkids) + else: + self.assertEquals(networkids, networkid) + + if vmprofile_otherdeployparams.affinitygroupids: + self.assertEquals(affinitygroupids, vmprofile_otherdeployparams.affinitygroupids) + else: + self.assertEquals(affinitygroupids, '') + + def wait_for_vm_start(self, vm=None, project_id=None): + """ Wait until vm is Running """ + def check_user_vm_state(): + vms = VirtualMachine.list( + self.apiclient, + id=vm.id, + projectid=project_id, + listall=True + ) + if isinstance(vms, list): + if vms[0].state == 'Running': + return True, vms[0].state + return False, vms[0].state + + self.message("Waiting for user VM %s (%s) to be Running" % (vm.name, vm.id)) + res = wait_until(10, 30, check_user_vm_state) + if not res: + raise Exception("Failed to wait for user VM %s (%s) to be Running" % (vm.name, vm.id)) + return res + + @attr(tags=["advanced"], required_hardware="false") + def test_01_scale_up_verify(self): + """ Verify scale up of AutoScaling VM Group """ + self.message("Running test_01_scale_up_verify") + + # VM count increases from 0 to MIN_MEMBER + sleeptime = DEFAULT_INTERVAL * MIN_MEMBER + 5 + self.message("Waiting %s seconds for %s VM(s) to be created" % (sleeptime, MIN_MEMBER)) + time.sleep(sleeptime) + self.verifyVmCountAndProfiles(MIN_MEMBER) + + # VM count increases from MIN_MEMBER to MAX_MEMBER + sleeptime = (self.check_interval_seconds + DEFAULT_DURATION + DEFAULT_QUIETTIME) * (MAX_MEMBER - MIN_MEMBER) + self.message("Waiting %s seconds for other %s VM(s) to be created" % (sleeptime, (MAX_MEMBER - MIN_MEMBER))) + time.sleep(sleeptime) + self.verifyVmCountAndProfiles(MAX_MEMBER) + + + @attr(tags=["advanced"], required_hardware="false") + def test_02_update_vmprofile_and_vmgroup(self): + """ Verify update of AutoScaling VM Group and VM Profile""" + self.message("Running test_02_update_vmprofile_and_vmgroup") + + vmprofiles_list = AutoScaleVmProfile.list( + self.regular_user_apiclient, + listall=True, + id=self.autoscaling_vmprofile.id + ) + self.assertEqual( + isinstance(vmprofiles_list, list), + True, + "List autoscale profiles should return a valid list" + ) + self.assertEqual( + len(vmprofiles_list) == 1, + True, + "The number of autoscale profiles (%s) should be equal to 1" % (len(vmprofiles_list)) + ) + + # Create new AS VM Profile + otherdeployparams_new = [] + self.addOtherDeployParam(otherdeployparams_new, "rootdisksize", self.templatesize + 2) + self.addOtherDeployParam(otherdeployparams_new, "diskofferingid", self.disk_offering_custom_new.id) + self.addOtherDeployParam(otherdeployparams_new, "disksize", 5) + self.addOtherDeployParam(otherdeployparams_new, "keypairs", self.keypair_1.name) + self.addOtherDeployParam(otherdeployparams_new, "networkids", self.user_network_1.id) + + try: + Autoscale.updateAutoscaleVMProfile( + self.regular_user_apiclient, + id = self.autoscaling_vmprofile.id, + serviceofferingid = self.service_offering_new.id, + expungevmgraceperiod = DEFAULT_EXPUNGE_VM_GRACE_PERIOD + 1, + otherdeployparams = otherdeployparams_new + ) + self.fail("Autoscale VM Profile should not be updatable when VM Group is not Disabled") + except Exception as ex: + pass + + try: + Autoscale.updateAutoscaleVMGroup( + self.regular_user_apiclient, + id = self.autoscaling_vmprofile.id, + name=NAME_PREFIX + format(datetime.datetime.now(), '%Y%m%d-%H%M%S'), + maxmembers = MAX_MEMBER + 1, + minmembers = MIN_MEMBER + 1, + interval = DEFAULT_INTERVAL + 1 + ) + self.fail("Autoscale VM Group should not be updatable when VM Group is not Disabled") + except Exception as ex: + pass + + self.autoscaling_vmgroup.disable(self.regular_user_apiclient) + + try: + Autoscale.updateAutoscaleVMProfile( + self.regular_user_apiclient, + id = self.autoscaling_vmprofile.id, + serviceofferingid = self.service_offering_new.id, + expungevmgraceperiod = DEFAULT_EXPUNGE_VM_GRACE_PERIOD + 1, + otherdeployparams = otherdeployparams_new + ) + except Exception as ex: + self.fail("Autoscale VM Profile should be updatable when VM Group is Disabled") + + try: + Autoscale.updateAutoscaleVMGroup( + self.regular_user_apiclient, + id = self.autoscaling_vmgroup.id, + name=NAME_PREFIX + format(datetime.datetime.now(), '%Y%m%d-%H%M%S'), + maxmembers = MAX_MEMBER + 1, + minmembers = MIN_MEMBER + 1, + interval = DEFAULT_INTERVAL + 1 + ) + except Exception as ex: + self.fail("Autoscale VM Group should be updatable when VM Group is Disabled") + + self.autoscaling_vmgroup.enable(self.regular_user_apiclient) + + # VM count increases from MAX_MEMBER to MAX_MEMBER+1 + sleeptime = self.check_interval_seconds + DEFAULT_DURATION + DEFAULT_QUIETTIME + self.message("Waiting %s seconds for other %s VM(s) to be created" % (sleeptime, 1)) + time.sleep(sleeptime) + self.verifyVmCountAndProfiles(MAX_MEMBER + 1) + + @attr(tags=["advanced"], required_hardware="false") + def test_03_scale_down_verify(self): + """ Verify scale down of AutoScaling VM Group """ + self.message("Running test_03_scale_down_verify") + + self.autoscaling_vmgroup.disable(self.regular_user_apiclient) + + policies = Autoscale.listAutoscalePolicies( + self.regular_user_apiclient, + action="ScaleUp", + vmgroupid=self.autoscaling_vmgroup.id + ) + self.assertEqual( + isinstance(policies, list), + True, + "List autoscale policies should return a valid list" + ) + self.assertEqual( + len(policies) == 1, + True, + "The number of autoscale policies (%s) should be equal to 1" % (len(policies)) + ) + scale_up_policy = policies[0] + + conditions = Autoscale.listConditions( + self.regular_user_apiclient, + policyid=scale_up_policy.id + ) + self.assertEqual( + isinstance(conditions, list), + True, + "List conditions should return a valid list" + ) + + for condition in conditions: + if condition.counterid == self.counter_cpu_id: + Autoscale.updateCondition( + self.regular_user_apiclient, + id=condition.id, + relationaloperator="GT", + threshold=101 + ) + + policies = Autoscale.listAutoscalePolicies( + self.regular_user_apiclient, + action="ScaleDown", + vmgroupid=self.autoscaling_vmgroup.id + ) + self.assertEqual( + isinstance(policies, list), + True, + "List autoscale policies should return a valid list" + ) + self.assertEqual( + len(policies) == 1, + True, + "The number of autoscale policies (%s) should be equal to 1" % (len(policies)) + ) + scale_down_policy = policies[0] + + new_condition_1 = AutoScaleCondition.create( + self.regular_user_apiclient, + counterid=self.counter_network_received_id, + relationaloperator="GE", + threshold=0 + ) + new_condition_2 = AutoScaleCondition.create( + self.regular_user_apiclient, + counterid=self.counter_network_transmit_id, + relationaloperator="GE", + threshold=0 + ) + new_condition_3 = AutoScaleCondition.create( + self.regular_user_apiclient, + counterid=self.counter_lb_connection_id, + relationaloperator="GE", + threshold=0 + ) + Autoscale.updateAutoscalePolicy( + self.regular_user_apiclient, + id=scale_down_policy.id, + conditionids=','.join([new_condition_1.id, new_condition_2.id, new_condition_3.id]) + ) + + self.autoscaling_vmgroup.enable(self.regular_user_apiclient) + + # VM count decreases from MAX_MEMBER+1 to MIN_MEMBER+1 + sleeptime = (self.check_interval_seconds + DEFAULT_DURATION + DEFAULT_QUIETTIME + DEFAULT_EXPUNGE_VM_GRACE_PERIOD) * (MAX_MEMBER - MIN_MEMBER) + self.message("Waiting %s seconds for %s VM(s) to be destroyed" % (sleeptime, MAX_MEMBER - MIN_MEMBER)) + time.sleep(sleeptime) + self.verifyVmCountAndProfiles(MIN_MEMBER+1) + + @attr(tags=["advanced"], required_hardware="false") + def test_04_stop_remove_vm_in_vmgroup(self): + """ Verify removal of VM in AutoScaling VM Group""" + self.message("Running test_04_remove_vm_in_vmgroup") + + vms = VirtualMachine.list( + self.regular_user_apiclient, + autoscalevmgroupid=self.autoscaling_vmgroup.id, + listall=True + ) + self.assertEqual( + isinstance(vms, list), + True, + "List virtual machines should return a valid list" + ) + self.assertEqual( + len(vms) >= MIN_MEMBER, + True, + "The number of virtual machines (%s) should be equal to or greater than %s" % (len(vms), MIN_MEMBER) + ) + + vm = vms[0] + try: + cmd = stopVirtualMachine.stopVirtualMachineCmd() + cmd.id = vm.id + cmd.forced = True + self.apiclient.stopVirtualMachine(cmd) + self.fail("VM should not be stopped when VM Group is not Disabled") + except Exception as ex: + pass + + try: + VirtualMachine.delete(vm, self.regular_user_apiclient, expunge=False) + self.fail("VM should not be destroyed when VM Group is not Disabled") + except Exception as ex: + pass + + self.autoscaling_vmgroup.disable(self.regular_user_apiclient) + + try: + cmd = stopVirtualMachine.stopVirtualMachineCmd() + cmd.id = vm.id + cmd.forced = True + self.apiclient.stopVirtualMachine(cmd) + except Exception as ex: + self.fail("VM should be stopped when VM Group is Disabled") + + try: + VirtualMachine.delete(vm, self.regular_user_apiclient, expunge=False) + except Exception as ex: + self.fail("VM should be destroyed when VM Group is Disabled") + + self.verifyVmCountAndProfiles(MIN_MEMBER) + + VirtualMachine.delete(vm, self.apiclient, expunge=True) + + @attr(tags=["advanced"], required_hardware="false") + def test_05_remove_vmgroup(self): + """ Verify removal of AutoScaling VM Group""" + self.message("Running test_05_remove_vmgroup") + + self.delete_vmgroup(self.autoscaling_vmgroup, self.regular_user_apiclient, cleanup=False, expected=False) + self.delete_vmgroup(self.autoscaling_vmgroup, self.regular_user_apiclient, cleanup=True, expected=True) + + @attr(tags=["advanced"], required_hardware="false") + def test_06_autoscaling_vmgroup_on_project_network(self): + """ Testing VM autoscaling on project network """ + self.message("Running test_06_autoscaling_vmgroup_on_project_network") + + # Create project + project = Project.create( + self.regular_user_apiclient, + self.services["project"] + ) + self.cleanup.append(project) + + # Create project network + self.services["network"]["name"] = "Test Network Isolated - Project" + project_network = Network.create( + self.regular_user_apiclient, + self.services["network"], + networkofferingid=self.network_offering_isolated.id, + projectid=project.id, + zoneid=self.zone.id + ) + self.cleanup.append(project_network) + + # Acquire Public IP and create LoadBalancer rule for project + public_ip_address_project = PublicIPAddress.create( + self.regular_user_apiclient, + services=self.services["network"], + projectid = project.id, + networkid=project_network.id + ) + + load_balancer_rule_project = LoadBalancerRule.create( + self.regular_user_apiclient, + self.services["lbrule"], + projectid = project.id, + ipaddressid=public_ip_address_project.ipaddress.id, + networkid=project_network.id + ) + self.cleanup.append(load_balancer_rule_project) + + # Create AS conditions for project + scale_up_condition_project = AutoScaleCondition.create( + self.regular_user_apiclient, + projectid = project.id, + counterid = self.counter_cpu_id, + relationaloperator = "GE", + threshold = 1 + ) + + scale_down_condition_project = AutoScaleCondition.create( + self.regular_user_apiclient, + projectid = project.id, + counterid = self.counter_cpu_or_memory_id, + relationaloperator = "LE", + threshold = 100 + ) + + self.cleanup.append(scale_up_condition_project) + self.cleanup.append(scale_down_condition_project) + + # Create AS policies for project + scale_up_policy_project = AutoScalePolicy.create( + self.regular_user_apiclient, + action='ScaleUp', + conditionids=scale_up_condition_project.id, + quiettime=DEFAULT_QUIETTIME, + duration=DEFAULT_DURATION + ) + + scale_down_policy_project = AutoScalePolicy.create( + self.regular_user_apiclient, + action='ScaleDown', + conditionids=scale_down_condition_project.id, + quiettime=DEFAULT_QUIETTIME, + duration=DEFAULT_DURATION + ) + + self.cleanup.append(scale_up_policy_project) + self.cleanup.append(scale_down_policy_project) + + # Create AS VM Profile for project + autoscaling_vmprofile_project = AutoScaleVmProfile.create( + self.regular_user_apiclient, + serviceofferingid=self.service_offering.id, + zoneid=self.zone.id, + templateid=self.template.id, + expungevmgraceperiod=DEFAULT_EXPUNGE_VM_GRACE_PERIOD, + projectid = project.id + ) + + # Create AS VM Group for project + autoscaling_vmgroup_project = AutoScaleVmGroup.create( + self.regular_user_apiclient, + name=NAME_PREFIX + format(datetime.datetime.now(), '%Y%m%d-%H%M%S'), + lbruleid=load_balancer_rule_project.id, + minmembers=MIN_MEMBER, + maxmembers=MAX_MEMBER, + scaledownpolicyids=scale_down_policy_project.id, + scaleuppolicyids=scale_up_policy_project.id, + vmprofileid=autoscaling_vmprofile_project.id, + interval=DEFAULT_INTERVAL + ) + + self.excluded_vm_ids = [] + # VM count increases from 0 to MIN_MEMBER + sleeptime = DEFAULT_INTERVAL * MIN_MEMBER + 5 + self.message("Waiting %s seconds for %s VM(s) to be created" % (sleeptime, MIN_MEMBER)) + time.sleep(sleeptime) + self.verifyVmCountAndProfiles(MIN_MEMBER, autoscaling_vmgroup_project.id, autoscaling_vmprofile_project.id, + project_network.id, project.id) + + # VM count increases from MIN_MEMBER to MAX_MEMBER + sleeptime = (self.check_interval_seconds + DEFAULT_DURATION + DEFAULT_QUIETTIME) * (MAX_MEMBER - MIN_MEMBER) + self.message("Waiting %s seconds for other %s VM(s) to be created" % (sleeptime, (MAX_MEMBER - MIN_MEMBER))) + time.sleep(sleeptime) + self.verifyVmCountAndProfiles(MAX_MEMBER, autoscaling_vmgroup_project.id, autoscaling_vmprofile_project.id, + project_network.id, project.id) + + vms = VirtualMachine.list( + self.regular_user_apiclient, + autoscalevmgroupid=autoscaling_vmgroup_project.id, + projectid=project.id, + listall=True + ) + self.assertEqual( + isinstance(vms, list), + True, + "List virtual machines should return a valid list" + ) + self.assertEqual( + len(vms), + MAX_MEMBER, + "The number of virtual machines (%s) should be equal to %s" % (len(vms), MAX_MEMBER) + ) + + vm = vms[0] + # Remove a vm from LB, should fail + try: + LoadBalancerRule.remove(load_balancer_rule_project, self.regular_user_apiclient, [vm]) + self.fail("VM should not be removed from load balancer rule when VM Group is not Disabled") + except Exception as ex: + pass + + # Remove a vm from LB, should succeed when vm group is Disabled + autoscaling_vmgroup_project.disable(self.regular_user_apiclient) + try: + LoadBalancerRule.remove(load_balancer_rule_project, self.regular_user_apiclient, [vm]) + except Exception as ex: + self.fail("VM should be removed from load balancer rule when VM Group is Disabled") + + self.verifyVmCountAndProfiles(MAX_MEMBER-1, autoscaling_vmgroup_project.id, autoscaling_vmprofile_project.id, + project_network.id, project.id) + + autoscaling_vmgroup_project.enable(self.regular_user_apiclient) + + self.delete_vmgroup(autoscaling_vmgroup_project, self.regular_user_apiclient, cleanup=False, expected=False) + self.delete_vmgroup(autoscaling_vmgroup_project, self.regular_user_apiclient, cleanup=True, expected=True) + + VirtualMachine.delete(vm, self.regular_user_apiclient, expunge=False) + VirtualMachine.delete(vm, self.apiclient, expunge=True) + + @attr(tags=["advanced"], required_hardware="false") + def test_07_autoscaling_vmgroup_on_vpc_network(self): + """ Testing VM autoscaling on vpc network """ + self.message("Running test_07_autoscaling_vmgroup_on_vpc_network") + + # Create vpc offering + networkOffering = NetworkOffering.list( + self.apiclient, name="DefaultIsolatedNetworkOfferingForVpcNetworks") + self.assertTrue(networkOffering is not None and len( + networkOffering) > 0, "No VPC based network offering") + + vpcOffering = VpcOffering.list(self.apiclient, name="Default VPC offering") + self.assertTrue(vpcOffering is not None and len( + vpcOffering) > 0, "No VPC offerings found") + + self.services["vpc"] = {} + self.services["vpc"]["name"] = "test-vpc" + self.services["vpc"]["displaytext"] = "test-vpc" + self.services["vpc"]["cidr"] = "192.168.0.0/22" + + self.services["vpc_network"] = {} + self.services["vpc_network"]["name"] = "test-vpc-network" + self.services["vpc_network"]["displaytext"] = "test-vpc-network" + self.services["vpc_network"]["netmask"] = "255.255.255.0" + self.services["vpc_network"]["gateway"] = "192.168.0.1" + + # Create vpc + vpc = VPC.create( + self.regular_user_apiclient, + self.services["vpc"], + vpcofferingid=vpcOffering[0].id, + zoneid=self.zone.id + ) + self.cleanup.append(vpc) + + # Create vpc network + self.services["network"]["name"] = "Test Network Isolated - VPC" + vpc_network = Network.create( + self.regular_user_apiclient, + self.services["vpc_network"], + networkofferingid=networkOffering[0].id, + vpcid=vpc.id, + zoneid=self.zone.id + ) + self.cleanup.append(vpc_network) + + # Acquire Public IP and create LoadBalancer rule for vpc + public_ip_address_vpc = PublicIPAddress.create( + self.regular_user_apiclient, + services=self.services["network"], + vpcid=vpc.id, + networkid=vpc_network.id + ) + + load_balancer_rule_vpc = LoadBalancerRule.create( + self.regular_user_apiclient, + self.services["lbrule"], + ipaddressid=public_ip_address_vpc.ipaddress.id, + networkid=vpc_network.id + ) + self.cleanup.append(load_balancer_rule_vpc) + + # Create AS conditions for vpc + scale_up_condition_1 = AutoScaleCondition.create( + self.regular_user_apiclient, + counterid = self.counter_cpu_or_memory_id, + relationaloperator = "GE", + threshold = 1 + ) + scale_up_condition_3 = AutoScaleCondition.create( + self.regular_user_apiclient, + counterid=self.counter_network_received_id, + relationaloperator="GE", + threshold=0 + ) + scale_up_condition_4 = AutoScaleCondition.create( + self.regular_user_apiclient, + counterid=self.counter_network_transmit_id, + relationaloperator="GE", + threshold=0 + ) + scale_up_condition_5 = AutoScaleCondition.create( + self.regular_user_apiclient, + counterid=self.counter_lb_connection_id, + relationaloperator="GE", + threshold=0 + ) + + scale_down_condition_vpc = AutoScaleCondition.create( + self.regular_user_apiclient, + counterid = self.counter_cpu_or_memory_id, + relationaloperator = "LE", + threshold = 100 + ) + + self.cleanup.append(scale_up_condition_1) + self.cleanup.append(scale_up_condition_3) + self.cleanup.append(scale_up_condition_4) + self.cleanup.append(scale_up_condition_5) + self.cleanup.append(scale_down_condition_vpc) + + # Create AS policies for vpc + scale_up_policy_vpc = AutoScalePolicy.create( + self.regular_user_apiclient, + action='ScaleUp', + conditionids=','.join([scale_up_condition_1.id, scale_up_condition_3.id, + scale_up_condition_4.id, scale_up_condition_5.id]), + quiettime=DEFAULT_QUIETTIME, + duration=DEFAULT_DURATION + ) + + scale_down_policy_vpc = AutoScalePolicy.create( + self.regular_user_apiclient, + action='ScaleDown', + conditionids=scale_down_condition_vpc.id, + quiettime=DEFAULT_QUIETTIME, + duration=DEFAULT_DURATION + ) + + self.cleanup.append(scale_up_policy_vpc) + self.cleanup.append(scale_down_policy_vpc) + + # Create AS VM Profile for vpc + autoscaling_vmprofile_vpc = AutoScaleVmProfile.create( + self.regular_user_apiclient, + serviceofferingid=self.service_offering.id, + zoneid=self.zone.id, + templateid=self.template.id, + expungevmgraceperiod=DEFAULT_EXPUNGE_VM_GRACE_PERIOD + ) + + self.cleanup.append(autoscaling_vmprofile_vpc) + + # Create AS VM Group for vpc + autoscaling_vmgroup_vpc = AutoScaleVmGroup.create( + self.regular_user_apiclient, + name=NAME_PREFIX + format(datetime.datetime.now(), '%Y%m%d-%H%M%S'), + lbruleid=load_balancer_rule_vpc.id, + minmembers=MIN_MEMBER, + maxmembers=MAX_MEMBER, + scaledownpolicyids=scale_down_policy_vpc.id, + scaleuppolicyids=scale_up_policy_vpc.id, + vmprofileid=autoscaling_vmprofile_vpc.id, + interval=DEFAULT_INTERVAL + ) + + self.excluded_vm_ids = [] + # VM count increases from 0 to MIN_MEMBER + sleeptime = DEFAULT_INTERVAL * MIN_MEMBER + 5 + self.message("Waiting %s seconds for %s VM(s) to be created" % (sleeptime, MIN_MEMBER)) + time.sleep(sleeptime) + self.verifyVmCountAndProfiles(MIN_MEMBER, autoscaling_vmgroup_vpc.id, autoscaling_vmprofile_vpc.id, vpc_network.id) + + # VM count increases from MIN_MEMBER to MAX_MEMBER + sleeptime = (self.check_interval_seconds + DEFAULT_DURATION + DEFAULT_QUIETTIME) * (MAX_MEMBER - MIN_MEMBER) + self.message("Waiting %s seconds for other %s VM(s) to be created" % (sleeptime, (MAX_MEMBER - MIN_MEMBER))) + time.sleep(sleeptime) + self.verifyVmCountAndProfiles(MAX_MEMBER, autoscaling_vmgroup_vpc.id, autoscaling_vmprofile_vpc.id, vpc_network.id) + + autoscaling_vmgroup_vpc.disable(self.regular_user_apiclient) + + try: + Autoscale.updateAutoscaleVMGroup( + self.regular_user_apiclient, + id = autoscaling_vmgroup_vpc.id, + name=NAME_PREFIX + format(datetime.datetime.now(), '%Y%m%d-%H%M%S'), + maxmembers = MAX_MEMBER - 1 + ) + except Exception as ex: + self.fail("Autoscale VM Group should be updatable when VM Group is Disabled") + + autoscaling_vmgroup_vpc.enable(self.regular_user_apiclient) + + # VM count decreases from MAX_MEMBER to MAX_MEMBER - 1 + sleeptime = self.check_interval_seconds + DEFAULT_DURATION + DEFAULT_EXPUNGE_VM_GRACE_PERIOD + self.message("Waiting %s seconds for other %s VM(s) to be destroyed" % (sleeptime, 1)) + time.sleep(sleeptime) + self.verifyVmCountAndProfiles(MAX_MEMBER - 1, autoscaling_vmgroup_vpc.id, autoscaling_vmprofile_vpc.id, vpc_network.id) + + self.delete_vmgroup(autoscaling_vmgroup_vpc, self.regular_user_apiclient, cleanup=False, expected=False) + self.delete_vmgroup(autoscaling_vmgroup_vpc, self.regular_user_apiclient, cleanup=True, expected=True) diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py index 00e834ffc4ff..bdf8bbc43aa0 100755 --- a/tools/marvin/marvin/lib/base.py +++ b/tools/marvin/marvin/lib/base.py @@ -2172,6 +2172,15 @@ def createCondition(cls, apiclient, counterid, relationaloperator, threshold): cmd.threshold = threshold return (apiclient.createCondition(cmd)) + @classmethod + def updateCondition(cls, apiclient, id, **kwargs): + """Updates condition.""" + + cmd = updateCondition.updateConditionCmd() + cmd.id = id + [setattr(cmd, k, v) for k, v in list(kwargs.items())] + return (apiclient.updateCondition(cmd)) + @classmethod def listConditions(cls, apiclient, **kwargs): """Lists all available Conditions.""" @@ -2220,7 +2229,8 @@ def listAutoscaleVmPofiles(cls, apiclient, **kwargs): @classmethod def createAutoscaleVmProfile(cls, apiclient, serviceofferingid, zoneid, templateid, - autoscaleuserid=None, destroyvmgraceperiod=None, counterparam=None): + autoscaleuserid=None, expungevmgraceperiod=None, counterparam=None, + otherdeployparams=None, userdata=None): """creates Autoscale VM Profile.""" cmd = createAutoScaleVmProfile.createAutoScaleVmProfileCmd() @@ -2230,8 +2240,8 @@ def createAutoscaleVmProfile(cls, apiclient, serviceofferingid, zoneid, template if autoscaleuserid: cmd.autoscaleuserid = autoscaleuserid - if destroyvmgraceperiod: - cmd.destroyvmgraceperiod = destroyvmgraceperiod + if expungevmgraceperiod: + cmd.expungevmgraceperiod = expungevmgraceperiod if counterparam: for name, value in list(counterparam.items()): @@ -2240,11 +2250,17 @@ def createAutoscaleVmProfile(cls, apiclient, serviceofferingid, zoneid, template 'value': value }) + if otherdeployparams: + cmd.otherdeployparams = otherdeployparams + + if userdata: + cmd.userdata = userdata + return (apiclient.createAutoScaleVmProfile(cmd)) @classmethod def updateAutoscaleVMProfile(cls, apiclient, id, **kwargs): - """Updates Autoscale Policy.""" + """Updates Autoscale VM Profile.""" cmd = updateAutoScaleVmProfile.updateAutoScaleVmProfileCmd() cmd.id = id @@ -2253,7 +2269,7 @@ def updateAutoscaleVMProfile(cls, apiclient, id, **kwargs): @classmethod def createAutoscaleVmGroup(cls, apiclient, lbruleid, minmembers, maxmembers, - scaledownpolicyids, scaleuppolicyids, vmprofileid, interval=None): + scaledownpolicyids, scaleuppolicyids, vmprofileid, interval=None, name=None): """creates Autoscale VM Group.""" cmd = createAutoScaleVmGroup.createAutoScaleVmGroupCmd() @@ -2265,6 +2281,8 @@ def createAutoscaleVmGroup(cls, apiclient, lbruleid, minmembers, maxmembers, cmd.vmprofileid = vmprofileid if interval: cmd.interval = interval + if name: + cmd.name = name return (apiclient.createAutoScaleVmGroup(cmd)) @@ -2303,6 +2321,255 @@ def updateAutoscaleVMGroup(cls, apiclient, id, **kwargs): [setattr(cmd, k, v) for k, v in list(kwargs.items())] return (apiclient.updateAutoScaleVmGroup(cmd)) + @classmethod + def deleteAutoscaleVMGroup(cls, apiclient, id, cleanup=None): + """Deletes Autoscale VM Group.""" + + cmd = deleteAutoScaleVmGroup.deleteAutoScaleVmGroupCmd() + cmd.id = id + if cleanup: + cmd.cleanup = cleanup + return (apiclient.deleteAutoScaleVmGroup(cmd)) + + @classmethod + def deleteCondition(cls, apiclient, id): + """Deletes condition.""" + + cmd = deleteCondition.deleteConditionCmd() + cmd.id = id + return (apiclient.deleteCondition(cmd)) + + @classmethod + def deleteAutoscaleVMProfile(cls, apiclient, id): + """Deletes Autoscale VM Profile.""" + + cmd = deleteAutoScaleVmProfile.deleteAutoScaleVmProfileCmd() + cmd.id = id + return (apiclient.deleteAutoScaleVmProfile(cmd)) + + @classmethod + def deleteAutoscalePolicy(cls, apiclient, id): + """Deletes Autoscale Policy.""" + + cmd = deleteAutoScalePolicy.deleteAutoScalePolicyCmd() + cmd.id = id + return (apiclient.deleteAutoScalePolicy(cmd)) + +class AutoScaleCondition: + """Manage autoscale condition""" + + def __init__(self, items): + self.__dict__.update(items) + + @classmethod + def listConditions(cls, apiclient, **kwargs): + """Lists all available Conditions.""" + + cmd = listConditions.listConditionsCmd() + [setattr(cmd, k, v) for k, v in list(kwargs.items())] + return (apiclient.listConditions(cmd)) + + @classmethod + def create(cls, apiclient, counterid, relationaloperator, threshold, projectid=None): + """creates condition.""" + + cmd = createCondition.createConditionCmd() + cmd.counterid = counterid + cmd.relationaloperator = relationaloperator + cmd.threshold = threshold + if projectid: + cmd.projectid = projectid + return AutoScaleCondition(apiclient.createCondition(cmd).__dict__) + + def update(self, apiclient, **kwargs): + """Updates condition.""" + + cmd = updateCondition.updateConditionCmd() + cmd.id = self.id + [setattr(cmd, k, v) for k, v in list(kwargs.items())] + return (apiclient.updateCondition(cmd)) + + def delete(self, apiclient): + """Deletes condition.""" + + cmd = deleteCondition.deleteConditionCmd() + cmd.id = self.id + apiclient.deleteCondition(cmd) + return + +class AutoScalePolicy: + """Manage autoscale policy""" + + def __init__(self, items): + self.__dict__.update(items) + + @classmethod + def list(cls, apiclient, **kwargs): + """Lists all available Autoscale Policies.""" + + cmd = listAutoScalePolicies.listAutoScalePoliciesCmd() + [setattr(cmd, k, v) for k, v in list(kwargs.items())] + return (apiclient.listAutoScalePolicies(cmd)) + + @classmethod + def create(cls, apiclient, action, conditionids, duration, quiettime=None): + """creates condition.""" + + cmd = createAutoScalePolicy.createAutoScalePolicyCmd() + cmd.action = action + cmd.conditionids = conditionids + cmd.duration = duration + if quiettime: + cmd.quiettime = quiettime + + return AutoScalePolicy(apiclient.createAutoScalePolicy(cmd).__dict__) + + def update(self, apiclient, **kwargs): + """Updates Autoscale Policy.""" + + cmd = updateAutoScalePolicy.updateAutoScalePolicyCmd() + cmd.id = self.id + [setattr(cmd, k, v) for k, v in list(kwargs.items())] + return (apiclient.updateAutoScalePolicy(cmd)) + + def delete(self, apiclient): + """Deletes Autoscale Policy.""" + + cmd = deleteAutoScalePolicy.deleteAutoScalePolicyCmd() + cmd.id = self.id + apiclient.deleteAutoScalePolicy(cmd) + return + +class AutoScaleVmProfile: + """Manage autoscale vm profile""" + + def __init__(self, items): + self.__dict__.update(items) + + @classmethod + def list(cls, apiclient, **kwargs): + """Lists all available AutoscaleVM Profiles.""" + + cmd = listAutoScaleVmProfiles.listAutoScaleVmProfilesCmd() + [setattr(cmd, k, v) for k, v in list(kwargs.items())] + return (apiclient.listAutoScaleVmProfiles(cmd)) + + @classmethod + def create(cls, apiclient, serviceofferingid, zoneid, templateid, + autoscaleuserid=None, expungevmgraceperiod=None, counterparam=None, + otherdeployparams=None, userdata=None, projectid=None): + """creates Autoscale VM Profile.""" + + cmd = createAutoScaleVmProfile.createAutoScaleVmProfileCmd() + cmd.serviceofferingid = serviceofferingid + cmd.zoneid = zoneid + cmd.templateid = templateid + if autoscaleuserid: + cmd.autoscaleuserid = autoscaleuserid + + if expungevmgraceperiod: + cmd.expungevmgraceperiod = expungevmgraceperiod + + if counterparam: + for name, value in list(counterparam.items()): + cmd.counterparam.append({ + 'name': name, + 'value': value + }) + + if otherdeployparams: + cmd.otherdeployparams = otherdeployparams + + if userdata: + cmd.userdata = userdata + + if projectid: + cmd.projectid = projectid + + return AutoScaleVmProfile(apiclient.createAutoScaleVmProfile(cmd).__dict__) + + def update(self, apiclient, **kwargs): + """Updates Autoscale VM Profile.""" + + cmd = updateAutoScaleVmProfile.updateAutoScaleVmProfileCmd() + cmd.id = self.id + [setattr(cmd, k, v) for k, v in list(kwargs.items())] + return (apiclient.updateAutoScaleVmProfile(cmd)) + + def delete(self, apiclient): + """Deletes Autoscale VM Profile.""" + + cmd = deleteAutoScaleVmProfile.deleteAutoScaleVmProfileCmd() + cmd.id = self.id + apiclient.deleteAutoScaleVmProfile(cmd) + return + +class AutoScaleVmGroup: + """Manage autoscale vm group""" + + def __init__(self, items): + self.__dict__.update(items) + + @classmethod + def create(cls, apiclient, lbruleid, minmembers, maxmembers, + scaledownpolicyids, scaleuppolicyids, vmprofileid, interval=None, name=None): + """creates Autoscale VM Group.""" + + cmd = createAutoScaleVmGroup.createAutoScaleVmGroupCmd() + cmd.lbruleid = lbruleid + cmd.minmembers = minmembers + cmd.maxmembers = maxmembers + cmd.scaledownpolicyids = scaledownpolicyids + cmd.scaleuppolicyids = scaleuppolicyids + cmd.vmprofileid = vmprofileid + if interval: + cmd.interval = interval + if name: + cmd.name = name + + return AutoScaleVmGroup(apiclient.createAutoScaleVmGroup(cmd).__dict__) + + @classmethod + def list(cls, apiclient, **kwargs): + """Lists all available AutoscaleVM Group.""" + + cmd = listAutoScaleVmGroups.listAutoScaleVmGroupsCmd() + [setattr(cmd, k, v) for k, v in list(kwargs.items())] + return (apiclient.listAutoScaleVmGroups(cmd)) + + def enable(self, apiclient, **kwargs): + """Enables AutoscaleVM Group.""" + + cmd = enableAutoScaleVmGroup.enableAutoScaleVmGroupCmd() + cmd.id = self.id + [setattr(cmd, k, v) for k, v in list(kwargs.items())] + return (apiclient.enableAutoScaleVmGroup(cmd)) + + def disable(self, apiclient, **kwargs): + """Disables AutoscaleVM Group.""" + + cmd = disableAutoScaleVmGroup.disableAutoScaleVmGroupCmd() + cmd.id = self.id + [setattr(cmd, k, v) for k, v in list(kwargs.items())] + return (apiclient.disableAutoScaleVmGroup(cmd)) + + def update(self, apiclient, **kwargs): + """Updates Autoscale VM Group.""" + + cmd = updateAutoScaleVmGroup.updateAutoScaleVmGroupCmd() + cmd.id = self.id + [setattr(cmd, k, v) for k, v in list(kwargs.items())] + return (apiclient.updateAutoScaleVmGroup(cmd)) + + def delete(self, apiclient, cleanup=None): + """Deletes Autoscale VM Group.""" + + cmd = deleteAutoScaleVmGroup.deleteAutoScaleVmGroupCmd() + cmd.id = self.id + if cleanup: + cmd.cleanup = cleanup + apiclient.deleteAutoScaleVmGroup(cmd) + return class ServiceOffering: """Manage service offerings cycle""" diff --git a/tools/ngui/precache.py b/tools/ngui/precache.py index 720e1ace242f..e8f23011ccbb 100644 --- a/tools/ngui/precache.py +++ b/tools/ngui/precache.py @@ -16,4 +16,4 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -apicache = {u'authorize': {u'securitygroupingress': {u'name': u'authorizeSecurityGroupIngress', u'related': [u'authorizeSecurityGroupEgress'], u'isasync': True, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the security group. If the account parameter is used, domainId must also be used.'}, {u'name': u'startport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'start port for this ingress rule'}, {u'name': u'securitygroupid', u'required': False, u'related': [u'createSecurityGroup', u'listSecurityGroups'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the security group. Mutually exclusive with securityGroupName parameter'}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list associated'}, {u'name': u'usersecuritygrouplist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'user to security group mapping'}, {u'name': u'securitygroupname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The name of the security group. Mutually exclusive with securityGroupName parameter'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the security group. Must be used with domainId.'}, {u'name': u'icmpcode', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'error code for this icmp message'}, {u'name': u'protocol', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'TCP is default. UDP is the other supported protocol'}, {u'name': u'icmptype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'type of the icmp message being sent'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'an optional project of the security group'}, {u'name': u'endport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'end port for this ingress rule'}], u'requiredparams': [], u'description': u'Authorizes a particular ingress rule for this security group'}, u'securitygroupegress': {u'name': u'authorizeSecurityGroupEgress', u'related': [], u'isasync': True, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the security group. Must be used with domainId.'}, {u'name': u'securitygroupname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The name of the security group. Mutually exclusive with securityGroupName parameter'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the security group. If the account parameter is used, domainId must also be used.'}, {u'name': u'icmpcode', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'error code for this icmp message'}, {u'name': u'securitygroupid', u'required': False, u'related': [u'createSecurityGroup', u'listSecurityGroups'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the security group. Mutually exclusive with securityGroupName parameter'}, {u'name': u'icmptype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'type of the icmp message being sent'}, {u'name': u'protocol', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'TCP is default. UDP is the other supported protocol'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'an optional project of the security group'}, {u'name': u'endport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'end port for this egress rule'}, {u'name': u'usersecuritygrouplist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'user to security group mapping'}, {u'name': u'startport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'start port for this egress rule'}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list associated'}], u'requiredparams': [], u'description': u'Authorizes a particular egress rule for this security group'}}, u'restore': {u'virtualmachine': {u'name': u'restoreVirtualMachine', u'related': [u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine'], u'isasync': True, u'params': [{u'name': u'virtualmachineid', u'required': True, u'related': [u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'Virtual Machine ID'}], u'requiredparams': [u'virtualmachineid'], u'description': u'Restore a VM to original template or specific snapshot'}}, u'suspend': {u'project': {u'name': u'suspendProject', u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'suspendProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to be suspended'}], u'requiredparams': [u'id'], u'description': u'Suspends a project'}}, u'revoke': {u'securitygroupingress': {u'name': u'revokeSecurityGroupIngress', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'The ID of the ingress rule'}], u'requiredparams': [u'id'], u'description': u'Deletes a particular ingress rule from this security group'}, u'securitygroupegress': {u'name': u'revokeSecurityGroupEgress', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'The ID of the egress rule'}], u'requiredparams': [u'id'], u'description': u'Deletes a particular egress rule from this security group'}}, u'disassociate': {u'ipaddress': {u'name': u'disassociateIpAddress', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'the id of the public ip address to disassociate'}], u'requiredparams': [u'id'], u'description': u'Disassociates an ip address from the account.'}}, u'migrate': {u'volume': {u'name': u'migrateVolume', u'related': [u'detachVolume', u'resizeVolume', u'attachVolume', u'uploadVolume', u'createVolume'], u'isasync': True, u'params': [{u'name': u'volumeid', u'required': True, u'related': [u'migrateVolume', u'detachVolume', u'resizeVolume', u'attachVolume', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the volume'}, {u'name': u'storageid', u'required': True, u'related': [u'cancelStorageMaintenance', u'enableStorageMaintenance', u'updateStoragePool', u'createStoragePool', u'listStoragePools'], u'length': 255, u'type': u'uuid', u'description': u'destination storage pool ID to migrate the volume to'}], u'requiredparams': [u'volumeid', u'storageid'], u'description': u'Migrate volume'}, u'systemvm': {u'name': u'migrateSystemVm', u'related': [], u'isasync': True, u'params': [{u'name': u'virtualmachineid', u'required': True, u'related': [u'rebootSystemVm', u'listSystemVms'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine'}, {u'name': u'hostid', u'required': True, u'related': [u'addHost', u'updateHost', u'listHosts', u'listExternalLoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'destination Host ID to migrate VM to'}], u'requiredparams': [u'virtualmachineid', u'hostid'], u'description': u'Attempts Migration of a system virtual machine to the host specified.'}, u'virtualmachine': {u'name': u'migrateVirtualMachine', u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'deployVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'storageid', u'required': False, u'related': [u'cancelStorageMaintenance'], u'length': 255, u'type': u'long', u'description': u'Destination storage pool ID to migrate VM volumes to. Required for migrating the root disk volume'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine'}, {u'name': u'hostid', u'required': False, u'related': [u'addHost', u'updateHost', u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'Destination Host ID to migrate VM to. Required for live migrating a VM from host to host'}], u'requiredparams': [u'virtualmachineid'], u'description': u'Attempts Migration of a VM to a different host or Root volume of the vm to a different storage pool'}}, u'lock': {u'account': {u'name': u'lockAccount', u'related': [u'markDefaultZoneForAccount'], u'isasync': False, u'params': [{u'name': u'domainid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Locks the specified account on this domain.'}, {u'name': u'account', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Locks the specified account.'}], u'requiredparams': [u'domainid', u'account'], u'description': u'Locks an account'}, u'user': {u'name': u'lockUser', u'related': [u'listUsers'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'lockUser', u'listUsers'], u'length': 255, u'type': u'uuid', u'description': u'Locks user by user ID.'}], u'requiredparams': [u'id'], u'description': u'Locks a user account'}}, u'dissociate': {u'lun': {u'name': u'dissociateLun', u'related': [], u'isasync': False, u'params': [{u'name': u'iqn', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Guest IQN.'}, {u'name': u'path', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'LUN path.'}], u'requiredparams': [u'iqn', u'path'], u'description': u'Dissociate a LUN'}}, u'activate': {u'project': {u'name': u'activateProject', u'related': [u'createProject', u'listProjectAccounts'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to be modified'}], u'requiredparams': [u'id'], u'description': u'Activates a project'}}, u'reconnect': {u'host': {u'name': u'reconnectHost', u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addSecondaryStorage', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers', u'prepareHostForMaintenance'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addSecondaryStorage', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'reconnectHost', u'listExternalLoadBalancers', u'prepareHostForMaintenance'], u'length': 255, u'type': u'uuid', u'description': u'the host ID'}], u'requiredparams': [u'id'], u'description': u'Reconnects a host.'}}, u'cancel': {u'hostmaintenance': {u'name': u'cancelHostMaintenance', u'related': [u'listSwifts', u'addHost', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'the host ID'}], u'requiredparams': [u'id'], u'description': u'Cancels host maintenance.'}, u'storagemaintenance': {u'name': u'cancelStorageMaintenance', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'cancelStorageMaintenance'], u'length': 255, u'type': u'uuid', u'description': u'the primary storage ID'}], u'requiredparams': [u'id'], u'description': u'Cancels maintenance for primary storage'}}, u'query': {u'asyncjobresult': {u'name': u'queryAsyncJobResult', u'related': [], u'isasync': False, u'params': [{u'name': u'jobid', u'required': True, u'related': [u'queryAsyncJobResult'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the asynchronous job'}], u'requiredparams': [u'jobid'], u'description': u'Retrieves the current status of asynchronous job.'}}, u'recover': {u'virtualmachine': {u'name': u'recoverVirtualMachine', u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}], u'requiredparams': [u'id'], u'description': u'Recovers a virtual machine.'}}, u'extract': {u'volume': {u'name': u'extractVolume', u'related': [u'extractTemplate', u'extractIso'], u'isasync': True, u'params': [{u'name': u'url', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the url to which the volume would be extracted'}, {u'name': u'id', u'required': True, u'related': [u'migrateVolume', u'detachVolume', u'resizeVolume', u'attachVolume', u'listVolumes', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the volume'}, {u'name': u'mode', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone where the volume is located'}], u'requiredparams': [u'id', u'mode', u'zoneid'], u'description': u'Extracts volume'}, u'iso': {u'name': u'extractIso', u'related': [u'extractTemplate'], u'isasync': True, u'params': [{u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone where the ISO is originally located'}, {u'name': u'url', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the url to which the ISO would be extracted'}, {u'name': u'mode', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD'}, {u'name': u'id', u'required': True, u'related': [u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the ISO file'}], u'requiredparams': [u'mode', u'id'], u'description': u'Extracts an ISO'}, u'template': {u'name': u'extractTemplate', u'related': [], u'isasync': True, u'params': [{u'name': u'mode', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD'}, {u'name': u'id', u'required': True, u'related': [u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the template'}, {u'name': u'url', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the url to which the ISO would be extracted'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone where the ISO is originally located'}], u'requiredparams': [u'mode', u'id'], u'description': u'Extracts a template'}}, u'copy': {u'iso': {u'name': u'copyIso', u'related': [u'updateIso', u'listIsos'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'Template ID.'}, {u'name': u'destzoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'ID of the zone the template is being copied to.'}, {u'name': u'sourcezoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'ID of the zone the template is currently hosted on.'}], u'requiredparams': [u'id', u'destzoneid', u'sourcezoneid'], u'description': u'Copies an iso from one zone to another.'}, u'template': {u'name': u'copyTemplate', u'related': [u'listTemplates', u'registerIso', u'updateTemplate', u'prepareTemplate', u'registerTemplate', u'copyIso', u'updateIso', u'listIsos'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'copyTemplate', u'listTemplates', u'registerIso', u'updateTemplate', u'prepareTemplate', u'registerTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'Template ID.'}, {u'name': u'destzoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'ID of the zone the template is being copied to.'}, {u'name': u'sourcezoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'ID of the zone the template is currently hosted on.'}], u'requiredparams': [u'id', u'destzoneid', u'sourcezoneid'], u'description': u'Copies a template from one zone to another.'}}, u'prepare': {u'hostformaintenance': {u'name': u'prepareHostForMaintenance', u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addSecondaryStorage', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addSecondaryStorage', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers', u'prepareHostForMaintenance'], u'length': 255, u'type': u'uuid', u'description': u'the host ID'}], u'requiredparams': [u'id'], u'description': u'Prepares a host for maintenance.'}, u'template': {u'name': u'prepareTemplate', u'related': [u'registerIso', u'updateTemplate', u'copyIso', u'updateIso', u'listIsos'], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'zone ID of the template to be prepared in primary storage(s).'}, {u'name': u'templateid', u'required': True, u'related': [u'registerIso', u'updateTemplate', u'prepareTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'template ID of the template to be prepared in primary storage(s).'}], u'requiredparams': [u'zoneid', u'templateid'], u'description': u'load template into primary storage'}}, u'attach': {u'volume': {u'name': u'attachVolume', u'related': [u'detachVolume', u'resizeVolume', u'uploadVolume', u'createVolume'], u'isasync': True, u'params': [{u'name': u'deviceid', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'the ID of the device to map the volume to within the guest OS. If no deviceId is passed in, the next available deviceId will be chosen. Possible values for a Linux OS are:* 1 - /dev/xvdb* 2 - /dev/xvdc* 4 - /dev/xvde* 5 - /dev/xvdf* 6 - /dev/xvdg* 7 - /dev/xvdh* 8 - /dev/xvdi* 9 - /dev/xvdj'}, {u'name': u'id', u'required': True, u'related': [u'detachVolume', u'resizeVolume', u'attachVolume', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u' the ID of the virtual machine'}], u'requiredparams': [u'id', u'virtualmachineid'], u'description': u'Attaches a disk volume to a virtual machine.'}, u'iso': {u'name': u'attachIso', u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'virtualmachineid', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine'}, {u'name': u'id', u'required': True, u'related': [u'listTemplates', u'registerIso', u'updateTemplate', u'prepareTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the ISO file'}], u'requiredparams': [u'virtualmachineid', u'id'], u'description': u'Attaches an ISO to a virtual machine.'}}, u'create': {u'loadbalancerrule': {u'name': u'createLoadBalancerRule', u'related': [u'updateLoadBalancerRule'], u'isasync': True, u'params': [{u'name': u'openfirewall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, firewall rule for source/end public port is automatically created; if false - firewall rule has to be created explicitely. If not specified 1) defaulted to false when LB rule is being created for VPC guest network 2) in all other cases defaulted to true'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account associated with the load balancer. Must be used with the domainId parameter.'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the domain ID associated with the load balancer'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'zone where the load balancer is going to be created. This parameter is required when LB service provider is ElasticLoadBalancerVm'}, {u'name': u'publicipid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'public ip address id from where the network traffic will be load balanced from'}, {u'name': u'algorithm', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'load balancer algorithm (source, roundrobin, leastconn)'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the load balancer rule'}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list to forward traffic from'}, {u'name': u'publicport', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the public port from where the network traffic will be load balanced from'}, {u'name': u'description', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the description of the load balancer rule'}, {u'name': u'privateport', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the private port of the private ip address/virtual machine where the network traffic will be load balanced to'}, {u'name': u'networkid', u'required': False, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'The guest network this rule will be created for. Required when public Ip address is not associated with any Guest network yet (VPC case)'}], u'requiredparams': [u'algorithm', u'name', u'publicport', u'privateport'], u'description': u'Creates a load balancer rule'}, u'domain': {u'name': u'createDomain', u'related': [], u'isasync': False, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'creates domain with this name'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Domain UUID, required for adding domain from another Region'}, {u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Network domain for networks in the domain'}, {u'name': u'parentdomainid', u'required': False, u'related': [u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'assigns new domain a parent domain by domain ID of the parent. If no parent domain is specied, the ROOT domain is assumed.'}], u'requiredparams': [u'name'], u'description': u'Creates a domain'}, u'snapshotpolicy': {u'name': u'createSnapshotPolicy', u'related': [u'listSnapshotPolicies'], u'isasync': False, u'params': [{u'name': u'intervaltype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'valid values are HOURLY, DAILY, WEEKLY, and MONTHLY'}, {u'name': u'maxsnaps', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'maximum number of snapshots to retain'}, {u'name': u'schedule', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'time the snapshot is scheduled to be taken. Format is:* if HOURLY, MM* if DAILY, MM:HH* if WEEKLY, MM:HH:DD (1-7)* if MONTHLY, MM:HH:DD (1-28)'}, {u'name': u'timezone', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.'}, {u'name': u'volumeid', u'required': True, u'related': [u'detachVolume', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}], u'requiredparams': [u'intervaltype', u'maxsnaps', u'schedule', u'timezone', u'volumeid'], u'description': u'Creates a snapshot policy for the account.'}, u'diskoffering': {u'name': u'createDiskOffering', u'related': [u'listDiskOfferings'], u'isasync': False, u'params': [{u'name': u'customized', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'whether disk offering is custom or not'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 4096, u'type': u'string', u'description': u'alternate display text of the disk offering'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the containing domain, null for public offerings'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the disk offering'}, {u'name': u'disksize', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'size of the disk offering in GB'}, {u'name': u'storagetype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the storage type of the disk offering. Values are local and shared.'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'tags for the disk offering'}], u'requiredparams': [u'displaytext', u'name'], u'description': u'Creates a disk offering.'}, u'securitygroup': {u'name': u'createSecurityGroup', u'related': [u'listSecurityGroups'], u'isasync': False, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the security group. Must be used with domainId.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the security group. If the account parameter is used, domainId must also be used.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the security group'}, {u'name': u'description', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the description of the security group'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Deploy vm for the project'}], u'requiredparams': [u'name'], u'description': u'Creates a security group'}, u'portforwardingrule': {u'name': u'createPortForwardingRule', u'related': [u'listIpForwardingRules'], u'isasync': True, u'params': [{u'name': u'privateport', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u"the starting port of port forwarding rule's private port range"}, {u'name': u'ipaddressid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the IP address id of the port forwarding rule'}, {u'name': u'protocol', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the protocol for the port fowarding rule. Valid values are TCP or UDP.'}, {u'name': u'openfirewall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, firewall rule for source/end pubic port is automatically created; if false - firewall rule has to be created explicitely. If not specified 1) defaulted to false when PF rule is being created for VPC guest network 2) in all other cases defaulted to true'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine for the port forwarding rule'}, {u'name': u'privateendport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u"the ending port of port forwarding rule's private port range"}, {u'name': u'networkid', u'required': False, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'The network of the vm the Port Forwarding rule will be created for. Required when public Ip address is not associated with any Guest network yet (VPC case)'}, {u'name': u'publicendport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u"the ending port of port forwarding rule's private port range"}, {u'name': u'publicport', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u"the starting port of port forwarding rule's public port range"}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list to forward traffic from'}], u'requiredparams': [u'privateport', u'ipaddressid', u'protocol', u'virtualmachineid', u'publicport'], u'description': u'Creates a port forwarding rule'}, u'pod': {u'name': u'createPod', u'related': [u'updatePod', u'listPods'], u'isasync': False, u'params': [{u'name': u'startip', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the starting IP address for the Pod'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the Pod'}, {u'name': u'zoneid', u'required': True, u'related': [u'listZones'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID in which the Pod will be created'}, {u'name': u'endip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IP address for the Pod'}, {u'name': u'netmask', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask for the Pod'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this Pod for allocation of new resources'}, {u'name': u'gateway', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway for the Pod'}], u'requiredparams': [u'startip', u'name', u'zoneid', u'netmask', u'gateway'], u'description': u'Creates a new Pod.'}, u'ipforwardingrule': {u'name': u'createIpForwardingRule', u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'listPortForwardingRules', u'createPortForwardingRule'], u'isasync': True, u'params': [{u'name': u'endport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the end port for the rule'}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list to forward traffic from'}, {u'name': u'ipaddressid', u'required': True, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'the public IP address id of the forwarding rule, already associated via associateIp'}, {u'name': u'openfirewall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, firewall rule for source/end pubic port is automatically created; if false - firewall rule has to be created explicitely. Has value true by default'}, {u'name': u'startport', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the start port for the rule'}, {u'name': u'protocol', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the protocol for the rule. Valid values are TCP or UDP.'}], u'requiredparams': [u'ipaddressid', u'startport', u'protocol'], u'description': u'Creates an ip forwarding rule'}, u'vpnconnection': {u'name': u'createVpnConnection', u'related': [u'listVpnConnections', u'resetVpnConnection'], u'isasync': True, u'params': [{u'name': u's2svpngatewayid', u'required': True, u'related': [u'createVpnGateway', u'listVpnGateways'], u'length': 255, u'type': u'uuid', u'description': u'id of the vpn gateway'}, {u'name': u's2scustomergatewayid', u'required': True, u'related': [u'updateVpnCustomerGateway', u'createVpnCustomerGateway', u'listVpnCustomerGateways'], u'length': 255, u'type': u'uuid', u'description': u'id of the customer gateway'}], u'requiredparams': [u's2svpngatewayid', u's2scustomergatewayid'], u'description': u'Create site to site vpn connection'}, u'vpncustomergateway': {u'name': u'createVpnCustomerGateway', u'related': [], u'isasync': True, u'params': [{u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the domain ID associated with the gateway. If used with the account parameter returns the gateway associated with the account for the specified domain.'}, {u'name': u'gateway', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'public ip address id of the customer gateway'}, {u'name': u'esplifetime', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'Lifetime of phase 2 VPN connection to the customer gateway, in seconds'}, {u'name': u'esppolicy', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'ESP policy of the customer gateway'}, {u'name': u'ikepolicy', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'IKE policy of the customer gateway'}, {u'name': u'cidrlist', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'guest cidr list of the customer gateway'}, {u'name': u'dpd', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'If DPD is enabled for VPN connection'}, {u'name': u'ipsecpsk', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'IPsec Preshared-Key of the customer gateway'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account associated with the gateway. Must be used with the domainId parameter.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of this customer gateway'}, {u'name': u'ikelifetime', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'Lifetime of phase 1 VPN connection to the customer gateway, in seconds'}], u'requiredparams': [u'gateway', u'esppolicy', u'ikepolicy', u'cidrlist', u'ipsecpsk'], u'description': u'Creates site to site vpn customer gateway'}, u'lbstickinesspolicy': {u'name': u'createLBStickinessPolicy', u'related': [], u'isasync': True, u'params': [{u'name': u'lbruleid', u'required': True, u'related': [u'listIpForwardingRules'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the LB Stickiness policy'}, {u'name': u'methodname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the LB Stickiness policy method, possible values can be obtained from ListNetworks API '}, {u'name': u'description', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the description of the LB Stickiness policy'}, {u'name': u'param', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'param list. Example: param[0].name=cookiename¶m[0].value=LBCookie '}], u'requiredparams': [u'lbruleid', u'name', u'methodname'], u'description': u'Creates a Load Balancer stickiness policy '}, u'vpcoffering': {u'name': u'createVPCOffering', u'related': [u'listVPCOfferings'], u'isasync': True, u'params': [{u'name': u'displaytext', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the vpc offering'}, {u'name': u'supportedservices', u'required': True, u'related': [], u'length': 255, u'type': u'list', u'description': u'services supported by the vpc offering'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the vpc offering'}], u'requiredparams': [u'displaytext', u'supportedservices', u'name'], u'description': u'Creates VPC offering'}, u'network': {u'name': u'createNetwork', u'related': [u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'isasync': False, u'params': [{u'name': u'endipv6', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IPv6 address in the IPv6 network range'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'an optional project for the ssh key'}, {u'name': u'ip6cidr', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the CIDR of IPv6 network, must be at least /64'}, {u'name': u'acltype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Access control type; supported values are account and domain. In 3.0 all shared networks should have aclType=Domain, and all Isolated networks - Account. Account means that only the account owner can use the network, domain - all accouns in the domain can use the network'}, {u'name': u'gateway', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway of the network. Required for Shared networks and Isolated networks when it belongs to VPC'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the network'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID the network belongs to'}, {u'name': u'subdomainaccess', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Defines whether to allow subdomains to use networks dedicated to their parent domain(s). Should be used with aclType=Domain, defaulted to allow.subdomain.network.access global config if not specified'}, {u'name': u'startip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the beginning IP address in the network IP range'}, {u'name': u'netmask', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask of the network. Required for Shared networks and Isolated networks when it belongs to VPC'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'domain ID of the account owning a network'}, {u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'network domain'}, {u'name': u'ip6gateway', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway of the IPv6 network. Required for Shared networks and Isolated networks when it belongs to VPC'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'account who will own the network'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the network'}, {u'name': u'startipv6', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the beginning IPv6 address in the IPv6 network range'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the network'}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'the VPC network belongs to'}, {u'name': u'endip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IP address in the network IP range. If not specified, will be defaulted to startIP'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ID or VID of the network'}, {u'name': u'networkofferingid', u'required': True, u'related': [u'createNetworkOffering', u'updateNetworkOffering'], u'length': 255, u'type': u'uuid', u'description': u'the network offering id'}], u'requiredparams': [u'displaytext', u'zoneid', u'name', u'networkofferingid'], u'description': u'Creates a network'}, u'zone': {u'name': u'createZone', u'related': [u'listZones'], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the containing domain, null for public zones'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the Zone'}, {u'name': u'ip6dns2', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the second DNS for IPv6 network in the Zone'}, {u'name': u'domain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Network domain name for the networks in the zone'}, {u'name': u'internaldns1', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the first internal DNS for the Zone'}, {u'name': u'localstorageenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if local storage offering enabled, false otherwise'}, {u'name': u'securitygroupenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if network is security group enabled, false otherwise'}, {u'name': u'networktype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'network type of the zone, can be Basic or Advanced'}, {u'name': u'internaldns2', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the second internal DNS for the Zone'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this Zone for allocation of new resources'}, {u'name': u'guestcidraddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the guest CIDR address for the Zone'}, {u'name': u'dns1', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the first DNS for the Zone'}, {u'name': u'ip6dns1', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the first DNS for IPv6 network in the Zone'}, {u'name': u'dns2', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the second DNS for the Zone'}], u'requiredparams': [u'name', u'internaldns1', u'networktype', u'dns1'], u'description': u'Creates a Zone.'}, u'remoteaccessvpn': {u'name': u'createRemoteAccessVpn', u'related': [], u'isasync': True, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the VPN. Must be used with domainId.'}, {u'name': u'openfirewall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, firewall rule for source/end pubic port is automatically created; if false - firewall rule has to be created explicitely. Has value true by default'}, {u'name': u'publicipid', u'required': True, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'public ip address id of the vpn server'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the VPN. If the account parameter is used, domainId must also be used.'}, {u'name': u'iprange', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the range of ip addresses to allocate to vpn clients. The first ip in the range will be taken by the vpn server'}], u'requiredparams': [u'publicipid'], u'description': u'Creates a l2tp/ipsec remote access vpn'}, u'instancegroup': {u'name': u'createInstanceGroup', u'related': [], u'isasync': False, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account of the instance group. The account parameter must be used with the domainId parameter.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'The project of the instance group'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the instance group'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the domain ID of account owning the instance group'}], u'requiredparams': [u'name'], u'description': u'Creates a vm group'}, u'autoscalepolicy': {u'name': u'createAutoScalePolicy', u'related': [u'updateAutoScalePolicy'], u'isasync': True, u'params': [{u'name': u'action', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the action to be executed if all the conditions evaluate to true for the specified duration.'}, {u'name': u'quiettime', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the cool down period for which the policy should not be evaluated after the action has been taken'}, {u'name': u'conditionids', u'required': True, u'related': [], u'length': 255, u'type': u'list', u'description': u'the list of IDs of the conditions that are being evaluated on every interval'}, {u'name': u'duration', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the duration for which the conditions have to be true before action is taken'}], u'requiredparams': [u'action', u'conditionids', u'duration'], u'description': u'Creates an autoscale policy for a provision or deprovision action, the action is taken when the all the conditions evaluates to true for the specified duration. The policy is in effect once it is attached to a autscale vm group.'}, u'tags': {u'name': u'createTags', u'related': [], u'isasync': True, u'params': [{u'name': u'tags', u'required': True, u'related': [], u'length': 255, u'type': u'map', u'description': u'Map of tags (key/value pairs)'}, {u'name': u'resourcetype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'type of the resource'}, {u'name': u'customer', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"identifies client specific tag. When the value is not null, the tag can't be used by cloudStack code internally"}, {u'name': u'resourceids', u'required': True, u'related': [], u'length': 255, u'type': u'list', u'description': u'list of resources to create the tags for'}], u'requiredparams': [u'tags', u'resourcetype', u'resourceids'], u'description': u'Creates resource tag(s)'}, u'serviceoffering': {u'name': u'createServiceOffering', u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings'], u'isasync': False, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the service offering'}, {u'name': u'storagetype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the storage type of the service offering. Values are local and shared.'}, {u'name': u'issystem', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'is this a system vm offering'}, {u'name': u'cpunumber', u'required': True, u'related': [], u'length': 255, u'type': u'long', u'description': u'the CPU number of the service offering'}, {u'name': u'systemvmtype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the system VM type. Possible types are "domainrouter", "consoleproxy" and "secondarystoragevm".'}, {u'name': u'limitcpuuse', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'restrict the CPU usage to committed service offering'}, {u'name': u'hosttags', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the host tag for this service offering.'}, {u'name': u'offerha', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'the HA for the service offering'}, {u'name': u'memory', u'required': True, u'related': [], u'length': 255, u'type': u'long', u'description': u'the total memory of the service offering in MB'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the containing domain, null for public offerings'}, {u'name': u'cpuspeed', u'required': True, u'related': [], u'length': 255, u'type': u'long', u'description': u'the CPU speed of the service offering in MHz.'}, {u'name': u'networkrate', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'data transfer rate in megabits per second allowed. Supported only for non-System offering and system offerings having "domainrouter" systemvmtype'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the service offering'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the tags for this service offering.'}], u'requiredparams': [u'name', u'cpunumber', u'memory', u'cpuspeed', u'displaytext'], u'description': u'Creates a service offering.'}, u'condition': {u'name': u'createCondition', u'related': [], u'isasync': True, u'params': [{u'name': u'threshold', u'required': True, u'related': [], u'length': 255, u'type': u'long', u'description': u'Threshold value.'}, {u'name': u'counterid', u'required': True, u'related': [u'listConditions', u'listCounters', u'createCounter'], u'length': 255, u'type': u'uuid', u'description': u'ID of the Counter.'}, {u'name': u'relationaloperator', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Relational Operator to be used with threshold.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account of the condition. Must be used with the domainId parameter.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the domain ID of the account.'}], u'requiredparams': [u'threshold', u'counterid', u'relationaloperator'], u'description': u'Creates a condition'}, u'storagepool': {u'name': u'createStoragePool', u'related': [u'cancelStorageMaintenance', u'listStoragePools'], u'isasync': False, u'params': [{u'name': u'clusterid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the cluster ID for the storage pool'}, {u'name': u'zoneid', u'required': True, u'related': [u'listZones'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the storage pool'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name for the storage pool'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the tags for the storage pool'}, {u'name': u'podid', u'required': True, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID for the storage pool'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL of the storage pool'}, {u'name': u'details', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'the details for the storage pool'}], u'requiredparams': [u'clusterid', u'zoneid', u'name', u'podid', u'url'], u'description': u'Creates a storage pool.'}, u'vpngateway': {u'name': u'createVpnGateway', u'related': [], u'isasync': True, u'params': [{u'name': u'vpcid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'public ip address id of the vpn gateway'}], u'requiredparams': [u'vpcid'], u'description': u'Creates site to site vpn local gateway'}, u'autoscalevmgroup': {u'name': u'createAutoScaleVmGroup', u'related': [u'updateAutoScaleVmGroup'], u'isasync': True, u'params': [{u'name': u'vmprofileid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the autoscale profile that contains information about the vms in the vm group.'}, {u'name': u'scaledownpolicyids', u'required': True, u'related': [u'updateAutoScalePolicy'], u'length': 255, u'type': u'list', u'description': u'list of scaledown autoscale policies'}, {u'name': u'scaleuppolicyids', u'required': True, u'related': [u'updateAutoScalePolicy'], u'length': 255, u'type': u'list', u'description': u'list of scaleup autoscale policies'}, {u'name': u'interval', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the frequency at which the conditions have to be evaluated'}, {u'name': u'minmembers', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the minimum number of members in the vmgroup, the number of instances in the vm group will be equal to or more than this number.'}, {u'name': u'maxmembers', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'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.'}, {u'name': u'lbruleid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}], u'requiredparams': [u'vmprofileid', u'scaledownpolicyids', u'scaleuppolicyids', u'minmembers', u'maxmembers', u'lbruleid'], u'description': u'Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.'}, u'networkacl': {u'name': u'createNetworkACL', u'related': [], u'isasync': True, u'params': [{u'name': u'icmpcode', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'error code for this icmp message'}, {u'name': u'endport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the ending port of ACL'}, {u'name': u'traffictype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the traffic type for the ACL,can be Ingress or Egress, defaulted to Ingress if not specified'}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list to allow traffic from/to'}, {u'name': u'networkid', u'required': True, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'The network of the vm the ACL will be created for'}, {u'name': u'protocol', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the protocol for the ACL rule. Valid values are TCP/UDP/ICMP.'}, {u'name': u'startport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the starting port of ACL'}, {u'name': u'icmptype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'type of the icmp message being sent'}], u'requiredparams': [u'networkid', u'protocol'], u'description': u'Creates a ACL rule the given network (the network has to belong to VPC)'}, u'template': {u'name': u'createTemplate', u'related': [u'cancelStorageMaintenance', u'enableStorageMaintenance', u'updateStoragePool', u'createStoragePool', u'listStoragePools'], u'isasync': True, u'params': [{u'name': u'ostypeid', u'required': True, u'related': [u'listOsTypes'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the OS Type that best represents the OS of this template.'}, {u'name': u'templatetag', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the tag for this template.'}, {u'name': u'bits', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'32 or 64 bit'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this template is a public template, false otherwise'}, {u'name': u'volumeid', u'required': False, u'related': [u'migrateVolume', u'detachVolume', u'resizeVolume', u'attachVolume', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume the template is being created from. Either this parameter, or snapshotId has to be passed in'}, {u'name': u'passwordenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template supports the password reset feature; default is false'}, {u'name': u'snapshotid', u'required': False, u'related': [u'createSnapshot', u'listSnapshots'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the snapshot the template is being created from. Either this parameter, or volumeId has to be passed in'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'listLoadBalancerRuleInstances', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'Optional, VM ID. If this presents, it is going to create a baremetal template for VM this ID refers to. This is only for VM whose hypervisor type is BareMetal'}, {u'name': u'url', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Optional, only for baremetal hypervisor. The directory name where template stored on CIFS server'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the display text of the template. This is usually used for display purposes.'}, {u'name': u'details', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'Template details in key/value pairs.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the template'}, {u'name': u'isfeatured', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this template is a featured template, false otherwise'}, {u'name': u'requireshvm', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template requires HVM, false otherwise'}], u'requiredparams': [u'ostypeid', u'displaytext', u'name'], u'description': u'Creates a template of a virtual machine. The virtual machine must be in a STOPPED state. A template created from this command is automatically designated as a private template visible to the account that created it.'}, u'privategateway': {u'name': u'createPrivateGateway', u'related': [], u'isasync': True, u'params': [{u'name': u'vlan', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the Vlan for the private gateway'}, {u'name': u'gateway', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway of the Private gateway'}, {u'name': u'netmask', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask of the Private gateway'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID the network belongs to'}, {u'name': u'vpcid', u'required': True, u'related': [u'restartVPC'], u'length': 255, u'type': u'uuid', u'description': u'the VPC network belongs to'}, {u'name': u'ipaddress', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the IP address of the Private gateaway'}], u'requiredparams': [u'vlan', u'gateway', u'netmask', u'vpcid', u'ipaddress'], u'description': u'Creates a private gateway'}, u'volumeonfiler': {u'name': u'createVolumeOnFiler', u'related': [], u'isasync': False, u'params': [{u'name': u'volumename', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'volume name.'}, {u'name': u'aggregatename', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'aggregate name.'}, {u'name': u'poolname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}, {u'name': u'snapshotpolicy', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'snapshot policy.'}, {u'name': u'ipaddress', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'ip address.'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'password.'}, {u'name': u'size', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'volume size.'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'user name.'}, {u'name': u'snapshotreservation', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'snapshot reservation.'}], u'requiredparams': [u'volumename', u'aggregatename', u'poolname', u'ipaddress', u'password', u'size', u'username'], u'description': u'Create a volume'}, u'staticroute': {u'name': u'createStaticRoute', u'related': [], u'isasync': True, u'params': [{u'name': u'gatewayid', u'required': True, u'related': [u'createPrivateGateway'], u'length': 255, u'type': u'uuid', u'description': u'the gateway id we are creating static route for'}, {u'name': u'cidr', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'static route cidr'}], u'requiredparams': [u'gatewayid', u'cidr'], u'description': u'Creates a static route'}, u'volume': {u'name': u'createVolume', u'related': [u'detachVolume', u'uploadVolume'], u'isasync': True, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the disk volume'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the availability zone'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts'], u'length': 255, u'type': u'uuid', u'description': u'the project associated with the volume. Mutually exclusive with account parameter'}, {u'name': u'diskofferingid', u'required': False, u'related': [u'updateDiskOffering', u'createDiskOffering', u'listDiskOfferings'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk offering. Either diskOfferingId or snapshotId must be passed in.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account associated with the disk volume. Must be used with the domainId parameter.'}, {u'name': u'size', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'Arbitrary volume size'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the domain ID associated with the disk offering. If used with the account parameter returns the disk volume associated with the account for the specified domain.'}, {u'name': u'snapshotid', u'required': False, u'related': [u'createSnapshot', u'listSnapshots'], u'length': 255, u'type': u'uuid', u'description': u'the snapshot ID for the disk volume. Either diskOfferingId or snapshotId must be passed in.'}], u'requiredparams': [u'name'], u'description': u'Creates a disk volume from a disk offering. This disk volume must still be attached to a virtual machine to make use of it.'}, u'user': {u'name': u'createUser', u'related': [u'lockUser', u'listUsers'], u'isasync': False, u'params': [{u'name': u'account', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Creates the user under the specified account. If no account is specified, the username will be used as the account name.'}, {u'name': u'userid', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'User UUID, required for adding account from external provisioning system'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Unique username.'}, {u'name': u'timezone', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Creates the user under the specified domain. Has to be accompanied with the account parameter'}, {u'name': u'email', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'email'}, {u'name': u'lastname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'lastname'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Hashed password (Default is MD5). If you wish to use any other hashing algorithm, you would need to write a custom authentication adapter See Docs section.'}, {u'name': u'firstname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'firstname'}], u'requiredparams': [u'account', u'username', u'email', u'lastname', u'password', u'firstname'], u'description': u'Creates a user for an account that already exists'}, u'vpc': {u'name': u'createVPC', u'related': [u'updateVPC', u'restartVPC', u'listVPCs'], u'isasync': True, u'params': [{u'name': u'displaytext', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the VPC'}, {u'name': u'zoneid', u'required': True, u'related': [u'listZones'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the availability zone'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the VPC'}, {u'name': u'vpcofferingid', u'required': True, u'related': [u'listVPCOfferings', u'createVPCOffering'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the VPC offering'}, {u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'VPC network domain. All networks inside the VPC will belong to this domain'}, {u'name': u'cidr', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u"the cidr of the VPC. All VPC guest networks' cidrs should be within this CIDR"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account associated with the VPC. Must be used with the domainId parameter.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the domain ID associated with the VPC. If used with the account parameter returns the VPC associated with the account for the specified domain.'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts'], u'length': 255, u'type': u'uuid', u'description': u'create VPC for the project'}], u'requiredparams': [u'displaytext', u'zoneid', u'name', u'vpcofferingid', u'cidr'], u'description': u'Creates a VPC'}, u'storagenetworkiprange': {u'name': u'createStorageNetworkIpRange', u'related': [u'listStorageNetworkIpRange', u'updateStorageNetworkIpRange'], u'isasync': True, u'params': [{u'name': u'startip', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the beginning IP address'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Optional. The vlan the ip range sits on, default to Null when it is not specified which means you network is not on any Vlan. This is mainly for Vmware as other hypervisors can directly reterive bridge from pyhsical network traffic type table'}, {u'name': u'podid', u'required': True, u'related': [u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'UUID of pod where the ip range belongs to'}, {u'name': u'netmask', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask for storage network'}, {u'name': u'endip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IP address'}, {u'name': u'gateway', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway for storage network'}], u'requiredparams': [u'startip', u'podid', u'netmask', u'gateway'], u'description': u'Creates a Storage network IP range.'}, u'pool': {u'name': u'createPool', u'related': [], u'isasync': False, u'params': [{u'name': u'algorithm', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'algorithm.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}], u'requiredparams': [u'algorithm', u'name'], u'description': u'Create a pool'}, u'autoscalevmprofile': {u'name': u'createAutoScaleVmProfile', u'related': [u'updateAutoScaleVmProfile', u'listAutoScaleVmProfiles'], u'isasync': True, u'params': [{u'name': u'otherdeployparams', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'parameters other than zoneId/serviceOfferringId/templateId of the auto deployed virtual machine'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'availability zone for the auto deployed virtual machine'}, {u'name': u'serviceofferingid', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings', u'createServiceOffering', u'updateServiceOffering'], u'length': 255, u'type': u'uuid', u'description': u'the service offering of the auto deployed virtual machine'}, {u'name': u'destroyvmgraceperiod', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the time allowed for existing connections to get closed before a vm is destroyed'}, {u'name': u'counterparam', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'counterparam list. Example: counterparam[0].name=snmpcommunity&counterparam[0].value=public&counterparam[1].name=snmpport&counterparam[1].value=161'}, {u'name': u'templateid', u'required': True, u'related': [u'registerIso', u'updateTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the template of the auto deployed virtual machine'}, {u'name': u'autoscaleuserid', u'required': False, u'related': [u'disableUser', u'lockUser', u'listUsers', u'enableUser', u'createUser', u'updateUser'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the user used to launch and destroy the VMs'}], u'requiredparams': [u'zoneid', u'serviceofferingid', u'templateid'], u'description': u'Creates a profile that contains information about the virtual machine which will be provisioned automatically by autoscale feature.'}, u'account': {u'name': u'createAccount', u'related': [u'disableUser', u'lockUser', u'listUsers', u'enableUser', u'createUser', u'getUser', u'updateUser'], u'isasync': False, u'params': [{u'name': u'lastname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'lastname'}, {u'name': u'accounttype', u'required': True, u'related': [], u'length': 255, u'type': u'short', u'description': u'Type of the account. Specify 0 for user, 1 for root admin, and 2 for domain admin'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Unique username.'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Hashed password (Default is MD5). If you wish to use any other hashing algorithm, you would need to write a custom authentication adapter See Docs section.'}, {u'name': u'firstname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'firstname'}, {u'name': u'userid', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'User UUID, required for adding account from external provisioning system'}, {u'name': u'timezone', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Creates the user under the specified account. If no account is specified, the username will be used as the account name.'}, {u'name': u'accountdetails', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'details for account used to store specific parameters'}, {u'name': u'email', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'email'}, {u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"Network domain for the account's networks"}, {u'name': u'accountid', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Account UUID, required for adding account from external provisioning system'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'Creates the user under the specified domain.'}], u'requiredparams': [u'lastname', u'accounttype', u'username', u'password', u'firstname', u'email'], u'description': u'Creates an account'}, u'firewallrule': {u'name': u'createFirewallRule', u'related': [u'listEgressFirewallRules'], u'isasync': True, u'params': [{u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list to forward traffic from'}, {u'name': u'protocol', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the protocol for the firewall rule. Valid values are TCP/UDP/ICMP.'}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'type of firewallrule: system/user'}, {u'name': u'ipaddressid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the IP address id of the port forwarding rule'}, {u'name': u'startport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the starting port of firewall rule'}, {u'name': u'icmptype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'type of the icmp message being sent'}, {u'name': u'icmpcode', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'error code for this icmp message'}, {u'name': u'endport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the ending port of firewall rule'}], u'requiredparams': [u'protocol', u'ipaddressid'], u'description': u'Creates a firewall rule for a given ip address'}, u'networkoffering': {u'name': u'createNetworkOffering', u'related': [u'updateNetworkOffering'], u'isasync': False, u'params': [{u'name': u'serviceproviderlist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'provider to service mapping. If not specified, the provider for the service will be mapped to the default provider on the physical network'}, {u'name': u'serviceofferingid', u'required': False, u'related': [u'updateHypervisorCapabilities'], u'length': 255, u'type': u'uuid', u'description': u'the service offering ID used by virtual router provider'}, {u'name': u'supportedservices', u'required': True, u'related': [], u'length': 255, u'type': u'list', u'description': u'services supported by the network offering'}, {u'name': u'networkrate', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'data transfer rate in megabits per second allowed'}, {u'name': u'ispersistent', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if network offering supports persistent networks; defaulted to false if not specified'}, {u'name': u'servicecapabilitylist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'desired service capabilities as part of network offering'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the network offering'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the tags for the network offering.'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the network offering'}, {u'name': u'conservemode', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the network offering is IP conserve mode enabled'}, {u'name': u'guestiptype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'guest type of the network offering: Shared or Isolated'}, {u'name': u'traffictype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the traffic type for the network offering. Supported type in current release is GUEST only'}, {u'name': u'specifyvlan', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if network offering supports vlans'}, {u'name': u'availability', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the availability of network offering. Default value is Optional'}, {u'name': u'specifyipranges', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if network offering supports specifying ip ranges; defaulted to false if not specified'}], u'requiredparams': [u'supportedservices', u'name', u'displaytext', u'guestiptype', u'traffictype'], u'description': u'Creates a network offering.'}, u'vlaniprange': {u'name': u'createVlanIpRange', u'related': [u'listVlanIpRanges'], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'domain ID of the account owning a VLAN'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'suspendProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'project who will own the VLAN. If VLAN is Zone wide, this parameter should be ommited'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ID or VID of the VLAN. If not specified, will be defaulted to the vlan of the network or if vlan of the network is null - to Untagged'}, {u'name': u'networkid', u'required': False, u'related': [u'createNetwork', u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'the network id'}, {u'name': u'forvirtualnetwork', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if VLAN is of Virtual type, false if Direct'}, {u'name': u'podid', u'required': False, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'optional parameter. Have to be specified for Direct Untagged vlan only.'}, {u'name': u'ip6cidr', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the CIDR of IPv6 network, must be at least /64'}, {u'name': u'endipv6', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IPv6 address in the IPv6 network range'}, {u'name': u'startip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the beginning IP address in the VLAN IP range'}, {u'name': u'startipv6', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the beginning IPv6 address in the IPv6 network range'}, {u'name': u'gateway', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway of the VLAN IP range'}, {u'name': u'netmask', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask of the VLAN IP range'}, {u'name': u'endip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IP address in the VLAN IP range'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'account who will own the VLAN. If VLAN is Zone wide, this parameter should be ommited'}, {u'name': u'ip6gateway', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway of the IPv6 network. Required for Shared networks and Isolated networks when it belongs to VPC'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'updatePhysicalNetwork', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the physical network id'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID of the VLAN IP range'}], u'requiredparams': [], u'description': u'Creates a VLAN IP range.'}, u'counter': {u'name': u'createCounter', u'related': [u'listCounters'], u'isasync': True, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Name of the counter.'}, {u'name': u'source', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Source of the counter.'}, {u'name': u'value', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Value of the counter e.g. oid in case of snmp.'}], u'requiredparams': [u'name', u'source', u'value'], u'description': u'Adds metric counter'}, u'lunonfiler': {u'name': u'createLunOnFiler', u'related': [], u'isasync': False, u'params': [{u'name': u'size', u'required': True, u'related': [], u'length': 255, u'type': u'long', u'description': u'LUN size.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}], u'requiredparams': [u'size', u'name'], u'description': u'Create a LUN from a pool'}, u'project': {u'name': u'createProject', u'related': [], u'isasync': True, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'account who will be Admin for the project'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the project'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'domain ID of the account owning a project'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'display text of the project'}], u'requiredparams': [u'name', u'displaytext'], u'description': u'Creates a project'}, u'physicalnetwork': {u'name': u'createPhysicalNetwork', u'related': [u'listPhysicalNetworks'], u'isasync': True, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the physical network'}, {u'name': u'zoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the physical network'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'Tag the physical network'}, {u'name': u'networkspeed', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the speed for the physical network[1G/10G]'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the VLAN for the physical network'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'domain ID of the account owning a physical network'}, {u'name': u'broadcastdomainrange', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the broadcast domain range for the physical network[Pod or Zone]. In Acton release it can be Zone only in Advance zone, and Pod in Basic'}, {u'name': u'isolationmethods', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the isolation method for the physical network[VLAN/L3/GRE]'}], u'requiredparams': [u'name', u'zoneid'], u'description': u'Creates a physical network'}, u'snapshot': {u'name': u'createSnapshot', u'related': [u'listSnapshots'], u'isasync': True, u'params': [{u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'The domain ID of the snapshot. If used with the account parameter, specifies a domain for the account associated with the disk volume.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The account of the snapshot. The account parameter must be used with the domainId parameter.'}, {u'name': u'volumeid', u'required': True, u'related': [u'detachVolume'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the disk volume'}, {u'name': u'policyid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'policy id of the snapshot, if this is null, then use MANUAL_POLICY.'}], u'requiredparams': [u'volumeid'], u'description': u'Creates an instant snapshot of a volume.'}, u'virtualrouterelement': {u'name': u'createVirtualRouterElement', u'related': [], u'isasync': True, u'params': [{u'name': u'nspid', u'required': True, u'related': [u'updateNetworkServiceProvider'], u'length': 255, u'type': u'uuid', u'description': u'the network service provider ID of the virtual router element'}], u'requiredparams': [u'nspid'], u'description': u'Create a virtual router element.'}, u'egressfirewallrule': {u'name': u'createEgressFirewallRule', u'related': [u'createFirewallRule', u'listEgressFirewallRules'], u'isasync': True, u'params': [{u'name': u'networkid', u'required': True, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'the network id of the port forwarding rule'}, {u'name': u'startport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the starting port of firewall rule'}, {u'name': u'icmpcode', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'error code for this icmp message'}, {u'name': u'icmptype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'type of the icmp message being sent'}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list to forward traffic from'}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'type of firewallrule: system/user'}, {u'name': u'protocol', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the protocol for the firewall rule. Valid values are TCP/UDP/ICMP.'}, {u'name': u'endport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the ending port of firewall rule'}], u'requiredparams': [u'networkid', u'protocol'], u'description': u'Creates a egress firewall rule for a given network '}, u'sshkeypair': {u'name': u'createSSHKeyPair', u'related': [u'listSSHKeyPairs'], u'isasync': False, u'params': [{u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'an optional project for the ssh key'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the ssh key. If the account parameter is used, domainId must also be used.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Name of the keypair'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the ssh key. Must be used with domainId.'}], u'requiredparams': [u'name'], u'description': u'Create a new keypair and returns the private key'}}, u'deploy': {u'virtualmachine': {u'name': u'deployVirtualMachine', u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'keypair', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the ssh key pair used to login to the virtual machine'}, {u'name': u'userdata', u'required': False, u'related': [], u'length': 2048, u'type': u'string', u'description': u'an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding.'}, {u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the hypervisor on which to deploy the virtual machine'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used.'}, {u'name': u'size', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'the arbitrary size for the DATADISK volume. Mutually exclusive with diskOfferingId'}, {u'name': u'diskofferingid', u'required': False, u'related': [u'createDiskOffering', u'listDiskOfferings'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk offering for the virtual machine. If the template is of ISO format, the diskOfferingId is for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk volume. If the templateId parameter passed is from a Template object, the diskOfferingId refers to a DATA Disk Volume created. If the templateId parameter passed is from an ISO object, the diskOfferingId refers to a ROOT Disk Volume created.'}, {u'name': u'securitygroupids', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'comma separated list of security groups id that going to be applied to the virtual machine. Should be passed only when vm is created from a zone with Basic Network support. Mutually exclusive with securitygroupnames parameter'}, {u'name': u'serviceofferingid', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the service offering for the virtual machine'}, {u'name': u'ipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"the ip address for default vm's network"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the virtual machine. Must be used with domainId.'}, {u'name': u'hostid', u'required': False, u'related': [u'addHost', u'updateHost', u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'destination Host ID to deploy the VM to - parameter available for root admin only'}, {u'name': u'iptonetworklist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u"ip to network mapping. Can't be specified with networkIds parameter. Example: iptonetworklist[0].ip=10.10.10.11&iptonetworklist[0].ipv6=fc00:1234:5678::abcd&iptonetworklist[0].networkid=uuid - requests to use ip 10.10.10.11 in network id=uuid"}, {u'name': u'ip6address', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"the ipv6 address for default vm's network"}, {u'name': u'keyboard', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional keyboard device type for the virtual machine. valid value can be one of de,de-ch,es,fi,fr,fr-be,fr-ch,is,it,jp,nl-be,no,pt,uk,us'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject'], u'length': 255, u'type': u'uuid', u'description': u'Deploy vm for the project'}, {u'name': u'networkids', u'required': False, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'list', u'description': u"list of network ids used by virtual machine. Can't be specified with ipToNetworkList parameter"}, {u'name': u'displayname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional user generated name for the virtual machine'}, {u'name': u'securitygroupnames', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'comma separated list of security groups names that going to be applied to the virtual machine. Should be passed only when vm is created from a zone with Basic Network support. Mutually exclusive with securitygroupids parameter'}, {u'name': u'templateid', u'required': True, u'related': [u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the template for the virtual machine'}, {u'name': u'zoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'availability zone for the virtual machine'}, {u'name': u'group', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional group for the virtual machine'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'host name for the virtual machine'}, {u'name': u'startvm', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if network offering supports specifying ip ranges; defaulted to true if not specified'}], u'requiredparams': [u'serviceofferingid', u'templateid', u'zoneid'], u'description': u'Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.'}}, u'restart': {u'network': {u'name': u'restartNetwork', u'related': [u'associateIpAddress'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'The id of the network to restart.'}, {u'name': u'cleanup', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'If cleanup old network elements'}], u'requiredparams': [u'id'], u'description': u'Restarts the network; includes 1) restarting network elements - virtual routers, dhcp servers 2) reapplying all public ips 3) reapplying loadBalancing/portForwarding rules'}, u'vpc': {u'name': u'restartVPC', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': False, u'related': [u'restartVPC'], u'length': 255, u'type': u'uuid', u'description': u'the id of the VPC'}], u'requiredparams': [], u'description': u'Restarts a VPC'}}, u'reboot': {u'systemvm': {u'name': u'rebootSystemVm', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'rebootSystemVm'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the system virtual machine'}], u'requiredparams': [u'id'], u'description': u'Reboots a system VM.'}, u'router': {u'name': u'rebootRouter', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'rebootRouter'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the router'}], u'requiredparams': [u'id'], u'description': u'Starts a router.'}, u'virtualmachine': {u'name': u'rebootVirtualMachine', u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}], u'requiredparams': [u'id'], u'description': u'Reboots a virtual machine.'}}, u'mark': {u'defaultzoneforaccount': {u'name': u'markDefaultZoneForAccount', u'related': [], u'isasync': True, u'params': [{u'name': u'account', u'required': True, u'related': [u'markDefaultZoneForAccount'], u'length': 255, u'type': u'string', u'description': u'Name of the account that is to be marked.'}, {u'name': u'domainid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Marks the account that belongs to the specified domain.'}, {u'name': u'zoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'The Zone ID with which the account is to be marked.'}], u'requiredparams': [u'account', u'domainid', u'zoneid'], u'description': u'Marks a default zone for this account'}}, u'start': {u'systemvm': {u'name': u'startSystemVm', u'related': [u'rebootSystemVm', u'listSystemVms', u'changeServiceForSystemVm'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'startSystemVm', u'rebootSystemVm', u'listSystemVms', u'changeServiceForSystemVm'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the system virtual machine'}], u'requiredparams': [u'id'], u'description': u'Starts a system virtual machine.'}, u'router': {u'name': u'startRouter', u'related': [u'destroyRouter', u'rebootRouter'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'destroyRouter', u'rebootRouter', u'startRouter'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the router'}], u'requiredparams': [u'id'], u'description': u'Starts a router.'}, u'virtualmachine': {u'name': u'startVirtualMachine', u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}, {u'name': u'hostid', u'required': False, u'related': [u'addHost', u'updateHost', u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'destination Host ID to deploy the VM to - parameter available for root admin only'}], u'requiredparams': [u'id'], u'description': u'Starts a virtual machine.'}}, u'add': {u'trafficmonitor': {u'name': u'addTrafficMonitor', u'related': [u'listTrafficMonitors'], u'isasync': False, u'params': [{u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'URL of the traffic monitor Host'}, {u'name': u'includezones', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Traffic going into the listed zones will be metered'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'Zone in which to add the external firewall appliance.'}, {u'name': u'excludezones', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Traffic going into the listed zones will not be metered'}], u'requiredparams': [u'url', u'zoneid'], u'description': u'Adds Traffic Monitor Host for Direct Network Usage'}, u'secondarystorage': {u'name': u'addSecondaryStorage', u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the secondary storage'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL for the secondary storage'}], u'requiredparams': [u'url'], u'description': u'Adds secondary storage.'}, u'nictovirtualmachine': {u'name': u'addNicToVirtualMachine', u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'listLoadBalancerRuleInstances', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'networkid', u'required': True, u'related': [u'createNetwork', u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'Network ID'}, {u'name': u'ipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'IP Address for the new network'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'addNicToVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'listLoadBalancerRuleInstances', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'Virtual Machine ID'}], u'requiredparams': [u'networkid', u'virtualmachineid'], u'description': u'Adds VM to specified network by creating a NIC'}, u'netscalerloadbalancer': {u'name': u'addNetscalerLoadBalancer', u'related': [u'listNetscalerLoadBalancers', u'configureNetscalerLoadBalancer'], u'isasync': True, u'params': [{u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to reach netscaler load balancer device'}, {u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'updatePhysicalNetwork', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to reach netscaler load balancer device'}, {u'name': u'networkdevicetype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Netscaler device type supports NetscalerMPXLoadBalancer, NetscalerVPXLoadBalancer, NetscalerSDXLoadBalancer'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'URL of the netscaler load balancer appliance.'}], u'requiredparams': [u'password', u'physicalnetworkid', u'username', u'networkdevicetype', u'url'], u'description': u'Adds a netscaler load balancer device'}, u'cluster': {u'name': u'addCluster', u'related': [u'listClusters', u'updateCluster'], u'isasync': False, u'params': [{u'name': u'url', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this cluster for allocation of new resources'}, {u'name': u'vsmpassword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the password for the VSM associated with this cluster'}, {u'name': u'podid', u'required': True, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID for the host'}, {u'name': u'vsmipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ipaddress of the VSM associated with this cluster'}, {u'name': u'hypervisor', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'hypervisor type of the cluster: XenServer,KVM,VMware,Hyperv,BareMetal,Simulator'}, {u'name': u'vsmusername', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username for the VSM associated with this cluster'}, {u'name': u'username', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username for the cluster'}, {u'name': u'clustertype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'type of the cluster: CloudManaged, ExternalManaged'}, {u'name': u'clustername', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the cluster name'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the cluster'}, {u'name': u'password', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the password for the host'}], u'requiredparams': [u'podid', u'hypervisor', u'clustertype', u'clustername', u'zoneid'], u'description': u'Adds a new cluster'}, u's3': {u'name': u'addS3', u'related': [], u'isasync': False, u'params': [{u'name': u'connectiontimeout', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'connection timeout (milliseconds)'}, {u'name': u'accesskey', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'S3 access key'}, {u'name': u'bucket', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the template storage bucket'}, {u'name': u'endpoint', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'S3 host name'}, {u'name': u'secretkey', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'S3 secret key'}, {u'name': u'sockettimeout', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'socket timeout (milliseconds)'}, {u'name': u'maxerrorretry', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'maximum number of times to retry on error'}, {u'name': u'usehttps', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'connect to the S3 endpoint via HTTPS?'}], u'requiredparams': [u'accesskey', u'bucket', u'secretkey'], u'description': u'Adds S3'}, u'accounttoproject': {u'name': u'addAccountToProject', u'related': [], u'isasync': True, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the account to be added to the project'}, {u'name': u'email', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'email to which invitation to the project is going to be sent'}, {u'name': u'projectid', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'suspendProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to add the account to'}], u'requiredparams': [u'projectid'], u'description': u'Adds acoount to a project'}, u'region': {u'name': u'addRegion', u'related': [], u'isasync': False, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Name of the region'}, {u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Id of the Region'}, {u'name': u'endpoint', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Region service endpoint'}], u'requiredparams': [u'name', u'id', u'endpoint'], u'description': u'Adds a Region'}, u'externalloadbalancer': {u'name': u'addExternalLoadBalancer', u'related': [], u'isasync': False, u'params': [{u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Username of the external load balancer appliance.'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'URL of the external load balancer appliance.'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Password of the external load balancer appliance.'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'Zone in which to add the external load balancer appliance.'}], u'requiredparams': [u'username', u'url', u'password', u'zoneid'], u'description': u'Adds F5 external load balancer appliance.'}, u'vpnuser': {u'name': u'addVpnUser', u'related': [u'listVpnUsers'], u'isasync': True, u'params': [{u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'password for the username'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'username for the vpn user'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the vpn user. Must be used with domainId.'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the vpn user. If the account parameter is used, domainId must also be used.'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject'], u'length': 255, u'type': u'uuid', u'description': u'add vpn user to the specific project'}], u'requiredparams': [u'password', u'username'], u'description': u'Adds vpn users'}, u'baremetalhost': {u'name': u'addBaremetalHost', u'related': [u'listSwifts', u'addHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'isasync': False, u'params': [{u'name': u'ipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'ip address intentionally allocated to this host after provisioning'}, {u'name': u'hosttags', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list of tags to be added to the host'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the host URL'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username for the host'}, {u'name': u'zoneid', u'required': True, u'related': [u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the host'}, {u'name': u'clustername', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the cluster name for the host'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the cluster ID for the host'}, {u'name': u'hypervisor', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'hypervisor type of the host'}, {u'name': u'podid', u'required': True, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID for the host'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the password for the host'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this Host for allocation of new resources'}], u'requiredparams': [u'url', u'username', u'zoneid', u'hypervisor', u'podid', u'password'], u'description': u'add a baremetal host'}, u'traffictype': {u'name': u'addTrafficType', u'related': [u'updateTrafficType'], u'isasync': True, u'params': [{u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The VLAN id to be used for Management traffic by VMware host'}, {u'name': u'kvmnetworklabel', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The network name label of the physical device dedicated to this traffic on a KVM host'}, {u'name': u'traffictype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the trafficType to be added to the physical network'}, {u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'vmwarenetworklabel', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The network name label of the physical device dedicated to this traffic on a VMware host'}, {u'name': u'xennetworklabel', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The network name label of the physical device dedicated to this traffic on a XenServer host'}], u'requiredparams': [u'traffictype', u'physicalnetworkid'], u'description': u'Adds traffic type to a physical network'}, u'niciranvpdevice': {u'name': u'addNiciraNvpDevice', u'related': [], u'isasync': True, u'params': [{u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'hostname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Hostname of ip address of the Nicira NVP Controller.'}, {u'name': u'l3gatewayserviceuuid', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The L3 Gateway Service UUID configured on the Nicira Controller'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to access the Nicira Controller API'}, {u'name': u'transportzoneuuid', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'The Transportzone UUID configured on the Nicira Controller'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to access the Nicira Controller API'}], u'requiredparams': [u'physicalnetworkid', u'hostname', u'username', u'transportzoneuuid', u'password'], u'description': u'Adds a Nicira NVP device'}, u'host': {u'name': u'addHost', u'related': [u'updateHost', u'listHosts'], u'isasync': False, u'params': [{u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username for the host'}, {u'name': u'podid', u'required': True, u'related': [u'updatePod'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID for the host'}, {u'name': u'clustername', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the cluster name for the host'}, {u'name': u'zoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the host'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the host URL'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the cluster ID for the host'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the password for the host'}, {u'name': u'hosttags', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list of tags to be added to the host'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this Host for allocation of new resources'}, {u'name': u'hypervisor', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'hypervisor type of the host'}], u'requiredparams': [u'username', u'podid', u'zoneid', u'url', u'password', u'hypervisor'], u'description': u'Adds a new host.'}, u'f5loadbalancer': {u'name': u'addF5LoadBalancer', u'related': [u'configureF5LoadBalancer', u'listF5LoadBalancers'], u'isasync': True, u'params': [{u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to reach F5 BigIP load balancer device'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to reach F5 BigIP load balancer device'}, {u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'updatePhysicalNetwork', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'networkdevicetype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'supports only F5BigIpLoadBalancer'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'URL of the F5 load balancer appliance.'}], u'requiredparams': [u'password', u'username', u'physicalnetworkid', u'networkdevicetype', u'url'], u'description': u'Adds a F5 BigIP load balancer device'}, u'networkdevice': {u'name': u'addNetworkDevice', u'related': [], u'isasync': False, u'params': [{u'name': u'networkdevicetype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Network device type, now supports ExternalDhcp, PxeServer, NetscalerMPXLoadBalancer, NetscalerVPXLoadBalancer, NetscalerSDXLoadBalancer, F5BigIpLoadBalancer, JuniperSRXFirewall'}, {u'name': u'networkdeviceparameterlist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'parameters for network device'}], u'requiredparams': [], u'description': u'Adds a network device of one of the following types: ExternalDhcp, ExternalFirewall, ExternalLoadBalancer, PxeServer'}, u'bigswitchvnsdevice': {u'name': u'addBigSwitchVnsDevice', u'related': [], u'isasync': True, u'params': [{u'name': u'physicalnetworkid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'hostname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Hostname of ip address of the BigSwitch VNS Controller.'}], u'requiredparams': [u'physicalnetworkid', u'hostname'], u'description': u'Adds a BigSwitch VNS device'}, u'srxfirewall': {u'name': u'addSrxFirewall', u'related': [], u'isasync': True, u'params': [{u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to reach SRX firewall device'}, {u'name': u'networkdevicetype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'supports only JuniperSRXFirewall'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to reach SRX firewall device'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'URL of the SRX appliance.'}, {u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}], u'requiredparams': [u'password', u'networkdevicetype', u'username', u'url', u'physicalnetworkid'], u'description': u'Adds a SRX firewall device'}, u'swift': {u'name': u'addSwift', u'related': [u'listSwifts', u'addHost', u'updateHost', u'listHosts', u'listExternalLoadBalancers'], u'isasync': False, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account for swift'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL for swift'}, {u'name': u'username', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username for swift'}, {u'name': u'key', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u' key for the user for swift'}], u'requiredparams': [u'url'], u'description': u'Adds Swift.'}, u'externalfirewall': {u'name': u'addExternalFirewall', u'related': [], u'isasync': False, u'params': [{u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'URL of the external firewall appliance.'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Password of the external firewall appliance.'}, {u'name': u'zoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Zone in which to add the external firewall appliance.'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Username of the external firewall appliance.'}], u'requiredparams': [u'url', u'password', u'zoneid', u'username'], u'description': u'Adds an external firewall appliance'}, u'networkserviceprovider': {u'name': u'addNetworkServiceProvider', u'related': [u'updateNetworkServiceProvider'], u'isasync': True, u'params': [{u'name': u'destinationphysicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the destination Physical Network ID to bridge to'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name for the physical network service provider'}, {u'name': u'servicelist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the list of services to be enabled for this physical network service provider'}, {u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID to add the provider to'}], u'requiredparams': [u'name', u'physicalnetworkid'], u'description': u'Adds a network serviceProvider to a physical network'}}, u'verbs': [u'authorize', u'restore', u'suspend', u'revoke', u'disassociate', u'migrate', u'lock', u'dissociate', u'activate', u'reconnect', u'cancel', u'query', u'recover', u'extract', u'detach', u'prepare', u'start', u'create', u'associate', u'reboot', u'mark', u'attach', u'add', u'change', u'deploy', u'ldap', u'destroy', u'enable', u'configure', u'get', u'modify', u'stop', u'update', u'disable', u'resize', u'copy', u'generate', u'restart', u'reset', u'register', u'list', u'upload', u'remove', u'assign', u'delete'], u'resize': {u'volume': {u'name': u'resizeVolume', u'related': [u'detachVolume', u'uploadVolume', u'createVolume'], u'isasync': True, u'params': [{u'name': u'diskofferingid', u'required': False, u'related': [u'updateDiskOffering', u'createDiskOffering', u'listDiskOfferings'], u'length': 255, u'type': u'uuid', u'description': u'new disk offering id'}, {u'name': u'id', u'required': False, u'related': [u'detachVolume', u'resizeVolume', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}, {u'name': u'shrinkok', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Verify OK to Shrink'}, {u'name': u'size', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'New volume size in G'}], u'requiredparams': [], u'description': u'Resizes a volume'}}, u'ldap': {u'config': {u'name': u'ldapConfig', u'related': [u'ldapRemove'], u'isasync': False, u'params': [{u'name': u'hostname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Hostname or ip address of the ldap server eg: my.ldap.com'}, {u'name': u'ssl', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Check Use SSL if the external LDAP server is configured for LDAP over SSL.'}, {u'name': u'truststore', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Enter the path to trust certificates store.'}, {u'name': u'queryfilter', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'You specify a query filter here, which narrows down the users, who can be part of this domain.'}, {u'name': u'searchbase', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'The search base defines the starting point for the search in the directory tree Example: dc=cloud,dc=com.'}, {u'name': u'port', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Specify the LDAP port if required, default is 389.'}, {u'name': u'binddn', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Specify the distinguished name of a user with the search permission on the directory.'}, {u'name': u'truststorepass', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Enter the password for trust store.'}, {u'name': u'bindpass', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Enter the password.'}], u'requiredparams': [u'hostname', u'queryfilter', u'searchbase'], u'description': u'Configure the LDAP context for this site.'}, u'remove': {u'name': u'ldapRemove', u'related': [], u'isasync': False, u'params': [], u'requiredparams': [], u'description': u'Remove the LDAP context for this site.'}}, u'destroy': {u'systemvm': {u'name': u'destroySystemVm', u'related': [u'startSystemVm', u'rebootSystemVm', u'listSystemVms', u'stopSystemVm', u'changeServiceForSystemVm'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'startSystemVm', u'destroySystemVm', u'rebootSystemVm', u'listSystemVms', u'stopSystemVm', u'changeServiceForSystemVm'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the system virtual machine'}], u'requiredparams': [u'id'], u'description': u'Destroyes a system virtual machine.'}, u'router': {u'name': u'destroyRouter', u'related': [u'rebootRouter'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'destroyRouter', u'rebootRouter'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the router'}], u'requiredparams': [u'id'], u'description': u'Destroys a router.'}, u'volumeonfiler': {u'name': u'destroyVolumeOnFiler', u'related': [], u'isasync': False, u'params': [{u'name': u'volumename', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'volume name.'}, {u'name': u'ipaddress', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'ip address.'}, {u'name': u'aggregatename', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'aggregate name.'}], u'requiredparams': [u'volumename', u'ipaddress', u'aggregatename'], u'description': u'Destroy a Volume'}, u'lunonfiler': {u'name': u'destroyLunOnFiler', u'related': [], u'isasync': False, u'params': [{u'name': u'path', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'LUN path.'}], u'requiredparams': [u'path'], u'description': u'Destroy a LUN'}, u'virtualmachine': {u'name': u'destroyVirtualMachine', u'related': [u'listVirtualMachines'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listVirtualMachines', u'destroyVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}], u'requiredparams': [u'id'], u'description': u'Destroys a virtual machine. Once destroyed, only the administrator can recover it.'}}, u'get': {u'apilimit': {u'name': u'getApiLimit', u'related': [u'resetApiLimit'], u'isasync': False, u'params': [], u'requiredparams': [], u'description': u'Get API limit count for the caller'}, u'vmpassword': {u'name': u'getVMPassword', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}], u'requiredparams': [u'id'], u'description': u'Returns an encrypted password for the VM'}, u'user': {u'name': u'getUser', u'related': [u'disableUser', u'lockUser', u'listUsers', u'enableUser', u'createUser', u'updateUser'], u'isasync': False, u'params': [{u'name': u'userapikey', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'API key of the user'}], u'requiredparams': [u'userapikey'], u'description': u'Find user account by API key'}, u'cloudidentifier': {u'name': u'getCloudIdentifier', u'related': [], u'isasync': False, u'params': [{u'name': u'userid', u'required': True, u'related': [u'lockUser', u'listUsers', u'createUser'], u'length': 255, u'type': u'uuid', u'description': u'the user ID for the cloud identifier'}], u'requiredparams': [u'userid'], u'description': u'Retrieves a cloud identifier.'}}, u'count': 355, u'enable': {u'account': {u'name': u'enableAccount', u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount', u'disableAccount'], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'Enables specified account in this domain.'}, {u'name': u'id', u'required': False, u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount', u'enableAccount', u'disableAccount'], u'length': 255, u'type': u'uuid', u'description': u'Account id'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Enables specified account.'}], u'requiredparams': [], u'description': u'Enables an account'}, u'storagemaintenance': {u'name': u'enableStorageMaintenance', u'related': [u'cancelStorageMaintenance', u'updateStoragePool', u'createStoragePool', u'listStoragePools'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'cancelStorageMaintenance', u'enableStorageMaintenance', u'updateStoragePool', u'createStoragePool', u'listStoragePools'], u'length': 255, u'type': u'uuid', u'description': u'Primary storage ID'}], u'requiredparams': [u'id'], u'description': u'Puts storage pool into maintenance state'}, u'cisconexusvsm': {u'name': u'enableCiscoNexusVSM', u'related': [u'disableCiscoNexusVSM'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'disableCiscoNexusVSM', u'enableCiscoNexusVSM'], u'length': 255, u'type': u'uuid', u'description': u'Id of the Cisco Nexus 1000v VSM device to be enabled'}], u'requiredparams': [u'id'], u'description': u'Enable a Cisco Nexus VSM device'}, u'staticnat': {u'name': u'enableStaticNat', u'related': [], u'isasync': False, u'params': [{u'name': u'ipaddressid', u'required': True, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'the public IP address id for which static nat feature is being enabled'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine for enabling static nat feature'}, {u'name': u'networkid', u'required': False, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'The network of the vm the static nat will be enabled for. Required when public Ip address is not associated with any Guest network yet (VPC case)'}], u'requiredparams': [u'ipaddressid', u'virtualmachineid'], u'description': u'Enables static nat for given ip address'}, u'user': {u'name': u'enableUser', u'related': [u'lockUser', u'listUsers', u'createUser'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'lockUser', u'listUsers', u'enableUser', u'createUser'], u'length': 255, u'type': u'uuid', u'description': u'Enables user by user ID.'}], u'requiredparams': [u'id'], u'description': u'Enables a user account'}, u'autoscalevmgroup': {u'name': u'enableAutoScaleVmGroup', u'related': [u'createAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale group'}], u'requiredparams': [u'id'], u'description': u'Enables an AutoScale Vm Group'}}, u'configure': {u'srxfirewall': {u'name': u'configureSrxFirewall', u'related': [u'listSrxFirewalls', u'addSrxFirewall'], u'isasync': True, u'params': [{u'name': u'fwdeviceid', u'required': True, u'related': [u'listSrxFirewalls', u'configureSrxFirewall', u'addSrxFirewall'], u'length': 255, u'type': u'uuid', u'description': u'SRX firewall device ID'}, {u'name': u'fwdevicecapacity', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'capacity of the firewall device, Capacity will be interpreted as number of networks device can handle'}], u'requiredparams': [u'fwdeviceid'], u'description': u'Configures a SRX firewall device'}, u'f5loadbalancer': {u'name': u'configureF5LoadBalancer', u'related': [], u'isasync': True, u'params': [{u'name': u'lbdeviceid', u'required': True, u'related': [u'configureF5LoadBalancer'], u'length': 255, u'type': u'uuid', u'description': u'F5 load balancer device ID'}, {u'name': u'lbdevicecapacity', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'capacity of the device, Capacity will be interpreted as number of networks device can handle'}], u'requiredparams': [u'lbdeviceid'], u'description': u'configures a F5 load balancer device'}, u'netscalerloadbalancer': {u'name': u'configureNetscalerLoadBalancer', u'related': [u'listNetscalerLoadBalancers'], u'isasync': True, u'params': [{u'name': u'podids', u'required': False, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'list', u'description': u"Used when NetScaler device is provider of EIP service. This parameter represents the list of pod's, for which there exists a policy based route on datacenter L3 router to route pod's subnet IP to a NetScaler device."}, {u'name': u'lbdevicecapacity', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'capacity of the device, Capacity will be interpreted as number of networks device can handle'}, {u'name': u'lbdeviceid', u'required': True, u'related': [u'listNetscalerLoadBalancers', u'configureNetscalerLoadBalancer'], u'length': 255, u'type': u'uuid', u'description': u'Netscaler load balancer device ID'}, {u'name': u'inline', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if netscaler load balancer is intended to be used in in-line with firewall, false if netscaler load balancer will side-by-side with firewall'}, {u'name': u'lbdevicededicated', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this netscaler device to dedicated for a account, false if the netscaler device will be shared by multiple accounts'}], u'requiredparams': [u'lbdeviceid'], u'description': u'configures a netscaler load balancer device'}, u'virtualrouterelement': {u'name': u'configureVirtualRouterElement', u'related': [u'createVirtualRouterElement'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createVirtualRouterElement', u'configureVirtualRouterElement'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual router provider'}, {u'name': u'enabled', u'required': True, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Enabled/Disabled the service provider'}], u'requiredparams': [u'id', u'enabled'], u'description': u'Configures a virtual router element.'}}, u'associate': {u'ipaddress': {u'name': u'associateIpAddress', u'related': [], u'isasync': True, u'params': [{u'name': u'networkid', u'required': False, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'The network this ip address should be associated to.'}, {u'name': u'vpcid', u'required': False, u'related': [u'restartVPC', u'listVPCs'], u'length': 255, u'type': u'uuid', u'description': u'the VPC you want the ip address to be associated with'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account to associate with this IP address'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the availability zone you want to acquire an public IP address from'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts'], u'length': 255, u'type': u'uuid', u'description': u'Deploy vm for the project'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the domain to associate with this IP address'}], u'requiredparams': [], u'description': u'Acquires and associates a public IP to an account.'}, u'lun': {u'name': u'associateLun', u'related': [], u'isasync': False, u'params': [{u'name': u'iqn', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Guest IQN to which the LUN associate.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'LUN name.'}], u'requiredparams': [u'iqn', u'name'], u'description': u'Associate a LUN with a guest IQN'}}, u'stop': {u'systemvm': {u'name': u'stopSystemVm', u'related': [u'startSystemVm', u'rebootSystemVm', u'listSystemVms', u'changeServiceForSystemVm'], u'isasync': True, u'params': [{u'name': u'forced', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force stop the VM. The caller knows the VM is stopped.'}, {u'name': u'id', u'required': True, u'related': [u'startSystemVm', u'rebootSystemVm', u'listSystemVms', u'stopSystemVm', u'changeServiceForSystemVm'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the system virtual machine'}], u'requiredparams': [u'id'], u'description': u'Stops a system VM.'}, u'router': {u'name': u'stopRouter', u'related': [u'changeServiceForRouter', u'destroyRouter', u'rebootRouter', u'startRouter'], u'isasync': True, u'params': [{u'name': u'forced', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force stop the VM. The caller knows the VM is stopped.'}, {u'name': u'id', u'required': True, u'related': [u'changeServiceForRouter', u'stopRouter', u'destroyRouter', u'rebootRouter', u'startRouter'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the router'}], u'requiredparams': [u'id'], u'description': u'Stops a router.'}, u'virtualmachine': {u'name': u'stopVirtualMachine', u'related': [u'listVirtualMachines', u'destroyVirtualMachine'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}, {u'name': u'forced', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force stop the VM (vm is marked as Stopped even when command fails to be send to the backend). The caller knows the VM is stopped.'}], u'requiredparams': [u'id'], u'description': u'Stops a virtual machine.'}}, u'modify': {u'pool': {u'name': u'modifyPool', u'related': [], u'isasync': False, u'params': [{u'name': u'algorithm', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'algorithm.'}, {u'name': u'poolname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}], u'requiredparams': [u'algorithm', u'poolname'], u'description': u'Modify pool'}}, u'update': {u'loadbalancerrule': {u'name': u'updateLoadBalancerRule', u'related': [], u'isasync': True, u'params': [{u'name': u'description', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the description of the load balancer rule'}, {u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the id of the load balancer rule to update'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the load balancer rule'}, {u'name': u'algorithm', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'load balancer algorithm (source, roundrobin, leastconn)'}], u'requiredparams': [u'id'], u'description': u'Updates load balancer'}, u'domain': {u'name': u'updateDomain', u'related': [u'listDomainChildren', u'createDomain'], u'isasync': False, u'params': [{u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"Network domain for the domain's networks; empty string will update domainName with NULL value"}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'updates domain with this name'}, {u'name': u'id', u'required': True, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'ID of domain to update'}], u'requiredparams': [u'id'], u'description': u'Updates a domain with a new name'}, u'projectinvitation': {u'name': u'updateProjectInvitation', u'related': [], u'isasync': True, u'params': [{u'name': u'accept', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, accept the invitation, decline if false. True by default'}, {u'name': u'projectid', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to join'}, {u'name': u'token', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list invitations for specified account; this parameter has to be specified with domainId'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'account that is joining the project'}], u'requiredparams': [u'projectid'], u'description': u'Accepts or declines project invitation'}, u'diskoffering': {u'name': u'updateDiskOffering', u'related': [u'createDiskOffering', u'listDiskOfferings'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateDiskOffering', u'createDiskOffering', u'listDiskOfferings'], u'length': 255, u'type': u'uuid', u'description': u'ID of the disk offering'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'updates alternate display text of the disk offering with this value'}, {u'name': u'sortkey', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'sort key of the disk offering, integer'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'updates name of the disk offering with this value'}], u'requiredparams': [u'id'], u'description': u'Updates a disk offering.'}, u'virtualmachine': {u'name': u'updateVirtualMachine', u'related': [u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': False, u'params': [{u'name': u'displayname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'user generated name'}, {u'name': u'group', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'group of the virtual machine'}, {u'name': u'haenable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if high-availability is enabled for the virtual machine, false otherwise'}, {u'name': u'id', u'required': True, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}, {u'name': u'ostypeid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the OS type that best represents this VM.'}, {u'name': u'userdata', u'required': False, u'related': [], u'length': 2048, u'type': u'string', u'description': u'an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding.'}], u'requiredparams': [u'id'], u'description': u'Updates properties of a virtual machine. The VM has to be stopped and restarted for the new properties to take effect. UpdateVirtualMachine does not first check whether the VM is stopped. Therefore, stop the VM manually before issuing this call.'}, u'portforwardingrule': {u'name': u'updatePortForwardingRule', u'related': [u'listIpForwardingRules', u'listPortForwardingRules', u'createPortForwardingRule'], u'isasync': True, u'params': [{u'name': u'privateport', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the private port of the port forwarding rule'}, {u'name': u'publicport', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the public port of the port forwarding rule'}, {u'name': u'privateip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the private IP address of the port forwarding rule'}, {u'name': u'ipaddressid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the IP address id of the port forwarding rule'}, {u'name': u'protocol', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the protocol for the port fowarding rule. Valid values are TCP or UDP.'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine for the port forwarding rule'}], u'requiredparams': [u'privateport', u'publicport', u'ipaddressid', u'protocol'], u'description': u'Updates a port forwarding rule. Only the private port and the virtual machine can be updated.'}, u'cluster': {u'name': u'updateCluster', u'related': [], u'isasync': False, u'params': [{u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'hypervisor type of the cluster'}, {u'name': u'id', u'required': True, u'related': [u'updateCluster'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the Cluster'}, {u'name': u'managedstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'whether this cluster is managed by cloudstack'}, {u'name': u'clustername', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the cluster name'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this cluster for allocation of new resources'}, {u'name': u'clustertype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'hypervisor type of the cluster'}], u'requiredparams': [u'id'], u'description': u'Updates an existing cluster'}, u'hostpassword': {u'name': u'updateHostPassword', u'related': [], u'isasync': False, u'params': [{u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the new password for the host/cluster'}, {u'name': u'hostid', u'required': False, u'related': [u'listSwifts', u'addHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'the host ID'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the cluster ID'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username for the host/cluster'}], u'requiredparams': [u'password', u'username'], u'description': u'Update password of a host/pool on management server.'}, u'pod': {u'name': u'updatePod', u'related': [], u'isasync': False, u'params': [{u'name': u'endip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IP address for the Pod'}, {u'name': u'gateway', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway for the Pod'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this cluster for allocation of new resources'}, {u'name': u'id', u'required': True, u'related': [u'updatePod'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the Pod'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the Pod'}, {u'name': u'startip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the starting IP address for the Pod'}, {u'name': u'netmask', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask of the Pod'}], u'requiredparams': [u'id'], u'description': u'Updates a Pod.'}, u'isopermissions': {u'name': u'updateIsoPermissions', u'related': [], u'isasync': False, u'params': [{u'name': u'isextractable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template/iso is extractable, false other wise. Can be set only by root admin'}, {u'name': u'isfeatured', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true for featured template/iso, false otherwise'}, {u'name': u'accounts', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'a comma delimited list of accounts. If specified, "op" parameter has to be passed in.'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true for public template/iso, false for private templates/isos'}, {u'name': u'projectids', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'list', u'description': u'a comma delimited list of projects. If specified, "op" parameter has to be passed in.'}, {u'name': u'op', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'permission operator (add, remove, reset)'}, {u'name': u'id', u'required': True, u'related': [u'registerIso', u'updateTemplate', u'prepareTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the template ID'}], u'requiredparams': [u'id'], u'description': u'Updates iso permissions'}, u'resourcelimit': {u'name': u'updateResourceLimit', u'related': [], u'isasync': False, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Update resource for a specified account. Must be used with the domainId parameter.'}, {u'name': u'resourcetype', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Type of resource to update. Values are 0, 1, 2, 3, and 4. 0 - Instance. Number of instances a user can create. 1 - IP. Number of public IP addresses a user can own. 2 - Volume. Number of disk volumes a user can create.3 - Snapshot. Number of snapshots a user can create.4 - Template. Number of templates that a user can register/create.'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Update resource limits for all accounts in specified domain. If used with the account parameter, updates resource limits for a specified account in specified domain.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Update resource limits for project'}, {u'name': u'max', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u' Maximum resource limit.'}], u'requiredparams': [u'resourcetype'], u'description': u'Updates resource limits for an account or domain.'}, u'vpcoffering': {u'name': u'updateVPCOffering', u'related': [u'listVPCOfferings', u'createVPCOffering'], u'isasync': True, u'params': [{u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the VPC offering'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'update state for the VPC offering; supported states - Enabled/Disabled'}, {u'name': u'id', u'required': False, u'related': [u'listVPCOfferings', u'createVPCOffering', u'updateVPCOffering'], u'length': 255, u'type': u'uuid', u'description': u'the id of the VPC offering'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the VPC offering'}], u'requiredparams': [], u'description': u'Updates VPC offering'}, u'network': {u'name': u'updateNetwork', u'related': [u'listNetscalerLoadBalancerNetworks'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the network'}, {u'name': u'networkofferingid', u'required': False, u'related': [u'updateNetworkOffering'], u'length': 255, u'type': u'uuid', u'description': u'network offering ID'}, {u'name': u'changecidr', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force update even if cidr type is different'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the new name for the network'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the new display text for the network'}, {u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'network domain'}], u'requiredparams': [u'id'], u'description': u'Updates a network'}, u'zone': {u'name': u'updateZone', u'related': [u'listZones', u'createZone'], u'isasync': False, u'params': [{u'name': u'internaldns1', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the first internal DNS for the Zone'}, {u'name': u'dnssearchorder', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the dns search order list'}, {u'name': u'internaldns2', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the second internal DNS for the Zone'}, {u'name': u'domain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Network domain name for the networks in the zone; empty string will update domain with NULL value'}, {u'name': u'details', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'the details for the Zone'}, {u'name': u'ip6dns1', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the first DNS for IPv6 network in the Zone'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this cluster for allocation of new resources'}, {u'name': u'ip6dns2', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the second DNS for IPv6 network in the Zone'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the Zone'}, {u'name': u'id', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the Zone'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'updates a private zone to public if set, but not vice-versa'}, {u'name': u'dns2', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the second DNS for the Zone'}, {u'name': u'guestcidraddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the guest CIDR address for the Zone'}, {u'name': u'dhcpprovider', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the dhcp Provider for the Zone'}, {u'name': u'dns1', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the first DNS for the Zone'}, {u'name': u'localstorageenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if local storage offering enabled, false otherwise'}], u'requiredparams': [u'id'], u'description': u'Updates a Zone.'}, u'instancegroup': {u'name': u'updateInstanceGroup', u'related': [u'createInstanceGroup'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateInstanceGroup', u'createInstanceGroup'], u'length': 255, u'type': u'uuid', u'description': u'Instance group ID'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'new instance group name'}], u'requiredparams': [u'id'], u'description': u'Updates a vm group'}, u'autoscalepolicy': {u'name': u'updateAutoScalePolicy', u'related': [], u'isasync': True, u'params': [{u'name': u'duration', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the duration for which the conditions have to be true before action is taken'}, {u'name': u'id', u'required': True, u'related': [u'updateAutoScalePolicy'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale policy'}, {u'name': u'quiettime', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the cool down period for which the policy should not be evaluated after the action has been taken'}, {u'name': u'conditionids', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the list of IDs of the conditions that are being evaluated on every interval'}], u'requiredparams': [u'id'], u'description': u'Updates an existing autoscale policy.'}, u'serviceoffering': {u'name': u'updateServiceOffering', u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings', u'createServiceOffering'], u'isasync': False, u'params': [{u'name': u'sortkey', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'sort key of the service offering, integer'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the service offering to be updated'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the service offering to be updated'}, {u'name': u'id', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings', u'createServiceOffering', u'updateServiceOffering'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the service offering to be updated'}], u'requiredparams': [u'id'], u'description': u'Updates a service offering.'}, u'storagepool': {u'name': u'updateStoragePool', u'related': [u'cancelStorageMaintenance', u'createStoragePool', u'listStoragePools'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'cancelStorageMaintenance', u'updateStoragePool', u'createStoragePool', u'listStoragePools'], u'length': 255, u'type': u'uuid', u'description': u'the Id of the storage pool'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'comma-separated list of tags for the storage pool'}], u'requiredparams': [u'id'], u'description': u'Updates a storage pool.'}, u'hypervisorcapabilities': {u'name': u'updateHypervisorCapabilities', u'related': [], u'isasync': False, u'params': [{u'name': u'securitygroupenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'set true to enable security group for this hypervisor.'}, {u'name': u'maxguestslimit', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'the max number of Guest VMs per host for this hypervisor.'}, {u'name': u'id', u'required': False, u'related': [u'listHypervisorCapabilities'], u'length': 255, u'type': u'uuid', u'description': u'ID of the hypervisor capability'}], u'requiredparams': [], u'description': u'Updates a hypervisor capabilities.'}, u'template': {u'name': u'updateTemplate', u'related': [u'registerIso', u'copyIso', u'updateIso', u'listIsos'], u'isasync': False, u'params': [{u'name': u'bootable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if image is bootable, false otherwise'}, {u'name': u'passwordenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the image supports the password reset feature; default is false'}, {u'name': u'format', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the format for the image'}, {u'name': u'ostypeid', u'required': False, u'related': [u'listOsTypes'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the OS type that best represents the OS of this image.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the image file'}, {u'name': u'id', u'required': True, u'related': [u'registerIso', u'updateTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the image file'}, {u'name': u'sortkey', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'sort key of the template, integer'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the display text of the image'}], u'requiredparams': [u'id'], u'description': u'Updates attributes of a template.'}, u'defaultnicforvirtualmachine': {u'name': u'updateDefaultNicForVirtualMachine', u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'nicid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'NIC ID'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'Virtual Machine ID'}], u'requiredparams': [u'nicid', u'virtualmachineid'], u'description': u'Changes the default NIC on a VM'}, u'traffictype': {u'name': u'updateTrafficType', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateTrafficType'], u'length': 255, u'type': u'uuid', u'description': u'traffic type id'}, {u'name': u'xennetworklabel', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The network name label of the physical device dedicated to this traffic on a XenServer host'}, {u'name': u'vmwarenetworklabel', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The network name label of the physical device dedicated to this traffic on a VMware host'}, {u'name': u'kvmnetworklabel', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The network name label of the physical device dedicated to this traffic on a KVM host'}], u'requiredparams': [u'id'], u'description': u'Updates traffic type of a physical network'}, u'host': {u'name': u'updateHost', u'related': [u'listHosts'], u'isasync': False, u'params': [{u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Change resource state of host, valid values are [Enable, Disable]. Operation may failed if host in states not allowing Enable/Disable'}, {u'name': u'oscategoryid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the id of Os category to update the host with'}, {u'name': u'hosttags', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list of tags to be added to the host'}, {u'name': u'id', u'required': True, u'related': [u'updateHost', u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the host to update'}, {u'name': u'url', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the new uri for the secondary storage: nfs://host/path'}], u'requiredparams': [u'id'], u'description': u'Updates a host.'}, u'user': {u'name': u'updateUser', u'related': [u'disableUser', u'lockUser', u'listUsers', u'enableUser', u'createUser'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'disableUser', u'lockUser', u'listUsers', u'enableUser', u'createUser', u'updateUser'], u'length': 255, u'type': u'uuid', u'description': u'User uuid'}, {u'name': u'timezone', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.'}, {u'name': u'email', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'email'}, {u'name': u'usersecretkey', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The secret key for the user. Must be specified with userApiKey'}, {u'name': u'username', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Unique username'}, {u'name': u'firstname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'first name'}, {u'name': u'lastname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'last name'}, {u'name': u'password', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Hashed password (default is MD5). If you wish to use any other hasing algorithm, you would need to write a custom authentication adapter'}, {u'name': u'userapikey', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The API key for the user. Must be specified with userSecretKey'}], u'requiredparams': [u'id'], u'description': u'Updates a user account'}, u'vpc': {u'name': u'updateVPC', u'related': [u'restartVPC', u'listVPCs'], u'isasync': True, u'params': [{u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the VPC'}, {u'name': u'id', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs'], u'length': 255, u'type': u'uuid', u'description': u'the id of the VPC'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the VPC'}], u'requiredparams': [], u'description': u'Updates a VPC'}, u'resourcecount': {u'name': u'updateResourceCount', u'related': [], u'isasync': False, u'params': [{u'name': u'resourcetype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Type of resource to update. If specifies valid values are 0, 1, 2, 3, and 4. If not specified will update all resource counts0 - Instance. Number of instances a user can create. 1 - IP. Number of public IP addresses a user can own. 2 - Volume. Number of disk volumes a user can create.3 - Snapshot. Number of snapshots a user can create.4 - Template. Number of templates that a user can register/create.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Update resource limits for project'}, {u'name': u'domainid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'If account parameter specified then updates resource counts for a specified account in this domain else update resource counts for all accounts & child domains in specified domain.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Update resource count for a specified account. Must be used with the domainId parameter.'}], u'requiredparams': [u'domainid'], u'description': u'Recalculate and update resource count for an account or domain.'}, u'storagenetworkiprange': {u'name': u'updateStorageNetworkIpRange', u'related': [], u'isasync': True, u'params': [{u'name': u'endip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IP address'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Optional. the vlan the ip range sits on'}, {u'name': u'netmask', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask for storage network'}, {u'name': u'id', u'required': True, u'related': [u'updateStorageNetworkIpRange'], u'length': 255, u'type': u'uuid', u'description': u'UUID of storage network ip range'}, {u'name': u'startip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the beginning IP address'}], u'requiredparams': [u'id'], u'description': u'Update a Storage network IP range, only allowed when no IPs in this range have been allocated.'}, u'configuration': {u'name': u'updateConfiguration', u'related': [u'listConfigurations'], u'isasync': False, u'params': [{u'name': u'value', u'required': False, u'related': [], u'length': 4095, u'type': u'string', u'description': u'the value of the configuration'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the configuration'}], u'requiredparams': [u'name'], u'description': u'Updates a configuration.'}, u'templatepermissions': {u'name': u'updateTemplatePermissions', u'related': [], u'isasync': False, u'params': [{u'name': u'isfeatured', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true for featured template/iso, false otherwise'}, {u'name': u'isextractable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template/iso is extractable, false other wise. Can be set only by root admin'}, {u'name': u'projectids', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'a comma delimited list of projects. If specified, "op" parameter has to be passed in.'}, {u'name': u'op', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'permission operator (add, remove, reset)'}, {u'name': u'id', u'required': True, u'related': [u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the template ID'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true for public template/iso, false for private templates/isos'}, {u'name': u'accounts', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'a comma delimited list of accounts. If specified, "op" parameter has to be passed in.'}], u'requiredparams': [u'id'], u'description': u'Updates a template visibility permissions. A public template is visible to all accounts within the same domain. A private template is visible only to the owner of the template. A priviledged template is a private template with account permissions added. Only accounts specified under the template permissions are visible to them.'}, u'autoscalevmprofile': {u'name': u'updateAutoScaleVmProfile', u'related': [u'listAutoScaleVmProfiles'], u'isasync': True, u'params': [{u'name': u'destroyvmgraceperiod', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the time allowed for existing connections to get closed before a vm is destroyed'}, {u'name': u'autoscaleuserid', u'required': False, u'related': [u'lockUser', u'listUsers', u'enableUser', u'createUser'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the user used to launch and destroy the VMs'}, {u'name': u'templateid', u'required': False, u'related': [u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the template of the auto deployed virtual machine'}, {u'name': u'id', u'required': True, u'related': [u'updateAutoScaleVmProfile', u'listAutoScaleVmProfiles'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale vm profile'}, {u'name': u'counterparam', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'counterparam list. Example: counterparam[0].name=snmpcommunity&counterparam[0].value=public&counterparam[1].name=snmpport&counterparam[1].value=161'}], u'requiredparams': [u'id'], u'description': u'Updates an existing autoscale vm profile.'}, u'account': {u'name': u'updateAccount', u'related': [u'markDefaultZoneForAccount', u'listAccounts', u'lockAccount'], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount'], u'length': 255, u'type': u'uuid', u'description': u'Account id'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the domain where the account exists'}, {u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"Network domain for the account's networks; empty string will update domainName with NULL value"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the current account name'}, {u'name': u'accountdetails', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'details for account used to store specific parameters'}, {u'name': u'newname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'new name for the account'}], u'requiredparams': [u'newname'], u'description': u'Updates account information for the authenticated user'}, u'networkoffering': {u'name': u'updateNetworkOffering', u'related': [], u'isasync': False, u'params': [{u'name': u'sortkey', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'sort key of the network offering, integer'}, {u'name': u'id', u'required': False, u'related': [u'updateNetworkOffering'], u'length': 255, u'type': u'uuid', u'description': u'the id of the network offering'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the network offering'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the network offering'}, {u'name': u'availability', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the availability of network offering. Default value is Required for Guest Virtual network offering; Optional for Guest Direct network offering'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'update state for the network offering'}], u'requiredparams': [], u'description': u'Updates a network offering.'}, u'vpncustomergateway': {u'name': u'updateVpnCustomerGateway', u'related': [u'createVpnCustomerGateway'], u'isasync': True, u'params': [{u'name': u'ikelifetime', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'Lifetime of phase 1 VPN connection to the customer gateway, in seconds'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the domain ID associated with the gateway. If used with the account parameter returns the gateway associated with the account for the specified domain.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of this customer gateway'}, {u'name': u'id', u'required': True, u'related': [u'updateVpnCustomerGateway', u'createVpnCustomerGateway'], u'length': 255, u'type': u'uuid', u'description': u'id of customer gateway'}, {u'name': u'esplifetime', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'Lifetime of phase 2 VPN connection to the customer gateway, in seconds'}, {u'name': u'ikepolicy', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'IKE policy of the customer gateway'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account associated with the gateway. Must be used with the domainId parameter.'}, {u'name': u'esppolicy', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'ESP policy of the customer gateway'}, {u'name': u'gateway', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'public ip address id of the customer gateway'}, {u'name': u'ipsecpsk', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'IPsec Preshared-Key of the customer gateway'}, {u'name': u'dpd', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'If DPD is enabled for VPN connection'}, {u'name': u'cidrlist', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'guest cidr of the customer gateway'}], u'requiredparams': [u'id', u'ikepolicy', u'esppolicy', u'gateway', u'ipsecpsk', u'cidrlist'], u'description': u'Update site to site vpn customer gateway'}, u'region': {u'name': u'updateRegion', u'related': [u'addRegion', u'listRegions'], u'isasync': False, u'params': [{u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'updates region with this name'}, {u'name': u'endpoint', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'updates region with this end point'}, {u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Id of region to update'}], u'requiredparams': [u'id'], u'description': u'Updates a region'}, u'project': {u'name': u'updateProject', u'related': [u'createProject', u'listProjectAccounts', u'activateProject'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to be modified'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'display text of the project'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'new Admin account for the project'}], u'requiredparams': [u'id'], u'description': u'Updates a project'}, u'physicalnetwork': {u'name': u'updatePhysicalNetwork', u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'isasync': True, u'params': [{u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the VLAN for the physical network'}, {u'name': u'id', u'required': True, u'related': [u'listPhysicalNetworks', u'updatePhysicalNetwork', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'physical network id'}, {u'name': u'networkspeed', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the speed for the physical network[1G/10G]'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'Tag the physical network'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Enabled/Disabled'}], u'requiredparams': [u'id'], u'description': u'Updates a physical network'}, u'iso': {u'name': u'updateIso', u'related': [u'listIsos'], u'isasync': False, u'params': [{u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the image file'}, {u'name': u'id', u'required': True, u'related': [u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the image file'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the display text of the image'}, {u'name': u'format', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the format for the image'}, {u'name': u'sortkey', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'sort key of the template, integer'}, {u'name': u'ostypeid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the OS type that best represents the OS of this image.'}, {u'name': u'passwordenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the image supports the password reset feature; default is false'}, {u'name': u'bootable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if image is bootable, false otherwise'}], u'requiredparams': [u'id'], u'description': u'Updates an ISO file.'}, u'networkserviceprovider': {u'name': u'updateNetworkServiceProvider', u'related': [], u'isasync': True, u'params': [{u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Enabled/Disabled/Shutdown the physical network service provider'}, {u'name': u'id', u'required': True, u'related': [u'updateNetworkServiceProvider'], u'length': 255, u'type': u'uuid', u'description': u'network service provider id'}, {u'name': u'servicelist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the list of services to be enabled for this physical network service provider'}], u'requiredparams': [u'id'], u'description': u'Updates a network serviceProvider of a physical network'}, u'autoscalevmgroup': {u'name': u'updateAutoScaleVmGroup', u'related': [], u'isasync': True, u'params': [{u'name': u'scaledownpolicyids', u'required': False, u'related': [u'updateAutoScalePolicy'], u'length': 255, u'type': u'list', u'description': u'list of scaledown autoscale policies'}, {u'name': u'interval', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the frequency at which the conditions have to be evaluated'}, {u'name': u'minmembers', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the minimum number of members in the vmgroup, the number of instances in the vm group will be equal to or more than this number.'}, {u'name': u'maxmembers', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'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.'}, {u'name': u'id', u'required': True, u'related': [u'updateAutoScaleVmGroup'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale group'}, {u'name': u'scaleuppolicyids', u'required': False, u'related': [u'updateAutoScalePolicy'], u'length': 255, u'type': u'list', u'description': u'list of scaleup autoscale policies'}], u'requiredparams': [u'id'], u'description': u'Updates an existing autoscale vm group.'}}, u'disable': {u'account': {u'name': u'disableAccount', u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount'], u'isasync': True, u'params': [{u'name': u'lock', u'required': True, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'If true, only lock the account; else disable the account'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Disables specified account.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'Disables specified account in this domain.'}, {u'name': u'id', u'required': False, u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount', u'disableAccount'], u'length': 255, u'type': u'uuid', u'description': u'Account id'}], u'requiredparams': [u'lock'], u'description': u'Disables an account'}, u'autoscalevmgroup': {u'name': u'disableAutoScaleVmGroup', u'related': [u'listAutoScaleVmGroups', u'createAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listAutoScaleVmGroups', u'createAutoScaleVmGroup', u'disableAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale group'}], u'requiredparams': [u'id'], u'description': u'Disables an AutoScale Vm Group'}, u'cisconexusvsm': {u'name': u'disableCiscoNexusVSM', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'disableCiscoNexusVSM'], u'length': 255, u'type': u'uuid', u'description': u'Id of the Cisco Nexus 1000v VSM device to be deleted'}], u'requiredparams': [u'id'], u'description': u'disable a Cisco Nexus VSM device'}, u'staticnat': {u'name': u'disableStaticNat', u'related': [], u'isasync': True, u'params': [{u'name': u'ipaddressid', u'required': True, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'the public IP address id for which static nat feature is being disableed'}], u'requiredparams': [u'ipaddressid'], u'description': u'Disables static rule for given ip address'}, u'user': {u'name': u'disableUser', u'related': [u'lockUser', u'listUsers', u'enableUser', u'createUser'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'disableUser', u'lockUser', u'listUsers', u'enableUser', u'createUser'], u'length': 255, u'type': u'uuid', u'description': u'Disables user by user ID.'}], u'requiredparams': [u'id'], u'description': u'Disables a user account'}}, u'detach': {u'volume': {u'name': u'detachVolume', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': False, u'related': [u'detachVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}, {u'name': u'deviceid', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'the device ID on the virtual machine where volume is detached from'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'listVirtualMachines'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine where the volume is detached from'}], u'requiredparams': [], u'description': u'Detaches a disk volume from a virtual machine.'}, u'iso': {u'name': u'detachIso', u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'virtualmachineid', u'required': True, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}], u'requiredparams': [u'virtualmachineid'], u'description': u'Detaches any ISO file (if any) currently attached to a virtual machine.'}}, u'generate': {u'usagerecords': {u'name': u'generateUsageRecords', u'related': [], u'isasync': False, u'params': [{u'name': u'enddate', u'required': True, u'related': [], u'length': 255, u'type': u'date', u'description': u'End date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-03.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'List events for the specified domain.'}, {u'name': u'startdate', u'required': True, u'related': [], u'length': 255, u'type': u'date', u'description': u'Start date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-01.'}], u'requiredparams': [u'enddate', u'startdate'], u'description': u'Generates usage records. This will generate records only if there any records to be generated, i.e if the scheduled usage job was not run or failed'}}, u'change': {u'serviceforvirtualmachine': {u'name': u'changeServiceForVirtualMachine', u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}, {u'name': u'serviceofferingid', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings'], u'length': 255, u'type': u'uuid', u'description': u'the service offering ID to apply to the virtual machine'}], u'requiredparams': [u'id', u'serviceofferingid'], u'description': u'Changes the service offering for a virtual machine. The virtual machine must be in a "Stopped" state for this command to take effect.'}, u'serviceforsystemvm': {u'name': u'changeServiceForSystemVm', u'related': [u'rebootSystemVm', u'listSystemVms'], u'isasync': False, u'params': [{u'name': u'serviceofferingid', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings', u'createServiceOffering'], u'length': 255, u'type': u'uuid', u'description': u'the service offering ID to apply to the system vm'}, {u'name': u'id', u'required': True, u'related': [u'rebootSystemVm', u'listSystemVms', u'changeServiceForSystemVm'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the system vm'}], u'requiredparams': [u'serviceofferingid', u'id'], u'description': u'Changes the service offering for a system vm (console proxy or secondary storage). The system vm must be in a "Stopped" state for this command to take effect.'}, u'serviceforrouter': {u'name': u'changeServiceForRouter', u'related': [u'destroyRouter', u'rebootRouter', u'startRouter'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'changeServiceForRouter', u'destroyRouter', u'rebootRouter', u'startRouter'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the router'}, {u'name': u'serviceofferingid', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings', u'createServiceOffering', u'updateServiceOffering'], u'length': 255, u'type': u'uuid', u'description': u'the service offering ID to apply to the domain router'}], u'requiredparams': [u'id', u'serviceofferingid'], u'description': u'Upgrades domain router to a new service offering'}}, u'reset': {u'apilimit': {u'name': u'resetApiLimit', u'related': [], u'isasync': False, u'params': [{u'name': u'account', u'required': False, u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the acount whose limit to be reset'}], u'requiredparams': [], u'description': u'Reset api count'}, u'sshkeyforvirtualmachine': {u'name': u'resetSSHKeyForVirtualMachine', u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'an optional project for the ssh key'}, {u'name': u'keypair', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the ssh key pair used to login to the virtual machine'}, {u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the ssh key. Must be used with domainId.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used.'}], u'requiredparams': [u'keypair', u'id'], u'description': u'Resets the SSH Key for virtual machine. The virtual machine must be in a "Stopped" state. [async]'}, u'passwordforvirtualmachine': {u'name': u'resetPasswordForVirtualMachine', u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}], u'requiredparams': [u'id'], u'description': u'Resets the password for virtual machine. The virtual machine must be in a "Stopped" state and the template must already support this feature for this command to take effect. [async]'}, u'vpnconnection': {u'name': u'resetVpnConnection', u'related': [u'listVpnConnections'], u'isasync': True, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for connection. Must be used with domainId.'}, {u'name': u'id', u'required': True, u'related': [u'listVpnConnections', u'resetVpnConnection'], u'length': 255, u'type': u'uuid', u'description': u'id of vpn connection'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for connection. If the account parameter is used, domainId must also be used.'}], u'requiredparams': [u'id'], u'description': u'Reset site to site vpn connection'}}, u'register': {u'userkeys': {u'name': u'registerUserKeys', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'lockUser', u'listUsers', u'enableUser', u'createUser'], u'length': 255, u'type': u'uuid', u'description': u'User id'}], u'requiredparams': [u'id'], u'description': u'This command allows a user to register for the developer API, returning a secret key and an API key. This request is made through the integration API port, so it is a privileged command and must be made on behalf of a user. It is up to the implementer just how the username and password are entered, and then how that translates to an integration API request. Both secret key and API key should be returned to the user'}, u'iso': {u'name': u'registerIso', u'related': [u'copyIso', u'updateIso', u'listIsos'], u'isasync': False, u'params': [{u'name': u'ostypeid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the OS Type that best represents the OS of this ISO. If the iso is bootable this parameter needs to be passed'}, {u'name': u'checksum', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the MD5 checksum value of this ISO'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the ISO'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId. If the account parameter is used, domainId must also be used.'}, {u'name': u'bootable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this ISO is bootable. If not passed explicitly its assumed to be true'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts'], u'length': 255, u'type': u'uuid', u'description': u'Register iso for the project'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if you want to register the ISO to be publicly available to all users, false otherwise.'}, {u'name': u'zoneid', u'required': True, u'related': [u'listZones'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone you wish to register the ISO to.'}, {u'name': u'isextractable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the iso or its derivatives are extractable; default is false'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the display text of the ISO. This is usually used for display purposes.'}, {u'name': u'isfeatured', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if you want this ISO to be featured'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL to where the ISO is currently being hosted'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account name. Must be used with domainId.'}], u'requiredparams': [u'name', u'zoneid', u'displaytext', u'url'], u'description': u'Registers an existing ISO into the CloudStack Cloud.'}, u'sshkeypair': {u'name': u'registerSSHKeyPair', u'related': [u'createSSHKeyPair', u'listSSHKeyPairs'], u'isasync': False, u'params': [{u'name': u'publickey', u'required': True, u'related': [], u'length': 5120, u'type': u'string', u'description': u'Public key material of the keypair'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the ssh key. If the account parameter is used, domainId must also be used.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Name of the keypair'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'an optional project for the ssh key'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the ssh key. Must be used with domainId.'}], u'requiredparams': [u'publickey', u'name'], u'description': u'Register a public key in a keypair under a certain name'}, u'template': {u'name': u'registerTemplate', u'related': [u'listTemplates', u'registerIso', u'updateTemplate', u'prepareTemplate', u'copyIso', u'updateIso', u'listIsos'], u'isasync': False, u'params': [{u'name': u'isextractable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template or its derivatives are extractable; default is false'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone the template is to be hosted on'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId. If the account parameter is used, domainId must also be used.'}, {u'name': u'checksum', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the MD5 checksum value of this template'}, {u'name': u'templatetag', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the tag for this template.'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template is available to all accounts; default is true'}, {u'name': u'passwordenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template supports the password reset feature; default is false'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the display text of the template. This is usually used for display purposes.'}, {u'name': u'sshkeyenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template supports the sshkey upload feature; default is false'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'Register template for the project'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the template'}, {u'name': u'isfeatured', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this template is a featured template, false otherwise'}, {u'name': u'format', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the format for the template. Possible values include QCOW2, RAW, and VHD.'}, {u'name': u'requireshvm', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this template requires HVM'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional accountName. Must be used with domainId.'}, {u'name': u'ostypeid', u'required': True, u'related': [u'listOsTypes'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the OS Type that best represents the OS of this template.'}, {u'name': u'hypervisor', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the target hypervisor for the template'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL of where the template is hosted. Possible URL include http:// and https://'}, {u'name': u'bits', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'32 or 64 bits support. 64 by default'}, {u'name': u'details', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'Template details in key/value pairs.'}], u'requiredparams': [u'zoneid', u'displaytext', u'name', u'format', u'ostypeid', u'hypervisor', u'url'], u'description': u'Registers an existing template into the CloudStack cloud. '}}, u'list': {u'instancegroups': {u'name': u'listInstanceGroups', u'related': [u'updateInstanceGroup', u'createInstanceGroup'], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listInstanceGroups', u'updateInstanceGroup', u'createInstanceGroup'], u'length': 255, u'type': u'uuid', u'description': u'list instance groups by ID'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list instance groups by name'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}], u'requiredparams': [], u'description': u'Lists vm groups'}, u'physicalnetworks': {u'name': u'listPhysicalNetworks', u'related': [], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the physical network'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listPhysicalNetworks'], u'length': 255, u'type': u'uuid', u'description': u'list physical network by id'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'search by name'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists physical networks'}, u'networks': {u'name': u'listNetworks', u'related': [u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks'], u'isasync': False, u'params': [{u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'issystem', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if network is system, false otherwise'}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'List networks by VPC'}, {u'name': u'acltype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list networks by ACL (access control list) type. Supported values are Account and Domain'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'specifyipranges', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if need to list only networks which support specifying ip ranges'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID of the network'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'restartrequired', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list networks by restartRequired'}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the type of the network. Supported values are: Isolated and Shared'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'list networks by physical network id'}, {u'name': u'supportedservices', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list networks supporting certain services'}, {u'name': u'traffictype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'type of the traffic'}, {u'name': u'id', u'required': False, u'related': [u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'list networks by id'}, {u'name': u'canusefordeploy', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list networks available for vm deployment'}, {u'name': u'forvpc', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'the network belongs to vpc'}], u'requiredparams': [], u'description': u'Lists all available networks.'}, u'capabilities': {u'name': u'listCapabilities', u'related': [], u'isasync': False, u'params': [], u'requiredparams': [], u'description': u'Lists capabilities'}, u'clusters': {u'name': u'listClusters', u'related': [u'updateCluster'], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'listClusters', u'updateCluster'], u'length': 255, u'type': u'uuid', u'description': u'lists clusters by the cluster ID'}, {u'name': u'managedstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'whether this cluster is managed by cloudstack'}, {u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists clusters by hypervisor type'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists clusters by allocation state'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'lists clusters by Zone ID'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists clusters by the cluster name'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'clustertype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists clusters by cluster type'}, {u'name': u'showcapacities', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'flag to display the capacity of the clusters'}, {u'name': u'podid', u'required': False, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'lists clusters by Pod ID'}], u'requiredparams': [], u'description': u'Lists clusters.'}, u'resourcelimits': {u'name': u'listResourceLimits', u'related': [u'updateResourceLimit'], u'isasync': False, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'resourcetype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Type of resource to update. Values are 0, 1, 2, 3, and 4. 0 - Instance. Number of instances a user can create. 1 - IP. Number of public IP addresses a user can own. 2 - Volume. Number of disk volumes a user can create.3 - Snapshot. Number of snapshots a user can create.4 - Template. Number of templates that a user can register/create.'}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'Lists resource limits by ID.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}], u'requiredparams': [], u'description': u'Lists resource limits.'}, u'firewallrules': {u'name': u'listFirewallRules', u'related': [u'createEgressFirewallRule', u'createFirewallRule', u'listEgressFirewallRules'], u'isasync': False, u'params': [{u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'id', u'required': False, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'Lists rule with the specified ID.'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'ipaddressid', u'required': False, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'the id of IP address of the firwall services'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}], u'requiredparams': [], u'description': u'Lists all firewall rules for an IP address.'}, u'supportednetworkservices': {u'name': u'listSupportedNetworkServices', u'related': [], u'isasync': False, u'params': [{u'name': u'service', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'network service name to list providers and capabilities of'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'provider', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'network service provider name'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists all network services provided by CloudStack or for the given Provider.'}, u'loadbalancerrules': {u'name': u'listLoadBalancerRules', u'related': [u'createLoadBalancerRule', u'updateLoadBalancerRule'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the availability zone ID'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine of the load balancer rule'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'id', u'required': False, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'publicipid', u'required': False, u'related': [u'restartNetwork', u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'the public IP address id of the load balancer rule '}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the load balancer rule'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}], u'requiredparams': [], u'description': u'Lists load balancer rules.'}, u'autoscalepolicies': {u'name': u'listAutoScalePolicies', u'related': [u'createAutoScalePolicy', u'updateAutoScalePolicy'], u'isasync': False, u'params': [{u'name': u'action', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the action to be executed if all the conditions evaluate to true for the specified duration.'}, {u'name': u'id', u'required': False, u'related': [u'createAutoScalePolicy', u'updateAutoScalePolicy', u'listAutoScalePolicies'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale policy'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'vmgroupid', u'required': False, u'related': [u'createAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale vm group'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'conditionid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the condition of the policy'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists autoscale policies.'}, u'niciranvpdevices': {u'name': u'listNiciraNvpDevices', u'related': [u'addNiciraNvpDevice'], u'isasync': False, u'params': [{u'name': u'nvpdeviceid', u'required': False, u'related': [u'addNiciraNvpDevice', u'listNiciraNvpDevices'], u'length': 255, u'type': u'uuid', u'description': u'nicira nvp device ID'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists Nicira NVP devices'}, u'f5loadbalancernetworks': {u'name': u'listF5LoadBalancerNetworks', u'related': [u'createNetwork', u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'lbdeviceid', u'required': True, u'related': [u'configureF5LoadBalancer', u'addF5LoadBalancer', u'listF5LoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'f5 load balancer device ID'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [u'lbdeviceid'], u'description': u'lists network that are using a F5 load balancer device'}, u'templatepermissions': {u'name': u'listTemplatePermissions', u'related': [u'listIsoPermissions'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'listIsoPermissions', u'listTemplatePermissions'], u'length': 255, u'type': u'uuid', u'description': u'the template ID'}], u'requiredparams': [u'id'], u'description': u'List template visibility and all accounts that have permissions to view this template.'}, u'projects': {u'name': u'listProjects', u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List projects by tags (key/value pairs)'}, {u'name': u'id', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list projects by project ID'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list projects by name'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list projects by state'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list projects by display text'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}], u'requiredparams': [], u'description': u'Lists projects and provides detailed information for listed projects'}, u'systemvms': {u'name': u'listSystemVms', u'related': [u'rebootSystemVm'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID of the system VM'}, {u'name': u'hostid', u'required': False, u'related': [u'addHost', u'updateHost', u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'the host ID of the system VM'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the state of the system VM'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'storageid', u'required': False, u'related': [u'cancelStorageMaintenance'], u'length': 255, u'type': u'uuid', u'description': u"the storage ID where vm's volumes belong to"}, {u'name': u'systemvmtype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the system VM type. Possible types are "consoleproxy" and "secondarystoragevm".'}, {u'name': u'podid', u'required': False, u'related': [u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID of the system VM'}, {u'name': u'id', u'required': False, u'related': [u'rebootSystemVm', u'listSystemVms'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the system VM'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the system VM'}], u'requiredparams': [], u'description': u'List system virtual machines.'}, u'portforwardingrules': {u'name': u'listPortForwardingRules', u'related': [u'listIpForwardingRules', u'createPortForwardingRule'], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'id', u'required': False, u'related': [u'listIpForwardingRules', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'Lists rule with the specified ID.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'ipaddressid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the id of IP address of the port forwarding services'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}], u'requiredparams': [], u'description': u'Lists all port forwarding rules for an IP address.'}, u'hypervisors': {u'name': u'listHypervisors', u'related': [], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the zone id for listing hypervisors.'}], u'requiredparams': [], u'description': u'List hypervisors'}, u'publicipaddresses': {u'name': u'listPublicIpAddresses', u'related': [u'restartNetwork', u'associateIpAddress'], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'lists all public IP addresses by Zone ID'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'allocatedonly', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'limits search results to allocated public IP addresses'}, {u'name': u'id', u'required': False, u'related': [u'restartNetwork', u'listPublicIpAddresses', u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'lists ip address by id'}, {u'name': u'forloadbalancing', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list only ips used for load balancing'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'isstaticnat', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list only static nat ip addresses'}, {u'name': u'issourcenat', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list only source nat ip addresses'}, {u'name': u'vlanid', u'required': False, u'related': [u'listVlanIpRanges'], u'length': 255, u'type': u'uuid', u'description': u'lists all public IP addresses by VLAN ID'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'ipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists the specified IP address'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'lists all public IP addresses by physical network id'}, {u'name': u'associatednetworkid', u'required': False, u'related': [u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'lists all public IP addresses associated to the network specified'}, {u'name': u'forvirtualnetwork', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'the virtual network for the IP address'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'List ips belonging to the VPC'}], u'requiredparams': [], u'description': u'Lists all public ip addresses'}, u'vpngateways': {u'name': u'listVpnGateways', u'related': [u'createVpnGateway'], u'isasync': False, u'params': [{u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'id', u'required': False, u'related': [u'createVpnGateway', u'listVpnGateways'], u'length': 255, u'type': u'uuid', u'description': u'id of the vpn gateway'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'id of vpc'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}], u'requiredparams': [], u'description': u'Lists site 2 site vpn gateways'}, u'loadbalancerruleinstances': {u'name': u'listLoadBalancerRuleInstances', u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'applied', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if listing all virtual machines currently applied to the load balancer rule; default is true'}, {u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}], u'requiredparams': [u'id'], u'description': u'List all virtual machine instances that are assigned to a load balancer rule.'}, u'hosts': {u'name': u'listHosts', u'related': [], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'podid', u'required': False, u'related': [u'updatePod'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID for the host'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the state of the host'}, {u'name': u'resourcestate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list hosts by resource state. Resource state represents current state determined by admin of host, valule can be one of [Enabled, Disabled, Unmanaged, PrepareForMaintenance, ErrorInMaintenance, Maintenance, Error]'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the host'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the host'}, {u'name': u'virtualmachineid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'lists hosts in the same cluster as this VM and flag hosts with enough CPU/RAm to host this VM'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'lists hosts existing in particular cluster'}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the host type'}, {u'name': u'id', u'required': False, u'related': [u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'the id of the host'}, {u'name': u'details', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'comma separated list of host details requested, value can be a list of [ min, all, capacity, events, stats]'}, {u'name': u'hahost', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, list only hosts dedicated to HA'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists hosts.'}, u'pools': {u'name': u'listPools', u'related': [], u'isasync': False, u'params': [], u'requiredparams': [], u'description': u'List Pool'}, u'counters': {u'name': u'listCounters', u'related': [], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'source', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Source of the counter.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'id', u'required': False, u'related': [u'listCounters'], u'length': 255, u'type': u'uuid', u'description': u'ID of the Counter.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Name of the counter.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'List the counters'}, u'configurations': {u'name': u'listConfigurations', u'related': [], u'isasync': False, u'params': [{u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists configuration by name'}, {u'name': u'category', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists configurations by category'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists all configurations.'}, u'usagerecords': {u'name': u'listUsageRecords', u'related': [], u'isasync': False, u'params': [{u'name': u'enddate', u'required': True, u'related': [], u'length': 255, u'type': u'date', u'description': u'End date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-03.'}, {u'name': u'startdate', u'required': True, u'related': [], u'length': 255, u'type': u'date', u'description': u'Start date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-01.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'List usage records for the specified usage type'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject'], u'length': 255, u'type': u'uuid', u'description': u'List usage records for specified project'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List usage records for the specified user.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'List usage records for the specified domain.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'accountid', u'required': False, u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount'], u'length': 255, u'type': u'uuid', u'description': u'List usage records for the specified account'}], u'requiredparams': [u'enddate', u'startdate'], u'description': u'Lists usage records for accounts'}, u'storagepools': {u'name': u'listStoragePools', u'related': [u'cancelStorageMaintenance'], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the storage pool'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'path', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the storage pool path'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list storage pools belongig to the specific cluster'}, {u'name': u'id', u'required': False, u'related': [u'cancelStorageMaintenance', u'listStoragePools'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the storage pool'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'ipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the IP address for the storage pool'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the storage pool'}, {u'name': u'podid', u'required': False, u'related': [u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID for the storage pool'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists storage pools.'}, u'vpncustomergateways': {u'name': u'listVpnCustomerGateways', u'related': [u'updateVpnCustomerGateway', u'createVpnCustomerGateway'], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'updateVpnCustomerGateway', u'createVpnCustomerGateway', u'listVpnCustomerGateways'], u'length': 255, u'type': u'uuid', u'description': u'id of the customer gateway'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}], u'requiredparams': [], u'description': u'Lists site to site vpn customer gateways'}, u'zones': {u'name': u'listZones', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'listZones'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone'}, {u'name': u'available', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if you want to retrieve all available Zones. False if you only want to return the Zones from which you have at least one VM. Default is false.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the zone'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the domain associated with the zone'}, {u'name': u'showcapacities', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'flag to display the capacity of the zones'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists zones'}, u'serviceofferings': {u'name': u'listServiceOfferings', u'related': [u'updateHypervisorCapabilities'], u'isasync': False, u'params': [{u'name': u'systemvmtype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the system VM type. Possible types are "consoleproxy", "secondarystoragevm" or "domainrouter".'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the domain associated with the service offering'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the service offering'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine. Pass this in if you want to see the available service offering that a virtual machine can be changed to.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'issystem', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'is this a system vm offering'}, {u'name': u'id', u'required': False, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings'], u'length': 255, u'type': u'uuid', u'description': u'ID of the service offering'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists all available service offerings.'}, u'externalfirewalls': {u'name': u'listExternalFirewalls', u'related': [u'addExternalFirewall'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'zoneid', u'required': True, u'related': [u'listZones'], u'length': 255, u'type': u'uuid', u'description': u'zone Id'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [u'zoneid'], u'description': u'List external firewall appliances.'}, u'networkserviceproviders': {u'name': u'listNetworkServiceProviders', u'related': [u'addNetworkServiceProvider', u'listTrafficTypes', u'updateNetworkServiceProvider'], u'isasync': False, u'params': [{u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list providers by state'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list providers by name'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'updatePhysicalNetwork', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists network serviceproviders for a given physical network.'}, u'capacity': {u'name': u'listCapacity', u'related': [], u'isasync': False, u'params': [{u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'lists capacity by type* CAPACITY_TYPE_MEMORY = 0* CAPACITY_TYPE_CPU = 1* CAPACITY_TYPE_STORAGE = 2* CAPACITY_TYPE_STORAGE_ALLOCATED = 3* CAPACITY_TYPE_VIRTUAL_NETWORK_PUBLIC_IP = 4* CAPACITY_TYPE_PRIVATE_IP = 5* CAPACITY_TYPE_SECONDARY_STORAGE = 6* CAPACITY_TYPE_VLAN = 7* CAPACITY_TYPE_DIRECT_ATTACHED_PUBLIC_IP = 8* CAPACITY_TYPE_LOCAL_STORAGE = 9.'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'lists capacity by the Cluster ID'}, {u'name': u'sortby', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Sort the results. Available values: Usage'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'fetchlatest', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'recalculate capacities and fetch the latest'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'lists capacity by the Zone ID'}, {u'name': u'podid', u'required': False, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'lists capacity by the Pod ID'}], u'requiredparams': [], u'description': u'Lists all the system wide capacities.'}, u'diskofferings': {u'name': u'listDiskOfferings', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'listDiskOfferings'], u'length': 255, u'type': u'uuid', u'description': u'ID of the disk offering'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the disk offering'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the domain of the disk offering.'}], u'requiredparams': [], u'description': u'Lists all available disk offerings.'}, u'lbstickinesspolicies': {u'name': u'listLBStickinessPolicies', u'related': [u'createLBStickinessPolicy'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'lbruleid', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [u'lbruleid'], u'description': u'Lists LBStickiness policies.'}, u'srxfirewallnetworks': {u'name': u'listSrxFirewallNetworks', u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'isasync': False, u'params': [{u'name': u'lbdeviceid', u'required': True, u'related': [u'addSrxFirewall'], u'length': 255, u'type': u'uuid', u'description': u'netscaler load balancer device ID'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [u'lbdeviceid'], u'description': u'lists network that are using SRX firewall device'}, u'securitygroups': {u'name': u'listSecurityGroups', u'related': [], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'id', u'required': False, u'related': [u'listSecurityGroups'], u'length': 255, u'type': u'uuid', u'description': u'list the security group by the id provided'}, {u'name': u'securitygroupname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists security groups by name'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'lists security groups by virtual machine id'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists security groups'}, u'conditions': {u'name': u'listConditions', u'related': [u'listCounters', u'createCounter'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'ID of the Condition.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'counterid', u'required': False, u'related': [u'listConditions', u'listCounters', u'createCounter'], u'length': 255, u'type': u'uuid', u'description': u'Counter-id of the condition.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'policyid', u'required': False, u'related': [u'createAutoScalePolicy', u'updateAutoScalePolicy'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the policy'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}], u'requiredparams': [], u'description': u'List Conditions for the specific user'}, u'swifts': {u'name': u'listSwifts', u'related': [u'addHost', u'updateHost', u'listHosts', u'listExternalLoadBalancers'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'the id of the swift'}], u'requiredparams': [], u'description': u'List Swift.'}, u'hypervisorcapabilities': {u'name': u'listHypervisorCapabilities', u'related': [], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listHypervisorCapabilities'], u'length': 255, u'type': u'uuid', u'description': u'ID of the hypervisor capability'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the hypervisor for which to restrict the search'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists all hypervisor capabilities.'}, u'tags': {u'name': u'listTags', u'related': [], u'isasync': False, u'params': [{u'name': u'resourceid', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by resource id'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'resourcetype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by resource type'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'key', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by key'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'customer', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by customer name'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'value', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by value'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'List resource tag(s)'}, u'routers': {u'name': u'listRouters', u'related': [u'changeServiceForRouter', u'stopRouter', u'destroyRouter', u'rebootRouter', u'startRouter'], u'isasync': False, u'params': [{u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the state of the router'}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'List networks by VPC'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'podid', u'required': False, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID of the router'}, {u'name': u'hostid', u'required': False, u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addSecondaryStorage', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers', u'prepareHostForMaintenance'], u'length': 255, u'type': u'uuid', u'description': u'the host ID of the router'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the router'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID of the router'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'id', u'required': False, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'addNicToVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'listLoadBalancerRuleInstances', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk router'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'suspendProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'networkid', u'required': False, u'related': [u'createNetwork', u'listNiciraNvpDeviceNetworks', u'updateNetwork', u'listF5LoadBalancerNetworks', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'list by network id'}, {u'name': u'forvpc', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true is passed for this parameter, list only VPC routers'}], u'requiredparams': [], u'description': u'List routers.'}, u'traffictypes': {u'name': u'listTrafficTypes', u'related': [u'addNetworkServiceProvider', u'updateNetworkServiceProvider'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [u'physicalnetworkid'], u'description': u'Lists traffic types of a given physical network.'}, u'projectinvitations': {u'name': u'listProjectInvitations', u'related': [], u'isasync': False, u'params': [{u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'activeonly', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, list only active invitations - having Pending state and ones that are not timed out yet'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list by project id'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list invitations by state'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'id', u'required': False, u'related': [u'listProjectInvitations'], u'length': 255, u'type': u'uuid', u'description': u'list invitations by id'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}], u'requiredparams': [], u'description': u'Lists projects and provides detailed information for listed projects'}, u'isos': {u'name': u'listIsos', u'related': [], u'isasync': False, u'params': [{u'name': u'bootable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the ISO is bootable, false otherwise'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list all isos by name'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'id', u'required': False, u'related': [u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'list ISO by id'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the ISO is publicly available to all users, false otherwise.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isofilter', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'possible values are "featured", "self", "selfexecutable","sharedexecutable","executable", and "community". * featured : templates that have been marked as featured and public. * self : templates that have been registered or created by the calling user. * selfexecutable : same as self, but only returns templates that can be used to deploy a new VM. * sharedexecutable : templates ready to be deployed that have been granted to the calling user by another user. * executable : templates that are owned by the calling user, or public templates, that can be used to deploy a VM. * community : templates that have been marked as public but not featured. * all : all templates (only usable by admins).'}, {u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the hypervisor for which to restrict the search'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'isready', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this ISO is ready to be deployed'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists all available ISO files.'}, u'users': {u'name': u'listUsers', u'related': [], u'isasync': False, u'params': [{u'name': u'username', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List user by the username'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'accounttype', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'List users by account type. Valid types include admin, domain-admin, read-only-admin, or user.'}, {u'name': u'id', u'required': False, u'related': [u'listUsers'], u'length': 255, u'type': u'uuid', u'description': u'List user by ID.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List users by state of the user account.'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists user accounts'}, u'sshkeypairs': {u'name': u'listSSHKeyPairs', u'related': [], u'isasync': False, u'params': [{u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'fingerprint', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'A public key fingerprint to look for'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'A key pair name to look for'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}], u'requiredparams': [], u'description': u'List registered keypairs'}, u'privategateways': {u'name': u'listPrivateGateways', u'related': [u'createPrivateGateway'], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'createPrivateGateway', u'listPrivateGateways'], u'length': 255, u'type': u'uuid', u'description': u'list private gateway by id'}, {u'name': u'ipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list gateways by ip address'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'list gateways by vpc'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list gateways by state'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list gateways by vlan'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}], u'requiredparams': [], u'description': u'List private gateways'}, u'usagetypes': {u'name': u'listUsageTypes', u'related': [], u'isasync': False, u'params': [], u'requiredparams': [], u'description': u'List Usage Types'}, u'domainchildren': {u'name': u'listDomainChildren', u'related': [u'createDomain'], u'isasync': False, u'params': [{u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list children domains by name'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list children domain by parent domain ID.'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'to return the entire tree, use the value "true". To return the first level children, use the value "false".'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists all children domains belonging to a specified domain'}, u'domains': {u'name': u'listDomains', u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'List domain by domain ID.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List domain by domain name.'}, {u'name': u'level', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'List domains by domain level.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}], u'requiredparams': [], u'description': u'Lists domains and provides detailed information for listed domains'}, u'externalloadbalancers': {u'name': u'listExternalLoadBalancers', u'related': [u'addHost', u'updateHost', u'listHosts'], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'zone Id'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists F5 external load balancer appliances added in a zone.'}, u'netscalerloadbalancers': {u'name': u'listNetscalerLoadBalancers', u'related': [], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'lbdeviceid', u'required': False, u'related': [u'listNetscalerLoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'netscaler load balancer device ID'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'lists netscaler load balancer devices'}, u's3s': {u'name': u'listS3s', u'related': [u'addS3'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists S3s'}, u'bigswitchvnsdevices': {u'name': u'listBigSwitchVnsDevices', u'related': [u'addBigSwitchVnsDevice'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'vnsdeviceid', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'bigswitch vns device ID'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}], u'requiredparams': [], u'description': u'Lists BigSwitch Vns devices'}, u'accounts': {u'name': u'listAccounts', u'related': [u'markDefaultZoneForAccount', u'lockAccount'], u'isasync': False, u'params': [{u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list accounts by state. Valid states are enabled, disabled, and locked.'}, {u'name': u'iscleanuprequired', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list accounts by cleanuprequred attribute (values are true or false)'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'accounttype', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'list accounts by account type. Valid account types are 1 (admin), 2 (domain-admin), and 0 (user).'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'id', u'required': False, u'related': [u'markDefaultZoneForAccount', u'listAccounts', u'lockAccount'], u'length': 255, u'type': u'uuid', u'description': u'list account by account ID'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list account by account name'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}], u'requiredparams': [], u'description': u'Lists accounts and provides detailed account information for listed accounts'}, u'networkdevice': {u'name': u'listNetworkDevice', u'related': [u'addNetworkDevice'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'networkdevicetype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Network device type, now supports ExternalDhcp, PxeServer, NetscalerMPXLoadBalancer, NetscalerVPXLoadBalancer, NetscalerSDXLoadBalancer, F5BigIpLoadBalancer, JuniperSRXFirewall'}, {u'name': u'networkdeviceparameterlist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'parameters for network device'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'List network devices'}, u'vlanipranges': {u'name': u'listVlanIpRanges', u'related': [], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'networkid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'network id of the VLAN IP range'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the domain ID with which the VLAN IP range is associated. If used with the account parameter, returns all VLAN IP ranges for that account in the specified domain.'}, {u'name': u'id', u'required': False, u'related': [u'listVlanIpRanges'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the VLAN IP range'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks'], u'length': 255, u'type': u'uuid', u'description': u'physical network id of the VLAN IP range'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'project who will own the VLAN'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account with which the VLAN IP range is associated. Must be used with the domainId parameter.'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ID or VID of the VLAN. Default is an "untagged" VLAN.'}, {u'name': u'podid', u'required': False, u'related': [u'updatePod'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID of the VLAN IP range'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID of the VLAN IP range'}, {u'name': u'forvirtualnetwork', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if VLAN is of Virtual type, false if Direct'}], u'requiredparams': [], u'description': u'Lists all VLAN IP ranges.'}, u'traffictypeimplementors': {u'name': u'listTrafficTypeImplementors', u'related': [], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'traffictype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Optional. The network traffic type, if specified, return its implementor. Otherwise, return all traffic types with their implementor'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists implementors of implementor of a network traffic type or implementors of all network traffic types'}, u'storagenetworkiprange': {u'name': u'listStorageNetworkIpRange', u'related': [u'updateStorageNetworkIpRange'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'optional parameter. Zone uuid, if specicied and both pod uuid and range uuid are absent, using it to search the range.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'id', u'required': False, u'related': [u'listStorageNetworkIpRange', u'updateStorageNetworkIpRange'], u'length': 255, u'type': u'uuid', u'description': u'optional parameter. Storaget network IP range uuid, if specicied, using it to search the range.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'podid', u'required': False, u'related': [u'updatePod'], u'length': 255, u'type': u'uuid', u'description': u'optional parameter. Pod uuid, if specicied and range uuid is absent, using it to search the range.'}], u'requiredparams': [], u'description': u'List a storage network IP range.'}, u'isopermissions': {u'name': u'listIsoPermissions', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'listIsoPermissions'], u'length': 255, u'type': u'uuid', u'description': u'the template ID'}], u'requiredparams': [u'id'], u'description': u'List iso visibility and all accounts that have permissions to view this iso.'}, u'snapshotpolicies': {u'name': u'listSnapshotPolicies', u'related': [], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'volumeid', u'required': True, u'related': [u'detachVolume', u'uploadVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [u'volumeid'], u'description': u'Lists snapshot policies.'}, u'autoscalevmgroups': {u'name': u'listAutoScaleVmGroups', u'related': [u'createAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'isasync': False, u'params': [{u'name': u'policyid', u'required': False, u'related': [u'createAutoScalePolicy', u'updateAutoScalePolicy', u'listAutoScalePolicies'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the policy'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'vmprofileid', u'required': False, u'related': [u'updateAutoScaleVmProfile', u'createAutoScaleVmProfile', u'listAutoScaleVmProfiles'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the profile'}, {u'name': u'lbruleid', u'required': False, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the loadbalancer'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the availability zone ID'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'id', u'required': False, u'related': [u'listAutoScaleVmGroups', u'createAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale vm group'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists autoscale vm groups.'}, u'projectaccounts': {u'name': u'listProjectAccounts', u'related': [u'createProject'], u'isasync': False, u'params': [{u'name': u'projectid', u'required': True, u'related': [u'createProject', u'listProjectAccounts'], u'length': 255, u'type': u'uuid', u'description': u'id of the project'}, {u'name': u'role', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list accounts of the project by role'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list accounts of the project by account name'}], u'requiredparams': [u'projectid'], u'description': u"Lists project's accounts"}, u'autoscalevmprofiles': {u'name': u'listAutoScaleVmProfiles', u'related': [], u'isasync': False, u'params': [{u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'domainid', u'required': False, u'related': [u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'id', u'required': False, u'related': [u'listAutoScaleVmProfiles'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale vm profile'}, {u'name': u'templateid', u'required': False, u'related': [u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the templateid of the autoscale vm profile'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'otherdeployparams', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the otherdeployparameters of the autoscale vm profile'}], u'requiredparams': [], u'description': u'Lists autoscale vm profiles.'}, u'apis': {u'name': u'listApis', u'related': [], u'isasync': False, u'params': [{u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'API name'}], u'requiredparams': [], u'description': u'lists all available apis on the server, provided by the Api Discovery plugin'}, u'vpcs': {u'name': u'listVPCs', u'related': [u'restartVPC'], u'isasync': False, u'params': [{u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by name of the VPC'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'cidr', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"list by cidr of the VPC. All VPC guest networks' cidrs should be within this CIDR"}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'restartrequired', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list VPCs by restartRequired option'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list VPCs by state'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by display text of the VPC'}, {u'name': u'id', u'required': False, u'related': [u'restartVPC', u'listVPCs'], u'length': 255, u'type': u'uuid', u'description': u'list VPC by id'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list by zone'}, {u'name': u'supportedservices', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list VPC supporting certain services'}, {u'name': u'vpcofferingid', u'required': False, u'related': [u'listVPCOfferings', u'createVPCOffering'], u'length': 255, u'type': u'uuid', u'description': u'list by ID of the VPC offering'}], u'requiredparams': [], u'description': u'Lists VPCs'}, u'f5loadbalancers': {u'name': u'listF5LoadBalancers', u'related': [u'configureF5LoadBalancer'], u'isasync': False, u'params': [{u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'updatePhysicalNetwork', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'lbdeviceid', u'required': False, u'related': [u'configureF5LoadBalancer', u'listF5LoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'f5 load balancer device ID'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'lists F5 load balancer devices'}, u'snapshots': {u'name': u'listSnapshots', u'related': [], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'id', u'required': False, u'related': [u'listSnapshots'], u'length': 255, u'type': u'uuid', u'description': u'lists snapshot by snapshot ID'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'intervaltype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'valid values are HOURLY, DAILY, WEEKLY, and MONTHLY.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'volumeid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists snapshot by snapshot name'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'snapshottype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'valid values are MANUAL or RECURRING.'}], u'requiredparams': [], u'description': u'Lists all available snapshots for the account.'}, u'networkofferings': {u'name': u'listNetworkOfferings', u'related': [u'createNetworkOffering', u'updateNetworkOffering'], u'isasync': False, u'params': [{u'name': u'isdefault', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if need to list only default network offerings. Default value is false'}, {u'name': u'sourcenatsupported', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if need to list only netwok offerings where source nat is supported, false otherwise'}, {u'name': u'supportedservices', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list network offerings supporting certain services'}, {u'name': u'networkid', u'required': False, u'related': [u'createNetwork', u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the network. Pass this in if you want to see the available network offering that a network can be changed to.'}, {u'name': u'specifyipranges', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if need to list only network offerings which support specifying ip ranges'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list network offerings by name'}, {u'name': u'id', u'required': False, u'related': [u'listNetworkOfferings', u'createNetworkOffering', u'updateNetworkOffering'], u'length': 255, u'type': u'uuid', u'description': u'list network offerings by id'}, {u'name': u'specifyvlan', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'the tags for the network offering.'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'list netowrk offerings available for network creation in specific zone'}, {u'name': u'forvpc', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'the network offering can be used only for network creation inside the VPC'}, {u'name': u'traffictype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by traffic type'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'guestiptype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list network offerings by guest type: Shared or Isolated'}, {u'name': u'istagged', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if offering has tags specified'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'list network offerings by tags'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list network offerings by display text'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list network offerings by state'}, {u'name': u'availability', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the availability of network offering. Default value is Required'}], u'requiredparams': [], u'description': u'Lists all available network offerings.'}, u'virtualmachines': {u'name': u'listVirtualMachines', u'related': [], u'isasync': False, u'params': [{u'name': u'templateid', u'required': False, u'related': [u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'list vms by template'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'networkid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list by network id'}, {u'name': u'storageid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u"the storage ID where vm's volumes belong to"}, {u'name': u'isoid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list vms by iso'}, {u'name': u'vpcid', u'required': False, u'related': [u'restartVPC'], u'length': 255, u'type': u'uuid', u'description': u'list vms by vpc'}, {u'name': u'podid', u'required': False, u'related': [u'updatePod'], u'length': 255, u'type': u'uuid', u'description': u'the pod ID'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the virtual machine'}, {u'name': u'details', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'comma separated list of host details requested, value can be a list of [all, group, nics, stats, secgrp, tmpl, servoff, iso, volume, min]. If no parameter is passed in, the details will be defaulted to all'}, {u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the target hypervisor for the template'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'groupid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the group ID'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the availability zone ID'}, {u'name': u'hostid', u'required': False, u'related': [u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'the host ID'}, {u'name': u'id', u'required': False, u'related': [u'listVirtualMachines'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine'}, {u'name': u'forvirtualnetwork', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list by network type; true if need to list vms using Virtual Network, false otherwise'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'state of the virtual machine'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'List the virtual machines owned by the account.'}, u'netscalerloadbalancernetworks': {u'name': u'listNetscalerLoadBalancerNetworks', u'related': [], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'lbdeviceid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'netscaler load balancer device ID'}], u'requiredparams': [u'lbdeviceid'], u'description': u'lists network that are using a netscaler load balancer device'}, u'oscategories': {u'name': u'listOsCategories', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'listOsCategories'], u'length': 255, u'type': u'uuid', u'description': u'list Os category by id'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list os category by name'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists all supported OS categories for this cloud.'}, u'virtualrouterelements': {u'name': u'listVirtualRouterElements', u'related': [u'createVirtualRouterElement', u'configureVirtualRouterElement'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'nspid', u'required': False, u'related': [u'addNetworkServiceProvider', u'listTrafficTypes', u'updateNetworkServiceProvider'], u'length': 255, u'type': u'uuid', u'description': u'list virtual router elements by network service provider id'}, {u'name': u'id', u'required': False, u'related': [u'createVirtualRouterElement', u'configureVirtualRouterElement', u'listVirtualRouterElements'], u'length': 255, u'type': u'uuid', u'description': u'list virtual router elements by id'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'enabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list network offerings by enabled state'}], u'requiredparams': [], u'description': u'Lists all available virtual router elements.'}, u'lunsonfiler': {u'name': u'listLunsOnFiler', u'related': [], u'isasync': False, u'params': [{u'name': u'poolname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}], u'requiredparams': [u'poolname'], u'description': u'List LUN'}, u'asyncjobs': {u'name': u'listAsyncJobs', u'related': [u'queryAsyncJobResult'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'startdate', u'required': False, u'related': [], u'length': 255, u'type': u'tzdate', u'description': u'the start date of the async job'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}], u'requiredparams': [], u'description': u'Lists all pending asynchronous jobs for the account.'}, u'ostypes': {u'name': u'listOsTypes', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'listOsTypes'], u'length': 255, u'type': u'uuid', u'description': u'list by Os type Id'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'oscategoryid', u'required': False, u'related': [u'listOsCategories'], u'length': 255, u'type': u'uuid', u'description': u'list by Os Category id'}, {u'name': u'description', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list os by description'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists all supported OS types for this cloud.'}, u'networkacls': {u'name': u'listNetworkACLs', u'related': [u'createNetworkACL'], u'isasync': False, u'params': [{u'name': u'traffictype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list network ACLs by traffic type - Ingress or Egress'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'id', u'required': False, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'Lists network ACL with the specified ID.'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'suspendProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'networkid', u'required': False, u'related': [u'createNetwork', u'listNiciraNvpDeviceNetworks', u'updateNetwork', u'listF5LoadBalancerNetworks', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'list network ACLs by network Id'}], u'requiredparams': [], u'description': u'Lists all network ACLs'}, u'volumesonfiler': {u'name': u'listVolumesOnFiler', u'related': [], u'isasync': False, u'params': [{u'name': u'poolname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}], u'requiredparams': [u'poolname'], u'description': u'List Volumes'}, u'eventtypes': {u'name': u'listEventTypes', u'related': [], u'isasync': False, u'params': [], u'requiredparams': [], u'description': u'List Event Types'}, u'remoteaccessvpns': {u'name': u'listRemoteAccessVpns', u'related': [u'createRemoteAccessVpn'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'publicipid', u'required': True, u'related': [u'restartNetwork', u'listPublicIpAddresses', u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'public ip address id of the vpn server'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}], u'requiredparams': [u'publicipid'], u'description': u'Lists remote access vpns'}, u'alerts': {u'name': u'listAlerts', u'related': [], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by alert type'}, {u'name': u'id', u'required': False, u'related': [u'listAlerts'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the alert'}], u'requiredparams': [], u'description': u'Lists all alerts.'}, u'regions': {u'name': u'listRegions', u'related': [u'addRegion'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'List Region by region ID.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List Region by region name.'}], u'requiredparams': [], u'description': u'Lists Regions'}, u'vpcofferings': {u'name': u'listVPCOfferings', u'related': [], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listVPCOfferings'], u'length': 255, u'type': u'uuid', u'description': u'list VPC offerings by id'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list VPC offerings by state'}, {u'name': u'supportedservices', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list VPC offerings supporting certain services'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list VPC offerings by display text'}, {u'name': u'isdefault', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if need to list only default VPC offerings. Default value is false'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list VPC offerings by name'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists VPC offerings'}, u'niciranvpdevicenetworks': {u'name': u'listNiciraNvpDeviceNetworks', u'related': [u'createNetwork', u'updateNetwork', u'listF5LoadBalancerNetworks', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'isasync': False, u'params': [{u'name': u'nvpdeviceid', u'required': True, u'related': [u'addNiciraNvpDevice', u'listNiciraNvpDevices'], u'length': 255, u'type': u'uuid', u'description': u'nicira nvp device ID'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [u'nvpdeviceid'], u'description': u'lists network that are using a nicira nvp device'}, u'events': {u'name': u'listEvents', u'related': [], u'isasync': False, u'params': [{u'name': u'startdate', u'required': False, u'related': [], u'length': 255, u'type': u'date', u'description': u'the start date range of the list you want to retrieve (use format "yyyy-MM-dd" or the new format "yyyy-MM-dd HH:mm:ss")'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'enddate', u'required': False, u'related': [], u'length': 255, u'type': u'date', u'description': u'the end date range of the list you want to retrieve (use format "yyyy-MM-dd" or the new format "yyyy-MM-dd HH:mm:ss")'}, {u'name': u'duration', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the duration of the event'}, {u'name': u'id', u'required': False, u'related': [u'listEvents'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the event'}, {u'name': u'level', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the event level (INFO, WARN, ERROR)'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'entrytime', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the time the event was entered'}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the event type (see event types)'}], u'requiredparams': [], u'description': u'A command to list events.'}, u'templates': {u'name': u'listTemplates', u'related': [u'registerIso', u'updateTemplate', u'prepareTemplate', u'copyIso', u'updateIso', u'listIsos'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'templatefilter', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'possible values are "featured", "self", "selfexecutable","sharedexecutable","executable", and "community". * featured : templates that have been marked as featured and public. * self : templates that have been registered or created by the calling user. * selfexecutable : same as self, but only returns templates that can be used to deploy a new VM. * sharedexecutable : templates ready to be deployed that have been granted to the calling user by another user. * executable : templates that are owned by the calling user, or public templates, that can be used to deploy a VM. * community : templates that have been marked as public but not featured. * all : all templates (only usable by admins).'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listTemplates', u'registerIso', u'updateTemplate', u'prepareTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the template ID'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the template name'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the hypervisor for which to restrict the search'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'list templates by zoneId'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}], u'requiredparams': [u'templatefilter'], u'description': u'List all public, private, and privileged templates.'}, u'cisconexusvsms': {u'name': u'listCiscoNexusVSMs', u'related': [u'disableCiscoNexusVSM', u'enableCiscoNexusVSM'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Id of the CloudStack cluster in which the Cisco Nexus 1000v VSM appliance.'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'Id of the CloudStack cluster in which the Cisco Nexus 1000v VSM appliance.'}], u'requiredparams': [], u'description': u'Retrieves a Cisco Nexus 1000v Virtual Switch Manager device associated with a Cluster'}, u'ipforwardingrules': {u'name': u'listIpForwardingRules', u'related': [], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'id', u'required': False, u'related': [u'listIpForwardingRules'], u'length': 255, u'type': u'uuid', u'description': u'Lists rule with the specified ID.'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'listVirtualMachines', u'destroyVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'Lists all rules applied to the specified Vm.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'ipaddressid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list the rule belonging to this public ip address'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}], u'requiredparams': [], u'description': u'List the ip forwarding rules'}, u'srxfirewalls': {u'name': u'listSrxFirewalls', u'related': [u'addSrxFirewall'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'fwdeviceid', u'required': False, u'related': [u'listSrxFirewalls', u'addSrxFirewall'], u'length': 255, u'type': u'uuid', u'description': u'SRX firewall device ID'}], u'requiredparams': [], u'description': u'lists SRX firewall devices in a physical network'}, u'vpnconnections': {u'name': u'listVpnConnections', u'related': [], u'isasync': False, u'params': [{u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'vpcid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'id of vpc'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'id', u'required': False, u'related': [u'listVpnConnections'], u'length': 255, u'type': u'uuid', u'description': u'id of the vpn connection'}], u'requiredparams': [], u'description': u'Lists site to site vpn connection gateways'}, u'trafficmonitors': {u'name': u'listTrafficMonitors', u'related': [], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'zone Id'}], u'requiredparams': [u'zoneid'], u'description': u'List traffic monitor Hosts.'}, u'vpnusers': {u'name': u'listVpnUsers', u'related': [], u'isasync': False, u'params': [{u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listVpnUsers'], u'length': 255, u'type': u'uuid', u'description': u'The uuid of the Vpn user'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'username', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username of the vpn user.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists vpn users'}, u'egressfirewallrules': {u'name': u'listEgressFirewallRules', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Lists rule with the specified ID.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'networkid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the id network network for the egress firwall services'}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Lists rule with the specified ID.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'ipaddressid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the id of IP address of the firwall services'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}], u'requiredparams': [], u'description': u'Lists all egress firewall rules for network id.'}, u'staticroutes': {u'name': u'listStaticRoutes', u'related': [u'createStaticRoute'], u'isasync': False, u'params': [{u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'gatewayid', u'required': False, u'related': [u'createPrivateGateway'], u'length': 255, u'type': u'uuid', u'description': u'list static routes by gateway id'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'list static routes by vpc id'}, {u'name': u'id', u'required': False, u'related': [u'createStaticRoute', u'listStaticRoutes'], u'length': 255, u'type': u'uuid', u'description': u'list static route by id'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}], u'requiredparams': [], u'description': u'Lists all static routes'}, u'volumes': {u'name': u'listVolumes', u'related': [u'migrateVolume', u'detachVolume', u'resizeVolume', u'attachVolume', u'uploadVolume', u'createVolume'], u'isasync': False, u'params': [{u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the disk volume'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'suspendProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'hostid', u'required': False, u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addSecondaryStorage', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers', u'prepareHostForMaintenance'], u'length': 255, u'type': u'uuid', u'description': u'list volumes on specified host'}, {u'name': u'id', u'required': False, u'related': [u'migrateVolume', u'detachVolume', u'resizeVolume', u'attachVolume', u'listVolumes', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the availability zone'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'listLoadBalancerRuleInstances', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine'}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the type of disk volume'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'podid', u'required': False, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the pod id the disk volume belongs to'}], u'requiredparams': [], u'description': u'Lists all volumes.'}, u'pods': {u'name': u'listPods', u'related': [u'updatePod'], u'isasync': False, u'params': [{u'name': u'showcapacities', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'flag to display the capacity of the pods'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list pods by allocation state'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list Pods by Zone ID'}, {u'name': u'id', u'required': False, u'related': [u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'list Pods by ID'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list Pods by name'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists all Pods.'}}, u'upload': {u'volume': {u'name': u'uploadVolume', u'related': [u'detachVolume'], u'isasync': True, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the volume'}, {u'name': u'format', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the format for the volume. Possible values include QCOW2, OVA, and VHD.'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL of where the volume is hosted. Possible URL include http:// and https://'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional accountName. Must be used with domainId.'}, {u'name': u'domainid', u'required': False, u'related': [u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId. If the account parameter is used, domainId must also be used.'}, {u'name': u'checksum', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the MD5 checksum value of this volume'}, {u'name': u'zoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone the volume is to be hosted on'}], u'requiredparams': [u'name', u'format', u'url', u'zoneid'], u'description': u'Uploads a data disk.'}, u'customcertificate': {u'name': u'uploadCustomCertificate', u'related': [], u'isasync': True, u'params': [{u'name': u'domainsuffix', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'DNS domain suffix that the certificate is granted for.'}, {u'name': u'certificate', u'required': True, u'related': [], u'length': 65535, u'type': u'string', u'description': u'The certificate to be uploaded.'}, {u'name': u'privatekey', u'required': False, u'related': [], u'length': 65535, u'type': u'string', u'description': u'The private key for the attached certificate.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'A name / alias for the certificate.'}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'An integer providing the location in a chain that the certificate will hold. Usually, this can be left empty. When creating a chain, the top level certificate should have an ID of 1, with each step in the chain incrementing by one. Example, CA with id = 1, Intermediate CA with id = 2, Site certificate with ID = 3'}], u'requiredparams': [u'domainsuffix', u'certificate'], u'description': u'Uploads a custom certificate for the console proxy VMs to use for SSL. Can be used to upload a single certificate signed by a known CA. Can also be used, through multiple calls, to upload a chain of certificates from CA to the custom certificate itself.'}}, u'remove': {u'region': {u'name': u'removeRegion', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'ID of the region to delete'}], u'requiredparams': [u'id'], u'description': u'Removes specified region'}, u'nicfromvirtualmachine': {u'name': u'removeNicFromVirtualMachine', u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'nicid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'NIC ID'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'Virtual Machine ID'}], u'requiredparams': [u'nicid', u'virtualmachineid'], u'description': u'Removes VM from specified network by deleting a NIC'}, u'fromloadbalancerrule': {u'name': u'removeFromLoadBalancerRule', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listIpForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the load balancer rule'}, {u'name': u'virtualmachineids', u'required': True, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'list', u'description': u'the list of IDs of the virtual machines that are being removed from the load balancer rule (i.e. virtualMachineIds=1,2,3)'}], u'requiredparams': [u'id', u'virtualmachineids'], u'description': u'Removes a virtual machine or a list of virtual machines from a load balancer rule.'}, u'vpnuser': {u'name': u'removeVpnUser', u'related': [], u'isasync': True, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the vpn user. If the account parameter is used, domainId must also be used.'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'remove vpn user from the project'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the vpn user. Must be used with domainId.'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'username for the vpn user'}], u'requiredparams': [u'username'], u'description': u'Removes vpn user'}}, u'asyncapis': [u'createCondition', u'reconnectHost', u'copyTemplate', u'deleteBigSwitchVnsDevice', u'addNicToVirtualMachine', u'extractVolume', u'addAccountToProject', u'deleteEgressFirewallRule', u'deleteCiscoNexusVSM', u'createVpnConnection', u'suspendProject', u'addF5LoadBalancer', u'deleteAutoScaleVmGroup', u'authorizeSecurityGroupIngress', u'addNetscalerLoadBalancer', u'deleteDomain', u'configureNetscalerLoadBalancer', u'disableAutoScaleVmGroup', u'authorizeSecurityGroupEgress', u'createTemplate', u'migrateVolume', u'updatePhysicalNetwork', u'prepareHostForMaintenance', u'deletePrivateGateway', u'deleteStaticRoute', u'deleteTrafficType', u'deleteLoadBalancerRule', u'attachIso', u'destroySystemVm', u'deletePortForwardingRule', u'enableStorageMaintenance', u'stopRouter', u'configureSrxFirewall', u'attachVolume', u'updateVPCOffering', u'resetSSHKeyForVirtualMachine', u'updateProjectInvitation', u'createTags', u'enableAutoScaleVmGroup', u'deleteTags', u'deleteAccountFromProject', u'removeVpnUser', u'updateVpnCustomerGateway', u'stopSystemVm', u'uploadCustomCertificate', u'restartNetwork', u'createAutoScaleVmProfile', u'rebootVirtualMachine', u'enableCiscoNexusVSM', u'cancelHostMaintenance', u'deleteStorageNetworkIpRange', u'deleteFirewallRule', u'deleteVpnConnection', u'startSystemVm', u'deleteF5LoadBalancer', u'deleteNiciraNvpDevice', u'updateProject', u'deleteNetwork', u'deleteProject', u'deleteNetscalerLoadBalancer', u'deleteIpForwardingRule', u'addTrafficType', u'disableUser', u'resizeVolume', u'configureVirtualRouterElement', u'createStaticRoute', u'deleteProjectInvitation', u'migrateSystemVm', u'activateProject', u'removeNicFromVirtualMachine', u'revokeSecurityGroupIngress', u'updateDefaultNicForVirtualMachine', u'disableStaticNat', u'createNetworkACL', u'createVPC', u'configureF5LoadBalancer', u'disassociateIpAddress', u'createIpForwardingRule', u'createVolume', u'resetPasswordForVirtualMachine', u'assignToLoadBalancerRule', u'startRouter', u'extractIso', u'deleteRemoteAccessVpn', u'resetVpnConnection', u'createRemoteAccessVpn', u'extractTemplate', u'startVirtualMachine', u'detachIso', u'updateVPC', u'deleteAccount', u'associateIpAddress', u'updateAutoScaleVmProfile', u'disableAccount', u'updatePortForwardingRule', u'migrateVirtualMachine', u'createStorageNetworkIpRange', u'cancelStorageMaintenance', u'deployVirtualMachine', u'removeFromLoadBalancerRule', u'revokeSecurityGroupEgress', u'deleteCondition', u'createPortForwardingRule', u'addVpnUser', u'createVPCOffering', u'createEgressFirewallRule', u'deleteLBStickinessPolicy', u'destroyRouter', u'createPrivateGateway', u'disableCiscoNexusVSM', u'deleteAutoScaleVmProfile', u'updateTrafficType', u'deleteSnapshot', u'createProject', u'createLoadBalancerRule', u'addSrxFirewall', u'addNiciraNvpDevice', u'createAutoScalePolicy', u'restoreVirtualMachine', u'copyIso', u'uploadVolume', u'createLBStickinessPolicy', u'stopVirtualMachine', u'createCounter', u'createSnapshot', u'destroyVirtualMachine', u'updateNetwork', u'deleteVpnGateway', u'createAutoScaleVmGroup', u'rebootRouter', u'deleteNetworkServiceProvider', u'deleteIso', u'createVpnCustomerGateway', u'createFirewallRule', u'deleteAutoScalePolicy', u'deleteSrxFirewall', u'addNetworkServiceProvider', u'rebootSystemVm', u'detachVolume', u'deleteNetworkACL', u'markDefaultZoneForAccount', u'deleteVPC', u'restartVPC', u'updateAutoScaleVmGroup', u'updateLoadBalancerRule', u'createPhysicalNetwork', u'deleteTemplate', u'deletePhysicalNetwork', u'deleteVpnCustomerGateway', u'deleteVPCOffering', u'createVirtualRouterElement', u'updateAutoScalePolicy', u'addBigSwitchVnsDevice', u'createVpnGateway', u'updateNetworkServiceProvider', u'deleteCounter', u'updateStorageNetworkIpRange'], u'assign': {u'toloadbalancerrule': {u'name': u'assignToLoadBalancerRule', u'related': [], u'isasync': True, u'params': [{u'name': u'virtualmachineids', u'required': True, u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'list', u'description': u'the list of IDs of the virtual machine that are being assigned to the load balancer rule(i.e. virtualMachineIds=1,2,3)'}, {u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}], u'requiredparams': [u'virtualmachineids', u'id'], u'description': u'Assigns virtual machine or a list of virtual machines to a load balancer rule.'}, u'virtualmachine': {u'name': u'assignVirtualMachine', u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': False, u'params': [{u'name': u'networkids', u'required': False, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'list', u'description': u'list of new network ids in which the moved VM will participate. In case no network ids are provided the VM will be part of the default network for that zone. In case there is no network yet created for the new account the default network will be created.'}, {u'name': u'domainid', u'required': True, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'domain id of the new VM owner.'}, {u'name': u'securitygroupids', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list of security group ids to be applied on the virtual machine. In case no security groups are provided the VM is part of the default security group.'}, {u'name': u'account', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'account name of the new VM owner.'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'id of the VM to be moved'}], u'requiredparams': [u'domainid', u'account', u'virtualmachineid'], u'description': u'Assign a VM from one account to another under the same domain. This API is available for Basic zones with security groups and Advance zones with guest networks. The VM is restricted to move between accounts under same domain.'}}, u'delete': {u'loadbalancerrule': {u'name': u'deleteLoadBalancerRule', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}], u'requiredparams': [u'id'], u'description': u'Deletes a load balancer rule.'}, u'domain': {u'name': u'deleteDomain', u'related': [], u'isasync': True, u'params': [{u'name': u'cleanup', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if all domain resources (child domains, accounts) have to be cleaned up, false otherwise'}, {u'name': u'id', u'required': True, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'ID of domain to delete'}], u'requiredparams': [u'id'], u'description': u'Deletes a specified domain'}, u'instancegroup': {u'name': u'deleteInstanceGroup', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the instance group'}], u'requiredparams': [u'id'], u'description': u'Deletes a vm group'}, u'diskoffering': {u'name': u'deleteDiskOffering', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateDiskOffering', u'createDiskOffering', u'listDiskOfferings'], u'length': 255, u'type': u'uuid', u'description': u'ID of the disk offering'}], u'requiredparams': [u'id'], u'description': u'Updates a disk offering.'}, u'externalloadbalancer': {u'name': u'deleteExternalLoadBalancer', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'Id of the external loadbalancer appliance.'}], u'requiredparams': [u'id'], u'description': u'Deletes a F5 external load balancer appliance added in a zone.'}, u'securitygroup': {u'name': u'deleteSecurityGroup', u'related': [], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the domain ID of account owning the security group'}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'The ID of the security group. Mutually exclusive with name parameter'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The ID of the security group. Mutually exclusive with id parameter'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account of the security group. Must be specified with domain ID'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the project of the security group'}], u'requiredparams': [], u'description': u'Deletes security group'}, u'portforwardingrule': {u'name': u'deletePortForwardingRule', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the port forwarding rule'}], u'requiredparams': [u'id'], u'description': u'Deletes a port forwarding rule'}, u'cluster': {u'name': u'deleteCluster', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the cluster ID'}], u'requiredparams': [u'id'], u'description': u'Deletes a cluster.'}, u'accountfromproject': {u'name': u'deleteAccountFromProject', u'related': [], u'isasync': True, u'params': [{u'name': u'projectid', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to remove the account from'}, {u'name': u'account', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the account to be removed from the project'}], u'requiredparams': [u'projectid', u'account'], u'description': u'Deletes account from the project'}, u'networkdevice': {u'name': u'deleteNetworkDevice', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'addHost', u'updateHost', u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'Id of network device to delete'}], u'requiredparams': [u'id'], u'description': u'Deletes network device.'}, u'firewallrule': {u'name': u'deleteFirewallRule', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the firewall rule'}], u'requiredparams': [u'id'], u'description': u'Deletes a firewall rule'}, u'pod': {u'name': u'deletePod', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the Pod'}], u'requiredparams': [u'id'], u'description': u'Deletes a Pod.'}, u'ipforwardingrule': {u'name': u'deleteIpForwardingRule', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the id of the forwarding rule'}], u'requiredparams': [u'id'], u'description': u'Deletes an ip forwarding rule'}, u'vpnconnection': {u'name': u'deleteVpnConnection', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listVpnConnections', u'resetVpnConnection'], u'length': 255, u'type': u'uuid', u'description': u'id of vpn connection'}], u'requiredparams': [u'id'], u'description': u'Delete site to site vpn connection'}, u'lbstickinesspolicy': {u'name': u'deleteLBStickinessPolicy', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createLBStickinessPolicy'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the LB stickiness policy'}], u'requiredparams': [u'id'], u'description': u'Deletes a LB stickiness policy.'}, u'vpcoffering': {u'name': u'deleteVPCOffering', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the VPC offering'}], u'requiredparams': [u'id'], u'description': u'Deletes VPC offering'}, u'network': {u'name': u'deleteNetwork', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the network'}], u'requiredparams': [u'id'], u'description': u'Deletes a network'}, u'zone': {u'name': u'deleteZone', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the Zone'}], u'requiredparams': [u'id'], u'description': u'Deletes a Zone.'}, u'remoteaccessvpn': {u'name': u'deleteRemoteAccessVpn', u'related': [], u'isasync': True, u'params': [{u'name': u'publicipid', u'required': True, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'public ip address id of the vpn server'}], u'requiredparams': [u'publicipid'], u'description': u'Destroys a l2tp/ipsec remote access vpn'}, u'storagenetworkiprange': {u'name': u'deleteStorageNetworkIpRange', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listStorageNetworkIpRange', u'createStorageNetworkIpRange', u'updateStorageNetworkIpRange'], u'length': 255, u'type': u'uuid', u'description': u'the uuid of the storage network ip range'}], u'requiredparams': [u'id'], u'description': u'Deletes a storage network IP Range.'}, u'bigswitchvnsdevice': {u'name': u'deleteBigSwitchVnsDevice', u'related': [], u'isasync': True, u'params': [{u'name': u'vnsdeviceid', u'required': True, u'related': [], u'length': 255, u'type': u'long', u'description': u'BigSwitch device ID'}], u'requiredparams': [u'vnsdeviceid'], u'description': u' delete a bigswitch vns device'}, u'projectinvitation': {u'name': u'deleteProjectInvitation', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listProjectInvitations'], u'length': 255, u'type': u'uuid', u'description': u'id of the invitation'}], u'requiredparams': [u'id'], u'description': u'Accepts or declines project invitation'}, u'autoscalepolicy': {u'name': u'deleteAutoScalePolicy', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateAutoScalePolicy'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale policy'}], u'requiredparams': [u'id'], u'description': u'Deletes a autoscale policy.'}, u'niciranvpdevice': {u'name': u'deleteNiciraNvpDevice', u'related': [], u'isasync': True, u'params': [{u'name': u'nvpdeviceid', u'required': True, u'related': [u'addNiciraNvpDevice', u'listNiciraNvpDevices'], u'length': 255, u'type': u'uuid', u'description': u'Nicira device ID'}], u'requiredparams': [u'nvpdeviceid'], u'description': u' delete a nicira nvp device'}, u'serviceoffering': {u'name': u'deleteServiceOffering', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the service offering'}], u'requiredparams': [u'id'], u'description': u'Deletes a service offering.'}, u'condition': {u'name': u'deleteCondition', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the condition.'}], u'requiredparams': [u'id'], u'description': u'Removes a condition'}, u'storagepool': {u'name': u'deleteStoragePool', u'related': [], u'isasync': False, u'params': [{u'name': u'forced', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force destroy storage pool (force expunge volumes in Destroyed state as a part of pool removal)'}, {u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Storage pool id'}], u'requiredparams': [u'id'], u'description': u'Deletes a storage pool.'}, u'vpngateway': {u'name': u'deleteVpnGateway', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createVpnGateway'], u'length': 255, u'type': u'uuid', u'description': u'id of customer gateway'}], u'requiredparams': [u'id'], u'description': u'Delete site to site vpn gateway'}, u'snapshot': {u'name': u'deleteSnapshot', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createSnapshot', u'listSnapshots'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the snapshot'}], u'requiredparams': [u'id'], u'description': u'Deletes a snapshot of a disk volume.'}, u'autoscalevmgroup': {u'name': u'deleteAutoScaleVmGroup', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listAutoScaleVmGroups', u'createAutoScaleVmGroup', u'disableAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale group'}], u'requiredparams': [u'id'], u'description': u'Deletes a autoscale vm group.'}, u'trafficmonitor': {u'name': u'deleteTrafficMonitor', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'Id of the Traffic Monitor Host.'}], u'requiredparams': [u'id'], u'description': u'Deletes an traffic monitor host.'}, u'networkacl': {u'name': u'deleteNetworkACL', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the network ACL'}], u'requiredparams': [u'id'], u'description': u'Deletes a Network ACL'}, u'template': {u'name': u'deleteTemplate', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the template'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of zone of the template'}], u'requiredparams': [u'id'], u'description': u'Deletes a template from the system. All virtual machines using the deleted template will not be affected.'}, u'tags': {u'name': u'deleteTags', u'related': [], u'isasync': True, u'params': [{u'name': u'resourceids', u'required': True, u'related': [], u'length': 255, u'type': u'list', u'description': u'Delete tags for resource id(s)'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'Delete tags matching key/value pairs'}, {u'name': u'resourcetype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Delete tag by resource type'}], u'requiredparams': [u'resourceids', u'resourcetype'], u'description': u'Deleting resource tag(s)'}, u'snapshotpolicies': {u'name': u'deleteSnapshotPolicies', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Id of the snapshot policy'}, {u'name': u'ids', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list of snapshots policy IDs separated by comma'}], u'requiredparams': [], u'description': u'Deletes snapshot policies for the account.'}, u'privategateway': {u'name': u'deletePrivateGateway', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createPrivateGateway', u'listPrivateGateways'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the private gateway'}], u'requiredparams': [u'id'], u'description': u'Deletes a Private gateway'}, u'traffictype': {u'name': u'deleteTrafficType', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'addTrafficType', u'updateTrafficType'], u'length': 255, u'type': u'uuid', u'description': u'traffic type id'}], u'requiredparams': [u'id'], u'description': u'Deletes traffic type of a physical network'}, u'host': {u'name': u'deleteHost', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the host ID'}, {u'name': u'forcedestroylocalstorage', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force destroy local storage on this host. All VMs created on this local storage will be destroyed'}, {u'name': u'forced', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force delete the host. All HA enabled vms running on the host will be put to HA; HA disabled ones will be stopped'}], u'requiredparams': [u'id'], u'description': u'Deletes a host.'}, u'staticroute': {u'name': u'deleteStaticRoute', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createStaticRoute', u'listStaticRoutes'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the static route'}], u'requiredparams': [u'id'], u'description': u'Deletes a static route'}, u'vpc': {u'name': u'deleteVPC', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'restartVPC'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the VPC'}], u'requiredparams': [u'id'], u'description': u'Deletes a VPC'}, u'srxfirewall': {u'name': u'deleteSrxFirewall', u'related': [], u'isasync': True, u'params': [{u'name': u'fwdeviceid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'srx firewall device ID'}], u'requiredparams': [u'fwdeviceid'], u'description': u' delete a SRX firewall device'}, u'externalfirewall': {u'name': u'deleteExternalFirewall', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'Id of the external firewall appliance.'}], u'requiredparams': [u'id'], u'description': u'Deletes an external firewall appliance.'}, u'pool': {u'name': u'deletePool', u'related': [], u'isasync': False, u'params': [{u'name': u'poolname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}], u'requiredparams': [u'poolname'], u'description': u'Delete a pool'}, u'autoscalevmprofile': {u'name': u'deleteAutoScaleVmProfile', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listAutoScaleVmProfiles'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale profile'}], u'requiredparams': [u'id'], u'description': u'Deletes a autoscale vm profile.'}, u'volume': {u'name': u'deleteVolume', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'detachVolume', u'resizeVolume', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the disk volume'}], u'requiredparams': [u'id'], u'description': u'Deletes a detached disk volume.'}, u'account': {u'name': u'deleteAccount', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount', u'disableAccount'], u'length': 255, u'type': u'uuid', u'description': u'Account id'}], u'requiredparams': [u'id'], u'description': u'Deletes a account, and all users associated with this account'}, u'cisconexusvsm': {u'name': u'deleteCiscoNexusVSM', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'disableCiscoNexusVSM', u'listCiscoNexusVSMs', u'enableCiscoNexusVSM'], u'length': 255, u'type': u'uuid', u'description': u'Id of the Cisco Nexus 1000v VSM device to be deleted'}], u'requiredparams': [u'id'], u'description': u' delete a Cisco Nexus VSM device'}, u'netscalerloadbalancer': {u'name': u'deleteNetscalerLoadBalancer', u'related': [], u'isasync': True, u'params': [{u'name': u'lbdeviceid', u'required': True, u'related': [u'listNetscalerLoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'netscaler load balancer device ID'}], u'requiredparams': [u'lbdeviceid'], u'description': u' delete a netscaler load balancer device'}, u'networkoffering': {u'name': u'deleteNetworkOffering', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'createNetworkOffering', u'updateNetworkOffering'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the network offering'}], u'requiredparams': [u'id'], u'description': u'Deletes a network offering.'}, u'vpncustomergateway': {u'name': u'deleteVpnCustomerGateway', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'id of customer gateway'}], u'requiredparams': [u'id'], u'description': u'Delete site to site vpn customer gateway'}, u'counter': {u'name': u'deleteCounter', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the counter'}], u'requiredparams': [u'id'], u'description': u'Deletes a counter'}, u'physicalnetwork': {u'name': u'deletePhysicalNetwork', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the Physical network'}], u'requiredparams': [u'id'], u'description': u'Deletes a Physical Network.'}, u'project': {u'name': u'deleteProject', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to be deleted'}], u'requiredparams': [u'id'], u'description': u'Deletes a project'}, u'vlaniprange': {u'name': u'deleteVlanIpRange', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'listVlanIpRanges'], u'length': 255, u'type': u'uuid', u'description': u'the id of the VLAN IP range'}], u'requiredparams': [u'id'], u'description': u'Creates a VLAN IP range.'}, u'f5loadbalancer': {u'name': u'deleteF5LoadBalancer', u'related': [], u'isasync': True, u'params': [{u'name': u'lbdeviceid', u'required': True, u'related': [u'configureF5LoadBalancer'], u'length': 255, u'type': u'uuid', u'description': u'netscaler load balancer device ID'}], u'requiredparams': [u'lbdeviceid'], u'description': u' delete a F5 load balancer device'}, u'iso': {u'name': u'deleteIso', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the ISO file'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone of the ISO file. If not specified, the ISO will be deleted from all the zones'}], u'requiredparams': [u'id'], u'description': u'Deletes an ISO file.'}, u'egressfirewallrule': {u'name': u'deleteEgressFirewallRule', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the firewall rule'}], u'requiredparams': [u'id'], u'description': u'Deletes an ggress firewall rule'}, u'networkserviceprovider': {u'name': u'deleteNetworkServiceProvider', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'addNetworkServiceProvider', u'listTrafficTypes', u'updateNetworkServiceProvider'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the network service provider'}], u'requiredparams': [u'id'], u'description': u'Deletes a Network Service Provider.'}, u'sshkeypair': {u'name': u'deleteSSHKeyPair', u'related': [], u'isasync': False, u'params': [{u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the project associated with keypair'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the domain ID associated with the keypair'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Name of the keypair'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account associated with the keypair. Must be used with the domainId parameter.'}], u'requiredparams': [u'name'], u'description': u'Deletes a keypair by name'}, u'user': {u'name': u'deleteUser', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'lockUser', u'listUsers'], u'length': 255, u'type': u'uuid', u'description': u'id of the user to be deleted'}], u'requiredparams': [u'id'], u'description': u'Deletes a user for an account'}}} +apicache = {u'authorize': {u'securitygroupingress': {u'name': u'authorizeSecurityGroupIngress', u'related': [u'authorizeSecurityGroupEgress'], u'isasync': True, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the security group. If the account parameter is used, domainId must also be used.'}, {u'name': u'startport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'start port for this ingress rule'}, {u'name': u'securitygroupid', u'required': False, u'related': [u'createSecurityGroup', u'listSecurityGroups'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the security group. Mutually exclusive with securityGroupName parameter'}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list associated'}, {u'name': u'usersecuritygrouplist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'user to security group mapping'}, {u'name': u'securitygroupname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The name of the security group. Mutually exclusive with securityGroupName parameter'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the security group. Must be used with domainId.'}, {u'name': u'icmpcode', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'error code for this icmp message'}, {u'name': u'protocol', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'TCP is default. UDP is the other supported protocol'}, {u'name': u'icmptype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'type of the icmp message being sent'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'an optional project of the security group'}, {u'name': u'endport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'end port for this ingress rule'}], u'requiredparams': [], u'description': u'Authorizes a particular ingress rule for this security group'}, u'securitygroupegress': {u'name': u'authorizeSecurityGroupEgress', u'related': [], u'isasync': True, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the security group. Must be used with domainId.'}, {u'name': u'securitygroupname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The name of the security group. Mutually exclusive with securityGroupName parameter'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the security group. If the account parameter is used, domainId must also be used.'}, {u'name': u'icmpcode', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'error code for this icmp message'}, {u'name': u'securitygroupid', u'required': False, u'related': [u'createSecurityGroup', u'listSecurityGroups'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the security group. Mutually exclusive with securityGroupName parameter'}, {u'name': u'icmptype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'type of the icmp message being sent'}, {u'name': u'protocol', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'TCP is default. UDP is the other supported protocol'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'an optional project of the security group'}, {u'name': u'endport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'end port for this egress rule'}, {u'name': u'usersecuritygrouplist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'user to security group mapping'}, {u'name': u'startport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'start port for this egress rule'}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list associated'}], u'requiredparams': [], u'description': u'Authorizes a particular egress rule for this security group'}}, u'restore': {u'virtualmachine': {u'name': u'restoreVirtualMachine', u'related': [u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine'], u'isasync': True, u'params': [{u'name': u'virtualmachineid', u'required': True, u'related': [u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'Virtual Machine ID'}], u'requiredparams': [u'virtualmachineid'], u'description': u'Restore a VM to original template or specific snapshot'}}, u'suspend': {u'project': {u'name': u'suspendProject', u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'suspendProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to be suspended'}], u'requiredparams': [u'id'], u'description': u'Suspends a project'}}, u'revoke': {u'securitygroupingress': {u'name': u'revokeSecurityGroupIngress', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'The ID of the ingress rule'}], u'requiredparams': [u'id'], u'description': u'Deletes a particular ingress rule from this security group'}, u'securitygroupegress': {u'name': u'revokeSecurityGroupEgress', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'The ID of the egress rule'}], u'requiredparams': [u'id'], u'description': u'Deletes a particular egress rule from this security group'}}, u'disassociate': {u'ipaddress': {u'name': u'disassociateIpAddress', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'the id of the public ip address to disassociate'}], u'requiredparams': [u'id'], u'description': u'Disassociates an ip address from the account.'}}, u'migrate': {u'volume': {u'name': u'migrateVolume', u'related': [u'detachVolume', u'resizeVolume', u'attachVolume', u'uploadVolume', u'createVolume'], u'isasync': True, u'params': [{u'name': u'volumeid', u'required': True, u'related': [u'migrateVolume', u'detachVolume', u'resizeVolume', u'attachVolume', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the volume'}, {u'name': u'storageid', u'required': True, u'related': [u'cancelStorageMaintenance', u'enableStorageMaintenance', u'updateStoragePool', u'createStoragePool', u'listStoragePools'], u'length': 255, u'type': u'uuid', u'description': u'destination storage pool ID to migrate the volume to'}], u'requiredparams': [u'volumeid', u'storageid'], u'description': u'Migrate volume'}, u'systemvm': {u'name': u'migrateSystemVm', u'related': [], u'isasync': True, u'params': [{u'name': u'virtualmachineid', u'required': True, u'related': [u'rebootSystemVm', u'listSystemVms'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine'}, {u'name': u'hostid', u'required': True, u'related': [u'addHost', u'updateHost', u'listHosts', u'listExternalLoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'destination Host ID to migrate VM to'}], u'requiredparams': [u'virtualmachineid', u'hostid'], u'description': u'Attempts Migration of a system virtual machine to the host specified.'}, u'virtualmachine': {u'name': u'migrateVirtualMachine', u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'deployVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'storageid', u'required': False, u'related': [u'cancelStorageMaintenance'], u'length': 255, u'type': u'long', u'description': u'Destination storage pool ID to migrate VM volumes to. Required for migrating the root disk volume'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine'}, {u'name': u'hostid', u'required': False, u'related': [u'addHost', u'updateHost', u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'Destination Host ID to migrate VM to. Required for live migrating a VM from host to host'}], u'requiredparams': [u'virtualmachineid'], u'description': u'Attempts Migration of a VM to a different host or Root volume of the vm to a different storage pool'}}, u'lock': {u'account': {u'name': u'lockAccount', u'related': [u'markDefaultZoneForAccount'], u'isasync': False, u'params': [{u'name': u'domainid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Locks the specified account on this domain.'}, {u'name': u'account', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Locks the specified account.'}], u'requiredparams': [u'domainid', u'account'], u'description': u'Locks an account'}, u'user': {u'name': u'lockUser', u'related': [u'listUsers'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'lockUser', u'listUsers'], u'length': 255, u'type': u'uuid', u'description': u'Locks user by user ID.'}], u'requiredparams': [u'id'], u'description': u'Locks a user account'}}, u'dissociate': {u'lun': {u'name': u'dissociateLun', u'related': [], u'isasync': False, u'params': [{u'name': u'iqn', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Guest IQN.'}, {u'name': u'path', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'LUN path.'}], u'requiredparams': [u'iqn', u'path'], u'description': u'Dissociate a LUN'}}, u'activate': {u'project': {u'name': u'activateProject', u'related': [u'createProject', u'listProjectAccounts'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to be modified'}], u'requiredparams': [u'id'], u'description': u'Activates a project'}}, u'reconnect': {u'host': {u'name': u'reconnectHost', u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addSecondaryStorage', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers', u'prepareHostForMaintenance'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addSecondaryStorage', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'reconnectHost', u'listExternalLoadBalancers', u'prepareHostForMaintenance'], u'length': 255, u'type': u'uuid', u'description': u'the host ID'}], u'requiredparams': [u'id'], u'description': u'Reconnects a host.'}}, u'cancel': {u'hostmaintenance': {u'name': u'cancelHostMaintenance', u'related': [u'listSwifts', u'addHost', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'the host ID'}], u'requiredparams': [u'id'], u'description': u'Cancels host maintenance.'}, u'storagemaintenance': {u'name': u'cancelStorageMaintenance', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'cancelStorageMaintenance'], u'length': 255, u'type': u'uuid', u'description': u'the primary storage ID'}], u'requiredparams': [u'id'], u'description': u'Cancels maintenance for primary storage'}}, u'query': {u'asyncjobresult': {u'name': u'queryAsyncJobResult', u'related': [], u'isasync': False, u'params': [{u'name': u'jobid', u'required': True, u'related': [u'queryAsyncJobResult'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the asynchronous job'}], u'requiredparams': [u'jobid'], u'description': u'Retrieves the current status of asynchronous job.'}}, u'recover': {u'virtualmachine': {u'name': u'recoverVirtualMachine', u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}], u'requiredparams': [u'id'], u'description': u'Recovers a virtual machine.'}}, u'extract': {u'volume': {u'name': u'extractVolume', u'related': [u'extractTemplate', u'extractIso'], u'isasync': True, u'params': [{u'name': u'url', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the url to which the volume would be extracted'}, {u'name': u'id', u'required': True, u'related': [u'migrateVolume', u'detachVolume', u'resizeVolume', u'attachVolume', u'listVolumes', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the volume'}, {u'name': u'mode', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone where the volume is located'}], u'requiredparams': [u'id', u'mode', u'zoneid'], u'description': u'Extracts volume'}, u'iso': {u'name': u'extractIso', u'related': [u'extractTemplate'], u'isasync': True, u'params': [{u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone where the ISO is originally located'}, {u'name': u'url', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the url to which the ISO would be extracted'}, {u'name': u'mode', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD'}, {u'name': u'id', u'required': True, u'related': [u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the ISO file'}], u'requiredparams': [u'mode', u'id'], u'description': u'Extracts an ISO'}, u'template': {u'name': u'extractTemplate', u'related': [], u'isasync': True, u'params': [{u'name': u'mode', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD'}, {u'name': u'id', u'required': True, u'related': [u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the template'}, {u'name': u'url', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the url to which the ISO would be extracted'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone where the ISO is originally located'}], u'requiredparams': [u'mode', u'id'], u'description': u'Extracts a template'}}, u'copy': {u'iso': {u'name': u'copyIso', u'related': [u'updateIso', u'listIsos'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'Template ID.'}, {u'name': u'destzoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'ID of the zone the template is being copied to.'}, {u'name': u'sourcezoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'ID of the zone the template is currently hosted on.'}], u'requiredparams': [u'id', u'destzoneid', u'sourcezoneid'], u'description': u'Copies an iso from one zone to another.'}, u'template': {u'name': u'copyTemplate', u'related': [u'listTemplates', u'registerIso', u'updateTemplate', u'prepareTemplate', u'registerTemplate', u'copyIso', u'updateIso', u'listIsos'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'copyTemplate', u'listTemplates', u'registerIso', u'updateTemplate', u'prepareTemplate', u'registerTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'Template ID.'}, {u'name': u'destzoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'ID of the zone the template is being copied to.'}, {u'name': u'sourcezoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'ID of the zone the template is currently hosted on.'}], u'requiredparams': [u'id', u'destzoneid', u'sourcezoneid'], u'description': u'Copies a template from one zone to another.'}}, u'prepare': {u'hostformaintenance': {u'name': u'prepareHostForMaintenance', u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addSecondaryStorage', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addSecondaryStorage', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers', u'prepareHostForMaintenance'], u'length': 255, u'type': u'uuid', u'description': u'the host ID'}], u'requiredparams': [u'id'], u'description': u'Prepares a host for maintenance.'}, u'template': {u'name': u'prepareTemplate', u'related': [u'registerIso', u'updateTemplate', u'copyIso', u'updateIso', u'listIsos'], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'zone ID of the template to be prepared in primary storage(s).'}, {u'name': u'templateid', u'required': True, u'related': [u'registerIso', u'updateTemplate', u'prepareTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'template ID of the template to be prepared in primary storage(s).'}], u'requiredparams': [u'zoneid', u'templateid'], u'description': u'load template into primary storage'}}, u'attach': {u'volume': {u'name': u'attachVolume', u'related': [u'detachVolume', u'resizeVolume', u'uploadVolume', u'createVolume'], u'isasync': True, u'params': [{u'name': u'deviceid', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'the ID of the device to map the volume to within the guest OS. If no deviceId is passed in, the next available deviceId will be chosen. Possible values for a Linux OS are:* 1 - /dev/xvdb* 2 - /dev/xvdc* 4 - /dev/xvde* 5 - /dev/xvdf* 6 - /dev/xvdg* 7 - /dev/xvdh* 8 - /dev/xvdi* 9 - /dev/xvdj'}, {u'name': u'id', u'required': True, u'related': [u'detachVolume', u'resizeVolume', u'attachVolume', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u' the ID of the virtual machine'}], u'requiredparams': [u'id', u'virtualmachineid'], u'description': u'Attaches a disk volume to a virtual machine.'}, u'iso': {u'name': u'attachIso', u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'virtualmachineid', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine'}, {u'name': u'id', u'required': True, u'related': [u'listTemplates', u'registerIso', u'updateTemplate', u'prepareTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the ISO file'}], u'requiredparams': [u'virtualmachineid', u'id'], u'description': u'Attaches an ISO to a virtual machine.'}}, u'create': {u'loadbalancerrule': {u'name': u'createLoadBalancerRule', u'related': [u'updateLoadBalancerRule'], u'isasync': True, u'params': [{u'name': u'openfirewall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, firewall rule for source/end public port is automatically created; if false - firewall rule has to be created explicitely. If not specified 1) defaulted to false when LB rule is being created for VPC guest network 2) in all other cases defaulted to true'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account associated with the load balancer. Must be used with the domainId parameter.'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the domain ID associated with the load balancer'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'zone where the load balancer is going to be created. This parameter is required when LB service provider is ElasticLoadBalancerVm'}, {u'name': u'publicipid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'public ip address id from where the network traffic will be load balanced from'}, {u'name': u'algorithm', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'load balancer algorithm (source, roundrobin, leastconn)'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the load balancer rule'}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list to forward traffic from'}, {u'name': u'publicport', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the public port from where the network traffic will be load balanced from'}, {u'name': u'description', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the description of the load balancer rule'}, {u'name': u'privateport', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the private port of the private ip address/virtual machine where the network traffic will be load balanced to'}, {u'name': u'networkid', u'required': False, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'The guest network this rule will be created for. Required when public Ip address is not associated with any Guest network yet (VPC case)'}], u'requiredparams': [u'algorithm', u'name', u'publicport', u'privateport'], u'description': u'Creates a load balancer rule'}, u'domain': {u'name': u'createDomain', u'related': [], u'isasync': False, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'creates domain with this name'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Domain UUID, required for adding domain from another Region'}, {u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Network domain for networks in the domain'}, {u'name': u'parentdomainid', u'required': False, u'related': [u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'assigns new domain a parent domain by domain ID of the parent. If no parent domain is specied, the ROOT domain is assumed.'}], u'requiredparams': [u'name'], u'description': u'Creates a domain'}, u'snapshotpolicy': {u'name': u'createSnapshotPolicy', u'related': [u'listSnapshotPolicies'], u'isasync': False, u'params': [{u'name': u'intervaltype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'valid values are HOURLY, DAILY, WEEKLY, and MONTHLY'}, {u'name': u'maxsnaps', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'maximum number of snapshots to retain'}, {u'name': u'schedule', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'time the snapshot is scheduled to be taken. Format is:* if HOURLY, MM* if DAILY, MM:HH* if WEEKLY, MM:HH:DD (1-7)* if MONTHLY, MM:HH:DD (1-28)'}, {u'name': u'timezone', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.'}, {u'name': u'volumeid', u'required': True, u'related': [u'detachVolume', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}], u'requiredparams': [u'intervaltype', u'maxsnaps', u'schedule', u'timezone', u'volumeid'], u'description': u'Creates a snapshot policy for the account.'}, u'diskoffering': {u'name': u'createDiskOffering', u'related': [u'listDiskOfferings'], u'isasync': False, u'params': [{u'name': u'customized', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'whether disk offering is custom or not'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 4096, u'type': u'string', u'description': u'alternate display text of the disk offering'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the containing domain, null for public offerings'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the disk offering'}, {u'name': u'disksize', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'size of the disk offering in GB'}, {u'name': u'storagetype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the storage type of the disk offering. Values are local and shared.'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'tags for the disk offering'}], u'requiredparams': [u'displaytext', u'name'], u'description': u'Creates a disk offering.'}, u'securitygroup': {u'name': u'createSecurityGroup', u'related': [u'listSecurityGroups'], u'isasync': False, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the security group. Must be used with domainId.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the security group. If the account parameter is used, domainId must also be used.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the security group'}, {u'name': u'description', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the description of the security group'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Deploy vm for the project'}], u'requiredparams': [u'name'], u'description': u'Creates a security group'}, u'portforwardingrule': {u'name': u'createPortForwardingRule', u'related': [u'listIpForwardingRules'], u'isasync': True, u'params': [{u'name': u'privateport', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u"the starting port of port forwarding rule's private port range"}, {u'name': u'ipaddressid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the IP address id of the port forwarding rule'}, {u'name': u'protocol', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the protocol for the port fowarding rule. Valid values are TCP or UDP.'}, {u'name': u'openfirewall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, firewall rule for source/end pubic port is automatically created; if false - firewall rule has to be created explicitely. If not specified 1) defaulted to false when PF rule is being created for VPC guest network 2) in all other cases defaulted to true'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine for the port forwarding rule'}, {u'name': u'privateendport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u"the ending port of port forwarding rule's private port range"}, {u'name': u'networkid', u'required': False, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'The network of the vm the Port Forwarding rule will be created for. Required when public Ip address is not associated with any Guest network yet (VPC case)'}, {u'name': u'publicendport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u"the ending port of port forwarding rule's private port range"}, {u'name': u'publicport', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u"the starting port of port forwarding rule's public port range"}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list to forward traffic from'}], u'requiredparams': [u'privateport', u'ipaddressid', u'protocol', u'virtualmachineid', u'publicport'], u'description': u'Creates a port forwarding rule'}, u'pod': {u'name': u'createPod', u'related': [u'updatePod', u'listPods'], u'isasync': False, u'params': [{u'name': u'startip', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the starting IP address for the Pod'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the Pod'}, {u'name': u'zoneid', u'required': True, u'related': [u'listZones'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID in which the Pod will be created'}, {u'name': u'endip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IP address for the Pod'}, {u'name': u'netmask', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask for the Pod'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this Pod for allocation of new resources'}, {u'name': u'gateway', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway for the Pod'}], u'requiredparams': [u'startip', u'name', u'zoneid', u'netmask', u'gateway'], u'description': u'Creates a new Pod.'}, u'ipforwardingrule': {u'name': u'createIpForwardingRule', u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'listPortForwardingRules', u'createPortForwardingRule'], u'isasync': True, u'params': [{u'name': u'endport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the end port for the rule'}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list to forward traffic from'}, {u'name': u'ipaddressid', u'required': True, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'the public IP address id of the forwarding rule, already associated via associateIp'}, {u'name': u'openfirewall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, firewall rule for source/end pubic port is automatically created; if false - firewall rule has to be created explicitely. Has value true by default'}, {u'name': u'startport', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the start port for the rule'}, {u'name': u'protocol', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the protocol for the rule. Valid values are TCP or UDP.'}], u'requiredparams': [u'ipaddressid', u'startport', u'protocol'], u'description': u'Creates an ip forwarding rule'}, u'vpnconnection': {u'name': u'createVpnConnection', u'related': [u'listVpnConnections', u'resetVpnConnection'], u'isasync': True, u'params': [{u'name': u's2svpngatewayid', u'required': True, u'related': [u'createVpnGateway', u'listVpnGateways'], u'length': 255, u'type': u'uuid', u'description': u'id of the vpn gateway'}, {u'name': u's2scustomergatewayid', u'required': True, u'related': [u'updateVpnCustomerGateway', u'createVpnCustomerGateway', u'listVpnCustomerGateways'], u'length': 255, u'type': u'uuid', u'description': u'id of the customer gateway'}], u'requiredparams': [u's2svpngatewayid', u's2scustomergatewayid'], u'description': u'Create site to site vpn connection'}, u'vpncustomergateway': {u'name': u'createVpnCustomerGateway', u'related': [], u'isasync': True, u'params': [{u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the domain ID associated with the gateway. If used with the account parameter returns the gateway associated with the account for the specified domain.'}, {u'name': u'gateway', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'public ip address id of the customer gateway'}, {u'name': u'esplifetime', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'Lifetime of phase 2 VPN connection to the customer gateway, in seconds'}, {u'name': u'esppolicy', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'ESP policy of the customer gateway'}, {u'name': u'ikepolicy', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'IKE policy of the customer gateway'}, {u'name': u'cidrlist', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'guest cidr list of the customer gateway'}, {u'name': u'dpd', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'If DPD is enabled for VPN connection'}, {u'name': u'ipsecpsk', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'IPsec Preshared-Key of the customer gateway'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account associated with the gateway. Must be used with the domainId parameter.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of this customer gateway'}, {u'name': u'ikelifetime', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'Lifetime of phase 1 VPN connection to the customer gateway, in seconds'}], u'requiredparams': [u'gateway', u'esppolicy', u'ikepolicy', u'cidrlist', u'ipsecpsk'], u'description': u'Creates site to site vpn customer gateway'}, u'lbstickinesspolicy': {u'name': u'createLBStickinessPolicy', u'related': [], u'isasync': True, u'params': [{u'name': u'lbruleid', u'required': True, u'related': [u'listIpForwardingRules'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the LB Stickiness policy'}, {u'name': u'methodname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the LB Stickiness policy method, possible values can be obtained from ListNetworks API '}, {u'name': u'description', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the description of the LB Stickiness policy'}, {u'name': u'param', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'param list. Example: param[0].name=cookiename¶m[0].value=LBCookie '}], u'requiredparams': [u'lbruleid', u'name', u'methodname'], u'description': u'Creates a Load Balancer stickiness policy '}, u'vpcoffering': {u'name': u'createVPCOffering', u'related': [u'listVPCOfferings'], u'isasync': True, u'params': [{u'name': u'displaytext', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the vpc offering'}, {u'name': u'supportedservices', u'required': True, u'related': [], u'length': 255, u'type': u'list', u'description': u'services supported by the vpc offering'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the vpc offering'}], u'requiredparams': [u'displaytext', u'supportedservices', u'name'], u'description': u'Creates VPC offering'}, u'network': {u'name': u'createNetwork', u'related': [u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'isasync': False, u'params': [{u'name': u'endipv6', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IPv6 address in the IPv6 network range'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'an optional project for the ssh key'}, {u'name': u'ip6cidr', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the CIDR of IPv6 network, must be at least /64'}, {u'name': u'acltype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Access control type; supported values are account and domain. In 3.0 all shared networks should have aclType=Domain, and all Isolated networks - Account. Account means that only the account owner can use the network, domain - all accouns in the domain can use the network'}, {u'name': u'gateway', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway of the network. Required for Shared networks and Isolated networks when it belongs to VPC'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the network'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID the network belongs to'}, {u'name': u'subdomainaccess', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Defines whether to allow subdomains to use networks dedicated to their parent domain(s). Should be used with aclType=Domain, defaulted to allow.subdomain.network.access global config if not specified'}, {u'name': u'startip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the beginning IP address in the network IP range'}, {u'name': u'netmask', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask of the network. Required for Shared networks and Isolated networks when it belongs to VPC'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'domain ID of the account owning a network'}, {u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'network domain'}, {u'name': u'ip6gateway', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway of the IPv6 network. Required for Shared networks and Isolated networks when it belongs to VPC'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'account who will own the network'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the network'}, {u'name': u'startipv6', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the beginning IPv6 address in the IPv6 network range'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the network'}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'the VPC network belongs to'}, {u'name': u'endip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IP address in the network IP range. If not specified, will be defaulted to startIP'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ID or VID of the network'}, {u'name': u'networkofferingid', u'required': True, u'related': [u'createNetworkOffering', u'updateNetworkOffering'], u'length': 255, u'type': u'uuid', u'description': u'the network offering id'}], u'requiredparams': [u'displaytext', u'zoneid', u'name', u'networkofferingid'], u'description': u'Creates a network'}, u'zone': {u'name': u'createZone', u'related': [u'listZones'], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the containing domain, null for public zones'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the Zone'}, {u'name': u'ip6dns2', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the second DNS for IPv6 network in the Zone'}, {u'name': u'domain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Network domain name for the networks in the zone'}, {u'name': u'internaldns1', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the first internal DNS for the Zone'}, {u'name': u'localstorageenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if local storage offering enabled, false otherwise'}, {u'name': u'securitygroupenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if network is security group enabled, false otherwise'}, {u'name': u'networktype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'network type of the zone, can be Basic or Advanced'}, {u'name': u'internaldns2', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the second internal DNS for the Zone'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this Zone for allocation of new resources'}, {u'name': u'guestcidraddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the guest CIDR address for the Zone'}, {u'name': u'dns1', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the first DNS for the Zone'}, {u'name': u'ip6dns1', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the first DNS for IPv6 network in the Zone'}, {u'name': u'dns2', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the second DNS for the Zone'}], u'requiredparams': [u'name', u'internaldns1', u'networktype', u'dns1'], u'description': u'Creates a Zone.'}, u'remoteaccessvpn': {u'name': u'createRemoteAccessVpn', u'related': [], u'isasync': True, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the VPN. Must be used with domainId.'}, {u'name': u'openfirewall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, firewall rule for source/end pubic port is automatically created; if false - firewall rule has to be created explicitely. Has value true by default'}, {u'name': u'publicipid', u'required': True, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'public ip address id of the vpn server'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the VPN. If the account parameter is used, domainId must also be used.'}, {u'name': u'iprange', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the range of ip addresses to allocate to vpn clients. The first ip in the range will be taken by the vpn server'}], u'requiredparams': [u'publicipid'], u'description': u'Creates a l2tp/ipsec remote access vpn'}, u'instancegroup': {u'name': u'createInstanceGroup', u'related': [], u'isasync': False, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account of the instance group. The account parameter must be used with the domainId parameter.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'The project of the instance group'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the instance group'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the domain ID of account owning the instance group'}], u'requiredparams': [u'name'], u'description': u'Creates a vm group'}, u'autoscalepolicy': {u'name': u'createAutoScalePolicy', u'related': [u'updateAutoScalePolicy'], u'isasync': True, u'params': [{u'name': u'action', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the action to be executed if all the conditions evaluate to true for the specified duration.'}, {u'name': u'quiettime', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the cool down period for which the policy should not be evaluated after the action has been taken'}, {u'name': u'conditionids', u'required': True, u'related': [], u'length': 255, u'type': u'list', u'description': u'the list of IDs of the conditions that are being evaluated on every interval'}, {u'name': u'duration', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the duration for which the conditions have to be true before action is taken'}], u'requiredparams': [u'action', u'conditionids', u'duration'], u'description': u'Creates an autoscale policy for a provision or deprovision action, the action is taken when the all the conditions evaluates to true for the specified duration. The policy is in effect once it is attached to a autscale vm group.'}, u'tags': {u'name': u'createTags', u'related': [], u'isasync': True, u'params': [{u'name': u'tags', u'required': True, u'related': [], u'length': 255, u'type': u'map', u'description': u'Map of tags (key/value pairs)'}, {u'name': u'resourcetype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'type of the resource'}, {u'name': u'customer', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"identifies client specific tag. When the value is not null, the tag can't be used by cloudStack code internally"}, {u'name': u'resourceids', u'required': True, u'related': [], u'length': 255, u'type': u'list', u'description': u'list of resources to create the tags for'}], u'requiredparams': [u'tags', u'resourcetype', u'resourceids'], u'description': u'Creates resource tag(s)'}, u'serviceoffering': {u'name': u'createServiceOffering', u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings'], u'isasync': False, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the service offering'}, {u'name': u'storagetype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the storage type of the service offering. Values are local and shared.'}, {u'name': u'issystem', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'is this a system vm offering'}, {u'name': u'cpunumber', u'required': True, u'related': [], u'length': 255, u'type': u'long', u'description': u'the CPU number of the service offering'}, {u'name': u'systemvmtype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the system VM type. Possible types are "domainrouter", "consoleproxy" and "secondarystoragevm".'}, {u'name': u'limitcpuuse', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'restrict the CPU usage to committed service offering'}, {u'name': u'hosttags', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the host tag for this service offering.'}, {u'name': u'offerha', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'the HA for the service offering'}, {u'name': u'memory', u'required': True, u'related': [], u'length': 255, u'type': u'long', u'description': u'the total memory of the service offering in MB'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the containing domain, null for public offerings'}, {u'name': u'cpuspeed', u'required': True, u'related': [], u'length': 255, u'type': u'long', u'description': u'the CPU speed of the service offering in MHz.'}, {u'name': u'networkrate', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'data transfer rate in megabits per second allowed. Supported only for non-System offering and system offerings having "domainrouter" systemvmtype'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the service offering'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the tags for this service offering.'}], u'requiredparams': [u'name', u'cpunumber', u'memory', u'cpuspeed', u'displaytext'], u'description': u'Creates a service offering.'}, u'condition': {u'name': u'createCondition', u'related': [], u'isasync': True, u'params': [{u'name': u'threshold', u'required': True, u'related': [], u'length': 255, u'type': u'long', u'description': u'Threshold value.'}, {u'name': u'counterid', u'required': True, u'related': [u'listConditions', u'listCounters', u'createCounter'], u'length': 255, u'type': u'uuid', u'description': u'ID of the Counter.'}, {u'name': u'relationaloperator', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Relational Operator to be used with threshold.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account of the condition. Must be used with the domainId parameter.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the domain ID of the account.'}], u'requiredparams': [u'threshold', u'counterid', u'relationaloperator'], u'description': u'Creates a condition'}, u'storagepool': {u'name': u'createStoragePool', u'related': [u'cancelStorageMaintenance', u'listStoragePools'], u'isasync': False, u'params': [{u'name': u'clusterid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the cluster ID for the storage pool'}, {u'name': u'zoneid', u'required': True, u'related': [u'listZones'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the storage pool'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name for the storage pool'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the tags for the storage pool'}, {u'name': u'podid', u'required': True, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID for the storage pool'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL of the storage pool'}, {u'name': u'details', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'the details for the storage pool'}], u'requiredparams': [u'clusterid', u'zoneid', u'name', u'podid', u'url'], u'description': u'Creates a storage pool.'}, u'vpngateway': {u'name': u'createVpnGateway', u'related': [], u'isasync': True, u'params': [{u'name': u'vpcid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'public ip address id of the vpn gateway'}], u'requiredparams': [u'vpcid'], u'description': u'Creates site to site vpn local gateway'}, u'autoscalevmgroup': {u'name': u'createAutoScaleVmGroup', u'related': [u'updateAutoScaleVmGroup'], u'isasync': True, u'params': [{u'name': u'vmprofileid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the autoscale profile that contains information about the vms in the vm group.'}, {u'name': u'scaledownpolicyids', u'required': True, u'related': [u'updateAutoScalePolicy'], u'length': 255, u'type': u'list', u'description': u'list of scaledown autoscale policies'}, {u'name': u'scaleuppolicyids', u'required': True, u'related': [u'updateAutoScalePolicy'], u'length': 255, u'type': u'list', u'description': u'list of scaleup autoscale policies'}, {u'name': u'interval', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the frequency at which the conditions have to be evaluated'}, {u'name': u'minmembers', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the minimum number of members in the vmgroup, the number of instances in the vm group will be equal to or more than this number.'}, {u'name': u'maxmembers', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'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.'}, {u'name': u'lbruleid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}], u'requiredparams': [u'vmprofileid', u'scaledownpolicyids', u'scaleuppolicyids', u'minmembers', u'maxmembers', u'lbruleid'], u'description': u'Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.'}, u'networkacl': {u'name': u'createNetworkACL', u'related': [], u'isasync': True, u'params': [{u'name': u'icmpcode', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'error code for this icmp message'}, {u'name': u'endport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the ending port of ACL'}, {u'name': u'traffictype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the traffic type for the ACL,can be Ingress or Egress, defaulted to Ingress if not specified'}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list to allow traffic from/to'}, {u'name': u'networkid', u'required': True, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'The network of the vm the ACL will be created for'}, {u'name': u'protocol', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the protocol for the ACL rule. Valid values are TCP/UDP/ICMP.'}, {u'name': u'startport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the starting port of ACL'}, {u'name': u'icmptype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'type of the icmp message being sent'}], u'requiredparams': [u'networkid', u'protocol'], u'description': u'Creates a ACL rule the given network (the network has to belong to VPC)'}, u'template': {u'name': u'createTemplate', u'related': [u'cancelStorageMaintenance', u'enableStorageMaintenance', u'updateStoragePool', u'createStoragePool', u'listStoragePools'], u'isasync': True, u'params': [{u'name': u'ostypeid', u'required': True, u'related': [u'listOsTypes'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the OS Type that best represents the OS of this template.'}, {u'name': u'templatetag', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the tag for this template.'}, {u'name': u'bits', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'32 or 64 bit'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this template is a public template, false otherwise'}, {u'name': u'volumeid', u'required': False, u'related': [u'migrateVolume', u'detachVolume', u'resizeVolume', u'attachVolume', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume the template is being created from. Either this parameter, or snapshotId has to be passed in'}, {u'name': u'passwordenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template supports the password reset feature; default is false'}, {u'name': u'snapshotid', u'required': False, u'related': [u'createSnapshot', u'listSnapshots'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the snapshot the template is being created from. Either this parameter, or volumeId has to be passed in'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'listLoadBalancerRuleInstances', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'Optional, VM ID. If this presents, it is going to create a baremetal template for VM this ID refers to. This is only for VM whose hypervisor type is BareMetal'}, {u'name': u'url', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Optional, only for baremetal hypervisor. The directory name where template stored on CIFS server'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the display text of the template. This is usually used for display purposes.'}, {u'name': u'details', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'Template details in key/value pairs.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the template'}, {u'name': u'isfeatured', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this template is a featured template, false otherwise'}, {u'name': u'requireshvm', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template requires HVM, false otherwise'}], u'requiredparams': [u'ostypeid', u'displaytext', u'name'], u'description': u'Creates a template of a virtual machine. The virtual machine must be in a STOPPED state. A template created from this command is automatically designated as a private template visible to the account that created it.'}, u'privategateway': {u'name': u'createPrivateGateway', u'related': [], u'isasync': True, u'params': [{u'name': u'vlan', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the Vlan for the private gateway'}, {u'name': u'gateway', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway of the Private gateway'}, {u'name': u'netmask', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask of the Private gateway'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID the network belongs to'}, {u'name': u'vpcid', u'required': True, u'related': [u'restartVPC'], u'length': 255, u'type': u'uuid', u'description': u'the VPC network belongs to'}, {u'name': u'ipaddress', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the IP address of the Private gateaway'}], u'requiredparams': [u'vlan', u'gateway', u'netmask', u'vpcid', u'ipaddress'], u'description': u'Creates a private gateway'}, u'volumeonfiler': {u'name': u'createVolumeOnFiler', u'related': [], u'isasync': False, u'params': [{u'name': u'volumename', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'volume name.'}, {u'name': u'aggregatename', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'aggregate name.'}, {u'name': u'poolname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}, {u'name': u'snapshotpolicy', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'snapshot policy.'}, {u'name': u'ipaddress', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'ip address.'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'password.'}, {u'name': u'size', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'volume size.'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'user name.'}, {u'name': u'snapshotreservation', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'snapshot reservation.'}], u'requiredparams': [u'volumename', u'aggregatename', u'poolname', u'ipaddress', u'password', u'size', u'username'], u'description': u'Create a volume'}, u'staticroute': {u'name': u'createStaticRoute', u'related': [], u'isasync': True, u'params': [{u'name': u'gatewayid', u'required': True, u'related': [u'createPrivateGateway'], u'length': 255, u'type': u'uuid', u'description': u'the gateway id we are creating static route for'}, {u'name': u'cidr', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'static route cidr'}], u'requiredparams': [u'gatewayid', u'cidr'], u'description': u'Creates a static route'}, u'volume': {u'name': u'createVolume', u'related': [u'detachVolume', u'uploadVolume'], u'isasync': True, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the disk volume'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the availability zone'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts'], u'length': 255, u'type': u'uuid', u'description': u'the project associated with the volume. Mutually exclusive with account parameter'}, {u'name': u'diskofferingid', u'required': False, u'related': [u'updateDiskOffering', u'createDiskOffering', u'listDiskOfferings'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk offering. Either diskOfferingId or snapshotId must be passed in.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account associated with the disk volume. Must be used with the domainId parameter.'}, {u'name': u'size', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'Arbitrary volume size'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the domain ID associated with the disk offering. If used with the account parameter returns the disk volume associated with the account for the specified domain.'}, {u'name': u'snapshotid', u'required': False, u'related': [u'createSnapshot', u'listSnapshots'], u'length': 255, u'type': u'uuid', u'description': u'the snapshot ID for the disk volume. Either diskOfferingId or snapshotId must be passed in.'}], u'requiredparams': [u'name'], u'description': u'Creates a disk volume from a disk offering. This disk volume must still be attached to a virtual machine to make use of it.'}, u'user': {u'name': u'createUser', u'related': [u'lockUser', u'listUsers'], u'isasync': False, u'params': [{u'name': u'account', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Creates the user under the specified account. If no account is specified, the username will be used as the account name.'}, {u'name': u'userid', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'User UUID, required for adding account from external provisioning system'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Unique username.'}, {u'name': u'timezone', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Creates the user under the specified domain. Has to be accompanied with the account parameter'}, {u'name': u'email', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'email'}, {u'name': u'lastname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'lastname'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Hashed password (Default is MD5). If you wish to use any other hashing algorithm, you would need to write a custom authentication adapter See Docs section.'}, {u'name': u'firstname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'firstname'}], u'requiredparams': [u'account', u'username', u'email', u'lastname', u'password', u'firstname'], u'description': u'Creates a user for an account that already exists'}, u'vpc': {u'name': u'createVPC', u'related': [u'updateVPC', u'restartVPC', u'listVPCs'], u'isasync': True, u'params': [{u'name': u'displaytext', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the VPC'}, {u'name': u'zoneid', u'required': True, u'related': [u'listZones'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the availability zone'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the VPC'}, {u'name': u'vpcofferingid', u'required': True, u'related': [u'listVPCOfferings', u'createVPCOffering'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the VPC offering'}, {u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'VPC network domain. All networks inside the VPC will belong to this domain'}, {u'name': u'cidr', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u"the cidr of the VPC. All VPC guest networks' cidrs should be within this CIDR"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account associated with the VPC. Must be used with the domainId parameter.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the domain ID associated with the VPC. If used with the account parameter returns the VPC associated with the account for the specified domain.'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts'], u'length': 255, u'type': u'uuid', u'description': u'create VPC for the project'}], u'requiredparams': [u'displaytext', u'zoneid', u'name', u'vpcofferingid', u'cidr'], u'description': u'Creates a VPC'}, u'storagenetworkiprange': {u'name': u'createStorageNetworkIpRange', u'related': [u'listStorageNetworkIpRange', u'updateStorageNetworkIpRange'], u'isasync': True, u'params': [{u'name': u'startip', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the beginning IP address'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Optional. The vlan the ip range sits on, default to Null when it is not specified which means you network is not on any Vlan. This is mainly for Vmware as other hypervisors can directly reterive bridge from pyhsical network traffic type table'}, {u'name': u'podid', u'required': True, u'related': [u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'UUID of pod where the ip range belongs to'}, {u'name': u'netmask', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask for storage network'}, {u'name': u'endip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IP address'}, {u'name': u'gateway', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway for storage network'}], u'requiredparams': [u'startip', u'podid', u'netmask', u'gateway'], u'description': u'Creates a Storage network IP range.'}, u'pool': {u'name': u'createPool', u'related': [], u'isasync': False, u'params': [{u'name': u'algorithm', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'algorithm.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}], u'requiredparams': [u'algorithm', u'name'], u'description': u'Create a pool'}, u'autoscalevmprofile': {u'name': u'createAutoScaleVmProfile', u'related': [u'updateAutoScaleVmProfile', u'listAutoScaleVmProfiles'], u'isasync': True, u'params': [{u'name': u'otherdeployparams', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'parameters other than zoneId/serviceOfferringId/templateId of the auto deployed virtual machine'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'availability zone for the auto deployed virtual machine'}, {u'name': u'serviceofferingid', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings', u'createServiceOffering', u'updateServiceOffering'], u'length': 255, u'type': u'uuid', u'description': u'the service offering of the auto deployed virtual machine'}, {u'name': u'expungevmgraceperiod', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the time allowed for existing connections to get closed before a vm is destroyed'}, {u'name': u'counterparam', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'counterparam list. Example: counterparam[0].name=snmpcommunity&counterparam[0].value=public&counterparam[1].name=snmpport&counterparam[1].value=161'}, {u'name': u'templateid', u'required': True, u'related': [u'registerIso', u'updateTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the template of the auto deployed virtual machine'}, {u'name': u'autoscaleuserid', u'required': False, u'related': [u'disableUser', u'lockUser', u'listUsers', u'enableUser', u'createUser', u'updateUser'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the user used to launch and destroy the VMs'}], u'requiredparams': [u'zoneid', u'serviceofferingid', u'templateid'], u'description': u'Creates a profile that contains information about the virtual machine which will be provisioned automatically by autoscale feature.'}, u'account': {u'name': u'createAccount', u'related': [u'disableUser', u'lockUser', u'listUsers', u'enableUser', u'createUser', u'getUser', u'updateUser'], u'isasync': False, u'params': [{u'name': u'lastname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'lastname'}, {u'name': u'accounttype', u'required': True, u'related': [], u'length': 255, u'type': u'short', u'description': u'Type of the account. Specify 0 for user, 1 for root admin, and 2 for domain admin'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Unique username.'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Hashed password (Default is MD5). If you wish to use any other hashing algorithm, you would need to write a custom authentication adapter See Docs section.'}, {u'name': u'firstname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'firstname'}, {u'name': u'userid', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'User UUID, required for adding account from external provisioning system'}, {u'name': u'timezone', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Creates the user under the specified account. If no account is specified, the username will be used as the account name.'}, {u'name': u'accountdetails', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'details for account used to store specific parameters'}, {u'name': u'email', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'email'}, {u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"Network domain for the account's networks"}, {u'name': u'accountid', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Account UUID, required for adding account from external provisioning system'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'Creates the user under the specified domain.'}], u'requiredparams': [u'lastname', u'accounttype', u'username', u'password', u'firstname', u'email'], u'description': u'Creates an account'}, u'firewallrule': {u'name': u'createFirewallRule', u'related': [u'listEgressFirewallRules'], u'isasync': True, u'params': [{u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list to forward traffic from'}, {u'name': u'protocol', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the protocol for the firewall rule. Valid values are TCP/UDP/ICMP.'}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'type of firewallrule: system/user'}, {u'name': u'ipaddressid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the IP address id of the port forwarding rule'}, {u'name': u'startport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the starting port of firewall rule'}, {u'name': u'icmptype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'type of the icmp message being sent'}, {u'name': u'icmpcode', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'error code for this icmp message'}, {u'name': u'endport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the ending port of firewall rule'}], u'requiredparams': [u'protocol', u'ipaddressid'], u'description': u'Creates a firewall rule for a given ip address'}, u'networkoffering': {u'name': u'createNetworkOffering', u'related': [u'updateNetworkOffering'], u'isasync': False, u'params': [{u'name': u'serviceproviderlist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'provider to service mapping. If not specified, the provider for the service will be mapped to the default provider on the physical network'}, {u'name': u'serviceofferingid', u'required': False, u'related': [u'updateHypervisorCapabilities'], u'length': 255, u'type': u'uuid', u'description': u'the service offering ID used by virtual router provider'}, {u'name': u'supportedservices', u'required': True, u'related': [], u'length': 255, u'type': u'list', u'description': u'services supported by the network offering'}, {u'name': u'networkrate', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'data transfer rate in megabits per second allowed'}, {u'name': u'ispersistent', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if network offering supports persistent networks; defaulted to false if not specified'}, {u'name': u'servicecapabilitylist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'desired service capabilities as part of network offering'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the network offering'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the tags for the network offering.'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the network offering'}, {u'name': u'conservemode', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the network offering is IP conserve mode enabled'}, {u'name': u'guestiptype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'guest type of the network offering: Shared or Isolated'}, {u'name': u'traffictype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the traffic type for the network offering. Supported type in current release is GUEST only'}, {u'name': u'specifyvlan', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if network offering supports vlans'}, {u'name': u'availability', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the availability of network offering. Default value is Optional'}, {u'name': u'specifyipranges', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if network offering supports specifying ip ranges; defaulted to false if not specified'}], u'requiredparams': [u'supportedservices', u'name', u'displaytext', u'guestiptype', u'traffictype'], u'description': u'Creates a network offering.'}, u'vlaniprange': {u'name': u'createVlanIpRange', u'related': [u'listVlanIpRanges'], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'domain ID of the account owning a VLAN'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'suspendProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'project who will own the VLAN. If VLAN is Zone wide, this parameter should be ommited'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ID or VID of the VLAN. If not specified, will be defaulted to the vlan of the network or if vlan of the network is null - to Untagged'}, {u'name': u'networkid', u'required': False, u'related': [u'createNetwork', u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'the network id'}, {u'name': u'forvirtualnetwork', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if VLAN is of Virtual type, false if Direct'}, {u'name': u'podid', u'required': False, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'optional parameter. Have to be specified for Direct Untagged vlan only.'}, {u'name': u'ip6cidr', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the CIDR of IPv6 network, must be at least /64'}, {u'name': u'endipv6', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IPv6 address in the IPv6 network range'}, {u'name': u'startip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the beginning IP address in the VLAN IP range'}, {u'name': u'startipv6', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the beginning IPv6 address in the IPv6 network range'}, {u'name': u'gateway', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway of the VLAN IP range'}, {u'name': u'netmask', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask of the VLAN IP range'}, {u'name': u'endip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IP address in the VLAN IP range'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'account who will own the VLAN. If VLAN is Zone wide, this parameter should be ommited'}, {u'name': u'ip6gateway', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway of the IPv6 network. Required for Shared networks and Isolated networks when it belongs to VPC'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'updatePhysicalNetwork', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the physical network id'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID of the VLAN IP range'}], u'requiredparams': [], u'description': u'Creates a VLAN IP range.'}, u'counter': {u'name': u'createCounter', u'related': [u'listCounters'], u'isasync': True, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Name of the counter.'}, {u'name': u'source', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Source of the counter.'}, {u'name': u'value', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Value of the counter e.g. oid in case of snmp.'}], u'requiredparams': [u'name', u'source', u'value'], u'description': u'Adds metric counter'}, u'lunonfiler': {u'name': u'createLunOnFiler', u'related': [], u'isasync': False, u'params': [{u'name': u'size', u'required': True, u'related': [], u'length': 255, u'type': u'long', u'description': u'LUN size.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}], u'requiredparams': [u'size', u'name'], u'description': u'Create a LUN from a pool'}, u'project': {u'name': u'createProject', u'related': [], u'isasync': True, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'account who will be Admin for the project'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the project'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'domain ID of the account owning a project'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'display text of the project'}], u'requiredparams': [u'name', u'displaytext'], u'description': u'Creates a project'}, u'physicalnetwork': {u'name': u'createPhysicalNetwork', u'related': [u'listPhysicalNetworks'], u'isasync': True, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the physical network'}, {u'name': u'zoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the physical network'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'Tag the physical network'}, {u'name': u'networkspeed', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the speed for the physical network[1G/10G]'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the VLAN for the physical network'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'domain ID of the account owning a physical network'}, {u'name': u'broadcastdomainrange', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the broadcast domain range for the physical network[Pod or Zone]. In Acton release it can be Zone only in Advance zone, and Pod in Basic'}, {u'name': u'isolationmethods', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the isolation method for the physical network[VLAN/L3/GRE]'}], u'requiredparams': [u'name', u'zoneid'], u'description': u'Creates a physical network'}, u'snapshot': {u'name': u'createSnapshot', u'related': [u'listSnapshots'], u'isasync': True, u'params': [{u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'The domain ID of the snapshot. If used with the account parameter, specifies a domain for the account associated with the disk volume.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The account of the snapshot. The account parameter must be used with the domainId parameter.'}, {u'name': u'volumeid', u'required': True, u'related': [u'detachVolume'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the disk volume'}, {u'name': u'policyid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'policy id of the snapshot, if this is null, then use MANUAL_POLICY.'}], u'requiredparams': [u'volumeid'], u'description': u'Creates an instant snapshot of a volume.'}, u'virtualrouterelement': {u'name': u'createVirtualRouterElement', u'related': [], u'isasync': True, u'params': [{u'name': u'nspid', u'required': True, u'related': [u'updateNetworkServiceProvider'], u'length': 255, u'type': u'uuid', u'description': u'the network service provider ID of the virtual router element'}], u'requiredparams': [u'nspid'], u'description': u'Create a virtual router element.'}, u'egressfirewallrule': {u'name': u'createEgressFirewallRule', u'related': [u'createFirewallRule', u'listEgressFirewallRules'], u'isasync': True, u'params': [{u'name': u'networkid', u'required': True, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'the network id of the port forwarding rule'}, {u'name': u'startport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the starting port of firewall rule'}, {u'name': u'icmpcode', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'error code for this icmp message'}, {u'name': u'icmptype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'type of the icmp message being sent'}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list to forward traffic from'}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'type of firewallrule: system/user'}, {u'name': u'protocol', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the protocol for the firewall rule. Valid values are TCP/UDP/ICMP.'}, {u'name': u'endport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the ending port of firewall rule'}], u'requiredparams': [u'networkid', u'protocol'], u'description': u'Creates a egress firewall rule for a given network '}, u'sshkeypair': {u'name': u'createSSHKeyPair', u'related': [u'listSSHKeyPairs'], u'isasync': False, u'params': [{u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'an optional project for the ssh key'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the ssh key. If the account parameter is used, domainId must also be used.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Name of the keypair'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the ssh key. Must be used with domainId.'}], u'requiredparams': [u'name'], u'description': u'Create a new keypair and returns the private key'}}, u'deploy': {u'virtualmachine': {u'name': u'deployVirtualMachine', u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'keypair', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the ssh key pair used to login to the virtual machine'}, {u'name': u'userdata', u'required': False, u'related': [], u'length': 2048, u'type': u'string', u'description': u'an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding.'}, {u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the hypervisor on which to deploy the virtual machine'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used.'}, {u'name': u'size', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'the arbitrary size for the DATADISK volume. Mutually exclusive with diskOfferingId'}, {u'name': u'diskofferingid', u'required': False, u'related': [u'createDiskOffering', u'listDiskOfferings'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk offering for the virtual machine. If the template is of ISO format, the diskOfferingId is for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk volume. If the templateId parameter passed is from a Template object, the diskOfferingId refers to a DATA Disk Volume created. If the templateId parameter passed is from an ISO object, the diskOfferingId refers to a ROOT Disk Volume created.'}, {u'name': u'securitygroupids', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'comma separated list of security groups id that going to be applied to the virtual machine. Should be passed only when vm is created from a zone with Basic Network support. Mutually exclusive with securitygroupnames parameter'}, {u'name': u'serviceofferingid', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the service offering for the virtual machine'}, {u'name': u'ipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"the ip address for default vm's network"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the virtual machine. Must be used with domainId.'}, {u'name': u'hostid', u'required': False, u'related': [u'addHost', u'updateHost', u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'destination Host ID to deploy the VM to - parameter available for root admin only'}, {u'name': u'iptonetworklist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u"ip to network mapping. Can't be specified with networkIds parameter. Example: iptonetworklist[0].ip=10.10.10.11&iptonetworklist[0].ipv6=fc00:1234:5678::abcd&iptonetworklist[0].networkid=uuid - requests to use ip 10.10.10.11 in network id=uuid"}, {u'name': u'ip6address', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"the ipv6 address for default vm's network"}, {u'name': u'keyboard', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional keyboard device type for the virtual machine. valid value can be one of de,de-ch,es,fi,fr,fr-be,fr-ch,is,it,jp,nl-be,no,pt,uk,us'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject'], u'length': 255, u'type': u'uuid', u'description': u'Deploy vm for the project'}, {u'name': u'networkids', u'required': False, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'list', u'description': u"list of network ids used by virtual machine. Can't be specified with ipToNetworkList parameter"}, {u'name': u'displayname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional user generated name for the virtual machine'}, {u'name': u'securitygroupnames', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'comma separated list of security groups names that going to be applied to the virtual machine. Should be passed only when vm is created from a zone with Basic Network support. Mutually exclusive with securitygroupids parameter'}, {u'name': u'templateid', u'required': True, u'related': [u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the template for the virtual machine'}, {u'name': u'zoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'availability zone for the virtual machine'}, {u'name': u'group', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional group for the virtual machine'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'host name for the virtual machine'}, {u'name': u'startvm', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if network offering supports specifying ip ranges; defaulted to true if not specified'}], u'requiredparams': [u'serviceofferingid', u'templateid', u'zoneid'], u'description': u'Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.'}}, u'restart': {u'network': {u'name': u'restartNetwork', u'related': [u'associateIpAddress'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'The id of the network to restart.'}, {u'name': u'cleanup', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'If cleanup old network elements'}], u'requiredparams': [u'id'], u'description': u'Restarts the network; includes 1) restarting network elements - virtual routers, dhcp servers 2) reapplying all public ips 3) reapplying loadBalancing/portForwarding rules'}, u'vpc': {u'name': u'restartVPC', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': False, u'related': [u'restartVPC'], u'length': 255, u'type': u'uuid', u'description': u'the id of the VPC'}], u'requiredparams': [], u'description': u'Restarts a VPC'}}, u'reboot': {u'systemvm': {u'name': u'rebootSystemVm', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'rebootSystemVm'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the system virtual machine'}], u'requiredparams': [u'id'], u'description': u'Reboots a system VM.'}, u'router': {u'name': u'rebootRouter', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'rebootRouter'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the router'}], u'requiredparams': [u'id'], u'description': u'Starts a router.'}, u'virtualmachine': {u'name': u'rebootVirtualMachine', u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}], u'requiredparams': [u'id'], u'description': u'Reboots a virtual machine.'}}, u'mark': {u'defaultzoneforaccount': {u'name': u'markDefaultZoneForAccount', u'related': [], u'isasync': True, u'params': [{u'name': u'account', u'required': True, u'related': [u'markDefaultZoneForAccount'], u'length': 255, u'type': u'string', u'description': u'Name of the account that is to be marked.'}, {u'name': u'domainid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Marks the account that belongs to the specified domain.'}, {u'name': u'zoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'The Zone ID with which the account is to be marked.'}], u'requiredparams': [u'account', u'domainid', u'zoneid'], u'description': u'Marks a default zone for this account'}}, u'start': {u'systemvm': {u'name': u'startSystemVm', u'related': [u'rebootSystemVm', u'listSystemVms', u'changeServiceForSystemVm'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'startSystemVm', u'rebootSystemVm', u'listSystemVms', u'changeServiceForSystemVm'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the system virtual machine'}], u'requiredparams': [u'id'], u'description': u'Starts a system virtual machine.'}, u'router': {u'name': u'startRouter', u'related': [u'destroyRouter', u'rebootRouter'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'destroyRouter', u'rebootRouter', u'startRouter'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the router'}], u'requiredparams': [u'id'], u'description': u'Starts a router.'}, u'virtualmachine': {u'name': u'startVirtualMachine', u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}, {u'name': u'hostid', u'required': False, u'related': [u'addHost', u'updateHost', u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'destination Host ID to deploy the VM to - parameter available for root admin only'}], u'requiredparams': [u'id'], u'description': u'Starts a virtual machine.'}}, u'add': {u'trafficmonitor': {u'name': u'addTrafficMonitor', u'related': [u'listTrafficMonitors'], u'isasync': False, u'params': [{u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'URL of the traffic monitor Host'}, {u'name': u'includezones', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Traffic going into the listed zones will be metered'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'Zone in which to add the external firewall appliance.'}, {u'name': u'excludezones', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Traffic going into the listed zones will not be metered'}], u'requiredparams': [u'url', u'zoneid'], u'description': u'Adds Traffic Monitor Host for Direct Network Usage'}, u'secondarystorage': {u'name': u'addSecondaryStorage', u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the secondary storage'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL for the secondary storage'}], u'requiredparams': [u'url'], u'description': u'Adds secondary storage.'}, u'nictovirtualmachine': {u'name': u'addNicToVirtualMachine', u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'listLoadBalancerRuleInstances', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'networkid', u'required': True, u'related': [u'createNetwork', u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'Network ID'}, {u'name': u'ipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'IP Address for the new network'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'addNicToVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'listLoadBalancerRuleInstances', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'Virtual Machine ID'}], u'requiredparams': [u'networkid', u'virtualmachineid'], u'description': u'Adds VM to specified network by creating a NIC'}, u'netscalerloadbalancer': {u'name': u'addNetscalerLoadBalancer', u'related': [u'listNetscalerLoadBalancers', u'configureNetscalerLoadBalancer'], u'isasync': True, u'params': [{u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to reach netscaler load balancer device'}, {u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'updatePhysicalNetwork', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to reach netscaler load balancer device'}, {u'name': u'networkdevicetype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Netscaler device type supports NetscalerMPXLoadBalancer, NetscalerVPXLoadBalancer, NetscalerSDXLoadBalancer'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'URL of the netscaler load balancer appliance.'}], u'requiredparams': [u'password', u'physicalnetworkid', u'username', u'networkdevicetype', u'url'], u'description': u'Adds a netscaler load balancer device'}, u'cluster': {u'name': u'addCluster', u'related': [u'listClusters', u'updateCluster'], u'isasync': False, u'params': [{u'name': u'url', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this cluster for allocation of new resources'}, {u'name': u'vsmpassword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the password for the VSM associated with this cluster'}, {u'name': u'podid', u'required': True, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID for the host'}, {u'name': u'vsmipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ipaddress of the VSM associated with this cluster'}, {u'name': u'hypervisor', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'hypervisor type of the cluster: XenServer,KVM,VMware,Hyperv,BareMetal,Simulator'}, {u'name': u'vsmusername', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username for the VSM associated with this cluster'}, {u'name': u'username', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username for the cluster'}, {u'name': u'clustertype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'type of the cluster: CloudManaged, ExternalManaged'}, {u'name': u'clustername', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the cluster name'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the cluster'}, {u'name': u'password', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the password for the host'}], u'requiredparams': [u'podid', u'hypervisor', u'clustertype', u'clustername', u'zoneid'], u'description': u'Adds a new cluster'}, u's3': {u'name': u'addS3', u'related': [], u'isasync': False, u'params': [{u'name': u'connectiontimeout', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'connection timeout (milliseconds)'}, {u'name': u'accesskey', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'S3 access key'}, {u'name': u'bucket', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the template storage bucket'}, {u'name': u'endpoint', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'S3 host name'}, {u'name': u'secretkey', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'S3 secret key'}, {u'name': u'sockettimeout', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'socket timeout (milliseconds)'}, {u'name': u'maxerrorretry', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'maximum number of times to retry on error'}, {u'name': u'usehttps', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'connect to the S3 endpoint via HTTPS?'}], u'requiredparams': [u'accesskey', u'bucket', u'secretkey'], u'description': u'Adds S3'}, u'accounttoproject': {u'name': u'addAccountToProject', u'related': [], u'isasync': True, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the account to be added to the project'}, {u'name': u'email', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'email to which invitation to the project is going to be sent'}, {u'name': u'projectid', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'suspendProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to add the account to'}], u'requiredparams': [u'projectid'], u'description': u'Adds acoount to a project'}, u'region': {u'name': u'addRegion', u'related': [], u'isasync': False, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Name of the region'}, {u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Id of the Region'}, {u'name': u'endpoint', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Region service endpoint'}], u'requiredparams': [u'name', u'id', u'endpoint'], u'description': u'Adds a Region'}, u'externalloadbalancer': {u'name': u'addExternalLoadBalancer', u'related': [], u'isasync': False, u'params': [{u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Username of the external load balancer appliance.'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'URL of the external load balancer appliance.'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Password of the external load balancer appliance.'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'Zone in which to add the external load balancer appliance.'}], u'requiredparams': [u'username', u'url', u'password', u'zoneid'], u'description': u'Adds F5 external load balancer appliance.'}, u'vpnuser': {u'name': u'addVpnUser', u'related': [u'listVpnUsers'], u'isasync': True, u'params': [{u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'password for the username'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'username for the vpn user'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the vpn user. Must be used with domainId.'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the vpn user. If the account parameter is used, domainId must also be used.'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject'], u'length': 255, u'type': u'uuid', u'description': u'add vpn user to the specific project'}], u'requiredparams': [u'password', u'username'], u'description': u'Adds vpn users'}, u'baremetalhost': {u'name': u'addBaremetalHost', u'related': [u'listSwifts', u'addHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'isasync': False, u'params': [{u'name': u'ipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'ip address intentionally allocated to this host after provisioning'}, {u'name': u'hosttags', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list of tags to be added to the host'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the host URL'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username for the host'}, {u'name': u'zoneid', u'required': True, u'related': [u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the host'}, {u'name': u'clustername', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the cluster name for the host'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the cluster ID for the host'}, {u'name': u'hypervisor', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'hypervisor type of the host'}, {u'name': u'podid', u'required': True, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID for the host'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the password for the host'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this Host for allocation of new resources'}], u'requiredparams': [u'url', u'username', u'zoneid', u'hypervisor', u'podid', u'password'], u'description': u'add a baremetal host'}, u'traffictype': {u'name': u'addTrafficType', u'related': [u'updateTrafficType'], u'isasync': True, u'params': [{u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The VLAN id to be used for Management traffic by VMware host'}, {u'name': u'kvmnetworklabel', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The network name label of the physical device dedicated to this traffic on a KVM host'}, {u'name': u'traffictype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the trafficType to be added to the physical network'}, {u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'vmwarenetworklabel', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The network name label of the physical device dedicated to this traffic on a VMware host'}, {u'name': u'xennetworklabel', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The network name label of the physical device dedicated to this traffic on a XenServer host'}], u'requiredparams': [u'traffictype', u'physicalnetworkid'], u'description': u'Adds traffic type to a physical network'}, u'niciranvpdevice': {u'name': u'addNiciraNvpDevice', u'related': [], u'isasync': True, u'params': [{u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'hostname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Hostname of ip address of the Nicira NVP Controller.'}, {u'name': u'l3gatewayserviceuuid', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The L3 Gateway Service UUID configured on the Nicira Controller'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to access the Nicira Controller API'}, {u'name': u'transportzoneuuid', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'The Transportzone UUID configured on the Nicira Controller'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to access the Nicira Controller API'}], u'requiredparams': [u'physicalnetworkid', u'hostname', u'username', u'transportzoneuuid', u'password'], u'description': u'Adds a Nicira NVP device'}, u'host': {u'name': u'addHost', u'related': [u'updateHost', u'listHosts'], u'isasync': False, u'params': [{u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username for the host'}, {u'name': u'podid', u'required': True, u'related': [u'updatePod'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID for the host'}, {u'name': u'clustername', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the cluster name for the host'}, {u'name': u'zoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the host'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the host URL'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the cluster ID for the host'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the password for the host'}, {u'name': u'hosttags', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list of tags to be added to the host'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this Host for allocation of new resources'}, {u'name': u'hypervisor', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'hypervisor type of the host'}], u'requiredparams': [u'username', u'podid', u'zoneid', u'url', u'password', u'hypervisor'], u'description': u'Adds a new host.'}, u'f5loadbalancer': {u'name': u'addF5LoadBalancer', u'related': [u'configureF5LoadBalancer', u'listF5LoadBalancers'], u'isasync': True, u'params': [{u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to reach F5 BigIP load balancer device'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to reach F5 BigIP load balancer device'}, {u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'updatePhysicalNetwork', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'networkdevicetype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'supports only F5BigIpLoadBalancer'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'URL of the F5 load balancer appliance.'}], u'requiredparams': [u'password', u'username', u'physicalnetworkid', u'networkdevicetype', u'url'], u'description': u'Adds a F5 BigIP load balancer device'}, u'networkdevice': {u'name': u'addNetworkDevice', u'related': [], u'isasync': False, u'params': [{u'name': u'networkdevicetype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Network device type, now supports ExternalDhcp, PxeServer, NetscalerMPXLoadBalancer, NetscalerVPXLoadBalancer, NetscalerSDXLoadBalancer, F5BigIpLoadBalancer, JuniperSRXFirewall'}, {u'name': u'networkdeviceparameterlist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'parameters for network device'}], u'requiredparams': [], u'description': u'Adds a network device of one of the following types: ExternalDhcp, ExternalFirewall, ExternalLoadBalancer, PxeServer'}, u'bigswitchvnsdevice': {u'name': u'addBigSwitchVnsDevice', u'related': [], u'isasync': True, u'params': [{u'name': u'physicalnetworkid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'hostname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Hostname of ip address of the BigSwitch VNS Controller.'}], u'requiredparams': [u'physicalnetworkid', u'hostname'], u'description': u'Adds a BigSwitch VNS device'}, u'srxfirewall': {u'name': u'addSrxFirewall', u'related': [], u'isasync': True, u'params': [{u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to reach SRX firewall device'}, {u'name': u'networkdevicetype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'supports only JuniperSRXFirewall'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to reach SRX firewall device'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'URL of the SRX appliance.'}, {u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}], u'requiredparams': [u'password', u'networkdevicetype', u'username', u'url', u'physicalnetworkid'], u'description': u'Adds a SRX firewall device'}, u'swift': {u'name': u'addSwift', u'related': [u'listSwifts', u'addHost', u'updateHost', u'listHosts', u'listExternalLoadBalancers'], u'isasync': False, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account for swift'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL for swift'}, {u'name': u'username', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username for swift'}, {u'name': u'key', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u' key for the user for swift'}], u'requiredparams': [u'url'], u'description': u'Adds Swift.'}, u'externalfirewall': {u'name': u'addExternalFirewall', u'related': [], u'isasync': False, u'params': [{u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'URL of the external firewall appliance.'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Password of the external firewall appliance.'}, {u'name': u'zoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Zone in which to add the external firewall appliance.'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Username of the external firewall appliance.'}], u'requiredparams': [u'url', u'password', u'zoneid', u'username'], u'description': u'Adds an external firewall appliance'}, u'networkserviceprovider': {u'name': u'addNetworkServiceProvider', u'related': [u'updateNetworkServiceProvider'], u'isasync': True, u'params': [{u'name': u'destinationphysicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the destination Physical Network ID to bridge to'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name for the physical network service provider'}, {u'name': u'servicelist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the list of services to be enabled for this physical network service provider'}, {u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID to add the provider to'}], u'requiredparams': [u'name', u'physicalnetworkid'], u'description': u'Adds a network serviceProvider to a physical network'}}, u'verbs': [u'authorize', u'restore', u'suspend', u'revoke', u'disassociate', u'migrate', u'lock', u'dissociate', u'activate', u'reconnect', u'cancel', u'query', u'recover', u'extract', u'detach', u'prepare', u'start', u'create', u'associate', u'reboot', u'mark', u'attach', u'add', u'change', u'deploy', u'ldap', u'destroy', u'enable', u'configure', u'get', u'modify', u'stop', u'update', u'disable', u'resize', u'copy', u'generate', u'restart', u'reset', u'register', u'list', u'upload', u'remove', u'assign', u'delete'], u'resize': {u'volume': {u'name': u'resizeVolume', u'related': [u'detachVolume', u'uploadVolume', u'createVolume'], u'isasync': True, u'params': [{u'name': u'diskofferingid', u'required': False, u'related': [u'updateDiskOffering', u'createDiskOffering', u'listDiskOfferings'], u'length': 255, u'type': u'uuid', u'description': u'new disk offering id'}, {u'name': u'id', u'required': False, u'related': [u'detachVolume', u'resizeVolume', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}, {u'name': u'shrinkok', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Verify OK to Shrink'}, {u'name': u'size', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'New volume size in G'}], u'requiredparams': [], u'description': u'Resizes a volume'}}, u'ldap': {u'config': {u'name': u'ldapConfig', u'related': [u'ldapRemove'], u'isasync': False, u'params': [{u'name': u'hostname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Hostname or ip address of the ldap server eg: my.ldap.com'}, {u'name': u'ssl', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Check Use SSL if the external LDAP server is configured for LDAP over SSL.'}, {u'name': u'truststore', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Enter the path to trust certificates store.'}, {u'name': u'queryfilter', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'You specify a query filter here, which narrows down the users, who can be part of this domain.'}, {u'name': u'searchbase', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'The search base defines the starting point for the search in the directory tree Example: dc=cloud,dc=com.'}, {u'name': u'port', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Specify the LDAP port if required, default is 389.'}, {u'name': u'binddn', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Specify the distinguished name of a user with the search permission on the directory.'}, {u'name': u'truststorepass', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Enter the password for trust store.'}, {u'name': u'bindpass', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Enter the password.'}], u'requiredparams': [u'hostname', u'queryfilter', u'searchbase'], u'description': u'Configure the LDAP context for this site.'}, u'remove': {u'name': u'ldapRemove', u'related': [], u'isasync': False, u'params': [], u'requiredparams': [], u'description': u'Remove the LDAP context for this site.'}}, u'destroy': {u'systemvm': {u'name': u'destroySystemVm', u'related': [u'startSystemVm', u'rebootSystemVm', u'listSystemVms', u'stopSystemVm', u'changeServiceForSystemVm'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'startSystemVm', u'destroySystemVm', u'rebootSystemVm', u'listSystemVms', u'stopSystemVm', u'changeServiceForSystemVm'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the system virtual machine'}], u'requiredparams': [u'id'], u'description': u'Destroyes a system virtual machine.'}, u'router': {u'name': u'destroyRouter', u'related': [u'rebootRouter'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'destroyRouter', u'rebootRouter'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the router'}], u'requiredparams': [u'id'], u'description': u'Destroys a router.'}, u'volumeonfiler': {u'name': u'destroyVolumeOnFiler', u'related': [], u'isasync': False, u'params': [{u'name': u'volumename', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'volume name.'}, {u'name': u'ipaddress', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'ip address.'}, {u'name': u'aggregatename', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'aggregate name.'}], u'requiredparams': [u'volumename', u'ipaddress', u'aggregatename'], u'description': u'Destroy a Volume'}, u'lunonfiler': {u'name': u'destroyLunOnFiler', u'related': [], u'isasync': False, u'params': [{u'name': u'path', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'LUN path.'}], u'requiredparams': [u'path'], u'description': u'Destroy a LUN'}, u'virtualmachine': {u'name': u'destroyVirtualMachine', u'related': [u'listVirtualMachines'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listVirtualMachines', u'destroyVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}], u'requiredparams': [u'id'], u'description': u'Destroys a virtual machine. Once destroyed, only the administrator can recover it.'}}, u'get': {u'apilimit': {u'name': u'getApiLimit', u'related': [u'resetApiLimit'], u'isasync': False, u'params': [], u'requiredparams': [], u'description': u'Get API limit count for the caller'}, u'vmpassword': {u'name': u'getVMPassword', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}], u'requiredparams': [u'id'], u'description': u'Returns an encrypted password for the VM'}, u'user': {u'name': u'getUser', u'related': [u'disableUser', u'lockUser', u'listUsers', u'enableUser', u'createUser', u'updateUser'], u'isasync': False, u'params': [{u'name': u'userapikey', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'API key of the user'}], u'requiredparams': [u'userapikey'], u'description': u'Find user account by API key'}, u'cloudidentifier': {u'name': u'getCloudIdentifier', u'related': [], u'isasync': False, u'params': [{u'name': u'userid', u'required': True, u'related': [u'lockUser', u'listUsers', u'createUser'], u'length': 255, u'type': u'uuid', u'description': u'the user ID for the cloud identifier'}], u'requiredparams': [u'userid'], u'description': u'Retrieves a cloud identifier.'}}, u'count': 355, u'enable': {u'account': {u'name': u'enableAccount', u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount', u'disableAccount'], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'Enables specified account in this domain.'}, {u'name': u'id', u'required': False, u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount', u'enableAccount', u'disableAccount'], u'length': 255, u'type': u'uuid', u'description': u'Account id'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Enables specified account.'}], u'requiredparams': [], u'description': u'Enables an account'}, u'storagemaintenance': {u'name': u'enableStorageMaintenance', u'related': [u'cancelStorageMaintenance', u'updateStoragePool', u'createStoragePool', u'listStoragePools'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'cancelStorageMaintenance', u'enableStorageMaintenance', u'updateStoragePool', u'createStoragePool', u'listStoragePools'], u'length': 255, u'type': u'uuid', u'description': u'Primary storage ID'}], u'requiredparams': [u'id'], u'description': u'Puts storage pool into maintenance state'}, u'cisconexusvsm': {u'name': u'enableCiscoNexusVSM', u'related': [u'disableCiscoNexusVSM'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'disableCiscoNexusVSM', u'enableCiscoNexusVSM'], u'length': 255, u'type': u'uuid', u'description': u'Id of the Cisco Nexus 1000v VSM device to be enabled'}], u'requiredparams': [u'id'], u'description': u'Enable a Cisco Nexus VSM device'}, u'staticnat': {u'name': u'enableStaticNat', u'related': [], u'isasync': False, u'params': [{u'name': u'ipaddressid', u'required': True, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'the public IP address id for which static nat feature is being enabled'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine for enabling static nat feature'}, {u'name': u'networkid', u'required': False, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'The network of the vm the static nat will be enabled for. Required when public Ip address is not associated with any Guest network yet (VPC case)'}], u'requiredparams': [u'ipaddressid', u'virtualmachineid'], u'description': u'Enables static nat for given ip address'}, u'user': {u'name': u'enableUser', u'related': [u'lockUser', u'listUsers', u'createUser'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'lockUser', u'listUsers', u'enableUser', u'createUser'], u'length': 255, u'type': u'uuid', u'description': u'Enables user by user ID.'}], u'requiredparams': [u'id'], u'description': u'Enables a user account'}, u'autoscalevmgroup': {u'name': u'enableAutoScaleVmGroup', u'related': [u'createAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale group'}], u'requiredparams': [u'id'], u'description': u'Enables an AutoScale Vm Group'}}, u'configure': {u'srxfirewall': {u'name': u'configureSrxFirewall', u'related': [u'listSrxFirewalls', u'addSrxFirewall'], u'isasync': True, u'params': [{u'name': u'fwdeviceid', u'required': True, u'related': [u'listSrxFirewalls', u'configureSrxFirewall', u'addSrxFirewall'], u'length': 255, u'type': u'uuid', u'description': u'SRX firewall device ID'}, {u'name': u'fwdevicecapacity', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'capacity of the firewall device, Capacity will be interpreted as number of networks device can handle'}], u'requiredparams': [u'fwdeviceid'], u'description': u'Configures a SRX firewall device'}, u'f5loadbalancer': {u'name': u'configureF5LoadBalancer', u'related': [], u'isasync': True, u'params': [{u'name': u'lbdeviceid', u'required': True, u'related': [u'configureF5LoadBalancer'], u'length': 255, u'type': u'uuid', u'description': u'F5 load balancer device ID'}, {u'name': u'lbdevicecapacity', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'capacity of the device, Capacity will be interpreted as number of networks device can handle'}], u'requiredparams': [u'lbdeviceid'], u'description': u'configures a F5 load balancer device'}, u'netscalerloadbalancer': {u'name': u'configureNetscalerLoadBalancer', u'related': [u'listNetscalerLoadBalancers'], u'isasync': True, u'params': [{u'name': u'podids', u'required': False, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'list', u'description': u"Used when NetScaler device is provider of EIP service. This parameter represents the list of pod's, for which there exists a policy based route on datacenter L3 router to route pod's subnet IP to a NetScaler device."}, {u'name': u'lbdevicecapacity', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'capacity of the device, Capacity will be interpreted as number of networks device can handle'}, {u'name': u'lbdeviceid', u'required': True, u'related': [u'listNetscalerLoadBalancers', u'configureNetscalerLoadBalancer'], u'length': 255, u'type': u'uuid', u'description': u'Netscaler load balancer device ID'}, {u'name': u'inline', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if netscaler load balancer is intended to be used in in-line with firewall, false if netscaler load balancer will side-by-side with firewall'}, {u'name': u'lbdevicededicated', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this netscaler device to dedicated for a account, false if the netscaler device will be shared by multiple accounts'}], u'requiredparams': [u'lbdeviceid'], u'description': u'configures a netscaler load balancer device'}, u'virtualrouterelement': {u'name': u'configureVirtualRouterElement', u'related': [u'createVirtualRouterElement'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createVirtualRouterElement', u'configureVirtualRouterElement'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual router provider'}, {u'name': u'enabled', u'required': True, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Enabled/Disabled the service provider'}], u'requiredparams': [u'id', u'enabled'], u'description': u'Configures a virtual router element.'}}, u'associate': {u'ipaddress': {u'name': u'associateIpAddress', u'related': [], u'isasync': True, u'params': [{u'name': u'networkid', u'required': False, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'The network this ip address should be associated to.'}, {u'name': u'vpcid', u'required': False, u'related': [u'restartVPC', u'listVPCs'], u'length': 255, u'type': u'uuid', u'description': u'the VPC you want the ip address to be associated with'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account to associate with this IP address'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the availability zone you want to acquire an public IP address from'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts'], u'length': 255, u'type': u'uuid', u'description': u'Deploy vm for the project'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the domain to associate with this IP address'}], u'requiredparams': [], u'description': u'Acquires and associates a public IP to an account.'}, u'lun': {u'name': u'associateLun', u'related': [], u'isasync': False, u'params': [{u'name': u'iqn', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Guest IQN to which the LUN associate.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'LUN name.'}], u'requiredparams': [u'iqn', u'name'], u'description': u'Associate a LUN with a guest IQN'}}, u'stop': {u'systemvm': {u'name': u'stopSystemVm', u'related': [u'startSystemVm', u'rebootSystemVm', u'listSystemVms', u'changeServiceForSystemVm'], u'isasync': True, u'params': [{u'name': u'forced', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force stop the VM. The caller knows the VM is stopped.'}, {u'name': u'id', u'required': True, u'related': [u'startSystemVm', u'rebootSystemVm', u'listSystemVms', u'stopSystemVm', u'changeServiceForSystemVm'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the system virtual machine'}], u'requiredparams': [u'id'], u'description': u'Stops a system VM.'}, u'router': {u'name': u'stopRouter', u'related': [u'changeServiceForRouter', u'destroyRouter', u'rebootRouter', u'startRouter'], u'isasync': True, u'params': [{u'name': u'forced', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force stop the VM. The caller knows the VM is stopped.'}, {u'name': u'id', u'required': True, u'related': [u'changeServiceForRouter', u'stopRouter', u'destroyRouter', u'rebootRouter', u'startRouter'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the router'}], u'requiredparams': [u'id'], u'description': u'Stops a router.'}, u'virtualmachine': {u'name': u'stopVirtualMachine', u'related': [u'listVirtualMachines', u'destroyVirtualMachine'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}, {u'name': u'forced', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force stop the VM (vm is marked as Stopped even when command fails to be send to the backend). The caller knows the VM is stopped.'}], u'requiredparams': [u'id'], u'description': u'Stops a virtual machine.'}}, u'modify': {u'pool': {u'name': u'modifyPool', u'related': [], u'isasync': False, u'params': [{u'name': u'algorithm', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'algorithm.'}, {u'name': u'poolname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}], u'requiredparams': [u'algorithm', u'poolname'], u'description': u'Modify pool'}}, u'update': {u'loadbalancerrule': {u'name': u'updateLoadBalancerRule', u'related': [], u'isasync': True, u'params': [{u'name': u'description', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the description of the load balancer rule'}, {u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the id of the load balancer rule to update'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the load balancer rule'}, {u'name': u'algorithm', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'load balancer algorithm (source, roundrobin, leastconn)'}], u'requiredparams': [u'id'], u'description': u'Updates load balancer'}, u'domain': {u'name': u'updateDomain', u'related': [u'listDomainChildren', u'createDomain'], u'isasync': False, u'params': [{u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"Network domain for the domain's networks; empty string will update domainName with NULL value"}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'updates domain with this name'}, {u'name': u'id', u'required': True, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'ID of domain to update'}], u'requiredparams': [u'id'], u'description': u'Updates a domain with a new name'}, u'projectinvitation': {u'name': u'updateProjectInvitation', u'related': [], u'isasync': True, u'params': [{u'name': u'accept', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, accept the invitation, decline if false. True by default'}, {u'name': u'projectid', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to join'}, {u'name': u'token', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list invitations for specified account; this parameter has to be specified with domainId'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'account that is joining the project'}], u'requiredparams': [u'projectid'], u'description': u'Accepts or declines project invitation'}, u'diskoffering': {u'name': u'updateDiskOffering', u'related': [u'createDiskOffering', u'listDiskOfferings'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateDiskOffering', u'createDiskOffering', u'listDiskOfferings'], u'length': 255, u'type': u'uuid', u'description': u'ID of the disk offering'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'updates alternate display text of the disk offering with this value'}, {u'name': u'sortkey', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'sort key of the disk offering, integer'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'updates name of the disk offering with this value'}], u'requiredparams': [u'id'], u'description': u'Updates a disk offering.'}, u'virtualmachine': {u'name': u'updateVirtualMachine', u'related': [u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': False, u'params': [{u'name': u'displayname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'user generated name'}, {u'name': u'group', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'group of the virtual machine'}, {u'name': u'haenable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if high-availability is enabled for the virtual machine, false otherwise'}, {u'name': u'id', u'required': True, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}, {u'name': u'ostypeid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the OS type that best represents this VM.'}, {u'name': u'userdata', u'required': False, u'related': [], u'length': 2048, u'type': u'string', u'description': u'an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding.'}], u'requiredparams': [u'id'], u'description': u'Updates properties of a virtual machine. The VM has to be stopped and restarted for the new properties to take effect. UpdateVirtualMachine does not first check whether the VM is stopped. Therefore, stop the VM manually before issuing this call.'}, u'portforwardingrule': {u'name': u'updatePortForwardingRule', u'related': [u'listIpForwardingRules', u'listPortForwardingRules', u'createPortForwardingRule'], u'isasync': True, u'params': [{u'name': u'privateport', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the private port of the port forwarding rule'}, {u'name': u'publicport', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the public port of the port forwarding rule'}, {u'name': u'privateip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the private IP address of the port forwarding rule'}, {u'name': u'ipaddressid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the IP address id of the port forwarding rule'}, {u'name': u'protocol', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the protocol for the port fowarding rule. Valid values are TCP or UDP.'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine for the port forwarding rule'}], u'requiredparams': [u'privateport', u'publicport', u'ipaddressid', u'protocol'], u'description': u'Updates a port forwarding rule. Only the private port and the virtual machine can be updated.'}, u'cluster': {u'name': u'updateCluster', u'related': [], u'isasync': False, u'params': [{u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'hypervisor type of the cluster'}, {u'name': u'id', u'required': True, u'related': [u'updateCluster'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the Cluster'}, {u'name': u'managedstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'whether this cluster is managed by cloudstack'}, {u'name': u'clustername', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the cluster name'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this cluster for allocation of new resources'}, {u'name': u'clustertype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'hypervisor type of the cluster'}], u'requiredparams': [u'id'], u'description': u'Updates an existing cluster'}, u'hostpassword': {u'name': u'updateHostPassword', u'related': [], u'isasync': False, u'params': [{u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the new password for the host/cluster'}, {u'name': u'hostid', u'required': False, u'related': [u'listSwifts', u'addHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'the host ID'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the cluster ID'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username for the host/cluster'}], u'requiredparams': [u'password', u'username'], u'description': u'Update password of a host/pool on management server.'}, u'pod': {u'name': u'updatePod', u'related': [], u'isasync': False, u'params': [{u'name': u'endip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IP address for the Pod'}, {u'name': u'gateway', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway for the Pod'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this cluster for allocation of new resources'}, {u'name': u'id', u'required': True, u'related': [u'updatePod'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the Pod'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the Pod'}, {u'name': u'startip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the starting IP address for the Pod'}, {u'name': u'netmask', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask of the Pod'}], u'requiredparams': [u'id'], u'description': u'Updates a Pod.'}, u'isopermissions': {u'name': u'updateIsoPermissions', u'related': [], u'isasync': False, u'params': [{u'name': u'isextractable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template/iso is extractable, false other wise. Can be set only by root admin'}, {u'name': u'isfeatured', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true for featured template/iso, false otherwise'}, {u'name': u'accounts', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'a comma delimited list of accounts. If specified, "op" parameter has to be passed in.'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true for public template/iso, false for private templates/isos'}, {u'name': u'projectids', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'list', u'description': u'a comma delimited list of projects. If specified, "op" parameter has to be passed in.'}, {u'name': u'op', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'permission operator (add, remove, reset)'}, {u'name': u'id', u'required': True, u'related': [u'registerIso', u'updateTemplate', u'prepareTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the template ID'}], u'requiredparams': [u'id'], u'description': u'Updates iso permissions'}, u'resourcelimit': {u'name': u'updateResourceLimit', u'related': [], u'isasync': False, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Update resource for a specified account. Must be used with the domainId parameter.'}, {u'name': u'resourcetype', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Type of resource to update. Values are 0, 1, 2, 3, and 4. 0 - Instance. Number of instances a user can create. 1 - IP. Number of public IP addresses a user can own. 2 - Volume. Number of disk volumes a user can create.3 - Snapshot. Number of snapshots a user can create.4 - Template. Number of templates that a user can register/create.'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Update resource limits for all accounts in specified domain. If used with the account parameter, updates resource limits for a specified account in specified domain.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Update resource limits for project'}, {u'name': u'max', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u' Maximum resource limit.'}], u'requiredparams': [u'resourcetype'], u'description': u'Updates resource limits for an account or domain.'}, u'vpcoffering': {u'name': u'updateVPCOffering', u'related': [u'listVPCOfferings', u'createVPCOffering'], u'isasync': True, u'params': [{u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the VPC offering'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'update state for the VPC offering; supported states - Enabled/Disabled'}, {u'name': u'id', u'required': False, u'related': [u'listVPCOfferings', u'createVPCOffering', u'updateVPCOffering'], u'length': 255, u'type': u'uuid', u'description': u'the id of the VPC offering'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the VPC offering'}], u'requiredparams': [], u'description': u'Updates VPC offering'}, u'network': {u'name': u'updateNetwork', u'related': [u'listNetscalerLoadBalancerNetworks'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the network'}, {u'name': u'networkofferingid', u'required': False, u'related': [u'updateNetworkOffering'], u'length': 255, u'type': u'uuid', u'description': u'network offering ID'}, {u'name': u'changecidr', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force update even if cidr type is different'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the new name for the network'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the new display text for the network'}, {u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'network domain'}], u'requiredparams': [u'id'], u'description': u'Updates a network'}, u'zone': {u'name': u'updateZone', u'related': [u'listZones', u'createZone'], u'isasync': False, u'params': [{u'name': u'internaldns1', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the first internal DNS for the Zone'}, {u'name': u'dnssearchorder', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the dns search order list'}, {u'name': u'internaldns2', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the second internal DNS for the Zone'}, {u'name': u'domain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Network domain name for the networks in the zone; empty string will update domain with NULL value'}, {u'name': u'details', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'the details for the Zone'}, {u'name': u'ip6dns1', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the first DNS for IPv6 network in the Zone'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this cluster for allocation of new resources'}, {u'name': u'ip6dns2', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the second DNS for IPv6 network in the Zone'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the Zone'}, {u'name': u'id', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the Zone'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'updates a private zone to public if set, but not vice-versa'}, {u'name': u'dns2', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the second DNS for the Zone'}, {u'name': u'guestcidraddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the guest CIDR address for the Zone'}, {u'name': u'dhcpprovider', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the dhcp Provider for the Zone'}, {u'name': u'dns1', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the first DNS for the Zone'}, {u'name': u'localstorageenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if local storage offering enabled, false otherwise'}], u'requiredparams': [u'id'], u'description': u'Updates a Zone.'}, u'instancegroup': {u'name': u'updateInstanceGroup', u'related': [u'createInstanceGroup'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateInstanceGroup', u'createInstanceGroup'], u'length': 255, u'type': u'uuid', u'description': u'Instance group ID'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'new instance group name'}], u'requiredparams': [u'id'], u'description': u'Updates a vm group'}, u'autoscalepolicy': {u'name': u'updateAutoScalePolicy', u'related': [], u'isasync': True, u'params': [{u'name': u'duration', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the duration for which the conditions have to be true before action is taken'}, {u'name': u'id', u'required': True, u'related': [u'updateAutoScalePolicy'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale policy'}, {u'name': u'quiettime', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the cool down period for which the policy should not be evaluated after the action has been taken'}, {u'name': u'conditionids', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the list of IDs of the conditions that are being evaluated on every interval'}], u'requiredparams': [u'id'], u'description': u'Updates an existing autoscale policy.'}, u'serviceoffering': {u'name': u'updateServiceOffering', u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings', u'createServiceOffering'], u'isasync': False, u'params': [{u'name': u'sortkey', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'sort key of the service offering, integer'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the service offering to be updated'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the service offering to be updated'}, {u'name': u'id', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings', u'createServiceOffering', u'updateServiceOffering'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the service offering to be updated'}], u'requiredparams': [u'id'], u'description': u'Updates a service offering.'}, u'storagepool': {u'name': u'updateStoragePool', u'related': [u'cancelStorageMaintenance', u'createStoragePool', u'listStoragePools'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'cancelStorageMaintenance', u'updateStoragePool', u'createStoragePool', u'listStoragePools'], u'length': 255, u'type': u'uuid', u'description': u'the Id of the storage pool'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'comma-separated list of tags for the storage pool'}], u'requiredparams': [u'id'], u'description': u'Updates a storage pool.'}, u'hypervisorcapabilities': {u'name': u'updateHypervisorCapabilities', u'related': [], u'isasync': False, u'params': [{u'name': u'securitygroupenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'set true to enable security group for this hypervisor.'}, {u'name': u'maxguestslimit', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'the max number of Guest VMs per host for this hypervisor.'}, {u'name': u'id', u'required': False, u'related': [u'listHypervisorCapabilities'], u'length': 255, u'type': u'uuid', u'description': u'ID of the hypervisor capability'}], u'requiredparams': [], u'description': u'Updates a hypervisor capabilities.'}, u'template': {u'name': u'updateTemplate', u'related': [u'registerIso', u'copyIso', u'updateIso', u'listIsos'], u'isasync': False, u'params': [{u'name': u'bootable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if image is bootable, false otherwise'}, {u'name': u'passwordenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the image supports the password reset feature; default is false'}, {u'name': u'format', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the format for the image'}, {u'name': u'ostypeid', u'required': False, u'related': [u'listOsTypes'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the OS type that best represents the OS of this image.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the image file'}, {u'name': u'id', u'required': True, u'related': [u'registerIso', u'updateTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the image file'}, {u'name': u'sortkey', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'sort key of the template, integer'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the display text of the image'}], u'requiredparams': [u'id'], u'description': u'Updates attributes of a template.'}, u'defaultnicforvirtualmachine': {u'name': u'updateDefaultNicForVirtualMachine', u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'nicid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'NIC ID'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'Virtual Machine ID'}], u'requiredparams': [u'nicid', u'virtualmachineid'], u'description': u'Changes the default NIC on a VM'}, u'traffictype': {u'name': u'updateTrafficType', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateTrafficType'], u'length': 255, u'type': u'uuid', u'description': u'traffic type id'}, {u'name': u'xennetworklabel', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The network name label of the physical device dedicated to this traffic on a XenServer host'}, {u'name': u'vmwarenetworklabel', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The network name label of the physical device dedicated to this traffic on a VMware host'}, {u'name': u'kvmnetworklabel', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The network name label of the physical device dedicated to this traffic on a KVM host'}], u'requiredparams': [u'id'], u'description': u'Updates traffic type of a physical network'}, u'host': {u'name': u'updateHost', u'related': [u'listHosts'], u'isasync': False, u'params': [{u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Change resource state of host, valid values are [Enable, Disable]. Operation may failed if host in states not allowing Enable/Disable'}, {u'name': u'oscategoryid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the id of Os category to update the host with'}, {u'name': u'hosttags', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list of tags to be added to the host'}, {u'name': u'id', u'required': True, u'related': [u'updateHost', u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the host to update'}, {u'name': u'url', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the new uri for the secondary storage: nfs://host/path'}], u'requiredparams': [u'id'], u'description': u'Updates a host.'}, u'user': {u'name': u'updateUser', u'related': [u'disableUser', u'lockUser', u'listUsers', u'enableUser', u'createUser'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'disableUser', u'lockUser', u'listUsers', u'enableUser', u'createUser', u'updateUser'], u'length': 255, u'type': u'uuid', u'description': u'User uuid'}, {u'name': u'timezone', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.'}, {u'name': u'email', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'email'}, {u'name': u'usersecretkey', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The secret key for the user. Must be specified with userApiKey'}, {u'name': u'username', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Unique username'}, {u'name': u'firstname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'first name'}, {u'name': u'lastname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'last name'}, {u'name': u'password', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Hashed password (default is MD5). If you wish to use any other hasing algorithm, you would need to write a custom authentication adapter'}, {u'name': u'userapikey', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The API key for the user. Must be specified with userSecretKey'}], u'requiredparams': [u'id'], u'description': u'Updates a user account'}, u'vpc': {u'name': u'updateVPC', u'related': [u'restartVPC', u'listVPCs'], u'isasync': True, u'params': [{u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the VPC'}, {u'name': u'id', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs'], u'length': 255, u'type': u'uuid', u'description': u'the id of the VPC'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the VPC'}], u'requiredparams': [], u'description': u'Updates a VPC'}, u'resourcecount': {u'name': u'updateResourceCount', u'related': [], u'isasync': False, u'params': [{u'name': u'resourcetype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Type of resource to update. If specifies valid values are 0, 1, 2, 3, and 4. If not specified will update all resource counts0 - Instance. Number of instances a user can create. 1 - IP. Number of public IP addresses a user can own. 2 - Volume. Number of disk volumes a user can create.3 - Snapshot. Number of snapshots a user can create.4 - Template. Number of templates that a user can register/create.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Update resource limits for project'}, {u'name': u'domainid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'If account parameter specified then updates resource counts for a specified account in this domain else update resource counts for all accounts & child domains in specified domain.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Update resource count for a specified account. Must be used with the domainId parameter.'}], u'requiredparams': [u'domainid'], u'description': u'Recalculate and update resource count for an account or domain.'}, u'storagenetworkiprange': {u'name': u'updateStorageNetworkIpRange', u'related': [], u'isasync': True, u'params': [{u'name': u'endip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IP address'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Optional. the vlan the ip range sits on'}, {u'name': u'netmask', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask for storage network'}, {u'name': u'id', u'required': True, u'related': [u'updateStorageNetworkIpRange'], u'length': 255, u'type': u'uuid', u'description': u'UUID of storage network ip range'}, {u'name': u'startip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the beginning IP address'}], u'requiredparams': [u'id'], u'description': u'Update a Storage network IP range, only allowed when no IPs in this range have been allocated.'}, u'configuration': {u'name': u'updateConfiguration', u'related': [u'listConfigurations'], u'isasync': False, u'params': [{u'name': u'value', u'required': False, u'related': [], u'length': 4095, u'type': u'string', u'description': u'the value of the configuration'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the configuration'}], u'requiredparams': [u'name'], u'description': u'Updates a configuration.'}, u'templatepermissions': {u'name': u'updateTemplatePermissions', u'related': [], u'isasync': False, u'params': [{u'name': u'isfeatured', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true for featured template/iso, false otherwise'}, {u'name': u'isextractable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template/iso is extractable, false other wise. Can be set only by root admin'}, {u'name': u'projectids', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'a comma delimited list of projects. If specified, "op" parameter has to be passed in.'}, {u'name': u'op', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'permission operator (add, remove, reset)'}, {u'name': u'id', u'required': True, u'related': [u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the template ID'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true for public template/iso, false for private templates/isos'}, {u'name': u'accounts', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'a comma delimited list of accounts. If specified, "op" parameter has to be passed in.'}], u'requiredparams': [u'id'], u'description': u'Updates a template visibility permissions. A public template is visible to all accounts within the same domain. A private template is visible only to the owner of the template. A priviledged template is a private template with account permissions added. Only accounts specified under the template permissions are visible to them.'}, u'autoscalevmprofile': {u'name': u'updateAutoScaleVmProfile', u'related': [u'listAutoScaleVmProfiles'], u'isasync': True, u'params': [{u'name': u'expungevmgraceperiod', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the time allowed for existing connections to get closed before a vm is destroyed'}, {u'name': u'autoscaleuserid', u'required': False, u'related': [u'lockUser', u'listUsers', u'enableUser', u'createUser'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the user used to launch and destroy the VMs'}, {u'name': u'templateid', u'required': False, u'related': [u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the template of the auto deployed virtual machine'}, {u'name': u'id', u'required': True, u'related': [u'updateAutoScaleVmProfile', u'listAutoScaleVmProfiles'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale vm profile'}, {u'name': u'counterparam', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'counterparam list. Example: counterparam[0].name=snmpcommunity&counterparam[0].value=public&counterparam[1].name=snmpport&counterparam[1].value=161'}], u'requiredparams': [u'id'], u'description': u'Updates an existing autoscale vm profile.'}, u'account': {u'name': u'updateAccount', u'related': [u'markDefaultZoneForAccount', u'listAccounts', u'lockAccount'], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount'], u'length': 255, u'type': u'uuid', u'description': u'Account id'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the domain where the account exists'}, {u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"Network domain for the account's networks; empty string will update domainName with NULL value"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the current account name'}, {u'name': u'accountdetails', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'details for account used to store specific parameters'}, {u'name': u'newname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'new name for the account'}], u'requiredparams': [u'newname'], u'description': u'Updates account information for the authenticated user'}, u'networkoffering': {u'name': u'updateNetworkOffering', u'related': [], u'isasync': False, u'params': [{u'name': u'sortkey', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'sort key of the network offering, integer'}, {u'name': u'id', u'required': False, u'related': [u'updateNetworkOffering'], u'length': 255, u'type': u'uuid', u'description': u'the id of the network offering'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the network offering'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the network offering'}, {u'name': u'availability', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the availability of network offering. Default value is Required for Guest Virtual network offering; Optional for Guest Direct network offering'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'update state for the network offering'}], u'requiredparams': [], u'description': u'Updates a network offering.'}, u'vpncustomergateway': {u'name': u'updateVpnCustomerGateway', u'related': [u'createVpnCustomerGateway'], u'isasync': True, u'params': [{u'name': u'ikelifetime', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'Lifetime of phase 1 VPN connection to the customer gateway, in seconds'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the domain ID associated with the gateway. If used with the account parameter returns the gateway associated with the account for the specified domain.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of this customer gateway'}, {u'name': u'id', u'required': True, u'related': [u'updateVpnCustomerGateway', u'createVpnCustomerGateway'], u'length': 255, u'type': u'uuid', u'description': u'id of customer gateway'}, {u'name': u'esplifetime', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'Lifetime of phase 2 VPN connection to the customer gateway, in seconds'}, {u'name': u'ikepolicy', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'IKE policy of the customer gateway'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account associated with the gateway. Must be used with the domainId parameter.'}, {u'name': u'esppolicy', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'ESP policy of the customer gateway'}, {u'name': u'gateway', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'public ip address id of the customer gateway'}, {u'name': u'ipsecpsk', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'IPsec Preshared-Key of the customer gateway'}, {u'name': u'dpd', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'If DPD is enabled for VPN connection'}, {u'name': u'cidrlist', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'guest cidr of the customer gateway'}], u'requiredparams': [u'id', u'ikepolicy', u'esppolicy', u'gateway', u'ipsecpsk', u'cidrlist'], u'description': u'Update site to site vpn customer gateway'}, u'region': {u'name': u'updateRegion', u'related': [u'addRegion', u'listRegions'], u'isasync': False, u'params': [{u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'updates region with this name'}, {u'name': u'endpoint', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'updates region with this end point'}, {u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Id of region to update'}], u'requiredparams': [u'id'], u'description': u'Updates a region'}, u'project': {u'name': u'updateProject', u'related': [u'createProject', u'listProjectAccounts', u'activateProject'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to be modified'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'display text of the project'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'new Admin account for the project'}], u'requiredparams': [u'id'], u'description': u'Updates a project'}, u'physicalnetwork': {u'name': u'updatePhysicalNetwork', u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'isasync': True, u'params': [{u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the VLAN for the physical network'}, {u'name': u'id', u'required': True, u'related': [u'listPhysicalNetworks', u'updatePhysicalNetwork', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'physical network id'}, {u'name': u'networkspeed', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the speed for the physical network[1G/10G]'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'Tag the physical network'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Enabled/Disabled'}], u'requiredparams': [u'id'], u'description': u'Updates a physical network'}, u'iso': {u'name': u'updateIso', u'related': [u'listIsos'], u'isasync': False, u'params': [{u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the image file'}, {u'name': u'id', u'required': True, u'related': [u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the image file'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the display text of the image'}, {u'name': u'format', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the format for the image'}, {u'name': u'sortkey', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'sort key of the template, integer'}, {u'name': u'ostypeid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the OS type that best represents the OS of this image.'}, {u'name': u'passwordenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the image supports the password reset feature; default is false'}, {u'name': u'bootable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if image is bootable, false otherwise'}], u'requiredparams': [u'id'], u'description': u'Updates an ISO file.'}, u'networkserviceprovider': {u'name': u'updateNetworkServiceProvider', u'related': [], u'isasync': True, u'params': [{u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Enabled/Disabled/Shutdown the physical network service provider'}, {u'name': u'id', u'required': True, u'related': [u'updateNetworkServiceProvider'], u'length': 255, u'type': u'uuid', u'description': u'network service provider id'}, {u'name': u'servicelist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the list of services to be enabled for this physical network service provider'}], u'requiredparams': [u'id'], u'description': u'Updates a network serviceProvider of a physical network'}, u'autoscalevmgroup': {u'name': u'updateAutoScaleVmGroup', u'related': [], u'isasync': True, u'params': [{u'name': u'scaledownpolicyids', u'required': False, u'related': [u'updateAutoScalePolicy'], u'length': 255, u'type': u'list', u'description': u'list of scaledown autoscale policies'}, {u'name': u'interval', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the frequency at which the conditions have to be evaluated'}, {u'name': u'minmembers', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the minimum number of members in the vmgroup, the number of instances in the vm group will be equal to or more than this number.'}, {u'name': u'maxmembers', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'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.'}, {u'name': u'id', u'required': True, u'related': [u'updateAutoScaleVmGroup'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale group'}, {u'name': u'scaleuppolicyids', u'required': False, u'related': [u'updateAutoScalePolicy'], u'length': 255, u'type': u'list', u'description': u'list of scaleup autoscale policies'}], u'requiredparams': [u'id'], u'description': u'Updates an existing autoscale vm group.'}}, u'disable': {u'account': {u'name': u'disableAccount', u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount'], u'isasync': True, u'params': [{u'name': u'lock', u'required': True, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'If true, only lock the account; else disable the account'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Disables specified account.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'Disables specified account in this domain.'}, {u'name': u'id', u'required': False, u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount', u'disableAccount'], u'length': 255, u'type': u'uuid', u'description': u'Account id'}], u'requiredparams': [u'lock'], u'description': u'Disables an account'}, u'autoscalevmgroup': {u'name': u'disableAutoScaleVmGroup', u'related': [u'listAutoScaleVmGroups', u'createAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listAutoScaleVmGroups', u'createAutoScaleVmGroup', u'disableAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale group'}], u'requiredparams': [u'id'], u'description': u'Disables an AutoScale Vm Group'}, u'cisconexusvsm': {u'name': u'disableCiscoNexusVSM', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'disableCiscoNexusVSM'], u'length': 255, u'type': u'uuid', u'description': u'Id of the Cisco Nexus 1000v VSM device to be deleted'}], u'requiredparams': [u'id'], u'description': u'disable a Cisco Nexus VSM device'}, u'staticnat': {u'name': u'disableStaticNat', u'related': [], u'isasync': True, u'params': [{u'name': u'ipaddressid', u'required': True, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'the public IP address id for which static nat feature is being disableed'}], u'requiredparams': [u'ipaddressid'], u'description': u'Disables static rule for given ip address'}, u'user': {u'name': u'disableUser', u'related': [u'lockUser', u'listUsers', u'enableUser', u'createUser'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'disableUser', u'lockUser', u'listUsers', u'enableUser', u'createUser'], u'length': 255, u'type': u'uuid', u'description': u'Disables user by user ID.'}], u'requiredparams': [u'id'], u'description': u'Disables a user account'}}, u'detach': {u'volume': {u'name': u'detachVolume', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': False, u'related': [u'detachVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}, {u'name': u'deviceid', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'the device ID on the virtual machine where volume is detached from'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'listVirtualMachines'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine where the volume is detached from'}], u'requiredparams': [], u'description': u'Detaches a disk volume from a virtual machine.'}, u'iso': {u'name': u'detachIso', u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'virtualmachineid', u'required': True, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}], u'requiredparams': [u'virtualmachineid'], u'description': u'Detaches any ISO file (if any) currently attached to a virtual machine.'}}, u'generate': {u'usagerecords': {u'name': u'generateUsageRecords', u'related': [], u'isasync': False, u'params': [{u'name': u'enddate', u'required': True, u'related': [], u'length': 255, u'type': u'date', u'description': u'End date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-03.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'List events for the specified domain.'}, {u'name': u'startdate', u'required': True, u'related': [], u'length': 255, u'type': u'date', u'description': u'Start date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-01.'}], u'requiredparams': [u'enddate', u'startdate'], u'description': u'Generates usage records. This will generate records only if there any records to be generated, i.e if the scheduled usage job was not run or failed'}}, u'change': {u'serviceforvirtualmachine': {u'name': u'changeServiceForVirtualMachine', u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}, {u'name': u'serviceofferingid', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings'], u'length': 255, u'type': u'uuid', u'description': u'the service offering ID to apply to the virtual machine'}], u'requiredparams': [u'id', u'serviceofferingid'], u'description': u'Changes the service offering for a virtual machine. The virtual machine must be in a "Stopped" state for this command to take effect.'}, u'serviceforsystemvm': {u'name': u'changeServiceForSystemVm', u'related': [u'rebootSystemVm', u'listSystemVms'], u'isasync': False, u'params': [{u'name': u'serviceofferingid', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings', u'createServiceOffering'], u'length': 255, u'type': u'uuid', u'description': u'the service offering ID to apply to the system vm'}, {u'name': u'id', u'required': True, u'related': [u'rebootSystemVm', u'listSystemVms', u'changeServiceForSystemVm'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the system vm'}], u'requiredparams': [u'serviceofferingid', u'id'], u'description': u'Changes the service offering for a system vm (console proxy or secondary storage). The system vm must be in a "Stopped" state for this command to take effect.'}, u'serviceforrouter': {u'name': u'changeServiceForRouter', u'related': [u'destroyRouter', u'rebootRouter', u'startRouter'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'changeServiceForRouter', u'destroyRouter', u'rebootRouter', u'startRouter'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the router'}, {u'name': u'serviceofferingid', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings', u'createServiceOffering', u'updateServiceOffering'], u'length': 255, u'type': u'uuid', u'description': u'the service offering ID to apply to the domain router'}], u'requiredparams': [u'id', u'serviceofferingid'], u'description': u'Upgrades domain router to a new service offering'}}, u'reset': {u'apilimit': {u'name': u'resetApiLimit', u'related': [], u'isasync': False, u'params': [{u'name': u'account', u'required': False, u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the acount whose limit to be reset'}], u'requiredparams': [], u'description': u'Reset api count'}, u'sshkeyforvirtualmachine': {u'name': u'resetSSHKeyForVirtualMachine', u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'an optional project for the ssh key'}, {u'name': u'keypair', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the ssh key pair used to login to the virtual machine'}, {u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the ssh key. Must be used with domainId.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used.'}], u'requiredparams': [u'keypair', u'id'], u'description': u'Resets the SSH Key for virtual machine. The virtual machine must be in a "Stopped" state. [async]'}, u'passwordforvirtualmachine': {u'name': u'resetPasswordForVirtualMachine', u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}], u'requiredparams': [u'id'], u'description': u'Resets the password for virtual machine. The virtual machine must be in a "Stopped" state and the template must already support this feature for this command to take effect. [async]'}, u'vpnconnection': {u'name': u'resetVpnConnection', u'related': [u'listVpnConnections'], u'isasync': True, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for connection. Must be used with domainId.'}, {u'name': u'id', u'required': True, u'related': [u'listVpnConnections', u'resetVpnConnection'], u'length': 255, u'type': u'uuid', u'description': u'id of vpn connection'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for connection. If the account parameter is used, domainId must also be used.'}], u'requiredparams': [u'id'], u'description': u'Reset site to site vpn connection'}}, u'register': {u'userkeys': {u'name': u'registerUserKeys', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'lockUser', u'listUsers', u'enableUser', u'createUser'], u'length': 255, u'type': u'uuid', u'description': u'User id'}], u'requiredparams': [u'id'], u'description': u'This command allows a user to register for the developer API, returning a secret key and an API key. This request is made through the integration API port, so it is a privileged command and must be made on behalf of a user. It is up to the implementer just how the username and password are entered, and then how that translates to an integration API request. Both secret key and API key should be returned to the user'}, u'iso': {u'name': u'registerIso', u'related': [u'copyIso', u'updateIso', u'listIsos'], u'isasync': False, u'params': [{u'name': u'ostypeid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the OS Type that best represents the OS of this ISO. If the iso is bootable this parameter needs to be passed'}, {u'name': u'checksum', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the MD5 checksum value of this ISO'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the ISO'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId. If the account parameter is used, domainId must also be used.'}, {u'name': u'bootable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this ISO is bootable. If not passed explicitly its assumed to be true'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts'], u'length': 255, u'type': u'uuid', u'description': u'Register iso for the project'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if you want to register the ISO to be publicly available to all users, false otherwise.'}, {u'name': u'zoneid', u'required': True, u'related': [u'listZones'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone you wish to register the ISO to.'}, {u'name': u'isextractable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the iso or its derivatives are extractable; default is false'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the display text of the ISO. This is usually used for display purposes.'}, {u'name': u'isfeatured', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if you want this ISO to be featured'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL to where the ISO is currently being hosted'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account name. Must be used with domainId.'}], u'requiredparams': [u'name', u'zoneid', u'displaytext', u'url'], u'description': u'Registers an existing ISO into the CloudStack Cloud.'}, u'sshkeypair': {u'name': u'registerSSHKeyPair', u'related': [u'createSSHKeyPair', u'listSSHKeyPairs'], u'isasync': False, u'params': [{u'name': u'publickey', u'required': True, u'related': [], u'length': 5120, u'type': u'string', u'description': u'Public key material of the keypair'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the ssh key. If the account parameter is used, domainId must also be used.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Name of the keypair'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'an optional project for the ssh key'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the ssh key. Must be used with domainId.'}], u'requiredparams': [u'publickey', u'name'], u'description': u'Register a public key in a keypair under a certain name'}, u'template': {u'name': u'registerTemplate', u'related': [u'listTemplates', u'registerIso', u'updateTemplate', u'prepareTemplate', u'copyIso', u'updateIso', u'listIsos'], u'isasync': False, u'params': [{u'name': u'isextractable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template or its derivatives are extractable; default is false'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone the template is to be hosted on'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId. If the account parameter is used, domainId must also be used.'}, {u'name': u'checksum', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the MD5 checksum value of this template'}, {u'name': u'templatetag', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the tag for this template.'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template is available to all accounts; default is true'}, {u'name': u'passwordenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template supports the password reset feature; default is false'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the display text of the template. This is usually used for display purposes.'}, {u'name': u'sshkeyenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template supports the sshkey upload feature; default is false'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'Register template for the project'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the template'}, {u'name': u'isfeatured', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this template is a featured template, false otherwise'}, {u'name': u'format', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the format for the template. Possible values include QCOW2, RAW, and VHD.'}, {u'name': u'requireshvm', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this template requires HVM'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional accountName. Must be used with domainId.'}, {u'name': u'ostypeid', u'required': True, u'related': [u'listOsTypes'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the OS Type that best represents the OS of this template.'}, {u'name': u'hypervisor', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the target hypervisor for the template'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL of where the template is hosted. Possible URL include http:// and https://'}, {u'name': u'bits', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'32 or 64 bits support. 64 by default'}, {u'name': u'details', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'Template details in key/value pairs.'}], u'requiredparams': [u'zoneid', u'displaytext', u'name', u'format', u'ostypeid', u'hypervisor', u'url'], u'description': u'Registers an existing template into the CloudStack cloud. '}}, u'list': {u'instancegroups': {u'name': u'listInstanceGroups', u'related': [u'updateInstanceGroup', u'createInstanceGroup'], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listInstanceGroups', u'updateInstanceGroup', u'createInstanceGroup'], u'length': 255, u'type': u'uuid', u'description': u'list instance groups by ID'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list instance groups by name'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}], u'requiredparams': [], u'description': u'Lists vm groups'}, u'physicalnetworks': {u'name': u'listPhysicalNetworks', u'related': [], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the physical network'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listPhysicalNetworks'], u'length': 255, u'type': u'uuid', u'description': u'list physical network by id'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'search by name'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists physical networks'}, u'networks': {u'name': u'listNetworks', u'related': [u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks'], u'isasync': False, u'params': [{u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'issystem', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if network is system, false otherwise'}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'List networks by VPC'}, {u'name': u'acltype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list networks by ACL (access control list) type. Supported values are Account and Domain'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'specifyipranges', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if need to list only networks which support specifying ip ranges'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID of the network'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'restartrequired', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list networks by restartRequired'}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the type of the network. Supported values are: Isolated and Shared'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'list networks by physical network id'}, {u'name': u'supportedservices', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list networks supporting certain services'}, {u'name': u'traffictype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'type of the traffic'}, {u'name': u'id', u'required': False, u'related': [u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'list networks by id'}, {u'name': u'canusefordeploy', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list networks available for vm deployment'}, {u'name': u'forvpc', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'the network belongs to vpc'}], u'requiredparams': [], u'description': u'Lists all available networks.'}, u'capabilities': {u'name': u'listCapabilities', u'related': [], u'isasync': False, u'params': [], u'requiredparams': [], u'description': u'Lists capabilities'}, u'clusters': {u'name': u'listClusters', u'related': [u'updateCluster'], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'listClusters', u'updateCluster'], u'length': 255, u'type': u'uuid', u'description': u'lists clusters by the cluster ID'}, {u'name': u'managedstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'whether this cluster is managed by cloudstack'}, {u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists clusters by hypervisor type'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists clusters by allocation state'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'lists clusters by Zone ID'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists clusters by the cluster name'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'clustertype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists clusters by cluster type'}, {u'name': u'showcapacities', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'flag to display the capacity of the clusters'}, {u'name': u'podid', u'required': False, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'lists clusters by Pod ID'}], u'requiredparams': [], u'description': u'Lists clusters.'}, u'resourcelimits': {u'name': u'listResourceLimits', u'related': [u'updateResourceLimit'], u'isasync': False, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'resourcetype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Type of resource to update. Values are 0, 1, 2, 3, and 4. 0 - Instance. Number of instances a user can create. 1 - IP. Number of public IP addresses a user can own. 2 - Volume. Number of disk volumes a user can create.3 - Snapshot. Number of snapshots a user can create.4 - Template. Number of templates that a user can register/create.'}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'Lists resource limits by ID.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}], u'requiredparams': [], u'description': u'Lists resource limits.'}, u'firewallrules': {u'name': u'listFirewallRules', u'related': [u'createEgressFirewallRule', u'createFirewallRule', u'listEgressFirewallRules'], u'isasync': False, u'params': [{u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'id', u'required': False, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'Lists rule with the specified ID.'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'ipaddressid', u'required': False, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'the id of IP address of the firwall services'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}], u'requiredparams': [], u'description': u'Lists all firewall rules for an IP address.'}, u'supportednetworkservices': {u'name': u'listSupportedNetworkServices', u'related': [], u'isasync': False, u'params': [{u'name': u'service', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'network service name to list providers and capabilities of'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'provider', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'network service provider name'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists all network services provided by CloudStack or for the given Provider.'}, u'loadbalancerrules': {u'name': u'listLoadBalancerRules', u'related': [u'createLoadBalancerRule', u'updateLoadBalancerRule'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the availability zone ID'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine of the load balancer rule'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'id', u'required': False, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'publicipid', u'required': False, u'related': [u'restartNetwork', u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'the public IP address id of the load balancer rule '}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the load balancer rule'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}], u'requiredparams': [], u'description': u'Lists load balancer rules.'}, u'autoscalepolicies': {u'name': u'listAutoScalePolicies', u'related': [u'createAutoScalePolicy', u'updateAutoScalePolicy'], u'isasync': False, u'params': [{u'name': u'action', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the action to be executed if all the conditions evaluate to true for the specified duration.'}, {u'name': u'id', u'required': False, u'related': [u'createAutoScalePolicy', u'updateAutoScalePolicy', u'listAutoScalePolicies'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale policy'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'vmgroupid', u'required': False, u'related': [u'createAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale vm group'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'conditionid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the condition of the policy'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists autoscale policies.'}, u'niciranvpdevices': {u'name': u'listNiciraNvpDevices', u'related': [u'addNiciraNvpDevice'], u'isasync': False, u'params': [{u'name': u'nvpdeviceid', u'required': False, u'related': [u'addNiciraNvpDevice', u'listNiciraNvpDevices'], u'length': 255, u'type': u'uuid', u'description': u'nicira nvp device ID'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists Nicira NVP devices'}, u'f5loadbalancernetworks': {u'name': u'listF5LoadBalancerNetworks', u'related': [u'createNetwork', u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'lbdeviceid', u'required': True, u'related': [u'configureF5LoadBalancer', u'addF5LoadBalancer', u'listF5LoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'f5 load balancer device ID'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [u'lbdeviceid'], u'description': u'lists network that are using a F5 load balancer device'}, u'templatepermissions': {u'name': u'listTemplatePermissions', u'related': [u'listIsoPermissions'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'listIsoPermissions', u'listTemplatePermissions'], u'length': 255, u'type': u'uuid', u'description': u'the template ID'}], u'requiredparams': [u'id'], u'description': u'List template visibility and all accounts that have permissions to view this template.'}, u'projects': {u'name': u'listProjects', u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List projects by tags (key/value pairs)'}, {u'name': u'id', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list projects by project ID'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list projects by name'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list projects by state'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list projects by display text'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}], u'requiredparams': [], u'description': u'Lists projects and provides detailed information for listed projects'}, u'systemvms': {u'name': u'listSystemVms', u'related': [u'rebootSystemVm'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID of the system VM'}, {u'name': u'hostid', u'required': False, u'related': [u'addHost', u'updateHost', u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'the host ID of the system VM'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the state of the system VM'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'storageid', u'required': False, u'related': [u'cancelStorageMaintenance'], u'length': 255, u'type': u'uuid', u'description': u"the storage ID where vm's volumes belong to"}, {u'name': u'systemvmtype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the system VM type. Possible types are "consoleproxy" and "secondarystoragevm".'}, {u'name': u'podid', u'required': False, u'related': [u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID of the system VM'}, {u'name': u'id', u'required': False, u'related': [u'rebootSystemVm', u'listSystemVms'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the system VM'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the system VM'}], u'requiredparams': [], u'description': u'List system virtual machines.'}, u'portforwardingrules': {u'name': u'listPortForwardingRules', u'related': [u'listIpForwardingRules', u'createPortForwardingRule'], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'id', u'required': False, u'related': [u'listIpForwardingRules', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'Lists rule with the specified ID.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'ipaddressid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the id of IP address of the port forwarding services'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}], u'requiredparams': [], u'description': u'Lists all port forwarding rules for an IP address.'}, u'hypervisors': {u'name': u'listHypervisors', u'related': [], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the zone id for listing hypervisors.'}], u'requiredparams': [], u'description': u'List hypervisors'}, u'publicipaddresses': {u'name': u'listPublicIpAddresses', u'related': [u'restartNetwork', u'associateIpAddress'], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'lists all public IP addresses by Zone ID'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'allocatedonly', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'limits search results to allocated public IP addresses'}, {u'name': u'id', u'required': False, u'related': [u'restartNetwork', u'listPublicIpAddresses', u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'lists ip address by id'}, {u'name': u'forloadbalancing', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list only ips used for load balancing'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'isstaticnat', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list only static nat ip addresses'}, {u'name': u'issourcenat', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list only source nat ip addresses'}, {u'name': u'vlanid', u'required': False, u'related': [u'listVlanIpRanges'], u'length': 255, u'type': u'uuid', u'description': u'lists all public IP addresses by VLAN ID'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'ipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists the specified IP address'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'lists all public IP addresses by physical network id'}, {u'name': u'associatednetworkid', u'required': False, u'related': [u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'lists all public IP addresses associated to the network specified'}, {u'name': u'forvirtualnetwork', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'the virtual network for the IP address'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'List ips belonging to the VPC'}], u'requiredparams': [], u'description': u'Lists all public ip addresses'}, u'vpngateways': {u'name': u'listVpnGateways', u'related': [u'createVpnGateway'], u'isasync': False, u'params': [{u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'id', u'required': False, u'related': [u'createVpnGateway', u'listVpnGateways'], u'length': 255, u'type': u'uuid', u'description': u'id of the vpn gateway'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'id of vpc'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}], u'requiredparams': [], u'description': u'Lists site 2 site vpn gateways'}, u'loadbalancerruleinstances': {u'name': u'listLoadBalancerRuleInstances', u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'applied', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if listing all virtual machines currently applied to the load balancer rule; default is true'}, {u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}], u'requiredparams': [u'id'], u'description': u'List all virtual machine instances that are assigned to a load balancer rule.'}, u'hosts': {u'name': u'listHosts', u'related': [], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'podid', u'required': False, u'related': [u'updatePod'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID for the host'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the state of the host'}, {u'name': u'resourcestate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list hosts by resource state. Resource state represents current state determined by admin of host, valule can be one of [Enabled, Disabled, Unmanaged, PrepareForMaintenance, ErrorInMaintenance, Maintenance, Error]'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the host'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the host'}, {u'name': u'virtualmachineid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'lists hosts in the same cluster as this VM and flag hosts with enough CPU/RAm to host this VM'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'lists hosts existing in particular cluster'}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the host type'}, {u'name': u'id', u'required': False, u'related': [u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'the id of the host'}, {u'name': u'details', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'comma separated list of host details requested, value can be a list of [ min, all, capacity, events, stats]'}, {u'name': u'hahost', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, list only hosts dedicated to HA'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists hosts.'}, u'pools': {u'name': u'listPools', u'related': [], u'isasync': False, u'params': [], u'requiredparams': [], u'description': u'List Pool'}, u'counters': {u'name': u'listCounters', u'related': [], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'source', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Source of the counter.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'id', u'required': False, u'related': [u'listCounters'], u'length': 255, u'type': u'uuid', u'description': u'ID of the Counter.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Name of the counter.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'List the counters'}, u'configurations': {u'name': u'listConfigurations', u'related': [], u'isasync': False, u'params': [{u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists configuration by name'}, {u'name': u'category', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists configurations by category'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists all configurations.'}, u'usagerecords': {u'name': u'listUsageRecords', u'related': [], u'isasync': False, u'params': [{u'name': u'enddate', u'required': True, u'related': [], u'length': 255, u'type': u'date', u'description': u'End date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-03.'}, {u'name': u'startdate', u'required': True, u'related': [], u'length': 255, u'type': u'date', u'description': u'Start date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-01.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'List usage records for the specified usage type'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject'], u'length': 255, u'type': u'uuid', u'description': u'List usage records for specified project'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List usage records for the specified user.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'List usage records for the specified domain.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'accountid', u'required': False, u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount'], u'length': 255, u'type': u'uuid', u'description': u'List usage records for the specified account'}], u'requiredparams': [u'enddate', u'startdate'], u'description': u'Lists usage records for accounts'}, u'storagepools': {u'name': u'listStoragePools', u'related': [u'cancelStorageMaintenance'], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the storage pool'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'path', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the storage pool path'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list storage pools belongig to the specific cluster'}, {u'name': u'id', u'required': False, u'related': [u'cancelStorageMaintenance', u'listStoragePools'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the storage pool'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'ipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the IP address for the storage pool'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the storage pool'}, {u'name': u'podid', u'required': False, u'related': [u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID for the storage pool'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists storage pools.'}, u'vpncustomergateways': {u'name': u'listVpnCustomerGateways', u'related': [u'updateVpnCustomerGateway', u'createVpnCustomerGateway'], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'updateVpnCustomerGateway', u'createVpnCustomerGateway', u'listVpnCustomerGateways'], u'length': 255, u'type': u'uuid', u'description': u'id of the customer gateway'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}], u'requiredparams': [], u'description': u'Lists site to site vpn customer gateways'}, u'zones': {u'name': u'listZones', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'listZones'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone'}, {u'name': u'available', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if you want to retrieve all available Zones. False if you only want to return the Zones from which you have at least one VM. Default is false.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the zone'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the domain associated with the zone'}, {u'name': u'showcapacities', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'flag to display the capacity of the zones'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists zones'}, u'serviceofferings': {u'name': u'listServiceOfferings', u'related': [u'updateHypervisorCapabilities'], u'isasync': False, u'params': [{u'name': u'systemvmtype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the system VM type. Possible types are "consoleproxy", "secondarystoragevm" or "domainrouter".'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the domain associated with the service offering'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the service offering'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine. Pass this in if you want to see the available service offering that a virtual machine can be changed to.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'issystem', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'is this a system vm offering'}, {u'name': u'id', u'required': False, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings'], u'length': 255, u'type': u'uuid', u'description': u'ID of the service offering'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists all available service offerings.'}, u'externalfirewalls': {u'name': u'listExternalFirewalls', u'related': [u'addExternalFirewall'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'zoneid', u'required': True, u'related': [u'listZones'], u'length': 255, u'type': u'uuid', u'description': u'zone Id'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [u'zoneid'], u'description': u'List external firewall appliances.'}, u'networkserviceproviders': {u'name': u'listNetworkServiceProviders', u'related': [u'addNetworkServiceProvider', u'listTrafficTypes', u'updateNetworkServiceProvider'], u'isasync': False, u'params': [{u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list providers by state'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list providers by name'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'updatePhysicalNetwork', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists network serviceproviders for a given physical network.'}, u'capacity': {u'name': u'listCapacity', u'related': [], u'isasync': False, u'params': [{u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'lists capacity by type* CAPACITY_TYPE_MEMORY = 0* CAPACITY_TYPE_CPU = 1* CAPACITY_TYPE_STORAGE = 2* CAPACITY_TYPE_STORAGE_ALLOCATED = 3* CAPACITY_TYPE_VIRTUAL_NETWORK_PUBLIC_IP = 4* CAPACITY_TYPE_PRIVATE_IP = 5* CAPACITY_TYPE_SECONDARY_STORAGE = 6* CAPACITY_TYPE_VLAN = 7* CAPACITY_TYPE_DIRECT_ATTACHED_PUBLIC_IP = 8* CAPACITY_TYPE_LOCAL_STORAGE = 9.'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'lists capacity by the Cluster ID'}, {u'name': u'sortby', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Sort the results. Available values: Usage'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'fetchlatest', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'recalculate capacities and fetch the latest'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'lists capacity by the Zone ID'}, {u'name': u'podid', u'required': False, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'lists capacity by the Pod ID'}], u'requiredparams': [], u'description': u'Lists all the system wide capacities.'}, u'diskofferings': {u'name': u'listDiskOfferings', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'listDiskOfferings'], u'length': 255, u'type': u'uuid', u'description': u'ID of the disk offering'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the disk offering'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the domain of the disk offering.'}], u'requiredparams': [], u'description': u'Lists all available disk offerings.'}, u'lbstickinesspolicies': {u'name': u'listLBStickinessPolicies', u'related': [u'createLBStickinessPolicy'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'lbruleid', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [u'lbruleid'], u'description': u'Lists LBStickiness policies.'}, u'srxfirewallnetworks': {u'name': u'listSrxFirewallNetworks', u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'isasync': False, u'params': [{u'name': u'lbdeviceid', u'required': True, u'related': [u'addSrxFirewall'], u'length': 255, u'type': u'uuid', u'description': u'netscaler load balancer device ID'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [u'lbdeviceid'], u'description': u'lists network that are using SRX firewall device'}, u'securitygroups': {u'name': u'listSecurityGroups', u'related': [], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'id', u'required': False, u'related': [u'listSecurityGroups'], u'length': 255, u'type': u'uuid', u'description': u'list the security group by the id provided'}, {u'name': u'securitygroupname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists security groups by name'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'lists security groups by virtual machine id'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists security groups'}, u'conditions': {u'name': u'listConditions', u'related': [u'listCounters', u'createCounter'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'ID of the Condition.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'counterid', u'required': False, u'related': [u'listConditions', u'listCounters', u'createCounter'], u'length': 255, u'type': u'uuid', u'description': u'Counter-id of the condition.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'policyid', u'required': False, u'related': [u'createAutoScalePolicy', u'updateAutoScalePolicy'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the policy'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}], u'requiredparams': [], u'description': u'List Conditions for the specific user'}, u'swifts': {u'name': u'listSwifts', u'related': [u'addHost', u'updateHost', u'listHosts', u'listExternalLoadBalancers'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'the id of the swift'}], u'requiredparams': [], u'description': u'List Swift.'}, u'hypervisorcapabilities': {u'name': u'listHypervisorCapabilities', u'related': [], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listHypervisorCapabilities'], u'length': 255, u'type': u'uuid', u'description': u'ID of the hypervisor capability'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the hypervisor for which to restrict the search'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists all hypervisor capabilities.'}, u'tags': {u'name': u'listTags', u'related': [], u'isasync': False, u'params': [{u'name': u'resourceid', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by resource id'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'resourcetype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by resource type'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'key', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by key'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'customer', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by customer name'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'value', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by value'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'List resource tag(s)'}, u'routers': {u'name': u'listRouters', u'related': [u'changeServiceForRouter', u'stopRouter', u'destroyRouter', u'rebootRouter', u'startRouter'], u'isasync': False, u'params': [{u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the state of the router'}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'List networks by VPC'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'podid', u'required': False, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID of the router'}, {u'name': u'hostid', u'required': False, u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addSecondaryStorage', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers', u'prepareHostForMaintenance'], u'length': 255, u'type': u'uuid', u'description': u'the host ID of the router'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the router'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID of the router'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'id', u'required': False, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'addNicToVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'listLoadBalancerRuleInstances', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk router'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'suspendProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'networkid', u'required': False, u'related': [u'createNetwork', u'listNiciraNvpDeviceNetworks', u'updateNetwork', u'listF5LoadBalancerNetworks', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'list by network id'}, {u'name': u'forvpc', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true is passed for this parameter, list only VPC routers'}], u'requiredparams': [], u'description': u'List routers.'}, u'traffictypes': {u'name': u'listTrafficTypes', u'related': [u'addNetworkServiceProvider', u'updateNetworkServiceProvider'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [u'physicalnetworkid'], u'description': u'Lists traffic types of a given physical network.'}, u'projectinvitations': {u'name': u'listProjectInvitations', u'related': [], u'isasync': False, u'params': [{u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'activeonly', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, list only active invitations - having Pending state and ones that are not timed out yet'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list by project id'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list invitations by state'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'id', u'required': False, u'related': [u'listProjectInvitations'], u'length': 255, u'type': u'uuid', u'description': u'list invitations by id'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}], u'requiredparams': [], u'description': u'Lists projects and provides detailed information for listed projects'}, u'isos': {u'name': u'listIsos', u'related': [], u'isasync': False, u'params': [{u'name': u'bootable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the ISO is bootable, false otherwise'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list all isos by name'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'id', u'required': False, u'related': [u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'list ISO by id'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the ISO is publicly available to all users, false otherwise.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isofilter', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'possible values are "featured", "self", "selfexecutable","sharedexecutable","executable", and "community". * featured : templates that have been marked as featured and public. * self : templates that have been registered or created by the calling user. * selfexecutable : same as self, but only returns templates that can be used to deploy a new VM. * sharedexecutable : templates ready to be deployed that have been granted to the calling user by another user. * executable : templates that are owned by the calling user, or public templates, that can be used to deploy a VM. * community : templates that have been marked as public but not featured. * all : all templates (only usable by admins).'}, {u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the hypervisor for which to restrict the search'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'isready', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this ISO is ready to be deployed'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists all available ISO files.'}, u'users': {u'name': u'listUsers', u'related': [], u'isasync': False, u'params': [{u'name': u'username', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List user by the username'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'accounttype', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'List users by account type. Valid types include admin, domain-admin, read-only-admin, or user.'}, {u'name': u'id', u'required': False, u'related': [u'listUsers'], u'length': 255, u'type': u'uuid', u'description': u'List user by ID.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List users by state of the user account.'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists user accounts'}, u'sshkeypairs': {u'name': u'listSSHKeyPairs', u'related': [], u'isasync': False, u'params': [{u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'fingerprint', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'A public key fingerprint to look for'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'A key pair name to look for'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}], u'requiredparams': [], u'description': u'List registered keypairs'}, u'privategateways': {u'name': u'listPrivateGateways', u'related': [u'createPrivateGateway'], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'createPrivateGateway', u'listPrivateGateways'], u'length': 255, u'type': u'uuid', u'description': u'list private gateway by id'}, {u'name': u'ipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list gateways by ip address'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'list gateways by vpc'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list gateways by state'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list gateways by vlan'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}], u'requiredparams': [], u'description': u'List private gateways'}, u'usagetypes': {u'name': u'listUsageTypes', u'related': [], u'isasync': False, u'params': [], u'requiredparams': [], u'description': u'List Usage Types'}, u'domainchildren': {u'name': u'listDomainChildren', u'related': [u'createDomain'], u'isasync': False, u'params': [{u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list children domains by name'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list children domain by parent domain ID.'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'to return the entire tree, use the value "true". To return the first level children, use the value "false".'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists all children domains belonging to a specified domain'}, u'domains': {u'name': u'listDomains', u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'List domain by domain ID.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List domain by domain name.'}, {u'name': u'level', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'List domains by domain level.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}], u'requiredparams': [], u'description': u'Lists domains and provides detailed information for listed domains'}, u'externalloadbalancers': {u'name': u'listExternalLoadBalancers', u'related': [u'addHost', u'updateHost', u'listHosts'], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'zone Id'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists F5 external load balancer appliances added in a zone.'}, u'netscalerloadbalancers': {u'name': u'listNetscalerLoadBalancers', u'related': [], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'lbdeviceid', u'required': False, u'related': [u'listNetscalerLoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'netscaler load balancer device ID'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'lists netscaler load balancer devices'}, u's3s': {u'name': u'listS3s', u'related': [u'addS3'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists S3s'}, u'bigswitchvnsdevices': {u'name': u'listBigSwitchVnsDevices', u'related': [u'addBigSwitchVnsDevice'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'vnsdeviceid', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'bigswitch vns device ID'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}], u'requiredparams': [], u'description': u'Lists BigSwitch Vns devices'}, u'accounts': {u'name': u'listAccounts', u'related': [u'markDefaultZoneForAccount', u'lockAccount'], u'isasync': False, u'params': [{u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list accounts by state. Valid states are enabled, disabled, and locked.'}, {u'name': u'iscleanuprequired', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list accounts by cleanuprequred attribute (values are true or false)'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'accounttype', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'list accounts by account type. Valid account types are 1 (admin), 2 (domain-admin), and 0 (user).'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'id', u'required': False, u'related': [u'markDefaultZoneForAccount', u'listAccounts', u'lockAccount'], u'length': 255, u'type': u'uuid', u'description': u'list account by account ID'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list account by account name'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}], u'requiredparams': [], u'description': u'Lists accounts and provides detailed account information for listed accounts'}, u'networkdevice': {u'name': u'listNetworkDevice', u'related': [u'addNetworkDevice'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'networkdevicetype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Network device type, now supports ExternalDhcp, PxeServer, NetscalerMPXLoadBalancer, NetscalerVPXLoadBalancer, NetscalerSDXLoadBalancer, F5BigIpLoadBalancer, JuniperSRXFirewall'}, {u'name': u'networkdeviceparameterlist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'parameters for network device'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'List network devices'}, u'vlanipranges': {u'name': u'listVlanIpRanges', u'related': [], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'networkid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'network id of the VLAN IP range'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the domain ID with which the VLAN IP range is associated. If used with the account parameter, returns all VLAN IP ranges for that account in the specified domain.'}, {u'name': u'id', u'required': False, u'related': [u'listVlanIpRanges'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the VLAN IP range'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks'], u'length': 255, u'type': u'uuid', u'description': u'physical network id of the VLAN IP range'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'project who will own the VLAN'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account with which the VLAN IP range is associated. Must be used with the domainId parameter.'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ID or VID of the VLAN. Default is an "untagged" VLAN.'}, {u'name': u'podid', u'required': False, u'related': [u'updatePod'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID of the VLAN IP range'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID of the VLAN IP range'}, {u'name': u'forvirtualnetwork', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if VLAN is of Virtual type, false if Direct'}], u'requiredparams': [], u'description': u'Lists all VLAN IP ranges.'}, u'traffictypeimplementors': {u'name': u'listTrafficTypeImplementors', u'related': [], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'traffictype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Optional. The network traffic type, if specified, return its implementor. Otherwise, return all traffic types with their implementor'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists implementors of implementor of a network traffic type or implementors of all network traffic types'}, u'storagenetworkiprange': {u'name': u'listStorageNetworkIpRange', u'related': [u'updateStorageNetworkIpRange'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'optional parameter. Zone uuid, if specicied and both pod uuid and range uuid are absent, using it to search the range.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'id', u'required': False, u'related': [u'listStorageNetworkIpRange', u'updateStorageNetworkIpRange'], u'length': 255, u'type': u'uuid', u'description': u'optional parameter. Storaget network IP range uuid, if specicied, using it to search the range.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'podid', u'required': False, u'related': [u'updatePod'], u'length': 255, u'type': u'uuid', u'description': u'optional parameter. Pod uuid, if specicied and range uuid is absent, using it to search the range.'}], u'requiredparams': [], u'description': u'List a storage network IP range.'}, u'isopermissions': {u'name': u'listIsoPermissions', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'listIsoPermissions'], u'length': 255, u'type': u'uuid', u'description': u'the template ID'}], u'requiredparams': [u'id'], u'description': u'List iso visibility and all accounts that have permissions to view this iso.'}, u'snapshotpolicies': {u'name': u'listSnapshotPolicies', u'related': [], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'volumeid', u'required': True, u'related': [u'detachVolume', u'uploadVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [u'volumeid'], u'description': u'Lists snapshot policies.'}, u'autoscalevmgroups': {u'name': u'listAutoScaleVmGroups', u'related': [u'createAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'isasync': False, u'params': [{u'name': u'policyid', u'required': False, u'related': [u'createAutoScalePolicy', u'updateAutoScalePolicy', u'listAutoScalePolicies'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the policy'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'vmprofileid', u'required': False, u'related': [u'updateAutoScaleVmProfile', u'createAutoScaleVmProfile', u'listAutoScaleVmProfiles'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the profile'}, {u'name': u'lbruleid', u'required': False, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the loadbalancer'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the availability zone ID'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'id', u'required': False, u'related': [u'listAutoScaleVmGroups', u'createAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale vm group'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists autoscale vm groups.'}, u'projectaccounts': {u'name': u'listProjectAccounts', u'related': [u'createProject'], u'isasync': False, u'params': [{u'name': u'projectid', u'required': True, u'related': [u'createProject', u'listProjectAccounts'], u'length': 255, u'type': u'uuid', u'description': u'id of the project'}, {u'name': u'role', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list accounts of the project by role'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list accounts of the project by account name'}], u'requiredparams': [u'projectid'], u'description': u"Lists project's accounts"}, u'autoscalevmprofiles': {u'name': u'listAutoScaleVmProfiles', u'related': [], u'isasync': False, u'params': [{u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'domainid', u'required': False, u'related': [u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'id', u'required': False, u'related': [u'listAutoScaleVmProfiles'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale vm profile'}, {u'name': u'templateid', u'required': False, u'related': [u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the templateid of the autoscale vm profile'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'otherdeployparams', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the otherdeployparameters of the autoscale vm profile'}], u'requiredparams': [], u'description': u'Lists autoscale vm profiles.'}, u'apis': {u'name': u'listApis', u'related': [], u'isasync': False, u'params': [{u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'API name'}], u'requiredparams': [], u'description': u'lists all available apis on the server, provided by the Api Discovery plugin'}, u'vpcs': {u'name': u'listVPCs', u'related': [u'restartVPC'], u'isasync': False, u'params': [{u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by name of the VPC'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'cidr', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"list by cidr of the VPC. All VPC guest networks' cidrs should be within this CIDR"}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'restartrequired', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list VPCs by restartRequired option'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list VPCs by state'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by display text of the VPC'}, {u'name': u'id', u'required': False, u'related': [u'restartVPC', u'listVPCs'], u'length': 255, u'type': u'uuid', u'description': u'list VPC by id'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list by zone'}, {u'name': u'supportedservices', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list VPC supporting certain services'}, {u'name': u'vpcofferingid', u'required': False, u'related': [u'listVPCOfferings', u'createVPCOffering'], u'length': 255, u'type': u'uuid', u'description': u'list by ID of the VPC offering'}], u'requiredparams': [], u'description': u'Lists VPCs'}, u'f5loadbalancers': {u'name': u'listF5LoadBalancers', u'related': [u'configureF5LoadBalancer'], u'isasync': False, u'params': [{u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'updatePhysicalNetwork', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'lbdeviceid', u'required': False, u'related': [u'configureF5LoadBalancer', u'listF5LoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'f5 load balancer device ID'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'lists F5 load balancer devices'}, u'snapshots': {u'name': u'listSnapshots', u'related': [], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'id', u'required': False, u'related': [u'listSnapshots'], u'length': 255, u'type': u'uuid', u'description': u'lists snapshot by snapshot ID'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'intervaltype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'valid values are HOURLY, DAILY, WEEKLY, and MONTHLY.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'volumeid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists snapshot by snapshot name'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'snapshottype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'valid values are MANUAL or RECURRING.'}], u'requiredparams': [], u'description': u'Lists all available snapshots for the account.'}, u'networkofferings': {u'name': u'listNetworkOfferings', u'related': [u'createNetworkOffering', u'updateNetworkOffering'], u'isasync': False, u'params': [{u'name': u'isdefault', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if need to list only default network offerings. Default value is false'}, {u'name': u'sourcenatsupported', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if need to list only netwok offerings where source nat is supported, false otherwise'}, {u'name': u'supportedservices', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list network offerings supporting certain services'}, {u'name': u'networkid', u'required': False, u'related': [u'createNetwork', u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the network. Pass this in if you want to see the available network offering that a network can be changed to.'}, {u'name': u'specifyipranges', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if need to list only network offerings which support specifying ip ranges'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list network offerings by name'}, {u'name': u'id', u'required': False, u'related': [u'listNetworkOfferings', u'createNetworkOffering', u'updateNetworkOffering'], u'length': 255, u'type': u'uuid', u'description': u'list network offerings by id'}, {u'name': u'specifyvlan', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'the tags for the network offering.'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'list netowrk offerings available for network creation in specific zone'}, {u'name': u'forvpc', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'the network offering can be used only for network creation inside the VPC'}, {u'name': u'traffictype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by traffic type'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'guestiptype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list network offerings by guest type: Shared or Isolated'}, {u'name': u'istagged', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if offering has tags specified'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'list network offerings by tags'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list network offerings by display text'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list network offerings by state'}, {u'name': u'availability', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the availability of network offering. Default value is Required'}], u'requiredparams': [], u'description': u'Lists all available network offerings.'}, u'virtualmachines': {u'name': u'listVirtualMachines', u'related': [], u'isasync': False, u'params': [{u'name': u'templateid', u'required': False, u'related': [u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'list vms by template'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'networkid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list by network id'}, {u'name': u'storageid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u"the storage ID where vm's volumes belong to"}, {u'name': u'isoid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list vms by iso'}, {u'name': u'vpcid', u'required': False, u'related': [u'restartVPC'], u'length': 255, u'type': u'uuid', u'description': u'list vms by vpc'}, {u'name': u'podid', u'required': False, u'related': [u'updatePod'], u'length': 255, u'type': u'uuid', u'description': u'the pod ID'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the virtual machine'}, {u'name': u'details', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'comma separated list of host details requested, value can be a list of [all, group, nics, stats, secgrp, tmpl, servoff, iso, volume, min]. If no parameter is passed in, the details will be defaulted to all'}, {u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the target hypervisor for the template'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'groupid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the group ID'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the availability zone ID'}, {u'name': u'hostid', u'required': False, u'related': [u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'the host ID'}, {u'name': u'id', u'required': False, u'related': [u'listVirtualMachines'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine'}, {u'name': u'forvirtualnetwork', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list by network type; true if need to list vms using Virtual Network, false otherwise'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'state of the virtual machine'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'List the virtual machines owned by the account.'}, u'netscalerloadbalancernetworks': {u'name': u'listNetscalerLoadBalancerNetworks', u'related': [], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'lbdeviceid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'netscaler load balancer device ID'}], u'requiredparams': [u'lbdeviceid'], u'description': u'lists network that are using a netscaler load balancer device'}, u'oscategories': {u'name': u'listOsCategories', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'listOsCategories'], u'length': 255, u'type': u'uuid', u'description': u'list Os category by id'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list os category by name'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists all supported OS categories for this cloud.'}, u'virtualrouterelements': {u'name': u'listVirtualRouterElements', u'related': [u'createVirtualRouterElement', u'configureVirtualRouterElement'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'nspid', u'required': False, u'related': [u'addNetworkServiceProvider', u'listTrafficTypes', u'updateNetworkServiceProvider'], u'length': 255, u'type': u'uuid', u'description': u'list virtual router elements by network service provider id'}, {u'name': u'id', u'required': False, u'related': [u'createVirtualRouterElement', u'configureVirtualRouterElement', u'listVirtualRouterElements'], u'length': 255, u'type': u'uuid', u'description': u'list virtual router elements by id'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'enabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list network offerings by enabled state'}], u'requiredparams': [], u'description': u'Lists all available virtual router elements.'}, u'lunsonfiler': {u'name': u'listLunsOnFiler', u'related': [], u'isasync': False, u'params': [{u'name': u'poolname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}], u'requiredparams': [u'poolname'], u'description': u'List LUN'}, u'asyncjobs': {u'name': u'listAsyncJobs', u'related': [u'queryAsyncJobResult'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'startdate', u'required': False, u'related': [], u'length': 255, u'type': u'tzdate', u'description': u'the start date of the async job'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}], u'requiredparams': [], u'description': u'Lists all pending asynchronous jobs for the account.'}, u'ostypes': {u'name': u'listOsTypes', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'listOsTypes'], u'length': 255, u'type': u'uuid', u'description': u'list by Os type Id'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'oscategoryid', u'required': False, u'related': [u'listOsCategories'], u'length': 255, u'type': u'uuid', u'description': u'list by Os Category id'}, {u'name': u'description', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list os by description'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists all supported OS types for this cloud.'}, u'networkacls': {u'name': u'listNetworkACLs', u'related': [u'createNetworkACL'], u'isasync': False, u'params': [{u'name': u'traffictype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list network ACLs by traffic type - Ingress or Egress'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'id', u'required': False, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'Lists network ACL with the specified ID.'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'suspendProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'networkid', u'required': False, u'related': [u'createNetwork', u'listNiciraNvpDeviceNetworks', u'updateNetwork', u'listF5LoadBalancerNetworks', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'list network ACLs by network Id'}], u'requiredparams': [], u'description': u'Lists all network ACLs'}, u'volumesonfiler': {u'name': u'listVolumesOnFiler', u'related': [], u'isasync': False, u'params': [{u'name': u'poolname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}], u'requiredparams': [u'poolname'], u'description': u'List Volumes'}, u'eventtypes': {u'name': u'listEventTypes', u'related': [], u'isasync': False, u'params': [], u'requiredparams': [], u'description': u'List Event Types'}, u'remoteaccessvpns': {u'name': u'listRemoteAccessVpns', u'related': [u'createRemoteAccessVpn'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'publicipid', u'required': True, u'related': [u'restartNetwork', u'listPublicIpAddresses', u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'public ip address id of the vpn server'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}], u'requiredparams': [u'publicipid'], u'description': u'Lists remote access vpns'}, u'alerts': {u'name': u'listAlerts', u'related': [], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by alert type'}, {u'name': u'id', u'required': False, u'related': [u'listAlerts'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the alert'}], u'requiredparams': [], u'description': u'Lists all alerts.'}, u'regions': {u'name': u'listRegions', u'related': [u'addRegion'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'List Region by region ID.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List Region by region name.'}], u'requiredparams': [], u'description': u'Lists Regions'}, u'vpcofferings': {u'name': u'listVPCOfferings', u'related': [], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listVPCOfferings'], u'length': 255, u'type': u'uuid', u'description': u'list VPC offerings by id'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list VPC offerings by state'}, {u'name': u'supportedservices', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list VPC offerings supporting certain services'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list VPC offerings by display text'}, {u'name': u'isdefault', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if need to list only default VPC offerings. Default value is false'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list VPC offerings by name'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists VPC offerings'}, u'niciranvpdevicenetworks': {u'name': u'listNiciraNvpDeviceNetworks', u'related': [u'createNetwork', u'updateNetwork', u'listF5LoadBalancerNetworks', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'isasync': False, u'params': [{u'name': u'nvpdeviceid', u'required': True, u'related': [u'addNiciraNvpDevice', u'listNiciraNvpDevices'], u'length': 255, u'type': u'uuid', u'description': u'nicira nvp device ID'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [u'nvpdeviceid'], u'description': u'lists network that are using a nicira nvp device'}, u'events': {u'name': u'listEvents', u'related': [], u'isasync': False, u'params': [{u'name': u'startdate', u'required': False, u'related': [], u'length': 255, u'type': u'date', u'description': u'the start date range of the list you want to retrieve (use format "yyyy-MM-dd" or the new format "yyyy-MM-dd HH:mm:ss")'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'enddate', u'required': False, u'related': [], u'length': 255, u'type': u'date', u'description': u'the end date range of the list you want to retrieve (use format "yyyy-MM-dd" or the new format "yyyy-MM-dd HH:mm:ss")'}, {u'name': u'duration', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the duration of the event'}, {u'name': u'id', u'required': False, u'related': [u'listEvents'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the event'}, {u'name': u'level', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the event level (INFO, WARN, ERROR)'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'entrytime', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the time the event was entered'}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the event type (see event types)'}], u'requiredparams': [], u'description': u'A command to list events.'}, u'templates': {u'name': u'listTemplates', u'related': [u'registerIso', u'updateTemplate', u'prepareTemplate', u'copyIso', u'updateIso', u'listIsos'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'templatefilter', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'possible values are "featured", "self", "selfexecutable","sharedexecutable","executable", and "community". * featured : templates that have been marked as featured and public. * self : templates that have been registered or created by the calling user. * selfexecutable : same as self, but only returns templates that can be used to deploy a new VM. * sharedexecutable : templates ready to be deployed that have been granted to the calling user by another user. * executable : templates that are owned by the calling user, or public templates, that can be used to deploy a VM. * community : templates that have been marked as public but not featured. * all : all templates (only usable by admins).'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listTemplates', u'registerIso', u'updateTemplate', u'prepareTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the template ID'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the template name'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the hypervisor for which to restrict the search'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'list templates by zoneId'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}], u'requiredparams': [u'templatefilter'], u'description': u'List all public, private, and privileged templates.'}, u'cisconexusvsms': {u'name': u'listCiscoNexusVSMs', u'related': [u'disableCiscoNexusVSM', u'enableCiscoNexusVSM'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Id of the CloudStack cluster in which the Cisco Nexus 1000v VSM appliance.'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'Id of the CloudStack cluster in which the Cisco Nexus 1000v VSM appliance.'}], u'requiredparams': [], u'description': u'Retrieves a Cisco Nexus 1000v Virtual Switch Manager device associated with a Cluster'}, u'ipforwardingrules': {u'name': u'listIpForwardingRules', u'related': [], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'id', u'required': False, u'related': [u'listIpForwardingRules'], u'length': 255, u'type': u'uuid', u'description': u'Lists rule with the specified ID.'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'listVirtualMachines', u'destroyVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'Lists all rules applied to the specified Vm.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'ipaddressid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list the rule belonging to this public ip address'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}], u'requiredparams': [], u'description': u'List the ip forwarding rules'}, u'srxfirewalls': {u'name': u'listSrxFirewalls', u'related': [u'addSrxFirewall'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'fwdeviceid', u'required': False, u'related': [u'listSrxFirewalls', u'addSrxFirewall'], u'length': 255, u'type': u'uuid', u'description': u'SRX firewall device ID'}], u'requiredparams': [], u'description': u'lists SRX firewall devices in a physical network'}, u'vpnconnections': {u'name': u'listVpnConnections', u'related': [], u'isasync': False, u'params': [{u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'vpcid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'id of vpc'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'id', u'required': False, u'related': [u'listVpnConnections'], u'length': 255, u'type': u'uuid', u'description': u'id of the vpn connection'}], u'requiredparams': [], u'description': u'Lists site to site vpn connection gateways'}, u'trafficmonitors': {u'name': u'listTrafficMonitors', u'related': [], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'zone Id'}], u'requiredparams': [u'zoneid'], u'description': u'List traffic monitor Hosts.'}, u'vpnusers': {u'name': u'listVpnUsers', u'related': [], u'isasync': False, u'params': [{u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listVpnUsers'], u'length': 255, u'type': u'uuid', u'description': u'The uuid of the Vpn user'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'username', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username of the vpn user.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists vpn users'}, u'egressfirewallrules': {u'name': u'listEgressFirewallRules', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Lists rule with the specified ID.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'networkid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the id network network for the egress firwall services'}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Lists rule with the specified ID.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'ipaddressid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the id of IP address of the firwall services'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}], u'requiredparams': [], u'description': u'Lists all egress firewall rules for network id.'}, u'staticroutes': {u'name': u'listStaticRoutes', u'related': [u'createStaticRoute'], u'isasync': False, u'params': [{u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'gatewayid', u'required': False, u'related': [u'createPrivateGateway'], u'length': 255, u'type': u'uuid', u'description': u'list static routes by gateway id'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'list static routes by vpc id'}, {u'name': u'id', u'required': False, u'related': [u'createStaticRoute', u'listStaticRoutes'], u'length': 255, u'type': u'uuid', u'description': u'list static route by id'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}], u'requiredparams': [], u'description': u'Lists all static routes'}, u'volumes': {u'name': u'listVolumes', u'related': [u'migrateVolume', u'detachVolume', u'resizeVolume', u'attachVolume', u'uploadVolume', u'createVolume'], u'isasync': False, u'params': [{u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the disk volume'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'suspendProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'hostid', u'required': False, u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addSecondaryStorage', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers', u'prepareHostForMaintenance'], u'length': 255, u'type': u'uuid', u'description': u'list volumes on specified host'}, {u'name': u'id', u'required': False, u'related': [u'migrateVolume', u'detachVolume', u'resizeVolume', u'attachVolume', u'listVolumes', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the availability zone'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'listLoadBalancerRuleInstances', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine'}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the type of disk volume'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'podid', u'required': False, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the pod id the disk volume belongs to'}], u'requiredparams': [], u'description': u'Lists all volumes.'}, u'pods': {u'name': u'listPods', u'related': [u'updatePod'], u'isasync': False, u'params': [{u'name': u'showcapacities', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'flag to display the capacity of the pods'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list pods by allocation state'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list Pods by Zone ID'}, {u'name': u'id', u'required': False, u'related': [u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'list Pods by ID'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list Pods by name'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists all Pods.'}}, u'upload': {u'volume': {u'name': u'uploadVolume', u'related': [u'detachVolume'], u'isasync': True, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the volume'}, {u'name': u'format', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the format for the volume. Possible values include QCOW2, OVA, and VHD.'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL of where the volume is hosted. Possible URL include http:// and https://'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional accountName. Must be used with domainId.'}, {u'name': u'domainid', u'required': False, u'related': [u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId. If the account parameter is used, domainId must also be used.'}, {u'name': u'checksum', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the MD5 checksum value of this volume'}, {u'name': u'zoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone the volume is to be hosted on'}], u'requiredparams': [u'name', u'format', u'url', u'zoneid'], u'description': u'Uploads a data disk.'}, u'customcertificate': {u'name': u'uploadCustomCertificate', u'related': [], u'isasync': True, u'params': [{u'name': u'domainsuffix', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'DNS domain suffix that the certificate is granted for.'}, {u'name': u'certificate', u'required': True, u'related': [], u'length': 65535, u'type': u'string', u'description': u'The certificate to be uploaded.'}, {u'name': u'privatekey', u'required': False, u'related': [], u'length': 65535, u'type': u'string', u'description': u'The private key for the attached certificate.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'A name / alias for the certificate.'}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'An integer providing the location in a chain that the certificate will hold. Usually, this can be left empty. When creating a chain, the top level certificate should have an ID of 1, with each step in the chain incrementing by one. Example, CA with id = 1, Intermediate CA with id = 2, Site certificate with ID = 3'}], u'requiredparams': [u'domainsuffix', u'certificate'], u'description': u'Uploads a custom certificate for the console proxy VMs to use for SSL. Can be used to upload a single certificate signed by a known CA. Can also be used, through multiple calls, to upload a chain of certificates from CA to the custom certificate itself.'}}, u'remove': {u'region': {u'name': u'removeRegion', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'ID of the region to delete'}], u'requiredparams': [u'id'], u'description': u'Removes specified region'}, u'nicfromvirtualmachine': {u'name': u'removeNicFromVirtualMachine', u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'nicid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'NIC ID'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'Virtual Machine ID'}], u'requiredparams': [u'nicid', u'virtualmachineid'], u'description': u'Removes VM from specified network by deleting a NIC'}, u'fromloadbalancerrule': {u'name': u'removeFromLoadBalancerRule', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listIpForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the load balancer rule'}, {u'name': u'virtualmachineids', u'required': True, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'list', u'description': u'the list of IDs of the virtual machines that are being removed from the load balancer rule (i.e. virtualMachineIds=1,2,3)'}], u'requiredparams': [u'id', u'virtualmachineids'], u'description': u'Removes a virtual machine or a list of virtual machines from a load balancer rule.'}, u'vpnuser': {u'name': u'removeVpnUser', u'related': [], u'isasync': True, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the vpn user. If the account parameter is used, domainId must also be used.'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'remove vpn user from the project'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the vpn user. Must be used with domainId.'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'username for the vpn user'}], u'requiredparams': [u'username'], u'description': u'Removes vpn user'}}, u'asyncapis': [u'createCondition', u'reconnectHost', u'copyTemplate', u'deleteBigSwitchVnsDevice', u'addNicToVirtualMachine', u'extractVolume', u'addAccountToProject', u'deleteEgressFirewallRule', u'deleteCiscoNexusVSM', u'createVpnConnection', u'suspendProject', u'addF5LoadBalancer', u'deleteAutoScaleVmGroup', u'authorizeSecurityGroupIngress', u'addNetscalerLoadBalancer', u'deleteDomain', u'configureNetscalerLoadBalancer', u'disableAutoScaleVmGroup', u'authorizeSecurityGroupEgress', u'createTemplate', u'migrateVolume', u'updatePhysicalNetwork', u'prepareHostForMaintenance', u'deletePrivateGateway', u'deleteStaticRoute', u'deleteTrafficType', u'deleteLoadBalancerRule', u'attachIso', u'destroySystemVm', u'deletePortForwardingRule', u'enableStorageMaintenance', u'stopRouter', u'configureSrxFirewall', u'attachVolume', u'updateVPCOffering', u'resetSSHKeyForVirtualMachine', u'updateProjectInvitation', u'createTags', u'enableAutoScaleVmGroup', u'deleteTags', u'deleteAccountFromProject', u'removeVpnUser', u'updateVpnCustomerGateway', u'stopSystemVm', u'uploadCustomCertificate', u'restartNetwork', u'createAutoScaleVmProfile', u'rebootVirtualMachine', u'enableCiscoNexusVSM', u'cancelHostMaintenance', u'deleteStorageNetworkIpRange', u'deleteFirewallRule', u'deleteVpnConnection', u'startSystemVm', u'deleteF5LoadBalancer', u'deleteNiciraNvpDevice', u'updateProject', u'deleteNetwork', u'deleteProject', u'deleteNetscalerLoadBalancer', u'deleteIpForwardingRule', u'addTrafficType', u'disableUser', u'resizeVolume', u'configureVirtualRouterElement', u'createStaticRoute', u'deleteProjectInvitation', u'migrateSystemVm', u'activateProject', u'removeNicFromVirtualMachine', u'revokeSecurityGroupIngress', u'updateDefaultNicForVirtualMachine', u'disableStaticNat', u'createNetworkACL', u'createVPC', u'configureF5LoadBalancer', u'disassociateIpAddress', u'createIpForwardingRule', u'createVolume', u'resetPasswordForVirtualMachine', u'assignToLoadBalancerRule', u'startRouter', u'extractIso', u'deleteRemoteAccessVpn', u'resetVpnConnection', u'createRemoteAccessVpn', u'extractTemplate', u'startVirtualMachine', u'detachIso', u'updateVPC', u'deleteAccount', u'associateIpAddress', u'updateAutoScaleVmProfile', u'disableAccount', u'updatePortForwardingRule', u'migrateVirtualMachine', u'createStorageNetworkIpRange', u'cancelStorageMaintenance', u'deployVirtualMachine', u'removeFromLoadBalancerRule', u'revokeSecurityGroupEgress', u'deleteCondition', u'createPortForwardingRule', u'addVpnUser', u'createVPCOffering', u'createEgressFirewallRule', u'deleteLBStickinessPolicy', u'destroyRouter', u'createPrivateGateway', u'disableCiscoNexusVSM', u'deleteAutoScaleVmProfile', u'updateTrafficType', u'deleteSnapshot', u'createProject', u'createLoadBalancerRule', u'addSrxFirewall', u'addNiciraNvpDevice', u'createAutoScalePolicy', u'restoreVirtualMachine', u'copyIso', u'uploadVolume', u'createLBStickinessPolicy', u'stopVirtualMachine', u'createCounter', u'createSnapshot', u'destroyVirtualMachine', u'updateNetwork', u'deleteVpnGateway', u'createAutoScaleVmGroup', u'rebootRouter', u'deleteNetworkServiceProvider', u'deleteIso', u'createVpnCustomerGateway', u'createFirewallRule', u'deleteAutoScalePolicy', u'deleteSrxFirewall', u'addNetworkServiceProvider', u'rebootSystemVm', u'detachVolume', u'deleteNetworkACL', u'markDefaultZoneForAccount', u'deleteVPC', u'restartVPC', u'updateAutoScaleVmGroup', u'updateLoadBalancerRule', u'createPhysicalNetwork', u'deleteTemplate', u'deletePhysicalNetwork', u'deleteVpnCustomerGateway', u'deleteVPCOffering', u'createVirtualRouterElement', u'updateAutoScalePolicy', u'addBigSwitchVnsDevice', u'createVpnGateway', u'updateNetworkServiceProvider', u'deleteCounter', u'updateStorageNetworkIpRange'], u'assign': {u'toloadbalancerrule': {u'name': u'assignToLoadBalancerRule', u'related': [], u'isasync': True, u'params': [{u'name': u'virtualmachineids', u'required': True, u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'list', u'description': u'the list of IDs of the virtual machine that are being assigned to the load balancer rule(i.e. virtualMachineIds=1,2,3)'}, {u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}], u'requiredparams': [u'virtualmachineids', u'id'], u'description': u'Assigns virtual machine or a list of virtual machines to a load balancer rule.'}, u'virtualmachine': {u'name': u'assignVirtualMachine', u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': False, u'params': [{u'name': u'networkids', u'required': False, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'list', u'description': u'list of new network ids in which the moved VM will participate. In case no network ids are provided the VM will be part of the default network for that zone. In case there is no network yet created for the new account the default network will be created.'}, {u'name': u'domainid', u'required': True, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'domain id of the new VM owner.'}, {u'name': u'securitygroupids', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list of security group ids to be applied on the virtual machine. In case no security groups are provided the VM is part of the default security group.'}, {u'name': u'account', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'account name of the new VM owner.'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'id of the VM to be moved'}], u'requiredparams': [u'domainid', u'account', u'virtualmachineid'], u'description': u'Assign a VM from one account to another under the same domain. This API is available for Basic zones with security groups and Advance zones with guest networks. The VM is restricted to move between accounts under same domain.'}}, u'delete': {u'loadbalancerrule': {u'name': u'deleteLoadBalancerRule', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}], u'requiredparams': [u'id'], u'description': u'Deletes a load balancer rule.'}, u'domain': {u'name': u'deleteDomain', u'related': [], u'isasync': True, u'params': [{u'name': u'cleanup', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if all domain resources (child domains, accounts) have to be cleaned up, false otherwise'}, {u'name': u'id', u'required': True, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'ID of domain to delete'}], u'requiredparams': [u'id'], u'description': u'Deletes a specified domain'}, u'instancegroup': {u'name': u'deleteInstanceGroup', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the instance group'}], u'requiredparams': [u'id'], u'description': u'Deletes a vm group'}, u'diskoffering': {u'name': u'deleteDiskOffering', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateDiskOffering', u'createDiskOffering', u'listDiskOfferings'], u'length': 255, u'type': u'uuid', u'description': u'ID of the disk offering'}], u'requiredparams': [u'id'], u'description': u'Updates a disk offering.'}, u'externalloadbalancer': {u'name': u'deleteExternalLoadBalancer', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'Id of the external loadbalancer appliance.'}], u'requiredparams': [u'id'], u'description': u'Deletes a F5 external load balancer appliance added in a zone.'}, u'securitygroup': {u'name': u'deleteSecurityGroup', u'related': [], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the domain ID of account owning the security group'}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'The ID of the security group. Mutually exclusive with name parameter'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The ID of the security group. Mutually exclusive with id parameter'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account of the security group. Must be specified with domain ID'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the project of the security group'}], u'requiredparams': [], u'description': u'Deletes security group'}, u'portforwardingrule': {u'name': u'deletePortForwardingRule', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the port forwarding rule'}], u'requiredparams': [u'id'], u'description': u'Deletes a port forwarding rule'}, u'cluster': {u'name': u'deleteCluster', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the cluster ID'}], u'requiredparams': [u'id'], u'description': u'Deletes a cluster.'}, u'accountfromproject': {u'name': u'deleteAccountFromProject', u'related': [], u'isasync': True, u'params': [{u'name': u'projectid', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to remove the account from'}, {u'name': u'account', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the account to be removed from the project'}], u'requiredparams': [u'projectid', u'account'], u'description': u'Deletes account from the project'}, u'networkdevice': {u'name': u'deleteNetworkDevice', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'addHost', u'updateHost', u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'Id of network device to delete'}], u'requiredparams': [u'id'], u'description': u'Deletes network device.'}, u'firewallrule': {u'name': u'deleteFirewallRule', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the firewall rule'}], u'requiredparams': [u'id'], u'description': u'Deletes a firewall rule'}, u'pod': {u'name': u'deletePod', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the Pod'}], u'requiredparams': [u'id'], u'description': u'Deletes a Pod.'}, u'ipforwardingrule': {u'name': u'deleteIpForwardingRule', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the id of the forwarding rule'}], u'requiredparams': [u'id'], u'description': u'Deletes an ip forwarding rule'}, u'vpnconnection': {u'name': u'deleteVpnConnection', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listVpnConnections', u'resetVpnConnection'], u'length': 255, u'type': u'uuid', u'description': u'id of vpn connection'}], u'requiredparams': [u'id'], u'description': u'Delete site to site vpn connection'}, u'lbstickinesspolicy': {u'name': u'deleteLBStickinessPolicy', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createLBStickinessPolicy'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the LB stickiness policy'}], u'requiredparams': [u'id'], u'description': u'Deletes a LB stickiness policy.'}, u'vpcoffering': {u'name': u'deleteVPCOffering', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the VPC offering'}], u'requiredparams': [u'id'], u'description': u'Deletes VPC offering'}, u'network': {u'name': u'deleteNetwork', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the network'}], u'requiredparams': [u'id'], u'description': u'Deletes a network'}, u'zone': {u'name': u'deleteZone', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the Zone'}], u'requiredparams': [u'id'], u'description': u'Deletes a Zone.'}, u'remoteaccessvpn': {u'name': u'deleteRemoteAccessVpn', u'related': [], u'isasync': True, u'params': [{u'name': u'publicipid', u'required': True, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'public ip address id of the vpn server'}], u'requiredparams': [u'publicipid'], u'description': u'Destroys a l2tp/ipsec remote access vpn'}, u'storagenetworkiprange': {u'name': u'deleteStorageNetworkIpRange', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listStorageNetworkIpRange', u'createStorageNetworkIpRange', u'updateStorageNetworkIpRange'], u'length': 255, u'type': u'uuid', u'description': u'the uuid of the storage network ip range'}], u'requiredparams': [u'id'], u'description': u'Deletes a storage network IP Range.'}, u'bigswitchvnsdevice': {u'name': u'deleteBigSwitchVnsDevice', u'related': [], u'isasync': True, u'params': [{u'name': u'vnsdeviceid', u'required': True, u'related': [], u'length': 255, u'type': u'long', u'description': u'BigSwitch device ID'}], u'requiredparams': [u'vnsdeviceid'], u'description': u' delete a bigswitch vns device'}, u'projectinvitation': {u'name': u'deleteProjectInvitation', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listProjectInvitations'], u'length': 255, u'type': u'uuid', u'description': u'id of the invitation'}], u'requiredparams': [u'id'], u'description': u'Accepts or declines project invitation'}, u'autoscalepolicy': {u'name': u'deleteAutoScalePolicy', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateAutoScalePolicy'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale policy'}], u'requiredparams': [u'id'], u'description': u'Deletes a autoscale policy.'}, u'niciranvpdevice': {u'name': u'deleteNiciraNvpDevice', u'related': [], u'isasync': True, u'params': [{u'name': u'nvpdeviceid', u'required': True, u'related': [u'addNiciraNvpDevice', u'listNiciraNvpDevices'], u'length': 255, u'type': u'uuid', u'description': u'Nicira device ID'}], u'requiredparams': [u'nvpdeviceid'], u'description': u' delete a nicira nvp device'}, u'serviceoffering': {u'name': u'deleteServiceOffering', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the service offering'}], u'requiredparams': [u'id'], u'description': u'Deletes a service offering.'}, u'condition': {u'name': u'deleteCondition', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the condition.'}], u'requiredparams': [u'id'], u'description': u'Removes a condition'}, u'storagepool': {u'name': u'deleteStoragePool', u'related': [], u'isasync': False, u'params': [{u'name': u'forced', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force destroy storage pool (force expunge volumes in Destroyed state as a part of pool removal)'}, {u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Storage pool id'}], u'requiredparams': [u'id'], u'description': u'Deletes a storage pool.'}, u'vpngateway': {u'name': u'deleteVpnGateway', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createVpnGateway'], u'length': 255, u'type': u'uuid', u'description': u'id of customer gateway'}], u'requiredparams': [u'id'], u'description': u'Delete site to site vpn gateway'}, u'snapshot': {u'name': u'deleteSnapshot', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createSnapshot', u'listSnapshots'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the snapshot'}], u'requiredparams': [u'id'], u'description': u'Deletes a snapshot of a disk volume.'}, u'autoscalevmgroup': {u'name': u'deleteAutoScaleVmGroup', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listAutoScaleVmGroups', u'createAutoScaleVmGroup', u'disableAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale group'}], u'requiredparams': [u'id'], u'description': u'Deletes a autoscale vm group.'}, u'trafficmonitor': {u'name': u'deleteTrafficMonitor', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'Id of the Traffic Monitor Host.'}], u'requiredparams': [u'id'], u'description': u'Deletes an traffic monitor host.'}, u'networkacl': {u'name': u'deleteNetworkACL', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the network ACL'}], u'requiredparams': [u'id'], u'description': u'Deletes a Network ACL'}, u'template': {u'name': u'deleteTemplate', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the template'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of zone of the template'}], u'requiredparams': [u'id'], u'description': u'Deletes a template from the system. All virtual machines using the deleted template will not be affected.'}, u'tags': {u'name': u'deleteTags', u'related': [], u'isasync': True, u'params': [{u'name': u'resourceids', u'required': True, u'related': [], u'length': 255, u'type': u'list', u'description': u'Delete tags for resource id(s)'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'Delete tags matching key/value pairs'}, {u'name': u'resourcetype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Delete tag by resource type'}], u'requiredparams': [u'resourceids', u'resourcetype'], u'description': u'Deleting resource tag(s)'}, u'snapshotpolicies': {u'name': u'deleteSnapshotPolicies', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Id of the snapshot policy'}, {u'name': u'ids', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list of snapshots policy IDs separated by comma'}], u'requiredparams': [], u'description': u'Deletes snapshot policies for the account.'}, u'privategateway': {u'name': u'deletePrivateGateway', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createPrivateGateway', u'listPrivateGateways'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the private gateway'}], u'requiredparams': [u'id'], u'description': u'Deletes a Private gateway'}, u'traffictype': {u'name': u'deleteTrafficType', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'addTrafficType', u'updateTrafficType'], u'length': 255, u'type': u'uuid', u'description': u'traffic type id'}], u'requiredparams': [u'id'], u'description': u'Deletes traffic type of a physical network'}, u'host': {u'name': u'deleteHost', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the host ID'}, {u'name': u'forcedestroylocalstorage', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force destroy local storage on this host. All VMs created on this local storage will be destroyed'}, {u'name': u'forced', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force delete the host. All HA enabled vms running on the host will be put to HA; HA disabled ones will be stopped'}], u'requiredparams': [u'id'], u'description': u'Deletes a host.'}, u'staticroute': {u'name': u'deleteStaticRoute', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createStaticRoute', u'listStaticRoutes'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the static route'}], u'requiredparams': [u'id'], u'description': u'Deletes a static route'}, u'vpc': {u'name': u'deleteVPC', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'restartVPC'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the VPC'}], u'requiredparams': [u'id'], u'description': u'Deletes a VPC'}, u'srxfirewall': {u'name': u'deleteSrxFirewall', u'related': [], u'isasync': True, u'params': [{u'name': u'fwdeviceid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'srx firewall device ID'}], u'requiredparams': [u'fwdeviceid'], u'description': u' delete a SRX firewall device'}, u'externalfirewall': {u'name': u'deleteExternalFirewall', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'Id of the external firewall appliance.'}], u'requiredparams': [u'id'], u'description': u'Deletes an external firewall appliance.'}, u'pool': {u'name': u'deletePool', u'related': [], u'isasync': False, u'params': [{u'name': u'poolname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}], u'requiredparams': [u'poolname'], u'description': u'Delete a pool'}, u'autoscalevmprofile': {u'name': u'deleteAutoScaleVmProfile', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listAutoScaleVmProfiles'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale profile'}], u'requiredparams': [u'id'], u'description': u'Deletes a autoscale vm profile.'}, u'volume': {u'name': u'deleteVolume', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'detachVolume', u'resizeVolume', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the disk volume'}], u'requiredparams': [u'id'], u'description': u'Deletes a detached disk volume.'}, u'account': {u'name': u'deleteAccount', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount', u'disableAccount'], u'length': 255, u'type': u'uuid', u'description': u'Account id'}], u'requiredparams': [u'id'], u'description': u'Deletes a account, and all users associated with this account'}, u'cisconexusvsm': {u'name': u'deleteCiscoNexusVSM', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'disableCiscoNexusVSM', u'listCiscoNexusVSMs', u'enableCiscoNexusVSM'], u'length': 255, u'type': u'uuid', u'description': u'Id of the Cisco Nexus 1000v VSM device to be deleted'}], u'requiredparams': [u'id'], u'description': u' delete a Cisco Nexus VSM device'}, u'netscalerloadbalancer': {u'name': u'deleteNetscalerLoadBalancer', u'related': [], u'isasync': True, u'params': [{u'name': u'lbdeviceid', u'required': True, u'related': [u'listNetscalerLoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'netscaler load balancer device ID'}], u'requiredparams': [u'lbdeviceid'], u'description': u' delete a netscaler load balancer device'}, u'networkoffering': {u'name': u'deleteNetworkOffering', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'createNetworkOffering', u'updateNetworkOffering'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the network offering'}], u'requiredparams': [u'id'], u'description': u'Deletes a network offering.'}, u'vpncustomergateway': {u'name': u'deleteVpnCustomerGateway', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'id of customer gateway'}], u'requiredparams': [u'id'], u'description': u'Delete site to site vpn customer gateway'}, u'counter': {u'name': u'deleteCounter', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the counter'}], u'requiredparams': [u'id'], u'description': u'Deletes a counter'}, u'physicalnetwork': {u'name': u'deletePhysicalNetwork', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the Physical network'}], u'requiredparams': [u'id'], u'description': u'Deletes a Physical Network.'}, u'project': {u'name': u'deleteProject', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to be deleted'}], u'requiredparams': [u'id'], u'description': u'Deletes a project'}, u'vlaniprange': {u'name': u'deleteVlanIpRange', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'listVlanIpRanges'], u'length': 255, u'type': u'uuid', u'description': u'the id of the VLAN IP range'}], u'requiredparams': [u'id'], u'description': u'Creates a VLAN IP range.'}, u'f5loadbalancer': {u'name': u'deleteF5LoadBalancer', u'related': [], u'isasync': True, u'params': [{u'name': u'lbdeviceid', u'required': True, u'related': [u'configureF5LoadBalancer'], u'length': 255, u'type': u'uuid', u'description': u'netscaler load balancer device ID'}], u'requiredparams': [u'lbdeviceid'], u'description': u' delete a F5 load balancer device'}, u'iso': {u'name': u'deleteIso', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the ISO file'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone of the ISO file. If not specified, the ISO will be deleted from all the zones'}], u'requiredparams': [u'id'], u'description': u'Deletes an ISO file.'}, u'egressfirewallrule': {u'name': u'deleteEgressFirewallRule', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the firewall rule'}], u'requiredparams': [u'id'], u'description': u'Deletes an ggress firewall rule'}, u'networkserviceprovider': {u'name': u'deleteNetworkServiceProvider', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'addNetworkServiceProvider', u'listTrafficTypes', u'updateNetworkServiceProvider'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the network service provider'}], u'requiredparams': [u'id'], u'description': u'Deletes a Network Service Provider.'}, u'sshkeypair': {u'name': u'deleteSSHKeyPair', u'related': [], u'isasync': False, u'params': [{u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the project associated with keypair'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the domain ID associated with the keypair'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Name of the keypair'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account associated with the keypair. Must be used with the domainId parameter.'}], u'requiredparams': [u'name'], u'description': u'Deletes a keypair by name'}, u'user': {u'name': u'deleteUser', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'lockUser', u'listUsers'], u'length': 255, u'type': u'uuid', u'description': u'id of the user to be deleted'}], u'requiredparams': [u'id'], u'description': u'Deletes a user for an account'}}} diff --git a/ui/public/locales/ar.json b/ui/public/locales/ar.json index 706a1ff23429..dc595d32a0d4 100644 --- a/ui/public/locales/ar.json +++ b/ui/public/locales/ar.json @@ -1461,7 +1461,7 @@ "message.validate.range.length": "Please enter a value between {0} and {1} characters long.", "message.vm.review.launch": "\u064a\u0631\u062c\u0649 \u0645\u0631\u0627\u062c\u0639\u0629 \u0627\u0644\u0645\u0639\u0644\u0648\u0645\u0627\u062a \u0627\u0644\u062a\u0627\u0644\u064a\u0629 \u0648\u062a\u0623\u0643\u062f \u0623\u0646 \u0645\u062b\u0627\u0644\u0643 \u0627\u0644\u0625\u0641\u062a\u0631\u0627\u0636\u064a \u0635\u062d\u064a\u062d \u0642\u0628\u0644 \u0627\u0644\u0625\u0646\u0637\u0644\u0627\u0642", "message.zone.creation.complete": "Zone creation complete", -"messgae.validate.min": "Please enter a value greater than or equal to {0}.", +"message.validate.min": "Please enter a value greater than or equal to {0}.", "side.by.side": "Side by Side", "state.completed": "\u062a\u0645 \u0627\u0644\u0627\u0643\u0645\u0627\u0644", "state.declined": "\u062a\u0645 \u0627\u0644\u0631\u0641\u0636", diff --git a/ui/public/locales/ca.json b/ui/public/locales/ca.json index ff3a951e4208..b5e1fa91fcac 100644 --- a/ui/public/locales/ca.json +++ b/ui/public/locales/ca.json @@ -1461,7 +1461,7 @@ "message.validate.range.length": "Please enter a value between {0} and {1} characters long.", "message.vm.review.launch": "Please review the following information and confirm that your virtual instance is correct before launch.", "message.zone.creation.complete": "Zone creation complete", -"messgae.validate.min": "Please enter a value greater than or equal to {0}.", +"message.validate.min": "Please enter a value greater than or equal to {0}.", "side.by.side": "Costat a costat", "state.completed": "Complert", "state.declined": "Declinat", diff --git a/ui/public/locales/de_DE.json b/ui/public/locales/de_DE.json index 9cb29350d60b..a6ef965580c9 100644 --- a/ui/public/locales/de_DE.json +++ b/ui/public/locales/de_DE.json @@ -2175,7 +2175,7 @@ "message.zone.creation.complete": "Zonenerstellung abgeschlossen", "message.zone.detail.description": "Geben Sie weitere Details zur Zone an", "message.zone.detail.hint": "Eine Zone ist die größte Organisationseinheit in CloudStack und wird normalerweise verbunden mit einem einzelnen Datenzentrum. Zonen bieten physische Isolation und Redundanz. Eine Zone besteht aus einem oder mehreren Pods (jeder Pod beinhaltet Hosts und primäre Speichersysteme) und ein sekundäres Speichersystem, das auf alle Pods der Zone aufgeteilt ist.", -"messgae.validate.min": "Bitte geben sie einen Wert größer oder gleich {0} ein.", +"message.validate.min": "Bitte geben sie einen Wert größer oder gleich {0} ein.", "router.health.checks": "Gesundheitsüberprüfung", "side.by.side": "Nebeneinander", "state.completed": "Fertiggestellt", diff --git a/ui/public/locales/el_GR.json b/ui/public/locales/el_GR.json index db0ad72b394a..24a36773091f 100644 --- a/ui/public/locales/el_GR.json +++ b/ui/public/locales/el_GR.json @@ -2689,7 +2689,7 @@ "message.zone.creation.complete": "Η δημιουργία ζώνης ολοκληρώθηκε", "message.zone.detail.description": "Συμπλήρωση λεπτομερειών ζώνης", "message.zone.detail.hint": "Μια ζώνη είναι η μεγαλύτερη οργανική μονάδα στο CloudStack και συνήθως αντιστοιχεί σε ένα μόνο κέντρο δεδομένων. Οι ζώνες παρέχουν φυσική απομόνωση και πλεονασμό. Μια ζώνη αποτελείται από ένα ή περισσότερα pods (καθένα από τα οποία περιέχει κεντρικούς υπολογιστές και πρωτεύοντες διακομιστές αποθήκευσης) και έναν δευτερεύοντα διακομιστή αποθήκευσης, ο οποίος είναι κοινόχρηστος από όλα τα pods της ζώνης.", -"messgae.validate.min": "Πληκτρολογήστε μια τιμή μεγαλύτερη ή ίση με {0}.", +"message.validate.min": "Πληκτρολογήστε μια τιμή μεγαλύτερη ή ίση με {0}.", "migrate.from": "Μετεγκατάσταση από", "migrate.to": "Μετεγκατάσταση σε", "migrationPolicy": "Μεταναστευτική Πολιτική", diff --git a/ui/public/locales/en.json b/ui/public/locales/en.json index a3b163187e39..1dc3fb8ddcec 100644 --- a/ui/public/locales/en.json +++ b/ui/public/locales/en.json @@ -4,6 +4,7 @@ "error.dedicate.host.failed": "Failed to dedicate host.", "error.dedicate.pod.failed": "Failed to dedicate pod.", "error.dedicate.zone.failed": "Failed to dedicate zone.", +"error.empty.counter.operator.threshold": "Either Counter, Operator or Threshold is empty", "error.execute.api.failed": "Failed to execute API.", "error.fetching.async.job.result": "Error encountered while fetching async job result.", "error.form.message": "There are errors in the form. Please fix them.", @@ -187,6 +188,7 @@ "label.add.ciscoasa1000v": "Add CiscoASA1000v resource", "label.add.cluster": "Add cluster", "label.add.compute.offering": "Add compute offering", +"label.add.condition": "Add condition", "label.add.disk.offering": "Add disk offering", "label.add.domain": "Add domain", "label.add.egress.rule": "Add egress rule", @@ -216,8 +218,10 @@ "label.add.note": "Add comment", "label.add.opendaylight.device": "Add OpenDaylight controller", "label.add.pa.device": "Add Palo Alto device", +"label.add.param": "Add param", "label.add.physical.network": "Add physical network", "label.add.pod": "Add pod", +"label.add.policy": "Add policy", "label.add.primary.storage": "Add primary storage", "label.add.private.gateway": "Add private gateway", "label.add.resources": "Add resources", @@ -301,15 +305,20 @@ "label.authentication.method": "Authentication Method", "label.authentication.sshkey": "System SSH Key", "label.automigrate.volume": "Auto migrate volume to another storage pool if required", +"label.autoscale": "AutoScale", +"label.autoscalevmgroupname": "AutoScale VM Group", "label.author.email": "Author e-mail", "label.author.name": "Author name", "label.auto.assign": "Automatically assign", "label.auto.assign.diskoffering.disk.size": "Automatically assign offering matching the disk size", "label.auto.assign.random.ip": "Automatically assign a random IP address", +"label.autoscale.vm.groups": "AutoScale VM Groups", +"label.autoscale.vm.profile": "AutoScale VM Profile", "label.autoscalingenabled": "Auto scaling", "label.availability": "Availability", "label.available": "Available", "label.availableprocessors": "Available processor cores", +"label.availablevirtualmachinecount": "Available VMs", "label.back": "Back", "label.backup": "Backups", "label.backup.attach.restore": "Restore and attach backup volume", @@ -408,6 +417,7 @@ "label.complete": "Complete", "label.compute": "Compute", "label.compute.offerings": "Compute offerings", +"label.conditions": "Conditions", "label.configuration": "Configuration", "label.configure": "Configure", "label.configure.ldap": "Configure LDAP", @@ -438,6 +448,8 @@ "label.copy": "Copy", "label.copy.clipboard": "Copy to clipboard", "label.copyid": "Copy ID", +"label.counter": "Counter", +"label.counter.name": "Name of the counter for which the policy will be evaluated", "label.cpu": "CPU", "label.cpu.sockets": "CPU sockets", "label.cpu.usage.info": "CPU usage information", @@ -453,6 +465,7 @@ "label.cputotalghz": "CPU total", "label.cpuused": "CPU utilized", "label.cpuusedghz": "CPU used", +"label.create": "Create", "label.create.account": "Create account", "label.create.backup": "Start backup", "label.create.network": "Create new network", @@ -512,6 +525,7 @@ "label.delete.acl.list": "Delete ACL list", "label.delete.affinity.group": "Delete affinity group", "label.delete.alerts": "Delete alerts", +"label.delete.autoscale.vmgroup": "Delete AutoScale VM Group", "label.delete.backup": "Delete backup", "label.delete.bigswitchbcf": "Remove BigSwitch BCF controller", "label.delete.brocadevcs": "Remove Brocade Vcs switch", @@ -571,6 +585,7 @@ "label.direct.attached.public.ip": "Direct attached public IP", "label.direct.ips": "Shared network IPs", "label.directdownload": "Direct download", +"label.disable.autoscale.vmgroup": "Disable AutoScale VM Group", "label.disable.host": "Disable host", "label.disable.network.offering": "Disable network offering", "label.disable.provider": "Disable provider", @@ -637,6 +652,7 @@ "label.download.state": "Download state", "label.dpd": "Dead peer detection", "label.driver": "Driver", +"label.duration": "Duration (in sec)", "label.dynamicscalingenabled": "Dynamic scaling enabled", "label.dynamicscalingenabled.tooltip": "VM can dynamically scale only when dynamic scaling is enabled on template, service offering and global setting.", "label.diskofferingstrictness": "Disk offering strictness", @@ -646,6 +662,7 @@ "label.edit": "Edit", "label.edit.acl.list": "Edit ACL list", "label.edit.acl.rule": "Edit ACL rule", +"label.edit.autoscale.vmprofile": "Edit AutoScale VM Profile", "label.edit.project.details": "Edit project details", "label.edit.project.role": "Edit project role", "label.edit.role": "Edit role", @@ -660,6 +677,7 @@ "label.egressdefaultpolicy": "Default egress policy", "label.elastic": "Elastic", "label.email": "Email", +"label.enable.autoscale.vmgroup": "Enable AutoScale VM Group", "label.enable.host": "Enable Host", "label.enable.network.offering": "Enable network offering", "label.enable.provider": "Enable provider", @@ -703,6 +721,7 @@ "label.example": "Example", "label.example.plugin": "ExamplePlugin", "label.expunge": "Expunge", +"label.expungevmgraceperiod": "Expunge VM grace period (in sec)", "label.expunged": "Expunged", "label.expunging": "Expunging", "label.export.rules": "Export Rules", @@ -863,6 +882,7 @@ "label.interval": "Polling interval (in sec)", "label.intervaltype": "Interval type", "label.introduction.to.cloudstack": "Introduction to CloudStack™", +"label.invalid.number": "Invalid number", "label.invitations": "Invitations", "label.invite": "Invite", "label.ip": "IP address", @@ -987,6 +1007,8 @@ "label.lbdevicededicated": "Dedicated", "label.lbdeviceid": "ID", "label.lbdevicestate": "Status", +"label.lbprovider": "Load balancer provider", +"label.lbruleid": "Load balancer ID", "label.lbtype": "Load balancer type", "label.ldap.configuration": "LDAP configuration", "label.ldap.group.name": "LDAP group", @@ -1052,6 +1074,7 @@ "label.maximum": "Maximum", "label.maxinstance": "Max instances", "label.maxiops": "Max IOPS", +"label.maxmembers": "Max members", "label.maxmemory": "Max. memory (MiB)", "label.maxnetwork": "Max. networks", "label.maxprimarystorage": "Max. primary storage (GiB)", @@ -1107,6 +1130,7 @@ "label.minimum": "Minimum", "label.miniops": "Min IOPS", "label.minmaxiops": "Min IOPS / Max IOPS", +"label.minmembers": "Min members", "label.minmemory": "Min memory (in MB)", "label.minsize": "Minimum size", "label.minute.past.hour": "minute(s) past the hour", @@ -1160,6 +1184,7 @@ "label.networktype": "Network type", "label.networkwrite": "Network write", "label.new": "New", +"label.new.autoscale.vmgroup": "New AutoScale VM Group", "label.new.instance.group": "New instance group", "label.new.password": "New password", "label.new.project": "New project", @@ -1207,6 +1232,11 @@ "label.opendaylight.controllers": "OpenDaylight controllers", "label.operation": "Operation", "label.operation.status": "Operation status", +"label.operator.greater": "Greater than", +"label.operator.greater.or.equal": "Greater than or equals to", +"label.operator.less": "Less than", +"label.operator.less.or.equal": "Less than or equals to", +"label.operator.equal": "Equals to", "label.optional": "Optional", "label.order": "Order", "label.oscategoryid": "OS preference", @@ -1241,6 +1271,8 @@ "label.palo.alto.firewall": "Palo Alto firewall", "label.palp": "Palo Alto log profile", "label.params": "Parameters", +"label.param.name": "Parameter name", +"label.param.value": "Parameter value", "label.parentdomainname": "Parent domain", "label.parentname": "Parent", "label.passive": "Passive", @@ -1337,6 +1369,7 @@ "label.public.traffic": "Public traffic", "label.publicinterface": "Public interface", "label.publicip": "IP address", +"label.publicipid": "IP address ID", "label.publickey": "Public key", "label.publicnetwork": "Public network", "label.publicport": "Public port", @@ -1344,6 +1377,7 @@ "label.qostype": "QoS type", "label.quickview": "Quick view", "label.quiescevm": "Quiesce VM", +"label.quiettime": "Quiet time (in sec)", "label.quota": "Quota", "label.quota.add.credits": "Add credits", "label.quota.configuration": "Quota configuration", @@ -1394,6 +1428,7 @@ "label.reinstall.vm": "Reinstall VM", "label.reject": "Reject", "label.related": "Related", +"label.relationaloperator": "Operator", "label.release": "Release", "label.release.account": "Release from account", "label.release.dedicated.cluster": "Release dedicated cluster", @@ -1408,6 +1443,7 @@ "label.remove.ldap": "Remove LDAP", "label.remove.network.offering": "Remove network offering", "label.remove.pf": "Remove port forwarding rule", +"label.remove.policy": "Remove policy", "label.remove.project.account": "Remove account from project", "label.remove.project.role": "Remove project role", "label.remove.project.user": "Remove user from project", @@ -1498,6 +1534,10 @@ "label.save": "Save", "label.save.new.rule": "Save new rule", "label.scale.vm": "Scale VM", +"label.scaledown.policies": "ScaleDown policies", +"label.scaledown.policy": "ScaleDown policy", +"label.scaleup.policies": "ScaleUp policies", +"label.scaleup.policy": "ScaleUp policy", "label.schedule": "Schedule", "label.scheduled.backups": "Scheduled backups", "label.scheduled.snapshots": "Scheduled snapshots", @@ -1675,6 +1715,7 @@ "label.supportsha": "Supports HA", "label.supportspublicaccess": "Supports public access", "label.supportsstrechedl2subnet": "Supports stretched L2 subnet", +"label.supportsvmautoscaling": "Supports VM auto scaling", "label.suspend.project": "Suspend project", "label.switch.type": "Switch type", "label.sync.storage": "Sync storage pool", @@ -1732,6 +1773,7 @@ "label.threadstotalcount": "Total Thread count", "label.threadswaitingcount": "Waiting Threads", "label.threshold": "Threshold", +"label.threshold.description": "Value for which the Counter will be evaluated with the Operator selected", "label.thursday": "Thursday", "label.time": "Time", "label.timeout": "Timeout", @@ -1767,6 +1809,8 @@ "label.unmanaged.instances": "Unmanaged instances", "label.untagged": "Untagged", "label.updateinsequence": "Update in sequence", +"label.update.autoscale.vmgroup": "Update AutoScale VM group", +"label.update.condition": "Update condition", "label.update.instance.group": "Update instance group", "label.update.ip.range": "Update IP range", "label.update.network": "Update network", @@ -1828,6 +1872,7 @@ "label.view.console": "View console", "label.viewing": "Viewing", "label.virtualmachine": "Instance", +"label.virtualmachinecount": "VM Count", "label.virtual.machine": "Virtual machine", "label.virtual.machines": "Virtual machines", "label.virtual.network": "Virtual network", @@ -1921,6 +1966,7 @@ "label.xenservertoolsversion61plus": "Original XS Version is 6.1+", "label.yes": "Yes", "label.yourinstance": "Your instance", +"label.your.autoscale.vmgroup": "Your autoscale vm group", "label.zone": "Zone", "label.zone.dedicated": "Zone dedicated", "label.zone.details": "Zone details", @@ -1937,6 +1983,7 @@ "message.action.cancel.maintenance": "Your host has been successfully canceled for maintenance. This process can take up to several minutes.", "message.action.cancel.maintenance.mode": "Please confirm that you want to cancel this maintenance.", "message.action.create.snapshot.from.vmsnapshot": "Please confirm that you want to create snapshot from VM Snapshot", +"message.action.delete.autoscale.vmgroup": "Please confirm that you want to delete this autoscale vm group.", "message.action.delete.backup.offering": "Please confirm that you want to delete this backup offering?", "message.action.delete.cluster": "Please confirm that you want to delete this cluster.", "message.action.delete.disk.offering": "Please confirm that you want to delete this disk offering.", @@ -2065,6 +2112,10 @@ "message.attach.volume.failed": "Failed to attach volume.", "message.attach.volume.progress": "Attaching volume", "message.authorization.failed": "Session expired, authorization verification failed.", +"message.autoscale.loadbalancer.update": "The load balancer rule can be updated only when autoscale VM group is DISABLED.", +"message.autoscale.policies.update": "The scale up/down policies can be updated only when autoscale VM group is DISABLED.", +"message.autoscale.vm.networks": "Please choose at least one network for VMs in the autoscale VM group. The default network must be an Isolated network or VPC tier which supports VM AutoScaling and has load balancing rules.", +"message.autoscale.vmprofile.update": "The autoscale vm profile can be updated only when autoscale VM group is DISABLED.", "message.backup.attach.restore": "Please confirm that you want to restore and attach the volume from the backup?", "message.backup.create": "Are you sure you want create a VM backup?", "message.backup.offering.remove": "Are you sure you want to remove VM from backup offering and delete the backup chain?", @@ -2102,11 +2153,13 @@ "message.confirm.delete.provider": "Please confirm that you would like to delete this provider?", "message.confirm.delete.srx": "Please confirm that you would like to delete SRX.", "message.confirm.destroy.router": "All services provided by this virtual router will be interrupted. Please confirm that you want to stop this router. Please confirm that you would like to destroy this router.", +"message.confirm.disable.autoscale.vmgroup": "Please confirm that you want to disable this autoscale vm group.", "message.confirm.disable.host": "Please confirm that you want to disable the host.", "message.confirm.disable.network.offering": "Are you sure you want to disable this network offering?", "message.confirm.disable.provider": "Please confirm that you would like to disable this provider.", "message.confirm.disable.storage": "Please confirm that you want to disable the storage pool.", "message.confirm.disable.vpc.offering": "Are you sure you want to disable this VPC offering?", +"message.confirm.enable.autoscale.vmgroup": "Please confirm that you want to enable this autoscale vm group.", "message.confirm.enable.host": "Please confirm that you want to enable the host.", "message.confirm.enable.network.offering": "Are you sure you want to enable this network offering?", "message.confirm.enable.provider": "Please confirm that you would like to enable this provider.", @@ -2138,6 +2191,12 @@ "message.create.volume.processing": "Volume creation in progress", "message.create.vpc.offering": "VPC offering created.", "message.create.vpn.customer.gateway.failed": "VPN customer gateway creation failed.", +"message.creating.autoscale.vmgroup": "Creating AutoScale VM group", +"message.creating.autoscale.vmprofile": "Creating AutoScale VM profile", +"message.creating.autoscale.scaledown.conditions": "Creating ScaleDown conditions", +"message.creating.autoscale.scaledown.policy": "Creating ScaleDown policy", +"message.creating.autoscale.scaleup.conditions": "Creating ScaleUp conditions", +"message.creating.autoscale.scaleup.policy": "Creating ScaleUp policy", "message.creating.cluster": "Creating cluster", "message.creating.guest.network": "Creating guest network", "message.creating.physical.networks": "Creating physical networks", @@ -2242,6 +2301,7 @@ "message.error.description": "Please enter description.", "message.error.discovering.feature": "Exception caught while discovering features.", "message.error.display.text": "Please enter display text.", +"message.error.duration.less.than.interval": "The duration in Autoscale policy cannot be less than interval", "message.error.enable.saml": "Unable to find users IDs to enable SAML single sign on, kindly enable it manually.", "message.error.end.date.and.time": "Please select the end date and time!", "message.error.endip": "Please enter end IP.", @@ -2256,6 +2316,7 @@ "message.error.internallb.instance.port": "Please specify a instance port.", "message.error.internallb.name": "Please specify a name for the internal LB.", "message.error.internallb.source.port": "Please specify a source port.", +"message.error.invalid.autoscale.vmgroup.name": "Invalid AutoScale VM group name. It can contain the ASCII letters 'a' through 'z', 'A' through 'Z', the digits '0' through '9' and the hyphen ('-'), must be between 1 and 255 characters long.", "message.error.ip.range": "Please enter valid range.", "message.error.ipv4.address": "Please enter a valid IPv4 address.", "message.error.ipv4.dns1": "Please enter IpV4 DNS 1.", @@ -2268,6 +2329,7 @@ "message.error.loading.setting": "There was an error loading these settings.", "message.error.lun": "Please enter LUN #.", "message.error.macaddress": "Please enter a valid MAC Address.", +"message.error.max.members.less.than.min.members": "The value of Max members must be larger than the value of Min members", "message.error.name": "Please enter name.", "message.error.netmask": "Please enter Netmask.", "message.error.network.offering": "Please select network offering.", @@ -2290,6 +2352,10 @@ "message.error.retrieve.kubeconfig": "Unable to retrieve Kubernetes cluster config", "message.error.s3nfs.path": "Please enter S3 NFS Path", "message.error.s3nfs.server": "Please enter S3 NFS Server", +"message.error.select.load.balancer": "Please select a load balancer", +"message.error.select.network": "Please select a network", +"message.error.select.network.supports.vm.autoscaling": "The default network you selected does not support VM AutoScaling, please select a default network which supports VM AutoScaling.", +"message.error.select.user": "Please select a user", "message.error.swift.account": "Please enter account", "message.error.swift.key": "Please enter key", "message.error.swift.username": "Please enter username", @@ -2307,6 +2373,7 @@ "message.error.size.for.cluster": "Please enter size for Kubernetes cluster.", "message.error.smb.password": "Please enter SMB password.", "message.error.smb.username": "Please enter SMB username.", +"message.error.specify.stickiness.method": "Please specify a stickiness method", "message.error.specify.sticky.name": "Please specify a sticky name.", "message.error.sr.namelabel": "Please enter SR Name-Label.", "message.error.start.date.and.time": "Please select the start date and time!", @@ -2431,6 +2498,7 @@ "message.please.confirm.remove.user.data": "Please confirm that you want to remove this userdata", "message.please.enter.valid.value": "Please enter a valid value.", "message.please.enter.value": "Please enter values.", +"message.please.wait.while.autoscale.vmgroup.is.being.created": "Please wait while your AutoScale VM group is being created; this may take a while...", "message.please.wait.while.zone.is.being.created": "Please wait while your zone is being created; this may take a while...", "message.pod.dedicated": "Pod dedicated.", "message.pod.dedication.released": "Pod dedication released.", @@ -2480,11 +2548,20 @@ "message.restart.vpc": "Please confirm that you want to restart the VPC.", "message.restart.vpc.remark": "Please confirm that you want to restart the VPC

Remark: making a non-redundant VPC redundant will force a clean up. The networks will not be available for a couple of minutes.

", "message.scale.processing": "Scale in progress", +"message.scaledown.policies": "Please add at least a ScaleDown policy. The AutoScale VM group will be scaled down when all conditions in a ScaleDown policy are matched. ScaleDown policies will be checked after ScaleUp policies.", +"message.scaledown.policy.continue": "Please add at least condition to ScaleDown policy to continue", +"message.scaledown.policy.duration.continue": "Please input a valid duration to ScaleDown policy to continue", +"message.scaledown.policy.name.continue": "Please input a name to ScaleDown policy to continue", +"message.scaleup.policies": "Please add at least a ScaleUp policy. The AutoScale VM group will be scaled up when all conditions in a ScaleUp policy are matched. ScaleUp policies will be checked before ScaleDown policies.", +"message.scaleup.policy.continue": "Please add at least a condition to ScaleUp policy to continue", +"message.scaleup.policy.duration.continue": "Please input a valid duration to ScaleUp policy to continue", +"message.scaleup.policy.name.continue": "Please input a name to ScaleUp policy to continue", "message.select.a.zone": "A zone typically corresponds to a single datacenter. Multiple zones help make the cloud more reliable by providing physical isolation and redundancy.", "message.select.affinity.groups": "Please select any affinity groups you want this VM to belong to:", "message.select.destination.image.stores": "Please select Image Store(s) to which data is to be migrated to", "message.select.disk.offering": "Please select a disk offering for disk", "message.select.end.date.and.time": "Select an end date & time.", +"message.select.load.balancer.rule": "Please select a load balancer rule for your AutoScale VM group.", "message.select.migration.policy": "Please select a migration policy.", "message.select.nic.network": "Please select a network for NIC", "message.select.security.groups": "Please select security group(s) for your new VM.", @@ -2580,6 +2657,7 @@ "message.success.resize.volume": "Successfully resized volume", "message.success.scale.kubernetes": "Successfully scaled Kubernetes cluster", "message.success.unmanage.instance": "Successfully unmanaged instance", +"message.success.update.condition": "Successfully updated condition", "message.success.update.ipaddress": "Successfully updated IP address", "message.success.update.iprange": "Successfully updated IP range", "message.success.update.kubeversion": "Successfully updated Kubernetes supported version", @@ -2602,6 +2680,11 @@ "message.template.type.change.warning": "WARNING: Changing the template type to SYSTEM will disable further changes to the template.", "message.tooltip.reserved.system.netmask": "The network prefix that defines the pod subnet. Uses CIDR notation.", "message.traffic.type.to.basic.zone": "traffic type to basic zone", +"message.update.autoscale.policy.failed": "Failed to update autoscale policy", +"message.update.autoscale.vmgroup.failed": "Failed to update autoscale vm group", +"message.update.autoscale.vm.profile.failed": "Failed to update autoscale vm profile", +"message.update.condition.failed": "Failed to update condition", +"message.update.condition.processing": "Updating condition...", "message.update.ipaddress.processing": "Updating IP Address...", "message.update.resource.count": "Please confirm that you want to update resource counts for this account.", "message.update.resource.count.domain": "Please confirm that you want to update resource counts for this domain.", @@ -2619,6 +2702,7 @@ "message.validate.maxlength": "Please enter no more than {0} characters.", "message.validate.minlength": "Please enter at least {0} characters.", "message.validate.number": "Please enter a valid number.", +"message.validate.positive.number": "Please enter a valid positive number.", "message.validate.range": "Please enter a value between {0} and {1}.", "message.validate.range.length": "Please enter a value between {0} and {1} characters long.", "message.virtual.router.not.return.elementid": "error: listVirtualRouterElements API doesn't return virtual router element ID.", @@ -2659,7 +2743,7 @@ "message.zone.creation.complete": "Zone creation complete.", "message.zone.detail.description": "Populate zone details.", "message.zone.detail.hint": "A zone is the largest organizational unit in CloudStack, and it typically corresponds to a single datacenter. Zones provide physical isolation and redundancy. A zone consists of one or more pods (each of which contains hosts and primary storage servers) and a secondary storage server which is shared by all pods in the zone.", -"messgae.validate.min": "Please enter a value greater than or equal to {0}.", +"message.validate.min": "Please enter a value greater than or equal to {0}.", "migrate.from": "Migrate from", "migrate.to": "Migrate to", "migrationPolicy": "Migration policy", @@ -2685,4 +2769,4 @@ "state.suspended": "Suspended", "user.login": "Login", "user.logout": "Logout" -} \ No newline at end of file +} diff --git a/ui/public/locales/es.json b/ui/public/locales/es.json index 475469720227..4f9d2f2f32a2 100644 --- a/ui/public/locales/es.json +++ b/ui/public/locales/es.json @@ -1493,7 +1493,7 @@ "message.validate.range.length": "Por favor ingrese un valor entre {0} y {1} caracteres de longitud.", "message.vm.review.launch": "Por favor revise la siguiente informaci\u00f3n y confirme que su instancia virtual es correcta antes de lanzarla.", "message.zone.creation.complete": "Creaci\u00f3n de la zona completada", -"messgae.validate.min": "Por favor ingrese un valor mayor o igual que {0}.", +"message.validate.min": "Por favor ingrese un valor mayor o igual que {0}.", "side.by.side": "Juntos", "state.completed": "Completado", "state.declined": "Declinado", diff --git a/ui/public/locales/fr_FR.json b/ui/public/locales/fr_FR.json index c1fd67d45c66..d968124723df 100644 --- a/ui/public/locales/fr_FR.json +++ b/ui/public/locales/fr_FR.json @@ -1463,7 +1463,7 @@ "message.validate.range.length": "Veuillez entrer une valeur de {0} \u00e0 {1} caract\u00e8res.", "message.vm.review.launch": "Merci de v\u00e9rifier les informations suivantes et de confirmer que votre instance virtuelle est correcte avant de la d\u00e9marrer.", "message.zone.creation.complete": "Cr\u00e9ation de la zone termin\u00e9e", -"messgae.validate.min": "Veuillez entrer une valeur sup\u00e9rieure ou \u00e9gale \u00e0 {0}.", +"message.validate.min": "Veuillez entrer une valeur sup\u00e9rieure ou \u00e9gale \u00e0 {0}.", "side.by.side": "C\u00f4te \u00e0 c\u00f4te", "state.completed": "Termin\u00e9", "state.declined": "Refus\u00e9", diff --git a/ui/public/locales/hu.json b/ui/public/locales/hu.json index 493d4257105e..257377d423e4 100644 --- a/ui/public/locales/hu.json +++ b/ui/public/locales/hu.json @@ -1461,7 +1461,7 @@ "message.validate.range.length": "Adj meg egy {0} \u00e9s {1} k\u00f6z\u00f6tti hossz\u00fas\u00e1g\u00fa \u00e9rt\u00e9ket!", "message.vm.review.launch": "Please review the following information and confirm that your virtual instance is correct before launch.", "message.zone.creation.complete": "A z\u00f3na l\u00e9trehoz\u00e1sa befejez\u0151d\u00f6tt", -"messgae.validate.min": "Adj meg egy \u00e9rt\u00e9ket, ami legal\u00e1bb {0}!", +"message.validate.min": "Adj meg egy \u00e9rt\u00e9ket, ami legal\u00e1bb {0}!", "side.by.side": "Egym\u00e1s mellett", "state.completed": "K\u00e9sz", "state.declined": "Elromlott", diff --git a/ui/public/locales/it_IT.json b/ui/public/locales/it_IT.json index 75aeb8b31e4b..73bb05943e96 100644 --- a/ui/public/locales/it_IT.json +++ b/ui/public/locales/it_IT.json @@ -1461,7 +1461,7 @@ "message.validate.range.length": "Please enter a value between {0} and {1} characters long.", "message.vm.review.launch": "Si prega di riesaminare le informazioni e confermare l'instance virtuale scelta sia corretta prima di avviarla.", "message.zone.creation.complete": "Creazione zona completata", -"messgae.validate.min": "Please enter a value greater than or equal to {0}.", +"message.validate.min": "Please enter a value greater than or equal to {0}.", "side.by.side": "Side by Side", "state.completed": "Completato", "state.declined": "Declinato", diff --git a/ui/public/locales/ja_JP.json b/ui/public/locales/ja_JP.json index dd162bc0a6bd..2288b3119b5d 100644 --- a/ui/public/locales/ja_JP.json +++ b/ui/public/locales/ja_JP.json @@ -779,7 +779,7 @@ "label.destroy": "破棄", "label.destroy.kubernetes.cluster": "Kubernetesクラスターを破棄", "label.destroy.router": "ルーターを破棄", - "label.destroyvmgraceperiod": "VM破棄の猶予期間", + "label.expungevmgraceperiod": "VM破棄の猶予期間", "label.detaching.disk": "ディスクをデタッチしています", "label.details": "詳細", "label.deviceid": "デバイスID", @@ -3495,7 +3495,7 @@ "message.zone.step.2.desc": "新しいゾーンを追加するために、次の情報を入力してください。", "message.zone.step.3.desc": "新しいポッドを追加するために、次の情報を入力してください。", "message.zonewizard.enable.local.storage": "警告: このゾーンのローカルストレージを有効にする場合は、システムVMの起動場所に応じて次の操作が必要です。

1. システムVMを共有プライマリストレージで起動する必要がある場合は、共有プライマリストレージを作成した後でゾーンに追加する必要があります。ゾーンを無効状態から開始する必要もあります。

2. システムVMをローカルプライマリストレージで起動する必要がある場合は、ゾーンを有効にする前にsystem.vm.use.local.storageをtrueに設定する必要があります。


続行してもよろしいですか?", - "messgae.validate.min": "{0}以上の値を入力してください。", + "message.validate.min": "{0}以上の値を入力してください。", "migrate.from": "マイグレーション元", "migrate.to": "マイグレーション先", "migrationPolicy": "マイグレーションポリシー", diff --git a/ui/public/locales/ko_KR.json b/ui/public/locales/ko_KR.json index 640f17a6798e..c1c0e5a11b9b 100644 --- a/ui/public/locales/ko_KR.json +++ b/ui/public/locales/ko_KR.json @@ -2297,7 +2297,7 @@ "message.zone.creation.complete": "Zone\uc744 \uc0dd\uc131\ud558\uc600\uc2b5\ub2c8\ub2e4.", "message.zone.detail.description": "Zone \uc138\ubd80 \uc815\ubcf4 \ucc44\uc6b0\uae30", "message.zone.detail.hint": "A \uc601\uc5ed\uc740 CloudStack\uc5d0\uc11c \uac00\uc7a5 \ud070 \uc870\uc9c1 \ub2e8\uc704\uc774\uba70 \uc77c\ubc18\uc801\uc73c\ub85c \ub2e8\uc77c \ub370\uc774\ud130 \uc13c\ud130\uc5d0 \ud574\ub2f9\ud569\ub2c8\ub2e4. \uc601\uc5ed\uc740 \ubb3c\ub9ac\uc801 \uaca9\ub9ac \ubc0f \uc911\ubcf5\uc131\uc744 \uc81c\uacf5\ud569\ub2c8\ub2e4. Zone\uc740 \uac01\uac01 \ud638\uc2a4\ud2b8 \ubc0f \uae30\ubcf8 \uc2a4\ud1a0\ub9ac\uc9c0 \uc11c\ubc84\uac00\uc788\ub294 \ud558\ub098 \uc774\uc0c1\uc758 Pod\uc640 Zone\uc758 \ubaa8\ub4e0 Pod\uac00 \uacf5\uc720\ud558\ub294 2\ucc28 \uc2a4\ud1a0\ub9ac\uc9c0 \uc11c\ubc84\ub85c \uad6c\uc131\ub429\ub2c8\ub2e4.", -"messgae.validate.min": "{0}\ubcf4\ub2e4 \ud06c\uac70\ub098 \uac19\uc740 \uac12\uc744 \uc785\ub825\ud558\uc2ed\uc2dc\uc624.", +"message.validate.min": "{0}\ubcf4\ub2e4 \ud06c\uac70\ub098 \uac19\uc740 \uac12\uc744 \uc785\ub825\ud558\uc2ed\uc2dc\uc624.", "migrate.from": "Migrate From", "migrate.to": "Migrate To", "migrationPolicy": "\ub9c8\uc774\uadf8\ub808\uc774\uc158 \uc815\ucc45", diff --git a/ui/public/locales/nb_NO.json b/ui/public/locales/nb_NO.json index 668db1254237..c16800f2f172 100644 --- a/ui/public/locales/nb_NO.json +++ b/ui/public/locales/nb_NO.json @@ -1461,7 +1461,7 @@ "message.validate.range.length": "Vennligst skriv inn en verdi som er mellom {0} og {1} tegn langt.", "message.vm.review.launch": "Vennligst vurder f\u00f8lgende informasjon og bekreft at din virtuelle instans er korrekt f\u00f8r kj\u00f8ring", "message.zone.creation.complete": "Opprettelsen av sonen utf\u00f8rt", -"messgae.validate.min": "Skriv en verdig st\u00f8rre enn eller lik {0}.", +"message.validate.min": "Skriv en verdig st\u00f8rre enn eller lik {0}.", "side.by.side": "Side ved side", "state.completed": "Utf\u00f8rt", "state.declined": "Avvist", diff --git a/ui/public/locales/nl_NL.json b/ui/public/locales/nl_NL.json index fc503dfb4af0..6177369b34ba 100644 --- a/ui/public/locales/nl_NL.json +++ b/ui/public/locales/nl_NL.json @@ -1462,7 +1462,7 @@ "message.validate.range.length": "Gelieve een waarde tussen de {0} en {1} karakters lang in te geven.", "message.vm.review.launch": "Gelieve de volgende gegevens te verifi\u00ebren te bevestigen zodat uw instantie gestart kan worden.", "message.zone.creation.complete": "De installatie van de zone is compleet", -"messgae.validate.min": "Gelieve een waarde groter of gelijk aan {0} in te geven.", +"message.validate.min": "Gelieve een waarde groter of gelijk aan {0} in te geven.", "side.by.side": "Zij aan Zij", "state.completed": "Uitgevoerd", "state.declined": "Geweigerd", diff --git a/ui/public/locales/pl.json b/ui/public/locales/pl.json index a558afdeb1b7..f5337f3caca3 100644 --- a/ui/public/locales/pl.json +++ b/ui/public/locales/pl.json @@ -1462,7 +1462,7 @@ "message.validate.range.length": "Please enter a value between {0} and {1} characters long.", "message.vm.review.launch": "Please review the following information and confirm that your virtual instance is correct before launch.", "message.zone.creation.complete": "Zone creation complete", -"messgae.validate.min": "Please enter a value greater than or equal to {0}.", +"message.validate.min": "Please enter a value greater than or equal to {0}.", "side.by.side": "Side by Side", "state.completed": "Uko\u0144czono", "state.declined": "Odrzucono", diff --git a/ui/public/locales/pt_BR.json b/ui/public/locales/pt_BR.json index c85a5f4d8013..3521832c220e 100644 --- a/ui/public/locales/pt_BR.json +++ b/ui/public/locales/pt_BR.json @@ -2470,7 +2470,7 @@ "message.zone.creation.complete": "Cria\u00e7\u00e3o de zona completa", "message.zone.detail.description": "Preencha os detalhes da zona", "message.zone.detail.hint": "Uma zona \u00e9 a maior unidade organizacional no CloudStack, e normalmente corresponde a um \u00fanico datacenter. As zonas proporcionam isolamento f\u00edsico e redund\u00e2ncia. Uma zona consiste em um ou mais pods (cada um contendo hosts e servidores de armazenamento prim\u00e1rio) e um servidor de armazenamento secund\u00e1rio que \u00e9 compartilhado por todos os pods da zona.", -"messgae.validate.min": "Por favor entre com um valor maior que ou igual a {0}.", +"message.validate.min": "Por favor entre com um valor maior que ou igual a {0}.", "migrate.from": "Migrar de", "migrate.to": "Migrar para", "migrationPolicy": "Pol\u00edtica de migra\u00e7\u00e3o", diff --git a/ui/public/locales/ru_RU.json b/ui/public/locales/ru_RU.json index 870f235a2bae..12a201e837c9 100644 --- a/ui/public/locales/ru_RU.json +++ b/ui/public/locales/ru_RU.json @@ -1460,7 +1460,7 @@ "message.validate.range.length": "Please enter a value between {0} and {1} characters long.", "message.vm.review.launch": "\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0438 \u0443\u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u044c\u0442\u0435\u0441\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u0430\u0448\u0430 \u043c\u0430\u0448\u0438\u043d\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e.", "message.zone.creation.complete": "\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0437\u043e\u043d\u044b \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e", -"messgae.validate.min": "Please enter a value greater than or equal to {0}.", +"message.validate.min": "Please enter a value greater than or equal to {0}.", "side.by.side": "\u0411\u043e\u043a-\u043e-\u0411\u043e\u043a", "state.completed": "\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e", "state.declined": "\u041e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u043e", diff --git a/ui/public/locales/zh_CN.json b/ui/public/locales/zh_CN.json index 4ef642607a4c..cf65c982a699 100644 --- a/ui/public/locales/zh_CN.json +++ b/ui/public/locales/zh_CN.json @@ -899,7 +899,7 @@ "label.destroy": "\u9500\u6BC1", "label.destroy.kubernetes.cluster": "\u6467\u6BC1 Kubernetes \u96C6\u7FA4", "label.destroy.router": "\u9500\u6BC1\u8DEF\u7531\u5668", - "label.destroyvmgraceperiod": "\u9500\u6BC1\u865A\u62DF\u673A\u5BBD\u9650\u671F", + "label.expungevmgraceperiod": "\u9500\u6BC1\u865A\u62DF\u673A\u5BBD\u9650\u671F", "label.detaching.disk": "\u6B63\u5728\u53D6\u6D88\u9644\u52A0\u78C1\u76D8", "label.details": "\u8BE6\u7EC6\u4FE1\u606F", "label.deviceid": "\u8BBE\u5907\u6807\u8BC6\u7801", @@ -3976,7 +3976,7 @@ "message.zone.step.3.desc": "\u8BF7\u8F93\u5165\u4EE5\u4E0B\u4FE1\u606F\u4EE5\u6DFB\u52A0\u4E00\u4E2A\u65B0\u63D0\u4F9B\u70B9", "message.zonewizard.enable.local.storage": "\u8B66\u544A: \u5982\u679C\u4E3A\u6B64\u8D44\u6E90\u57DF\u542F\u7528\u4E86\u672C\u5730\u5B58\u50A8\uFF0C\u5219\u5FC5\u987B\u6267\u884C\u4EE5\u4E0B\u64CD\u4F5C\uFF0C\u5177\u4F53\u53D6\u51B3\u4E8E\u60A8\u5E0C\u671B\u542F\u52A8\u7CFB\u7EDF\u865A\u62DF\u673A\u7684\u4F4D\u7F6E:

1. \u5982\u679C\u9700\u8981\u5728\u5171\u4EAB\u4E3B\u5B58\u50A8\u4E2D\u542F\u52A8\u7CFB\u7EDF\u865A\u62DF\u673A\uFF0C\u5219\u5FC5\u987B\u5728\u5B8C\u6210\u521B\u5EFA\u540E\u5C06\u5171\u4EAB\u4E3B\u5B58\u50A8\u6DFB\u52A0\u5230\u6B64\u8D44\u6E90\u57DF\u3002

2. \u5982\u679C\u9700\u8981\u5728\u672C\u5730\u4E3B\u5B58\u50A8\u4E2D\u542F\u52A8\u7CFB\u7EDF\u865A\u62DF\u673A\uFF0C\u5219\u5FC5\u987B\u5728\u542F\u7528\u6B64\u8D44\u6E90\u57DF\u4E4B\u524D\u5C06 system.vm.use.local.storage \u8BBE\u7F6E\u4E3A true\u3002


\u662F\u5426\u8981\u7EE7\u7EED\uFF1F", - "messgae.validate.min": "\u8BF7\u8F93\u5165\u4E00\u4E2A\u5927\u4E8E\u6216\u7B49\u4E8E {0} \u7684\u503C\u3002", + "message.validate.min": "\u8BF7\u8F93\u5165\u4E00\u4E2A\u5927\u4E8E\u6216\u7B49\u4E8E {0} \u7684\u503C\u3002", "migrate.from": "\u8FC1\u79BB", "migrate.to": "\u8FC1\u79FB\u5230", "migrationPolicy": "\u8FC1\u79FB\u7B56\u7565", diff --git a/ui/src/components/view/AnnotationsTab.vue b/ui/src/components/view/AnnotationsTab.vue index daad48c5b819..36539a268eba 100644 --- a/ui/src/components/view/AnnotationsTab.vue +++ b/ui/src/components/view/AnnotationsTab.vue @@ -191,6 +191,7 @@ export default { case 'SecondaryStorage': return 'SECONDARY_STORAGE' case 'SystemVm': return 'SYSTEM_VM' case 'VirtualRouter': return 'VR' + case 'AutoScaleVmGroup': return 'AUTOSCALE_VM_GROUP' default: return '' } }, diff --git a/ui/src/components/view/InfoCard.vue b/ui/src/components/view/InfoCard.vue index 7ed56c9fde4a..32ac7aad91b1 100644 --- a/ui/src/components/view/InfoCard.vue +++ b/ui/src/components/view/InfoCard.vue @@ -317,6 +317,13 @@ +
+
{{ $t('label.loadbalancerrule') }}
+
+ + {{ resource.loadbalancer.name }} ( {{ resource.loadbalancer.publicip }}:{{ resource.loadbalancer.publicport }}) +
+
{{ $t('label.ip') }}
@@ -351,6 +358,13 @@ {{ resource.group || resource.groupid }}
+
+
{{ $t('label.autoscalevmgroupname') }}
+
+ + {{ resource.autoscalevmgroupname || resource.autoscalevmgroupid }} +
+
{{ $t('label.keypairs') }}
@@ -402,6 +416,13 @@ {{ resource.guestnetworkname || resource.guestnetworkid }}
+
+
{{ $t('label.publicip') }}
+
+ + {{ resource.publicip }} +
+
{{ $t('label.vpcname') }}
diff --git a/ui/src/components/view/ListView.vue b/ui/src/components/view/ListView.vue index d964d2759dc8..6111300881c6 100644 --- a/ui/src/components/view/ListView.vue +++ b/ui/src/components/view/ListView.vue @@ -162,7 +162,8 @@ {{ ipV6Address(text, record) }} -