cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gavin...@apache.org
Subject [3/3] git commit: BUILD: Make CloudStack buildable with nonoss libs
Date Tue, 25 Dec 2012 12:52:43 GMT
BUILD: Make CloudStack buildable with nonoss libs

Nonoss libs are packaged into cloud-deps rpm

Make sure you've following nonoss libs:
 deps/cloud-iControl.jar
 deps/cloud-manageontap.jar
 deps/cloud-netscaler-sdx.jar
 deps/cloud-netscaler.jar
 deps/vmware-apputils.jar
 deps/vmware-vim.jar
 deps/vmware-vim25.jar

This reverse engineers and sort of reverts the commit:
5ae15f8bbf9a8ffdd07dda3008e6c239b1d1e621.

The vhd-util is downloaded and added to (refer CLOUDSTACK-134)
scripts/vm/hypervisor/xenserver/vhd-util, from:
http://download.cloud.com.s3.amazonaws.com/tools/vhd-util

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/20fab871
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/20fab871
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/20fab871

Branch: refs/heads/4.0
Commit: 20fab87108ab4e6790709d4784ce6994467d3067
Parents: 1434ade
Author: Rohit Yadav <rohit.yadav@citrix.com>
Authored: Fri Sep 14 18:10:54 2012 +0530
Committer: root <root@ms1install.(none)>
Committed: Tue Dec 25 07:17:43 2012 +0800

----------------------------------------------------------------------
 .../com/cloud/agent/vmdata/JettyVmDataServer.java  |  370 +++++++++
 build/build-cloud-plugins.xml                      |   14 +-
 build/build-cloud.xml                              |    4 +-
 build/package.xml                                  |    9 +-
 client/pom.xml                                     |   37 +
 client/tomcatconf/components.xml.in                |   19 +
 cloud.spec                                         |   23 +-
 console-proxy/pom.xml                              |    5 +
 debian/cloud-deps.install                          |   11 +
 debian/cloud-server.install                        |    7 +
 deps/pom.xml                                       |   25 +
 patches/pom.xml                                    |    5 +
 .../kvm/resource/FakeComputingResource.java        |  641 +++++++++++++++
 pom.xml                                            |    1 +
 scripts/vm/hypervisor/xenserver/vhd-util           |  Bin 0 -> 318977 bytes
 wscript_build                                      |    6 +-
 16 files changed, 1162 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/20fab871/agent/src/com/cloud/agent/vmdata/JettyVmDataServer.java
----------------------------------------------------------------------
diff --git a/agent/src/com/cloud/agent/vmdata/JettyVmDataServer.java b/agent/src/com/cloud/agent/vmdata/JettyVmDataServer.java
new file mode 100644
index 0000000..fa1f8d1
--- /dev/null
+++ b/agent/src/com/cloud/agent/vmdata/JettyVmDataServer.java
@@ -0,0 +1,370 @@
+// 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.vmdata;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.File;
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Local;
+import javax.naming.ConfigurationException;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.log4j.Logger;
+import org.mortbay.jetty.Connector;
+import org.mortbay.jetty.Handler;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.handler.DefaultHandler;
+import org.mortbay.jetty.handler.HandlerList;
+import org.mortbay.jetty.handler.ResourceHandler;
+import org.mortbay.jetty.nio.SelectChannelConnector;
+import org.mortbay.jetty.servlet.Context;
+import org.mortbay.jetty.servlet.ServletHolder;
+import org.mortbay.thread.QueuedThreadPool;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.routing.VmDataCommand;
+import com.cloud.agent.api.to.NicTO;
+import com.cloud.agent.api.to.VirtualMachineTO;
+import com.cloud.network.Networks.TrafficType;
+import com.cloud.storage.JavaStorageLayer;
+import com.cloud.storage.StorageLayer;
+import com.cloud.utils.net.NetUtils;
+import com.cloud.utils.script.Script;
+
+/**
+ * Serves vm data using embedded Jetty server
+ *
+ */
+@Local(value = { VmDataServer.class })
+public class JettyVmDataServer implements VmDataServer {
+    private static final Logger s_logger = Logger
+            .getLogger(JettyVmDataServer.class);
+
+    public static final String USER_DATA = "user-data";
+    public static final String META_DATA = "meta-data";
+    protected String _vmDataDir;
+    protected Server _jetty;
+    protected String _hostIp;
+    protected Map<String, String> _ipVmMap = new HashMap<String, String>();
+    protected StorageLayer _fs = new JavaStorageLayer();
+
+    public class VmDataServlet extends HttpServlet {
+
+        private static final long serialVersionUID = -1640031398971742349L;
+
+        JettyVmDataServer _vmDataServer;
+        String _dataType; // userdata or meta-data
+
+        public VmDataServlet(JettyVmDataServer dataServer, String dataType) {
+            this._vmDataServer = dataServer;
+            this._dataType = dataType;
+        }
+
+        @Override
+        protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+                throws ServletException, IOException {
+            int port = req.getServerPort();
+            if (port != 80 && port != 8000) {
+                resp.sendError(HttpServletResponse.SC_NOT_FOUND,
+                        "Request not understood");
+                return;
+            }
+            if (_dataType.equalsIgnoreCase(USER_DATA)) {
+                handleUserData(req, resp);
+            } else if (_dataType.equalsIgnoreCase(META_DATA)) {
+                handleMetaData(req, resp);
+            }
+        }
+
+        protected void handleUserData(HttpServletRequest req,
+                HttpServletResponse resp) throws ServletException, IOException {
+            String metadataItem = req.getPathInfo();
+            String requester = req.getRemoteAddr();
+            resp.setContentType("text/html");
+            resp.setStatus(HttpServletResponse.SC_OK);
+            String data = null;
+            if (metadataItem != null) {
+                String[] path = metadataItem.split("/");
+                if (path.length > 1) {
+                    metadataItem = path[1];
+                }
+            }
+
+            if (metadataItem != null)
+                data = _vmDataServer.getVmDataItem(requester, metadataItem);
+
+            if (data != null) {
+                resp.getWriter().print(data);
+            } else {
+                resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
+                resp.sendError(HttpServletResponse.SC_NOT_FOUND,
+                        "Request not found");
+            }
+
+        }
+
+        protected void handleMetaData(HttpServletRequest req,
+                HttpServletResponse resp) throws ServletException, IOException {
+            String metadataItem = req.getPathInfo();
+            String requester = req.getRemoteAddr();
+            resp.setContentType("text/html");
+            resp.setStatus(HttpServletResponse.SC_OK);
+            String metaData = _vmDataServer.getVmDataItem(requester,
+                    metadataItem);
+            if (metaData != null) {
+                resp.getWriter().print(
+                        _vmDataServer.getVmDataItem(requester, metadataItem));
+            } else {
+                resp.sendError(HttpServletResponse.SC_NOT_FOUND,
+                        "Request not found");
+            }
+        }
+
+    }
+
+    @Override
+    public boolean configure(String name, Map<String, Object> params)
+            throws ConfigurationException {
+        boolean success = true;
+        try {
+            int vmDataPort = 80;
+            int fileservingPort = 8000;
+            _vmDataDir = (String) params.get("vm.data.dir");
+            String port = (String) params.get("vm.data.port");
+            if (port != null) {
+                vmDataPort = Integer.parseInt(port);
+            }
+            port = (String) params.get("file.server.port");
+            if (port != null) {
+                fileservingPort = Integer.parseInt(port);
+            }
+            _hostIp = (String) params.get("host.ip");
+
+            if (_vmDataDir == null) {
+                _vmDataDir = "/var/www/html";
+            }
+            success = _fs.mkdirs(_vmDataDir);
+            success = success && buildIpVmMap();
+            if (success) {
+                setupJetty(vmDataPort, fileservingPort);
+            }
+        } catch (Exception e) {
+            s_logger.warn("Failed to configure jetty", e);
+            throw new ConfigurationException("Failed to configure jetty!!");
+        }
+        return success;
+    }
+
+    protected boolean buildIpVmMap() {
+        String[] dirs = _fs.listFiles(_vmDataDir);
+        for (String dir : dirs) {
+            String[] path = dir.split("/");
+            String vm = path[path.length - 1];
+            if (vm.startsWith("i-")) {
+                String[] dataFiles = _fs.listFiles(dir);
+                for (String dfile : dataFiles) {
+                    String path2[] = dfile.split("/");
+                    String ipv4file = path2[path2.length - 1];
+                    if (ipv4file.equalsIgnoreCase("local-ipv4")) {
+                        try {
+                            BufferedReader input = new BufferedReader(
+                                    new FileReader(dfile));
+                            String line = null;
+                            while ((line = input.readLine()) != null) {
+                                if (NetUtils.isValidIp(line)) {
+                                    _ipVmMap.put(line, vm);
+                                    s_logger.info("Found ip " + line
+                                            + " for vm " + vm);
+                                } else {
+                                    s_logger.info("Invalid ip " + line
+                                            + " for vm " + vm);
+                                }
+                            }
+                        } catch (FileNotFoundException e) {
+                            s_logger.warn("Failed to find file " + dfile);
+                        } catch (IOException e) {
+                            s_logger.warn("Failed to get ip address of " + vm);
+                        }
+
+                    }
+                }
+            }
+        }
+        return true;
+    }
+
+    public String getVmDataItem(String requester, String dataItem) {
+        String vmName = _ipVmMap.get(requester);
+        if (vmName == null) {
+            return null;
+        }
+        String vmDataFile = _vmDataDir + File.separator + vmName
+                + File.separator + dataItem;
+        try {
+            BufferedReader input = new BufferedReader(
+                    new FileReader(vmDataFile));
+            StringBuilder result = new StringBuilder();
+            String line = null;
+            while ((line = input.readLine()) != null) {
+                result.append(line);
+            }
+            input.close();
+            return result.toString();
+        } catch (FileNotFoundException e) {
+            s_logger.warn("Failed to find requested file " + vmDataFile);
+            return null;
+        } catch (IOException e) {
+            s_logger.warn("Failed to read requested file " + vmDataFile);
+            return null;
+        }
+    }
+
+    private void setupJetty(int vmDataPort, int fileservingPort)
+            throws Exception {
+        _jetty = new Server();
+
+        SelectChannelConnector connector0 = new SelectChannelConnector();
+        connector0.setHost(_hostIp);
+        connector0.setPort(fileservingPort);
+        connector0.setMaxIdleTime(30000);
+        connector0.setRequestBufferSize(8192);
+
+        SelectChannelConnector connector1 = new SelectChannelConnector();
+        connector1.setHost(_hostIp);
+        connector1.setPort(vmDataPort);
+        connector1.setThreadPool(new QueuedThreadPool(5));
+        connector1.setMaxIdleTime(30000);
+        connector1.setRequestBufferSize(8192);
+
+        _jetty.setConnectors(new Connector[] { connector0, connector1 });
+
+        Context root = new Context(_jetty, "/latest", Context.SESSIONS);
+        root.setResourceBase(_vmDataDir);
+        root.addServlet(new ServletHolder(new VmDataServlet(this, USER_DATA)),
+                "/*");
+
+        ResourceHandler resource_handler = new ResourceHandler();
+        resource_handler.setResourceBase("/var/lib/images/");
+
+        HandlerList handlers = new HandlerList();
+        handlers.setHandlers(new Handler[] { root, resource_handler,
+                new DefaultHandler() });
+        _jetty.setHandler(handlers);
+
+        _jetty.start();
+        // _jetty.join();
+    }
+
+    @Override
+    public boolean start() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean stop() {
+        return true;
+    }
+
+    @Override
+    public String getName() {
+        return "JettyVmDataServer";
+    }
+
+    @Override
+    public Answer handleVmDataCommand(VmDataCommand cmd) {
+        String vmDataDir = _vmDataDir + File.separator + cmd.getVmName();
+
+        Script.runSimpleBashScript("rm -rf " + vmDataDir);
+        _fs.mkdirs(vmDataDir);
+
+        for (String[] item : cmd.getVmData()) {
+            try {
+                _fs.create(vmDataDir, item[1]);
+                String vmDataFile = vmDataDir + File.separator + item[1];
+                byte[] data;
+                if (item[2] != null) {
+                    if (item[1].equals("user-data")) {
+                        data = Base64.decodeBase64(item[2]);
+                    } else {
+                        data = item[2].getBytes();
+                    }
+                    if (data != null && data.length > 0) {
+                        FileOutputStream writer = new FileOutputStream(
+                                vmDataFile);
+                        writer.write(data);
+                        writer.close();
+                    }
+                }
+            } catch (IOException e) {
+                s_logger.warn("Failed to write vm data item " + item[1], e);
+                return new Answer(cmd, false, "Failed to write vm data item "
+                        + item[1]);
+            }
+        }
+        return new Answer(cmd);
+
+    }
+
+    @Override
+    public void handleVmStarted(VirtualMachineTO vm) {
+        for (NicTO nic : vm.getNics()) {
+            if (nic.getType() == TrafficType.Guest) {
+                if (nic.getIp() != null) {
+                    String ipv4File = _vmDataDir + File.separator
+                            + vm.getName() + File.separator + "local-ipv4";
+                    try {
+                        _fs.create(_vmDataDir + File.separator + vm.getName(),
+                                "local-ipv4");
+                        BufferedWriter writer = new BufferedWriter(
+                                new FileWriter(ipv4File));
+                        writer.write(nic.getIp());
+                        _ipVmMap.put(nic.getIp(), vm.getName());
+                        writer.close();
+                    } catch (IOException e) {
+                        s_logger.warn(
+                                "Failed to create or write to local-ipv4 file "
+                                        + ipv4File, e);
+                    }
+
+                }
+
+            }
+        }
+    }
+
+    @Override
+    public void handleVmStopped(String vmName) {
+        String vmDataDir = _vmDataDir + File.separator + vmName;
+        Script.runSimpleBashScript("rm -rf " + vmDataDir);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/20fab871/build/build-cloud-plugins.xml
----------------------------------------------------------------------
diff --git a/build/build-cloud-plugins.xml b/build/build-cloud-plugins.xml
index 207ef71..ce7722f 100755
--- a/build/build-cloud-plugins.xml
+++ b/build/build-cloud-plugins.xml
@@ -179,9 +179,9 @@
   </path>
 
 
-  <target name="compile-plugins" description="Compile all of the jars corresponding to plugins" depends="compile-utils, compile-api, compile-core, compile-server, compile-hypervisors, compile-deployment-planners, compile-host-allocators, compile-network-elements, compile-user-authenticators, compile-storage-allocators"/>
+  <target name="compile-plugins" description="Compile all of the jars corresponding to plugins" depends="compile-utils, compile-api, compile-core, compile-server, compile-hypervisors, compile-deployment-planners, compile-host-allocators, compile-network-elements, compile-user-authenticators, compile-storage-allocators, compile-file-systems "/>
 
-  <target name="build-plugins" depends="build-hypervisors, build-network-elements, build-deployment-planners, build-host-allocators, build-storage-allocators, build-user-authenticators" description="Builds all jar's for the plug-in's"/>
+  <target name="build-plugins" depends="build-hypervisors, build-file-systems, build-network-elements, build-deployment-planners, build-host-allocators, build-storage-allocators, build-user-authenticators" description="Builds all jar's for the plug-in's"/>
 
   <target name="clean-plugins" description="Clean all of the generated files by the plugins">
       <delete file="${build.log}" />
@@ -193,8 +193,8 @@
 
   <!-- ===================== Hypervisors ========================= -->
 
-  <target name="compile-hypervisors" depends="compile-kvm, compile-ovm, compile-xen" description="Compile all hypervisors"/>
-  <target name="build-hypervisors" depends="build-kvm, build-ovm, build-xen " description="Builds all hypervisors"/>
+  <target name="compile-hypervisors" depends="compile-kvm, compile-vmware, compile-ovm, compile-xen" description="Compile all hypervisors"/>
+  <target name="build-hypervisors" depends="build-kvm, build-vmware, build-ovm, build-xen " description="Builds all hypervisors"/>
 
   <target name="compile-kvm" depends="-init, compile-core, compile-agent" description="Compile KVM">
   	<ant antfile="${base.dir}/plugins/hypervisors/kvm/build.xml" target="build"/>
@@ -212,7 +212,7 @@
   </target>
   <target name="build-xen" depends="compile-xen" />
 
-  <target name="compile-vmware" depends="-init, compile-server" description="Compiles Vmware">
+  <target name="compile-vmware" depends="-init, compile-vmware-base" description="Compiles Vmware">
   	<ant antfile="${base.dir}/plugins/hypervisors/vmware/build.xml" target="build"/>
   </target>
   <target name="build-vmware" depends="compile-vmware" />
@@ -279,8 +279,8 @@
 
   <!-- ===================== Network Elements ===================== -->
 
-  <target name="compile-network-elements" depends="compile-ovs, compile-elb, compile-nicira-nvp" description="Compile all network elements"/>
-  <target name="build-network-elements" depends="build-ovs, build-elb, build-nicira-nvp" description="build all network elements"/>
+  <target name="compile-network-elements" depends="compile-ovs, compile-f5, compile-srx, compile-netscaler, compile-elb, compile-nicira-nvp" description="Compile all network elements"/>
+  <target name="build-network-elements" depends="build-ovs, build-f5, build-srx, build-netscaler, build-elb, build-nicira-nvp" description="build all network elements"/>
  
   <target name="compile-netscaler" depends="-init, compile-server" description="Compile NetScaler plugin">
   	<ant antfile="${base.dir}/plugins/network-elements/netscaler/build.xml" target="build"/>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/20fab871/build/build-cloud.xml
----------------------------------------------------------------------
diff --git a/build/build-cloud.xml b/build/build-cloud.xml
index 1b25fac..f751820 100755
--- a/build/build-cloud.xml
+++ b/build/build-cloud.xml
@@ -200,7 +200,7 @@
     <path refid="deps.classpath" />
     <path refid="dist.classpath" />
   </path>
-  <target name="compile-core" depends="-init, compile-utils, compile-api" description="Compile the core business logic.">
+  <target name="compile-core" depends="-init, compile-utils, compile-api, compile-vmware-base" description="Compile the core business logic.">
     <compile-java jar.name="${core.jar}" top.dir="${core.dir}" classpath="core.classpath" />
   </target>
 
@@ -480,7 +480,7 @@
 
   <target name="build-servers" depends="-init, build-server" />
 
-  <target name="build-opensource" depends="-init, build-server, build-agent, build-scripts, build-ui, build-console-proxy, package-oss-systemvm-iso">
+  <target name="build-opensource" depends="-init, compile-all, build-server, build-hypervisors, build-agent, build-scripts, build-ui, build-console-proxy, package-oss-systemvm-iso">
       <fileset dir="${base.dir}/client">
         <include name="setup/**/*" />
       </fileset>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/20fab871/build/package.xml
----------------------------------------------------------------------
diff --git a/build/package.xml b/build/package.xml
index 09ed939..7e2bbe1 100755
--- a/build/package.xml
+++ b/build/package.xml
@@ -209,20 +209,25 @@
         <include name="gson-1.7.1.jar" />
         <include name="commons-httpclient-3.1.jar" />
         <include name="commons-logging-1.1.1.jar" />
-        <include name="commons-collections-3.1.jar" />
+        <include name="commons-collections-3*.jar" />
         <include name="commons-codec-1.6.jar" />
         <include name="commons-pool-1.6.jar" />
+        <include name="commons-discovery*.jar" />
         <include name="cglib-*.jar" />
         <include name="axis-*.jar" />
-        <include name="discovery-*.jar" />
         <include name="wsdl4j-*.jar" />
         <include name="ejb-api-3.0.jar" />
+        <include name="vmware-apputils.jar" />
+        <include name="vmware-vim.jar" />
+        <include name="vmware-vim25.jar" />
       </zipfileset>
       <zipfileset dir="${jar.dir}">
         <include name="${agent.jar}" />
         <include name="${utils.jar}" />
         <include name="${core.jar}" />
         <include name="${api.jar}" />
+        <include name="${vmware-base.jar}" />
+        <include name="${vmware.jar}" />
       </zipfileset>
       <zipfileset dir="${console-proxy.dist.dir}" filemode="555"/>
       <zipfileset dir="${scripts.dir}/storage/secondary" prefix="scripts/storage/secondary" filemode="555">

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/20fab871/client/pom.xml
----------------------------------------------------------------------
diff --git a/client/pom.xml b/client/pom.xml
index add72e1..63cad0d 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -104,6 +104,43 @@
       <version>5.1.21</version>
       <scope>runtime</scope>
     </dependency>
+    <!-- Non-OSS deps -->
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-hypervisor-vmware</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-network-srx</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-hypervisor-kvm</artifactId>
+      <version>${project.version}</version>
+      <exclusions>
+        <exclusion>
+          <groupId>org.mortbay.jetty</groupId>
+          <artifactId>jetty</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-netapp</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-network-f5</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-network-netscaler</artifactId>
+      <version>${project.version}</version>
+    </dependency>
   </dependencies>
   <build>
     <defaultGoal>install</defaultGoal>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/20fab871/client/tomcatconf/components.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/components.xml.in b/client/tomcatconf/components.xml.in
index 5730b83..44eddc8 100755
--- a/client/tomcatconf/components.xml.in
+++ b/client/tomcatconf/components.xml.in
@@ -114,6 +114,7 @@ under the License.
         </adapters>
         <adapters key="com.cloud.ha.Investigator">
             <adapter name="SimpleInvestigator" class="com.cloud.ha.CheckOnAgentInvestigator"/>
+            <adapter name="VmwareInvestigator" class="com.cloud.ha.VmwareInvestigator"/>
             <adapter name="XenServerInvestigator" class="com.cloud.ha.XenServerInvestigator"/>
             <adapter name="PingInvestigator" class="com.cloud.ha.UserVmDomRInvestigator"/>
 			<adapter name="ManagementIPSysVMInvestigator" class="com.cloud.ha.ManagementIPSystemVMInvestigator"/>
@@ -121,6 +122,7 @@ under the License.
         <adapters key="com.cloud.ha.FenceBuilder">
             <adapter name="XenServerFenceBuilder" class="com.cloud.ha.XenServerFencer"/>
             <adapter name="KVMFenceBuilder" class="com.cloud.ha.KVMFencer"/>
+            <adapter name="VmwareFenceBuilder" class="com.cloud.ha.VmwareFencer"/>
             <adapter name="OvmFenceBuilder" class="com.cloud.ovm.hypervisor.OvmFencer"/>
         </adapters>
         <adapters key="com.cloud.hypervisor.HypervisorGuru">
@@ -131,6 +133,7 @@ under the License.
             <adapter name="XCP Agent" class="com.cloud.hypervisor.xen.discoverer.XcpServerDiscoverer"/>
             <adapter name="SecondaryStorage" class="com.cloud.storage.secondary.SecondaryStorageDiscoverer"/>
             <adapter name="KVM Agent" class="com.cloud.hypervisor.kvm.discoverer.KvmServerDiscoverer"/>
+            <adapter name="VShpereServer" class="com.cloud.hypervisor.vmware.VmwareServerDiscoverer"/>
             <adapter name="Bare Metal Agent" class="com.cloud.baremetal.BareMetalDiscoverer"/>
             <adapter name="SCVMMServer" class="com.cloud.hypervisor.hyperv.HypervServerDiscoverer"/>            
 			<adapter name="Ovm Discover" class="com.cloud.ovm.hypervisor.OvmDiscoverer" />
@@ -150,11 +153,15 @@ under the License.
             <adapter name="DomainChecker" class="com.cloud.acl.DomainChecker"/>
         </adapters>
         <adapters key="com.cloud.network.element.NetworkElement">
+            <adapter name="JuniperSRX" class="com.cloud.network.element.JuniperSRXExternalFirewallElement"/>
+            <adapter name="Netscaler" class="com.cloud.network.element.NetscalerElement"/>
+            <adapter name="F5BigIP" class="com.cloud.network.element.F5ExternalLoadBalancerElement"/>
             <adapter name="VirtualRouter" class="com.cloud.network.element.VirtualRouterElement"/>
             <adapter name="Ovs" class="com.cloud.network.element.OvsElement"/>
             <adapter name="ExternalDhcpServer" class="com.cloud.network.element.ExternalDhcpElement"/>
             <adapter name="BareMetal" class="com.cloud.network.element.BareMetalElement"/>
             <adapter name="SecurityGroupProvider" class="com.cloud.network.element.SecurityGroupElement"/>
+            <adapter name="CiscoNexus1000vVSM" class="com.cloud.network.element.CiscoNexusVSMElement"/>
             <adapter name="VpcVirtualRouter" class="com.cloud.network.element.VpcVirtualRouterElement"/>
             <adapter name="NiciraNvp" class="com.cloud.network.element.NiciraNvpElement"/>
         </adapters>
@@ -164,6 +171,7 @@ under the License.
         <adapters key="com.cloud.hypervisor.HypervisorGuru">
             <adapter name="XenServerGuru" class="com.cloud.hypervisor.XenServerGuru"/>
             <adapter name="KVMGuru" class="com.cloud.hypervisor.KVMGuru"/>
+            <adapter name="VMwareGuru" class="com.cloud.hypervisor.guru.VMwareGuru"/>
             <adapter name="BareMetalGuru" class="com.cloud.baremetal.BareMetalGuru"/>
             <adapter name="HypervGuru" class="com.cloud.hypervisor.guru.HypervGuru"/>            
             <adapter name="OvmGuru" class="com.cloud.ovm.hypervisor.OvmGuru" />
@@ -171,14 +179,25 @@ under the License.
         <adapters key="com.cloud.agent.StartupCommandProcessor">
             <adapter name="BasicAgentAuthorizer" class="com.cloud.agent.manager.authn.impl.BasicAgentAuthManager"/>
         </adapters>
+        <manager name="VmwareManager" key="com.cloud.hypervisor.vmware.manager.VmwareManager" class="com.cloud.hypervisor.vmware.manager.VmwareManagerImpl"/>
         <manager name="OvsTunnelManager" key="com.cloud.network.ovs.OvsTunnelManager" class="com.cloud.network.ovs.OvsTunnelManagerImpl"/>
         <manager name="ElasticLoadBalancerManager" key="com.cloud.network.lb.ElasticLoadBalancerManager" class="com.cloud.network.lb.ElasticLoadBalancerManagerImpl"/>
+        <manager name="NetappManager" key="com.cloud.netapp.NetappManager" class="com.cloud.netapp.NetappManagerImpl"/>
         <pluggableservice name="VirtualRouterElementService" key="com.cloud.network.element.VirtualRouterElementService" class="com.cloud.network.element.VirtualRouterElement"/>
+        <pluggableservice name="NetscalerExternalLoadBalancerElementService" key="com.cloud.network.element.NetscalerLoadBalancerElementService" class="com.cloud.network.element.NetscalerElement"/>
+        <pluggableservice name="F5ExternalLoadBalancerElementService" key="com.cloud.network.element.F5ExternalLoadBalancerElementService" class="com.cloud.network.element.F5ExternalLoadBalancerElement"/>
+        <pluggableservice name="JuniperSRXFirewallElementService" key="com.cloud.network.element.JuniperSRXFirewallElementService" class="com.cloud.network.element.JuniperSRXExternalFirewallElement"/>
+        <pluggableservice name="CiscoNexusVSMElementService" key="com.cloud.network.element.CiscoNexusVSMElementService" class="com.cloud.network.element.CiscoNexusVSMElement"/>
         <pluggableservice name="NiciraNvpElementService" key="com.cloud.network.element.NiciraNvpElementService" class="com.cloud.network.element.NiciraNvpElement"/>
+        <dao name="NetScalerPodDao" class="com.cloud.network.dao.NetScalerPodDaoImpl" singleton="false"/>
+        <dao name="CiscoNexusVSMDeviceDao" class="com.cloud.network.dao.CiscoNexusVSMDeviceDaoImpl" singleton="false"/>
         <dao name="OvsTunnelInterfaceDao" class="com.cloud.network.ovs.dao.OvsTunnelInterfaceDaoImpl" singleton="false"/>
         <dao name="OvsTunnelAccountDao" class="com.cloud.network.ovs.dao.OvsTunnelNetworkDaoImpl" singleton="false"/>
         <dao name="NiciraNvpDao" class="com.cloud.network.dao.NiciraNvpDaoImpl" singleton="false"/>
         <dao name="NiciraNvpNicMappingDao" class="com.cloud.network.dao.NiciraNvpNicMappingDaoImpl" singleton="false"/>
+        <dao name="NetappPool" class="com.cloud.netapp.dao.PoolDaoImpl" singleton="false"/>
+        <dao name="NetappVolume" class="com.cloud.netapp.dao.VolumeDaoImpl" singleton="false"/>
+        <dao name="NetappLun" class="com.cloud.netapp.dao.LunDaoImpl" singleton="false"/>
         <dao name="ElasticLbVmMapDao" class="com.cloud.network.lb.dao.ElasticLbVmMapDaoImpl" singleton="false"/>
     </management-server>
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/20fab871/cloud.spec
----------------------------------------------------------------------
diff --git a/cloud.spec b/cloud.spec
index debe3ae..61652c2 100644
--- a/cloud.spec
+++ b/cloud.spec
@@ -436,18 +436,25 @@ fi
 %files server
 %defattr(0644,root,root,0755)
 %{_javadir}/%{name}-server.jar
+%{_javadir}/%{name}-vmware-base.jar
+%{_javadir}/%{name}-vmware.jar
 %{_javadir}/%{name}-ovm.jar
 %{_javadir}/%{name}-dp-user-concentrated-pod.jar
 %{_javadir}/%{name}-dp-user-dispersing.jar
 %{_javadir}/%{name}-host-allocator-random.jar
+%{_javadir}/%{name}-plugin-f5.jar
+%{_javadir}/%{name}-plugin-netscaler.jar
 %{_javadir}/%{name}-plugin-ovs.jar
+%{_javadir}/%{name}-plugin-srx.jar
 %{_javadir}/%{name}-storage-allocator-random.jar
 %{_javadir}/%{name}-user-authenticator-ldap.jar
 %{_javadir}/%{name}-user-authenticator-md5.jar
 %{_javadir}/%{name}-user-authenticator-plaintext.jar
 %{_javadir}/%{name}-plugin-hypervisor-xen.jar
-%{_javadir}/%{name}-plugin-elb.jar
+%{_javadir}/%{name}-plugin-hypervisor-kvm.jar
+%{_javadir}/%{name}-plugin-netapp.jar
 %{_javadir}/%{name}-plugin-nicira-nvp.jar
+%{_javadir}/%{name}-plugin-elb.jar
 %config(noreplace) %{_sysconfdir}/%{name}/server/*
 %doc LICENSE
 %doc NOTICE
@@ -497,11 +504,25 @@ fi
 %{_javadir}/jasypt-1.*.jar
 %{_javadir}/commons-configuration-1.8.jar
 %{_javadir}/ejb-api-3.0.jar
+%{_javadir}/axis-1.4.jar
 %{_javadir}/axis2-1.5.1.jar
+%{_javadir}/axis-jaxrpc-1.4.jar
+%{_javadir}/axis2-kernel-*.jar
 %{_javadir}/commons-discovery-0.5.jar
 %{_javadir}/jstl-1.2.jar
 %{_javadir}/javax.persistence-2.0.0.jar
 %{_javadir}/bcprov-jdk16-1.45.jar
+%{_javadir}/commons-lang-*.jar
+%{_javadir}/mysql-connector-java-5.1.21.jar
+%{_javadir}/junit-4.10.jar
+%{_javadir}/jetty-6.1.26.jar
+%{_javadir}/jetty-util-6.1.26.jar
+%{_javadir}/libvirt-0.4.9.jar
+%{_javadir}/cloud-netscaler.jar
+%{_javadir}/cloud-netscaler-sdx.jar
+%{_javadir}/cloud-iControl.jar
+%{_javadir}/cloud-manageontap.jar
+%{_javadir}/vmware*.jar
 %doc LICENSE
 %doc NOTICE
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/20fab871/console-proxy/pom.xml
----------------------------------------------------------------------
diff --git a/console-proxy/pom.xml b/console-proxy/pom.xml
index 9c1bf25..4042431 100644
--- a/console-proxy/pom.xml
+++ b/console-proxy/pom.xml
@@ -50,6 +50,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-vmware-base</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
       <artifactId>cloud-agent</artifactId>
       <version>${project.version}</version>
     </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/20fab871/debian/cloud-deps.install
----------------------------------------------------------------------
diff --git a/debian/cloud-deps.install b/debian/cloud-deps.install
index 57451bb..a584ddf 100644
--- a/debian/cloud-deps.install
+++ b/debian/cloud-deps.install
@@ -31,3 +31,14 @@
 /usr/share/java/javax.persistence-2.0.0.jar
 /usr/share/java/gson-1.7.1.jar
 /usr/share/java/xapi-5.6.100-1-SNAPSHOT.jar
+/usr/share/java/axis-1.4.jar
+/usr/share/java/axis-jaxrpc-1.4.jar
+/usr/share/java/junit-4.10.jar
+/usr/share/java/jetty-6.1.26.jar
+/usr/share/java/jetty-util-6.1.26.jar
+/usr/share/java/mysql-connector-java-5.1.21.jar
+/usr/share/java/cloud-netscaler.jar
+/usr/share/java/cloud-netscaler-sdx.jar
+/usr/share/java/cloud-iControl.jar
+/usr/share/java/cloud-manageontap.jar
+/usr/share/java/vmware-*.jar

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/20fab871/debian/cloud-server.install
----------------------------------------------------------------------
diff --git a/debian/cloud-server.install b/debian/cloud-server.install
index 9cd1eeb..17d4246 100644
--- a/debian/cloud-server.install
+++ b/debian/cloud-server.install
@@ -29,3 +29,10 @@
 /usr/share/java/cloud-user-authenticator-md5.jar
 /usr/share/java/cloud-user-authenticator-plaintext.jar
 /usr/share/java/cloud-plugin-hypervisor-xen.jar
+/usr/share/java/cloud-vmware-base.jar
+/usr/share/java/cloud-vmware.jar
+/usr/share/java/cloud-plugin-hypervisor-kvm.jar
+/usr/share/java/cloud-plugin-f5.jar
+/usr/share/java/cloud-plugin-netscaler.jar
+/usr/share/java/cloud-plugin-srx.jar
+/usr/share/java/cloud-plugin-netapp.jar

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/20fab871/deps/pom.xml
----------------------------------------------------------------------
diff --git a/deps/pom.xml b/deps/pom.xml
index 90de4ac..633ca9b 100644
--- a/deps/pom.xml
+++ b/deps/pom.xml
@@ -110,6 +110,31 @@
       <scope>runtime</scope>
     </dependency>
     <!-- Non-OSS deps -->
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-hypervisor-vmware</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-network-srx</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-netapp</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-network-f5</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-network-netscaler</artifactId>
+      <version>${project.version}</version>
+    </dependency>
     <!-- for awsapi build -->
     <dependency>
       <groupId>org.apache.axis2</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/20fab871/patches/pom.xml
----------------------------------------------------------------------
diff --git a/patches/pom.xml b/patches/pom.xml
index 4f8b4b2..302c720 100644
--- a/patches/pom.xml
+++ b/patches/pom.xml
@@ -50,6 +50,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-vmware-base</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
       <artifactId>cloud-agent</artifactId>
       <version>${project.version}</version>
     </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/20fab871/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/FakeComputingResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/FakeComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/FakeComputingResource.java
new file mode 100644
index 0000000..d2a8643
--- /dev/null
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/FakeComputingResource.java
@@ -0,0 +1,641 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.hypervisor.kvm.resource;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.UUID;
+
+import javax.ejb.Local;
+import javax.naming.ConfigurationException;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.AttachIsoCommand;
+import com.cloud.agent.api.AttachVolumeCommand;
+import com.cloud.agent.api.CheckHealthAnswer;
+import com.cloud.agent.api.CheckHealthCommand;
+import com.cloud.agent.api.CheckStateAnswer;
+import com.cloud.agent.api.CheckStateCommand;
+import com.cloud.agent.api.CheckVirtualMachineAnswer;
+import com.cloud.agent.api.CheckVirtualMachineCommand;
+import com.cloud.agent.api.CleanupNetworkRulesCmd;
+import com.cloud.agent.api.Command;
+import com.cloud.agent.api.GetHostStatsAnswer;
+import com.cloud.agent.api.GetHostStatsCommand;
+import com.cloud.agent.api.GetStorageStatsAnswer;
+import com.cloud.agent.api.GetStorageStatsCommand;
+import com.cloud.agent.api.GetVmStatsAnswer;
+import com.cloud.agent.api.GetVmStatsCommand;
+import com.cloud.agent.api.ModifySshKeysCommand;
+import com.cloud.agent.api.ModifyStoragePoolAnswer;
+import com.cloud.agent.api.ModifyStoragePoolCommand;
+import com.cloud.agent.api.PingCommand;
+import com.cloud.agent.api.PingRoutingCommand;
+import com.cloud.agent.api.PingTestCommand;
+import com.cloud.agent.api.ReadyAnswer;
+import com.cloud.agent.api.ReadyCommand;
+import com.cloud.agent.api.RebootAnswer;
+import com.cloud.agent.api.RebootCommand;
+import com.cloud.agent.api.SecurityGroupRuleAnswer;
+import com.cloud.agent.api.SecurityGroupRulesCmd;
+import com.cloud.agent.api.StartAnswer;
+import com.cloud.agent.api.StartCommand;
+import com.cloud.agent.api.StartupCommand;
+import com.cloud.agent.api.StartupRoutingCommand;
+import com.cloud.agent.api.StartupRoutingCommand.VmState;
+import com.cloud.agent.api.StartupStorageCommand;
+import com.cloud.agent.api.StopAnswer;
+import com.cloud.agent.api.StopCommand;
+import com.cloud.agent.api.StoragePoolInfo;
+import com.cloud.agent.api.routing.SavePasswordCommand;
+import com.cloud.agent.api.routing.VmDataCommand;
+import com.cloud.agent.api.storage.CreateAnswer;
+import com.cloud.agent.api.storage.CreateCommand;
+import com.cloud.agent.api.storage.DestroyCommand;
+import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer;
+import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
+import com.cloud.agent.api.to.NicTO;
+import com.cloud.agent.api.to.VirtualMachineTO;
+import com.cloud.agent.api.to.VolumeTO;
+import com.cloud.agent.dhcp.DhcpSnooper;
+import com.cloud.agent.dhcp.FakeDhcpSnooper;
+import com.cloud.agent.mockvm.MockVm;
+import com.cloud.agent.mockvm.MockVmMgr;
+import com.cloud.agent.mockvm.VmMgr;
+import com.cloud.agent.vmdata.JettyVmDataServer;
+import com.cloud.agent.vmdata.VmDataServer;
+import com.cloud.host.Host.Type;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.network.Networks.RouterPrivateIpStrategy;
+import com.cloud.network.Networks.TrafficType;
+import com.cloud.resource.ServerResource;
+import com.cloud.resource.ServerResourceBase;
+import com.cloud.storage.Storage;
+import com.cloud.storage.Storage.StoragePoolType;
+import com.cloud.storage.Volume;
+import com.cloud.storage.template.TemplateInfo;
+import com.cloud.utils.PropertiesUtil;
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.utils.script.Script;
+import com.cloud.vm.VirtualMachine.State;
+
+/**
+ * Pretends to be a computing resource
+ *
+ */
+@Local(value = { ServerResource.class })
+public class FakeComputingResource extends ServerResourceBase implements
+        ServerResource {
+    private static final Logger s_logger = Logger
+            .getLogger(FakeComputingResource.class);
+    private Map<String, Object> _params;
+    private VmMgr _vmManager = new MockVmMgr();
+    protected HashMap<String, State> _vms = new HashMap<String, State>(20);
+    protected DhcpSnooper _dhcpSnooper = new FakeDhcpSnooper();
+    protected VmDataServer _vmDataServer = new JettyVmDataServer();
+
+    @Override
+    public Type getType() {
+        return Type.Routing;
+    }
+
+    @Override
+    public StartupCommand[] initialize() {
+        Map<String, VmState> changes = null;
+
+        final List<Object> info = getHostInfo();
+
+        final StartupRoutingCommand cmd = new StartupRoutingCommand(
+                (Integer) info.get(0), (Long) info.get(1), (Long) info.get(2),
+                (Long) info.get(4), (String) info.get(3), HypervisorType.KVM,
+                RouterPrivateIpStrategy.HostLocal, changes);
+        fillNetworkInformation(cmd);
+        cmd.getHostDetails().putAll(getVersionStrings());
+        cmd.setCluster(getConfiguredProperty("cluster", "1"));
+        StoragePoolInfo pi = initializeLocalStorage();
+        StartupStorageCommand sscmd = new StartupStorageCommand();
+        sscmd.setPoolInfo(pi);
+        sscmd.setGuid(pi.getUuid());
+        sscmd.setDataCenter((String) _params.get("zone"));
+        sscmd.setResourceType(Storage.StorageResourceType.STORAGE_POOL);
+
+        return new StartupCommand[] { cmd, sscmd };
+
+    }
+
+    private Map<String, String> getVersionStrings() {
+        Map<String, String> result = new HashMap<String, String>();
+        String hostOs = (String) _params.get("Host.OS");
+        String hostOsVer = (String) _params.get("Host.OS.Version");
+        String hostOsKernVer = (String) _params.get("Host.OS.Kernel.Version");
+        result.put("Host.OS", hostOs == null ? "Fedora" : hostOs);
+        result.put("Host.OS.Version", hostOsVer == null ? "14" : hostOsVer);
+        result.put("Host.OS.Kernel.Version",
+                hostOsKernVer == null ? "2.6.35.6-45.fc14.x86_64"
+                        : hostOsKernVer);
+        return result;
+    }
+
+    protected void fillNetworkInformation(final StartupCommand cmd) {
+
+        cmd.setPrivateIpAddress((String) _params.get("private.ip.address"));
+        cmd.setPrivateMacAddress((String) _params.get("private.mac.address"));
+        cmd.setPrivateNetmask((String) _params.get("private.ip.netmask"));
+
+        cmd.setStorageIpAddress((String) _params.get("private.ip.address"));
+        cmd.setStorageMacAddress((String) _params.get("private.mac.address"));
+        cmd.setStorageNetmask((String) _params.get("private.ip.netmask"));
+        cmd.setGatewayIpAddress((String) _params.get("gateway.ip.address"));
+
+    }
+
+    protected StoragePoolInfo initializeLocalStorage() {
+        String hostIp = (String) _params.get("private.ip.address");
+        String localStoragePath = (String) _params.get("local.storage.path");
+        String lh = hostIp + localStoragePath;
+        String uuid = UUID.nameUUIDFromBytes(lh.getBytes()).toString();
+
+        String capacity = (String) _params.get("local.storage.capacity");
+        String available = (String) _params.get("local.storage.avail");
+
+        return new StoragePoolInfo(uuid, hostIp, localStoragePath,
+                localStoragePath, StoragePoolType.Filesystem,
+                Long.parseLong(capacity), Long.parseLong(available));
+
+    }
+
+    @Override
+    public PingCommand getCurrentStatus(long id) {
+        final HashMap<String, State> newStates = new HashMap<String, State>();
+        _dhcpSnooper.syncIpAddr();
+        return new PingRoutingCommand(com.cloud.host.Host.Type.Routing, id,
+                newStates);
+    }
+
+    @Override
+    public Answer executeRequest(Command cmd) {
+        try {
+            if (cmd instanceof ReadyCommand) {
+                return execute((ReadyCommand) cmd);
+            } else if (cmd instanceof ModifySshKeysCommand) {
+                return execute((ModifySshKeysCommand) cmd);// TODO: remove
+            } else if (cmd instanceof GetHostStatsCommand) {
+                return execute((GetHostStatsCommand) cmd);
+            } else if (cmd instanceof PrimaryStorageDownloadCommand) {
+                return execute((PrimaryStorageDownloadCommand) cmd);
+
+            } else if (cmd instanceof StopCommand) {
+                return execute((StopCommand) cmd);
+            } else if (cmd instanceof GetVmStatsCommand) {
+                return execute((GetVmStatsCommand) cmd);
+            } else if (cmd instanceof RebootCommand) {
+                return execute((RebootCommand) cmd);
+            } else if (cmd instanceof CheckStateCommand) {
+                return executeRequest(cmd);
+            } else if (cmd instanceof CheckHealthCommand) {
+                return execute((CheckHealthCommand) cmd);
+            } else if (cmd instanceof PingTestCommand) {
+                return execute((PingTestCommand) cmd);
+            } else if (cmd instanceof CheckVirtualMachineCommand) {
+                return execute((CheckVirtualMachineCommand) cmd);
+            } else if (cmd instanceof ReadyCommand) {
+                return execute((ReadyCommand) cmd);
+            } else if (cmd instanceof StopCommand) {
+                return execute((StopCommand) cmd);
+            } else if (cmd instanceof CreateCommand) {
+                return execute((CreateCommand) cmd);
+            } else if (cmd instanceof DestroyCommand) {
+                return execute((DestroyCommand) cmd);
+            } else if (cmd instanceof PrimaryStorageDownloadCommand) {
+                return execute((PrimaryStorageDownloadCommand) cmd);
+            } else if (cmd instanceof GetStorageStatsCommand) {
+                return execute((GetStorageStatsCommand) cmd);
+            } else if (cmd instanceof ModifyStoragePoolCommand) {
+                return execute((ModifyStoragePoolCommand) cmd);
+            } else if (cmd instanceof SecurityGroupRulesCmd) {
+                return execute((SecurityGroupRulesCmd) cmd);
+            } else if (cmd instanceof StartCommand) {
+                return execute((StartCommand) cmd);
+            } else if (cmd instanceof CleanupNetworkRulesCmd) {
+                return execute((CleanupNetworkRulesCmd) cmd);
+            } else if (cmd instanceof SavePasswordCommand) {
+                return execute((SavePasswordCommand) cmd);
+            } else if (cmd instanceof VmDataCommand) {
+                return execute((VmDataCommand) cmd);
+            } else {
+                s_logger.warn("Unsupported command ");
+                return Answer.createUnsupportedCommandAnswer(cmd);
+            }
+        } catch (final IllegalArgumentException e) {
+            return new Answer(cmd, false, e.getMessage());
+        }
+    }
+
+    private Answer execute(CleanupNetworkRulesCmd cmd) {
+        return new Answer(cmd);
+    }
+
+    private Answer execute(SecurityGroupRulesCmd cmd) {
+        s_logger.info("Programmed network rules for vm " + cmd.getVmName()
+                + " guestIp=" + cmd.getGuestIp() + ",ingress numrules="
+                + cmd.getIngressRuleSet().length + ",egress numrules="
+                + cmd.getEgressRuleSet().length);
+        return new SecurityGroupRuleAnswer(cmd);
+    }
+
+    private Answer execute(ModifyStoragePoolCommand cmd) {
+        long capacity = getConfiguredProperty("local.storage.capacity",
+                10000000000L);
+        long used = 10000000L;
+        long available = capacity - used;
+        if (cmd.getAdd()) {
+
+            ModifyStoragePoolAnswer answer = new ModifyStoragePoolAnswer(cmd,
+                    capacity, used, new HashMap<String, TemplateInfo>());
+
+            if (s_logger.isInfoEnabled())
+                s_logger.info("Sending ModifyStoragePoolCommand answer with capacity: "
+                        + capacity
+                        + ", used: "
+                        + used
+                        + ", available: "
+                        + available);
+            return answer;
+        } else {
+            if (s_logger.isInfoEnabled())
+                s_logger.info("ModifyNetfsStoragePoolCmd is not add command, cmd: "
+                        + cmd.toString());
+            return new Answer(cmd);
+        }
+    }
+
+    private Answer execute(GetStorageStatsCommand cmd) {
+        return new GetStorageStatsAnswer(cmd, getConfiguredProperty(
+                "local.storage.capacity", 100000000000L), 0L);
+    }
+
+    protected synchronized ReadyAnswer execute(ReadyCommand cmd) {
+        return new ReadyAnswer(cmd);
+    }
+
+    private Answer execute(PrimaryStorageDownloadCommand cmd) {
+        return new PrimaryStorageDownloadAnswer(cmd.getLocalPath(), 16000000L);
+    }
+
+    private Answer execute(ModifySshKeysCommand cmd) {
+        return new Answer(cmd, true, null);
+    }
+
+    @Override
+    protected String getDefaultScriptsDir() {
+        return null;
+    }
+
+    protected String getConfiguredProperty(String key, String defaultValue) {
+        String val = (String) _params.get(key);
+        return val == null ? defaultValue : val;
+    }
+
+    protected Long getConfiguredProperty(String key, Long defaultValue) {
+        String val = (String) _params.get(key);
+
+        if (val != null) {
+            Long result = Long.parseLong(val);
+            return result;
+        }
+        return defaultValue;
+    }
+
+    protected List<Object> getHostInfo() {
+        final ArrayList<Object> info = new ArrayList<Object>();
+        long speed = getConfiguredProperty("cpuspeed", 4000L);
+        long cpus = getConfiguredProperty("cpus", 4L);
+        long ram = getConfiguredProperty("memory", 16000L * 1024L * 1024L);
+        long dom0ram = Math.min(ram / 10, 768 * 1024 * 1024L);
+
+        String cap = getConfiguredProperty("capabilities", "hvm");
+        info.add((int) cpus);
+        info.add(speed);
+        info.add(ram);
+        info.add(cap);
+        info.add(dom0ram);
+        return info;
+
+    }
+
+    private Map<String, Object> getSimulatorProperties()
+            throws ConfigurationException {
+        final File file = PropertiesUtil.findConfigFile("simulator.properties");
+        if (file == null) {
+            throw new ConfigurationException(
+                    "Unable to find simulator.properties.");
+        }
+
+        s_logger.info("simulator.properties found at " + file.getAbsolutePath());
+        Properties properties = new Properties();
+        try {
+            properties.load(new FileInputStream(file));
+
+            final Map<String, Object> params = PropertiesUtil.toMap(properties);
+
+            return params;
+        } catch (final FileNotFoundException ex) {
+            throw new CloudRuntimeException("Cannot find the file: "
+                    + file.getAbsolutePath(), ex);
+        } catch (final IOException ex) {
+            throw new CloudRuntimeException("IOException in reading "
+                    + file.getAbsolutePath(), ex);
+        }
+    }
+
+    @Override
+    public boolean configure(String name, Map<String, Object> params)
+            throws ConfigurationException {
+        Map<String, Object> simProps = getSimulatorProperties();
+        params.putAll(simProps);
+        setParams(params);
+        _vmManager.configure(params);
+        _dhcpSnooper.configure(name, params);
+        _vmDataServer.configure(name, params);
+        return true;
+    }
+
+    public void setParams(Map<String, Object> _params) {
+        this._params = _params;
+    }
+
+    public Map<String, Object> getParams() {
+        return _params;
+    }
+
+    protected synchronized StartAnswer execute(StartCommand cmd) {
+        VmMgr vmMgr = getVmManager();
+
+        VirtualMachineTO vmSpec = cmd.getVirtualMachine();
+        String vmName = vmSpec.getName();
+        State state = State.Stopped;
+
+        try {
+            if (!_vms.containsKey(vmName)) {
+                synchronized (_vms) {
+                    _vms.put(vmName, State.Starting);
+                }
+
+                MockVm vm = vmMgr.createVmFromSpec(vmSpec);
+                vmMgr.createVbd(vmSpec, vmName, vm);
+                vmMgr.createVif(vmSpec, vmName, vm);
+
+                state = State.Running;
+                for (NicTO nic : cmd.getVirtualMachine().getNics()) {
+                    if (nic.getType() == TrafficType.Guest) {
+                        InetAddress addr = _dhcpSnooper.getIPAddr(nic.getMac(),
+                                vmName);
+                        nic.setIp(addr.getHostAddress());
+                    }
+                }
+                _vmDataServer.handleVmStarted(cmd.getVirtualMachine());
+                return new StartAnswer(cmd);
+            } else {
+                String msg = "There is already a VM having the same name "
+                        + vmName;
+                s_logger.warn(msg);
+                return new StartAnswer(cmd, msg);
+            }
+        } catch (Exception ex) {
+
+        } finally {
+            synchronized (_vms) {
+                _vms.put(vmName, state);
+            }
+        }
+        return new StartAnswer(cmd);
+    }
+
+    protected synchronized StopAnswer execute(StopCommand cmd) {
+        VmMgr vmMgr = getVmManager();
+
+        StopAnswer answer = null;
+        String vmName = cmd.getVmName();
+
+        Integer port = vmMgr.getVncPort(vmName);
+
+        State state = null;
+        synchronized (_vms) {
+            state = _vms.get(vmName);
+            _vms.put(vmName, State.Stopping);
+        }
+        try {
+            String result = vmMgr.stopVM(vmName, false);
+            if (result != null) {
+                s_logger.info("Trying destroy on " + vmName);
+                if (result == Script.ERR_TIMEOUT) {
+                    result = vmMgr.stopVM(vmName, true);
+                }
+
+                s_logger.warn("Couldn't stop " + vmName);
+
+                if (result != null) {
+                    return new StopAnswer(cmd, result, false);
+                }
+            }
+
+            answer = new StopAnswer(cmd, null, port, true);
+
+            String result2 = vmMgr.cleanupVnet(cmd.getVnet());
+            if (result2 != null) {
+                result = result2 + (result != null ? ("\n" + result) : "");
+                answer = new StopAnswer(cmd, result, port, true);
+            }
+
+            _dhcpSnooper.cleanup(vmName, null);
+
+            return answer;
+        } finally {
+            if (answer == null || !answer.getResult()) {
+                synchronized (_vms) {
+                    _vms.put(vmName, state);
+                }
+            }
+        }
+    }
+
+    protected Answer execute(final VmDataCommand cmd) {
+        return _vmDataServer.handleVmDataCommand(cmd);
+    }
+
+    protected Answer execute(final SavePasswordCommand cmd) {
+        return new Answer(cmd);
+    }
+
+    protected Answer execute(RebootCommand cmd) {
+        VmMgr vmMgr = getVmManager();
+        vmMgr.rebootVM(cmd.getVmName());
+        return new RebootAnswer(cmd, "success", true);
+    }
+
+    private Answer execute(PingTestCommand cmd) {
+        return new Answer(cmd);
+    }
+
+    protected GetVmStatsAnswer execute(GetVmStatsCommand cmd) {
+        return null;
+    }
+
+    private VmMgr getVmManager() {
+        return _vmManager;
+    }
+
+    protected Answer execute(GetHostStatsCommand cmd) {
+        VmMgr vmMgr = getVmManager();
+        return new GetHostStatsAnswer(cmd, vmMgr.getHostCpuUtilization(),
+                vmMgr.getHostFreeMemory(), vmMgr.getHostTotalMemory(), 0, 0,
+                "SimulatedHost");
+    }
+
+    protected CheckStateAnswer execute(CheckStateCommand cmd) {
+        State state = getVmManager().checkVmState(cmd.getVmName());
+        return new CheckStateAnswer(cmd, state);
+    }
+
+    protected CheckHealthAnswer execute(CheckHealthCommand cmd) {
+        return new CheckHealthAnswer(cmd, true);
+    }
+
+    protected CheckVirtualMachineAnswer execute(
+            final CheckVirtualMachineCommand cmd) {
+        VmMgr vmMgr = getVmManager();
+        final String vmName = cmd.getVmName();
+
+        final State state = vmMgr.checkVmState(vmName);
+        Integer vncPort = null;
+        if (state == State.Running) {
+            vncPort = vmMgr.getVncPort(vmName);
+            synchronized (_vms) {
+                _vms.put(vmName, State.Running);
+            }
+        }
+        return new CheckVirtualMachineAnswer(cmd, state, vncPort);
+    }
+
+    protected Answer execute(final AttachVolumeCommand cmd) {
+        return new Answer(cmd);
+    }
+
+    protected Answer execute(final AttachIsoCommand cmd) {
+        return new Answer(cmd);
+    }
+
+    protected CreateAnswer execute(final CreateCommand cmd) {
+        try {
+
+            VolumeTO vol = new VolumeTO(cmd.getVolumeId(), Volume.Type.ROOT,
+                    com.cloud.storage.Storage.StoragePoolType.LVM, cmd
+                            .getPool().getUuid(), "dummy", "/mountpoint",
+                    "dummyPath", 1000L, null);
+            return new CreateAnswer(cmd, vol);
+        } catch (Throwable th) {
+            return new CreateAnswer(cmd, new Exception("Unexpected exception"));
+        }
+    }
+
+    protected HashMap<String, State> sync() {
+        Map<String, State> newStates;
+        Map<String, State> oldStates = null;
+
+        HashMap<String, State> changes = new HashMap<String, State>();
+
+        synchronized (_vms) {
+            newStates = getVmManager().getVmStates();
+            oldStates = new HashMap<String, State>(_vms.size());
+            oldStates.putAll(_vms);
+
+            for (Map.Entry<String, State> entry : newStates.entrySet()) {
+                String vm = entry.getKey();
+
+                State newState = entry.getValue();
+                State oldState = oldStates.remove(vm);
+
+                if (s_logger.isTraceEnabled()) {
+                    s_logger.trace("VM " + vm + ": xen has state " + newState
+                            + " and we have state "
+                            + (oldState != null ? oldState.toString() : "null"));
+                }
+
+                if (oldState == null) {
+                    _vms.put(vm, newState);
+                    changes.put(vm, newState);
+                } else if (oldState == State.Starting) {
+                    if (newState == State.Running) {
+                        _vms.put(vm, newState);
+                    } else if (newState == State.Stopped) {
+                        s_logger.debug("Ignoring vm " + vm
+                                + " because of a lag in starting the vm.");
+                    }
+                } else if (oldState == State.Stopping) {
+                    if (newState == State.Stopped) {
+                        _vms.put(vm, newState);
+                    } else if (newState == State.Running) {
+                        s_logger.debug("Ignoring vm " + vm
+                                + " because of a lag in stopping the vm. ");
+                    }
+                } else if (oldState != newState) {
+                    _vms.put(vm, newState);
+                    changes.put(vm, newState);
+                }
+            }
+
+            for (Map.Entry<String, State> entry : oldStates.entrySet()) {
+                String vm = entry.getKey();
+                State oldState = entry.getValue();
+
+                if (s_logger.isTraceEnabled()) {
+                    s_logger.trace("VM " + vm
+                            + " is now missing from xen so reporting stopped");
+                }
+
+                if (oldState == State.Stopping) {
+                    s_logger.debug("Ignoring VM " + vm
+                            + " in transition state stopping.");
+                    _vms.remove(vm);
+                } else if (oldState == State.Starting) {
+                    s_logger.debug("Ignoring VM " + vm
+                            + " in transition state starting.");
+                } else if (oldState == State.Stopped) {
+                    _vms.remove(vm);
+                } else {
+                    changes.put(entry.getKey(), State.Stopped);
+                }
+            }
+        }
+
+        return changes;
+    }
+
+    protected Answer execute(DestroyCommand cmd) {
+        return new Answer(cmd, true, null);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/20fab871/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 8394ed6..ce50dc5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -155,6 +155,7 @@
     <module>utils</module>
     <module>deps/XenServerJava</module>
     <module>plugins</module>
+    <module>vmware-base</module>
     <module>awsapi</module>
     <module>patches</module>
     <module>test</module>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/20fab871/scripts/vm/hypervisor/xenserver/vhd-util
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/vhd-util b/scripts/vm/hypervisor/xenserver/vhd-util
new file mode 100755
index 0000000..46d62dd
Binary files /dev/null and b/scripts/vm/hypervisor/xenserver/vhd-util differ

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/20fab871/wscript_build
----------------------------------------------------------------------
diff --git a/wscript_build b/wscript_build
index 1c12c61..2ee3b36 100644
--- a/wscript_build
+++ b/wscript_build
@@ -135,7 +135,7 @@ def build_jars ():
 			"cloud-commons-httpclient-3.1.jar", "cloud-commons-pool-1.4.jar",
 			"cloud-servlet-api.jar", "cloud-commons-logging-1.1.1.jar",
 			"cloud-ws-commons-util-1.0.2.jar",
-			"cloud-commons-collections-3.2.1.jar", "vmware*.jar", "cloud-secstorage-extras.jar",
+			"cloud-commons-collections-3.2.1.jar", "cloud-secstorage-extras.jar",
 			"cloud-agent-simulator.jar", "cloud-awsapi.jar", "cloud-test.jar", "cloud-wsdl4j.jar", "cloud-console-proxy.jar"]
 
 	for a in jars_str:
@@ -162,8 +162,8 @@ def build_dependences ():
 
 	start_path = bld.path.find_dir ("deps")
 
-        bld.install_files('${JAVADIR}',start_path.ant_glob(["CAStorSDK-*.jar", "javax.persistence-2.0.0.jar", "apache-log4j-extras-1.1.jar", "libvirt-0.4.9.jar", "axis2-1.5.1.jar", "jstl-1.2.jar", "commons-discovery-0.5.jar", "commons-codec-1.6.jar", "ejb-api-3.0.jar", "xmlrpc-client-3.1.3.jar", "commons-dbcp-1.4.jar", "commons-pool-1.6.jar", "gson-1.7.1.jar", 
-         "netscaler-1.0.jar", "netscaler-sdx-1.0.jar", "backport-util-concurrent-3.1.jar", "ehcache-1.5.0.jar", "httpcore-4.0.jar", "log4j-1.2.16.jar", "trilead-ssh2-build213-svnkit-1.3-patch.jar", "cglib-nodep-2.2.2.jar", "xmlrpc-common-3.*.jar",
+        bld.install_files('${JAVADIR}',start_path.ant_glob(["axis-1.4.jar", "axis-jaxrpc-1.4.jar", "axis2-kernel*.jar", "commons-lang-*.jar", "mysql-connector-java-5.1.21.jar", "junit-4.10.jar", "jetty-6.1.26.jar", "jetty-util-6.1.26.jar", "vmware*.jar", "CAStorSDK-*.jar", "javax.persistence-2.0.0.jar", "apache-log4j-extras-1.1.jar", "libvirt-0.4.9.jar", "axis2-1.5.1.jar", "jstl-1.2.jar", "commons-discovery-0.5.jar", "commons-codec-1.6.jar", "ejb-api-3.0.jar", "xmlrpc-client-3.1.3.jar", "commons-dbcp-1.4.jar", "commons-pool-1.6.jar", "gson-1.7.1.jar",
+         "cloud-netscaler.jar", "cloud-netscaler-sdx.jar", "backport-util-concurrent-3.1.jar", "ehcache-1.5.0.jar", "httpcore-4.0.jar", "log4j-1.2.16.jar", "trilead-ssh2-build213-svnkit-1.3-patch.jar", "cglib-nodep-2.2.2.jar", "xmlrpc-common-3.*.jar",
          "axiom*.jar", "axis2*.jar", "antlr*.jar", "XmlSchema*.jar", "json-simple*.jar", "neethi*.jar", "woden*.jar", "xercesImpl*.jar", "xml-apis*.jar", "dom4j*.jar", "javassist*.jar", "commons-fileupload*.jar",
          "xmlrpc-client-3.*.jar", "wsdl4j-1.6.2.jar", "bcprov-jdk16-1.45.jar", "jsch-0.1.42.jar", "jasypt-1.9.0.jar", "commons-configuration-1.8.jar", "mail-1.4.jar", "activation-1.1.jar",  "xapi-5.6.100-1-SNAPSHOT.jar"], excl = excludes), cwd=start_path)
 


Mime
View raw message