cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [7/8] CLOUDSTACK-6967: Now with module!
Date Mon, 23 Jun 2014 10:39:57 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/189972bc/plugins/hypervisors/ovm3
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ovm3 b/plugins/hypervisors/ovm3
deleted file mode 160000
index bd64f2d..0000000
--- a/plugins/hypervisors/ovm3
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit bd64f2dbf461847a3f7056693bf34e80e4f7af73
diff --git a/plugins/hypervisors/ovm3/pom.xml b/plugins/hypervisors/ovm3/pom.xml
new file mode 100644
index 0000000..22c9fe0
--- /dev/null
+++ b/plugins/hypervisors/ovm3/pom.xml
@@ -0,0 +1,36 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>cloud-plugin-hypervisor-ovm3</artifactId>
+  <name>Apache CloudStack Plugin - Hypervisor OracleVM3</name>
+  <parent>
+    <groupId>org.apache.cloudstack</groupId>
+    <artifactId>cloudstack-plugins</artifactId>
+    <version>4.4.0-SNAPSHOT</version>
+    <relativePath>../../pom.xml</relativePath>
+  </parent>
+   <dependencies>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>xapi</artifactId>
+      <version>${cs.xapi.version}</version>
+    </dependency>    
+  </dependencies>
+</project>
diff --git a/plugins/hypervisors/ovm3/resources/META-INF/cloudstack/ovm3-compute/module.properties b/plugins/hypervisors/ovm3/resources/META-INF/cloudstack/ovm3-compute/module.properties
new file mode 100644
index 0000000..69e6469
--- /dev/null
+++ b/plugins/hypervisors/ovm3/resources/META-INF/cloudstack/ovm3-compute/module.properties
@@ -0,0 +1,18 @@
+# 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.
+name=ovm3-compute
+parent=compute
diff --git a/plugins/hypervisors/ovm3/resources/META-INF/cloudstack/ovm3-compute/spring-ovm3-compute-context.xml b/plugins/hypervisors/ovm3/resources/META-INF/cloudstack/ovm3-compute/spring-ovm3-compute-context.xml
new file mode 100644
index 0000000..42230c9
--- /dev/null
+++ b/plugins/hypervisors/ovm3/resources/META-INF/cloudstack/ovm3-compute/spring-ovm3-compute-context.xml
@@ -0,0 +1,39 @@
+<!--
+  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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:aop="http://www.springframework.org/schema/aop"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      http://www.springframework.org/schema/context/spring-context-3.0.xsd"
+                      >
+
+    <bean id="Ovm3Fencer" class="com.cloud.hypervisor.ovm3.hypervisor.Ovm3Fencer">
+        <property name="name" value="Ovm3FenceBuilder" />
+    </bean>
+
+    <bean id="Ovm3Guru" class="com.cloud.hypervisor.ovm3.hypervisor.Ovm3Guru">
+        <property name="name" value="Ovm3Guru" />
+    </bean>
+
+    
+</beans>
diff --git a/plugins/hypervisors/ovm3/resources/META-INF/cloudstack/ovm3-discoverer/module.properties b/plugins/hypervisors/ovm3/resources/META-INF/cloudstack/ovm3-discoverer/module.properties
new file mode 100644
index 0000000..025d4cf
--- /dev/null
+++ b/plugins/hypervisors/ovm3/resources/META-INF/cloudstack/ovm3-discoverer/module.properties
@@ -0,0 +1,18 @@
+# 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.
+name=ovm3-discoverer
+parent=discoverer
diff --git a/plugins/hypervisors/ovm3/resources/META-INF/cloudstack/ovm3-discoverer/spring-ovm3-discoverer-context.xml b/plugins/hypervisors/ovm3/resources/META-INF/cloudstack/ovm3-discoverer/spring-ovm3-discoverer-context.xml
new file mode 100644
index 0000000..aa76271
--- /dev/null
+++ b/plugins/hypervisors/ovm3/resources/META-INF/cloudstack/ovm3-discoverer/spring-ovm3-discoverer-context.xml
@@ -0,0 +1,34 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:aop="http://www.springframework.org/schema/aop"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      http://www.springframework.org/schema/context/spring-context-3.0.xsd"
+                      >
+
+    <bean id="Ovm3Discoverer" class="com.cloud.hypervisor.ovm3.hypervisor.Ovm3Discoverer">
+        <property name="name" value="Ovm3Discover" />
+    </bean>
+    
+</beans>
diff --git a/plugins/hypervisors/ovm3/scripts/clean_master.sh b/plugins/hypervisors/ovm3/scripts/clean_master.sh
new file mode 100755
index 0000000..bbf1cd0
--- /dev/null
+++ b/plugins/hypervisors/ovm3/scripts/clean_master.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+for i in `xm list | awk '{ print $1 }' | egrep -v "Name|Domain-0"`
+do
+    xm destroy $i
+done
+rm /etc/ovs-agent/db/server
+rm /etc/ovs-agent/db/repository
+rm /etc/ocfs2/cluster.conf
+rm /nfsmnt/*/*.img
+rm /nfsmnt/*/.ovspoolfs
+rm /nfsmnt/*/.generic_fs_stamp
+rm /OVS/Repositories/*/.generic_fs_stamp
+rm /OVS/Repositories/*/.ovsrepo
+/etc/init.d/ovs-agent restart
+/etc/init.d/ocfs2 restart
+for i in `mount | grep cs-mgmt | awk '{ print $1 }'`
+do
+    umount $i
+done
+rm -rf /OVS/Repositories/*
+rm -rf /nfsmnt/*
+ip addr del 192.168.1.230 dev c0a80100
+ip addr del 192.168.1.161 dev c0a80100
+rm /etc/sysconfig/network-scripts/ifcfg-control0
+reboot
diff --git a/plugins/hypervisors/ovm3/scripts/clean_slave.sh b/plugins/hypervisors/ovm3/scripts/clean_slave.sh
new file mode 100755
index 0000000..6d46859
--- /dev/null
+++ b/plugins/hypervisors/ovm3/scripts/clean_slave.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+for i in `xm list | awk '{ print $1 }' | egrep -v "Name|Domain-0"`
+do
+    xm destroy $i
+done
+rm /etc/ovs-agent/db/server
+rm /etc/ovs-agent/db/repository
+rm /etc/ocfs2/cluster.conf
+/etc/init.d/ovs-agent restart
+/etc/init.d/ocfs2 restart
+for i in `mount | grep cs-mgmt | awk '{ print $1 }'`
+do
+    umount $i
+done
+
diff --git a/plugins/hypervisors/ovm3/scripts/create_pool_cluster.py b/plugins/hypervisors/ovm3/scripts/create_pool_cluster.py
new file mode 100755
index 0000000..15c9a97
--- /dev/null
+++ b/plugins/hypervisors/ovm3/scripts/create_pool_cluster.py
@@ -0,0 +1,271 @@
+#!/usr/bin/python
+#
+# 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.
+#
+import os, sys, subprocess
+from xml.dom.minidom import parseString
+
+from xmlrpclib import ServerProxy, Error
+
+server = ServerProxy("http://localhost:8899")
+
+pooledFs = 1
+normalRepo = 0
+
+try:
+  if normalRepo:
+    print "normal repo"
+    # this litterally throws EVERYTHING away on the repo
+    repoDom = parseString(server.discover_repository_db())
+    for node in repoDom.getElementsByTagName('Repository'):
+        repoUuid = node.attributes['Uuid']
+        remoteMount = node.getElementsByTagName('Fs_location')[0].firstChild.nodeValue
+        localMount = node.getElementsByTagName('Mount_point')[0].firstChild.nodeValue
+
+        # there is a "strong" relation between repo's and VMs
+        # onfortunately there is no reference in the vm.cfg
+        # or any known info in the configuration of the VM
+        # in which repo it lives....
+        for dirname, dirnames, filenames in os.walk('%s/VirtualMachines/' % localMount):
+            for vm in dirnames:
+                print "Destroying vm: %s on repo %s" % (vm, repoUuid.value)
+                try:
+                    mVm = server.list_vm(repoUuid.value, vm)
+                    if mVm != None:
+                        print server.stop_vm(repoUuid.value, vm)
+                        print server.delete_vm(repoUuid.value, vm)
+                    else:
+                        print "%s already not in repo %s" % (repoUuid.value, vm)
+                except Error, v:
+                    print "Unable to destroy: %s" % (v)
+                    continue
+
+        # VMs = server.list_vms() 
+        # for vm in VMs:
+        #    if vm['domid'] != '0':
+        #        print vm
+        #        print server.delete_vm(repoUuid.value, vm['uuid'])
+
+        rc = server.delete_repository(repoUuid.value, True)
+        # Set to false if you want to keep data:      ^^^^
+        print "Repository: %s" % repoUuid.value
+        if (rc == None):
+            print "Ok repo: %s destroyed!" % repoUuid.value
+            # now unmount the FS
+            # print server.unmount_repository_fs(localMount)
+        else:
+            print "Failed repo: %s not destroyed!" % repoUuid.value
+
+    # for now only treat NFS stuff as we're testing with that..
+    nfsHost='cs-mgmt'
+    nfsDom = server.storage_plugin_listMountPoints(
+        'oracle.generic.NFSPlugin.GenericNFSPlugin', 
+            { 'status': '', 
+                'admin_user': '', 
+                'admin_host': '', 
+                'uuid': '', 
+                'total_sz': 0, 
+                'admin_passwd': '',
+                'free_sz': 0, 
+                'name': '', 
+                'access_host': nfsHost, 
+                'storage_type': 'FileSys', 
+                'alloc_sz': 0, 
+                'access_grps': [], 
+                'used_sz': 0, 
+                'storage_desc': ''
+            })
+    for node in nfsDom:
+        props = {'status': node['status'], 
+            'uuid': '', 
+            'access_host': nfsHost, 
+            'storage_type': 'FileSys', 
+            'name': '' }
+        extprops = {'status': node['status'], 
+            'uuid': node['fs_uuid'], 
+            'ss_uuid': '', 
+            'size': 0, 
+            'free_sz': '', 
+            'state': 1, 
+            'access_grp_names': [], 
+            'access_path': nfsHost + ':' + '/volumes/cs-data/secondary', 
+            'name': ''}
+        # rc = server.storage_plugin_unmount('oracle.generic.NFSPlugin.GenericNFSPlugin', props, extprops, nfsMnt, True)
+        # print rc
+
+    nfsDom = parseString(server.discover_mounted_file_systems('nfs'))
+    for node in nfsDom.getElementsByTagName('Mount'):
+        nfsMnt = node.attributes['Dir'].value
+        print 'Mountpoint: %s' % (nfsMnt)
+        fsStamp = '%s/.generic_fs_stamp' % nfsMnt
+        # remove this so we don't cock up next run
+        if os.path.isfile(fsStamp):
+            print "Stamp found: %s" % fsStamp
+            os.unlink(fsStamp)
+
+        rc = server.storage_plugin_unmount('oracle.generic.NFSPlugin.GenericNFSPlugin', props, extprops, nfsMnt, True)
+        print rc
+
+
+  if pooledFs:
+    print "pooling"
+    # pool stuff 
+    poolalias="ItsMyPool"
+    poolmvip="192.168.1.161"
+    poolfirsthost = {
+        'ip': "192.168.1.64",
+        'hn': "ovm-1",
+        'id': 0,
+        'role': 'utility,xen'
+    }
+    fstype="nfs"
+    fstarget="cs-mgmt:/volumes/cs-data/primary"
+    poolid="0004fb0000020000ba9aaf00ae5e2d73"
+    clusterid="ba9aaf00ae5e2d72"
+    poolfsuuid="0004fb0000050000e70fbddeb802208f"
+    poolfsnfsbaseuuid="b8ca41cb-3469-4f74-a086-dddffe37dc2d"
+    manageruuid="0004fb00000100000af70d20dcce7d65"
+    pooluuid="0004fb0000020000ba9aaf00ae5e2d73"
+    blocksize=""
+    clustersize=""
+    journalesize=""
+
+    # o2cb is the problem.... /etc/init.d/o2cb
+    #   sets it's config in /etc/sysconfig/o2cb (can be removed)
+    #   dmsetup requires the stopping of o2cb first,
+    #   then the removal of the config, after which dmsetup
+    #   can remove the device from /dev/mapper/
+    # eventually cluster cleanup can be done by removing
+    #   stuff from /etc/ovs-agent/db 
+    #   also clean /etc/ocfs2/cluster.conf
+    print server.create_pool_filesystem(
+        fstype,
+        fstarget,
+        clusterid,
+        poolfsuuid,
+        poolfsnfsbaseuuid,
+        manageruuid,
+        pooluuid
+    )
+
+    # poolDom = server.discover_server_pool()
+    # print poolDom
+    # poolDom = parseString(server.discover_server_pool()) 
+    # if poolDom.getElementsByTagName('Server_Pool'):
+    # get unique id
+    cluster = server.is_cluster_online()
+    if cluster == True:
+        print "clean up pool"
+        # print server.destroy_cluster(poolfsuuid)
+        # deconfigure cluster
+        # print server.destroy_server_pool(poolid)
+        
+    if cluster == False:
+        print "create_server_pool"
+        # first take ownership. without an owner nothing happens
+        print server.take_ownership(manageruuid, "")
+        # we need to add the first host first to the pool....
+        poolDom = server.discover_server_pool()
+        print poolDom
+        poolDom = parseString(server.discover_server_pool())
+        if poolDom.getElementsByTagName('Server_Pool'):
+            print server.destroy_server_pool(pooluuid)
+
+        print server.create_pool_filesystem(
+            fstype,
+            fstarget,
+            clusterid,
+            poolfsuuid,
+            poolfsnfsbaseuuid,
+            manageruuid,
+            pooluuid
+        )
+        print server.create_server_pool(poolalias, 
+            pooluuid, 
+            poolmvip, 
+            poolfirsthost['id'], 
+            poolfirsthost['hn'], 
+            poolfirsthost['ip'], 
+            poolfirsthost['role'])
+        
+        print "configure_virtual_ip"
+        server.configure_virtual_ip(poolmvip, poolfirsthost['ip'])
+        server.set_pool_member_ip_list(['192.168.1.64','192.168.1.65'],)
+        print "configure for cluster"
+        server.configure_server_for_cluster(
+            {
+                'O2CB_HEARTBEAT_THRESHOLD': '61', 
+                'O2CB_RECONNECT_DELAY_MS': '2000', 
+                'O2CB_KEEPALIVE_DELAY_MS': '2000', 
+                'O2CB_BOOTCLUSTER': clusterid, 
+                'O2CB_IDLE_TIMEOUT_MS': '60000', 
+                'O2CB_ENABLED': 'true', 
+                'O2CB_STACK': 'o2cb'
+            }, 
+            {
+                'node': [
+                    {
+                        'ip_port': 7777, 
+                        'cluster': clusterid, 
+                        'ip_address': poolfirsthost['ip'], 
+                        'name': poolfirsthost['hn'], 
+                        'number': poolfirsthost['id']
+                    }
+                ], 
+                'heartbeat': [
+                    {
+                        'cluster': clusterid, 
+                        # uppercase poolfsuuid
+                        'region': '0004FB0000050000E70FBDDEB802208F'
+                    }
+                ], 
+                'cluster': [
+                    {
+                        'heartbeat_mode': 'global', 
+                        'node_count': 1, 
+                        'name': clusterid
+                    }
+                ]
+            }, 
+            'nfs', 
+            'cs-mgmt:/volumes/cs-data/primary', 
+            poolfsuuid, 
+            poolfsnfsbaseuuid
+        )
+        print "create cluster"
+        server.create_cluster(poolfsuuid,)
+
+    poolDom = parseString(server.discover_server_pool())
+    for node in poolDom.getElementsByTagName('Server_Pool'):
+        id = node.getElementsByTagName('Unique_Id')[0].firstChild.nodeValue
+        alias = node.getElementsByTagName('Pool_Alias')[0].firstChild.nodeValue
+        mvip = node.getElementsByTagName('Master_Virtual_Ip')[0].firstChild.nodeValue
+        print "pool: %s, %s, %s" % (id, mvip, alias)
+        members = node.getElementsByTagName('Member')
+        for member in members:
+            mip = member.getElementsByTagName('Registered_IP')[0].firstChild.nodeValue
+            print "member: %s" % (mip)
+
+    print server.is_cluster_online()
+    print server.discover_cluster()
+    print server.discover_pool_filesystem()
+    print server.discover_server_pool()
+    # server.destroy_server_pool(pooluuid)
+
+except Error, v:
+    print "ERROR", v
diff --git a/plugins/hypervisors/ovm3/scripts/info.py b/plugins/hypervisors/ovm3/scripts/info.py
new file mode 100755
index 0000000..518aaf1
--- /dev/null
+++ b/plugins/hypervisors/ovm3/scripts/info.py
@@ -0,0 +1,111 @@
+#!/usr/bin/python
+#
+# 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.
+#
+import os, sys, subprocess, socket,fcntl, struct
+from socket import gethostname
+import errno
+from socket import error as socket_error
+from xml.dom.minidom import parseString
+
+from xmlrpclib import ServerProxy, Error
+
+def spCon(proto, auth, host, port):
+    print "trying %s on %s@%s:%s" % (proto, auth, host, port)
+    try:
+        x=ServerProxy("%s://%s@%s:%s" % (proto, auth, host, port))
+        x.echo(proto)
+        return x
+    except Error, v:
+        return
+    except socket_error, serr:
+        return
+
+def getCon(auth, host, port):
+    try:    
+        server = spCon("http", auth, host, port)
+        if server:
+            return server
+        else:
+            server = spCon("https", auth, host, port)
+    except Error, v:
+        print "ERROR", v
+    return server
+
+def get_ip_address(ifname):
+    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+    return socket.inet_ntoa(fcntl.ioctl(
+        s.fileno(),
+        0x8915,  # SIOCGIFADDR
+        struct.pack('256s', ifname[:15])
+    )[20:24])
+
+def is_it_up(host, port):
+    try:
+        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+        s.settimeout(1)
+        s.connect((host, port))
+        s.close()
+    except:
+        print "host: %s:%s DOWN" % (host, port)
+        return False
+
+    print "host: %s:%s UP" % (host, port)
+    return True
+
+# hmm master actions don't apply to a slave
+master="192.168.1.161"
+port=8899
+user = "oracle"
+password = "test123"
+auth = "%s:%s" % (user, password)
+server = getCon(auth, 'localhost', port)
+mserver = getCon(auth, master, port)
+poolNode=True
+interface = "c0a80100"
+role='xen,utility'
+hostname=gethostname()
+ip = get_ip_address(interface)
+poolMembers = []
+xserver = server
+poolCount = 0
+
+try:
+    print server.discover_pool_filesystem()
+    print
+    print server.discover_server_pool()
+    poolDom = parseString(server.discover_server_pool())
+    for node in poolDom.getElementsByTagName('Server_Pool'):
+        id = node.getElementsByTagName('Unique_Id')[0].firstChild.nodeValue
+        alias = node.getElementsByTagName('Pool_Alias')[0].firstChild.nodeValue
+        mvip = node.getElementsByTagName('Master_Virtual_Ip')[0].firstChild.nodeValue
+        print "pool: %s, %s, %s" % (id, mvip, alias)
+        members = node.getElementsByTagName('Member')
+        for member in members:
+            poolCount = poolCount + 1
+            mip = member.getElementsByTagName('Registered_IP')[0].firstChild.nodeValue
+            print "member: %s" % (mip)
+            if mip == ip:
+               pooled = True
+            else:
+               poolMembers.append(mip)
+            
+    # print server.discover_server()
+
+except Error, v:
+    print "ERROR", v
diff --git a/plugins/hypervisors/ovm3/scripts/ovs_agent_plugin/cloudstack.py b/plugins/hypervisors/ovm3/scripts/ovs_agent_plugin/cloudstack.py
new file mode 100644
index 0000000..f655760
--- /dev/null
+++ b/plugins/hypervisors/ovm3/scripts/ovs_agent_plugin/cloudstack.py
@@ -0,0 +1,344 @@
+#!/usr/bin/python
+#
+# 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.
+#
+import logging
+import time
+import re
+import os.path
+import paramiko
+import subprocess
+import socket
+
+from xen.util.xmlrpcclient import ServerProxy
+from xmlrpclib import Error
+from xen.xend import XendClient
+from agent.api.base import Agent
+from agent.lib.settings import get_api_version
+from xen.xend import sxp
+
+class CloudStack(Agent):
+    """
+    Cloudstack plugin for OVM3.2.x.
+    """
+
+    # exposed services
+    def get_services(self, version=None):
+        return {
+            'call': call,
+            'get_vncport': getVncPort,
+            'exec_domr': domrExec,
+            'check_domr_port': domrCheckPort,
+            'check_domr_ssh': domrCheckSsh,
+            'ovs_control_interface': ovsControlInterface,
+            'ovs_mkdir': ovsMkdir,
+            'ovs_check_file': ovsCheckFile,
+            'ovs_upload_ssh_key': ovsUploadSshKey,
+            'ovs_dom0_stats': ovsDom0Stats,
+            'ovs_domU_stats': ovsDomUStats,
+            'get_module_version': getModuleVersion,
+            'ping': ping,
+#            'ovs_agent_set_ssl': ovsAgentSetSsl,
+#            'ovs_agent_set_port': ovsAgentSetPort,
+#            'ovs_restart_agent': ovsRestartAgent,
+        }
+
+    def getName(self):
+        return self.__class__.__name__
+
+# which version are we intended for?
+def getModuleVersion():
+    return "0.1"
+
+# call test
+def call(msg):
+    return msg
+
+# execute something on domr
+def domrExec(ip, cmd, timeout=10, username="root", port=3922, keyfile="~/.ssh/id_rsa.cloud"):
+    ssh = paramiko.SSHClient()
+    ssh.load_system_host_keys()
+    ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
+    privatekeyfile = os.path.expanduser(keyfile)
+    key = paramiko.RSAKey.from_private_key_file(privatekeyfile)
+    ssh.connect(ip, port, username, pkey=key, timeout=timeout)
+    ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command(cmd)
+    exit_status = ssh_stdout.channel.recv_exit_status()
+    ssh.close()
+    return { "rc": exit_status,
+        "out": ''.join(ssh_stdout.readlines()),
+        "err": ''.join(ssh_stderr.readlines()) };
+
+# check a port on domr
+def domrPort(ip, port=3922, timeout=3):
+    return domrCheckPort(ip, port, timeout=timeout)
+
+# check a port on domr
+def domrCheckPort(ip, port=3922, timeout=3):
+    try:
+        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+        s.settimeout(timeout)
+        s.connect((ip, port))
+        s.close()
+        return True
+    except:
+        return False
+
+# check ssh
+def domrCheckSsh(ip, port=3922, timeout=10):
+    x = domrExec(ip, "", port=port, timeout=timeout)
+    if (x.get("rc") == 0):
+        return True
+    return False
+
+def _ovsIni(setting, set):
+    ini="/etc/ovs-agent/agent.ini"
+    replaced=False
+    if os.path.isfile(ini):
+        import fileinput
+        for line in fileinput.FileInput(ini, inplace=1):
+                line=line.rstrip('\n')
+                if re.search("%s=" % setting, line):
+                    line="%s=%s" % (setting, set)
+                    replaced=True
+                print line
+    return replaced
+
+# enable/disable ssl for the agent
+def ovsAgentSetSsl(state):
+    ena="disable"
+    if state and state != "disable" and state.lower() != "false":
+        ena="enable"
+    return _ovsIni("ssl", ena)
+
+def ovsAgentSetPort(port):
+    return _ovsIni("port", port)
+
+def ovsRestartAgent():
+    return restartService("ovs-agent")
+
+# replace with popen
+def restartService(service):
+    command = ['service', service, 'restart'];
+    subprocess.call(command, shell=False)
+    return True
+
+# sets the control interface and removes the route net entry
+def ovsControlInterface(dev, ipmask):
+    command = ['route', 'del', '-net', ipmask];
+    subprocess.call(command, shell=False)
+    command = ['ifconfig', dev, 'arp']
+    subprocess.call(command, shell=False)
+    return True
+
+# create a dir if we need it
+def ovsMkdir(dir, mode=0700):
+    if not os.path.exists(dir):
+        return os.makedirs(dir, mode)
+    return True
+
+# if a file exists, easy
+def ovsCheckFile(file):
+    if os.path.isfile(file):
+        return True
+    return False
+
+# upload keys
+def ovsUploadSshKey(keyfile, content):
+    keydir=os.path.expanduser("~/.ssh")
+    key="%s/%s" % (keydir, keyfile)
+    try:
+        ovsMkdir(os.path.expanduser(keydir))
+    except Error, v:
+        print "was already there %s" % keydir
+
+    try:
+        text_file = open("%s" % key, "w")
+        text_file.write("%s" % content)
+        text_file.close()
+    except Error, v:
+        print "something went wrong %s" % v
+        return False
+    return True
+
+
+# older python,
+def ovsDom0Stats(bridge):
+    stats={}
+    stats['cpu'] = "%s" % (100 - float(os.popen("top -b -n 1 | grep Cpu\(s\): | cut -d% -f4|cut -d, -f2").read()))
+    stats['free'] = "%s" % (1048576 * int(os.popen("xm info | grep free_memory | awk '{ print $3 }'").read()))
+    stats['total'] = "%s" % (1048576 * int(os.popen("xm info | grep total_memory | awk '{ print $3 }'").read()))
+    stats['tx'] = os.popen("netstat -in | grep %s | head -1 | awk '{print $4 }'" % bridge).read()
+    stats['rx'] = os.popen("netstat -in | grep %s | head -1 | awk '{print $8 }'" % bridge).read()
+    return stats
+
+def getVncPort(domain):
+    port = "0"
+    if re.search("\w-(\d+-)?\d+-VM", domain):
+        server=ServerProxy(XendClient.uri)
+        dom=server.xend.domain(domain, 1)
+        devices = [child for child in sxp.children(dom)
+            if len(child) > 0 and child[0] == "device"]
+        vfbs_sxp = map(lambda x: x[1], [device for device in devices 
+            if device[1][0] == "vfb"])[0]
+        loc=[child for child in vfbs_sxp
+            if child[0] == "location"][0][1]
+        listner, port = loc.split(":")
+    else:
+        print "no valid domain: %s" % domain
+    return port
+
+def get_child_by_name(exp, childname, default = None):
+    try:
+        return [child for child in sxp.children(exp)
+                if child[0] == childname][0][1]
+    except:
+        return default
+
+def ovsDomUStats(domain):
+    _rd_bytes=0
+    _wr_bytes=0
+    _rd_ops=0
+    _wr_ops=0
+    _tx_bytes=0
+    _rx_bytes=0
+    stats={}
+    server=ServerProxy(XendClient.uri)
+    dominfo=server.xend.domain(domain, 1)
+    domid=get_child_by_name(dominfo, "domid")
+
+    # vbds
+    devs = server.xend.domain.getDeviceSxprs(domain, 'vbd')
+    devids = [dev[0] for dev in devs]
+    for dev in devids:
+        sys_path="/sys/devices/%s-%s-%s/statistics" % ("vbd", domid, dev)
+        _rd_bytes += long(open("%s/rd_sect" % sys_path).readline().strip())
+        _wr_bytes += long(open("%s/wr_sect" % sys_path).readline().strip())
+        _rd_ops += long(open("%s/rd_req" % sys_path).readline().strip())
+        _wr_ops += long(open("%s/wr_req" % sys_path).readline().strip())
+
+    # vifs
+    devs = server.xend.domain.getDeviceSxprs(domain, 'vif')
+    devids = [dev[0] for dev in devs]
+    for dev in devids:
+        vif="vif%s.%s" % (domid, dev)
+        sys_path="/sys/devices/%s-%s-%s/net/%s/statistics" % ("vif", domid, dev, vif)
+        _tx_bytes += long(open("%s/tx_bytes" % sys_path).readline().strip())
+        _rx_bytes += long(open("%s/rx_bytes" % sys_path).readline().strip())
+
+    epoch=time.time()
+    stats['rd_bytes'] = "%s" % (_rd_bytes * 512)
+    stats['wr_bytes'] = "%s" % (_wr_bytes * 512)
+    stats['rd_ops'] = "%s" % (_rd_ops)
+    stats['wr_ops'] = "%s" % (_wr_ops)
+    stats['tx_bytes'] = "%s" % (_tx_bytes)
+    stats['rx_bytes'] = "%s" % (_rx_bytes)
+    stats['cputime']= "%s" % get_child_by_name(dominfo, "cpu_time")
+    stats['uptime']= "%s" % (epoch - get_child_by_name(dominfo, "start_time"))
+    stats['vcpus']= "%s" % get_child_by_name(dominfo, "online_vcpus")
+    return stats
+
+def ping(host, count=3):
+    if os.system("ping -c %s %s " % (count, host)) == 0:
+        return True
+    return False
+
+# add SystemVM stuff here....
+#
+
+#
+# Self deploy and integration, not de-integration 
+# should return False if fails
+#
+# install us if we are missing in: 
+# /usr/lib64/python2.4/site-packages/agent/api
+# and add our hooks in:
+# /usr/lib64/python2.4/site-packages/agent/target/api.py
+if __name__ == '__main__':
+    from distutils.sysconfig import get_python_lib
+    from agent.target.api import MODULES
+    from shutil import copyfile
+    import inspect, os, hashlib, getopt, sys
+
+    # default vars
+    exist=False
+    agentpath="%s/agent" % (get_python_lib(1))
+    api="%s/target/api.py" % (agentpath)
+    modpath="%s/api" % (agentpath)
+    ssl="disable"
+    port=0
+
+    # get options
+    try:
+        opts, args = getopt.getopt(sys.argv[1:], "sp::", 
+            [ 'port=','ssl='])
+    except getopt.GetoptError:
+        print "Available Options: --port=, --ssl="
+        sys.exit()
+
+    for o, a in opts:
+        if o in ('-s', '--ssl'):
+            ssl = a
+        if o in ('-p', '--port'):
+            port = int(a)
+
+    # check if we're in the modules already
+    cs = CloudStack()
+    for mod in MODULES:
+        if re.search(cs.getName(), "%s" % (mod)):
+            exist=True
+
+    # if we're not:
+    if not exist:
+        if os.path.isfile(api):
+            import fileinput
+            for line in fileinput.FileInput(api, inplace=1):
+                line=line.rstrip('\n')
+                if re.search("import common", line):
+                    line="%s, cloudstack" % (line)
+                if re.search("MODULES", line):
+                    n=cs.getName()
+                    line="%s\n\t%s.%s," % (line, n.lower(), n)
+                print line
+            print "Api inserted, %s in %s" % (cs.getName(), api)
+        else:
+            print "Api missing, %s" % (api)
+    else:
+        print "Api present, %s in %s" % (cs.getName(), api)
+
+    # either way check our version and install if checksum differs
+    modfile="%s/%s.py" % (modpath, cs.getName().lower())
+    me=os.path.abspath(__file__)
+    if os.path.isfile(modfile):
+        if hashlib.md5(open(me).read()).hexdigest() != hashlib.md5(open(modfile).read()).hexdigest():
+            print "Module copy, %s" % (modfile)
+            copyfile(me, modfile)
+        else:
+            print "Module correct, %s" % (modfile)
+    else:
+        print "Module copy, %s" % (modfile)
+        copyfile(me, modfile)
+    
+    # setup ssl and port
+    if ssl:
+        ovsAgentSetSsl(ssl)
+    if port > 1024:
+        ovsAgentSetPort(port)
+
+    # restart either way
+    ovsRestartAgent()
diff --git a/plugins/hypervisors/ovm3/scripts/password.py b/plugins/hypervisors/ovm3/scripts/password.py
new file mode 100755
index 0000000..25404a9
--- /dev/null
+++ b/plugins/hypervisors/ovm3/scripts/password.py
@@ -0,0 +1,57 @@
+#!/usr/bin/python
+#
+# 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.
+#
+import os, sys, subprocess, socket,fcntl, struct
+from socket import gethostname
+from xml.dom.minidom import parseString
+
+from xmlrpclib import ServerProxy, Error
+
+def spCon(proto, host, port):
+    print "trying %s on %s:%s" % (proto, host, port)
+    try:
+        x=ServerProxy("%s://%s:%s" % (proto, host, port))
+        x.echo(proto)
+        return x
+    except Error, v:
+        print "ERROR", v
+        return
+
+def getCon(host, port):
+    try:
+        server = spCon("http", host, port)
+    except Error, v:
+        print "ERROR", v
+        server = spCon("https", host, port)
+
+    return server
+
+# hmm master actions don't apply to a slave
+port=8899
+user = "oracle"
+password = "test123"
+auth = "%s:%s" % (user, password)
+host = "localhost"
+
+print "setting up password"
+try:
+    con = getCon(host, port)
+    print con.update_agent_password(user, password)
+except Error, v:
+    print "ERROR", v
diff --git a/plugins/hypervisors/ovm3/scripts/repo_pool.py b/plugins/hypervisors/ovm3/scripts/repo_pool.py
new file mode 100755
index 0000000..71feca8
--- /dev/null
+++ b/plugins/hypervisors/ovm3/scripts/repo_pool.py
@@ -0,0 +1,186 @@
+#!/usr/bin/python
+#
+# 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.
+#
+import os, sys, subprocess, socket,fcntl, struct
+from socket import gethostname
+from xml.dom.minidom import parseString
+
+from xmlrpclib import ServerProxy, Error
+
+def get_ip_address(ifname):
+    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+    return socket.inet_ntoa(fcntl.ioctl(
+        s.fileno(),
+        0x8915,  # SIOCGIFADDR
+        struct.pack('256s', ifname[:15])
+    )[20:24])
+
+def is_it_up(host, port):
+    try:
+        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+        s.settimeout(1)
+        s.connect((host, port))
+        s.close()
+    except:
+        print "host: %s:%s DOWN" % (host, port)
+        return False
+
+    print "host: %s:%s UP" % (host, port)
+    return True
+
+# hmm master actions don't apply to a slave
+master="192.168.1.161"
+port=8899
+user = "oracle"
+password = "*******"
+auth = "%s:%s" % (user, password)
+server = ServerProxy("http://%s:%s" % ("localhost", port))
+mserver = ServerProxy("http://%s@%s:%s" % (auth, master, port))
+poolNode=True
+interface = "c0a80100"
+role='xen,utility'
+hostname=gethostname()
+ip = get_ip_address(interface)
+poolMembers = []
+xserver = server
+
+print "setting up password"
+server.update_agent_password(user, password)
+
+if (is_it_up(master, port)):
+    print "master seems to be up, slaving"
+    xserver = mserver
+else:
+    print "no master yet, will become master"
+
+# other mechanism must be used to make interfaces equal...
+try:
+    # pooling related same as primary storage!
+    poolalias="Pool 0"
+    poolid="0004fb0000020000ba9aaf00ae5e2d73"
+    poolfsnfsbaseuuid="7718562d-872f-47a7-b454-8f9cac4ffa3a"
+    pooluuid=poolid
+    poolfsuuid=poolid
+    clusterid="ba9aaf00ae5e2d72"
+    mgr="d1a749d4295041fb99854f52ea4dea97"
+    poolmvip=master
+
+    poolfsnfsbaseuuid="6824e646-5908-48c9-ba44-bb1a8a778084"
+    repoid="6824e646590848c9ba44bb1a8a778084"
+    poolid=repoid
+    repo="/OVS/Repositories/%s" % (repoid)
+    repomount="cs-mgmt:/volumes/cs-data/secondary"
+
+    # primary
+    primuuid="7718562d872f47a7b4548f9cac4ffa3a"
+    ssuuid="7718562d-872f-47a7-b454-8f9cac4ffa3a"
+    fshost="cs-mgmt"
+    fstarget="/volumes/cs-data/primary"
+    fstype="nfs"
+    fsname="Primary storage"
+    fsmntpoint="%s:%s" % (fshost, fstarget)
+    fsmnt="/nfsmnt/%s" % (ssuuid)
+    fsplugin="oracle.generic.NFSPlugin.GenericNFSPlugin"
+
+    # set the basics we require to "operate"
+    print server.take_ownership(mgr, '')
+    print server.update_server_roles(role,)
+
+    # if we're pooling pool...
+    if (poolNode == True):
+        poolCount = 0
+        pooled = False
+
+        # check pooling
+        try:
+            poolDom = parseString(xserver.discover_server_pool())
+            print xserver.discover_server_pool()
+            for node in poolDom.getElementsByTagName('Server_Pool'):
+                id = node.getElementsByTagName('Unique_Id')[0].firstChild.nodeValue
+                alias = node.getElementsByTagName('Pool_Alias')[0].firstChild.nodeValue
+                mvip = node.getElementsByTagName('Master_Virtual_Ip')[0].firstChild.nodeValue
+                print "pool: %s, %s, %s" % (id, mvip, alias)
+                members = node.getElementsByTagName('Member')
+                for member in members:
+                    poolCount = poolCount + 1
+                    mip = member.getElementsByTagName('Registered_IP')[0].firstChild.nodeValue
+                    print "member: %s" % (mip)
+                    if mip == ip:
+                        pooled = True
+                    else:
+                        poolMembers.append(mip)
+
+        except Error,v:
+            print "no master will become master, %s" % v
+            
+        if (pooled == False):
+            # setup the repository
+            print "setup repo"
+            print server.mount_repository_fs(repomount, repo)
+            try:    
+                print "adding repo"
+                print server.add_repository(repomount, repo)
+            except Error, v:
+                print "will create the repo, as it's not there", v
+                print server.create_repository(repomount, repo, repoid, "repo") 
+
+            print "not pooled!"
+            if (poolCount == 0):
+                print "no pool yet, create it"
+                # check if a pool exists already if not create 
+                # pool if so add us to the pool
+                print "create pool fs"
+                print server.create_pool_filesystem(
+                    fstype, 
+                    "%s/VirtualMachines/" % repomount,
+                    clusterid,
+                    poolfsuuid,
+                    poolfsnfsbaseuuid,
+                    mgr,
+                    pooluuid
+                )
+                print "create pool"      
+                print server.create_server_pool(poolalias, 
+                    pooluuid, 
+                    poolmvip, 
+                    poolCount, 
+                    hostname, 
+                    ip, 
+                    role
+                )
+            else:
+                print "join the pool"
+                print server.join_server_pool(poolalias,
+                    pooluuid,
+                    poolmvip,
+                    poolCount,
+                    hostname,
+                    ip,
+                    role
+                )
+
+        # add member to ip list ?
+        poolMembers.append(ip)
+        print "mambers for pool: %s" % poolMembers
+        print xserver.set_pool_member_ip_list(poolMembers)
+
+    print server.discover_server_pool()
+
+except Error, v:
+    print "ERROR", v
diff --git a/plugins/hypervisors/ovm3/scripts/simple_pool.py b/plugins/hypervisors/ovm3/scripts/simple_pool.py
new file mode 100755
index 0000000..756de93
--- /dev/null
+++ b/plugins/hypervisors/ovm3/scripts/simple_pool.py
@@ -0,0 +1,209 @@
+#!/usr/bin/python
+#
+# 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.
+#
+import os, sys, subprocess, socket,fcntl, struct
+from socket import gethostname
+from xml.dom.minidom import parseString
+import errno
+from socket import error as socket_error
+
+from xmlrpclib import ServerProxy, Error
+
+def spCon(proto, auth, host, port):
+    print "trying %s on %s@%s:%s" % (proto, auth, host, port)
+    try:
+        x=ServerProxy("%s://%s@%s:%s" % (proto, auth, host, port))
+        x.echo(proto)
+        return x
+    except Error, v:
+        return
+    except socket_error, serr:
+        return
+
+def getCon(auth, host, port):
+    try:    
+        server = spCon("http", auth, host, port)
+        if server:
+            return server
+        else:
+            server = spCon("https", auth, host, port)
+    except Error, v:
+        print "ERROR", v
+    return server
+
+def get_ip_address(ifname):
+    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+    return socket.inet_ntoa(fcntl.ioctl(
+        s.fileno(),
+        0x8915,  # SIOCGIFADDR
+        struct.pack('256s', ifname[:15])
+    )[20:24])
+
+# hmm master actions don't apply to a slave
+master="192.168.1.161"
+port=8899
+passw='test123'
+user='oracle'
+auth="%s:%s" % (user, passw)
+server = getCon(auth, "localhost", port)
+mserver = getCon(auth, master, port)
+try:
+    mserver.echo("test")
+except AttributeError, v:
+    print "no mserver, becoming mserver"
+    mserver=server
+
+poolNode=True
+interface = "c0a80100"
+role='xen,utility'
+hostname=gethostname()
+ip = get_ip_address(interface)
+nodes=[]
+
+try:
+    # pooling related same as primary storage!
+    poolalias="Pool 0"
+    clusterid="ba9aaf00ae5e2d72"
+    mgr="d1a749d4295041fb99854f52ea4dea97"
+    poolmvip=master
+
+    # primary
+    primuuid="7718562d872f47a7b4548f9cac4ffa3a"
+    ssuuid="7718562d-872f-47a7-b454-8f9cac4ffa3a"
+    fshost="cs-mgmt"
+    fstarget="/volumes/cs-data/primary/ovm"
+    fstype="nfs"
+    fsname="Primary storage"
+    fsmntpoint="%s:%s" % (fshost, fstarget)
+    fsmntpoint2="%s:%s" % (fshost, "/volumes/cs-data/secondary")
+    fsmntpoint="%s/VirtualMachines" % (fsmntpoint2)
+    fsmnt="/nfsmnt/%s" % (ssuuid)
+    fsplugin="oracle.generic.NFSPlugin.GenericNFSPlugin"
+    repo="/OVS/Repositories/%s" % (primuuid)
+
+    # set the basics we require to "operate"
+    print server.take_ownership(mgr, '')
+    print server.update_server_roles(role,)
+
+    # setup the repository
+    print server.mount_repository_fs(fsmntpoint2, repo)
+    try:
+        print server.add_repository(fsmntpoint2, repo)
+    except Error, v:
+        print "will create the repo, as it's not there", v
+        print server.create_repository(fsmntpoint2, repo, primuuid, "A repository")
+    
+    # if we're pooling pool...
+    if (poolNode == True):
+        poolCount = 0
+        pooled = False
+
+        # check pooling
+       	poolDom = parseString(mserver.discover_server_pool())
+        for node in poolDom.getElementsByTagName('Server_Pool'):
+            id = node.getElementsByTagName('Unique_Id')[0].firstChild.nodeValue
+            alias = node.getElementsByTagName('Pool_Alias')[0].firstChild.nodeValue
+            mvip = node.getElementsByTagName('Master_Virtual_Ip')[0].firstChild.nodeValue
+            print "pool: %s, %s, %s" % (id, mvip, alias)
+            members = node.getElementsByTagName('Member')
+            for member in members:
+                poolCount = poolCount + 1
+                mip = member.getElementsByTagName('Registered_IP')[0].firstChild.nodeValue
+                if (mip == ip):
+                    pooled = True
+                else:
+                    nodes.append(mip)
+                print "member: %s" % (mip)
+
+        # if (pooled == False):
+        try:
+            if (poolCount == 0):
+                print "master"
+                # check if a pool exists already if not create 
+                # pool if so add us to the pool
+                print server.configure_virtual_ip(master, ip)
+                print server.create_pool_filesystem(
+                    fstype, 
+                    fsmntpoint,
+                    clusterid,
+                    primuuid,
+                    ssuuid,
+                    mgr,
+                    primuuid
+                )       
+                print server.create_server_pool(poolalias, 
+                    primuuid, 
+                    poolmvip, 
+                    poolCount, 
+                    hostname, 
+                    ip, 
+                    role
+                )
+            else:
+                try:
+                    print "slave"
+                    print server.join_server_pool(poolalias,
+                        primuuid,
+                        poolmvip,
+                        poolCount,
+                        hostname,
+                        ip,
+                        role
+                    )
+                except Error, v:
+                    print "host already part of pool?: %s" % (v)
+                    
+            nodes.append(ip)
+            for node in nodes:
+                # con = getCon(auth, node, port)
+                # print con.set_pool_member_ip_list(nodes);
+                print mserver.dispatch("http://%s@%s:%s/api/3" % (auth, node, port), "set_pool_member_ip_list", nodes)
+            # print server.configure_virtual_ip(master, ip)
+        except Error, e:
+            print "something went wrong: %s" % (e)
+
+    # sys.exit()
+    # mount the primary fs
+    print server.storage_plugin_mount(
+        fsplugin, 
+        {
+            'uuid': primuuid, 
+            'storage_desc': fsname, 
+            'access_host': fshost, 
+            'storage_type': 'FileSys', 
+            'name':primuuid 
+       }, 
+        {
+            'status': '', 
+            'uuid': ssuuid,
+            'ss_uuid': primuuid, 
+            'size': 0, 
+            'state': 1, 
+            'access_grp_names': [], 
+            'access_path': fsmntpoint,
+            'name': fsname
+        },
+        fsmnt,
+        '', 
+        True, 
+        []
+    )
+
+except Error, v:
+    print "ERROR", v
diff --git a/plugins/hypervisors/ovm3/scripts/socat.sh b/plugins/hypervisors/ovm3/scripts/socat.sh
new file mode 100755
index 0000000..c3fbc44
--- /dev/null
+++ b/plugins/hypervisors/ovm3/scripts/socat.sh
@@ -0,0 +1,2 @@
+CERT="/etc/ovs-agent/cert"
+socat OPENSSL-LISTEN:8899,reuseaddr,fork,verify=0,key=$CERT/key.pem,cert=$CERT/certificate.pem TCP:localhost:8898 &
diff --git a/plugins/hypervisors/ovm3/scripts/tail.sh b/plugins/hypervisors/ovm3/scripts/tail.sh
new file mode 100755
index 0000000..fe88bc0
--- /dev/null
+++ b/plugins/hypervisors/ovm3/scripts/tail.sh
@@ -0,0 +1,2 @@
+cd /var/log 
+tail -f ovm-consoled.log devmon.log messages ovs-agent.log ovmwatch.log
diff --git a/plugins/hypervisors/ovm3/src/com/cloud/ha/Ovm3Investigator.java b/plugins/hypervisors/ovm3/src/com/cloud/ha/Ovm3Investigator.java
new file mode 100644
index 0000000..980fa1f
--- /dev/null
+++ b/plugins/hypervisors/ovm3/src/com/cloud/ha/Ovm3Investigator.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 com.cloud.ha;
+
+import java.util.List;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.agent.AgentManager;
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.CheckOnHostCommand;
+import com.cloud.host.Host;
+import com.cloud.host.HostVO;
+import com.cloud.host.Status;
+import com.cloud.host.dao.HostDao;
+import com.cloud.hypervisor.Hypervisor;
+import com.cloud.resource.ResourceManager;
+import com.cloud.utils.component.AdapterBase;
+
+@Local(value = Investigator.class)
+public class Ovm3Investigator extends AdapterBase implements Investigator {
+    private final static Logger s_logger = Logger.getLogger(Ovm3Investigator.class);
+    @Inject
+    HostDao _hostDao;
+    @Inject
+    AgentManager _agentMgr;
+    @Inject
+    ResourceManager _resourceMgr;
+
+    @Override
+    public Boolean isVmAlive(com.cloud.vm.VirtualMachine vm, Host host) {
+        Status status = isAgentAlive(host);
+        if (status == null) {
+            return null;
+        }
+        return status == Status.Up ? true : null;
+    }
+
+    @Override
+    public Status isAgentAlive(Host agent) {
+        if (agent.getHypervisorType() != Hypervisor.HypervisorType.Ovm3) {
+            return null;
+        }
+        CheckOnHostCommand cmd = new CheckOnHostCommand(agent);
+        List<HostVO> neighbors = _resourceMgr.listHostsInClusterByStatus(agent.getClusterId(), Status.Up);
+        for (HostVO neighbor : neighbors) {
+            if (neighbor.getId() == agent.getId() || neighbor.getHypervisorType() != Hypervisor.HypervisorType.Ovm3) {
+                continue;
+            }
+            try {
+                Answer answer = _agentMgr.easySend(neighbor.getId(), cmd);
+                if (answer != null) {
+                    return answer.getResult() ? Status.Down : Status.Up;
+                }
+            } catch (Exception e) {
+                s_logger.debug("Failed to send command to host: " + neighbor.getId());
+            }
+        }
+
+        return null;
+    }
+}
diff --git a/plugins/hypervisors/ovm3/src/com/cloud/hypervisor/ovm3/hypervisor/Ovm3Discoverer.java b/plugins/hypervisors/ovm3/src/com/cloud/hypervisor/ovm3/hypervisor/Ovm3Discoverer.java
new file mode 100755
index 0000000..bd1d90d
--- /dev/null
+++ b/plugins/hypervisors/ovm3/src/com/cloud/hypervisor/ovm3/hypervisor/Ovm3Discoverer.java
@@ -0,0 +1,411 @@
+// 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.ovm3.hypervisor;
+
+import java.net.InetAddress;
+import java.net.URI;
+import java.net.UnknownHostException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+
+import org.apache.log4j.Logger;
+import org.apache.xmlrpc.XmlRpcException;
+
+import com.cloud.agent.Listener;
+import com.cloud.agent.AgentManager;
+import com.cloud.agent.api.AgentControlAnswer;
+import com.cloud.agent.api.AgentControlCommand;
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+import com.cloud.host.Status;
+import com.cloud.agent.api.StartupCommand;
+import com.cloud.agent.api.StartupRoutingCommand;
+import com.cloud.configuration.Config;
+import com.cloud.dc.ClusterVO;
+import com.cloud.dc.dao.ClusterDao;
+import com.cloud.dc.ClusterDetailsDao;
+// import com.cloud.exception.DiscoveryException;
+import com.cloud.host.HostInfo;
+import com.cloud.host.HostVO;
+import com.cloud.host.Host;
+import com.cloud.host.dao.HostDao;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.hypervisor.ovm3.object.Linux;
+import com.cloud.hypervisor.ovm3.object.Connection;
+import com.cloud.resource.Discoverer;
+import com.cloud.resource.DiscovererBase;
+import com.cloud.resource.ResourceManager;
+import com.cloud.resource.ResourceStateAdapter;
+import com.cloud.resource.ServerResource;
+import com.cloud.resource.UnableDeleteHostException;
+import com.cloud.utils.db.QueryBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.utils.ssh.SSHCmdHelper;
+
+@Local(value = Discoverer.class)
+public class Ovm3Discoverer extends DiscovererBase implements Discoverer,
+        Listener, ResourceStateAdapter {
+    private static final Logger s_logger = Logger
+            .getLogger(Ovm3Discoverer.class);
+    protected String _publicNetworkDevice;
+    protected String _privateNetworkDevice;
+    protected String _guestNetworkDevice;
+    protected String _storageNetworkDevice;
+    private String _ovsAgentPath = "/etc/ovs-agent/agent.ini";
+
+    @Inject
+    ClusterDao _clusterDao;
+    @Inject
+    ClusterDetailsDao _clusterDetailsDao;
+    @Inject
+    ResourceManager _resourceMgr;
+    @Inject
+    AgentManager _agentMgr;
+    @Inject
+    HostDao _hostDao = null;
+
+    @Override
+    public boolean configure(String name, Map<String, Object> params)
+            throws ConfigurationException {
+        super.configure(name, params);
+        /* these are in Config.java */
+        _publicNetworkDevice = _params.get(Config.Ovm3PublicNetwork.key());
+        _privateNetworkDevice = _params.get(Config.Ovm3PrivateNetwork.key());
+        _guestNetworkDevice = _params.get(Config.Ovm3GuestNetwork.key());
+        _storageNetworkDevice = _params.get(Config.Ovm3StorageNetwork.key());
+        _resourceMgr.registerResourceStateAdapter(this.getClass()
+                .getSimpleName(), this);
+        return true;
+    }
+
+    protected Ovm3Discoverer() {
+    }
+
+    @Override
+    public boolean stop() {
+        _resourceMgr.unregisterResourceStateAdapter(this.getClass()
+                .getSimpleName());
+        return super.stop();
+    }
+
+    private boolean checkIfExisted(String guid) {
+        QueryBuilder<HostVO> sc = QueryBuilder.create(HostVO.class);
+        sc.and(sc.entity().getGuid(), SearchCriteria.Op.EQ, guid);
+        sc.and(sc.entity().getHypervisorType(), SearchCriteria.Op.EQ,
+                HypervisorType.Ovm3);
+        List<HostVO> hosts = sc.list();
+        return !hosts.isEmpty();
+    }
+
+    @Override
+    public Map<? extends ServerResource, Map<String, String>> find(long dcId,
+            Long podId, Long clusterId, URI url, String username,
+            String password, List<String> hostTags)
+            throws CloudRuntimeException {
+        Connection c = null;
+
+        if (url.getScheme().equals("http") || url.getScheme().equals("https")) {
+            String msg = "Discovering " + url
+                + ": " + _params;
+            s_logger.debug(msg);
+        } else {
+            String msg = "urlString is not http(s) so we're not taking care of the discovery for this: "
+                    + url;
+            s_logger.debug(msg);
+            throw new CloudRuntimeException(msg);
+        }
+
+        if (clusterId == null) {
+            String msg = "must specify cluster Id when add host";
+            s_logger.debug(msg);
+            throw new CloudRuntimeException(msg);
+        }
+
+        if (podId == null) {
+            String msg = "must specify pod Id when add host";
+            s_logger.debug(msg);
+            throw new CloudRuntimeException(msg);
+        }
+
+        ClusterVO cluster = _clusterDao.findById(clusterId);
+        if (cluster == null
+                || (cluster.getHypervisorType() != HypervisorType.Ovm3)) {
+            String msg = "invalid cluster id or cluster is not for Ovm3 hypervisors";
+            s_logger.info(msg);
+            throw new CloudRuntimeException(msg);
+        } else {
+            s_logger.info("cluster: " + cluster);
+        }
+
+        String agentUsername = _params.get("agentusername");
+        if (agentUsername == null) {
+            String msg = "Agent user name must be specified";
+            s_logger.info(msg);
+            throw new CloudRuntimeException(msg);
+        }
+
+        String agentPassword = _params.get("agentpassword");
+        if (agentPassword == null) {
+            String msg = "Agent password must be specified";
+            s_logger.info(msg);
+            throw new CloudRuntimeException(msg);
+        }
+
+        String agentPort = _params.get("agentport");
+        if (agentPort == null) {
+            String msg = "Agent port must be specified";
+            s_logger.info(msg);
+            throw new CloudRuntimeException(msg);
+        }
+
+        try {
+            String hostname = url.getHost();
+            /* port = url.getPort(); */
+
+            InetAddress ia = InetAddress.getByName(hostname);
+            String hostIp = ia.getHostAddress();
+            String guid = UUID.nameUUIDFromBytes(hostIp.getBytes()).toString();
+
+            if (checkIfExisted(guid)) {
+                String msg = "The host " + hostIp + " has been added before";
+                s_logger.debug(msg);
+                throw new CloudRuntimeException(msg);
+            }
+
+            s_logger.debug("Ovm3 discover is going to disover host having guid "
+                    + guid);
+
+            ClusterVO clu = _clusterDao.findById(clusterId);
+            if (clu.getGuid() == null) {
+                clu.setGuid(UUID.randomUUID().toString());
+            }
+            _clusterDao.update(clusterId, clu);
+            Map<String, String> clusterDetails = _clusterDetailsDao
+                    .findDetails(clusterId);
+            String ovm3vip = (clusterDetails.get("ovm3vip") == null) ? ""
+                    : clusterDetails.get("ovm3vip");
+            String ovm3pool = (clusterDetails.get("ovm3pool") == null) ? "false"
+                    : clusterDetails.get("ovm3pool");
+            String ovm3cluster = (clusterDetails.get("ovm3cluster") == null) ? "false"
+                    : clusterDetails.get("ovm3cluster");
+
+            /* should perhaps only make this connect to the agent port ? */
+            com.trilead.ssh2.Connection sshConnection = new com.trilead.ssh2.Connection(
+                    hostIp, 22);
+            sshConnection.connect(null, 60000, 60000);
+            sshConnection = SSHCmdHelper.acquireAuthorizedConnection(hostIp,
+                    username, password);
+            if (sshConnection == null) {
+                String msg = String.format("Cannot connect to Ovm3 host(IP=%1$s, username=%2$s, password=*******), discovery failed",
+                        hostIp, username);
+                s_logger.warn(msg);
+                throw new CloudRuntimeException(msg);
+            }
+
+            Map<String, String> details = new HashMap<String, String>();
+            Ovm3ResourceBase ovmResource = new Ovm3ResourceBase();
+            details.put("ip", hostIp);
+            details.put("host", hostname);
+            details.put("username", username);
+            details.put("password", password);
+            details.put("zone", Long.toString(dcId));
+            details.put("guid", guid);
+            details.put("pod", Long.toString(podId));
+            details.put("cluster", Long.toString(clusterId));
+            details.put("agentusername", agentUsername);
+            details.put("agentpassword", agentPassword);
+            details.put("agentport", agentPort.toString());
+            details.put("ovm3vip", ovm3vip);
+            details.put("ovm3pool", ovm3pool);
+            details.put("ovm3cluster", ovm3cluster);
+
+            if (_publicNetworkDevice != null) {
+                details.put("public.network.device", _publicNetworkDevice);
+            }
+            if (_privateNetworkDevice != null) {
+                details.put("private.network.device", _privateNetworkDevice);
+            }
+            if (_guestNetworkDevice != null) {
+                details.put("guest.network.device", _guestNetworkDevice);
+            }
+            if (_storageNetworkDevice != null) {
+                details.put("storage.network.device", _storageNetworkDevice);
+            }
+            s_logger.warn("network devices: " + _guestNetworkDevice + " "
+                    + _privateNetworkDevice + " " + _publicNetworkDevice + " "
+                    + _storageNetworkDevice);
+
+            Map<String, Object> params = new HashMap<String, Object>();
+            params.putAll(details);
+
+            ovmResource.configure(hostname, params);
+            ovmResource.start();
+
+            try {
+                c = new Connection(hostIp, Integer.parseInt(agentPort), agentUsername, agentPassword);
+            } catch (Exception e) {
+                String msg = String.format("Cannot connect to Ovm3 agent(IP=%1$s, Port=%1$, username=%3$s, password=*******), discovery failed",
+                        hostIp, agentPort, agentUsername);
+                s_logger.warn(msg);
+                throw new CloudRuntimeException(msg);
+            }
+            /* After resource start, we are able to execute our agent api */
+            Linux host = new Linux(c);
+            details.put("agentVersion", host.getAgentVersion());
+            details.put(HostInfo.HOST_OS_KERNEL_VERSION,
+                    host.getHostKernelRelease());
+            details.put(HostInfo.HOST_OS, host.getHostOs());
+            details.put(HostInfo.HOST_OS_VERSION, host.getHostOsVersion());
+            details.put(HostInfo.HYPERVISOR_VERSION,
+                    host.getHypervisorVersion());
+
+            Map<Ovm3ResourceBase, Map<String, String>> resources = new HashMap<Ovm3ResourceBase, Map<String, String>>();
+            resources.put(ovmResource, details);
+            return resources;
+        } catch (XmlRpcException e) {
+            s_logger.debug("XmlRpc exception, Unable to discover Ovm3 host: " + url.getHost(),
+                    e);
+            return null;
+        } catch (UnknownHostException e) {
+            s_logger.debug(
+                    "Host name resolve failed exception, Unable to discover Ovm3 host: "
+                            + url.getHost(), e);
+            return null;
+        } catch (ConfigurationException e) {
+            s_logger.debug(
+                    "Configure resource failed, Unable to discover Ovm3 host: " + url.getHost(),
+                    e);
+            return null;
+        } catch (Exception e) {
+            s_logger.debug("Unable to discover Ovm3 host: " + url.getHost(), e);
+            return null;
+        }
+    }
+
+    @Override
+    public void postDiscovery(List<HostVO> hosts, long msId)
+            throws CloudRuntimeException {
+        // TODO Auto-generated method stub
+        s_logger.debug("postDiscovery" + hosts);
+    }
+
+    @Override
+    public boolean matchHypervisor(String hypervisor) {
+        return HypervisorType.Ovm3.toString().equalsIgnoreCase(hypervisor);
+    }
+
+    @Override
+    public HypervisorType getHypervisorType() {
+        return HypervisorType.Ovm3;
+    }
+
+    @Override
+    public HostVO createHostVOForConnectedAgent(HostVO host,
+            StartupCommand[] cmd) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public boolean processAnswers(long agentId, long seq, Answer[] answers) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean processCommands(long agentId, long seq, Command[] commands) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public AgentControlAnswer processControlCommand(long agentId,
+            AgentControlCommand cmd) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* for reconnecting */
+    @Override
+    public void processConnect(Host host, StartupCommand cmd,
+            boolean forRebalance) {
+    }
+
+    @Override
+    public boolean processDisconnect(long agentId, Status state) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean isRecurring() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public int getTimeout() {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public boolean processTimeout(long agentId, long seq) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public HostVO createHostVOForDirectConnectAgent(HostVO host,
+            StartupCommand[] startup, ServerResource resource,
+            Map<String, String> details, List<String> hostTags) {
+        StartupCommand firstCmd = startup[0];
+        if (!(firstCmd instanceof StartupRoutingCommand)) {
+            return null;
+        }
+
+        StartupRoutingCommand ssCmd = ((StartupRoutingCommand) firstCmd);
+        if (ssCmd.getHypervisorType() != HypervisorType.Ovm3) {
+            return null;
+        }
+
+        // TODO: Double check this
+        return _resourceMgr.fillRoutingHostVO(host, ssCmd, HypervisorType.Ovm3,
+                details, hostTags);
+    }
+
+    // TODO: Make sure that we cleanup when the host is removed
+    @Override
+    public DeleteHostAnswer deleteHost(HostVO host, boolean isForced,
+            boolean isForceDeleteStorage) throws UnableDeleteHostException {
+        if (host.getType() != com.cloud.host.Host.Type.Routing
+                || host.getHypervisorType() != HypervisorType.Ovm3) {
+            return null;
+        }
+
+        _resourceMgr.deleteRoutingHost(host, isForced, isForceDeleteStorage);
+        return new DeleteHostAnswer(true);
+    }
+
+}
diff --git a/plugins/hypervisors/ovm3/src/com/cloud/hypervisor/ovm3/hypervisor/Ovm3Fencer.java b/plugins/hypervisors/ovm3/src/com/cloud/hypervisor/ovm3/hypervisor/Ovm3Fencer.java
new file mode 100755
index 0000000..30db663
--- /dev/null
+++ b/plugins/hypervisors/ovm3/src/com/cloud/hypervisor/ovm3/hypervisor/Ovm3Fencer.java
@@ -0,0 +1,133 @@
+// 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.ovm3.hypervisor;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.agent.AgentManager;
+import com.cloud.agent.api.FenceAnswer;
+import com.cloud.agent.api.FenceCommand;
+import com.cloud.exception.AgentUnavailableException;
+import com.cloud.exception.OperationTimedoutException;
+import com.cloud.ha.FenceBuilder;
+import com.cloud.host.Host;
+import com.cloud.host.HostVO;
+import com.cloud.host.Status;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.resource.ResourceManager;
+import com.cloud.utils.component.AdapterBase;
+import com.cloud.vm.VirtualMachine;
+
+@Local(value = FenceBuilder.class)
+public class Ovm3Fencer extends AdapterBase implements FenceBuilder {
+    Map<String, Object> _params;
+    private static final Logger s_logger = Logger.getLogger(Ovm3Fencer.class);
+    @Inject
+    AgentManager _agentMgr;
+    @Inject
+    ResourceManager _resourceMgr;
+
+
+    @Override
+    public boolean configure(String name, Map<String, Object> params)
+            throws ConfigurationException {
+        _params = params;
+        return true;
+    }
+
+    @Override
+    public boolean start() {
+        // TODO Auto-generated method stub
+        return true;
+    }
+
+    @Override
+    public boolean stop() {
+        // TODO Auto-generated method stub
+        return true;
+    }
+
+    public Ovm3Fencer() {
+        super();
+    }
+
+    @Override
+    public Boolean fenceOff(VirtualMachine vm, Host host) {
+        if (host.getHypervisorType() != HypervisorType.Ovm3) {
+            s_logger.debug("Don't know how to fence non Ovm3 hosts "
+                    + host.getHypervisorType());
+            return null;
+        } else {
+            s_logger.debug("Fencing " + vm + " on host " + host
+                    + " with params: "+ _params );
+        }
+
+        List<HostVO> hosts = _resourceMgr.listAllHostsInCluster(host
+                .getClusterId());
+        FenceCommand fence = new FenceCommand(vm, host);
+
+        for (HostVO h : hosts) {
+            if (h.getHypervisorType() != HypervisorType.Ovm3) {
+                continue;
+            }
+
+            if (h.getStatus() != Status.Up) {
+                continue;
+            }
+
+            if (h.getId() == host.getId()) {
+                continue;
+            }
+
+            FenceAnswer answer;
+            try {
+                answer = (FenceAnswer) _agentMgr.send(h.getId(), fence);
+            } catch (AgentUnavailableException e) {
+                if (s_logger.isDebugEnabled()) {
+                    s_logger.debug("Moving on to the next host because "
+                            + h.toString() + " is unavailable");
+                }
+                continue;
+            } catch (OperationTimedoutException e) {
+                if (s_logger.isDebugEnabled()) {
+                    s_logger.debug("Moving on to the next host because "
+                            + h.toString() + " is unavailable");
+                }
+                continue;
+            }
+
+            if (answer != null && answer.getResult()) {
+                return true;
+            }
+        }
+
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug("Unable to fence off " + vm.toString() + " on "
+                    + host.toString());
+        }
+
+        return false;
+    }
+
+}
diff --git a/plugins/hypervisors/ovm3/src/com/cloud/hypervisor/ovm3/hypervisor/Ovm3Guru.java b/plugins/hypervisors/ovm3/src/com/cloud/hypervisor/ovm3/hypervisor/Ovm3Guru.java
new file mode 100755
index 0000000..08aac30
--- /dev/null
+++ b/plugins/hypervisors/ovm3/src/com/cloud/hypervisor/ovm3/hypervisor/Ovm3Guru.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.
+
+/* shameless rip from original ovm guru */
+package com.cloud.hypervisor.ovm3.hypervisor;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+
+import com.cloud.agent.api.to.VirtualMachineTO;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.hypervisor.HypervisorGuru;
+import com.cloud.hypervisor.HypervisorGuruBase;
+import com.cloud.storage.GuestOSVO;
+import com.cloud.storage.dao.GuestOSDao;
+import com.cloud.vm.VirtualMachineProfile;
+
+@Local(value = HypervisorGuru.class)
+public class Ovm3Guru extends HypervisorGuruBase implements HypervisorGuru {
+    // private static final Logger s_logger = Logger.getLogger(VMwareGuru.class);
+
+    @Inject
+    GuestOSDao _guestOsDao;
+
+    protected Ovm3Guru() {
+        super();
+    }
+
+    @Override
+    public HypervisorType getHypervisorType() {
+        return HypervisorType.Ovm3;
+    }
+
+    @Override
+    public VirtualMachineTO implement(VirtualMachineProfile vm) {
+        VirtualMachineTO to = toVirtualMachineTO(vm);
+        to.setBootloader(vm.getBootLoaderType());
+
+        // Determine the VM's OS description
+        GuestOSVO guestOS = _guestOsDao.findById(vm.getVirtualMachine()
+                .getGuestOSId());
+        to.setOs(guestOS.getDisplayName());
+
+        return to;
+    }
+
+    @Override
+    public boolean trackVmHostChange() {
+        return true;
+    }
+}
diff --git a/plugins/hypervisors/ovm3/src/com/cloud/hypervisor/ovm3/hypervisor/Ovm3Helper.java b/plugins/hypervisors/ovm3/src/com/cloud/hypervisor/ovm3/hypervisor/Ovm3Helper.java
new file mode 100755
index 0000000..8b0b1b5
--- /dev/null
+++ b/plugins/hypervisors/ovm3/src/com/cloud/hypervisor/ovm3/hypervisor/Ovm3Helper.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 com.cloud.hypervisor.ovm3.hypervisor;
+
+import java.util.HashMap;
+
+public class Ovm3Helper {
+    /* /usr/lib64/python2.4/site-packages/agent/lib/assembly */
+    private static final HashMap<String, String> s_ovmMap = new HashMap<String, String>();
+
+    public static final String HVM = "hvm";
+    public static final String PV = "xen_pvm";
+    public static final String DOMSOL = "ldoms_pvm";
+    public static final String DEFAULT = "default";
+
+    static {
+        s_ovmMap.put("Oracle Enterprise Linux 6.0 (32-bit)", PV);
+        s_ovmMap.put("Oracle Enterprise Linux 6.0 (64-bit)", PV);
+        s_ovmMap.put("Oracle Enterprise Linux 5.0 (32-bit)", PV);
+        s_ovmMap.put("Oracle Enterprise Linux 5.0 (64-bit)", PV);
+        s_ovmMap.put("Oracle Enterprise Linux 5.1 (32-bit)", PV);
+        s_ovmMap.put("Oracle Enterprise Linux 5.1 (64-bit)", PV);
+        s_ovmMap.put("Oracle Enterprise Linux 5.2 (32-bit)", PV);
+        s_ovmMap.put("Oracle Enterprise Linux 5.2 (64-bit)", PV);
+        s_ovmMap.put("Oracle Enterprise Linux 5.3 (32-bit)", PV);
+        s_ovmMap.put("Oracle Enterprise Linux 5.3 (64-bit)", PV);
+        s_ovmMap.put("Oracle Enterprise Linux 5.4 (32-bit)", PV);
+        s_ovmMap.put("Oracle Enterprise Linux 5.4 (64-bit)", PV);
+        s_ovmMap.put("Oracle Enterprise Linux 5.5 (32-bit)", PV);
+        s_ovmMap.put("Oracle Enterprise Linux 5.5 (64-bit)", PV);
+        s_ovmMap.put("Other Linux (32-bit)", PV);
+        s_ovmMap.put("Other Linux (64-bit)", PV);
+        s_ovmMap.put("Other PV (32-bit)", PV);
+        s_ovmMap.put("Other PV (64-bit)", PV);
+        s_ovmMap.put("Debian GNU/Linux 7(32-bit)", PV);
+        s_ovmMap.put("Debian GNU/Linux 7(64-bit)", PV);
+        s_ovmMap.put("Linux HVM (32-bit)", HVM);
+        s_ovmMap.put("Linux HVM (64-bit)", HVM);
+        s_ovmMap.put("Dos", HVM);
+        s_ovmMap.put("Windows 7 (32-bit)", HVM);
+        s_ovmMap.put("Windows 7 (64-bit)", HVM);
+        s_ovmMap.put("Windows 8 (64-bit)", HVM);
+        s_ovmMap.put("Windows Server 2003 (32-bit)", HVM);
+        s_ovmMap.put("Windows Server 2003 (64-bit)", HVM);
+        s_ovmMap.put("Windows Server 2008 (32-bit)", HVM);
+        s_ovmMap.put("Windows Server 2008 (64-bit)", HVM);
+        s_ovmMap.put("Windows Server 2008 R2 (64-bit)", HVM);
+        s_ovmMap.put("Windows Server 2012 (64-bit)", HVM);
+        s_ovmMap.put("Windows 2000 SP4 (32-bit)", HVM);
+        s_ovmMap.put("Windows Vista (32-bit)", HVM);
+        s_ovmMap.put("Windows XP SP2 (32-bit)", HVM);
+        s_ovmMap.put("Windows XP SP3 (32-bit)", HVM);
+        s_ovmMap.put("Sun Solaris 10(32-bit)", HVM);
+        s_ovmMap.put("Sun Solaris 10(64-bit)", HVM);
+        s_ovmMap.put("Sun Solaris 9(Experimental)", HVM);
+        s_ovmMap.put("Sun Solaris 8(Experimental)", HVM);
+        s_ovmMap.put("Sun Solaris 11 (32-bit)", HVM);
+        s_ovmMap.put("Sun Solaris 11 (64-bit)", HVM);
+        s_ovmMap.put("Sun Solaris PV (32-bit)", PV);
+        s_ovmMap.put("Sun Solaris PV (64-bit)", PV);
+        s_ovmMap.put("Sun Solaris Sparc (32-bit)", DOMSOL);
+        s_ovmMap.put("Sun Solaris Sparc (64-bit)", DOMSOL);
+    }
+
+    public static String getOvm3GuestType(String stdType) {
+        return s_ovmMap.get(stdType);
+    }
+}
diff --git a/plugins/hypervisors/ovm3/src/com/cloud/hypervisor/ovm3/hypervisor/Ovm3ResourceBase.java b/plugins/hypervisors/ovm3/src/com/cloud/hypervisor/ovm3/hypervisor/Ovm3ResourceBase.java
new file mode 100755
index 0000000..6b563d5
--- /dev/null
+++ b/plugins/hypervisors/ovm3/src/com/cloud/hypervisor/ovm3/hypervisor/Ovm3ResourceBase.java
@@ -0,0 +1,3211 @@
+// 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.ovm3.hypervisor;
+
+import java.io.File;
+import java.io.IOException;
+import java.math.BigInteger;
+import java.net.URI;
+import java.util.ArrayList;
+// import java.net.URISyntaxException;
+/*
+ * import java.util.ArrayList;
+ */
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.net.URL;
+
+import org.apache.commons.lang.BooleanUtils;
+
+import com.google.gson.Gson;
+
+import org.apache.commons.codec.binary.Base64;
+
+import javax.naming.ConfigurationException;
+
+import org.apache.log4j.Logger;
+import org.apache.xmlrpc.XmlRpcException;
+import org.apache.cloudstack.storage.to.TemplateObjectTO;
+import org.apache.cloudstack.storage.to.VolumeObjectTO;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
+
+
+
+
+// import org.apache.cloudstack.storage.to.PrimaryDataStoreTO;
+// import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
+import com.cloud.agent.IAgentControl;
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.AttachIsoCommand;
+import com.cloud.agent.api.AttachVolumeAnswer;
+import com.cloud.agent.api.AttachVolumeCommand;
+import com.cloud.agent.api.CheckNetworkAnswer;
+import com.cloud.agent.api.CheckNetworkCommand;
+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.CreatePrivateTemplateFromVolumeCommand;
+import com.cloud.agent.api.CreateStoragePoolCommand;
+import com.cloud.agent.api.DeleteStoragePoolCommand;
+import com.cloud.agent.api.FenceAnswer;
+import com.cloud.agent.api.FenceCommand;
+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.GetVncPortAnswer;
+import com.cloud.agent.api.GetVncPortCommand;
+import com.cloud.agent.api.GetDomRVersionAnswer;
+import com.cloud.agent.api.GetDomRVersionCmd;
+import com.cloud.agent.api.NetworkRulesSystemVmCommand;
+import com.cloud.a

<TRUNCATED>

Mime
View raw message