You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2018/05/18 20:13:47 UTC

[GitHub] mike-tutkowski closed pull request #2501: Only perform certain actions with managed storage if the VM is s…

mike-tutkowski closed pull request #2501: Only perform certain actions with managed storage if the VM is s…
URL: https://github.com/apache/cloudstack/pull/2501
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/.travis.yml b/.travis.yml
index d5fd173d71e..f4b52bae945 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -33,10 +33,11 @@ env:
      - PATH=$HOME/.local/bin:$PATH
   matrix:
     # Keep the TESTS sorted by name and grouped by type
+    - TESTS="smoke/test_certauthority_root"
+    
     - TESTS="smoke/test_accounts
              smoke/test_affinity_groups
              smoke/test_affinity_groups_projects
-             smoke/test_certauthority_root
              smoke/test_deploy_vgpu_enabled_vm
              smoke/test_deploy_vm_iso
              smoke/test_deploy_vm_root_resize
@@ -70,9 +71,10 @@ env:
              smoke/test_password_server
              smoke/test_portable_publicip
              smoke/test_portforwardingrules"
-
-    - TESTS="smoke/test_primary_storage
-             smoke/test_privategw_acl
+    
+    - TESTS="smoke/test_primary_storage"
+    
+    - TESTS="smoke/test_privategw_acl
              smoke/test_projects
              smoke/test_public_ip_range
              smoke/test_pvlan
diff --git a/INSTALL.md b/INSTALL.md
index 626df91dc56..8a87c8ad0e4 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -59,7 +59,7 @@ Following these steps, jenv and pyenv will use .java-version and .python-version
 
 You may get the source code from the repository hosted on Apache:
 
-    $ git clone https://git-wip-us.apache.org/repos/asf/cloudstack.git
+    $ git clone https://gitbox.apache.org/repos/asf/cloudstack.git
 
 Or, you may fork the repository from the official Apache CloudStack mirror on [Github](https://github.com/apache/cloudstack)
 
@@ -97,13 +97,13 @@ field should be left blank which is defaulted to the ROOT domain.
 
 ## Building with non-redistributable plugins
 
-CloudStack supports several plugins that depend on libraries with distribution restrictions. 
-Because of this they are not included in the default build. Enable these additional plugins 
+CloudStack supports several plugins that depend on libraries with distribution restrictions.
+Because of this they are not included in the default build. Enable these additional plugins
 activate their respective profiles. For convenience adding -Dnoredist will enable all plugins
-that depend on libraries with distribution restrictions. The build procedure expects that the 
-required libraries are present in the maven repository. 
+that depend on libraries with distribution restrictions. The build procedure expects that the
+required libraries are present in the maven repository.
 
-The following procedure can be used to add the libraries to the local maven repository. Details 
+The following procedure can be used to add the libraries to the local maven repository. Details
 on obtaining the required libraries can be found in this file. Note that this will vary between
 releases of CloudStack
 
diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md
new file mode 100644
index 00000000000..21627321142
--- /dev/null
+++ b/ISSUE_TEMPLATE.md
@@ -0,0 +1,76 @@
+<!--
+Verify first that your issue/request is not already reported on GitHub.
+Also test if the latest release and master branch are affected too.
+Always add information AFTER of these HTML comments, but no need to delete the comments.
+-->
+
+##### ISSUE TYPE
+<!-- Pick one below and delete the rest -->
+ * Bug Report
+ * Improvement Request
+ * Enhancement Request
+ * Feature Idea
+ * Documentation Report
+ * Other
+
+##### COMPONENT NAME
+<!--
+Categorize the issue, e.g. API, VR, VPN, UI, etc.
+-->
+~~~
+
+~~~
+
+##### CLOUDSTACK VERSION
+<!--
+New line separated list of affected versions, commit ID for issues on master branch.
+-->
+
+~~~
+
+~~~
+
+##### CONFIGURATION
+<!--
+Information about the configuration if relevant, e.g. basic network, advanced networking, etc.  N/A otherwise
+-->
+
+
+##### OS / ENVIRONMENT
+<!--
+Information about the environment if relevant, N/A otherwise
+-->
+
+
+##### SUMMARY
+<!-- Explain the problem/feature briefly -->
+
+
+##### STEPS TO REPRODUCE
+<!--
+For bugs, show exactly how to reproduce the problem, using a minimal test-case. Use Screenshots if accurate.
+
+For new features, show how the feature would be used.
+-->
+
+<!-- Paste example playbooks or commands between quotes below -->
+~~~
+
+~~~
+
+<!-- You can also paste gist.github.com links for larger files -->
+
+##### EXPECTED RESULTS
+<!-- What did you expect to happen when running the steps above? -->
+
+~~~
+
+~~~
+
+##### ACTUAL RESULTS
+<!-- What actually happened? -->
+
+<!-- Paste verbatim command output between quotes below -->
+~~~
+
+~~~
diff --git a/LICENSE b/LICENSE
index 0dcb45c6189..48d852652c3 100644
--- a/LICENSE
+++ b/LICENSE
@@ -612,13 +612,13 @@ Within the ui/lib/qunit directory
             qunit.css  from http://docs.jquery.com/QUnit
             qunit.js  from http://docs.jquery.com/QUnit
 
-Within the utils/src/com/cloud/utils/db directory
+Within the utils/src/main/java/com/cloud/utils/db directory
     licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt  (as above)
     Copyright (c) 2004 Clinton Begin
         from Clinton Begin  http://code.google.com/p/mybatis/ 
             ScriptRunner.java  from http://code.google.com/p/mybatis/
 
-Within the utils/src/org/apache/commons/httpclient/contrib/ssl directory
+Within the utils/src/main/java/org/apache/commons/httpclient/contrib/ssl directory
     licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt  (as above)
     Copyright (c) 2007 The Apache Software Foundation
         from The Apache Software Foundation  http://www.apache.org/ 
diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md
index 17adfe69a31..cf1f6a24655 100644
--- a/PULL_REQUEST_TEMPLATE.md
+++ b/PULL_REQUEST_TEMPLATE.md
@@ -34,6 +34,8 @@
 - [ ] My code follows the code style of this project.
 - [ ] My change requires a change to the documentation.
 - [ ] I have updated the documentation accordingly.
+Testing
 - [ ] I have added tests to cover my changes.
-- [ ] All new and existing tests passed.
+- [ ] All relevant new and existing integration tests have passed.
+- [ ] A full integration testsuite with all test that can run on my environment has passed.
 
diff --git a/README.md b/README.md
index 17a7a8f7bd9..471672f60d8 100644
--- a/README.md
+++ b/README.md
@@ -67,7 +67,7 @@ Interested in helping out with Apache CloudStack? Great! We welcome
 participation from anybody willing to work [The Apache Way](http://theapacheway.com) and make a
 contribution. Note that you do not have to be a developer in order to contribute
 to Apache CloudStack. We need folks to help with documentation, translation,
-promotion etc.See our contribution [page](http://cloudstack.apache.org/contribute.html).
+promotion etc. See our contribution [page](http://cloudstack.apache.org/contribute.html).
 
 If you're interested in learning more or participating in the Apache CloudStack
 project, the mailing lists are the best way to do that. While the project has
@@ -100,7 +100,7 @@ If you've found an issue that you believe is a security vulnerability in a
 released version of CloudStack, please report it to `security@cloudstack.apache.org` with details about the vulnerability, how it
 might be exploited, and any additional information that might be useful.
 
-For more details, please visit our security [page](http://cloudstack.apache.org/security.html)
+For more details, please visit our security [page](http://cloudstack.apache.org/security.html).
 
 ## License
 
@@ -143,7 +143,7 @@ Unrestricted (TSU) exception (see the BIS Export Administration Regulations, Sec
 
 The following provides more details on the included cryptographic software:
 
-* CloudStack makes use of JaSypt cryptographic libraries
+* CloudStack makes use of JaSypt cryptographic libraries.
 * CloudStack has a system requirement of MySQL, and uses native database encryption functionality.
 * CloudStack makes use of the Bouncy Castle general-purpose encryption library.
 * CloudStack can optionally interacts with and controls OpenSwan-based VPNs.
diff --git a/agent/pom.xml b/agent/pom.xml
index 50b10c17827..61c1804fc9a 100644
--- a/agent/pom.xml
+++ b/agent/pom.xml
@@ -23,7 +23,7 @@
   <parent>
     <groupId>org.apache.cloudstack</groupId>
     <artifactId>cloudstack</artifactId>
-    <version>4.11.1.0-SNAPSHOT</version>
+    <version>4.12.0.0-SNAPSHOT</version>
   </parent>
   <dependencies>
     <dependency>
diff --git a/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java b/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java
deleted file mode 100644
index b3b17e7d970..00000000000
--- a/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java
+++ /dev/null
@@ -1,464 +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.agent.resource.consoleproxy;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.naming.ConfigurationException;
-
-import org.apache.cloudstack.managed.context.ManagedContextRunnable;
-import org.apache.log4j.Logger;
-
-import com.cloud.agent.Agent.ExitStatus;
-import com.cloud.agent.api.AgentControlAnswer;
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.CheckHealthAnswer;
-import com.cloud.agent.api.CheckHealthCommand;
-import com.cloud.agent.api.Command;
-import com.cloud.agent.api.ConsoleAccessAuthenticationAnswer;
-import com.cloud.agent.api.ConsoleAccessAuthenticationCommand;
-import com.cloud.agent.api.ConsoleProxyLoadReportCommand;
-import com.cloud.agent.api.PingCommand;
-import com.cloud.agent.api.ReadyAnswer;
-import com.cloud.agent.api.ReadyCommand;
-import com.cloud.agent.api.StartupCommand;
-import com.cloud.agent.api.StartupProxyCommand;
-import com.cloud.agent.api.proxy.CheckConsoleProxyLoadCommand;
-import com.cloud.agent.api.proxy.ConsoleProxyLoadAnswer;
-import com.cloud.agent.api.proxy.StartConsoleProxyAgentHttpHandlerCommand;
-import com.cloud.agent.api.proxy.WatchConsoleProxyLoadCommand;
-import com.cloud.exception.AgentControlChannelException;
-import com.cloud.host.Host;
-import com.cloud.host.Host.Type;
-import com.cloud.resource.ServerResource;
-import com.cloud.resource.ServerResourceBase;
-import com.cloud.utils.NumbersUtil;
-import com.cloud.utils.ReflectUtil;
-import com.cloud.utils.net.NetUtils;
-import com.cloud.utils.script.Script;
-import com.google.gson.Gson;
-
-/**
- *
- * I don't want to introduce extra cross-cutting concerns into console proxy
- * process, as it involves configurations like zone/pod, agent auto self-upgrade
- * etc. I also don't want to introduce more module dependency issues into our
- * build system, cross-communication between this resource and console proxy
- * will be done through reflection. As a result, come out with following
- * solution to solve the problem of building a communication channel between
- * consoole proxy and management server.
- *
- * We will deploy an agent shell inside console proxy VM, and this agent shell
- * will launch current console proxy from within this special server resource,
- * through it console proxy can build a communication channel with management
- * server.
- *
- */
-public class ConsoleProxyResource extends ServerResourceBase implements ServerResource {
-    static final Logger s_logger = Logger.getLogger(ConsoleProxyResource.class);
-
-    private final Properties _properties = new Properties();
-    private Thread _consoleProxyMain = null;
-
-    long _proxyVmId;
-    int _proxyPort;
-
-    String _localgw;
-    String _eth1ip;
-    String _eth1mask;
-    String _pubIp;
-
-    @Override
-    public Answer executeRequest(final Command cmd) {
-        if (cmd instanceof CheckConsoleProxyLoadCommand) {
-            return execute((CheckConsoleProxyLoadCommand)cmd);
-        } else if (cmd instanceof WatchConsoleProxyLoadCommand) {
-            return execute((WatchConsoleProxyLoadCommand)cmd);
-        } else if (cmd instanceof ReadyCommand) {
-            s_logger.info("Receive ReadyCommand, response with ReadyAnswer");
-            return new ReadyAnswer((ReadyCommand)cmd);
-        } else if (cmd instanceof CheckHealthCommand) {
-            return new CheckHealthAnswer((CheckHealthCommand)cmd, true);
-        } else if (cmd instanceof StartConsoleProxyAgentHttpHandlerCommand) {
-            return execute((StartConsoleProxyAgentHttpHandlerCommand)cmd);
-        } else {
-            return Answer.createUnsupportedCommandAnswer(cmd);
-        }
-    }
-
-    private Answer execute(StartConsoleProxyAgentHttpHandlerCommand cmd) {
-        s_logger.info("Invoke launchConsoleProxy() in responding to StartConsoleProxyAgentHttpHandlerCommand");
-        launchConsoleProxy(cmd.getKeystoreBits(), cmd.getKeystorePassword(), cmd.getEncryptorPassword());
-        return new Answer(cmd);
-    }
-
-    private void disableRpFilter() {
-        try (FileWriter fstream = new FileWriter("/proc/sys/net/ipv4/conf/eth2/rp_filter");
-             BufferedWriter out = new BufferedWriter(fstream);)
-        {
-            out.write("0");
-        } catch (IOException e) {
-            s_logger.warn("Unable to disable rp_filter");
-        }
-    }
-
-    protected Answer execute(final CheckConsoleProxyLoadCommand cmd) {
-        return executeProxyLoadScan(cmd, cmd.getProxyVmId(), cmd.getProxyVmName(), cmd.getProxyManagementIp(), cmd.getProxyCmdPort());
-    }
-
-    protected Answer execute(final WatchConsoleProxyLoadCommand cmd) {
-        return executeProxyLoadScan(cmd, cmd.getProxyVmId(), cmd.getProxyVmName(), cmd.getProxyManagementIp(), cmd.getProxyCmdPort());
-    }
-
-    private Answer executeProxyLoadScan(final Command cmd, final long proxyVmId, final String proxyVmName, final String proxyManagementIp, final int cmdPort) {
-        String result = null;
-
-        final StringBuffer sb = new StringBuffer();
-        sb.append("http://").append(proxyManagementIp).append(":" + cmdPort).append("/cmd/getstatus");
-
-        boolean success = true;
-        try {
-            final URL url = new URL(sb.toString());
-            final URLConnection conn = url.openConnection();
-
-            final InputStream is = conn.getInputStream();
-            final BufferedReader reader = new BufferedReader(new InputStreamReader(is,"UTF-8"));
-            final StringBuilder sb2 = new StringBuilder();
-            String line = null;
-            try {
-                while ((line = reader.readLine()) != null)
-                    sb2.append(line + "\n");
-                result = sb2.toString();
-            } catch (final IOException e) {
-                success = false;
-            } finally {
-                try {
-                    is.close();
-                } catch (final IOException e) {
-                    s_logger.warn("Exception when closing , console proxy address : " + proxyManagementIp);
-                    success = false;
-                }
-            }
-        } catch (final IOException e) {
-            s_logger.warn("Unable to open console proxy command port url, console proxy address : " + proxyManagementIp);
-            success = false;
-        }
-
-        return new ConsoleProxyLoadAnswer(cmd, proxyVmId, proxyVmName, success, result);
-    }
-
-    @Override
-    protected String getDefaultScriptsDir() {
-        return null;
-    }
-
-    @Override
-    public Type getType() {
-        return Host.Type.ConsoleProxy;
-    }
-
-    @Override
-    public synchronized StartupCommand[] initialize() {
-        final StartupProxyCommand cmd = new StartupProxyCommand();
-        fillNetworkInformation(cmd);
-        cmd.setProxyPort(_proxyPort);
-        cmd.setProxyVmId(_proxyVmId);
-        if (_pubIp != null)
-            cmd.setPublicIpAddress(_pubIp);
-        return new StartupCommand[] {cmd};
-    }
-
-    @Override
-    public void disconnected() {
-    }
-
-    @Override
-    public PingCommand getCurrentStatus(long id) {
-        return new PingCommand(Type.ConsoleProxy, id);
-    }
-
-    @Override
-    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
-        _localgw = (String)params.get("localgw");
-        _eth1mask = (String)params.get("eth1mask");
-        _eth1ip = (String)params.get("eth1ip");
-        if (_eth1ip != null) {
-            params.put("private.network.device", "eth1");
-        } else {
-            s_logger.info("eth1ip parameter has not been configured, assuming that we are not inside a system vm");
-        }
-
-        String eth2ip = (String)params.get("eth2ip");
-        if (eth2ip != null) {
-            params.put("public.network.device", "eth2");
-        } else {
-            s_logger.info("eth2ip parameter is not found, assuming that we are not inside a system vm");
-        }
-
-        super.configure(name, params);
-
-        for (Map.Entry<String, Object> entry : params.entrySet()) {
-            _properties.put(entry.getKey(), entry.getValue());
-        }
-
-        String value = (String)params.get("premium");
-        if (value != null && value.equals("premium"))
-            _proxyPort = 443;
-        else {
-            value = (String)params.get("consoleproxy.httpListenPort");
-            _proxyPort = NumbersUtil.parseInt(value, 80);
-        }
-
-        value = (String)params.get("proxy_vm");
-        _proxyVmId = NumbersUtil.parseLong(value, 0);
-
-        if (_localgw != null) {
-            String mgmtHosts = (String)params.get("host");
-            if (_eth1ip != null) {
-                for (final String mgmtHost : mgmtHosts.split(",")) {
-                    addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, mgmtHost);
-                }
-                String internalDns1 = (String) params.get("internaldns1");
-                if (internalDns1 == null) {
-                    s_logger.warn("No DNS entry found during configuration of NfsSecondaryStorage");
-                } else {
-                    addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, internalDns1);
-                }
-                String internalDns2 = (String) params.get("internaldns2");
-                if (internalDns2 != null) {
-                    addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, internalDns2);
-                }
-            }
-        }
-
-        _pubIp = (String)params.get("public.ip");
-
-        value = (String)params.get("disable_rp_filter");
-        if (value != null && value.equalsIgnoreCase("true")) {
-            disableRpFilter();
-        }
-
-        if (s_logger.isInfoEnabled())
-            s_logger.info("Receive proxyVmId in ConsoleProxyResource configuration as " + _proxyVmId);
-
-        return true;
-    }
-
-    private void addRouteToInternalIpOrCidr(String localgw, String eth1ip, String eth1mask, String destIpOrCidr) {
-        s_logger.debug("addRouteToInternalIp: localgw=" + localgw + ", eth1ip=" + eth1ip + ", eth1mask=" + eth1mask + ",destIp=" + destIpOrCidr);
-        if (destIpOrCidr == null) {
-            s_logger.debug("addRouteToInternalIp: destIp is null");
-            return;
-        }
-        if (!NetUtils.isValidIp4(destIpOrCidr) && !NetUtils.isValidIp4Cidr(destIpOrCidr)) {
-            s_logger.warn(" destIp is not a valid ip address or cidr destIp=" + destIpOrCidr);
-            return;
-        }
-        boolean inSameSubnet = false;
-        if (NetUtils.isValidIp4(destIpOrCidr)) {
-            if (eth1ip != null && eth1mask != null) {
-                inSameSubnet = NetUtils.sameSubnet(eth1ip, destIpOrCidr, eth1mask);
-            } else {
-                s_logger.warn("addRouteToInternalIp: unable to determine same subnet: _eth1ip=" + eth1ip + ", dest ip=" + destIpOrCidr + ", _eth1mask=" + eth1mask);
-            }
-        } else {
-            inSameSubnet = NetUtils.isNetworkAWithinNetworkB(destIpOrCidr, NetUtils.ipAndNetMaskToCidr(eth1ip, eth1mask));
-        }
-        if (inSameSubnet) {
-            s_logger.debug("addRouteToInternalIp: dest ip " + destIpOrCidr + " is in the same subnet as eth1 ip " + eth1ip);
-            return;
-        }
-        Script command = new Script("/bin/bash", s_logger);
-        command.add("-c");
-        command.add("ip route delete " + destIpOrCidr);
-        command.execute();
-        command = new Script("/bin/bash", s_logger);
-        command.add("-c");
-        command.add("ip route add " + destIpOrCidr + " via " + localgw);
-        String result = command.execute();
-        if (result != null) {
-            s_logger.warn("Error in configuring route to internal ip err=" + result);
-        } else {
-            s_logger.debug("addRouteToInternalIp: added route to internal ip=" + destIpOrCidr + " via " + localgw);
-        }
-    }
-
-    @Override
-    public String getName() {
-        return _name;
-    }
-
-    private void launchConsoleProxy(final byte[] ksBits, final String ksPassword, final String encryptorPassword) {
-        final Object resource = this;
-        s_logger.info("Building class loader for com.cloud.consoleproxy.ConsoleProxy");
-        final ClassLoader loader = ReflectUtil.getClassLoaderForName("console-proxy");
-        if (_consoleProxyMain == null) {
-            s_logger.info("Running com.cloud.consoleproxy.ConsoleProxy with encryptor password=" + encryptorPassword);
-            _consoleProxyMain = new Thread(new ManagedContextRunnable() {
-                @Override
-                protected void runInContext() {
-                    try {
-                        Class<?> consoleProxyClazz = loader.loadClass("com.cloud.consoleproxy.ConsoleProxy");
-                        try {
-                            s_logger.info("Invoke startWithContext()");
-                            Method method = consoleProxyClazz.getMethod("startWithContext", Properties.class, Object.class, byte[].class, String.class, String.class);
-                            method.invoke(null, _properties, resource, ksBits, ksPassword, encryptorPassword);
-                        } catch (SecurityException e) {
-                            s_logger.error("Unable to launch console proxy due to SecurityException", e);
-                            System.exit(ExitStatus.Error.value());
-                        } catch (NoSuchMethodException e) {
-                            s_logger.error("Unable to launch console proxy due to NoSuchMethodException", e);
-                            System.exit(ExitStatus.Error.value());
-                        } catch (IllegalArgumentException e) {
-                            s_logger.error("Unable to launch console proxy due to IllegalArgumentException", e);
-                            System.exit(ExitStatus.Error.value());
-                        } catch (IllegalAccessException e) {
-                            s_logger.error("Unable to launch console proxy due to IllegalAccessException", e);
-                            System.exit(ExitStatus.Error.value());
-                        } catch (InvocationTargetException e) {
-                            s_logger.error("Unable to launch console proxy due to InvocationTargetException " + e.getTargetException().toString(), e);
-                            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();
-        } else {
-            s_logger.info("com.cloud.consoleproxy.ConsoleProxy is already running");
-
-            try {
-                Class<?> consoleProxyClazz = loader.loadClass("com.cloud.consoleproxy.ConsoleProxy");
-                Method methodSetup = consoleProxyClazz.getMethod("setEncryptorPassword", String.class);
-                methodSetup.invoke(null, encryptorPassword);
-            } catch (SecurityException e) {
-                s_logger.error("Unable to launch console proxy due to SecurityException", e);
-                System.exit(ExitStatus.Error.value());
-            } catch (NoSuchMethodException e) {
-                s_logger.error("Unable to launch console proxy due to NoSuchMethodException", e);
-                System.exit(ExitStatus.Error.value());
-            } catch (IllegalArgumentException e) {
-                s_logger.error("Unable to launch console proxy due to IllegalArgumentException", e);
-                System.exit(ExitStatus.Error.value());
-            } catch (IllegalAccessException e) {
-                s_logger.error("Unable to launch console proxy due to IllegalAccessException", e);
-                System.exit(ExitStatus.Error.value());
-            } catch (InvocationTargetException e) {
-                s_logger.error("Unable to launch console proxy due to InvocationTargetException " + e.getTargetException().toString(), e);
-                System.exit(ExitStatus.Error.value());
-            } catch (final ClassNotFoundException e) {
-                s_logger.error("Unable to launch console proxy due to ClassNotFoundException", e);
-                System.exit(ExitStatus.Error.value());
-            }
-        }
-    }
-
-    public String authenticateConsoleAccess(String host, String port, String vmId, String sid, String ticket, Boolean isReauthentication) {
-
-        ConsoleAccessAuthenticationCommand cmd = new ConsoleAccessAuthenticationCommand(host, port, vmId, sid, ticket);
-        cmd.setReauthenticating(isReauthentication);
-
-        ConsoleProxyAuthenticationResult result = new ConsoleProxyAuthenticationResult();
-        result.setSuccess(false);
-        result.setReauthentication(isReauthentication);
-
-        try {
-            AgentControlAnswer answer = getAgentControl().sendRequest(cmd, 10000);
-
-            if (answer != null) {
-                ConsoleAccessAuthenticationAnswer authAnswer = (ConsoleAccessAuthenticationAnswer)answer;
-                result.setSuccess(authAnswer.succeeded());
-                result.setHost(authAnswer.getHost());
-                result.setPort(authAnswer.getPort());
-                result.setTunnelUrl(authAnswer.getTunnelUrl());
-                result.setTunnelSession(authAnswer.getTunnelSession());
-            } else {
-                s_logger.error("Authentication failed for vm: " + vmId + " with sid: " + sid);
-            }
-        } catch (AgentControlChannelException e) {
-            s_logger.error("Unable to send out console access authentication request due to " + e.getMessage(), e);
-        }
-
-        return new Gson().toJson(result);
-    }
-
-    public void reportLoadInfo(String gsonLoadInfo) {
-        ConsoleProxyLoadReportCommand cmd = new ConsoleProxyLoadReportCommand(_proxyVmId, gsonLoadInfo);
-        try {
-            getAgentControl().postRequest(cmd);
-
-            if (s_logger.isDebugEnabled())
-                s_logger.debug("Report proxy load info, proxy : " + _proxyVmId + ", load: " + gsonLoadInfo);
-        } catch (AgentControlChannelException e) {
-            s_logger.error("Unable to send out load info due to " + e.getMessage(), e);
-        }
-    }
-
-    public void ensureRoute(String address) {
-        if (_localgw != null) {
-            if (s_logger.isDebugEnabled())
-                s_logger.debug("Ensure route for " + address + " via " + _localgw);
-
-            // this method won't be called in high frequency, serialize access
-            // to script execution
-            synchronized (this) {
-                try {
-                    addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, address);
-                } catch (Throwable e) {
-                    s_logger.warn("Unexpected exception while adding internal route to " + address, e);
-                }
-            }
-        }
-    }
-
-    @Override
-    public void setName(String name) {
-    }
-
-    @Override
-    public void setConfigParams(Map<String, Object> params) {
-    }
-
-    @Override
-    public Map<String, Object> getConfigParams() {
-        return new HashMap<String, Object>();
-    }
-
-    @Override
-    public int getRunLevel() {
-        return 0;
-    }
-
-    @Override
-    public void setRunLevel(int level) {
-    }
-}
diff --git a/agent/src/com/cloud/agent/Agent.java b/agent/src/main/java/com/cloud/agent/Agent.java
similarity index 100%
rename from agent/src/com/cloud/agent/Agent.java
rename to agent/src/main/java/com/cloud/agent/Agent.java
diff --git a/agent/src/com/cloud/agent/AgentShell.java b/agent/src/main/java/com/cloud/agent/AgentShell.java
similarity index 100%
rename from agent/src/com/cloud/agent/AgentShell.java
rename to agent/src/main/java/com/cloud/agent/AgentShell.java
diff --git a/agent/src/com/cloud/agent/IAgentShell.java b/agent/src/main/java/com/cloud/agent/IAgentShell.java
similarity index 100%
rename from agent/src/com/cloud/agent/IAgentShell.java
rename to agent/src/main/java/com/cloud/agent/IAgentShell.java
diff --git a/agent/src/com/cloud/agent/dao/StorageComponent.java b/agent/src/main/java/com/cloud/agent/dao/StorageComponent.java
similarity index 100%
rename from agent/src/com/cloud/agent/dao/StorageComponent.java
rename to agent/src/main/java/com/cloud/agent/dao/StorageComponent.java
diff --git a/agent/src/com/cloud/agent/dao/impl/PropertiesStorage.java b/agent/src/main/java/com/cloud/agent/dao/impl/PropertiesStorage.java
similarity index 100%
rename from agent/src/com/cloud/agent/dao/impl/PropertiesStorage.java
rename to agent/src/main/java/com/cloud/agent/dao/impl/PropertiesStorage.java
diff --git a/agent/src/com/cloud/agent/dhcp/DhcpProtocolParserServer.java b/agent/src/main/java/com/cloud/agent/dhcp/DhcpProtocolParserServer.java
similarity index 100%
rename from agent/src/com/cloud/agent/dhcp/DhcpProtocolParserServer.java
rename to agent/src/main/java/com/cloud/agent/dhcp/DhcpProtocolParserServer.java
diff --git a/agent/src/com/cloud/agent/dhcp/DhcpSnooper.java b/agent/src/main/java/com/cloud/agent/dhcp/DhcpSnooper.java
similarity index 100%
rename from agent/src/com/cloud/agent/dhcp/DhcpSnooper.java
rename to agent/src/main/java/com/cloud/agent/dhcp/DhcpSnooper.java
diff --git a/agent/src/com/cloud/agent/dhcp/FakeDhcpSnooper.java b/agent/src/main/java/com/cloud/agent/dhcp/FakeDhcpSnooper.java
similarity index 100%
rename from agent/src/com/cloud/agent/dhcp/FakeDhcpSnooper.java
rename to agent/src/main/java/com/cloud/agent/dhcp/FakeDhcpSnooper.java
diff --git a/agent/src/com/cloud/agent/direct/download/DirectTemplateDownloader.java b/agent/src/main/java/com/cloud/agent/direct/download/DirectTemplateDownloader.java
similarity index 100%
rename from agent/src/com/cloud/agent/direct/download/DirectTemplateDownloader.java
rename to agent/src/main/java/com/cloud/agent/direct/download/DirectTemplateDownloader.java
diff --git a/agent/src/com/cloud/agent/direct/download/DirectTemplateDownloaderImpl.java b/agent/src/main/java/com/cloud/agent/direct/download/DirectTemplateDownloaderImpl.java
similarity index 100%
rename from agent/src/com/cloud/agent/direct/download/DirectTemplateDownloaderImpl.java
rename to agent/src/main/java/com/cloud/agent/direct/download/DirectTemplateDownloaderImpl.java
diff --git a/agent/src/com/cloud/agent/direct/download/HttpDirectTemplateDownloader.java b/agent/src/main/java/com/cloud/agent/direct/download/HttpDirectTemplateDownloader.java
similarity index 100%
rename from agent/src/com/cloud/agent/direct/download/HttpDirectTemplateDownloader.java
rename to agent/src/main/java/com/cloud/agent/direct/download/HttpDirectTemplateDownloader.java
diff --git a/agent/src/com/cloud/agent/direct/download/HttpsDirectTemplateDownloader.java b/agent/src/main/java/com/cloud/agent/direct/download/HttpsDirectTemplateDownloader.java
similarity index 100%
rename from agent/src/com/cloud/agent/direct/download/HttpsDirectTemplateDownloader.java
rename to agent/src/main/java/com/cloud/agent/direct/download/HttpsDirectTemplateDownloader.java
diff --git a/agent/src/com/cloud/agent/direct/download/MetalinkDirectTemplateDownloader.java b/agent/src/main/java/com/cloud/agent/direct/download/MetalinkDirectTemplateDownloader.java
similarity index 100%
rename from agent/src/com/cloud/agent/direct/download/MetalinkDirectTemplateDownloader.java
rename to agent/src/main/java/com/cloud/agent/direct/download/MetalinkDirectTemplateDownloader.java
diff --git a/agent/src/com/cloud/agent/direct/download/NfsDirectTemplateDownloader.java b/agent/src/main/java/com/cloud/agent/direct/download/NfsDirectTemplateDownloader.java
similarity index 100%
rename from agent/src/com/cloud/agent/direct/download/NfsDirectTemplateDownloader.java
rename to agent/src/main/java/com/cloud/agent/direct/download/NfsDirectTemplateDownloader.java
diff --git a/agent/src/com/cloud/agent/mockvm/MockVm.java b/agent/src/main/java/com/cloud/agent/mockvm/MockVm.java
similarity index 100%
rename from agent/src/com/cloud/agent/mockvm/MockVm.java
rename to agent/src/main/java/com/cloud/agent/mockvm/MockVm.java
diff --git a/agent/src/com/cloud/agent/mockvm/MockVmMgr.java b/agent/src/main/java/com/cloud/agent/mockvm/MockVmMgr.java
similarity index 100%
rename from agent/src/com/cloud/agent/mockvm/MockVmMgr.java
rename to agent/src/main/java/com/cloud/agent/mockvm/MockVmMgr.java
diff --git a/agent/src/com/cloud/agent/mockvm/VmMgr.java b/agent/src/main/java/com/cloud/agent/mockvm/VmMgr.java
similarity index 100%
rename from agent/src/com/cloud/agent/mockvm/VmMgr.java
rename to agent/src/main/java/com/cloud/agent/mockvm/VmMgr.java
diff --git a/agent/src/com/cloud/agent/resource/DummyResource.java b/agent/src/main/java/com/cloud/agent/resource/DummyResource.java
similarity index 100%
rename from agent/src/com/cloud/agent/resource/DummyResource.java
rename to agent/src/main/java/com/cloud/agent/resource/DummyResource.java
diff --git a/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyAuthenticationResult.java b/agent/src/main/java/com/cloud/agent/resource/consoleproxy/ConsoleProxyAuthenticationResult.java
similarity index 100%
rename from agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyAuthenticationResult.java
rename to agent/src/main/java/com/cloud/agent/resource/consoleproxy/ConsoleProxyAuthenticationResult.java
diff --git a/agent/src/main/java/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java b/agent/src/main/java/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java
new file mode 100644
index 00000000000..fb5e32771a3
--- /dev/null
+++ b/agent/src/main/java/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java
@@ -0,0 +1,464 @@
+// 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.resource.consoleproxy;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.naming.ConfigurationException;
+
+import org.apache.cloudstack.managed.context.ManagedContextRunnable;
+import org.apache.log4j.Logger;
+
+import com.cloud.agent.Agent.ExitStatus;
+import com.cloud.agent.api.AgentControlAnswer;
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.CheckHealthAnswer;
+import com.cloud.agent.api.CheckHealthCommand;
+import com.cloud.agent.api.Command;
+import com.cloud.agent.api.ConsoleAccessAuthenticationAnswer;
+import com.cloud.agent.api.ConsoleAccessAuthenticationCommand;
+import com.cloud.agent.api.ConsoleProxyLoadReportCommand;
+import com.cloud.agent.api.PingCommand;
+import com.cloud.agent.api.ReadyAnswer;
+import com.cloud.agent.api.ReadyCommand;
+import com.cloud.agent.api.StartupCommand;
+import com.cloud.agent.api.StartupProxyCommand;
+import com.cloud.agent.api.proxy.CheckConsoleProxyLoadCommand;
+import com.cloud.agent.api.proxy.ConsoleProxyLoadAnswer;
+import com.cloud.agent.api.proxy.StartConsoleProxyAgentHttpHandlerCommand;
+import com.cloud.agent.api.proxy.WatchConsoleProxyLoadCommand;
+import com.cloud.exception.AgentControlChannelException;
+import com.cloud.host.Host;
+import com.cloud.host.Host.Type;
+import com.cloud.resource.ServerResource;
+import com.cloud.resource.ServerResourceBase;
+import com.cloud.utils.NumbersUtil;
+import com.cloud.utils.ReflectUtil;
+import com.cloud.utils.net.NetUtils;
+import com.cloud.utils.script.Script;
+import com.google.gson.Gson;
+
+/**
+ *
+ * I don't want to introduce extra cross-cutting concerns into console proxy
+ * process, as it involves configurations like zone/pod, agent auto self-upgrade
+ * etc. I also don't want to introduce more module dependency issues into our
+ * build system, cross-communication between this resource and console proxy
+ * will be done through reflection. As a result, come out with following
+ * solution to solve the problem of building a communication channel between
+ * consoole proxy and management server.
+ *
+ * We will deploy an agent shell inside console proxy VM, and this agent shell
+ * will launch current console proxy from within this special server resource,
+ * through it console proxy can build a communication channel with management
+ * server.
+ *
+ */
+public class ConsoleProxyResource extends ServerResourceBase implements ServerResource {
+    static final Logger s_logger = Logger.getLogger(ConsoleProxyResource.class);
+
+    private final Properties _properties = new Properties();
+    private Thread _consoleProxyMain = null;
+
+    long _proxyVmId;
+    int _proxyPort;
+
+    String _localgw;
+    String _eth1ip;
+    String _eth1mask;
+    String _pubIp;
+
+    @Override
+    public Answer executeRequest(final Command cmd) {
+        if (cmd instanceof CheckConsoleProxyLoadCommand) {
+            return execute((CheckConsoleProxyLoadCommand)cmd);
+        } else if (cmd instanceof WatchConsoleProxyLoadCommand) {
+            return execute((WatchConsoleProxyLoadCommand)cmd);
+        } else if (cmd instanceof ReadyCommand) {
+            s_logger.info("Receive ReadyCommand, response with ReadyAnswer");
+            return new ReadyAnswer((ReadyCommand)cmd);
+        } else if (cmd instanceof CheckHealthCommand) {
+            return new CheckHealthAnswer((CheckHealthCommand)cmd, true);
+        } else if (cmd instanceof StartConsoleProxyAgentHttpHandlerCommand) {
+            return execute((StartConsoleProxyAgentHttpHandlerCommand)cmd);
+        } else {
+            return Answer.createUnsupportedCommandAnswer(cmd);
+        }
+    }
+
+    private Answer execute(StartConsoleProxyAgentHttpHandlerCommand cmd) {
+        s_logger.info("Invoke launchConsoleProxy() in responding to StartConsoleProxyAgentHttpHandlerCommand");
+        launchConsoleProxy(cmd.getKeystoreBits(), cmd.getKeystorePassword(), cmd.getEncryptorPassword());
+        return new Answer(cmd);
+    }
+
+    private void disableRpFilter() {
+        try (FileWriter fstream = new FileWriter("/proc/sys/net/ipv4/conf/eth2/rp_filter");
+             BufferedWriter out = new BufferedWriter(fstream);)
+        {
+            out.write("0");
+        } catch (IOException e) {
+            s_logger.warn("Unable to disable rp_filter");
+        }
+    }
+
+    protected Answer execute(final CheckConsoleProxyLoadCommand cmd) {
+        return executeProxyLoadScan(cmd, cmd.getProxyVmId(), cmd.getProxyVmName(), cmd.getProxyManagementIp(), cmd.getProxyCmdPort());
+    }
+
+    protected Answer execute(final WatchConsoleProxyLoadCommand cmd) {
+        return executeProxyLoadScan(cmd, cmd.getProxyVmId(), cmd.getProxyVmName(), cmd.getProxyManagementIp(), cmd.getProxyCmdPort());
+    }
+
+    private Answer executeProxyLoadScan(final Command cmd, final long proxyVmId, final String proxyVmName, final String proxyManagementIp, final int cmdPort) {
+        String result = null;
+
+        final StringBuffer sb = new StringBuffer();
+        sb.append("http://").append(proxyManagementIp).append(":" + cmdPort).append("/cmd/getstatus");
+
+        boolean success = true;
+        try {
+            final URL url = new URL(sb.toString());
+            final URLConnection conn = url.openConnection();
+
+            final InputStream is = conn.getInputStream();
+            final BufferedReader reader = new BufferedReader(new InputStreamReader(is,"UTF-8"));
+            final StringBuilder sb2 = new StringBuilder();
+            String line = null;
+            try {
+                while ((line = reader.readLine()) != null)
+                    sb2.append(line + "\n");
+                result = sb2.toString();
+            } catch (final IOException e) {
+                success = false;
+            } finally {
+                try {
+                    is.close();
+                } catch (final IOException e) {
+                    s_logger.warn("Exception when closing , console proxy address : " + proxyManagementIp);
+                    success = false;
+                }
+            }
+        } catch (final IOException e) {
+            s_logger.warn("Unable to open console proxy command port url, console proxy address : " + proxyManagementIp);
+            success = false;
+        }
+
+        return new ConsoleProxyLoadAnswer(cmd, proxyVmId, proxyVmName, success, result);
+    }
+
+    @Override
+    protected String getDefaultScriptsDir() {
+        return null;
+    }
+
+    @Override
+    public Type getType() {
+        return Host.Type.ConsoleProxy;
+    }
+
+    @Override
+    public synchronized StartupCommand[] initialize() {
+        final StartupProxyCommand cmd = new StartupProxyCommand();
+        fillNetworkInformation(cmd);
+        cmd.setProxyPort(_proxyPort);
+        cmd.setProxyVmId(_proxyVmId);
+        if (_pubIp != null)
+            cmd.setPublicIpAddress(_pubIp);
+        return new StartupCommand[] {cmd};
+    }
+
+    @Override
+    public void disconnected() {
+    }
+
+    @Override
+    public PingCommand getCurrentStatus(long id) {
+        return new PingCommand(Type.ConsoleProxy, id);
+    }
+
+    @Override
+    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
+        _localgw = (String)params.get("localgw");
+        _eth1mask = (String)params.get("eth1mask");
+        _eth1ip = (String)params.get("eth1ip");
+        if (_eth1ip != null) {
+            params.put("private.network.device", "eth1");
+        } else {
+            s_logger.info("eth1ip parameter has not been configured, assuming that we are not inside a system vm");
+        }
+
+        String eth2ip = (String)params.get("eth2ip");
+        if (eth2ip != null) {
+            params.put("public.network.device", "eth2");
+        } else {
+            s_logger.info("eth2ip parameter is not found, assuming that we are not inside a system vm");
+        }
+
+        super.configure(name, params);
+
+        for (Map.Entry<String, Object> entry : params.entrySet()) {
+            _properties.put(entry.getKey(), entry.getValue());
+        }
+
+        String value = (String)params.get("premium");
+        if (value != null && value.equals("premium"))
+            _proxyPort = 443;
+        else {
+            value = (String)params.get("consoleproxy.httpListenPort");
+            _proxyPort = NumbersUtil.parseInt(value, 80);
+        }
+
+        value = (String)params.get("proxy_vm");
+        _proxyVmId = NumbersUtil.parseLong(value, 0);
+
+        if (_localgw != null) {
+            String mgmtHosts = (String)params.get("host");
+            if (_eth1ip != null) {
+                for (final String mgmtHost : mgmtHosts.split(",")) {
+                    addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, mgmtHost);
+                }
+                String internalDns1 = (String) params.get("internaldns1");
+                if (internalDns1 == null) {
+                    s_logger.warn("No DNS entry found during configuration of ConsoleProxy");
+                } else {
+                    addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, internalDns1);
+                }
+                String internalDns2 = (String) params.get("internaldns2");
+                if (internalDns2 != null) {
+                    addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, internalDns2);
+                }
+            }
+        }
+
+        _pubIp = (String)params.get("public.ip");
+
+        value = (String)params.get("disable_rp_filter");
+        if (value != null && value.equalsIgnoreCase("true")) {
+            disableRpFilter();
+        }
+
+        if (s_logger.isInfoEnabled())
+            s_logger.info("Receive proxyVmId in ConsoleProxyResource configuration as " + _proxyVmId);
+
+        return true;
+    }
+
+    private void addRouteToInternalIpOrCidr(String localgw, String eth1ip, String eth1mask, String destIpOrCidr) {
+        s_logger.debug("addRouteToInternalIp: localgw=" + localgw + ", eth1ip=" + eth1ip + ", eth1mask=" + eth1mask + ",destIp=" + destIpOrCidr);
+        if (destIpOrCidr == null) {
+            s_logger.debug("addRouteToInternalIp: destIp is null");
+            return;
+        }
+        if (!NetUtils.isValidIp4(destIpOrCidr) && !NetUtils.isValidIp4Cidr(destIpOrCidr)) {
+            s_logger.warn(" destIp is not a valid ip address or cidr destIp=" + destIpOrCidr);
+            return;
+        }
+        boolean inSameSubnet = false;
+        if (NetUtils.isValidIp4(destIpOrCidr)) {
+            if (eth1ip != null && eth1mask != null) {
+                inSameSubnet = NetUtils.sameSubnet(eth1ip, destIpOrCidr, eth1mask);
+            } else {
+                s_logger.warn("addRouteToInternalIp: unable to determine same subnet: _eth1ip=" + eth1ip + ", dest ip=" + destIpOrCidr + ", _eth1mask=" + eth1mask);
+            }
+        } else {
+            inSameSubnet = NetUtils.isNetworkAWithinNetworkB(destIpOrCidr, NetUtils.ipAndNetMaskToCidr(eth1ip, eth1mask));
+        }
+        if (inSameSubnet) {
+            s_logger.debug("addRouteToInternalIp: dest ip " + destIpOrCidr + " is in the same subnet as eth1 ip " + eth1ip);
+            return;
+        }
+        Script command = new Script("/bin/bash", s_logger);
+        command.add("-c");
+        command.add("ip route delete " + destIpOrCidr);
+        command.execute();
+        command = new Script("/bin/bash", s_logger);
+        command.add("-c");
+        command.add("ip route add " + destIpOrCidr + " via " + localgw);
+        String result = command.execute();
+        if (result != null) {
+            s_logger.warn("Error in configuring route to internal ip err=" + result);
+        } else {
+            s_logger.debug("addRouteToInternalIp: added route to internal ip=" + destIpOrCidr + " via " + localgw);
+        }
+    }
+
+    @Override
+    public String getName() {
+        return _name;
+    }
+
+    private void launchConsoleProxy(final byte[] ksBits, final String ksPassword, final String encryptorPassword) {
+        final Object resource = this;
+        s_logger.info("Building class loader for com.cloud.consoleproxy.ConsoleProxy");
+        final ClassLoader loader = ReflectUtil.getClassLoaderForName("console-proxy");
+        if (_consoleProxyMain == null) {
+            s_logger.info("Running com.cloud.consoleproxy.ConsoleProxy with encryptor password=" + encryptorPassword);
+            _consoleProxyMain = new Thread(new ManagedContextRunnable() {
+                @Override
+                protected void runInContext() {
+                    try {
+                        Class<?> consoleProxyClazz = loader.loadClass("com.cloud.consoleproxy.ConsoleProxy");
+                        try {
+                            s_logger.info("Invoke startWithContext()");
+                            Method method = consoleProxyClazz.getMethod("startWithContext", Properties.class, Object.class, byte[].class, String.class, String.class);
+                            method.invoke(null, _properties, resource, ksBits, ksPassword, encryptorPassword);
+                        } catch (SecurityException e) {
+                            s_logger.error("Unable to launch console proxy due to SecurityException", e);
+                            System.exit(ExitStatus.Error.value());
+                        } catch (NoSuchMethodException e) {
+                            s_logger.error("Unable to launch console proxy due to NoSuchMethodException", e);
+                            System.exit(ExitStatus.Error.value());
+                        } catch (IllegalArgumentException e) {
+                            s_logger.error("Unable to launch console proxy due to IllegalArgumentException", e);
+                            System.exit(ExitStatus.Error.value());
+                        } catch (IllegalAccessException e) {
+                            s_logger.error("Unable to launch console proxy due to IllegalAccessException", e);
+                            System.exit(ExitStatus.Error.value());
+                        } catch (InvocationTargetException e) {
+                            s_logger.error("Unable to launch console proxy due to InvocationTargetException " + e.getTargetException().toString(), e);
+                            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();
+        } else {
+            s_logger.info("com.cloud.consoleproxy.ConsoleProxy is already running");
+
+            try {
+                Class<?> consoleProxyClazz = loader.loadClass("com.cloud.consoleproxy.ConsoleProxy");
+                Method methodSetup = consoleProxyClazz.getMethod("setEncryptorPassword", String.class);
+                methodSetup.invoke(null, encryptorPassword);
+            } catch (SecurityException e) {
+                s_logger.error("Unable to launch console proxy due to SecurityException", e);
+                System.exit(ExitStatus.Error.value());
+            } catch (NoSuchMethodException e) {
+                s_logger.error("Unable to launch console proxy due to NoSuchMethodException", e);
+                System.exit(ExitStatus.Error.value());
+            } catch (IllegalArgumentException e) {
+                s_logger.error("Unable to launch console proxy due to IllegalArgumentException", e);
+                System.exit(ExitStatus.Error.value());
+            } catch (IllegalAccessException e) {
+                s_logger.error("Unable to launch console proxy due to IllegalAccessException", e);
+                System.exit(ExitStatus.Error.value());
+            } catch (InvocationTargetException e) {
+                s_logger.error("Unable to launch console proxy due to InvocationTargetException " + e.getTargetException().toString(), e);
+                System.exit(ExitStatus.Error.value());
+            } catch (final ClassNotFoundException e) {
+                s_logger.error("Unable to launch console proxy due to ClassNotFoundException", e);
+                System.exit(ExitStatus.Error.value());
+            }
+        }
+    }
+
+    public String authenticateConsoleAccess(String host, String port, String vmId, String sid, String ticket, Boolean isReauthentication) {
+
+        ConsoleAccessAuthenticationCommand cmd = new ConsoleAccessAuthenticationCommand(host, port, vmId, sid, ticket);
+        cmd.setReauthenticating(isReauthentication);
+
+        ConsoleProxyAuthenticationResult result = new ConsoleProxyAuthenticationResult();
+        result.setSuccess(false);
+        result.setReauthentication(isReauthentication);
+
+        try {
+            AgentControlAnswer answer = getAgentControl().sendRequest(cmd, 10000);
+
+            if (answer != null) {
+                ConsoleAccessAuthenticationAnswer authAnswer = (ConsoleAccessAuthenticationAnswer)answer;
+                result.setSuccess(authAnswer.succeeded());
+                result.setHost(authAnswer.getHost());
+                result.setPort(authAnswer.getPort());
+                result.setTunnelUrl(authAnswer.getTunnelUrl());
+                result.setTunnelSession(authAnswer.getTunnelSession());
+            } else {
+                s_logger.error("Authentication failed for vm: " + vmId + " with sid: " + sid);
+            }
+        } catch (AgentControlChannelException e) {
+            s_logger.error("Unable to send out console access authentication request due to " + e.getMessage(), e);
+        }
+
+        return new Gson().toJson(result);
+    }
+
+    public void reportLoadInfo(String gsonLoadInfo) {
+        ConsoleProxyLoadReportCommand cmd = new ConsoleProxyLoadReportCommand(_proxyVmId, gsonLoadInfo);
+        try {
+            getAgentControl().postRequest(cmd);
+
+            if (s_logger.isDebugEnabled())
+                s_logger.debug("Report proxy load info, proxy : " + _proxyVmId + ", load: " + gsonLoadInfo);
+        } catch (AgentControlChannelException e) {
+            s_logger.error("Unable to send out load info due to " + e.getMessage(), e);
+        }
+    }
+
+    public void ensureRoute(String address) {
+        if (_localgw != null) {
+            if (s_logger.isDebugEnabled())
+                s_logger.debug("Ensure route for " + address + " via " + _localgw);
+
+            // this method won't be called in high frequency, serialize access
+            // to script execution
+            synchronized (this) {
+                try {
+                    addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, address);
+                } catch (Throwable e) {
+                    s_logger.warn("Unexpected exception while adding internal route to " + address, e);
+                }
+            }
+        }
+    }
+
+    @Override
+    public void setName(String name) {
+    }
+
+    @Override
+    public void setConfigParams(Map<String, Object> params) {
+    }
+
+    @Override
+    public Map<String, Object> getConfigParams() {
+        return new HashMap<String, Object>();
+    }
+
+    @Override
+    public int getRunLevel() {
+        return 0;
+    }
+
+    @Override
+    public void setRunLevel(int level) {
+    }
+}
diff --git a/agent/src/com/cloud/agent/vmdata/VmDataServer.java b/agent/src/main/java/com/cloud/agent/vmdata/VmDataServer.java
similarity index 100%
rename from agent/src/com/cloud/agent/vmdata/VmDataServer.java
rename to agent/src/main/java/com/cloud/agent/vmdata/VmDataServer.java
diff --git a/agent/test/com/cloud/agent/AgentShellTest.java b/agent/src/test/java/com/cloud/agent/AgentShellTest.java
similarity index 100%
rename from agent/test/com/cloud/agent/AgentShellTest.java
rename to agent/src/test/java/com/cloud/agent/AgentShellTest.java
diff --git a/agent/test/com/cloud/agent/dao/impl/PropertiesStorageTest.java b/agent/src/test/java/com/cloud/agent/dao/impl/PropertiesStorageTest.java
similarity index 100%
rename from agent/test/com/cloud/agent/dao/impl/PropertiesStorageTest.java
rename to agent/src/test/java/com/cloud/agent/dao/impl/PropertiesStorageTest.java
diff --git a/agent/test/com/cloud/agent/direct/download/DirectTemplateDownloaderImplTest.java b/agent/src/test/java/com/cloud/agent/direct/download/DirectTemplateDownloaderImplTest.java
similarity index 100%
rename from agent/test/com/cloud/agent/direct/download/DirectTemplateDownloaderImplTest.java
rename to agent/src/test/java/com/cloud/agent/direct/download/DirectTemplateDownloaderImplTest.java
diff --git a/api/pom.xml b/api/pom.xml
index b0a8c160f50..e8cea9ceb16 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -23,7 +23,7 @@
   <parent>
     <groupId>org.apache.cloudstack</groupId>
     <artifactId>cloudstack</artifactId>
-    <version>4.11.1.0-SNAPSHOT</version>
+    <version>4.12.0.0-SNAPSHOT</version>
   </parent>
   <dependencies>
     <dependency>
diff --git a/api/src/com/cloud/alert/Alert.java b/api/src/com/cloud/alert/Alert.java
deleted file mode 100644
index f77442068d6..00000000000
--- a/api/src/com/cloud/alert/Alert.java
+++ /dev/null
@@ -1,44 +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.alert;
-
-import java.util.Date;
-
-import org.apache.cloudstack.api.Identity;
-import org.apache.cloudstack.api.InternalIdentity;
-
-public interface Alert extends Identity, InternalIdentity {
-    short getType();
-
-    String getSubject();
-
-    Long getPodId();
-
-    long getDataCenterId();
-
-    int getSentCount();
-
-    Date getCreatedDate();
-
-    Date getLastSent();
-
-    Date getResolved();
-
-    boolean getArchived();
-
-    String getName();
-}
diff --git a/api/src/com/cloud/network/vpc/NetworkACLItem.java b/api/src/com/cloud/network/vpc/NetworkACLItem.java
deleted file mode 100644
index 75153fd7c5a..00000000000
--- a/api/src/com/cloud/network/vpc/NetworkACLItem.java
+++ /dev/null
@@ -1,81 +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.vpc;
-
-import java.util.List;
-
-import org.apache.cloudstack.api.Displayable;
-import org.apache.cloudstack.api.Identity;
-import org.apache.cloudstack.api.InternalIdentity;
-
-public interface NetworkACLItem extends InternalIdentity, Identity, Displayable {
-
-    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<String> getSourceCidrList();
-
-    /**
-     * @return
-     */
-    TrafficType getTrafficType();
-
-    @Override
-    boolean isDisplay();
-
-}
diff --git a/api/src/com/cloud/network/vpc/NetworkACLService.java b/api/src/com/cloud/network/vpc/NetworkACLService.java
deleted file mode 100644
index f08fff5425d..00000000000
--- a/api/src/com/cloud/network/vpc/NetworkACLService.java
+++ /dev/null
@@ -1,136 +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.vpc;
-
-import java.util.List;
-
-import org.apache.cloudstack.api.command.user.network.CreateNetworkACLCmd;
-import org.apache.cloudstack.api.command.user.network.ListNetworkACLListsCmd;
-import org.apache.cloudstack.api.command.user.network.ListNetworkACLsCmd;
-
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.utils.Pair;
-
-public interface NetworkACLService {
-    /**
-     * Creates Network ACL for the specified VPC
-     * @param name
-     * @param description
-     * @param vpcId
-     * @param forDisplay TODO
-     * @return
-     */
-    NetworkACL createNetworkACL(String name, String description, long vpcId, Boolean forDisplay);
-
-    /**
-     * 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 cmd
-     * @return
-     */
-    Pair<List<? extends NetworkACL>, Integer> listNetworkACLs(ListNetworkACLListsCmd cmd);
-
-    /**
-     * 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<List<? extends NetworkACLItem>, Integer> listNetworkACLItems(ListNetworkACLsCmd cmd);
-
-    /**
-     * Revoke ACL Item with specified Id
-     * @param ruleId
-     * @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
-     * @param newUUID TODO
-     * @param forDisplay TODO
-     * @return
-     * @throws ResourceUnavailableException
-     */
-    NetworkACLItem updateNetworkACLItem(Long id, String protocol, List<String> sourceCidrList, NetworkACLItem.TrafficType trafficType, String action, Integer number,
-            Integer sourcePortStart, Integer sourcePortEnd, Integer icmpCode, Integer icmpType, String newUUID, Boolean forDisplay) throws ResourceUnavailableException;
-
-    /**
-     * Associates ACL with specified Network
-     * @param aclId
-     * @param privateGatewayId
-     * @return
-     * @throws ResourceUnavailableException
-     */
-    boolean replaceNetworkACLonPrivateGw(long aclId, long privateGatewayId) throws ResourceUnavailableException;
-
-    NetworkACL updateNetworkACL(Long id, String customId, Boolean forDisplay);
-
-}
diff --git a/api/src/com/cloud/resource/ResourceService.java b/api/src/com/cloud/resource/ResourceService.java
deleted file mode 100644
index 854b53591d6..00000000000
--- a/api/src/com/cloud/resource/ResourceService.java
+++ /dev/null
@@ -1,102 +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.resource;
-
-import java.util.List;
-
-import com.cloud.dc.DataCenter;
-import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
-import org.apache.cloudstack.api.command.admin.cluster.DeleteClusterCmd;
-import org.apache.cloudstack.api.command.admin.host.AddHostCmd;
-import org.apache.cloudstack.api.command.admin.host.AddSecondaryStorageCmd;
-import org.apache.cloudstack.api.command.admin.host.CancelMaintenanceCmd;
-import org.apache.cloudstack.api.command.admin.host.PrepareForMaintenanceCmd;
-import org.apache.cloudstack.api.command.admin.host.ReconnectHostCmd;
-import org.apache.cloudstack.api.command.admin.host.UpdateHostCmd;
-import org.apache.cloudstack.api.command.admin.host.UpdateHostPasswordCmd;
-
-import com.cloud.exception.DiscoveryException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.ResourceInUseException;
-import com.cloud.host.Host;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.org.Cluster;
-import com.cloud.utils.fsm.NoTransitionException;
-
-public interface ResourceService {
-    /**
-     * Updates a host
-     *
-     * @param cmd
-     *            - the command specifying hostId
-     * @return hostObject
-     * @throws NoTransitionException
-     */
-    Host updateHost(UpdateHostCmd cmd) throws NoTransitionException;
-
-    Host cancelMaintenance(CancelMaintenanceCmd cmd);
-
-    Host reconnectHost(ReconnectHostCmd cmd);
-
-    /**
-     * We will automatically create an Apache CloudStack cluster to attach to the external cluster and return a hyper host to perform
-     * host related operation within the cluster
-     *
-     * @param cmd
-     * @return
-     * @throws IllegalArgumentException
-     * @throws DiscoveryException
-     */
-    List<? extends Cluster> discoverCluster(AddClusterCmd cmd) throws IllegalArgumentException, DiscoveryException, ResourceInUseException;
-
-    boolean deleteCluster(DeleteClusterCmd cmd);
-
-    Cluster updateCluster(Cluster cluster, String clusterType, String hypervisor, String allocationState, String managedstate);
-
-    List<? extends Host> discoverHosts(AddHostCmd cmd) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException;
-
-    List<? extends Host> discoverHosts(AddSecondaryStorageCmd cmd) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException;
-
-    Host maintain(PrepareForMaintenanceCmd cmd);
-
-    /**
-     * Deletes a host
-     *
-     * @param hostId
-     *            TODO
-     * @param isForced
-     *            TODO
-     *
-     * @param true if deleted, false otherwise
-     */
-    boolean deleteHost(long hostId, boolean isForced, boolean isForceDeleteStorage);
-
-    boolean updateClusterPassword(UpdateHostPasswordCmd upasscmd);
-
-    boolean updateHostPassword(UpdateHostPasswordCmd upasscmd);
-
-    Host getHost(long hostId);
-
-    Cluster getCluster(Long clusterId);
-
-    DataCenter getZone(Long zoneId);
-
-    List<HypervisorType> getSupportedHypervisorTypes(long zoneId, boolean forVirtualRouter, Long podId);
-
-    boolean releaseHostReservation(Long hostId);
-
-}
diff --git a/api/src/com/cloud/storage/StorageService.java b/api/src/com/cloud/storage/StorageService.java
deleted file mode 100644
index e40b1e6e14c..00000000000
--- a/api/src/com/cloud/storage/StorageService.java
+++ /dev/null
@@ -1,112 +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.storage;
-
-import java.net.UnknownHostException;
-import java.util.Map;
-
-import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaintenanceCmd;
-import org.apache.cloudstack.api.command.admin.storage.CreateSecondaryStagingStoreCmd;
-import org.apache.cloudstack.api.command.admin.storage.CreateStoragePoolCmd;
-import org.apache.cloudstack.api.command.admin.storage.DeleteImageStoreCmd;
-import org.apache.cloudstack.api.command.admin.storage.DeletePoolCmd;
-import org.apache.cloudstack.api.command.admin.storage.DeleteSecondaryStagingStoreCmd;
-import org.apache.cloudstack.api.command.admin.storage.UpdateStoragePoolCmd;
-
-import com.cloud.exception.DiscoveryException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.ResourceInUseException;
-import com.cloud.exception.ResourceUnavailableException;
-
-public interface StorageService {
-    /**
-     * Create StoragePool based on uri
-     *
-     * @param cmd
-     *            The command object that specifies the zone, cluster/pod, URI, details, etc. to use to create the
-     *            storage pool.
-     * @return
-     *            The StoragePool created.
-     * @throws ResourceInUseException
-     * @throws IllegalArgumentException
-     * @throws UnknownHostException
-     * @throws ResourceUnavailableException
-     */
-    StoragePool createPool(CreateStoragePoolCmd cmd) throws ResourceInUseException, IllegalArgumentException, UnknownHostException, ResourceUnavailableException;
-
-    ImageStore createSecondaryStagingStore(CreateSecondaryStagingStoreCmd cmd);
-
-    /**
-     * Delete the storage pool
-     *
-     * @param cmd
-     *            - the command specifying poolId
-     * @return success or failure
-     */
-    boolean deletePool(DeletePoolCmd cmd);
-
-    /**
-     * Enable maintenance for primary storage
-     *
-     * @param primaryStorageId
-     *            - the primaryStorageId
-     * @return the primary storage pool
-     * @throws ResourceUnavailableException
-     * @throws InsufficientCapacityException
-     */
-    StoragePool preparePrimaryStorageForMaintenance(Long primaryStorageId) throws ResourceUnavailableException, InsufficientCapacityException;
-
-    /**
-     * Complete maintenance for primary storage
-     *
-     * @param cmd
-     *            - the command specifying primaryStorageId
-     * @return the primary storage pool
-     * @throws ResourceUnavailableException
-     */
-    StoragePool cancelPrimaryStorageForMaintenance(CancelPrimaryStorageMaintenanceCmd cmd) throws ResourceUnavailableException;
-
-    StoragePool updateStoragePool(UpdateStoragePoolCmd cmd) throws IllegalArgumentException;
-
-    StoragePool getStoragePool(long id);
-
-    boolean deleteImageStore(DeleteImageStoreCmd cmd);
-
-    boolean deleteSecondaryStagingStore(DeleteSecondaryStagingStoreCmd cmd);
-
-    ImageStore discoverImageStore(String name, String url, String providerName, Long zoneId, Map details) throws IllegalArgumentException, DiscoveryException,
-            InvalidParameterValueException;
-
-
-        /**
-     * Migrate existing NFS to use object store.
-     * @param name object store name.
-     * @param url object store url.
-     * @param providerName object store provider Name.
-     * @param details object store other details
-     * @return Object store created.
-     * @throws IllegalArgumentException
-     * @throws DiscoveryException
-     * @throws InvalidParameterValueException
-     */
-    ImageStore migrateToObjectStore(String name, String url, String providerName, Map details) throws IllegalArgumentException, DiscoveryException,
-            InvalidParameterValueException;
-
-
-}
diff --git a/api/src/com/cloud/user/AccountService.java b/api/src/com/cloud/user/AccountService.java
deleted file mode 100644
index 9683d9fa330..00000000000
--- a/api/src/com/cloud/user/AccountService.java
+++ /dev/null
@@ -1,144 +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.user;
-
-import java.util.Map;
-
-import org.apache.cloudstack.acl.ControlledEntity;
-import org.apache.cloudstack.acl.RoleType;
-import org.apache.cloudstack.acl.SecurityChecker.AccessType;
-import org.apache.cloudstack.api.command.admin.user.GetUserKeysCmd;
-import org.apache.cloudstack.api.command.admin.user.RegisterCmd;
-
-import com.cloud.domain.Domain;
-import com.cloud.exception.PermissionDeniedException;
-import com.cloud.offering.DiskOffering;
-import com.cloud.offering.ServiceOffering;
-
-
-public interface AccountService {
-
-    /**
-     * Creates a new user and account, stores the password as is so encrypted passwords are recommended.
-     *
-     * @param userName
-     *            TODO
-     * @param password
-     *            TODO
-     * @param firstName
-     *            TODO
-     * @param lastName
-     *            TODO
-     * @param email
-     *            TODO
-     * @param timezone
-     *            TODO
-     * @param accountName
-     *            TODO
-     * @param accountType
-     *            TODO
-     * @param domainId
-     *            TODO
-     * @param networkDomain
-     *            TODO
-     *
-     * @return the user if created successfully, null otherwise
-     */
-    UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName,
-        short accountType, Long roleId, Long domainId, String networkDomain, Map<String, String> details, String accountUUID, String userUUID);
-
-    UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long roleId, Long domainId, String networkDomain,
-                                  Map<String, String> details, String accountUUID, String userUUID, User.Source source);
-
-    /**
-     * Locks a user by userId. A locked user cannot access the API, but will still have running VMs/IP addresses
-     * allocated/etc.
-     *
-     * @param userId
-     * @return UserAccount object
-     */
-    UserAccount lockUser(long userId);
-
-    Account getSystemAccount();
-
-    User getSystemUser();
-
-    User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId, String userUUID);
-
-    User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId, String userUUID,
-                    User.Source source);
-
-    boolean isAdmin(Long accountId);
-
-    Account finalizeOwner(Account caller, String accountName, Long domainId, Long projectId);
-
-    Account getActiveAccountByName(String accountName, Long domainId);
-
-    UserAccount getActiveUserAccount(String username, Long domainId);
-
-    UserAccount updateUser(Long userId, String firstName, String lastName, String email, String userName, String password, String apiKey, String secretKey, String timeZone);
-
-    Account getActiveAccountById(long accountId);
-
-    Account getAccount(long accountId);
-
-    User getActiveUser(long userId);
-
-    User getUserIncludingRemoved(long userId);
-
-    boolean isRootAdmin(Long accountId);
-
-    boolean isDomainAdmin(Long accountId);
-
-    boolean isNormalUser(long accountId);
-
-    User getActiveUserByRegistrationToken(String registrationToken);
-
-    void markUserRegistered(long userId);
-
-    public String[] createApiKeyAndSecretKey(RegisterCmd cmd);
-
-    public String[] createApiKeyAndSecretKey(final long userId);
-
-    UserAccount getUserByApiKey(String apiKey);
-
-    RoleType getRoleType(Account account);
-
-    void checkAccess(Account account, Domain domain) throws PermissionDeniedException;
-
-    void checkAccess(Account account, AccessType accessType, boolean sameOwner, ControlledEntity... entities) throws PermissionDeniedException;
-
-    void checkAccess(Account account, ServiceOffering so) throws PermissionDeniedException;
-
-    void checkAccess(Account account, DiskOffering dof) throws PermissionDeniedException;
-
-    void checkAccess(User user, ControlledEntity entity);
-
-    void checkAccess(Account account, AccessType accessType, boolean sameOwner, String apiName,
-            ControlledEntity... entities) throws PermissionDeniedException;
-
-    Long finalyzeAccountId(String accountName, Long domainId, Long projectId, boolean enabledOnly);
-
-    /**
-     * returns the user account object for a given user id
-     * @param userId user id
-     * @return useraccount object if it exists else null
-     */
-    UserAccount getUserAccountById(Long userId);
-
-    public Map<String, String> getKeys(GetUserKeysCmd cmd);
-}
diff --git a/api/src/com/cloud/agent/api/Answer.java b/api/src/main/java/com/cloud/agent/api/Answer.java
similarity index 100%
rename from api/src/com/cloud/agent/api/Answer.java
rename to api/src/main/java/com/cloud/agent/api/Answer.java
diff --git a/api/src/com/cloud/agent/api/BadCommand.java b/api/src/main/java/com/cloud/agent/api/BadCommand.java
similarity index 100%
rename from api/src/com/cloud/agent/api/BadCommand.java
rename to api/src/main/java/com/cloud/agent/api/BadCommand.java
diff --git a/api/src/com/cloud/agent/api/Command.java b/api/src/main/java/com/cloud/agent/api/Command.java
similarity index 100%
rename from api/src/com/cloud/agent/api/Command.java
rename to api/src/main/java/com/cloud/agent/api/Command.java
diff --git a/api/src/com/cloud/agent/api/HostVmStateReportEntry.java b/api/src/main/java/com/cloud/agent/api/HostVmStateReportEntry.java
similarity index 100%
rename from api/src/com/cloud/agent/api/HostVmStateReportEntry.java
rename to api/src/main/java/com/cloud/agent/api/HostVmStateReportEntry.java
diff --git a/api/src/com/cloud/agent/api/LogLevel.java b/api/src/main/java/com/cloud/agent/api/LogLevel.java
similarity index 100%
rename from api/src/com/cloud/agent/api/LogLevel.java
rename to api/src/main/java/com/cloud/agent/api/LogLevel.java
diff --git a/api/src/com/cloud/agent/api/PvlanSetupCommand.java b/api/src/main/java/com/cloud/agent/api/PvlanSetupCommand.java
similarity index 100%
rename from api/src/com/cloud/agent/api/PvlanSetupCommand.java
rename to api/src/main/java/com/cloud/agent/api/PvlanSetupCommand.java
diff --git a/api/src/com/cloud/agent/api/StoragePoolInfo.java b/api/src/main/java/com/cloud/agent/api/StoragePoolInfo.java
similarity index 100%
rename from api/src/com/cloud/agent/api/StoragePoolInfo.java
rename to api/src/main/java/com/cloud/agent/api/StoragePoolInfo.java
diff --git a/api/src/com/cloud/agent/api/UnsupportedAnswer.java b/api/src/main/java/com/cloud/agent/api/UnsupportedAnswer.java
similarity index 100%
rename from api/src/com/cloud/agent/api/UnsupportedAnswer.java
rename to api/src/main/java/com/cloud/agent/api/UnsupportedAnswer.java
diff --git a/api/src/com/cloud/agent/api/VgpuTypesInfo.java b/api/src/main/java/com/cloud/agent/api/VgpuTypesInfo.java
similarity index 100%
rename from api/src/com/cloud/agent/api/VgpuTypesInfo.java
rename to api/src/main/java/com/cloud/agent/api/VgpuTypesInfo.java
diff --git a/api/src/com/cloud/agent/api/storage/CopyTemplateToPrimaryStorageAnswer.java b/api/src/main/java/com/cloud/agent/api/storage/CopyTemplateToPrimaryStorageAnswer.java
similarity index 100%
rename from api/src/com/cloud/agent/api/storage/CopyTemplateToPrimaryStorageAnswer.java
rename to api/src/main/java/com/cloud/agent/api/storage/CopyTemplateToPrimaryStorageAnswer.java
diff --git a/api/src/com/cloud/agent/api/storage/CreateVolumeOVACommand.java b/api/src/main/java/com/cloud/agent/api/storage/CreateVolumeOVACommand.java
similarity index 100%
rename from api/src/com/cloud/agent/api/storage/CreateVolumeOVACommand.java
rename to api/src/main/java/com/cloud/agent/api/storage/CreateVolumeOVACommand.java
diff --git a/api/src/com/cloud/agent/api/storage/OVFHelper.java b/api/src/main/java/com/cloud/agent/api/storage/OVFHelper.java
similarity index 100%
rename from api/src/com/cloud/agent/api/storage/OVFHelper.java
rename to api/src/main/java/com/cloud/agent/api/storage/OVFHelper.java
diff --git a/api/src/com/cloud/agent/api/storage/PasswordAuth.java b/api/src/main/java/com/cloud/agent/api/storage/PasswordAuth.java
similarity index 100%
rename from api/src/com/cloud/agent/api/storage/PasswordAuth.java
rename to api/src/main/java/com/cloud/agent/api/storage/PasswordAuth.java
diff --git a/api/src/com/cloud/agent/api/storage/PrepareOVAPackingCommand.java b/api/src/main/java/com/cloud/agent/api/storage/PrepareOVAPackingCommand.java
similarity index 100%
rename from api/src/com/cloud/agent/api/storage/PrepareOVAPackingCommand.java
rename to api/src/main/java/com/cloud/agent/api/storage/PrepareOVAPackingCommand.java
diff --git a/api/src/com/cloud/agent/api/to/DataObjectType.java b/api/src/main/java/com/cloud/agent/api/to/DataObjectType.java
similarity index 100%
rename from api/src/com/cloud/agent/api/to/DataObjectType.java
rename to api/src/main/java/com/cloud/agent/api/to/DataObjectType.java
diff --git a/api/src/com/cloud/agent/api/to/DataStoreTO.java b/api/src/main/java/com/cloud/agent/api/to/DataStoreTO.java
similarity index 100%
rename from api/src/com/cloud/agent/api/to/DataStoreTO.java
rename to api/src/main/java/com/cloud/agent/api/to/DataStoreTO.java
diff --git a/api/src/com/cloud/agent/api/to/DataTO.java b/api/src/main/java/com/cloud/agent/api/to/DataTO.java
similarity index 100%
rename from api/src/com/cloud/agent/api/to/DataTO.java
rename to api/src/main/java/com/cloud/agent/api/to/DataTO.java
diff --git a/api/src/com/cloud/agent/api/to/DatadiskTO.java b/api/src/main/java/com/cloud/agent/api/to/DatadiskTO.java
similarity index 100%
rename from api/src/com/cloud/agent/api/to/DatadiskTO.java
rename to api/src/main/java/com/cloud/agent/api/to/DatadiskTO.java
diff --git a/api/src/com/cloud/agent/api/to/DhcpTO.java b/api/src/main/java/com/cloud/agent/api/to/DhcpTO.java
similarity index 100%
rename from api/src/com/cloud/agent/api/to/DhcpTO.java
rename to api/src/main/java/com/cloud/agent/api/to/DhcpTO.java
diff --git a/api/src/com/cloud/agent/api/to/DiskTO.java b/api/src/main/java/com/cloud/agent/api/to/DiskTO.java
similarity index 100%
rename from api/src/com/cloud/agent/api/to/DiskTO.java
rename to api/src/main/java/com/cloud/agent/api/to/DiskTO.java
diff --git a/api/src/com/cloud/agent/api/to/FirewallRuleTO.java b/api/src/main/java/com/cloud/agent/api/to/FirewallRuleTO.java
similarity index 100%
rename from api/src/com/cloud/agent/api/to/FirewallRuleTO.java
rename to api/src/main/java/com/cloud/agent/api/to/FirewallRuleTO.java
diff --git a/api/src/com/cloud/agent/api/to/GPUDeviceTO.java b/api/src/main/java/com/cloud/agent/api/to/GPUDeviceTO.java
similarity index 100%
rename from api/src/com/cloud/agent/api/to/GPUDeviceTO.java
rename to api/src/main/java/com/cloud/agent/api/to/GPUDeviceTO.java
diff --git a/api/src/com/cloud/agent/api/to/HostTO.java b/api/src/main/java/com/cloud/agent/api/to/HostTO.java
similarity index 100%
rename from api/src/com/cloud/agent/api/to/HostTO.java
rename to api/src/main/java/com/cloud/agent/api/to/HostTO.java
diff --git a/api/src/com/cloud/agent/api/to/IpAddressTO.java b/api/src/main/java/com/cloud/agent/api/to/IpAddressTO.java
similarity index 100%
rename from api/src/com/cloud/agent/api/to/IpAddressTO.java
rename to api/src/main/java/com/cloud/agent/api/to/IpAddressTO.java
diff --git a/api/src/com/cloud/agent/api/to/LoadBalancerTO.java b/api/src/main/java/com/cloud/agent/api/to/LoadBalancerTO.java
similarity index 100%
rename from api/src/com/cloud/agent/api/to/LoadBalancerTO.java
rename to api/src/main/java/com/cloud/agent/api/to/LoadBalancerTO.java
diff --git a/api/src/com/cloud/agent/api/to/MonitorServiceTO.java b/api/src/main/java/com/cloud/agent/api/to/MonitorServiceTO.java
similarity index 100%
rename from api/src/com/cloud/agent/api/to/MonitorServiceTO.java
rename to api/src/main/java/com/cloud/agent/api/to/MonitorServiceTO.java
diff --git a/api/src/com/cloud/agent/api/to/NetworkACLTO.java b/api/src/main/java/com/cloud/agent/api/to/NetworkACLTO.java
similarity index 100%
rename from api/src/com/cloud/agent/api/to/NetworkACLTO.java
rename to api/src/main/java/com/cloud/agent/api/to/NetworkACLTO.java
diff --git a/api/src/com/cloud/agent/api/to/NetworkTO.java b/api/src/main/java/com/cloud/agent/api/to/NetworkTO.java
similarity index 100%
rename from api/src/com/cloud/agent/api/to/NetworkTO.java
rename to api/src/main/java/com/cloud/agent/api/to/NetworkTO.java
diff --git a/api/src/com/cloud/agent/api/to/NfsTO.java b/api/src/main/java/com/cloud/agent/api/to/NfsTO.java
similarity index 100%
rename from api/src/com/cloud/agent/api/to/NfsTO.java
rename to api/src/main/java/com/cloud/agent/api/to/NfsTO.java
diff --git a/api/src/com/cloud/agent/api/to/NicTO.java b/api/src/main/java/com/cloud/agent/api/to/NicTO.java
similarity index 100%
rename from api/src/com/cloud/agent/api/to/NicTO.java
rename to api/src/main/java/com/cloud/agent/api/to/NicTO.java
diff --git a/api/src/com/cloud/agent/api/to/PortForwardingRuleTO.java b/api/src/main/java/com/cloud/agent/api/to/PortForwardingRuleTO.java
similarity index 100%
rename from api/src/com/cloud/agent/api/to/PortForwardingRuleTO.java
rename to api/src/main/java/com/cloud/agent/api/to/PortForwardingRuleTO.java
diff --git a/api/src/com/cloud/agent/api/to/S3TO.java b/api/src/main/java/com/cloud/agent/api/to/S3TO.java
similarity index 100%
rename from api/src/com/cloud/agent/api/to/S3TO.java
rename to api/src/main/java/com/cloud/agent/api/to/S3TO.java
diff --git a/api/src/com/cloud/agent/api/to/StaticNatRuleTO.java b/api/src/main/java/com/cloud/agent/api/to/StaticNatRuleTO.java
similarity index 100%
rename from api/src/com/cloud/agent/api/to/StaticNatRuleTO.java
rename to api/src/main/java/com/cloud/agent/api/to/StaticNatRuleTO.java
diff --git a/api/src/com/cloud/agent/api/to/StorageFilerTO.java b/api/src/main/java/com/cloud/agent/api/to/StorageFilerTO.java
similarity index 100%
rename from api/src/com/cloud/agent/api/to/StorageFilerTO.java
rename to api/src/main/java/com/cloud/agent/api/to/StorageFilerTO.java
diff --git a/api/src/com/cloud/agent/api/to/SwiftTO.java b/api/src/main/java/com/cloud/agent/api/to/SwiftTO.java
similarity index 100%
rename from api/src/com/cloud/agent/api/to/SwiftTO.java
rename to api/src/main/java/com/cloud/agent/api/to/SwiftTO.java
diff --git a/api/src/com/cloud/agent/api/to/TemplateTO.java b/api/src/main/java/com/cloud/agent/api/to/TemplateTO.java
similarity index 100%
rename from api/src/com/cloud/agent/api/to/TemplateTO.java
rename to api/src/main/java/com/cloud/agent/api/to/TemplateTO.java
diff --git a/api/src/com/cloud/agent/api/to/VirtualMachineTO.java b/api/src/main/java/com/cloud/agent/api/to/VirtualMachineTO.java
similarity index 100%
rename from api/src/com/cloud/agent/api/to/VirtualMachineTO.java
rename to api/src/main/java/com/cloud/agent/api/to/VirtualMachineTO.java
diff --git a/api/src/com/cloud/agent/api/to/VolumeTO.java b/api/src/main/java/com/cloud/agent/api/to/VolumeTO.java
similarity index 100%
rename from api/src/com/cloud/agent/api/to/VolumeTO.java
rename to api/src/main/java/com/cloud/agent/api/to/VolumeTO.java
diff --git a/api/src/com/cloud/agent/manager/allocator/HostAllocator.java b/api/src/main/java/com/cloud/agent/manager/allocator/HostAllocator.java
similarity index 100%
rename from api/src/com/cloud/agent/manager/allocator/HostAllocator.java
rename to api/src/main/java/com/cloud/agent/manager/allocator/HostAllocator.java
diff --git a/api/src/com/cloud/agent/manager/allocator/PodAllocator.java b/api/src/main/java/com/cloud/agent/manager/allocator/PodAllocator.java
similarity index 100%
rename from api/src/com/cloud/agent/manager/allocator/PodAllocator.java
rename to api/src/main/java/com/cloud/agent/manager/allocator/PodAllocator.java
diff --git a/api/src/main/java/com/cloud/alert/Alert.java b/api/src/main/java/com/cloud/alert/Alert.java
new file mode 100644
index 00000000000..d85dca5b7b0
--- /dev/null
+++ b/api/src/main/java/com/cloud/alert/Alert.java
@@ -0,0 +1,46 @@
+// 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.alert;
+
+import java.util.Date;
+
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+public interface Alert extends Identity, InternalIdentity {
+    short getType();
+
+    String getSubject();
+
+    Long getPodId();
+
+    long getDataCenterId();
+
+    int getSentCount();
+
+    Date getCreatedDate();
+
+    Date getLastSent();
+
+    Date getResolved();
+
+    boolean getArchived();
+
+    String getName();
+
+    String getContent();
+}
diff --git a/api/src/com/cloud/alert/AlertAdapter.java b/api/src/main/java/com/cloud/alert/AlertAdapter.java
similarity index 100%
rename from api/src/com/cloud/alert/AlertAdapter.java
rename to api/src/main/java/com/cloud/alert/AlertAdapter.java
diff --git a/api/src/com/cloud/api/commands/.gitignore b/api/src/main/java/com/cloud/api/commands/.gitignore
similarity index 100%
rename from api/src/com/cloud/api/commands/.gitignore
rename to api/src/main/java/com/cloud/api/commands/.gitignore
diff --git a/api/src/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java b/api/src/main/java/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java
similarity index 100%
rename from api/src/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java
rename to api/src/main/java/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java
diff --git a/api/src/com/cloud/capacity/Capacity.java b/api/src/main/java/com/cloud/capacity/Capacity.java
similarity index 100%
rename from api/src/com/cloud/capacity/Capacity.java
rename to api/src/main/java/com/cloud/capacity/Capacity.java
diff --git a/api/src/com/cloud/capacity/CapacityState.java b/api/src/main/java/com/cloud/capacity/CapacityState.java
similarity index 100%
rename from api/src/com/cloud/capacity/CapacityState.java
rename to api/src/main/java/com/cloud/capacity/CapacityState.java
diff --git a/api/src/com/cloud/configuration/ConfigurationService.java b/api/src/main/java/com/cloud/configuration/ConfigurationService.java
similarity index 100%
rename from api/src/com/cloud/configuration/ConfigurationService.java
rename to api/src/main/java/com/cloud/configuration/ConfigurationService.java
diff --git a/api/src/com/cloud/configuration/Resource.java b/api/src/main/java/com/cloud/configuration/Resource.java
similarity index 100%
rename from api/src/com/cloud/configuration/Resource.java
rename to api/src/main/java/com/cloud/configuration/Resource.java
diff --git a/api/src/com/cloud/configuration/ResourceCount.java b/api/src/main/java/com/cloud/configuration/ResourceCount.java
similarity index 100%
rename from api/src/com/cloud/configuration/ResourceCount.java
rename to api/src/main/java/com/cloud/configuration/ResourceCount.java
diff --git a/api/src/com/cloud/configuration/ResourceLimit.java b/api/src/main/java/com/cloud/configuration/ResourceLimit.java
similarity index 100%
rename from api/src/com/cloud/configuration/ResourceLimit.java
rename to api/src/main/java/com/cloud/configuration/ResourceLimit.java
diff --git a/api/src/com/cloud/consoleproxy/ConsoleProxyAllocator.java b/api/src/main/java/com/cloud/consoleproxy/ConsoleProxyAllocator.java
similarity index 100%
rename from api/src/com/cloud/consoleproxy/ConsoleProxyAllocator.java
rename to api/src/main/java/com/cloud/consoleproxy/ConsoleProxyAllocator.java
diff --git a/api/src/com/cloud/dc/DataCenter.java b/api/src/main/java/com/cloud/dc/DataCenter.java
similarity index 100%
rename from api/src/com/cloud/dc/DataCenter.java
rename to api/src/main/java/com/cloud/dc/DataCenter.java
diff --git a/api/src/com/cloud/dc/DedicatedResources.java b/api/src/main/java/com/cloud/dc/DedicatedResources.java
similarity index 100%
rename from api/src/com/cloud/dc/DedicatedResources.java
rename to api/src/main/java/com/cloud/dc/DedicatedResources.java
diff --git a/api/src/com/cloud/dc/Pod.java b/api/src/main/java/com/cloud/dc/Pod.java
similarity index 100%
rename from api/src/com/cloud/dc/Pod.java
rename to api/src/main/java/com/cloud/dc/Pod.java
diff --git a/api/src/com/cloud/dc/StorageNetworkIpRange.java b/api/src/main/java/com/cloud/dc/StorageNetworkIpRange.java
similarity index 100%
rename from api/src/com/cloud/dc/StorageNetworkIpRange.java
rename to api/src/main/java/com/cloud/dc/StorageNetworkIpRange.java
diff --git a/api/src/com/cloud/dc/Vlan.java b/api/src/main/java/com/cloud/dc/Vlan.java
similarity index 100%
rename from api/src/com/cloud/dc/Vlan.java
rename to api/src/main/java/com/cloud/dc/Vlan.java
diff --git a/api/src/com/cloud/deploy/DataCenterDeployment.java b/api/src/main/java/com/cloud/deploy/DataCenterDeployment.java
similarity index 100%
rename from api/src/com/cloud/deploy/DataCenterDeployment.java
rename to api/src/main/java/com/cloud/deploy/DataCenterDeployment.java
diff --git a/api/src/com/cloud/deploy/DeployDestination.java b/api/src/main/java/com/cloud/deploy/DeployDestination.java
similarity index 100%
rename from api/src/com/cloud/deploy/DeployDestination.java
rename to api/src/main/java/com/cloud/deploy/DeployDestination.java
diff --git a/api/src/com/cloud/deploy/DeploymentClusterPlanner.java b/api/src/main/java/com/cloud/deploy/DeploymentClusterPlanner.java
similarity index 100%
rename from api/src/com/cloud/deploy/DeploymentClusterPlanner.java
rename to api/src/main/java/com/cloud/deploy/DeploymentClusterPlanner.java
diff --git a/api/src/com/cloud/deploy/DeploymentPlan.java b/api/src/main/java/com/cloud/deploy/DeploymentPlan.java
similarity index 100%
rename from api/src/com/cloud/deploy/DeploymentPlan.java
rename to api/src/main/java/com/cloud/deploy/DeploymentPlan.java
diff --git a/api/src/com/cloud/deploy/DeploymentPlanner.java b/api/src/main/java/com/cloud/deploy/DeploymentPlanner.java
similarity index 100%
rename from api/src/com/cloud/deploy/DeploymentPlanner.java
rename to api/src/main/java/com/cloud/deploy/DeploymentPlanner.java
diff --git a/api/src/com/cloud/deploy/HAPlanner.java b/api/src/main/java/com/cloud/deploy/HAPlanner.java
similarity index 100%
rename from api/src/com/cloud/deploy/HAPlanner.java
rename to api/src/main/java/com/cloud/deploy/HAPlanner.java
diff --git a/api/src/com/cloud/domain/Domain.java b/api/src/main/java/com/cloud/domain/Domain.java
similarity index 100%
rename from api/src/com/cloud/domain/Domain.java
rename to api/src/main/java/com/cloud/domain/Domain.java
diff --git a/api/src/com/cloud/domain/PartOf.java b/api/src/main/java/com/cloud/domain/PartOf.java
similarity index 100%
rename from api/src/com/cloud/domain/PartOf.java
rename to api/src/main/java/com/cloud/domain/PartOf.java
diff --git a/api/src/com/cloud/event/ActionEvent.java b/api/src/main/java/com/cloud/event/ActionEvent.java
similarity index 100%
rename from api/src/com/cloud/event/ActionEvent.java
rename to api/src/main/java/com/cloud/event/ActionEvent.java
diff --git a/api/src/com/cloud/event/ActionEvents.java b/api/src/main/java/com/cloud/event/ActionEvents.java
similarity index 100%
rename from api/src/com/cloud/event/ActionEvents.java
rename to api/src/main/java/com/cloud/event/ActionEvents.java
diff --git a/api/src/com/cloud/event/Event.java b/api/src/main/java/com/cloud/event/Event.java
similarity index 100%
rename from api/src/com/cloud/event/Event.java
rename to api/src/main/java/com/cloud/event/Event.java
diff --git a/api/src/com/cloud/event/EventCategory.java b/api/src/main/java/com/cloud/event/EventCategory.java
similarity index 100%
rename from api/src/com/cloud/event/EventCategory.java
rename to api/src/main/java/com/cloud/event/EventCategory.java
diff --git a/api/src/com/cloud/event/EventTypes.java b/api/src/main/java/com/cloud/event/EventTypes.java
similarity index 100%
rename from api/src/com/cloud/event/EventTypes.java
rename to api/src/main/java/com/cloud/event/EventTypes.java
diff --git a/api/src/com/cloud/event/UsageEvent.java b/api/src/main/java/com/cloud/event/UsageEvent.java
similarity index 100%
rename from api/src/com/cloud/event/UsageEvent.java
rename to api/src/main/java/com/cloud/event/UsageEvent.java
diff --git a/api/src/com/cloud/exception/AccountLimitException.java b/api/src/main/java/com/cloud/exception/AccountLimitException.java
similarity index 100%
rename from api/src/com/cloud/exception/AccountLimitException.java
rename to api/src/main/java/com/cloud/exception/AccountLimitException.java
diff --git a/api/src/com/cloud/exception/AffinityConflictException.java b/api/src/main/java/com/cloud/exception/AffinityConflictException.java
similarity index 100%
rename from api/src/com/cloud/exception/AffinityConflictException.java
rename to api/src/main/java/com/cloud/exception/AffinityConflictException.java
diff --git a/api/src/com/cloud/exception/AgentControlChannelException.java b/api/src/main/java/com/cloud/exception/AgentControlChannelException.java
similarity index 100%
rename from api/src/com/cloud/exception/AgentControlChannelException.java
rename to api/src/main/java/com/cloud/exception/AgentControlChannelException.java
diff --git a/api/src/com/cloud/exception/AgentUnavailableException.java b/api/src/main/java/com/cloud/exception/AgentUnavailableException.java
similarity index 100%
rename from api/src/com/cloud/exception/AgentUnavailableException.java
rename to api/src/main/java/com/cloud/exception/AgentUnavailableException.java
diff --git a/api/src/com/cloud/exception/CloudAuthenticationException.java b/api/src/main/java/com/cloud/exception/CloudAuthenticationException.java
similarity index 100%
rename from api/src/com/cloud/exception/CloudAuthenticationException.java
rename to api/src/main/java/com/cloud/exception/CloudAuthenticationException.java
diff --git a/api/src/com/cloud/exception/CloudException.java b/api/src/main/java/com/cloud/exception/CloudException.java
similarity index 100%
rename from api/src/com/cloud/exception/CloudException.java
rename to api/src/main/java/com/cloud/exception/CloudException.java
diff --git a/api/src/com/cloud/exception/ConcurrentOperationException.java b/api/src/main/java/com/cloud/exception/ConcurrentOperationException.java
similarity index 100%
rename from api/src/com/cloud/exception/ConcurrentOperationException.java
rename to api/src/main/java/com/cloud/exception/ConcurrentOperationException.java
diff --git a/api/src/com/cloud/exception/ConflictingNetworkSettingsException.java b/api/src/main/java/com/cloud/exception/ConflictingNetworkSettingsException.java
similarity index 100%
rename from api/src/com/cloud/exception/ConflictingNetworkSettingsException.java
rename to api/src/main/java/com/cloud/exception/ConflictingNetworkSettingsException.java
diff --git a/api/src/com/cloud/exception/ConnectionException.java b/api/src/main/java/com/cloud/exception/ConnectionException.java
similarity index 100%
rename from api/src/com/cloud/exception/ConnectionException.java
rename to api/src/main/java/com/cloud/exception/ConnectionException.java
diff --git a/api/src/com/cloud/exception/DiscoveredWithErrorException.java b/api/src/main/java/com/cloud/exception/DiscoveredWithErrorException.java
similarity index 100%
rename from api/src/com/cloud/exception/DiscoveredWithErrorException.java
rename to api/src/main/java/com/cloud/exception/DiscoveredWithErrorException.java
diff --git a/api/src/com/cloud/exception/DiscoveryException.java b/api/src/main/java/com/cloud/exception/DiscoveryException.java
similarity index 100%
rename from api/src/com/cloud/exception/DiscoveryException.java
rename to api/src/main/java/com/cloud/exception/DiscoveryException.java
diff --git a/api/src/com/cloud/exception/HAStateException.java b/api/src/main/java/com/cloud/exception/HAStateException.java
similarity index 100%
rename from api/src/com/cloud/exception/HAStateException.java
rename to api/src/main/java/com/cloud/exception/HAStateException.java
diff --git a/api/src/com/cloud/exception/InsufficientAddressCapacityException.java b/api/src/main/java/com/cloud/exception/InsufficientAddressCapacityException.java
similarity index 100%
rename from api/src/com/cloud/exception/InsufficientAddressCapacityException.java
rename to api/src/main/java/com/cloud/exception/InsufficientAddressCapacityException.java
diff --git a/api/src/com/cloud/exception/InsufficientCapacityException.java b/api/src/main/java/com/cloud/exception/InsufficientCapacityException.java
similarity index 100%
rename from api/src/com/cloud/exception/InsufficientCapacityException.java
rename to api/src/main/java/com/cloud/exception/InsufficientCapacityException.java
diff --git a/api/src/com/cloud/exception/InsufficientNetworkCapacityException.java b/api/src/main/java/com/cloud/exception/InsufficientNetworkCapacityException.java
similarity index 100%
rename from api/src/com/cloud/exception/InsufficientNetworkCapacityException.java
rename to api/src/main/java/com/cloud/exception/InsufficientNetworkCapacityException.java
diff --git a/api/src/com/cloud/exception/InsufficientServerCapacityException.java b/api/src/main/java/com/cloud/exception/InsufficientServerCapacityException.java
similarity index 100%
rename from api/src/com/cloud/exception/InsufficientServerCapacityException.java
rename to api/src/main/java/com/cloud/exception/InsufficientServerCapacityException.java
diff --git a/api/src/com/cloud/exception/InsufficientStorageCapacityException.java b/api/src/main/java/com/cloud/exception/InsufficientStorageCapacityException.java
similarity index 100%
rename from api/src/com/cloud/exception/InsufficientStorageCapacityException.java
rename to api/src/main/java/com/cloud/exception/InsufficientStorageCapacityException.java
diff --git a/api/src/com/cloud/exception/InsufficientVirtualNetworkCapacityException.java b/api/src/main/java/com/cloud/exception/InsufficientVirtualNetworkCapacityException.java
similarity index 100%
rename from api/src/com/cloud/exception/InsufficientVirtualNetworkCapacityException.java
rename to api/src/main/java/com/cloud/exception/InsufficientVirtualNetworkCapacityException.java
diff --git a/api/src/com/cloud/exception/InternalErrorException.java b/api/src/main/java/com/cloud/exception/InternalErrorException.java
similarity index 100%
rename from api/src/com/cloud/exception/InternalErrorException.java
rename to api/src/main/java/com/cloud/exception/InternalErrorException.java
diff --git a/api/src/com/cloud/exception/InvalidParameterValueException.java b/api/src/main/java/com/cloud/exception/InvalidParameterValueException.java
similarity index 100%
rename from api/src/com/cloud/exception/InvalidParameterValueException.java
rename to api/src/main/java/com/cloud/exception/InvalidParameterValueException.java
diff --git a/api/src/com/cloud/exception/ManagementServerException.java b/api/src/main/java/com/cloud/exception/ManagementServerException.java
similarity index 100%
rename from api/src/com/cloud/exception/ManagementServerException.java
rename to api/src/main/java/com/cloud/exception/ManagementServerException.java
diff --git a/api/src/com/cloud/exception/NetworkRuleConflictException.java b/api/src/main/java/com/cloud/exception/NetworkRuleConflictException.java
similarity index 100%
rename from api/src/com/cloud/exception/NetworkRuleConflictException.java
rename to api/src/main/java/com/cloud/exception/NetworkRuleConflictException.java
diff --git a/api/src/com/cloud/exception/OperationTimedoutException.java b/api/src/main/java/com/cloud/exception/OperationTimedoutException.java
similarity index 100%
rename from api/src/com/cloud/exception/OperationTimedoutException.java
rename to api/src/main/java/com/cloud/exception/OperationTimedoutException.java
diff --git a/api/src/com/cloud/exception/PermissionDeniedException.java b/api/src/main/java/com/cloud/exception/PermissionDeniedException.java
similarity index 100%
rename from api/src/com/cloud/exception/PermissionDeniedException.java
rename to api/src/main/java/com/cloud/exception/PermissionDeniedException.java
diff --git a/api/src/com/cloud/exception/RequestLimitException.java b/api/src/main/java/com/cloud/exception/RequestLimitException.java
similarity index 100%
rename from api/src/com/cloud/exception/RequestLimitException.java
rename to api/src/main/java/com/cloud/exception/RequestLimitException.java
diff --git a/api/src/com/cloud/exception/ResourceAllocationException.java b/api/src/main/java/com/cloud/exception/ResourceAllocationException.java
similarity index 100%
rename from api/src/com/cloud/exception/ResourceAllocationException.java
rename to api/src/main/java/com/cloud/exception/ResourceAllocationException.java
diff --git a/api/src/com/cloud/exception/ResourceInUseException.java b/api/src/main/java/com/cloud/exception/ResourceInUseException.java
similarity index 100%
rename from api/src/com/cloud/exception/ResourceInUseException.java
rename to api/src/main/java/com/cloud/exception/ResourceInUseException.java
diff --git a/api/src/com/cloud/exception/ResourceUnavailableException.java b/api/src/main/java/com/cloud/exception/ResourceUnavailableException.java
similarity index 100%
rename from api/src/com/cloud/exception/ResourceUnavailableException.java
rename to api/src/main/java/com/cloud/exception/ResourceUnavailableException.java
diff --git a/api/src/com/cloud/exception/StorageConflictException.java b/api/src/main/java/com/cloud/exception/StorageConflictException.java
similarity index 100%
rename from api/src/com/cloud/exception/StorageConflictException.java
rename to api/src/main/java/com/cloud/exception/StorageConflictException.java
diff --git a/api/src/com/cloud/exception/StorageUnavailableException.java b/api/src/main/java/com/cloud/exception/StorageUnavailableException.java
similarity index 100%
rename from api/src/com/cloud/exception/StorageUnavailableException.java
rename to api/src/main/java/com/cloud/exception/StorageUnavailableException.java
diff --git a/api/src/com/cloud/exception/UnavailableCommandException.java b/api/src/main/java/com/cloud/exception/UnavailableCommandException.java
similarity index 100%
rename from api/src/com/cloud/exception/UnavailableCommandException.java
rename to api/src/main/java/com/cloud/exception/UnavailableCommandException.java
diff --git a/api/src/com/cloud/exception/UnsupportedServiceException.java b/api/src/main/java/com/cloud/exception/UnsupportedServiceException.java
similarity index 100%
rename from api/src/com/cloud/exception/UnsupportedServiceException.java
rename to api/src/main/java/com/cloud/exception/UnsupportedServiceException.java
diff --git a/api/src/com/cloud/exception/VirtualMachineMigrationException.java b/api/src/main/java/com/cloud/exception/VirtualMachineMigrationException.java
similarity index 100%
rename from api/src/com/cloud/exception/VirtualMachineMigrationException.java
rename to api/src/main/java/com/cloud/exception/VirtualMachineMigrationException.java
diff --git a/api/src/com/cloud/gpu/GPU.java b/api/src/main/java/com/cloud/gpu/GPU.java
similarity index 100%
rename from api/src/com/cloud/gpu/GPU.java
rename to api/src/main/java/com/cloud/gpu/GPU.java
diff --git a/api/src/com/cloud/ha/FenceBuilder.java b/api/src/main/java/com/cloud/ha/FenceBuilder.java
similarity index 100%
rename from api/src/com/cloud/ha/FenceBuilder.java
rename to api/src/main/java/com/cloud/ha/FenceBuilder.java
diff --git a/api/src/com/cloud/ha/Investigator.java b/api/src/main/java/com/cloud/ha/Investigator.java
similarity index 100%
rename from api/src/com/cloud/ha/Investigator.java
rename to api/src/main/java/com/cloud/ha/Investigator.java
diff --git a/api/src/com/cloud/host/Host.java b/api/src/main/java/com/cloud/host/Host.java
similarity index 100%
rename from api/src/com/cloud/host/Host.java
rename to api/src/main/java/com/cloud/host/Host.java
diff --git a/api/src/com/cloud/host/HostEnvironment.java b/api/src/main/java/com/cloud/host/HostEnvironment.java
similarity index 100%
rename from api/src/com/cloud/host/HostEnvironment.java
rename to api/src/main/java/com/cloud/host/HostEnvironment.java
diff --git a/api/src/com/cloud/host/HostStats.java b/api/src/main/java/com/cloud/host/HostStats.java
similarity index 100%
rename from api/src/com/cloud/host/HostStats.java
rename to api/src/main/java/com/cloud/host/HostStats.java
diff --git a/api/src/com/cloud/host/Status.java b/api/src/main/java/com/cloud/host/Status.java
similarity index 100%
rename from api/src/com/cloud/host/Status.java
rename to api/src/main/java/com/cloud/host/Status.java
diff --git a/api/src/com/cloud/hypervisor/Hypervisor.java b/api/src/main/java/com/cloud/hypervisor/Hypervisor.java
similarity index 100%
rename from api/src/com/cloud/hypervisor/Hypervisor.java
rename to api/src/main/java/com/cloud/hypervisor/Hypervisor.java
diff --git a/api/src/com/cloud/hypervisor/HypervisorCapabilities.java b/api/src/main/java/com/cloud/hypervisor/HypervisorCapabilities.java
similarity index 100%
rename from api/src/com/cloud/hypervisor/HypervisorCapabilities.java
rename to api/src/main/java/com/cloud/hypervisor/HypervisorCapabilities.java
diff --git a/api/src/com/cloud/hypervisor/HypervisorGuru.java b/api/src/main/java/com/cloud/hypervisor/HypervisorGuru.java
similarity index 100%
rename from api/src/com/cloud/hypervisor/HypervisorGuru.java
rename to api/src/main/java/com/cloud/hypervisor/HypervisorGuru.java
diff --git a/api/src/com/cloud/info/ConsoleProxyLoadInfo.java b/api/src/main/java/com/cloud/info/ConsoleProxyLoadInfo.java
similarity index 100%
rename from api/src/com/cloud/info/ConsoleProxyLoadInfo.java
rename to api/src/main/java/com/cloud/info/ConsoleProxyLoadInfo.java
diff --git a/api/src/com/cloud/info/RunningHostCountInfo.java b/api/src/main/java/com/cloud/info/RunningHostCountInfo.java
similarity index 100%
rename from api/src/com/cloud/info/RunningHostCountInfo.java
rename to api/src/main/java/com/cloud/info/RunningHostCountInfo.java
diff --git a/api/src/com/cloud/network/GuestVlan.java b/api/src/main/java/com/cloud/network/GuestVlan.java
similarity index 100%
rename from api/src/com/cloud/network/GuestVlan.java
rename to api/src/main/java/com/cloud/network/GuestVlan.java
diff --git a/api/src/com/cloud/network/IpAddress.java b/api/src/main/java/com/cloud/network/IpAddress.java
similarity index 100%
rename from api/src/com/cloud/network/IpAddress.java
rename to api/src/main/java/com/cloud/network/IpAddress.java
diff --git a/api/src/com/cloud/network/MonitoringService.java b/api/src/main/java/com/cloud/network/MonitoringService.java
similarity index 100%
rename from api/src/com/cloud/network/MonitoringService.java
rename to api/src/main/java/com/cloud/network/MonitoringService.java
diff --git a/api/src/com/cloud/network/Network.java b/api/src/main/java/com/cloud/network/Network.java
similarity index 100%
rename from api/src/com/cloud/network/Network.java
rename to api/src/main/java/com/cloud/network/Network.java
diff --git a/api/src/com/cloud/network/NetworkMigrationResponder.java b/api/src/main/java/com/cloud/network/NetworkMigrationResponder.java
similarity index 100%
rename from api/src/com/cloud/network/NetworkMigrationResponder.java
rename to api/src/main/java/com/cloud/network/NetworkMigrationResponder.java
diff --git a/api/src/com/cloud/network/NetworkModel.java b/api/src/main/java/com/cloud/network/NetworkModel.java
similarity index 100%
rename from api/src/com/cloud/network/NetworkModel.java
rename to api/src/main/java/com/cloud/network/NetworkModel.java
diff --git a/api/src/com/cloud/network/NetworkProfile.java b/api/src/main/java/com/cloud/network/NetworkProfile.java
similarity index 100%
rename from api/src/com/cloud/network/NetworkProfile.java
rename to api/src/main/java/com/cloud/network/NetworkProfile.java
diff --git a/api/src/com/cloud/network/NetworkRuleApplier.java b/api/src/main/java/com/cloud/network/NetworkRuleApplier.java
similarity index 100%
rename from api/src/com/cloud/network/NetworkRuleApplier.java
rename to api/src/main/java/com/cloud/network/NetworkRuleApplier.java
diff --git a/api/src/com/cloud/network/NetworkService.java b/api/src/main/java/com/cloud/network/NetworkService.java
similarity index 100%
rename from api/src/com/cloud/network/NetworkService.java
rename to api/src/main/java/com/cloud/network/NetworkService.java
diff --git a/api/src/com/cloud/network/NetworkUsageService.java b/api/src/main/java/com/cloud/network/NetworkUsageService.java
similarity index 100%
rename from api/src/com/cloud/network/NetworkUsageService.java
rename to api/src/main/java/com/cloud/network/NetworkUsageService.java
diff --git a/api/src/com/cloud/network/Networks.java b/api/src/main/java/com/cloud/network/Networks.java
similarity index 100%
rename from api/src/com/cloud/network/Networks.java
rename to api/src/main/java/com/cloud/network/Networks.java
diff --git a/api/src/com/cloud/network/OvsProvider.java b/api/src/main/java/com/cloud/network/OvsProvider.java
similarity index 100%
rename from api/src/com/cloud/network/OvsProvider.java
rename to api/src/main/java/com/cloud/network/OvsProvider.java
diff --git a/api/src/com/cloud/network/PhysicalNetwork.java b/api/src/main/java/com/cloud/network/PhysicalNetwork.java
similarity index 100%
rename from api/src/com/cloud/network/PhysicalNetwork.java
rename to api/src/main/java/com/cloud/network/PhysicalNetwork.java
diff --git a/api/src/com/cloud/network/PhysicalNetworkServiceProvider.java b/api/src/main/java/com/cloud/network/PhysicalNetworkServiceProvider.java
similarity index 100%
rename from api/src/com/cloud/network/PhysicalNetworkServiceProvider.java
rename to api/src/main/java/com/cloud/network/PhysicalNetworkServiceProvider.java
diff --git a/api/src/com/cloud/network/PhysicalNetworkSetupInfo.java b/api/src/main/java/com/cloud/network/PhysicalNetworkSetupInfo.java
similarity index 100%
rename from api/src/com/cloud/network/PhysicalNetworkSetupInfo.java
rename to api/src/main/java/com/cloud/network/PhysicalNetworkSetupInfo.java
diff --git a/api/src/com/cloud/network/PhysicalNetworkTrafficType.java b/api/src/main/java/com/cloud/network/PhysicalNetworkTrafficType.java
similarity index 100%
rename from api/src/com/cloud/network/PhysicalNetworkTrafficType.java
rename to api/src/main/java/com/cloud/network/PhysicalNetworkTrafficType.java
diff --git a/api/src/com/cloud/network/PublicIpAddress.java b/api/src/main/java/com/cloud/network/PublicIpAddress.java
similarity index 100%
rename from api/src/com/cloud/network/PublicIpAddress.java
rename to api/src/main/java/com/cloud/network/PublicIpAddress.java
diff --git a/api/src/com/cloud/network/RemoteAccessVpn.java b/api/src/main/java/com/cloud/network/RemoteAccessVpn.java
similarity index 100%
rename from api/src/com/cloud/network/RemoteAccessVpn.java
rename to api/src/main/java/com/cloud/network/RemoteAccessVpn.java
diff --git a/api/src/com/cloud/network/Site2SiteCustomerGateway.java b/api/src/main/java/com/cloud/network/Site2SiteCustomerGateway.java
similarity index 100%
rename from api/src/com/cloud/network/Site2SiteCustomerGateway.java
rename to api/src/main/java/com/cloud/network/Site2SiteCustomerGateway.java
diff --git a/api/src/com/cloud/network/Site2SiteVpnConnection.java b/api/src/main/java/com/cloud/network/Site2SiteVpnConnection.java
similarity index 100%
rename from api/src/com/cloud/network/Site2SiteVpnConnection.java
rename to api/src/main/java/com/cloud/network/Site2SiteVpnConnection.java
diff --git a/api/src/com/cloud/network/Site2SiteVpnGateway.java b/api/src/main/java/com/cloud/network/Site2SiteVpnGateway.java
similarity index 100%
rename from api/src/com/cloud/network/Site2SiteVpnGateway.java
rename to api/src/main/java/com/cloud/network/Site2SiteVpnGateway.java
diff --git a/api/src/com/cloud/network/StorageNetworkService.java b/api/src/main/java/com/cloud/network/StorageNetworkService.java
similarity index 100%
rename from api/src/com/cloud/network/StorageNetworkService.java
rename to api/src/main/java/com/cloud/network/StorageNetworkService.java
diff --git a/api/src/com/cloud/network/TrafficLabel.java b/api/src/main/java/com/cloud/network/TrafficLabel.java
similarity index 100%
rename from api/src/com/cloud/network/TrafficLabel.java
rename to api/src/main/java/com/cloud/network/TrafficLabel.java
diff --git a/api/src/com/cloud/network/UserIpv6Address.java b/api/src/main/java/com/cloud/network/UserIpv6Address.java
similarity index 100%
rename from api/src/com/cloud/network/UserIpv6Address.java
rename to api/src/main/java/com/cloud/network/UserIpv6Address.java
diff --git a/api/src/com/cloud/network/VirtualNetworkApplianceService.java b/api/src/main/java/com/cloud/network/VirtualNetworkApplianceService.java
similarity index 100%
rename from api/src/com/cloud/network/VirtualNetworkApplianceService.java
rename to api/src/main/java/com/cloud/network/VirtualNetworkApplianceService.java
diff --git a/api/src/com/cloud/network/VirtualRouterProvider.java b/api/src/main/java/com/cloud/network/VirtualRouterProvider.java
similarity index 100%
rename from api/src/com/cloud/network/VirtualRouterProvider.java
rename to api/src/main/java/com/cloud/network/VirtualRouterProvider.java
diff --git a/api/src/com/cloud/network/VpcVirtualNetworkApplianceService.java b/api/src/main/java/com/cloud/network/VpcVirtualNetworkApplianceService.java
similarity index 100%
rename from api/src/com/cloud/network/VpcVirtualNetworkApplianceService.java
rename to api/src/main/java/com/cloud/network/VpcVirtualNetworkApplianceService.java
diff --git a/api/src/com/cloud/network/VpnUser.java b/api/src/main/java/com/cloud/network/VpnUser.java
similarity index 100%
rename from api/src/com/cloud/network/VpnUser.java
rename to api/src/main/java/com/cloud/network/VpnUser.java
diff --git a/api/src/com/cloud/network/as/AutoScaleCounter.java b/api/src/main/java/com/cloud/network/as/AutoScaleCounter.java
similarity index 100%
rename from api/src/com/cloud/network/as/AutoScaleCounter.java
rename to api/src/main/java/com/cloud/network/as/AutoScaleCounter.java
diff --git a/api/src/com/cloud/network/as/AutoScalePolicy.java b/api/src/main/java/com/cloud/network/as/AutoScalePolicy.java
similarity index 100%
rename from api/src/com/cloud/network/as/AutoScalePolicy.java
rename to api/src/main/java/com/cloud/network/as/AutoScalePolicy.java
diff --git a/api/src/com/cloud/network/as/AutoScaleService.java b/api/src/main/java/com/cloud/network/as/AutoScaleService.java
similarity index 100%
rename from api/src/com/cloud/network/as/AutoScaleService.java
rename to api/src/main/java/com/cloud/network/as/AutoScaleService.java
diff --git a/api/src/com/cloud/network/as/AutoScaleVmGroup.java b/api/src/main/java/com/cloud/network/as/AutoScaleVmGroup.java
similarity index 100%
rename from api/src/com/cloud/network/as/AutoScaleVmGroup.java
rename to api/src/main/java/com/cloud/network/as/AutoScaleVmGroup.java
diff --git a/api/src/com/cloud/network/as/AutoScaleVmProfile.java b/api/src/main/java/com/cloud/network/as/AutoScaleVmProfile.java
similarity index 100%
rename from api/src/com/cloud/network/as/AutoScaleVmProfile.java
rename to api/src/main/java/com/cloud/network/as/AutoScaleVmProfile.java
diff --git a/api/src/com/cloud/network/as/Condition.java b/api/src/main/java/com/cloud/network/as/Condition.java
similarity index 100%
rename from api/src/com/cloud/network/as/Condition.java
rename to api/src/main/java/com/cloud/network/as/Condition.java
diff --git a/api/src/com/cloud/network/as/Counter.java b/api/src/main/java/com/cloud/network/as/Counter.java
similarity index 100%
rename from api/src/com/cloud/network/as/Counter.java
rename to api/src/main/java/com/cloud/network/as/Counter.java
diff --git a/api/src/com/cloud/network/element/AggregatedCommandExecutor.java b/api/src/main/java/com/cloud/network/element/AggregatedCommandExecutor.java
similarity index 100%
rename from api/src/com/cloud/network/element/AggregatedCommandExecutor.java
rename to api/src/main/java/com/cloud/network/element/AggregatedCommandExecutor.java
diff --git a/api/src/com/cloud/network/element/ConnectivityProvider.java b/api/src/main/java/com/cloud/network/element/ConnectivityProvider.java
similarity index 100%
rename from api/src/com/cloud/network/element/ConnectivityProvider.java
rename to api/src/main/java/com/cloud/network/element/ConnectivityProvider.java
diff --git a/api/src/com/cloud/network/element/DhcpServiceProvider.java b/api/src/main/java/com/cloud/network/element/DhcpServiceProvider.java
similarity index 100%
rename from api/src/com/cloud/network/element/DhcpServiceProvider.java
rename to api/src/main/java/com/cloud/network/element/DhcpServiceProvider.java
diff --git a/api/src/com/cloud/network/element/DnsServiceProvider.java b/api/src/main/java/com/cloud/network/element/DnsServiceProvider.java
similarity index 100%
rename from api/src/com/cloud/network/element/DnsServiceProvider.java
rename to api/src/main/java/com/cloud/network/element/DnsServiceProvider.java
diff --git a/api/src/com/cloud/network/element/FirewallServiceProvider.java b/api/src/main/java/com/cloud/network/element/FirewallServiceProvider.java
similarity index 100%
rename from api/src/com/cloud/network/element/FirewallServiceProvider.java
rename to api/src/main/java/com/cloud/network/element/FirewallServiceProvider.java
diff --git a/api/src/com/cloud/network/element/IpDeployer.java b/api/src/main/java/com/cloud/network/element/IpDeployer.java
similarity index 100%
rename from api/src/com/cloud/network/element/IpDeployer.java
rename to api/src/main/java/com/cloud/network/element/IpDeployer.java
diff --git a/api/src/com/cloud/network/element/IpDeployingRequester.java b/api/src/main/java/com/cloud/network/element/IpDeployingRequester.java
similarity index 100%
rename from api/src/com/cloud/network/element/IpDeployingRequester.java
rename to api/src/main/java/com/cloud/network/element/IpDeployingRequester.java
diff --git a/api/src/com/cloud/network/element/LoadBalancingServiceProvider.java b/api/src/main/java/com/cloud/network/element/LoadBalancingServiceProvider.java
similarity index 100%
rename from api/src/com/cloud/network/element/LoadBalancingServiceProvider.java
rename to api/src/main/java/com/cloud/network/element/LoadBalancingServiceProvider.java
diff --git a/api/src/com/cloud/network/element/NetworkACLServiceProvider.java b/api/src/main/java/com/cloud/network/element/NetworkACLServiceProvider.java
similarity index 100%
rename from api/src/com/cloud/network/element/NetworkACLServiceProvider.java
rename to api/src/main/java/com/cloud/network/element/NetworkACLServiceProvider.java
diff --git a/api/src/com/cloud/network/element/NetworkElement.java b/api/src/main/java/com/cloud/network/element/NetworkElement.java
similarity index 100%
rename from api/src/com/cloud/network/element/NetworkElement.java
rename to api/src/main/java/com/cloud/network/element/NetworkElement.java
diff --git a/api/src/com/cloud/network/element/PortForwardingServiceProvider.java b/api/src/main/java/com/cloud/network/element/PortForwardingServiceProvider.java
similarity index 100%
rename from api/src/com/cloud/network/element/PortForwardingServiceProvider.java
rename to api/src/main/java/com/cloud/network/element/PortForwardingServiceProvider.java
diff --git a/api/src/com/cloud/network/element/RedundantResource.java b/api/src/main/java/com/cloud/network/element/RedundantResource.java
similarity index 100%
rename from api/src/com/cloud/network/element/RedundantResource.java
rename to api/src/main/java/com/cloud/network/element/RedundantResource.java
diff --git a/api/src/com/cloud/network/element/RemoteAccessVPNServiceProvider.java b/api/src/main/java/com/cloud/network/element/RemoteAccessVPNServiceProvider.java
similarity index 100%
rename from api/src/com/cloud/network/element/RemoteAccessVPNServiceProvider.java
rename to api/src/main/java/com/cloud/network/element/RemoteAccessVPNServiceProvider.java
diff --git a/api/src/com/cloud/network/element/Site2SiteVpnServiceProvider.java b/api/src/main/java/com/cloud/network/element/Site2SiteVpnServiceProvider.java
similarity index 100%
rename from api/src/com/cloud/network/element/Site2SiteVpnServiceProvider.java
rename to api/src/main/java/com/cloud/network/element/Site2SiteVpnServiceProvider.java
diff --git a/api/src/com/cloud/network/element/SourceNatServiceProvider.java b/api/src/main/java/com/cloud/network/element/SourceNatServiceProvider.java
similarity index 100%
rename from api/src/com/cloud/network/element/SourceNatServiceProvider.java
rename to api/src/main/java/com/cloud/network/element/SourceNatServiceProvider.java
diff --git a/api/src/com/cloud/network/element/StaticNatServiceProvider.java b/api/src/main/java/com/cloud/network/element/StaticNatServiceProvider.java
similarity index 100%
rename from api/src/com/cloud/network/element/StaticNatServiceProvider.java
rename to api/src/main/java/com/cloud/network/element/StaticNatServiceProvider.java
diff --git a/api/src/com/cloud/network/element/UserDataServiceProvider.java b/api/src/main/java/com/cloud/network/element/UserDataServiceProvider.java
similarity index 100%
rename from api/src/com/cloud/network/element/UserDataServiceProvider.java
rename to api/src/main/java/com/cloud/network/element/UserDataServiceProvider.java
diff --git a/api/src/com/cloud/network/element/VirtualRouterElementService.java b/api/src/main/java/com/cloud/network/element/VirtualRouterElementService.java
similarity index 100%
rename from api/src/com/cloud/network/element/VirtualRouterElementService.java
rename to api/src/main/java/com/cloud/network/element/VirtualRouterElementService.java
diff --git a/api/src/com/cloud/network/element/VpcProvider.java b/api/src/main/java/com/cloud/network/element/VpcProvider.java
similarity index 100%
rename from api/src/com/cloud/network/element/VpcProvider.java
rename to api/src/main/java/com/cloud/network/element/VpcProvider.java
diff --git a/api/src/com/cloud/network/firewall/FirewallService.java b/api/src/main/java/com/cloud/network/firewall/FirewallService.java
similarity index 100%
rename from api/src/com/cloud/network/firewall/FirewallService.java
rename to api/src/main/java/com/cloud/network/firewall/FirewallService.java
diff --git a/api/src/com/cloud/network/guru/NetworkGuru.java b/api/src/main/java/com/cloud/network/guru/NetworkGuru.java
similarity index 100%
rename from api/src/com/cloud/network/guru/NetworkGuru.java
rename to api/src/main/java/com/cloud/network/guru/NetworkGuru.java
diff --git a/api/src/com/cloud/network/guru/NetworkGuruAdditionalFunctions.java b/api/src/main/java/com/cloud/network/guru/NetworkGuruAdditionalFunctions.java
similarity index 100%
rename from api/src/com/cloud/network/guru/NetworkGuruAdditionalFunctions.java
rename to api/src/main/java/com/cloud/network/guru/NetworkGuruAdditionalFunctions.java
diff --git a/api/src/com/cloud/network/lb/LoadBalancingRule.java b/api/src/main/java/com/cloud/network/lb/LoadBalancingRule.java
similarity index 100%
rename from api/src/com/cloud/network/lb/LoadBalancingRule.java
rename to api/src/main/java/com/cloud/network/lb/LoadBalancingRule.java
diff --git a/api/src/com/cloud/network/lb/LoadBalancingRulesService.java b/api/src/main/java/com/cloud/network/lb/LoadBalancingRulesService.java
similarity index 100%
rename from api/src/com/cloud/network/lb/LoadBalancingRulesService.java
rename to api/src/main/java/com/cloud/network/lb/LoadBalancingRulesService.java
diff --git a/api/src/com/cloud/network/router/VirtualRouter.java b/api/src/main/java/com/cloud/network/router/VirtualRouter.java
similarity index 100%
rename from api/src/com/cloud/network/router/VirtualRouter.java
rename to api/src/main/java/com/cloud/network/router/VirtualRouter.java
diff --git a/api/src/com/cloud/network/rules/FirewallRule.java b/api/src/main/java/com/cloud/network/rules/FirewallRule.java
similarity index 100%
rename from api/src/com/cloud/network/rules/FirewallRule.java
rename to api/src/main/java/com/cloud/network/rules/FirewallRule.java
diff --git a/api/src/com/cloud/network/rules/HealthCheckPolicy.java b/api/src/main/java/com/cloud/network/rules/HealthCheckPolicy.java
similarity index 100%
rename from api/src/com/cloud/network/rules/HealthCheckPolicy.java
rename to api/src/main/java/com/cloud/network/rules/HealthCheckPolicy.java
diff --git a/api/src/com/cloud/network/rules/LbStickinessMethod.java b/api/src/main/java/com/cloud/network/rules/LbStickinessMethod.java
similarity index 100%
rename from api/src/com/cloud/network/rules/LbStickinessMethod.java
rename to api/src/main/java/com/cloud/network/rules/LbStickinessMethod.java
diff --git a/api/src/com/cloud/network/rules/LoadBalancer.java b/api/src/main/java/com/cloud/network/rules/LoadBalancer.java
similarity index 100%
rename from api/src/com/cloud/network/rules/LoadBalancer.java
rename to api/src/main/java/com/cloud/network/rules/LoadBalancer.java
diff --git a/api/src/com/cloud/network/rules/LoadBalancerContainer.java b/api/src/main/java/com/cloud/network/rules/LoadBalancerContainer.java
similarity index 100%
rename from api/src/com/cloud/network/rules/LoadBalancerContainer.java
rename to api/src/main/java/com/cloud/network/rules/LoadBalancerContainer.java
diff --git a/api/src/com/cloud/network/rules/PortForwardingRule.java b/api/src/main/java/com/cloud/network/rules/PortForwardingRule.java
similarity index 100%
rename from api/src/com/cloud/network/rules/PortForwardingRule.java
rename to api/src/main/java/com/cloud/network/rules/PortForwardingRule.java
diff --git a/api/src/com/cloud/network/rules/RulesService.java b/api/src/main/java/com/cloud/network/rules/RulesService.java
similarity index 100%
rename from api/src/com/cloud/network/rules/RulesService.java
rename to api/src/main/java/com/cloud/network/rules/RulesService.java
diff --git a/api/src/com/cloud/network/rules/StaticNat.java b/api/src/main/java/com/cloud/network/rules/StaticNat.java
similarity index 100%
rename from api/src/com/cloud/network/rules/StaticNat.java
rename to api/src/main/java/com/cloud/network/rules/StaticNat.java
diff --git a/api/src/com/cloud/network/rules/StaticNatRule.java b/api/src/main/java/com/cloud/network/rules/StaticNatRule.java
similarity index 100%
rename from api/src/com/cloud/network/rules/StaticNatRule.java
rename to api/src/main/java/com/cloud/network/rules/StaticNatRule.java
diff --git a/api/src/com/cloud/network/rules/StickinessPolicy.java b/api/src/main/java/com/cloud/network/rules/StickinessPolicy.java
similarity index 100%
rename from api/src/com/cloud/network/rules/StickinessPolicy.java
rename to api/src/main/java/com/cloud/network/rules/StickinessPolicy.java
diff --git a/api/src/com/cloud/network/security/SecurityGroup.java b/api/src/main/java/com/cloud/network/security/SecurityGroup.java
similarity index 100%
rename from api/src/com/cloud/network/security/SecurityGroup.java
rename to api/src/main/java/com/cloud/network/security/SecurityGroup.java
diff --git a/api/src/com/cloud/network/security/SecurityGroupRules.java b/api/src/main/java/com/cloud/network/security/SecurityGroupRules.java
similarity index 100%
rename from api/src/com/cloud/network/security/SecurityGroupRules.java
rename to api/src/main/java/com/cloud/network/security/SecurityGroupRules.java
diff --git a/api/src/com/cloud/network/security/SecurityGroupService.java b/api/src/main/java/com/cloud/network/security/SecurityGroupService.java
similarity index 100%
rename from api/src/com/cloud/network/security/SecurityGroupService.java
rename to api/src/main/java/com/cloud/network/security/SecurityGroupService.java
diff --git a/api/src/com/cloud/network/security/SecurityRule.java b/api/src/main/java/com/cloud/network/security/SecurityRule.java
similarity index 100%
rename from api/src/com/cloud/network/security/SecurityRule.java
rename to api/src/main/java/com/cloud/network/security/SecurityRule.java
diff --git a/api/src/com/cloud/network/vpc/NetworkACL.java b/api/src/main/java/com/cloud/network/vpc/NetworkACL.java
similarity index 100%
rename from api/src/com/cloud/network/vpc/NetworkACL.java
rename to api/src/main/java/com/cloud/network/vpc/NetworkACL.java
diff --git a/api/src/main/java/com/cloud/network/vpc/NetworkACLItem.java b/api/src/main/java/com/cloud/network/vpc/NetworkACLItem.java
new file mode 100644
index 00000000000..eeca375c46f
--- /dev/null
+++ b/api/src/main/java/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 java.util.List;
+
+import org.apache.cloudstack.api.Displayable;
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+public interface NetworkACLItem extends InternalIdentity, Identity, Displayable {
+
+    @Override
+    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 port 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<String> getSourceCidrList();
+
+    TrafficType getTrafficType();
+
+    @Override
+    boolean isDisplay();
+
+    String getReason();
+}
diff --git a/api/src/main/java/com/cloud/network/vpc/NetworkACLService.java b/api/src/main/java/com/cloud/network/vpc/NetworkACLService.java
new file mode 100644
index 00000000000..7c4e8b45333
--- /dev/null
+++ b/api/src/main/java/com/cloud/network/vpc/NetworkACLService.java
@@ -0,0 +1,99 @@
+// 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 java.util.List;
+
+import org.apache.cloudstack.api.command.user.network.CreateNetworkACLCmd;
+import org.apache.cloudstack.api.command.user.network.ListNetworkACLListsCmd;
+import org.apache.cloudstack.api.command.user.network.ListNetworkACLsCmd;
+import org.apache.cloudstack.api.command.user.network.MoveNetworkAclItemCmd;
+import org.apache.cloudstack.api.command.user.network.UpdateNetworkACLItemCmd;
+import org.apache.cloudstack.api.command.user.network.UpdateNetworkACLListCmd;
+
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.utils.Pair;
+
+public interface NetworkACLService {
+
+    /**
+     * Creates Network ACL for the specified VPC
+     */
+    NetworkACL createNetworkACL(String name, String description, long vpcId, Boolean forDisplay);
+
+    /**
+     * Get Network ACL with specified Id
+     */
+    NetworkACL getNetworkACL(long id);
+
+    /**
+     * List NetworkACLs by Id/Name/Network or VPC it belongs to
+     */
+    Pair<List<? extends NetworkACL>, Integer> listNetworkACLs(ListNetworkACLListsCmd cmd);
+
+    /**
+     * Delete specified network ACL. Deletion fails if the list is not empty
+     */
+    boolean deleteNetworkACL(long id);
+
+    /**
+     * Associates ACL with specified Network
+     */
+    boolean replaceNetworkACL(long aclId, long networkId) throws ResourceUnavailableException;
+
+    /**
+     * Applied ACL to associated networks
+     */
+    boolean applyNetworkACL(long aclId) throws ResourceUnavailableException;
+
+    /**
+     * Creates a Network ACL Item within an ACL and applies the ACL to associated networks
+     */
+    NetworkACLItem createNetworkACLItem(CreateNetworkACLCmd aclItemCmd);
+
+    /**
+     * Return ACL item with specified Id
+     */
+    NetworkACLItem getNetworkACLItem(long ruleId);
+
+    /**
+     * Lists Network ACL Items by Id, Network, ACLId, Traffic Type, protocol
+     */
+    Pair<List<? extends NetworkACLItem>, Integer> listNetworkACLItems(ListNetworkACLsCmd cmd);
+
+    /**
+     * Revoke ACL Item with specified Id
+     */
+    boolean revokeNetworkACLItem(long ruleId);
+
+    /**
+     * Updates existing aclItem applies to associated networks
+     */
+    NetworkACLItem updateNetworkACLItem(UpdateNetworkACLItemCmd updateNetworkACLItemCmd) throws ResourceUnavailableException;
+
+    /**
+     * Associates ACL with specified Network
+     */
+    boolean replaceNetworkACLonPrivateGw(long aclId, long privateGatewayId) throws ResourceUnavailableException;
+
+    NetworkACL updateNetworkACL(UpdateNetworkACLListCmd updateNetworkACLListCmd);
+
+    /**
+     * Updates a network item ACL to a new position. This method allows users to inform between which ACLs the given ACL will be placed. Therefore, the 'number' field will be filled out by the system in the best way possible to place the ACL accordingly.
+     */
+    NetworkACLItem moveNetworkAclRuleToNewPosition(MoveNetworkAclItemCmd moveNetworkAclItemCmd);
+}
\ No newline at end of file
diff --git a/api/src/com/cloud/network/vpc/PrivateGateway.java b/api/src/main/java/com/cloud/network/vpc/PrivateGateway.java
similarity index 100%
rename from api/src/com/cloud/network/vpc/PrivateGateway.java
rename to api/src/main/java/com/cloud/network/vpc/PrivateGateway.java
diff --git a/api/src/com/cloud/network/vpc/PrivateIp.java b/api/src/main/java/com/cloud/network/vpc/PrivateIp.java
similarity index 100%
rename from api/src/com/cloud/network/vpc/PrivateIp.java
rename to api/src/main/java/com/cloud/network/vpc/PrivateIp.java
diff --git a/api/src/com/cloud/network/vpc/StaticRoute.java b/api/src/main/java/com/cloud/network/vpc/StaticRoute.java
similarity index 100%
rename from api/src/com/cloud/network/vpc/StaticRoute.java
rename to api/src/main/java/com/cloud/network/vpc/StaticRoute.java
diff --git a/api/src/com/cloud/network/vpc/StaticRouteProfile.java b/api/src/main/java/com/cloud/network/vpc/StaticRouteProfile.java
similarity index 100%
rename from api/src/com/cloud/network/vpc/StaticRouteProfile.java
rename to api/src/main/java/com/cloud/network/vpc/StaticRouteProfile.java
diff --git a/api/src/com/cloud/network/vpc/Vpc.java b/api/src/main/java/com/cloud/network/vpc/Vpc.java
similarity index 100%
rename from api/src/com/cloud/network/vpc/Vpc.java
rename to api/src/main/java/com/cloud/network/vpc/Vpc.java
diff --git a/api/src/com/cloud/network/vpc/VpcGateway.java b/api/src/main/java/com/cloud/network/vpc/VpcGateway.java
similarity index 100%
rename from api/src/com/cloud/network/vpc/VpcGateway.java
rename to api/src/main/java/com/cloud/network/vpc/VpcGateway.java
diff --git a/api/src/com/cloud/network/vpc/VpcOffering.java b/api/src/main/java/com/cloud/network/vpc/VpcOffering.java
similarity index 100%
rename from api/src/com/cloud/network/vpc/VpcOffering.java
rename to api/src/main/java/com/cloud/network/vpc/VpcOffering.java
diff --git a/api/src/com/cloud/network/vpc/VpcProvisioningService.java b/api/src/main/java/com/cloud/network/vpc/VpcProvisioningService.java
similarity index 100%
rename from api/src/com/cloud/network/vpc/VpcProvisioningService.java
rename to api/src/main/java/com/cloud/network/vpc/VpcProvisioningService.java
diff --git a/api/src/com/cloud/network/vpc/VpcService.java b/api/src/main/java/com/cloud/network/vpc/VpcService.java
similarity index 100%
rename from api/src/com/cloud/network/vpc/VpcService.java
rename to api/src/main/java/com/cloud/network/vpc/VpcService.java
diff --git a/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java b/api/src/main/java/com/cloud/network/vpn/RemoteAccessVpnService.java
similarity index 100%
rename from api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
rename to api/src/main/java/com/cloud/network/vpn/RemoteAccessVpnService.java
diff --git a/api/src/com/cloud/network/vpn/Site2SiteVpnService.java b/api/src/main/java/com/cloud/network/vpn/Site2SiteVpnService.java
similarity index 100%
rename from api/src/com/cloud/network/vpn/Site2SiteVpnService.java
rename to api/src/main/java/com/cloud/network/vpn/Site2SiteVpnService.java
diff --git a/api/src/com/cloud/offering/DiskOffering.java b/api/src/main/java/com/cloud/offering/DiskOffering.java
similarity index 100%
rename from api/src/com/cloud/offering/DiskOffering.java
rename to api/src/main/java/com/cloud/offering/DiskOffering.java
diff --git a/api/src/com/cloud/offering/DiskOfferingInfo.java b/api/src/main/java/com/cloud/offering/DiskOfferingInfo.java
similarity index 100%
rename from api/src/com/cloud/offering/DiskOfferingInfo.java
rename to api/src/main/java/com/cloud/offering/DiskOfferingInfo.java
diff --git a/api/src/com/cloud/offering/NetworkOffering.java b/api/src/main/java/com/cloud/offering/NetworkOffering.java
similarity index 100%
rename from api/src/com/cloud/offering/NetworkOffering.java
rename to api/src/main/java/com/cloud/offering/NetworkOffering.java
diff --git a/api/src/com/cloud/offering/OfferingManager.java b/api/src/main/java/com/cloud/offering/OfferingManager.java
similarity index 100%
rename from api/src/com/cloud/offering/OfferingManager.java
rename to api/src/main/java/com/cloud/offering/OfferingManager.java
diff --git a/api/src/com/cloud/offering/ServiceOffering.java b/api/src/main/java/com/cloud/offering/ServiceOffering.java
similarity index 100%
rename from api/src/com/cloud/offering/ServiceOffering.java
rename to api/src/main/java/com/cloud/offering/ServiceOffering.java
diff --git a/api/src/com/cloud/org/Cluster.java b/api/src/main/java/com/cloud/org/Cluster.java
similarity index 100%
rename from api/src/com/cloud/org/Cluster.java
rename to api/src/main/java/com/cloud/org/Cluster.java
diff --git a/api/src/com/cloud/org/Grouping.java b/api/src/main/java/com/cloud/org/Grouping.java
similarity index 100%
rename from api/src/com/cloud/org/Grouping.java
rename to api/src/main/java/com/cloud/org/Grouping.java
diff --git a/api/src/com/cloud/org/Managed.java b/api/src/main/java/com/cloud/org/Managed.java
similarity index 100%
rename from api/src/com/cloud/org/Managed.java
rename to api/src/main/java/com/cloud/org/Managed.java
diff --git a/api/src/com/cloud/org/RunningIn.java b/api/src/main/java/com/cloud/org/RunningIn.java
similarity index 100%
rename from api/src/com/cloud/org/RunningIn.java
rename to api/src/main/java/com/cloud/org/RunningIn.java
diff --git a/api/src/com/cloud/projects/Project.java b/api/src/main/java/com/cloud/projects/Project.java
similarity index 100%
rename from api/src/com/cloud/projects/Project.java
rename to api/src/main/java/com/cloud/projects/Project.java
diff --git a/api/src/com/cloud/projects/ProjectAccount.java b/api/src/main/java/com/cloud/projects/ProjectAccount.java
similarity index 100%
rename from api/src/com/cloud/projects/ProjectAccount.java
rename to api/src/main/java/com/cloud/projects/ProjectAccount.java
diff --git a/api/src/com/cloud/projects/ProjectInvitation.java b/api/src/main/java/com/cloud/projects/ProjectInvitation.java
similarity index 100%
rename from api/src/com/cloud/projects/ProjectInvitation.java
rename to api/src/main/java/com/cloud/projects/ProjectInvitation.java
diff --git a/api/src/com/cloud/projects/ProjectService.java b/api/src/main/java/com/cloud/projects/ProjectService.java
similarity index 100%
rename from api/src/com/cloud/projects/ProjectService.java
rename to api/src/main/java/com/cloud/projects/ProjectService.java
diff --git a/api/src/com/cloud/region/ha/GlobalLoadBalancerRule.java b/api/src/main/java/com/cloud/region/ha/GlobalLoadBalancerRule.java
similarity index 100%
rename from api/src/com/cloud/region/ha/GlobalLoadBalancerRule.java
rename to api/src/main/java/com/cloud/region/ha/GlobalLoadBalancerRule.java
diff --git a/api/src/com/cloud/region/ha/GlobalLoadBalancingRulesService.java b/api/src/main/java/com/cloud/region/ha/GlobalLoadBalancingRulesService.java
similarity index 100%
rename from api/src/com/cloud/region/ha/GlobalLoadBalancingRulesService.java
rename to api/src/main/java/com/cloud/region/ha/GlobalLoadBalancingRulesService.java
diff --git a/api/src/main/java/com/cloud/resource/ResourceService.java b/api/src/main/java/com/cloud/resource/ResourceService.java
new file mode 100644
index 00000000000..70823084d84
--- /dev/null
+++ b/api/src/main/java/com/cloud/resource/ResourceService.java
@@ -0,0 +1,89 @@
+// 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.resource;
+
+import java.util.List;
+
+import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
+import org.apache.cloudstack.api.command.admin.cluster.DeleteClusterCmd;
+import org.apache.cloudstack.api.command.admin.host.AddHostCmd;
+import org.apache.cloudstack.api.command.admin.host.AddSecondaryStorageCmd;
+import org.apache.cloudstack.api.command.admin.host.CancelMaintenanceCmd;
+import org.apache.cloudstack.api.command.admin.host.PrepareForMaintenanceCmd;
+import org.apache.cloudstack.api.command.admin.host.ReconnectHostCmd;
+import org.apache.cloudstack.api.command.admin.host.UpdateHostCmd;
+import org.apache.cloudstack.api.command.admin.host.UpdateHostPasswordCmd;
+
+import com.cloud.dc.DataCenter;
+import com.cloud.exception.AgentUnavailableException;
+import com.cloud.exception.DiscoveryException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceInUseException;
+import com.cloud.host.Host;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.org.Cluster;
+import com.cloud.utils.fsm.NoTransitionException;
+
+public interface ResourceService {
+    /**
+     * Updates a host
+     *
+     * @param cmd - the command specifying hostId
+     */
+    Host updateHost(UpdateHostCmd cmd) throws NoTransitionException;
+
+    Host cancelMaintenance(CancelMaintenanceCmd cmd);
+
+    Host reconnectHost(ReconnectHostCmd cmd) throws AgentUnavailableException;
+
+    /**
+     * We will automatically create an Apache CloudStack cluster to attach to the external cluster and return a hyper host to perform
+     * host related operation within the cluster
+     */
+    List<? extends Cluster> discoverCluster(AddClusterCmd cmd) throws IllegalArgumentException, DiscoveryException, ResourceInUseException;
+
+    boolean deleteCluster(DeleteClusterCmd cmd);
+
+    Cluster updateCluster(Cluster cluster, String clusterType, String hypervisor, String allocationState, String managedstate);
+
+    List<? extends Host> discoverHosts(AddHostCmd cmd) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException;
+
+    List<? extends Host> discoverHosts(AddSecondaryStorageCmd cmd) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException;
+
+    Host maintain(PrepareForMaintenanceCmd cmd);
+
+    /**
+     * Deletes a host
+     * @param true if deleted, false otherwise
+     */
+    boolean deleteHost(long hostId, boolean isForced, boolean isForceDeleteStorage);
+
+    boolean updateClusterPassword(UpdateHostPasswordCmd upasscmd);
+
+    boolean updateHostPassword(UpdateHostPasswordCmd upasscmd);
+
+    Host getHost(long hostId);
+
+    Cluster getCluster(Long clusterId);
+
+    DataCenter getZone(Long zoneId);
+
+    List<HypervisorType> getSupportedHypervisorTypes(long zoneId, boolean forVirtualRouter, Long podId);
+
+    boolean releaseHostReservation(Long hostId);
+
+}
diff --git a/api/src/com/cloud/resource/ResourceState.java b/api/src/main/java/com/cloud/resource/ResourceState.java
similarity index 100%
rename from api/src/com/cloud/resource/ResourceState.java
rename to api/src/main/java/com/cloud/resource/ResourceState.java
diff --git a/api/src/com/cloud/resource/UnableDeleteHostException.java b/api/src/main/java/com/cloud/resource/UnableDeleteHostException.java
similarity index 100%
rename from api/src/com/cloud/resource/UnableDeleteHostException.java
rename to api/src/main/java/com/cloud/resource/UnableDeleteHostException.java
diff --git a/api/src/com/cloud/serializer/Param.java b/api/src/main/java/com/cloud/serializer/Param.java
similarity index 100%
rename from api/src/com/cloud/serializer/Param.java
rename to api/src/main/java/com/cloud/serializer/Param.java
diff --git a/api/src/com/cloud/server/ManagementService.java b/api/src/main/java/com/cloud/server/ManagementService.java
similarity index 100%
rename from api/src/com/cloud/server/ManagementService.java
rename to api/src/main/java/com/cloud/server/ManagementService.java
diff --git a/api/src/com/cloud/server/ResourceMetaDataService.java b/api/src/main/java/com/cloud/server/ResourceMetaDataService.java
similarity index 100%
rename from api/src/com/cloud/server/ResourceMetaDataService.java
rename to api/src/main/java/com/cloud/server/ResourceMetaDataService.java
diff --git a/api/src/com/cloud/server/ResourceTag.java b/api/src/main/java/com/cloud/server/ResourceTag.java
similarity index 100%
rename from api/src/com/cloud/server/ResourceTag.java
rename to api/src/main/java/com/cloud/server/ResourceTag.java
diff --git a/api/src/com/cloud/server/TaggedResourceService.java b/api/src/main/java/com/cloud/server/TaggedResourceService.java
similarity index 100%
rename from api/src/com/cloud/server/TaggedResourceService.java
rename to api/src/main/java/com/cloud/server/TaggedResourceService.java
diff --git a/api/src/com/cloud/storage/DataStoreProviderApiService.java b/api/src/main/java/com/cloud/storage/DataStoreProviderApiService.java
similarity index 100%
rename from api/src/com/cloud/storage/DataStoreProviderApiService.java
rename to api/src/main/java/com/cloud/storage/DataStoreProviderApiService.java
diff --git a/api/src/com/cloud/storage/DataStoreRole.java b/api/src/main/java/com/cloud/storage/DataStoreRole.java
similarity index 100%
rename from api/src/com/cloud/storage/DataStoreRole.java
rename to api/src/main/java/com/cloud/storage/DataStoreRole.java
diff --git a/api/src/com/cloud/storage/GuestOS.java b/api/src/main/java/com/cloud/storage/GuestOS.java
similarity index 100%
rename from api/src/com/cloud/storage/GuestOS.java
rename to api/src/main/java/com/cloud/storage/GuestOS.java
diff --git a/api/src/com/cloud/storage/GuestOSHypervisor.java b/api/src/main/java/com/cloud/storage/GuestOSHypervisor.java
similarity index 100%
rename from api/src/com/cloud/storage/GuestOSHypervisor.java
rename to api/src/main/java/com/cloud/storage/GuestOSHypervisor.java
diff --git a/api/src/com/cloud/storage/GuestOsCategory.java b/api/src/main/java/com/cloud/storage/GuestOsCategory.java
similarity index 100%
rename from api/src/com/cloud/storage/GuestOsCategory.java
rename to api/src/main/java/com/cloud/storage/GuestOsCategory.java
diff --git a/api/src/com/cloud/storage/ImageStore.java b/api/src/main/java/com/cloud/storage/ImageStore.java
similarity index 100%
rename from api/src/com/cloud/storage/ImageStore.java
rename to api/src/main/java/com/cloud/storage/ImageStore.java
diff --git a/api/src/com/cloud/storage/ScopeType.java b/api/src/main/java/com/cloud/storage/ScopeType.java
similarity index 100%
rename from api/src/com/cloud/storage/ScopeType.java
rename to api/src/main/java/com/cloud/storage/ScopeType.java
diff --git a/api/src/com/cloud/storage/Snapshot.java b/api/src/main/java/com/cloud/storage/Snapshot.java
similarity index 100%
rename from api/src/com/cloud/storage/Snapshot.java
rename to api/src/main/java/com/cloud/storage/Snapshot.java
diff --git a/api/src/com/cloud/storage/Storage.java b/api/src/main/java/com/cloud/storage/Storage.java
similarity index 100%
rename from api/src/com/cloud/storage/Storage.java
rename to api/src/main/java/com/cloud/storage/Storage.java
diff --git a/api/src/com/cloud/storage/StorageGuru.java b/api/src/main/java/com/cloud/storage/StorageGuru.java
similarity index 100%
rename from api/src/com/cloud/storage/StorageGuru.java
rename to api/src/main/java/com/cloud/storage/StorageGuru.java
diff --git a/api/src/com/cloud/storage/StoragePool.java b/api/src/main/java/com/cloud/storage/StoragePool.java
similarity index 100%
rename from api/src/com/cloud/storage/StoragePool.java
rename to api/src/main/java/com/cloud/storage/StoragePool.java
diff --git a/api/src/com/cloud/storage/StoragePoolDiscoverer.java b/api/src/main/java/com/cloud/storage/StoragePoolDiscoverer.java
similarity index 100%
rename from api/src/com/cloud/storage/StoragePoolDiscoverer.java
rename to api/src/main/java/com/cloud/storage/StoragePoolDiscoverer.java
diff --git a/api/src/com/cloud/storage/StoragePoolStatus.java b/api/src/main/java/com/cloud/storage/StoragePoolStatus.java
similarity index 100%
rename from api/src/com/cloud/storage/StoragePoolStatus.java
rename to api/src/main/java/com/cloud/storage/StoragePoolStatus.java
diff --git a/api/src/main/java/com/cloud/storage/StorageService.java b/api/src/main/java/com/cloud/storage/StorageService.java
new file mode 100644
index 00000000000..aebbbcd4bd0
--- /dev/null
+++ b/api/src/main/java/com/cloud/storage/StorageService.java
@@ -0,0 +1,105 @@
+// 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 java.net.UnknownHostException;
+import java.util.Map;
+
+import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaintenanceCmd;
+import org.apache.cloudstack.api.command.admin.storage.CreateSecondaryStagingStoreCmd;
+import org.apache.cloudstack.api.command.admin.storage.CreateStoragePoolCmd;
+import org.apache.cloudstack.api.command.admin.storage.DeleteImageStoreCmd;
+import org.apache.cloudstack.api.command.admin.storage.DeletePoolCmd;
+import org.apache.cloudstack.api.command.admin.storage.DeleteSecondaryStagingStoreCmd;
+import org.apache.cloudstack.api.command.admin.storage.UpdateStoragePoolCmd;
+
+import com.cloud.exception.DiscoveryException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceInUseException;
+import com.cloud.exception.ResourceUnavailableException;
+
+public interface StorageService {
+    /**
+     * Create StoragePool based on uri
+     *
+     * @param cmd
+     *            The command object that specifies the zone, cluster/pod, URI, details, etc. to use to create the
+     *            storage pool.
+     * @return
+     *            The StoragePool created.
+     * @throws ResourceInUseException
+     * @throws IllegalArgumentException
+     * @throws UnknownHostException
+     * @throws ResourceUnavailableException
+     */
+    StoragePool createPool(CreateStoragePoolCmd cmd) throws ResourceInUseException, IllegalArgumentException, UnknownHostException, ResourceUnavailableException;
+
+    ImageStore createSecondaryStagingStore(CreateSecondaryStagingStoreCmd cmd);
+
+    /**
+     * Delete the storage pool
+     *
+     * @param cmd
+     *            - the command specifying poolId
+     * @return success or failure
+     */
+    boolean deletePool(DeletePoolCmd cmd);
+
+    /**
+     * Enable maintenance for primary storage
+     *
+     * @param primaryStorageId
+     *            - the primaryStorageId
+     * @return the primary storage pool
+     * @throws ResourceUnavailableException
+     * @throws InsufficientCapacityException
+     */
+    StoragePool preparePrimaryStorageForMaintenance(Long primaryStorageId) throws ResourceUnavailableException, InsufficientCapacityException;
+
+    /**
+     * Complete maintenance for primary storage
+     *
+     * @param cmd
+     *            - the command specifying primaryStorageId
+     * @return the primary storage pool
+     * @throws ResourceUnavailableException
+     */
+    StoragePool cancelPrimaryStorageForMaintenance(CancelPrimaryStorageMaintenanceCmd cmd) throws ResourceUnavailableException;
+
+    StoragePool updateStoragePool(UpdateStoragePoolCmd cmd) throws IllegalArgumentException;
+
+    StoragePool getStoragePool(long id);
+
+    boolean deleteImageStore(DeleteImageStoreCmd cmd);
+
+    boolean deleteSecondaryStagingStore(DeleteSecondaryStagingStoreCmd cmd);
+
+    ImageStore discoverImageStore(String name, String url, String providerName, Long zoneId, Map details) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException;
+
+    /**
+     * Migrate existing NFS to use object store.
+     * @param name object store name.
+     * @param url object store URL.
+     * @param providerName object store provider Name.
+     * @param details object store other details
+     * @return Object store created.
+     */
+    ImageStore migrateToObjectStore(String name, String url, String providerName, Map<String, String> details) throws DiscoveryException;
+
+}
diff --git a/api/src/com/cloud/storage/StorageStats.java b/api/src/main/java/com/cloud/storage/StorageStats.java
similarity index 100%
rename from api/src/com/cloud/storage/StorageStats.java
rename to api/src/main/java/com/cloud/storage/StorageStats.java
diff --git a/api/src/com/cloud/storage/Upload.java b/api/src/main/java/com/cloud/storage/Upload.java
similarity index 100%
rename from api/src/com/cloud/storage/Upload.java
rename to api/src/main/java/com/cloud/storage/Upload.java
diff --git a/api/src/com/cloud/storage/VMTemplateStorageResourceAssoc.java b/api/src/main/java/com/cloud/storage/VMTemplateStorageResourceAssoc.java
similarity index 100%
rename from api/src/com/cloud/storage/VMTemplateStorageResourceAssoc.java
rename to api/src/main/java/com/cloud/storage/VMTemplateStorageResourceAssoc.java
diff --git a/api/src/com/cloud/storage/Volume.java b/api/src/main/java/com/cloud/storage/Volume.java
similarity index 100%
rename from api/src/com/cloud/storage/Volume.java
rename to api/src/main/java/com/cloud/storage/Volume.java
diff --git a/api/src/com/cloud/storage/VolumeApiService.java b/api/src/main/java/com/cloud/storage/VolumeApiService.java
similarity index 100%
rename from api/src/com/cloud/storage/VolumeApiService.java
rename to api/src/main/java/com/cloud/storage/VolumeApiService.java
diff --git a/api/src/com/cloud/storage/VolumeStats.java b/api/src/main/java/com/cloud/storage/VolumeStats.java
similarity index 100%
rename from api/src/com/cloud/storage/VolumeStats.java
rename to api/src/main/java/com/cloud/storage/VolumeStats.java
diff --git a/api/src/com/cloud/storage/snapshot/SnapshotApiService.java b/api/src/main/java/com/cloud/storage/snapshot/SnapshotApiService.java
similarity index 100%
rename from api/src/com/cloud/storage/snapshot/SnapshotApiService.java
rename to api/src/main/java/com/cloud/storage/snapshot/SnapshotApiService.java
diff --git a/api/src/com/cloud/storage/snapshot/SnapshotPolicy.java b/api/src/main/java/com/cloud/storage/snapshot/SnapshotPolicy.java
similarity index 100%
rename from api/src/com/cloud/storage/snapshot/SnapshotPolicy.java
rename to api/src/main/java/com/cloud/storage/snapshot/SnapshotPolicy.java
diff --git a/api/src/com/cloud/storage/snapshot/SnapshotSchedule.java b/api/src/main/java/com/cloud/storage/snapshot/SnapshotSchedule.java
similarity index 100%
rename from api/src/com/cloud/storage/snapshot/SnapshotSchedule.java
rename to api/src/main/java/com/cloud/storage/snapshot/SnapshotSchedule.java
diff --git a/api/src/com/cloud/storage/template/TemplateProp.java b/api/src/main/java/com/cloud/storage/template/TemplateProp.java
similarity index 100%
rename from api/src/com/cloud/storage/template/TemplateProp.java
rename to api/src/main/java/com/cloud/storage/template/TemplateProp.java
diff --git a/api/src/com/cloud/template/BasedOn.java b/api/src/main/java/com/cloud/template/BasedOn.java
similarity index 100%
rename from api/src/com/cloud/template/BasedOn.java
rename to api/src/main/java/com/cloud/template/BasedOn.java
diff --git a/api/src/com/cloud/template/TemplateApiService.java b/api/src/main/java/com/cloud/template/TemplateApiService.java
similarity index 100%
rename from api/src/com/cloud/template/TemplateApiService.java
rename to api/src/main/java/com/cloud/template/TemplateApiService.java
diff --git a/api/src/com/cloud/template/VirtualMachineTemplate.java b/api/src/main/java/com/cloud/template/VirtualMachineTemplate.java
similarity index 100%
rename from api/src/com/cloud/template/VirtualMachineTemplate.java
rename to api/src/main/java/com/cloud/template/VirtualMachineTemplate.java
diff --git a/api/src/com/cloud/user/Account.java b/api/src/main/java/com/cloud/user/Account.java
similarity index 100%
rename from api/src/com/cloud/user/Account.java
rename to api/src/main/java/com/cloud/user/Account.java
diff --git a/api/src/main/java/com/cloud/user/AccountService.java b/api/src/main/java/com/cloud/user/AccountService.java
new file mode 100644
index 00000000000..060861d1809
--- /dev/null
+++ b/api/src/main/java/com/cloud/user/AccountService.java
@@ -0,0 +1,117 @@
+// 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.user;
+
+import java.util.Map;
+
+import org.apache.cloudstack.acl.ControlledEntity;
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.command.admin.user.GetUserKeysCmd;
+import org.apache.cloudstack.api.command.admin.user.RegisterCmd;
+import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd;
+
+import com.cloud.domain.Domain;
+import com.cloud.exception.PermissionDeniedException;
+import com.cloud.offering.DiskOffering;
+import com.cloud.offering.ServiceOffering;
+
+public interface AccountService {
+
+    /**
+     * Creates a new user and account, stores the password as is so encrypted passwords are recommended.
+     * @return the user if created successfully, null otherwise
+     */
+    UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long roleId, Long domainId,
+            String networkDomain, Map<String, String> details, String accountUUID, String userUUID);
+
+    UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long roleId, Long domainId,
+            String networkDomain, Map<String, String> details, String accountUUID, String userUUID, User.Source source);
+
+    /**
+     * Locks a user by userId. A locked user cannot access the API, but will still have running VMs/IP addresses
+     * allocated/etc.
+     */
+    UserAccount lockUser(long userId);
+
+    Account getSystemAccount();
+
+    User getSystemUser();
+
+    User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId, String userUUID);
+
+    User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId, String userUUID, User.Source source);
+
+    boolean isAdmin(Long accountId);
+
+    Account finalizeOwner(Account caller, String accountName, Long domainId, Long projectId);
+
+    Account getActiveAccountByName(String accountName, Long domainId);
+
+    UserAccount getActiveUserAccount(String username, Long domainId);
+
+    UserAccount updateUser(UpdateUserCmd updateUserCmd);
+
+    Account getActiveAccountById(long accountId);
+
+    Account getAccount(long accountId);
+
+    User getActiveUser(long userId);
+
+    User getUserIncludingRemoved(long userId);
+
+    boolean isRootAdmin(Long accountId);
+
+    boolean isDomainAdmin(Long accountId);
+
+    boolean isNormalUser(long accountId);
+
+    User getActiveUserByRegistrationToken(String registrationToken);
+
+    void markUserRegistered(long userId);
+
+    public String[] createApiKeyAndSecretKey(RegisterCmd cmd);
+
+    public String[] createApiKeyAndSecretKey(final long userId);
+
+    UserAccount getUserByApiKey(String apiKey);
+
+    RoleType getRoleType(Account account);
+
+    void checkAccess(Account account, Domain domain) throws PermissionDeniedException;
+
+    void checkAccess(Account account, AccessType accessType, boolean sameOwner, ControlledEntity... entities) throws PermissionDeniedException;
+
+    void checkAccess(Account account, ServiceOffering so) throws PermissionDeniedException;
+
+    void checkAccess(Account account, DiskOffering dof) throws PermissionDeniedException;
+
+    void checkAccess(User user, ControlledEntity entity);
+
+    void checkAccess(Account account, AccessType accessType, boolean sameOwner, String apiName, ControlledEntity... entities) throws PermissionDeniedException;
+
+    Long finalyzeAccountId(String accountName, Long domainId, Long projectId, boolean enabledOnly);
+
+    /**
+     * returns the user account object for a given user id
+     * @param userId user id
+     * @return {@link UserAccount} object if it exists else null
+     */
+    UserAccount getUserAccountById(Long userId);
+
+    public Map<String, String> getKeys(GetUserKeysCmd cmd);
+}
diff --git a/api/src/com/cloud/user/DomainService.java b/api/src/main/java/com/cloud/user/DomainService.java
similarity index 100%
rename from api/src/com/cloud/user/DomainService.java
rename to api/src/main/java/com/cloud/user/DomainService.java
diff --git a/api/src/com/cloud/user/OwnedBy.java b/api/src/main/java/com/cloud/user/OwnedBy.java
similarity index 100%
rename from api/src/com/cloud/user/OwnedBy.java
rename to api/src/main/java/com/cloud/user/OwnedBy.java
diff --git a/api/src/com/cloud/user/ResourceLimitService.java b/api/src/main/java/com/cloud/user/ResourceLimitService.java
similarity index 100%
rename from api/src/com/cloud/user/ResourceLimitService.java
rename to api/src/main/java/com/cloud/user/ResourceLimitService.java
diff --git a/api/src/com/cloud/user/SSHKeyPair.java b/api/src/main/java/com/cloud/user/SSHKeyPair.java
similarity index 100%
rename from api/src/com/cloud/user/SSHKeyPair.java
rename to api/src/main/java/com/cloud/user/SSHKeyPair.java
diff --git a/api/src/com/cloud/user/User.java b/api/src/main/java/com/cloud/user/User.java
similarity index 100%
rename from api/src/com/cloud/user/User.java
rename to api/src/main/java/com/cloud/user/User.java
diff --git a/api/src/com/cloud/user/UserAccount.java b/api/src/main/java/com/cloud/user/UserAccount.java
similarity index 100%
rename from api/src/com/cloud/user/UserAccount.java
rename to api/src/main/java/com/cloud/user/UserAccount.java
diff --git a/api/src/com/cloud/uservm/UserVm.java b/api/src/main/java/com/cloud/uservm/UserVm.java
similarity index 100%
rename from api/src/com/cloud/uservm/UserVm.java
rename to api/src/main/java/com/cloud/uservm/UserVm.java
diff --git a/api/src/com/cloud/vm/BareMetalVmService.java b/api/src/main/java/com/cloud/vm/BareMetalVmService.java
similarity index 100%
rename from api/src/com/cloud/vm/BareMetalVmService.java
rename to api/src/main/java/com/cloud/vm/BareMetalVmService.java
diff --git a/api/src/com/cloud/vm/ConsoleProxy.java b/api/src/main/java/com/cloud/vm/ConsoleProxy.java
similarity index 100%
rename from api/src/com/cloud/vm/ConsoleProxy.java
rename to api/src/main/java/com/cloud/vm/ConsoleProxy.java
diff --git a/api/src/com/cloud/vm/DiskProfile.java b/api/src/main/java/com/cloud/vm/DiskProfile.java
similarity index 100%
rename from api/src/com/cloud/vm/DiskProfile.java
rename to api/src/main/java/com/cloud/vm/DiskProfile.java
diff --git a/api/src/com/cloud/vm/InstanceGroup.java b/api/src/main/java/com/cloud/vm/InstanceGroup.java
similarity index 100%
rename from api/src/com/cloud/vm/InstanceGroup.java
rename to api/src/main/java/com/cloud/vm/InstanceGroup.java
diff --git a/api/src/com/cloud/vm/Nic.java b/api/src/main/java/com/cloud/vm/Nic.java
similarity index 100%
rename from api/src/com/cloud/vm/Nic.java
rename to api/src/main/java/com/cloud/vm/Nic.java
diff --git a/api/src/com/cloud/vm/NicExtraDhcpOption.java b/api/src/main/java/com/cloud/vm/NicExtraDhcpOption.java
similarity index 100%
rename from api/src/com/cloud/vm/NicExtraDhcpOption.java
rename to api/src/main/java/com/cloud/vm/NicExtraDhcpOption.java
diff --git a/api/src/com/cloud/vm/NicIpAlias.java b/api/src/main/java/com/cloud/vm/NicIpAlias.java
similarity index 100%
rename from api/src/com/cloud/vm/NicIpAlias.java
rename to api/src/main/java/com/cloud/vm/NicIpAlias.java
diff --git a/api/src/com/cloud/vm/NicProfile.java b/api/src/main/java/com/cloud/vm/NicProfile.java
similarity index 100%
rename from api/src/com/cloud/vm/NicProfile.java
rename to api/src/main/java/com/cloud/vm/NicProfile.java
diff --git a/api/src/com/cloud/vm/NicSecondaryIp.java b/api/src/main/java/com/cloud/vm/NicSecondaryIp.java
similarity index 100%
rename from api/src/com/cloud/vm/NicSecondaryIp.java
rename to api/src/main/java/com/cloud/vm/NicSecondaryIp.java
diff --git a/api/src/com/cloud/vm/ReservationContext.java b/api/src/main/java/com/cloud/vm/ReservationContext.java
similarity index 100%
rename from api/src/com/cloud/vm/ReservationContext.java
rename to api/src/main/java/com/cloud/vm/ReservationContext.java
diff --git a/api/src/com/cloud/vm/RunningOn.java b/api/src/main/java/com/cloud/vm/RunningOn.java
similarity index 100%
rename from api/src/com/cloud/vm/RunningOn.java
rename to api/src/main/java/com/cloud/vm/RunningOn.java
diff --git a/api/src/com/cloud/vm/SecondaryStorageVm.java b/api/src/main/java/com/cloud/vm/SecondaryStorageVm.java
similarity index 100%
rename from api/src/com/cloud/vm/SecondaryStorageVm.java
rename to api/src/main/java/com/cloud/vm/SecondaryStorageVm.java
diff --git a/api/src/com/cloud/vm/SystemVm.java b/api/src/main/java/com/cloud/vm/SystemVm.java
similarity index 100%
rename from api/src/com/cloud/vm/SystemVm.java
rename to api/src/main/java/com/cloud/vm/SystemVm.java
diff --git a/api/src/com/cloud/vm/UserVmService.java b/api/src/main/java/com/cloud/vm/UserVmService.java
similarity index 100%
rename from api/src/com/cloud/vm/UserVmService.java
rename to api/src/main/java/com/cloud/vm/UserVmService.java
diff --git a/api/src/com/cloud/vm/VirtualMachine.java b/api/src/main/java/com/cloud/vm/VirtualMachine.java
similarity index 100%
rename from api/src/com/cloud/vm/VirtualMachine.java
rename to api/src/main/java/com/cloud/vm/VirtualMachine.java
diff --git a/api/src/com/cloud/vm/VirtualMachineName.java b/api/src/main/java/com/cloud/vm/VirtualMachineName.java
similarity index 100%
rename from api/src/com/cloud/vm/VirtualMachineName.java
rename to api/src/main/java/com/cloud/vm/VirtualMachineName.java
diff --git a/api/src/com/cloud/vm/VirtualMachineProfile.java b/api/src/main/java/com/cloud/vm/VirtualMachineProfile.java
similarity index 100%
rename from api/src/com/cloud/vm/VirtualMachineProfile.java
rename to api/src/main/java/com/cloud/vm/VirtualMachineProfile.java
diff --git a/api/src/com/cloud/vm/VmDetailConstants.java b/api/src/main/java/com/cloud/vm/VmDetailConstants.java
similarity index 100%
rename from api/src/com/cloud/vm/VmDetailConstants.java
rename to api/src/main/java/com/cloud/vm/VmDetailConstants.java
diff --git a/api/src/com/cloud/vm/VmDiskStats.java b/api/src/main/java/com/cloud/vm/VmDiskStats.java
similarity index 100%
rename from api/src/com/cloud/vm/VmDiskStats.java
rename to api/src/main/java/com/cloud/vm/VmDiskStats.java
diff --git a/api/src/com/cloud/vm/VmNetworkStats.java b/api/src/main/java/com/cloud/vm/VmNetworkStats.java
similarity index 100%
rename from api/src/com/cloud/vm/VmNetworkStats.java
rename to api/src/main/java/com/cloud/vm/VmNetworkStats.java
diff --git a/api/src/com/cloud/vm/VmStats.java b/api/src/main/java/com/cloud/vm/VmStats.java
similarity index 100%
rename from api/src/com/cloud/vm/VmStats.java
rename to api/src/main/java/com/cloud/vm/VmStats.java
diff --git a/api/src/com/cloud/vm/snapshot/VMSnapshot.java b/api/src/main/java/com/cloud/vm/snapshot/VMSnapshot.java
similarity index 100%
rename from api/src/com/cloud/vm/snapshot/VMSnapshot.java
rename to api/src/main/java/com/cloud/vm/snapshot/VMSnapshot.java
diff --git a/api/src/com/cloud/vm/snapshot/VMSnapshotService.java b/api/src/main/java/com/cloud/vm/snapshot/VMSnapshotService.java
similarity index 100%
rename from api/src/com/cloud/vm/snapshot/VMSnapshotService.java
rename to api/src/main/java/com/cloud/vm/snapshot/VMSnapshotService.java
diff --git a/api/src/org/apache/cloudstack/acl/APIChecker.java b/api/src/main/java/org/apache/cloudstack/acl/APIChecker.java
similarity index 100%
rename from api/src/org/apache/cloudstack/acl/APIChecker.java
rename to api/src/main/java/org/apache/cloudstack/acl/APIChecker.java
diff --git a/api/src/org/apache/cloudstack/acl/APILimitChecker.java b/api/src/main/java/org/apache/cloudstack/acl/APILimitChecker.java
similarity index 100%
rename from api/src/org/apache/cloudstack/acl/APILimitChecker.java
rename to api/src/main/java/org/apache/cloudstack/acl/APILimitChecker.java
diff --git a/api/src/org/apache/cloudstack/acl/ControlledEntity.java b/api/src/main/java/org/apache/cloudstack/acl/ControlledEntity.java
similarity index 100%
rename from api/src/org/apache/cloudstack/acl/ControlledEntity.java
rename to api/src/main/java/org/apache/cloudstack/acl/ControlledEntity.java
diff --git a/api/src/org/apache/cloudstack/acl/InfrastructureEntity.java b/api/src/main/java/org/apache/cloudstack/acl/InfrastructureEntity.java
similarity index 100%
rename from api/src/org/apache/cloudstack/acl/InfrastructureEntity.java
rename to api/src/main/java/org/apache/cloudstack/acl/InfrastructureEntity.java
diff --git a/api/src/org/apache/cloudstack/acl/PermissionScope.java b/api/src/main/java/org/apache/cloudstack/acl/PermissionScope.java
similarity index 100%
rename from api/src/org/apache/cloudstack/acl/PermissionScope.java
rename to api/src/main/java/org/apache/cloudstack/acl/PermissionScope.java
diff --git a/api/src/org/apache/cloudstack/acl/QuerySelector.java b/api/src/main/java/org/apache/cloudstack/acl/QuerySelector.java
similarity index 100%
rename from api/src/org/apache/cloudstack/acl/QuerySelector.java
rename to api/src/main/java/org/apache/cloudstack/acl/QuerySelector.java
diff --git a/api/src/org/apache/cloudstack/acl/Role.java b/api/src/main/java/org/apache/cloudstack/acl/Role.java
similarity index 100%
rename from api/src/org/apache/cloudstack/acl/Role.java
rename to api/src/main/java/org/apache/cloudstack/acl/Role.java
diff --git a/api/src/org/apache/cloudstack/acl/RolePermission.java b/api/src/main/java/org/apache/cloudstack/acl/RolePermission.java
similarity index 100%
rename from api/src/org/apache/cloudstack/acl/RolePermission.java
rename to api/src/main/java/org/apache/cloudstack/acl/RolePermission.java
diff --git a/api/src/org/apache/cloudstack/acl/RoleService.java b/api/src/main/java/org/apache/cloudstack/acl/RoleService.java
similarity index 100%
rename from api/src/org/apache/cloudstack/acl/RoleService.java
rename to api/src/main/java/org/apache/cloudstack/acl/RoleService.java
diff --git a/api/src/org/apache/cloudstack/acl/RoleType.java b/api/src/main/java/org/apache/cloudstack/acl/RoleType.java
similarity index 100%
rename from api/src/org/apache/cloudstack/acl/RoleType.java
rename to api/src/main/java/org/apache/cloudstack/acl/RoleType.java
diff --git a/api/src/org/apache/cloudstack/acl/Rule.java b/api/src/main/java/org/apache/cloudstack/acl/Rule.java
similarity index 100%
rename from api/src/org/apache/cloudstack/acl/Rule.java
rename to api/src/main/java/org/apache/cloudstack/acl/Rule.java
diff --git a/api/src/org/apache/cloudstack/acl/SecurityChecker.java b/api/src/main/java/org/apache/cloudstack/acl/SecurityChecker.java
similarity index 100%
rename from api/src/org/apache/cloudstack/acl/SecurityChecker.java
rename to api/src/main/java/org/apache/cloudstack/acl/SecurityChecker.java
diff --git a/api/src/org/apache/cloudstack/affinity/AffinityGroup.java b/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroup.java
similarity index 100%
rename from api/src/org/apache/cloudstack/affinity/AffinityGroup.java
rename to api/src/main/java/org/apache/cloudstack/affinity/AffinityGroup.java
diff --git a/api/src/org/apache/cloudstack/affinity/AffinityGroupProcessor.java b/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupProcessor.java
similarity index 100%
rename from api/src/org/apache/cloudstack/affinity/AffinityGroupProcessor.java
rename to api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupProcessor.java
diff --git a/api/src/org/apache/cloudstack/affinity/AffinityGroupResponse.java b/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/affinity/AffinityGroupResponse.java
rename to api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupResponse.java
diff --git a/api/src/org/apache/cloudstack/affinity/AffinityGroupService.java b/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupService.java
similarity index 100%
rename from api/src/org/apache/cloudstack/affinity/AffinityGroupService.java
rename to api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupService.java
diff --git a/api/src/org/apache/cloudstack/affinity/AffinityGroupTypeResponse.java b/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupTypeResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/affinity/AffinityGroupTypeResponse.java
rename to api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupTypeResponse.java
diff --git a/api/src/org/apache/cloudstack/affinity/AffinityProcessorBase.java b/api/src/main/java/org/apache/cloudstack/affinity/AffinityProcessorBase.java
similarity index 100%
rename from api/src/org/apache/cloudstack/affinity/AffinityProcessorBase.java
rename to api/src/main/java/org/apache/cloudstack/affinity/AffinityProcessorBase.java
diff --git a/api/src/org/apache/cloudstack/alert/AlertService.java b/api/src/main/java/org/apache/cloudstack/alert/AlertService.java
similarity index 100%
rename from api/src/org/apache/cloudstack/alert/AlertService.java
rename to api/src/main/java/org/apache/cloudstack/alert/AlertService.java
diff --git a/api/src/org/apache/cloudstack/annotation/Annotation.java b/api/src/main/java/org/apache/cloudstack/annotation/Annotation.java
similarity index 100%
rename from api/src/org/apache/cloudstack/annotation/Annotation.java
rename to api/src/main/java/org/apache/cloudstack/annotation/Annotation.java
diff --git a/api/src/org/apache/cloudstack/annotation/AnnotationService.java b/api/src/main/java/org/apache/cloudstack/annotation/AnnotationService.java
similarity index 100%
rename from api/src/org/apache/cloudstack/annotation/AnnotationService.java
rename to api/src/main/java/org/apache/cloudstack/annotation/AnnotationService.java
diff --git a/api/src/org/apache/cloudstack/api/ACL.java b/api/src/main/java/org/apache/cloudstack/api/ACL.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/ACL.java
rename to api/src/main/java/org/apache/cloudstack/api/ACL.java
diff --git a/api/src/org/apache/cloudstack/api/APICommand.java b/api/src/main/java/org/apache/cloudstack/api/APICommand.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/APICommand.java
rename to api/src/main/java/org/apache/cloudstack/api/APICommand.java
diff --git a/api/src/org/apache/cloudstack/api/AbstractGetUploadParamsCmd.java b/api/src/main/java/org/apache/cloudstack/api/AbstractGetUploadParamsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/AbstractGetUploadParamsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/AbstractGetUploadParamsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/ApiArgValidator.java b/api/src/main/java/org/apache/cloudstack/api/ApiArgValidator.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/ApiArgValidator.java
rename to api/src/main/java/org/apache/cloudstack/api/ApiArgValidator.java
diff --git a/api/src/org/apache/cloudstack/api/ApiCommandJobType.java b/api/src/main/java/org/apache/cloudstack/api/ApiCommandJobType.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/ApiCommandJobType.java
rename to api/src/main/java/org/apache/cloudstack/api/ApiCommandJobType.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/ApiConstants.java b/api/src/main/java/org/apache/cloudstack/api/ApiConstants.java
new file mode 100644
index 00000000000..504b2149837
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/ApiConstants.java
@@ -0,0 +1,733 @@
+// 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;
+
+public class ApiConstants {
+    public static final String ACCOUNT = "account";
+    public static final String ACCOUNTS = "accounts";
+    public static final String ACCOUNT_TYPE = "accounttype";
+    public static final String ACCOUNT_ID = "accountid";
+    public static final String ACTIVITY = "activity";
+    public static final String ADDRESS = "address";
+    public static final String ALGORITHM = "algorithm";
+    public static final String ALLOCATED_ONLY = "allocatedonly";
+    public static final String ANNOTATION = "annotation";
+    public static final String API_KEY = "apikey";
+    public static final String ASYNC_BACKUP = "asyncbackup";
+    public static final String USER_API_KEY = "userapikey";
+    public static final String APPLIED = "applied";
+    public static final String LIST_LB_VMIPS = "lbvmips";
+    public static final String AVAILABLE = "available";
+    public static final String BITS = "bits";
+    public static final String BOOTABLE = "bootable";
+    public static final String BIND_DN = "binddn";
+    public static final String BIND_PASSWORD = "bindpass";
+    public static final String BYTES_READ_RATE = "bytesreadrate";
+    public static final String BYTES_WRITE_RATE = "byteswriterate";
+    public static final String BYPASS_VLAN_OVERLAP_CHECK = "bypassvlanoverlapcheck";
+    public static final String CATEGORY = "category";
+    public static final String CAN_REVERT = "canrevert";
+    public static final String CA_CERTIFICATES = "cacertificates";
+    public static final String CERTIFICATE = "certificate";
+    public static final String CERTIFICATE_CHAIN = "certchain";
+    public static final String CERTIFICATE_FINGERPRINT = "fingerprint";
+    public static final String CERTIFICATE_ID = "certid";
+    public static final String CSR = "csr";
+    public static final String PRIVATE_KEY = "privatekey";
+    public static final String DOMAIN_SUFFIX = "domainsuffix";
+    public static final String DNS_SEARCH_ORDER = "dnssearchorder";
+    public static final String CHAIN_INFO = "chaininfo";
+    public static final String CIDR = "cidr";
+    public static final String IP6_CIDR = "ip6cidr";
+    public static final String CIDR_LIST = "cidrlist";
+    public static final String DEST_CIDR_LIST = "destcidrlist";
+    public static final String CLEANUP = "cleanup";
+    public static final String MAKEREDUNDANT = "makeredundant";
+    public static final String CLUSTER_ID = "clusterid";
+    public static final String CLUSTER_NAME = "clustername";
+    public static final String CLUSTER_TYPE = "clustertype";
+    public static final String CN = "cn";
+    public static final String COMMAND = "command";
+    public static final String CMD_EVENT_TYPE = "cmdeventtype";
+    public static final String COMPONENT = "component";
+    public static final String CPU_NUMBER = "cpunumber";
+    public static final String CPU_SPEED = "cpuspeed";
+    public static final String CREATED = "created";
+    public static final String CTX_ACCOUNT_ID = "ctxaccountid";
+    public static final String CTX_DETAILS = "ctxDetails";
+    public static final String CTX_USER_ID = "ctxuserid";
+    public static final String CTXSTARTEVENTID = "ctxstarteventid";
+    public static final String CTX_START_EVENT_ID = "ctxStartEventId";
+    public static final String CUSTOMIZED = "customized";
+    public static final String CUSTOMIZED_IOPS = "customizediops";
+    public static final String CUSTOM_ID = "customid";
+    public static final String CUSTOM_JOB_ID = "customjobid";
+    public static final String MIN_IOPS = "miniops";
+    public static final String MAX_IOPS = "maxiops";
+    public static final String HYPERVISOR_SNAPSHOT_RESERVE = "hypervisorsnapshotreserve";
+    public static final String DATADISK_OFFERING_LIST = "datadiskofferinglist";
+    public static final String DESCRIPTION = "description";
+    public static final String DESTINATION_ZONE_ID = "destzoneid";
+    public static final String DETAILS = "details";
+    public static final String DEVICE_ID = "deviceid";
+    public static final String DIRECT_DOWNLOAD = "directdownload";
+    public static final String DISK_OFFERING_ID = "diskofferingid";
+    public static final String NEW_DISK_OFFERING_ID = "newdiskofferingid";
+    public static final String DISK_SIZE = "disksize";
+    public static final String UTILIZATION = "utilization";
+    public static final String DRIVER = "driver";
+    public static final String ROOT_DISK_SIZE = "rootdisksize";
+    public static final String DHCP_OPTIONS_NETWORK_LIST = "dhcpoptionsnetworklist";
+    public static final String DHCP_OPTIONS = "dhcpoptions";
+    public static final String DHCP_PREFIX = "dhcp:";
+    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";
+    public static final String IP6_DNS2 = "ip6dns2";
+    public static final String DOMAIN = "domain";
+    public static final String DOMAIN_ID = "domainid";
+    public static final String DOMAIN__ID = "domainId";
+    public static final String DURATION = "duration";
+    public static final String ELIGIBLE = "eligible";
+    public static final String EMAIL = "email";
+    public static final String END_DATE = "enddate";
+    public static final String END_IP = "endip";
+    public static final String END_IPV6 = "endipv6";
+    public static final String END_PORT = "endport";
+    public static final String ENTRY_TIME = "entrytime";
+    public static final String EXPIRES = "expires";
+    public static final String EXTRA_DHCP_OPTION = "extradhcpoption";
+    public static final String EXTRA_DHCP_OPTION_NAME = "extradhcpoptionname";
+    public static final String EXTRA_DHCP_OPTION_CODE = "extradhcpoptioncode";
+    public static final String EXTRA_DHCP_OPTION_VALUE = "extradhcpvalue";
+    public static final String FENCE = "fence";
+    public static final String FETCH_LATEST = "fetchlatest";
+    public static final String FIRSTNAME = "firstname";
+    public static final String FORCED = "forced";
+    public static final String FORCED_DESTROY_LOCAL_STORAGE = "forcedestroylocalstorage";
+    public static final String FORMAT = "format";
+    public static final String FOR_VIRTUAL_NETWORK = "forvirtualnetwork";
+    public static final String FOR_SYSTEM_VMS = "forsystemvms";
+    public static final String GATEWAY = "gateway";
+    public static final String IP6_GATEWAY = "ip6gateway";
+    public static final String GROUP = "group";
+    public static final String GROUP_ID = "groupid";
+    public static final String GSLB_LB_METHOD = "gslblbmethod";
+    public static final String GSLB_SERVICE_DOMAIN_NAME = "gslbdomainname";
+    public static final String GSLB_SERVICE_TYPE = "gslbservicetype";
+    public static final String GSLB_STICKY_SESSION_METHOD = "gslbstickysessionmethodname";
+    public static final String GSLB_LBRULE_WEIGHT_MAP = "gslblbruleweightsmap";
+    public static final String GUEST_CIDR_ADDRESS = "guestcidraddress";
+    public static final String GUEST_VLAN_RANGE = "guestvlanrange";
+    public static final String HA_ENABLE = "haenable";
+    public static final String HA_PROVIDER = "haprovider";
+    public static final String HA_STATE = "hastate";
+    public static final String HEALTH = "health";
+    public static final String HOST_ID = "hostid";
+    public static final String HOST_NAME = "hostname";
+    public static final String HYPERVISOR = "hypervisor";
+    public static final String INLINE = "inline";
+    public static final String INSTANCE = "instance";
+    public static final String ICMP_CODE = "icmpcode";
+    public static final String ICMP_TYPE = "icmptype";
+    public static final String ID = "id";
+    public static final String IDS = "ids";
+    public static final String PREVIOUS_ACL_RULE_ID = "previousaclruleid";
+    public static final String NEXT_ACL_RULE_ID = "nextaclruleid";
+    public static final String INTERNAL_DNS1 = "internaldns1";
+    public static final String INTERNAL_DNS2 = "internaldns2";
+    public static final String INTERVAL_TYPE = "intervaltype";
+    public static final String LOCATION_TYPE = "locationtype";
+    public static final String IOPS_READ_RATE = "iopsreadrate";
+    public static final String IOPS_WRITE_RATE = "iopswriterate";
+    public static final String IP_ADDRESS = "ipaddress";
+    public static final String IP6_ADDRESS = "ip6address";
+    public static final String IP_ADDRESS_ID = "ipaddressid";
+    public static final String IS_ASYNC = "isasync";
+    public static final String IP_AVAILABLE = "ipavailable";
+    public static final String IP_LIMIT = "iplimit";
+    public static final String IP_TOTAL = "iptotal";
+    public static final String IS_CLEANUP_REQUIRED = "iscleanuprequired";
+    public static final String IS_EXTRACTABLE = "isextractable";
+    public static final String IS_FEATURED = "isfeatured";
+    public static final String IS_PORTABLE = "isportable";
+    public static final String IS_PUBLIC = "ispublic";
+    public static final String IS_PERSISTENT = "ispersistent";
+    public static final String EGRESS_DEFAULT_POLICY = "egressdefaultpolicy";
+    public static final String IS_READY = "isready";
+    public static final String IS_RECURSIVE = "isrecursive";
+    public static final String ISO_FILTER = "isofilter";
+    public static final String ISO_GUEST_OS_NONE = "None";
+    public static final String JOB_ID = "jobid";
+    public static final String JOB_STATUS = "jobstatus";
+    public static final String LASTNAME = "lastname";
+    public static final String LEVEL = "level";
+    public static final String LENGTH = "length";
+    public static final String LIMIT_CPU_USE = "limitcpuuse";
+    public static final String LOCK = "lock";
+    public static final String LUN = "lun";
+    public static final String LBID = "lbruleid";
+    public static final String MAX = "max";
+    public static final String MAC_ADDRESS = "macaddress";
+    public static final String MAX_SNAPS = "maxsnaps";
+    public static final String MEMORY = "memory";
+    public static final String MODE = "mode";
+    public static final String KEEPALIVE_ENABLED = "keepaliveenabled";
+    public static final String NAME = "name";
+    public static final String METHOD_NAME = "methodname";
+    public static final String NETWORK_DOMAIN = "networkdomain";
+    public static final String NETMASK = "netmask";
+    public static final String NEW_NAME = "newname";
+    public static final String NUM_RETRIES = "numretries";
+    public static final String OFFER_HA = "offerha";
+    public static final String IS_SYSTEM_OFFERING = "issystem";
+    public static final String IS_DEFAULT_USE = "defaultuse";
+    public static final String OP = "op";
+    public static final String OS_CATEGORY_ID = "oscategoryid";
+    public static final String OS_TYPE_ID = "ostypeid";
+    public static final String OS_DISPLAY_NAME = "osdisplayname";
+    public static final String OS_NAME_FOR_HYPERVISOR = "osnameforhypervisor";
+    public static final String OUTOFBANDMANAGEMENT_POWERSTATE = "outofbandmanagementpowerstate";
+    public static final String OUTOFBANDMANAGEMENT_ENABLED = "outofbandmanagementenabled";
+    public static final String PARAMS = "params";
+    public static final String PARENT_ID = "parentid";
+    public static final String PARENT_DOMAIN_ID = "parentdomainid";
+    public static final String PARENT_TEMPLATE_ID = "parenttemplateid";
+    public static final String PASSWORD = "password";
+    public static final String CURRENT_PASSWORD = "currentpassword";
+    public static final String SHOULD_UPDATE_PASSWORD = "update_passwd_on_host";
+    public static final String PASSWORD_ENABLED = "passwordenabled";
+    public static final String SSHKEY_ENABLED = "sshkeyenabled";
+    public static final String PATH = "path";
+    public static final String POD_ID = "podid";
+    public static final String POD_NAME = "podname";
+    public static final String POD_IDS = "podids";
+    public static final String POLICY_ID = "policyid";
+    public static final String PORT = "port";
+    public static final String PORTAL = "portal";
+    public static final String PORTABLE_IP_ADDRESS = "portableipaddress";
+    public static final String PORT_FORWARDING_SERVICE_ID = "portforwardingserviceid";
+    public static final String POST_URL = "postURL";
+    public static final String POWER_STATE = "powerstate";
+    public static final String PRIVATE_INTERFACE = "privateinterface";
+    public static final String PRIVATE_IP = "privateip";
+    public static final String PRIVATE_PORT = "privateport";
+    public static final String PRIVATE_START_PORT = "privateport";
+    public static final String PRIVATE_END_PORT = "privateendport";
+    public static final String PRIVATE_ZONE = "privatezone";
+    public static final String PROTOCOL = "protocol";
+    public static final String PROVISIONINGTYPE = "provisioningtype";
+    public static final String PUBLIC_INTERFACE = "publicinterface";
+    public static final String PUBLIC_IP_ID = "publicipid";
+    public static final String PUBLIC_IP = "publicip";
+    public static final String PUBLIC_PORT = "publicport";
+    public static final String PUBLIC_START_PORT = "publicport";
+    public static final String PUBLIC_END_PORT = "publicendport";
+    public static final String PUBLIC_ZONE = "publiczone";
+    public static final String RECEIVED_BYTES = "receivedbytes";
+    public static final String RECONNECT = "reconnect";
+    public static final String RECOVER = "recover";
+    public static final String REQUIRES_HVM = "requireshvm";
+    public static final String RESOURCE_TYPE = "resourcetype";
+    public static final String RESOURCE_TYPE_NAME = "resourcetypename";
+    public static final String RESPONSE = "response";
+    public static final String REVERTABLE = "revertable";
+    public static final String REGISTERED = "registered";
+    public static final String QUERY_FILTER = "queryfilter";
+    public static final String SCHEDULE = "schedule";
+    public static final String SCOPE = "scope";
+    public static final String SECRET_KEY = "usersecretkey";
+    public static final String SECONDARY_IP = "secondaryip";
+    public static final String SINCE = "since";
+    public static final String KEY = "key";
+    public static final String SEARCH_BASE = "searchbase";
+    public static final String SECURITY_GROUP_IDS = "securitygroupids";
+    public static final String SECURITY_GROUP_NAMES = "securitygroupnames";
+    public static final String SECURITY_GROUP_NAME = "securitygroupname";
+    public static final String SECURITY_GROUP_ID = "securitygroupid";
+    public static final String SENT = "sent";
+    public static final String SENT_BYTES = "sentbytes";
+    public static final String SERIAL = "serial";
+    public static final String SERVICE_OFFERING_ID = "serviceofferingid";
+    public static final String SESSIONKEY = "sessionkey";
+    public static final String SHOW_CAPACITIES = "showcapacities";
+    public static final String SHOW_REMOVED = "showremoved";
+    public static final String SIGNATURE = "signature";
+    public static final String SIGNATURE_VERSION = "signatureversion";
+    public static final String SIZE = "size";
+    public static final String SNAPSHOT = "snapshot";
+    public static final String SNAPSHOT_ID = "snapshotid";
+    public static final String SNAPSHOT_POLICY_ID = "snapshotpolicyid";
+    public static final String SNAPSHOT_TYPE = "snapshottype";
+    public static final String SNAPSHOT_QUIESCEVM = "quiescevm";
+    public static final String SOURCE_ZONE_ID = "sourcezoneid";
+    public static final String START_DATE = "startdate";
+    public static final String START_ID = "startid";
+    public static final String START_IP = "startip";
+    public static final String START_IPV6 = "startipv6";
+    public static final String START_PORT = "startport";
+    public static final String STATE = "state";
+    public static final String STATUS = "status";
+    public static final String STORAGE_TYPE = "storagetype";
+    public static final String STORAGE_POLICY = "storagepolicy";
+    public static final String STORAGE_MOTION_ENABLED = "storagemotionenabled";
+    public static final String STORAGE_CAPABILITIES = "storagecapabilities";
+    public static final String SYSTEM_VM_TYPE = "systemvmtype";
+    public static final String TAGS = "tags";
+    public static final String TARGET_IQN = "targetiqn";
+    public static final String TEMPLATE_FILTER = "templatefilter";
+    public static final String TEMPLATE_ID = "templateid";
+    public static final String ISO_ID = "isoid";
+    public static final String TIMEOUT = "timeout";
+    public static final String TIMEZONE = "timezone";
+    public static final String TIMEZONEOFFSET = "timezoneoffset";
+    public static final String TYPE = "type";
+    public static final String TRUST_STORE = "truststore";
+    public static final String TRUST_STORE_PASSWORD = "truststorepass";
+    public static final String URL = "url";
+    public static final String USAGE_INTERFACE = "usageinterface";
+    public static final String USER_DATA = "userdata";
+    public static final String USER_ID = "userid";
+    public static final String USE_SSL = "ssl";
+    public static final String USERNAME = "username";
+    public static final String USER_SECURITY_GROUP_LIST = "usersecuritygrouplist";
+    public static final String USE_VIRTUAL_NETWORK = "usevirtualnetwork";
+    public static final String Update_IN_SEQUENCE = "updateinsequence";
+    public static final String VALUE = "value";
+    public static final String VIRTUAL_MACHINE_ID = "virtualmachineid";
+    public static final String VIRTUAL_MACHINE_IDS = "virtualmachineids";
+    public static final String VIRTUAL_MACHINE_ID_IP = "vmidipmap";
+    public static final String VIRTUAL_MACHINE_COUNT = "virtualmachinecount";
+    public static final String USAGE_ID = "usageid";
+    public static final String USAGE_TYPE = "usagetype";
+    public static final String INCLUDE_TAGS = "includetags";
+
+    public static final String VLAN = "vlan";
+    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 ISOLATION_URI = "isolationuri";
+    public static final String VM_AVAILABLE = "vmavailable";
+    public static final String VM_LIMIT = "vmlimit";
+    public static final String VM_TOTAL = "vmtotal";
+    public static final String VNET = "vnet";
+    public static final String IS_VOLATILE = "isvolatile";
+    public static final String VOLUME_ID = "volumeid";
+    public static final String ZONE_ID = "zoneid";
+    public static final String ZONE_NAME = "zonename";
+    public static final String NETWORK_TYPE = "networktype";
+    public static final String PAGE = "page";
+    public static final String PAGE_SIZE = "pagesize";
+    public static final String COUNT = "count";
+    public static final String TRAFFIC_TYPE = "traffictype";
+    public static final String NETWORK_OFFERING_ID = "networkofferingid";
+    public static final String TIER_NETWORK_OFFERINGS = "tiernetworkofferings";
+    public static final String NETWORK_IDS = "networkids";
+    public static final String NETWORK_ID = "networkid";
+    public static final String NIC_ID = "nicid";
+    public static final String SPECIFY_VLAN = "specifyvlan";
+    public static final String IS_DEFAULT = "isdefault";
+    public static final String IS_SYSTEM = "issystem";
+    public static final String IS_USER_DEFINED = "isuserdefined";
+    public static final String AVAILABILITY = "availability";
+    public static final String NETWORKRATE = "networkrate";
+    public static final String HOST_TAGS = "hosttags";
+    public static final String SSH_KEYPAIR = "keypair";
+    public static final String HTTPMETHOD = "httpmethod";
+    public static final String HOST_CPU_CAPACITY = "hostcpucapacity";
+    public static final String HOST_CPU_NUM = "hostcpunum";
+    public static final String HOST_MEM_CAPACITY = "hostmemcapacity";
+    public static final String HOST_MAC = "hostmac";
+    public static final String HOST_TAG = "hosttag";
+    public static final String PXE_SERVER_TYPE = "pxeservertype";
+    public static final String LINMIN_USERNAME = "linminusername";
+    public static final String LINMIN_PASSWORD = "linminpassword";
+    public static final String LINMIN_APID = "linminapid";
+    public static final String DHCP_SERVER_TYPE = "dhcpservertype";
+    public static final String LINK_LOCAL_IP = "linklocalip";
+    public static final String LINK_LOCAL_MAC_ADDRESS = "linklocalmacaddress";
+    public static final String LINK_LOCAL_MAC_NETMASK = "linklocalnetmask";
+    public static final String LINK_LOCAL_NETWORK_ID = "linklocalnetworkid";
+    public static final String PRIVATE_MAC_ADDRESS = "privatemacaddress";
+    public static final String PRIVATE_NETMASK = "privatenetmask";
+    public static final String PRIVATE_NETWORK_ID = "privatenetworkid";
+    public static final String ALLOCATION_STATE = "allocationstate";
+    public static final String MANAGED_STATE = "managedstate";
+    public static final String STORAGE_ID = "storageid";
+    public static final String PING_STORAGE_SERVER_IP = "pingstorageserverip";
+    public static final String PING_DIR = "pingdir";
+    public static final String TFTP_DIR = "tftpdir";
+    public static final String PING_CIFS_USERNAME = "pingcifsusername";
+    public static final String PING_CIFS_PASSWORD = "pingcifspassword";
+    public static final String CHECKSUM = "checksum";
+    public static final String NETWORK_DEVICE_TYPE = "networkdevicetype";
+    public static final String NETWORK_DEVICE_PARAMETER_LIST = "networkdeviceparameterlist";
+    public static final String ZONE_TOKEN = "zonetoken";
+    public static final String DHCP_PROVIDER = "dhcpprovider";
+    public static final String RESULT = "success";
+    public static final String RESUME = "resume";
+    public static final String LUN_ID = "lunId";
+    public static final String IQN = "iqn";
+    public static final String AGGREGATE_NAME = "aggregatename";
+    public static final String POOL_NAME = "poolname";
+    public static final String VOLUME_NAME = "volumename";
+    public static final String SNAPSHOT_POLICY = "snapshotpolicy";
+    public static final String SNAPSHOT_RESERVATION = "snapshotreservation";
+    public static final String IP_NETWORK_LIST = "iptonetworklist";
+    public static final String PARAM_LIST = "param";
+    public static final String FOR_LOAD_BALANCING = "forloadbalancing";
+    public static final String KEYBOARD = "keyboard";
+    public static final String OPEN_FIREWALL = "openfirewall";
+    public static final String TEMPLATE_TAG = "templatetag";
+    public static final String HYPERVISOR_VERSION = "hypervisorversion";
+    public static final String MAX_GUESTS_LIMIT = "maxguestslimit";
+    public static final String MAX_DATA_VOLUMES_LIMIT = "maxdatavolumeslimit";
+    public static final String MAX_HOSTS_PER_CLUSTER = "maxhostspercluster";
+    public static final String PROJECT_ID = "projectid";
+    public static final String PROJECT_IDS = "projectids";
+    public static final String PROJECT = "project";
+    public static final String ROLE = "role";
+    public static final String ROLE_ID = "roleid";
+    public static final String ROLE_TYPE = "roletype";
+    public static final String ROLE_NAME = "rolename";
+    public static final String PERMISSION = "permission";
+    public static final String RULE = "rule";
+    public static final String RULE_ID = "ruleid";
+    public static final String RULE_ORDER = "ruleorder";
+    public static final String USER = "user";
+    public static final String ACTIVE_ONLY = "activeonly";
+    public static final String TOKEN = "token";
+    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";
+    public static final String PROVIDER = "provider";
+    public static final String MANAGED = "managed";
+    public static final String CAPACITY_BYTES = "capacitybytes";
+    public static final String CAPACITY_IOPS = "capacityiops";
+    public static final String NETWORK_SPEED = "networkspeed";
+    public static final String BROADCAST_DOMAIN_RANGE = "broadcastdomainrange";
+    public static final String BROADCAST_URI = "broadcasturi";
+    public static final String ISOLATION_METHOD = "isolationmethod";
+    public static final String ISOLATION_METHODS = "isolationmethods";
+    public static final String PHYSICAL_NETWORK_ID = "physicalnetworkid";
+    public static final String DEST_PHYSICAL_NETWORK_ID = "destinationphysicalnetworkid";
+    public static final String ENABLE = "enable";
+    public static final String ENABLED = "enabled";
+    public static final String SERVICE_NAME = "servicename";
+    public static final String DHCP_RANGE = "dhcprange";
+    public static final String UUID = "uuid";
+    public static final String SECURITY_GROUP_EANBLED = "securitygroupenabled";
+    public static final String LOCAL_STORAGE_ENABLED = "localstorageenabled";
+    public static final String GUEST_IP_TYPE = "guestiptype";
+    public static final String XENSERVER_NETWORK_LABEL = "xennetworklabel";
+    public static final String KVM_NETWORK_LABEL = "kvmnetworklabel";
+    public static final String VMWARE_NETWORK_LABEL = "vmwarenetworklabel";
+    public static final String HYPERV_NETWORK_LABEL = "hypervnetworklabel";
+    public static final String OVM3_NETWORK_LABEL = "ovm3networklabel";
+    public static final String NETWORK_SERVICE_PROVIDER_ID = "nspid";
+    public static final String SERVICE_LIST = "servicelist";
+    public static final String CAN_ENABLE_INDIVIDUAL_SERVICE = "canenableindividualservice";
+    public static final String SUPPORTED_SERVICES = "supportedservices";
+    public static final String NSP_ID = "nspid";
+    public static final String ACL_TYPE = "acltype";
+    public static final String ACL_REASON = "reason";
+    public static final String ACL_RULE_PARTIAL_UPGRADE = "partialupgrade";
+    public static final String SUBDOMAIN_ACCESS = "subdomainaccess";
+    public static final String LOAD_BALANCER_DEVICE_ID = "lbdeviceid";
+    public static final String LOAD_BALANCER_DEVICE_NAME = "lbdevicename";
+    public static final String LOAD_BALANCER_DEVICE_STATE = "lbdevicestate";
+    public static final String LOAD_BALANCER_DEVICE_CAPACITY = "lbdevicecapacity";
+    public static final String LOAD_BALANCER_DEVICE_DEDICATED = "lbdevicededicated";
+    public static final String LOAD_BALANCER_RULE = "loadbalancerrule";
+    public static final String LOAD_BALANCER_RULE_LIST = "loadbalancerrulelist";
+    public static final String FIREWALL_DEVICE_ID = "fwdeviceid";
+    public static final String FIREWALL_DEVICE_NAME = "fwdevicename";
+    public static final String FIREWALL_DEVICE_STATE = "fwdevicestate";
+    public static final String FIREWALL_DEVICE_CAPACITY = "fwdevicecapacity";
+    public static final String FIREWALL_DEVICE_DEDICATED = "fwdevicededicated";
+    public static final String SERVICE = "service";
+    public static final String ASSOCIATED_NETWORK_ID = "associatednetworkid";
+    public static final String ASSOCIATED_NETWORK_NAME = "associatednetworkname";
+    public static final String SOURCE_NAT_SUPPORTED = "sourcenatsupported";
+    public static final String RESOURCE_STATE = "resourcestate";
+    public static final String PROJECT_INVITE_REQUIRED = "projectinviterequired";
+    public static final String REQUIRED = "required";
+    public static final String RESTART_REQUIRED = "restartrequired";
+    public static final String ALLOW_USER_CREATE_PROJECTS = "allowusercreateprojects";
+    public static final String CONSERVE_MODE = "conservemode";
+    public static final String TRAFFIC_TYPE_IMPLEMENTOR = "traffictypeimplementor";
+    public static final String KEYWORD = "keyword";
+    public static final String LIST_ALL = "listall";
+    public static final String SPECIFY_IP_RANGES = "specifyipranges";
+    public static final String IS_SOURCE_NAT = "issourcenat";
+    public static final String IS_STATIC_NAT = "isstaticnat";
+    public static final String SORT_BY = "sortby";
+    public static final String CHANGE_CIDR = "changecidr";
+    public static final String PURPOSE = "purpose";
+    public static final String IS_TAGGED = "istagged";
+    public static final String INSTANCE_NAME = "instancename";
+    public static final String START_VM = "startvm";
+    public static final String HA_HOST = "hahost";
+    public static final String CUSTOM_DISK_OFF_MIN_SIZE = "customdiskofferingminsize";
+    public static final String CUSTOM_DISK_OFF_MAX_SIZE = "customdiskofferingmaxsize";
+    public static final String DEFAULT_ZONE_ID = "defaultzoneid";
+    public static final String LIVE_MIGRATE = "livemigrate";
+    public static final String MIGRATE_TO = "migrateto";
+    public static final String GUID = "guid";
+    public static final String VSWITCH_TYPE_GUEST_TRAFFIC = "guestvswitchtype";
+    public static final String VSWITCH_TYPE_PUBLIC_TRAFFIC = "publicvswitchtype";
+    public static final String VSWITCH_NAME_GUEST_TRAFFIC = "guestvswitchname";
+    public static final String VSWITCH_NAME_PUBLIC_TRAFFIC = "publicvswitchname";
+    // Ovs controller
+    public static final String OVS_DEVICE_ID = "ovsdeviceid";
+    public static final String OVS_DEVICE_NAME = "ovsdevicename";
+    // OpenDaylight controller
+    public static final String ODL_DEVICE_ID = "odldeviceid";
+    public static final String ODL_DEVICE_NAME = "odldevicename";
+    public static final String ODL_TRANSPORT_ZONE_UUID = "transportzoneuuid";
+    public static final String ODL_GATEWAYSERVICE_UUID = "l3gatewayserviceuuid";
+
+    public static final String EXTERNAL_SWITCH_MGMT_DEVICE_ID = "vsmdeviceid";
+    public static final String EXTERNAL_SWITCH_MGMT_DEVICE_NAME = "vsmdevicename";
+    public static final String EXTERNAL_SWITCH_MGMT_DEVICE_STATE = "vsmdevicestate";
+    // Would we need to have a capacity field for Cisco N1KV VSM? Max hosts managed by it perhaps? May remove this
+    // later.
+    public static final String EXTERNAL_SWITCH_MGMT_DEVICE_CAPACITY = "vsmdevicecapacity";
+    public static final String CISCO_NEXUS_VSM_NAME = "vsmname";
+    public static final String VSM_USERNAME = "vsmusername";
+    public static final String VSM_PASSWORD = "vsmpassword";
+    public static final String VSM_IPADDRESS = "vsmipaddress";
+    public static final String VSM_MGMT_VLAN_ID = "vsmmgmtvlanid";
+    public static final String VSM_PKT_VLAN_ID = "vsmpktvlanid";
+    public static final String VSM_CTRL_VLAN_ID = "vsmctrlvlanid";
+    public static final String VSM_STORAGE_VLAN_ID = "vsmstoragevlanid";
+    public static final String VSM_DOMAIN_ID = "vsmdomainid";
+    public static final String VSM_CONFIG_MODE = "vsmconfigmode";
+    public static final String VSM_CONFIG_STATE = "vsmconfigstate";
+    public static final String VSM_DEVICE_STATE = "vsmdevicestate";
+    public static final String VCENTER = "vcenter";
+    public static final String ADD_VSM_FLAG = "addvsmflag";
+    public static final String END_POINT = "endpoint";
+    public static final String REGION_ID = "regionid";
+    public static final String VPC_OFF_ID = "vpcofferingid";
+    public static final String NETWORK = "network";
+    public static final String VPC_ID = "vpcid";
+    public static final String GATEWAY_ID = "gatewayid";
+    public static final String CAN_USE_FOR_DEPLOY = "canusefordeploy";
+    public static final String RESOURCE_IDS = "resourceids";
+    public static final String RESOURCE_ID = "resourceid";
+    public static final String CUSTOMER = "customer";
+    public static final String S2S_VPN_GATEWAY_ID = "s2svpngatewayid";
+    public static final String S2S_CUSTOMER_GATEWAY_ID = "s2scustomergatewayid";
+    public static final String IPSEC_PSK = "ipsecpsk";
+    public static final String GUEST_IP = "guestip";
+    public static final String REMOVED = "removed";
+    public static final String IKE_POLICY = "ikepolicy";
+    public static final String ESP_POLICY = "esppolicy";
+    public static final String IKE_LIFETIME = "ikelifetime";
+    public static final String ESP_LIFETIME = "esplifetime";
+    public static final String DPD = "dpd";
+    public static final String FORCE_ENCAP = "forceencap";
+    public static final String FOR_VPC = "forvpc";
+    public static final String SHRINK_OK = "shrinkok";
+    public static final String NICIRA_NVP_DEVICE_ID = "nvpdeviceid";
+    public static final String NICIRA_NVP_TRANSPORT_ZONE_UUID = "transportzoneuuid";
+    public static final String NICIRA_NVP_DEVICE_NAME = "niciradevicename";
+    public static final String NICIRA_NVP_GATEWAYSERVICE_UUID = "l3gatewayserviceuuid";
+    public static final String NICIRA_NVP_L2_GATEWAYSERVICE_UUID = "l2gatewayserviceuuid";
+    public static final String NSX_LOGICAL_SWITCH = "nsxlogicalswitch";
+    public static final String NSX_LOGICAL_SWITCH_PORT = "nsxlogicalswitchport";
+    public static final String S3_ACCESS_KEY = "accesskey";
+    public static final String S3_SECRET_KEY = "secretkey";
+    public static final String S3_END_POINT = "endpoint";
+    public static final String S3_BUCKET_NAME = "bucket";
+    public static final String S3_SIGNER = "s3signer";
+    public static final String S3_V3_SIGNER = "S3SignerType";
+    public static final String S3_V4_SIGNER = "AWSS3V4SignerType";
+    public static final String S3_HTTPS_FLAG = "usehttps";
+    public static final String S3_CONNECTION_TIMEOUT = "connectiontimeout";
+    public static final String S3_CONNECTION_TTL = "connectionttl";
+    public static final String S3_MAX_ERROR_RETRY = "maxerrorretry";
+    public static final String S3_SOCKET_TIMEOUT = "sockettimeout";
+    public static final String S3_USE_TCP_KEEPALIVE = "usetcpkeepalive";
+    public static final String INCL_ZONES = "includezones";
+    public static final String EXCL_ZONES = "excludezones";
+    public static final String SOURCE = "source";
+    public static final String COUNTER_ID = "counterid";
+    public static final String AGGR_OPERATOR = "aggroperator";
+    public static final String AGGR_FUNCTION = "aggrfunction";
+    public static final String AGGR_VALUE = "aggrvalue";
+    public static final String THRESHOLD = "threshold";
+    public static final String RELATIONAL_OPERATOR = "relationaloperator";
+    public static final String OTHER_DEPLOY_PARAMS = "otherdeployparams";
+    public static final String MIN_MEMBERS = "minmembers";
+    public static final String MAX_MEMBERS = "maxmembers";
+    public static final String AUTOSCALE_VM_DESTROY_TIME = "destroyvmgraceperiod";
+    public static final String VMPROFILE_ID = "vmprofileid";
+    public static final String VMGROUP_ID = "vmgroupid";
+    public static final String CS_URL = "csurl";
+    public static final String IDP_ID = "idpid";
+    public static final String SCALEUP_POLICY_IDS = "scaleuppolicyids";
+    public static final String SCALEDOWN_POLICY_IDS = "scaledownpolicyids";
+    public static final String SCALEUP_POLICIES = "scaleuppolicies";
+    public static final String SCALEDOWN_POLICIES = "scaledownpolicies";
+    public static final String INTERVAL = "interval";
+    public static final String QUIETTIME = "quiettime";
+    public static final String ACTION = "action";
+    public static final String CONDITION_ID = "conditionid";
+    public static final String CONDITION_IDS = "conditionids";
+    public static final String COUNTERPARAM_LIST = "counterparam";
+    public static final String AUTOSCALE_USER_ID = "autoscaleuserid";
+    public static final String BAREMETAL_DISCOVER_NAME = "baremetaldiscovername";
+    public static final String BAREMETAL_RCT_URL = "baremetalrcturl";
+    public static final String UCS_DN = "ucsdn";
+    public static final String GSLB_PROVIDER = "gslbprovider";
+    public static final String EXCLUSIVE_GSLB_PROVIDER = "isexclusivegslbprovider";
+    public static final String GSLB_PROVIDER_PUBLIC_IP = "gslbproviderpublicip";
+    public static final String GSLB_PROVIDER_PRIVATE_IP = "gslbproviderprivateip";
+    public static final String VM_SNAPSHOT_DESCRIPTION = "description";
+    public static final String VM_SNAPSHOT_DISPLAYNAME = "name";
+    public static final String VM_SNAPSHOT_ID = "vmsnapshotid";
+    public static final String VM_SNAPSHOT_IDS = "vmsnapshotids";
+    public static final String VM_SNAPSHOT_DISK_IDS = "vmsnapshotdiskids";
+    public static final String VM_SNAPSHOT_MEMORY = "snapshotmemory";
+    public static final String VM_SNAPSHOT_QUIESCEVM = "quiescevm";
+    public static final String IMAGE_STORE_UUID = "imagestoreuuid";
+    public static final String GUEST_VM_CIDR = "guestvmcidr";
+    public static final String NETWORK_CIDR = "networkcidr";
+    public static final String RESERVED_IP_RANGE = "reservediprange";
+    public static final String UCS_MANAGER_ID = "ucsmanagerid";
+    public static final String UCS_PROFILE_DN = "profiledn";
+    public static final String UCS_BLADE_DN = "bladedn";
+    public static final String UCS_BLADE_ID = "bladeid";
+    public static final String VM_GUEST_IP = "vmguestip";
+    public static final String HEALTHCHECK_RESPONSE_TIMEOUT = "responsetimeout";
+    public static final String HEALTHCHECK_INTERVAL_TIME = "intervaltime";
+    public static final String HEALTHCHECK_HEALTHY_THRESHOLD = "healthythreshold";
+    public static final String HEALTHCHECK_UNHEALTHY_THRESHOLD = "unhealthythreshold";
+    public static final String HEALTHCHECK_PINGPATH = "pingpath";
+    public static final String SOURCE_PORT = "sourceport";
+    public static final String INSTANCE_PORT = "instanceport";
+    public static final String SOURCE_IP = "sourceipaddress";
+    public static final String SOURCE_IP_NETWORK_ID = "sourceipaddressnetworkid";
+    public static final String SCHEME = "scheme";
+    public static final String PROVIDER_TYPE = "providertype";
+    public static final String AFFINITY_GROUP_IDS = "affinitygroupids";
+    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 static final String IS_DYNAMICALLY_SCALABLE = "isdynamicallyscalable";
+    public static final String ROUTING = "isrouting";
+    public static final String MAX_CONNECTIONS = "maxconnections";
+    public static final String SERVICE_STATE = "servicestate";
+
+    public static final String IAM_ACCOUNT_IDS = "accountids";
+    public static final String IAM_MEMBER_ACCOUNTS = "memberaccounts";
+    public static final String IAM_PARENT_POLICY_ID = "parentpolicyid";
+    public static final String IAM_PARENT_POLICY_NAME = "parentpolicyname";
+    public static final String IAM_POLICY_IDS = "policyids";
+    public static final String IAM_POLICIES = "policies";
+    public static final String IAM_APIS = "apis";
+    public static final String IAM_GROUPS = "groups";
+    public static final String IAM_PERMISSIONS = "permission";
+    public static final String IAM_ACTION = "action";
+    public static final String IAM_SCOPE = "scope";
+    public static final String IAM_SCOPE_ID = "scopeid";
+    public static final String IAM_ALLOW_DENY = "permission";
+    public static final String ENTITY_TYPE = "entitytype";
+    public static final String ENTITY_ID = "entityid";
+    public static final String EXTERNAL_ID = "externalid";
+    public static final String ACCESS_TYPE = "accesstype";
+
+    public static final String RESOURCE_DETAILS = "resourcedetails";
+    public static final String EXPUNGE = "expunge";
+    public static final String FOR_DISPLAY = "fordisplay";
+    public static final String PASSIVE = "passive";
+    public static final String VERSION = "version";
+    public static final String START = "start";
+    public static final String GPUGROUP = "gpugroup";
+    public static final String GPUGROUPNAME = "gpugroupname";
+    public static final String VGPU = "vgpu";
+    public static final String VGPUTYPE = "vgputype";
+    public static final String VIDEORAM = "videoram";
+    public static final String MAXHEADS = "maxheads";
+    public static final String MAXRESOLUTIONX = "maxresolutionx";
+    public static final String MAXRESOLUTIONY = "maxresolutiony";
+    public static final String MAXVGPUPERPGPU = "maxvgpuperpgpu";
+    public static final String REMAININGCAPACITY = "remainingcapacity";
+    public static final String MAXCAPACITY = "maxcapacity";
+    public static final String DISTRIBUTED_VPC_ROUTER = "distributedvpcrouter";
+    public static final String REDUNDANT_ROUTER = "redundantrouter";
+    public static final String REDUNDANT_VPC_ROUTER = "redundantvpcrouter";
+    public static final String READ_ONLY = "readonly";
+    public static final String SUPPORTS_REGION_LEVEL_VPC = "supportsregionLevelvpc";
+    public static final String SUPPORTS_STRECHED_L2_SUBNET = "supportsstrechedl2subnet";
+    public static final String SUPPORTS_PUBLIC_ACCESS = "supportspublicaccess";
+    public static final String REGION_LEVEL_VPC = "regionlevelvpc";
+    public static final String STRECHED_L2_SUBNET = "strechedl2subnet";
+    public static final String NETWORK_NAME = "networkname";
+    public static final String NETWORK_SPANNED_ZONES = "zonesnetworkspans";
+    public static final String METADATA = "metadata";
+    public static final String PHYSICAL_SIZE = "physicalsize";
+    public static final String OVM3_POOL = "ovm3pool";
+    public static final String OVM3_CLUSTER = "ovm3cluster";
+    public static final String OVM3_VIP = "ovm3vip";
+    public static final String CLEAN_UP_DETAILS = "cleanupdetails";
+    public static final String VIRTUAL_SIZE = "virtualsize";
+    public static final String NETSCALER_CONTROLCENTER_ID = "netscalercontrolcenterid";
+    public static final String NETSCALER_SERVICEPACKAGE_ID = "netscalerservicepackageid";
+
+    public static final String ZONE_ID_LIST = "zoneids";
+    public static final String DESTINATION_ZONE_ID_LIST = "destzoneids";
+    public static final String ADMIN = "admin";
+    public static final String CHECKSUM_PARAMETER_PREFIX_DESCRIPTION = "The parameter containing the checksum will be considered a MD5sum if it is not prefixed\n"
+            + " and just a plain ascii/utf8 representation of a hexadecimal string. If it is required to\n"
+            + " use another algorithm the hexadecimal string is to be prefixed with a string of the form,\n"
+            + " \"{<algorithm>}\", not including the double quotes. In this <algorithm> is the exact string\n"
+            + " representing the java supported algorithm, i.e. MD5 or SHA-256. Note that java does not\n" + " contain an algorithm called SHA256 or one called sha-256, only SHA-256.";
+
+    public static final String HAS_ANNOTATION = "hasannotation";
+    public static final String LAST_ANNOTATED = "lastannotated";
+    public static final String LDAP_DOMAIN = "ldapdomain";
+
+    public enum HostDetails {
+        all, capacity, events, stats, min;
+    }
+
+    public enum VMDetails {
+        all, group, nics, stats, secgrp, tmpl, servoff, diskoff, iso, volume, min, affgrp;
+    }
+
+    public enum DomainDetails {
+        all, resource, min;
+    }
+}
\ No newline at end of file
diff --git a/api/src/org/apache/cloudstack/api/ApiErrorCode.java b/api/src/main/java/org/apache/cloudstack/api/ApiErrorCode.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/ApiErrorCode.java
rename to api/src/main/java/org/apache/cloudstack/api/ApiErrorCode.java
diff --git a/api/src/org/apache/cloudstack/api/ApiServerService.java b/api/src/main/java/org/apache/cloudstack/api/ApiServerService.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/ApiServerService.java
rename to api/src/main/java/org/apache/cloudstack/api/ApiServerService.java
diff --git a/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/BaseAsyncCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/BaseAsyncCmd.java
diff --git a/api/src/org/apache/cloudstack/api/BaseAsyncCreateCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCreateCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/BaseAsyncCreateCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/BaseAsyncCreateCmd.java
diff --git a/api/src/org/apache/cloudstack/api/BaseAsyncCreateCustomIdCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCreateCustomIdCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/BaseAsyncCreateCustomIdCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/BaseAsyncCreateCustomIdCmd.java
diff --git a/api/src/org/apache/cloudstack/api/BaseAsyncCustomIdCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCustomIdCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/BaseAsyncCustomIdCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/BaseAsyncCustomIdCmd.java
diff --git a/api/src/org/apache/cloudstack/api/BaseCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/BaseCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/BaseCmd.java
diff --git a/api/src/org/apache/cloudstack/api/BaseCustomIdCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseCustomIdCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/BaseCustomIdCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/BaseCustomIdCmd.java
diff --git a/api/src/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/BaseListCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseListCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/BaseListCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/BaseListCmd.java
diff --git a/api/src/org/apache/cloudstack/api/BaseListDomainResourcesCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseListDomainResourcesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/BaseListDomainResourcesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/BaseListDomainResourcesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/BaseListProjectAndAccountResourcesCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseListProjectAndAccountResourcesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/BaseListProjectAndAccountResourcesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/BaseListProjectAndAccountResourcesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/BaseListTaggedResourcesCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseListTaggedResourcesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/BaseListTaggedResourcesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/BaseListTaggedResourcesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/BaseResponse.java b/api/src/main/java/org/apache/cloudstack/api/BaseResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/BaseResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/BaseResponse.java
diff --git a/api/src/org/apache/cloudstack/api/BaseResponseWithTagInformation.java b/api/src/main/java/org/apache/cloudstack/api/BaseResponseWithTagInformation.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/BaseResponseWithTagInformation.java
rename to api/src/main/java/org/apache/cloudstack/api/BaseResponseWithTagInformation.java
diff --git a/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
diff --git a/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/Displayable.java b/api/src/main/java/org/apache/cloudstack/api/Displayable.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/Displayable.java
rename to api/src/main/java/org/apache/cloudstack/api/Displayable.java
diff --git a/api/src/org/apache/cloudstack/api/EntityReference.java b/api/src/main/java/org/apache/cloudstack/api/EntityReference.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/EntityReference.java
rename to api/src/main/java/org/apache/cloudstack/api/EntityReference.java
diff --git a/api/src/org/apache/cloudstack/api/IBaseListAccountResourcesCmd.java b/api/src/main/java/org/apache/cloudstack/api/IBaseListAccountResourcesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/IBaseListAccountResourcesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/IBaseListAccountResourcesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/IBaseListCmd.java b/api/src/main/java/org/apache/cloudstack/api/IBaseListCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/IBaseListCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/IBaseListCmd.java
diff --git a/api/src/org/apache/cloudstack/api/IBaseListDomainResourcesCmd.java b/api/src/main/java/org/apache/cloudstack/api/IBaseListDomainResourcesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/IBaseListDomainResourcesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/IBaseListDomainResourcesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/IBaseListProjectAndAccountResourcesCmd.java b/api/src/main/java/org/apache/cloudstack/api/IBaseListProjectAndAccountResourcesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/IBaseListProjectAndAccountResourcesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/IBaseListProjectAndAccountResourcesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/IBaseListTaggedResourcesCmd.java b/api/src/main/java/org/apache/cloudstack/api/IBaseListTaggedResourcesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/IBaseListTaggedResourcesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/IBaseListTaggedResourcesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/Identity.java b/api/src/main/java/org/apache/cloudstack/api/Identity.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/Identity.java
rename to api/src/main/java/org/apache/cloudstack/api/Identity.java
diff --git a/api/src/org/apache/cloudstack/api/InternalIdentity.java b/api/src/main/java/org/apache/cloudstack/api/InternalIdentity.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/InternalIdentity.java
rename to api/src/main/java/org/apache/cloudstack/api/InternalIdentity.java
diff --git a/api/src/org/apache/cloudstack/api/LdapValidator.java b/api/src/main/java/org/apache/cloudstack/api/LdapValidator.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/LdapValidator.java
rename to api/src/main/java/org/apache/cloudstack/api/LdapValidator.java
diff --git a/api/src/org/apache/cloudstack/api/Parameter.java b/api/src/main/java/org/apache/cloudstack/api/Parameter.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/Parameter.java
rename to api/src/main/java/org/apache/cloudstack/api/Parameter.java
diff --git a/api/src/org/apache/cloudstack/api/ResourceDetail.java b/api/src/main/java/org/apache/cloudstack/api/ResourceDetail.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/ResourceDetail.java
rename to api/src/main/java/org/apache/cloudstack/api/ResourceDetail.java
diff --git a/api/src/org/apache/cloudstack/api/ResponseGenerator.java b/api/src/main/java/org/apache/cloudstack/api/ResponseGenerator.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/ResponseGenerator.java
rename to api/src/main/java/org/apache/cloudstack/api/ResponseGenerator.java
diff --git a/api/src/org/apache/cloudstack/api/ResponseObject.java b/api/src/main/java/org/apache/cloudstack/api/ResponseObject.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/ResponseObject.java
rename to api/src/main/java/org/apache/cloudstack/api/ResponseObject.java
diff --git a/api/src/org/apache/cloudstack/api/ServerApiException.java b/api/src/main/java/org/apache/cloudstack/api/ServerApiException.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/ServerApiException.java
rename to api/src/main/java/org/apache/cloudstack/api/ServerApiException.java
diff --git a/api/src/org/apache/cloudstack/api/Validate.java b/api/src/main/java/org/apache/cloudstack/api/Validate.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/Validate.java
rename to api/src/main/java/org/apache/cloudstack/api/Validate.java
diff --git a/api/src/org/apache/cloudstack/api/auth/APIAuthenticationManager.java b/api/src/main/java/org/apache/cloudstack/api/auth/APIAuthenticationManager.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/auth/APIAuthenticationManager.java
rename to api/src/main/java/org/apache/cloudstack/api/auth/APIAuthenticationManager.java
diff --git a/api/src/org/apache/cloudstack/api/auth/APIAuthenticationType.java b/api/src/main/java/org/apache/cloudstack/api/auth/APIAuthenticationType.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/auth/APIAuthenticationType.java
rename to api/src/main/java/org/apache/cloudstack/api/auth/APIAuthenticationType.java
diff --git a/api/src/org/apache/cloudstack/api/auth/APIAuthenticator.java b/api/src/main/java/org/apache/cloudstack/api/auth/APIAuthenticator.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/auth/APIAuthenticator.java
rename to api/src/main/java/org/apache/cloudstack/api/auth/APIAuthenticator.java
diff --git a/api/src/org/apache/cloudstack/api/auth/PluggableAPIAuthenticator.java b/api/src/main/java/org/apache/cloudstack/api/auth/PluggableAPIAuthenticator.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/auth/PluggableAPIAuthenticator.java
rename to api/src/main/java/org/apache/cloudstack/api/auth/PluggableAPIAuthenticator.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/ListAccountsCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/ListAccountsCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/account/ListAccountsCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/account/ListAccountsCmdByAdmin.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/acl/CreateRoleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/CreateRoleCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/acl/CreateRoleCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/acl/CreateRoleCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/acl/CreateRolePermissionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/CreateRolePermissionCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/acl/CreateRolePermissionCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/acl/CreateRolePermissionCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/acl/DeleteRoleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DeleteRoleCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/acl/DeleteRoleCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DeleteRoleCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/acl/DeleteRolePermissionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DeleteRolePermissionCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/acl/DeleteRolePermissionCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DeleteRolePermissionCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/acl/ListRolePermissionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/ListRolePermissionsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/acl/ListRolePermissionsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/acl/ListRolePermissionsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/acl/ListRolesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/ListRolesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/acl/ListRolesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/acl/ListRolesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/acl/RoleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/RoleCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/acl/RoleCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/acl/RoleCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/acl/UpdateRoleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/UpdateRoleCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/acl/UpdateRoleCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/acl/UpdateRoleCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/acl/UpdateRolePermissionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/UpdateRolePermissionCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/acl/UpdateRolePermissionCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/acl/UpdateRolePermissionCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/address/AcquirePodIpCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/address/AcquirePodIpCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/address/AcquirePodIpCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/address/AcquirePodIpCmdByAdmin.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/address/AssociateIPAddrCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/address/AssociateIPAddrCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/address/AssociateIPAddrCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/address/AssociateIPAddrCmdByAdmin.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/address/ListPublicIpAddressesCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/address/ListPublicIpAddressesCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/address/ListPublicIpAddressesCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/address/ListPublicIpAddressesCmdByAdmin.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/address/ReleasePodIpCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/address/ReleasePodIpCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/address/ReleasePodIpCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/address/ReleasePodIpCmdByAdmin.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/affinitygroup/UpdateVMAffinityGroupCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/affinitygroup/UpdateVMAffinityGroupCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/affinitygroup/UpdateVMAffinityGroupCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/affinitygroup/UpdateVMAffinityGroupCmdByAdmin.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/alert/GenerateAlertCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/alert/GenerateAlertCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/alert/GenerateAlertCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/alert/GenerateAlertCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/annotation/AddAnnotationCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/AddAnnotationCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/annotation/AddAnnotationCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/AddAnnotationCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/annotation/ListAnnotationsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/ListAnnotationsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/annotation/ListAnnotationsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/ListAnnotationsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/annotation/RemoveAnnotationCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/RemoveAnnotationCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/annotation/RemoveAnnotationCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/RemoveAnnotationCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/ca/IssueCertificateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/ca/IssueCertificateCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/ca/IssueCertificateCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/ca/IssueCertificateCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/ca/ListCAProvidersCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/ca/ListCAProvidersCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/ca/ListCAProvidersCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/ca/ListCAProvidersCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/ca/ListCaCertificateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/ca/ListCaCertificateCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/ca/ListCaCertificateCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/ca/ListCaCertificateCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/ca/ProvisionCertificateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/ca/ProvisionCertificateCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/ca/ProvisionCertificateCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/ca/ProvisionCertificateCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/ca/RevokeCertificateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/ca/RevokeCertificateCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/ca/RevokeCertificateCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/ca/RevokeCertificateCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/ListDeploymentPlannersCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/config/ListDeploymentPlannersCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/config/ListDeploymentPlannersCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/config/ListDeploymentPlannersCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/direct/download/UploadTemplateDirectDownloadCertificate.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/direct/download/UploadTemplateDirectDownloadCertificate.java
new file mode 100644
index 00000000000..60d4262546c
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/direct/download/UploadTemplateDirectDownloadCertificate.java
@@ -0,0 +1,90 @@
+// 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.direct.download;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.exception.NetworkRuleConflictException;
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.context.CallContext;
+import org.apache.cloudstack.direct.download.DirectDownloadManager;
+import org.apache.log4j.Logger;
+
+import javax.inject.Inject;
+
+@APICommand(name = UploadTemplateDirectDownloadCertificate.APINAME,
+        description = "Upload a certificate for HTTPS direct template download on KVM hosts",
+        responseObject = SuccessResponse.class,
+        requestHasSensitiveInfo = true,
+        responseHasSensitiveInfo = true,
+        since = "4.11.0",
+        authorized = {RoleType.Admin})
+public class UploadTemplateDirectDownloadCertificate extends BaseCmd {
+
+    @Inject
+    DirectDownloadManager directDownloadManager;
+
+    private static final Logger LOG = Logger.getLogger(UploadTemplateDirectDownloadCertificate.class);
+    public static final String APINAME = "uploadTemplateDirectDownloadCertificate";
+
+    @Parameter(name = ApiConstants.CERTIFICATE, type = BaseCmd.CommandType.STRING, required = true, length = 65535,
+            description = "SSL certificate")
+    private String certificate;
+
+    @Parameter(name = ApiConstants.NAME , type = BaseCmd.CommandType.STRING, required = true,
+            description = "Name for the uploaded certificate")
+    private String name;
+
+    @Parameter(name = ApiConstants.HYPERVISOR, type = BaseCmd.CommandType.STRING, required = true, description = "Hypervisor type")
+    private String hypervisor;
+
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
+        if (!hypervisor.equalsIgnoreCase("kvm")) {
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Currently supporting KVM hosts only");
+        }
+
+        SuccessResponse response = new SuccessResponse(getCommandName());
+        try {
+            LOG.debug("Uploading certificate " + name + " to agents for Direct Download");
+            boolean result = directDownloadManager.uploadCertificateToHosts(certificate, name, hypervisor);
+            response.setSuccess(result);
+            setResponseObject(response);
+        } catch (Exception e) {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
+        }
+    }
+
+    @Override
+    public String getCommandName() {
+        return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return CallContext.current().getCallingAccount().getId();
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmdByAdmin.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/guest/AddGuestOsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/guest/AddGuestOsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/guest/AddGuestOsMappingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsMappingCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/guest/AddGuestOsMappingCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsMappingCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/guest/ListGuestOsMappingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/ListGuestOsMappingCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/guest/ListGuestOsMappingCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/guest/ListGuestOsMappingCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/guest/RemoveGuestOsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/RemoveGuestOsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/guest/RemoveGuestOsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/guest/RemoveGuestOsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/guest/RemoveGuestOsMappingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/RemoveGuestOsMappingCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/guest/RemoveGuestOsMappingCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/guest/RemoveGuestOsMappingCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsMappingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsMappingCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsMappingCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsMappingCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/ha/ConfigureHAForHostCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/ConfigureHAForHostCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/ha/ConfigureHAForHostCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/ha/ConfigureHAForHostCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/ha/DisableHAForClusterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/DisableHAForClusterCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/ha/DisableHAForClusterCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/ha/DisableHAForClusterCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/ha/DisableHAForHostCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/DisableHAForHostCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/ha/DisableHAForHostCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/ha/DisableHAForHostCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/ha/DisableHAForZoneCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/DisableHAForZoneCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/ha/DisableHAForZoneCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/ha/DisableHAForZoneCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/ha/EnableHAForClusterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/EnableHAForClusterCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/ha/EnableHAForClusterCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/ha/EnableHAForClusterCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/ha/EnableHAForHostCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/EnableHAForHostCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/ha/EnableHAForHostCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/ha/EnableHAForHostCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/ha/EnableHAForZoneCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/EnableHAForZoneCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/ha/EnableHAForZoneCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/ha/EnableHAForZoneCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/ha/ListHostHAProvidersCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/ListHostHAProvidersCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/ha/ListHostHAProvidersCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/ha/ListHostHAProvidersCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/ha/ListHostHAResourcesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/ListHostHAResourcesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/ha/ListHostHAResourcesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/ha/ListHostHAResourcesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/ListHostTagsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/ListHostTagsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/host/ListHostTagsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/host/ListHostTagsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/PrepareForMaintenanceCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/PrepareForMaintenanceCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/host/PrepareForMaintenanceCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/host/PrepareForMaintenanceCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java
new file mode 100644
index 00000000000..34e439f3a37
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java
@@ -0,0 +1,116 @@
+// 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.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.context.CallContext;
+import org.apache.log4j.Logger;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.AgentUnavailableException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.host.Host;
+import com.cloud.user.Account;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@APICommand(name = "reconnectHost", description = "Reconnects a host.", responseObject = HostResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class ReconnectHostCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(ReconnectHostCmd.class.getName());
+
+    private static final String s_name = "reconnecthostresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// 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;
+    }
+
+    public static String getResultObjectName() {
+        return "host";
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Account account = CallContext.current().getCallingAccount();
+        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 String getEventType() {
+        return EventTypes.EVENT_HOST_RECONNECT;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "reconnecting host: " + getId();
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.Host;
+    }
+
+    @Override
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    @Override
+    public void execute() {
+        try {
+            Host result = _resourceService.reconnectHost(this);
+            HostResponse response = _responseGenerator.createHostResponse(result);
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
+        } catch (InvalidParameterValueException e) {
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.getMessage());
+        } catch (CloudRuntimeException e) {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
+        } catch (AgentUnavailableException e) {
+            throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, e.getMessage());
+        }
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/ReleaseHostReservationCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/ReleaseHostReservationCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/host/ReleaseHostReservationCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/host/ReleaseHostReservationCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostPasswordCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/UpdateHostPasswordCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostPasswordCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/host/UpdateHostPasswordCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/internallb/ConfigureInternalLoadBalancerElementCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/ConfigureInternalLoadBalancerElementCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/internallb/ConfigureInternalLoadBalancerElementCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/ConfigureInternalLoadBalancerElementCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/internallb/CreateInternalLoadBalancerElementCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/CreateInternalLoadBalancerElementCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/internallb/CreateInternalLoadBalancerElementCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/CreateInternalLoadBalancerElementCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLBVMsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/ListInternalLBVMsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLBVMsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/ListInternalLBVMsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLoadBalancerElementsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/ListInternalLoadBalancerElementsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLoadBalancerElementsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/ListInternalLoadBalancerElementsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/internallb/StopInternalLBVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/StopInternalLBVMCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/internallb/StopInternalLBVMCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/StopInternalLBVMCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/iso/AttachIsoCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/AttachIsoCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/iso/AttachIsoCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/iso/AttachIsoCmdByAdmin.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/iso/CopyIsoCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/CopyIsoCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/iso/CopyIsoCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/iso/CopyIsoCmdByAdmin.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/iso/DetachIsoCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/DetachIsoCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/iso/DetachIsoCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/iso/DetachIsoCmdByAdmin.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/iso/ListIsoPermissionsCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/ListIsoPermissionsCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/iso/ListIsoPermissionsCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/iso/ListIsoPermissionsCmdByAdmin.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/iso/ListIsosCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/ListIsosCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/iso/ListIsosCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/iso/ListIsosCmdByAdmin.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/iso/RegisterIsoCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/RegisterIsoCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/iso/RegisterIsoCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/iso/RegisterIsoCmdByAdmin.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/iso/UpdateIsoCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/UpdateIsoCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/iso/UpdateIsoCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/iso/UpdateIsoCmdByAdmin.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/loadbalancer/ListLoadBalancerRuleInstancesCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/loadbalancer/ListLoadBalancerRuleInstancesCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/loadbalancer/ListLoadBalancerRuleInstancesCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/loadbalancer/ListLoadBalancerRuleInstancesCmdByAdmin.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkDeviceCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/AddNetworkDeviceCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkDeviceCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/AddNetworkDeviceCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/CreateManagementNetworkIpRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateManagementNetworkIpRangeCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/CreateManagementNetworkIpRangeCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateManagementNetworkIpRangeCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateNetworkCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateNetworkCmdByAdmin.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/CreateStorageNetworkIpRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateStorageNetworkIpRangeCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/CreateStorageNetworkIpRangeCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateStorageNetworkIpRangeCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DedicateGuestVlanRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DedicateGuestVlanRangeCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/DedicateGuestVlanRangeCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/DedicateGuestVlanRangeCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteManagementNetworkIpRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteManagementNetworkIpRangeCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/DeleteManagementNetworkIpRangeCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteManagementNetworkIpRangeCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkDeviceCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteNetworkDeviceCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkDeviceCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteNetworkDeviceCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteNetworkOfferingCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkOfferingCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteNetworkOfferingCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkServiceProviderCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteNetworkServiceProviderCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkServiceProviderCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteNetworkServiceProviderCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DeletePhysicalNetworkCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeletePhysicalNetworkCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/DeletePhysicalNetworkCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeletePhysicalNetworkCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteStorageNetworkIpRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteStorageNetworkIpRangeCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/DeleteStorageNetworkIpRangeCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteStorageNetworkIpRangeCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListDedicatedGuestVlanRangesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListDedicatedGuestVlanRangesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/ListDedicatedGuestVlanRangesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListDedicatedGuestVlanRangesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkDeviceCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListNetworkDeviceCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkDeviceCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListNetworkDeviceCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkIsolationMethodsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListNetworkIsolationMethodsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkIsolationMethodsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListNetworkIsolationMethodsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkServiceProvidersCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListNetworkServiceProvidersCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkServiceProvidersCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListNetworkServiceProvidersCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworksCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListNetworksCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/ListNetworksCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListNetworksCmdByAdmin.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListSupportedNetworkServicesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListSupportedNetworkServicesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/ListSupportedNetworkServicesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListSupportedNetworkServicesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/MigrateNetworkCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/MigrateNetworkCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/MigrateNetworkCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/MigrateNetworkCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/MigrateVPCCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/MigrateVPCCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/MigrateVPCCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/MigrateVPCCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedGuestVlanRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedGuestVlanRangeCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedGuestVlanRangeCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedGuestVlanRangeCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateNetworkCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateNetworkCmdByAdmin.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdatePhysicalNetworkCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdatePhysicalNetworkCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/UpdatePhysicalNetworkCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdatePhysicalNetworkCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java
new file mode 100644
index 00000000000..eaa8d875036
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java
@@ -0,0 +1,288 @@
+// 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.offering;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import com.cloud.storage.Storage;
+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.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.ServiceOfferingResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.offering.ServiceOffering;
+import com.cloud.user.Account;
+
+@APICommand(name = "createServiceOffering", description = "Creates a service offering.", responseObject = ServiceOfferingResponse.class,
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class CreateServiceOfferingCmd extends BaseCmd {
+    public static final Logger s_logger = Logger.getLogger(CreateServiceOfferingCmd.class.getName());
+    private static final String s_name = "createserviceofferingresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.CPU_NUMBER, type = CommandType.INTEGER, required = false, description = "the CPU number of the service offering")
+    private Integer cpuNumber;
+
+    @Parameter(name = ApiConstants.CPU_SPEED, type = CommandType.INTEGER, required = false, description = "the CPU speed of the service offering in MHz.")
+    private Integer cpuSpeed;
+
+    @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, required = true, description = "the display text of the service offering")
+    private String displayText;
+
+    @Parameter(name = ApiConstants.PROVISIONINGTYPE, type = CommandType.STRING, description = "provisioning type used to create volumes. Valid values are thin, sparse, fat.")
+    private String provisioningType = Storage.ProvisioningType.THIN.toString();
+
+    @Parameter(name = ApiConstants.MEMORY, type = CommandType.INTEGER, required = false, description = "the total memory of the service offering in MB")
+    private Integer memory;
+
+    @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the service offering")
+    private String serviceOfferingName;
+
+    @Parameter(name = ApiConstants.OFFER_HA, type = CommandType.BOOLEAN, description = "the HA for the service offering")
+    private Boolean offerHa;
+
+    @Parameter(name = ApiConstants.LIMIT_CPU_USE, type = CommandType.BOOLEAN, description = "restrict the CPU usage to committed service offering")
+    private Boolean limitCpuUse;
+
+    @Parameter(name = ApiConstants.IS_VOLATILE,
+               type = CommandType.BOOLEAN,
+               description = "true if the virtual machine needs to be volatile so that on every reboot of VM, original root disk is dettached then destroyed and a fresh root disk is created and attached to VM")
+    private Boolean isVolatile;
+
+    @Parameter(name = ApiConstants.STORAGE_TYPE, type = CommandType.STRING, description = "the storage type of the service offering. Values are local and shared.")
+    private String storageType;
+
+    @Parameter(name = ApiConstants.TAGS, type = CommandType.STRING, description = "the tags for this service offering.")
+    private String tags;
+
+    @Parameter(name = ApiConstants.DOMAIN_ID,
+               type = CommandType.UUID,
+               entityType = DomainResponse.class,
+               description = "the ID of the containing domain, null for public offerings")
+    private Long domainId;
+
+    @Parameter(name = ApiConstants.HOST_TAGS, type = CommandType.STRING, description = "the host tag for this service offering.")
+    private String hostTag;
+
+    @Parameter(name = ApiConstants.IS_SYSTEM_OFFERING, type = CommandType.BOOLEAN, description = "is this a system vm offering")
+    private Boolean isSystem;
+
+    @Parameter(name = ApiConstants.SYSTEM_VM_TYPE,
+               type = CommandType.STRING,
+               description = "the system VM type. Possible types are \"domainrouter\", \"consoleproxy\" and \"secondarystoragevm\".")
+    private String systemVmType;
+
+    @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;
+
+    @Parameter(name = ApiConstants.BYTES_READ_RATE, type = CommandType.LONG, required = false, description = "bytes read rate of the disk offering")
+    private Long bytesReadRate;
+
+    @Parameter(name = ApiConstants.BYTES_WRITE_RATE, type = CommandType.LONG, required = false, description = "bytes write rate of the disk offering")
+    private Long bytesWriteRate;
+
+    @Parameter(name = ApiConstants.IOPS_READ_RATE, type = CommandType.LONG, required = false, description = "io requests read rate of the disk offering")
+    private Long iopsReadRate;
+
+    @Parameter(name = ApiConstants.IOPS_WRITE_RATE, type = CommandType.LONG, required = false, description = "io requests write rate of the disk offering")
+    private Long iopsWriteRate;
+
+    @Parameter(name = ApiConstants.CUSTOMIZED_IOPS, type = CommandType.BOOLEAN, required = false, description = "whether compute offering iops is custom or not", since = "4.4")
+    private Boolean customizedIops;
+
+    @Parameter(name = ApiConstants.MIN_IOPS, type = CommandType.LONG, required = false, description = "min iops of the compute offering", since = "4.4")
+    private Long minIops;
+
+    @Parameter(name = ApiConstants.MAX_IOPS, type = CommandType.LONG, required = false, description = "max iops of the compute offering", since = "4.4")
+    private Long maxIops;
+
+    @Parameter(name = ApiConstants.HYPERVISOR_SNAPSHOT_RESERVE,
+            type = CommandType.INTEGER,
+            required = false,
+            description = "Hypervisor snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)",
+            since = "4.4")
+    private Integer hypervisorSnapshotReserve;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Integer getCpuNumber() {
+        return cpuNumber;
+    }
+
+    public Integer getCpuSpeed() {
+        return cpuSpeed;
+    }
+
+    public String getDisplayText() {
+        return displayText;
+    }
+
+    public String getProvisioningType(){
+        return provisioningType;
+    }
+
+    public Integer getMemory() {
+        return memory;
+    }
+
+    public String getServiceOfferingName() {
+        return serviceOfferingName;
+    }
+
+    public Boolean isOfferHa() {
+        return offerHa == null ? Boolean.FALSE : offerHa;
+    }
+
+    public Boolean isLimitCpuUse() {
+        return limitCpuUse == null ? Boolean.FALSE : limitCpuUse;
+    }
+
+    public Boolean isVolatileVm() {
+        return isVolatile == null ? Boolean.FALSE : isVolatile;
+    }
+
+    public String getStorageType() {
+        return storageType;
+    }
+
+    public String getTags() {
+        return tags;
+    }
+
+    public Long getDomainId() {
+        return domainId;
+    }
+
+    public String getHostTag() {
+        return hostTag;
+    }
+
+    public Boolean isSystem() {
+        return isSystem == null ? false : isSystem;
+    }
+
+    public String getSystemVmType() {
+        return systemVmType;
+    }
+
+    public Integer getNetworkRate() {
+        return networkRate;
+    }
+
+    public String getDeploymentPlanner() {
+        return deploymentPlanner;
+    }
+
+    public boolean isCustomized() {
+        return (cpuNumber == null || memory == null || cpuSpeed == null);
+    }
+
+    public Map<String, String> getDetails() {
+        Map<String, String> detailsMap = null;
+        if (details != null && !details.isEmpty()) {
+            detailsMap = new HashMap<String, String>();
+            Collection<?> props = details.values();
+            Iterator<?> iter = props.iterator();
+            while (iter.hasNext()) {
+                HashMap<String, String> detail = (HashMap<String, String>) iter.next();
+                detailsMap.put(detail.get("key"), detail.get("value"));
+            }
+        }
+        return detailsMap;
+    }
+
+    public Long getBytesReadRate() {
+        return bytesReadRate;
+    }
+
+    public Long getBytesWriteRate() {
+        return bytesWriteRate;
+    }
+
+    public Long getIopsReadRate() {
+        return iopsReadRate;
+    }
+
+    public Long getIopsWriteRate() {
+        return iopsWriteRate;
+    }
+
+    public Boolean isCustomizedIops() {
+        return customizedIops;
+    }
+
+    public Long getMinIops() {
+        return minIops;
+    }
+
+    public Long getMaxIops() {
+        return maxIops;
+    }
+
+    public Integer getHypervisorSnapshotReserve() {
+        return hypervisorSnapshotReserve;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public void execute() {
+        ServiceOffering result = _configService.createServiceOffering(this);
+        if (result != null) {
+            ServiceOfferingResponse response = _responseGenerator.createServiceOfferingResponse(result);
+            response.setResponseName(getCommandName());
+            this.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/offering/DeleteDiskOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/DeleteDiskOfferingCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/offering/DeleteDiskOfferingCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/offering/DeleteDiskOfferingCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/outofbandmanagement/ChangeOutOfBandManagementPasswordCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/ChangeOutOfBandManagementPasswordCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/outofbandmanagement/ChangeOutOfBandManagementPasswordCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/ChangeOutOfBandManagementPasswordCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/outofbandmanagement/ConfigureOutOfBandManagementCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/ConfigureOutOfBandManagementCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/outofbandmanagement/ConfigureOutOfBandManagementCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/ConfigureOutOfBandManagementCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/outofbandmanagement/DisableOutOfBandManagementForClusterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/DisableOutOfBandManagementForClusterCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/outofbandmanagement/DisableOutOfBandManagementForClusterCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/DisableOutOfBandManagementForClusterCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/outofbandmanagement/DisableOutOfBandManagementForHostCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/DisableOutOfBandManagementForHostCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/outofbandmanagement/DisableOutOfBandManagementForHostCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/DisableOutOfBandManagementForHostCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/outofbandmanagement/DisableOutOfBandManagementForZoneCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/DisableOutOfBandManagementForZoneCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/outofbandmanagement/DisableOutOfBandManagementForZoneCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/DisableOutOfBandManagementForZoneCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/outofbandmanagement/EnableOutOfBandManagementForClusterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/EnableOutOfBandManagementForClusterCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/outofbandmanagement/EnableOutOfBandManagementForClusterCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/EnableOutOfBandManagementForClusterCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/outofbandmanagement/EnableOutOfBandManagementForHostCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/EnableOutOfBandManagementForHostCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/outofbandmanagement/EnableOutOfBandManagementForHostCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/EnableOutOfBandManagementForHostCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/outofbandmanagement/EnableOutOfBandManagementForZoneCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/EnableOutOfBandManagementForZoneCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/outofbandmanagement/EnableOutOfBandManagementForZoneCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/EnableOutOfBandManagementForZoneCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/outofbandmanagement/IssueOutOfBandManagementPowerActionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/IssueOutOfBandManagementPowerActionCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/outofbandmanagement/IssueOutOfBandManagementPowerActionCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/IssueOutOfBandManagementPowerActionCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/CreatePortableIpRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/region/CreatePortableIpRangeCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/region/CreatePortableIpRangeCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/region/CreatePortableIpRangeCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/ListPortableIpRangesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/region/ListPortableIpRangesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/region/ListPortableIpRangesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/region/ListPortableIpRangesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/RemoveRegionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/region/RemoveRegionCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/region/RemoveRegionCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/region/RemoveRegionCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/ArchiveAlertsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/ArchiveAlertsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/resource/ArchiveAlertsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/resource/ArchiveAlertsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/CleanVMReservationsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/CleanVMReservationsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/resource/CleanVMReservationsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/resource/CleanVMReservationsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/DeleteAlertsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/DeleteAlertsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/resource/DeleteAlertsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/resource/DeleteAlertsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureOvsElementCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/ConfigureOvsElementCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/router/ConfigureOvsElementCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/router/ConfigureOvsElementCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java
new file mode 100644
index 00000000000..4bb6d9066c7
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java
@@ -0,0 +1,142 @@
+// 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.router;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+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.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ProviderResponse;
+import org.apache.cloudstack.api.response.VirtualRouterProviderResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.network.VirtualRouterProvider;
+import com.cloud.network.VirtualRouterProvider.Type;
+import com.cloud.network.element.VirtualRouterElementService;
+import com.cloud.user.Account;
+
+@APICommand(name = "createVirtualRouterElement", responseObject = VirtualRouterProviderResponse.class, description = "Create a virtual router element.",
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd {
+    public static final Logger s_logger = Logger.getLogger(CreateVirtualRouterElementCmd.class.getName());
+    private static final String s_name = "createvirtualrouterelementresponse";
+
+    @Inject
+    private List<VirtualRouterElementService> _service;
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.NETWORK_SERVICE_PROVIDER_ID,
+               type = CommandType.UUID,
+               entityType = ProviderResponse.class,
+               required = true,
+               description = "the network service provider ID of the virtual router element")
+    private Long nspId;
+
+    @Parameter(name = ApiConstants.PROVIDER_TYPE,
+               type = CommandType.UUID,
+               entityType = ProviderResponse.class,
+               description = "The provider type. Supported types are VirtualRouter (default) and VPCVirtualRouter")
+    private String providerType;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public void setNspId(Long nspId) {
+        this.nspId = nspId;
+    }
+
+    public Long getNspId() {
+        return nspId;
+    }
+
+    public Type getProviderType() {
+        if (providerType != null) {
+            if (providerType.equalsIgnoreCase(Type.VirtualRouter.toString())) {
+                return Type.VirtualRouter;
+            } else if (providerType.equalsIgnoreCase(Type.VPCVirtualRouter.toString())) {
+                return Type.VPCVirtualRouter;
+            } else
+                throw new InvalidParameterValueException("Invalid providerType specified");
+        }
+        return Type.VirtualRouter;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public void execute() {
+        CallContext.current().setEventDetails("Virtual router element Id: " + getEntityUuid());
+        VirtualRouterProvider result = _service.get(0).getCreatedElement(getEntityId());
+        if (result != null) {
+            VirtualRouterProviderResponse response = _responseGenerator.createVirtualRouterProviderResponse(result);
+            if(response != null) {
+                response.setResponseName(getCommandName());
+                this.setResponseObject(response);
+            }
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network");
+        }
+    }
+
+    @Override
+    public void create() throws ResourceAllocationException {
+        VirtualRouterProvider result = _service.get(0).addElement(getNspId(), getProviderType());
+        if (result != null) {
+            setEntityId(result.getId());
+            setEntityUuid(result.getUuid());
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network");
+        }
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_SERVICE_PROVIDER_CREATE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "Adding physical network ServiceProvider Virtual Router: " + getEntityUuid();
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java
new file mode 100644
index 00000000000..c460c6665e7
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.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.admin.router;
+
+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.DomainRouterResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.router.VirtualRouter;
+import com.cloud.user.Account;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "destroyRouter", description = "Destroys a router.", responseObject = DomainRouterResponse.class, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class DestroyRouterCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(DestroyRouterCmd.class.getName());
+    private static final String s_name = "destroyrouterresponse";
+
+    // ///////////////////////////////////////////////////
+    // ////////////// API parameters /////////////////////
+    // ///////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, required = true, description = "the ID of the router")
+    private Long id;
+
+    // ///////////////////////////////////////////////////
+    // ///////////////// Accessors ///////////////////////
+    // ///////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    // ///////////////////////////////////////////////////
+    // ///////////// API Implementation///////////////////
+    // ///////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        VirtualRouter router = _entityMgr.findById(VirtualRouter.class, getId());
+        if (router != null) {
+            return router.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_ROUTER_DESTROY;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "destroying router: " + this._uuidMgr.getUuid(VirtualMachine.class,getId());
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.DomainRouter;
+    }
+
+    @Override
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    @Override
+    public void execute() throws ConcurrentOperationException, ResourceUnavailableException {
+        CallContext ctx = CallContext.current();
+        ctx.setEventDetails("Router Id: " + this._uuidMgr.getUuid(VirtualMachine.class,getId()));
+
+        VirtualRouter result = _routerService.destroyRouter(getId(), ctx.getCallingAccount(), ctx.getCallingUserId());
+        if (result != null) {
+            DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to destroy router");
+        }
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ListOvsElementsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/ListOvsElementsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/router/ListOvsElementsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/router/ListOvsElementsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ListVirtualRouterElementsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/ListVirtualRouterElementsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/router/ListVirtualRouterElementsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/router/ListVirtualRouterElementsCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java
new file mode 100644
index 00000000000..802e3df3dcf
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java
@@ -0,0 +1,111 @@
+// 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.router;
+
+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.DomainRouterResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.router.VirtualRouter;
+import com.cloud.user.Account;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "rebootRouter", description = "Starts a router.", responseObject = DomainRouterResponse.class, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class RebootRouterCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(RebootRouterCmd.class.getName());
+    private static final String s_name = "rebootrouterresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, required = true, description = "the ID of the router")
+    private Long id;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        VirtualRouter router = _entityMgr.findById(VirtualRouter.class, getId());
+        if (router != null) {
+            return router.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_ROUTER_REBOOT;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "rebooting router: " + this._uuidMgr.getUuid(VirtualMachine.class,getId());
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.DomainRouter;
+    }
+
+    @Override
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    @Override
+    public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
+        CallContext.current().setEventDetails("Router Id: " + this._uuidMgr.getUuid(VirtualMachine.class,getId()));
+        VirtualRouter result = _routerService.rebootRouter(getId(), true);
+        if (result != null) {
+            DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result);
+            response.setResponseName("router");
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reboot router");
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java
new file mode 100644
index 00000000000..6d36a3c801e
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java
@@ -0,0 +1,123 @@
+// 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.router;
+
+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.DomainRouterResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.router.VirtualRouter;
+import com.cloud.network.router.VirtualRouter.Role;
+import com.cloud.user.Account;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "startRouter", responseObject = DomainRouterResponse.class, description = "Starts a router.", entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class StartRouterCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(StartRouterCmd.class.getName());
+    private static final String s_name = "startrouterresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, required = true, description = "the ID of the router")
+    private Long id;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getResultObjectName() {
+        return "router";
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        VirtualRouter router = _entityMgr.findById(VirtualRouter.class, getId());
+        if (router != null) {
+            return router.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_ROUTER_START;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "starting router: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.DomainRouter;
+    }
+
+    @Override
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    @Override
+    public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
+        CallContext.current().setEventDetails("Router Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
+        VirtualRouter result = null;
+        VirtualRouter router = _routerService.findRouter(getId());
+        if (router == null || router.getRole() != Role.VIRTUAL_ROUTER) {
+            throw new InvalidParameterValueException("Can't find router by id");
+        } else {
+            result = _routerService.startRouter(getId());
+        }
+        if (result != null) {
+            DomainRouterResponse routerResponse = _responseGenerator.createDomainRouterResponse(result);
+            routerResponse.setResponseName(getCommandName());
+            setResponseObject(routerResponse);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to start router");
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java
new file mode 100644
index 00000000000..2474171a459
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java
@@ -0,0 +1,126 @@
+// 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.router;
+
+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.DomainRouterResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.router.VirtualRouter;
+import com.cloud.network.router.VirtualRouter.Role;
+import com.cloud.user.Account;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "stopRouter", description = "Stops a router.", responseObject = DomainRouterResponse.class, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class StopRouterCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(StopRouterCmd.class.getName());
+    private static final String s_name = "stoprouterresponse";
+
+    // ///////////////////////////////////////////////////
+    // ////////////// API parameters /////////////////////
+    // ///////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, required = true, description = "the ID of the router")
+    private Long id;
+
+    @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM. The caller knows the VM is stopped.")
+    private Boolean forced;
+
+    // ///////////////////////////////////////////////////
+    // ///////////////// Accessors ///////////////////////
+    // ///////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    // ///////////////////////////////////////////////////
+    // ///////////// API Implementation///////////////////
+    // ///////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        VirtualRouter router = _entityMgr.findById(VirtualRouter.class, getId());
+        if (router != null) {
+            return router.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_ROUTER_STOP;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "Stopping router: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.DomainRouter;
+    }
+
+    @Override
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    public boolean isForced() {
+        return (forced != null) ? forced : false;
+    }
+
+    @Override
+    public void execute() throws ConcurrentOperationException, ResourceUnavailableException {
+        CallContext.current().setEventDetails("Router Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
+        VirtualRouter result = null;
+        VirtualRouter router = _routerService.findRouter(getId());
+        if (router == null || router.getRole() != Role.VIRTUAL_ROUTER) {
+            throw new InvalidParameterValueException("Can't find router by id");
+        } else {
+            result = _routerService.stopRouter(getId(), isForced());
+        }
+
+        if (result != null) {
+            DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to stop router");
+        }
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterTemplateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/UpgradeRouterTemplateCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterTemplateCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/router/UpgradeRouterTemplateCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/AddImageStoreS3CMD.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/AddImageStoreS3CMD.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/storage/AddImageStoreS3CMD.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/storage/AddImageStoreS3CMD.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/CreateSecondaryStagingStoreCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/CreateSecondaryStagingStoreCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/storage/CreateSecondaryStagingStoreCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/storage/CreateSecondaryStagingStoreCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/DeleteImageStoreCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/DeleteImageStoreCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/storage/DeleteImageStoreCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/storage/DeleteImageStoreCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/DeletePoolCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/DeletePoolCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/storage/DeletePoolCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/storage/DeletePoolCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/DeleteSecondaryStagingStoreCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/DeleteSecondaryStagingStoreCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/storage/DeleteSecondaryStagingStoreCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/storage/DeleteSecondaryStagingStoreCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/FindStoragePoolsForMigrationCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/FindStoragePoolsForMigrationCmd.java
new file mode 100644
index 00000000000..73c596c9e56
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/FindStoragePoolsForMigrationCmd.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 org.apache.cloudstack.api.command.admin.storage;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiCommandJobType;
+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.StoragePoolResponse;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.log4j.Logger;
+
+import com.cloud.storage.StoragePool;
+import com.cloud.utils.Pair;
+
+@APICommand(name = "findStoragePoolsForMigration", description = "Lists storage pools available for migration of a volume.", responseObject = StoragePoolResponse.class,
+requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class FindStoragePoolsForMigrationCmd extends BaseListCmd {
+    public static final Logger s_logger = Logger.getLogger(FindStoragePoolsForMigrationCmd.class.getName());
+
+    private static final String s_name = "findstoragepoolsformigrationresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VolumeResponse.class, required = true, description = "the ID of the volume")
+    private Long id;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.StoragePool;
+    }
+
+    @Override
+    public void execute() {
+        Pair<List<? extends StoragePool>, List<? extends StoragePool>> pools = _mgr.listStoragePoolsForMigrationOfVolume(getId());
+        ListResponse<StoragePoolResponse> response = new ListResponse<StoragePoolResponse>();
+        List<StoragePoolResponse> poolResponses = new ArrayList<StoragePoolResponse>();
+
+        List<? extends StoragePool> allPools = pools.first();
+        List<? extends StoragePool> suitablePoolList = pools.second();
+        for (StoragePool pool : allPools) {
+            StoragePoolResponse poolResponse = _responseGenerator.createStoragePoolForMigrationResponse(pool);
+            Boolean suitableForMigration = false;
+            for (StoragePool suitablePool : suitablePoolList) {
+                if (StringUtils.equals(suitablePool.getUuid(), pool.getUuid())) {
+                    suitableForMigration = true;
+                    break;
+                }
+            }
+            poolResponse.setSuitableForMigration(suitableForMigration);
+            poolResponse.setObjectName("storagepool");
+            poolResponses.add(poolResponse);
+        }
+        sortPoolsBySuitabilityAndName(poolResponses);
+        response.setResponses(poolResponses);
+        response.setResponseName(getCommandName());
+        this.setResponseObject(response);
+    }
+
+    protected void sortPoolsBySuitabilityAndName(List<StoragePoolResponse> poolResponses) {
+        Collections.sort(poolResponses, new Comparator<StoragePoolResponse>() {
+            @Override
+            public int compare(StoragePoolResponse o1, StoragePoolResponse o2) {
+                if (o1.getSuitableForMigration() && o2.getSuitableForMigration()) {
+                    return o1.getName().compareTo(o2.getName());
+                }
+                if (o1.getSuitableForMigration()) {
+                    return -1;
+                }
+                if (o2.getSuitableForMigration()) {
+                    return 1;
+                }
+                return 0;
+            }
+        });
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/ListImageStoresCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListImageStoresCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/storage/ListImageStoresCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListImageStoresCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/ListSecondaryStagingStoresCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListSecondaryStagingStoresCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/storage/ListSecondaryStagingStoresCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListSecondaryStagingStoresCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/ListStorageProvidersCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListStorageProvidersCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/storage/ListStorageProvidersCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListStorageProvidersCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/ListStorageTagsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListStorageTagsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/storage/ListStorageTagsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListStorageTagsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateCloudToUseObjectStoreCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/UpdateCloudToUseObjectStoreCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/storage/UpdateCloudToUseObjectStoreCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/storage/UpdateCloudToUseObjectStoreCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/swift/ListSwiftsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/swift/ListSwiftsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/swift/ListSwiftsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/swift/ListSwiftsCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java
new file mode 100644
index 00000000000..f68f9ddb49e
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.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.admin.systemvm;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.ACL;
+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.SystemVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "destroySystemVm", responseObject = SystemVmResponse.class, description = "Destroyes a system virtual machine.", entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class DestroySystemVmCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(DestroySystemVmCmd.class.getName());
+
+    private static final String s_name = "destroysystemvmresponse";
+
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name = ApiConstants.ID,
+               type = CommandType.UUID,
+               entityType = SystemVmResponse.class,
+               required = true,
+               description = "The ID of the system virtual machine")
+    private Long id;
+
+    public Long getId() {
+        return id;
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getResultObjectName() {
+        return "systemvm";
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Account account = CallContext.current().getCallingAccount();
+        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 String getEventType() {
+        VirtualMachine.Type type = _mgr.findSystemVMTypeById(getId());
+        if (type == VirtualMachine.Type.ConsoleProxy) {
+            return EventTypes.EVENT_PROXY_DESTROY;
+        } else {
+            return EventTypes.EVENT_SSVM_DESTROY;
+        }
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "destroying system vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.SystemVm;
+    }
+
+    @Override
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    @Override
+    public void execute() {
+        CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
+        VirtualMachine instance = _mgr.destroySystemVM(this);
+        if (instance != null) {
+            SystemVmResponse response = _responseGenerator.createSystemVmResponse(instance);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to destroy system vm");
+        }
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java
new file mode 100644
index 00000000000..ab0018b9e80
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java
@@ -0,0 +1,143 @@
+// 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 org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+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.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.SystemVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ManagementServerException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.exception.VirtualMachineMigrationException;
+import com.cloud.host.Host;
+import com.cloud.user.Account;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "migrateSystemVm", description = "Attempts Migration of a system virtual machine to the host specified.", responseObject = SystemVmResponse.class, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class MigrateSystemVMCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(MigrateSystemVMCmd.class.getName());
+
+    private static final String s_name = "migratesystemvmresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.HOST_ID,
+               type = CommandType.UUID,
+               entityType = HostResponse.class,
+               required = true,
+               description = "destination Host ID to migrate VM to")
+    private Long hostId;
+
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
+               type = CommandType.UUID,
+               entityType = SystemVmResponse.class,
+               required = true,
+               description = "the ID of the virtual machine")
+    private Long virtualMachineId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getHostId() {
+        return hostId;
+    }
+
+    public Long getVirtualMachineId() {
+        return virtualMachineId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Account account = CallContext.current().getCallingAccount();
+        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 String getEventType() {
+        return EventTypes.EVENT_VM_MIGRATE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "Attempting to migrate VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId()) + " to host Id: " + this._uuidMgr.getUuid(Host.class, getHostId());
+    }
+
+    @Override
+    public void execute() {
+
+        Host destinationHost = _resourceService.getHost(getHostId());
+        if (destinationHost == null) {
+            throw new InvalidParameterValueException("Unable to find the host to migrate the VM, host id=" + getHostId());
+        }
+        try {
+            CallContext.current().setEventDetails("VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId()) + " to host Id: " + this._uuidMgr.getUuid(Host.class, getHostId()));
+            //FIXME : Should not be calling UserVmService to migrate all types of VMs - need a generic VM layer
+            VirtualMachine migratedVm = _userVmService.migrateVirtualMachine(getVirtualMachineId(), destinationHost);
+            if (migratedVm != null) {
+                // return the generic system VM instance response
+                SystemVmResponse response = _responseGenerator.createSystemVmResponse(migratedVm);
+                response.setResponseName(getCommandName());
+                setResponseObject(response);
+            } else {
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate the system vm");
+            }
+        } catch (ResourceUnavailableException ex) {
+            s_logger.warn("Exception: ", ex);
+            throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+        } catch (ConcurrentOperationException e) {
+            s_logger.warn("Exception: ", e);
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
+        } catch (ManagementServerException e) {
+            s_logger.warn("Exception: ", e);
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
+        } catch (VirtualMachineMigrationException e) {
+            s_logger.warn("Exception: ", e);
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java
new file mode 100644
index 00000000000..ebc50ae7e1d
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java
@@ -0,0 +1,119 @@
+// 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 org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.ACL;
+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.SystemVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "rebootSystemVm", description = "Reboots a system VM.", responseObject = SystemVmResponse.class, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class RebootSystemVmCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(RebootSystemVmCmd.class.getName());
+
+    private static final String s_name = "rebootsystemvmresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name = ApiConstants.ID,
+               type = CommandType.UUID,
+               entityType = SystemVmResponse.class,
+               required = true,
+               description = "The ID of the system virtual machine")
+    private Long id;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Account account = CallContext.current().getCallingAccount();
+        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 String getEventType() {
+        VirtualMachine.Type type = _mgr.findSystemVMTypeById(getId());
+        if (type == VirtualMachine.Type.ConsoleProxy) {
+            return EventTypes.EVENT_PROXY_REBOOT;
+        } else {
+            return EventTypes.EVENT_SSVM_REBOOT;
+        }
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "rebooting system vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.SystemVm;
+    }
+
+    @Override
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    @Override
+    public void execute() {
+        CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
+        VirtualMachine result = _mgr.rebootSystemVM(this);
+        if (result != null) {
+            SystemVmResponse response = _responseGenerator.createSystemVmResponse(result);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to reboot system vm");
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java
new file mode 100644
index 00000000000..c4a69a28a28
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java
@@ -0,0 +1,145 @@
+// 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 java.util.Map;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+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.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+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.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ManagementServerException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.exception.VirtualMachineMigrationException;
+import com.cloud.offering.ServiceOffering;
+import com.cloud.user.Account;
+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.", entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+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 /////////////////////
+    /////////////////////////////////////////////////////
+
+    @ACL(accessType = AccessType.OperateEntry)
+    @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;
+
+    @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "name value pairs of custom parameters for cpu, memory and cpunumber. example details[i].name=value")
+    private Map<String, String> details;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    public Long getServiceOfferingId() {
+        return serviceOfferingId;
+    }
+
+    public Map<String, String> getDetails() {
+        return details;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Account account = CallContext.current().getCallingAccount();
+        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() {
+        CallContext.current().setEventDetails("SystemVm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
+
+        ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, 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());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade system vm");
+        }
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VM_UPGRADE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "Upgrading system vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()) + " to service offering: " + this._uuidMgr.getUuid(ServiceOffering.class, getServiceOfferingId());
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java
new file mode 100644
index 00000000000..a2b70a6630b
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java
@@ -0,0 +1,123 @@
+// 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 org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.ACL;
+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.SystemVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "startSystemVm", responseObject = SystemVmResponse.class, description = "Starts a system virtual machine.", entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class StartSystemVMCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(StartSystemVMCmd.class.getName());
+
+    private static final String s_name = "startsystemvmresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name = ApiConstants.ID,
+               type = CommandType.UUID,
+               entityType = SystemVmResponse.class,
+               required = true,
+               description = "The ID of the system virtual machine")
+    private Long id;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getResultObjectName() {
+        return "systemvm";
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Account account = CallContext.current().getCallingAccount();
+        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 String getEventType() {
+        VirtualMachine.Type type = _mgr.findSystemVMTypeById(getId());
+        if (type == VirtualMachine.Type.ConsoleProxy) {
+            return EventTypes.EVENT_PROXY_START;
+        } else {
+            return EventTypes.EVENT_SSVM_START;
+        }
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "starting system vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.SystemVm;
+    }
+
+    @Override
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    @Override
+    public void execute() {
+        CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
+        VirtualMachine instance = _mgr.startSystemVM(getId());
+        if (instance != null) {
+            SystemVmResponse response = _responseGenerator.createSystemVmResponse(instance);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to start system vm");
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java
new file mode 100644
index 00000000000..9237004b727
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java
@@ -0,0 +1,129 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.systemvm;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.ACL;
+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.SystemVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "stopSystemVm", description = "Stops a system VM.", responseObject = SystemVmResponse.class, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class StopSystemVmCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(StopSystemVmCmd.class.getName());
+
+    private static final String s_name = "stopsystemvmresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name = ApiConstants.ID,
+               type = CommandType.UUID,
+               entityType = SystemVmResponse.class,
+               required = true,
+               description = "The ID of the system virtual machine")
+    private Long id;
+
+    @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM.  The caller knows the VM is stopped.")
+    private Boolean forced;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Account account = CallContext.current().getCallingAccount();
+        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 String getEventType() {
+        VirtualMachine.Type type = _mgr.findSystemVMTypeById(getId());
+        if (type == VirtualMachine.Type.ConsoleProxy) {
+            return EventTypes.EVENT_PROXY_STOP;
+        } else {
+            return EventTypes.EVENT_SSVM_STOP;
+        }
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "stopping system vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.SystemVm;
+    }
+
+    @Override
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    public boolean isForced() {
+        return (forced != null) ? forced : false;
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException, ConcurrentOperationException {
+        CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
+        VirtualMachine result = _mgr.stopSystemVM(this);
+        if (result != null) {
+            SystemVmResponse response = _responseGenerator.createSystemVmResponse(result);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to stop system vm");
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java
new file mode 100644
index 00000000000..f2663586faa
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java
@@ -0,0 +1,115 @@
+// 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 java.util.Map;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+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.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+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.cloudstack.context.CallContext;
+
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.offering.ServiceOffering;
+import com.cloud.user.Account;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "changeServiceForSystemVm", responseObject = SystemVmResponse.class, description = "Changes the service offering for a system vm (console proxy or secondary storage). "
+        + "The system vm must be in a \"Stopped\" state for " + "this command to take effect.", entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class UpgradeSystemVMCmd extends BaseCmd {
+    public static final Logger s_logger = Logger.getLogger(UpgradeVMCmd.class.getName());
+    private static final String s_name = "changeserviceforsystemvmresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @ACL(accessType = AccessType.OperateEntry)
+    @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;
+
+    @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "name value pairs of custom parameters for cpu, memory and cpunumber. example details[i].name=value")
+    private Map<String, String> details;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    public Long getServiceOfferingId() {
+        return serviceOfferingId;
+    }
+
+    public Map<String, String> getDetails() {
+        return details;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Account account = CallContext.current().getCallingAccount();
+        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() {
+        CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
+
+        ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
+        if (serviceOffering == null) {
+            throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId);
+        }
+
+        VirtualMachine result = _mgr.upgradeSystemVM(this);
+        if (result != null) {
+            SystemVmResponse response = _responseGenerator.createSystemVmResponse(result);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to reboot system vm");
+        }
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/template/CopyTemplateCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/template/CopyTemplateCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/template/CopyTemplateCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/template/CopyTemplateCmdByAdmin.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/template/CreateTemplateCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/template/CreateTemplateCmdByAdmin.java
new file mode 100644
index 00000000000..865bc15f679
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/template/CreateTemplateCmdByAdmin.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 org.apache.cloudstack.api.command.admin.template;
+
+import java.util.List;
+
+import com.cloud.storage.Snapshot;
+import com.cloud.storage.Volume;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.template.CreateTemplateCmd;
+import org.apache.cloudstack.api.response.TemplateResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.template.VirtualMachineTemplate;
+
+@APICommand(name = "createTemplate", responseObject = TemplateResponse.class, description = "Creates a template of a virtual machine. " + "The virtual machine must be in a STOPPED state. "
+        + "A template created from this command is automatically designated as a private template visible to the account that created it.", responseView = ResponseView.Full,
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class CreateTemplateCmdByAdmin extends CreateTemplateCmd {
+    public static final Logger s_logger = Logger.getLogger(CreateTemplateCmdByAdmin.class.getName());
+
+    @Override
+    public void execute() {
+        CallContext.current().setEventDetails("Template Id: " + getEntityUuid()+((getSnapshotId() == null) ? " from volume Id: " + this._uuidMgr.getUuid(Volume.class, getVolumeId()) : " from snapshot Id: " + this._uuidMgr.getUuid(Snapshot.class, getSnapshotId())));
+        VirtualMachineTemplate template = null;
+        template = _templateService.createPrivateTemplate(this);
+
+        if (template != null){
+            List<TemplateResponse> templateResponses;
+            if (isBareMetal()) {
+                templateResponses = _responseGenerator.createTemplateResponses(ResponseView.Full, template.getId(), vmId);
+            } else {
+                templateResponses = _responseGenerator.createTemplateResponses(ResponseView.Full, template.getId(), snapshotId, volumeId, false);
+            }
+            TemplateResponse response = new TemplateResponse();
+            if (templateResponses != null && !templateResponses.isEmpty()) {
+                response = templateResponses.get(0);
+            }
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create private template");
+        }
+
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/template/ListTemplatePermissionsCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/template/ListTemplatePermissionsCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/template/ListTemplatePermissionsCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/template/ListTemplatePermissionsCmdByAdmin.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/template/ListTemplatesCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/template/ListTemplatesCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/template/ListTemplatesCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/template/ListTemplatesCmdByAdmin.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/template/RegisterTemplateCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/template/RegisterTemplateCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/template/RegisterTemplateCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/template/RegisterTemplateCmdByAdmin.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/template/UpdateTemplateCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/template/UpdateTemplateCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/template/UpdateTemplateCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/template/UpdateTemplateCmdByAdmin.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficMonitorCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/AddTrafficMonitorCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficMonitorCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/usage/AddTrafficMonitorCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficMonitorCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficMonitorCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficMonitorCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficMonitorCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/GenerateUsageRecordsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/GenerateUsageRecordsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/usage/GenerateUsageRecordsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/usage/GenerateUsageRecordsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficMonitorsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/ListTrafficMonitorsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficMonitorsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/usage/ListTrafficMonitorsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypeImplementorsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypeImplementorsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypeImplementorsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypeImplementorsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/ListUsageTypesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/ListUsageTypesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/usage/ListUsageTypesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/usage/ListUsageTypesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/RemoveRawUsageRecordsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/RemoveRawUsageRecordsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/usage/RemoveRawUsageRecordsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/usage/RemoveRawUsageRecordsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/GetUserKeysCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/GetUserKeysCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/user/GetUserKeysCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/user/GetUserKeysCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/MoveUserCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/MoveUserCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/user/MoveUserCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/user/MoveUserCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java
new file mode 100644
index 00000000000..24624e2c271
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java
@@ -0,0 +1,177 @@
+// 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.user;
+
+import javax.inject.Inject;
+
+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.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.UserResponse;
+import org.apache.cloudstack.context.CallContext;
+import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
+
+import com.cloud.user.Account;
+import com.cloud.user.User;
+import com.cloud.user.UserAccount;
+
+@APICommand(name = "updateUser", description = "Updates a user account", responseObject = UserResponse.class,
+requestHasSensitiveInfo = true, responseHasSensitiveInfo = true)
+public class UpdateUserCmd extends BaseCmd {
+    public static final Logger s_logger = Logger.getLogger(UpdateUserCmd.class.getName());
+
+    private static final String s_name = "updateuserresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.USER_API_KEY, type = CommandType.STRING, description = "The API key for the user. Must be specified with userSecretKey")
+    private String apiKey;
+
+    @Parameter(name = ApiConstants.EMAIL, type = CommandType.STRING, description = "email")
+    private String email;
+
+    @Parameter(name = ApiConstants.FIRSTNAME, type = CommandType.STRING, description = "first name")
+    private String firstname;
+
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserResponse.class, required = true, description = "User uuid")
+    private Long id;
+
+    @Parameter(name = ApiConstants.LASTNAME, type = CommandType.STRING, description = "last name")
+    private String lastname;
+
+    @Parameter(name = ApiConstants.PASSWORD,
+            type = CommandType.STRING,
+            description = "Clear text password (default hashed to SHA256SALT). If you wish to use any other hashing algorithm, you would need to write a custom authentication adapter. Can't be passed when command is executed via integration.api.port",
+            acceptedOnAdminPort = false)
+    private String password;
+
+    @Parameter(name = ApiConstants.CURRENT_PASSWORD, type = CommandType.STRING, description = "Current password that was being used by the user. You must inform the current password when updating the password.", acceptedOnAdminPort = false)
+    private String currentPassword;
+
+    @Parameter(name = ApiConstants.SECRET_KEY, type = CommandType.STRING, description = "The secret key for the user. Must be specified with userApiKey")
+    private String secretKey;
+
+    @Parameter(name = ApiConstants.TIMEZONE,
+            type = CommandType.STRING,
+            description = "Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.")
+    private String timezone;
+
+    @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, description = "Unique username")
+    private String username;
+
+    @Inject
+    private RegionService _regionService;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public String getApiKey() {
+        return apiKey;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public String getFirstname() {
+        return firstname;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public String getLastname() {
+        return lastname;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public String getCurrentPassword() {
+        return currentPassword;
+    }
+
+    public String getSecretKey() {
+        return secretKey;
+    }
+
+    public String getTimezone() {
+        return timezone;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        User user = _entityMgr.findById(User.class, getId());
+        if (user != null) {
+            return user.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public void execute() {
+        CallContext.current().setEventDetails("UserId: " + getId());
+        UserAccount user = _regionService.updateUser(this);
+
+        if (user != null) {
+            UserResponse response = _responseGenerator.createUserResponse(user);
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update user");
+        }
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public void setFirstname(String firstname) {
+        this.firstname = firstname;
+    }
+
+    public void setLastname(String lastname) {
+        this.lastname = lastname;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vlan/DedicatePublicIpRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/DedicatePublicIpRangeCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/vlan/DedicatePublicIpRangeCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/DedicatePublicIpRangeCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java
new file mode 100644
index 00000000000..d5edd301a66
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java
@@ -0,0 +1,158 @@
+// 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.vlan;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+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.DomainResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
+import org.apache.cloudstack.api.response.PodResponse;
+import org.apache.cloudstack.api.response.ProjectResponse;
+import org.apache.cloudstack.api.response.VlanIpRangeResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+
+import com.cloud.dc.Vlan;
+import com.cloud.utils.Pair;
+
+@APICommand(name = "listVlanIpRanges", description = "Lists all VLAN IP ranges.", responseObject = VlanIpRangeResponse.class,
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class ListVlanIpRangesCmd extends BaseListCmd {
+    public static final Logger s_logger = Logger.getLogger(ListVlanIpRangesCmd.class.getName());
+
+    private static final String s_name = "listvlaniprangesresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ACCOUNT,
+               type = CommandType.STRING,
+               description = "the account with which the VLAN IP range is associated. Must be used with the domainId parameter.")
+    private String accountName;
+
+    @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "project who will own the VLAN")
+    private Long projectId;
+
+    @Parameter(name = ApiConstants.DOMAIN_ID,
+               type = CommandType.UUID,
+               entityType = DomainResponse.class,
+               description = "the domain ID with which the VLAN IP range is associated.  If used with the account parameter, " +
+                   "returns all VLAN IP ranges for that account in the specified domain.")
+    private Long domainId;
+
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VlanIpRangeResponse.class, required = false, description = "the ID of the VLAN IP range")
+    private Long id;
+
+    @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "the Pod ID of the VLAN IP range")
+    private Long podId;
+
+    @Parameter(name = ApiConstants.VLAN, type = CommandType.STRING, description = "the ID or VID of the VLAN. Default is an \"untagged\" VLAN.")
+    private String vlan;
+
+    @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the Zone ID of the VLAN IP range")
+    private Long zoneId;
+
+    @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "network id of the VLAN IP range")
+    private Long networkId;
+
+    @Parameter(name = ApiConstants.FOR_VIRTUAL_NETWORK, type = CommandType.BOOLEAN, description = "true if VLAN is of Virtual type, false if Direct")
+    private Boolean forVirtualNetwork;
+
+    @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID,
+               type = CommandType.UUID,
+               entityType = PhysicalNetworkResponse.class,
+               description = "physical network id of the VLAN IP range")
+    private Long physicalNetworkId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public String getAccountName() {
+        return accountName;
+    }
+
+    public Long getDomainId() {
+        return domainId;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public Long getPodId() {
+        return podId;
+    }
+
+    public String getVlan() {
+        return vlan;
+    }
+
+    public Long getZoneId() {
+        return zoneId;
+    }
+
+    public Long getNetworkId() {
+        return networkId;
+    }
+
+    public Boolean isForVirtualNetwork() {
+        return forVirtualNetwork;
+    }
+
+    public Long getProjectId() {
+        return projectId;
+    }
+
+    public Long getPhysicalNetworkId() {
+        return physicalNetworkId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public void execute() {
+        Pair<List<? extends Vlan>, Integer> vlans = _mgr.searchForVlans(this);
+        ListResponse<VlanIpRangeResponse> response = new ListResponse<VlanIpRangeResponse>();
+        List<VlanIpRangeResponse> vlanResponses = new ArrayList<VlanIpRangeResponse>();
+        for (Vlan vlan : vlans.first()) {
+            VlanIpRangeResponse vlanResponse = _responseGenerator.createVlanIpRangeResponse(vlan);
+            vlanResponse.setObjectName("vlaniprange");
+            vlanResponses.add(vlanResponse);
+        }
+
+        response.setResponses(vlanResponses, vlans.second());
+        response.setResponseName(getCommandName());
+        setResponseObject(response);
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vlan/ReleasePublicIpRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/ReleasePublicIpRangeCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/vlan/ReleasePublicIpRangeCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/ReleasePublicIpRangeCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/AddNicToVMCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/AddNicToVMCmdByAdmin.java
new file mode 100644
index 00000000000..da0a087b258
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/AddNicToVMCmdByAdmin.java
@@ -0,0 +1,58 @@
+// 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.vm;
+
+import java.util.ArrayList;
+import java.util.EnumSet;
+
+import com.cloud.network.Network;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants.VMDetails;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.vm.AddNicToVMCmd;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
+
+
+@APICommand(name = "addNicToVirtualMachine", description = "Adds VM to specified network by creating a NIC", responseObject = UserVmResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+public class AddNicToVMCmdByAdmin extends AddNicToVMCmd {
+    public static final Logger s_logger = Logger.getLogger(AddNicToVMCmdByAdmin.class);
+
+    @Override
+    public void execute(){
+        CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()) + " Network Id: " + this._uuidMgr.getUuid(Network.class, getNetworkId()));
+        UserVm result = _userVmService.addNicToVirtualMachine(this);
+        ArrayList<VMDetails> dc = new ArrayList<VMDetails>();
+        dc.add(VMDetails.valueOf("nics"));
+        EnumSet<VMDetails> details = EnumSet.copyOf(dc);
+        if (result != null){
+            UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", details, result).get(0);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add NIC to vm. Refer to server logs for details.");
+        }
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/DeployVMCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/DeployVMCmdByAdmin.java
new file mode 100644
index 00000000000..fa76db9cf30
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/DeployVMCmdByAdmin.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.command.admin.vm;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.vm.DeployVMCmd;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InsufficientServerCapacityException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
+
+
+@APICommand(name = "deployVirtualMachine", description = "Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.", responseObject = UserVmResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+public class DeployVMCmdByAdmin extends DeployVMCmd {
+    public static final Logger s_logger = Logger.getLogger(DeployVMCmdByAdmin.class.getName());
+
+
+    @Override
+    public void execute(){
+        UserVm result;
+
+        if (getStartVm()) {
+            try {
+                CallContext.current().setEventDetails("Vm Id: " + getEntityUuid());
+                result = _userVmService.startVirtualMachine(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 (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());
+            }
+        } else {
+            result = _userVmService.getUserVm(getEntityId());
+        }
+
+        if (result != null) {
+            UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result).get(0);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to deploy vm");
+        }
+    }
+
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/DestroyVMCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/DestroyVMCmdByAdmin.java
new file mode 100644
index 00000000000..bb59a176f68
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/DestroyVMCmdByAdmin.java
@@ -0,0 +1,60 @@
+// 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.vm;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.vm.DestroyVMCmd;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "destroyVirtualMachine", description = "Destroys a virtual machine. Once destroyed, only the administrator can recover it.", responseObject = UserVmResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false,
+        responseHasSensitiveInfo = true)
+public class DestroyVMCmdByAdmin extends DestroyVMCmd {
+    public static final Logger s_logger = Logger.getLogger(DestroyVMCmdByAdmin.class.getName());
+
+
+    @Override
+    public void execute() throws ResourceUnavailableException, ConcurrentOperationException{
+        CallContext.current().setEventDetails("Vm Id: "+this._uuidMgr.getUuid(VirtualMachine.class, getId()));
+        UserVm result = _userVmService.destroyVm(this);
+
+        UserVmResponse response = new UserVmResponse();
+        if (result != null) {
+            List<UserVmResponse> responses = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result);
+            if (responses != null && !responses.isEmpty()) {
+                response = responses.get(0);
+            }
+            response.setResponseName("virtualmachine");
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to destroy vm");
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ExpungeVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ExpungeVMCmd.java
new file mode 100644
index 00000000000..ea6cb00efa7
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ExpungeVMCmd.java
@@ -0,0 +1,123 @@
+// 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.vm;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.ACL;
+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.SuccessResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+import com.cloud.uservm.UserVm;
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "expungeVirtualMachine", description = "Expunge a virtual machine. Once expunged, it cannot be recoverd.", responseObject = SuccessResponse.class, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class ExpungeVMCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(ExpungeVMCmd.class.getName());
+
+    private static final String s_name = "expungevirtualmachineresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the virtual machine")
+    private Long id;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        UserVm vm = _responseGenerator.findUserVmById(getId());
+        if (vm != null) {
+            return vm.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VM_EXPUNGE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "Expunging vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.VirtualMachine;
+    }
+
+    @Override
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException, ConcurrentOperationException {
+        CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
+        try {
+            UserVm result = _userVmService.expungeVm(this.getId());
+
+            if (result != null) {
+                SuccessResponse response = new SuccessResponse(getCommandName());
+                setResponseObject(response);
+            } else {
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to expunge vm");
+            }
+        } catch (InvalidParameterValueException ipve) {
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage());
+        } catch (CloudRuntimeException cre) {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, cre.getMessage());
+        }
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/GetVMUserDataCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/GetVMUserDataCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/vm/GetVMUserDataCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/vm/GetVMUserDataCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/ListVMsCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ListVMsCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/vm/ListVMsCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ListVMsCmdByAdmin.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java
new file mode 100644
index 00000000000..b5683e3f144
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java
@@ -0,0 +1,195 @@
+// 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.vm;
+
+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.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.HostResponse;
+import org.apache.cloudstack.api.response.StoragePoolResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ManagementServerException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.exception.VirtualMachineMigrationException;
+import com.cloud.host.Host;
+import com.cloud.storage.StoragePool;
+import com.cloud.user.Account;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "migrateVirtualMachine",
+            description = "Attempts Migration of a VM to a different host or Root volume of the vm to a different storage pool",
+        responseObject = UserVmResponse.class, entityType = {VirtualMachine.class},
+            requestHasSensitiveInfo = false,
+            responseHasSensitiveInfo = true)
+public class MigrateVMCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(MigrateVMCmd.class.getName());
+
+    private static final String s_name = "migratevirtualmachineresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.HOST_ID,
+               type = CommandType.UUID,
+               entityType = HostResponse.class,
+               required = false,
+               description = "Destination Host ID to migrate VM to. Required for live migrating a VM from host to host")
+    private Long hostId;
+
+    @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
+               type = CommandType.UUID,
+               entityType = UserVmResponse.class,
+               required = true,
+               description = "the ID of the virtual machine")
+    private Long virtualMachineId;
+
+    @Parameter(name = ApiConstants.STORAGE_ID,
+               type = CommandType.UUID,
+               entityType = StoragePoolResponse.class,
+               required = false,
+               description = "Destination storage pool ID to migrate VM volumes to. Required for migrating the root disk volume")
+    private Long storageId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getHostId() {
+        return hostId;
+    }
+
+    public Long getVirtualMachineId() {
+        return virtualMachineId;
+    }
+
+    public Long getStoragePoolId() {
+        return storageId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        UserVm userVm = _entityMgr.findById(UserVm.class, getVirtualMachineId());
+        if (userVm != null) {
+            return userVm.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VM_MIGRATE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        if (getHostId() != null) {
+            return "Attempting to migrate VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId()) + " to host Id: " + this._uuidMgr.getUuid(Host.class, getHostId());
+        } else if (getStoragePoolId() != null) {
+            return "Attempting to migrate VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId()) + " to storage pool Id: " + this._uuidMgr.getUuid(StoragePool.class, getStoragePoolId());
+        } else {
+            return "Attempting to migrate VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId());
+        }
+    }
+
+    @Override
+    public void execute() {
+        if (getHostId() == null && getStoragePoolId() == null) {
+            throw new InvalidParameterValueException("Either hostId or storageId must be specified");
+        }
+
+        if (getHostId() != null && getStoragePoolId() != null) {
+            throw new InvalidParameterValueException("Only one of hostId and storageId can be specified");
+        }
+
+        UserVm userVm = _userVmService.getUserVm(getVirtualMachineId());
+        if (userVm == null) {
+            throw new InvalidParameterValueException("Unable to find the VM by id=" + getVirtualMachineId());
+        }
+
+        Host destinationHost = null;
+        if (getHostId() != null) {
+            destinationHost = _resourceService.getHost(getHostId());
+            if (destinationHost == null) {
+                throw new InvalidParameterValueException("Unable to find the host to migrate the VM, host id=" + getHostId());
+            }
+            if (destinationHost.getType() != Host.Type.Routing) {
+                throw new InvalidParameterValueException("The specified host(" + destinationHost.getName() + ") is not suitable to migrate the VM, please specify another one");
+            }
+            CallContext.current().setEventDetails("VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId()) + ((getHostId() != null) ?  " to host Id: " + this._uuidMgr.getUuid(Host.class, getHostId()) : "" ));
+        }
+
+        StoragePool destStoragePool = null;
+        if (getStoragePoolId() != null) {
+            destStoragePool = _storageService.getStoragePool(getStoragePoolId());
+            if (destStoragePool == null) {
+                throw new InvalidParameterValueException("Unable to find the storage pool to migrate the VM");
+            }
+            CallContext.current().setEventDetails("VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId()) + " to storage pool Id: " + this._uuidMgr.getUuid(StoragePool.class, getStoragePoolId()));
+        }
+
+        try {
+            VirtualMachine migratedVm = null;
+            if (getHostId() != null) {
+                migratedVm = _userVmService.migrateVirtualMachine(getVirtualMachineId(), destinationHost);
+            } else if (getStoragePoolId() != null) {
+                migratedVm = _userVmService.vmStorageMigration(getVirtualMachineId(), destStoragePool);
+            }
+            if (migratedVm != null) {
+                UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", (UserVm)migratedVm).get(0);
+                response.setResponseName(getCommandName());
+                setResponseObject(response);
+            } else {
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate vm");
+            }
+        } catch (ResourceUnavailableException ex) {
+            s_logger.warn("Exception: ", ex);
+            throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+        } catch (ConcurrentOperationException e) {
+            s_logger.warn("Exception: ", e);
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
+        } catch (ManagementServerException e) {
+            s_logger.warn("Exception: ", e);
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
+        } catch (VirtualMachineMigrationException e) {
+            s_logger.warn("Exception: ", e);
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/MigrateVirtualMachineWithVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/MigrateVirtualMachineWithVolumeCmd.java
new file mode 100644
index 00000000000..f9d01f6afc8
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/MigrateVirtualMachineWithVolumeCmd.java
@@ -0,0 +1,177 @@
+// 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.vm;
+
+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.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.HostResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ManagementServerException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.exception.VirtualMachineMigrationException;
+import com.cloud.host.Host;
+import com.cloud.user.Account;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "migrateVirtualMachineWithVolume",
+            description = "Attempts Migration of a VM with its volumes to a different host",
+        responseObject = UserVmResponse.class, entityType = {VirtualMachine.class},
+            requestHasSensitiveInfo = false,
+            responseHasSensitiveInfo = true)
+public class MigrateVirtualMachineWithVolumeCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(MigrateVMCmd.class.getName());
+
+    private static final String s_name = "migratevirtualmachinewithvolumeresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.HOST_ID,
+               type = CommandType.UUID,
+               entityType = HostResponse.class,
+               required = true,
+               description = "Destination Host ID to migrate VM to.")
+    private Long hostId;
+
+    @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
+               type = CommandType.UUID,
+               entityType = UserVmResponse.class,
+               required = true,
+               description = "the ID of the virtual machine")
+    private Long virtualMachineId;
+
+    @Parameter(name = ApiConstants.MIGRATE_TO,
+               type = CommandType.MAP,
+               required = false,
+               description = "Storage to pool mapping. This parameter specifies the mapping between a volume and a pool where you want to migrate that volume. Format of this " +
+               "parameter: migrateto[volume-index].volume=<uuid>&migrateto[volume-index].pool=<uuid>Where, [volume-index] indicates the index to identify the volume that you " +
+               "want to migrate, volume=<uuid> indicates the UUID of the volume that you want to migrate, and pool=<uuid> indicates the UUID of the pool where you want to " +
+               "migrate the volume. Example: migrateto[0].volume=<71f43cd6-69b0-4d3b-9fbc-67f50963d60b>&migrateto[0].pool=<a382f181-3d2b-4413-b92d-b8931befa7e1>&" +
+               "migrateto[1].volume=<88de0173-55c0-4c1c-a269-83d0279eeedf>&migrateto[1].pool=<95d6e97c-6766-4d67-9a30-c449c15011d1>&migrateto[2].volume=" +
+               "<1b331390-59f2-4796-9993-bf11c6e76225>&migrateto[2].pool=<41fdb564-9d3b-447d-88ed-7628f7640cbc>")
+    private Map migrateVolumeTo;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getHostId() {
+        return hostId;
+    }
+
+    public Long getVirtualMachineId() {
+        return virtualMachineId;
+    }
+
+    public Map<String, String> getVolumeToPool() {
+        Map<String, String> volumeToPoolMap = new HashMap<String, String>();
+        if (migrateVolumeTo != null && !migrateVolumeTo.isEmpty()) {
+            Collection<?> allValues = migrateVolumeTo.values();
+            Iterator<?> iter = allValues.iterator();
+            while (iter.hasNext()) {
+                HashMap<String, String> volumeToPool = (HashMap<String, String>)iter.next();
+                String volume = volumeToPool.get("volume");
+                String pool = volumeToPool.get("pool");
+                volumeToPoolMap.put(volume, pool);
+            }
+        }
+        return volumeToPoolMap;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        UserVm userVm = _entityMgr.findById(UserVm.class, getVirtualMachineId());
+        if (userVm != null) {
+            return userVm.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VM_MIGRATE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "Attempting to migrate VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId()) + " to host Id: " + this._uuidMgr.getUuid(Host.class, getHostId());
+    }
+
+    @Override
+    public void execute() {
+        UserVm userVm = _userVmService.getUserVm(getVirtualMachineId());
+        if (userVm == null) {
+            throw new InvalidParameterValueException("Unable to find the VM by id=" + getVirtualMachineId());
+        }
+
+        Host destinationHost = _resourceService.getHost(getHostId());
+        if (destinationHost == null) {
+            throw new InvalidParameterValueException("Unable to find the host to migrate the VM, host id =" + getHostId());
+        }
+
+        try {
+            VirtualMachine migratedVm = _userVmService.migrateVirtualMachineWithVolume(getVirtualMachineId(), destinationHost, getVolumeToPool());
+            if (migratedVm != null) {
+                UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", (UserVm)migratedVm).get(0);
+                response.setResponseName(getCommandName());
+                setResponseObject(response);
+            } else {
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate vm");
+            }
+        } catch (ResourceUnavailableException ex) {
+            s_logger.warn("Exception: ", ex);
+            throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+        } catch (ConcurrentOperationException e) {
+            s_logger.warn("Exception: ", e);
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
+        } catch (ManagementServerException e) {
+            s_logger.warn("Exception: ", e);
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
+        } catch (VirtualMachineMigrationException e) {
+            s_logger.warn("Exception: ", e);
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RebootVMCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RebootVMCmdByAdmin.java
new file mode 100644
index 00000000000..c32f9ac0e76
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RebootVMCmdByAdmin.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 org.apache.cloudstack.api.command.admin.vm;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.vm.RebootVMCmd;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "rebootVirtualMachine", description = "Reboots a virtual machine.", responseObject = UserVmResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+public class RebootVMCmdByAdmin extends RebootVMCmd {
+    public static final Logger s_logger = Logger.getLogger(RebootVMCmdByAdmin.class.getName());
+
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException{
+        CallContext.current().setEventDetails("Vm Id: "+this._uuidMgr.getUuid(VirtualMachine.class, getId()));
+        UserVm result;
+        result = _userVmService.rebootVirtualMachine(this);
+
+        if (result !=null){
+            UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result).get(0);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reboot vm instance");
+        }
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RemoveNicFromVMCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RemoveNicFromVMCmdByAdmin.java
new file mode 100644
index 00000000000..08c56df3b89
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RemoveNicFromVMCmdByAdmin.java
@@ -0,0 +1,57 @@
+// 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.vm;
+
+import java.util.ArrayList;
+import java.util.EnumSet;
+
+import com.cloud.vm.Nic;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants.VMDetails;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.vm.RemoveNicFromVMCmd;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "removeNicFromVirtualMachine", description = "Removes VM from specified network by deleting a NIC", responseObject = UserVmResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+public class RemoveNicFromVMCmdByAdmin extends RemoveNicFromVMCmd {
+    public static final Logger s_logger = Logger.getLogger(RemoveNicFromVMCmdByAdmin.class);
+
+    @Override
+    public void execute(){
+        CallContext.current().setEventDetails("Vm Id: "+this._uuidMgr.getUuid(VirtualMachine.class, getVmId()) + " Nic Id: " + this._uuidMgr.getUuid(Nic.class, getNicId()));
+        UserVm result = _userVmService.removeNicFromVirtualMachine(this);
+        ArrayList<VMDetails> dc = new ArrayList<VMDetails>();
+        dc.add(VMDetails.valueOf("nics"));
+        EnumSet<VMDetails> details = EnumSet.copyOf(dc);
+        if (result != null){
+            UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", details, result).get(0);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove NIC from vm, see error log for details");
+        }
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/ResetVMPasswordCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ResetVMPasswordCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/vm/ResetVMPasswordCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ResetVMPasswordCmdByAdmin.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/ResetVMSSHKeyCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ResetVMSSHKeyCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/vm/ResetVMSSHKeyCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ResetVMSSHKeyCmdByAdmin.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RestoreVMCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RestoreVMCmdByAdmin.java
new file mode 100644
index 00000000000..f607fafdf23
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RestoreVMCmdByAdmin.java
@@ -0,0 +1,57 @@
+// 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.vm;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.vm.RestoreVMCmd;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "restoreVirtualMachine", description = "Restore a VM to original template/ISO or new template/ISO", responseObject = UserVmResponse.class, since = "3.0.0", responseView = ResponseView.Full, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false,
+        responseHasSensitiveInfo = true)
+public class RestoreVMCmdByAdmin extends RestoreVMCmd {
+    public static final Logger s_logger = Logger.getLogger(RestoreVMCmdByAdmin.class);
+
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
+            ResourceAllocationException {
+        UserVm result;
+        CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()));
+        result = _userVmService.restoreVM(this);
+        if (result != null) {
+            UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result).get(0);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to restore vm " + getVmId());
+        }
+    }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/ScaleVMCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ScaleVMCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/vm/ScaleVMCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ScaleVMCmdByAdmin.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/StartVMCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/StartVMCmdByAdmin.java
new file mode 100644
index 00000000000..1230547ddc9
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/StartVMCmdByAdmin.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.command.admin.vm;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.vm.StartVMCmd;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+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;
+import com.cloud.uservm.UserVm;
+import com.cloud.utils.exception.ExecutionException;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "startVirtualMachine", responseObject = UserVmResponse.class, description = "Starts a virtual machine.", responseView = ResponseView.Full, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+public class StartVMCmdByAdmin extends StartVMCmd {
+    public static final Logger s_logger = Logger.getLogger(StartVMCmdByAdmin.class.getName());
+
+
+    @Override
+    public void execute() throws ResourceUnavailableException, ResourceAllocationException {
+        try {
+            CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
+
+            UserVm result ;
+            result = _userVmService.startVirtualMachine(this);
+
+            if (result != null) {
+                UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result).get(0);
+                response.setResponseName(getCommandName());
+                setResponseObject(response);
+            } else {
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to start a vm");
+            }
+        } catch (ConcurrentOperationException ex) {
+            s_logger.warn("Exception: ", ex);
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
+        } catch (StorageUnavailableException ex) {
+            s_logger.warn("Exception: ", ex);
+            throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+        } 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/main/java/org/apache/cloudstack/api/command/admin/vm/StopVMCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/StopVMCmdByAdmin.java
new file mode 100644
index 00000000000..ca85dfacb2c
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/StopVMCmdByAdmin.java
@@ -0,0 +1,55 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.vm;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.vm.StopVMCmd;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "stopVirtualMachine", responseObject = UserVmResponse.class, description = "Stops a virtual machine.", responseView = ResponseView.Full, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+public class StopVMCmdByAdmin extends StopVMCmd {
+    public static final Logger s_logger = Logger.getLogger(StopVMCmdByAdmin.class.getName());
+
+
+
+    @Override
+    public void execute() throws ServerApiException, ConcurrentOperationException {
+        CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
+        UserVm result;
+
+        result = _userVmService.stopVirtualMachine(getId(), isForced());
+
+        if (result != null) {
+            UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result).get(0);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to stop vm");
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/UpdateDefaultNicForVMCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/UpdateDefaultNicForVMCmdByAdmin.java
new file mode 100644
index 00000000000..d666ae40cdb
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/UpdateDefaultNicForVMCmdByAdmin.java
@@ -0,0 +1,58 @@
+// 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.vm;
+
+import java.util.ArrayList;
+import java.util.EnumSet;
+
+import com.cloud.vm.Nic;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants.VMDetails;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.vm.UpdateDefaultNicForVMCmd;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "updateDefaultNicForVirtualMachine", description = "Changes the default NIC on a VM", responseObject = UserVmResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+public class UpdateDefaultNicForVMCmdByAdmin extends UpdateDefaultNicForVMCmd {
+    public static final Logger s_logger = Logger.getLogger(UpdateDefaultNicForVMCmdByAdmin.class);
+
+
+    @Override
+    public void execute(){
+        CallContext.current().setEventDetails("Vm Id: "+this._uuidMgr.getUuid(VirtualMachine.class, getVmId()) + " Nic Id: " + this._uuidMgr.getUuid(Nic.class, getNicId()));
+        UserVm result = _userVmService.updateDefaultNicForVirtualMachine(this);
+        ArrayList<VMDetails> dc = new ArrayList<VMDetails>();
+        dc.add(VMDetails.valueOf("nics"));
+        EnumSet<VMDetails> details = EnumSet.copyOf(dc);
+        if (result != null){
+            UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", details, result).get(0);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to set default nic for VM. Refer to server logs for details.");
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/UpdateVMCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/UpdateVMCmdByAdmin.java
new file mode 100644
index 00000000000..5d2b2b78cf3
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/UpdateVMCmdByAdmin.java
@@ -0,0 +1,55 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.vm;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.vm.UpdateVMCmd;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
+
+
+@APICommand(name = "updateVirtualMachine", description="Updates properties of a virtual machine. The VM has to be stopped and restarted for the " +
+        "new properties to take effect. UpdateVirtualMachine does not first check whether the VM is stopped. " +
+        "Therefore, stop the VM manually before issuing this call.", responseObject = UserVmResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+public class UpdateVMCmdByAdmin extends UpdateVMCmd {
+    public static final Logger s_logger = Logger.getLogger(UpdateVMCmdByAdmin.class.getName());
+
+    @Override
+    public void execute() throws ResourceUnavailableException,
+            InsufficientCapacityException, ServerApiException {
+        CallContext.current().setEventDetails("Vm Id: "+this._uuidMgr.getUuid(VirtualMachine.class, getId()));
+        UserVm result = _userVmService.updateVirtualMachine(this);
+        if (result != null){
+            UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result).get(0);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update vm");
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/UpgradeVMCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/UpgradeVMCmdByAdmin.java
new file mode 100644
index 00000000000..6e3261aa41c
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/UpgradeVMCmdByAdmin.java
@@ -0,0 +1,61 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.vm;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.vm.UpgradeVMCmd;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.offering.ServiceOffering;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "changeServiceForVirtualMachine", responseObject=UserVmResponse.class, description="Changes the service offering for a virtual machine. " +
+                                            "The virtual machine must be in a \"Stopped\" state for " +
+        "this command to take effect.", responseView = ResponseView.Full, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+public class UpgradeVMCmdByAdmin extends UpgradeVMCmd {
+    public static final Logger s_logger = Logger.getLogger(UpgradeVMCmdByAdmin.class.getName());
+
+
+    @Override
+    public void execute() throws ResourceAllocationException{
+        CallContext.current().setEventDetails("Vm Id: "+this._uuidMgr.getUuid(VirtualMachine.class, getId()));
+
+        ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
+        if (serviceOffering == null) {
+            throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId);
+        }
+
+        UserVm result = _userVmService.upgradeVirtualMachine(this);
+        if (result != null){
+            UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result).get(0);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade vm");
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vmsnapshot/RevertToVMSnapshotCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vmsnapshot/RevertToVMSnapshotCmdByAdmin.java
new file mode 100644
index 00000000000..47cb99b3e17
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vmsnapshot/RevertToVMSnapshotCmdByAdmin.java
@@ -0,0 +1,59 @@
+// 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.vmsnapshot;
+
+import java.util.logging.Logger;
+
+import com.cloud.vm.snapshot.VMSnapshot;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.vmsnapshot.RevertToVMSnapshotCmd;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.uservm.UserVm;
+
+@APICommand(name = "revertToVMSnapshot", description = "Revert VM from a vmsnapshot.", responseObject = UserVmResponse.class, since = "4.2.0", responseView = ResponseView.Full,
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+public class RevertToVMSnapshotCmdByAdmin extends RevertToVMSnapshotCmd {
+    public static final Logger s_logger = Logger
+            .getLogger(RevertToVMSnapshotCmdByAdmin.class.getName());
+
+
+    @Override
+    public void execute() throws  ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException, ConcurrentOperationException {
+        CallContext.current().setEventDetails(
+                "vmsnapshot id: " + this._uuidMgr.getUuid(VMSnapshot.class, getVmSnapShotId()));
+        UserVm result = _vmSnapshotService.revertToSnapshot(getVmSnapShotId());
+        if (result != null) {
+            UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full,
+                    "virtualmachine", result).get(0);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"Failed to revert VM snapshot");
+        }
+    }
+
+
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/AttachVolumeCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/AttachVolumeCmdByAdmin.java
new file mode 100644
index 00000000000..f70b41086d5
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/AttachVolumeCmdByAdmin.java
@@ -0,0 +1,49 @@
+// 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.volume;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.storage.Volume;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "attachVolume", description = "Attaches a disk volume to a virtual machine.", responseObject = VolumeResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class AttachVolumeCmdByAdmin extends AttachVolumeCmd {
+    public static final Logger s_logger = Logger.getLogger(AttachVolumeCmdByAdmin.class.getName());
+
+    @Override
+    public void execute(){
+        CallContext.current().setEventDetails("Volume Id: "+this._uuidMgr.getUuid(Volume.class, getId())+" VmId: "+this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId()));
+        Volume result = _volumeService.attachVolumeToVM(this);
+        if (result != null) {
+            VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, result);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to attach volume");
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/CreateVolumeCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/CreateVolumeCmdByAdmin.java
new file mode 100644
index 00000000000..1dc4721a4c2
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/CreateVolumeCmdByAdmin.java
@@ -0,0 +1,64 @@
+// 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.volume;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.storage.Snapshot;
+import com.cloud.storage.Volume;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "createVolume", responseObject = VolumeResponse.class, description = "Creates a disk volume from a disk offering. This disk volume must still be attached to a virtual machine to make use of it.", responseView = ResponseView.Full, entityType = {
+        Volume.class, VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class CreateVolumeCmdByAdmin extends CreateVolumeCmd {
+    public static final Logger s_logger = Logger.getLogger(CreateVolumeCmdByAdmin.class.getName());
+
+    @Override
+    public void execute(){
+        CallContext.current().setEventDetails("Volume Id: "+ getEntityUuid() + ((getSnapshotId() == null) ? "" : " from snapshot: " + this._uuidMgr.getUuid(Snapshot.class, getSnapshotId())));
+        Volume volume = _volumeService.createVolume(this);
+        if (volume != null) {
+            VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, volume);
+            //FIXME - have to be moved to ApiResponseHelper
+            if (getSnapshotId() != null) {
+                Snapshot snap = _entityMgr.findById(Snapshot.class, getSnapshotId());
+                if (snap != null) {
+                    response.setSnapshotId(snap.getUuid()); // if the volume was
+                    // created from a
+                    // snapshot,
+                    // snapshotId will
+                    // be set so we pass
+                    // it back in the
+                    // response
+                }
+            }
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a volume");
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/DetachVolumeCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/DetachVolumeCmdByAdmin.java
new file mode 100644
index 00000000000..f9d9cbd65ed
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/DetachVolumeCmdByAdmin.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 org.apache.cloudstack.api.command.admin.volume;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.storage.Volume;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "detachVolume", description = "Detaches a disk volume from a virtual machine.", responseObject = VolumeResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class DetachVolumeCmdByAdmin extends DetachVolumeCmd {
+    public static final Logger s_logger = Logger.getLogger(DetachVolumeCmdByAdmin.class.getName());
+
+
+    @Override
+    public void execute(){
+        CallContext.current().setEventDetails(getEventDescription());
+        Volume result = _volumeService.detachVolumeFromVM(this);
+        if (result != null){
+            VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, result);
+            response.setResponseName("volume");
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to detach volume");
+        }
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/volume/ListVolumesCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/ListVolumesCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/volume/ListVolumesCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/volume/ListVolumesCmdByAdmin.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/MigrateVolumeCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/MigrateVolumeCmdByAdmin.java
new file mode 100644
index 00000000000..1a18b95e211
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/MigrateVolumeCmdByAdmin.java
@@ -0,0 +1,44 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.volume;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.volume.MigrateVolumeCmd;
+import org.apache.cloudstack.api.response.VolumeResponse;
+
+import com.cloud.storage.Volume;
+
+@APICommand(name = "migrateVolume", description = "Migrate volume", responseObject = VolumeResponse.class, since = "3.0.0", responseView = ResponseView.Full, entityType = {
+        Volume.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class MigrateVolumeCmdByAdmin extends MigrateVolumeCmd {
+
+    @Override
+    public void execute() {
+        Volume result = _volumeService.migrateVolume(this);
+        if (result != null) {
+            VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, result);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate volume");
+        }
+    }
+
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/ResizeVolumeCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/ResizeVolumeCmdByAdmin.java
new file mode 100644
index 00000000000..689e779f0f4
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/ResizeVolumeCmdByAdmin.java
@@ -0,0 +1,56 @@
+// 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.volume;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.storage.Volume;
+
+
+@APICommand(name = "resizeVolume", description = "Resizes a volume", responseObject = VolumeResponse.class, responseView = ResponseView.Full, entityType = {Volume.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class ResizeVolumeCmdByAdmin extends ResizeVolumeCmd {
+
+    @Override
+    public void execute() throws ResourceAllocationException{
+        Volume volume = null;
+        try {
+            CallContext.current().setEventDetails("Volume Id: " + this._uuidMgr.getUuid(Volume.class, getEntityId()) + " to size " + getSize() + "G");
+            volume = _volumeService.resizeVolume(this);
+        } catch (InvalidParameterValueException ex) {
+            s_logger.info(ex.getMessage());
+            throw new ServerApiException(ApiErrorCode.UNSUPPORTED_ACTION_ERROR, ex.getMessage());
+        }
+
+        if (volume != null) {
+            VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, volume);
+            //FIXME - have to be moved to ApiResponseHelper
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to resize volume");
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/UpdateVolumeCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/UpdateVolumeCmdByAdmin.java
new file mode 100644
index 00000000000..b683435f565
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/UpdateVolumeCmdByAdmin.java
@@ -0,0 +1,46 @@
+// 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.volume;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.volume.UpdateVolumeCmd;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.storage.Volume;
+
+@APICommand(name = "updateVolume", description = "Updates the volume.", responseObject = VolumeResponse.class, responseView = ResponseView.Full, entityType = {Volume.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class UpdateVolumeCmdByAdmin extends UpdateVolumeCmd {
+
+    @Override
+    public void execute(){
+        CallContext.current().setEventDetails("Volume Id: "+this._uuidMgr.getUuid(Volume.class, getId()));
+        Volume result = _volumeService.updateVolume(getId(), getPath(), getState(), getStorageId(), getDisplayVolume(),
+                getCustomId(), getEntityOwnerId(), getChainInfo());
+        if (result != null) {
+            VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, 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/command/admin/volume/UploadVolumeCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/UploadVolumeCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/volume/UploadVolumeCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/volume/UploadVolumeCmdByAdmin.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/CreateVPCCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/CreateVPCCmdByAdmin.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/ListVPCsCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/ListVPCsCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/vpc/ListVPCsCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/ListVPCsCmdByAdmin.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCCmdByAdmin.java
new file mode 100644
index 00000000000..d7761def204
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCCmdByAdmin.java
@@ -0,0 +1,48 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.vpc;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.vpc.UpdateVPCCmd;
+import org.apache.cloudstack.api.response.VpcResponse;
+
+import com.cloud.network.vpc.Vpc;
+
+@APICommand(name = "updateVPC", description = "Updates a VPC", responseObject = VpcResponse.class, responseView = ResponseView.Full, entityType = {Vpc.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class UpdateVPCCmdByAdmin extends UpdateVPCCmd {
+    public static final Logger s_logger = Logger.getLogger(UpdateVPCCmdByAdmin.class.getName());
+
+    @Override
+    public void execute(){
+        Vpc result = _vpcService.updateVpc(getId(), getVpcName(), getDisplayText(), getCustomId(), isDisplayVpc());
+        if (result != null) {
+            VpcResponse response = _responseGenerator.createVpcResponse(ResponseView.Full, result);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update VPC");
+        }
+    }
+
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/zone/ListZonesCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/zone/ListZonesCmdByAdmin.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/zone/ListZonesCmdByAdmin.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/zone/ListZonesCmdByAdmin.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java
new file mode 100644
index 00000000000..d590081104a
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java
@@ -0,0 +1,200 @@
+// 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.address;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiCommandJobType;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.response.IPAddressResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
+import org.apache.cloudstack.api.response.VlanIpRangeResponse;
+import org.apache.cloudstack.api.response.VpcResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+
+import com.cloud.network.IpAddress;
+import com.cloud.utils.Pair;
+
+@APICommand(name = "listPublicIpAddresses", description = "Lists all public IP addresses", responseObject = IPAddressResponse.class, responseView = ResponseView.Restricted,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, entityType = { IpAddress.class })
+public class ListPublicIpAddressesCmd extends BaseListTaggedResourcesCmd {
+    public static final Logger s_logger = Logger.getLogger(ListPublicIpAddressesCmd.class.getName());
+
+    private static final String s_name = "listpublicipaddressesresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ALLOCATED_ONLY, type = CommandType.BOOLEAN, description = "limits search results to allocated public IP addresses")
+    private Boolean allocatedOnly;
+
+    @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "lists all public IP addresses by state")
+    private String state;
+
+    @Parameter(name = ApiConstants.FOR_VIRTUAL_NETWORK, type = CommandType.BOOLEAN, description = "the virtual network for the IP address")
+    private Boolean forVirtualNetwork;
+
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = IPAddressResponse.class, description = "lists IP address by ID")
+    private Long id;
+
+    @Parameter(name = ApiConstants.IP_ADDRESS, type = CommandType.STRING, description = "lists the specified IP address")
+    private String ipAddress;
+
+    @Parameter(name = ApiConstants.VLAN_ID, type = CommandType.UUID, entityType = VlanIpRangeResponse.class, description = "lists all public IP addresses by VLAN ID")
+    private Long vlanId;
+
+    @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "lists all public IP addresses by zone ID")
+    private Long zoneId;
+
+    @Parameter(name = ApiConstants.FOR_LOAD_BALANCING, type = CommandType.BOOLEAN, description = "list only IPs used for load balancing")
+    private Boolean forLoadBalancing;
+
+    @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID,
+               type = CommandType.UUID,
+               entityType = PhysicalNetworkResponse.class,
+               description = "lists all public IP addresses by physical network ID")
+    private Long physicalNetworkId;
+
+    @Parameter(name = ApiConstants.ASSOCIATED_NETWORK_ID,
+               type = CommandType.UUID,
+               entityType = NetworkResponse.class,
+               description = "lists all public IP addresses associated to the network specified")
+    private Long associatedNetworkId;
+
+    @Parameter(name = ApiConstants.IS_SOURCE_NAT, type = CommandType.BOOLEAN, description = "list only source NAT IP addresses")
+    private Boolean isSourceNat;
+
+    @Parameter(name = ApiConstants.IS_STATIC_NAT, type = CommandType.BOOLEAN, description = "list only static NAT IP addresses")
+    private Boolean isStaticNat;
+
+    @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "List IPs belonging to the VPC")
+    private Long vpcId;
+
+    @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin})
+    private Boolean display;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+    public Long getId() {
+        return id;
+    }
+
+    public Boolean isAllocatedOnly() {
+        return allocatedOnly;
+    }
+
+    public Boolean isForVirtualNetwork() {
+        return forVirtualNetwork;
+    }
+
+    public String getIpAddress() {
+        return ipAddress;
+    }
+
+    public Long getVlanId() {
+        return vlanId;
+    }
+
+    public Long getZoneId() {
+        return zoneId;
+    }
+
+    public Long getPhysicalNetworkId() {
+        return physicalNetworkId;
+    }
+
+    public Long getAssociatedNetworkId() {
+        return associatedNetworkId;
+    }
+
+    public Boolean isSourceNat() {
+        return isSourceNat;
+    }
+
+    public Boolean isStaticNat() {
+        return isStaticNat;
+    }
+
+    public Long getVpcId() {
+        return vpcId;
+    }
+
+    @Override
+    public Boolean getDisplay() {
+        if (display != null) {
+            return display;
+        }
+        return super.getDisplay();
+    }
+
+    public Boolean isForLoadBalancing() {
+        return forLoadBalancing;
+    }
+
+    public Boolean getForVirtualNetwork() {
+        return forVirtualNetwork;
+    }
+
+    public Boolean getForLoadBalancing() {
+        return forLoadBalancing;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public void execute() {
+        Pair<List<? extends IpAddress>, Integer> result = _mgr.searchForIPAddresses(this);
+        ListResponse<IPAddressResponse> response = new ListResponse<IPAddressResponse>();
+        List<IPAddressResponse> ipAddrResponses = new ArrayList<IPAddressResponse>();
+        for (IpAddress ipAddress : result.first()) {
+            IPAddressResponse ipResponse = _responseGenerator.createIPAddressResponse(ResponseView.Restricted, ipAddress);
+            ipResponse.setObjectName("publicipaddress");
+            ipAddrResponses.add(ipResponse);
+        }
+
+        response.setResponses(ipAddrResponses, result.second());
+        response.setResponseName(getCommandName());
+        setResponseObject(response);
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.IpAddress;
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/address/UpdateIPAddrCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/address/UpdateIPAddrCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/address/UpdateIPAddrCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/address/UpdateIPAddrCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/CreateAffinityGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/affinitygroup/CreateAffinityGroupCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/affinitygroup/CreateAffinityGroupCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/affinitygroup/CreateAffinityGroupCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/DeleteAffinityGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/affinitygroup/DeleteAffinityGroupCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/affinitygroup/DeleteAffinityGroupCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/affinitygroup/DeleteAffinityGroupCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupTypesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupTypesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupTypesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupTypesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/UpdateVMAffinityGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/affinitygroup/UpdateVMAffinityGroupCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/affinitygroup/UpdateVMAffinityGroupCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/affinitygroup/UpdateVMAffinityGroupCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/event/ArchiveEventsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/event/ArchiveEventsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/event/ArchiveEventsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/event/ArchiveEventsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/event/DeleteEventsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/event/DeleteEventsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/event/DeleteEventsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/event/DeleteEventsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/event/ListEventTypesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/event/ListEventTypesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/event/ListEventTypesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/event/ListEventTypesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/event/ListEventsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/event/ListEventsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/event/ListEventsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/event/ListEventsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/CreateEgressFirewallRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreateEgressFirewallRuleCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/firewall/CreateEgressFirewallRuleCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreateEgressFirewallRuleCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java
new file mode 100644
index 00000000000..02c425553d8
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java
@@ -0,0 +1,361 @@
+// 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.firewall;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.RoleType;
+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.FirewallResponse;
+import org.apache.cloudstack.api.response.IPAddressResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.NetworkRuleConflictException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.IpAddress;
+import com.cloud.network.rules.FirewallRule;
+import com.cloud.user.Account;
+import com.cloud.utils.net.NetUtils;
+
+@APICommand(name = "createFirewallRule", description = "Creates a firewall rule for a given IP address", responseObject = FirewallResponse.class, entityType = {FirewallRule.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements FirewallRule {
+    public static final Logger s_logger = Logger.getLogger(CreateFirewallRuleCmd.class.getName());
+
+    private static final String s_name = "createfirewallruleresponse";
+
+    // ///////////////////////////////////////////////////
+    // ////////////// API parameters /////////////////////
+    // ///////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.IP_ADDRESS_ID,
+               type = CommandType.UUID,
+               entityType = IPAddressResponse.class,
+               required = true,
+               description = "the IP address id of the port forwarding rule")
+    private Long ipAddressId;
+
+    @Parameter(name = ApiConstants.PROTOCOL,
+               type = CommandType.STRING,
+               required = true,
+               description = "the protocol for the firewall rule. Valid values are TCP/UDP/ICMP.")
+    private String protocol;
+
+    @Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "the starting port of firewall rule")
+    private Integer publicStartPort;
+
+    @Parameter(name = ApiConstants.END_PORT, type = CommandType.INTEGER, description = "the ending port of firewall rule")
+    private Integer publicEndPort;
+
+    @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "the CIDR list to forward traffic from")
+    private List<String> 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.TYPE, type = CommandType.STRING, description = "type of firewallrule: system/user")
+    private String type;
+
+    @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin})
+    private Boolean display;
+
+    // ///////////////////////////////////////////////////
+    // ///////////////// Accessors ///////////////////////
+    // ///////////////////////////////////////////////////
+
+
+    public Long getIpAddressId() {
+        return ipAddressId;
+    }
+
+    @Override
+    public String getProtocol() {
+        return protocol.trim();
+    }
+
+    @Override
+    public List<String> getSourceCidrList() {
+        if (cidrlist != null) {
+            return cidrlist;
+        } else {
+            List<String> oneCidrList = new ArrayList<String>();
+            oneCidrList.add(NetUtils.ALL_IP4_CIDRS);
+            return oneCidrList;
+        }
+
+    }
+
+    // ///////////////////////////////////////////////////
+    // ///////////// API Implementation///////////////////
+    // ///////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public void setSourceCidrList(List<String> cidrs) {
+        cidrlist = cidrs;
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException {
+        CallContext callerContext = CallContext.current();
+        boolean success = false;
+        FirewallRule rule = _entityMgr.findById(FirewallRule.class, getEntityId());
+        try {
+            CallContext.current().setEventDetails("Rule ID: " + getEntityId());
+            success = _firewallService.applyIngressFwRules(rule.getSourceIpAddressId(), callerContext.getCallingAccount());
+
+            // State is different after the rule is applied, so get new object here
+            rule = _entityMgr.findById(FirewallRule.class, getEntityId());
+            FirewallResponse fwResponse = new FirewallResponse();
+            if (rule != null) {
+                fwResponse = _responseGenerator.createFirewallResponse(rule);
+                setResponseObject(fwResponse);
+            }
+            fwResponse.setResponseName(getCommandName());
+        } finally {
+            if (!success || rule == null) {
+                _firewallService.revokeIngressFwRule(getEntityId(), true);
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create firewall rule");
+            }
+        }
+    }
+
+    @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 ipAddressId;
+    }
+
+    @Override
+    public Integer getSourcePortStart() {
+        if (publicStartPort != null) {
+            return publicStartPort;
+        }
+        return null;
+    }
+
+    @Override
+    public Integer getSourcePortEnd() {
+        if (publicEndPort == null) {
+            if (publicStartPort != null) {
+                return publicStartPort;
+            }
+        } else {
+            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() {
+        IpAddress ip = _entityMgr.findById(IpAddress.class, getIpAddressId());
+        Long ntwkId = null;
+
+        if (ip.getAssociatedWithNetworkId() != null) {
+            ntwkId = ip.getAssociatedWithNetworkId();
+        }
+
+        if (ntwkId == null) {
+            throw new InvalidParameterValueException("Unable to create firewall rule for the IP address ID=" + ipAddressId +
+                    " as IP is not associated with any network and no networkId is passed in");
+        }
+        return ntwkId;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Account account = CallContext.current().getCallingAccount();
+
+        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 long getDomainId() {
+        IpAddress ip = _networkService.getIp(ipAddressId);
+        return ip.getDomainId();
+    }
+
+    @Override
+    public void create() {
+        if (getSourceCidrList() != null) {
+            for (String cidr : getSourceCidrList()) {
+                if (!NetUtils.isValidIp4Cidr(cidr) && !NetUtils.isValidIp6Cidr(cidr)) {
+                    throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Source CIDRs formatting error " + cidr);
+                }
+            }
+        }
+        try {
+            FirewallRule result = _firewallService.createIngressFirewallRule(this);
+            if (result != null) {
+                setEntityId(result.getId());
+                setEntityUuid(result.getUuid());
+            }
+        } catch (NetworkRuleConflictException ex) {
+            s_logger.trace("Network Rule Conflict: ", ex);
+            throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage(), ex);
+        }
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_FIREWALL_OPEN;
+    }
+
+    @Override
+    public String getEventDescription() {
+        IpAddress ip = _networkService.getIp(ipAddressId);
+        return ("Creating firewall rule for IP: " + ip.getAddress() + " for protocol:" + getProtocol());
+    }
+
+    @Override
+    public long getAccountId() {
+        IpAddress ip = _networkService.getIp(ipAddressId);
+        return ip.getAccountId();
+    }
+
+    @Override
+    public String getSyncObjType() {
+        return BaseAsyncCmd.networkSyncObject;
+    }
+
+    @Override
+    public Long getSyncObjId() {
+        return getIp().getAssociatedWithNetworkId();
+    }
+
+    private IpAddress getIp() {
+        IpAddress ip = _networkService.getIp(ipAddressId);
+        if (ip == null) {
+            throw new InvalidParameterValueException("Unable to find IP address by ID " + ipAddressId);
+        }
+        return ip;
+    }
+
+    @Override
+    public Integer getIcmpCode() {
+        if (icmpCode != null) {
+            return icmpCode;
+        } else if (protocol.equalsIgnoreCase(NetUtils.ICMP_PROTO)) {
+            return -1;
+        }
+        return null;
+    }
+
+    @Override
+    public Integer getIcmpType() {
+        if (icmpType != null) {
+            return icmpType;
+        } else if (protocol.equalsIgnoreCase(NetUtils.ICMP_PROTO)) {
+                return -1;
+
+        }
+        return null;
+    }
+
+    @Override
+    public Long getRelated() {
+        return null;
+    }
+
+    @Override
+    public FirewallRuleType getType() {
+        if (type != null && type.equalsIgnoreCase("system")) {
+            return FirewallRuleType.System;
+        } else {
+            return FirewallRuleType.User;
+        }
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.FirewallRule;
+    }
+
+    @Override
+    public TrafficType getTrafficType() {
+        return FirewallRule.TrafficType.Ingress;
+    }
+
+    @Override
+    public boolean isDisplay() {
+        if (display != null) {
+            return display;
+        } else {
+            return true;
+        }
+    }
+
+    @Override
+    public List<String> getDestinationCidrList(){
+        return null;
+    }
+
+    @Override
+    public Class<?> getEntityType() {
+        return FirewallRule.class;
+    }
+
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java
new file mode 100644
index 00000000000..ff11395ee37
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java
@@ -0,0 +1,450 @@
+// 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.firewall;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.ACL;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.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.FirewallRuleResponse;
+import org.apache.cloudstack.api.response.IPAddressResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.NetworkRuleConflictException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.IpAddress;
+import com.cloud.network.rules.FirewallRule;
+import com.cloud.network.rules.PortForwardingRule;
+import com.cloud.user.Account;
+import com.cloud.utils.net.Ip;
+import com.cloud.utils.net.NetUtils;
+import com.cloud.vm.VirtualMachine;
+
+
+@APICommand(name = "createPortForwardingRule", description = "Creates a port forwarding rule", responseObject = FirewallRuleResponse.class, entityType = {FirewallRule.class,
+        VirtualMachine.class, IpAddress.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements PortForwardingRule {
+    public static final Logger s_logger = Logger.getLogger(CreatePortForwardingRuleCmd.class.getName());
+
+    private static final String s_name = "createportforwardingruleresponse";
+
+    // ///////////////////////////////////////////////////
+    // ////////////// API parameters /////////////////////
+    // ///////////////////////////////////////////////////
+
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name = ApiConstants.IP_ADDRESS_ID,
+               type = CommandType.UUID,
+               entityType = IPAddressResponse.class,
+            required = true,
+    description = "the IP address id of the port forwarding rule")
+    private Long ipAddressId;
+
+    @Parameter(name = ApiConstants.PRIVATE_START_PORT,
+               type = CommandType.INTEGER,
+               required = true,
+            description = "the starting port of port forwarding rule's private port range")
+    private Integer privateStartPort;
+
+    @Parameter(name = ApiConstants.PROTOCOL,
+               type = CommandType.STRING,
+               required = true,
+            description = "the protocol for the port forwarding rule. Valid values are TCP or UDP.")
+    private String protocol;
+
+    @Parameter(name = ApiConstants.PRIVATE_END_PORT,
+               type = CommandType.INTEGER,
+               required = false,
+               description = "the ending port of port forwarding rule's private port range")
+    private Integer privateEndPort;
+
+    @Parameter(name = ApiConstants.PUBLIC_START_PORT,
+               type = CommandType.INTEGER,
+               required = true,
+            description = "the starting port of port forwarding rule's public port range")
+    private Integer publicStartPort;
+
+    @Parameter(name = ApiConstants.PUBLIC_END_PORT,
+               type = CommandType.INTEGER,
+               required = false,
+               description = "the ending port of port forwarding rule's private port range")
+    private Integer publicEndPort;
+
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
+               type = CommandType.UUID,
+               entityType = UserVmResponse.class,
+            required = true,
+                description = "the ID of the virtual machine for the port forwarding rule")
+    private Long virtualMachineId;
+
+    @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "the cidr list to forward traffic from")
+    private List<String> cidrlist;
+
+    @Parameter(name = ApiConstants.OPEN_FIREWALL, type = CommandType.BOOLEAN, description = "if true, firewall rule for source/end public port is automatically created; "
+        + "if false - firewall rule has to be created explicitly. If not specified 1) defaulted to false when PF"
+        + " rule is being created for VPC guest network 2) in all other cases defaulted to true")
+    private Boolean openFirewall;
+
+    @Parameter(name = ApiConstants.NETWORK_ID,
+               type = CommandType.UUID,
+               entityType = NetworkResponse.class,
+               description = "the network of the virtual machine the port forwarding rule will be created for. "
+                   + "Required when public IP address is not associated with any guest network yet (VPC case).")
+    private Long networkId;
+    @Parameter(name = ApiConstants.VM_GUEST_IP,
+               type = CommandType.STRING,
+               required = false,
+    description = "VM guest nic secondary IP address for the port forwarding rule")
+    private String vmSecondaryIp;
+
+    @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin})
+    private Boolean display;
+
+    // ///////////////////////////////////////////////////
+    // ///////////////// Accessors ///////////////////////
+    // ///////////////////////////////////////////////////
+
+    public Long getIpAddressId() {
+        return ipAddressId;
+    }
+
+    public Ip getVmSecondaryIp() {
+        if (vmSecondaryIp == null) {
+            return null;
+        }
+        return new Ip(vmSecondaryIp);
+    }
+
+    @Override
+    public String getProtocol() {
+        return protocol.trim();
+    }
+
+    @Override
+    public long getVirtualMachineId() {
+        return virtualMachineId;
+    }
+
+    @Override
+    public List<String> getSourceCidrList() {
+        if (cidrlist != null) {
+            throw new InvalidParameterValueException("Parameter cidrList is deprecated; if you need to open firewall "
+                + "rule for the specific cidr, please refer to createFirewallRule command");
+        }
+        return null;
+    }
+
+    public Boolean getOpenFirewall() {
+        boolean isVpc = getVpcId() == null ? false : true;
+        if (openFirewall != null) {
+            if (isVpc && openFirewall) {
+                throw new InvalidParameterValueException("Can't have openFirewall=true when IP address belongs to VPC");
+            }
+            return openFirewall;
+        } else {
+            if (isVpc) {
+                return false;
+            }
+            return true;
+        }
+    }
+
+    private Long getVpcId() {
+        if (ipAddressId != null) {
+            IpAddress ipAddr = _networkService.getIp(ipAddressId);
+            if (ipAddr == null || !ipAddr.readyToUse()) {
+                throw new InvalidParameterValueException("Unable to create PF rule, invalid IP address id " + ipAddressId);
+            } else {
+                return ipAddr.getVpcId();
+            }
+        }
+        return null;
+    }
+
+    // ///////////////////////////////////////////////////
+    // ///////////// API Implementation///////////////////
+    // ///////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException {
+        CallContext callerContext = CallContext.current();
+        boolean success = true;
+        PortForwardingRule rule = null;
+        try {
+            CallContext.current().setEventDetails("Rule Id: " + getEntityId());
+
+            if (getOpenFirewall()) {
+                success = success && _firewallService.applyIngressFirewallRules(ipAddressId, callerContext.getCallingAccount());
+            }
+
+            success = success && _rulesService.applyPortForwardingRules(ipAddressId, callerContext.getCallingAccount());
+
+            // State is different after the rule is applied, so get new object here
+            rule = _entityMgr.findById(PortForwardingRule.class, getEntityId());
+            FirewallRuleResponse fwResponse = new FirewallRuleResponse();
+            if (rule != null) {
+                fwResponse = _responseGenerator.createPortForwardingRuleResponse(rule);
+                setResponseObject(fwResponse);
+            }
+            fwResponse.setResponseName(getCommandName());
+        } finally {
+            if (!success || rule == null) {
+
+                if (getOpenFirewall()) {
+                    _firewallService.revokeRelatedFirewallRule(getEntityId(), true);
+                }
+
+                try {
+                    _rulesService.revokePortForwardingRule(getEntityId(), true);
+                } catch (Exception ex) {
+                    //Ignore e.g. failed to apply rules to device error
+                }
+
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to apply port forwarding rule");
+            }
+        }
+    }
+
+    @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 ipAddressId;
+    }
+
+    @Override
+    public Integer getSourcePortStart() {
+        return publicStartPort.intValue();
+    }
+
+    @Override
+    public Integer getSourcePortEnd() {
+        return (publicEndPort == null) ? publicStartPort.intValue() : publicEndPort.intValue();
+    }
+
+    @Override
+    public Purpose getPurpose() {
+        return Purpose.PortForwarding;
+    }
+
+    @Override
+    public State getState() {
+        throw new UnsupportedOperationException("Should never call me to find the state");
+    }
+
+    @Override
+    public long getNetworkId() {
+        IpAddress ip = _entityMgr.findById(IpAddress.class, getIpAddressId());
+        Long ntwkId = null;
+
+        if (ip.getAssociatedWithNetworkId() != null) {
+            ntwkId = ip.getAssociatedWithNetworkId();
+        } else {
+            ntwkId = networkId;
+        }
+        if (ntwkId == null) {
+            throw new InvalidParameterValueException("Unable to create port forwarding rule for the ipAddress id=" + ipAddressId +
+                    " as ip is not associated with any network and no networkId is passed in");
+        }
+        return ntwkId;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Account account = CallContext.current().getCallingAccount();
+
+        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 long getDomainId() {
+        IpAddress ip = _networkService.getIp(ipAddressId);
+        return ip.getDomainId();
+    }
+
+    @Override
+    public Ip getDestinationIpAddress() {
+        return null;
+    }
+
+    @Override
+    public void setDestinationIpAddress(Ip destinationIpAddress) {
+        return;
+    }
+
+    @Override
+    public int getDestinationPortStart() {
+        return privateStartPort.intValue();
+    }
+
+    @Override
+    public int getDestinationPortEnd() {
+        return (privateEndPort == null) ? privateStartPort.intValue() : privateEndPort.intValue();
+    }
+
+    @Override
+    public void create() {
+        // cidr list parameter is deprecated
+        if (cidrlist != null) {
+            throw new InvalidParameterValueException(
+                "Parameter cidrList is deprecated; if you need to open firewall rule for the specific cidr, please refer to createFirewallRule command");
+        }
+
+        Ip privateIp = getVmSecondaryIp();
+        if (privateIp != null) {
+            if (!NetUtils.isValidIp4(privateIp.toString())) {
+                throw new InvalidParameterValueException("Invalid vm ip address");
+            }
+        }
+
+        try {
+            PortForwardingRule result = _rulesService.createPortForwardingRule(this, virtualMachineId, privateIp, getOpenFirewall(), isDisplay());
+            setEntityId(result.getId());
+            setEntityUuid(result.getUuid());
+        } catch (NetworkRuleConflictException ex) {
+            s_logger.trace("Network Rule Conflict: ", ex);
+            throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage(), ex);
+        }
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_NET_RULE_ADD;
+    }
+
+    @Override
+    public String getEventDescription() {
+        IpAddress ip = _networkService.getIp(ipAddressId);
+        return ("Applying port forwarding  rule for Ip: " + ip.getAddress() + " with virtual machine:" + virtualMachineId);
+    }
+
+    @Override
+    public long getAccountId() {
+        IpAddress ip = _networkService.getIp(ipAddressId);
+        return ip.getAccountId();
+    }
+
+    @Override
+    public String getSyncObjType() {
+        return BaseAsyncCmd.networkSyncObject;
+    }
+
+    @Override
+    public Long getSyncObjId() {
+        return getIp().getAssociatedWithNetworkId();
+    }
+
+    private IpAddress getIp() {
+        IpAddress ip = _networkService.getIp(ipAddressId);
+        if (ip == null) {
+            throw new InvalidParameterValueException("Unable to find ip address by id " + ipAddressId);
+        }
+        return ip;
+    }
+
+    @Override
+    public Integer getIcmpCode() {
+        return null;
+    }
+
+    @Override
+    public Integer getIcmpType() {
+        return null;
+    }
+
+    @Override
+    public Long getRelated() {
+        return null;
+    }
+
+    @Override
+    public FirewallRuleType getType() {
+        return FirewallRuleType.User;
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.FirewallRule;
+    }
+
+    @Override
+    public TrafficType getTrafficType() {
+        return null;
+    }
+
+    @Override
+    public List<String> getDestinationCidrList(){
+        return null;
+    }
+
+    @Override
+    public boolean isDisplay() {
+        if (display != null) {
+            return display;
+        } else {
+            return true;
+        }
+    }
+
+    @Override
+    public Class<?> getEntityType() {
+        return FirewallRule.class;
+    }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteFirewallRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/DeleteFirewallRuleCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/firewall/DeleteFirewallRuleCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/firewall/DeleteFirewallRuleCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/DeletePortForwardingRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/DeletePortForwardingRuleCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/firewall/DeletePortForwardingRuleCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/firewall/DeletePortForwardingRuleCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/IListFirewallRulesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/IListFirewallRulesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/firewall/IListFirewallRulesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/firewall/IListFirewallRulesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/ListEgressFirewallRulesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/ListEgressFirewallRulesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/firewall/ListEgressFirewallRulesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/firewall/ListEgressFirewallRulesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/ListPortForwardingRulesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/ListPortForwardingRulesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/firewall/ListPortForwardingRulesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/firewall/ListPortForwardingRulesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/UpdateEgressFirewallRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/UpdateEgressFirewallRuleCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/firewall/UpdateEgressFirewallRuleCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/firewall/UpdateEgressFirewallRuleCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/UpdateFirewallRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/UpdateFirewallRuleCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/firewall/UpdateFirewallRuleCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/firewall/UpdateFirewallRuleCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/guest/ListGuestOsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/guest/ListGuestOsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/CopyIsoCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/CopyIsoCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/iso/CopyIsoCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/iso/CopyIsoCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/DeleteIsoCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/DeleteIsoCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/iso/DeleteIsoCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/iso/DeleteIsoCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/DetachIsoCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/DetachIsoCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/iso/DetachIsoCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/iso/DetachIsoCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/ExtractIsoCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/ExtractIsoCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/iso/ExtractIsoCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/iso/ExtractIsoCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoPermissionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/UpdateIsoPermissionsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoPermissionsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/iso/UpdateIsoPermissionsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/job/ListAsyncJobsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/job/ListAsyncJobsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/job/ListAsyncJobsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/job/ListAsyncJobsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignCertToLoadBalancerCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/AssignCertToLoadBalancerCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignCertToLoadBalancerCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/AssignCertToLoadBalancerCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBHealthCheckPolicyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBHealthCheckPolicyCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBHealthCheckPolicyCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBHealthCheckPolicyCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteApplicationLoadBalancerCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/DeleteApplicationLoadBalancerCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteApplicationLoadBalancerCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/DeleteApplicationLoadBalancerCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBHealthCheckPolicyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBHealthCheckPolicyCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBHealthCheckPolicyCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBHealthCheckPolicyCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBStickinessPolicyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBStickinessPolicyCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBStickinessPolicyCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBStickinessPolicyCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLoadBalancerRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLoadBalancerRuleCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLoadBalancerRuleCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLoadBalancerRuleCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteSslCertCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/DeleteSslCertCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteSslCertCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/DeleteSslCertCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListApplicationLoadBalancersCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListApplicationLoadBalancersCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListApplicationLoadBalancersCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListApplicationLoadBalancersCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBHealthCheckPoliciesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListLBHealthCheckPoliciesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBHealthCheckPoliciesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListLBHealthCheckPoliciesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBStickinessPoliciesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListLBStickinessPoliciesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBStickinessPoliciesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListLBStickinessPoliciesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListSslCertsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListSslCertsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListSslCertsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListSslCertsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveCertFromLoadBalancerCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/RemoveCertFromLoadBalancerCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveCertFromLoadBalancerCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/RemoveCertFromLoadBalancerCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateApplicationLoadBalancerCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UpdateApplicationLoadBalancerCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateApplicationLoadBalancerCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UpdateApplicationLoadBalancerCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLBHealthCheckPolicyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLBHealthCheckPolicyCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLBHealthCheckPolicyCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLBHealthCheckPolicyCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLBStickinessPolicyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLBStickinessPolicyCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLBStickinessPolicyCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLBStickinessPolicyCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UploadSslCertCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UploadSslCertCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/loadbalancer/UploadSslCertCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UploadSslCertCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java
new file mode 100644
index 00000000000..2b2a3c6866a
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java
@@ -0,0 +1,250 @@
+// 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 java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cloudstack.acl.RoleType;
+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.NetworkACLItemResponse;
+import org.apache.cloudstack.api.response.NetworkACLResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.context.CallContext;
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+
+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.utils.net.NetUtils;
+
+@APICommand(name = "createNetworkACL", description = "Creates a ACL rule in the given network (the network has to belong to VPC)", responseObject = NetworkACLItemResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class CreateNetworkACLCmd extends BaseAsyncCreateCmd {
+    public static final Logger s_logger = Logger.getLogger(CreateNetworkACLCmd.class.getName());
+
+    private static final String s_name = "createnetworkaclresponse";
+
+    // ///////////////////////////////////////////////////
+    // ////////////// API parameters /////////////////////
+    // ///////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, required = true, 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<String> 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.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, 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 number of the ACL item, its ordering")
+    private Integer number;
+
+    @Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, description = "scl entry action, allow or deny")
+    private String action;
+
+    @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {
+            RoleType.Admin})
+    private Boolean display;
+
+    @Parameter(name = ApiConstants.ACL_REASON, type = CommandType.STRING, description = "A description indicating why the ACL rule is required.")
+    private String reason;
+
+    // ///////////////////////////////////////////////////
+    // ///////////////// Accessors ///////////////////////
+    // ///////////////////////////////////////////////////
+
+    @Override
+    public boolean isDisplay() {
+        if (display != null) {
+            return display;
+        } else {
+            return true;
+        }
+    }
+
+    public String getProtocol() {
+        String p = protocol.trim();
+        // Deal with ICMP(protocol number 1) specially because it need to be paired with icmp type and code
+        if (StringUtils.isNumeric(p)) {
+            int protoNumber = Integer.parseInt(p);
+            if (protoNumber == 1) {
+                p = "icmp";
+            }
+        }
+        return p;
+    }
+
+    public List<String> getSourceCidrList() {
+        if (cidrlist != null) {
+            return cidrlist;
+        } else {
+            List<String> oneCidrList = new ArrayList<String>();
+            oneCidrList.add(NetUtils.ALL_IP4_CIDRS);
+            return oneCidrList;
+        }
+    }
+
+    public NetworkACLItem.TrafficType getTrafficType() {
+        if (trafficType == null) {
+            return NetworkACLItem.TrafficType.Ingress;
+        }
+        for (NetworkACLItem.TrafficType type : NetworkACLItem.TrafficType.values()) {
+            if (type.toString().equalsIgnoreCase(trafficType)) {
+                return type;
+            }
+        }
+        throw new InvalidParameterValueException("Invalid traffic type " + trafficType);
+    }
+
+    // ///////////////////////////////////////////////////
+    // ///////////// 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() {
+        if (publicEndPort == null) {
+            if (publicStartPort != null) {
+                return publicStartPort;
+            }
+        } else {
+            return publicEndPort;
+        }
+
+        return null;
+    }
+
+    public Long getNetworkId() {
+        return networkId;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Account caller = CallContext.current().getCallingAccount();
+        return caller.getAccountId();
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_NETWORK_ACL_ITEM_CREATE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "Creating Network ACL Item";
+    }
+
+    public Integer getIcmpCode() {
+        if (icmpCode != null) {
+            return icmpCode;
+        } else if (getProtocol().equalsIgnoreCase(NetUtils.ICMP_PROTO)) {
+            return -1;
+        }
+        return null;
+    }
+
+    public Integer getIcmpType() {
+        if (icmpType != null) {
+            return icmpType;
+        } else if (getProtocol().equalsIgnoreCase(NetUtils.ICMP_PROTO)) {
+            return -1;
+
+        }
+        return null;
+    }
+
+    public Long getACLId() {
+        return aclId;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    @Override
+    public void create() {
+        NetworkACLItem result = _networkACLService.createNetworkACLItem(this);
+        setEntityId(result.getId());
+        setEntityUuid(result.getUuid());
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException {
+        boolean success = false;
+        NetworkACLItem rule = _networkACLService.getNetworkACLItem(getEntityId());
+        try {
+            CallContext.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");
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLListCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/CreateNetworkACLListCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLListCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/network/CreateNetworkACLListCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLListCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLListCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLListCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLListCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLListsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworkACLListsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLListsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworkACLListsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkOfferingsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworkOfferingsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/network/ListNetworkOfferingsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworkOfferingsCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
new file mode 100644
index 00000000000..a61c59734c6
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
@@ -0,0 +1,174 @@
+// 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 java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
+import org.apache.cloudstack.api.response.VpcResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+
+import com.cloud.network.Network;
+import com.cloud.utils.Pair;
+
+@APICommand(name = "listNetworks", description = "Lists all available networks.", responseObject = NetworkResponse.class, responseView = ResponseView.Restricted, entityType = {Network.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class ListNetworksCmd extends BaseListTaggedResourcesCmd {
+    public static final Logger s_logger = Logger.getLogger(ListNetworksCmd.class.getName());
+    private static final String s_name = "listnetworksresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "list networks by ID")
+    private Long id;
+
+    @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the zone ID of the network")
+    private Long zoneId;
+
+    @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "the type of the network. Supported values are: isolated and shared")
+    private String guestIpType;
+
+    @Parameter(name = ApiConstants.IS_SYSTEM, type = CommandType.BOOLEAN, description = "true if network is system, false otherwise")
+    private Boolean isSystem;
+
+    @Parameter(name = ApiConstants.ACL_TYPE, type = CommandType.STRING, description = "list networks by ACL (access control list) type. Supported values are account and domain")
+    private String aclType;
+
+    @Parameter(name = ApiConstants.TRAFFIC_TYPE, type = CommandType.STRING, description = "type of the traffic")
+    private String trafficType;
+
+    @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, description = "list networks by physical network id")
+    private Long physicalNetworkId;
+
+    @Parameter(name = ApiConstants.SUPPORTED_SERVICES, type = CommandType.LIST, collectionType = CommandType.STRING, description = "list networks supporting certain services")
+    private List<String> supportedServices;
+
+    @Parameter(name = ApiConstants.RESTART_REQUIRED, type = CommandType.BOOLEAN, description = "list networks by restartRequired")
+    private Boolean restartRequired;
+
+    @Parameter(name = ApiConstants.SPECIFY_IP_RANGES, type = CommandType.BOOLEAN, description = "true if need to list only networks which support specifying IP ranges")
+    private Boolean specifyIpRanges;
+
+    @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "List networks by VPC")
+    private Long vpcId;
+
+    @Parameter(name = ApiConstants.CAN_USE_FOR_DEPLOY, type = CommandType.BOOLEAN, description = "list networks available for VM deployment")
+    private Boolean canUseForDeploy;
+
+    @Parameter(name = ApiConstants.FOR_VPC, type = CommandType.BOOLEAN, description = "the network belongs to VPC")
+    private Boolean forVpc;
+
+    @Parameter(name = ApiConstants.DISPLAY_NETWORK, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin})
+    private Boolean display;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    public Long getZoneId() {
+        return zoneId;
+    }
+
+    public String getGuestIpType() {
+        return guestIpType;
+    }
+
+    public Boolean getIsSystem() {
+        return isSystem;
+    }
+
+    public String getAclType() {
+        return aclType;
+    }
+
+    public String getTrafficType() {
+        return trafficType;
+    }
+
+    public Long getPhysicalNetworkId() {
+        return physicalNetworkId;
+    }
+
+    public List<String> getSupportedServices() {
+        return supportedServices;
+    }
+
+    public Boolean isRestartRequired() {
+        return restartRequired;
+    }
+
+    public Boolean isSpecifyIpRanges() {
+        return specifyIpRanges;
+    }
+
+    public Long getVpcId() {
+        return vpcId;
+    }
+
+    public Boolean canUseForDeploy() {
+        return canUseForDeploy;
+    }
+
+    public Boolean getForVpc() {
+        return forVpc;
+    }
+
+    @Override
+    public Boolean getDisplay() {
+        if (display != null) {
+            return display;
+        }
+        return super.getDisplay();
+    }
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public void execute() {
+        Pair<List<? extends Network>, Integer> networks = _networkService.searchForNetworks(this);
+        ListResponse<NetworkResponse> response = new ListResponse<NetworkResponse>();
+        List<NetworkResponse> networkResponses = new ArrayList<NetworkResponse>();
+        for (Network network : networks.first()) {
+            NetworkResponse networkResponse = _responseGenerator.createNetworkResponse(ResponseView.Restricted, network);
+            networkResponses.add(networkResponse);
+        }
+        response.setResponses(networkResponses, networks.second());
+        response.setResponseName(getCommandName());
+        setResponseObject(response);
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/MoveNetworkAclItemCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/MoveNetworkAclItemCmd.java
new file mode 100644
index 00000000000..aaa9c185526
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/MoveNetworkAclItemCmd.java
@@ -0,0 +1,96 @@
+// 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.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCustomIdCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.NetworkACLItemResponse;
+import org.apache.cloudstack.context.CallContext;
+import org.apache.log4j.Logger;
+
+import com.cloud.event.EventTypes;
+import com.cloud.network.vpc.NetworkACLItem;
+import com.cloud.user.Account;
+
+@APICommand(name = "moveNetworkAclItem", description = "Move an ACL rule to a position bettwen two other ACL rules of the same ACL network list", responseObject = NetworkACLItemResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class MoveNetworkAclItemCmd extends BaseAsyncCustomIdCmd {
+
+    public static final Logger s_logger = Logger.getLogger(MoveNetworkAclItemCmd.class.getName());
+    private static final String s_name = "moveNetworkAclItemResponse";
+
+    @Parameter(name = ApiConstants.ID, type = CommandType.STRING, required = true, description = "The ID of the network ACL rule that is being moved to a new position.")
+    private String uuidRuleBeingMoved;
+
+    @Parameter(name = ApiConstants.PREVIOUS_ACL_RULE_ID, type = CommandType.STRING, description = "The ID of the first rule that is right before the new position where the rule being moved is going to be placed. This value can be 'NULL' if the rule is being moved to the first position of the network ACL list.")
+    private String previousAclRuleUuid;
+
+    @Parameter(name = ApiConstants.NEXT_ACL_RULE_ID, type = CommandType.STRING, description = "The ID of the rule that is right after the new position where the rule being moved is going to be placed. This value can be 'NULL' if the rule is being moved to the last position of the network ACL list.")
+    private String nextAclRuleUuid;
+
+    @Override
+    public void execute() {
+        CallContext.current().setEventDetails(getEventDescription());
+
+        NetworkACLItem aclItem = _networkACLService.moveNetworkAclRuleToNewPosition(this);
+
+        NetworkACLItemResponse aclResponse = _responseGenerator.createNetworkACLItemResponse(aclItem);
+        setResponseObject(aclResponse);
+        aclResponse.setResponseName(getCommandName());
+    }
+
+    public String getUuidRuleBeingMoved() {
+        return uuidRuleBeingMoved;
+    }
+
+    public String getPreviousAclRuleUuid() {
+        return previousAclRuleUuid;
+    }
+
+    public String getNextAclRuleUuid() {
+        return nextAclRuleUuid;
+    }
+
+    @Override
+    public void checkUuid() {
+        if (this.getCustomId() != null) {
+            _uuidMgr.checkUuid(this.getCustomId(), NetworkACLItem.class);
+        }
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_NETWORK_ACL_ITEM_UPDATE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return String.format("Placing network ACL item [%s] between [%s] and [%s].", uuidRuleBeingMoved, previousAclRuleUuid, nextAclRuleUuid);
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Account caller = CallContext.current().getCallingAccount();
+        return caller.getAccountId();
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ReplaceNetworkACLListCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/ReplaceNetworkACLListCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/network/ReplaceNetworkACLListCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/network/ReplaceNetworkACLListCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/RestartNetworkCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/RestartNetworkCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/network/RestartNetworkCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/network/RestartNetworkCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLItemCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLItemCmd.java
new file mode 100644
index 00000000000..1215f5710a0
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLItemCmd.java
@@ -0,0 +1,197 @@
+// 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 java.util.List;
+
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCustomIdCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.NetworkACLItemResponse;
+import org.apache.cloudstack.context.CallContext;
+import org.apache.log4j.Logger;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.vpc.NetworkACLItem;
+import com.cloud.user.Account;
+
+@APICommand(name = "updateNetworkACLItem", description = "Updates ACL item with specified ID", responseObject = NetworkACLItemResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class UpdateNetworkACLItemCmd extends BaseAsyncCustomIdCmd {
+    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<String> 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;
+
+    @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {
+            RoleType.Admin})
+    private Boolean display;
+
+    @Parameter(name = ApiConstants.ACL_REASON, type = CommandType.STRING, description = "A description indicating why the ACL rule is required.")
+    private String reason;
+
+    @Parameter(name = ApiConstants.ACL_RULE_PARTIAL_UPGRADE, type = CommandType.BOOLEAN, required = false, description = "Indicates if the ACL rule is to be updated partially (merging the parameters sent with current configuration) or completely (disconsidering all of the current configurations). The default value is 'true'.")
+    private boolean partialUpgrade = true;
+
+    // ///////////////////////////////////////////////////
+    // ///////////////// Accessors ///////////////////////
+    // ///////////////////////////////////////////////////
+
+    @Override
+    public boolean isDisplay() {
+        if (display != null) {
+            return display;
+        } else {
+            return true;
+        }
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public String getProtocol() {
+        if (protocol != null) {
+            return protocol.trim();
+        } else {
+            return null;
+        }
+    }
+
+    public List<String> 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 = CallContext.current().getCallingAccount();
+        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;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException {
+        CallContext.current().setEventDetails("Rule Id: " + getId());
+        NetworkACLItem aclItem = _networkACLService.updateNetworkACLItem(this);
+        NetworkACLItemResponse aclResponse = _responseGenerator.createNetworkACLItemResponse(aclItem);
+        setResponseObject(aclResponse);
+        aclResponse.setResponseName(getCommandName());
+    }
+
+    @Override
+    public void checkUuid() {
+        if (this.getCustomId() != null) {
+            _uuidMgr.checkUuid(this.getCustomId(), NetworkACLItem.class);
+        }
+    }
+
+    public boolean isPartialUpgrade() {
+        return partialUpgrade;
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLListCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLListCmd.java
new file mode 100644
index 00000000000..22eaf2180ca
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLListCmd.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.network;
+
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCustomIdCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.NetworkACLResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.context.CallContext;
+import org.apache.log4j.Logger;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.vpc.NetworkACL;
+import com.cloud.user.Account;
+
+@APICommand(name = "updateNetworkACLList", description = "Updates network ACL list", responseObject = SuccessResponse.class, since = "4.4", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class UpdateNetworkACLListCmd extends BaseAsyncCustomIdCmd {
+    public static final Logger s_logger = Logger.getLogger(UpdateNetworkACLListCmd.class.getName());
+    private static final String s_name = "updatenetworkacllistresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkACLResponse.class, required = true, description = "the ID of the network ACL")
+    private Long id;
+
+    @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the list to the end user or not", since = "4.4", authorized = {
+            RoleType.Admin})
+    private Boolean display;
+
+    @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, 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;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    public Boolean getDisplay() {
+        return display;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_NETWORK_ACL_UPDATE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return ("Updating network ACL list ID=" + id);
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Account caller = CallContext.current().getCallingAccount();
+        return caller.getAccountId();
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException {
+        NetworkACL acl = _networkACLService.updateNetworkACL(this);
+        NetworkACLResponse aclResponse = _responseGenerator.createNetworkACLResponse(acl);
+        setResponseObject(aclResponse);
+        aclResponse.setResponseName(getCommandName());
+    }
+
+    @Override
+    public void checkUuid() {
+        if (this.getCustomId() != null) {
+            _uuidMgr.checkUuid(this.getCustomId(), NetworkACL.class);
+        }
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public String getName() {
+        return name;
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/offering/ListDiskOfferingsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/offering/ListDiskOfferingsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/offering/ListDiskOfferingsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/offering/ListDiskOfferingsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/AssignToGlobalLoadBalancerRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/AssignToGlobalLoadBalancerRuleCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/AssignToGlobalLoadBalancerRuleCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/AssignToGlobalLoadBalancerRuleCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/CreateGlobalLoadBalancerRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/CreateGlobalLoadBalancerRuleCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/CreateGlobalLoadBalancerRuleCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/CreateGlobalLoadBalancerRuleCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/DeleteGlobalLoadBalancerRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/DeleteGlobalLoadBalancerRuleCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/DeleteGlobalLoadBalancerRuleCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/DeleteGlobalLoadBalancerRuleCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/ListGlobalLoadBalancerRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/ListGlobalLoadBalancerRuleCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/ListGlobalLoadBalancerRuleCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/ListGlobalLoadBalancerRuleCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/RemoveFromGlobalLoadBalancerRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/RemoveFromGlobalLoadBalancerRuleCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/RemoveFromGlobalLoadBalancerRuleCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/RemoveFromGlobalLoadBalancerRuleCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/UpdateGlobalLoadBalancerRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/UpdateGlobalLoadBalancerRuleCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/UpdateGlobalLoadBalancerRuleCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/UpdateGlobalLoadBalancerRuleCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
new file mode 100644
index 00000000000..8c2a7e41754
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
@@ -0,0 +1,252 @@
+// 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.snapshot;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.PermissionDeniedException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.projects.Project;
+import com.cloud.storage.Snapshot;
+import com.cloud.storage.Volume;
+import com.cloud.user.Account;
+import com.cloud.utils.exception.CloudRuntimeException;
+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.DomainResponse;
+import org.apache.cloudstack.api.response.SnapshotPolicyResponse;
+import org.apache.cloudstack.api.response.SnapshotResponse;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.log4j.Logger;
+
+@APICommand(name = "createSnapshot", description = "Creates an instant snapshot of a volume.", responseObject = SnapshotResponse.class, entityType = {Snapshot.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
+    public static final Logger s_logger = Logger.getLogger(CreateSnapshotCmd.class.getName());
+    private static final String s_name = "createsnapshotresponse";
+
+    // ///////////////////////////////////////////////////
+    // ////////////// API parameters /////////////////////
+    // ///////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ACCOUNT,
+               type = CommandType.STRING,
+               description = "The account of the snapshot. The account parameter must be used with the domainId parameter.")
+    private String accountName;
+
+    @Parameter(name = ApiConstants.DOMAIN_ID,
+               type = CommandType.UUID,
+               entityType = DomainResponse.class,
+            description = "The domain ID of the snapshot. If used with the account parameter, specifies a domain for the account associated with the disk volume.")
+    private Long domainId;
+
+    @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class, required = true, description = "The ID of the disk volume")
+    private Long volumeId;
+
+    @Parameter(name = ApiConstants.POLICY_ID,
+               type = CommandType.UUID,
+               entityType = SnapshotPolicyResponse.class,
+            description = "policy id of the snapshot, if this is null, then use MANUAL_POLICY.")
+    private Long policyId;
+
+    @Parameter(name = ApiConstants.SNAPSHOT_QUIESCEVM, type = CommandType.BOOLEAN, required = false, description = "quiesce vm if true")
+    private Boolean quiescevm;
+
+    @Parameter(name = ApiConstants.LOCATION_TYPE, type = CommandType.STRING, required = false, description = "Currently applicable only for managed storage. " +
+            "Valid location types: 'primary', 'secondary'. Default = 'primary'.")
+    private String locationType;
+
+    @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the snapshot")
+    private String snapshotName;
+
+    @Parameter(name = ApiConstants.ASYNC_BACKUP, type = CommandType.BOOLEAN, required = false, description = "asynchronous backup if true")
+    private Boolean asyncBackup;
+
+    private String syncObjectType = BaseAsyncCmd.snapshotHostSyncObject;
+
+    // ///////////////////////////////////////////////////
+    // ///////////////// Accessors ///////////////////////
+    // ///////////////////////////////////////////////////
+
+    public Boolean getQuiescevm() {
+        if (quiescevm == null) {
+            return false;
+        } else {
+            return quiescevm;
+        }
+    }
+
+    public String getAccountName() {
+        return accountName;
+    }
+
+    public Long getDomainId() {
+        return domainId;
+    }
+
+    public Long getVolumeId() {
+        return volumeId;
+    }
+
+    public String getSnapshotName() {
+        return snapshotName;
+    }
+
+    public Long getPolicyId() {
+        if (policyId != null) {
+            return policyId;
+        } else {
+            return Snapshot.MANUAL_POLICY_ID;
+        }
+    }
+
+    private Long getHostId() {
+        Volume volume = _entityMgr.findById(Volume.class, getVolumeId());
+        if (volume == null) {
+            throw new InvalidParameterValueException("Unable to find volume by id");
+        }
+        return _snapshotService.getHostIdForSnapshotOperation(volume);
+    }
+
+    // ///////////////////////////////////////////////////
+    // ///////////// API Implementation///////////////////
+    // ///////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getResultObjectName() {
+        return ApiConstants.SNAPSHOT;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+
+        Volume volume = _entityMgr.findById(Volume.class, getVolumeId());
+        if (volume == null) {
+            throw new InvalidParameterValueException("Unable to find volume by id=" + volumeId);
+        }
+
+        Account account = _accountService.getAccount(volume.getAccountId());
+        //Can create templates for enabled projects/accounts only
+        if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) {
+            Project project = _projectService.findByProjectAccountId(volume.getAccountId());
+            if (project.getState() != Project.State.Active) {
+                throw new PermissionDeniedException("Can't add resources to the project id=" + project.getId() + " in state=" + project.getState() +
+                    " as it's no longer active");
+            }
+        } else if (account.getState() == Account.State.disabled) {
+            throw new PermissionDeniedException("The owner of template is disabled: " + account);
+        }
+
+        return volume.getAccountId();
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_SNAPSHOT_CREATE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "creating snapshot for volume: " + this._uuidMgr.getUuid(Volume.class, getVolumeId());
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.Snapshot;
+    }
+
+    @Override
+    public void create() throws ResourceAllocationException {
+        Snapshot snapshot = _volumeService.allocSnapshot(getVolumeId(), getPolicyId(), getSnapshotName(), getLocationType());
+        if (snapshot != null) {
+            setEntityId(snapshot.getId());
+            setEntityUuid(snapshot.getUuid());
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create snapshot");
+        }
+    }
+
+    @Override
+    public void execute() {
+        Snapshot snapshot;
+        try {
+            snapshot =
+                _volumeService.takeSnapshot(getVolumeId(), getPolicyId(), getEntityId(), _accountService.getAccount(getEntityOwnerId()), getQuiescevm(), getLocationType(), getAsyncBackup());
+
+            if (snapshot != null) {
+                SnapshotResponse response = _responseGenerator.createSnapshotResponse(snapshot);
+                response.setResponseName(getCommandName());
+                setResponseObject(response);
+            } else {
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create snapshot due to an internal error creating snapshot for volume " + getVolumeId());
+            }
+        } catch (Exception e) {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create snapshot due to an internal error creating snapshot for volume " + getVolumeId());
+        }
+    }
+
+    private Snapshot.LocationType getLocationType() {
+
+        if (Snapshot.LocationType.values() == null || Snapshot.LocationType.values().length == 0 || locationType == null) {
+            return null;
+        }
+
+        try {
+            String lType = locationType.trim().toUpperCase();
+            return Snapshot.LocationType.valueOf(lType);
+        } catch (IllegalArgumentException e) {
+            String errMesg = "Invalid locationType " + locationType + "Specified for volume " + getVolumeId()
+                        + " Valid values are: primary,secondary ";
+            s_logger.warn(errMesg);
+            throw  new CloudRuntimeException(errMesg);
+        }
+    }
+
+    @Override
+    public String getSyncObjType() {
+        if (getSyncObjId() != null) {
+            return syncObjectType;
+        }
+        return null;
+    }
+
+    @Override
+    public Long getSyncObjId() {
+        if (getHostId() != null) {
+            return getHostId();
+        }
+        return null;
+    }
+
+    public Boolean getAsyncBackup() {
+        if (asyncBackup == null) {
+            return false;
+        } else {
+            return asyncBackup;
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotFromVMSnapshotCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotFromVMSnapshotCmd.java
new file mode 100644
index 00000000000..556b041631b
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotFromVMSnapshotCmd.java
@@ -0,0 +1,219 @@
+// 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.snapshot;
+
+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.SnapshotResponse;
+import org.apache.cloudstack.api.response.VMSnapshotResponse;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.cloudstack.context.CallContext;
+import org.apache.log4j.Logger;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.PermissionDeniedException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.projects.Project;
+import com.cloud.storage.Snapshot;
+import com.cloud.user.Account;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.snapshot.VMSnapshot;
+
+@APICommand(name = "createSnapshotFromVMSnapshot", description = "Creates an instant snapshot of a volume from existing vm snapshot.", responseObject = SnapshotResponse.class, entityType = {Snapshot.class}, since = "4.10.0",
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class CreateSnapshotFromVMSnapshotCmd extends BaseAsyncCreateCmd {
+    public static final Logger s_logger = Logger.getLogger(CreateSnapshotFromVMSnapshotCmd.class.getName());
+    private static final String s_name = "createsnapshotfromvmsnapshotresponse";
+
+    // ///////////////////////////////////////////////////
+    // ////////////// API parameters /////////////////////
+    // ///////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class, required = true, description = "The ID of the disk volume")
+    private Long volumeId;
+
+    @Parameter(name=ApiConstants.VM_SNAPSHOT_ID, type=CommandType.UUID, entityType=VMSnapshotResponse.class,
+            required=true, description="The ID of the VM snapshot")
+    private Long vmSnapshotId;
+
+    @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the snapshot")
+    private String snapshotName;
+
+    private String syncObjectType = BaseAsyncCmd.snapshotHostSyncObject;
+
+    // ///////////////////////////////////////////////////
+    // ///////////////// Accessors ///////////////////////
+    // ///////////////////////////////////////////////////
+
+    public Long getVolumeId() {
+        return volumeId;
+    }
+
+    public Long getVMSnapshotId() {
+        return vmSnapshotId;
+    }
+
+    public String getSnapshotName() {
+        return snapshotName;
+    }
+
+    private Long getVmId() {
+        VMSnapshot vmsnapshot = _entityMgr.findById(VMSnapshot.class, getVMSnapshotId());
+        if (vmsnapshot == null) {
+            throw new InvalidParameterValueException("Unable to find vm snapshot by id=" + getVMSnapshotId());
+        }
+        UserVm vm = _entityMgr.findById(UserVm.class, vmsnapshot.getVmId());
+        if (vm == null) {
+            throw new InvalidParameterValueException("Unable to find vm by vm snapshot id=" + getVMSnapshotId());
+        }
+        return vm.getId();
+    }
+    private Long getHostId() {
+        VMSnapshot vmsnapshot = _entityMgr.findById(VMSnapshot.class, getVMSnapshotId());
+        if (vmsnapshot == null) {
+            throw new InvalidParameterValueException("Unable to find vm snapshot by id=" + getVMSnapshotId());
+        }
+        UserVm vm = _entityMgr.findById(UserVm.class, vmsnapshot.getVmId());
+        if (vm != null) {
+            if(vm.getHostId() != null) {
+                return vm.getHostId();
+            } else if(vm.getLastHostId() != null) {
+                return vm.getLastHostId();
+            }
+        }
+        return null;
+    }
+
+
+    // ///////////////////////////////////////////////////
+    // ///////////// API Implementation///////////////////
+    // ///////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getResultObjectName() {
+        return ApiConstants.SNAPSHOT;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+
+        VMSnapshot vmsnapshot = _entityMgr.findById(VMSnapshot.class, getVMSnapshotId());
+        if (vmsnapshot == null) {
+            throw new InvalidParameterValueException("Unable to find vmsnapshot by id=" + getVMSnapshotId());
+        }
+
+        Account account = _accountService.getAccount(vmsnapshot.getAccountId());
+        //Can create templates for enabled projects/accounts only
+        if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) {
+            Project project = _projectService.findByProjectAccountId(vmsnapshot.getAccountId());
+            if (project == null) {
+                throw new InvalidParameterValueException("Unable to find project by account id=" + account.getUuid());
+            }
+            if (project.getState() != Project.State.Active) {
+                throw new PermissionDeniedException("Can't add resources to the project id=" + project.getUuid() + " in state=" + project.getState() + " as it's no longer active");
+            }
+        } else if (account.getState() == Account.State.disabled) {
+            throw new PermissionDeniedException("The owner of template is disabled: " + account);
+        }
+
+        return vmsnapshot.getAccountId();
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_SNAPSHOT_CREATE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "creating snapshot from vm snapshot : " + this._uuidMgr.getUuid(VMSnapshot.class, getVMSnapshotId());
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.Snapshot;
+    }
+
+    @Override
+    public void create() throws ResourceAllocationException {
+        Snapshot snapshot = this._volumeService.allocSnapshotForVm(getVmId(), getVolumeId(), getSnapshotName());
+        if (snapshot != null) {
+            this.setEntityId(snapshot.getId());
+            this.setEntityUuid(snapshot.getUuid());
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create snapshot from vm snapshot");
+        }
+    }
+
+    @Override
+    public void execute() {
+        s_logger.info("CreateSnapshotFromVMSnapshotCmd with vm snapshot id:" + getVMSnapshotId() + " and snapshot id:" + getEntityId() + " starts:" + System.currentTimeMillis());
+        CallContext.current().setEventDetails("Vm Snapshot Id: "+ this._uuidMgr.getUuid(VMSnapshot.class, getVMSnapshotId()));
+        Snapshot snapshot = null;
+        try {
+            snapshot = _snapshotService.backupSnapshotFromVmSnapshot(getEntityId(), getVmId(), getVolumeId(), getVMSnapshotId());
+            if (snapshot != null) {
+                SnapshotResponse response = _responseGenerator.createSnapshotResponse(snapshot);
+                response.setResponseName(getCommandName());
+                this.setResponseObject(response);
+            } else {
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create snapshot due to an internal error creating snapshot from vm snapshot " + getVMSnapshotId());
+            }
+        } catch (InvalidParameterValueException ex) {
+            throw ex;
+        } catch (Exception e) {
+            s_logger.debug("Failed to create snapshot", e);
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create snapshot due to an internal error creating snapshot from vm snapshot " + getVMSnapshotId());
+        } finally {
+            if (snapshot == null) {
+                try {
+                    _snapshotService.deleteSnapshot(getEntityId());
+                } catch (Exception e) {
+                    s_logger.debug("Failed to clean failed snapshot" + getEntityId());
+                }
+            }
+        }
+    }
+
+
+    @Override
+    public String getSyncObjType() {
+        if (getSyncObjId() != null) {
+            return syncObjectType;
+        }
+        return null;
+    }
+
+    @Override
+    public Long getSyncObjId() {
+        if (getHostId() != null) {
+            return getHostId();
+        }
+        return null;
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java
new file mode 100644
index 00000000000..452135fc1f4
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java
@@ -0,0 +1,111 @@
+// 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.snapshot;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.ACL;
+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.SnapshotResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.storage.Snapshot;
+import com.cloud.user.Account;
+
+@APICommand(name = "deleteSnapshot", description = "Deletes a snapshot of a disk volume.", responseObject = SuccessResponse.class, entityType = {Snapshot.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class DeleteSnapshotCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(DeleteSnapshotCmd.class.getName());
+    private static final String s_name = "deletesnapshotresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = SnapshotResponse.class,
+            required=true, description="The ID of the snapshot")
+    private Long id;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Snapshot snapshot = _entityMgr.findById(Snapshot.class, getId());
+        if (snapshot != null) {
+            return snapshot.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_SNAPSHOT_DELETE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "deleting snapshot: " + this._uuidMgr.getUuid(Snapshot.class, getId());
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.Snapshot;
+    }
+
+    @Override
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    @Override
+    public void execute() {
+        CallContext.current().setEventDetails("Snapshot Id: " + this._uuidMgr.getUuid(Snapshot.class, getId()));
+        boolean result = _snapshotService.deleteSnapshot(getId());
+        if (result) {
+            SuccessResponse response = new SuccessResponse(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete snapshot");
+        }
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java
new file mode 100644
index 00000000000..20a638c36f4
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java
@@ -0,0 +1,110 @@
+/*
+ * 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.snapshot;
+
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.ACL;
+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.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.SnapshotResponse;
+import org.apache.cloudstack.context.CallContext;
+import org.apache.log4j.Logger;
+
+import com.cloud.event.EventTypes;
+import com.cloud.storage.Snapshot;
+import com.cloud.user.Account;
+
+@APICommand(name = "revertSnapshot", description = "This is supposed to revert a volume snapshot. This command is only supported with KVM so far", responseObject = SnapshotResponse.class, entityType = {Snapshot.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class RevertSnapshotCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(RevertSnapshotCmd.class.getName());
+    private static final String s_name = "revertsnapshotresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name= ApiConstants.ID, type= BaseCmd.CommandType.UUID, entityType = SnapshotResponse.class,
+            required=true, description="The ID of the snapshot")
+    private Long id;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+    public Long getId() {
+        return id;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Snapshot snapshot = _entityMgr.findById(Snapshot.class, getId());
+        if (snapshot != null) {
+            return snapshot.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_SNAPSHOT_REVERT;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "revert snapshot: " + this._uuidMgr.getUuid(Snapshot.class, getId());
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.Snapshot;
+    }
+
+    @Override
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    @Override
+    public void execute() {
+        CallContext.current().setEventDetails("Snapshot Id: " + this._uuidMgr.getUuid(Snapshot.class, getId()));
+        Snapshot snapshot = _snapshotService.revertSnapshot(getId());
+        if (snapshot != null) {
+            SnapshotResponse response = _responseGenerator.createSnapshotResponse(snapshot);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to revert snapshot");
+        }
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/UpdateSnapshotPolicyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/UpdateSnapshotPolicyCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/snapshot/UpdateSnapshotPolicyCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/UpdateSnapshotPolicyCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/tag/DeleteTagsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/tag/DeleteTagsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/tag/DeleteTagsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/tag/DeleteTagsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/tag/ListTagsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/tag/ListTagsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/tag/ListTagsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/tag/ListTagsCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java
new file mode 100644
index 00000000000..db45f75e8f0
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java
@@ -0,0 +1,198 @@
+// 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.template;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.cloud.dc.DataCenter;
+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.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.TemplateResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.StorageUnavailableException;
+import com.cloud.template.VirtualMachineTemplate;
+import com.cloud.user.Account;
+
+@APICommand(name = "copyTemplate", description = "Copies a template from one zone to another.", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted,
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class CopyTemplateCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(CopyTemplateCmd.class.getName());
+    private static final String s_name = "copytemplateresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.DESTINATION_ZONE_ID,
+               type = CommandType.UUID,
+               entityType = ZoneResponse.class,
+               required = false,
+               description = "ID of the zone the template is being copied to.")
+    protected Long destZoneId;
+
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID,
+            entityType = TemplateResponse.class, required = true, description = "Template ID.")
+    private Long id;
+
+    @Parameter(name = ApiConstants.SOURCE_ZONE_ID,
+               type = CommandType.UUID,
+               entityType = ZoneResponse.class,
+            description = "ID of the zone the template is currently hosted on. " +
+                    "If not specified and template is cross-zone, " +
+                    "then we will sync this template to region wide image store.")
+    private Long sourceZoneId;
+
+    @Parameter(name = ApiConstants.DESTINATION_ZONE_ID_LIST,
+                    type=CommandType.LIST,
+                    collectionType = CommandType.UUID,
+                    entityType = ZoneResponse.class,
+                    required = false,
+                    description = "A list of IDs of the zones that the template needs to be copied to." +
+                            "Specify this list if the template needs to copied to multiple zones in one go. " +
+                            "Do not specify destzoneid and destzoneids together, however one of them is required.")
+    protected List<Long> destZoneIds;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public List<Long> getDestinationZoneIds() {
+        if (destZoneIds != null && destZoneIds.size() != 0) {
+            return destZoneIds;
+        }
+        if (destZoneId != null) {
+            List < Long > destIds = new ArrayList<>();
+            destIds.add(destZoneId);
+            return destIds;
+        }
+        return null;
+    }
+
+    public Long getDestinationZoneId() {
+        return destZoneId;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public Long getSourceZoneId() {
+        return sourceZoneId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getStaticName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        VirtualMachineTemplate template = _entityMgr.findById(VirtualMachineTemplate.class, getId());
+        if (template != null) {
+            return template.getAccountId();
+        }
+
+        // bad id given, parent this command to SYSTEM so ERROR events are tracked
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_TEMPLATE_COPY;
+    }
+
+    @Override
+    public String getEventDescription() {
+        StringBuilder descBuilder = new StringBuilder();
+        if (getDestinationZoneIds() != null) {
+
+            for (Long destId : getDestinationZoneIds()) {
+                descBuilder.append(", ");
+                descBuilder.append(this._uuidMgr.getUuid(DataCenter.class, destId));
+            }
+            if (descBuilder.length() > 0) {
+                descBuilder.deleteCharAt(0);
+            }
+        }
+
+        return  "copying template: " + this._uuidMgr.getUuid(VirtualMachineTemplate.class, getId()) +((getSourceZoneId() != null) ? " from zone: " + this._uuidMgr.getUuid(DataCenter.class, getSourceZoneId()) : "") + ((descBuilder.length() > 0) ? " to zones: " + descBuilder.toString() : "");
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.Template;
+    }
+
+    @Override
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    @Override
+    public void execute() throws ResourceAllocationException {
+        try {
+            if (destZoneId == null && (destZoneIds == null || destZoneIds.size() == 0))
+                throw new ServerApiException(ApiErrorCode.PARAM_ERROR,
+                        "Either destzoneid or destzoneids parameters have to be specified.");
+
+            if (destZoneId != null && destZoneIds != null && destZoneIds.size() != 0)
+                throw new ServerApiException(ApiErrorCode.PARAM_ERROR,
+                        "Both destzoneid and destzoneids cannot be specified at the same time.");
+
+            CallContext.current().setEventDetails(getEventDescription());
+            VirtualMachineTemplate template = _templateService.copyTemplate(this);
+
+            if (template != null){
+                List<TemplateResponse> listResponse = _responseGenerator.createTemplateResponses(ResponseView.Restricted,
+                                                            template, getDestinationZoneIds(), false);
+                TemplateResponse response = new TemplateResponse();
+                if (listResponse != null && !listResponse.isEmpty()) {
+                    response = listResponse.get(0);
+                }
+
+                response.setResponseName(getCommandName());
+                setResponseObject(response);
+            } else {
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to copy template");
+            }
+        } catch (StorageUnavailableException ex) {
+            s_logger.warn("Exception: ", ex);
+            throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
new file mode 100644
index 00000000000..42f138300bc
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
@@ -0,0 +1,318 @@
+// 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.template;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cloudstack.acl.SecurityChecker;
+import org.apache.cloudstack.api.response.GuestOSResponse;
+import org.apache.cloudstack.api.response.SnapshotResponse;
+import org.apache.cloudstack.api.response.TemplateResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.cloudstack.api.response.ProjectResponse;
+
+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.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.PermissionDeniedException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.projects.Project;
+import com.cloud.storage.Snapshot;
+import com.cloud.storage.Volume;
+import com.cloud.template.VirtualMachineTemplate;
+import com.cloud.user.Account;
+
+@APICommand(name = "createTemplate", responseObject = TemplateResponse.class, description = "Creates a template of a virtual machine. " + "The virtual machine must be in a STOPPED state. "
+        + "A template created from this command is automatically designated as a private template visible to the account that created it.", responseView = ResponseView.Restricted,
+    requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class CreateTemplateCmd extends BaseAsyncCreateCmd {
+    public static final Logger s_logger = Logger.getLogger(CreateTemplateCmd.class.getName());
+    private static final String s_name = "createtemplateresponse";
+
+    // ///////////////////////////////////////////////////
+    // ////////////// API parameters /////////////////////
+    // ///////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.BITS, type = CommandType.INTEGER, description = "32 or 64 bit")
+    private Integer bits;
+
+    @Parameter(name = ApiConstants.DISPLAY_TEXT,
+               type = CommandType.STRING,
+               required = true,
+               description = "the display text of the template. This is usually used for display purposes.",
+               length = 4096)
+    private String displayText;
+
+    @Parameter(name = ApiConstants.IS_FEATURED, type = CommandType.BOOLEAN, description = "true if this template is a featured template, false otherwise")
+    private Boolean featured;
+
+    @Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "true if this template is a public template, false otherwise")
+    private Boolean publicTemplate;
+
+    @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the template")
+    private String templateName;
+
+    @Parameter(name = ApiConstants.OS_TYPE_ID,
+               type = CommandType.UUID,
+               entityType = GuestOSResponse.class,
+               required = true,
+               description = "the ID of the OS Type that best represents the OS of this template.")
+    private Long osTypeId;
+
+    @Parameter(name = ApiConstants.PASSWORD_ENABLED,
+               type = CommandType.BOOLEAN,
+               description = "true if the template supports the password reset feature; default is false")
+    private Boolean passwordEnabled;
+
+    @Parameter(name = ApiConstants.REQUIRES_HVM, type = CommandType.BOOLEAN, description = "true if the template requres HVM, false otherwise")
+    private Boolean requiresHvm;
+
+    @Parameter(name = ApiConstants.SNAPSHOT_ID,
+               type = CommandType.UUID,
+               entityType = SnapshotResponse.class,
+            description = "the ID of the snapshot the template is being created from. Either this parameter, or volumeId has to be passed in")
+    protected Long snapshotId;
+
+    @Parameter(name = ApiConstants.VOLUME_ID,
+               type = CommandType.UUID,
+               entityType = VolumeResponse.class,
+            description = "the ID of the disk volume the template is being created from. Either this parameter, or snapshotId has to be passed in")
+    protected Long volumeId;
+
+    @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = UserVmResponse.class,
+            description="Optional, VM ID. If this presents, it is going to create a baremetal template for VM this ID refers to. This is only for VM whose hypervisor type is BareMetal")
+    protected Long vmId;
+
+    @Parameter(name = ApiConstants.URL,
+               type = CommandType.STRING,
+               length = 2048,
+               description = "Optional, only for baremetal hypervisor. The directory name where template stored on CIFS server")
+    private String url;
+
+    @Parameter(name = ApiConstants.TEMPLATE_TAG, type = CommandType.STRING, description = "the tag for this template.")
+    private String templateTag;
+
+    @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "Template details in key/value pairs using format details[i].keyname=keyvalue. Example: details[0].hypervisortoolsversion=xenserver61")
+    protected Map details;
+
+    @Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE,
+               type = CommandType.BOOLEAN,
+               description = "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory")
+    protected Boolean isDynamicallyScalable;
+
+    @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "create template for the project")
+    private Long projectId;
+
+    // ///////////////////////////////////////////////////
+    // ///////////////// Accessors ///////////////////////
+    // ///////////////////////////////////////////////////
+
+    public Integer getBits() {
+        return bits;
+    }
+
+    public String getDisplayText() {
+        return displayText;
+    }
+
+    public Boolean isFeatured() {
+        return featured;
+    }
+
+    public Boolean isPublic() {
+        return publicTemplate;
+    }
+
+    public String getTemplateName() {
+        return templateName;
+    }
+
+    public Long getOsTypeId() {
+        return osTypeId;
+    }
+
+    public Boolean isPasswordEnabled() {
+        return passwordEnabled;
+    }
+
+    public Boolean getRequiresHvm() {
+        return requiresHvm;
+    }
+
+    public Long getSnapshotId() {
+        return snapshotId;
+    }
+
+    public Long getVolumeId() {
+        return volumeId;
+    }
+
+    public Long getVmId() {
+        return vmId;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public String getTemplateTag() {
+        return templateTag;
+    }
+
+    public Map getDetails() {
+        if (details == null || details.isEmpty()) {
+            return null;
+        }
+
+        Collection paramsCollection = details.values();
+        Map params = (Map)(paramsCollection.toArray())[0];
+        return params;
+    }
+
+    public boolean isDynamicallyScalable() {
+        return isDynamicallyScalable == null ? false : isDynamicallyScalable;
+    }
+
+    // ///////////////////////////////////////////////////
+    // ///////////// API Implementation///////////////////
+    // ///////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getResultObjectName() {
+        return "template";
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Long volumeId = getVolumeId();
+        Long snapshotId = getSnapshotId();
+        Account callingAccount = CallContext.current().getCallingAccount();
+        if (volumeId != null) {
+            Volume volume = _entityMgr.findById(Volume.class, volumeId);
+            if (volume != null) {
+                _accountService.checkAccess(callingAccount, SecurityChecker.AccessType.UseEntry, false, volume);
+            } else {
+                throw new InvalidParameterValueException("Unable to find volume by id=" + volumeId);
+            }
+        } else {
+            Snapshot snapshot = _entityMgr.findById(Snapshot.class, snapshotId);
+            if (snapshot != null) {
+                _accountService.checkAccess(callingAccount, SecurityChecker.AccessType.UseEntry, false, snapshot);
+            } else {
+                throw new InvalidParameterValueException("Unable to find snapshot by id=" + snapshotId);
+            }
+        }
+
+        if(projectId != null){
+            final Project project = _projectService.getProject(projectId);
+            if (project != null) {
+                if (project.getState() == Project.State.Active) {
+                    Account projectAccount= _accountService.getAccount(project.getProjectAccountId());
+                    _accountService.checkAccess(callingAccount, SecurityChecker.AccessType.UseEntry, false, projectAccount);
+                    return project.getProjectAccountId();
+                } else {
+                    final PermissionDeniedException ex =
+                            new PermissionDeniedException("Can't add resources to the project with specified projectId in state=" + project.getState() +
+                                    " as it's no longer active");
+                    ex.addProxyObject(project.getUuid(), "projectId");
+                    throw ex;
+                }
+            } else {
+                throw new InvalidParameterValueException("Unable to find project by id");
+            }
+        }
+
+        return callingAccount.getId();
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_TEMPLATE_CREATE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "creating template: " + getTemplateName();
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.Template;
+    }
+
+    protected boolean isBareMetal() {
+        return (getVmId() != null && getUrl() != null);
+    }
+
+    @Override
+    public void create() throws ResourceAllocationException {
+        VirtualMachineTemplate template = null;
+        //TemplateOwner should be the caller https://issues.citrite.net/browse/CS-17530
+        template = _templateService.createPrivateTemplateRecord(this, _accountService.getAccount(getEntityOwnerId()));
+        if (template != null) {
+            setEntityId(template.getId());
+            setEntityUuid(template.getUuid());
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a template");
+        }
+
+    }
+
+    @Override
+    public void execute() {
+        CallContext.current().setEventDetails(
+            "Template Id: " + getEntityUuid() + ((getSnapshotId() == null) ? " from volume Id: " + this._uuidMgr.getUuid(Volume.class, getVolumeId()) : " from snapshot Id: " + this._uuidMgr.getUuid(Snapshot.class, getSnapshotId())));
+        VirtualMachineTemplate template = null;
+        template = _templateService.createPrivateTemplate(this);
+
+        if (template != null) {
+            List<TemplateResponse> templateResponses;
+            if (isBareMetal()) {
+                templateResponses = _responseGenerator.createTemplateResponses(ResponseView.Restricted, template.getId(), vmId);
+            } else {
+                templateResponses = _responseGenerator.createTemplateResponses(ResponseView.Restricted, template.getId(), snapshotId, volumeId, false);
+            }
+            TemplateResponse response = new TemplateResponse();
+            if (templateResponses != null && !templateResponses.isEmpty()) {
+                response = templateResponses.get(0);
+            }
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create private template");
+        }
+
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java
new file mode 100755
index 00000000000..3cee148f759
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java
@@ -0,0 +1,127 @@
+// 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.template;
+
+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.SuccessResponse;
+import org.apache.cloudstack.api.response.TemplateResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.template.VirtualMachineTemplate;
+import com.cloud.user.Account;
+
+@APICommand(name = "deleteTemplate",
+            responseObject = SuccessResponse.class,
+            description = "Deletes a template from the system. All virtual machines using the deleted template will not be affected.",
+            requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class DeleteTemplateCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(DeleteTemplateCmd.class.getName());
+    private static final String s_name = "deletetemplateresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "the ID of the template")
+    private Long id;
+
+    @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the ID of zone of the template")
+    private Long zoneId;
+
+    @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force delete a template.", since = "4.9+")
+    private Boolean forced;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    public Long getZoneId() {
+        return zoneId;
+    }
+
+    public boolean isForced() {
+        return (forced != null) ? forced : true;
+    }
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getStaticName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        VirtualMachineTemplate template = _entityMgr.findById(VirtualMachineTemplate.class, getId());
+        if (template != null) {
+            return template.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_TEMPLATE_DELETE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "Deleting template " + this._uuidMgr.getUuid(VirtualMachineTemplate.class, getId());
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.Template;
+    }
+
+    @Override
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    @Override
+    public void execute() {
+        CallContext.current().setEventDetails("Template Id: " + this._uuidMgr.getUuid(VirtualMachineTemplate.class, getId()));
+        boolean result = _templateService.deleteTemplate(this);
+        if (result) {
+            SuccessResponse response = new SuccessResponse(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete template");
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java
new file mode 100644
index 00000000000..f0e7b0803e9
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java
@@ -0,0 +1,147 @@
+// 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.template;
+
+import com.cloud.dc.DataCenter;
+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.ExtractResponse;
+import org.apache.cloudstack.api.response.TemplateResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InternalErrorException;
+import com.cloud.template.VirtualMachineTemplate;
+import com.cloud.user.Account;
+
+@APICommand(name = "extractTemplate", description = "Extracts a template", responseObject = ExtractResponse.class,
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class ExtractTemplateCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(ExtractTemplateCmd.class.getName());
+
+    private static final String s_name = "extracttemplateresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "the ID of the template")
+    private Long id;
+
+    @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = false, length = 2048, description = "the url to which the ISO would be extracted")
+    private String url;
+
+    @Parameter(name = ApiConstants.ZONE_ID,
+               type = CommandType.UUID,
+               entityType = ZoneResponse.class,
+               required = false,
+               description = "the ID of the zone where the ISO is originally located")
+    private Long zoneId;
+
+    @Parameter(name = ApiConstants.MODE, type = CommandType.STRING, required = true, description = "the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD")
+    private String mode;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public Long getZoneId() {
+        return zoneId;
+    }
+
+    public String getMode() {
+        return mode;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getStaticName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        VirtualMachineTemplate template = _entityMgr.findById(VirtualMachineTemplate.class, getId());
+        if (template != null) {
+            return template.getAccountId();
+        }
+
+        // invalid id, parent this command to SYSTEM so ERROR events are tracked
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_TEMPLATE_EXTRACT;
+    }
+
+    @Override
+    public String getEventDescription() {
+     return "extracting template: " + this._uuidMgr.getUuid(VirtualMachineTemplate.class, getId()) + ((getZoneId() != null) ? " from zone: " + this._uuidMgr.getUuid(DataCenter.class, getZoneId()) : "");
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.Template;
+    }
+
+    @Override
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    @Override
+    public void execute() {
+        try {
+            CallContext.current().setEventDetails(getEventDescription());
+            String uploadUrl = _templateService.extract(this);
+            if (uploadUrl != null) {
+                ExtractResponse response = _responseGenerator.createExtractResponse(id, zoneId, getEntityOwnerId(), mode, uploadUrl);
+                response.setResponseName(getCommandName());
+                this.setResponseObject(response);
+            } else {
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to extract template");
+            }
+        } catch (InternalErrorException ex) {
+            s_logger.warn("Exception: ", ex);
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
+        }
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/GetUploadParamsForTemplateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/template/GetUploadParamsForTemplateCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/template/GetUploadParamsForTemplateCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/template/GetUploadParamsForTemplateCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplatePermissionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/template/UpdateTemplatePermissionsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplatePermissionsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/template/UpdateTemplatePermissionsCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java
new file mode 100644
index 00000000000..009c4fd2fdf
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java
@@ -0,0 +1,195 @@
+// 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.vm;
+
+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.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.NicResponse;
+import org.apache.cloudstack.api.response.NicSecondaryIpResponse;
+import org.apache.cloudstack.context.CallContext;
+import org.apache.log4j.Logger;
+
+import com.cloud.dc.DataCenter;
+import com.cloud.dc.DataCenter.NetworkType;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientAddressCapacityException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.Network;
+import com.cloud.utils.net.NetUtils;
+import com.cloud.vm.Nic;
+import com.cloud.vm.NicSecondaryIp;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "addIpToNic", description = "Assigns secondary IP to NIC", responseObject = NicSecondaryIpResponse.class,
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class AddIpToVmNicCmd extends BaseAsyncCreateCmd {
+    public static final Logger s_logger = Logger.getLogger(AddIpToVmNicCmd.class.getName());
+    private static final String s_name = "addiptovmnicresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @Parameter(name = ApiConstants.NIC_ID, type = CommandType.UUID, entityType = NicResponse.class, required = true, description = "the ID of the nic to which you want to assign private IP")
+    private Long nicId;
+
+    @Parameter(name = ApiConstants.IP_ADDRESS, type = CommandType.STRING, required = false, description = "Secondary IP Address")
+    private String ipAddr;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public String getEntityTable() {
+        return "nic_secondary_ips";
+    }
+
+    private long getNetworkId() {
+        Nic nic = _entityMgr.findById(Nic.class, nicId);
+        if (nic == null) {
+            throw new InvalidParameterValueException("Can't find network id for specified nic");
+        }
+        return nic.getNetworkId();
+    }
+
+    public long getNicId() {
+        return nicId;
+    }
+
+    private String getIpaddress() {
+        if (ipAddr != null) {
+            return ipAddr;
+        } else {
+            return null;
+        }
+    }
+
+    private NetworkType getNetworkType() {
+        Network ntwk = _entityMgr.findById(Network.class, getNetworkId());
+        DataCenter dc = _entityMgr.findById(DataCenter.class, ntwk.getDataCenterId());
+        return dc.getNetworkType();
+    }
+
+    private boolean isZoneSGEnabled() {
+        Network ntwk = _entityMgr.findById(Network.class, getNetworkId());
+        DataCenter dc = _entityMgr.findById(DataCenter.class, ntwk.getDataCenterId());
+        return dc.isSecurityGroupEnabled();
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_NIC_SECONDARY_IP_ASSIGN;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "associating ip to nic id=" + this._uuidMgr.getUuid(Nic.class, getNicId()) + " belonging to network id=" + this._uuidMgr.getUuid(Network.class, getNetworkId());
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getResultObjectName() {
+        return "addressinfo";
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException, ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException {
+
+        CallContext.current().setEventDetails("Nic Id: " + this._uuidMgr.getUuid(Nic.class, getNicId()));
+        NicSecondaryIp result = _entityMgr.findById(NicSecondaryIp.class, getEntityId());
+
+        if (result != null) {
+            CallContext.current().setEventDetails("secondary Ip Id: " + getEntityUuid());
+            boolean success = false;
+            success = _networkService.configureNicSecondaryIp(result, isZoneSGEnabled());
+
+            if (success == false) {
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to set security group rules for the secondary ip");
+            }
+
+            NicSecondaryIpResponse response = _responseGenerator.createSecondaryIPToNicResponse(result);
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign secondary ip to nic");
+        }
+    }
+
+
+    @Override
+    public Long getSyncObjId() {
+        return getNetworkId();
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.IpAddress;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Nic nic = _entityMgr.findById(Nic.class, nicId);
+        if (nic == null) {
+            throw new InvalidParameterValueException("Can't find nic for id specified");
+        }
+        long vmId = nic.getInstanceId();
+        VirtualMachine vm = _entityMgr.findById(VirtualMachine.class, vmId);
+
+        return vm.getAccountId();
+    }
+
+    @Override
+    public void create() throws ResourceAllocationException {
+        String ip;
+        NicSecondaryIp result;
+        String secondaryIp = null;
+        if ((ip = getIpaddress()) != null) {
+            if (!NetUtils.isValidIp4(ip)) {
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Invalid ip address " + ip);
+            }
+        }
+
+        try {
+            result = _networkService.allocateSecondaryGuestIP(getNicId(), getIpaddress());
+            if (result != null) {
+                setEntityId(result.getId());
+                setEntityUuid(result.getUuid());
+            }
+        } catch (InsufficientAddressCapacityException e) {
+            throw new InvalidParameterValueException("Allocating guest ip for nic failed : " + e.getMessage());
+        }
+
+        if (result == null) {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign secondary ip to nic");
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java
new file mode 100644
index 00000000000..a5a3f6ecc33
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java
@@ -0,0 +1,174 @@
+// 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.vm;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.cloud.network.Network;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.ACL;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiConstants.VMDetails;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.user.Account;
+import com.cloud.uservm.UserVm;
+import com.cloud.utils.net.Dhcp;
+import com.cloud.utils.net.NetUtils;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "addNicToVirtualMachine", description = "Adds VM to specified network by creating a NIC", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+public class AddNicToVMCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(AddNicToVMCmd.class);
+    private static final String s_name = "addnictovirtualmachineresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType=UserVmResponse.class,
+            required=true, description="Virtual Machine ID")
+    private Long vmId;
+
+    @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, required = true, description = "Network ID")
+    private Long netId;
+
+    @Parameter(name = ApiConstants.IP_ADDRESS, type = CommandType.STRING, description = "IP Address for the new network")
+    private String ipaddr;
+
+    @Parameter(name = ApiConstants.MAC_ADDRESS, type = CommandType.STRING, description = "Mac Address for the new network")
+    private String macaddr;
+
+    @Parameter(name = ApiConstants.DHCP_OPTIONS, type = CommandType.MAP, description = "DHCP options which are passed to the nic"
+            + " Example: dhcpoptions[0].dhcp:114=url&dhcpoptions[0].dhcp:66=www.test.com")
+    private Map dhcpOptions;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getVmId() {
+        return vmId;
+    }
+
+    public Long getNetworkId() {
+        return netId;
+    }
+
+    public String getIpAddress() {
+        return ipaddr;
+    }
+
+    public String getMacAddress() {
+        if (macaddr == null) {
+            return null;
+        }
+        if(!NetUtils.isValidMac(macaddr)) {
+            throw new InvalidParameterValueException("Mac address is not valid: " + macaddr);
+        } else if(!NetUtils.isUnicastMac(macaddr)) {
+            throw new InvalidParameterValueException("Mac address is not unicast: " + macaddr);
+        }
+        return NetUtils.standardizeMacAddress(macaddr);
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getResultObjectName() {
+        return "virtualmachine";
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_NIC_CREATE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "Adding network " + this._uuidMgr.getUuid(Network.class, getNetworkId()) + " to user vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId());
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        UserVm vm = _responseGenerator.findUserVmById(getVmId());
+        if (vm == null) {
+             return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
+        }
+        return vm.getAccountId();
+    }
+
+    public Map<Integer, String> getDhcpOptionsMap() {
+        Map<Integer, String> dhcpOptionsMap = new HashMap<>();
+        if (dhcpOptions != null && !dhcpOptions.isEmpty()) {
+
+            Collection<Map<String, String>> paramsCollection = this.dhcpOptions.values();
+            for(Map<String, String> dhcpNetworkOptions : paramsCollection) {
+                for (String key : dhcpNetworkOptions.keySet()) {
+                    if (key.startsWith(ApiConstants.DHCP_PREFIX)) {
+                        int dhcpOptionValue = Integer.parseInt(key.replaceFirst(ApiConstants.DHCP_PREFIX, ""));
+                        dhcpOptionsMap.put(dhcpOptionValue, dhcpNetworkOptions.get(key));
+                    } else {
+                        Dhcp.DhcpOptionCode dhcpOptionEnum = Dhcp.DhcpOptionCode.valueOfString(key);
+                        dhcpOptionsMap.put(dhcpOptionEnum.getCode(), dhcpNetworkOptions.get(key));
+                    }
+                }
+
+            }
+        }
+
+        return dhcpOptionsMap;
+    }
+
+    @Override
+    public void execute() {
+        CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()) + " Network Id: " + this._uuidMgr.getUuid(Network.class, getNetworkId()));
+        UserVm result = _userVmService.addNicToVirtualMachine(this);
+        ArrayList<VMDetails> dc = new ArrayList<VMDetails>();
+        dc.add(VMDetails.valueOf("nics"));
+        EnumSet<VMDetails> details = EnumSet.copyOf(dc);
+        if (result != null){
+            UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", details, result).get(0);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add NIC to vm. Refer to server logs for details.");
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
new file mode 100644
index 00000000000..29d4c97ce0d
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
@@ -0,0 +1,598 @@
+// 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.vm;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.affinity.AffinityGroupResponse;
+import org.apache.cloudstack.api.ACL;
+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.BaseAsyncCreateCustomIdCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.DiskOfferingResponse;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.HostResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.api.response.ProjectResponse;
+import org.apache.cloudstack.api.response.SecurityGroupResponse;
+import org.apache.cloudstack.api.response.ServiceOfferingResponse;
+import org.apache.cloudstack.api.response.TemplateResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.cloudstack.context.CallContext;
+import org.apache.commons.collections.MapUtils;
+
+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;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.network.Network;
+import com.cloud.network.Network.IpAddresses;
+import com.cloud.offering.DiskOffering;
+import com.cloud.template.VirtualMachineTemplate;
+import com.cloud.uservm.UserVm;
+import com.cloud.utils.net.Dhcp;
+import com.cloud.utils.net.NetUtils;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "deployVirtualMachine", description = "Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+public class DeployVMCmd extends BaseAsyncCreateCustomIdCmd implements SecurityGroupAction {
+    public static final Logger s_logger = Logger.getLogger(DeployVMCmd.class.getName());
+
+    private static final String s_name = "deployvirtualmachineresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "availability zone for the virtual machine")
+    private Long zoneId;
+
+    @ACL
+    @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, required = true, description = "the ID of the service offering for the virtual machine")
+    private Long serviceOfferingId;
+
+    @ACL
+    @Parameter(name = ApiConstants.TEMPLATE_ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "the ID of the template for the virtual machine")
+    private Long templateId;
+
+    @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "host name for the virtual machine")
+    private String name;
+
+    @Parameter(name = ApiConstants.DISPLAY_NAME, type = CommandType.STRING, description = "an optional user generated name for the virtual machine")
+    private String displayName;
+
+    //Owner information
+    @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the virtual machine. Must be used with domainId.")
+    private String accountName;
+
+    @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used.")
+    private Long domainId;
+
+    //Network information
+    //@ACL(accessType = AccessType.UseEntry)
+    @Parameter(name = ApiConstants.NETWORK_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = NetworkResponse.class, description = "list of network ids used by virtual machine. Can't be specified with ipToNetworkList parameter")
+    private List<Long> networkIds;
+
+    //DataDisk information
+    @ACL
+    @Parameter(name = ApiConstants.DISK_OFFERING_ID, type = CommandType.UUID, entityType = DiskOfferingResponse.class, description = "the ID of the disk offering for the virtual machine. If the template is of ISO format,"
+            + " the diskOfferingId is for the root disk volume. Otherwise this parameter is used to indicate the "
+            + "offering for the data disk volume. If the templateId parameter passed is from a Template object,"
+            + " the diskOfferingId refers to a DATA Disk Volume created. If the templateId parameter passed is "
+            + "from an ISO object, the diskOfferingId refers to a ROOT Disk Volume created.")
+    private Long diskOfferingId;
+
+    @Parameter(name = ApiConstants.SIZE, type = CommandType.LONG, description = "the arbitrary size for the DATADISK volume. Mutually exclusive with diskOfferingId")
+    private Long size;
+
+    @Parameter(name = ApiConstants.ROOT_DISK_SIZE,
+            type = CommandType.LONG,
+            description = "Optional field to resize root disk on deploy. Value is in GB. Only applies to template-based deployments. Analogous to details[0].rootdisksize, which takes precedence over this parameter if both are provided",
+            since = "4.4")
+    private Long rootdisksize;
+
+    @Parameter(name = ApiConstants.GROUP, type = CommandType.STRING, description = "an optional group for the virtual machine")
+    private String group;
+
+    @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "the hypervisor on which to deploy the virtual machine. "
+            + "The parameter is required and respected only when hypervisor info is not set on the ISO/Template passed to the call")
+    private String hypervisor;
+
+    @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.SSH_KEYPAIR, type = CommandType.STRING, description = "name of the ssh key pair used to login to the virtual machine")
+    private String sshKeyPairName;
+
+    @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, description = "destination Host ID to deploy the VM to - parameter available for root admin only")
+    private Long hostId;
+
+    @ACL
+    @Parameter(name = ApiConstants.SECURITY_GROUP_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = SecurityGroupResponse.class, description = "comma separated list of security groups id that going to be applied to the virtual machine. "
+            + "Should be passed only when vm is created from a zone with Basic Network support." + " Mutually exclusive with securitygroupnames parameter")
+    private List<Long> securityGroupIdList;
+
+    @ACL
+    @Parameter(name = ApiConstants.SECURITY_GROUP_NAMES, type = CommandType.LIST, collectionType = CommandType.STRING, entityType = SecurityGroupResponse.class, description = "comma separated list of security groups names that going to be applied to the virtual machine."
+            + " Should be passed only when vm is created from a zone with Basic Network support. " + "Mutually exclusive with securitygroupids parameter")
+    private List<String> securityGroupNameList;
+
+    @Parameter(name = ApiConstants.IP_NETWORK_LIST, type = CommandType.MAP, description = "ip to network mapping. Can't be specified with networkIds parameter."
+            + " Example: iptonetworklist[0].ip=10.10.10.11&iptonetworklist[0].ipv6=fc00:1234:5678::abcd&iptonetworklist[0].networkid=uuid&iptonetworklist[0].mac=aa:bb:cc:dd:ee::ff - requests to use ip 10.10.10.11 in network id=uuid")
+    private Map ipToNetworkList;
+
+    @Parameter(name = ApiConstants.IP_ADDRESS, type = CommandType.STRING, description = "the ip address for default vm's network")
+    private String ipAddress;
+
+    @Parameter(name = ApiConstants.IP6_ADDRESS, type = CommandType.STRING, description = "the ipv6 address for default vm's network")
+    private String ip6Address;
+
+    @Parameter(name = ApiConstants.MAC_ADDRESS, type = CommandType.STRING, description = "the mac address for default vm's network")
+    private String macAddress;
+
+    @Parameter(name = ApiConstants.KEYBOARD, type = CommandType.STRING, description = "an optional keyboard device type for the virtual machine. valid value can be one of de,de-ch,es,fi,fr,fr-be,fr-ch,is,it,jp,nl-be,no,pt,uk,us")
+    private String keyboard;
+
+    @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Deploy vm for the project")
+    private Long projectId;
+
+    @Parameter(name = ApiConstants.START_VM, type = CommandType.BOOLEAN, description = "true if start vm after creating; defaulted to true if not specified")
+    private Boolean startVm;
+
+    @ACL
+    @Parameter(name = ApiConstants.AFFINITY_GROUP_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = AffinityGroupResponse.class, description = "comma separated list of affinity groups id that are going to be applied to the virtual machine."
+            + " Mutually exclusive with affinitygroupnames parameter")
+    private List<Long> affinityGroupIdList;
+
+    @ACL
+    @Parameter(name = ApiConstants.AFFINITY_GROUP_NAMES, type = CommandType.LIST, collectionType = CommandType.STRING, entityType = AffinityGroupResponse.class, description = "comma separated list of affinity groups names that are going to be applied to the virtual machine."
+            + "Mutually exclusive with affinitygroupids parameter")
+    private List<String> 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.", authorized = {RoleType.Admin})
+    private Boolean displayVm;
+
+    @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, since = "4.3", description = "used to specify the custom parameters.")
+    private Map details;
+
+    @Parameter(name = ApiConstants.DEPLOYMENT_PLANNER, type = CommandType.STRING, description = "Deployment planner to use for vm allocation. Available to ROOT admin only", since = "4.4", authorized = { RoleType.Admin })
+    private String deploymentPlanner;
+
+    @Parameter(name = ApiConstants.DHCP_OPTIONS_NETWORK_LIST, type = CommandType.MAP, description = "DHCP options which are passed to the VM on start up"
+            + " Example: dhcpoptionsnetworklist[0].dhcp:114=url&dhcpoptionsetworklist[0].networkid=networkid&dhcpoptionsetworklist[0].dhcp:66=www.test.com")
+    private Map dhcpOptionsNetworkList;
+
+    @Parameter(name = ApiConstants.DATADISK_OFFERING_LIST, type = CommandType.MAP, since = "4.11", description = "datadisk template to disk-offering mapping;" +
+            " an optional parameter used to create additional data disks from datadisk templates; can't be specified with diskOfferingId parameter")
+    private Map dataDiskTemplateToDiskOfferingList;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public String getAccountName() {
+        if (accountName == null) {
+            return CallContext.current().getCallingAccount().getAccountName();
+        }
+        return accountName;
+    }
+
+    public Long getDiskOfferingId() {
+        return diskOfferingId;
+    }
+
+    public String getDeploymentPlanner() {
+        return deploymentPlanner;
+    }
+
+    public String getDisplayName() {
+        return displayName;
+    }
+
+    public Long getDomainId() {
+        if (domainId == null) {
+            return CallContext.current().getCallingAccount().getDomainId();
+        }
+        return domainId;
+    }
+
+    public Map<String, String> getDetails() {
+        Map<String, String> customparameterMap = new HashMap<String, String>();
+        if (details != null && details.size() != 0) {
+            Collection parameterCollection = details.values();
+            Iterator iter = parameterCollection.iterator();
+            while (iter.hasNext()) {
+                HashMap<String, String> value = (HashMap<String, String>)iter.next();
+                for (Map.Entry<String,String> entry: value.entrySet()) {
+                    customparameterMap.put(entry.getKey(),entry.getValue());
+                }
+            }
+        }
+        if (rootdisksize != null && !customparameterMap.containsKey("rootdisksize")) {
+            customparameterMap.put("rootdisksize", rootdisksize.toString());
+        }
+        return customparameterMap;
+    }
+
+    public String getGroup() {
+        return group;
+    }
+
+    public HypervisorType getHypervisor() {
+        return HypervisorType.getType(hypervisor);
+    }
+
+    public Boolean isDisplayVm() {
+        return displayVm;
+    }
+
+    @Override
+    public boolean isDisplay() {
+        if(displayVm == null)
+            return true;
+        else
+            return displayVm;
+    }
+
+    public List<String> getSecurityGroupNameList() {
+        return securityGroupNameList;
+    }
+
+    public List<Long> getSecurityGroupIdList() {
+        return securityGroupIdList;
+    }
+
+    public Long getServiceOfferingId() {
+        return serviceOfferingId;
+    }
+
+    public Long getSize() {
+        return size;
+    }
+
+    public Long getTemplateId() {
+        return templateId;
+    }
+
+    public String getUserData() {
+        return userData;
+    }
+
+    public Long getZoneId() {
+        return zoneId;
+    }
+
+    public List<Long> getNetworkIds() {
+       if (ipToNetworkList != null && !ipToNetworkList.isEmpty()) {
+           if ((networkIds != null && !networkIds.isEmpty()) || ipAddress != null || getIp6Address() != null) {
+               throw new InvalidParameterValueException("ipToNetworkMap can't be specified along with networkIds or ipAddress");
+           } else {
+               List<Long> networks = new ArrayList<Long>();
+               networks.addAll(getIpToNetworkMap().keySet());
+               return networks;
+           }
+       }
+        return networkIds;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getSSHKeyPairName() {
+        return sshKeyPairName;
+    }
+
+    public Long getHostId() {
+        return hostId;
+    }
+
+    public boolean getStartVm() {
+        return startVm == null ? true : startVm;
+    }
+
+    public Map<Long, IpAddresses> getIpToNetworkMap() {
+        if ((networkIds != null || ipAddress != null || getIp6Address() != null) && ipToNetworkList != null) {
+            throw new InvalidParameterValueException("NetworkIds and ipAddress can't be specified along with ipToNetworkMap parameter");
+        }
+        LinkedHashMap<Long, IpAddresses> ipToNetworkMap = null;
+        if (ipToNetworkList != null && !ipToNetworkList.isEmpty()) {
+            ipToNetworkMap = new LinkedHashMap<Long, IpAddresses>();
+            Collection ipsCollection = ipToNetworkList.values();
+            Iterator iter = ipsCollection.iterator();
+            while (iter.hasNext()) {
+                HashMap<String, String> ips = (HashMap<String, String>)iter.next();
+                Long networkId;
+                Network network = _networkService.getNetwork(ips.get("networkid"));
+                if (network != null) {
+                    networkId = network.getId();
+                } else {
+                    try {
+                        networkId = Long.parseLong(ips.get("networkid"));
+                    } catch (NumberFormatException e) {
+                        throw new InvalidParameterValueException("Unable to translate and find entity with networkId: " + ips.get("networkid"));
+                    }
+                }
+                String requestedIp = ips.get("ip");
+                String requestedIpv6 = ips.get("ipv6");
+                String requestedMac = ips.get("mac");
+                if (requestedIpv6 != null) {
+                    requestedIpv6 = NetUtils.standardizeIp6Address(requestedIpv6);
+                }
+                if (requestedMac != null) {
+                    if(!NetUtils.isValidMac(requestedMac)) {
+                        throw new InvalidParameterValueException("Mac address is not valid: " + requestedMac);
+                    } else if(!NetUtils.isUnicastMac(requestedMac)) {
+                        throw new InvalidParameterValueException("Mac address is not unicast: " + requestedMac);
+                    }
+                    requestedMac = NetUtils.standardizeMacAddress(requestedMac);
+                }
+                IpAddresses addrs = new IpAddresses(requestedIp, requestedIpv6, requestedMac);
+                ipToNetworkMap.put(networkId, addrs);
+            }
+        }
+
+        return ipToNetworkMap;
+    }
+
+    public String getIpAddress() {
+        return ipAddress;
+    }
+
+    public String getIp6Address() {
+        if (ip6Address == null) {
+            return null;
+        }
+        return NetUtils.standardizeIp6Address(ip6Address);
+    }
+
+
+    public String getMacAddress() {
+        if (macAddress == null) {
+            return null;
+        }
+        if(!NetUtils.isValidMac(macAddress)) {
+            throw new InvalidParameterValueException("Mac address is not valid: " + macAddress);
+        } else if(!NetUtils.isUnicastMac(macAddress)) {
+            throw new InvalidParameterValueException("Mac address is not unicast: " + macAddress);
+        }
+        return NetUtils.standardizeMacAddress(macAddress);
+    }
+
+    public List<Long> getAffinityGroupIdList() {
+        if (affinityGroupNameList != null && affinityGroupIdList != null) {
+            throw new InvalidParameterValueException("affinitygroupids parameter is mutually exclusive with affinitygroupnames parameter");
+        }
+
+        // transform group names to ids here
+        if (affinityGroupNameList != null) {
+            List<Long> affinityGroupIds = new ArrayList<Long>();
+            for (String groupName : affinityGroupNameList) {
+                Long groupId = _responseGenerator.getAffinityGroupId(groupName, getEntityOwnerId());
+                if (groupId == null) {
+                    throw new InvalidParameterValueException("Unable to find affinity group by name " + groupName);
+                } else {
+                    affinityGroupIds.add(groupId);
+                }
+            }
+            return affinityGroupIds;
+        } else {
+            return affinityGroupIdList;
+        }
+    }
+
+    public String getKeyboard() {
+        // TODO Auto-generated method stub
+        return keyboard;
+    }
+
+    public Map<String, Map<Integer, String>> getDhcpOptionsMap() {
+        Map<String, Map<Integer, String>> dhcpOptionsMap = new HashMap<>();
+        if (dhcpOptionsNetworkList != null && !dhcpOptionsNetworkList.isEmpty()) {
+
+            Collection<Map<String, String>> paramsCollection = this.dhcpOptionsNetworkList.values();
+            for (Map<String, String> dhcpNetworkOptions : paramsCollection) {
+                String networkId = dhcpNetworkOptions.get(ApiConstants.NETWORK_ID);
+
+                if (networkId == null) {
+                    throw new IllegalArgumentException("No networkid specified when providing extra dhcp options.");
+                }
+
+                Map<Integer, String> dhcpOptionsForNetwork = new HashMap<>();
+                dhcpOptionsMap.put(networkId, dhcpOptionsForNetwork);
+
+                for (String key : dhcpNetworkOptions.keySet()) {
+                    if (key.startsWith(ApiConstants.DHCP_PREFIX)) {
+                        int dhcpOptionValue = Integer.parseInt(key.replaceFirst(ApiConstants.DHCP_PREFIX, ""));
+                        dhcpOptionsForNetwork.put(dhcpOptionValue, dhcpNetworkOptions.get(key));
+                    } else if (!key.equals(ApiConstants.NETWORK_ID)) {
+                        Dhcp.DhcpOptionCode dhcpOptionEnum = Dhcp.DhcpOptionCode.valueOfString(key);
+                        dhcpOptionsForNetwork.put(dhcpOptionEnum.getCode(), dhcpNetworkOptions.get(key));
+                    }
+                }
+
+            }
+        }
+
+        return dhcpOptionsMap;
+    }
+
+    public Map<Long, DiskOffering> getDataDiskTemplateToDiskOfferingMap() {
+        if (diskOfferingId != null && dataDiskTemplateToDiskOfferingList != null) {
+            throw new InvalidParameterValueException("diskofferingid paramter can't be specified along with datadisktemplatetodiskofferinglist parameter");
+        }
+        if (MapUtils.isEmpty(dataDiskTemplateToDiskOfferingList)) {
+            return new HashMap<Long, DiskOffering>();
+        }
+
+        HashMap<Long, DiskOffering> dataDiskTemplateToDiskOfferingMap = new HashMap<Long, DiskOffering>();
+        for (Object objDataDiskTemplates : dataDiskTemplateToDiskOfferingList.values()) {
+            HashMap<String, String> dataDiskTemplates = (HashMap<String, String>) objDataDiskTemplates;
+            Long dataDiskTemplateId;
+            DiskOffering dataDiskOffering = null;
+            VirtualMachineTemplate dataDiskTemplate= _entityMgr.findByUuid(VirtualMachineTemplate.class, dataDiskTemplates.get("datadisktemplateid"));
+            if (dataDiskTemplate == null) {
+                dataDiskTemplate = _entityMgr.findById(VirtualMachineTemplate.class, dataDiskTemplates.get("datadisktemplateid"));
+                if (dataDiskTemplate == null)
+                    throw new InvalidParameterValueException("Unable to translate and find entity with datadisktemplateid " + dataDiskTemplates.get("datadisktemplateid"));
+            }
+            dataDiskTemplateId = dataDiskTemplate.getId();
+            dataDiskOffering = _entityMgr.findByUuid(DiskOffering.class, dataDiskTemplates.get("diskofferingid"));
+            if (dataDiskOffering == null) {
+                dataDiskOffering = _entityMgr.findById(DiskOffering.class, dataDiskTemplates.get("diskofferingid"));
+                if (dataDiskOffering == null)
+                    throw new InvalidParameterValueException("Unable to translate and find entity with diskofferingId " + dataDiskTemplates.get("diskofferingid"));
+            }
+            dataDiskTemplateToDiskOfferingMap.put(dataDiskTemplateId, dataDiskOffering);
+        }
+        return dataDiskTemplateToDiskOfferingMap;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getResultObjectName() {
+        return "virtualmachine";
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
+        if (accountId == null) {
+            return CallContext.current().getCallingAccount().getId();
+        }
+
+        return accountId;
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VM_CREATE;
+    }
+
+    @Override
+    public String getCreateEventType() {
+        return EventTypes.EVENT_VM_CREATE;
+    }
+
+    @Override
+    public String getCreateEventDescription() {
+        return "creating Vm";
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "starting Vm. Vm Id: " + getEntityUuid();
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.VirtualMachine;
+    }
+
+    @Override
+    public void execute() {
+        UserVm result;
+
+        if (getStartVm()) {
+            try {
+                CallContext.current().setEventDetails("Vm Id: " + getEntityUuid());
+                result = _userVmService.startVirtualMachine(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 (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());
+            }
+        } else {
+            result = _userVmService.getUserVm(getEntityId());
+        }
+
+        if (result != null) {
+            UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", result).get(0);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to deploy vm uuid:"+getEntityUuid());
+        }
+    }
+
+
+    @Override
+    public void create() throws ResourceAllocationException {
+        try {
+            UserVm vm = _userVmService.createVirtualMachine(this);
+
+            if (vm != null) {
+                setEntityId(vm.getId());
+                setEntityUuid(vm.getUuid());
+            } else {
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to deploy vm");
+            }
+        } catch (InsufficientCapacityException ex) {
+            s_logger.info(ex);
+            s_logger.trace(ex.getMessage(), ex);
+            throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
+        } 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 (ResourceAllocationException ex) {
+            s_logger.warn("Exception: ", ex);
+            throw new ServerApiException(ApiErrorCode.RESOURCE_ALLOCATION_ERROR, ex.getMessage());
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java
new file mode 100644
index 00000000000..730c6776772
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java
@@ -0,0 +1,137 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.user.vm;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.ACL;
+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.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "destroyVirtualMachine", description = "Destroys a virtual machine.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class},
+            requestHasSensitiveInfo = false,
+            responseHasSensitiveInfo = true)
+public class DestroyVMCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(DestroyVMCmd.class.getName());
+
+    private static final String s_name = "destroyvirtualmachineresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserVmResponse.class,
+            required=true, description="The ID of the virtual machine")
+    private Long id;
+
+    @Parameter(name = ApiConstants.EXPUNGE,
+               type = CommandType.BOOLEAN,
+               description = "If true is passed, the vm is expunged immediately. False by default.",
+               since = "4.2.1")
+    private Boolean expunge;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    public boolean getExpunge() {
+        if (expunge == null) {
+            return false;
+        }
+        return expunge;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        UserVm vm = _responseGenerator.findUserVmById(getId());
+        if (vm != null) {
+            return vm.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VM_DESTROY;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "destroying vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.VirtualMachine;
+    }
+
+    @Override
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException, ConcurrentOperationException {
+        CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
+        UserVm result = _userVmService.destroyVm(this);
+
+        UserVmResponse response = new UserVmResponse();
+        if (result != null) {
+            List<UserVmResponse> responses = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", result);
+            if (responses != null && !responses.isEmpty()) {
+                response = responses.get(0);
+            }
+            response.setResponseName("virtualmachine");
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to destroy vm");
+        }
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/GetVMPasswordCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/GetVMPasswordCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vm/GetVMPasswordCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vm/GetVMPasswordCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ListNicsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ListNicsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vm/ListNicsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vm/ListNicsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java
new file mode 100644
index 00000000000..b524257ef7a
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java
@@ -0,0 +1,115 @@
+// 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.vm;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.ACL;
+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.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "rebootVirtualMachine", description = "Reboots a virtual machine.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+public class RebootVMCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(RebootVMCmd.class.getName());
+    private static final String s_name = "rebootvirtualmachineresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserVmResponse.class,
+            required=true, description="The ID of the virtual machine")
+    private Long id;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        UserVm vm = _responseGenerator.findUserVmById(getId());
+        if (vm != null) {
+            return vm.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VM_REBOOT;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "rebooting user vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.VirtualMachine;
+    }
+
+    @Override
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException {
+        CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
+        UserVm result;
+        result = _userVmService.rebootVirtualMachine(this);
+        if (result !=null){
+            UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", result).get(0);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reboot vm instance");
+        }
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/RemoveIpFromVmNicCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RemoveIpFromVmNicCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vm/RemoveIpFromVmNicCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vm/RemoveIpFromVmNicCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RemoveNicFromVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RemoveNicFromVMCmd.java
new file mode 100644
index 00000000000..677b482aa94
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RemoveNicFromVMCmd.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.vm;
+
+import java.util.ArrayList;
+import java.util.EnumSet;
+
+import com.cloud.vm.Nic;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.ACL;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiConstants.VMDetails;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.NicResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "removeNicFromVirtualMachine", description = "Removes VM from specified network by deleting a NIC", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+public class RemoveNicFromVMCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(RemoveNicFromVMCmd.class);
+    private static final String s_name = "removenicfromvirtualmachineresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType=UserVmResponse.class,
+            required=true, description="Virtual Machine ID")
+    private Long vmId;
+
+    @Parameter(name = ApiConstants.NIC_ID, type = CommandType.UUID, entityType = NicResponse.class, required = true, description = "NIC ID")
+    private Long nicId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getVmId() {
+        return vmId;
+    }
+
+    public Long getNicId() {
+        return nicId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getResultObjectName() {
+        return "virtualmachine";
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_NIC_DELETE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "Removing NIC " + this._uuidMgr.getUuid(Nic.class, getNicId()) + " from user vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId());
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        UserVm vm = _responseGenerator.findUserVmById(getVmId());
+        if (vm == null) {
+             return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
+        }
+        return vm.getAccountId();
+    }
+
+    @Override
+    public void execute() {
+        CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()) + " Nic Id: " + this._uuidMgr.getUuid(Nic.class, getNicId()));
+        UserVm result = _userVmService.removeNicFromVirtualMachine(this);
+        ArrayList<VMDetails> dc = new ArrayList<VMDetails>();
+        dc.add(VMDetails.valueOf("nics"));
+        EnumSet<VMDetails> details = EnumSet.copyOf(dc);
+        if (result != null){
+            UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", details, result).get(0);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove NIC from vm, see error log for details");
+        }
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMSSHKeyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMSSHKeyCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vm/ResetVMSSHKeyCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMSSHKeyCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.java
new file mode 100644
index 00000000000..b2b4d036e48
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.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.vm;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+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.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.TemplateResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "restoreVirtualMachine", description = "Restore a VM to original template/ISO or new template/ISO", responseObject = UserVmResponse.class, since = "3.0.0", responseView = ResponseView.Restricted, entityType = {VirtualMachine.class},
+            requestHasSensitiveInfo = false,
+            responseHasSensitiveInfo = true)
+public class RestoreVMCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(RestoreVMCmd.class);
+    private static final String s_name = "restorevmresponse";
+
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType=UserVmResponse.class,
+            required=true, description="Virtual Machine ID")
+    private Long vmId;
+
+    @Parameter(name = ApiConstants.TEMPLATE_ID,
+               type = CommandType.UUID,
+               entityType = TemplateResponse.class,
+               description = "an optional template Id to restore vm from the new template. This can be an ISO id in case of restore vm deployed using ISO")
+    private Long templateId;
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VM_RESTORE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "Restore a VM to orignal template or specific snapshot";
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
+            ResourceAllocationException {
+        UserVm result;
+        CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()));
+        result = _userVmService.restoreVM(this);
+        if (result != null) {
+            UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", result).get(0);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to restore vm " + getVmId());
+        }
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        UserVm vm = _responseGenerator.findUserVmById(getVmId());
+        if (vm == null) {
+             return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
+        }
+        return vm.getAccountId();
+    }
+
+    public long getVmId() {
+        return vmId;
+    }
+
+    public Long getTemplateId() {
+        return templateId;
+    }
+
+    // TODO - Remove vmid param and make it "id" in 5.0 so that we dont have two getters
+    public Long getId() {
+        return getVmId();
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
new file mode 100644
index 00000000000..631cef213b9
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
@@ -0,0 +1,163 @@
+// 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.vm;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import com.cloud.offering.ServiceOffering;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+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.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+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;
+import com.cloud.exception.VirtualMachineMigrationException;
+import com.cloud.user.Account;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
+
+
+@APICommand(name = "scaleVirtualMachine", description = "Scales the virtual machine to a new service offering.", responseObject = SuccessResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class ScaleVMCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(ScaleVMCmd.class.getName());
+    private static final String s_name = "scalevirtualmachineresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserVmResponse.class,
+            required=true, description="The ID of the virtual machine")
+    private Long id;
+
+    @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.UUID, entityType=ServiceOfferingResponse.class,
+            required=true, description="the ID of the service offering for the virtual machine")
+    private Long serviceOfferingId;
+
+    @Parameter(name = ApiConstants.DETAILS, type = BaseCmd.CommandType.MAP, description = "name value pairs of custom parameters for cpu,memory and cpunumber. example details[i].name=value")
+    private Map<String, String> details;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    public Long getServiceOfferingId() {
+        return serviceOfferingId;
+    }
+
+    //instead of reading a map directly we are using collections.
+    //it is because details.values() cannot be cast to a map.
+    //it gives a exception
+    public Map<String, String> getDetails() {
+        Map<String, String> customparameterMap = new HashMap<String, String>();
+        if (details != null && details.size() != 0) {
+            Collection parameterCollection = details.values();
+            Iterator iter = parameterCollection.iterator();
+            while (iter.hasNext()) {
+                HashMap<String, String> value = (HashMap<String, String>)iter.next();
+                for (String key : value.keySet()) {
+                    customparameterMap.put(key, value.get(key));
+                }
+            }
+        }
+        return customparameterMap;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getResultObjectName() {
+        return "virtualmachine";
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        UserVm userVm = _entityMgr.findById(UserVm.class, getId());
+        if (userVm != null) {
+            return userVm.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VM_UPGRADE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "upgrading vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()) + " to service offering: " + this._uuidMgr.getUuid(ServiceOffering.class, getServiceOfferingId());
+    }
+
+    @Override
+    public void execute() {
+        UserVm result;
+        try {
+            result = _userVmService.upgradeVirtualMachine(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){
+            List<UserVmResponse> responseList = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", result);
+            UserVmResponse response = responseList.get(0);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to scale vm");
+        }
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/SecurityGroupAction.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/SecurityGroupAction.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vm/SecurityGroupAction.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vm/SecurityGroupAction.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java
new file mode 100644
index 00000000000..b87c7de0187
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java
@@ -0,0 +1,170 @@
+// 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.vm;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.ACL;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.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.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.HostResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+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;
+import com.cloud.user.Account;
+import com.cloud.uservm.UserVm;
+import com.cloud.utils.exception.ExecutionException;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "startVirtualMachine", responseObject = UserVmResponse.class, description = "Starts a virtual machine.", responseView = ResponseView.Restricted, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+public class StartVMCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(StartVMCmd.class.getName());
+
+    private static final String s_name = "startvirtualmachineresponse";
+
+    // ///////////////////////////////////////////////////
+    // ////////////// API parameters /////////////////////
+    // ///////////////////////////////////////////////////
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType=UserVmResponse.class,
+            required = true, description = "The ID of the virtual machine")
+    private Long id;
+
+    @Parameter(name = ApiConstants.HOST_ID,
+               type = CommandType.UUID,
+               entityType = HostResponse.class,
+               description = "destination Host ID to deploy the VM to - parameter available for root admin only",
+               since = "3.0.1")
+    private Long hostId;
+
+    @Parameter(name = ApiConstants.DEPLOYMENT_PLANNER, type = CommandType.STRING, description = "Deployment planner to use for vm allocation. Available to ROOT admin only", since = "4.4", authorized = { RoleType.Admin })
+    private String deploymentPlanner;
+
+    // ///////////////////////////////////////////////////
+    // ///////////////// Accessors ///////////////////////
+    // ///////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    public Long getHostId() {
+        return hostId;
+    }
+
+    // ///////////////////////////////////////////////////
+    // ///////////// API Implementation///////////////////
+    // ///////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getResultObjectName() {
+        return "virtualmachine";
+    }
+
+    public String getDeploymentPlanner() {
+        return deploymentPlanner;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        UserVm vm = _responseGenerator.findUserVmById(getId());
+        if (vm != null) {
+            return vm.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are
+        // tracked
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VM_START;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "starting user vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.VirtualMachine;
+    }
+
+    @Override
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException, ResourceAllocationException {
+        try {
+            CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
+
+            UserVm result;
+            result = _userVmService.startVirtualMachine(this);
+
+            if (result != null) {
+                UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", result).get(0);
+                response.setResponseName(getCommandName());
+                setResponseObject(response);
+            } else {
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to start a vm");
+            }
+        } catch (ConcurrentOperationException ex) {
+            s_logger.warn("Exception: ", ex);
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
+        } catch (StorageUnavailableException ex) {
+            s_logger.warn("Exception: ", ex);
+            throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+        } 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/main/java/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java
new file mode 100644
index 00000000000..bab8552312a
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/StopVMCmd.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.user.vm;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.ACL;
+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.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.user.Account;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "stopVirtualMachine", responseObject = UserVmResponse.class, description = "Stops a virtual machine.", responseView = ResponseView.Restricted, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+public class StopVMCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(StopVMCmd.class.getName());
+
+    private static final String s_name = "stopvirtualmachineresponse";
+
+    // ///////////////////////////////////////////////////
+    // ////////////// API parameters /////////////////////
+    // ///////////////////////////////////////////////////
+
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType=UserVmResponse.class,
+            required = true, description = "The ID of the virtual machine")
+    private Long id;
+
+    @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM "
+        + "(vm is marked as Stopped even when command fails to be send to the backend, otherwise a force poweroff is attempted).  The caller knows the VM is stopped.")
+    private Boolean forced;
+
+    // ///////////////////////////////////////////////////
+    // ///////////////// Accessors ///////////////////////
+    // ///////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    // ///////////////////////////////////////////////////
+    // ///////////// API Implementation///////////////////
+    // ///////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getResultObjectName() {
+        return "virtualmachine";
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        UserVm vm = _responseGenerator.findUserVmById(getId());
+        if (vm != null) {
+            return vm.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are
+// tracked
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VM_STOP;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "stopping user vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.VirtualMachine;
+    }
+
+    @Override
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    public boolean isForced() {
+        return (forced != null) ? forced : false;
+    }
+
+    @Override
+    public void execute() throws ServerApiException, ConcurrentOperationException {
+        CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
+        UserVm result;
+
+        result = _userVmService.stopVirtualMachine(getId(), isForced());
+
+        if (result != null) {
+            UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", result).get(0);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to stop vm");
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateDefaultNicForVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateDefaultNicForVMCmd.java
new file mode 100644
index 00000000000..7262e23c77d
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateDefaultNicForVMCmd.java
@@ -0,0 +1,121 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.user.vm;
+
+import java.util.ArrayList;
+import java.util.EnumSet;
+
+import com.cloud.vm.Nic;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.ACL;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiConstants.VMDetails;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.NicResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "updateDefaultNicForVirtualMachine", description = "Changes the default NIC on a VM", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+public class UpdateDefaultNicForVMCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(UpdateDefaultNicForVMCmd.class);
+    private static final String s_name = "updatedefaultnicforvirtualmachineresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType=UserVmResponse.class,
+            required=true, description="Virtual Machine ID")
+    private Long vmId;
+
+    @Parameter(name = ApiConstants.NIC_ID, type = CommandType.UUID, entityType = NicResponse.class, required = true, description = "NIC ID")
+    private Long nicId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getVmId() {
+        return vmId;
+    }
+
+    public Long getNicId() {
+        return nicId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getResultObjectName() {
+        return "virtualmachine";
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_NIC_UPDATE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "Updating NIC " + this._uuidMgr.getUuid(Nic.class, getNicId()) + " on user vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId());
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        UserVm vm = _responseGenerator.findUserVmById(getVmId());
+        if (vm == null) {
+             return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
+        }
+        return vm.getAccountId();
+    }
+
+    @Override
+    public void execute() {
+        CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()) + " Nic Id: " + this._uuidMgr.getUuid(Nic.class, getNicId()));
+        UserVm result = _userVmService.updateDefaultNicForVirtualMachine(this);
+        ArrayList<VMDetails> dc = new ArrayList<VMDetails>();
+        dc.add(VMDetails.valueOf("nics"));
+        EnumSet<VMDetails> details = EnumSet.copyOf(dc);
+        if (result != null){
+            UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", details, result).get(0);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to set default nic for VM. Refer to server logs for details.");
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
new file mode 100644
index 00000000000..9e4e6b1d612
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
@@ -0,0 +1,271 @@
+// 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.vm;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.ACL;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseCustomIdCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.GuestOSResponse;
+import org.apache.cloudstack.api.response.SecurityGroupResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+import com.cloud.uservm.UserVm;
+import com.cloud.utils.net.Dhcp;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "updateVirtualMachine", description="Updates properties of a virtual machine. The VM has to be stopped and restarted for the " +
+        "new properties to take effect. UpdateVirtualMachine does not first check whether the VM is stopped. " +
+        "Therefore, stop the VM manually before issuing this call.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class},
+    requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+public class UpdateVMCmd extends BaseCustomIdCmd implements SecurityGroupAction {
+    public static final Logger s_logger = Logger.getLogger(UpdateVMCmd.class.getName());
+    private static final String s_name = "updatevirtualmachineresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.DISPLAY_NAME, type = CommandType.STRING, description = "user generated name")
+    private String displayName;
+
+    @Parameter(name = ApiConstants.GROUP, type = CommandType.STRING, description = "group of the virtual machine")
+    private String group;
+
+    @Parameter(name = ApiConstants.HA_ENABLE, type = CommandType.BOOLEAN, description = "true if high-availability is enabled for the virtual machine, false otherwise")
+    private Boolean haEnable;
+
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserVmResponse.class,
+            required=true, description="The ID of the virtual machine")
+    private Long id;
+
+    @Parameter(name = ApiConstants.OS_TYPE_ID,
+               type = CommandType.UUID,
+               entityType = GuestOSResponse.class,
+               description = "the ID of the OS type that best represents this VM.")
+    private Long osTypeId;
+
+    @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.", authorized = {RoleType.Admin})
+    private Boolean displayVm;
+
+    @Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE,
+               type = CommandType.BOOLEAN,
+               description = "true if VM contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory")
+    protected Boolean isDynamicallyScalable;
+
+    @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "new host name of the vm. The VM has to be stopped/started for this update to take affect", since = "4.4")
+    private String name;
+
+    @Parameter(name = ApiConstants.INSTANCE_NAME, type = CommandType.STRING, description = "instance name of the user vm", since = "4.4", authorized = {RoleType.Admin})
+    private String instanceName;
+
+    @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "Details in key/value pairs.")
+    protected Map<String, String> details;
+
+    @ACL
+    @Parameter(name = ApiConstants.SECURITY_GROUP_IDS,
+               type = CommandType.LIST,
+               collectionType = CommandType.UUID,
+               entityType = SecurityGroupResponse.class,
+               description = "list of security group ids to be applied on the virtual machine.")
+    private List<Long> securityGroupIdList;
+
+    @ACL
+    @Parameter(name = ApiConstants.SECURITY_GROUP_NAMES,
+               type = CommandType.LIST,
+               collectionType = CommandType.STRING,
+               entityType = SecurityGroupResponse.class,
+               description = "comma separated list of security groups names that going to be applied to the virtual machine. " +
+                       "Should be passed only when vm is created from a zone with Basic Network support. " +
+                       "Mutually exclusive with securitygroupids parameter"
+            )
+    private List<String> securityGroupNameList;
+
+    @Parameter(name = ApiConstants.CLEAN_UP_DETAILS,
+            type = CommandType.BOOLEAN,
+            description = "optional boolean field, which indicates if details should be cleaned up or not (if set to true, details removed for this resource, details field ignored; if false or not set, no action)")
+    private Boolean cleanupDetails;
+
+    @Parameter(name = ApiConstants.DHCP_OPTIONS_NETWORK_LIST, type = CommandType.MAP, description = "DHCP options which are passed to the VM on start up"
+            + " Example: dhcpoptionsnetworklist[0].dhcp:114=url&dhcpoptionsetworklist[0].networkid=networkid&dhcpoptionsetworklist[0].dhcp:66=www.test.com")
+    private Map dhcpOptionsNetworkList;
+
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public String getDisplayName() {
+        return displayName;
+    }
+
+    public String getGroup() {
+        return group;
+    }
+
+    public Boolean getHaEnable() {
+        return haEnable;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public String getUserData() {
+        return userData;
+    }
+
+    public Boolean getDisplayVm() {
+        return displayVm;
+    }
+
+    public Boolean isDynamicallyScalable() {
+        return isDynamicallyScalable;
+    }
+
+    public String getHostName() {
+        return name;
+    }
+
+    public String getInstanceName() {
+        return instanceName;
+    }
+
+    public Map<String, String> getDetails() {
+        if (this.details == null || this.details.isEmpty()) {
+            return null;
+        }
+
+        Collection<String> paramsCollection = this.details.values();
+        return (Map<String, String>) (paramsCollection.toArray())[0];
+    }
+
+    public List<Long> getSecurityGroupIdList() {
+        return securityGroupIdList;
+    }
+
+    public List<String> getSecurityGroupNameList() {
+        return securityGroupNameList;
+    }
+
+    public boolean isCleanupDetails(){
+        return cleanupDetails == null ? false : cleanupDetails.booleanValue();
+    }
+
+    public Map<String, Map<Integer, String>> getDhcpOptionsMap() {
+        Map<String, Map<Integer, String>> dhcpOptionsMap = new HashMap<>();
+        if (dhcpOptionsNetworkList != null && !dhcpOptionsNetworkList.isEmpty()) {
+
+            Collection<Map<String, String>> paramsCollection = this.dhcpOptionsNetworkList.values();
+            for(Map<String, String> dhcpNetworkOptions : paramsCollection) {
+                String networkId = dhcpNetworkOptions.get(ApiConstants.NETWORK_ID);
+
+                if(networkId == null) {
+                    throw new IllegalArgumentException("No networkid specified when providing extra dhcp options.");
+                }
+
+                Map<Integer, String> dhcpOptionsForNetwork = new HashMap<>();
+                dhcpOptionsMap.put(networkId, dhcpOptionsForNetwork);
+
+                for (String key : dhcpNetworkOptions.keySet()) {
+                    if (key.startsWith(ApiConstants.DHCP_PREFIX)) {
+                        int dhcpOptionValue = Integer.parseInt(key.replaceFirst(ApiConstants.DHCP_PREFIX, ""));
+                        dhcpOptionsForNetwork.put(dhcpOptionValue, dhcpNetworkOptions.get(key));
+                    } else if (!key.equals(ApiConstants.NETWORK_ID)) {
+                        Dhcp.DhcpOptionCode dhcpOptionEnum = Dhcp.DhcpOptionCode.valueOfString(key);
+                        dhcpOptionsForNetwork.put(dhcpOptionEnum.getCode(), dhcpNetworkOptions.get(key));
+                    }
+                }
+
+            }
+        }
+
+        return dhcpOptionsMap;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getOsTypeId() {
+        return osTypeId;
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getResultObjectName() {
+        return "virtualmachine";
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        UserVm userVm = _entityMgr.findById(UserVm.class, getId());
+        if (userVm != null) {
+            return userVm.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException {
+        CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
+        UserVm result = _userVmService.updateVirtualMachine(this);
+        if (result != null){
+            UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", result).get(0);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update vm");
+        }
+    }
+
+    @Override
+    public void checkUuid() {
+        if (getCustomId() != null) {
+            _uuidMgr.checkUuid(getCustomId(), UserVm.class);
+
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVmNicIpCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVmNicIpCmd.java
new file mode 100644
index 00000000000..9d184f9a934
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVmNicIpCmd.java
@@ -0,0 +1,186 @@
+// 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.vm;
+
+import java.util.ArrayList;
+import java.util.EnumSet;
+
+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.ApiConstants.VMDetails;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.response.NicResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.dc.DataCenter;
+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.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.Network;
+import com.cloud.uservm.UserVm;
+import com.cloud.utils.net.NetUtils;
+import com.cloud.vm.Nic;
+
+@APICommand(name = "updateVmNicIp", description = "Update the default Ip of a VM Nic", responseObject = UserVmResponse.class)
+public class UpdateVmNicIpCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(AddIpToVmNicCmd.class.getName());
+    private static final String s_name = "updatevmnicipresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @Parameter(name=ApiConstants.NIC_ID, type=CommandType.UUID, entityType = NicResponse.class, required = true,
+            description="the ID of the nic to which you want to assign private IP")
+            private Long nicId;
+
+    @Parameter(name = ApiConstants.IP_ADDRESS, type = CommandType.STRING, required = false,
+            description = "Secondary IP Address")
+            private String ipAddr;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public String getEntityTable() {
+        return "nic_secondary_ips";
+    }
+
+    public String getAccountName() {
+        return CallContext.current().getCallingAccount().getAccountName();
+    }
+
+    public long getDomainId() {
+        return CallContext.current().getCallingAccount().getDomainId();
+    }
+
+    private long getZoneId() {
+        Network ntwk = _entityMgr.findById(Network.class, getNetworkId());
+        if (ntwk == null) {
+            throw new InvalidParameterValueException("Can't find zone id for specified");
+        }
+        return ntwk.getDataCenterId();
+    }
+
+    public Long getNetworkId() {
+        Nic nic = _entityMgr.findById(Nic.class, nicId);
+        if (nic == null) {
+            throw new InvalidParameterValueException("Can't find network id for specified nic");
+        }
+        Long networkId = nic.getNetworkId();
+        return networkId;
+    }
+
+    public Long getNicId() {
+        return nicId;
+    }
+
+    public String getIpaddress () {
+        if (ipAddr != null) {
+            return ipAddr;
+        } else {
+            return null;
+        }
+    }
+
+    public NetworkType getNetworkType() {
+        Network ntwk = _entityMgr.findById(Network.class, getNetworkId());
+        DataCenter dc = _entityMgr.findById(DataCenter.class, ntwk.getDataCenterId());
+        return dc.getNetworkType();
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return CallContext.current().getCallingAccountId();
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_NET_IP_ASSIGN;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "associating ip to nic id: " + this._uuidMgr.getUuid(Network.class, getNetworkId()) + " in zone " + this._uuidMgr.getUuid(DataCenter.class, getZoneId());
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getResultObjectName() {
+        return "addressinfo";
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException, ResourceAllocationException,
+    ConcurrentOperationException, InsufficientCapacityException {
+
+        CallContext.current().setEventDetails("Nic Id: " + getNicId() );
+        String ip;
+        if ((ip = getIpaddress()) != null) {
+            if (!NetUtils.isValidIp4(ip)) {
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Invalid ip address " + ip);
+            }
+        }
+
+        UserVm vm = _userVmService.updateNicIpForVirtualMachine(this);
+        ArrayList<VMDetails> dc = new ArrayList<VMDetails>();
+        dc.add(VMDetails.valueOf("nics"));
+        EnumSet<VMDetails> details = EnumSet.copyOf(dc);
+        if (vm != null){
+            UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", details, vm).get(0);
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update ip address on vm NIC. Refer to server logs for details.");
+        }
+    }
+
+    @Override
+    public String getSyncObjType() {
+        return BaseAsyncCmd.networkSyncObject;
+    }
+
+    @Override
+    public Long getSyncObjId() {
+        return getNetworkId();
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.IpAddress;
+    }
+
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java
new file mode 100644
index 00000000000..216833bca46
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java
@@ -0,0 +1,139 @@
+// 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.vm;
+
+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.acl.SecurityChecker.AccessType;
+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.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ServiceOfferingResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.offering.ServiceOffering;
+import com.cloud.user.Account;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "changeServiceForVirtualMachine", responseObject=UserVmResponse.class, description="Changes the service offering for a virtual machine. " +
+                                            "The virtual machine must be in a \"Stopped\" state for " +
+        "this command to take effect.", responseView = ResponseView.Restricted, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+public class UpgradeVMCmd extends BaseCmd {
+    public static final Logger s_logger = Logger.getLogger(UpgradeVMCmd.class.getName());
+    private static final String s_name = "changeserviceforvirtualmachineresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserVmResponse.class,
+            required=true, description="The ID of the virtual machine")
+    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 virtual machine")
+    protected Long serviceOfferingId;
+
+    @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "name value pairs of custom parameters for cpu, memory and cpunumber. example details[i].name=value")
+    private Map<String, String> details;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    public Long getServiceOfferingId() {
+        return serviceOfferingId;
+    }
+
+    public Map<String, String> getDetails() {
+        Map<String, String> customparameterMap = new HashMap<String, String>();
+        if (details != null && details.size() != 0) {
+            Collection parameterCollection = details.values();
+            Iterator iter = parameterCollection.iterator();
+            while (iter.hasNext()) {
+                HashMap<String, String> value = (HashMap<String, String>)iter.next();
+                for (String key : value.keySet()) {
+                    customparameterMap.put(key, value.get(key));
+                }
+            }
+        }
+        return customparameterMap;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getResultObjectName() {
+        return "virtualmachine";
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        UserVm userVm = _entityMgr.findById(UserVm.class, getId());
+        if (userVm != null) {
+            return userVm.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public void execute() throws ResourceAllocationException {
+        CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
+
+        ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
+        if (serviceOffering == null) {
+            throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId);
+        }
+
+        UserVm result = _userVmService.upgradeVirtualMachine(this);
+
+        if (result != null){
+            UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", result).get(0);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade vm");
+        }
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vmgroup/CreateVMGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vmgroup/CreateVMGroupCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vmgroup/CreateVMGroupCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vmgroup/CreateVMGroupCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vmgroup/DeleteVMGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vmgroup/DeleteVMGroupCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vmgroup/DeleteVMGroupCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vmgroup/DeleteVMGroupCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vmgroup/ListVMGroupsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vmgroup/ListVMGroupsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vmgroup/ListVMGroupsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vmgroup/ListVMGroupsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vmgroup/UpdateVMGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vmgroup/UpdateVMGroupCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vmgroup/UpdateVMGroupCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vmgroup/UpdateVMGroupCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/CreateVMSnapshotCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/CreateVMSnapshotCmd.java
new file mode 100644
index 00000000000..e89f6ccb310
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/CreateVMSnapshotCmd.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 org.apache.cloudstack.api.command.user.vmsnapshot;
+
+import java.util.logging.Logger;
+
+import com.cloud.vm.VirtualMachine;
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+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.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.api.response.VMSnapshotResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.snapshot.VMSnapshot;
+
+@APICommand(name = "createVMSnapshot", description = "Creates snapshot for a vm.", responseObject = VMSnapshotResponse.class, since = "4.2.0", entityType = {VMSnapshot.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class CreateVMSnapshotCmd extends BaseAsyncCreateCmd {
+
+    public static final Logger s_logger = Logger.getLogger(CreateVMSnapshotCmd.class.getName());
+    private static final String s_name = "createvmsnapshotresponse";
+
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, required = true, entityType = UserVmResponse.class, description = "The ID of the vm")
+    private Long vmId;
+
+    @Parameter(name = ApiConstants.VM_SNAPSHOT_DESCRIPTION, type = CommandType.STRING, required = false, description = "The description of the snapshot")
+    private String description;
+
+    @Parameter(name = ApiConstants.VM_SNAPSHOT_DISPLAYNAME, type = CommandType.STRING, required = false, description = "The display name of the snapshot")
+    private String displayName;
+
+    @Parameter(name = ApiConstants.VM_SNAPSHOT_MEMORY, type = CommandType.BOOLEAN, required = false, description = "snapshot memory if true")
+    private Boolean snapshotMemory;
+
+    @Parameter(name = ApiConstants.VM_SNAPSHOT_QUIESCEVM, type = CommandType.BOOLEAN, required = false, description = "quiesce vm if true")
+    private Boolean quiescevm;
+
+    public Boolean snapshotMemory() {
+        if (snapshotMemory == null) {
+            return false;
+        } else {
+            return snapshotMemory;
+        }
+    }
+
+    public Boolean getQuiescevm() {
+        if (quiescevm == null) {
+            return false;
+        } else {
+            return quiescevm;
+        }
+    }
+
+    public String getDisplayName() {
+        return displayName;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public Long getVmId() {
+        return vmId;
+    }
+
+    @Override
+    public void create() throws ResourceAllocationException {
+        VMSnapshot vmsnapshot = _vmSnapshotService.allocVMSnapshot(getVmId(), getDisplayName(), getDescription(), snapshotMemory());
+        if (vmsnapshot != null) {
+            setEntityId(vmsnapshot.getId());
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create vm snapshot");
+        }
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "creating snapshot for VM: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId());
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VM_SNAPSHOT_CREATE;
+    }
+
+    @Override
+    public void execute() {
+        CallContext.current().setEventDetails("VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()));
+        VMSnapshot result = _vmSnapshotService.createVMSnapshot(getVmId(), getEntityId(), getQuiescevm());
+        if (result != null) {
+            VMSnapshotResponse response = _responseGenerator.createVMSnapshotResponse(result);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create vm snapshot due to an internal error creating snapshot for vm " + getVmId());
+        }
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        UserVm userVM = _userVmService.getUserVm(vmId);
+        return userVM.getAccountId();
+    }
+
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/DeleteVMSnapshotCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/DeleteVMSnapshotCmd.java
new file mode 100644
index 00000000000..03c9d43d9e2
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/DeleteVMSnapshotCmd.java
@@ -0,0 +1,92 @@
+// 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.vmsnapshot;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+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.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.api.response.VMSnapshotResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
+import com.cloud.vm.snapshot.VMSnapshot;
+
+@APICommand(name = "deleteVMSnapshot", description = "Deletes a vmsnapshot.", responseObject = SuccessResponse.class, since = "4.2.0", entityType = {VMSnapshot.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class DeleteVMSnapshotCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(DeleteVMSnapshotCmd.class.getName());
+    private static final String s_name = "deletevmsnapshotresponse";
+
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name = ApiConstants.VM_SNAPSHOT_ID,
+               type = CommandType.UUID,
+               entityType = VMSnapshotResponse.class,
+               required = true,
+               description = "The ID of the VM snapshot")
+    private Long id;
+
+    public Long getId() {
+        return id;
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        VMSnapshot vmSnapshot = _entityMgr.findById(VMSnapshot.class, getId());
+        if (vmSnapshot != null) {
+            return vmSnapshot.getAccountId();
+        }
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public void execute() {
+        CallContext.current().setEventDetails("vmsnapshot id: " + this._uuidMgr.getUuid(VMSnapshot.class, getId()));
+        boolean result = _vmSnapshotService.deleteVMSnapshot(getId());
+        if (result) {
+            SuccessResponse response = new SuccessResponse(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete vm snapshot");
+        }
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "Delete VM snapshot: " + this._uuidMgr.getUuid(VMSnapshot.class, getId());
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VM_SNAPSHOT_DELETE;
+    }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/ListVMSnapshotCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/ListVMSnapshotCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vmsnapshot/ListVMSnapshotCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/ListVMSnapshotCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToVMSnapshotCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToVMSnapshotCmd.java
new file mode 100644
index 00000000000..8c3510b8201
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToVMSnapshotCmd.java
@@ -0,0 +1,99 @@
+// 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.vmsnapshot;
+
+import java.util.logging.Logger;
+
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+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.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.api.response.VMSnapshotResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.snapshot.VMSnapshot;
+
+@APICommand(name = "revertToVMSnapshot", description = "Revert VM from a vmsnapshot.", responseObject = UserVmResponse.class, since = "4.2.0", responseView = ResponseView.Restricted,
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+public class RevertToVMSnapshotCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(RevertToVMSnapshotCmd.class.getName());
+    private static final String s_name = "reverttovmsnapshotresponse";
+
+    @ACL(accessType = AccessType.OperateEntry, pointerToEntity = "getVmId()")
+    @Parameter(name = ApiConstants.VM_SNAPSHOT_ID,
+               type = CommandType.UUID,
+               required = true,
+               entityType = VMSnapshotResponse.class,
+               description = "The ID of the vm snapshot")
+    private Long vmSnapShotId;
+
+    public Long getVmSnapShotId() {
+        return vmSnapShotId;
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        VMSnapshot vmSnapshot = _entityMgr.findById(VMSnapshot.class, getVmSnapShotId());
+        if (vmSnapshot != null) {
+            return vmSnapshot.getAccountId();
+        }
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public void execute() throws  ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException, ConcurrentOperationException {
+        CallContext.current().setEventDetails("vmsnapshot id: " + this._uuidMgr.getUuid(VMSnapshot.class, getVmSnapShotId()));
+        UserVm result = _vmSnapshotService.revertToSnapshot(getVmSnapShotId());
+        if (result != null) {
+            UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted,
+                    "virtualmachine", result).get(0);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to revert VM snapshot");
+        }
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "Revert from VM snapshot: " + this._uuidMgr.getUuid(VMSnapshot.class, getVmSnapShotId());
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VM_SNAPSHOT_REVERT;
+    }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/AddResourceDetailCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/AddResourceDetailCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/volume/AddResourceDetailCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/volume/AddResourceDetailCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/AttachVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/AttachVolumeCmd.java
new file mode 100644
index 00000000000..7e2b15538f0
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/AttachVolumeCmd.java
@@ -0,0 +1,129 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.user.volume;
+
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.ACL;
+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.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.storage.Volume;
+import com.cloud.user.Account;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "attachVolume", description = "Attaches a disk volume to a virtual machine.", responseObject = VolumeResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class AttachVolumeCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(AttachVolumeCmd.class.getName());
+    private static final String s_name = "attachvolumeresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.DEVICE_ID, type = CommandType.LONG, description = "the ID of the device to map the volume to within the guest OS. "
+            + "If no deviceId is passed in, the next available deviceId will be chosen. " + "Possible values for a Linux OS are:" + "* 0 - /dev/xvda" + "* 1 - /dev/xvdb" + "* 2 - /dev/xvdc"
+        + "* 4 - /dev/xvde" + "* 5 - /dev/xvdf" + "* 6 - /dev/xvdg" + "* 7 - /dev/xvdh" + "* 8 - /dev/xvdi" + "* 9 - /dev/xvdj")
+    private Long deviceId;
+
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VolumeResponse.class, required = true, description = "the ID of the disk volume")
+    private Long id;
+
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType=UserVmResponse.class,
+            required=true, description="    the ID of the virtual machine")
+    private Long virtualMachineId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getDeviceId() {
+        return deviceId;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public Long getVirtualMachineId() {
+        return virtualMachineId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// 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  "attaching volume: " + this._uuidMgr.getUuid(Volume.class, getId()) + " to vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId());
+    }
+
+    @Override
+    public void execute() {
+        CallContext.current().setEventDetails("Volume Id: " + this._uuidMgr.getUuid(Volume.class, getId()) + " VmId: " + this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId()));
+        Volume result = _volumeService.attachVolumeToVM(this);
+        if (result != null) {
+            VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Restricted, result);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to attach volume");
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java
new file mode 100644
index 00000000000..65281090ca3
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java
@@ -0,0 +1,246 @@
+// 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.acl.RoleType;
+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.BaseAsyncCreateCustomIdCmd;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.DiskOfferingResponse;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.ProjectResponse;
+import org.apache.cloudstack.api.response.SnapshotResponse;
+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.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.storage.Snapshot;
+import com.cloud.storage.Volume;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "createVolume", responseObject = VolumeResponse.class, description = "Creates a disk volume from a disk offering. This disk volume must still be attached to a virtual machine to make use of it.", responseView = ResponseView.Restricted, entityType = {
+        Volume.class, VirtualMachine.class},
+            requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class CreateVolumeCmd extends BaseAsyncCreateCustomIdCmd {
+    public static final Logger s_logger = Logger.getLogger(CreateVolumeCmd.class.getName());
+    private static final String s_name = "createvolumeresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ACCOUNT,
+               type = BaseCmd.CommandType.STRING,
+               description = "the account associated with the disk volume. Must be used with the domainId parameter.")
+    private String accountName;
+
+    @Parameter(name = ApiConstants.PROJECT_ID,
+               type = CommandType.UUID,
+               entityType = ProjectResponse.class,
+               description = "the project associated with the volume. Mutually exclusive with account parameter")
+    private Long projectId;
+
+    @Parameter(name = ApiConstants.DOMAIN_ID,
+               type = CommandType.UUID,
+               entityType = DomainResponse.class,
+               description = "the domain ID associated with the disk offering. If used with the account parameter"
+                   + " returns the disk volume associated with the account for the specified domain.")
+    private Long domainId;
+
+    @Parameter(name = ApiConstants.DISK_OFFERING_ID,
+               required = false,
+               type = CommandType.UUID,
+               entityType = DiskOfferingResponse.class,
+               description = "the ID of the disk offering. Either diskOfferingId or snapshotId must be passed in.")
+    private Long diskOfferingId;
+
+    @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the disk volume")
+    private String volumeName;
+
+    @Parameter(name = ApiConstants.SIZE, type = CommandType.LONG, description = "Arbitrary volume size")
+    private Long size;
+
+    @Parameter(name = ApiConstants.MIN_IOPS, type = CommandType.LONG, description = "min iops")
+    private Long minIops;
+
+    @Parameter(name = ApiConstants.MAX_IOPS, type = CommandType.LONG, description = "max iops")
+    private Long maxIops;
+
+    @Parameter(name = ApiConstants.SNAPSHOT_ID,
+               type = CommandType.UUID,
+               entityType = SnapshotResponse.class,
+               description = "the snapshot ID for the disk volume. Either diskOfferingId or snapshotId must be passed in.")
+    private Long snapshotId;
+
+    @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, 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.", authorized = {RoleType.Admin})
+    private Boolean displayVolume;
+
+    @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
+               type = CommandType.UUID,
+               entityType = UserVmResponse.class,
+               description = "the ID of the virtual machine; to be used with snapshot Id, VM to which the volume gets attached after creation")
+    private Long virtualMachineId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public String getAccountName() {
+        return accountName;
+    }
+
+    public Long getDiskOfferingId() {
+        return diskOfferingId;
+    }
+
+    public Long getDomainId() {
+        return domainId;
+    }
+
+    public String getVolumeName() {
+        return volumeName;
+    }
+
+    public Long getSize() {
+        return size;
+    }
+
+    public Long getMinIops() {
+        return minIops;
+    }
+
+    public Long getMaxIops() {
+        return maxIops;
+    }
+
+    public Long getSnapshotId() {
+        return snapshotId;
+    }
+
+    public Long getZoneId() {
+        return zoneId;
+    }
+
+    private Long getProjectId() {
+        return projectId;
+    }
+
+    public Boolean getDisplayVolume() {
+        return displayVolume;
+    }
+
+    @Override
+    public boolean isDisplay() {
+        if(displayVolume == null)
+            return true;
+        else
+            return displayVolume;
+    }
+
+    public Long getVirtualMachineId() {
+        return virtualMachineId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getResultObjectName() {
+        return "volume";
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.Volume;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
+        if (accountId == null) {
+            return CallContext.current().getCallingAccount().getId();
+        }
+
+        return accountId;
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VOLUME_CREATE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "creating volume: " + getVolumeName() + ((getSnapshotId() == null) ? "" : " from snapshot: " + this._uuidMgr.getUuid(Snapshot.class, getSnapshotId()));
+    }
+
+    @Override
+    public void create() throws ResourceAllocationException {
+
+        Volume volume = _volumeService.allocVolume(this);
+        if (volume != null) {
+            setEntityId(volume.getId());
+            setEntityUuid(volume.getUuid());
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create volume");
+        }
+    }
+
+    @Override
+    public void execute() {
+        CallContext.current().setEventDetails("Volume Id: " + getEntityUuid() + ((getSnapshotId() == null) ? "" : " from snapshot: " + this._uuidMgr.getUuid(Snapshot.class, getSnapshotId())));
+        Volume volume = _volumeService.createVolume(this);
+        if (volume != null) {
+            VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Restricted, volume);
+            //FIXME - have to be moved to ApiResponseHelper
+            if (getSnapshotId() != null) {
+                Snapshot snap = _entityMgr.findById(Snapshot.class, getSnapshotId());
+                if (snap != null) {
+                    response.setSnapshotId(snap.getUuid()); // if the volume was
+                    // created from a
+                    // snapshot,
+                    // snapshotId will
+                    // be set so we pass
+                    // it back in the
+                    // response
+                }
+            }
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a volume");
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java
new file mode 100644
index 00000000000..070ec5fba74
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java
@@ -0,0 +1,93 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.user.volume;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+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.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.storage.Volume;
+import com.cloud.user.Account;
+
+@APICommand(name = "deleteVolume", description = "Deletes a detached disk volume.", responseObject = SuccessResponse.class, entityType = {Volume.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class DeleteVolumeCmd extends BaseCmd {
+    public static final Logger s_logger = Logger.getLogger(DeleteVolumeCmd.class.getName());
+    private static final String s_name = "deletevolumeresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VolumeResponse.class,
+            required=true, description="The ID of the disk volume")
+    private Long id;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getResultObjectName() {
+        return "volume";
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Volume volume = _entityMgr.findById(Volume.class, getId());
+        if (volume != null) {
+            return volume.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public void execute() throws ConcurrentOperationException {
+        CallContext.current().setEventDetails("Volume Id: " + this._uuidMgr.getUuid(Volume.class, getId()));
+        boolean result = _volumeService.deleteVolume(id, CallContext.current().getCallingAccount());
+        if (result) {
+            SuccessResponse response = new SuccessResponse(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete volume");
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/DetachVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/DetachVolumeCmd.java
new file mode 100644
index 00000000000..55d30e33114
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/DetachVolumeCmd.java
@@ -0,0 +1,153 @@
+// 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.cloudstack.api.BaseAsyncCmd;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.ACL;
+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.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.storage.Volume;
+import com.cloud.user.Account;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "detachVolume", description = "Detaches a disk volume from a virtual machine.", responseObject = VolumeResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class DetachVolumeCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(DetachVolumeCmd.class.getName());
+    private static final String s_name = "detachvolumeresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VolumeResponse.class,
+            description="the ID of the disk volume")
+    private Long id;
+
+    @Parameter(name = ApiConstants.DEVICE_ID, type = CommandType.LONG, description = "the device ID on the virtual machine where volume is detached from")
+    private Long deviceId;
+
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
+               type = CommandType.UUID,
+               entityType = UserVmResponse.class,
+               description = "the ID of the virtual machine where the volume is detached from")
+    private Long virtualMachineId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    public Long getDeviceId() {
+        return deviceId;
+    }
+
+    public Long getVirtualMachineId() {
+        return virtualMachineId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getResultObjectName() {
+        return "volume";
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.Volume;
+    }
+
+    @Override
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Long volumeId = getId();
+        if (volumeId != null) {
+            Volume volume = _responseGenerator.findVolumeById(volumeId);
+            if (volume != null) {
+                return volume.getAccountId();
+            }
+        } else if (getVirtualMachineId() != null) {
+            UserVm vm = _responseGenerator.findUserVmById(getVirtualMachineId());
+            if (vm != null) {
+                return vm.getAccountId();
+            }
+        }
+
+        // invalid id, parent this command to SYSTEM so ERROR events are tracked
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VOLUME_DETACH;
+    }
+
+    @Override
+    public String getEventDescription() {
+        StringBuilder sb = new StringBuilder();
+        if (id != null) {
+            sb.append(": " + this._uuidMgr.getUuid(Volume.class, id));
+        } else if ((deviceId != null) && (virtualMachineId != null)) {
+            sb.append(" with device id: " + deviceId + " from vm: " + ((getVirtualMachineId() != null) ? this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId()) : "" ));
+        } else {
+            sb.append(" <error:  either volume id or deviceId/vmId need to be specified>");
+        }
+        return  "detaching volume" + sb.toString();
+    }
+
+    @Override
+    public void execute() {
+        CallContext.current().setEventDetails(getEventDescription());
+        Volume result = _volumeService.detachVolumeFromVM(this);
+        if (result != null){
+            VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Restricted, result);
+            response.setResponseName("volume");
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to detach volume");
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java
new file mode 100644
index 00000000000..f48236680e1
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java
@@ -0,0 +1,158 @@
+// 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.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.ACL;
+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.ExtractResponse;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.dc.DataCenter;
+import com.cloud.event.EventTypes;
+import com.cloud.storage.Upload;
+import com.cloud.storage.Volume;
+import com.cloud.user.Account;
+
+@APICommand(name = "extractVolume", description = "Extracts volume", responseObject = ExtractResponse.class, entityType = {Volume.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class ExtractVolumeCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(ExtractVolumeCmd.class.getName());
+
+    private static final String s_name = "extractvolumeresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VolumeResponse.class,
+            required=true, description="the ID of the volume")
+    private Long id;
+
+    @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = false, length = 2048, description = "the url to which the volume would be extracted")
+    private String url;
+
+    @Parameter(name = ApiConstants.ZONE_ID,
+               type = CommandType.UUID,
+               entityType = ZoneResponse.class,
+               required = true,
+               description = "the ID of the zone where the volume is located")
+    private Long zoneId;
+
+    @Parameter(name = ApiConstants.MODE, type = CommandType.STRING, required = true, description = "the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD")
+    private String mode;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public Long getZoneId() {
+        return zoneId;
+    }
+
+    public String getMode() {
+        return mode;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getStaticName() {
+        return s_name;
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.Volume;
+    }
+
+    @Override
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Volume volume = _entityMgr.findById(Volume.class, getId());
+        if (volume != null) {
+            return volume.getAccountId();
+        }
+
+        // invalid id, parent this command to SYSTEM so ERROR events are tracked
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VOLUME_EXTRACT;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "Extraction job";
+    }
+
+    @Override
+    public void execute() {
+        CallContext.current().setEventDetails("Volume Id: " + this._uuidMgr.getUuid(Volume.class, getId()));
+        String uploadUrl = _volumeService.extractVolume(this);
+        if (uploadUrl != null) {
+            ExtractResponse response = new ExtractResponse();
+            response.setResponseName(getCommandName());
+            response.setObjectName("volume");
+            Volume vol = _entityMgr.findById(Volume.class, id);
+            response.setId(vol.getUuid());
+            response.setName(vol.getName());
+            DataCenter zone = _entityMgr.findById(DataCenter.class, zoneId);
+            response.setZoneId(zone.getUuid());
+            response.setZoneName(zone.getName());
+            response.setMode(mode);
+            response.setState(Upload.Status.DOWNLOAD_URL_CREATED.toString());
+            Account account = _entityMgr.findById(Account.class, getEntityOwnerId());
+            response.setAccountId(account.getUuid());
+            response.setUrl(uploadUrl);
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to extract volume");
+        }
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/GetUploadParamsForVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/GetUploadParamsForVolumeCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/volume/GetUploadParamsForVolumeCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/volume/GetUploadParamsForVolumeCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/ListResourceDetailsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ListResourceDetailsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/volume/ListResourceDetailsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/volume/ListResourceDetailsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/MigrateVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/MigrateVolumeCmd.java
new file mode 100644
index 00000000000..0e1f7e08a17
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/MigrateVolumeCmd.java
@@ -0,0 +1,123 @@
+// 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.storage.StoragePool;
+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.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.StoragePoolResponse;
+import org.apache.cloudstack.api.response.VolumeResponse;
+
+import com.cloud.event.EventTypes;
+import com.cloud.storage.Volume;
+import com.cloud.user.Account;
+
+@APICommand(name = "migrateVolume", description = "Migrate volume", responseObject = VolumeResponse.class, since = "3.0.0", responseView = ResponseView.Restricted, entityType = {
+        Volume.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class MigrateVolumeCmd extends BaseAsyncCmd {
+    private static final String s_name = "migratevolumeresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class, required = true, description = "the ID of the volume")
+    private Long volumeId;
+
+    @Parameter(name = ApiConstants.STORAGE_ID, type = CommandType.UUID, entityType = StoragePoolResponse.class, required = true, description = "destination storage pool ID to migrate the volume to")
+    private Long storageId;
+
+    @Parameter(name = ApiConstants.LIVE_MIGRATE, type = CommandType.BOOLEAN, required = false, description = "if the volume should be live migrated when it is attached to a running vm")
+    private Boolean liveMigrate;
+
+    @Parameter(name = ApiConstants.NEW_DISK_OFFERING_ID, type = CommandType.STRING, description = "The new disk offering ID that replaces the current one used by the volume. This new disk offering is used to better reflect the new storage where the volume is going to be migrated to.")
+    private String newDiskOfferingUuid;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    // TODO remove this in 5.0 and use id as param instead.
+    public Long getVolumeId() {
+        return volumeId;
+    }
+
+    public Long getId() {
+        return getVolumeId();
+    }
+
+    public Long getStoragePoolId() {
+        return storageId;
+    }
+
+    public boolean isLiveMigrate() {
+        return (liveMigrate != null) ? liveMigrate : false;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Volume volume = _entityMgr.findById(Volume.class, getVolumeId());
+        if (volume != null) {
+            return volume.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VOLUME_MIGRATE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "Attempting to migrate volume Id: " + this._uuidMgr.getUuid(Volume.class, getVolumeId()) + " to storage pool Id: " + this._uuidMgr.getUuid(StoragePool.class, getStoragePoolId());
+    }
+
+    public String getNewDiskOfferingUuid() {
+        return newDiskOfferingUuid;
+    }
+
+    @Override
+    public void execute() {
+        Volume result;
+
+        result = _volumeService.migrateVolume(this);
+        if (result != null) {
+            VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Restricted, result);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate volume");
+        }
+    }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/RemoveResourceDetailCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/RemoveResourceDetailCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/volume/RemoveResourceDetailCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/volume/RemoveResourceDetailCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java
new file mode 100644
index 00000000000..a7953336ff1
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java
@@ -0,0 +1,189 @@
+// 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.cloudstack.api.BaseAsyncCmd;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.ACL;
+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.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.DiskOfferingResponse;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.PermissionDeniedException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.projects.Project;
+import com.cloud.storage.Volume;
+import com.cloud.user.Account;
+
+
+@APICommand(name = "resizeVolume", description = "Resizes a volume", responseObject = VolumeResponse.class, responseView = ResponseView.Restricted, entityType = {Volume.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class ResizeVolumeCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(ResizeVolumeCmd.class.getName());
+
+    private static final String s_name = "resizevolumeresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name = ApiConstants.ID, entityType = VolumeResponse.class, required = true, type = CommandType.UUID, description = "the ID of the disk volume")
+    private Long id;
+
+    @Parameter(name = ApiConstants.MIN_IOPS, type = CommandType.LONG, required = false, description = "New minimum number of IOPS")
+    private Long minIops;
+
+    @Parameter(name = ApiConstants.MAX_IOPS, type = CommandType.LONG, required = false, description = "New maximum number of IOPS")
+    private Long maxIops;
+
+    @Parameter(name = ApiConstants.SIZE, type = CommandType.LONG, required = false, description = "New volume size in GB")
+    private Long size;
+
+    @Parameter(name = ApiConstants.SHRINK_OK, type = CommandType.BOOLEAN, required = false, description = "Verify OK to Shrink")
+    private boolean shrinkOk;
+
+    @Parameter(name = ApiConstants.DISK_OFFERING_ID,
+               entityType = DiskOfferingResponse.class,
+               type = CommandType.UUID,
+               required = false,
+               description = "new disk offering id")
+    private Long newDiskOfferingId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public ResizeVolumeCmd() {}
+
+    public ResizeVolumeCmd(Long id, Long minIops, Long maxIops) {
+        this.id = id;
+        this.minIops = minIops;
+        this.maxIops = maxIops;
+    }
+
+    //TODO use the method getId() instead of this one.
+    public Long getEntityId() {
+        return id;
+    }
+
+    public Long getId() {
+        return getEntityId();
+    }
+
+    public Long getMinIops() {
+        return minIops;
+    }
+
+    public Long getMaxIops() {
+        return maxIops;
+    }
+
+    public Long getSize() {
+        return size;
+    }
+
+    public boolean getShrinkOk() {
+        return shrinkOk;
+    }
+
+    public Long getNewDiskOfferingId() {
+        return newDiskOfferingId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public ApiCommandJobType getInstanceType() {
+        return ApiCommandJobType.Volume;
+    }
+
+    public static String getResultObjectName() {
+        return "volume";
+    }
+
+   @Override
+    public long getEntityOwnerId() {
+
+        Volume volume = _entityMgr.findById(Volume.class, getEntityId());
+        if (volume == null) {
+                throw new InvalidParameterValueException("Unable to find volume by id=" + id);
+        }
+
+        Account account = _accountService.getAccount(volume.getAccountId());
+        //Can resize volumes for enabled projects/accounts only
+        if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) {
+                Project project = _projectService.findByProjectAccountId(volume.getAccountId());
+            if (project.getState() != Project.State.Active) {
+                throw new PermissionDeniedException("Can't add resources to  project id=" + project.getId() + " in state=" + project.getState() +
+                    " as it's no longer active");
+            }
+        } else if (account.getState() == Account.State.disabled) {
+            throw new PermissionDeniedException("The owner of volume " + id + "  is disabled: " + account);
+        }
+
+        return volume.getAccountId();
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VOLUME_RESIZE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "Volume Id: " + this._uuidMgr.getUuid(Volume.class, getEntityId()) + " to size " + getSize() + "G";
+    }
+
+    @Override
+    public void execute() throws ResourceAllocationException {
+        Volume volume = null;
+        try {
+            CallContext.current().setEventDetails("Volume Id: " + this._uuidMgr.getUuid(Volume.class, getEntityId()) + " to size " + getSize() + "G");
+            volume = _volumeService.resizeVolume(this);
+        } catch (InvalidParameterValueException ex) {
+            s_logger.info(ex.getMessage());
+            throw new ServerApiException(ApiErrorCode.UNSUPPORTED_ACTION_ERROR, ex.getMessage());
+        }
+
+        if (volume != null) {
+            VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Restricted, volume);
+            //FIXME - have to be moved to ApiResponseHelper
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to resize volume");
+        }
+    }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java
new file mode 100644
index 00000000000..b4f8642e8de
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java
@@ -0,0 +1,176 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.user.volume;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.ACL;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiCommandJobType;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCustomIdCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.StoragePoolResponse;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.storage.Volume;
+
+@APICommand(name = "updateVolume", description = "Updates the volume.", responseObject = VolumeResponse.class, responseView = ResponseView.Restricted, entityType = {Volume.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class UpdateVolumeCmd extends BaseAsyncCustomIdCmd {
+    public static final Logger s_logger = Logger.getLogger(UpdateVolumeCmd.class.getName());
+    private static final String s_name = "updatevolumeresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VolumeResponse.class, description="the ID of the disk volume")
+    private Long id;
+
+    @Parameter(name = ApiConstants.PATH, type = CommandType.STRING, description = "The path of the volume")
+    private String path;
+
+    @Parameter(name = ApiConstants.CHAIN_INFO,
+            type = CommandType.STRING,
+            description = "The chain info of the volume",
+            since = "4.4")
+    private String chainInfo;
+
+    @Parameter(name = ApiConstants.STORAGE_ID,
+               type = CommandType.UUID,
+               entityType = StoragePoolResponse.class,
+               description = "Destination storage pool UUID for the volume",
+               since = "4.3")
+    private Long storageId;
+
+    @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "The state of the volume", since = "4.3")
+    private String state;
+
+    @Parameter(name = ApiConstants.DISPLAY_VOLUME,
+               type = CommandType.BOOLEAN,
+ description = "an optional field, whether to the display the volume to the end user or not.", authorized = {RoleType.Admin})
+    private Boolean displayVolume;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public String getPath() {
+        return path;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public Long getStorageId() {
+        return storageId;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public Boolean getDisplayVolume() {
+        return displayVolume;
+    }
+
+    public String getChainInfo() {
+        return chainInfo;
+    }
+    /////////////////////////////////////////////////////
+    /////////////// 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) {
+            throw new InvalidParameterValueException("Invalid volume id was provided");
+        }
+        return volume.getAccountId();
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VOLUME_UPDATE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        StringBuilder desc = new StringBuilder("Updating volume: ");
+        desc.append(getId()).append(" with");
+        if (getPath() != null) {
+            desc.append(" path " + getPath());
+        }
+        if (getStorageId() != null) {
+            desc.append(", storage id " + getStorageId());
+        }
+
+        if (getState() != null) {
+            desc.append(", state " + getState());
+        }
+        return desc.toString();
+    }
+
+    @Override
+    public void execute() {
+        CallContext.current().setEventDetails("Volume Id: " + this._uuidMgr.getUuid(Volume.class, getId()));
+        Volume result = _volumeService.updateVolume(getId(), getPath(), getState(), getStorageId(), getDisplayVolume(),
+                getCustomId(), getEntityOwnerId(), getChainInfo());
+        if (result != null) {
+            VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Restricted, result);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update volume");
+        }
+    }
+
+    @Override
+    public void checkUuid() {
+        if (getCustomId() != null) {
+            _uuidMgr.checkUuid(getCustomId(), Volume.class);
+        }
+    }
+
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java
new file mode 100644
index 00000000000..2802c00aaf3
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java
@@ -0,0 +1,181 @@
+// 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.dc.DataCenter;
+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.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.DiskOfferingResponse;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.ProjectResponse;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.NetworkRuleConflictException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.storage.Volume;
+
+@APICommand(name = "uploadVolume", description = "Uploads a data disk.", responseObject = VolumeResponse.class, responseView = ResponseView.Restricted, entityType = {Volume.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class UploadVolumeCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(UploadVolumeCmd.class.getName());
+    private static final String s_name = "uploadvolumeresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.FORMAT,
+               type = CommandType.STRING,
+               required = true,
+               description = "the format for the volume. Possible values include QCOW2, OVA, and VHD.")
+    private String format;
+
+    @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the volume")
+    private String volumeName;
+
+    @Parameter(name = ApiConstants.URL,
+               type = CommandType.STRING,
+               required = true,
+               length = 2048,
+               description = "the URL of where the volume is hosted. Possible URL include http:// and https://")
+    private String url;
+
+    @Parameter(name = ApiConstants.ZONE_ID,
+               type = CommandType.UUID,
+               entityType = ZoneResponse.class,
+               required = true,
+               description = "the ID of the zone the volume is to be hosted on")
+    private Long zoneId;
+
+    @Parameter(name = ApiConstants.DOMAIN_ID,
+               type = CommandType.UUID,
+               entityType = DomainResponse.class,
+               description = "an optional domainId. If the account parameter is used, domainId must also be used.")
+    private Long domainId;
+
+    @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional accountName. Must be used with domainId.")
+    private String accountName;
+
+    @Parameter(name = ApiConstants.CHECKSUM, type = CommandType.STRING, description = "the checksum value of this volume. " + ApiConstants.CHECKSUM_PARAMETER_PREFIX_DESCRIPTION)
+    private String checksum;
+
+    @Parameter(name = ApiConstants.IMAGE_STORE_UUID, type = CommandType.STRING, description = "Image store uuid")
+    private String imageStoreUuid;
+
+    @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Upload volume for the project")
+    private Long projectId;
+
+    @Parameter(name = ApiConstants.DISK_OFFERING_ID, required = false, type = CommandType.UUID, entityType = DiskOfferingResponse.class, description = "the ID of the disk offering. This must be a custom sized offering since during uploadVolume volume size is unknown.")
+    private Long diskOfferingId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public String getFormat() {
+        return format;
+    }
+
+    public String getVolumeName() {
+        return volumeName;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public Long getZoneId() {
+        return zoneId;
+    }
+
+    public Long getDomainId() {
+        return domainId;
+    }
+
+    public String getAccountName() {
+        return accountName;
+    }
+
+    public String getChecksum() {
+        return checksum;
+    }
+
+    public String getImageStoreUuid() {
+        return imageStoreUuid;
+    }
+
+    public Long getDiskOfferingId() {
+        return diskOfferingId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
+        ResourceAllocationException, NetworkRuleConflictException {
+
+            Volume volume = _volumeService.uploadVolume(this);
+            if (volume != null){
+            VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Restricted, volume);
+                response.setResponseName(getCommandName());
+                setResponseObject(response);
+            } else {
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upload volume");
+            }
+    }
+
+    @Override
+    public String getCommandName() {
+           return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
+        if (accountId == null) {
+            return CallContext.current().getCallingAccount().getId();
+        }
+
+        return accountId;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "uploading volume: " + getVolumeName() + " in the zone " + this._uuidMgr.getUuid(DataCenter.class, getZoneId());
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VOLUME_UPLOAD;
+    }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteStaticRouteCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/DeleteStaticRouteCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpc/DeleteStaticRouteCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpc/DeleteStaticRouteCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/ListPrivateGatewaysCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/ListPrivateGatewaysCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpc/ListPrivateGatewaysCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpc/ListPrivateGatewaysCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/ListStaticRoutesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/ListStaticRoutesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpc/ListStaticRoutesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpc/ListStaticRoutesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/ListVPCsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpc/ListVPCsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java
new file mode 100644
index 00000000000..1309334a496
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java
@@ -0,0 +1,136 @@
+// 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.vpc;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.ACL;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseAsyncCustomIdCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.VpcResponse;
+
+import com.cloud.event.EventTypes;
+import com.cloud.network.vpc.Vpc;
+import com.cloud.user.Account;
+
+@APICommand(name = "updateVPC", description = "Updates a VPC", responseObject = VpcResponse.class, responseView = ResponseView.Restricted, entityType = {Vpc.class},
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class UpdateVPCCmd extends BaseAsyncCustomIdCmd {
+    public static final Logger s_logger = Logger.getLogger(UpdateVPCCmd.class.getName());
+    private static final String s_name = "updatevpcresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @ACL(accessType = AccessType.OperateEntry)
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VpcResponse.class, required = true, description = "the id of the VPC")
+    private Long id;
+
+    @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the VPC")
+    private String vpcName;
+
+    @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "the display text of the VPC")
+    private String displayText;
+
+    @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the vpc to the end user or not", since = "4.4", authorized = {RoleType.Admin})
+    private Boolean display;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public String getVpcName() {
+        return vpcName;
+    }
+
+    public String getDisplayText() {
+        return displayText;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public Boolean isDisplayVpc() {
+        return display;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Vpc vpc = _entityMgr.findById(Vpc.class, getId());
+        if (vpc != null) {
+            return vpc.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public void execute() {
+        Vpc result = _vpcService.updateVpc(getId(), getVpcName(), getDisplayText(), getCustomId(), isDisplayVpc());
+        if (result != null) {
+            VpcResponse response = _responseGenerator.createVpcResponse(ResponseView.Restricted, result);
+            response.setResponseName(getCommandName());
+            setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update VPC");
+        }
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VPC_UPDATE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "updating VPC id=" + getId();
+    }
+
+    @Override
+    public String getSyncObjType() {
+        return BaseAsyncCmd.vpcSyncObject;
+    }
+
+    @Override
+    public Long getSyncObjId() {
+        return getId();
+    }
+
+    @Override
+    public void checkUuid() {
+        if (getCustomId() != null) {
+            _uuidMgr.checkUuid(getCustomId(), Vpc.class);
+        }
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateRemoteAccessVpnCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/CreateRemoteAccessVpnCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpn/CreateRemoteAccessVpnCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpn/CreateRemoteAccessVpnCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/ListRemoteAccessVpnsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListRemoteAccessVpnsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpn/ListRemoteAccessVpnsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListRemoteAccessVpnsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnConnectionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListVpnConnectionsCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnConnectionsCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListVpnConnectionsCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnCustomerGatewaysCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListVpnCustomerGatewaysCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnCustomerGatewaysCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListVpnCustomerGatewaysCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnGatewaysCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListVpnGatewaysCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnGatewaysCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListVpnGatewaysCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnUsersCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListVpnUsersCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnUsersCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListVpnUsersCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateRemoteAccessVpnCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/UpdateRemoteAccessVpnCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpn/UpdateRemoteAccessVpnCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpn/UpdateRemoteAccessVpnCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnConnectionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/UpdateVpnConnectionCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnConnectionCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpn/UpdateVpnConnectionCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnGatewayCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/UpdateVpnGatewayCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnGatewayCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/vpn/UpdateVpnGatewayCmd.java
diff --git a/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/zone/ListZonesCmd.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/command/user/zone/ListZonesCmd.java
rename to api/src/main/java/org/apache/cloudstack/api/command/user/zone/ListZonesCmd.java
diff --git a/api/src/org/apache/cloudstack/api/response/AccountResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/AccountResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/AccountResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/AccountResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/AcquireIPAddressResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/AcquireIPAddressResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/AcquireIPAddressResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/AcquireIPAddressResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/AcquirePodIpCmdResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/AcquirePodIpCmdResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/AcquirePodIpCmdResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/AcquirePodIpCmdResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/AlertResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/AlertResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/AlertResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/AlertResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/AnnotationResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/AnnotationResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/AnnotationResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/AnnotationResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerInstanceResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ApplicationLoadBalancerInstanceResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerInstanceResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/ApplicationLoadBalancerInstanceResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ApplicationLoadBalancerResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/ApplicationLoadBalancerResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerRuleResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ApplicationLoadBalancerRuleResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerRuleResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/ApplicationLoadBalancerRuleResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/AsyncJobResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/AsyncJobResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/AsyncJobResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/AsyncJobResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/AuthenticationCmdResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/AuthenticationCmdResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/AuthenticationCmdResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/AuthenticationCmdResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/AutoScalePolicyResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/AutoScalePolicyResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/AutoScalePolicyResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/AutoScalePolicyResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/CAProviderResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/CAProviderResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/CAProviderResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/CAProviderResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/CapabilitiesResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/CapabilitiesResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/CapabilitiesResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/CapabilitiesResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/CapabilityResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/CapabilityResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/CapabilityResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/CapabilityResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/CapacityResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/CapacityResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/CapacityResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/CapacityResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/CertificateResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/CertificateResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/CertificateResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/CertificateResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/ChildTemplateResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ChildTemplateResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/ChildTemplateResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/ChildTemplateResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/CloudIdentifierResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/CloudIdentifierResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/CloudIdentifierResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/CloudIdentifierResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/ClusterResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ClusterResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/ClusterResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/ClusterResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/ConditionResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ConditionResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/ConditionResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/ConditionResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/ConfigurationResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ConfigurationResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/ConfigurationResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/ConfigurationResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/ControlledEntityResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ControlledEntityResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/ControlledEntityResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/ControlledEntityResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/ControlledViewEntityResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ControlledViewEntityResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/ControlledViewEntityResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/ControlledViewEntityResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/CounterResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/CounterResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/CounterResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/CounterResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/CreateCmdResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/CreateCmdResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/CreateCmdResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/CreateCmdResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/CreateSSHKeyPairResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/CreateSSHKeyPairResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/CreateSSHKeyPairResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/CreateSSHKeyPairResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/CustomCertificateResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/CustomCertificateResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/CustomCertificateResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/CustomCertificateResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/DeploymentPlannersResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/DeploymentPlannersResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/DeploymentPlannersResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/DeploymentPlannersResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/DiskOfferingResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/DiskOfferingResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/DomainResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/DomainResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/DomainResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/DomainResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/DomainRouterResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/DomainRouterResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/DomainRouterResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/DomainRouterResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/EventResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/EventResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/EventResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/EventResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/EventTypeResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/EventTypeResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/EventTypeResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/EventTypeResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/ExceptionResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ExceptionResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/ExceptionResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/ExceptionResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/ExternalFirewallResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ExternalFirewallResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/ExternalFirewallResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/ExternalFirewallResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/ExternalLoadBalancerResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ExternalLoadBalancerResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/ExternalLoadBalancerResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/ExternalLoadBalancerResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/ExtractResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ExtractResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/ExtractResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/ExtractResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/FirewallResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/FirewallResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/FirewallResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/FirewallResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/FirewallRuleResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/FirewallRuleResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/FirewallRuleResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/FirewallRuleResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/GetUploadParamsResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/GetUploadParamsResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/GetUploadParamsResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/GetUploadParamsResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/GetVMPasswordResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/GetVMPasswordResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/GetVMPasswordResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/GetVMPasswordResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/GlobalLoadBalancerResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/GlobalLoadBalancerResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/GlobalLoadBalancerResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/GlobalLoadBalancerResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/GpuResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/GpuResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/GpuResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/GpuResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/GuestOSCategoryResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/GuestOSCategoryResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/GuestOSCategoryResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/GuestOSCategoryResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/GuestOSResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/GuestOSResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/GuestOSResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/GuestOSResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/GuestOsMappingResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/GuestOsMappingResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/GuestOsMappingResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/GuestOsMappingResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/GuestVlanRangeResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/GuestVlanRangeResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/GuestVlanRangeResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/GuestVlanRangeResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/HAProviderResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/HAProviderResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/HAProviderResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/HAProviderResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/HostForMigrationResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/HostForMigrationResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/HostForMigrationResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/HostForMigrationResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/HostHAResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/HostHAResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/HostHAResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/HostHAResponse.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/response/HostResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/HostResponse.java
new file mode 100644
index 00000000000..3d53682d3b9
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/response/HostResponse.java
@@ -0,0 +1,664 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.response;
+
+import com.cloud.host.Host;
+import com.cloud.host.Status;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.serializer.Param;
+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 org.apache.cloudstack.ha.HAConfig;
+import org.apache.cloudstack.outofbandmanagement.OutOfBandManagement;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@EntityReference(value = Host.class)
+public class HostResponse extends BaseResponse {
+    @SerializedName(ApiConstants.ID)
+    @Param(description = "the ID of the host")
+    private String id;
+
+    @SerializedName(ApiConstants.NAME)
+    @Param(description = "the name of the host")
+    private String name;
+
+    @SerializedName(ApiConstants.STATE)
+    @Param(description = "the state of the host")
+    private Status state;
+
+    @SerializedName("disconnected")
+    @Param(description = "true if the host is disconnected. False otherwise.")
+    private Date disconnectedOn;
+
+    @SerializedName(ApiConstants.TYPE)
+    @Param(description = "the host type")
+    private Host.Type hostType;
+
+    @SerializedName("oscategoryid")
+    @Param(description = "the OS category ID of the host")
+    private String osCategoryId;
+
+    @SerializedName("oscategoryname")
+    @Param(description = "the OS category name of the host")
+    private String osCategoryName;
+
+    @SerializedName(ApiConstants.IP_ADDRESS)
+    @Param(description = "the IP address of the host")
+    private String ipAddress;
+
+    @SerializedName(ApiConstants.ZONE_ID)
+    @Param(description = "the Zone ID of the host")
+    private String zoneId;
+
+    @SerializedName(ApiConstants.ZONE_NAME)
+    @Param(description = "the Zone name of the host")
+    private String zoneName;
+
+    @SerializedName(ApiConstants.POD_ID)
+    @Param(description = "the Pod ID of the host")
+    private String podId;
+
+    @SerializedName("podname")
+    @Param(description = "the Pod name of the host")
+    private String podName;
+
+    @SerializedName("version")
+    @Param(description = "the host version")
+    private String version;
+
+    @SerializedName(ApiConstants.HYPERVISOR)
+    @Param(description = "the host hypervisor")
+    private HypervisorType hypervisor;
+
+    @SerializedName("cpusockets")
+    @Param(description = "the number of CPU sockets on the host")
+    private Integer cpuSockets;
+
+    @SerializedName("cpunumber")
+    @Param(description = "the CPU number of the host")
+    private Integer cpuNumber;
+
+    @SerializedName("cpuspeed")
+    @Param(description = "the CPU speed of the host")
+    private Long cpuSpeed;
+
+    @SerializedName("cpuallocated")
+    @Param(description = "the amount of the host's CPU currently allocated")
+    private String cpuAllocated;
+
+    @SerializedName("cpuused")
+    @Param(description = "the amount of the host's CPU currently used")
+    private String cpuUsed;
+
+    @SerializedName("cpuwithoverprovisioning")
+    @Param(description = "the amount of the host's CPU after applying the cpu.overprovisioning.factor ")
+    private String cpuWithOverprovisioning;
+
+    @SerializedName("averageload")
+    @Param(description = "the cpu average load on the host")
+    private Long averageLoad;
+
+    @SerializedName("networkkbsread")
+    @Param(description = "the incoming network traffic on the host")
+    private Long networkKbsRead;
+
+    @SerializedName("networkkbswrite")
+    @Param(description = "the outgoing network traffic on the host")
+    private Long networkKbsWrite;
+
+    @Deprecated
+    @SerializedName("memorytotal")
+    @Param(description = "the memory total of the host, this parameter is deprecated use memorywithoverprovisioning")
+    private Long memoryTotal;
+
+    @SerializedName("memorywithoverprovisioning")
+    @Param(description = "the amount of the host's memory after applying the mem.overprovisioning.factor")
+    private String memWithOverprovisioning;
+
+    @SerializedName("memoryallocated")
+    @Param(description = "the amount of the host's memory currently allocated")
+    private long memoryAllocated;
+
+    @SerializedName("memoryused")
+    @Param(description = "the amount of the host's memory currently used")
+    private Long memoryUsed;
+
+    @SerializedName(ApiConstants.GPUGROUP)
+    @Param(description = "GPU cards present in the host", responseObject = GpuResponse.class, since = "4.4")
+    private List<GpuResponse> gpuGroup;
+
+    @SerializedName("disksizetotal")
+    @Param(description = "the total disk size of the host")
+    private Long diskSizeTotal;
+
+    @SerializedName("disksizeallocated")
+    @Param(description = "the host's currently allocated disk size")
+    private Long diskSizeAllocated;
+
+    @SerializedName("capabilities")
+    @Param(description = "capabilities of the host")
+    private String capabilities;
+
+    @SerializedName("lastpinged")
+    @Param(description = "the date and time the host was last pinged")
+    private Date lastPinged;
+
+    @SerializedName("managementserverid")
+    @Param(description = "the management server ID of the host")
+    private Long managementServerId;
+
+    @SerializedName("clusterid")
+    @Param(description = "the cluster ID of the host")
+    private String clusterId;
+
+    @SerializedName("clustername")
+    @Param(description = "the cluster name of the host")
+    private String clusterName;
+
+    @SerializedName("clustertype")
+    @Param(description = "the cluster type of the cluster that host belongs to")
+    private String clusterType;
+
+    @SerializedName("islocalstorageactive")
+    @Param(description = "true if local storage is active, false otherwise")
+    private Boolean localStorageActive;
+
+    @SerializedName(ApiConstants.CREATED)
+    @Param(description = "the date and time the host was created")
+    private Date created;
+
+    @SerializedName("removed")
+    @Param(description = "the date and time the host was removed")
+    private Date removed;
+
+    @SerializedName("events")
+    @Param(description = "events available for the host")
+    private String events;
+
+    @SerializedName("hosttags")
+    @Param(description = "comma-separated list of tags for the host")
+    private String hostTags;
+
+    @SerializedName("hasenoughcapacity")
+    @Param(description = "true if this host has enough CPU and RAM capacity to migrate a VM to it, false otherwise")
+    private Boolean hasEnoughCapacity;
+
+    @SerializedName("suitableformigration")
+    @Param(description = "true if this host is suitable(has enough capacity and satisfies all conditions like hosttags, max guests vm limit etc) to migrate a VM to it , false otherwise")
+    private Boolean suitableForMigration;
+
+    @SerializedName("hostha")
+    @Param(description = "the host HA information information")
+    private HostHAResponse hostHAResponse;
+
+    @SerializedName("outofbandmanagement")
+    @Param(description = "the host out-of-band management information")
+    private OutOfBandManagementResponse outOfBandManagementResponse;
+
+    @SerializedName("resourcestate")
+    @Param(description = "the resource state of the host")
+    private String resourceState;
+
+    @SerializedName(ApiConstants.HYPERVISOR_VERSION)
+    @Param(description = "the hypervisor version")
+    private String hypervisorVersion;
+
+    @SerializedName(ApiConstants.HA_HOST)
+    @Param(description = "true if the host is Ha host (dedicated to vms started by HA process; false otherwise")
+    private Boolean haHost;
+
+    @SerializedName(ApiConstants.DETAILS)
+    @Param(description = "Host details in key/value pairs.", since = "4.5")
+    private Map details;
+
+    @SerializedName(ApiConstants.ANNOTATION)
+    @Param(description = "the last annotation set on this host by an admin", since = "4.11")
+    private String annotation;
+
+    @SerializedName(ApiConstants.LAST_ANNOTATED)
+    @Param(description = "the last time this host was annotated", since = "4.11")
+    private Date lastAnnotated;
+
+    @SerializedName(ApiConstants.USERNAME)
+    @Param(description = "the admin that annotated this host", since = "4.11")
+    private String username;
+
+    // Default visibility to support accessing the details from unit tests
+    Map getDetails() {
+        return details;
+    }
+
+    @Override
+    public String getObjectId() {
+        return this.getId();
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public void setState(Status state) {
+        this.state = state;
+    }
+
+    public void setDisconnectedOn(Date disconnectedOn) {
+        this.disconnectedOn = disconnectedOn;
+    }
+
+    public void setHostType(Host.Type hostType) {
+        this.hostType = hostType;
+    }
+
+    public void setOsCategoryId(String osCategoryId) {
+        this.osCategoryId = osCategoryId;
+    }
+
+    public void setOsCategoryName(String osCategoryName) {
+        this.osCategoryName = osCategoryName;
+    }
+
+    public void setIpAddress(String ipAddress) {
+        this.ipAddress = ipAddress;
+    }
+
+    public void setZoneId(String zoneId) {
+        this.zoneId = zoneId;
+    }
+
+    public void setZoneName(String zoneName) {
+        this.zoneName = zoneName;
+    }
+
+    public void setPodId(String podId) {
+        this.podId = podId;
+    }
+
+    public void setPodName(String podName) {
+        this.podName = podName;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public void setHypervisor(HypervisorType hypervisor) {
+        this.hypervisor = hypervisor;
+    }
+
+    public void setCpuSockets(Integer cpuSockets) {
+        this.cpuSockets = cpuSockets;
+    }
+
+    public void setCpuNumber(Integer cpuNumber) {
+        this.cpuNumber = cpuNumber;
+    }
+
+    public void setCpuSpeed(Long cpuSpeed) {
+        this.cpuSpeed = cpuSpeed;
+    }
+
+    public String getCpuAllocated() {
+        return cpuAllocated;
+    }
+
+    public void setCpuAllocated(String cpuAllocated) {
+        this.cpuAllocated = cpuAllocated;
+    }
+
+    public void setCpuUsed(String cpuUsed) {
+        this.cpuUsed = cpuUsed;
+    }
+
+    public void setAverageLoad(Long averageLoad) {
+        this.averageLoad = averageLoad;
+    }
+
+    public void setNetworkKbsRead(Long networkKbsRead) {
+        this.networkKbsRead = networkKbsRead;
+    }
+
+    public void setNetworkKbsWrite(Long networkKbsWrite) {
+        this.networkKbsWrite = networkKbsWrite;
+    }
+
+    public void setMemWithOverprovisioning(String memWithOverprovisioning){
+        this.memWithOverprovisioning=memWithOverprovisioning;
+    }
+
+    public void setMemoryAllocated(long memoryAllocated) {
+        this.memoryAllocated = memoryAllocated;
+    }
+
+    public void setMemoryUsed(Long memoryUsed) {
+        this.memoryUsed = memoryUsed;
+    }
+
+    public void setGpuGroups(List<GpuResponse> gpuGroup) {
+        this.gpuGroup = gpuGroup;
+    }
+
+    public void setDiskSizeTotal(Long diskSizeTotal) {
+        this.diskSizeTotal = diskSizeTotal;
+    }
+
+    public void setDiskSizeAllocated(Long diskSizeAllocated) {
+        this.diskSizeAllocated = diskSizeAllocated;
+    }
+
+    public void setCapabilities(String capabilities) {
+        this.capabilities = capabilities;
+    }
+
+    public void setLastPinged(Date lastPinged) {
+        this.lastPinged = lastPinged;
+    }
+
+    public void setManagementServerId(Long managementServerId) {
+        this.managementServerId = managementServerId;
+    }
+
+    public void setClusterId(String clusterId) {
+        this.clusterId = clusterId;
+    }
+
+    public void setClusterName(String clusterName) {
+        this.clusterName = clusterName;
+    }
+
+    public void setClusterType(String clusterType) {
+        this.clusterType = clusterType;
+    }
+
+    public void setLocalStorageActive(Boolean localStorageActive) {
+        this.localStorageActive = localStorageActive;
+    }
+
+    public void setCreated(Date created) {
+        this.created = created;
+    }
+
+    public void setRemoved(Date removed) {
+        this.removed = removed;
+    }
+
+    public void setEvents(String events) {
+        this.events = events;
+    }
+
+    public String getHostTags() {
+        return hostTags;
+    }
+
+    public void setHostTags(String hostTags) {
+        this.hostTags = hostTags;
+    }
+
+    public void setHasEnoughCapacity(Boolean hasEnoughCapacity) {
+        this.hasEnoughCapacity = hasEnoughCapacity;
+    }
+
+    public void setSuitableForMigration(Boolean suitableForMigration) {
+        this.suitableForMigration = suitableForMigration;
+    }
+
+    public HostHAResponse getHostHAResponse() {
+        return hostHAResponse;
+    }
+
+    public void setHostHAResponse(final HAConfig config) {
+        this.hostHAResponse = new HostHAResponse(config);
+    }
+
+    public OutOfBandManagementResponse getOutOfBandManagementResponse() {
+        return outOfBandManagementResponse;
+    }
+
+    public void setOutOfBandManagementResponse(final OutOfBandManagement outOfBandManagementConfig) {
+        this.outOfBandManagementResponse =  new OutOfBandManagementResponse(outOfBandManagementConfig);
+    }
+
+    public String getResourceState() {
+        return resourceState;
+    }
+
+    public void setResourceState(String resourceState) {
+        this.resourceState = resourceState;
+    }
+
+    public String getCpuWithOverprovisioning() {
+        return cpuWithOverprovisioning;
+    }
+
+    public void setCpuWithOverprovisioning(String cpuWithOverprovisioning) {
+        this.cpuWithOverprovisioning = cpuWithOverprovisioning;
+    }
+
+    public void setHypervisorVersion(String hypervisorVersion) {
+        this.hypervisorVersion = hypervisorVersion;
+    }
+
+    public void setHaHost(Boolean haHost) {
+        this.haHost = haHost;
+    }
+
+    public void setAnnotation(String annotation) {
+        this.annotation = annotation;
+    }
+
+    public void setLastAnnotated(Date lastAnnotated) {
+        this.lastAnnotated = lastAnnotated;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public void setDetails(Map details) {
+
+        if (details == null) {
+            return;
+        }
+
+        final Map detailsCopy = new HashMap(details);
+
+        // Fix for CVE ID 2015-3251
+        // Remove sensitive host credential information from
+        // the details to prevent leakage through API calls
+        detailsCopy.remove("username");
+        detailsCopy.remove("password");
+
+        this.details = detailsCopy;
+
+    }
+
+    public void setMemoryTotal(Long memoryTotal) {
+        this.memoryTotal = memoryTotal;
+    }
+    public String getName() {
+        return name;
+    }
+
+    public Status getState() {
+        return state;
+    }
+
+    public Date getDisconnectedOn() {
+        return disconnectedOn;
+    }
+
+    public Host.Type getHostType() {
+        return hostType;
+    }
+
+    public String getOsCategoryId() {
+        return osCategoryId;
+    }
+
+    public String getOsCategoryName() {
+        return osCategoryName;
+    }
+
+    public String getIpAddress() {
+        return ipAddress;
+    }
+
+    public String getZoneId() {
+        return zoneId;
+    }
+
+    public String getZoneName() {
+        return zoneName;
+    }
+
+    public String getPodId() {
+        return podId;
+    }
+
+    public String getPodName() {
+        return podName;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public HypervisorType getHypervisor() {
+        return hypervisor;
+    }
+
+    public Integer getCpuSockets() {
+        return cpuSockets;
+    }
+
+    public Integer getCpuNumber() {
+        return cpuNumber;
+    }
+
+    public Long getCpuSpeed() {
+        return cpuSpeed;
+    }
+
+    public String getCpuUsed() {
+        return cpuUsed;
+    }
+
+    public Long getAverageLoad() {
+        return averageLoad;
+    }
+
+    public Long getNetworkKbsRead() {
+        return networkKbsRead;
+    }
+
+    public Long getNetworkKbsWrite() {
+        return networkKbsWrite;
+    }
+
+    public Long getMemoryTotal() {
+        return memoryTotal;
+    }
+
+    public long getMemoryAllocated() {
+        return memoryAllocated;
+    }
+
+    public Long getMemoryUsed() {
+        return memoryUsed;
+    }
+
+    public List<GpuResponse> getGpuGroup() {
+        return gpuGroup;
+    }
+
+    public Long getDiskSizeTotal() {
+        return diskSizeTotal;
+    }
+
+    public Long getDiskSizeAllocated() {
+        return diskSizeAllocated;
+    }
+
+    public String getCapabilities() {
+        return capabilities;
+    }
+
+    public Date getLastPinged() {
+        return lastPinged;
+    }
+
+    public Long getManagementServerId() {
+        return managementServerId;
+    }
+
+    public String getClusterId() {
+        return clusterId;
+    }
+
+    public String getClusterName() {
+        return clusterName;
+    }
+
+    public String getClusterType() {
+        return clusterType;
+    }
+
+    public Boolean isLocalStorageActive() {
+        return localStorageActive;
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+
+    public Date getRemoved() {
+        return removed;
+    }
+
+    public String getEvents() {
+        return events;
+    }
+
+    public Boolean hasEnoughCapacity() {
+        return hasEnoughCapacity;
+    }
+
+    public Boolean isSuitableForMigration() {
+        return suitableForMigration;
+    }
+
+    public String getHypervisorVersion() {
+        return hypervisorVersion;
+    }
+
+    public Boolean getHaHost() {
+        return haHost;
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/response/HostTagResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/HostTagResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/HostTagResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/HostTagResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/HypervisorCapabilitiesResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/HypervisorCapabilitiesResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/HypervisorCapabilitiesResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/HypervisorCapabilitiesResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/HypervisorResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/HypervisorResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/HypervisorResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/HypervisorResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/IPAddressResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/IPAddressResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/IPAddressResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/IPAddressResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/ImageStoreDetailResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ImageStoreDetailResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/ImageStoreDetailResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/ImageStoreDetailResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/ImageStoreResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ImageStoreResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/ImageStoreResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/ImageStoreResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/InstanceGroupResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/InstanceGroupResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/InstanceGroupResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/InstanceGroupResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/InternalLoadBalancerElementResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/InternalLoadBalancerElementResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/InternalLoadBalancerElementResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/InternalLoadBalancerElementResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/IpForwardingRuleResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/IpForwardingRuleResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/IpForwardingRuleResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/IpForwardingRuleResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/IsoVmResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/IsoVmResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/IsoVmResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/IsoVmResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/IsolationMethodResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/IsolationMethodResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/IsolationMethodResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/IsolationMethodResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/LBHealthCheckPolicyResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/LBHealthCheckPolicyResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/LBHealthCheckPolicyResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/LBHealthCheckPolicyResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/LBHealthCheckResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/LBHealthCheckResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/LBHealthCheckResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/LBHealthCheckResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/LBStickinessPolicyResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/LBStickinessPolicyResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/LBStickinessPolicyResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/LBStickinessPolicyResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/LBStickinessResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/LBStickinessResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/LBStickinessResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/LBStickinessResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/ListResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ListResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/ListResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/ListResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/LoadBalancerResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/LoadBalancerResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/LoadBalancerRuleVmMapResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/LoadBalancerRuleVmMapResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/LoadBalancerRuleVmMapResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/LoadBalancerRuleVmMapResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/LoginCmdResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/LoginCmdResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/LoginCmdResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/LoginCmdResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/LogoutCmdResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/LogoutCmdResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/LogoutCmdResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/LogoutCmdResponse.java
diff --git a/api/src/main/java/org/apache/cloudstack/api/response/NetworkACLItemResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/NetworkACLItemResponse.java
new file mode 100644
index 00000000000..97f5042bc9f
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/response/NetworkACLItemResponse.java
@@ -0,0 +1,155 @@
+// 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 org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+
+import com.cloud.network.vpc.NetworkACLItem;
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+@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<ResourceTagResponse> 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;
+
+    @SerializedName(ApiConstants.FOR_DISPLAY)
+    @Param(description = "is rule for display to the regular user", since = "4.4", authorized = {RoleType.Admin})
+    private Boolean forDisplay;
+
+    @SerializedName(ApiConstants.ACL_REASON)
+    @Param(description = "an explanation on why this ACL rule is being applied", since = "4.12")
+    private String reason;
+
+    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<ResourceTagResponse> 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;
+    }
+
+    public void setForDisplay(Boolean forDisplay) {
+        this.forDisplay = forDisplay;
+    }
+
+    public void setReason(String reason) {
+        this.reason = reason;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+}
diff --git a/api/src/org/apache/cloudstack/api/response/NetworkACLResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/NetworkACLResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/NetworkACLResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/NetworkACLResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/NetworkDeviceResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/NetworkDeviceResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/NetworkDeviceResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/NetworkDeviceResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/NetworkOfferingResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/NetworkOfferingResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/NetworkOfferingResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/NetworkOfferingResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/NetworkResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/NetworkResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/NetworkResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/NetworkResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/NicExtraDhcpOptionResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/NicExtraDhcpOptionResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/NicExtraDhcpOptionResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/NicExtraDhcpOptionResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/NicResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/NicResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/NicResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/NicResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/NicSecondaryIpResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/NicSecondaryIpResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/NicSecondaryIpResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/NicSecondaryIpResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/OutOfBandManagementResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/OutOfBandManagementResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/OutOfBandManagementResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/OutOfBandManagementResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/OvsProviderResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/OvsProviderResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/OvsProviderResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/OvsProviderResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/PhysicalNetworkResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/PhysicalNetworkResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/PhysicalNetworkResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/PhysicalNetworkResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/PodResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/PodResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/PodResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/PodResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/PortableIpRangeResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/PortableIpRangeResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/PortableIpRangeResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/PortableIpRangeResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/PortableIpResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/PortableIpResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/PortableIpResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/PortableIpResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/PrivateGatewayResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/PrivateGatewayResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/PrivateGatewayResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/PrivateGatewayResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/ProjectAccountResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ProjectAccountResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/ProjectAccountResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/ProjectAccountResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/ProjectInvitationResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ProjectInvitationResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/ProjectInvitationResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/ProjectInvitationResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/ProjectResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ProjectResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/ProjectResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/ProjectResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/ProviderResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ProviderResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/ProviderResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/ProviderResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/RegionResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/RegionResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/RegionResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/RegionResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/RegisterResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/RegisterResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/RegisterResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/RegisterResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/RemoteAccessVpnResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/RemoteAccessVpnResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/RemoteAccessVpnResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/RemoteAccessVpnResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/ResourceCountResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ResourceCountResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/ResourceCountResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/ResourceCountResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/ResourceDetailResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ResourceDetailResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/ResourceDetailResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/ResourceDetailResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/ResourceLimitAndCountResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ResourceLimitAndCountResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/ResourceLimitAndCountResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/ResourceLimitAndCountResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/ResourceLimitResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ResourceLimitResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/ResourceLimitResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/ResourceLimitResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/ResourceTagResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ResourceTagResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/ResourceTagResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/ResourceTagResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/RolePermissionResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/RolePermissionResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/RolePermissionResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/RolePermissionResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/RoleResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/RoleResponse.java
similarity index 100%
rename from api/src/org/apache/cloudstack/api/response/RoleResponse.java
rename to api/src/main/java/org/apache/cloudstack/api/response/RoleResponse.java
diff --git a/api/src/org/apache/cloudstack/api/response/SSHKeyPairResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/SSHKeyPairResponse.java
similarity index 100%

  (This diff was longer than 20,000 lines, and has been truncated...)


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services