diff --git a/agent/conf/log4j-cloud.xml.in b/agent/conf/log4j-cloud.xml.in
index 6bc80f084739..093b5dab6b82 100644
--- a/agent/conf/log4j-cloud.xml.in
+++ b/agent/conf/log4j-cloud.xml.in
@@ -58,7 +58,38 @@ under the License.
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/api/src/com/cloud/agent/api/Answer.java b/api/src/com/cloud/agent/api/Answer.java
index 17bba76e14d0..25a2f5c476b9 100644
--- a/api/src/com/cloud/agent/api/Answer.java
+++ b/api/src/com/cloud/agent/api/Answer.java
@@ -19,6 +19,7 @@
import com.cloud.utils.exception.ExceptionUtil;
public class Answer extends Command {
+ public AnswerTypeError typeError;
protected boolean result;
protected String details;
@@ -35,6 +36,12 @@ public Answer(final Command command, final boolean success, final String details
this.details = details;
}
+ public Answer(final Command command, final boolean success, final String details, final AnswerTypeError type) {
+ this.typeError = type;
+ result = success;
+ this.details = details;
+ }
+
public Answer(final Command command, final Exception e) {
this(command, false, ExceptionUtil.toString(e));
}
@@ -60,6 +67,14 @@ public static UnsupportedAnswer createUnsupportedVersionAnswer(final Command cmd
return new UnsupportedAnswer(cmd, "Unsuppored Version.");
}
+ public AnswerTypeError getTypeError() {
+ return typeError;
+ }
+
+ public enum AnswerTypeError {
+ DNS_IO_ERROR
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
diff --git a/api/src/com/cloud/agent/api/to/SrTO.java b/api/src/com/cloud/agent/api/to/SrTO.java
new file mode 100644
index 000000000000..7f3ec32f674e
--- /dev/null
+++ b/api/src/com/cloud/agent/api/to/SrTO.java
@@ -0,0 +1,35 @@
+// 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;
+
+public class SrTO {
+
+ protected String ref;
+
+ public SrTO(String ref) {
+ this.ref = ref;
+ }
+
+ public String getRef() {
+ return ref;
+ }
+
+ public void setRef(String ref) {
+ this.ref = ref;
+ }
+}
+
diff --git a/api/src/com/cloud/agent/api/to/VirtualNetworkTO.java b/api/src/com/cloud/agent/api/to/VirtualNetworkTO.java
new file mode 100644
index 000000000000..1f69599d37a2
--- /dev/null
+++ b/api/src/com/cloud/agent/api/to/VirtualNetworkTO.java
@@ -0,0 +1,33 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.to;
+
+public class VirtualNetworkTO {
+ protected String ref;
+
+ public VirtualNetworkTO(String ref) {
+ this.ref = ref;
+ }
+
+ public String getRef() {
+ return ref;
+ }
+
+ public void setRef(String ref) {
+ this.ref = ref;
+ }
+}
diff --git a/api/src/com/cloud/event/EventTypes.java b/api/src/com/cloud/event/EventTypes.java
index 907b93eca103..0486075ca47d 100644
--- a/api/src/com/cloud/event/EventTypes.java
+++ b/api/src/com/cloud/event/EventTypes.java
@@ -149,7 +149,9 @@ public class EventTypes {
// Load Balancers
public static final String EVENT_ASSIGN_TO_LOAD_BALANCER_RULE = "LB.ASSIGN.TO.RULE";
+ public static final String EVENT_ASSIGN_NETWORK_TO_LOAD_BALANCER_RULE = "LB.ASSIGN.NETWORK.TO.RULE";
public static final String EVENT_REMOVE_FROM_LOAD_BALANCER_RULE = "LB.REMOVE.FROM.RULE";
+ public static final String EVENT_REMOVE_NETWORK_FROM_LOAD_BALANCER_RULE = "LB.REMOVE.NETWORK.FROM.RULE";
public static final String EVENT_LOAD_BALANCER_CREATE = "LB.CREATE";
public static final String EVENT_LOAD_BALANCER_DELETE = "LB.DELETE";
public static final String EVENT_LB_STICKINESSPOLICY_CREATE = "LB.STICKINESSPOLICY.CREATE";
@@ -163,6 +165,11 @@ public class EventTypes {
public static final String EVENT_LB_CERT_DELETE = "LB.CERT.DELETE";
public static final String EVENT_LB_CERT_ASSIGN = "LB.CERT.ASSIGN";
public static final String EVENT_LB_CERT_REMOVE = "LB.CERT.REMOVE";
+ public static final String EVENT_LB_REGISTER_DNS = "LB.DNS.REGISTRY";
+ public static final String EVENT_LB_CREATE_POOL = "LB.POOL.CREATE";
+ public static final String EVENT_LB_REMOVE_POOL = "LB.POOL.REMOVE";
+ public static final String EVENT_LB_LINK = "LB.LINK";
+ public static final String EVENT_LB_UNLINK = "LB.UNLINK";
// Global Load Balancer rules
public static final String EVENT_ASSIGN_TO_GLOBAL_LOAD_BALANCER_RULE = "GLOBAL.LB.ASSIGN";
@@ -322,6 +329,9 @@ public class EventTypes {
// Host
public static final String EVENT_HOST_RECONNECT = "HOST.RECONNECT";
+ public static final String EVENT_HOST_CREATE = "HOST.CREATE";
+ public static final String EVENT_HOST_DELETE = "HOST.DELETE";
+ public static final String EVENT_HOST_UPDATE = "HOST.UPDATE";
// Host Out-of-band management
public static final String EVENT_HOST_OUTOFBAND_MANAGEMENT_ENABLE = "HOST.OOBM.ENABLE";
@@ -497,6 +507,11 @@ public class EventTypes {
public static final String EVENT_AUTOSCALEVMGROUP_ENABLE = "AUTOSCALEVMGROUP.ENABLE";
public static final String EVENT_AUTOSCALEVMGROUP_DISABLE = "AUTOSCALEVMGROUP.DISABLE";
+ public static final String EVENT_AUTOSCALEVMGROUP_SCALEUP = "AUTOSCALE.SCALEUP";
+ public static final String EVENT_AUTOSCALEVMGROUP_SCALEUP_FAILED = "AUTOSCALE.SCALEUP.FAILED";
+ public static final String EVENT_AUTOSCALEVMGROUP_SCALEDOWN = "AUTOSCALE.SCALEDOWN";
+ public static final String EVENT_AUTOSCALEVMGROUP_SCALEDOWN_FAILED = "AUTOSCALE.SCALEDOWN.FAILED";
+
public static final String EVENT_BAREMETAL_DHCP_SERVER_ADD = "PHYSICAL.DHCP.ADD";
public static final String EVENT_BAREMETAL_DHCP_SERVER_DELETE = "PHYSICAL.DHCP.DELETE";
public static final String EVENT_BAREMETAL_PXE_SERVER_ADD = "PHYSICAL.PXE.ADD";
@@ -796,6 +811,9 @@ public class EventTypes {
// Host
entityEventDetails.put(EVENT_HOST_RECONNECT, Host.class);
+ entityEventDetails.put(EVENT_HOST_CREATE, Host.class);
+ entityEventDetails.put(EVENT_HOST_DELETE, Host.class);
+ entityEventDetails.put(EVENT_HOST_UPDATE, Host.class);
// Host Out-of-band management
entityEventDetails.put(EVENT_HOST_OUTOFBAND_MANAGEMENT_ENABLE, Host.class);
@@ -947,6 +965,10 @@ 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_SCALEUP, AutoScaleVmGroup.class);
+ entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_SCALEUP_FAILED, AutoScaleVmGroup.class);
+ entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_SCALEDOWN, AutoScaleVmGroup.class);
+ entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_SCALEDOWN_FAILED, 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/com/cloud/globodictionary/GloboDictionaryEntity.java b/api/src/com/cloud/globodictionary/GloboDictionaryEntity.java
new file mode 100644
index 000000000000..d21e34e00ff1
--- /dev/null
+++ b/api/src/com/cloud/globodictionary/GloboDictionaryEntity.java
@@ -0,0 +1,34 @@
+/*
+* 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.globodictionary;
+
+public interface GloboDictionaryEntity extends Comparable {
+
+ String getId();
+
+ void setId(String id);
+
+ String getName();
+
+ void setName(String name);
+
+ String getStatus();
+
+ void setStatus(String status);
+
+ boolean isActive();
+}
diff --git a/api/src/com/cloud/globodictionary/GloboDictionaryService.java b/api/src/com/cloud/globodictionary/GloboDictionaryService.java
new file mode 100644
index 000000000000..6693cb19d19d
--- /dev/null
+++ b/api/src/com/cloud/globodictionary/GloboDictionaryService.java
@@ -0,0 +1,48 @@
+/*
+* 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.globodictionary;
+
+import java.util.List;
+
+public interface GloboDictionaryService {
+
+ enum GloboDictionaryEntityType {
+ CLIENT("/clientes", "Clients"), BUSINESS_SERVICE("/servicos-de-negocio", "Business Services"),
+ COMPONENT("/componentes", "Components"), SUB_COMPONENT("/sub-componentes", "Sub-components"),
+ PRODUCT("/produtos", "Products");
+
+ private final String uri;
+ private final String friendlyName;
+
+ GloboDictionaryEntityType(String uri, String friendlyName) {
+ this.uri = uri;
+ this.friendlyName = friendlyName;
+ }
+
+ public String getUri() {
+ return uri;
+ }
+
+ public String getFriendlyName() {
+ return friendlyName;
+ }
+ }
+
+ List list(GloboDictionaryEntityType type);
+
+ GloboDictionaryEntity get(GloboDictionaryEntityType type, String id);
+}
diff --git a/api/src/com/cloud/network/IpAddress.java b/api/src/com/cloud/network/IpAddress.java
index 2447809d66f5..3f76c1c8e725 100644
--- a/api/src/com/cloud/network/IpAddress.java
+++ b/api/src/com/cloud/network/IpAddress.java
@@ -86,6 +86,7 @@ enum Purpose {
Long getNetworkId();
+ @Override
boolean isDisplay();
public Date getRemoved();
diff --git a/api/src/com/cloud/network/Network.java b/api/src/com/cloud/network/Network.java
index 75196a469d3e..068f8bdef3f9 100644
--- a/api/src/com/cloud/network/Network.java
+++ b/api/src/com/cloud/network/Network.java
@@ -135,6 +135,10 @@ public static class Provider {
// add new Ovs provider
public static final Provider Ovs = new Provider("Ovs", false);
public static final Provider Opendaylight = new Provider("Opendaylight", false);
+
+ // add GloboNetwork provider
+ public static final Provider GloboNetwork = new Provider("GloboNetwork", true);
+ public static final Provider GloboAclApi = new Provider("GloboACLAPI", true);
// add Nuage Vsp Providers
public static final Provider NuageVsp = new Provider("NuageVsp", false);
public static final Provider BrocadeVcs = new Provider("BrocadeVcs", false);
diff --git a/api/src/com/cloud/network/NetworkService.java b/api/src/com/cloud/network/NetworkService.java
index d76d65972026..ab68311b75be 100644
--- a/api/src/com/cloud/network/NetworkService.java
+++ b/api/src/com/cloud/network/NetworkService.java
@@ -67,6 +67,7 @@ IpAddress allocatePortableIP(Account ipOwner, int regionId, Long zoneId, Long ne
Network createGuestNetwork(CreateNetworkCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException;
Pair, Integer> searchForNetworks(ListNetworksCmd cmd);
+ List extends Network> searchForAllNetworks(ListNetworksCmd cmd);
boolean deleteNetwork(long networkId, boolean forced);
diff --git a/api/src/com/cloud/network/as/AutoScaleCounter.java b/api/src/com/cloud/network/as/AutoScaleCounter.java
index f25d6699a006..0447343f7c43 100644
--- a/api/src/com/cloud/network/as/AutoScaleCounter.java
+++ b/api/src/com/cloud/network/as/AutoScaleCounter.java
@@ -29,6 +29,9 @@ public static class AutoScaleCounterType {
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 ActiveConnections = new AutoScaleCounterType("active_connections");
+ public static final AutoScaleCounterType MemoryNoCache = new AutoScaleCounterType("memory_no_cache");
+
public AutoScaleCounterType(String name) {
_name = name;
diff --git a/api/src/com/cloud/network/as/AutoScalePolicy.java b/api/src/com/cloud/network/as/AutoScalePolicy.java
index 56ea3f5f7f72..0c3476f63c4f 100644
--- a/api/src/com/cloud/network/as/AutoScalePolicy.java
+++ b/api/src/com/cloud/network/as/AutoScalePolicy.java
@@ -24,6 +24,10 @@
public interface AutoScalePolicy extends ControlledEntity, InternalIdentity {
+ enum LogicalOperator{
+ OR, AND
+ }
+
@Override
long getId();
@@ -37,4 +41,8 @@ public interface AutoScalePolicy extends ControlledEntity, InternalIdentity {
public String getAction();
+ public LogicalOperator getLogicalOperator();
+
+ public Integer getStep();
+
}
diff --git a/api/src/com/cloud/network/as/AutoScaleService.java b/api/src/com/cloud/network/as/AutoScaleService.java
index 32d693d7b8a4..b98657b6a1c2 100644
--- a/api/src/com/cloud/network/as/AutoScaleService.java
+++ b/api/src/com/cloud/network/as/AutoScaleService.java
@@ -59,6 +59,8 @@ public interface AutoScaleService {
boolean deleteAutoScaleVmGroup(long vmGroupId);
+ boolean deleteAutoScaleVmGroupWithDependencies(long vmGroupId);
+
AutoScaleVmGroup updateAutoScaleVmGroup(UpdateAutoScaleVmGroupCmd cmd);
AutoScaleVmGroup enableAutoScaleVmGroup(Long id);
@@ -78,4 +80,5 @@ public interface AutoScaleService {
List extends Condition> listConditions(ListConditionsCmd cmd);
boolean deleteCondition(long conditionId) throws ResourceInUseException;
+
}
diff --git a/api/src/com/cloud/network/as/AutoScaleVmGroup.java b/api/src/com/cloud/network/as/AutoScaleVmGroup.java
index cf2c15c42166..59c4289ee0c0 100644
--- a/api/src/com/cloud/network/as/AutoScaleVmGroup.java
+++ b/api/src/com/cloud/network/as/AutoScaleVmGroup.java
@@ -54,7 +54,11 @@ public interface AutoScaleVmGroup extends ControlledEntity, InternalIdentity, Di
String getUuid();
+ boolean isLocked();
+
@Override
boolean isDisplay();
+ String getVmPrefixName();
+
}
diff --git a/api/src/com/cloud/network/as/AutoScaleVmProfile.java b/api/src/com/cloud/network/as/AutoScaleVmProfile.java
index 495446a6e837..0fb3cc6c2ad3 100644
--- a/api/src/com/cloud/network/as/AutoScaleVmProfile.java
+++ b/api/src/com/cloud/network/as/AutoScaleVmProfile.java
@@ -49,6 +49,8 @@ public interface AutoScaleVmProfile extends ControlledEntity, InternalIdentity,
public long getAutoScaleUserId();
+ public String getUserData();
+
@Override
boolean isDisplay();
diff --git a/api/src/com/cloud/network/as/Counter.java b/api/src/com/cloud/network/as/Counter.java
index 286bf517c79d..1a8bbe8a48ec 100644
--- a/api/src/com/cloud/network/as/Counter.java
+++ b/api/src/com/cloud/network/as/Counter.java
@@ -26,7 +26,11 @@ public static enum Source {
netscaler,
snmp,
cpu,
- memory
+ memory,
+ cpu_used,
+ memory_used,
+ memory_free,
+ active_connections
}
String getName();
diff --git a/api/src/com/cloud/network/element/UserDataServiceProvider.java b/api/src/com/cloud/network/element/UserDataServiceProvider.java
index bf6d7e819e91..e3d89b448901 100644
--- a/api/src/com/cloud/network/element/UserDataServiceProvider.java
+++ b/api/src/com/cloud/network/element/UserDataServiceProvider.java
@@ -34,4 +34,5 @@ boolean addPasswordAndUserdata(Network network, NicProfile nic, VirtualMachinePr
boolean saveUserData(Network network, NicProfile nic, VirtualMachineProfile vm) throws ResourceUnavailableException;
boolean saveSSHKey(Network network, NicProfile nic, VirtualMachineProfile vm, String sshPublicKey) throws ResourceUnavailableException;
+
}
diff --git a/api/src/com/cloud/network/lb/LoadBalancingRule.java b/api/src/com/cloud/network/lb/LoadBalancingRule.java
index be69332ea780..1d4b83206693 100644
--- a/api/src/com/cloud/network/lb/LoadBalancingRule.java
+++ b/api/src/com/cloud/network/lb/LoadBalancingRule.java
@@ -16,6 +16,7 @@
// under the License.
package com.cloud.network.lb;
+import java.util.ArrayList;
import java.util.List;
import com.cloud.network.as.AutoScalePolicy;
@@ -38,6 +39,16 @@ public class LoadBalancingRule {
private List healthCheckPolicies;
private LbSslCert sslCert;
private String lbProtocol;
+ private String cache;
+ private String serviceDownAction;
+ private String healthCheckDestination;
+ private String healthCheckType;
+ private String expectedHealthCheck;
+ private boolean skipDnsError = false;
+ private boolean dsr;
+
+ private List additionalNetworks;
+ private List additionalPortMap;
public LoadBalancingRule(LoadBalancer lb, List destinations, List stickinessPolicies,
List healthCheckPolicies, Ip sourceIp) {
@@ -59,6 +70,13 @@ public LoadBalancingRule(LoadBalancer lb, List destinations, List
this.lbProtocol = lbProtocol;
}
+ public List getAllNetworks() {
+ List ids = new ArrayList<>(additionalNetworks);
+ ids.add(getNetworkId());
+
+ return ids;
+ }
+
public long getId() {
return lb.getId();
}
@@ -107,6 +125,18 @@ public String getLbProtocol() {
return this.lbProtocol;
}
+ public String getCache() { return this.cache; }
+
+ public void setCache(String cache) { this.cache = cache; }
+
+ public String getServiceDownAction() {
+ return serviceDownAction;
+ }
+
+ public void setServiceDownAction(String serviceDownAction) {
+ this.serviceDownAction = serviceDownAction;
+ }
+
public FirewallRule.Purpose getPurpose() {
return FirewallRule.Purpose.LoadBalancing;
}
@@ -143,6 +173,58 @@ public LbSslCert getLbSslCert() {
return sslCert;
}
+ public List getAdditionalNetworks() {
+ return additionalNetworks;
+ }
+
+ public void setAdditionalNetworks(List additionalNetworks) {
+ this.additionalNetworks = additionalNetworks;
+ }
+
+ public List getAdditionalPortMap() { return additionalPortMap; }
+
+ public void setAdditionalPortMap(List additionalPortMap) { this.additionalPortMap = additionalPortMap; }
+
+ public void setHealthCheckDestination(String healthCheckDestination) {
+ this.healthCheckDestination = healthCheckDestination;
+ }
+
+ public String getHealthcheckDestination() {
+ return healthCheckDestination;
+ }
+
+ public String getHealthCheckType() {
+ return healthCheckType;
+ }
+
+ public void setHealthCheckType(String healthCheckType) {
+ this.healthCheckType = healthCheckType;
+ }
+
+ public String getExpectedHealthCheck() {
+ return expectedHealthCheck;
+ }
+
+ public void setExpectedHealthCheck(String expectedHealthCheck) {
+ this.expectedHealthCheck = expectedHealthCheck;
+ }
+
+ public boolean isSkipDnsError() {
+ return skipDnsError;
+ }
+
+ public void setSkipDnsError(boolean skipDnsError) {
+ this.skipDnsError = skipDnsError;
+ }
+
+ public void setDsr(boolean dsr) {
+ this.dsr = dsr;
+ }
+
+ public boolean isDsr() {
+ return dsr;
+ }
+
public interface Destination {
String getIpAddress();
@@ -150,7 +232,11 @@ public interface Destination {
int getDestinationPortEnd();
+ long getNetworkId();
+
boolean isRevoked();
+
+ long getInstanceId();
}
public static class LbStickinessPolicy {
@@ -244,12 +330,16 @@ public static class LbDestination implements Destination {
private int portStart;
private int portEnd;
private String ip;
+ private long networkId;
+ private long instanceId;
boolean revoked;
- public LbDestination(int portStart, int portEnd, String ip, boolean revoked) {
+ public LbDestination(int portStart, int portEnd, String ip, long networkId, long instanceId, boolean revoked) {
this.portStart = portStart;
this.portEnd = portEnd;
this.ip = ip;
+ this.networkId = networkId;
+ this.instanceId = instanceId;
this.revoked = revoked;
}
@@ -268,6 +358,16 @@ public int getDestinationPortEnd() {
return portEnd;
}
+ @Override
+ public long getNetworkId() {
+ return networkId;
+ }
+
+ @Override
+ public long getInstanceId() {
+ return instanceId;
+ }
+
@Override
public boolean isRevoked() {
return revoked;
diff --git a/api/src/com/cloud/network/lb/LoadBalancingRulesService.java b/api/src/com/cloud/network/lb/LoadBalancingRulesService.java
index 50b39d2f3382..153a70c65505 100644
--- a/api/src/com/cloud/network/lb/LoadBalancingRulesService.java
+++ b/api/src/com/cloud/network/lb/LoadBalancingRulesService.java
@@ -16,6 +16,7 @@
// under the License.
package com.cloud.network.lb;
+import com.cloud.utils.Ternary;
import java.util.List;
import java.util.Map;
@@ -41,18 +42,20 @@
public interface LoadBalancingRulesService {
/**
* Create a load balancer rule from the given ipAddress/port to the given private port
- * @param openFirewall
- * TODO
- * @param forDisplay TODO
* @param cmd
* the command specifying the ip address, public port, protocol, private port, and algorithm
*
+ * @param openFirewall
+ * TODO
+ * @param forDisplay TODO
+ * @param skipDnsError
* @return the newly created LoadBalancerVO if successful, null otherwise
* @throws InsufficientAddressCapacityException
*/
LoadBalancer createPublicLoadBalancerRule(String xId, String name, String description, int srcPortStart, int srcPortEnd, int defPortStart, int defPortEnd,
- Long ipAddrId, String protocol, String algorithm, long networkId, long lbOwnerId, boolean openFirewall, String lbProtocol, Boolean forDisplay) throws NetworkRuleConflictException,
- InsufficientAddressCapacityException;
+ Long ipAddrId, String protocol, String algorithm, long networkId, long lbOwnerId, boolean openFirewall, String lbProtocol, Boolean forDisplay, List additionalPortMap, String cache,
+ String serviceDownAction, String healthCheckDestination, String expectedHealthcheck, String healthcheckType, boolean forcedns, boolean dsr)
+ throws NetworkRuleConflictException, InsufficientAddressCapacityException;
LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd);
@@ -106,6 +109,13 @@ LoadBalancer createPublicLoadBalancerRule(String xId, String name, String descri
boolean removeCertFromLoadBalancer(long lbRuleId);
+
+ /*
+ * Assign a network methods
+ */
+ boolean assignNetworksToLoadBalancer(Long loadBalancerId, List networkIds);
+ boolean removeNetworksFromLoadBalancer(Long loadBalancerId, List networkIds);
+
/**
* List instances that have either been applied to a load balancer or are eligible to be assigned to a load
* balancer.
@@ -114,7 +124,7 @@ LoadBalancer createPublicLoadBalancerRule(String xId, String name, String descri
* @return list of vm instances that have been or can be applied to a load balancer along with service state,
* if the LB has health check policy created on it from cloudstack.
*/
- Pair, List> listLoadBalancerInstances(ListLoadBalancerRuleInstancesCmd cmd);
+ Ternary, List, Integer> listLoadBalancerInstances(ListLoadBalancerRuleInstancesCmd cmd);
/**
* List load balancer rules based on the given criteria
@@ -148,6 +158,8 @@ LoadBalancer createPublicLoadBalancerRule(String xId, String name, String descri
LoadBalancer findById(long loadBalancer);
+ LoadBalancer findByUuid(String uuid);
+
public void updateLBHealthChecks(Scheme scheme) throws ResourceUnavailableException;
Map getLbInstances(long lbId);
@@ -163,4 +175,17 @@ LoadBalancer createPublicLoadBalancerRule(String xId, String name, String descri
LoadBalancer findLbByStickinessId(long stickinessPolicyId);
Long findLBIdByHealtCheckPolicyId(long lbHealthCheckPolicy);
+
+ HealthCheckPolicy validateAndPersistLbHealthcheckPolicy(Long lbRuleId, String pingPath, String description, int timeout, int healthcheckInterval, int healthyThreshold, int unhealthyThreshold, Boolean forDisplay);
+
+ StickinessPolicy validateAndPersistLbStickinessPolicy(Long lbRuleId, String lbStickinessPolicyName, String lbStickinessMethodName, Map paramList, String description, Boolean forDisplay);
+
+ public boolean isLinkedChildLoadBalancer(String lbuuid);
+
+ public boolean isLinkedParentLoadBalancer(String lbuuid);
+
+ public void throwExceptionIfIsChildLoadBalancer(Long id, String operation);
+
+ void throwExceptionIfIsParentLoadBalancer(Long id, String actualCommandName);
+ void throwExceptionIfIsParentLoadBalancer(List ids, String operation);
}
diff --git a/api/src/com/cloud/projects/ProjectService.java b/api/src/com/cloud/projects/ProjectService.java
index dc882ef11b8d..9fd8530a430d 100644
--- a/api/src/com/cloud/projects/ProjectService.java
+++ b/api/src/com/cloud/projects/ProjectService.java
@@ -34,10 +34,16 @@ public interface ProjectService {
* - account name of the project owner
* @param domainId
* - domainid of the project owner
+ * @param businessServiceId
+ * @param clientId
+ * @param componentId
+ * @param subComponentId
+ * @param productId
+ * @param detailedUsage
* @return the project if created successfully, null otherwise
* @throws ResourceAllocationException
*/
- Project createProject(String name, String displayText, String accountName, Long domainId) throws ResourceAllocationException;
+ Project createProject(String name, String displayText, String accountName, Long domainId, String businessServiceId, String clientId, String componentId, String subComponentId, String productId, Boolean detailedUsage) throws ResourceAllocationException;
/**
* Deletes a project
@@ -67,7 +73,7 @@ public interface ProjectService {
Project findByNameAndDomainId(String name, long domainId);
- Project updateProject(long id, String displayText, String newOwnerName) throws ResourceAllocationException;
+ Project updateProject(long id, String displayText, String newOwnerName, String businessServiceId, String clientId, String componentId, String subComponentId, String productId, Boolean detailedUsage) throws ResourceAllocationException;
boolean addAccountToProject(long projectId, String accountName, String email);
diff --git a/api/src/com/cloud/server/ResourceTag.java b/api/src/com/cloud/server/ResourceTag.java
index 0bd5d734e30e..75e436c7921a 100644
--- a/api/src/com/cloud/server/ResourceTag.java
+++ b/api/src/com/cloud/server/ResourceTag.java
@@ -55,7 +55,7 @@ public enum ResourceObjectType {
User(true, true),
DiskOffering(false, true),
AutoScaleVmProfile(false, true),
- AutoScaleVmGroup(false, true),
+ AutoScaleVmGroup(true, true),
LBStickinessPolicy(false, true),
LBHealthCheckPolicy(false, true),
SnapshotPolicy(false, true),
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
index 03ee7fc1b20b..4afd837f7eb3 100644
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -25,6 +25,7 @@ public class ApiConstants {
public static final String ADDRESS = "address";
public static final String ALGORITHM = "algorithm";
public static final String ALLOCATED_ONLY = "allocatedonly";
+ public static final String ADDITIONAL_PORT_MAP = "additionalportmap";
public static final String ANNOTATION = "annotation";
public static final String API_KEY = "apikey";
public static final String ASYNC_BACKUP = "asyncbackup";
@@ -38,6 +39,11 @@ public class ApiConstants {
public static final String BIND_PASSWORD = "bindpass";
public static final String BYTES_READ_RATE = "bytesreadrate";
public static final String BYTES_WRITE_RATE = "byteswriterate";
+ public static final String CACHE = "cache";
+ public static final String SERVICE_DOWN_ACTION = "servicedownactionid";
+ public static final String HEALTHCHECK_DESTINATION = "healthcheckdestination";
+ public static final String HEALTHCHECK_TYPE = "healthchecktype";
+ public static final String EXPECTED_HEALTHCHECK = "expectedhealthcheck";
public static final String BYPASS_VLAN_OVERLAP_CHECK = "bypassvlanoverlapcheck";
public static final String CATEGORY = "category";
public static final String CAN_REVERT = "canrevert";
@@ -178,6 +184,7 @@ public class ApiConstants {
public static final String ISO_GUEST_OS_NONE = "None";
public static final String JOB_ID = "jobid";
public static final String JOB_STATUS = "jobstatus";
+ public static final String CONTEXT = "context";
public static final String LASTNAME = "lastname";
public static final String LEVEL = "level";
public static final String LENGTH = "length";
@@ -185,6 +192,10 @@ 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_CHILD_LBID = "childlbid";
+ public static final String LB_PARENT_LBID = "parentlbid";
+ public static final String LB_LINKED_PARENT_LOAD_BALANCER = "linkedparent";
+ public static final String LB_LINKED_CHILDREN_LOAD_BALANCER = "linkedchildren";
public static final String MAX = "max";
public static final String MAC_ADDRESS = "macaddress";
public static final String MAX_SNAPS = "maxsnaps";
@@ -203,6 +214,7 @@ public class ApiConstants {
public static final String OP = "op";
public static final String OS_CATEGORY_ID = "oscategoryid";
public static final String OS_TYPE_ID = "ostypeid";
+ public static final String OS_TYPE_NAME = "ostypename";
public static final String OS_DISPLAY_NAME = "osdisplayname";
public static final String OS_NAME_FOR_HYPERVISOR = "osnameforhypervisor";
public static final String OUTOFBANDMANAGEMENT_POWERSTATE = "outofbandmanagementpowerstate";
@@ -247,6 +259,7 @@ public class ApiConstants {
public static final String RECOVER = "recover";
public static final String REQUIRES_HVM = "requireshvm";
public static final String RESOURCE_TYPE = "resourcetype";
+ public static final String RESOURCE_KEY = "resourcekey";
public static final String RESOURCE_TYPE_NAME = "resourcetypename";
public static final String RESPONSE = "response";
public static final String REVERTABLE = "revertable";
@@ -315,6 +328,7 @@ public class ApiConstants {
public static final String VIRTUAL_MACHINE_ID = "virtualmachineid";
public static final String VIRTUAL_MACHINE_IDS = "virtualmachineids";
public static final String VIRTUAL_MACHINE_ID_IP = "vmidipmap";
+ public static final String VIP_ID = "vipid";
public static final String VIRTUAL_MACHINE_COUNT = "virtualmachinecount";
public static final String USAGE_ID = "usageid";
public static final String USAGE_TYPE = "usagetype";
@@ -595,10 +609,15 @@ public class ApiConstants {
public static final String INTERVAL = "interval";
public static final String QUIETTIME = "quiettime";
public static final String ACTION = "action";
+ public static final String LOGICAL_OPERATOR = "logicaloperator";
+ public static final String STEP = "step";
public static final String CONDITION_ID = "conditionid";
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_PROFILE_REMOVE_NETWORKS = "removenetworks";
+ public static final String AUTOSCALE_GROUP_COUNT_MEMBERS = "autoscalegroupcountmembers";
+ public static final String AUTOSCALE_GROUP_VM_PREFIX_NAME = "autoscalegroupvmprefixname";
public static final String BAREMETAL_DISCOVER_NAME = "baremetaldiscovername";
public static final String BAREMETAL_RCT_URL = "baremetalrcturl";
public static final String UCS_DN = "ucsdn";
@@ -693,6 +712,19 @@ public class ApiConstants {
public static final String NETWORK_SPANNED_ZONES = "zonesnetworkspans";
public static final String METADATA = "metadata";
public static final String PHYSICAL_SIZE = "physicalsize";
+
+ public static final String GURU_NAME = "guruname";
+ public static final String GLOBO_RESOURCE_CONFIG = "globoresourceconfig";
+ public static final String L4_PROTOCOL = "l4protocol";
+ public static final String L7_PROTOCOL = "l7protocol";
+
+ public static final String BUSINESS_SERVICE_ID = "businessserviceid";
+ public static final String CLIENT_ID = "clientid";
+ public static final String COMPONENT_ID = "componentid";
+ public static final String SUB_COMPONENT_ID = "subcomponentid";
+ public static final String PRODUCT_ID = "productid";
+ public static final String DETAILED_USAGE = "detailedusage";
+
public static final String OVM3_POOL = "ovm3pool";
public static final String OVM3_CLUSTER = "ovm3cluster";
public static final String OVM3_VIP = "ovm3vip";
@@ -715,7 +747,6 @@ public class ApiConstants {
public static final String LAST_ANNOTATED = "lastannotated";
public static final String LDAP_DOMAIN = "ldapdomain";
-
public enum HostDetails {
all, capacity, events, stats, min;
}
diff --git a/api/src/org/apache/cloudstack/api/BaseListCmd.java b/api/src/org/apache/cloudstack/api/BaseListCmd.java
index 36fa36fcfc9a..e242aa8a4d85 100644
--- a/api/src/org/apache/cloudstack/api/BaseListCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseListCmd.java
@@ -142,4 +142,12 @@ public void validateSpecificParameters(final Map params){
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "\"pagesize\" parameter is required when \"page\" is specified");
}
}
+
+ public void setPage(Integer page) {
+ this.page = page;
+ }
+
+ public void setPageSize(Integer pageSize) {
+ this.pageSize = pageSize;
+ }
}
diff --git a/api/src/org/apache/cloudstack/api/BaseResponse.java b/api/src/org/apache/cloudstack/api/BaseResponse.java
index 45016c1a2a26..13d4f01aec24 100644
--- a/api/src/org/apache/cloudstack/api/BaseResponse.java
+++ b/api/src/org/apache/cloudstack/api/BaseResponse.java
@@ -19,6 +19,7 @@
import com.google.gson.annotations.SerializedName;
import com.cloud.serializer.Param;
+import org.apache.cloudstack.context.CallContext;
public abstract class BaseResponse implements ResponseObject {
private transient String responseName;
@@ -32,6 +33,10 @@ public abstract class BaseResponse implements ResponseObject {
@Param(description = "the current status of the latest async job acting on this object")
private Integer jobStatus;
+ @SerializedName(ApiConstants.CONTEXT)
+ @Param(description = "context error")
+ private String context;
+
public BaseResponse() {
}
@@ -83,4 +88,20 @@ public Integer getJobStatus() {
public void setJobStatus(Integer jobStatus) {
this.jobStatus = jobStatus;
}
+
+ public String getContext() {
+ return context;
+ }
+
+ public void setContext(String context) {
+ this.context = context;
+ }
+
+
+ public void buildCurrentContext() {
+ CallContext context = CallContext.current();
+ if (context != null) {
+ setContext(context.getNdcContext());
+ }
+ }
}
diff --git a/api/src/org/apache/cloudstack/api/ResponseGenerator.java b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
index 4fb248cd1055..cfaee3e51f2f 100644
--- a/api/src/org/apache/cloudstack/api/ResponseGenerator.java
+++ b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
@@ -22,6 +22,8 @@
import java.util.Map;
import java.util.Set;
+import javax.servlet.http.HttpSession;
+
import org.apache.cloudstack.affinity.AffinityGroup;
import org.apache.cloudstack.affinity.AffinityGroupResponse;
import org.apache.cloudstack.api.ApiConstants.HostDetails;
@@ -64,6 +66,7 @@
import org.apache.cloudstack.api.response.LBStickinessResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.LoadBalancerResponse;
+import org.apache.cloudstack.api.response.LoginCmdResponse;
import org.apache.cloudstack.api.response.NetworkACLItemResponse;
import org.apache.cloudstack.api.response.NetworkACLResponse;
import org.apache.cloudstack.api.response.NetworkOfferingResponse;
@@ -461,5 +464,7 @@ List createTemplateResponses(ResponseView view, VirtualMachine
ListResponse createUpgradeRouterTemplateResponse(List jobIds);
+ LoginCmdResponse createLoginResponse(HttpSession session);
+
SSHKeyPairResponse createSSHKeyPairResponse(SSHKeyPair sshkeyPair, boolean privatekey);
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/loadbalancer/ListLoadBalancerRuleInstancesCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/loadbalancer/ListLoadBalancerRuleInstancesCmdByAdmin.java
index 1bece181fb85..f0dc4e40e21b 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/loadbalancer/ListLoadBalancerRuleInstancesCmdByAdmin.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/loadbalancer/ListLoadBalancerRuleInstancesCmdByAdmin.java
@@ -16,6 +16,7 @@
// under the License.
package org.apache.cloudstack.api.command.admin.loadbalancer;
+import com.cloud.utils.Ternary;
import java.util.ArrayList;
import java.util.List;
@@ -30,7 +31,7 @@
import org.apache.cloudstack.api.response.UserVmResponse;
import com.cloud.uservm.UserVm;
-import com.cloud.utils.Pair;
+//import com.cloud.utils.Pair;
@APICommand(name = "listLoadBalancerRuleInstances", description = "List all virtual machine instances that are assigned to a load balancer rule.", responseObject = LoadBalancerRuleVmMapResponse.class, responseView = ResponseView.Full,
requestHasSensitiveInfo = false,
@@ -42,10 +43,10 @@ public class ListLoadBalancerRuleInstancesCmdByAdmin extends ListLoadBalancerRul
@Override
public void execute(){
- Pair, List> vmServiceMap = _lbService.listLoadBalancerInstances(this);
+ Ternary, List, Integer> vmServiceMap = _lbService.listLoadBalancerInstances(this);
List extends UserVm> result = vmServiceMap.first();
List serviceStates = vmServiceMap.second();
-
+ Integer count = vmServiceMap.third();
if (!isListLbVmip()) {
// list lb instances
@@ -59,7 +60,7 @@ public void execute(){
vmResponses.get(i).setServiceState(serviceStates.get(i));
}
}
- response.setResponses(vmResponses);
+ response.setResponses(vmResponses,count);
response.setResponseName(getCommandName());
setResponseObject(response);
@@ -87,7 +88,7 @@ public void execute(){
}
lbRes.setResponseName(getCommandName());
- lbRes.setResponses(listlbVmRes);
+ lbRes.setResponses(listlbVmRes, count);
setResponseObject(lbRes);
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java
index 413818b8242b..9a6b7b59b2aa 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java
@@ -17,8 +17,6 @@
package org.apache.cloudstack.api.command.admin.region;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
@@ -28,6 +26,7 @@
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.PortableIpRangeResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java
index 71d6a661af33..18842dbf4da6 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java
@@ -32,7 +32,7 @@
import com.cloud.user.User;
@APICommand(name = "createUser", description = "Creates a user for an account that already exists", responseObject = UserResponse.class,
- requestHasSensitiveInfo = true, responseHasSensitiveInfo = true)
+ requestHasSensitiveInfo = true, responseHasSensitiveInfo = true, entityType = { Account.class })
public class CreateUserCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(CreateUserCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java
index 08ba521ed62c..f90a48043db3 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java
@@ -35,7 +35,7 @@
import com.cloud.user.User;
@APICommand(name = "deleteUser", description = "Deletes a user for an account", responseObject = SuccessResponse.class,
- requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, entityType = { Account.class })
public class DeleteUserCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteUserCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java
index c6e09ef0f9e6..3a9676e24665 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java
@@ -37,7 +37,7 @@
import com.cloud.user.UserAccount;
@APICommand(name = "disableUser", description = "Disables a user account", responseObject = UserResponse.class,
- requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = true, entityType = { Account.class })
public class DisableUserCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DisableUserCmd.class.getName());
private static final String s_name = "disableuserresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java
index d69eccf9342b..e4f4477103cc 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java
@@ -35,7 +35,7 @@
import com.cloud.user.UserAccount;
@APICommand(name = "enableUser", description = "Enables a user account", responseObject = UserResponse.class,
- requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = true, entityType = { Account.class })
public class EnableUserCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(EnableUserCmd.class.getName());
private static final String s_name = "enableuserresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java
index d58f69596328..51fa8eed0a9b 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java
@@ -25,10 +25,11 @@
import org.apache.cloudstack.api.response.UserResponse;
import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.user.Account;
import com.cloud.user.UserAccount;
@APICommand(name = "getUser", description = "Find user account by API key", responseObject = UserResponse.class,
- requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = true, entityType = { Account.class })
public class GetUserCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(GetUserCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java
index c0c2b24814aa..14cbb26602ec 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java
@@ -25,8 +25,10 @@
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.UserResponse;
+import com.cloud.user.Account;
+
@APICommand(name = "listUsers", description = "Lists user accounts", responseObject = UserResponse.class,
- requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = true, entityType = { Account.class })
public class ListUsersCmd extends BaseListAccountResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListUsersCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java
index e6ac36719e33..ac49c76cbbb3 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java
@@ -34,7 +34,7 @@
import com.cloud.user.UserAccount;
@APICommand(name = "updateUser", description = "Updates a user account", responseObject = UserResponse.class,
- requestHasSensitiveInfo = true, responseHasSensitiveInfo = true)
+ requestHasSensitiveInfo = true, responseHasSensitiveInfo = true, entityType = { Account.class })
public class UpdateUserCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpdateUserCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/DeployVMCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/vm/DeployVMCmdByAdmin.java
index 03bb4c623d0d..fe457038cf0f 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vm/DeployVMCmdByAdmin.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/DeployVMCmdByAdmin.java
@@ -61,8 +61,8 @@ public void execute(){
message.append(", Please check the affinity groups provided, there may not be sufficient capacity to follow them");
}
}
- s_logger.info(ex);
- s_logger.info(message.toString(), ex);
+ s_logger.error(ex);
+ s_logger.error(message.toString(), ex);
throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, message.toString());
}
} else {
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java
index 6a2b491f2f45..9d393dc480cc 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java
@@ -63,6 +63,12 @@ public class CreateAutoScalePolicyCmd extends BaseAsyncCreateCmd {
description = "the duration for which the conditions have to be true before action is taken")
private int duration;
+ @Parameter(name = ApiConstants.STEP,
+ type = CommandType.INTEGER,
+ required = false,
+ description = "the number of vms that will be created/destroyed")
+ private Integer step = 1;
+
@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")
@@ -76,6 +82,11 @@ public class CreateAutoScalePolicyCmd extends BaseAsyncCreateCmd {
description = "the list of IDs of the conditions that are being evaluated on every interval")
private List conditionIds;
+ @Parameter(name = ApiConstants.LOGICAL_OPERATOR,
+ type = CommandType.STRING,
+ description = "logical operator to be used between all of the conditions")
+ private String logicalOperator = AutoScalePolicy.LogicalOperator.AND.name();
+
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@@ -95,10 +106,18 @@ public String getAction() {
return action;
}
+ public Integer getStep() {
+ return step;
+ }
+
public List getConditionIds() {
return conditionIds;
}
+ public String getLogicalOperator() {
+ return logicalOperator;
+ }
+
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java
index 0308c1710c33..94dc8a235c1f 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java
@@ -98,6 +98,13 @@ public class CreateAutoScaleVmGroupCmd extends BaseAsyncCreateCmd {
description = "the autoscale profile that contains information about the vms in the vm group.")
private long profileId;
+
+ @Parameter(name = ApiConstants.AUTOSCALE_GROUP_VM_PREFIX_NAME,
+ type = CommandType.STRING,
+ required = true,
+ description = "the prefix name of the AutoScale group vms")
+ private String vmPrefixName;
+
@Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the group to the end user or not", since = "4.4", authorized = {RoleType.Admin})
private Boolean display;
@@ -133,6 +140,10 @@ public long getLbRuleId() {
return lbRuleId;
}
+ public String getVmPrefixName() {
+ return vmPrefixName;
+ }
+
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java
index 447085e79b5a..4c3a41875715 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java
@@ -17,8 +17,10 @@
package org.apache.cloudstack.api.command.user.autoscale;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
+import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.log4j.Logger;
import org.apache.cloudstack.acl.RoleType;
@@ -34,6 +36,7 @@
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.UserResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.context.CallContext;
import com.cloud.event.EventTypes;
@@ -100,9 +103,29 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd {
description = "the ID of the user used to launch and destroy the VMs")
private Long autoscaleUserId;
+ @Parameter(name = ApiConstants.NETWORK_IDS,
+ type = CommandType.LIST,
+ collectionType = CommandType.UUID,
+ entityType = NetworkResponse.class,
+ required = false,
+ description = "list of additional networks (besides the LB network) to be added to the VMs")
+ private List networkIds;
+
+ @Parameter(name = ApiConstants.AUTOSCALE_PROFILE_REMOVE_NETWORKS, type = CommandType.BOOLEAN, description = "an optional field, all additional networks will be removed if true")
+ private boolean removeNetworks;
+
+ @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 2KB of data after base64 encoding. Using HTTP POST(via POST body), you can send up to 32K of data after base64 encoding.",
+ length = 32768)
+ private String userData;
+
@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;
+ @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "The project on which the profile will be created")
+ private Long projectId;
+
private Map otherDeployParamMap;
// ///////////////////////////////////////////////////
@@ -113,6 +136,10 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd {
private Long accountId;
public Long getDomainId() {
+ if(projectId != null){
+ Long accountId = _accountService.finalyzeAccountId(null, null, projectId, true);
+ return _accountService.getAccount(accountId).getDomainId();
+ }
if (domainId == null) {
getAccountId();
}
@@ -165,6 +192,9 @@ public Integer getDestroyVmGraceperiod() {
}
public long getAccountId() {
+ if(projectId != null){
+ return _accountService.finalyzeAccountId(null, null, projectId, true);
+ }
if (accountId != null) {
return accountId;
}
@@ -180,6 +210,18 @@ public long getAccountId() {
return accountId;
}
+ public List getNetworkIds() {
+ return networkIds;
+ }
+
+ public boolean isRemoveNetworks() {
+ return removeNetworks;
+ }
+
+ public String getUserData() {
+ return userData;
+ }
+
private void createOtherDeployParamMap() {
if (otherDeployParamMap == null) {
otherDeployParamMap = new HashMap();
@@ -249,6 +291,10 @@ public ApiCommandJobType getInstanceType() {
return ApiCommandJobType.AutoScaleVmProfile;
}
+ public Long getProjectId() {
+ return projectId;
+ }
+
@Override
public void execute() {
AutoScaleVmProfile result = _entityMgr.findById(AutoScaleVmProfile.class, getEntityId());
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java
index 847866ef3ae5..cfa788864f74 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java
@@ -17,6 +17,7 @@
package org.apache.cloudstack.api.command.user.autoscale;
+import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
@@ -60,6 +61,9 @@ public class CreateConditionCmd extends BaseAsyncCreateCmd {
@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "the domain ID of the account.")
private Long domainId;
+ @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "The project on which the condition will be created")
+ private Long projectId;
+
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@@ -138,7 +142,12 @@ public String getEventType() {
@Override
public long getEntityOwnerId() {
- Long accountId = _accountService.finalyzeAccountId(accountName, domainId, null, true);
+ Long accountId = null;
+ if(projectId != null ){
+ accountId = _accountService.finalyzeAccountId(null, null, projectId, true);
+ }else{
+ accountId = _accountService.finalyzeAccountId(accountName, domainId, null, true);
+ }
if (accountId == null) {
return CallContext.current().getCallingAccount().getId();
}
@@ -146,4 +155,7 @@ public long getEntityOwnerId() {
return accountId;
}
+ public Long getProjectId() {
+ return projectId;
+ }
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java
index a9d2f4e23299..c6518c2ae467 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java
@@ -52,6 +52,9 @@ public class DeleteAutoScaleVmGroupCmd extends BaseAsyncCmd {
description = "the ID of the autoscale group")
private Long id;
+ @Parameter(name = "removedependencies", type = CommandType.BOOLEAN, required = false, description = "remove all dependencies related to Autoscale VM Group")
+ private Boolean removeDependencies;
+
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@@ -60,6 +63,8 @@ public Long getId() {
return id;
}
+ public Boolean getRemoveDependencies() { return removeDependencies; }
+
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@@ -93,7 +98,14 @@ public String getEventDescription() {
@Override
public void execute() {
CallContext.current().setEventDetails("AutoScale Vm Group Id: " + getId());
- boolean result = _autoScaleService.deleteAutoScaleVmGroup(id);
+ boolean result = false;
+ if (getRemoveDependencies() == null || !getRemoveDependencies()) {
+ // Remove autoscale VM group, but preserve all dependencies - i.e. profiles, policies, conditions
+ result = _autoScaleService.deleteAutoScaleVmGroup(id);
+ } else {
+ // Remove autoscale VM group and all profiles, policies and conditions associated to it
+ result = _autoScaleService.deleteAutoScaleVmGroupWithDependencies(id);
+ }
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java
index c2b244f2a7fe..e41cf1d09ae0 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java
@@ -19,6 +19,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
@@ -57,6 +58,9 @@ public class ListAutoScalePoliciesCmd extends BaseListAccountResourcesCmd {
@Parameter(name = ApiConstants.VMGROUP_ID, type = CommandType.UUID, entityType = AutoScaleVmGroupResponse.class, description = "the ID of the autoscale vm group")
private Long vmGroupId;
+ @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "the Project ID of the policy")
+ private Long projectId;
+
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@@ -77,6 +81,13 @@ public Long getVmGroupId() {
return vmGroupId;
}
+ public Long getProjectId() {
+ if(projectId != null){
+ return _accountService.finalyzeAccountId(null, null, projectId, true);
+ }
+ return null;
+ }
+
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java
index 37c90b9bfdb3..12d7d5856d57 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java
@@ -19,6 +19,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.log4j.Logger;
import org.apache.cloudstack.acl.RoleType;
@@ -65,6 +66,9 @@ public class ListAutoScaleVmGroupsCmd extends BaseListProjectAndAccountResources
@Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin})
private Boolean display;
+ @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "the Project ID of the auto scale group")
+ private Long projectId;
+
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@@ -89,6 +93,13 @@ public Long getZoneId() {
return zoneId;
}
+ public Long getProjectId() {
+ if(projectId != null){
+ return _accountService.finalyzeAccountId(null, null, projectId, true);
+ }
+ return null;
+ }
+
@Override
public Boolean getDisplay() {
if (display != null) {
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java
index 554b48854a49..11c927ad9d92 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java
@@ -19,6 +19,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.log4j.Logger;
import org.apache.cloudstack.acl.RoleType;
@@ -63,6 +64,9 @@ public class ListAutoScaleVmProfilesCmd extends BaseListProjectAndAccountResourc
@Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin})
private Boolean display;
+ @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "the Project ID of the Vm profile")
+ private Long projectId;
+
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@@ -95,6 +99,13 @@ public Boolean getDisplay() {
return super.getDisplay();
}
+ public Long getProjectId() {
+ if(projectId != null){
+ return _accountService.finalyzeAccountId(null, null, projectId, true);
+ }
+ return null;
+ }
+
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java
index d75d64942f90..8243998d4248 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java
@@ -20,6 +20,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
@@ -56,6 +57,9 @@ public class ListConditionsCmd extends BaseListAccountResourcesCmd {
@Parameter(name = ApiConstants.POLICY_ID, type = CommandType.UUID, entityType = AutoScalePolicyResponse.class, description = "the ID of the policy")
private Long policyId;
+ @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "the Project ID of the condition")
+ private Long projectId;
+
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@@ -92,6 +96,13 @@ public Long getPolicyId() {
return policyId;
}
+ public Long getProjectId() {
+ if(projectId != null){
+ return _accountService.finalyzeAccountId(null, null, projectId, true);
+ }
+ return null;
+ }
+
@Override
public String getCommandName() {
return s_name;
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java
index 24858f4656b9..a016e6ec274d 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java
@@ -72,6 +72,17 @@ public class UpdateAutoScalePolicyCmd extends BaseAsyncCmd {
description = "the ID of the autoscale policy")
private Long id;
+ @Parameter(name = ApiConstants.STEP,
+ type = CommandType.INTEGER,
+ required = false,
+ description = "the number of vms that will be created/destroyed")
+ private Integer step = 1;
+
+ @Parameter(name = ApiConstants.LOGICAL_OPERATOR,
+ type = CommandType.STRING,
+ description = "logical operator to be used between all of the conditions")
+ private String logicalOperator;
+
@Override
public void execute() {
CallContext.current().setEventDetails("AutoScale Policy Id: " + getId());
@@ -105,6 +116,14 @@ public List getConditionIds() {
return conditionIds;
}
+ public Integer getStep() {
+ return step;
+ }
+
+ public String getLogicalOperator() {
+ return logicalOperator;
+ }
+
@Override
public String getCommandName() {
return s_name;
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java
index deebe2ecc9a4..b73604e606ea 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java
@@ -17,8 +17,10 @@
package org.apache.cloudstack.api.command.user.autoscale;
+import java.util.List;
import java.util.Map;
+import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.log4j.Logger;
import org.apache.cloudstack.acl.RoleType;
@@ -81,6 +83,23 @@ public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCustomIdCmd {
description = "the ID of the user used to launch and destroy the VMs")
private Long autoscaleUserId;
+ @Parameter(name = ApiConstants.NETWORK_IDS,
+ type = CommandType.LIST,
+ collectionType = CommandType.UUID,
+ entityType = NetworkResponse.class,
+ required = false,
+ description = "list of additional networks (besides the LB network) to be added to the VMs")
+ private List networkIds;
+
+ @Parameter(name = ApiConstants.AUTOSCALE_PROFILE_REMOVE_NETWORKS, type = CommandType.BOOLEAN, description = "an optional field, all additional networks will be removed if true")
+ private boolean removeNetworks;
+
+ @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 2KB of data after base64 encoding. Using HTTP POST(via POST body), you can send up to 32K of data after base64 encoding.",
+ length = 32768)
+ private String userData;
+
@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;
@@ -129,6 +148,18 @@ public Boolean getDisplay() {
return display;
}
+ public List getNetworkIds() {
+ return networkIds;
+ }
+
+ public boolean isRemoveNetworks() {
+ return removeNetworks;
+ }
+
+ public String getUserData() {
+ return userData;
+ }
+
@Override
public String getEventType() {
return EventTypes.EVENT_AUTOSCALEVMPROFILE_UPDATE;
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java
index fab7d9eef29a..3d655e671a85 100644
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java
@@ -55,16 +55,16 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
// ///////////////////////////////////////////////////
@Parameter(name = ApiConstants.IP_ADDRESS_ID,
- type = CommandType.UUID,
- entityType = IPAddressResponse.class,
- required = true,
- description = "the IP address id of the port forwarding rule")
+ type = CommandType.UUID,
+ entityType = IPAddressResponse.class,
+ required = true,
+ description = "the IP address id of the port forwarding rule")
private Long ipAddressId;
@Parameter(name = ApiConstants.PROTOCOL,
- type = CommandType.STRING,
- required = true,
- description = "the protocol for the firewall rule. Valid values are TCP/UDP/ICMP.")
+ type = CommandType.STRING,
+ required = true,
+ description = "the protocol for the firewall rule. Valid values are TCP/UDP/ICMP.")
private String protocol;
@Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "the starting port of firewall rule")
@@ -310,7 +310,7 @@ public Integer getIcmpType() {
if (icmpType != null) {
return icmpType;
} else if (protocol.equalsIgnoreCase(NetUtils.ICMP_PROTO)) {
- return -1;
+ return -1;
}
return null;
diff --git a/api/src/org/apache/cloudstack/api/command/user/globodictionary/BaseDictionaryCmd.java b/api/src/org/apache/cloudstack/api/command/user/globodictionary/BaseDictionaryCmd.java
new file mode 100644
index 000000000000..0c848fbd8729
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/globodictionary/BaseDictionaryCmd.java
@@ -0,0 +1,100 @@
+/*
+* 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.globodictionary;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.NetworkRuleConflictException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.globodictionary.GloboDictionaryEntity;
+import com.cloud.globodictionary.GloboDictionaryService;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.GloboDictionaryResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import javax.inject.Inject;
+import java.util.ArrayList;
+import java.util.List;
+
+public abstract class BaseDictionaryCmd extends BaseCmd {
+
+ @Inject
+ protected GloboDictionaryService globoDictionaryService;
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.ID, type = BaseCmd.CommandType.STRING, description = "the ID of the object being listed")
+ private String id;
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
+ ListResponse response = new ListResponse<>();
+ List globoDictionaryResponses = new ArrayList<>();
+
+ if(id != null){
+ GloboDictionaryEntity component = globoDictionaryService.get(this.getEntity(), id);
+ if(component != null){
+ globoDictionaryResponses.add(createResponse(component));
+ }
+ }else {
+ List components = globoDictionaryService.list(this.getEntity());
+ for (GloboDictionaryEntity component : components) {
+ globoDictionaryResponses.add(createResponse(component));
+ }
+ }
+
+ response.setResponses(globoDictionaryResponses);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public String getCommandName() {
+ return null;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return CallContext.current().getCallingAccountId();
+ }
+
+ private GloboDictionaryResponse createResponse(GloboDictionaryEntity component) {
+ GloboDictionaryResponse globoDictionaryResponse = new GloboDictionaryResponse(component.getId(), component.getName());
+ globoDictionaryResponse.setObjectName(this.getResponseName());
+ return globoDictionaryResponse;
+ }
+
+ abstract GloboDictionaryService.GloboDictionaryEntityType getEntity();
+
+ abstract String getResponseName();
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/globodictionary/ListBusinessServicesCmd.java b/api/src/org/apache/cloudstack/api/command/user/globodictionary/ListBusinessServicesCmd.java
new file mode 100644
index 000000000000..4e2a90f2334c
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/globodictionary/ListBusinessServicesCmd.java
@@ -0,0 +1,44 @@
+/*
+* 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.globodictionary;
+
+import com.cloud.globodictionary.GloboDictionaryService;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.response.GloboDictionaryResponse;
+
+@APICommand(name = "listBusinessServices", description = "Lists business services", responseObject = GloboDictionaryResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class ListBusinessServicesCmd extends BaseDictionaryCmd {
+
+ private static final String s_name = "listbusinessservicesresponse";
+ private static final String response_name = "businessservice";
+
+ @Override
+ GloboDictionaryService.GloboDictionaryEntityType getEntity() {
+ return GloboDictionaryService.GloboDictionaryEntityType.BUSINESS_SERVICE;
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ String getResponseName() {
+ return response_name;
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/globodictionary/ListClientsCmd.java b/api/src/org/apache/cloudstack/api/command/user/globodictionary/ListClientsCmd.java
new file mode 100644
index 000000000000..9be5927e5c21
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/globodictionary/ListClientsCmd.java
@@ -0,0 +1,44 @@
+/*
+* 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.globodictionary;
+
+import com.cloud.globodictionary.GloboDictionaryService;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.response.GloboDictionaryResponse;
+
+@APICommand(name = "listClients", description = "Lists clients", responseObject = GloboDictionaryResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class ListClientsCmd extends BaseDictionaryCmd {
+
+ private static final String s_name = "listclientsresponse";
+ private static final String response_name = "client";
+
+ @Override
+ GloboDictionaryService.GloboDictionaryEntityType getEntity() {
+ return GloboDictionaryService.GloboDictionaryEntityType.CLIENT;
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ String getResponseName() {
+ return response_name;
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/globodictionary/ListComponentsCmd.java b/api/src/org/apache/cloudstack/api/command/user/globodictionary/ListComponentsCmd.java
new file mode 100644
index 000000000000..4775df4e6400
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/globodictionary/ListComponentsCmd.java
@@ -0,0 +1,44 @@
+/*
+* 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.globodictionary;
+
+import com.cloud.globodictionary.GloboDictionaryService;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.response.GloboDictionaryResponse;
+
+@APICommand(name = "listComponents", description = "Lists components", responseObject = GloboDictionaryResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class ListComponentsCmd extends BaseDictionaryCmd {
+
+ private static final String s_name = "listcomponentsresponse";
+ private static final String response_name = "component";
+
+ @Override
+ GloboDictionaryService.GloboDictionaryEntityType getEntity() {
+ return GloboDictionaryService.GloboDictionaryEntityType.COMPONENT;
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ String getResponseName() {
+ return response_name;
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/globodictionary/ListProductsCmd.java b/api/src/org/apache/cloudstack/api/command/user/globodictionary/ListProductsCmd.java
new file mode 100644
index 000000000000..7ac2ca169f8b
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/globodictionary/ListProductsCmd.java
@@ -0,0 +1,44 @@
+/*
+* 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.globodictionary;
+
+import com.cloud.globodictionary.GloboDictionaryService;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.response.GloboDictionaryResponse;
+
+@APICommand(name = "listProducts", description = "Lists products", responseObject = GloboDictionaryResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class ListProductsCmd extends BaseDictionaryCmd {
+
+ private static final String s_name = "listproductsresponse";
+ private static final String response_name = "product";
+
+ @Override
+ GloboDictionaryService.GloboDictionaryEntityType getEntity() {
+ return GloboDictionaryService.GloboDictionaryEntityType.PRODUCT;
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ String getResponseName() {
+ return response_name;
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/globodictionary/ListSubComponentsCmd.java b/api/src/org/apache/cloudstack/api/command/user/globodictionary/ListSubComponentsCmd.java
new file mode 100644
index 000000000000..ba8f11166cb9
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/globodictionary/ListSubComponentsCmd.java
@@ -0,0 +1,44 @@
+/*
+* 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.globodictionary;
+
+import com.cloud.globodictionary.GloboDictionaryService;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.response.GloboDictionaryResponse;
+
+@APICommand(name = "listSubComponents", description = "Lists sub-components", responseObject = GloboDictionaryResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class ListSubComponentsCmd extends BaseDictionaryCmd {
+
+ private static final String s_name = "listsubcomponentsresponse";
+ private static final String response_name = "subcomponent";
+
+ @Override
+ GloboDictionaryService.GloboDictionaryEntityType getEntity() {
+ return GloboDictionaryService.GloboDictionaryEntityType.SUB_COMPONENT;
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ String getResponseName() {
+ return response_name;
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignNetworksToLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignNetworksToLoadBalancerRuleCmd.java
new file mode 100644
index 000000000000..108df11a5177
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignNetworksToLoadBalancerRuleCmd.java
@@ -0,0 +1,122 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.user.loadbalancer;
+
+import java.util.List;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.context.CallContext;
+import org.apache.log4j.Logger;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.network.rules.LoadBalancer;
+import com.cloud.user.Account;
+import com.cloud.utils.StringUtils;
+
+@APICommand(name = "assignNetworksToLoadBalancerRule", description = "Assigns network or a list of networks to a load balancer rule.", responseObject = SuccessResponse.class)
+public class AssignNetworksToLoadBalancerRuleCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(AssignNetworksToLoadBalancerRuleCmd.class.getName());
+
+ private static final String s_name = "assignnetworkstoloadbalancerruleresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "the ID of the load balancer rule")
+ private Long id;
+
+ @Parameter(name = ApiConstants.NETWORK_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = NetworkResponse.class, required = true, description = "the list of IDs of the networks that are being assigned to the load balancer rule")
+ private List networkIds;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getLoadBalancerId() {
+ return id;
+ }
+
+ public List getNetworkIds() {
+ return networkIds;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ LoadBalancer lb = _entityMgr.findById(LoadBalancer.class, getLoadBalancerId());
+ if (lb == null) {
+ return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
+ }
+ return lb.getAccountId();
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_ASSIGN_NETWORK_TO_LOAD_BALANCER_RULE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "applying networks for load balancer: " + getLoadBalancerId() + " (ids: " + StringUtils.join(getNetworkIds(), ",") + ")";
+ }
+
+ @Override
+ public void execute() {
+ _lbService.throwExceptionIfIsChildLoadBalancer(id, getActualCommandName());
+
+ CallContext.current().setEventDetails("Load balancer Id: " + getLoadBalancerId() + " Network ids: " + StringUtils.join(getNetworkIds(), ","));
+ boolean result = _lbService.assignNetworksToLoadBalancer(getLoadBalancerId(), getNetworkIds());
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign load balancer rule");
+ }
+ }
+
+ @Override
+ public String getSyncObjType() {
+ return BaseAsyncCmd.networkSyncObject;
+ }
+
+ @Override
+ public Long getSyncObjId() {
+ LoadBalancer lb = _lbService.findById(id);
+ if (lb == null) {
+ throw new InvalidParameterValueException("Unable to find load balancer rule: " + id);
+ }
+ return lb.getNetworkId();
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java
index 1e7303708014..dd8c96239324 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java
@@ -23,7 +23,6 @@
import java.util.List;
import java.util.Map;
-import com.cloud.utils.exception.CloudRuntimeException;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
@@ -163,17 +162,11 @@ public Map> getVmIdIpListMap() {
@Override
public void execute() {
+ _lbService.throwExceptionIfIsChildLoadBalancer(id, getActualCommandName());
CallContext.current().setEventDetails("Load balancer Id: " + getLoadBalancerId() + " VmIds: " + StringUtils.join(getVirtualMachineIds(), ","));
Map> vmIdIpsMap = getVmIdIpListMap();
- boolean result = false;
-
- try {
- result = _lbService.assignToLoadBalancer(getLoadBalancerId(), virtualMachineIds, vmIdIpsMap);
- }catch (CloudRuntimeException ex) {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign load balancer rule");
- }
-
+ boolean result = _lbService.assignToLoadBalancer(getLoadBalancerId(), virtualMachineIds, vmIdIpsMap);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
setResponseObject(response);
@@ -195,4 +188,9 @@ public Long getSyncObjId() {
}
return lb.getNetworkId();
}
+
+
+ public void setVirtualMachineIds(List virtualMachineIds) {
+ this.virtualMachineIds = virtualMachineIds;
+ }
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBHealthCheckPolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBHealthCheckPolicyCmd.java
index 94c5324c23e2..8a790307b981 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBHealthCheckPolicyCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBHealthCheckPolicyCmd.java
@@ -16,6 +16,7 @@
// under the License.
package org.apache.cloudstack.api.command.user.loadbalancer;
+import java.util.Objects;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
@@ -159,24 +160,18 @@ public int getUnhealthyThreshold() {
@Override
public void execute() throws ResourceAllocationException, ResourceUnavailableException {
- HealthCheckPolicy policy = null;
- boolean success = false;
-
- try {
- CallContext.current().setEventDetails("Load balancer health check policy ID : " + getEntityId());
- success = _lbService.applyLBHealthCheckPolicy(this);
- if (success) {
- // State might be different after the rule is applied, so get new object here
- policy = _entityMgr.findById(HealthCheckPolicy.class, getEntityId());
- LoadBalancer lb = _lbService.findById(policy.getLoadBalancerId());
- LBHealthCheckResponse hcResponse = _responseGenerator.createLBHealthCheckPolicyResponse(policy, lb);
- setResponseObject(hcResponse);
- hcResponse.setResponseName(getCommandName());
- }
- } finally {
- if (!success || (policy == null)) {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create health check policy");
- }
+ HealthCheckPolicy policy;
+ boolean success;
+
+ CallContext.current().setEventDetails("Load balancer healthcheck policy Id : " + getEntityId());
+ success = _lbService.applyLBHealthCheckPolicy(this);
+ if (success) {
+ // State might be different after the rule is applied, so get new object here
+ policy = _entityMgr.findById(HealthCheckPolicy.class, getEntityId());
+ LoadBalancer lb = _lbService.findById(policy.getLoadBalancerId());
+ LBHealthCheckResponse hcResponse = _responseGenerator.createLBHealthCheckPolicyResponse(policy, lb);
+ setResponseObject(hcResponse);
+ hcResponse.setResponseName(getCommandName());
}
}
@@ -201,4 +196,34 @@ public String getEventType() {
public String getEventDescription() {
return "Create load balancer health check policy";
}
+
+
+ public void setPingPath(String pingPath) {
+ this.pingPath = pingPath;
+ }
+
+ public void setLbRuleId(Long lbRuleId) {
+ this.lbRuleId = lbRuleId;
+ }
+
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ CreateLBHealthCheckPolicyCmd that = (CreateLBHealthCheckPolicyCmd) o;
+ return Objects.equals(responsTimeOut, that.responsTimeOut) &&
+ Objects.equals(healthCheckInterval, that.healthCheckInterval) &&
+ Objects.equals(healthyThreshold, that.healthyThreshold) &&
+ Objects.equals(unhealthyThreshold, that.unhealthyThreshold) &&
+ Objects.equals(lbRuleId, that.lbRuleId) &&
+ Objects.equals(description, that.description) &&
+ Objects.equals(pingPath, that.pingPath) &&
+ Objects.equals(display, that.display);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(lbRuleId, description, pingPath, responsTimeOut, healthCheckInterval, healthyThreshold, unhealthyThreshold, display);
+ }
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java
index 45e6f81a0aa3..1e94845f22a3 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java
@@ -18,6 +18,7 @@
import java.util.Map;
+import java.util.Objects;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
@@ -192,4 +193,34 @@ public Long getSyncObjId() {
}
return lb.getNetworkId();
}
+
+ public void setLbRuleId(Long lbRuleId) {
+ this.lbRuleId = lbRuleId;
+ }
+
+ public void setStickinessMethodName(String stickinessMethodName) {
+ this.stickinessMethodName = stickinessMethodName;
+ }
+
+ public void setLbStickinessPolicyName(String lbStickinessPolicyName) {
+ this.lbStickinessPolicyName = lbStickinessPolicyName;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ CreateLBStickinessPolicyCmd that = (CreateLBStickinessPolicyCmd) o;
+ return Objects.equals(lbRuleId, that.lbRuleId) &&
+ Objects.equals(description, that.description) &&
+ Objects.equals(lbStickinessPolicyName, that.lbStickinessPolicyName) &&
+ Objects.equals(stickinessMethodName, that.stickinessMethodName) &&
+ Objects.equals(paramList, that.paramList) &&
+ Objects.equals(display, that.display);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(lbRuleId, description, lbStickinessPolicyName, stickinessMethodName, paramList, display);
+ }
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java
index f9367652bdbd..ad50614c415b 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java
@@ -120,6 +120,30 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements L
@Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin})
private Boolean display;
+ @Parameter(name = ApiConstants.ADDITIONAL_PORT_MAP, type = CommandType.LIST, collectionType = CommandType.STRING, description = "additional port mappings for load balancing rule", since = "4.4")
+ private List additionalPortMap;
+
+ @Parameter(name = ApiConstants.CACHE, type = CommandType.STRING, description = "Cache group associated to Load Balancer")
+ private String cache;
+
+ @Parameter(name = ApiConstants.SERVICE_DOWN_ACTION, type = CommandType.STRING, description = "ID of the action to be executed when service is down")
+ private String serviceDownAction;
+
+ @Parameter(name = ApiConstants.HEALTHCHECK_DESTINATION, type = CommandType.STRING, description = "Port to be used as health check alternative to the service port (optional)")
+ private String healthCheckDestination;
+
+ @Parameter(name = ApiConstants.HEALTHCHECK_TYPE, type = CommandType.STRING, description = "Healthcheck type (TCP, UDP, HTTP or HTTPS)")
+ protected String healthCheckType;
+
+ @Parameter(name = ApiConstants.EXPECTED_HEALTHCHECK, type = CommandType.STRING, description = "Expected healthcheck string to check if is in service.")
+ private String expectedHealthCheck;
+
+ @Parameter(name = "skipdnserror", type = CommandType.BOOLEAN, description = "when false if dns integration failed, the loadbalancer will not be created and throw an exception, else lb will be created and dns it could be register later")
+ private boolean skipDnsError = false ;
+
+ @Parameter(name = "dsr", type = CommandType.BOOLEAN, description = "when true creates the load balancing using DSR (Direct server return)")
+ private boolean dsr = false ;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -223,6 +247,16 @@ public long getNetworkId() {
}
}
+ public String getCache() { return cache; }
+
+ public String getServiceDownAction() {
+ return serviceDownAction;
+ }
+
+ public String getHealthCheckDestination() {
+ return healthCheckDestination;
+ }
+
public Integer getPublicPort() {
return publicPort;
}
@@ -231,6 +265,8 @@ public String getName() {
return loadBalancerRuleName;
}
+ public List getAdditionalPortMap() { return additionalPortMap; }
+
public Boolean getOpenFirewall() {
boolean isVpc = getVpcId() == null ? false : true;
if (openFirewall != null) {
@@ -278,18 +314,26 @@ public void execute() throws ResourceAllocationException, ResourceUnavailableExc
if (getOpenFirewall()) {
success = success && _firewallService.applyIngressFirewallRules(getSourceIpAddressId(), callerContext.getCallingAccount());
+ if(!success) {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to apply firewall rules.");
+ }
}
// State might be different after the rule is applied, so get new object here
rule = _entityMgr.findById(LoadBalancer.class, getEntityId());
LoadBalancerResponse lbResponse = new LoadBalancerResponse();
- if (rule != null) {
- lbResponse = _responseGenerator.createLoadBalancerResponse(rule);
- setResponseObject(lbResponse);
+ if (rule == null) {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to apply firewall rules.");
}
+ lbResponse = _responseGenerator.createLoadBalancerResponse(rule);
lbResponse.setResponseName(getCommandName());
+
+ setResponseObject(lbResponse);
+
} catch (Exception ex) {
s_logger.warn("Failed to create LB rule due to exception ", ex);
+ String msg = ex.getMessage() != null ? ex.getMessage() : "";
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create load balancer rule. " + msg);
} finally {
if (!success || rule == null) {
@@ -298,8 +342,6 @@ public void execute() throws ResourceAllocationException, ResourceUnavailableExc
}
// no need to apply the rule on the backend as it exists in the db only
_lbService.deleteLoadBalancerRule(getEntityId(), false);
-
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create load balancer rule");
}
}
}
@@ -314,7 +356,8 @@ public void create() {
try {
LoadBalancer result =
_lbService.createPublicLoadBalancerRule(getXid(), getName(), getDescription(), getSourcePortStart(), getSourcePortEnd(), getDefaultPortStart(),
- getDefaultPortEnd(), getSourceIpAddressId(), getProtocol(), getAlgorithm(), getNetworkId(), getEntityOwnerId(), getOpenFirewall(), getLbProtocol(), isDisplay());
+ getDefaultPortEnd(), getSourceIpAddressId(), getProtocol(), getAlgorithm(), getNetworkId(), getEntityOwnerId(), getOpenFirewall(), getLbProtocol(), isDisplay(),
+ getAdditionalPortMap(), getCache(), getServiceDownAction(), getHealthCheckDestination(), getExpectedHealthCheck(), healthCheckType, skipDnsError, dsr);
this.setEntityId(result.getId());
this.setEntityUuid(result.getUuid());
} catch (NetworkRuleConflictException e) {
@@ -425,4 +468,28 @@ public String getSyncObjType() {
public Long getSyncObjId() {
return getNetworkId();
}
+
+ public String getHealthCheckType() {
+ return healthCheckType;
+ }
+
+ public String getExpectedHealthCheck() {
+ return expectedHealthCheck;
+ }
+
+ public boolean isSkipDnsError() {
+ return skipDnsError;
+ }
+
+ public void setSkipDnsError(boolean skipDnsError) {
+ this.skipDnsError = skipDnsError;
+ }
+
+ public boolean isDsr() {
+ return dsr;
+ }
+
+ public void setDsr(boolean dsr) {
+ this.dsr = dsr;
+ }
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java
index e3cde0ba640f..5529031037eb 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java
@@ -16,6 +16,7 @@
// under the License.
package org.apache.cloudstack.api.command.user.loadbalancer;
+import com.cloud.utils.Ternary;
import java.util.ArrayList;
import java.util.List;
@@ -33,7 +34,7 @@
import org.apache.cloudstack.api.response.UserVmResponse;
import com.cloud.uservm.UserVm;
-import com.cloud.utils.Pair;
+//import com.cloud.utils.Pair;
@APICommand(name = "listLoadBalancerRuleInstances", description = "List all virtual machine instances that are assigned to a load balancer rule.", responseObject = LoadBalancerRuleVmMapResponse.class, responseView = ResponseView.Restricted,
requestHasSensitiveInfo = false,
@@ -93,9 +94,10 @@ public String getCommandName() {
@Override
public void execute() {
- Pair, List> vmServiceMap = _lbService.listLoadBalancerInstances(this);
+ Ternary, List,Integer> vmServiceMap = _lbService.listLoadBalancerInstances(this);
List extends UserVm> result = vmServiceMap.first();
List serviceStates = vmServiceMap.second();
+ Integer count = vmServiceMap.third();
if (!isListLbVmip()) {
// list lb instances
@@ -109,11 +111,10 @@ public void execute() {
vmResponses.get(i).setServiceState(serviceStates.get(i));
}
}
- response.setResponses(vmResponses);
+ response.setResponses(vmResponses, count);
response.setResponseName(getCommandName());
- setResponseObject(response);
-
+ setResponseObject(response);
} else {
ListResponse lbRes = new ListResponse();
@@ -139,7 +140,7 @@ public void execute() {
}
lbRes.setResponseName(getCommandName());
- lbRes.setResponses(listlbVmRes);
+ lbRes.setResponses(listlbVmRes, count);
setResponseObject(lbRes);
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java
index 13765563fd9d..320596dccdc7 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java
@@ -156,6 +156,7 @@ public String getEventDescription() {
@Override
public void execute() {
+ _lbService.throwExceptionIfIsChildLoadBalancer(id, getActualCommandName());
CallContext.current().setEventDetails("Load balancer Id: " + getId() + " VmIds: " + StringUtils.join(getVirtualMachineIds(), ","));
Map> vmIdIpsMap = getVmIdIpListMap();
try {
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveNetworksFromLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveNetworksFromLoadBalancerRuleCmd.java
new file mode 100644
index 000000000000..b5ea5a8253fc
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveNetworksFromLoadBalancerRuleCmd.java
@@ -0,0 +1,121 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.user.loadbalancer;
+
+import java.util.List;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.context.CallContext;
+import org.apache.log4j.Logger;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.network.rules.LoadBalancer;
+import com.cloud.user.Account;
+import com.cloud.utils.StringUtils;
+
+@APICommand(name = "removeNetworksFromLoadBalancerRule", description = "Removes a list of networks from a load balancer rule.", responseObject = SuccessResponse.class)
+public class RemoveNetworksFromLoadBalancerRuleCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(RemoveNetworksFromLoadBalancerRuleCmd.class.getName());
+
+ private static final String s_name = "removenetworksfromloadbalancerruleresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "the ID of the load balancer rule")
+ private Long id;
+
+ @Parameter(name = ApiConstants.NETWORK_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = NetworkResponse.class, required = true, description = "the list of IDs of the networks that are being removed from the load balancer rule")
+ private List networkIds;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getLoadBalancerId() {
+ return id;
+ }
+
+ public List getNetworkIds() {
+ return networkIds;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ LoadBalancer lb = _entityMgr.findById(LoadBalancer.class, getLoadBalancerId());
+ if (lb == null) {
+ return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
+ }
+ return lb.getAccountId();
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_REMOVE_NETWORK_FROM_LOAD_BALANCER_RULE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "removing networks from load balancer: " + getLoadBalancerId() + " (ids: " + StringUtils.join(getNetworkIds(), ",") + ")";
+ }
+
+ @Override
+ public void execute() {
+ _lbService.throwExceptionIfIsChildLoadBalancer(id, getActualCommandName());
+ CallContext.current().setEventDetails("Load balancer Id: " + getLoadBalancerId() + " NetworkIds: " + StringUtils.join(getNetworkIds(), ","));
+ boolean result = _lbService.removeNetworksFromLoadBalancer(id, getNetworkIds());
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove networks from load balancer rule");
+ }
+ }
+
+ @Override
+ public String getSyncObjType() {
+ return BaseAsyncCmd.networkSyncObject;
+ }
+
+ @Override
+ public Long getSyncObjId() {
+ LoadBalancer lb = _lbService.findById(id);
+ if (lb == null) {
+ throw new InvalidParameterValueException("Unable to find load balancer rule: " + id);
+ }
+ return lb.getNetworkId();
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java
index 43b6633bde41..373744f9df33 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java
@@ -16,6 +16,7 @@
// under the License.
package org.apache.cloudstack.api.command.user.network;
+import com.cloud.utils.exception.CloudRuntimeException;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.log4j.Logger;
@@ -76,13 +77,19 @@ public String getCommandName() {
@Override
public void execute() {
- CallContext.current().setEventDetails("Network Id: " + id);
- boolean result = _networkService.deleteNetwork(id, isForced());
- if (result) {
- SuccessResponse response = new SuccessResponse(getCommandName());
- setResponseObject(response);
- } else {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network");
+ CallContext.current().setEventDetails("Network Id: " + getId());
+ try {
+ boolean result = _networkService.deleteNetwork(getId(), isForced());
+
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network");
+ }
+
+ }catch (CloudRuntimeException e ) {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage(), e);
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java
index e8a045ca1ccf..f4168e1b6fb0 100644
--- a/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java
@@ -57,6 +57,24 @@ public class CreateProjectCmd extends BaseAsyncCreateCmd {
@Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, required = true, description = "display text of the project")
private String displayText;
+ @Parameter(name = ApiConstants.BUSINESS_SERVICE_ID, type = CommandType.STRING, required = false, description = "business service id")
+ private String businessServiceId;
+
+ @Parameter(name = ApiConstants.CLIENT_ID, type = CommandType.STRING, required = false, description = "client id")
+ private String clientId;
+
+ @Parameter(name = ApiConstants.COMPONENT_ID, type = CommandType.STRING, required = false, description = "component id")
+ private String componentId;
+
+ @Parameter(name = ApiConstants.SUB_COMPONENT_ID, type = CommandType.STRING, required = false, description = "sub-component id")
+ private String subComponentId;
+
+ @Parameter(name = ApiConstants.PRODUCT_ID, type = CommandType.STRING, required = false, description = "product id")
+ private String productId;
+
+ @Parameter(name = ApiConstants.DETAILED_USAGE, type = CommandType.BOOLEAN, required = false, description = "true if project has detailed usage by third party app")
+ private Boolean detailedUsage = false;
+
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@@ -86,6 +104,30 @@ public String getDisplayText() {
return displayText;
}
+ public String getBusinessServiceId() {
+ return businessServiceId;
+ }
+
+ public String getClientId() {
+ return clientId;
+ }
+
+ public String getComponentId() {
+ return componentId;
+ }
+
+ public String getSubComponentId() {
+ return subComponentId;
+ }
+
+ public String getProductId() {
+ return productId;
+ }
+
+ public Boolean isDetailedUsage() {
+ return detailedUsage;
+ }
+
@Override
public String getCommandName() {
return s_name;
@@ -125,7 +167,8 @@ public void execute() {
@Override
public void create() throws ResourceAllocationException {
CallContext.current().setEventDetails("Project Name: " + getName());
- Project project = _projectService.createProject(getName(), getDisplayText(), getAccountName(), getDomainId());
+ Project project = _projectService.createProject(getName(), getDisplayText(), getAccountName(), getDomainId(),
+ getBusinessServiceId(), getClientId(), getComponentId(), getSubComponentId(), getProductId(), isDetailedUsage());
if (project != null) {
this.setEntityId(project.getId());
this.setEntityUuid(project.getUuid());
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java
index 7b479b1a9ffd..7a25f66ea32b 100644
--- a/api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java
@@ -61,6 +61,9 @@ public class ListProjectsCmd extends BaseListAccountResourcesCmd {
@Parameter(name = ApiConstants.TAGS, type = CommandType.MAP, description = "List projects by tags (key/value pairs)")
private Map tags;
+ @Parameter(name = "simple", type = CommandType.BOOLEAN, description = "List only basic projec data like id, name, domain")
+ private boolean simple;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -81,6 +84,10 @@ public String getState() {
return state;
}
+ public boolean isSimple() {
+ return simple;
+ }
+
@Override
public String getCommandName() {
return s_name;
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java
index 11e5e35bac3d..cd584e769a3f 100644
--- a/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java
@@ -52,6 +52,24 @@ public class UpdateProjectCmd extends BaseAsyncCmd {
@Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "display text of the project")
private String displayText;
+ @Parameter(name = ApiConstants.BUSINESS_SERVICE_ID, type = CommandType.STRING, required = false, description = "business service id")
+ private String businessServiceId;
+
+ @Parameter(name = ApiConstants.CLIENT_ID, type = CommandType.STRING, required = false, description = "client id")
+ private String clientId;
+
+ @Parameter(name = ApiConstants.COMPONENT_ID, type = CommandType.STRING, required = false, description = "component id")
+ private String componentId;
+
+ @Parameter(name = ApiConstants.SUB_COMPONENT_ID, type = CommandType.STRING, required = false, description = "sub-component id")
+ private String subComponentId;
+
+ @Parameter(name = ApiConstants.PRODUCT_ID, type = CommandType.STRING, required = false, description = "product id")
+ private String productId;
+
+ @Parameter(name = ApiConstants.DETAILED_USAGE, type = CommandType.BOOLEAN, required = false, description = "true if project has detailed usage by third party app")
+ private Boolean detailedUsage;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -68,6 +86,30 @@ public String getDisplayText() {
return displayText;
}
+ public String getBusinessServiceId() {
+ return businessServiceId;
+ }
+
+ public String getClientId() {
+ return clientId;
+ }
+
+ public String getComponentId() {
+ return componentId;
+ }
+
+ public String getSubComponentId() {
+ return subComponentId;
+ }
+
+ public String getProductId() {
+ return productId;
+ }
+
+ public Boolean isDetailedUsage() {
+ return detailedUsage;
+ }
+
@Override
public String getCommandName() {
return s_name;
@@ -91,7 +133,8 @@ public long getEntityOwnerId() {
@Override
public void execute() throws ResourceAllocationException {
CallContext.current().setEventDetails("Project id: " + getId());
- Project project = _projectService.updateProject(getId(), getDisplayText(), getAccountName());
+ Project project = _projectService.updateProject(getId(), getDisplayText(), getAccountName(), getBusinessServiceId(),
+ getClientId(), getComponentId(), getSubComponentId(), getProductId(), isDetailedUsage());
if (project != null) {
ProjectResponse response = _responseGenerator.createProjectResponse(project);
response.setResponseName(getCommandName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/RemoveFromGlobalLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/RemoveFromGlobalLoadBalancerRuleCmd.java
index c514984d2171..f52e3748f74c 100644
--- a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/RemoveFromGlobalLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/RemoveFromGlobalLoadBalancerRuleCmd.java
@@ -117,6 +117,9 @@ public String getEventDescription() {
public void execute() {
CallContext.current().setEventDetails(
"Global Load balancer rule Id: " + getGlobalLoadBalancerRuleId() + " VmIds: " + StringUtils.join(getLoadBalancerRulesIds(), ","));
+
+ _lbService.throwExceptionIfIsParentLoadBalancer(getLoadBalancerRulesIds(), getActualCommandName());
+
boolean result = _gslbService.removeFromGlobalLoadBalancerRule(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java
index d16b87cd95e8..afa07cca3b9d 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java
@@ -78,6 +78,9 @@ public class CopyTemplateCmd extends BaseAsyncCmd {
"Do not specify destzoneid and destzoneids together, however one of them is required.")
protected List destZoneIds;
+ @Parameter(name = "force", type = CommandType.BOOLEAN, description = "Force copy template when template is cross zones")
+ private boolean force = false;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -179,4 +182,8 @@ public void execute() throws ResourceAllocationException {
throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
}
}
+
+ public boolean isForce() {
+ return force;
+ }
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ListGloboVirtualMachinesCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/ListGloboVirtualMachinesCmd.java
new file mode 100644
index 000000000000..bd9a670f4dba
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/ListGloboVirtualMachinesCmd.java
@@ -0,0 +1,57 @@
+package org.apache.cloudstack.api.command.user.vm;
+
+import com.cloud.utils.Pair;
+import com.cloud.vm.VirtualMachine;
+import java.util.List;
+import javax.inject.Inject;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiCommandJobType;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
+
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject;
+import org.apache.cloudstack.api.response.ListResponse;
+
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.query.QueryService;
+
+@APICommand(name = "listGloboVirtualMachines", description = "List the virtual machines by usage.", responseObject = UserVmResponse.class, responseView = ResponseObject.ResponseView.Restricted, entityType = {VirtualMachine.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+public class ListGloboVirtualMachinesCmd extends BaseListTaggedResourcesCmd {
+
+ private static final String s_name = "listglobovirtualmachinesresponse";
+
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, description = "the ID of the virtual machine")
+ private Long id;
+
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "name of the virtual machine (a substring match is made against the parameter value, data for all matching VMs will be returned)")
+ private String name;
+
+ @Inject
+ public QueryService _queryService;
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public ApiCommandJobType getInstanceType() {
+ return ApiCommandJobType.VirtualMachine;
+ }
+
+ @Override
+ public void execute() {
+ ListResponse response = new ListResponse<>();
+ Pair, Integer> result = _queryService.listGloboVm(id, name, getProjectId(), getTags());
+
+ response.setResponses(result.first(), result.second());
+ response.setResponseName(getCommandName());
+ response.setObjectName("virtualmachine");
+ setResponseObject(response);
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java
index ff6acde755f8..e423923c61c1 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java
@@ -130,6 +130,9 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd {
@Parameter(name = ApiConstants.DISPLAY_VM, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin})
private Boolean display;
+ @Parameter(name = "simple", type = CommandType.BOOLEAN, description = "List only basic VM data")
+ private boolean simple;
+
@Parameter(name = ApiConstants.USER_ID, type = CommandType.UUID, entityType = UserResponse.class, required = false, description = "the user ID that created the VM and is under the account that owns the VM")
private Long userId;
@@ -195,6 +198,10 @@ public Long getAffinityGroupId() {
return affinityGroupId;
}
+ public boolean isSimple() {
+ return simple;
+ }
+
public String getKeyPairName() {
return keypair;
}
diff --git a/api/src/org/apache/cloudstack/api/response/AutoScalePolicyResponse.java b/api/src/org/apache/cloudstack/api/response/AutoScalePolicyResponse.java
index bf85d8b227f2..e797fbe11c3c 100644
--- a/api/src/org/apache/cloudstack/api/response/AutoScalePolicyResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/AutoScalePolicyResponse.java
@@ -38,6 +38,10 @@ public class AutoScalePolicyResponse extends BaseResponse implements ControlledE
@Param(description = "the action to be executed if all the conditions evaluate to true for the specified duration.")
private String action;
+ @SerializedName(ApiConstants.STEP)
+ @Param(description = "the number of vms that will be created/destroyed")
+ private Integer step;
+
@SerializedName(ApiConstants.DURATION)
@Param(description = "the duration for which the conditions have to be true before action is taken")
private Integer duration;
@@ -50,6 +54,10 @@ public class AutoScalePolicyResponse extends BaseResponse implements ControlledE
@Param(description = "the list of IDs of the conditions that are being evaluated on every interval")
private List conditions;
+ @SerializedName(ApiConstants.LOGICAL_OPERATOR)
+ @Param(description = "logical operator to be used between all of the conditions")
+ private String logicalOperator;
+
@SerializedName(ApiConstants.ACCOUNT)
@Param(description = "the account owning the autoscale policy")
private String accountName;
@@ -91,10 +99,18 @@ public void setAction(String action) {
this.action = action;
}
+ public void setStep(Integer step) {
+ this.step = step;
+ }
+
public void setConditions(List conditions) {
this.conditions = conditions;
}
+ public void setLogicalOperator(String logicalOperator) {
+ this.logicalOperator = logicalOperator;
+ }
+
@Override
public void setAccountName(String accountName) {
this.accountName = accountName;
diff --git a/api/src/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java b/api/src/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java
index 572d4626fd9e..a5da2d2ffcb8 100644
--- a/api/src/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java
@@ -38,6 +38,10 @@ public class AutoScaleVmGroupResponse extends BaseResponse implements Controlled
@Param(description = "the load balancer rule ID")
private String loadBalancerId;
+ @SerializedName(ApiConstants.AUTOSCALE_GROUP_VM_PREFIX_NAME)
+ @Param(description = "the autoscale vm group name")
+ private String autoScaleGroupName;
+
@SerializedName(ApiConstants.VMPROFILE_ID)
@Param(description = "the autoscale profile that contains information about the vms in the vm group.")
private String profileId;
@@ -46,6 +50,10 @@ public class AutoScaleVmGroupResponse extends BaseResponse implements Controlled
@Param(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.")
private int minMembers;
+ @SerializedName(ApiConstants.AUTOSCALE_GROUP_COUNT_MEMBERS)
+ @Param(description = "the number of instances in the vm autoscale group.")
+ private int autoScaleGroupCountMembers;
+
@SerializedName(ApiConstants.MAX_MEMBERS)
@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;
@@ -86,6 +94,13 @@ public class AutoScaleVmGroupResponse extends BaseResponse implements Controlled
@Param(description = "the domain name of the vm profile")
private String domainName;
+ @SerializedName("tags")
+ @Param(
+ description = "the list of resource tags associated with load balancer",
+ responseObject = ResourceTagResponse.class
+ )
+ private List tags;
+
@SerializedName(ApiConstants.FOR_DISPLAY)
@Param(description = "is group for display to the regular user", since = "4.4", authorized = {RoleType.Admin})
private Boolean forDisplay;
@@ -107,6 +122,10 @@ public void setLoadBalancerId(String loadBalancerId) {
this.loadBalancerId = loadBalancerId;
}
+ public void setAutoScaleGroupName(String autoScaleGroupName) {
+ this.autoScaleGroupName = autoScaleGroupName;
+ }
+
public void setProfileId(String profileId) {
this.profileId = profileId;
}
@@ -115,6 +134,10 @@ public void setMinMembers(int minMembers) {
this.minMembers = minMembers;
}
+ public void setAutoScaleGroupCountMembers(int autoScaleGroupCountMembers) {
+ this.autoScaleGroupCountMembers = autoScaleGroupCountMembers;
+ }
+
public void setMaxMembers(int maxMembers) {
this.maxMembers = maxMembers;
}
@@ -160,6 +183,10 @@ public void setProjectName(String projectName) {
this.projectName = projectName;
}
+ public void setTags(List tags) {
+ this.tags = tags;
+ }
+
public void setForDisplay(Boolean forDisplay) {
this.forDisplay = forDisplay;
}
diff --git a/api/src/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java b/api/src/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java
index 412af1c27362..561bebd8bd3e 100644
--- a/api/src/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java
@@ -102,6 +102,14 @@ public class AutoScaleVmProfileResponse extends BaseResponse implements Controll
@Param(description = "is profile for display to the regular user", since = "4.4", authorized = {RoleType.Admin})
private Boolean forDisplay;
+ @SerializedName(ApiConstants.NETWORK_IDS)
+ @Param(description = "list of additional networks (besides the LB network) to be added to the VMs")
+ private List networkIds;
+
+ @SerializedName(ApiConstants.USER_DATA)
+ @Param(description = "an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded.")
+ private String userData;
+
public AutoScaleVmProfileResponse() {
}
@@ -179,4 +187,12 @@ public void setCsUrl(String csUrl) {
public void setForDisplay(Boolean forDisplay) {
this.forDisplay = forDisplay;
}
+
+ public void setNetworkIds(List networkIds) {
+ this.networkIds = networkIds;
+ }
+
+ public void setUserData(String userData) {
+ this.userData = userData;
+ }
}
diff --git a/api/src/org/apache/cloudstack/api/response/ExceptionResponse.java b/api/src/org/apache/cloudstack/api/response/ExceptionResponse.java
index 65d4ac333711..186483f84a56 100644
--- a/api/src/org/apache/cloudstack/api/response/ExceptionResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/ExceptionResponse.java
@@ -46,6 +46,7 @@ public class ExceptionResponse extends BaseResponse {
public ExceptionResponse() {
idList = new ArrayList();
+ buildCurrentContext();
}
public Integer getErrorCode() {
diff --git a/api/src/org/apache/cloudstack/api/response/ExpectedHealthcheckResponse.java b/api/src/org/apache/cloudstack/api/response/ExpectedHealthcheckResponse.java
new file mode 100644
index 000000000000..42275de93044
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/ExpectedHealthcheckResponse.java
@@ -0,0 +1,37 @@
+package org.apache.cloudstack.api.response;
+
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+
+public class ExpectedHealthcheckResponse extends BaseResponse implements Comparable {
+ @SerializedName(ApiConstants.ID)
+ @Param(description = "the Pool ID")
+ private Long id;
+
+ @SerializedName("expected")
+ @Param(description = "Expected healthcheck")
+ private String expected;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getExpected() {
+ return expected;
+ }
+
+ public void setExpected(String expected) {
+ this.expected = expected;
+ }
+
+ @Override
+ public int compareTo(ExpectedHealthcheckResponse o) {
+ return this.getExpected().compareToIgnoreCase(o.getExpected());
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/response/GloboDictionaryResponse.java b/api/src/org/apache/cloudstack/api/response/GloboDictionaryResponse.java
new file mode 100644
index 000000000000..3a47e0a33ca2
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/GloboDictionaryResponse.java
@@ -0,0 +1,54 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.cloudstack.api.response;
+
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+
+public class GloboDictionaryResponse extends BaseResponse {
+
+ @SerializedName(ApiConstants.ID)
+ @Param(description = "the globo dictionary object id")
+ private String id;
+
+ @SerializedName(ApiConstants.NAME)
+ @Param(description = "the globo dictionary object name")
+ private String name;
+
+ public GloboDictionaryResponse(String id, String name) {
+ this.id = id;
+ this.name = name;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/response/HostResponse.java b/api/src/org/apache/cloudstack/api/response/HostResponse.java
index b9667eca2411..8046789277ad 100644
--- a/api/src/org/apache/cloudstack/api/response/HostResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/HostResponse.java
@@ -496,7 +496,6 @@ public void setDetails(Map details) {
detailsCopy.remove("password");
this.details = detailsCopy;
-
}
public void setMemoryTotal(Long memoryTotal) {
diff --git a/api/src/org/apache/cloudstack/api/response/ListResponse.java b/api/src/org/apache/cloudstack/api/response/ListResponse.java
index 52abe246a49c..ecbee3bff930 100644
--- a/api/src/org/apache/cloudstack/api/response/ListResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/ListResponse.java
@@ -25,6 +25,10 @@ public class ListResponse extends BaseResponse {
List responses;
private transient Integer count;
+ public ListResponse(){
+ buildCurrentContext();
+ }
+
public List getResponses() {
return responses;
}
diff --git a/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java b/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java
index 1eb8fca5087b..2ae54479f284 100644
--- a/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java
@@ -16,14 +16,18 @@
// under the License.
package org.apache.cloudstack.api.response;
+import java.util.ArrayList;
import java.util.List;
+import com.cloud.network.rules.LoadBalancer;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
+import org.apache.cloudstack.api.EntityReference;
+import org.apache.cloudstack.globoconfig.GloboResourceConfiguration;
@SuppressWarnings("unused")
public class LoadBalancerResponse extends BaseResponse implements ControlledEntityResponse {
@@ -103,6 +107,26 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti
@Param(description = "the protocol of the loadbalanacer rule")
private String lbProtocol;
+ @SerializedName("additionalnetworkids")
+ @Param(description = "the additional networks that are associated with this load balancer")
+ private List additionalNetworks;
+
+ @SerializedName(ApiConstants.ADDITIONAL_PORT_MAP)
+ @Param(description = "additional port map associated with load balancing rule")
+ private List additionalPortMap;
+
+ @SerializedName(ApiConstants.CACHE)
+ @Param(description = "cache group associated with load balancing rule")
+ private String cache;
+
+ @SerializedName(ApiConstants.HEALTHCHECK_DESTINATION)
+ @Param(description = "Port to be used as health check alternative to the service port (optional)")
+ private String healthCheckDestination;
+
+ @SerializedName(ApiConstants.SERVICE_DOWN_ACTION)
+ @Param(description = "ID of the action to be executed when service is down")
+ private String serviceDownAction;
+
@SerializedName(ApiConstants.TAGS)
@Param(description = "the list of resource tags associated with load balancer", responseObject = ResourceTagResponse.class)
private List tags;
@@ -111,6 +135,20 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti
@Param(description = "is rule for display to the regular user", since = "4.4", authorized = {RoleType.Admin})
private Boolean forDisplay;
+ @SerializedName(ApiConstants.GLOBO_RESOURCE_CONFIG)
+ @Param(description = "list with globo resource configuration")
+ private List globoResourceConfigs;
+
+
+ @SerializedName(ApiConstants.LB_LINKED_PARENT_LOAD_BALANCER)
+ @Param(description = "load balancer that this is linked")
+ private LinkedLoadBalancer linkedparent;
+
+
+ @SerializedName(ApiConstants.LB_LINKED_CHILDREN_LOAD_BALANCER)
+ @Param(description = "load balancer linked children")
+ private List linkedchildren;
+
public void setId(String id) {
this.id = id;
}
@@ -196,7 +234,130 @@ public void setLbProtocol(String lbProtocol) {
this.lbProtocol = lbProtocol;
}
+ public void setAdditionalNetworks(List additionalNetworks) {
+ this.additionalNetworks = additionalNetworks;
+ }
+
+ public void setAdditionalPortMap(List additionalPortMap) { this.additionalPortMap = additionalPortMap; }
+
+ public void setCache(String cache) { this.cache = cache; }
+
+ public void setHealthCheckDestination(String healthCheckDestination) {
+ this.healthCheckDestination = healthCheckDestination;
+ }
+
+ public void setGloboResourceConfigs(List configs) {
+ this.globoResourceConfigs = configs;
+ }
+
+ public void setServiceDownAction(String serviceDownAction) {
+ this.serviceDownAction = serviceDownAction;
+ }
+
public void setForDisplay(Boolean forDisplay) {
this.forDisplay = forDisplay;
}
+
+ public String getName() {
+ return name;
+ }
+
+ public LinkedLoadBalancer getLinkedparent() {
+ return linkedparent;
+ }
+
+ public void setLinkedParentLoadBalancer(LoadBalancer parentLb, GloboResourceConfiguration linkedConfig) {
+ this.linkedparent = new LinkedLoadBalancer();
+ linkedparent.setName(parentLb.getName());
+ linkedparent.setUuid(parentLb.getUuid());
+ linkedparent.setConfigId(linkedConfig.getId());
+
+ }
+
+ public void addLinkChild(LoadBalancer childlb, GloboResourceConfiguration linkedConfig) {
+ if (linkedchildren == null) {
+ linkedchildren = new ArrayList<>();
+ }
+
+ LinkedLoadBalancer child = new LinkedLoadBalancer();
+ child.setName(childlb.getName());
+ child.setUuid(childlb.getUuid());
+ child.setConfigId(linkedConfig.getId());
+ linkedchildren.add(child);
+
+ }
+
+ @EntityReference(value = LoadBalancer.class)
+ public static class LinkedLoadBalancer {
+ private String name;
+ private String uuid;
+ private Long configid;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getUuid() {
+ return uuid;
+ }
+
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ public Long getConfigId() {
+ return configid;
+ }
+
+ public void setConfigId(Long configId) {
+ this.configid = configId;
+ }
+ }
+
+ @EntityReference(value = GloboResourceConfiguration.class)
+ public static class GloboResourceConfigurationResponse {
+ @SerializedName("resourcetype")
+ @Param(description = "the resourcetype of the resource")
+ private String resourceType;
+
+ @SerializedName("configurationkey")
+ @Param(description = "the configuration key")
+ private String configurationKey;
+
+ @SerializedName("configurationvalue")
+ @Param(description = "the configuration value")
+ private String configurationValue;
+
+
+ public GloboResourceConfigurationResponse() {
+ }
+
+ public String getResourceType() {
+ return this.resourceType;
+ }
+
+ public void setResourceType(String resourceType) {
+ this.resourceType = resourceType;
+ }
+
+ public void setConfigurationKey(String configurationKey){
+ this.configurationKey = configurationKey;
+ }
+
+ public void setConfigurationValue(String configurationValue){
+ this.configurationValue = configurationValue;
+ }
+
+ public String getConfigurationKey() {
+ return configurationKey;
+ }
+
+ public String getConfigurationValue() {
+ return configurationValue;
+ }
+ }
}
diff --git a/api/src/org/apache/cloudstack/api/response/NetworkResponse.java b/api/src/org/apache/cloudstack/api/response/NetworkResponse.java
index 8d0f725500bb..9edcc15fb168 100644
--- a/api/src/org/apache/cloudstack/api/response/NetworkResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/NetworkResponse.java
@@ -225,6 +225,10 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
@Param(description = "If a network is enabled for 'streched l2 subnet' then represents zones on which network currently spans", since = "4.4")
private Set networkSpannedZones;
+ @SerializedName(ApiConstants.GURU_NAME)
+ @Param(description = "The name of the network guru that implements this network", since = "4.6")
+ private String guruName;
+
@SerializedName(ApiConstants.EXTERNAL_ID)
@Param(description = "The external id of the network", since = "4.11")
private String externalId;
@@ -438,6 +442,10 @@ public void setNetworkSpannedZones(Set networkSpannedZones) {
this.networkSpannedZones = networkSpannedZones;
}
+ public void setGuruName(String guruName) {
+ this.guruName = guruName;
+ }
+
public void setExternalId(String externalId) {
this.externalId = externalId;
}
diff --git a/api/src/org/apache/cloudstack/api/response/PoolResponse.java b/api/src/org/apache/cloudstack/api/response/PoolResponse.java
new file mode 100644
index 000000000000..ee01d224436e
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/PoolResponse.java
@@ -0,0 +1,140 @@
+package org.apache.cloudstack.api.response;
+
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+
+public class PoolResponse extends BaseResponse {
+ @SerializedName(ApiConstants.ID)
+ @Param(description = "the Pool ID")
+ private Long id;
+
+ @SerializedName("name")
+ @Param(description = "the Pool Load name")
+ private String name;
+
+ @SerializedName("lbmethod")
+ @Param(description = "the Pool Load balancer Method")
+ private String lbMethod;
+
+
+ @SerializedName("port")
+ @Param(description = "the Pool Port")
+ private Integer port;
+
+ @SerializedName("vipport")
+ @Param(description = "the Vip Port")
+ private Integer vipPort;
+
+ @SerializedName("maxconn")
+ @Param(description = "the max connections")
+ private Integer maxconn;
+
+
+ @SerializedName("healthchecktype")
+ @Param(description = "Healthcheck type")
+ private String healthcheckType;
+
+ @SerializedName("healthcheck")
+ @Param(description = "Healthcheck")
+ private String healthcheck;
+
+ @SerializedName("healthcheckexpect")
+ @Param(description = "Expected healthcheck")
+ private String expectedHealthcheck;
+
+ @SerializedName("l4protocol")
+ private String l4Protocol;
+
+ @SerializedName("l7protocol")
+ private String l7Protocol;
+
+ public String getHealthcheckType() {
+ return healthcheckType;
+ }
+
+ public Integer getMaxconn() {
+ return maxconn;
+ }
+
+ public void setMaxconn(Integer maxconn) {
+ this.maxconn = maxconn;
+ }
+
+ public void setHealthcheckType(String healthcheckType) {
+ this.healthcheckType = healthcheckType;
+ }
+
+ public String getHealthcheck() {
+ return healthcheck;
+ }
+
+ public void setHealthcheck(String healthcheck) {
+ this.healthcheck = healthcheck;
+ }
+
+ public String getExpectedHealthcheck() {
+ return expectedHealthcheck;
+ }
+
+ public void setExpectedHealthcheck(String expectedHealthcheck) {
+ this.expectedHealthcheck = expectedHealthcheck;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getLbMethod() {
+ return lbMethod;
+ }
+
+ public void setLbMethod(String lbMethod) {
+ this.lbMethod = lbMethod;
+ }
+
+ public Integer getPort() {
+ return port;
+ }
+
+ public void setPort(Integer port) {
+ this.port = port;
+ }
+
+ public Integer getVipPort() {
+ return vipPort;
+ }
+
+ public void setVipPort(Integer vipPort) {
+ this.vipPort = vipPort;
+ }
+
+ public void setL4Protocol(String l4Protocol) {
+ this.l4Protocol = l4Protocol;
+ }
+
+ public void setL7Protocol(String l7Protocol) {
+ this.l7Protocol = l7Protocol;
+ }
+
+ public String getL4Protocol() {
+ return l4Protocol;
+ }
+
+ public String getL7Protocol() {
+ return l7Protocol;
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/response/ProjectResponse.java b/api/src/org/apache/cloudstack/api/response/ProjectResponse.java
index 8bfa6d94b63c..46635c7965df 100644
--- a/api/src/org/apache/cloudstack/api/response/ProjectResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/ProjectResponse.java
@@ -51,6 +51,30 @@ public class ProjectResponse extends BaseResponse implements ResourceLimitAndCou
@Param(description = "the domain name where the project belongs to")
private String domain;
+ @SerializedName(ApiConstants.BUSINESS_SERVICE_ID)
+ @Param(description = "the business service id")
+ private String businessServiceId;
+
+ @SerializedName(ApiConstants.CLIENT_ID)
+ @Param(description = "the client id")
+ private String clientId;
+
+ @SerializedName(ApiConstants.COMPONENT_ID)
+ @Param(description = "the component id")
+ private String componentId;
+
+ @SerializedName(ApiConstants.SUB_COMPONENT_ID)
+ @Param(description = "the sub-component id")
+ private String subComponentId;
+
+ @SerializedName(ApiConstants.PRODUCT_ID)
+ @Param(description = "the product id")
+ private String productId;
+
+ @SerializedName(ApiConstants.DETAILED_USAGE)
+ @Param(description = "true if project has detailed usage by third party app")
+ private Boolean detailedUsage;
+
@SerializedName(ApiConstants.ACCOUNT)
@Param(description = "the account name of the project's owner")
private String ownerName;
@@ -422,4 +446,27 @@ public void setSecondaryStorageAvailable(String secondaryStorageAvailable) {
this.secondaryStorageAvailable = secondaryStorageAvailable;
}
+ public void setBusinessServiceId(String businessServiceId) {
+ this.businessServiceId = businessServiceId;
+ }
+
+ public void setClientId(String clientId) {
+ this.clientId = clientId;
+ }
+
+ public void setComponentId(String componentId) {
+ this.componentId = componentId;
+ }
+
+ public void setSubComponentId(String subComponentId) {
+ this.subComponentId = subComponentId;
+ }
+
+ public void setProductId(String productId) {
+ this.productId = productId;
+ }
+
+ public void setDetailedUsage(Boolean detailedUsage) {
+ this.detailedUsage = detailedUsage;
+ }
}
diff --git a/api/src/org/apache/cloudstack/api/response/RegisterDnsForLoadBalancerResponse.java b/api/src/org/apache/cloudstack/api/response/RegisterDnsForLoadBalancerResponse.java
new file mode 100644
index 000000000000..05dc3fca93fa
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/RegisterDnsForLoadBalancerResponse.java
@@ -0,0 +1,47 @@
+package org.apache.cloudstack.api.response;
+
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+import org.apache.cloudstack.api.BaseResponse;
+
+/**
+ * Created by sinval.neto on 7/20/16.
+ */
+public class RegisterDnsForLoadBalancerResponse extends BaseResponse {
+
+ @SerializedName("result")
+ @Param(description = "the result of the operation")
+ private String result;
+
+ @SerializedName("id")
+ @Param(description = "the id of the resource")
+ private String id;
+
+ @SerializedName("resourcetype")
+ @Param(description = "the resourcetype of the resource")
+ private String resourceType;
+
+ public String getResult() {
+ return result;
+ }
+
+ public void setResult(String result) {
+ this.result = result;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getResourceType() {
+ return this.resourceType;
+ }
+
+ public void setResourceType(String resourceType) {
+ this.resourceType = resourceType;
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/response/SnapshotResponse.java b/api/src/org/apache/cloudstack/api/response/SnapshotResponse.java
index bb2ff7f6d0e9..ed5b07dd620c 100644
--- a/api/src/org/apache/cloudstack/api/response/SnapshotResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/SnapshotResponse.java
@@ -68,6 +68,10 @@ public class SnapshotResponse extends BaseResponse implements ControlledEntityRe
@Param(description = "type of the disk volume")
private String volumeType;
+ @SerializedName("volumesize")
+ @Param(description = "size of the disk volume")
+ private Long volumeSize;
+
@SerializedName(ApiConstants.CREATED)
@Param(description = " the date the snapshot was created")
private Date created;
@@ -96,6 +100,10 @@ public class SnapshotResponse extends BaseResponse implements ControlledEntityRe
@Param(description = "id of the availability zone")
private String zoneId;
+ @SerializedName(ApiConstants.ZONE_NAME)
+ @Param(description = "name of the availability zone")
+ private String zoneName;
+
@SerializedName(ApiConstants.TAGS)
@Param(description = "the list of resource tags associated with snapshot", responseObject = ResourceTagResponse.class)
private List tags;
@@ -168,6 +176,10 @@ public void setVolumeType(String volumeType) {
this.volumeType = volumeType;
}
+ public void setVolumeSize(Long volumeSize) {
+ this.volumeSize = volumeSize;
+ }
+
public void setCreated(Date created) {
this.created = created;
}
@@ -206,6 +218,10 @@ public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
+ public void setZoneName(String zoneName) {
+ this.zoneName = zoneName;
+ }
+
public void setTags(List tags) {
this.tags = tags;
}
diff --git a/api/src/org/apache/cloudstack/api/response/SuccessResponse.java b/api/src/org/apache/cloudstack/api/response/SuccessResponse.java
index 0dde6d0e4230..87857b07f054 100644
--- a/api/src/org/apache/cloudstack/api/response/SuccessResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/SuccessResponse.java
@@ -48,6 +48,7 @@ public void setDisplayText(String displayText) {
}
public SuccessResponse() {
+ buildCurrentContext();
}
public SuccessResponse(String responseName) {
diff --git a/api/src/org/apache/cloudstack/api/response/UserVmResponse.java b/api/src/org/apache/cloudstack/api/response/UserVmResponse.java
index 2ff1eaa717b7..9abb6cb10207 100644
--- a/api/src/org/apache/cloudstack/api/response/UserVmResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/UserVmResponse.java
@@ -286,6 +286,11 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co
@Param(description = "OS type id of the vm", since = "4.4")
private Long osTypeId;
+
+ @SerializedName(ApiConstants.OS_TYPE_NAME)
+ @Param(description = "OS type name of the vm", since = "4.4")
+ private String osTypeName;
+
public UserVmResponse() {
securityGroupList = new LinkedHashSet();
nics = new LinkedHashSet();
@@ -837,4 +842,9 @@ public void setDynamicallyScalable(Boolean dynamicallyScalable) {
public Long getOsTypeId() {
return osTypeId;
}
+
+ public void setOsTypeName(String osTypeName) {
+ this.osTypeName = osTypeName;
+ }
+
}
diff --git a/api/src/org/apache/cloudstack/context/CallContext.java b/api/src/org/apache/cloudstack/context/CallContext.java
index fb83f8689143..521e337aa303 100644
--- a/api/src/org/apache/cloudstack/context/CallContext.java
+++ b/api/src/org/apache/cloudstack/context/CallContext.java
@@ -62,6 +62,8 @@ protected Stack initialValue() {
private final Map