diff --git a/agent/pom.xml b/agent/pom.xml
index 0f44c1aa297..c2b1502728f 100644
--- a/agent/pom.xml
+++ b/agent/pom.xml
@@ -36,6 +36,11 @@
cloud-utils
${project.version}
+
+ commons-daemon
+ commons-daemon
+ ${cs.daemon.version}
+
install
diff --git a/agent/src/com/cloud/agent/AgentShell.java b/agent/src/com/cloud/agent/AgentShell.java
index 73b3950e7e4..cf454b8c89c 100644
--- a/agent/src/com/cloud/agent/AgentShell.java
+++ b/agent/src/com/cloud/agent/AgentShell.java
@@ -24,7 +24,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
import java.net.HttpURLConnection;
import java.util.ArrayList;
import java.util.Collections;
@@ -38,6 +37,9 @@ import java.util.UUID;
import javax.naming.ConfigurationException;
+import org.apache.commons.daemon.Daemon;
+import org.apache.commons.daemon.DaemonContext;
+import org.apache.commons.daemon.DaemonInitException;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
import org.apache.commons.httpclient.methods.GetMethod;
@@ -47,7 +49,6 @@ import org.apache.log4j.xml.DOMConfigurator;
import com.cloud.agent.Agent.ExitStatus;
import com.cloud.agent.dao.StorageComponent;
import com.cloud.agent.dao.impl.PropertiesStorage;
-import com.cloud.host.Host;
import com.cloud.resource.ServerResource;
import com.cloud.utils.LogUtils;
import com.cloud.utils.NumbersUtil;
@@ -58,7 +59,7 @@ import com.cloud.utils.backoff.impl.ConstantTimeBackoff;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.script.Script;
-public class AgentShell implements IAgentShell {
+public class AgentShell implements IAgentShell, Daemon {
private static final Logger s_logger = Logger.getLogger(AgentShell.class
.getName());
private static final MultiThreadedHttpConnectionManager s_httpClientManager = new MultiThreadedHttpConnectionManager();
@@ -79,7 +80,6 @@ public class AgentShell implements IAgentShell {
private int _nextAgentId = 1;
private volatile boolean _exit = false;
private int _pingRetries;
- private Thread _consoleProxyMain = null;
private final List _agents = new ArrayList();
public AgentShell() {
@@ -376,7 +376,17 @@ public class AgentShell implements IAgentShell {
return true;
}
-
+
+ @Override
+ public void init(DaemonContext dc) throws DaemonInitException {
+ s_logger.debug("Initializing AgentShell from JSVC");
+ try {
+ init(dc.getArguments());
+ } catch (ConfigurationException ex) {
+ throw new DaemonInitException("Initialization failed", ex);
+ }
+ }
+
public void init(String[] args) throws ConfigurationException {
// PropertiesUtil is used both in management server and agent packages,
@@ -402,11 +412,13 @@ public class AgentShell implements IAgentShell {
loadProperties();
parseCommand(args);
- List properties = Collections.list((Enumeration)_properties.propertyNames());
- for (String property:properties){
- s_logger.debug("Found property: " + property);
+ if (s_logger.isDebugEnabled()) {
+ List properties = Collections.list((Enumeration)_properties.propertyNames());
+ for (String property:properties){
+ s_logger.debug("Found property: " + property);
+ }
}
-
+
s_logger.info("Defaulting to using properties file for storage");
_storage = new PropertiesStorage();
_storage.configure("Storage", new HashMap());
@@ -434,71 +446,6 @@ public class AgentShell implements IAgentShell {
launchAgentFromTypeInfo();
}
- private boolean needConsoleProxy() {
- for (Agent agent : _agents) {
- if (agent.getResource().getType().equals(Host.Type.ConsoleProxy)
- || agent.getResource().getType().equals(Host.Type.Routing))
- return true;
- }
- return false;
- }
-
- private int getConsoleProxyPort() {
- int port = NumbersUtil.parseInt(
- getProperty(null, "consoleproxy.httpListenPort"), 443);
- return port;
- }
-
- private void openPortWithIptables(int port) {
- // TODO
- }
-
- private void launchConsoleProxy() throws ConfigurationException {
- if (!needConsoleProxy()) {
- if (s_logger.isInfoEnabled())
- s_logger.info("Storage only agent, no need to start console proxy on it");
- return;
- }
-
- int port = getConsoleProxyPort();
- openPortWithIptables(port);
-
- _consoleProxyMain = new Thread(new Runnable() {
- @Override
- public void run() {
- try {
- Class> consoleProxyClazz = Class.forName("com.cloud.consoleproxy.ConsoleProxy");
-
- try {
- Method method = consoleProxyClazz.getMethod("start",
- Properties.class);
- method.invoke(null, _properties);
- } catch (SecurityException e) {
- s_logger.error("Unable to launch console proxy due to SecurityException");
- System.exit(ExitStatus.Error.value());
- } catch (NoSuchMethodException e) {
- s_logger.error("Unable to launch console proxy due to NoSuchMethodException");
- System.exit(ExitStatus.Error.value());
- } catch (IllegalArgumentException e) {
- s_logger.error("Unable to launch console proxy due to IllegalArgumentException");
- System.exit(ExitStatus.Error.value());
- } catch (IllegalAccessException e) {
- s_logger.error("Unable to launch console proxy due to IllegalAccessException");
- System.exit(ExitStatus.Error.value());
- } catch (InvocationTargetException e) {
- s_logger.error("Unable to launch console proxy due to InvocationTargetException");
- System.exit(ExitStatus.Error.value());
- }
- } catch (final ClassNotFoundException e) {
- s_logger.error("Unable to launch console proxy due to ClassNotFoundException");
- System.exit(ExitStatus.Error.value());
- }
- }
- }, "Console-Proxy-Main");
- _consoleProxyMain.setDaemon(true);
- _consoleProxyMain.start();
- }
-
private void launchAgentFromClassInfo(String resourceClassNames)
throws ConfigurationException {
String[] names = resourceClassNames.split("\\|");
@@ -591,14 +538,6 @@ public class AgentShell implements IAgentShell {
launchAgent();
- //
- // For both KVM & Xen-Server hypervisor, we have switched to
- // VM-based console proxy solution, disable launching
- // of console proxy here
- //
- // launchConsoleProxy();
- //
-
try {
while (!_exit)
Thread.sleep(1000);
@@ -618,9 +557,6 @@ public class AgentShell implements IAgentShell {
public void stop() {
_exit = true;
- if (_consoleProxyMain != null) {
- _consoleProxyMain.interrupt();
- }
}
public void destroy() {
@@ -629,6 +565,7 @@ public class AgentShell implements IAgentShell {
public static void main(String[] args) {
try {
+ s_logger.debug("Initializing AgentShell from main");
AgentShell shell = new AgentShell();
shell.init(args);
shell.start();
@@ -636,4 +573,5 @@ public class AgentShell implements IAgentShell {
System.out.println(e.getMessage());
}
}
+
}
diff --git a/api/src/com/cloud/agent/api/PvlanSetupCommand.java b/api/src/com/cloud/agent/api/PvlanSetupCommand.java
new file mode 100644
index 00000000000..ee1f046d6d9
--- /dev/null
+++ b/api/src/com/cloud/agent/api/PvlanSetupCommand.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 com.cloud.agent.api;
+
+import java.net.URI;
+
+import com.cloud.utils.net.NetUtils;
+
+public class PvlanSetupCommand extends Command {
+ public enum Type {
+ DHCP,
+ VM
+ }
+ private String op;
+ private String primary;
+ private String isolated;
+ private String vmMac;
+ private String dhcpName;
+ private String dhcpMac;
+ private String dhcpIp;
+ private Type type;
+ private String networkTag;
+
+ protected PvlanSetupCommand() {}
+
+ protected PvlanSetupCommand(Type type, String op, URI uri, String networkTag)
+ {
+ this.type = type;
+ this.op = op;
+ this.primary = NetUtils.getPrimaryPvlanFromUri(uri);
+ this.isolated = NetUtils.getIsolatedPvlanFromUri(uri);
+ this.networkTag = networkTag;
+ }
+
+ static public PvlanSetupCommand createDhcpSetup(String op, URI uri, String networkTag, String dhcpName, String dhcpMac, String dhcpIp)
+ {
+ PvlanSetupCommand cmd = new PvlanSetupCommand(Type.DHCP, op, uri, networkTag);
+ cmd.setDhcpName(dhcpName);
+ cmd.setDhcpMac(dhcpMac);
+ cmd.setDhcpIp(dhcpIp);
+ return cmd;
+ }
+
+ static public PvlanSetupCommand createVmSetup(String op, URI uri, String networkTag, String vmMac)
+ {
+ PvlanSetupCommand cmd = new PvlanSetupCommand(Type.VM, op, uri, networkTag);
+ cmd.setVmMac(vmMac);
+ return cmd;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ public String getOp() {
+ return op;
+ }
+
+ public String getPrimary() {
+ return primary;
+ }
+
+ public String getIsolated() {
+ return isolated;
+ }
+
+ public String getVmMac() {
+ return vmMac;
+ }
+
+ protected void setVmMac(String vmMac) {
+ this.vmMac = vmMac;
+ }
+
+ public String getDhcpMac() {
+ return dhcpMac;
+ }
+
+ protected void setDhcpMac(String dhcpMac) {
+ this.dhcpMac = dhcpMac;
+ }
+
+ public String getDhcpIp() {
+ return dhcpIp;
+ }
+
+ protected void setDhcpIp(String dhcpIp) {
+ this.dhcpIp = dhcpIp;
+ }
+
+ public Type getType() {
+ return type;
+ }
+
+ public String getDhcpName() {
+ return dhcpName;
+ }
+
+ public void setDhcpName(String dhcpName) {
+ this.dhcpName = dhcpName;
+ }
+
+ public String getNetworkTag() {
+ return networkTag;
+ }
+}
diff --git a/api/src/com/cloud/agent/api/to/DnsmasqTO.java b/api/src/com/cloud/agent/api/to/DnsmasqTO.java
new file mode 100644
index 00000000000..f99878c2fed
--- /dev/null
+++ b/api/src/com/cloud/agent/api/to/DnsmasqTO.java
@@ -0,0 +1,53 @@
+// 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 DnsmasqTO {
+ String routerIp;
+ String gateway;
+ String netmask;
+
+ public DnsmasqTO(String routerIp, String gateway, String netmask) {
+ this.routerIp = routerIp;
+ this.gateway = gateway;
+ this.netmask =netmask;
+ }
+
+ public void setRouterIp(String routerIp){
+ this.routerIp = routerIp;
+ }
+
+ public void setGateway(String gateway) {
+ this.gateway = gateway;
+ }
+
+ public void setNetmask(String netmask) {
+ this.netmask = netmask ;
+ }
+
+ public String getRouterIp() {
+ return routerIp;
+ }
+
+ public String getGateway() {
+ return gateway;
+ }
+
+ public String getNetmask() {
+ return netmask;
+ }
+}
diff --git a/api/src/com/cloud/agent/api/to/NetworkACLTO.java b/api/src/com/cloud/agent/api/to/NetworkACLTO.java
index 8818e13de4a..398591b120d 100644
--- a/api/src/com/cloud/agent/api/to/NetworkACLTO.java
+++ b/api/src/com/cloud/agent/api/to/NetworkACLTO.java
@@ -20,10 +20,10 @@ package com.cloud.agent.api.to;
import java.util.ArrayList;
import java.util.List;
+import com.cloud.network.vpc.NetworkACLItem;
+import com.cloud.network.vpc.NetworkACLItem.TrafficType;
import org.apache.cloudstack.api.InternalIdentity;
-import com.cloud.network.rules.FirewallRule;
-import com.cloud.network.rules.FirewallRule.TrafficType;
import com.cloud.utils.net.NetUtils;
@@ -37,15 +37,16 @@ public class NetworkACLTO implements InternalIdentity {
private List cidrList;
private Integer icmpType;
private Integer icmpCode;
- private FirewallRule.TrafficType trafficType;
-
+ private TrafficType trafficType;
+ String action;
+ int number;
protected NetworkACLTO() {
}
public NetworkACLTO(long id,String vlanTag, String protocol, Integer portStart, Integer portEnd, boolean revoked,
- boolean alreadyAdded, List cidrList, Integer icmpType,Integer icmpCode,TrafficType trafficType) {
+ boolean alreadyAdded, List cidrList, Integer icmpType,Integer icmpCode,TrafficType trafficType, boolean allow, int number) {
this.vlanTag = vlanTag;
this.protocol = protocol;
@@ -70,12 +71,20 @@ public class NetworkACLTO implements InternalIdentity {
this.icmpType = icmpType;
this.icmpCode = icmpCode;
this.trafficType = trafficType;
+
+ if(!allow){
+ this.action = "DROP";
+ } else {
+ this.action = "ACCEPT";
+ }
+
+ this.number = number;
}
- public NetworkACLTO(FirewallRule rule, String vlanTag, FirewallRule.TrafficType trafficType ) {
+ public NetworkACLTO(NetworkACLItem rule, String vlanTag, NetworkACLItem.TrafficType trafficType ) {
this(rule.getId(), vlanTag, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(),
- rule.getState() == FirewallRule.State.Revoke, rule.getState() == FirewallRule.State.Active,
- rule.getSourceCidrList() ,rule.getIcmpType(), rule.getIcmpCode(),trafficType);
+ rule.getState() == NetworkACLItem.State.Revoke, rule.getState() == NetworkACLItem.State.Active,
+ rule.getSourceCidrList() ,rule.getIcmpType(), rule.getIcmpCode(),trafficType, rule.getAction() == NetworkACLItem.Action.Allow, rule.getNumber());
}
public long getId() {
@@ -83,7 +92,7 @@ public class NetworkACLTO implements InternalIdentity {
}
public String getSrcVlanTag() {
- return vlanTag;
+ return vlanTag;
}
public String getProtocol() {
@@ -95,18 +104,18 @@ public class NetworkACLTO implements InternalIdentity {
}
public Integer getIcmpType(){
- return icmpType;
+ return icmpType;
}
public Integer getIcmpCode(){
- return icmpCode;
+ return icmpCode;
}
public String getStringPortRange() {
- if (portRange == null || portRange.length < 2)
- return "0:0";
- else
- return NetUtils.portRangeToString(portRange);
+ if (portRange == null || portRange.length < 2)
+ return "0:0";
+ else
+ return NetUtils.portRangeToString(portRange);
}
public boolean revoked() {
@@ -121,7 +130,15 @@ public class NetworkACLTO implements InternalIdentity {
return alreadyAdded;
}
- public FirewallRule.TrafficType getTrafficType() {
+ public TrafficType getTrafficType() {
return trafficType;
}
+
+ public String getAction() {
+ return action;
+ }
+
+ public int getNumber(){
+ return number;
+ }
}
diff --git a/api/src/com/cloud/deploy/DeploymentClusterPlanner.java b/api/src/com/cloud/deploy/DeploymentClusterPlanner.java
new file mode 100644
index 00000000000..b12b93e728e
--- /dev/null
+++ b/api/src/com/cloud/deploy/DeploymentClusterPlanner.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 com.cloud.deploy;
+
+import java.util.List;
+
+import com.cloud.exception.InsufficientServerCapacityException;
+import com.cloud.vm.VirtualMachineProfile;
+
+/**
+ */
+public interface DeploymentClusterPlanner extends DeploymentPlanner {
+ /**
+ * This is called to determine list of possible clusters where a virtual
+ * machine can be deployed.
+ *
+ * @param vm
+ * virtual machine.
+ * @param plan
+ * deployment plan that tells you where it's being deployed to.
+ * @param avoid
+ * avoid these data centers, pods, clusters, or hosts.
+ * @return DeployDestination for that virtual machine.
+ */
+ List orderClusters(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid)
+ throws InsufficientServerCapacityException;
+
+ PlannerResourceUsage getResourceUsage();
+
+}
diff --git a/api/src/com/cloud/deploy/DeploymentPlanner.java b/api/src/com/cloud/deploy/DeploymentPlanner.java
index 50f64ff2abd..741a8048a0a 100644
--- a/api/src/com/cloud/deploy/DeploymentPlanner.java
+++ b/api/src/com/cloud/deploy/DeploymentPlanner.java
@@ -34,6 +34,7 @@ import com.cloud.vm.VirtualMachineProfile;
/**
*/
public interface DeploymentPlanner extends Adapter {
+
/**
* plan is called to determine where a virtual machine should be running.
*
@@ -45,6 +46,7 @@ public interface DeploymentPlanner extends Adapter {
* avoid these data centers, pods, clusters, or hosts.
* @return DeployDestination for that virtual machine.
*/
+ @Deprecated
DeployDestination plan(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException;
/**
@@ -87,6 +89,10 @@ public interface DeploymentPlanner extends Adapter {
userconcentratedpod_firstfit;
}
+ public enum PlannerResourceUsage {
+ Shared, Dedicated;
+ }
+
public static class ExcludeList {
private Set _dcIds;
private Set _podIds;
@@ -98,10 +104,22 @@ public interface DeploymentPlanner extends Adapter {
}
public ExcludeList(Set _dcIds, Set _podIds, Set _clusterIds, Set _hostIds, Set _poolIds) {
- this._dcIds = _dcIds;
- this._podIds = _podIds;
- this._clusterIds = _clusterIds;
- this._poolIds = _poolIds;
+ if (_dcIds != null) {
+ this._dcIds = new HashSet(_dcIds);
+ }
+ if (_podIds != null) {
+ this._podIds = new HashSet(_podIds);
+ }
+ if (_clusterIds != null) {
+ this._clusterIds = new HashSet(_clusterIds);
+ }
+
+ if (_hostIds != null) {
+ this._hostIds = new HashSet(_hostIds);
+ }
+ if (_poolIds != null) {
+ this._poolIds = new HashSet(_poolIds);
+ }
}
public boolean add(InsufficientCapacityException e) {
@@ -194,6 +212,13 @@ public interface DeploymentPlanner extends Adapter {
_hostIds.add(hostId);
}
+ public void addHostList(Collection hostList) {
+ if (_hostIds == null) {
+ _hostIds = new HashSet();
+ }
+ _hostIds.addAll(hostList);
+ }
+
public boolean shouldAvoid(Host host) {
if (_dcIds != null && _dcIds.contains(host.getDataCenterId())) {
return true;
diff --git a/api/src/com/cloud/event/EventTypes.java b/api/src/com/cloud/event/EventTypes.java
index 45a904e426c..9c83f13ea2a 100755
--- a/api/src/com/cloud/event/EventTypes.java
+++ b/api/src/com/cloud/event/EventTypes.java
@@ -92,6 +92,8 @@ public class EventTypes {
public static final String EVENT_PROXY_STOP = "PROXY.STOP";
public static final String EVENT_PROXY_REBOOT = "PROXY.REBOOT";
public static final String EVENT_PROXY_HA = "PROXY.HA";
+ public static final String EVENT_PROXY_SCALE = "PROXY.SCALE";
+
// VNC Console Events
public static final String EVENT_VNC_CONNECT = "VNC.CONNECT";
@@ -113,6 +115,10 @@ public class EventTypes {
public static final String EVENT_NIC_CREATE = "NIC.CREATE";
public static final String EVENT_NIC_DELETE = "NIC.DELETE";
public static final String EVENT_NIC_UPDATE = "NIC.UPDATE";
+ public static final String EVENT_NIC_DETAIL_ADD = "NIC.DETAIL.ADD";
+ public static final String EVENT_NIC_DETAIL_UPDATE = "NIC.DETAIL.UPDATE";
+ public static final String EVENT_NIC_DETAIL_REMOVE = "NIC.DETAIL.REMOVE";
+
// Load Balancers
public static final String EVENT_ASSIGN_TO_LOAD_BALANCER_RULE = "LB.ASSIGN.TO.RULE";
@@ -130,6 +136,7 @@ public class EventTypes {
public static final String EVENT_REMOVE_FROM_GLOBAL_LOAD_BALANCER_RULE = "GLOBAL.LB.REMOVE";
public static final String EVENT_GLOBAL_LOAD_BALANCER_CREATE = "GLOBAL.LB.CREATE";
public static final String EVENT_GLOBAL_LOAD_BALANCER_DELETE = "GLOBAL.LB.DELETE";
+ public static final String EVENT_GLOBAL_LOAD_BALANCER_UPDATE = "GLOBAL.LB.UPDATE";
// Account events
public static final String EVENT_ACCOUNT_ENABLE = "ACCOUNT.ENABLE";
@@ -176,6 +183,9 @@ public class EventTypes {
public static final String EVENT_VOLUME_UPLOAD = "VOLUME.UPLOAD";
public static final String EVENT_VOLUME_MIGRATE = "VOLUME.MIGRATE";
public static final String EVENT_VOLUME_RESIZE = "VOLUME.RESIZE";
+ public static final String EVENT_VOLUME_DETAIL_UPDATE = "VOLUME.DETAIL.UPDATE";
+ public static final String EVENT_VOLUME_DETAIL_ADD = "VOLUME.DETAIL.ADD";
+ public static final String EVENT_VOLUME_DETAIL_REMOVE = "VOLUME.DETAIL.REMOVE";
// Domains
public static final String EVENT_DOMAIN_CREATE = "DOMAIN.CREATE";
@@ -205,6 +215,7 @@ public class EventTypes {
public static final String EVENT_SSVM_STOP = "SSVM.STOP";
public static final String EVENT_SSVM_REBOOT = "SSVM.REBOOT";
public static final String EVENT_SSVM_HA = "SSVM.HA";
+ public static final String EVENT_SSVM_SCALE = "SSVM.SCALE";
// Service Offerings
public static final String EVENT_SERVICE_OFFERING_CREATE = "SERVICE.OFFERING.CREATE";
@@ -344,6 +355,14 @@ public class EventTypes {
public static final String EVENT_VPC_DELETE = "VPC.DELETE";
public static final String EVENT_VPC_RESTART = "VPC.RESTART";
+ // Network ACL
+ public static final String EVENT_NETWORK_ACL_CREATE = "NETWORK.ACL.CREATE";
+ public static final String EVENT_NETWORK_ACL_DELETE = "NETWORK.ACL.DELETE";
+ public static final String EVENT_NETWORK_ACL_REPLACE = "NETWORK.ACL.REPLACE";
+ public static final String EVENT_NETWORK_ACL_ITEM_CREATE = "NETWORK.ACL.ITEM.CREATE";
+ public static final String EVENT_NETWORK_ACL_ITEM_UPDATE = "NETWORK.ACL.ITEM.UPDATE";
+ public static final String EVENT_NETWORK_ACL_ITEM_DELETE = "NETWORK.ACL.ITEM.DELETE";
+
// VPC offerings
public static final String EVENT_VPC_OFFERING_CREATE = "VPC.OFFERING.CREATE";
public static final String EVENT_VPC_OFFERING_UPDATE = "VPC.OFFERING.UPDATE";
@@ -361,6 +380,10 @@ public class EventTypes {
public static final String EVENT_TAGS_CREATE = "CREATE_TAGS";
public static final String EVENT_TAGS_DELETE = "DELETE_TAGS";
+ // meta data related events
+ public static final String EVENT_RESOURCE_DETAILS_CREATE = "CREATE_RESOURCE_DETAILS";
+ public static final String EVENT_RESOURCE_DETAILS_DELETE = "DELETE_RESOURCE_DETAILS";
+
// vm snapshot events
public static final String EVENT_VM_SNAPSHOT_CREATE = "VMSNAPSHOT.CREATE";
public static final String EVENT_VM_SNAPSHOT_DELETE = "VMSNAPSHOT.DELETE";
@@ -403,6 +426,7 @@ public class EventTypes {
public static final String EVENT_INTERNAL_LB_VM_START = "INTERNALLBVM.START";
public static final String EVENT_INTERNAL_LB_VM_STOP = "INTERNALLBVM.STOP";
+ public static final String EVENT_HOST_RESERVATION_RELEASE = "HOST.RESERVATION.RELEASE";
// Dedicated guest vlan range
public static final String EVENT_GUEST_VLAN_RANGE_DEDICATE = "GUESTVLANRANGE.DEDICATE";
public static final String EVENT_DEDICATED_GUEST_VLAN_RANGE_RELEASE = "GUESTVLANRANGE.RELEASE";
@@ -708,7 +732,6 @@ public class EventTypes {
entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_UPDATE, AutoScaleVmGroup.class.getName());
entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_ENABLE, AutoScaleVmGroup.class.getName());
entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_DISABLE, AutoScaleVmGroup.class.getName());
-
entityEventDetails.put(EVENT_GUEST_VLAN_RANGE_DEDICATE, GuestVlan.class.getName());
entityEventDetails.put(EVENT_DEDICATED_GUEST_VLAN_RANGE_RELEASE, GuestVlan.class.getName());
}
diff --git a/api/src/com/cloud/exception/InsufficientServerCapacityException.java b/api/src/com/cloud/exception/InsufficientServerCapacityException.java
index af34e579943..8f889fee4c5 100755
--- a/api/src/com/cloud/exception/InsufficientServerCapacityException.java
+++ b/api/src/com/cloud/exception/InsufficientServerCapacityException.java
@@ -27,6 +27,8 @@ public class InsufficientServerCapacityException extends InsufficientCapacityExc
private static final long serialVersionUID = SerialVersionUID.InsufficientServerCapacityException;
+ private boolean affinityGroupsApplied = false;
+
public InsufficientServerCapacityException(String msg, Long clusterId) {
this(msg, Cluster.class, clusterId);
}
@@ -34,4 +36,13 @@ public class InsufficientServerCapacityException extends InsufficientCapacityExc
public InsufficientServerCapacityException(String msg, Class> scope, Long id) {
super(msg, scope, id);
}
+
+ public InsufficientServerCapacityException(String msg, Class> scope, Long id, boolean affinityGroupsApplied) {
+ super(msg, scope, id);
+ this.affinityGroupsApplied = affinityGroupsApplied;
+ }
+
+ public boolean isAffinityApplied() {
+ return affinityGroupsApplied;
+ }
}
diff --git a/api/src/com/cloud/exception/MissingParameterValueException.java b/api/src/com/cloud/exception/MissingParameterValueException.java
new file mode 100644
index 00000000000..231541dcdb3
--- /dev/null
+++ b/api/src/com/cloud/exception/MissingParameterValueException.java
@@ -0,0 +1,25 @@
+// 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.exception;
+
+import com.cloud.utils.exception.CloudRuntimeException;
+public class MissingParameterValueException extends CloudRuntimeException {
+
+ public MissingParameterValueException(String message) {
+ super(message);
+ }
+}
\ No newline at end of file
diff --git a/api/src/com/cloud/host/Status.java b/api/src/com/cloud/host/Status.java
index 97b151dc723..dd49122c13b 100755
--- a/api/src/com/cloud/host/Status.java
+++ b/api/src/com/cloud/host/Status.java
@@ -147,6 +147,7 @@ public enum Status {
s_fsm.addTransition(Status.Down, Event.Remove, Status.Removed);
s_fsm.addTransition(Status.Down, Event.ManagementServerDown, Status.Down);
s_fsm.addTransition(Status.Down, Event.AgentDisconnected, Status.Down);
+ s_fsm.addTransition(Status.Down, Event.PingTimeout, Status.Down);
s_fsm.addTransition(Status.Alert, Event.AgentConnected, Status.Connecting);
s_fsm.addTransition(Status.Alert, Event.Ping, Status.Up);
s_fsm.addTransition(Status.Alert, Event.Remove, Status.Removed);
diff --git a/api/src/com/cloud/network/Network.java b/api/src/com/cloud/network/Network.java
index fa062c6a694..a06208b2565 100644
--- a/api/src/com/cloud/network/Network.java
+++ b/api/src/com/cloud/network/Network.java
@@ -322,9 +322,14 @@ public interface Network extends ControlledEntity, StateObject, I
boolean getSpecifyIpRanges();
+ boolean getDisplayNetwork();
+
/**
* @return
*/
Long getVpcId();
+ Long getNetworkACLId();
+
+ void setNetworkACLId(Long networkACLId);
}
diff --git a/api/src/com/cloud/network/NetworkProfile.java b/api/src/com/cloud/network/NetworkProfile.java
index 2f56645139c..fa63ea286aa 100644
--- a/api/src/com/cloud/network/NetworkProfile.java
+++ b/api/src/com/cloud/network/NetworkProfile.java
@@ -52,6 +52,8 @@ public class NetworkProfile implements Network {
private boolean restartRequired;
private boolean specifyIpRanges;
private Long vpcId;
+ private boolean displayNetwork;
+ private Long networkAclId;
public NetworkProfile(Network network) {
this.id = network.getId();
@@ -81,6 +83,8 @@ public class NetworkProfile implements Network {
this.restartRequired = network.isRestartRequired();
this.specifyIpRanges = network.getSpecifyIpRanges();
this.vpcId = network.getVpcId();
+ this.displayNetwork = network.getDisplayNetwork();
+ this.networkAclId = network.getNetworkACLId();
}
public String getDns1() {
@@ -231,11 +235,26 @@ public class NetworkProfile implements Network {
return false;
}
+ @Override
+ public boolean getDisplayNetwork() {
+ return displayNetwork;
+ }
+
@Override
public Long getVpcId() {
return vpcId;
}
+ @Override
+ public Long getNetworkACLId() {
+ return networkAclId;
+ }
+
+ @Override
+ public void setNetworkACLId(Long networkACLId) {
+ this.networkAclId = networkACLId;
+ }
+
@Override
public void setTrafficType(TrafficType type) {
this.trafficType = type;
diff --git a/api/src/com/cloud/network/NetworkService.java b/api/src/com/cloud/network/NetworkService.java
index 5410af0f5ec..b154b3ff911 100755
--- a/api/src/com/cloud/network/NetworkService.java
+++ b/api/src/com/cloud/network/NetworkService.java
@@ -72,7 +72,7 @@ public interface NetworkService {
IpAddress getIp(long id);
Network updateGuestNetwork(long networkId, String name, String displayText, Account callerAccount, User callerUser,
- String domainSuffix, Long networkOfferingId, Boolean changeCidr, String guestVmCidr);
+ String domainSuffix, Long networkOfferingId, Boolean changeCidr, String guestVmCidr, Boolean displayNetwork);
PhysicalNetwork createPhysicalNetwork(Long zoneId, String vnetRange, String networkSpeed,
List isolationMethods, String broadcastDomainRange, Long domainId, List tags, String name);
@@ -175,4 +175,5 @@ public interface NetworkService {
/* lists the nic informaton */
List extends Nic> listNics(ListNicsCmd listNicsCmd);
+
}
diff --git a/api/src/com/cloud/network/Networks.java b/api/src/com/cloud/network/Networks.java
index f085e9f3029..5aede053d50 100755
--- a/api/src/com/cloud/network/Networks.java
+++ b/api/src/com/cloud/network/Networks.java
@@ -63,6 +63,7 @@ public class Networks {
Storage("storage", Integer.class),
Lswitch("lswitch", String.class),
Mido("mido", String.class),
+ Pvlan("pvlan", String.class),
UnDecided(null, null);
private String scheme;
diff --git a/api/src/com/cloud/network/element/DhcpServiceProvider.java b/api/src/com/cloud/network/element/DhcpServiceProvider.java
index f42c3105a78..f824767e855 100644
--- a/api/src/com/cloud/network/element/DhcpServiceProvider.java
+++ b/api/src/com/cloud/network/element/DhcpServiceProvider.java
@@ -23,9 +23,12 @@ import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network;
import com.cloud.vm.NicProfile;
import com.cloud.vm.ReservationContext;
-import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
public interface DhcpServiceProvider extends NetworkElement {
boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
+
+ boolean configDhcpSupportForSubnet(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
+ throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
+ boolean removeDhcpSupportForSubnet(Network network);
}
diff --git a/api/src/com/cloud/network/element/NetworkACLServiceProvider.java b/api/src/com/cloud/network/element/NetworkACLServiceProvider.java
index 4073b07ba1b..dac0a25c668 100644
--- a/api/src/com/cloud/network/element/NetworkACLServiceProvider.java
+++ b/api/src/com/cloud/network/element/NetworkACLServiceProvider.java
@@ -21,6 +21,7 @@ import java.util.List;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network;
import com.cloud.network.rules.FirewallRule;
+import com.cloud.network.vpc.NetworkACLItem;
public interface NetworkACLServiceProvider extends NetworkElement{
@@ -30,6 +31,6 @@ public interface NetworkACLServiceProvider extends NetworkElement{
* @return
* @throws ResourceUnavailableException
*/
- boolean applyNetworkACLs(Network config, List extends FirewallRule> rules) throws ResourceUnavailableException;
+ boolean applyNetworkACLs(Network config, List extends NetworkACLItem> rules) throws ResourceUnavailableException;
}
diff --git a/api/src/com/cloud/network/element/VpcProvider.java b/api/src/com/cloud/network/element/VpcProvider.java
index 81b1cf321db..acdd05d063c 100644
--- a/api/src/com/cloud/network/element/VpcProvider.java
+++ b/api/src/com/cloud/network/element/VpcProvider.java
@@ -52,4 +52,6 @@ public interface VpcProvider extends NetworkElement{
boolean deletePrivateGateway(PrivateGateway privateGateway) throws ConcurrentOperationException, ResourceUnavailableException;
boolean applyStaticRoutes(Vpc vpc, List routes) throws ResourceUnavailableException;
+
+ boolean applyACLItemsToPrivateGw(PrivateGateway gateway) throws ResourceUnavailableException;
}
diff --git a/api/src/com/cloud/network/firewall/NetworkACLService.java b/api/src/com/cloud/network/firewall/NetworkACLService.java
deleted file mode 100644
index 97de496f64f..00000000000
--- a/api/src/com/cloud/network/firewall/NetworkACLService.java
+++ /dev/null
@@ -1,51 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.network.firewall;
-
-
-import java.util.List;
-
-import org.apache.cloudstack.api.command.user.network.ListNetworkACLsCmd;
-
-import com.cloud.exception.NetworkRuleConflictException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.rules.FirewallRule;
-import com.cloud.user.Account;
-import com.cloud.utils.Pair;
-
-public interface NetworkACLService {
- FirewallRule getNetworkACL(long ruleId);
- boolean applyNetworkACLs(long networkId, Account caller) throws ResourceUnavailableException;
-
- /**
- * @param createNetworkACLCmd
- * @return
- */
- FirewallRule createNetworkACL(FirewallRule acl) throws NetworkRuleConflictException;
- /**
- * @param ruleId
- * @param apply
- * @return
- */
- boolean revokeNetworkACL(long ruleId, boolean apply);
- /**
- * @param listNetworkACLsCmd
- * @return
- */
- Pair, Integer> listNetworkACLs(ListNetworkACLsCmd cmd);
-
-}
diff --git a/api/src/com/cloud/network/vpc/NetworkACL.java b/api/src/com/cloud/network/vpc/NetworkACL.java
new file mode 100644
index 00000000000..8bde7c2142f
--- /dev/null
+++ b/api/src/com/cloud/network/vpc/NetworkACL.java
@@ -0,0 +1,36 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.network.vpc;
+
+import org.apache.cloudstack.acl.ControlledEntity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+public interface NetworkACL extends InternalIdentity{
+ public static final long DEFAULT_DENY = 1;
+ public static final long DEFAULT_ALLOW = 2;
+
+ String getDescription();
+
+ String getUuid();
+
+ Long getVpcId();
+
+ long getId();
+
+ String getName();
+}
diff --git a/api/src/com/cloud/network/vpc/NetworkACLItem.java b/api/src/com/cloud/network/vpc/NetworkACLItem.java
new file mode 100644
index 00000000000..312fa7390b2
--- /dev/null
+++ b/api/src/com/cloud/network/vpc/NetworkACLItem.java
@@ -0,0 +1,80 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.network.vpc;
+
+import org.apache.cloudstack.acl.ControlledEntity;
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+import java.util.List;
+
+public interface NetworkACLItem extends InternalIdentity {
+
+ String getUuid();
+
+ Action getAction();
+
+ int getNumber();
+
+ enum State {
+ Staged, // Rule been created but has never got through network rule conflict detection. Rules in this state can not be sent to network elements.
+ Add, // Add means the rule has been created and has gone through network rule conflict detection.
+ Active, // Rule has been sent to the network elements and reported to be active.
+ Revoke // Revoke means this rule has been revoked. If this rule has been sent to the network elements, the rule will be deleted from database.
+ }
+
+ enum TrafficType {
+ Ingress,
+ Egress
+ }
+
+ enum Action {
+ Allow,
+ Deny
+ }
+
+ /**
+ * @return first port of the source port range.
+ */
+ Integer getSourcePortStart();
+
+ /**
+ * @return last port of the source prot range. If this is null, that means only one port is mapped.
+ */
+ Integer getSourcePortEnd();
+
+ /**
+ * @return protocol to open these ports for.
+ */
+ String getProtocol();
+
+ State getState();
+
+ long getAclId();
+
+ Integer getIcmpCode();
+
+ Integer getIcmpType();
+
+ List getSourceCidrList();
+
+ /**
+ * @return
+ */
+ TrafficType getTrafficType();
+
+}
diff --git a/api/src/com/cloud/network/vpc/NetworkACLService.java b/api/src/com/cloud/network/vpc/NetworkACLService.java
new file mode 100644
index 00000000000..ec53c26a4ce
--- /dev/null
+++ b/api/src/com/cloud/network/vpc/NetworkACLService.java
@@ -0,0 +1,135 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.network.vpc;
+
+
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.utils.Pair;
+import org.apache.cloudstack.api.command.user.network.CreateNetworkACLCmd;
+import org.apache.cloudstack.api.command.user.network.ListNetworkACLsCmd;
+
+import java.util.List;
+
+public interface NetworkACLService {
+ /**
+ * Creates Network ACL for the specified VPC
+ * @param name
+ * @param description
+ * @param vpcId
+ * @return
+ */
+ NetworkACL createNetworkACL(String name, String description, long vpcId);
+
+ /**
+ * Get Network ACL with specified Id
+ * @param id
+ * @return
+ */
+ NetworkACL getNetworkACL(long id);
+
+ /**
+ * List NetworkACLs by Id/Name/Network or Vpc it belongs to
+ * @param id
+ * @param name
+ * @param networkId
+ * @param vpcId
+ * @return
+ */
+ Pair,Integer> listNetworkACLs(Long id, String name, Long networkId, Long vpcId);
+
+ /**
+ * Delete specified network ACL. Deletion fails if the list is not empty
+ * @param id
+ * @return
+ */
+ boolean deleteNetworkACL(long id);
+
+ /**
+ * Associates ACL with specified Network
+ * @param aclId
+ * @param networkId
+ * @return
+ * @throws ResourceUnavailableException
+ */
+ boolean replaceNetworkACL(long aclId, long networkId) throws ResourceUnavailableException;
+
+ /**
+ * Applied ACL to associated networks
+ * @param aclId
+ * @return
+ * @throws ResourceUnavailableException
+ */
+ boolean applyNetworkACL(long aclId) throws ResourceUnavailableException;
+
+ /**
+ * Creates a Network ACL Item within an ACL and applies the ACL to associated networks
+ * @param createNetworkACLCmd
+ * @return
+ */
+ NetworkACLItem createNetworkACLItem(CreateNetworkACLCmd aclItemCmd);
+
+ /**
+ * Return ACL item with specified Id
+ * @param ruleId
+ * @return
+ */
+ NetworkACLItem getNetworkACLItem(long ruleId);
+
+ /**
+ * Lists Network ACL Items by Id, Network, ACLId, Traffic Type, protocol
+ * @param listNetworkACLsCmd
+ * @return
+ */
+ Pair, Integer> listNetworkACLItems(ListNetworkACLsCmd cmd);
+
+ /**
+ * Revoked ACL Item with specified Id
+ * @param ruleId
+ * @param apply
+ * @return
+ */
+ boolean revokeNetworkACLItem(long ruleId);
+
+ /**
+ * Updates existing aclItem applies to associated networks
+ * @param id
+ * @param protocol
+ * @param sourceCidrList
+ * @param trafficType
+ * @param action
+ * @param number
+ * @param sourcePortStart
+ * @param sourcePortEnd
+ * @param icmpCode
+ * @param icmpType
+ * @return
+ * @throws ResourceUnavailableException
+ */
+ NetworkACLItem updateNetworkACLItem(Long id, String protocol, List sourceCidrList, NetworkACLItem.TrafficType trafficType,
+ String action, Integer number, Integer sourcePortStart, Integer sourcePortEnd,
+ Integer icmpCode, Integer icmpType) throws ResourceUnavailableException;
+
+ /**
+ * Associates ACL with specified Network
+ * @param aclId
+ * @param privateGatewayId
+ * @return
+ * @throws ResourceUnavailableException
+ */
+ boolean replaceNetworkACLonPrivateGw(long aclId, long privateGatewayId) throws ResourceUnavailableException;
+
+}
diff --git a/api/src/com/cloud/network/vpc/VpcGateway.java b/api/src/com/cloud/network/vpc/VpcGateway.java
index e3530d08561..5d278e952ed 100644
--- a/api/src/com/cloud/network/vpc/VpcGateway.java
+++ b/api/src/com/cloud/network/vpc/VpcGateway.java
@@ -81,4 +81,9 @@ public interface VpcGateway extends Identity, ControlledEntity, InternalIdentity
* @return
*/
boolean getSourceNat();
+
+ /**
+ * @return
+ */
+ long getNetworkACLId();
}
diff --git a/api/src/com/cloud/network/vpc/VpcService.java b/api/src/com/cloud/network/vpc/VpcService.java
index 23e276489c2..7a444c07b85 100644
--- a/api/src/com/cloud/network/vpc/VpcService.java
+++ b/api/src/com/cloud/network/vpc/VpcService.java
@@ -172,13 +172,14 @@ public interface VpcService {
* @param netmask
* @param gatewayOwnerId
* @param isSourceNat
+ * @param aclId
* @return
* @throws InsufficientCapacityException
* @throws ConcurrentOperationException
* @throws ResourceAllocationException
*/
public PrivateGateway createVpcPrivateGateway(long vpcId, Long physicalNetworkId, String vlan, String ipAddress,
- String gateway, String netmask, long gatewayOwnerId, Boolean isSourceNat) throws ResourceAllocationException,
+ String gateway, String netmask, long gatewayOwnerId, Boolean isSoruceNat, Long aclId) throws ResourceAllocationException,
ConcurrentOperationException, InsufficientCapacityException;
/**
diff --git a/api/src/com/cloud/offering/ServiceOffering.java b/api/src/com/cloud/offering/ServiceOffering.java
index 165369c5e9b..45d5f38952b 100755
--- a/api/src/com/cloud/offering/ServiceOffering.java
+++ b/api/src/com/cloud/offering/ServiceOffering.java
@@ -108,4 +108,6 @@ public interface ServiceOffering extends InfrastructureEntity, InternalIdentity,
boolean getDefaultUse();
String getSystemVmType();
+
+ String getDeploymentPlanner();
}
diff --git a/api/src/com/cloud/resource/ResourceService.java b/api/src/com/cloud/resource/ResourceService.java
index 08e2585d1a7..ce0df635bfe 100755
--- a/api/src/com/cloud/resource/ResourceService.java
+++ b/api/src/com/cloud/resource/ResourceService.java
@@ -100,11 +100,13 @@ public interface ResourceService {
Swift discoverSwift(AddSwiftCmd addSwiftCmd) throws DiscoveryException;
S3 discoverS3(AddS3Cmd cmd) throws DiscoveryException;
-
+
List getSupportedHypervisorTypes(long zoneId, boolean forVirtualRouter, Long podId);
Pair, Integer> listSwifts(ListSwiftsCmd cmd);
List extends S3> listS3s(ListS3sCmd cmd);
+ boolean releaseHostReservation(Long hostId);
+
}
diff --git a/api/src/com/cloud/server/ManagementService.java b/api/src/com/cloud/server/ManagementService.java
index 22494072648..24d33d5a3f8 100755
--- a/api/src/com/cloud/server/ManagementService.java
+++ b/api/src/com/cloud/server/ManagementService.java
@@ -22,6 +22,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import com.cloud.exception.*;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.command.admin.cluster.ListClustersCmd;
import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd;
@@ -34,11 +35,7 @@ import org.apache.cloudstack.api.command.admin.resource.DeleteAlertsCmd;
import org.apache.cloudstack.api.command.admin.resource.ListAlertsCmd;
import org.apache.cloudstack.api.command.admin.resource.ListCapacityCmd;
import org.apache.cloudstack.api.command.admin.resource.UploadCustomCertificateCmd;
-import org.apache.cloudstack.api.command.admin.systemvm.DestroySystemVmCmd;
-import org.apache.cloudstack.api.command.admin.systemvm.ListSystemVMsCmd;
-import org.apache.cloudstack.api.command.admin.systemvm.RebootSystemVmCmd;
-import org.apache.cloudstack.api.command.admin.systemvm.StopSystemVmCmd;
-import org.apache.cloudstack.api.command.admin.systemvm.UpgradeSystemVMCmd;
+import org.apache.cloudstack.api.command.admin.systemvm.*;
import org.apache.cloudstack.api.command.admin.vlan.ListVlanIpRangesCmd;
import org.apache.cloudstack.api.command.user.address.ListPublicIpAddressesCmd;
import org.apache.cloudstack.api.command.user.config.ListCapabilitiesCmd;
@@ -64,10 +61,6 @@ import com.cloud.configuration.Configuration;
import com.cloud.dc.Pod;
import com.cloud.dc.Vlan;
import com.cloud.domain.Domain;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InternalErrorException;
-import com.cloud.exception.PermissionDeniedException;
-import com.cloud.exception.ResourceUnavailableException;
import com.cloud.host.Host;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.hypervisor.HypervisorCapabilities;
@@ -419,5 +412,8 @@ public interface ManagementService {
* @return List of capacities
*/
List extends Capacity> listTopConsumedResources(ListCapacityCmd cmd);
+
+ List listDeploymentPlanners();
+ VirtualMachine upgradeSystemVM(ScaleSystemVMCmd cmd) throws ResourceUnavailableException, ManagementServerException, VirtualMachineMigrationException, ConcurrentOperationException;
}
diff --git a/api/src/com/cloud/server/ResourceMetaDataService.java b/api/src/com/cloud/server/ResourceMetaDataService.java
new file mode 100644
index 00000000000..556f97453a1
--- /dev/null
+++ b/api/src/com/cloud/server/ResourceMetaDataService.java
@@ -0,0 +1,47 @@
+// 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.server;
+
+package com.cloud.server;
+import java.util.List;
+import java.util.Map;
+
+import com.cloud.server.ResourceTag.TaggedResourceType;
+
+public interface ResourceMetaDataService {
+
+ TaggedResourceType getResourceType (String resourceTypeStr);
+
+ /**
+ * @param resourceId TODO
+ * @param resourceType
+ * @param details
+ * @return
+ */
+ boolean addResourceMetaData(String resourceId, TaggedResourceType resourceType, Map details);
+
+
+ /**
+ *
+ * @param resourceId
+ * @param resourceType
+ * @param key
+ * @return
+ */
+ public boolean deleteResourceMetaData(String resourceId, TaggedResourceType resourceType, String key);
+
+
+ }
diff --git a/api/src/com/cloud/server/ResourceTag.java b/api/src/com/cloud/server/ResourceTag.java
index 9006e305d81..f1d31e4e0d0 100644
--- a/api/src/com/cloud/server/ResourceTag.java
+++ b/api/src/com/cloud/server/ResourceTag.java
@@ -29,6 +29,7 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit
Volume,
Snapshot,
Network,
+ Nic,
LoadBalancer,
PortForwardingRule,
FirewallRule,
diff --git a/api/src/com/cloud/server/TaggedResourceService.java b/api/src/com/cloud/server/TaggedResourceService.java
index 92a4300db0a..46b185480bb 100644
--- a/api/src/com/cloud/server/TaggedResourceService.java
+++ b/api/src/com/cloud/server/TaggedResourceService.java
@@ -51,4 +51,7 @@ public interface TaggedResourceService {
boolean deleteTags(List resourceIds, TaggedResourceType resourceType, Map tags);
List extends ResourceTag> listByResourceTypeAndId(TaggedResourceType type, long resourceId);
-}
+
+ public Long getResourceId(String resourceId, TaggedResourceType resourceType);
+
+ }
diff --git a/api/src/com/cloud/storage/VolumeApiService.java b/api/src/com/cloud/storage/VolumeApiService.java
index 09a07d4be13..7e5ebe21200 100644
--- a/api/src/com/cloud/storage/VolumeApiService.java
+++ b/api/src/com/cloud/storage/VolumeApiService.java
@@ -18,12 +18,7 @@
*/
package com.cloud.storage;
-import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
-import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd;
-import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd;
-import org.apache.cloudstack.api.command.user.volume.MigrateVolumeCmd;
-import org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd;
-import org.apache.cloudstack.api.command.user.volume.UploadVolumeCmd;
+import org.apache.cloudstack.api.command.user.volume.*;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.PermissionDeniedException;
@@ -79,4 +74,6 @@ public interface VolumeApiService {
Volume attachVolumeToVM(AttachVolumeCmd command);
Volume detachVolumeFromVM(DetachVolumeCmd cmmd);
+
+ Volume updateVolume(UpdateVolumeCmd updateVolumeCmd);
}
diff --git a/api/src/com/cloud/vm/NicIpAlias.java b/api/src/com/cloud/vm/NicIpAlias.java
new file mode 100644
index 00000000000..11e127ca856
--- /dev/null
+++ b/api/src/com/cloud/vm/NicIpAlias.java
@@ -0,0 +1,45 @@
+// 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.vm;
+
+import org.apache.cloudstack.acl.ControlledEntity;
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+/** Each entry represents the alis ip of a perticular nic.
+ *
+ */
+public interface NicIpAlias extends ControlledEntity, Identity, InternalIdentity{
+ /**
+ * @return id in the CloudStack database
+ */
+ enum state {
+ active,
+ revoked,
+ }
+ long getId();
+ long getNicId();
+ String getIp4Address();
+ String getIp6Address();
+ long getNetworkId();
+ long getVmId();
+ Long getAliasCount();
+ String getNetmask();
+ String getGateway();
+
+
+}
diff --git a/api/src/com/cloud/vm/UserVmService.java b/api/src/com/cloud/vm/UserVmService.java
index b840e5e4b58..e5ec9d3e314 100755
--- a/api/src/com/cloud/vm/UserVmService.java
+++ b/api/src/com/cloud/vm/UserVmService.java
@@ -178,7 +178,10 @@ public interface UserVmService {
* TODO
* @param defaultIp
* TODO
+ * @param displayVm
+ * - Boolean flag whether to the display the vm to the end user or not
* @param affinityGroupIdList
+ *
* @param accountName
* - an optional account for the virtual machine. Must be used
* with domainId
@@ -200,7 +203,7 @@ public interface UserVmService {
UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List securityGroupIdList, Account owner, String hostName,
String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
HTTPMethod httpmethod, String userData, String sshKeyPair, Map requestedIps,
- IpAddresses defaultIp, String keyboard, List affinityGroupIdList)
+ IpAddresses defaultIp, Boolean displayVm, String keyboard, List affinityGroupIdList)
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
/**
@@ -251,7 +254,10 @@ public interface UserVmService {
* TODO
* @param defaultIps
* TODO
+ * @param displayVm
+ * - Boolean flag whether to the display the vm to the end user or not
* @param affinityGroupIdList
+ *
* @param accountName
* - an optional account for the virtual machine. Must be used
* with domainId
@@ -272,7 +278,7 @@ public interface UserVmService {
*/
UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List networkIdList, List securityGroupIdList,
Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData, String sshKeyPair,
- Map requestedIps, IpAddresses defaultIps, String keyboard, List affinityGroupIdList)
+ Map requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard, List affinityGroupIdList)
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
/**
@@ -320,7 +326,10 @@ public interface UserVmService {
* TODO
* @param defaultIps
* TODO
+ * @param displayVm
+ * - Boolean flag whether to the display the vm to the end user or not
* @param affinityGroupIdList
+ *
* @param accountName
* - an optional account for the virtual machine. Must be used
* with domainId
@@ -342,7 +351,8 @@ public interface UserVmService {
UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List networkIdList, Account owner, String hostName,
String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
HTTPMethod httpmethod, String userData, String sshKeyPair, Map requestedIps,
- IpAddresses defaultIps, String keyboard, List affinityGroupIdList)
+ IpAddresses defaultIps, Boolean displayVm, String keyboard, List affinityGroupIdList)
+
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
/**
@@ -452,6 +462,6 @@ public interface UserVmService {
UserVm restoreVM(RestoreVMCmd cmd) throws InsufficientCapacityException, ResourceUnavailableException;
- boolean upgradeVirtualMachine(ScaleVMCmd scaleVMCmd) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException;
+ UserVm upgradeVirtualMachine(ScaleVMCmd cmd) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException;
}
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
index c76506afc10..cf093bf4c7c 100755
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -56,7 +56,12 @@ public class ApiConstants {
public static final String DISK_OFFERING_ID = "diskofferingid";
public static final String DISK_SIZE = "disksize";
public static final String DISPLAY_NAME = "displayname";
+ public static final String DISPLAY_NETWORK = "displaynetwork";
+ public static final String DISPLAY_NIC = "displaynic";
public static final String DISPLAY_TEXT = "displaytext";
+ public static final String DISPLAY_VM = "displayvm";
+ public static final String DISPLAY_OFFERING = "displayoffering";
+ public static final String DISPLAY_VOLUME = "displayvolume";
public static final String DNS1 = "dns1";
public static final String DNS2 = "dns2";
public static final String IP6_DNS1 = "ip6dns1";
@@ -225,6 +230,7 @@ public class ApiConstants {
public static final String VLAN_RANGE = "vlanrange";
public static final String REMOVE_VLAN="removevlan";
public static final String VLAN_ID = "vlanid";
+ public static final String ISOLATED_PVLAN = "isolatedpvlan";
public static final String VM_AVAILABLE = "vmavailable";
public static final String VM_LIMIT = "vmlimit";
public static final String VM_TOTAL = "vmtotal";
@@ -306,6 +312,7 @@ public class ApiConstants {
public static final String ACCEPT = "accept";
public static final String SORT_KEY = "sortkey";
public static final String ACCOUNT_DETAILS = "accountdetails";
+ public static final String SERVICE_OFFERING_DETAILS = "serviceofferingdetails";
public static final String SERVICE_PROVIDER_LIST = "serviceproviderlist";
public static final String SERVICE_CAPABILITY_LIST = "servicecapabilitylist";
public static final String CAN_CHOOSE_SERVICE_CAPABILITY = "canchooseservicecapability";
@@ -490,6 +497,9 @@ public class ApiConstants {
public static final String AFFINITY_GROUP_NAMES = "affinitygroupnames";
public static final String ASA_INSIDE_PORT_PROFILE = "insideportprofile";
public static final String AFFINITY_GROUP_ID = "affinitygroupid";
+ public static final String DEPLOYMENT_PLANNER = "deploymentplanner";
+ public static final String ACL_ID = "aclid";
+ public static final String NUMBER = "number";
public enum HostDetails {
all, capacity, events, stats, min;
diff --git a/api/src/org/apache/cloudstack/api/BaseAsyncCreateCmd.java b/api/src/org/apache/cloudstack/api/BaseAsyncCreateCmd.java
index 55d73b4a687..60c2a183ad3 100644
--- a/api/src/org/apache/cloudstack/api/BaseAsyncCreateCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseAsyncCreateCmd.java
@@ -19,7 +19,6 @@ package org.apache.cloudstack.api;
import com.cloud.exception.ResourceAllocationException;
public abstract class BaseAsyncCreateCmd extends BaseAsyncCmd {
- @Parameter(name = "id", type = CommandType.LONG)
private Long id;
private String uuid;
diff --git a/api/src/org/apache/cloudstack/api/BaseCmd.java b/api/src/org/apache/cloudstack/api/BaseCmd.java
index 17a1ec5fe31..de76b7ab6d6 100644
--- a/api/src/org/apache/cloudstack/api/BaseCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseCmd.java
@@ -30,6 +30,7 @@ import javax.inject.Inject;
import org.apache.log4j.Logger;
import org.apache.cloudstack.affinity.AffinityGroupService;
+import com.cloud.server.ResourceMetaDataService;
import org.apache.cloudstack.network.element.InternalLoadBalancerElementService;
import org.apache.cloudstack.network.lb.ApplicationLoadBalancerService;
import org.apache.cloudstack.network.lb.InternalLoadBalancerVMService;
@@ -53,7 +54,7 @@ import com.cloud.network.StorageNetworkService;
import com.cloud.network.VpcVirtualNetworkApplianceService;
import com.cloud.network.as.AutoScaleService;
import com.cloud.network.firewall.FirewallService;
-import com.cloud.network.firewall.NetworkACLService;
+import com.cloud.network.vpc.NetworkACLService;
import com.cloud.network.lb.LoadBalancingRulesService;
import com.cloud.network.rules.RulesService;
import com.cloud.network.security.SecurityGroupService;
@@ -133,6 +134,7 @@ public abstract class BaseCmd {
@Inject public IdentityService _identityService;
@Inject public StorageNetworkService _storageNetworkService;
@Inject public TaggedResourceService _taggedResourceService;
+ @Inject public ResourceMetaDataService _resourceMetaDataService;
@Inject public VpcService _vpcService;
@Inject public NetworkACLService _networkACLService;
@Inject public Site2SiteVpnService _s2sVpnService;
diff --git a/api/src/org/apache/cloudstack/api/ResponseGenerator.java b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
index 33b445800b7..2c2ce0b97f6 100644
--- a/api/src/org/apache/cloudstack/api/ResponseGenerator.java
+++ b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
@@ -21,8 +21,15 @@ import java.util.EnumSet;
import java.util.List;
import java.util.Map;
+import com.cloud.vm.NicSecondaryIp;
import org.apache.cloudstack.affinity.AffinityGroup;
import org.apache.cloudstack.affinity.AffinityGroupResponse;
+import com.cloud.network.vpc.NetworkACL;
+import com.cloud.network.vpc.NetworkACLItem;
+import com.cloud.network.vpc.PrivateGateway;
+import com.cloud.network.vpc.StaticRoute;
+import com.cloud.network.vpc.Vpc;
+import com.cloud.network.vpc.VpcOffering;
import org.apache.cloudstack.api.ApiConstants.HostDetails;
import org.apache.cloudstack.api.ApiConstants.VMDetails;
import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd;
@@ -108,6 +115,7 @@ import org.apache.cloudstack.api.response.VpcOfferingResponse;
import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.cloudstack.api.response.VpnUsersResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.cloudstack.api.response.*;
import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
import org.apache.cloudstack.region.Region;
import org.apache.cloudstack.usage.Usage;
@@ -152,10 +160,6 @@ import com.cloud.network.rules.StaticNatRule;
import com.cloud.network.rules.StickinessPolicy;
import com.cloud.network.security.SecurityGroup;
import com.cloud.network.security.SecurityRule;
-import com.cloud.network.vpc.PrivateGateway;
-import com.cloud.network.vpc.StaticRoute;
-import com.cloud.network.vpc.Vpc;
-import com.cloud.network.vpc.VpcOffering;
import com.cloud.offering.DiskOffering;
import com.cloud.offering.NetworkOffering;
import com.cloud.offering.ServiceOffering;
@@ -375,11 +379,17 @@ public interface ResponseGenerator {
*/
VpcResponse createVpcResponse(Vpc vpc);
+ /**
+ * @param networkACLItem
+ * @return
+ */
+ NetworkACLItemResponse createNetworkACLItemResponse(NetworkACLItem networkACLItem);
+
/**
* @param networkACL
* @return
*/
- NetworkACLResponse createNetworkACLResponse(FirewallRule networkACL);
+ NetworkACLResponse createNetworkACLResponse(NetworkACL networkACL);
/**
* @param result
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
index 6252f6bee45..665c3aa4d5f 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
@@ -84,10 +84,10 @@ public class AddClusterCmd extends BaseCmd {
private String vsmipaddress;
@Parameter (name=ApiConstants.CPU_OVERCOMMIT_RATIO, type = CommandType.STRING, required = false , description = "value of the cpu overcommit ratio, defaults to 1")
- private String cpuovercommitRatio;
+ private String cpuOvercommitRatio;
- @Parameter(name = ApiConstants.MEMORY_OVERCOMMIT_RATIO, type = CommandType.STRING, required = false ,description = "value of the default ram overcommit ratio, defaults to 1")
- private String memoryovercommitratio;
+ @Parameter(name = ApiConstants.MEMORY_OVERCOMMIT_RATIO, type = CommandType.STRING, required = false, description = "value of the default memory overcommit ratio, defaults to 1")
+ private String memoryOvercommitRatio;
@Parameter(name = ApiConstants.VSWITCH_TYPE_GUEST_TRAFFIC, type = CommandType.STRING, required = false, description = "Type of virtual switch used for guest traffic in the cluster. Allowed values are, vmwaresvs (for VMware standard vSwitch) and vmwaredvs (for VMware distributed vSwitch)")
private String vSwitchTypeGuestTraffic;
@@ -167,7 +167,7 @@ public class AddClusterCmd extends BaseCmd {
}
public void setClusterType(String type) {
- this.clusterType = type;
+ clusterType = type;
}
@Override
@@ -184,15 +184,15 @@ public class AddClusterCmd extends BaseCmd {
}
public Float getCpuOvercommitRatio (){
- if(cpuovercommitRatio != null){
- return Float.parseFloat(cpuovercommitRatio);
+ if(cpuOvercommitRatio != null){
+ return Float.parseFloat(cpuOvercommitRatio);
}
return 1.0f;
}
- public Float getMemoryOvercommitRaito (){
- if (memoryovercommitratio != null){
- return Float.parseFloat(memoryovercommitratio);
+ public Float getMemoryOvercommitRatio(){
+ if (memoryOvercommitRatio != null){
+ return Float.parseFloat(memoryOvercommitRatio);
}
return 1.0f;
}
@@ -200,8 +200,8 @@ public class AddClusterCmd extends BaseCmd {
@Override
public void execute(){
try {
- if ((getMemoryOvercommitRaito().compareTo(1f) < 0) | (getCpuOvercommitRatio().compareTo(1f) < 0)) {
- throw new InvalidParameterValueException("Cpu and ram overcommit ratios should not be less than 1");
+ if (getMemoryOvercommitRatio().compareTo(1f) < 0 || getCpuOvercommitRatio().compareTo(1f) < 0) {
+ throw new InvalidParameterValueException("cpu and memory overcommit ratios should be greater than or equal to one");
}
List extends Cluster> result = _resourceService.discoverCluster(this);
ListResponse response = new ListResponse();
@@ -218,7 +218,7 @@ public class AddClusterCmd extends BaseCmd {
response.setResponses(clusterResponses);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} catch (DiscoveryException ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
index 8d49a8ce875..880777f47f2 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
@@ -58,7 +58,7 @@ public class UpdateClusterCmd extends BaseCmd {
@Parameter(name=ApiConstants.CPU_OVERCOMMIT_RATIO, type = CommandType.STRING, description = "Value of cpu overcommit ratio")
private String cpuovercommitratio;
- @Parameter(name=ApiConstants.MEMORY_OVERCOMMIT_RATIO, type = CommandType.STRING, description = "Value of ram overcommit ratio")
+ @Parameter(name=ApiConstants.MEMORY_OVERCOMMIT_RATIO, type = CommandType.STRING, description = "Value of memory overcommit ratio")
private String memoryovercommitratio;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/ListDeploymentPlannersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/ListDeploymentPlannersCmd.java
new file mode 100644
index 00000000000..598b620c301
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/config/ListDeploymentPlannersCmd.java
@@ -0,0 +1,71 @@
+// 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.admin.config;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.response.DeploymentPlannersResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.log4j.Logger;
+
+@APICommand(name = "listDeploymentPlanners", description = "Lists all DeploymentPlanners available.", responseObject = DeploymentPlannersResponse.class)
+public class ListDeploymentPlannersCmd extends BaseListCmd {
+ public static final Logger s_logger = Logger.getLogger(ListDeploymentPlannersCmd.class.getName());
+
+ private static final String s_name = "listdeploymentplannersresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public void execute(){
+ List planners = _mgr.listDeploymentPlanners();
+ ListResponse response = new ListResponse();
+ List plannerResponses = new ArrayList();
+
+ for (String planner : planners) {
+ DeploymentPlannersResponse plannerResponse = new DeploymentPlannersResponse();
+ plannerResponse.setName(planner);
+ plannerResponse.setObjectName("deploymentPlanner");
+ plannerResponses.add(plannerResponse);
+ }
+
+ response.setResponses(plannerResponses);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java
index a4ac01d8a49..7822f4a363b 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java
@@ -46,7 +46,7 @@ public class FindHostsForMigrationCmd extends BaseListCmd {
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = UserVmResponse.class,
- required=false, description="find hosts to which this VM can be migrated and flag the hosts with enough " +
+ required=true, description="find hosts to which this VM can be migrated and flag the hosts with enough " +
"CPU/RAM to host the VM")
private Long virtualMachineId;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/ReleaseHostReservationCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/ReleaseHostReservationCmd.java
new file mode 100644
index 00000000000..5ace7661330
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/ReleaseHostReservationCmd.java
@@ -0,0 +1,106 @@
+// 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.admin.host;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiCommandJobType;
+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.HostResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+
+@APICommand(name = "releaseHostReservation", description = "Releases host reservation.", responseObject = SuccessResponse.class)
+public class ReleaseHostReservationCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(ReleaseHostReservationCmd.class.getName());
+
+ private static final String s_name = "releasehostreservationresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=HostResponse.class,
+ required=true, description="the host ID")
+ private Long id;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ Account account = UserContext.current().getCaller();
+ if (account != null) {
+ return account.getId();
+ }
+
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_HOST_RESERVATION_RELEASE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "releasing reservation for host: " + getId();
+ }
+
+ @Override
+ public ApiCommandJobType getInstanceType() {
+ return ApiCommandJobType.Host;
+ }
+
+ @Override
+ public Long getInstanceId() {
+ return getId();
+ }
+
+ @Override
+ public void execute(){
+ boolean result = _resourceService.releaseHostReservation(getId());
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to release host reservation");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkIsolationMethodsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkIsolationMethodsCmd.java
index 7eef22a78b4..0d23fd67557 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkIsolationMethodsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkIsolationMethodsCmd.java
@@ -44,7 +44,7 @@ public class ListNetworkIsolationMethodsCmd extends BaseListCmd{
isolationResponses.add(isolationMethod);
}
}
- response.setResponses(isolationResponses, methods.length);
+ response.setResponses(isolationResponses, isolationResponses.size());
response.setResponseName(getCommandName());
this.setResponseObject(response);
diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java
index e7ab6bdcd9e..1e178f1869f 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java
@@ -63,7 +63,10 @@ public class CreateDiskOfferingCmd extends BaseCmd {
@Parameter(name=ApiConstants.STORAGE_TYPE, type=CommandType.STRING, description="the storage type of the disk offering. Values are local and shared.")
private String storageType = ServiceOffering.StorageType.shared.toString();
- /////////////////////////////////////////////////////
+ @Parameter(name=ApiConstants.DISPLAY_OFFERING, type=CommandType.BOOLEAN, description="an optional field, whether to display the offering to the end user or not.")
+ private Boolean displayOffering;
+
+/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -95,6 +98,10 @@ public class CreateDiskOfferingCmd extends BaseCmd {
return storageType;
}
+ public Boolean getDisplayOffering() {
+ return displayOffering;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java
index 8f822921a9e..fcbfa4adabc 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java
@@ -16,6 +16,9 @@
// under the License.
package org.apache.cloudstack.api.command.admin.offering;
+import java.util.Collection;
+import java.util.Map;
+
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
@@ -85,6 +88,12 @@ public class CreateServiceOfferingCmd extends BaseCmd {
@Parameter(name=ApiConstants.NETWORKRATE, type=CommandType.INTEGER, description="data transfer rate in megabits per second allowed. Supported only for non-System offering and system offerings having \"domainrouter\" systemvmtype")
private Integer networkRate;
+ @Parameter(name = ApiConstants.DEPLOYMENT_PLANNER, type = CommandType.STRING, description = "The deployment planner heuristics used to deploy a VM of this offering. If null, value of global config vm.deployment.planner is used")
+ private String deploymentPlanner;
+
+ @Parameter(name = ApiConstants.SERVICE_OFFERING_DETAILS, type = CommandType.MAP, description = "details for planner, used to store specific parameters")
+ private Map details;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -149,6 +158,19 @@ public class CreateServiceOfferingCmd extends BaseCmd {
return networkRate;
}
+ public String getDeploymentPlanner() {
+ return deploymentPlanner;
+ }
+
+ public Map getDetails() {
+ if (details == null || details.isEmpty()) {
+ return null;
+ }
+
+ Collection paramsCollection = details.values();
+ Map params = (Map)(paramsCollection.toArray())[0];
+ return params;
+ }
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
@@ -170,7 +192,7 @@ public class CreateServiceOfferingCmd extends BaseCmd {
if (result != null) {
ServiceOfferingResponse response = _responseGenerator.createServiceOfferingResponse(result);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create service offering");
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java
new file mode 100644
index 00000000000..a077e246a46
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java
@@ -0,0 +1,131 @@
+// 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.admin.systemvm;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.*;
+import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.command.user.vm.UpgradeVMCmd;
+import org.apache.cloudstack.api.response.ServiceOfferingResponse;
+import org.apache.cloudstack.api.response.SystemVmResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.offering.ServiceOffering;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "scaleSystemVm", responseObject=SystemVmResponse.class, description="Scale the service offering for a system vm (console proxy or secondary storage). " +
+ "The system vm must be in a \"Stopped\" state for " +
+ "this command to take effect.")
+public class ScaleSystemVMCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(UpgradeVMCmd.class.getName());
+ private static final String s_name = "changeserviceforsystemvmresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=SystemVmResponse.class,
+ required=true, description="The ID of the system vm")
+ private Long id;
+
+ @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.UUID, entityType=ServiceOfferingResponse.class,
+ required=true, description="the service offering ID to apply to the system vm")
+ private Long serviceOfferingId;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ public Long getServiceOfferingId() {
+ return serviceOfferingId;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ Account account = UserContext.current().getCaller();
+ if (account != null) {
+ return account.getId();
+ }
+
+ return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+ }
+
+ @Override
+ public void execute(){
+ UserContext.current().setEventDetails("SystemVm Id: "+getId());
+
+ ServiceOffering serviceOffering = _configService.getServiceOffering(serviceOfferingId);
+ if (serviceOffering == null) {
+ throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId);
+ }
+
+ VirtualMachine result = null;
+ try {
+ result = _mgr.upgradeSystemVM(this);
+ } catch (ResourceUnavailableException ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+ } catch (ConcurrentOperationException ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
+ } catch (ManagementServerException ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
+ } catch (VirtualMachineMigrationException ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
+ }
+ if (result != null) {
+ SystemVmResponse response = _responseGenerator.createSystemVmResponse(result);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to scale system vm");
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ VirtualMachine.Type type = _mgr.findSystemVMTypeById(getId());
+ if(type == VirtualMachine.Type.ConsoleProxy){
+ return EventTypes.EVENT_PROXY_SCALE;
+ }
+ else{
+ return EventTypes.EVENT_SSVM_SCALE;
+ }
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "scaling system vm: " + getId() + " to service offering: " + getServiceOfferingId();
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java
index 9cb8f185a1f..b1a3f528d51 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java
@@ -26,6 +26,7 @@ import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.NetworkACLResponse;
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
import org.apache.cloudstack.api.response.PrivateGatewayResponse;
import org.apache.cloudstack.api.response.VpcResponse;
@@ -75,6 +76,11 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd {
" 'false': sourcenat is not supported")
private Boolean isSourceNat;
+ @Parameter(name=ApiConstants.ACL_ID, type=CommandType.UUID, entityType = NetworkACLResponse.class,
+ required=false, description="the ID of the network ACL")
+ private Long aclId;
+
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -107,9 +113,14 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd {
if (isSourceNat == null) {
return false;
}
- return true;
+ return isSourceNat;
}
+ public Long getAclId() {
+ return aclId;
+ }
+
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -124,7 +135,7 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd {
PrivateGateway result = null;
try {
result = _vpcService.createVpcPrivateGateway(getVpcId(), getPhysicalNetworkId(),
- getVlan(), getStartIp(), getGateway(), getNetmask(), getEntityOwnerId(), getIsSourceNat());
+ getVlan(), getStartIp(), getGateway(), getNetmask(), getEntityOwnerId(), getIsSourceNat(), getAclId());
} catch (InsufficientCapacityException ex){
s_logger.info(ex);
s_logger.trace(ex);
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java
index 289b2b92823..18e6743099f 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java
@@ -22,30 +22,26 @@ import java.util.List;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.NetworkACLItemResponse;
import org.apache.cloudstack.api.response.NetworkACLResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.Network;
-import com.cloud.network.rules.FirewallRule;
-import com.cloud.network.vpc.Vpc;
+import com.cloud.network.vpc.NetworkACLItem;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
import com.cloud.utils.net.NetUtils;
-@APICommand(name = "createNetworkACL", description = "Creates a ACL rule the given network (the network has to belong to VPC)",
-responseObject = NetworkACLResponse.class)
-public class CreateNetworkACLCmd extends BaseAsyncCreateCmd implements FirewallRule {
+@APICommand(name = "createNetworkACL", description = "Creates a ACL rule in the given network (the network has to belong to VPC)",
+responseObject = NetworkACLItemResponse.class)
+public class CreateNetworkACLCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreateNetworkACLCmd.class.getName());
private static final String s_name = "createnetworkaclresponse";
@@ -55,7 +51,7 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd implements FirewallR
// ///////////////////////////////////////////////////
@Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, required = true, description =
- "the protocol for the ACL rule. Valid values are TCP/UDP/ICMP.")
+ "the protocol for the ACL rule. Valid values are TCP/UDP/ICMP/ALL or valid protocol number")
private String protocol;
@Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "the starting port of ACL")
@@ -75,23 +71,27 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd implements FirewallR
private Integer icmpCode;
@Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType = NetworkResponse.class,
- required=true,
description="The network of the vm the ACL will be created for")
private Long networkId;
+ @Parameter(name=ApiConstants.ACL_ID, type=CommandType.UUID, entityType = NetworkACLResponse.class,
+ description="The network of the vm the ACL will be created for")
+ private Long aclId;
+
@Parameter(name=ApiConstants.TRAFFIC_TYPE, type=CommandType.STRING, description="the traffic type for the ACL," +
"can be Ingress or Egress, defaulted to Ingress if not specified")
private String trafficType;
+ @Parameter(name=ApiConstants.NUMBER, type=CommandType.INTEGER, description="The network of the vm the ACL will be created for")
+ private Integer number;
+
+ @Parameter(name=ApiConstants.ACTION, type=CommandType.STRING, description="scl entry action, allow or deny")
+ private String action;
+
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
- public Long getIpAddressId() {
- return null;
- }
-
- @Override
public String getProtocol() {
return protocol.trim();
}
@@ -106,26 +106,11 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd implements FirewallR
}
}
- public long getVpcId() {
- Network network = _networkService.getNetwork(getNetworkId());
- if (network == null) {
- throw new InvalidParameterValueException("Invalid networkId is given");
- }
-
- Long vpcId = network.getVpcId();
- if (vpcId == null) {
- throw new InvalidParameterValueException("Can create network ACL only for the network belonging to the VPC");
- }
-
- return vpcId;
- }
-
- @Override
- public FirewallRule.TrafficType getTrafficType() {
+ public NetworkACLItem.TrafficType getTrafficType() {
if (trafficType == null) {
- return FirewallRule.TrafficType.Ingress;
+ return NetworkACLItem.TrafficType.Ingress;
}
- for (FirewallRule.TrafficType type : FirewallRule.TrafficType.values()) {
+ for (NetworkACLItem.TrafficType type : NetworkACLItem.TrafficType.values()) {
if (type.toString().equalsIgnoreCase(trafficType)) {
return type;
}
@@ -142,192 +127,103 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd implements FirewallR
return s_name;
}
- public void setSourceCidrList(List cidrs){
- cidrlist = cidrs;
+ public String getAction() {
+ return action;
}
- @Override
- public void execute() throws ResourceUnavailableException {
- UserContext callerContext = UserContext.current();
- boolean success = false;
- FirewallRule rule = _networkACLService.getNetworkACL(getEntityId());
- try {
- UserContext.current().setEventDetails("Rule Id: " + getEntityId());
- success = _networkACLService.applyNetworkACLs(rule.getNetworkId(), callerContext.getCaller());
-
- // State is different after the rule is applied, so get new object here
- NetworkACLResponse aclResponse = new NetworkACLResponse();
- if (rule != null) {
- aclResponse = _responseGenerator.createNetworkACLResponse(rule);
- setResponseObject(aclResponse);
- }
- aclResponse.setResponseName(getCommandName());
- } finally {
- if (!success || rule == null) {
- _networkACLService.revokeNetworkACL(getEntityId(), true);
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create network ACL");
- }
- }
+ public Integer getNumber() {
+ return number;
}
- @Override
- public long getId() {
- throw new UnsupportedOperationException("database id can only provided by VO objects");
- }
-
- @Override
- public String getXid() {
- // FIXME: We should allow for end user to specify Xid.
- return null;
- }
-
-
- @Override
- public String getUuid() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Long getSourceIpAddressId() {
- return null;
- }
-
- @Override
public Integer getSourcePortStart() {
- if (publicStartPort != null) {
- return publicStartPort.intValue();
- }
- return null;
+ return publicStartPort;
}
- @Override
public Integer getSourcePortEnd() {
if (publicEndPort == null) {
if (publicStartPort != null) {
- return publicStartPort.intValue();
+ return publicStartPort;
}
} else {
- return publicEndPort.intValue();
+ return publicEndPort;
}
return null;
}
- @Override
- public Purpose getPurpose() {
- return Purpose.Firewall;
- }
-
- @Override
- public State getState() {
- throw new UnsupportedOperationException("Should never call me to find the state");
- }
-
- @Override
- public long getNetworkId() {
+ public Long getNetworkId() {
return networkId;
}
@Override
public long getEntityOwnerId() {
- Vpc vpc = _vpcService.getVpc(getVpcId());
- if (vpc == null) {
- throw new InvalidParameterValueException("Invalid vpcId is given");
- }
-
- Account account = _accountService.getAccount(vpc.getAccountId());
- return account.getId();
- }
-
- @Override
- public long getDomainId() {
- Vpc vpc = _vpcService.getVpc(getVpcId());
- return vpc.getDomainId();
- }
-
- @Override
- public void create() {
- if (getSourceCidrList() != null) {
- for (String cidr: getSourceCidrList()){
- if (!NetUtils.isValidCIDR(cidr)){
- throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Source cidrs formatting error " + cidr);
- }
- }
- }
-
- try {
- FirewallRule result = _networkACLService.createNetworkACL(this);
- setEntityId(result.getId());
- setEntityUuid(result.getUuid());
- } catch (NetworkRuleConflictException ex) {
- s_logger.info("Network rule conflict: " + ex.getMessage());
- s_logger.trace("Network Rule Conflict: ", ex);
- throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
- }
+ Account caller = UserContext.current().getCaller();
+ return caller.getAccountId();
}
@Override
public String getEventType() {
- return EventTypes.EVENT_FIREWALL_OPEN;
+ return EventTypes.EVENT_NETWORK_ACL_ITEM_CREATE;
}
@Override
public String getEventDescription() {
- Network network = _networkService.getNetwork(networkId);
- return ("Createing Network ACL for Netowrk: " + network + " for protocol:" + this.getProtocol());
+ return "Creating Network ACL Item";
}
- @Override
- public long getAccountId() {
- Vpc vpc = _vpcService.getVpc(getVpcId());
- return vpc.getAccountId();
- }
-
- @Override
- public String getSyncObjType() {
- return BaseAsyncCmd.networkSyncObject;
- }
-
- @Override
- public Long getSyncObjId() {
- return getNetworkId();
- }
-
- @Override
public Integer getIcmpCode() {
if (icmpCode != null) {
return icmpCode;
- } else if (protocol.equalsIgnoreCase(NetUtils.ICMP_PROTO)) {
+ } else if (getProtocol().equalsIgnoreCase(NetUtils.ICMP_PROTO)) {
return -1;
}
return null;
}
- @Override
public Integer getIcmpType() {
if (icmpType != null) {
return icmpType;
- } else if (protocol.equalsIgnoreCase(NetUtils.ICMP_PROTO)) {
+ } else if (getProtocol().equalsIgnoreCase(NetUtils.ICMP_PROTO)) {
return -1;
}
return null;
}
- @Override
- public Long getRelated() {
- return null;
+ public Long getACLId() {
+ return aclId;
}
@Override
- public FirewallRuleType getType() {
- return FirewallRuleType.User;
+ public void create() {
+ NetworkACLItem result = _networkACLService.createNetworkACLItem(this);
+ setEntityId(result.getId());
+ setEntityUuid(result.getUuid());
}
@Override
- public ApiCommandJobType getInstanceType() {
- return ApiCommandJobType.FirewallRule;
+ public void execute() throws ResourceUnavailableException {
+ boolean success = false;
+ NetworkACLItem rule = _networkACLService.getNetworkACLItem(getEntityId());
+ try {
+ UserContext.current().setEventDetails("Rule Id: " + getEntityId());
+ success = _networkACLService.applyNetworkACL(rule.getAclId());
+
+ // State is different after the rule is applied, so get new object here
+ rule = _networkACLService.getNetworkACLItem(getEntityId());
+ NetworkACLItemResponse aclResponse = new NetworkACLItemResponse();
+ if (rule != null) {
+ aclResponse = _responseGenerator.createNetworkACLItemResponse(rule);
+ setResponseObject(aclResponse);
+ }
+ aclResponse.setResponseName(getCommandName());
+ } finally {
+ if (!success || rule == null) {
+ _networkACLService.revokeNetworkACLItem(getEntityId());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create network ACL Item");
+ }
+ }
}
}
+
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLListCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLListCmd.java
new file mode 100644
index 00000000000..591a3541a53
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLListCmd.java
@@ -0,0 +1,120 @@
+// 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.network;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.vpc.NetworkACL;
+import com.cloud.network.vpc.Vpc;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.NetworkACLResponse;
+import org.apache.cloudstack.api.response.VpcResponse;
+import org.apache.log4j.Logger;
+
+@APICommand(name = "createNetworkACLList", description = "Creates a Network ACL for the given VPC",
+responseObject = NetworkACLResponse.class)
+public class CreateNetworkACLListCmd extends BaseAsyncCreateCmd {
+ public static final Logger s_logger = Logger.getLogger(CreateNetworkACLListCmd.class.getName());
+
+ private static final String s_name = "createnetworkacllistresponse";
+
+ // ///////////////////////////////////////////////////
+ // ////////////// API parameters /////////////////////
+ // ///////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "Name of the network ACL List")
+ private String name;
+
+ @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "Description of the network ACL List")
+ private String description;
+
+ @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, required = true, entityType = VpcResponse.class, description = "Id of the VPC associated with this network ACL List")
+ private Long vpcId;
+
+ // ///////////////////////////////////////////////////
+ // ///////////////// Accessors ///////////////////////
+ // ///////////////////////////////////////////////////
+
+ public String getName() {
+ return name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public Long getVpcId() {
+ return vpcId;
+ }
+
+ // ///////////////////////////////////////////////////
+ // ///////////// API Implementation///////////////////
+ // ///////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public void create() {
+ NetworkACL result = _networkACLService.createNetworkACL(getName(), getDescription(), getVpcId());
+ setEntityId(result.getId());
+ setEntityUuid(result.getUuid());
+ }
+
+ @Override
+ public void execute() throws ResourceUnavailableException {
+ NetworkACL acl = _networkACLService.getNetworkACL(getEntityId());
+ if(acl != null){
+ NetworkACLResponse aclResponse = _responseGenerator.createNetworkACLResponse(acl);
+ setResponseObject(aclResponse);
+ aclResponse.setResponseName(getCommandName());
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create network ACL");
+ }
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ Vpc vpc = _vpcService.getVpc(getVpcId());
+ if (vpc == null) {
+ throw new InvalidParameterValueException("Invalid vpcId is given");
+ }
+
+ Account account = _accountService.getAccount(vpc.getAccountId());
+ return account.getId();
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_NETWORK_ACL_CREATE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Creating Network ACL with id: "+getEntityUuid();
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java
index e4f596189ba..9ec436e0628 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java
@@ -25,6 +25,7 @@ import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.NetworkACLResponse;
import org.apache.cloudstack.api.response.NetworkOfferingResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
@@ -87,6 +88,9 @@ public class CreateNetworkCmd extends BaseCmd {
@Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the ID or VID of the network")
private String vlan;
+ @Parameter(name=ApiConstants.ISOLATED_PVLAN, type=CommandType.STRING, description="the isolated private vlan for this network")
+ private String isolatedPvlan;
+
@Parameter(name=ApiConstants.NETWORK_DOMAIN, type=CommandType.STRING, description="network domain")
private String networkDomain;
@@ -127,6 +131,12 @@ public class CreateNetworkCmd extends BaseCmd {
@Parameter(name=ApiConstants.IP6_CIDR, type=CommandType.STRING, description="the CIDR of IPv6 network, must be at least /64")
private String ip6Cidr;
+ @Parameter(name=ApiConstants.DISPLAY_NETWORK, type=CommandType.BOOLEAN, description="an optional field, whether to the display the network to the end user or not.")
+ private Boolean displayNetwork;
+
+ @Parameter(name=ApiConstants.ACL_ID, type=CommandType.UUID, entityType = NetworkACLResponse.class,
+ description="Network ACL Id associated for the network")
+ private Long aclId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -142,6 +152,10 @@ public class CreateNetworkCmd extends BaseCmd {
return vlan;
}
+ public String getIsolatedPvlan() {
+ return isolatedPvlan;
+ }
+
public String getAccountName() {
return accountName;
}
@@ -190,6 +204,10 @@ public class CreateNetworkCmd extends BaseCmd {
return vpcId;
}
+ public Boolean getDisplayNetwork() {
+ return displayNetwork;
+ }
+
public Long getZoneId() {
Long physicalNetworkId = getPhysicalNetworkId();
@@ -248,6 +266,10 @@ public class CreateNetworkCmd extends BaseCmd {
return ip6Cidr.toLowerCase();
}
+ public Long getAclId() {
+ return aclId;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -273,7 +295,7 @@ public class CreateNetworkCmd extends BaseCmd {
if (result != null) {
NetworkResponse response = _responseGenerator.createNetworkResponse(result);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create network");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java
index 9c3cfb0e2c4..051e5867529 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java
@@ -19,20 +19,17 @@ package org.apache.cloudstack.api.command.user.network;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.ApiCommandJobType;
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.AccountResponse;
-import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.api.response.NetworkACLItemResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.event.EventTypes;
-import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.rules.FirewallRule;
+import com.cloud.user.Account;
import com.cloud.user.UserContext;
@APICommand(name = "deleteNetworkACL", description="Deletes a Network ACL", responseObject=SuccessResponse.class)
@@ -44,14 +41,10 @@ public class DeleteNetworkACLCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = FirewallRuleResponse.class,
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = NetworkACLItemResponse.class,
required=true, description="the ID of the network ACL")
private Long id;
- // unexposed parameter needed for events logging
- @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.UUID, entityType = AccountResponse.class,
- expose=false)
- private Long ownerId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -70,7 +63,7 @@ public class DeleteNetworkACLCmd extends BaseAsyncCmd {
@Override
public String getEventType() {
- return EventTypes.EVENT_FIREWALL_CLOSE;
+ return EventTypes.EVENT_NETWORK_ACL_ITEM_DELETE;
}
@Override
@@ -80,44 +73,21 @@ public class DeleteNetworkACLCmd extends BaseAsyncCmd {
@Override
public long getEntityOwnerId() {
- if (ownerId == null) {
- FirewallRule rule = _networkACLService.getNetworkACL(id);
- if (rule == null) {
- throw new InvalidParameterValueException("Unable to find network ACL by id=" + id);
- } else {
- ownerId = rule.getAccountId();
- }
- }
- return ownerId;
+ Account caller = UserContext.current().getCaller();
+ return caller.getAccountId();
}
@Override
public void execute() throws ResourceUnavailableException {
- UserContext.current().setEventDetails("Network ACL Id: " + id);
- boolean result = _networkACLService.revokeNetworkACL(id, true);
+ UserContext.current().setEventDetails("Network ACL Item Id: " + id);
+ boolean result = _networkACLService.revokeNetworkACLItem(id);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network ACL");
- }
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network ACL Item");
}
-
-
- @Override
- public String getSyncObjType() {
- return BaseAsyncCmd.networkSyncObject;
- }
-
- @Override
- public Long getSyncObjId() {
- return _firewallService.getFirewallRule(id).getNetworkId();
- }
-
- @Override
- public ApiCommandJobType getInstanceType() {
- return ApiCommandJobType.FirewallRule;
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLListCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLListCmd.java
new file mode 100644
index 00000000000..22f7b3caea3
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLListCmd.java
@@ -0,0 +1,94 @@
+// 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.network;
+
+
+import org.apache.log4j.Logger;
+
+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.NetworkACLResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+
+@APICommand(name = "deleteNetworkACLList", description="Deletes a Network ACL", responseObject=SuccessResponse.class)
+public class DeleteNetworkACLListCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(DeleteNetworkACLListCmd.class.getName());
+ private static final String s_name = "deletenetworkacllistresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = NetworkACLResponse.class,
+ required=true, description="the ID of the network ACL")
+ private Long id;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public long getId() {
+ return id;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_NETWORK_ACL_DELETE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return ("Deleting Network ACL id=" + id);
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ Account caller = UserContext.current().getCaller();
+ return caller.getAccountId();
+ }
+
+ @Override
+ public void execute() throws ResourceUnavailableException {
+ UserContext.current().setEventDetails("Network ACL Id: " + id);
+ boolean result = _networkACLService.deleteNetworkACL(id);
+
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network ACL");
+ }
+ }
+}
+
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLListsCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLListsCmd.java
new file mode 100644
index 00000000000..bb825d9f9f9
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLListsCmd.java
@@ -0,0 +1,102 @@
+// 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.network;
+
+import com.cloud.network.vpc.NetworkACL;
+import com.cloud.utils.Pair;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.NetworkACLResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.api.response.VpcResponse;
+import org.apache.log4j.Logger;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@APICommand(name = "listNetworkACLLists", description="Lists all network ACLs", responseObject=NetworkACLResponse.class)
+public class ListNetworkACLListsCmd extends BaseListCmd {
+ public static final Logger s_logger = Logger.getLogger(ListNetworkACLListsCmd.class.getName());
+
+ private static final String s_name = "listnetworkacllistsresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = NetworkACLResponse.class,
+ description="Lists network ACL with the specified ID.")
+ private Long id;
+
+ @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType = NetworkResponse.class,
+ description="list network ACLs by network Id")
+ private Long networkId;
+
+ @Parameter(name=ApiConstants.VPC_ID, type=CommandType.UUID, entityType = VpcResponse.class,
+ description="list network ACLs by Vpc Id")
+ private Long vpcId;
+
+ @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list network ACLs by specified name")
+ private String name;
+
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getNetworkId() {
+ return networkId;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public Long getVpcId() {
+ return vpcId;
+ }
+
+ public String getName(){
+ return name;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public void execute(){
+ Pair,Integer> result = _networkACLService.listNetworkACLs(getId(), getName(), getNetworkId(), getVpcId());
+ ListResponse response = new ListResponse();
+ List aclResponses = new ArrayList();
+
+ for (NetworkACL acl : result.first()) {
+ NetworkACLResponse aclResponse = _responseGenerator.createNetworkACLResponse(acl);
+ aclResponses.add(aclResponse);
+ }
+ response.setResponses(aclResponses, result.second());
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java
index 1709432fdaa..3f8e03306a5 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java
@@ -27,13 +27,14 @@ import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.FirewallRuleResponse;
import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.NetworkACLItemResponse;
import org.apache.cloudstack.api.response.NetworkACLResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
-import com.cloud.network.rules.FirewallRule;
+import com.cloud.network.vpc.NetworkACLItem;
import com.cloud.utils.Pair;
-@APICommand(name = "listNetworkACLs", description="Lists all network ACLs", responseObject=NetworkACLResponse.class)
+@APICommand(name = "listNetworkACLs", description="Lists all network ACL items", responseObject=NetworkACLItemResponse.class)
public class ListNetworkACLsCmd extends BaseListTaggedResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListNetworkACLsCmd.class.getName());
@@ -43,16 +44,26 @@ public class ListNetworkACLsCmd extends BaseListTaggedResourcesCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = FirewallRuleResponse.class,
- description="Lists network ACL with the specified ID.")
+ description="Lists network ACL Item with the specified ID")
private Long id;
@Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType = NetworkResponse.class,
- description="list network ACLs by network Id")
+ description="list network ACL Items by network Id")
private Long networkId;
- @Parameter(name=ApiConstants.TRAFFIC_TYPE, type=CommandType.STRING, description="list network ACLs by traffic type - Ingress or Egress")
+ @Parameter(name=ApiConstants.TRAFFIC_TYPE, type=CommandType.STRING, description="list network ACL Items by traffic type - Ingress or Egress")
private String trafficType;
+ @Parameter(name=ApiConstants.ACL_ID, type=CommandType.UUID, entityType = NetworkACLResponse.class,
+ description="list network ACL Items by ACL Id")
+ private Long aclId;
+
+ @Parameter(name=ApiConstants.PROTOCOL, type=CommandType.STRING, description="list network ACL Items by Protocol")
+ private String protocol;
+
+ @Parameter(name=ApiConstants.ACTION, type=CommandType.STRING, description="list network ACL Items by Action")
+ private String action;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -69,6 +80,18 @@ public class ListNetworkACLsCmd extends BaseListTaggedResourcesCmd {
return trafficType;
}
+ public Long getAclId(){
+ return aclId;
+ }
+
+ public String getProtocol() {
+ return protocol;
+ }
+
+ public String getAction() {
+ return action;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -80,16 +103,16 @@ public class ListNetworkACLsCmd extends BaseListTaggedResourcesCmd {
@Override
public void execute(){
- Pair,Integer> result = _networkACLService.listNetworkACLs(this);
- ListResponse response = new ListResponse();
- List aclResponses = new ArrayList();
+ Pair,Integer> result = _networkACLService.listNetworkACLItems(this);
+ ListResponse response = new ListResponse();
+ List aclResponses = new ArrayList();
- for (FirewallRule acl : result.first()) {
- NetworkACLResponse ruleData = _responseGenerator.createNetworkACLResponse(acl);
+ for (NetworkACLItem acl : result.first()) {
+ NetworkACLItemResponse ruleData = _responseGenerator.createNetworkACLItemResponse(acl);
aclResponses.add(ruleData);
}
response.setResponses(aclResponses, result.second());
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ReplaceNetworkACLListCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/ReplaceNetworkACLListCmd.java
new file mode 100644
index 00000000000..67f40d1a942
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/network/ReplaceNetworkACLListCmd.java
@@ -0,0 +1,120 @@
+// 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.network;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.vpc.NetworkACL;
+import com.cloud.network.vpc.Vpc;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.response.NetworkACLResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.api.response.PrivateGatewayResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
+@APICommand(name = "replaceNetworkACLList", description="Replaces ACL associated with a Network or private gateway", responseObject=SuccessResponse.class)
+public class ReplaceNetworkACLListCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(ReplaceNetworkACLListCmd.class.getName());
+ private static final String s_name = "replacenetworkacllistresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ACL_ID, type=CommandType.UUID, entityType = NetworkACLResponse.class,
+ required=true, description="the ID of the network ACL")
+ private long aclId;
+
+ @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType = NetworkResponse.class,
+ description="the ID of the network")
+ private Long networkId;
+
+ @Parameter(name=ApiConstants.GATEWAY_ID, type=CommandType.UUID, entityType = PrivateGatewayResponse.class,
+ description="the ID of the private gateway")
+ private Long privateGatewayId;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public long getAclId() {
+ return aclId;
+ }
+
+ public Long getNetworkId(){
+ return networkId;
+ }
+
+ public Long getPrivateGatewayId() {
+ return privateGatewayId;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_NETWORK_ACL_REPLACE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return ("Associating Network ACL id=" + aclId+ " with Network id="+ networkId);
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ Account caller = UserContext.current().getCaller();
+ return caller.getAccountId();
+ }
+
+ @Override
+ public void execute() throws ResourceUnavailableException {
+ if (getNetworkId() == null && getPrivateGatewayId() == null) {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Network id and private gateway can't be null at the same time");
+ }
+
+ if (getNetworkId() != null && getPrivateGatewayId() != null) {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Network id and private gateway can't be passed at the same time");
+ }
+
+ UserContext.current().setEventDetails("Network ACL Id: " + aclId);
+ boolean result = false;
+ if (getPrivateGatewayId() != null) {
+ result = _networkACLService.replaceNetworkACLonPrivateGw(aclId, privateGatewayId);
+ } else {
+ result = _networkACLService.replaceNetworkACL(aclId, networkId);
+ }
+
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to replace network ACL");
+ }
+ }
+}
+
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLItemCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLItemCmd.java
new file mode 100644
index 00000000000..1ea815ab1fb
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLItemCmd.java
@@ -0,0 +1,173 @@
+// 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.network;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.vpc.NetworkACLItem;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import com.cloud.utils.net.NetUtils;
+import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.response.NetworkACLItemResponse;
+import org.apache.cloudstack.api.response.NetworkACLResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.log4j.Logger;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@APICommand(name = "updateNetworkACLItem", description = "Updates ACL Item with specified Id",
+responseObject = NetworkACLItemResponse.class)
+public class UpdateNetworkACLItemCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(UpdateNetworkACLItemCmd.class.getName());
+
+ private static final String s_name = "createnetworkaclresponse";
+
+ // ///////////////////////////////////////////////////
+ // ////////////// API parameters /////////////////////
+ // ///////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = NetworkACLItemResponse.class,
+ required=true, description="the ID of the network ACL Item")
+ private Long id;
+
+ @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description =
+ "the protocol for the ACL rule. Valid values are TCP/UDP/ICMP/ALL or valid protocol number")
+ private String protocol;
+
+ @Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "the starting port of ACL")
+ private Integer publicStartPort;
+
+ @Parameter(name = ApiConstants.END_PORT, type = CommandType.INTEGER, description = "the ending port of ACL")
+ private Integer publicEndPort;
+
+ @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING,
+ description = "the cidr list to allow traffic from/to")
+ private List cidrlist;
+
+ @Parameter(name = ApiConstants.ICMP_TYPE, type = CommandType.INTEGER, description = "type of the icmp message being sent")
+ private Integer icmpType;
+
+ @Parameter(name = ApiConstants.ICMP_CODE, type = CommandType.INTEGER, description = "error code for this icmp message")
+ private Integer icmpCode;
+
+ @Parameter(name=ApiConstants.TRAFFIC_TYPE, type=CommandType.STRING, description="the traffic type for the ACL," +
+ "can be Ingress or Egress, defaulted to Ingress if not specified")
+ private String trafficType;
+
+ @Parameter(name=ApiConstants.NUMBER, type=CommandType.INTEGER, description="The network of the vm the ACL will be created for")
+ private Integer number;
+
+ @Parameter(name=ApiConstants.ACTION, type=CommandType.STRING, description="scl entry action, allow or deny")
+ private String action;
+
+ // ///////////////////////////////////////////////////
+ // ///////////////// Accessors ///////////////////////
+ // ///////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ public String getProtocol() {
+ if(protocol != null){
+ return protocol.trim();
+ } else
+ return null;
+ }
+
+ public List getSourceCidrList() {
+ return cidrlist;
+ }
+
+ public NetworkACLItem.TrafficType getTrafficType() {
+ if (trafficType != null) {
+ for (NetworkACLItem.TrafficType type : NetworkACLItem.TrafficType.values()) {
+ if (type.toString().equalsIgnoreCase(trafficType)) {
+ return type;
+ }
+ }
+ }
+ return null;
+ }
+
+ // ///////////////////////////////////////////////////
+ // ///////////// API Implementation///////////////////
+ // ///////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ public String getAction() {
+ return action;
+ }
+
+ public Integer getNumber() {
+ return number;
+ }
+
+ public Integer getSourcePortStart() {
+ return publicStartPort;
+ }
+
+ public Integer getSourcePortEnd() {
+ return publicEndPort;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ Account caller = UserContext.current().getCaller();
+ return caller.getAccountId();
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_NETWORK_ACL_ITEM_UPDATE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Updating Network ACL Item";
+ }
+
+ public Integer getIcmpCode() {
+ return icmpCode;
+ }
+
+ public Integer getIcmpType() {
+ return icmpType;
+ }
+
+ @Override
+ public void execute() throws ResourceUnavailableException {
+ UserContext.current().setEventDetails("Rule Id: " + getId());
+ NetworkACLItem aclItem = _networkACLService.updateNetworkACLItem(getId(), getProtocol(), getSourceCidrList(), getTrafficType(),
+ getAction(), getNumber(), getSourcePortStart(), getSourcePortEnd(), getIcmpCode(), getIcmpType());
+ if (aclItem == null) {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update network ACL Item");
+ }
+ NetworkACLItemResponse aclResponse = _responseGenerator.createNetworkACLItemResponse(aclItem);
+ setResponseObject(aclResponse);
+ aclResponse.setResponseName(getCommandName());
+ }
+
+}
+
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
index 8844f1cb832..63b5bb31d56 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
@@ -68,6 +68,9 @@ public class UpdateNetworkCmd extends BaseAsyncCmd {
@Parameter(name=ApiConstants.GUEST_VM_CIDR, type=CommandType.STRING, description="CIDR for Guest VMs,Cloudstack allocates IPs to Guest VMs only from this CIDR")
private String guestVmCidr;
+ @Parameter(name=ApiConstants.DISPLAY_NETWORK, type=CommandType.BOOLEAN, description="an optional field, whether to the display the network to the end user or not.")
+ private Boolean displayNetwork;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -102,6 +105,10 @@ public class UpdateNetworkCmd extends BaseAsyncCmd {
private String getGuestVmCidr() {
return guestVmCidr;
}
+
+ public Boolean getDisplayNetwork() {
+ return displayNetwork;
+ }
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -131,7 +138,7 @@ public class UpdateNetworkCmd extends BaseAsyncCmd {
}
Network result = _networkService.updateGuestNetwork(getId(), getNetworkName(), getDisplayText(), callerAccount,
- callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr(), getGuestVmCidr());
+ callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr(), getGuestVmCidr(), getDisplayNetwork());
if (result != null) {
diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/AssignToGlobalLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/AssignToGlobalLoadBalancerRuleCmd.java
index e2845bddd7c..a280ba8bbec 100644
--- a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/AssignToGlobalLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/AssignToGlobalLoadBalancerRuleCmd.java
@@ -103,7 +103,7 @@ public class AssignToGlobalLoadBalancerRuleCmd extends BaseAsyncCmd {
@Override
public String getEventDescription() {
- return "applying load balancer rules " + StringUtils.join(getLoadBalancerRulesIds(), ",") +
+ return "assign load balancer rules " + StringUtils.join(getLoadBalancerRulesIds(), ",") +
" to global load balancer rule " + getGlobalLoadBalancerRuleId();
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/CreateGlobalLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/CreateGlobalLoadBalancerRuleCmd.java
index 720e6d02c8d..e04bb336b79 100644
--- a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/CreateGlobalLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/CreateGlobalLoadBalancerRuleCmd.java
@@ -92,7 +92,11 @@ public class CreateGlobalLoadBalancerRuleCmd extends BaseAsyncCreateCmd {
}
public String getAlgorithm() {
+ if (algorithm != null) {
return algorithm;
+ } else {
+ return GlobalLoadBalancerRule.Algorithm.RoundRobin.name();
+ }
}
public String getGslbMethod() {
@@ -165,7 +169,7 @@ public class CreateGlobalLoadBalancerRuleCmd extends BaseAsyncCreateCmd {
@Override
public String getEventDescription() {
- return "creating a global load balancer: " + getName() + " for account: " + getAccountName();
+ return "creating a global load balancer rule Id: " + getEntityId();
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/DeleteGlobalLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/DeleteGlobalLoadBalancerRuleCmd.java
index 78659c9e56c..cdf31907014 100644
--- a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/DeleteGlobalLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/DeleteGlobalLoadBalancerRuleCmd.java
@@ -82,12 +82,12 @@ public class DeleteGlobalLoadBalancerRuleCmd extends BaseAsyncCmd {
@Override
public String getEventType() {
- return EventTypes.EVENT_LOAD_BALANCER_DELETE;
+ return EventTypes.EVENT_GLOBAL_LOAD_BALANCER_DELETE;
}
@Override
public String getEventDescription() {
- return "deleting global load balancer: " + getGlobalLoadBalancerId();
+ return "deleting global load balancer rule: " + getGlobalLoadBalancerId();
}
@Override
diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/UpdateGlobalLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/UpdateGlobalLoadBalancerRuleCmd.java
index 7d7eb25c7fb..101cde3c020 100644
--- a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/UpdateGlobalLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/UpdateGlobalLoadBalancerRuleCmd.java
@@ -23,15 +23,18 @@ import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.GlobalLoadBalancerResponse;
import org.apache.cloudstack.api.response.LoadBalancerResponse;
+import com.cloud.event.EventTypes;
+import com.cloud.region.ha.GlobalLoadBalancerRule;
import com.cloud.region.ha.GlobalLoadBalancingRulesService;
+import com.cloud.user.Account;
@APICommand(name = "updateGlobalLoadBalancerRule", description = "update global load balancer rules.", responseObject = LoadBalancerResponse.class)
-public class UpdateGlobalLoadBalancerRuleCmd extends BaseListTaggedResourcesCmd {
+public class UpdateGlobalLoadBalancerRuleCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(GlobalLoadBalancerResponse.class.getName());
private static final String s_name = "updategloballoadbalancerruleresponse";
@@ -90,9 +93,27 @@ public class UpdateGlobalLoadBalancerRuleCmd extends BaseListTaggedResourcesCmd
return s_name;
}
+ @Override
+ public long getEntityOwnerId() {
+ GlobalLoadBalancerRule lb = _entityMgr.findById(GlobalLoadBalancerRule.class, getId());
+ if (lb != null) {
+ return lb.getAccountId();
+ }
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
@Override
public void execute() {
_gslbService.updateGlobalLoadBalancerRule(this);
}
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_GLOBAL_LOAD_BALANCER_UPDATE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return null;
+ }
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
index b9d4740f568..6dfc576b187 100755
--- a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
@@ -52,6 +52,7 @@ import com.cloud.dc.DataCenter.NetworkType;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InsufficientServerCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
@@ -184,6 +185,8 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
+ "Mutually exclusive with affinitygroupids parameter")
private List affinityGroupNameList;
+ @Parameter(name=ApiConstants.DISPLAY_VM, type=CommandType.BOOLEAN, since="4.2", description="an optional field, whether to the display the vm to the end user or not.")
+ private Boolean displayVm;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@@ -220,6 +223,10 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
return HypervisorType.getType(hypervisor);
}
+ public Boolean getDisplayVm() {
+ return displayVm;
+ }
+
public List getSecurityGroupIdList() {
if (securityGroupNameList != null && securityGroupIdList != null) {
throw new InvalidParameterValueException("securitygroupids parameter is mutually exclusive with securitygroupnames parameter");
@@ -419,9 +426,15 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
} catch (InsufficientCapacityException ex) {
+ StringBuilder message = new StringBuilder(ex.getMessage());
+ if (ex instanceof InsufficientServerCapacityException) {
+ if(((InsufficientServerCapacityException)ex).isAffinityApplied()){
+ message.append(", Please check the affinity groups provided, there may not be sufficient capacity to follow them");
+ }
+ }
s_logger.info(ex);
- s_logger.info(ex.getMessage(), ex);
- throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
+ s_logger.info(message.toString(), ex);
+ throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, message.toString());
}
} else {
result = _userVmService.getUserVm(getEntityId());
@@ -482,18 +495,20 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
throw new InvalidParameterValueException("Can't specify network Ids in Basic zone");
} else {
vm = _userVmService.createBasicSecurityGroupVirtualMachine(zone, serviceOffering, template, getSecurityGroupIdList(), owner, name,
- displayName, diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard, getAffinityGroupIdList());
+ displayName, diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList());
}
} else {
if (zone.isSecurityGroupEnabled()) {
vm = _userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, template, getNetworkIds(), getSecurityGroupIdList(),
- owner, name, displayName, diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard, getAffinityGroupIdList());
+ owner, name, displayName, diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList());
+
} else {
if (getSecurityGroupIdList() != null && !getSecurityGroupIdList().isEmpty()) {
throw new InvalidParameterValueException("Can't create vm with security groups; security group feature is not enabled per zone");
}
vm = _userVmService.createAdvancedVirtualMachine(zone, serviceOffering, template, getNetworkIds(), owner, name, displayName,
- diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard, getAffinityGroupIdList());
+ diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList());
+
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
index 4316feda773..a4c3cc7fe02 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
@@ -16,19 +16,22 @@
// under the License.
package org.apache.cloudstack.api.command.user.vm;
+import java.util.List;
+
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ACL;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
+import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.ManagementServerException;
import com.cloud.exception.ResourceUnavailableException;
@@ -38,7 +41,7 @@ import com.cloud.uservm.UserVm;
@APICommand(name = "scaleVirtualMachine", description="Scales the virtual machine to a new service offering.", responseObject=SuccessResponse.class)
-public class ScaleVMCmd extends BaseCmd {
+public class ScaleVMCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(ScaleVMCmd.class.getName());
private static final String s_name = "scalevirtualmachineresponse";
@@ -94,7 +97,7 @@ public class ScaleVMCmd extends BaseCmd {
@Override
public void execute(){
//UserContext.current().setEventDetails("Vm Id: "+getId());
- boolean result;
+ UserVm result;
try {
result = _userVmService.upgradeVirtualMachine(this);
} catch (ResourceUnavailableException ex) {
@@ -110,11 +113,23 @@ public class ScaleVMCmd extends BaseCmd {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
- if (result){
- SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
+ if (result != null){
+ List responseList = _responseGenerator.createUserVmResponse("virtualmachine", result);
+ UserVmResponse response = responseList.get(0);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to scale vm");
}
}
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_VM_SCALE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "scaling volume: " + getId() + " to service offering: " + getServiceOfferingId();
+ }
}
\ No newline at end of file
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java
index 4936e60a47e..f96a2ac4b89 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java
@@ -31,6 +31,7 @@ import org.apache.cloudstack.api.response.UserVmResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InsufficientServerCapacityException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.exception.StorageUnavailableException;
@@ -112,7 +113,7 @@ public class StartVMCmd extends BaseAsyncCmd {
}
@Override
- public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException {
+ public void execute() throws ResourceUnavailableException, ResourceAllocationException {
try {
UserContext.current().setEventDetails("Vm Id: " + getId());
@@ -135,6 +136,16 @@ public class StartVMCmd extends BaseAsyncCmd {
} catch (ExecutionException ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
+ } catch (InsufficientCapacityException ex) {
+ StringBuilder message = new StringBuilder(ex.getMessage());
+ if (ex instanceof InsufficientServerCapacityException) {
+ if (((InsufficientServerCapacityException) ex).isAffinityApplied()) {
+ 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);
+ throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, message.toString());
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
index e14db7f9123..8cce121a55a 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
@@ -65,6 +65,8 @@ public class UpdateVMCmd extends BaseCmd{
@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.DISPLAY_VM, type=CommandType.BOOLEAN, description="an optional field, whether to the display the vm to the end user or not.")
+ private Boolean displayVm;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@@ -90,6 +92,10 @@ public class UpdateVMCmd extends BaseCmd{
return userData;
}
+ public Boolean getDisplayVm() {
+ return displayVm;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -108,6 +114,7 @@ public class UpdateVMCmd extends BaseCmd{
}
@Override
+
public long getEntityOwnerId() {
UserVm userVm = _entityMgr.findById(UserVm.class, getId());
if (userVm != null) {
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/AddResourceDetailCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/AddResourceDetailCmd.java
new file mode 100644
index 00000000000..a3b92478d1e
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/AddResourceDetailCmd.java
@@ -0,0 +1,112 @@
+// 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.volume;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.SuccessResponse;
+
+import com.cloud.event.EventTypes;
+import com.cloud.server.ResourceTag;
+
+@APICommand(name = "addResourceDetail", description="Adds detail for the Resource.", responseObject=SuccessResponse.class)
+public class AddResourceDetailCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(AddResourceDetailCmd.class.getName());
+ private static final String s_name = "addResourceDetailresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, required=true, description = "Map of (key/value pairs)")
+ private Map details;
+
+ @Parameter(name=ApiConstants.RESOURCE_TYPE, type=CommandType.STRING, required=true, description="type of the resource")
+ private String resourceType;
+
+ @Parameter(name=ApiConstants.RESOURCE_ID, type=CommandType.STRING, required=true,
+ collectionType=CommandType.STRING, description="resource id to create the details for")
+ private String resourceId;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Map getDetails() {
+ Map detailsMap = null;
+ if (!details.isEmpty()) {
+ detailsMap = new HashMap();
+ Collection> servicesCollection = details.values();
+ Iterator> iter = servicesCollection.iterator();
+ while (iter.hasNext()) {
+ HashMap services = (HashMap) iter.next();
+ String key = services.get("key");
+ String value = services.get("value");
+ detailsMap.put(key, value);
+ }
+ }
+ return detailsMap;
+ }
+
+ public ResourceTag.TaggedResourceType getResourceType() {
+ return _taggedResourceService.getResourceType(resourceType);
+ }
+
+ public String getResourceId() {
+ return resourceId;
+ }
+/////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+
+ @Override
+ public long getEntityOwnerId() {
+ //FIXME - validate the owner here
+ return 1;
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_RESOURCE_DETAILS_CREATE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "adding details to the resource ";
+ }
+
+ @Override
+ public void execute(){
+ _resourceMetaDataService.addResourceMetaData(getResourceId(), getResourceType(), getDetails());
+ setResponseObject(new SuccessResponse(getCommandName()));
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java
index 8117f38d989..85629d19952 100644
--- a/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java
@@ -77,8 +77,10 @@ public class CreateVolumeCmd extends BaseAsyncCreateCmd {
description="the ID of the availability zone")
private Long zoneId;
+ @Parameter(name=ApiConstants.DISPLAY_VOLUME, type=CommandType.BOOLEAN, description="an optional field, whether to display the volume to the end user or not.")
+ private Boolean displayVolume;
- /////////////////////////////////////////////////////
+/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -115,6 +117,10 @@ public class CreateVolumeCmd extends BaseAsyncCreateCmd {
return projectId;
}
+ public Boolean getDisplayVolume() {
+ return displayVolume;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/ListResourceDetailsCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/ListResourceDetailsCmd.java
new file mode 100644
index 00000000000..c02d4b4c6ef
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/ListResourceDetailsCmd.java
@@ -0,0 +1,75 @@
+// 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.volume;
+
+import com.cloud.server.ResourceTag;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.ResourceDetailResponse;
+import org.apache.cloudstack.api.response.ResourceTagResponse;
+
+import java.util.List;
+
+@APICommand(name = "listResourceDetails", description = "List resource detail(s)", responseObject = ResourceTagResponse.class, since = "4.2")
+public class ListResourceDetailsCmd extends BaseListProjectAndAccountResourcesCmd{
+ private static final String s_name = "listresourcedetailsresponse";
+
+ @Parameter(name=ApiConstants.RESOURCE_TYPE, type=CommandType.STRING, description="list by resource type")
+ private String resourceType;
+
+ @Parameter(name=ApiConstants.RESOURCE_ID, type=CommandType.STRING, description="list by resource id")
+ private String resourceId;
+
+ @Parameter(name=ApiConstants.KEY, type=CommandType.STRING, description="list by key")
+ private String key;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public void execute() {
+
+ ListResponse response = new ListResponse();
+ List resourceDetailResponse = _queryService.listResource(this);
+ response.setResponses(resourceDetailResponse);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }
+
+ public ResourceTag.TaggedResourceType getResourceType() {
+ return _taggedResourceService.getResourceType(resourceType);
+ }
+
+ public String getResourceId() {
+ return resourceId;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/RemoveResourceDetailCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/RemoveResourceDetailCmd.java
new file mode 100644
index 00000000000..f8872c90186
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/RemoveResourceDetailCmd.java
@@ -0,0 +1,103 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for Removeitional 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.volume;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiCommandJobType;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.SuccessResponse;
+
+import com.cloud.event.EventTypes;
+import com.cloud.server.ResourceTag;
+
+@APICommand(name = "removeResourceDetail", description="Removes detail for the Resource.", responseObject=SuccessResponse.class)
+public class RemoveResourceDetailCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(RemoveResourceDetailCmd.class.getName());
+ private static final String s_name = "RemoveResourceDetailresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.KEY, type = CommandType.STRING, description = "Delete details matching key/value pairs")
+ private String key;
+
+ @Parameter(name=ApiConstants.RESOURCE_TYPE, type=CommandType.STRING, required=true, description="Delete detail by resource type")
+ private String resourceType;
+
+ @Parameter(name=ApiConstants.RESOURCE_ID, type=CommandType.STRING, required=true,
+ collectionType=CommandType.STRING, description="Delete details for resource id")
+ private String resourceId;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+
+ public ResourceTag.TaggedResourceType getResourceType(){
+ return _taggedResourceService.getResourceType(resourceType);
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public String getResourceId() {
+ return resourceId;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public ApiCommandJobType getInstanceType() {
+ return ApiCommandJobType.Volume;
+ }
+
+
+ @Override
+ public long getEntityOwnerId() {
+ //FIXME - validate the owner here
+ return 1;
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_RESOURCE_DETAILS_DELETE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Removing detail to the volume ";
+ }
+
+ @Override
+ public void execute(){
+ _resourceMetaDataService.deleteResourceMetaData(getResourceId(), getResourceType(), getKey());
+ setResponseObject(new SuccessResponse(getCommandName()));
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java
new file mode 100644
index 00000000000..2722f29ec2a
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java
@@ -0,0 +1,114 @@
+// 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.volume;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiCommandJobType;
+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.VolumeResponse;
+
+import com.cloud.event.EventTypes;
+import com.cloud.storage.Volume;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+
+@APICommand(name = "updateVolume", description="Updates the volume.", responseObject=VolumeResponse.class)
+public class UpdateVolumeCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(UpdateVolumeCmd.class.getName());
+ private static final String s_name = "addVolumeresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VolumeResponse.class,
+ required=true, description="the ID of the disk volume")
+ private Long id;
+
+ @Parameter(name=ApiConstants.PATH, type=CommandType.STRING,
+ required=true, description="the path of the volume")
+ private String path;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public String getPath() {
+ return path;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public ApiCommandJobType getInstanceType() {
+ return ApiCommandJobType.Volume;
+ }
+
+ @Override
+ public Long getInstanceId() {
+ return getId();
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ Volume volume = _responseGenerator.findVolumeById(getId());
+ if (volume == null) {
+ return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
+ }
+ return volume.getAccountId();
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_VOLUME_ATTACH;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "adding detail to the volume: " + getId();
+ }
+
+ @Override
+ public void execute(){
+ UserContext.current().setEventDetails("Volume Id: "+getId());
+ Volume result = _volumeService.updateVolume(this);
+ if (result != null) {
+ VolumeResponse response = _responseGenerator.createVolumeResponse(result);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update volume");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/response/ClusterResponse.java b/api/src/org/apache/cloudstack/api/response/ClusterResponse.java
index 5ea932503fd..5d9bb054b8c 100644
--- a/api/src/org/apache/cloudstack/api/response/ClusterResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/ClusterResponse.java
@@ -69,7 +69,7 @@ public class ClusterResponse extends BaseResponse {
@SerializedName("cpuovercommitratio") @Param(description = "The cpu overcommit ratio of the cluster")
private String cpuovercommitratio;
- @SerializedName("memoryovercommitratio") @Param (description = "The ram overcommit ratio of the cluster")
+ @SerializedName("memoryovercommitratio") @Param (description = "The memory overcommit ratio of the cluster")
private String memoryovercommitratio;
public String getId() {
@@ -133,7 +133,7 @@ public class ClusterResponse extends BaseResponse {
}
public String getHypervisorType() {
- return this.hypervisorType;
+ return hypervisorType;
}
public void setHypervisorType(String hypervisorType) {
@@ -161,20 +161,22 @@ public class ClusterResponse extends BaseResponse {
}
public void setCapacitites(ArrayList arrayList) {
- this.capacitites = arrayList;
- }
- public void setCpuovercommitratio(String cpuovercommitratio){
- this.cpuovercommitratio= cpuovercommitratio;
- }
- public void setRamovercommitratio (String memoryOvercommitRatio){
- this.memoryovercommitratio= memoryOvercommitRatio;
+ capacitites = arrayList;
}
- public String getCpuovercommitratio (){
+ public void setCpuOvercommitRatio(String cpuovercommitratio){
+ this.cpuovercommitratio= cpuovercommitratio;
+ }
+
+ public String getCpuOvercommitRatio(){
return cpuovercommitratio;
}
- public String getRamovercommitratio (){
+ public void setMemoryOvercommitRatio(String memoryovercommitratio){
+ this.memoryovercommitratio= memoryovercommitratio;
+ }
+
+ public String getMemoryOvercommitRatio(){
return memoryovercommitratio;
}
}
diff --git a/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java b/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java
index 0b217c75d46..6f34a36d636 100644
--- a/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java
@@ -59,8 +59,20 @@ public class DiskOfferingResponse extends BaseResponse {
@SerializedName("storagetype") @Param(description="the storage type for this disk offering")
private String storageType;
+ @SerializedName("displayoffering") @Param(description="whether to display the offering to the end user or not.")
+ private Boolean displayOffering;
+
+ public Boolean getDisplayOffering() {
+ return displayOffering;
+ }
+
+ public void setDisplayOffering(Boolean displayOffering) {
+ this.displayOffering = displayOffering;
+ }
+
public String getId() {
return id;
+
}
public void setId(String id) {
diff --git a/api/src/org/apache/cloudstack/api/response/NetworkACLItemResponse.java b/api/src/org/apache/cloudstack/api/response/NetworkACLItemResponse.java
new file mode 100644
index 00000000000..400a4db7631
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/NetworkACLItemResponse.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.response;
+
+import java.util.List;
+
+import com.cloud.network.vpc.NetworkACLItem;
+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;
+
+@EntityReference(value = NetworkACLItem.class)
+public class NetworkACLItemResponse extends BaseResponse {
+ @SerializedName(ApiConstants.ID) @Param(description="the ID of the ACL Item")
+ private String id;
+
+ @SerializedName(ApiConstants.PROTOCOL) @Param(description="the protocol of the ACL")
+ private String protocol;
+
+ @SerializedName(ApiConstants.START_PORT) @Param(description="the starting port of ACL's port range")
+ private String startPort;
+
+ @SerializedName(ApiConstants.END_PORT) @Param(description = "the ending port of ACL's port range")
+ private String endPort;
+
+ @SerializedName(ApiConstants.TRAFFIC_TYPE) @Param(description="the traffic type for the ACL")
+ private String trafficType;
+
+ @SerializedName(ApiConstants.STATE) @Param(description="the state of the rule")
+ private String state;
+
+ @SerializedName(ApiConstants.CIDR_LIST) @Param(description="the cidr list to forward traffic from")
+ private String cidrList;
+
+ @SerializedName(ApiConstants.ICMP_TYPE) @Param(description= "type of the icmp message being sent")
+ private Integer icmpType;
+
+ @SerializedName(ApiConstants.ICMP_CODE) @Param(description = "error code for this icmp message")
+ private Integer icmpCode;
+
+ @SerializedName(ApiConstants.TAGS) @Param(description="the list of resource tags associated with the network ACLs",
+ responseObject = ResourceTagResponse.class)
+ private List tags;
+
+ @SerializedName(ApiConstants.ACL_ID) @Param(description="the ID of the ACL this item belongs to")
+ private String aclId;
+
+ @SerializedName(ApiConstants.NUMBER) @Param(description= "Number of the ACL Item")
+ private Integer number;
+
+ @SerializedName(ApiConstants.ACTION) @Param(description="Action of ACL Item. Allow/Deny")
+ private String action;
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public void setProtocol(String protocol) {
+ this.protocol = protocol;
+ }
+
+ public void setStartPort(String startPort) {
+ this.startPort = startPort;
+ }
+
+ public void setEndPort(String endPort) {
+ this.endPort = endPort;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public void setCidrList(String cidrList) {
+ this.cidrList = cidrList;
+ }
+
+ public void setIcmpType(Integer icmpType) {
+ this.icmpType = icmpType;
+ }
+
+ public void setIcmpCode(Integer icmpCode) {
+ this.icmpCode = icmpCode;
+ }
+
+ public void setTrafficType(String trafficType) {
+ this.trafficType = trafficType;
+ }
+
+ public void setTags(List tags) {
+ this.tags = tags;
+ }
+
+ public void setAclId(String aclId) {
+ this.aclId = aclId;
+ }
+
+ public void setNumber(Integer number) {
+ this.number = number;
+ }
+
+ public void setAction(String action) {
+ this.action = action;
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/response/NetworkACLResponse.java b/api/src/org/apache/cloudstack/api/response/NetworkACLResponse.java
index 8f5f216ff0c..1f8515e4378 100644
--- a/api/src/org/apache/cloudstack/api/response/NetworkACLResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/NetworkACLResponse.java
@@ -16,85 +16,42 @@
// under the License.
package org.apache.cloudstack.api.response;
-import java.util.List;
-
import com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+import com.cloud.network.vpc.NetworkACL;
import com.cloud.serializer.Param;
-@SuppressWarnings("unused")
+@EntityReference(value = NetworkACL.class)
public class NetworkACLResponse extends BaseResponse {
@SerializedName(ApiConstants.ID) @Param(description="the ID of the ACL")
private String id;
- @SerializedName(ApiConstants.PROTOCOL) @Param(description="the protocol of the ACL")
- private String protocol;
+ @SerializedName(ApiConstants.NAME) @Param(description="the Name of the ACL")
+ private String name;
- @SerializedName(ApiConstants.START_PORT) @Param(description="the starting port of ACL's port range")
- private String startPort;
+ @SerializedName(ApiConstants.DESCRIPTION) @Param(description="Description of the ACL")
+ private String description;
- @SerializedName(ApiConstants.END_PORT) @Param(description = "the ending port of ACL's port range")
- private String endPort;
-
- @SerializedName(ApiConstants.TRAFFIC_TYPE) @Param(description="the traffic type for the ACL")
- private String trafficType;
-
- @SerializedName(ApiConstants.STATE) @Param(description="the state of the rule")
- private String state;
-
- @SerializedName(ApiConstants.CIDR_LIST) @Param(description="the cidr list to forward traffic from")
- private String cidrList;
-
- @SerializedName(ApiConstants.ICMP_TYPE) @Param(description= "type of the icmp message being sent")
- private Integer icmpType;
-
- @SerializedName(ApiConstants.ICMP_CODE) @Param(description = "error code for this icmp message")
- private Integer icmpCode;
-
- @SerializedName(ApiConstants.TAGS) @Param(description="the list of resource tags associated with the network ACLs",
- responseObject = ResourceTagResponse.class)
- private List tags;
+ @SerializedName(ApiConstants.VPC_ID) @Param(description="Id of the VPC this ACL is associated with")
+ private String vpcId;
public void setId(String id) {
this.id = id;
}
- public void setProtocol(String protocol) {
- this.protocol = protocol;
+ public void setName(String name) {
+ this.name = name;
}
- public void setStartPort(String startPort) {
- this.startPort = startPort;
+ public void setDescription(String description) {
+ this.description = description;
}
- public void setEndPort(String endPort) {
- this.endPort = endPort;
- }
-
- public void setState(String state) {
- this.state = state;
- }
-
- public void setCidrList(String cidrList) {
- this.cidrList = cidrList;
- }
-
- public void setIcmpType(Integer icmpType) {
- this.icmpType = icmpType;
- }
-
- public void setIcmpCode(Integer icmpCode) {
- this.icmpCode = icmpCode;
- }
-
- public void setTrafficType(String trafficType) {
- this.trafficType = trafficType;
- }
-
- public void setTags(List tags) {
- this.tags = tags;
+ public void setVpcId(String vpcId) {
+ this.vpcId = vpcId;
}
}
diff --git a/api/src/org/apache/cloudstack/api/response/NetworkResponse.java b/api/src/org/apache/cloudstack/api/response/NetworkResponse.java
index 9ad57187afe..ec7859cef8e 100644
--- a/api/src/org/apache/cloudstack/api/response/NetworkResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/NetworkResponse.java
@@ -164,6 +164,17 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
@SerializedName(ApiConstants.IP6_CIDR) @Param(description="the cidr of IPv6 network")
private String ip6Cidr;
+ @SerializedName(ApiConstants.DISPLAY_NETWORK) @Param(description="an optional field, whether to the display the network to the end user or not.")
+ private Boolean displayNetwork;
+
+ public Boolean getDisplayNetwork() {
+ return displayNetwork;
+ }
+
+ public void setDisplayNetwork(Boolean displayNetwork) {
+ this.displayNetwork = displayNetwork;
+ }
+
public void setId(String id) {
this.id = id;
}
diff --git a/api/src/org/apache/cloudstack/api/response/NicDetailResponse.java b/api/src/org/apache/cloudstack/api/response/NicDetailResponse.java
new file mode 100644
index 00000000000..f8ddf1c8250
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/NicDetailResponse.java
@@ -0,0 +1,81 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.response;
+
+import java.util.Date;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+@SuppressWarnings("unused")
+public class NicDetailResponse extends BaseResponse{
+ @SerializedName(ApiConstants.ID)
+ @Param(description = "ID of the nic")
+ private String id;
+
+ @SerializedName(ApiConstants.NAME)
+ @Param(description = "name of the nic detail")
+ private String name;
+
+
+ @SerializedName(ApiConstants.VALUE)
+ @Param(description = "value of the nic detail")
+ private String value;
+
+ @SerializedName(ApiConstants.DISPLAY_NIC) @Param(description="an optional field whether to the display the nic to the end user or not.")
+ private Boolean displayNic;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getName() {
+
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Boolean getDisplayNic() {
+ return displayNic;
+ }
+
+ public void setDisplayNic(Boolean displayNic) {
+ this.displayNic = displayNic;
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/response/PrivateGatewayResponse.java b/api/src/org/apache/cloudstack/api/response/PrivateGatewayResponse.java
index a9ba88dafb8..882c1a6eb41 100644
--- a/api/src/org/apache/cloudstack/api/response/PrivateGatewayResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/PrivateGatewayResponse.java
@@ -81,6 +81,10 @@ public class PrivateGatewayResponse extends BaseResponse implements ControlledEn
private Boolean sourceNat;
+ @SerializedName(ApiConstants.ACL_ID) @Param(description = "ACL Id set for private gateway")
+ private String aclId;
+
+
@Override
public String getObjectId() {
return this.id;
@@ -155,6 +159,11 @@ public class PrivateGatewayResponse extends BaseResponse implements ControlledEn
this.sourceNat = sourceNat;
}
+ public void setAclId(String aclId) {
+ this.aclId = aclId;
+ }
+
+
}
diff --git a/api/src/org/apache/cloudstack/api/response/ResourceDetailResponse.java b/api/src/org/apache/cloudstack/api/response/ResourceDetailResponse.java
new file mode 100644
index 00000000000..0e917d71904
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/ResourceDetailResponse.java
@@ -0,0 +1,81 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.response;
+
+import java.util.Date;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+@SuppressWarnings("unused")
+public class ResourceDetailResponse extends BaseResponse{
+ @SerializedName(ApiConstants.RESOURCE_ID)
+ @Param(description = "ID of the resource")
+ private String resourceId;
+
+ @SerializedName(ApiConstants.RESOURCE_TYPE)
+ @Param(description = "ID of the resource")
+ private String resourceType;
+
+ @SerializedName(ApiConstants.KEY)
+ @Param(description = "key of the resource detail")
+ private String name;
+
+
+ @SerializedName(ApiConstants.VALUE)
+ @Param(description = "value of the resource detail")
+ private String value;
+
+ public String getResourceId() {
+ return resourceId;
+ }
+
+ public void setResourceId(String resourceId) {
+ this.resourceId = resourceId;
+ }
+
+ public String getResourceType() {
+ return resourceType;
+ }
+
+ public void setResourceType(String resourceType) {
+ this.resourceType = resourceType;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java b/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java
index a9bab876850..c686293f18a 100644
--- a/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java
@@ -83,6 +83,8 @@ public class ServiceOfferingResponse extends BaseResponse {
@SerializedName(ApiConstants.NETWORKRATE) @Param(description="data transfer rate in megabits per second allowed.")
private Integer networkRate;
+ @SerializedName(ApiConstants.DEPLOYMENT_PLANNER) @Param(description="deployment strategy used to deploy VM.")
+ private String deploymentPlanner;
public String getId() {
return id;
@@ -123,7 +125,7 @@ public class ServiceOfferingResponse extends BaseResponse {
}
public void setSystemVmType(String vmtype) {
- this.vm_type = vmtype;
+ vm_type = vmtype;
}
@@ -226,4 +228,12 @@ public class ServiceOfferingResponse extends BaseResponse {
public void setNetworkRate(Integer networkRate) {
this.networkRate = networkRate;
}
+
+ public String getDeploymentPlanner() {
+ return deploymentPlanner;
+ }
+
+ public void setDeploymentPlanner(String deploymentPlanner) {
+ this.deploymentPlanner = deploymentPlanner;
+ }
}
diff --git a/api/src/org/apache/cloudstack/api/response/UserVmResponse.java b/api/src/org/apache/cloudstack/api/response/UserVmResponse.java
index 5f511062d08..9901b5f014b 100644
--- a/api/src/org/apache/cloudstack/api/response/UserVmResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/UserVmResponse.java
@@ -177,6 +177,9 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
@Param(description = "list of affinity groups associated with the virtual machine", responseObject = AffinityGroupResponse.class)
private Set affinityGroupList;
+ @SerializedName(ApiConstants.DISPLAY_VM) @Param(description="an optional field whether to the display the vm to the end user or not.")
+ private Boolean displayVm;
+
public UserVmResponse(){
securityGroupList = new LinkedHashSet();
nics = new LinkedHashSet();
@@ -196,7 +199,13 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
return this.id;
}
+ public Boolean getDisplayVm() {
+ return displayVm;
+ }
+ public void setDisplayVm(Boolean displayVm) {
+ this.displayVm = displayVm;
+ }
@Override
public String getObjectId() {
diff --git a/api/src/org/apache/cloudstack/api/response/VolumeDetailResponse.java b/api/src/org/apache/cloudstack/api/response/VolumeDetailResponse.java
new file mode 100644
index 00000000000..04d280d0d9f
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/VolumeDetailResponse.java
@@ -0,0 +1,82 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.response;
+
+import java.util.Date;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+
+import com.cloud.serializer.Param;
+import com.cloud.storage.Volume;
+import com.google.gson.annotations.SerializedName;
+
+@SuppressWarnings("unused")
+public class VolumeDetailResponse extends BaseResponse{
+ @SerializedName(ApiConstants.ID)
+ @Param(description = "ID of the volume")
+ private String id;
+
+ @SerializedName(ApiConstants.NAME)
+ @Param(description = "name of the volume detail")
+ private String name;
+
+
+ @SerializedName(ApiConstants.VALUE)
+ @Param(description = "value of the volume detail")
+ private String value;
+
+ @SerializedName(ApiConstants.DISPLAY_VOLUME) @Param(description="an optional field whether to the display the volume to the end user or not.")
+ private Boolean displayVm;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getName() {
+
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Boolean getDisplayVm() {
+ return displayVm;
+ }
+
+ public void setDisplayVm(Boolean displayVm) {
+ this.displayVm = displayVm;
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/response/VolumeResponse.java b/api/src/org/apache/cloudstack/api/response/VolumeResponse.java
index 7b7c805a24f..47e620f55fb 100644
--- a/api/src/org/apache/cloudstack/api/response/VolumeResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/VolumeResponse.java
@@ -165,6 +165,9 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity
@SerializedName(ApiConstants.TAGS) @Param(description="the list of resource tags associated with volume", responseObject = ResourceTagResponse.class)
private Set tags;
+ @SerializedName(ApiConstants.DISPLAY_VOLUME) @Param(description="an optional field whether to the display the volume to the end user or not.")
+ private Boolean displayVm;
+
public VolumeResponse(){
tags = new LinkedHashSet();
}
@@ -324,4 +327,13 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity
public void addTag(ResourceTagResponse tag){
this.tags.add(tag);
}
+
+ public Boolean getDisplayVm() {
+ return displayVm;
+ }
+
+ public void setDisplayVm(Boolean displayVm) {
+ this.displayVm = displayVm;
+ }
+
}
diff --git a/api/src/org/apache/cloudstack/query/QueryService.java b/api/src/org/apache/cloudstack/query/QueryService.java
index 2f50d63828c..2dfd97cfa98 100644
--- a/api/src/org/apache/cloudstack/query/QueryService.java
+++ b/api/src/org/apache/cloudstack/query/QueryService.java
@@ -34,30 +34,15 @@ import org.apache.cloudstack.api.command.user.securitygroup.ListSecurityGroupsCm
import org.apache.cloudstack.api.command.user.tag.ListTagsCmd;
import org.apache.cloudstack.api.command.user.vm.ListVMsCmd;
import org.apache.cloudstack.api.command.user.vmgroup.ListVMGroupsCmd;
+import org.apache.cloudstack.api.command.user.volume.ListResourceDetailsCmd;
import org.apache.cloudstack.api.command.user.volume.ListVolumesCmd;
import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd;
-import org.apache.cloudstack.api.response.AccountResponse;
-import org.apache.cloudstack.api.response.AsyncJobResponse;
-import org.apache.cloudstack.api.response.DiskOfferingResponse;
-import org.apache.cloudstack.api.response.DomainRouterResponse;
-import org.apache.cloudstack.api.response.EventResponse;
-import org.apache.cloudstack.api.response.HostResponse;
-import org.apache.cloudstack.api.response.InstanceGroupResponse;
-import org.apache.cloudstack.api.response.ListResponse;
-import org.apache.cloudstack.api.response.ProjectAccountResponse;
-import org.apache.cloudstack.api.response.ProjectInvitationResponse;
-import org.apache.cloudstack.api.response.ProjectResponse;
-import org.apache.cloudstack.api.response.ResourceTagResponse;
-import org.apache.cloudstack.api.response.SecurityGroupResponse;
-import org.apache.cloudstack.api.response.ServiceOfferingResponse;
-import org.apache.cloudstack.api.response.StoragePoolResponse;
-import org.apache.cloudstack.api.response.UserResponse;
-import org.apache.cloudstack.api.response.UserVmResponse;
-import org.apache.cloudstack.api.response.VolumeResponse;
-import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.cloudstack.api.response.*;
import com.cloud.exception.PermissionDeniedException;
+import java.util.List;
+
/**
* Service used for list api query.
*
@@ -103,5 +88,8 @@ public interface QueryService {
public ListResponse listAffinityGroups(Long affinityGroupId, String affinityGroupName,
String affinityGroupType, Long vmId, Long startIndex, Long pageSize);
+ public List listResource(ListResourceDetailsCmd cmd);
+
ListResponse searchForInternalLbVms(ListInternalLBVMsCmd cmd);
+
}
diff --git a/api/test/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java
index 8a28290e04b..bb022986e2d 100644
--- a/api/test/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java
+++ b/api/test/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java
@@ -24,11 +24,18 @@ import org.apache.cloudstack.api.ResponseGenerator;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.command.user.vm.ScaleVMCmd;
+import org.apache.cloudstack.api.response.SwiftResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.Mockito;
+import static org.mockito.Matchers.anyInt;
+
+
+import java.util.LinkedList;
+import java.util.List;
public class ScaleVMCmdTest extends TestCase{
@@ -58,19 +65,34 @@ public class ScaleVMCmdTest extends TestCase{
public void testCreateSuccess() {
UserVmService userVmService = Mockito.mock(UserVmService.class);
+ UserVm userVm = Mockito.mock(UserVm.class);
+
try {
Mockito.when(
userVmService.upgradeVirtualMachine(scaleVMCmd))
- .thenReturn(true);
+ .thenReturn(userVm);
}catch (Exception e){
Assert.fail("Received exception when success expected " +e.getMessage());
}
- scaleVMCmd._userVmService = userVmService;
- responseGenerator = Mockito.mock(ResponseGenerator.class);
-
+ ResponseGenerator responseGenerator = Mockito.mock(ResponseGenerator.class);
scaleVMCmd._responseGenerator = responseGenerator;
+
+ UserVmResponse userVmResponse = Mockito.mock(UserVmResponse.class);
+ //List list = Mockito.mock(UserVmResponse.class);
+ //list.add(userVmResponse);
+ //LinkedList mockedList = Mockito.mock(LinkedList.class);
+ //Mockito.when(mockedList.get(0)).thenReturn(userVmResponse);
+
+ List list = new LinkedList();
+ list.add(userVmResponse);
+
+ Mockito.when(responseGenerator.createUserVmResponse("virtualmachine", userVm)).thenReturn(
+ list);
+
+ scaleVMCmd._userVmService = userVmService;
+
scaleVMCmd.execute();
}
@@ -83,7 +105,7 @@ public class ScaleVMCmdTest extends TestCase{
try {
Mockito.when(
userVmService.upgradeVirtualMachine(scaleVMCmd))
- .thenReturn(false);
+ .thenReturn(null);
}catch (Exception e){
Assert.fail("Received exception when success expected " +e.getMessage());
}
diff --git a/awsapi/src/com/cloud/bridge/persist/dao/CloudStackUserDaoImpl.java b/awsapi/src/com/cloud/bridge/persist/dao/CloudStackUserDaoImpl.java
index f108a20e5b4..5aac3960d02 100644
--- a/awsapi/src/com/cloud/bridge/persist/dao/CloudStackUserDaoImpl.java
+++ b/awsapi/src/com/cloud/bridge/persist/dao/CloudStackUserDaoImpl.java
@@ -19,15 +19,14 @@ package com.cloud.bridge.persist.dao;
import javax.ejb.Local;
import org.apache.log4j.Logger;
-import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
import org.springframework.stereotype.Component;
import com.cloud.bridge.model.CloudStackUserVO;
-import com.cloud.bridge.util.EncryptionSecretKeyCheckerUtil;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
import com.cloud.utils.db.Transaction;
+import com.cloud.utils.crypt.DBEncryptionUtil;
@Component
@Local(value={CloudStackUserDao.class})
@@ -51,13 +50,8 @@ public class CloudStackUserDaoImpl extends GenericDaoBasecloud-plugin-network-midonet
${project.version}
-
+
org.apache.cloudstack
cloud-plugin-network-internallb
${project.version}
@@ -131,6 +131,11 @@
cloud-plugin-planner-user-concentrated-pod
${project.version}
+
+ org.apache.cloudstack
+ cloud-plugin-planner-implicit-dedication
+ ${project.version}
+
org.apache.cloudstack
cloud-plugin-host-allocator-random
diff --git a/client/tomcatconf/applicationContext.xml.in b/client/tomcatconf/applicationContext.xml.in
index 366a4c1166a..96def5138d4 100644
--- a/client/tomcatconf/applicationContext.xml.in
+++ b/client/tomcatconf/applicationContext.xml.in
@@ -244,6 +244,8 @@
+
+
@@ -254,7 +256,9 @@
+
+
@@ -350,6 +354,7 @@
+
@@ -361,7 +366,7 @@
-
+
-
-
-
+
-
-
-
+
+
+
+
+
@@ -596,10 +601,6 @@
-
-
-
-
@@ -614,6 +615,7 @@
+
@@ -621,9 +623,7 @@
-
-
-
+
@@ -682,6 +682,7 @@
+
@@ -700,6 +701,7 @@
+
@@ -848,17 +850,13 @@
-
+
-
-
-
-
@@ -874,6 +872,8 @@
+
+
@@ -883,4 +883,7 @@
+
+
+
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index 0a6ec708166..68a7511560b 100644
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -205,6 +205,7 @@ destroySystemVm=1
listSystemVms=3
migrateSystemVm=1
changeServiceForSystemVm=1
+scaleSystemVm=1
#### configuration commands
updateConfiguration=1
@@ -212,6 +213,7 @@ listConfigurations=1
ldapConfig=1
ldapRemove=1
listCapabilities=15
+listDeploymentPlanners=1
#### pod commands
createPod=1
@@ -261,6 +263,7 @@ listHosts=3
findHostsForMigration=1
addSecondaryStorage=1
updateHostPassword=1
+releaseHostReservation=1
#### volume commands
attachVolume=15
@@ -272,6 +275,11 @@ listVolumes=15
extractVolume=15
migrateVolume=15
resizeVolume=15
+updateVolume=1
+addVolumeDetail=1
+updateVolumeDetail=1
+removeVolumeDetail=1
+listVolumeDetails=1
#### registration command: FIXME -- this really should be something in management server that
#### generates a new key for the user and they just have to
@@ -342,6 +350,10 @@ updateNetwork=15
addNicToVirtualMachine=15
removeNicFromVirtualMachine=15
updateDefaultNicForVirtualMachine=15
+addNicDetail=1
+updateNicDetail=1
+removeNicDetail=1
+listNicDetails=1
####
addIpToNic=15
@@ -433,8 +445,14 @@ deletePrivateGateway=1
#### Network ACL commands
createNetworkACL=15
+updateNetworkACLItem=15
deleteNetworkACL=15
listNetworkACLs=15
+createNetworkACLList=15
+deleteNetworkACLList=15
+replaceNetworkACLList=15
+listNetworkACLLists=15
+
#### Static route commands
createStaticRoute=15
@@ -446,6 +464,11 @@ createTags=15
deleteTags=15
listTags=15
+#### Meta Data commands
+addResourceDetail=1
+removeResourceDetail=1
+listResourceDetails=1
+
### Site-to-site VPN commands
createVpnCustomerGateway=15
createVpnGateway=15
@@ -583,9 +606,9 @@ listLoadBalancers=15
deleteLoadBalancer=15
#Internal Load Balancer Element commands
-configureInternalLoadBalancerElement=1
-createInternalLoadBalancerElement=1
-listInternalLoadBalancerElements=1
+configureInternalLoadBalancerElement=7
+createInternalLoadBalancerElement=7
+listInternalLoadBalancerElements=7
#### Affinity group commands
diff --git a/client/tomcatconf/componentContext.xml.in b/client/tomcatconf/componentContext.xml.in
index 8a45e5fea85..e946f448d90 100644
--- a/client/tomcatconf/componentContext.xml.in
+++ b/client/tomcatconf/componentContext.xml.in
@@ -156,6 +156,7 @@
+
diff --git a/core/src/com/cloud/agent/api/PlugNicCommand.java b/core/src/com/cloud/agent/api/PlugNicCommand.java
index b896e4540cb..d10c6808a59 100644
--- a/core/src/com/cloud/agent/api/PlugNicCommand.java
+++ b/core/src/com/cloud/agent/api/PlugNicCommand.java
@@ -17,11 +17,13 @@
package com.cloud.agent.api;
import com.cloud.agent.api.to.NicTO;
+import com.cloud.vm.VirtualMachine;
public class PlugNicCommand extends Command {
NicTO nic;
String instanceName;
+ VirtualMachine.Type vmType;
public NicTO getNic() {
return nic;
@@ -35,12 +37,17 @@ public class PlugNicCommand extends Command {
protected PlugNicCommand() {
}
- public PlugNicCommand(NicTO nic, String instanceName) {
+ public PlugNicCommand(NicTO nic, String instanceName, VirtualMachine.Type vmtype) {
this.nic = nic;
this.instanceName = instanceName;
+ this.vmType = vmtype;
}
public String getVmName() {
return instanceName;
}
+
+ public VirtualMachine.Type getVMType() {
+ return vmType;
+ }
}
diff --git a/core/src/com/cloud/agent/api/routing/CreateIpAliasCommand.java b/core/src/com/cloud/agent/api/routing/CreateIpAliasCommand.java
new file mode 100644
index 00000000000..92486fb847c
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/CreateIpAliasCommand.java
@@ -0,0 +1,36 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+import java.util.List;
+public class CreateIpAliasCommand extends NetworkElementCommand {
+ String routerip;
+ List ipAliasTOs;
+
+
+ public CreateIpAliasCommand(String routerip, List ipAliasTOs){
+ this.routerip = routerip;
+ this.ipAliasTOs = ipAliasTOs;
+ }
+
+ public String getRouterip (){
+ return routerip;
+ }
+
+ public List getIpAliasList() {
+ return ipAliasTOs;
+ }
+}
diff --git a/core/src/com/cloud/agent/api/routing/DeleteIpAliasCommand.java b/core/src/com/cloud/agent/api/routing/DeleteIpAliasCommand.java
new file mode 100644
index 00000000000..612084ff5c0
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/DeleteIpAliasCommand.java
@@ -0,0 +1,50 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+
+
+
+
+import java.util.List;
+
+public class DeleteIpAliasCommand extends NetworkElementCommand {
+ String routerip;
+ List deleteIpAliasTOs;
+ List createIpAliasTos;
+
+
+ public DeleteIpAliasCommand( String routerip, List deleteIpAliasTOs, List createIpAliasTos){
+ this.routerip = routerip;
+ this.deleteIpAliasTOs = deleteIpAliasTOs;
+ this.createIpAliasTos = createIpAliasTos;
+
+ }
+
+ public String getRouterip (){
+ return routerip;
+ }
+
+ public List getDeleteIpAliasTos() {
+ return deleteIpAliasTOs;
+ }
+
+ public List getCreateIpAliasTos() {
+ return createIpAliasTos;
+ }
+
+}
diff --git a/core/src/com/cloud/agent/api/routing/DnsMasqConfigCommand.java b/core/src/com/cloud/agent/api/routing/DnsMasqConfigCommand.java
new file mode 100644
index 00000000000..a52af90fb10
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/DnsMasqConfigCommand.java
@@ -0,0 +1,65 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+import com.cloud.agent.api.to.DnsmasqTO;
+
+import java.util.List;
+
+public class DnsMasqConfigCommand extends NetworkElementCommand {
+ String domain;
+ String dns1;
+ String dns2;
+ String internal_dns1;
+ String internal_dns2;
+ List dnsmasqTOs;
+
+ public DnsMasqConfigCommand(String domain, List dnsmasqTOs, String dns1, String dns2, String internal_dns1, String internal_dns2) {
+ this.domain = domain;
+ this.dnsmasqTOs = dnsmasqTOs;
+ this.dns1= dns1;
+ this.dns2= dns2;
+ this.internal_dns1 = internal_dns1;
+ this.internal_dns2 = internal_dns2;
+
+ }
+
+ public List getIps() {
+ return dnsmasqTOs;
+ }
+
+ public String getDomain() {
+ return domain;
+ }
+
+ public String getDns1() {
+ return dns1;
+ }
+
+ public String getDns2() {
+ return dns2;
+ }
+
+ public String getInternal_dns1() {
+ return internal_dns1;
+ }
+
+ public String getInternal_dns2() {
+ return internal_dns2;
+ }
+
+}
diff --git a/core/src/com/cloud/agent/api/routing/IpAliasTO.java b/core/src/com/cloud/agent/api/routing/IpAliasTO.java
new file mode 100644
index 00000000000..26a545deff9
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/IpAliasTO.java
@@ -0,0 +1,42 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+
+public class IpAliasTO {
+ String routerip;
+ String netmask;
+ String alias_count;
+
+ public IpAliasTO(String routerip, String netmask, String alias_count) {
+ this.routerip = routerip;
+ this.netmask = netmask;
+ this.alias_count = alias_count;
+ }
+
+ public String getRouterip() {
+ return routerip;
+ }
+
+ public String getNetmask() {
+ return netmask;
+ }
+
+ public String getAlias_count() {
+ return alias_count;
+ }
+}
diff --git a/core/src/com/cloud/agent/api/routing/NetworkElementCommand.java b/core/src/com/cloud/agent/api/routing/NetworkElementCommand.java
index 41ae80fe223..ddb7ac87386 100644
--- a/core/src/com/cloud/agent/api/routing/NetworkElementCommand.java
+++ b/core/src/com/cloud/agent/api/routing/NetworkElementCommand.java
@@ -32,6 +32,8 @@ public abstract class NetworkElementCommand extends Command {
public static final String ROUTER_GUEST_IP = "router.guest.ip";
public static final String ZONE_NETWORK_TYPE = "zone.network.type";
public static final String GUEST_BRIDGE = "guest.bridge";
+ public static final String VPC_PRIVATE_GATEWAY = "vpc.gateway.private";
+
protected NetworkElementCommand() {
super();
diff --git a/core/src/com/cloud/agent/api/routing/SetNetworkACLCommand.java b/core/src/com/cloud/agent/api/routing/SetNetworkACLCommand.java
index dba7354c8f2..d876c61fb4b 100644
--- a/core/src/com/cloud/agent/api/routing/SetNetworkACLCommand.java
+++ b/core/src/com/cloud/agent/api/routing/SetNetworkACLCommand.java
@@ -17,6 +17,9 @@
package com.cloud.agent.api.routing;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -42,11 +45,17 @@ public class SetNetworkACLCommand extends NetworkElementCommand{
public String[][] generateFwRules() {
String [][] result = new String [2][];
Set toAdd = new HashSet();
+ List aclList = Arrays.asList(rules);
+ Collections.sort(aclList, new Comparator() {
+ @Override
+ public int compare(NetworkACLTO acl1, NetworkACLTO acl2) {
+ return acl1.getNumber() > acl2.getNumber() ? 1 : -1;
+ }
+ });
-
- for (NetworkACLTO aclTO: rules) {
- /* example : Ingress:tcp:80:80:0.0.0.0/0:,Egress:tcp:220:220:0.0.0.0/0:,
- * each entry format Ingress/Egress:protocol:start port: end port:scidrs:
+ for (NetworkACLTO aclTO: aclList) {
+ /* example : Ingress:tcp:80:80:0.0.0.0/0:ACCEPT:,Egress:tcp:220:220:0.0.0.0/0:DROP:,
+ * each entry format Ingress/Egress:protocol:start port: end port:scidrs:action:
* reverted entry format Ingress/Egress:reverted:0:0:0:
*/
if (aclTO.revoked() == true)
@@ -80,7 +89,7 @@ public class SetNetworkACLCommand extends NetworkElementCommand{
firstEntry = false;
}
}
- sb.append(":");
+ sb.append(":").append(aclTO.getAction()).append(":");
String aclRuleEntry = sb.toString();
toAdd.add(aclRuleEntry);
diff --git a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
index b9bda4d9688..8b996d1bfed 100755
--- a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
+++ b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
@@ -16,28 +16,6 @@
// under the License.
package com.cloud.agent.resource.virtualnetwork;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.net.InetSocketAddress;
-import java.net.URL;
-import java.net.URLConnection;
-import java.nio.channels.SocketChannel;
-import java.util.List;
-import java.util.Map;
-
-import javax.ejb.Local;
-import javax.naming.ConfigurationException;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.log4j.Logger;
-
import com.cloud.agent.api.Answer;
import com.cloud.agent.api.BumpUpPriorityCommand;
import com.cloud.agent.api.CheckRouterAnswer;
@@ -50,7 +28,11 @@ import com.cloud.agent.api.GetDomRVersionCmd;
import com.cloud.agent.api.proxy.CheckConsoleProxyLoadCommand;
import com.cloud.agent.api.proxy.ConsoleProxyLoadAnswer;
import com.cloud.agent.api.proxy.WatchConsoleProxyLoadCommand;
+import com.cloud.agent.api.routing.CreateIpAliasCommand;
+import com.cloud.agent.api.routing.DeleteIpAliasCommand;
import com.cloud.agent.api.routing.DhcpEntryCommand;
+import com.cloud.agent.api.routing.DnsMasqConfigCommand;
+import com.cloud.agent.api.routing.IpAliasTO;
import com.cloud.agent.api.routing.IpAssocAnswer;
import com.cloud.agent.api.routing.IpAssocCommand;
import com.cloud.agent.api.routing.LoadBalancerConfigCommand;
@@ -74,6 +56,7 @@ import com.cloud.agent.api.to.IpAddressTO;
import com.cloud.agent.api.to.PortForwardingRuleTO;
import com.cloud.agent.api.to.StaticNatRuleTO;
import com.cloud.exception.InternalErrorException;
+import com.cloud.network.DnsMasqConfigurator;
import com.cloud.network.HAProxyConfigurator;
import com.cloud.network.LoadBalancerConfigurator;
import com.cloud.network.rules.FirewallRule;
@@ -84,6 +67,26 @@ import com.cloud.utils.net.NetUtils;
import com.cloud.utils.script.OutputInterpreter;
import com.cloud.utils.script.Script;
import com.cloud.utils.ssh.SshHelper;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.log4j.Logger;
+
+import javax.ejb.Local;
+import javax.naming.ConfigurationException;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.net.InetSocketAddress;
+import java.net.URL;
+import java.net.URLConnection;
+import java.nio.channels.SocketChannel;
+import java.util.List;
+import java.util.Map;
/**
* VirtualNetworkResource controls and configures virtual networking
@@ -106,6 +109,9 @@ public class VirtualRoutingResource implements Manager {
private String _privateEthIf;
private String _bumpUpPriorityPath;
private String _routerProxyPath;
+ private String _createIpAliasPath;
+ private String _deleteIpAliasPath;
+ private String _configDhcpPath;
private int _timeout;
private int _startTimeout;
@@ -137,6 +143,12 @@ public class VirtualRoutingResource implements Manager {
return execute((SavePasswordCommand)cmd);
} else if (cmd instanceof DhcpEntryCommand) {
return execute((DhcpEntryCommand)cmd);
+ } else if (cmd instanceof CreateIpAliasCommand) {
+ return execute((CreateIpAliasCommand) cmd);
+ } else if (cmd instanceof DnsMasqConfigCommand) {
+ return execute((DnsMasqConfigCommand) cmd);
+ } else if (cmd instanceof DeleteIpAliasCommand) {
+ return execute((DeleteIpAliasCommand) cmd);
} else if (cmd instanceof VmDataCommand) {
return execute ((VmDataCommand)cmd);
} else if (cmd instanceof CheckRouterCommand) {
@@ -609,6 +621,67 @@ public class VirtualRoutingResource implements Manager {
return new Answer(cmd, result==null, result);
}
+ protected Answer execute(final CreateIpAliasCommand cmd) {
+ String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
+ final Script command = new Script(_createIpAliasPath, _timeout, s_logger);
+ List ipAliasTOs = cmd.getIpAliasList();
+ String args=routerIp+" ";
+ for (IpAliasTO ipaliasto : ipAliasTOs) {
+ args = args + ipaliasto.getAlias_count()+":"+ipaliasto.getRouterip()+":"+ipaliasto.getNetmask()+"-";
+ }
+ command.add(args);
+ final String result = command.execute();
+ return new Answer(cmd, result==null, result);
+ }
+
+ protected Answer execute(final DeleteIpAliasCommand cmd) {
+ final Script command = new Script(_deleteIpAliasPath, _timeout, s_logger);
+ String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
+ String args = "";
+ List revokedIpAliasTOs = cmd.getDeleteIpAliasTos();
+ for (IpAliasTO ipAliasTO : revokedIpAliasTOs) {
+ args = args + ipAliasTO.getAlias_count()+":"+ipAliasTO.getRouterip()+":"+ipAliasTO.getNetmask()+"-";
+ }
+ args = args + " " ;
+ List activeIpAliasTOs = cmd.getCreateIpAliasTos();
+ for (IpAliasTO ipAliasTO : activeIpAliasTOs) {
+ args = args + ipAliasTO.getAlias_count()+":"+ipAliasTO.getRouterip()+":"+ipAliasTO.getNetmask()+"-";
+ }
+ command.add(args);
+ final String result = command.execute();
+ return new Answer(cmd, result==null, result);
+ }
+
+ protected Answer execute(final DnsMasqConfigCommand cmd) {
+ final Script command = new Script(_configDhcpPath, _timeout, s_logger);
+ String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
+ DnsMasqConfigurator configurator = new DnsMasqConfigurator();
+ String [] config = configurator.generateConfiguration(cmd);
+ File tmpCfgFile = null;
+ try {
+ String cfgFilePath = "";
+ if (routerIp != null) {
+ tmpCfgFile = File.createTempFile(routerIp.replace('.', '_'), "cfg");
+ final PrintWriter out
+ = new PrintWriter(new BufferedWriter(new FileWriter(tmpCfgFile)));
+ for (int i=0; i < config.length; i++) {
+ out.println(config[i]);
+ }
+ out.close();
+ cfgFilePath = tmpCfgFile.getAbsolutePath();
+ }
+ command.add(cfgFilePath);
+ final String result = command.execute();
+ return new Answer(cmd, result == null, result);
+ } catch (final IOException e) {
+ return new Answer(cmd, false, e.getMessage());
+ } finally {
+ if (tmpCfgFile != null) {
+ tmpCfgFile.delete();
+ }
+ }
+ }
+
public String getRouterStatus(String routerIP) {
return routerProxyWithParser("checkrouter.sh", routerIP, null);
}
@@ -819,12 +892,17 @@ public class VirtualRoutingResource implements Manager {
}
public String assignNetworkACL(final String routerIP, final String dev,
- final String routerGIP, final String netmask, final String rule){
+ final String routerGIP, final String netmask, final String rule, String privateGw){
String args = " -d " + dev;
- args += " -i " + routerGIP;
- args += " -m " + netmask;
- args += " -a " + rule;
- return routerProxy("vpc_acl.sh", routerIP, args);
+ if (privateGw != null) {
+ args += " -a " + rule;
+ return routerProxy("vpc_privategw_acl.sh", routerIP, args);
+ } else {
+ args += " -i " + routerGIP;
+ args += " -m " + netmask;
+ args += " -a " + rule;
+ return routerProxy("vpc_acl.sh", routerIP, args);
+ }
}
public String assignSourceNat(final String routerIP, final String pubIP, final String dev) {
diff --git a/core/src/com/cloud/network/DnsMasqConfigurator.java b/core/src/com/cloud/network/DnsMasqConfigurator.java
new file mode 100644
index 00000000000..bbf721d5509
--- /dev/null
+++ b/core/src/com/cloud/network/DnsMasqConfigurator.java
@@ -0,0 +1,118 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.network;
+
+import com.cloud.agent.api.routing.DnsMasqConfigCommand;
+import com.cloud.agent.api.to.DnsmasqTO;
+import org.apache.log4j.Logger;
+
+import java.util.Arrays;
+import java.util.List;
+
+
+
+ public class DnsMasqConfigurator {
+
+ private static final Logger s_logger = Logger.getLogger(DnsMasqConfigurator.class);
+ private static String[] Dnsmasq_config = {"# Never forward plain names (without a dot or domain part) \ndomain-needed\n",
+ "# Never forward addresses in the non-routed address spaces. \nbogus-priv\n",
+ "# Uncomment this to filter useless windows-originated DNS requests # which can trigger dial-on-demand links needlessly. \n # Note that (amongst other things) this blocks all SRV requests, # so don't use it if you use eg Kerberos, SIP, XMMP or Google-talk.# This option only affects forwarding, SRV records originating for # dnsmasq (via srv-host= lines) are not suppressed by it. \nfilterwin2k\n",
+ "# Change this line if you want dns to get its upstream servers from# somewhere other that /etc/resolv.conf \nresolv-file=/etc/dnsmasq-resolv.conf\n",
+ "# Add local-only domains here, queries in these domains are answered\n # from /etc/hosts or DHCP only.\n local=/cs1cloud.internal/",
+ "# If you want dnsmasq to listen for DHCP and DNS requests only on\n #specified interfaces (and the loopback) give the name of the\n# interface (eg eth0) here.\n# Repeat the line for more than one interface.\ninterface=eth0\n",
+ "# Or you can specify which interface _not_ to listen on\nexcept-interface=eth1\nexcept-interface=eth2\nexcept-interface=lo\n",
+ "# Or which to listen on by address (remember to include 127.0.0.1 if\n# you use this.)\n#listen-address=?\n",
+ "# If you want dnsmasq to provide only DNS service on an interface,\n# configure it as shown above, and then use the following line to\n#disable DHCP and TFTP on it.\nno-dhcp-interface=eth1\nno-dhcp-interface=eth2\n",
+ "# On systems which support it, dnsmasq binds the wildcard address,\n" +
+ "# even when it is listening on only some interfaces. It then discards\n" +
+ "# requests that it shouldn't reply to. This has the advantage of\n" +
+ "# working even when interfaces come and go and change address. If you\n" +
+ "# want dnsmasq to really bind only the interfaces it is listening on,\n" +
+ "# uncomment this option. About the only time you may need this is when\n" +
+ "# running another nameserver on the same machine.\n" +
+ "bind-interfaces\n",
+ "# Set this (and domain: see below) if you want to have a domain\n" +
+ "# automatically added to simple names in a hosts-file.\n" +
+ "expand-hosts\n",
+ "# Set the domain for dnsmasq. this is optional, but if it is set, it\n" +
+ "# does the following things.\n" +
+ "# 1) Allows DHCP hosts to have fully qualified domain names, as long\n" +
+ "# as the domain part matches this setting.\n" +
+ "# 2) Sets the \"domain\" DHCP option thereby potentially setting the\n" +
+ "# domain of all systems configured by DHCP\n" +
+ "# 3) Provides the domain part for \"expand-hosts\"\n",
+ "domain=cs1cloud.internal\n",
+ "# Set a different domain for a particular subnet\n",
+ "domain=cs1cloud.internal\n",
+ "# Same idea, but range rather then subnet\n",
+ "domain=cs1cloud.internal\n",
+ "# Uncomment this to enable the integrated DHCP server, you need\n" +
+ "# to supply the range of addresses available for lease and optionally\n" +
+ "# a lease time. If you have more than one network, you will need to\n" +
+ "# repeat this for each network on which you want to supply DHCP\n" +
+ "# service.\n",
+ "dhcp-range=set:net1,ipaddress,static\n",
+ "dhcp-hostsfile=/etc/dhcphosts.txt\n",
+ "log-facility=/var/log/dnsmasq.log\n",
+ "conf-dir=/etc/dnsmasq.d\n",
+ "dhcp-option=tag:net1,3,ipaddress\n",
+ "dhcp-option=tag:net1,1,netmask\n",
+ "dhcp-option=6,10.147.28.149,8.8.8.8\n",
+ "dhcp-optsfile=/etc/dhcpopts.txt\n",
+
+
+ };
+
+ public String[] generateConfiguration(DnsMasqConfigCommand dnsMasqconfigcmd) {
+ List dnsmasqTOs = dnsMasqconfigcmd.getIps();
+ List dnsMasqconf = Arrays.asList(Dnsmasq_config);
+ String range="";
+ String gateway="";
+ String netmask="";
+ String domain= dnsMasqconfigcmd.getDomain();
+ String dnsServers="";
+ int i=0;
+ for (; i< dnsmasqTOs.size(); i++) {
+ range=range + "dhcp-range=set:range"+i+","+dnsmasqTOs.get(i).getRouterIp()+",static\n";
+ gateway=gateway +"dhcp-option=tag:range"+i+",3,"+dnsmasqTOs.get(i).getGateway()+"\n";
+ netmask=netmask +"dhcp-option=tag:range"+i+",1,"+dnsmasqTOs.get(i).getNetmask()+"\n";
+ }
+ dnsMasqconf.set(12, "domain="+domain+"\n");
+ dnsMasqconf.set(14, "domain="+domain+"\n");
+ dnsMasqconf.set(16,"domain="+domain+"\n");
+ dnsMasqconf.set(18, range);
+ dnsMasqconf.set(22, gateway);
+ dnsMasqconf.set(23, netmask);
+ if (dnsMasqconfigcmd.getInternal_dns1() != null) {
+ dnsServers = dnsServers+dnsMasqconfigcmd.getInternal_dns1()+",";
+ }
+ if (dnsMasqconfigcmd.getInternal_dns2() != null) {
+ dnsServers = dnsServers+dnsMasqconfigcmd.getInternal_dns2()+",";
+ }
+ if (dnsMasqconfigcmd.getDns1() != null) {
+ dnsServers = dnsServers+dnsMasqconfigcmd.getDns1()+",";
+ }
+ if (dnsMasqconfigcmd.getDns2() != null) {
+ dnsServers = dnsServers+dnsMasqconfigcmd.getDns2()+",";
+ }
+ dnsServers = dnsServers +"*";
+ dnsServers = dnsServers.replace(";*", "");
+ dnsMasqconf.set(24,"dhcp-option=6,"+dnsServers);
+ return dnsMasqconf.toArray( new String[dnsMasqconf.size()]);
+ }
+
+ }
diff --git a/core/src/com/cloud/storage/VolumeDetailVO.java b/core/src/com/cloud/storage/VolumeDetailVO.java
new file mode 100644
index 00000000000..b0c8c1dbf35
--- /dev/null
+++ b/core/src/com/cloud/storage/VolumeDetailVO.java
@@ -0,0 +1,85 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.storage;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="volume_details")
+public class VolumeDetailVO implements InternalIdentity {
+ @Id
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
+ @Column(name="id")
+ private long id;
+
+ @Column(name="volume_id")
+ private long volumeId;
+
+ @Column(name="name")
+ private String name;
+
+ @Column(name="value", length=1024)
+ private String value;
+
+ public VolumeDetailVO() {}
+
+ public VolumeDetailVO(long volumeId, String name, String value) {
+ this.volumeId = volumeId;
+ this.name = name;
+ this.value = value;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public long getVolumeId() {
+ return volumeId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public void setVolumeId(long volumeId) {
+ this.volumeId = volumeId;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+}
diff --git a/debian/changelog b/debian/changelog
index f56dbd820d4..6e90eb33e89 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+cloudstack (4.2.0) unstable; urgency=low
+
+ * Update the version to 4.2.0 to be in sync with Maven (again)
+
+ -- Wido den Hollander Tue, 14 May 2013 15:56:42 +0200
+
cloudstack (4.2.0-incubating-0.0.snapshot) unstable; urgency=low
* Update the version to 4.2.0 to be in sync with Maven
diff --git a/debian/rules b/debian/rules
index c5875e75c99..ff12154db31 100755
--- a/debian/rules
+++ b/debian/rules
@@ -157,7 +157,7 @@ install:
install -D awsapi-setup/setup/cloud-setup-bridge $(DESTDIR)/usr/bin/cloudstack-setup-bridge
install -D awsapi-setup/setup/cloudstack-aws-api-register $(DESTDIR)/usr/bin/cloudstack-aws-api-register
cp -r awsapi-setup/db/mysql/* $(DESTDIR)/usr/share/$(PACKAGE)-bridge/setup
- for i in applicationContext.xml cloud-bridge.properties commons-logging.properties crypto.properties xes.keystore ec2-service.properties; do \
+ for i in cloud-bridge.properties commons-logging.properties crypto.properties xes.keystore ec2-service.properties; do \
mv $(DESTDIR)/usr/share/$(PACKAGE)-bridge/webapps/awsapi/WEB-INF/classes/$$i $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/management/; \
done
rm $(DESTDIR)/usr/share/$(PACKAGE)-bridge/webapps/awsapi/WEB-INF/classes/log4j-vmops.xml
diff --git a/docs/en-US/Installation_Guide.xml b/docs/en-US/Installation_Guide.xml
index e6a80318611..ea97f25c99c 100644
--- a/docs/en-US/Installation_Guide.xml
+++ b/docs/en-US/Installation_Guide.xml
@@ -55,6 +55,7 @@
+
diff --git a/docs/en-US/build-rpm.xml b/docs/en-US/build-rpm.xml
index ba32ef568ab..7caf924bfe4 100644
--- a/docs/en-US/build-rpm.xml
+++ b/docs/en-US/build-rpm.xml
@@ -26,7 +26,7 @@ under the License.
Building RPMs from Source
As mentioned previously in , you will need to install several prerequisites before you can build packages for &PRODUCT;. Here we'll assume you're working with a 64-bit build of CentOS or Red Hat Enterprise Linux.
# yum groupinstall "Development Tools"
- # yum install java-1.6.0-openjdk-devel.x86_64 genisoimage mysql mysql-server ws-common-utils MySQL-python tomcat6 createrepo
+ # yum install java-1.6.0-openjdk-devel.x86_64 genisoimage mysql mysql-server ws-commons-util MySQL-python tomcat6 createrepo
Next, you'll need to install build-time dependencies for CloudStack with
Maven. We're using Maven 3, so you'll want to
grab a Maven 3 tarball
@@ -41,9 +41,9 @@ under the License.
You probably want to ensure that your environment variables will survive a logout/reboot.
Be sure to update ~/.bashrc with the PATH and JAVA_HOME variables.
- Building RPMs for $PRODUCT; is fairly simple. Assuming you already have the source downloaded and have uncompressed the tarball into a local directory, you're going to be able to generate packages in just a few minutes.
+ Building RPMs for &PRODUCT; is fairly simple. Assuming you already have the source downloaded and have uncompressed the tarball into a local directory, you're going to be able to generate packages in just a few minutes.
Packaging has Changed
- If you've created packages for $PRODUCT; previously, you should be aware that the process has changed considerably since the project has moved to using Apache Maven. Please be sure to follow the steps in this section closely.
+ If you've created packages for &PRODUCT; previously, you should be aware that the process has changed considerably since the project has moved to using Apache Maven. Please be sure to follow the steps in this section closely.
Generating RPMS
@@ -69,7 +69,7 @@ under the License.
Configuring your systems to use your new yum repository
Now that your yum repository is populated with RPMs and metadata
- we need to configure the machines that need to install $PRODUCT;.
+ we need to configure the machines that need to install &PRODUCT;.
Create a file named /etc/yum.repos.d/cloudstack.repo with this information:
[apache-cloudstack]
@@ -79,7 +79,7 @@ under the License.
gpgcheck=0
- Completing this step will allow you to easily install $PRODUCT; on a number of machines across the network.
+ Completing this step will allow you to easily install &PRODUCT; on a number of machines across the network.
diff --git a/docs/en-US/delete-event-alerts.xml b/docs/en-US/delete-event-alerts.xml
index ef39040c102..5958b721940 100644
--- a/docs/en-US/delete-event-alerts.xml
+++ b/docs/en-US/delete-event-alerts.xml
@@ -27,7 +27,10 @@
You can delete or archive individual alerts or events either directly by using the Quickview
or by using the Details page. If you want to delete multiple alerts or events at the same time,
you can use the respective context menu. You can delete alerts or events by category for a time
- period.
+ period. For example, you can select categories such as USER.LOGOUT, VM.DESTROY, VM.AG.UPDATE, CONFIGURATION.VALUE.EDI, and so on.
+ You can also view the number of events or alerts archived or deleted.
In order to support the delete or archive alerts, the following global parameters have been
added:
diff --git a/docs/en-US/deployment-architecture-overview.xml b/docs/en-US/deployment-architecture-overview.xml
index e3103c52c1c..835898ced7f 100644
--- a/docs/en-US/deployment-architecture-overview.xml
+++ b/docs/en-US/deployment-architecture-overview.xml
@@ -49,7 +49,7 @@
multi-node Management Server installation and up to tens of thousands of
hosts using any of several advanced networking setups. For
information about deployment options, see the "Choosing a Deployment Architecture"
- section of the $PRODUCT; Installation Guide.
+ section of the &PRODUCT; Installation Guide.
diff --git a/docs/en-US/elastic-ip.xml b/docs/en-US/elastic-ip.xml
index 8ecbd75be70..672fc5aef0c 100644
--- a/docs/en-US/elastic-ip.xml
+++ b/docs/en-US/elastic-ip.xml
@@ -26,78 +26,91 @@
choice from the EIP pool of your account. Later if required you can reassign the IP address to a
different VM. This feature is extremely helpful during VM failure. Instead of replacing the VM
which is down, the IP address can be reassigned to a new VM in your account.
- Similar to the public IP address, Elastic IP addresses are mapped to their associated
- private IP addresses by using StaticNAT. The EIP service is equipped with StaticNAT (1:1)
- service in an EIP-enabled basic zone. The default network offering,
- DefaultSharedNetscalerEIPandELBNetworkOffering, provides your network with EIP and ELB network
- services if a NetScaler device is deployed in your zone. Consider the following illustration for
- more details.
-
-
-
-
-
- eip-ns-basiczone.png: Elastic IP in a NetScaler-enabled Basic Zone.
-
-
- In the illustration, a NetScaler appliance is the default entry or exit point for the
- &PRODUCT; instances, and firewall is the default entry or exit point for the rest of the data
- center. Netscaler provides LB services and staticNAT service to the guest networks. The guest
- traffic in the pods and the Management Server are on different subnets / VLANs. The policy-based
- routing in the data center core switch sends the public traffic through the NetScaler, whereas
- the rest of the data center goes through the firewall.
- The EIP work flow is as follows:
-
-
- When a user VM is deployed, a public IP is automatically acquired from the pool of
- public IPs configured in the zone. This IP is owned by the VM's account.
-
-
- Each VM will have its own private IP. When the user VM starts, Static NAT is provisioned
- on the NetScaler device by using the Inbound Network Address Translation (INAT) and Reverse
- NAT (RNAT) rules between the public IP and the private IP.
-
- Inbound NAT (INAT) is a type of NAT supported by NetScaler, in which the destination
- IP address is replaced in the packets from the public network, such as the Internet, with
- the private IP address of a VM in the private network. Reverse NAT (RNAT) is a type of NAT
- supported by NetScaler, in which the source IP address is replaced in the packets
- generated by a VM in the private network with the public IP address.
-
-
-
- This default public IP will be released in two cases:
-
-
- When the VM is stopped. When the VM starts, it again receives a new public IP, not
- necessarily the same one allocated initially, from the pool of Public IPs.
-
-
- The user acquires a public IP (Elastic IP). This public IP is associated with the
- account, but will not be mapped to any private IP. However, the user can enable Static
- NAT to associate this IP to the private IP of a VM in the account. The Static NAT rule
- for the public IP can be disabled at any time. When Static NAT is disabled, a new public
- IP is allocated from the pool, which is not necessarily be the same one allocated
- initially.
-
-
-
-
- For the deployments where public IPs are limited resources, you have the flexibility to
- choose not to allocate a public IP by default. You can use the Associate Public IP option to
- turn on or off the automatic public IP assignment in the EIP-enabled Basic zones. If you turn
- off the automatic public IP assignment while creating a network offering, only a private IP is
- assigned to a VM when the VM is deployed with that network offering. Later, the user can acquire
- an IP for the VM and enable static NAT.
- For more information on the Associate Public IP option, see .
- For more information on the Associate Public IP option, see the
- Administration Guide.
-
- The Associate Public IP feature is designed only for use with user VMs. The System VMs
- continue to get both public IP and private by default, irrespective of the network offering
- configuration.
-
- New deployments which use the default shared network offering with EIP and ELB services to
- create a shared network in the Basic zone will continue allocating public IPs to each user
- VM.
+
+ Elastic IPs in Basic Zone
+ Similar to the public IP address, Elastic IP addresses are mapped to their associated
+ private IP addresses by using StaticNAT. The EIP service is equipped with StaticNAT (1:1)
+ service in an EIP-enabled basic zone. The default network offering,
+ DefaultSharedNetscalerEIPandELBNetworkOffering, provides your network with EIP and ELB network
+ services if a NetScaler device is deployed in your zone. Consider the following illustration
+ for more details.
+
+
+
+
+
+ eip-ns-basiczone.png: Elastic IP in a NetScaler-enabled Basic Zone.
+
+
+ In the illustration, a NetScaler appliance is the default entry or exit point for the
+ &PRODUCT; instances, and firewall is the default entry or exit point for the rest of the data
+ center. Netscaler provides LB services and staticNAT service to the guest networks. The guest
+ traffic in the pods and the Management Server are on different subnets / VLANs. The
+ policy-based routing in the data center core switch sends the public traffic through the
+ NetScaler, whereas the rest of the data center goes through the firewall.
+ The EIP work flow is as follows:
+
+
+ When a user VM is deployed, a public IP is automatically acquired from the pool of
+ public IPs configured in the zone. This IP is owned by the VM's account.
+
+
+ Each VM will have its own private IP. When the user VM starts, Static NAT is
+ provisioned on the NetScaler device by using the Inbound Network Address Translation
+ (INAT) and Reverse NAT (RNAT) rules between the public IP and the private IP.
+
+ Inbound NAT (INAT) is a type of NAT supported by NetScaler, in which the destination
+ IP address is replaced in the packets from the public network, such as the Internet,
+ with the private IP address of a VM in the private network. Reverse NAT (RNAT) is a type
+ of NAT supported by NetScaler, in which the source IP address is replaced in the packets
+ generated by a VM in the private network with the public IP address.
+
+
+
+ This default public IP will be released in two cases:
+
+
+ When the VM is stopped. When the VM starts, it again receives a new public IP, not
+ necessarily the same one allocated initially, from the pool of Public IPs.
+
+
+ The user acquires a public IP (Elastic IP). This public IP is associated with the
+ account, but will not be mapped to any private IP. However, the user can enable Static
+ NAT to associate this IP to the private IP of a VM in the account. The Static NAT rule
+ for the public IP can be disabled at any time. When Static NAT is disabled, a new
+ public IP is allocated from the pool, which is not necessarily be the same one
+ allocated initially.
+
+
+
+
+ For the deployments where public IPs are limited resources, you have the flexibility to
+ choose not to allocate a public IP by default. You can use the Associate Public IP option to
+ turn on or off the automatic public IP assignment in the EIP-enabled Basic zones. If you turn
+ off the automatic public IP assignment while creating a network offering, only a private IP is
+ assigned to a VM when the VM is deployed with that network offering. Later, the user can
+ acquire an IP for the VM and enable static NAT.
+ For more information on the Associate Public IP option, see .
+ For more information on the Associate Public IP option, see the
+ Administration Guide.
+
+ The Associate Public IP feature is designed only for use with user VMs. The System VMs
+ continue to get both public IP and private by default, irrespective of the network offering
+ configuration.
+
+ New deployments which use the default shared network offering with EIP and ELB services to
+ create a shared network in the Basic zone will continue allocating public IPs to each user
+ VM.
+
+
+ About Portable IP
+ Portable IPs in &PRODUCT; are nothing but elastic IPs that can be transferred across
+ geographically separated zones. As an administrator, you can provision a pool of portable IPs
+ at region level and are available for user consumption. The users can acquire portable IPs if
+ admin has provisioned portable public IPs at the region level they are part of. These IPs can
+ be use for any service within an advanced zone. You can also use portable IPs for EIP service
+ in basic zones. Additionally, a portable IP can be transferred from one network to another
+ network.
+
diff --git a/docs/en-US/event-framework.xml b/docs/en-US/event-framework.xml
index 88c45c9033d..0f62fac1407 100644
--- a/docs/en-US/event-framework.xml
+++ b/docs/en-US/event-framework.xml
@@ -24,7 +24,7 @@
Event notification framework provides a means for the Management Server components to
publish and subscribe to &PRODUCT; events. Event notification is achieved by implementing the
concept of event bus abstraction in the Management Server. An event bus is introduced in the
- Management Server that allows the &PRODUCT;components and extension plug-ins to subscribe to the
+ Management Server that allows the &PRODUCT; components and extension plug-ins to subscribe to the
events by using the Advanced Message Queuing Protocol (AMQP) client. In &PRODUCT;, a default
implementation of event bus is provided as a plug-in that uses the RabbitMQ AMQP client. The
AMQP client pushes the published events to a compatible AMQP server. Therefore all the &PRODUCT;
diff --git a/docs/en-US/gslb.xml b/docs/en-US/gslb.xml
index 23033317381..968e8e2cefa 100644
--- a/docs/en-US/gslb.xml
+++ b/docs/en-US/gslb.xml
@@ -45,7 +45,7 @@
A typical GSLB environment is comprised of the following components:
- GSLB Site: In &PRODUCT;terminology, GSLB sites are
+ GSLB Site: In &PRODUCT; terminology, GSLB sites are
represented by zones that are mapped to data centers, each of which has various network
appliances. Each GSLB site is managed by a NetScaler appliance that is local to that
site. Each of these appliances treats its own site as the local site and all other
@@ -157,29 +157,15 @@
Configuring GSLB
- A GSLB deployment is the logical collection of GSLB virtual server, GSLB service, LB
- virtual server, service, domain, and ADNS service. To create a GSLB site, you must configure
- load balancing in the zone. You must create GSLB vservers and GSLB services for each site. You
- must bind GSLB services to GSLB vservers. You must then create an ADNS service that provides
- the IP address of the best performing site to the client's request. A GSLB vserver is an
- entity that performs load balancing for the domains bound to it by returning the IP address of
- the best GSLB service. A GSLB service is a representation of the load balancing/content
- switching vserver. An LB vserver load balances incoming traffic by identifying the best
- server, then directs traffic to the corresponding service. It can also load-balance external
- DNS name servers. Services are entities that represent the servers. The domain is the domain
- name for which the system is the authoritative DNS server. By creating an ADNS service, the
- system can be configured as an authoritative DNS server.
- To configure GSLB in your cloud environment, as a cloud administrator you must perform the
- following.
- To configure such a GSLB setup, you must first configure a standard load balancing setup
+ To configure a GSLB deployment, you must first configure a standard load balancing setup
for each zone. This enables you to balance load across the different servers in each zone in
- the region. Then, configure both NetScaler appliances that you plan to add to each zone as
- authoritative DNS (ADNS) servers. Next, create a GSLB site for each zone, configure GSLB
- virtual servers for each site, create GLSB services, and bind the GSLB services to the GSLB
- virtual servers. Finally, bind the domain to the GSLB virtual servers. The GSLB configurations
- on the two appliances at the two different sites are identical, although each sites
- load-balancing configuration is specific to that site.
- Perform the following as a cloud administrator. As per the above example, the
+ the region. Then on the NetScaler side, configure both NetScaler appliances that you plan to
+ add to each zone as authoritative DNS (ADNS) servers. Next, create a GSLB site for each zone,
+ configure GSLB virtual servers for each site, create GLSB services, and bind the GSLB services
+ to the GSLB virtual servers. Finally, bind the domain to the GSLB virtual servers. The GSLB
+ configurations on the two appliances at the two different zones are identical, although each
+ sites load-balancing configuration is specific to that site.
+ Perform the following as a cloud administrator. As per the example given above, the
administrator of xyztelco is the one who sets up GSLB:
@@ -201,6 +187,9 @@
Configure a GSLB site with site name formed from the domain name details.
+ Configure a GSLB site with the site name formed from the domain name.
+ As per the example given above, the site names are A.xyztelco.com and
+ B.xyztelco.com.
For more information, see Configuring a Basic GSLB Site.
@@ -459,7 +448,6 @@
Assigning Load Balancing Rules to GSLB
-
Log in to the &PRODUCT; UI as a domain administrator or user.
@@ -491,7 +479,7 @@
-
+
Known Limitation
Currently, &PRODUCT; does not support orchestration of services across the zones. The
notion of services and service providers in region are to be introduced.
diff --git a/docs/en-US/host-add-xenserver-kvm-ovm.xml b/docs/en-US/host-add-xenserver-kvm-ovm.xml
index 1f13e72d4c3..6973dbd1cc2 100644
--- a/docs/en-US/host-add-xenserver-kvm-ovm.xml
+++ b/docs/en-US/host-add-xenserver-kvm-ovm.xml
@@ -98,7 +98,7 @@
Adding a XenServer or KVM Host
-
+
If you have not already done so, install the hypervisor software on the host. You will
need to know which version of the hypervisor software version is supported by &PRODUCT;
@@ -152,6 +152,6 @@
Repeat for additional hosts.
-
+
diff --git a/docs/en-US/ipv6-support.xml b/docs/en-US/ipv6-support.xml
index c7f7744393e..bc14c8eab0e 100644
--- a/docs/en-US/ipv6-support.xml
+++ b/docs/en-US/ipv6-support.xml
@@ -21,7 +21,7 @@
-->
IPv6 Support in &PRODUCT;
- &PRODUCT;supports Internet Protocol version 6 (IPv6), the recent version of the Internet
+ &PRODUCT; supports Internet Protocol version 6 (IPv6), the recent version of the Internet
Protocol (IP) that defines routing the network traffic. IPv6 uses a 128-bit address that
exponentially expands the current address space that is available to the users. IPv6 addresses
consist of eight groups of four hexadecimal digits separated by colons, for example,
diff --git a/docs/en-US/storage-setup.xml b/docs/en-US/storage-setup.xml
new file mode 100644
index 00000000000..dee2f4ccbd7
--- /dev/null
+++ b/docs/en-US/storage-setup.xml
@@ -0,0 +1,192 @@
+
+
+%BOOK_ENTITIES;
+]>
+
+
+ Storage Setup
+ &PRODUCT; is designed to work with a wide variety of commodity and enterprise-grade storage. Local disk may be used as well, if supported by the selected hypervisor. Storage type support for guest virtual disks differs based on hypervisor selection.
+
+
+
+
+
+ XenServer
+ vSphere
+ KVM
+
+
+
+
+ NFS
+ Supported
+ Supported
+ Supported
+
+
+ iSCSI
+ Supported
+ Supported via VMFS
+ Supported via Clustered Filesystems
+
+
+ Fiber Channel
+ Supported via Pre-existing SR
+ Supported
+ Supported via Clustered Filesystems
+
+
+ Local Disk
+ Supported
+ Supported
+ Supported
+
+
+
+
+ The use of the Cluster Logical Volume Manager (CLVM) for KVM is not officially supported with &PRODUCT;.
+
+ Small-Scale Setup
+ In a small-scale setup, a single NFS server can function as both primary and secondary storage. The NFS server just needs to export two separate shares, one for primary storage and the other for secondary storage.
+
+
+ Secondary Storage
+ &PRODUCT; is designed to work with any scalable secondary storage system. The only requirement is the secondary storage system supports the NFS protocol.
+
+ The storage server should be a machine with a large number of disks. The disks should ideally be managed by a hardware RAID controller. Modern hardware RAID controllers support hot plug functionality independent of the operating system so you can replace faulty disks without impacting the running operating system.
+
+
+
+ Example Configurations
+ In this section we go through a few examples of how to set up storage to work properly on a few types of NFS and iSCSI storage systems.
+
+ Linux NFS on Local Disks and DAS
+ This section describes how to configure an NFS export on a standard Linux installation. The exact commands might vary depending on the operating system version.
+
+ Install the RHEL/CentOS distribution on the storage server.
+ If the root volume is more than 2 TB in size, create a smaller boot volume to install RHEL/CentOS. A root volume of 20 GB should be sufficient.
+ After the system is installed, create a directory called /export. This can each be a directory in the root partition itself or a mount point for a large disk volume.
+ If you have more than 16TB of storage on one host, create multiple EXT3 file systems and multiple NFS exports. Individual EXT3 file systems cannot exceed 16TB.
+
+ After /export directory is created, run the following command to configure it as an NFS export.
+ # echo "/export <CIDR>(rw,async,no_root_squash)" >> /etc/exports
+ Adjust the above command to suit your deployment needs.
+
+
+ Limiting NFS export. It is highly recommended that you limit the NFS export to a particular subnet by specifying a subnet mask (e.g.,”192.168.1.0/24”). By allowing access from only within the expected cluster, you avoid having non-pool member mount the storage. The limit you place must include the management network(s) and the storage network(s). If the two are the same network then one CIDR is sufficient. If you have a separate storage network you must provide separate CIDR’s for both or one CIDR that is broad enough to span both.
+ The following is an example with separate CIDRs:
+ /export 192.168.1.0/24(rw,async,no_root_squash) 10.50.1.0/24(rw,async,no_root_squash)
+
+
+ Removing the async flag. The async flag improves performance by allowing the NFS server to respond before writes are committed to the disk. Remove the async flag in your mission critical production deployment.
+
+
+
+
+ Run the following command to enable NFS service.
+ # chkconfig nfs on
+
+
+ Edit the /etc/sysconfig/nfs file and uncomment the following lines.
+ LOCKD_TCPPORT=32803
+LOCKD_UDPPORT=32769
+MOUNTD_PORT=892
+RQUOTAD_PORT=875
+STATD_PORT=662
+STATD_OUTGOING_PORT=2020
+
+
+ Edit the /etc/sysconfig/iptables file and add the following lines at the beginning of the INPUT chain.
+
+-A INPUT -m state --state NEW -p udp --dport 111 -j ACCEPT
+-A INPUT -m state --state NEW -p tcp --dport 111 -j ACCEPT
+-A INPUT -m state --state NEW -p tcp --dport 2049 -j ACCEPT
+-A INPUT -m state --state NEW -p tcp --dport 32803 -j ACCEPT
+-A INPUT -m state --state NEW -p udp --dport 32769 -j ACCEPT
+-A INPUT -m state --state NEW -p tcp --dport 892 -j ACCEPT
+-A INPUT -m state --state NEW -p udp --dport 892 -j ACCEPT
+-A INPUT -m state --state NEW -p tcp --dport 875 -j ACCEPT
+-A INPUT -m state --state NEW -p udp --dport 875 -j ACCEPT
+-A INPUT -m state --state NEW -p tcp --dport 662 -j ACCEPT
+-A INPUT -m state --state NEW -p udp --dport 662 -j ACCEPT
+
+
+
+ Reboot the server.
+ An NFS share called /export is now set up.
+
+
+ When copying and pasting a command, be sure the command has pasted as a single line before executing. Some document viewers may introduce unwanted line breaks in copied text.
+
+
+ Linux NFS on iSCSI
+ Use the following steps to set up a Linux NFS server export on an iSCSI volume. These steps apply to RHEL/CentOS 5 distributions.
+
+
+ Install iscsiadm.
+
+# yum install iscsi-initiator-utils
+# service iscsi start
+# chkconfig --add iscsi
+# chkconfig iscsi on
+
+
+
+ Discover the iSCSI target.
+ # iscsiadm -m discovery -t st -p <iSCSI Server IP address>:3260
+ For example:
+ # iscsiadm -m discovery -t st -p 172.23.10.240:3260
+ 172.23.10.240:3260,1 iqn.2001-05.com.equallogic:0-8a0906-83bcb3401-16e0002fd0a46f3d-rhel5-test
+
+
+ Log in.
+ # iscsiadm -m node -T <Complete Target Name> -l -p <Group IP>:3260
+ For example:
+ # iscsiadm -m node -l -T iqn.2001-05.com.equallogic:83bcb3401-16e0002fd0a46f3d-rhel5-test -p 172.23.10.240:3260
+
+
+ Discover the SCSI disk. For example:
+
+# iscsiadm -m session -P3 | grep Attached
+Attached scsi disk sdb State: running
+
+
+
+ Format the disk as ext3 and mount the volume.
+ # mkfs.ext3 /dev/sdb
+# mkdir -p /export
+# mount /dev/sdb /export
+
+
+
+ Add the disk to /etc/fstab to make sure it gets mounted on boot.
+ /dev/sdb /export ext3 _netdev 0 0
+
+
+ Now you can set up /export as an NFS share.
+
+
+ Limiting NFS export. In order to avoid data loss, it is highly recommended that you limit the NFS export to a particular subnet by specifying a subnet mask (e.g.,”192.168.1.0/24”). By allowing access from only within the expected cluster, you avoid having non-pool member mount the storage and inadvertently delete all its data. The limit you place must include the management network(s) and the storage network(s). If the two are the same network then one CIDR is sufficient. If you have a separate storage network you must provide separate CIDRs for both or one CIDR that is broad enough to span both.
+ The following is an example with separate CIDRs:
+ /export 192.168.1.0/24(rw,async,no_root_squash) 10.50.1.0/24(rw,async,no_root_squash)
+
+ Removing the async flag. The async flag improves performance by allowing the NFS server to respond before writes are committed to the disk. Remove the async flag in your mission critical production deployment.
+
+
+
+
diff --git a/docs/en-US/vmware-cluster-config-dvswitch.xml b/docs/en-US/vmware-cluster-config-dvswitch.xml
index 3468c1bea4e..a3250f4f380 100644
--- a/docs/en-US/vmware-cluster-config-dvswitch.xml
+++ b/docs/en-US/vmware-cluster-config-dvswitch.xml
@@ -21,7 +21,7 @@
-->
Configuring a vSphere Cluster with VMware Distributed Virtual Switch
- &PRODUCT;supports VMware vNetwork Distributed Switch (VDS) for virtual network configuration
+ &PRODUCT; supports VMware vNetwork Distributed Switch (VDS) for virtual network configuration
in a VMware vSphere environment. This section helps you configure VMware VDS in a &PRODUCT;
deployment. Each vCenter server instance can support up to 128 VDS instances and each VDS
instance can manage up to 500 VMware hosts.
diff --git a/engine/components-api/src/com/cloud/network/NetworkManager.java b/engine/components-api/src/com/cloud/network/NetworkManager.java
index 3448320096f..98f2b679cd4 100755
--- a/engine/components-api/src/com/cloud/network/NetworkManager.java
+++ b/engine/components-api/src/com/cloud/network/NetworkManager.java
@@ -19,6 +19,7 @@ package com.cloud.network;
import java.util.List;
import java.util.Map;
+import com.cloud.network.element.DhcpServiceProvider;
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
import com.cloud.dc.DataCenter;
@@ -99,7 +100,7 @@ public interface NetworkManager {
throws ConcurrentOperationException;
List setupNetwork(Account owner, NetworkOffering offering, Network predefined, DeploymentPlan plan, String name, String displayText, boolean errorIfAlreadySetup, Long domainId,
- ACLType aclType, Boolean subdomainAccess, Long vpcId) throws ConcurrentOperationException;
+ ACLType aclType, Boolean subdomainAccess, Long vpcId, Boolean isDisplayNetworkEnabled) throws ConcurrentOperationException;
void allocate(VirtualMachineProfile vm, List> networks) throws InsufficientCapacityException, ConcurrentOperationException;
@@ -128,7 +129,8 @@ public interface NetworkManager {
Network createGuestNetwork(long networkOfferingId, String name, String displayText, String gateway, String cidr,
String vlanId, String networkDomain, Account owner, Long domainId, PhysicalNetwork physicalNetwork,
- long zoneId, ACLType aclType, Boolean subdomainAccess, Long vpcId, String ip6Gateway, String ip6Cidr)
+ long zoneId, ACLType aclType, Boolean subdomainAccess, Long vpcId, String ip6Gateway, String ip6Cidr,
+ Boolean displayNetworkEnabled, String isolatedPvlan)
throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException;
/**
@@ -348,4 +350,7 @@ public interface NetworkManager {
NicVO savePlaceholderNic(Network network, String ip4Address, Type vmType);
+ DhcpServiceProvider getDhcpServiceProvider(Network network);
+
+ PublicIp assignPublicIpAddressFromVlans(long dcId, Long podId, Account owner, VlanType type, List vlanDbIds, Long networkId, String requestedIp, boolean isSystem) throws InsufficientAddressCapacityException;
}
diff --git a/engine/components-api/src/com/cloud/network/addr/PublicIp.java b/engine/components-api/src/com/cloud/network/addr/PublicIp.java
index 25e9d308b14..c753b4927c8 100644
--- a/engine/components-api/src/com/cloud/network/addr/PublicIp.java
+++ b/engine/components-api/src/com/cloud/network/addr/PublicIp.java
@@ -219,4 +219,8 @@ public class PublicIp implements PublicIpAddress {
public String getVmIp() {
return _addr.getVmIp();
}
+
+ public Long getIpMacAddress() {
+ return _addr.getMacAddress();
+ }
}
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/vm/VMEntityManagerImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/vm/VMEntityManagerImpl.java
index f7d48d5a27e..fe3a8217461 100755
--- a/engine/orchestration/src/org/apache/cloudstack/engine/vm/VMEntityManagerImpl.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/vm/VMEntityManagerImpl.java
@@ -24,6 +24,7 @@ import java.util.UUID;
import javax.inject.Inject;
+import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
import org.apache.cloudstack.engine.cloud.entity.VMEntityVO;
import org.apache.cloudstack.engine.cloud.entity.VMReservationVO;
import org.apache.cloudstack.engine.cloud.entity.dao.VMEntityDao;
@@ -60,6 +61,7 @@ import com.cloud.user.dao.AccountDao;
import com.cloud.user.dao.UserDao;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.vm.VMInstanceVO;
+import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineManager;
import com.cloud.vm.VirtualMachineProfile;
import com.cloud.vm.VirtualMachineProfileImpl;
@@ -115,6 +117,9 @@ public class VMEntityManagerImpl implements VMEntityManager {
@Inject
DeploymentPlanningManager _dpMgr;
+ @Inject
+ protected AffinityGroupVMMapDao _affinityGroupVMMapDao;
+
@Override
public VMEntityVO load(String vmId) {
return _vmEntityDao.findByUuid(vmId);
@@ -126,6 +131,16 @@ public class VMEntityManagerImpl implements VMEntityManager {
}
+ protected boolean areAffinityGroupsAssociated(VirtualMachineProfile vmProfile) {
+ VirtualMachine vm = vmProfile.getVirtualMachine();
+ long vmGroupCount = _affinityGroupVMMapDao.countAffinityGroupsForVm(vm.getId());
+
+ if (vmGroupCount > 0) {
+ return true;
+ }
+ return false;
+ }
+
@Override
public String reserve(VMEntityVO vmEntityVO, String plannerToUse, DeploymentPlan planToDeploy, ExcludeList exclude)
throws InsufficientCapacityException, ResourceUnavailableException {
@@ -197,7 +212,8 @@ public class VMEntityManagerImpl implements VMEntityManager {
// call retry it.
return UUID.randomUUID().toString();
}else{
- throw new InsufficientServerCapacityException("Unable to create a deployment for " + vmProfile, DataCenter.class, plan.getDataCenterId());
+ throw new InsufficientServerCapacityException("Unable to create a deployment for " + vmProfile,
+ DataCenter.class, plan.getDataCenterId(), areAffinityGroupsAssociated(vmProfile));
}
}
diff --git a/engine/schema/src/com/cloud/dc/dao/VlanDao.java b/engine/schema/src/com/cloud/dc/dao/VlanDao.java
index cc82632e9e3..39fa818e26f 100755
--- a/engine/schema/src/com/cloud/dc/dao/VlanDao.java
+++ b/engine/schema/src/com/cloud/dc/dao/VlanDao.java
@@ -16,13 +16,13 @@
// under the License.
package com.cloud.dc.dao;
-import java.util.List;
-
import com.cloud.dc.Vlan;
import com.cloud.dc.Vlan.VlanType;
import com.cloud.dc.VlanVO;
import com.cloud.utils.db.GenericDao;
+import java.util.List;
+
public interface VlanDao extends GenericDao {
VlanVO findByZoneAndVlanId(long zoneId, String vlanId);
@@ -52,4 +52,8 @@ public interface VlanDao extends GenericDao {
List listVlansByPhysicalNetworkId(long physicalNetworkId);
List listZoneWideNonDedicatedVlans(long zoneId);
+
+ List listVlansByNetworkIdAndGateway(long networkid, String gateway);
+
+ List listDedicatedVlans(long accountId);
}
diff --git a/engine/schema/src/com/cloud/dc/dao/VlanDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/VlanDaoImpl.java
index 100295b4b5f..eb3bde9d005 100755
--- a/engine/schema/src/com/cloud/dc/dao/VlanDaoImpl.java
+++ b/engine/schema/src/com/cloud/dc/dao/VlanDaoImpl.java
@@ -16,19 +16,6 @@
// under the License.
package com.cloud.dc.dao;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.ejb.Local;
-import javax.inject.Inject;
-import javax.naming.ConfigurationException;
-
-import org.springframework.stereotype.Component;
-
import com.cloud.dc.AccountVlanMapVO;
import com.cloud.dc.PodVlanMapVO;
import com.cloud.dc.Vlan;
@@ -43,6 +30,17 @@ import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
import com.cloud.utils.db.Transaction;
import com.cloud.utils.exception.CloudRuntimeException;
+import org.springframework.stereotype.Component;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
@Component
@Local(value={VlanDao.class})
@@ -59,6 +57,8 @@ public class VlanDaoImpl extends GenericDaoBase implements VlanDao
protected SearchBuilder NetworkVlanSearch;
protected SearchBuilder PhysicalNetworkVlanSearch;
protected SearchBuilder ZoneWideNonDedicatedVlanSearch;
+ protected SearchBuilder VlanGatewaysearch;
+ protected SearchBuilder DedicatedVlanSearch;
protected SearchBuilder AccountVlanMapSearch;
@@ -103,6 +103,11 @@ public class VlanDaoImpl extends GenericDaoBase implements VlanDao
PhysicalNetworkVlanSearch = createSearchBuilder();
PhysicalNetworkVlanSearch.and("physicalNetworkId", PhysicalNetworkVlanSearch.entity().getPhysicalNetworkId(), SearchCriteria.Op.EQ);
PhysicalNetworkVlanSearch.done();
+
+ VlanGatewaysearch = createSearchBuilder();
+ VlanGatewaysearch.and("gateway", VlanGatewaysearch.entity().getVlanGateway(), SearchCriteria.Op.EQ);
+ VlanGatewaysearch.and("networkid", VlanGatewaysearch.entity().getNetworkId(), SearchCriteria.Op.EQ);
+ VlanGatewaysearch.done();
}
@Override
@@ -209,6 +214,13 @@ public class VlanDaoImpl extends GenericDaoBase implements VlanDao
ZoneWideNonDedicatedVlanSearch.done();
AccountVlanMapSearch.done();
+ DedicatedVlanSearch = createSearchBuilder();
+ AccountVlanMapSearch = _accountVlanMapDao.createSearchBuilder();
+ AccountVlanMapSearch.and("accountId", AccountVlanMapSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+ DedicatedVlanSearch.join("AccountVlanMapSearch", AccountVlanMapSearch, DedicatedVlanSearch.entity().getId(), AccountVlanMapSearch.entity().getVlanDbId(), JoinBuilder.JoinType.LEFTOUTER);
+ DedicatedVlanSearch.done();
+ AccountVlanMapSearch.done();
+
return result;
}
@@ -317,6 +329,14 @@ public class VlanDaoImpl extends GenericDaoBase implements VlanDao
return listBy(sc);
}
+ @Override
+ public List listVlansByNetworkIdAndGateway(long networkid, String gateway){
+ SearchCriteria sc = VlanGatewaysearch.create();
+ sc.setParameters("networkid", networkid);
+ sc.setParameters("gateway", gateway);
+ return listBy(sc);
+ }
+
@Override
public List listVlansByPhysicalNetworkId(long physicalNetworkId) {
SearchCriteria sc = PhysicalNetworkVlanSearch.create();
@@ -331,4 +351,11 @@ public class VlanDaoImpl extends GenericDaoBase implements VlanDao
return listBy(sc);
}
+ @Override
+ public List listDedicatedVlans(long accountId) {
+ SearchCriteria sc = DedicatedVlanSearch.create();
+ sc.setJoinParameters("AccountVlanMapSearch", "accountId", accountId);
+ return listBy(sc);
+ }
+
}
diff --git a/engine/schema/src/com/cloud/domain/dao/DomainDao.java b/engine/schema/src/com/cloud/domain/dao/DomainDao.java
index afeb0f462f4..cb1c1f2c4be 100644
--- a/engine/schema/src/com/cloud/domain/dao/DomainDao.java
+++ b/engine/schema/src/com/cloud/domain/dao/DomainDao.java
@@ -26,9 +26,10 @@ public interface DomainDao extends GenericDao {
public DomainVO create(DomainVO domain);
public DomainVO findDomainByPath(String domainPath);
public boolean isChildDomain(Long parentId, Long childId);
- DomainVO findImmediateChildForParent(Long parentId);
- List findImmediateChildrenForParent(Long parentId);
- List findAllChildren(String path, Long parentId);
- List findInactiveDomains();
+ DomainVO findImmediateChildForParent(Long parentId);
+ List findImmediateChildrenForParent(Long parentId);
+ List findAllChildren(String path, Long parentId);
+ List findInactiveDomains();
Set getDomainParentIds(long domainId);
+ List getDomainChildrenIds(String path);
}
diff --git a/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java b/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java
index c30ca5ef49a..9460a73dc57 100644
--- a/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java
+++ b/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java
@@ -32,6 +32,7 @@ import com.cloud.domain.Domain;
import com.cloud.domain.DomainVO;
import com.cloud.utils.db.DB;
import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
import com.cloud.utils.db.Transaction;
@@ -46,6 +47,7 @@ public class DomainDaoImpl extends GenericDaoBase implements Dom
protected SearchBuilder DomainPairSearch;
protected SearchBuilder ImmediateChildDomainSearch;
protected SearchBuilder FindAllChildrenSearch;
+ protected GenericSearchBuilder FindIdsOfAllChildrenSearch;
protected SearchBuilder AllFieldsSearch;
public DomainDaoImpl () {
@@ -70,7 +72,12 @@ public class DomainDaoImpl extends GenericDaoBase implements Dom
FindAllChildrenSearch.and("path", FindAllChildrenSearch.entity().getPath(), SearchCriteria.Op.LIKE);
FindAllChildrenSearch.and("id", FindAllChildrenSearch.entity().getId(), SearchCriteria.Op.NEQ);
FindAllChildrenSearch.done();
-
+
+ FindIdsOfAllChildrenSearch = createSearchBuilder(Long.class);
+ FindIdsOfAllChildrenSearch.selectField(FindIdsOfAllChildrenSearch.entity().getId());
+ FindIdsOfAllChildrenSearch.and("path", FindIdsOfAllChildrenSearch.entity().getPath(), SearchCriteria.Op.LIKE);
+ FindIdsOfAllChildrenSearch.done();
+
AllFieldsSearch = createSearchBuilder();
AllFieldsSearch.and("name", AllFieldsSearch.entity().getName(), SearchCriteria.Op.EQ);
AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), SearchCriteria.Op.EQ);
@@ -221,7 +228,14 @@ public class DomainDaoImpl extends GenericDaoBase implements Dom
sc.setParameters("id", parentId);
return listBy(sc);
}
-
+
+ @Override
+ public List getDomainChildrenIds(String path){
+ SearchCriteria sc = FindIdsOfAllChildrenSearch.create();
+ sc.setParameters("path", path+"%");
+ return customSearch(sc, null);
+ }
+
@Override
public boolean isChildDomain(Long parentId, Long childId) {
if ((parentId == null) || (childId == null)) {
diff --git a/engine/schema/src/com/cloud/event/dao/EventDao.java b/engine/schema/src/com/cloud/event/dao/EventDao.java
index da5f47a90b4..9454ce717de 100644
--- a/engine/schema/src/com/cloud/event/dao/EventDao.java
+++ b/engine/schema/src/com/cloud/event/dao/EventDao.java
@@ -31,7 +31,7 @@ public interface EventDao extends GenericDao {
EventVO findCompletedEvent(long startId);
- public List listToArchiveOrDeleteEvents(List ids, String type, Date olderThan, Long accountId);
+ public List listToArchiveOrDeleteEvents(List ids, String type, Date olderThan, List accountIds);
public void archiveEvents(List events);
diff --git a/engine/schema/src/com/cloud/event/dao/EventDaoImpl.java b/engine/schema/src/com/cloud/event/dao/EventDaoImpl.java
index 6ba59c56b0a..0d3d38a0204 100644
--- a/engine/schema/src/com/cloud/event/dao/EventDaoImpl.java
+++ b/engine/schema/src/com/cloud/event/dao/EventDaoImpl.java
@@ -49,7 +49,7 @@ public class EventDaoImpl extends GenericDaoBase implements Event
ToArchiveOrDeleteEventSearch = createSearchBuilder();
ToArchiveOrDeleteEventSearch.and("id", ToArchiveOrDeleteEventSearch.entity().getId(), Op.IN);
ToArchiveOrDeleteEventSearch.and("type", ToArchiveOrDeleteEventSearch.entity().getType(), Op.EQ);
- ToArchiveOrDeleteEventSearch.and("accountId", ToArchiveOrDeleteEventSearch.entity().getAccountId(), Op.EQ);
+ ToArchiveOrDeleteEventSearch.and("accountIds", ToArchiveOrDeleteEventSearch.entity().getAccountId(), Op.IN);
ToArchiveOrDeleteEventSearch.and("createDateL", ToArchiveOrDeleteEventSearch.entity().getCreateDate(), Op.LT);
ToArchiveOrDeleteEventSearch.done();
}
@@ -76,7 +76,7 @@ public class EventDaoImpl extends GenericDaoBase implements Event
}
@Override
- public List listToArchiveOrDeleteEvents(List ids, String type, Date olderThan, Long accountId) {
+ public List listToArchiveOrDeleteEvents(List ids, String type, Date olderThan, List accountIds) {
SearchCriteria sc = ToArchiveOrDeleteEventSearch.create();
if (ids != null) {
sc.setParameters("id", ids.toArray(new Object[ids.size()]));
@@ -87,23 +87,24 @@ public class EventDaoImpl extends GenericDaoBase implements Event
if (olderThan != null) {
sc.setParameters("createDateL", olderThan);
}
- if (accountId != null) {
- sc.setParameters("accountId", accountId);
+ if (accountIds != null && !accountIds.isEmpty()) {
+ sc.setParameters("accountIds", accountIds.toArray(new Object[accountIds.size()]));
}
return search(sc, null);
}
@Override
public void archiveEvents(List events) {
-
- Transaction txn = Transaction.currentTxn();
- txn.start();
- for (EventVO event : events) {
- event = lockRow(event.getId(), true);
- event.setArchived(true);
- update(event.getId(), event);
- txn.commit();
+ if (events != null && !events.isEmpty()) {
+ Transaction txn = Transaction.currentTxn();
+ txn.start();
+ for (EventVO event : events) {
+ event = lockRow(event.getId(), true);
+ event.setArchived(true);
+ update(event.getId(), event);
+ txn.commit();
+ }
+ txn.close();
}
- txn.close();
}
}
diff --git a/engine/schema/src/com/cloud/host/dao/HostDetailsDaoImpl.java b/engine/schema/src/com/cloud/host/dao/HostDetailsDaoImpl.java
index b6a9cef9ee9..47cdeb30633 100644
--- a/engine/schema/src/com/cloud/host/dao/HostDetailsDaoImpl.java
+++ b/engine/schema/src/com/cloud/host/dao/HostDetailsDaoImpl.java
@@ -16,6 +16,8 @@
// under the License.
package com.cloud.host.dao;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -30,18 +32,19 @@ import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
import com.cloud.utils.db.Transaction;
+import com.cloud.utils.exception.CloudRuntimeException;
@Component
@Local(value=HostDetailsDao.class)
public class HostDetailsDaoImpl extends GenericDaoBase implements HostDetailsDao {
protected final SearchBuilder HostSearch;
protected final SearchBuilder DetailSearch;
-
+
public HostDetailsDaoImpl() {
HostSearch = createSearchBuilder();
HostSearch.and("hostId", HostSearch.entity().getHostId(), SearchCriteria.Op.EQ);
HostSearch.done();
-
+
DetailSearch = createSearchBuilder();
DetailSearch.and("hostId", DetailSearch.entity().getHostId(), SearchCriteria.Op.EQ);
DetailSearch.and("name", DetailSearch.entity().getName(), SearchCriteria.Op.EQ);
@@ -53,7 +56,7 @@ public class HostDetailsDaoImpl extends GenericDaoBase implement
SearchCriteria sc = DetailSearch.create();
sc.setParameters("hostId", hostId);
sc.setParameters("name", name);
-
+
DetailVO detail = findOneIncludingRemovedBy(sc);
if("password".equals(name) && detail != null){
detail.setValue(DBEncryptionUtil.decrypt(detail.getValue()));
@@ -65,7 +68,7 @@ public class HostDetailsDaoImpl extends GenericDaoBase implement
public Map findDetails(long hostId) {
SearchCriteria sc = HostSearch.create();
sc.setParameters("hostId", hostId);
-
+
List results = search(sc, null);
Map details = new HashMap(results.size());
for (DetailVO result : results) {
@@ -77,12 +80,12 @@ public class HostDetailsDaoImpl extends GenericDaoBase implement
}
return details;
}
-
+
@Override
public void deleteDetails(long hostId) {
SearchCriteria sc = HostSearch.create();
sc.setParameters("hostId", hostId);
-
+
List results = search(sc, null);
for (DetailVO result : results) {
remove(result.getId());
@@ -91,19 +94,27 @@ public class HostDetailsDaoImpl extends GenericDaoBase implement
@Override
public void persist(long hostId, Map details) {
+ final String InsertOrUpdateSql = "INSERT INTO `cloud`.`host_details` (host_id, name, value) VALUES (?,?,?) ON DUPLICATE KEY UPDATE value=?";
+
Transaction txn = Transaction.currentTxn();
txn.start();
- SearchCriteria sc = HostSearch.create();
- sc.setParameters("hostId", hostId);
- expunge(sc);
-
+
for (Map.Entry detail : details.entrySet()) {
- String value = detail.getValue();
- if("password".equals(detail.getKey())){
- value = DBEncryptionUtil.encrypt(value);
- }
- DetailVO vo = new DetailVO(hostId, detail.getKey(), value);
- persist(vo);
+ String value = detail.getValue();
+ if ("password".equals(detail.getKey())) {
+ value = DBEncryptionUtil.encrypt(value);
+ }
+ try {
+ PreparedStatement pstmt = txn.prepareAutoCloseStatement(InsertOrUpdateSql);
+ pstmt.setLong(1, hostId);
+ pstmt.setString(2, detail.getKey());
+ pstmt.setString(3, value);
+ pstmt.setString(4, value);
+ pstmt.executeUpdate();
+ } catch (SQLException e) {
+ throw new CloudRuntimeException("Unable to persist the host_details key: " + detail.getKey()
+ + " for host id: " + hostId, e);
+ }
}
txn.commit();
}
diff --git a/engine/schema/src/com/cloud/migration/ServiceOffering21VO.java b/engine/schema/src/com/cloud/migration/ServiceOffering21VO.java
index d07be6462f1..7a49e63e5b3 100644
--- a/engine/schema/src/com/cloud/migration/ServiceOffering21VO.java
+++ b/engine/schema/src/com/cloud/migration/ServiceOffering21VO.java
@@ -174,5 +174,10 @@ public class ServiceOffering21VO extends DiskOffering21VO implements ServiceOffe
return false;
}
+ @Override
+ public String getDeploymentPlanner() {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
diff --git a/engine/schema/src/com/cloud/network/dao/IPAddressDao.java b/engine/schema/src/com/cloud/network/dao/IPAddressDao.java
index 3d588fa9307..fecd44a32b1 100755
--- a/engine/schema/src/com/cloud/network/dao/IPAddressDao.java
+++ b/engine/schema/src/com/cloud/network/dao/IPAddressDao.java
@@ -16,12 +16,12 @@
// under the License.
package com.cloud.network.dao;
-import java.util.List;
-
import com.cloud.dc.Vlan.VlanType;
import com.cloud.utils.db.GenericDao;
import com.cloud.utils.net.Ip;
+import java.util.List;
+
public interface IPAddressDao extends GenericDao {
IPAddressVO markAsUnavailable(long ipAddressId);
@@ -68,4 +68,8 @@ public interface IPAddressDao extends GenericDao {
IPAddressVO findByAssociatedVmIdAndVmIp(long vmId, String vmIp);
IPAddressVO findByIpAndNetworkId(long networkId, String ipAddress);
+
+ IPAddressVO findByIpAndVlanId(String ipAddress, long vlanid);
+
+ long countFreeIpsInVlan(long vlanDbId);
}
diff --git a/engine/schema/src/com/cloud/network/dao/IPAddressDaoImpl.java b/engine/schema/src/com/cloud/network/dao/IPAddressDaoImpl.java
index 73f310fd628..1839ca45476 100755
--- a/engine/schema/src/com/cloud/network/dao/IPAddressDaoImpl.java
+++ b/engine/schema/src/com/cloud/network/dao/IPAddressDaoImpl.java
@@ -16,26 +16,12 @@
// under the License.
package com.cloud.network.dao;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.util.Date;
-import java.util.List;
-
-import javax.annotation.PostConstruct;
-import javax.ejb.Local;
-import javax.inject.Inject;
-
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
import com.cloud.dc.Vlan.VlanType;
import com.cloud.dc.VlanVO;
import com.cloud.dc.dao.VlanDao;
-import com.cloud.dc.dao.VlanDaoImpl;
import com.cloud.network.IpAddress.State;
import com.cloud.server.ResourceTag.TaggedResourceType;
import com.cloud.tags.dao.ResourceTagDao;
-import com.cloud.tags.dao.ResourceTagsDaoImpl;
import com.cloud.utils.db.DB;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.GenericSearchBuilder;
@@ -46,6 +32,16 @@ import com.cloud.utils.db.SearchCriteria.Func;
import com.cloud.utils.db.SearchCriteria.Op;
import com.cloud.utils.db.Transaction;
import com.cloud.utils.net.Ip;
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Local;
+import javax.inject.Inject;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.Date;
+import java.util.List;
@Component
@Local(value = { IPAddressDao.class })
@@ -192,6 +188,14 @@ public class IPAddressDaoImpl extends GenericDaoBase implemen
return findOneBy(sc);
}
+ @Override
+ public IPAddressVO findByIpAndVlanId(String ipAddress, long vlanid) {
+ SearchCriteria sc = AllFieldsSearch.create();
+ sc.setParameters("ipAddress", ipAddress);
+ sc.setParameters("vlan", vlanid);
+ return findOneBy(sc);
+ }
+
@Override
public IPAddressVO findByIpAndDcId(long dcId, String ipAddress) {
SearchCriteria sc = AllFieldsSearch.create();
@@ -332,6 +336,13 @@ public class IPAddressDaoImpl extends GenericDaoBase implemen
return customSearch(sc, null).get(0);
}
+ @Override
+ public long countFreeIpsInVlan(long vlanDbId) {
+ SearchCriteria sc = VlanDbIdSearchUnallocated.create();
+ sc.setParameters("vlanDbId", vlanDbId);
+ return listBy(sc).size();
+ }
+
@Override
public List listByAssociatedVpc(long vpcId, Boolean isSourceNat) {
SearchCriteria sc = AllFieldsSearch.create();
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkDao.java b/engine/schema/src/com/cloud/network/dao/NetworkDao.java
index 1d3f0b84aa6..d0a1a256efc 100644
--- a/engine/schema/src/com/cloud/network/dao/NetworkDao.java
+++ b/engine/schema/src/com/cloud/network/dao/NetworkDao.java
@@ -111,4 +111,8 @@ public interface NetworkDao extends GenericDao , StateDao listNetworksByAccount(long accountId, long zoneId, Network.GuestType type, boolean isSystem);
List listRedundantNetworks();
+
+ List listByAclId(long aclId);
+
+ int getNonSystemNetworkCountByVpcId(long vpcId);
}
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkDaoImpl.java b/engine/schema/src/com/cloud/network/dao/NetworkDaoImpl.java
index 1bc8973bc50..c55cf28273a 100644
--- a/engine/schema/src/com/cloud/network/dao/NetworkDaoImpl.java
+++ b/engine/schema/src/com/cloud/network/dao/NetworkDaoImpl.java
@@ -104,6 +104,7 @@ public class NetworkDaoImpl extends GenericDaoBase implements N
AllFieldsSearch.and("physicalNetwork", AllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ);
AllFieldsSearch.and("broadcastUri", AllFieldsSearch.entity().getBroadcastUri(), Op.EQ);
AllFieldsSearch.and("vpcId", AllFieldsSearch.entity().getVpcId(), Op.EQ);
+ AllFieldsSearch.and("aclId", AllFieldsSearch.entity().getNetworkACLId(), Op.EQ);
SearchBuilder join1 = _ntwkOffDao.createSearchBuilder();
join1.and("isSystem", join1.entity().isSystemOnly(), Op.EQ);
join1.and("isRedundant", join1.entity().getRedundantRouter(), Op.EQ);
@@ -161,6 +162,9 @@ public class NetworkDaoImpl extends GenericDaoBase implements N
CountBy.and("offeringId", CountBy.entity().getNetworkOfferingId(), Op.EQ);
CountBy.and("vpcId", CountBy.entity().getVpcId(), Op.EQ);
CountBy.and("removed", CountBy.entity().getRemoved(), Op.NULL);
+ SearchBuilder ntwkOffJoin = _ntwkOffDao.createSearchBuilder();
+ ntwkOffJoin.and("isSystem", ntwkOffJoin.entity().isSystemOnly(), Op.EQ);
+ CountBy.join("offerings", ntwkOffJoin, CountBy.entity().getNetworkOfferingId(), ntwkOffJoin.entity().getId(), JoinBuilder.JoinType.INNER);
CountBy.done();
PhysicalNetworkSearch = createSearchBuilder();
@@ -618,4 +622,22 @@ public class NetworkDaoImpl extends GenericDaoBase implements N
sc.setJoinParameters("offerings", "isRedundant", true);
return listBy(sc, null);
}
+
+ @Override
+ public List listByAclId(long aclId) {
+ SearchCriteria sc = AllFieldsSearch.create();
+ sc.setParameters("aclId", aclId);
+
+ return listBy(sc, null);
+ }
+
+
+ @Override
+ public int getNonSystemNetworkCountByVpcId(long vpcId) {
+ SearchCriteria sc = CountBy.create();
+ sc.setParameters("vpcId", vpcId);
+ sc.setJoinParameters("offerings", "isSystem", false);
+ List results = customSearch(sc, null);
+ return results.get(0);
+ }
}
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkVO.java b/engine/schema/src/com/cloud/network/dao/NetworkVO.java
index 8e728abd984..6580ea054f9 100644
--- a/engine/schema/src/com/cloud/network/dao/NetworkVO.java
+++ b/engine/schema/src/com/cloud/network/dao/NetworkVO.java
@@ -160,6 +160,12 @@ public class NetworkVO implements Network {
@Column(name="ip6_cidr")
String ip6Cidr;
+ @Column(name="display_network", updatable=true, nullable=false)
+ protected boolean displayNetwork = true;
+
+ @Column(name="network_acl_id")
+ Long networkACLId;
+
public NetworkVO() {
this.uuid = UUID.randomUUID().toString();
}
@@ -537,4 +543,23 @@ public class NetworkVO implements Network {
public void setIp6Gateway(String ip6Gateway) {
this.ip6Gateway = ip6Gateway;
}
+
+ @Override()
+ public boolean getDisplayNetwork() {
+ return displayNetwork;
+ }
+
+ public void setDisplayNetwork(boolean displayNetwork) {
+ this.displayNetwork = displayNetwork;
+ }
+
+ @Override
+ public void setNetworkACLId(Long networkACLId) {
+ this.networkACLId = networkACLId;
+ }
+
+ @Override
+ public Long getNetworkACLId() {
+ return networkACLId;
+ }
}
diff --git a/engine/schema/src/com/cloud/network/vpc/VpcGatewayVO.java b/engine/schema/src/com/cloud/network/vpc/VpcGatewayVO.java
index e8dcb46b211..7df2dfd236e 100644
--- a/engine/schema/src/com/cloud/network/vpc/VpcGatewayVO.java
+++ b/engine/schema/src/com/cloud/network/vpc/VpcGatewayVO.java
@@ -87,6 +87,11 @@ public class VpcGatewayVO implements VpcGateway {
@Column(name="source_nat")
boolean sourceNat;
+ @Column(name="network_acl_id")
+ long networkACLId;
+
+
+
protected VpcGatewayVO(){
this.uuid = UUID.randomUUID().toString();
}
@@ -106,7 +111,7 @@ public class VpcGatewayVO implements VpcGateway {
* @param sourceNat
*/
public VpcGatewayVO(String ip4Address, Type type, Long vpcId, long zoneId, Long networkId, String vlanTag,
- String gateway, String netmask, long accountId, long domainId, boolean sourceNat) {
+ String gateway, String netmask, long accountId, long domainId, boolean sourceNat, long networkACLId) {
this.ip4Address = ip4Address;
this.type = type;
this.vpcId = vpcId;
@@ -120,6 +125,8 @@ public class VpcGatewayVO implements VpcGateway {
this.domainId = domainId;
this.state = State.Creating;
this.sourceNat = sourceNat;
+ this.networkACLId = networkACLId;
+
}
@Override
@@ -203,4 +210,12 @@ public class VpcGatewayVO implements VpcGateway {
return this.sourceNat;
}
+ public void setNetworkACLId(long networkACLId) {
+ this.networkACLId = networkACLId;
+ }
+
+ @Override
+ public long getNetworkACLId() {
+ return networkACLId;
+ }
}
diff --git a/engine/schema/src/com/cloud/network/vpc/dao/PrivateIpDao.java b/engine/schema/src/com/cloud/network/vpc/dao/PrivateIpDao.java
index 02df92e9c67..ff8c26a9571 100644
--- a/engine/schema/src/com/cloud/network/vpc/dao/PrivateIpDao.java
+++ b/engine/schema/src/com/cloud/network/vpc/dao/PrivateIpDao.java
@@ -70,6 +70,7 @@ public interface PrivateIpDao extends GenericDao{
*/
PrivateIpVO findByIpAndVpcId(long vpcId, String ip4Address);
-
+
+ PrivateIpVO findByIpAndSourceNetworkIdAndVpcId(long networkId, String ip4Address, long vpcId);
}
diff --git a/engine/schema/src/com/cloud/network/vpc/dao/PrivateIpDaoImpl.java b/engine/schema/src/com/cloud/network/vpc/dao/PrivateIpDaoImpl.java
index ecab3bb6625..fe435c05175 100644
--- a/engine/schema/src/com/cloud/network/vpc/dao/PrivateIpDaoImpl.java
+++ b/engine/schema/src/com/cloud/network/vpc/dao/PrivateIpDaoImpl.java
@@ -114,7 +114,16 @@ public class PrivateIpDaoImpl extends GenericDaoBase implemen
sc.setParameters("networkId", networkId);
return findOneBy(sc);
}
-
+
+ @Override
+ public PrivateIpVO findByIpAndSourceNetworkIdAndVpcId(long networkId, String ip4Address, long vpcId) {
+ SearchCriteria sc = AllFieldsSearch.create();
+ sc.setParameters("ip", ip4Address);
+ sc.setParameters("networkId", networkId);
+ sc.setParameters("vpcId", vpcId);
+ return findOneBy(sc);
+ }
+
@Override
public PrivateIpVO findByIpAndVpcId(long vpcId, String ip4Address) {
SearchCriteria sc = AllFieldsSearch.create();
diff --git a/engine/schema/src/com/cloud/network/vpc/dao/VpcGatewayDao.java b/engine/schema/src/com/cloud/network/vpc/dao/VpcGatewayDao.java
index 600d67f6684..24d9deb511c 100644
--- a/engine/schema/src/com/cloud/network/vpc/dao/VpcGatewayDao.java
+++ b/engine/schema/src/com/cloud/network/vpc/dao/VpcGatewayDao.java
@@ -16,11 +16,18 @@
// under the License.
package com.cloud.network.vpc.dao;
+import com.cloud.network.vpc.VpcGateway;
import com.cloud.network.vpc.VpcGatewayVO;
import com.cloud.utils.db.GenericDao;
+import java.util.List;
+
public interface VpcGatewayDao extends GenericDao