incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahu...@apache.org
Subject [1/8] git commit: Introduced plugins directory. Moved ovm into plugins. Introduced build.xml for ovm.
Date Wed, 20 Jun 2012 01:48:00 GMT
Updated Branches:
  refs/heads/master d8a1fec45 -> e2a32ab4f


Introduced plugins directory.
Moved ovm into plugins.
Introduced build.xml for ovm.


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

Branch: refs/heads/master
Commit: e2a32ab4f787f682a8723bbf9a5ebb653aaccee5
Parents: d8a1fec
Author: Alex Huang <alex.huang@citrix.com>
Authored: Tue Jun 19 18:27:09 2012 -0700
Committer: Alex Huang <alex.huang@citrix.com>
Committed: Tue Jun 19 18:27:09 2012 -0700

----------------------------------------------------------------------
 build/build-cloud.xml                              |    9 +-
 build/build-common.xml                             |    2 +-
 ovm/.classpath                                     |   15 -
 ovm/.project                                       |   23 -
 ovm/scripts/vm/hypervisor/ovm/ConfigFileOps.py     |  171 --
 ..._reposExceptionDueToWrongReturnValueCheck.patch |   13 -
 ovm/scripts/vm/hypervisor/ovm/OvmCommonModule.py   |  156 --
 ovm/scripts/vm/hypervisor/ovm/OvmDiskModule.py     |   62 -
 ovm/scripts/vm/hypervisor/ovm/OvmDispatcher.py     |   58 -
 .../OvmDontTouchOCFS2ClusterWhenAgentStart.patch   |   13 -
 ovm/scripts/vm/hypervisor/ovm/OvmFaultConstants.py |   95 -
 .../vm/hypervisor/ovm/OvmHaHeartBeatModule.py      |  102 --
 ovm/scripts/vm/hypervisor/ovm/OvmHostModule.py     |  304 ----
 ovm/scripts/vm/hypervisor/ovm/OvmLoggerModule.py   |   51 -
 ovm/scripts/vm/hypervisor/ovm/OvmNetworkModule.py  |  429 -----
 ovm/scripts/vm/hypervisor/ovm/OvmOCFS2Module.py    |   76 -
 ovm/scripts/vm/hypervisor/ovm/OvmObjectModule.py   |   20 -
 ovm/scripts/vm/hypervisor/ovm/OvmPatch.patch       |   23 -
 .../vm/hypervisor/ovm/OvmSecurityGroupModule.py    |  478 -----
 .../vm/hypervisor/ovm/OvmStoragePoolModule.py      |  428 -----
 ovm/scripts/vm/hypervisor/ovm/OvmVifModule.py      |   62 -
 ovm/scripts/vm/hypervisor/ovm/OvmVmModule.py       |  538 ------
 ovm/scripts/vm/hypervisor/ovm/OvmVolumeModule.py   |  156 --
 ovm/scripts/vm/hypervisor/ovm/configureOvm.sh      |  127 --
 .../com/cloud/ovm/hypervisor/OvmDiscoverer.java    |  287 ---
 ovm/src/com/cloud/ovm/hypervisor/OvmFencer.java    |  122 --
 ovm/src/com/cloud/ovm/hypervisor/OvmGuru.java      |   57 -
 ovm/src/com/cloud/ovm/hypervisor/OvmHelper.java    |   61 -
 .../com/cloud/ovm/hypervisor/OvmResourceBase.java  | 1381 ---------------
 ovm/src/com/cloud/ovm/object/Coder.java            |   81 -
 ovm/src/com/cloud/ovm/object/Connection.java       |  135 --
 ovm/src/com/cloud/ovm/object/OvmBridge.java        |   66 -
 ovm/src/com/cloud/ovm/object/OvmDisk.java          |   27 -
 ovm/src/com/cloud/ovm/object/OvmHost.java          |   89 -
 ovm/src/com/cloud/ovm/object/OvmObject.java        |   16 -
 ovm/src/com/cloud/ovm/object/OvmSecurityGroup.java |   50 -
 ovm/src/com/cloud/ovm/object/OvmStoragePool.java   |  101 --
 ovm/src/com/cloud/ovm/object/OvmVif.java           |   26 -
 ovm/src/com/cloud/ovm/object/OvmVlan.java          |   39 -
 ovm/src/com/cloud/ovm/object/OvmVm.java            |  108 --
 ovm/src/com/cloud/ovm/object/OvmVolume.java        |   49 -
 ovm/src/com/cloud/ovm/object/Test.java             |  179 --
 .../deployment-planner/user-dispersing/.classpath  |   10 +
 .../deployment-planner/user-dispersing/.project    |   17 +
 .../.settings/org.eclipse.jdt.core.prefs           |   12 +
 .../deployment-planner/user-dispersing/build.xml   |  609 +++++++
 .../com/cloud/deploy/UserDispersingPlanner.java    |  215 +++
 plugins/hypervisors/ovm/.classpath                 |   15 +
 plugins/hypervisors/ovm/.project                   |   23 +
 plugins/hypervisors/ovm/build.xml                  |  128 ++
 .../ovm/scripts/vm/hypervisor/ovm/ConfigFileOps.py |  171 ++
 ..._reposExceptionDueToWrongReturnValueCheck.patch |   13 +
 .../scripts/vm/hypervisor/ovm/OvmCommonModule.py   |  156 ++
 .../ovm/scripts/vm/hypervisor/ovm/OvmDiskModule.py |   62 +
 .../ovm/scripts/vm/hypervisor/ovm/OvmDispatcher.py |   58 +
 .../OvmDontTouchOCFS2ClusterWhenAgentStart.patch   |   13 +
 .../scripts/vm/hypervisor/ovm/OvmFaultConstants.py |   95 +
 .../vm/hypervisor/ovm/OvmHaHeartBeatModule.py      |  102 ++
 .../ovm/scripts/vm/hypervisor/ovm/OvmHostModule.py |  304 ++++
 .../scripts/vm/hypervisor/ovm/OvmLoggerModule.py   |   51 +
 .../scripts/vm/hypervisor/ovm/OvmNetworkModule.py  |  429 +++++
 .../scripts/vm/hypervisor/ovm/OvmOCFS2Module.py    |   76 +
 .../scripts/vm/hypervisor/ovm/OvmObjectModule.py   |   20 +
 .../ovm/scripts/vm/hypervisor/ovm/OvmPatch.patch   |   23 +
 .../vm/hypervisor/ovm/OvmSecurityGroupModule.py    |  478 +++++
 .../vm/hypervisor/ovm/OvmStoragePoolModule.py      |  428 +++++
 .../ovm/scripts/vm/hypervisor/ovm/OvmVifModule.py  |   62 +
 .../ovm/scripts/vm/hypervisor/ovm/OvmVmModule.py   |  538 ++++++
 .../scripts/vm/hypervisor/ovm/OvmVolumeModule.py   |  156 ++
 .../ovm/scripts/vm/hypervisor/ovm/configureOvm.sh  |  127 ++
 .../com/cloud/ovm/hypervisor/OvmDiscoverer.java    |  287 +++
 .../src/com/cloud/ovm/hypervisor/OvmFencer.java    |  122 ++
 .../ovm/src/com/cloud/ovm/hypervisor/OvmGuru.java  |   57 +
 .../src/com/cloud/ovm/hypervisor/OvmHelper.java    |   61 +
 .../com/cloud/ovm/hypervisor/OvmResourceBase.java  | 1381 +++++++++++++++
 .../ovm/src/com/cloud/ovm/object/Coder.java        |   81 +
 .../ovm/src/com/cloud/ovm/object/Connection.java   |  135 ++
 .../ovm/src/com/cloud/ovm/object/OvmBridge.java    |   66 +
 .../ovm/src/com/cloud/ovm/object/OvmDisk.java      |   27 +
 .../ovm/src/com/cloud/ovm/object/OvmHost.java      |   89 +
 .../ovm/src/com/cloud/ovm/object/OvmObject.java    |   16 +
 .../src/com/cloud/ovm/object/OvmSecurityGroup.java |   50 +
 .../src/com/cloud/ovm/object/OvmStoragePool.java   |  101 ++
 .../ovm/src/com/cloud/ovm/object/OvmVif.java       |   26 +
 .../ovm/src/com/cloud/ovm/object/OvmVlan.java      |   39 +
 .../ovm/src/com/cloud/ovm/object/OvmVm.java        |  108 ++
 .../ovm/src/com/cloud/ovm/object/OvmVolume.java    |   49 +
 .../ovm/src/com/cloud/ovm/object/Test.java         |  179 ++
 .../com/cloud/deploy/UserDispersingPlanner.java    |  215 ---
 89 files changed, 7267 insertions(+), 6498 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e2a32ab4/build/build-cloud.xml
----------------------------------------------------------------------
diff --git a/build/build-cloud.xml b/build/build-cloud.xml
index b533db9..1ec2afb 100755
--- a/build/build-cloud.xml
+++ b/build/build-cloud.xml
@@ -588,15 +588,8 @@
   </target>
   
   <!-- ===================== Ovm.Jar ===================== -->
-  <property name="ovm.jar" value="cloud-ovm.jar" />
-  <property name="ovm.dir" location="${base.dir}/ovm" />
-  <property name="ovm-scripts.dir" location="${ovm.dir}/scripts" />
-  <path id="ovm.classpath" >
-    <path refid="deps.classpath" />
-    <path refid="dist.classpath" />
-  </path>
   <target name="compile-ovm" depends="-init, compile-server" description="Compile OVM">
-    <compile-java jar.name="${ovm.jar}" top.dir="${ovm.dir}" classpath="ovm.classpath" />
+  	<ant antfile="${base.dir}/plugins/hypervisors/ovm/build.xml" target="build"/>
   </target>
 
   <target name="compile-all" description="Compile all of the jars" depends="compile-utils, compile-api, compile-core, compile-server, compile-ovm"/>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e2a32ab4/build/build-common.xml
----------------------------------------------------------------------
diff --git a/build/build-common.xml b/build/build-common.xml
index 1d1aa87..7240f53 100755
--- a/build/build-common.xml
+++ b/build/build-common.xml
@@ -73,7 +73,7 @@
         <manifest>
           <attribute name="Class-Path" value="" />
           <attribute name="Built-By" value="${built.by}" />
-          <attribute name="Specification-Title" value="VMOps Cloud Stack" />
+          <attribute name="Specification-Title" value="Apache Cloud Stack" />
           <attribute name="Specification-Version" value="${impl.version}" />
           <attribute name="Specification-Vendor" value="${company.name}" />
           <attribute name="Implementation-Title" value="@{jar.name}" />

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e2a32ab4/ovm/.classpath
----------------------------------------------------------------------
diff --git a/ovm/.classpath b/ovm/.classpath
deleted file mode 100644
index 45bd29e..0000000
--- a/ovm/.classpath
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry combineaccessrules="false" kind="src" path="/core"/>
-	<classpathentry combineaccessrules="false" kind="src" path="/utils"/>
-	<classpathentry combineaccessrules="false" kind="src" path="/server"/>
-	<classpathentry combineaccessrules="false" kind="src" path="/api"/>
-	<classpathentry combineaccessrules="false" kind="src" path="/deps"/>
-	<classpathentry combineaccessrules="false" kind="src" path="/vmware-base"/>
-	<classpathentry kind="src" path="/agent-simulator"/>
-	<classpathentry combineaccessrules="false" kind="src" path="/agent"/>
-	<classpathentry exported="true" kind="lib" path="/deps/cloud-xmlrpc-common-3.1.3.jar"/>
-	<classpathentry kind="output" path="bin"/>
-</classpath>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e2a32ab4/ovm/.project
----------------------------------------------------------------------
diff --git a/ovm/.project b/ovm/.project
deleted file mode 100755
index 4b9d345..0000000
--- a/ovm/.project
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>ovm</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.python.pydev.PyDevBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.jdt.core.javabuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.eclipse.jdt.core.javanature</nature>
-		<nature>org.python.pydev.pythonNature</nature>
-	</natures>
-</projectDescription>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e2a32ab4/ovm/scripts/vm/hypervisor/ovm/ConfigFileOps.py
----------------------------------------------------------------------
diff --git a/ovm/scripts/vm/hypervisor/ovm/ConfigFileOps.py b/ovm/scripts/vm/hypervisor/ovm/ConfigFileOps.py
deleted file mode 100644
index c8bffe2..0000000
--- a/ovm/scripts/vm/hypervisor/ovm/ConfigFileOps.py
+++ /dev/null
@@ -1,171 +0,0 @@
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License.  Citrix Systems, Inc.
-# reserves all rights not expressly granted by 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.
-# 
-# Automatically generated by addcopyright.py at 04/03/2012
-import re
-class ConfigFileOps:
-    class entry:
-        def __init__(self, name, value, op, separator):
-            self.name = name
-            self.value = value
-            self.state = "new"
-            self.op = op
-            self.separator = separator
-        def setState(self, state):
-            self.state = state 
-        def getState(self):
-            return self.state
-
-    def __init__(self, fileName, cfg=None):
-        self.fileName = fileName
-        self.entries = []
-        self.backups = []
-        
-        if cfg is not None:
-            cfg.cfoHandlers.append(self)
-
-    def addEntry(self, name, value, separator="="):
-        e = self.entry(name, value, "add", separator)
-        self.entries.append(e)
-    
-    def rmEntry(self, name, value, separator="="):
-        entry = self.entry(name, value, "rm", separator)
-        self.entries.append(entry)
-    
-    def getEntry(self, name, separator="="):
-        try:
-            ctx = file(self.fileName).read(-1)
-            match = re.search("^" + name + ".*", ctx, re.MULTILINE)
-            if match is None:
-                return ""
-            line = match.group(0).split(separator, 1)
-            return line[1]
-        except:
-            return ""
-
-    def save(self):
-        fp = open(self.fileName, "r")
-        newLines = []
-        for line  in fp.readlines():
-            matched = False
-            for entry in self.entries:
-                if entry.op == "add":
-                    if entry.separator == "=":
-                        matchString = "^\ *" + entry.name + ".*"
-                    elif entry.separator == " ":
-                        matchString = "^\ *" + entry.name + "\ *" + entry.value
-                else:
-                    if entry.separator == "=":
-                        matchString = "^\ *" + entry.name + "\ *=\ *" + entry.value
-                    else:
-                        matchString = "^\ *" + entry.name + "\ *" + entry.value
-                
-                match = re.match(matchString, line)
-                if match is not None:
-                    if entry.op == "add" and entry.separator == "=":
-                        newline = entry.name + "=" + entry.value + "\n"
-                        entry.setState("set")
-                        newLines.append(newline)
-                        self.backups.append([line, newline])
-                        matched = True
-                        break
-                    elif entry.op == "rm":
-                        entry.setState("set")
-                        self.backups.append([line, None])
-                        matched = True
-                        break  
-                    
-            if not matched: 
-                newLines.append(line)
-
-        for entry in self.entries:
-            if entry.getState() != "set":
-                if entry.op == "add":
-                    newline = entry.name + entry.separator + entry.value + "\n"
-                    newLines.append(newline)
-                    self.backups.append([None, newline])
-                    entry.setState("set")
-
-        fp.close()
-        
-        file(self.fileName, "w").writelines(newLines)
-
-    def replace_line(self, startswith,stanza,always_add=False):
-        lines = [ s.strip() for s in file(self.fileName).readlines() ]
-        newlines = []
-        replaced = False
-        for line in lines:
-            if re.search(startswith, line):
-                if stanza is not None:
-                    newlines.append(stanza)
-                    self.backups.append([line, stanza])
-                replaced = True
-            else: newlines.append(line)
-        if not replaced and always_add:
-            newlines.append(stanza)
-            self.backups.append([None, stanza])
-        newlines = [ s + '\n' for s in newlines ]
-        file(self.fileName,"w").writelines(newlines)
-
-    def replace_or_add_line(self, startswith,stanza):
-        return self.replace_line(startswith,stanza,always_add=True)
-
-    def add_lines(self, lines, addToBackup=True):
-        fp = file(self.fileName).read(-1) 
-        sh = re.escape(lines)
-        match = re.search(sh, fp, re.MULTILINE) 
-        if match is not None:
-            return
-    
-        fp += lines
-        file(self.fileName, "w").write(fp)
-        self.backups.append([None, lines])
-        
-    def replace_lines(self, src, dst, addToBackup=True):
-        fp = file(self.fileName).read(-1) 
-        sh = re.escape(src)
-        if dst is None:
-            dst = ""
-        repl,nums = re.subn(sh, dst, fp)
-        if nums <=0:
-            return
-        file(self.fileName, "w").write(repl)
-        if addToBackup:
-            self.backups.append([src, dst])
-
-    def append_lines(self, match_lines, append_lines):
-        fp = file(self.fileName).read(-1)
-        sh = re.escape(match_lines)
-        match = re.search(sh, fp, re.MULTILINE)
-        if match is None:
-            return
-
-        sh = re.escape(append_lines)
-        if re.search(sh, fp, re.MULTILINE) is not None:
-            return
-
-        newlines = []
-        for line in file(self.fileName).readlines():
-            if re.search(match_lines, line) is not None:
-                newlines.append(line + append_lines)
-                self.backups.append([line, line + append_lines])
-            else:
-                newlines.append(line)
-
-        file(self.fileName, "w").writelines(newlines)
-            
-    def backup(self):
-        for oldLine, newLine in self.backups:
-            if newLine is None:
-                self.add_lines(oldLine, False)
-            else:
-                self.replace_lines(newLine, oldLine, False)
-            

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e2a32ab4/ovm/scripts/vm/hypervisor/ovm/Fixget_storage_reposExceptionDueToWrongReturnValueCheck.patch
----------------------------------------------------------------------
diff --git a/ovm/scripts/vm/hypervisor/ovm/Fixget_storage_reposExceptionDueToWrongReturnValueCheck.patch b/ovm/scripts/vm/hypervisor/ovm/Fixget_storage_reposExceptionDueToWrongReturnValueCheck.patch
deleted file mode 100644
index 7c41e55..0000000
--- a/ovm/scripts/vm/hypervisor/ovm/Fixget_storage_reposExceptionDueToWrongReturnValueCheck.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/OVSXUtility.py b/OVSXUtility.py
-index 4a98bc8..1053ef7 100644
---- a/OVSXUtility.py
-+++ b/OVSXUtility.py
-@@ -160,7 +160,7 @@ def get_storage_repos():
-     l = parse_storage_repos()
-     for sr in l:
-         d = get_storage_free_space(sr)
--        if d:
-+        if len(d) > 0:
-             d_repos_space[sr] = d[sr]
- 
-     if not d_repos_space:

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e2a32ab4/ovm/scripts/vm/hypervisor/ovm/OvmCommonModule.py
----------------------------------------------------------------------
diff --git a/ovm/scripts/vm/hypervisor/ovm/OvmCommonModule.py b/ovm/scripts/vm/hypervisor/ovm/OvmCommonModule.py
deleted file mode 100755
index aae6f71..0000000
--- a/ovm/scripts/vm/hypervisor/ovm/OvmCommonModule.py
+++ /dev/null
@@ -1,156 +0,0 @@
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License.  Citrix Systems, Inc.
-# reserves all rights not expressly granted by 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.
-# 
-# Automatically generated by addcopyright.py at 04/03/2012
-'''
-Created on May 17, 2011
-
-@author: frank
-'''
-
-try:
-    import json
-except ImportError:
-    import simplejson as json
-    
-from OvmObjectModule import *
-import types
-import logging
-import popen2
-import subprocess
-from OvmFaultConstants import toErrCode, dispatchErrCode, NoVmFoundException, ShellExceutedFailedException
-from xmlrpclib import Fault as XmlRpcFault
-from OVSCommons import *
-from OvmLoggerModule import OvmLogger
-from OVSXXenStore import xen_get_vm_path
-from OVSSiteRMServer import get_master_ip
-
-HEARTBEAT_TIMESTAMP_FORMAT='<timestamp>%s</timestamp>'
-HEARTBEAT_TIMESTAMP_PATTERN='(\<timestamp\>\d+.\d+<\/timestamp\>)'
-HEARTBEAT_DIR='heart_beat'
-ETC_HOSTS='/etc/hosts'
-HOSTNAME_FILE='/etc/sysconfig/network'
-OWNER_FILE_PREFIX='host_'
-OCFS2_CONF='/etc/ocfs2/cluster.conf'
-
-logger = OvmLogger('OvmCommon')
-
-def setAttrFromDict(obj, name, refDict, convertFunc=None):
-    if not convertFunc:
-        setattr(obj, name, refDict[name])
-    else:
-        setattr(obj, name, convertFunc(refDict[name]))
-
-def safeSetAttr(obj, name, value):
-    if not hasattr(obj, name): raise Exception("%s doesn't have attribute %s"%(obj.__class__.__name__, name))
-    setattr(obj, name, value)
-    
-def toAscii(jstr):
-    return str(jstr).encode('ascii', 'ignore')
-
-def toAsciiHook(dct):
-    for k in dct:
-        v = dct[k]
-        if type(v) is types.UnicodeType:
-            v = toAscii(v)
-        del dct[k]
-        k = toAscii(k)
-        dct[k] = v
-    return dct
-    
-def asciiLoads(jStr):
-    jStr = str(jStr).replace("'", '"').replace('False', 'false').replace('True', 'true')
-    return json.loads(jStr, object_hook=toAsciiHook)
-
-def exceptionIfNoSuccess(str, errMsg=None):
-    if not errMsg: errMsg = str
-    if not "success" in str: raise Exception("%s (%s)"%(errMsg, str))
-
-def successToMap(str, sep=';'):
-    if not str.startswith("success"): raise Exception(str)
-    str = str[len('success:'):]
-    dct = {}
-    for pair in str.split(sep):
-        (key, value) = pair.split('=', 1)
-        dct[key] = value
-    return dct
-
-def jsonSuccessToMap(str):
-    dct = json.loads(str)
-    if dct['status'] != 'SUCC': raise Exception(str)
-    return dct['value']
-    
-def safeDictSet(obj, dct, name):
-    if not hasattr(obj, name): raise Exception("%s has no attribute %s for encoding"%(obj.__class__.__name__, name))
-    dct[name] = getattr(obj, name)
-
-def normalizeToGson(str):
-    return str.replace('\\', '').strip('"').replace('"{', '{').replace('}"', '}');
-
-def toGson(obj):
-    return normalizeToGson(json.dumps(obj))
-
-def MtoBytes(M):
-    return M * 1024 * 1024
-
-def BytesToM(bytes):
-    return bytes/(1024*1024)
-
-def BytesToG(bytes):
-    return bytes/(1024*1024*1024)
-
-def runCmd(cmds):
-    process = subprocess.Popen(cmds, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-    stdout, stderr = process.communicate()
-    if process.returncode != 0:
-        raise ShellExceutedFailedException(stderr, process.returncode)
-    return stdout
-
-def doCmd(lst):
-    cmds = [str(i) for i in lst]
-    cmdStr = ' '.join(cmds)
-    logger.debug(doCmd, cmdStr)
-    res = runCmd(cmdStr)
-    logger.debug(doCmd, 'result:' + res)
-    return res
-
-def execute(cmd):
-    p = popen2.Popen3(cmd, True)
-    if (p.wait() != 0):
-        raise Exception("Failed to execute command. Command: " + cmd + ", Error: " + p.childerr.read())
-    return p.fromchild.read()
-
-def getDomId(vm_name):
-    return execute("xm list | grep " + vm_name + " | awk '{print $2}'").strip()
-    
-def raiseExceptionIfFail(res):
-    if not "success" in res and not "SUCC" in res: raise Exception(res)
-
-def ipToHeartBeatFileName(ip):
-    return ip.replace('.', '_') + "_HEARTBEAT"
-
-def getVmNameFromConfigureFile(cfgPath):
-    fd = open(cfgPath)
-    for i in fd.readlines():
-        i = i.strip()
-        if i.startswith('name'):
-            (key, value) = i.split("=", 1)
-            value = value.strip().strip("'")
-            fd.close()
-            return value
-    fd.close()
-    raise Exception('Cannot find vm name in %s'%cfgPath)
-
-def makeOwnerFileName():
-    hostIp = successToMap(get_master_ip())['ip']
-    ownerFileName = OWNER_FILE_PREFIX + hostIp.replace('.', '_')
-    return ownerFileName
-    

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e2a32ab4/ovm/scripts/vm/hypervisor/ovm/OvmDiskModule.py
----------------------------------------------------------------------
diff --git a/ovm/scripts/vm/hypervisor/ovm/OvmDiskModule.py b/ovm/scripts/vm/hypervisor/ovm/OvmDiskModule.py
deleted file mode 100644
index 7ae6c72..0000000
--- a/ovm/scripts/vm/hypervisor/ovm/OvmDiskModule.py
+++ /dev/null
@@ -1,62 +0,0 @@
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License.  Citrix Systems, Inc.
-# reserves all rights not expressly granted by 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.
-# 
-# Automatically generated by addcopyright.py at 04/03/2012
-'''
-Created on May 17, 2011
-
-@author: frank
-'''
-
-from OvmCommonModule import *
-
-class OvmDiskDecoder(json.JSONDecoder):
-    def decode(self, jStr):
-        deDict = asciiLoads(jStr)
-        disk = OvmDisk()
-        setAttrFromDict(disk, 'path', deDict)
-        setAttrFromDict(disk, 'type', deDict)
-        setAttrFromDict(disk, 'isIso', deDict)
-        return disk
-
-class OvmDiskEncoder(json.JSONEncoder):
-    def default(self, obj):
-        if not isinstance(obj, OvmDisk): raise Exception("%s is not instance of OvmDisk"%type(obj))
-        dct = {}
-        safeDictSet(obj, dct, 'path')
-        safeDictSet(obj, dct, 'type')
-        return dct    
-
-def fromOvmDisk(disk):
-    return normalizeToGson(json.dumps(disk, cls=OvmDiskEncoder))
-
-def fromOvmDiskList(diskList):
-    return [fromOvmDisk(d) for d in diskList]
-
-def toOvmDisk(jStr):
-    return json.loads(jStr, cls=OvmDiskDecoder)
-
-def toOvmDiskList(jStr):
-    disks = []
-    for i in jStr:
-        d = toOvmDisk(i)
-        disks.append(d)
-    return disks
-
-class OvmDisk(OvmObject):
-    path = ''
-    type = ''
-    isIso = False
-   
-    
-if __name__ == "__main__":
-    print toOvmDisk('''{"type":"w","path":"/data/data.raw"}''')
-    print toOvmDisk('''{"path":"/data/data.raw'","type":"w"}''')
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e2a32ab4/ovm/scripts/vm/hypervisor/ovm/OvmDispatcher.py
----------------------------------------------------------------------
diff --git a/ovm/scripts/vm/hypervisor/ovm/OvmDispatcher.py b/ovm/scripts/vm/hypervisor/ovm/OvmDispatcher.py
deleted file mode 100644
index 8db558e..0000000
--- a/ovm/scripts/vm/hypervisor/ovm/OvmDispatcher.py
+++ /dev/null
@@ -1,58 +0,0 @@
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License.  Citrix Systems, Inc.
-# reserves all rights not expressly granted by 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.
-# 
-# Automatically generated by addcopyright.py at 04/03/2012
-import types
-from OvmCommonModule import *
-from xmlrpclib import Fault
-from OVSCommons import *
-import OvmFaultConstants
-
-import OvmHostModule
-import OvmStoragePoolModule
-import OvmVmModule
-import OvmNetworkModule
-import OvmVolumeModule
-import OvmSecurityGroupModule
-from OvmHaHeartBeatModule import OvmHaHeartBeat
-
-ExposedClass = {}
-logger = OvmLogger('OvmDispatcher')
-def InitOvmDispacther():
-    global ExposedClass
-    modules = [ eval(attr) for attr in globals() if isinstance(eval(attr), types.ModuleType) ]
-    for m in modules:
-        for name in dir(m):
-            clz = getattr(m, name)
-            if type(clz) is types.TypeType and issubclass(clz, OvmObject):
-                ExposedClass[name] = clz
-    logger.debug(InitOvmDispacther, "Discovered exposed class:\n\n%s"%"\n".join(ExposedClass))
-
-@exposed
-def OvmDispatch(methodName, *params):
-    global ExposedClass
-    p = methodName.split('.')
-    if len(p) != 2:
-        logger.error(OvmDispatch, "%s is not a vaild format, should be classname.methodname"%p)
-        raise Fault(dispatchErrCode('InvalidCallMethodFormat'), "%s is not a vaild format, should be classname.methodname"%p)
-    clzName = p[0]
-    funcName = p[1]
-    if clzName not in ExposedClass.keys():
-        logger.error(OvmDispatch, "class %s is not exposed by agent"%clzName)
-        raise Fault(dispatchErrCode('InvaildClass'), "class %s is not exposed by agent"%clzName)
-    clz = ExposedClass[clzName]
-    if not hasattr(clz, funcName):
-        logger.error(OvmDispatch, "class %s has no function %s"%(clzName, funcName))
-        raise Fault(dispatchErrCode('InvaildFunction'), "class %s has no function %s"%(clzName, funcName))
-    logger.debug(OvmDispatch, "Entering %s.%s ===>"%(clzName, funcName))
-    rs = getattr(clz, funcName)(*params)
-    logger.debug(OvmDispatch, "Exited %s.%s <==="%(clzName, funcName))
-    return rs

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e2a32ab4/ovm/scripts/vm/hypervisor/ovm/OvmDontTouchOCFS2ClusterWhenAgentStart.patch
----------------------------------------------------------------------
diff --git a/ovm/scripts/vm/hypervisor/ovm/OvmDontTouchOCFS2ClusterWhenAgentStart.patch b/ovm/scripts/vm/hypervisor/ovm/OvmDontTouchOCFS2ClusterWhenAgentStart.patch
deleted file mode 100644
index dfe8462..0000000
--- a/ovm/scripts/vm/hypervisor/ovm/OvmDontTouchOCFS2ClusterWhenAgentStart.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/OVSAgentAutoStart.py b/OVSAgentAutoStart.py
-index 88fa18c..794a363 100755
---- a/OVSAgentAutoStart.py
-+++ b/OVSAgentAutoStart.py
-@@ -111,8 +111,6 @@ def prepare_cluster_heartbeat():
- JOBS = [
-     ["command", join(dirname(__file__), "utils/upgrade_agent.py")],
-     ["function", "get_agent_version", ()],
--    ["function", "prepare_cluster_root", ()],
--    ["function", "prepare_cluster_heartbeat", ()],
-     ["command", join(dirname(__file__), "utils/upgrade.py")],
-     ["command_bg", join(dirname(__file__), "OVSRemasterServer.py")],
-     ["command_bg", join(dirname(__file__), "OVSMonitorServer.py")],

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e2a32ab4/ovm/scripts/vm/hypervisor/ovm/OvmFaultConstants.py
----------------------------------------------------------------------
diff --git a/ovm/scripts/vm/hypervisor/ovm/OvmFaultConstants.py b/ovm/scripts/vm/hypervisor/ovm/OvmFaultConstants.py
deleted file mode 100755
index 9c3c7b9..0000000
--- a/ovm/scripts/vm/hypervisor/ovm/OvmFaultConstants.py
+++ /dev/null
@@ -1,95 +0,0 @@
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License.  Citrix Systems, Inc.
-# reserves all rights not expressly granted by 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.
-# 
-# Automatically generated by addcopyright.py at 04/03/2012
-OvmDispatcherStub = 0
-OvmHostErrCodeStub = 1000
-OvmVmErrCodeStub = 2000
-OvmStoragePoolErrCodeStub = 3000
-OvmNetworkErrCodeStub = 4000
-OvmVolumeErrCodeStub = 5000
-OvmOCFS2ErrCodeStub = 6000
-
-class NoVmFoundException(Exception):
-    pass
-
-class ShellExceutedFailedException(Exception):
-    stderr = ''
-    errCode = -1000
-    
-    def __init__(self, err, code):
-        Exception.__init__(self, "%s, return code:%s"%(err, code))
-        self.stderr = err
-        self.errCode = code
-
-errCode = {
-       # OvmDispatch is not class, these error codes are reserved
-       "OvmDispatch.InvalidCallMethodFormat":OvmDispatcherStub+1,
-       "OvmDispatch.InvaildClass":OvmDispatcherStub+2,
-       "OvmDispatch.InvaildFunction":OvmDispatcherStub+3,
-       "OvmVm.reboot":OvmDispatcherStub+4,
-        
-       "OvmHost.registerAsMaster":OvmHostErrCodeStub+1,
-       "OvmHost.registerAsVmServer":OvmHostErrCodeStub+2,
-       "OvmHost.ping":OvmHostErrCodeStub+3,
-       "OvmHost.getDetails":OvmHostErrCodeStub+4,
-       "OvmHost.getPerformanceStats":OvmHostErrCodeStub+5,
-       "OvmHost.getAllVms":OvmHostErrCodeStub+6,
-       "OvmHost.fence":OvmHostErrCodeStub+7,
-       "OvmHost.setupHeartBeat":OvmHostErrCodeStub+8,
-       "OvmHost.pingAnotherHost":OvmHostErrCodeStub+9,
-       
-       "OvmVm.create":OvmVmErrCodeStub+1,
-       "OvmVm.stop":OvmVmErrCodeStub+2,
-       "OvmVm.getDetails":OvmVmErrCodeStub+3,
-       "OvmVm.getVmStats":OvmVmErrCodeStub+4,
-       "OvmVm.migrate":OvmVmErrCodeStub+5,
-       "OvmVm.register":OvmVmErrCodeStub+6,
-       "OvmVm.getVncPort":OvmVmErrCodeStub+7,
-       "OvmVm.detachOrAttachIso":OvmVmErrCodeStub+8,
-       
-       "OvmStoragePool.create":OvmStoragePoolErrCodeStub+1,
-       "OvmStoragePool.getDetailsByUuid":OvmStoragePoolErrCodeStub+2,
-       "OvmStoragePool.downloadTemplate":OvmStoragePoolErrCodeStub+3,
-       "OvmStoragePool.prepareOCFS2Nodes":OvmStoragePoolErrCodeStub+4,
-       "OvmStoragePool.createTemplateFromVolume":OvmStoragePoolErrCodeStub+5,
-       "OvmStoragePool._umount":OvmStoragePoolErrCodeStub+6,
-       "OvmStoragePool.copyVolume":OvmStoragePoolErrCodeStub+7,
-       "OvmStoragePool.delete":OvmStoragePoolErrCodeStub+8,
-       
-       "OvmNetwork.createBridge":OvmNetworkErrCodeStub+1,
-       "OvmNetwork.deleteBridge":OvmNetworkErrCodeStub+2,
-       "OvmNetwork.createVlan":OvmNetworkErrCodeStub+3,
-       "OvmNetwork.deleteVlan":OvmNetworkErrCodeStub+4,
-       "OvmNetwork.getAllBridges":OvmNetworkErrCodeStub+5,
-       "OvmNetwork.getBridgeByIp":OvmNetworkErrCodeStub+6,
-       "OvmNetwork.createVlanBridge":OvmNetworkErrCodeStub+7,
-       "OvmNetwork.deleteVlanBridge":OvmNetworkErrCodeStub+8,
-       
-       "OvmVolume.createDataDisk":OvmVolumeErrCodeStub+1,
-       "OvmVolume.createFromTemplate":OvmVolumeErrCodeStub+2,
-       "OvmVolume.destroy":OvmVolumeErrCodeStub+3,
-       
-       "OvmOCFS2._addNode":OvmOCFS2ErrCodeStub+1,
-}
-
-
-def toErrCode(clz, func):
-    global errCode
-    if not callable(func): raise Exception("%s is not a callable, cannot get error code"%func)
-    name = clz.__name__ + '.' + func.__name__
-    if name not in errCode.keys(): return -1
-    return errCode[name]
-
-def dispatchErrCode(funcName):
-    name = "OvmDispatch." + funcName
-    if name not in errCode.keys(): return -1
-    return errCode[name]

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e2a32ab4/ovm/scripts/vm/hypervisor/ovm/OvmHaHeartBeatModule.py
----------------------------------------------------------------------
diff --git a/ovm/scripts/vm/hypervisor/ovm/OvmHaHeartBeatModule.py b/ovm/scripts/vm/hypervisor/ovm/OvmHaHeartBeatModule.py
deleted file mode 100644
index eeee35a..0000000
--- a/ovm/scripts/vm/hypervisor/ovm/OvmHaHeartBeatModule.py
+++ /dev/null
@@ -1,102 +0,0 @@
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License.  Citrix Systems, Inc.
-# reserves all rights not expressly granted by 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.
-# 
-# Automatically generated by addcopyright.py at 04/03/2012
-'''
-Created on Jun 6, 2011
-
-@author: frank
-'''
-from OvmCommonModule import *
-try:
-    from multiprocessing import Process, Manager
-except ImportError:
-    from processing import Process, Manager
-import signal
-
-logger = OvmLogger("OvmHaHeartBeat")
-
-class OvmHaHeartBeat(object):
-    '''
-    classdocs
-    '''
-    def __init__(self, mountPoint, ip):
-        self.mountPoint = mountPoint
-        self.ip = ip
-    
-    def mark(self, file):
-        timestamp = HEARTBEAT_TIMESTAMP_FORMAT % time.time()
-        try:
-            fd = open(file, 'w')
-            fd.write(timestamp)
-            fd.close()
-        except Exception, e:
-            errmsg = fmt_err_msg(e)
-            logger.error(OvmHaHeartBeat.mark, errmsg)
-        
-    def run(self):
-        '''
-        Constructor
-        '''
-        heartBeatDir = join(self.mountPoint, HEARTBEAT_DIR)
-        if not exists(heartBeatDir):
-            os.makedirs(heartBeatDir)
-        hearBeatFile = join(heartBeatDir, ipToHeartBeatFileName(self.ip))
-        while True:
-            self.mark(hearBeatFile)
-            time.sleep(120)
-    
-    @staticmethod
-    def start(poolPath, ip):
-        pidFile = join(PID_DIR, "heartbeat.pid")
-        
-        def isLive():
-            if exists(pidFile):
-                f = open(pidFile)
-                pid = f.read().strip()
-                f.close()
-                if isdir("/proc/%s" % pid):
-                    return long(pid)
-            return None
-        
-        def stopOldHeartBeat(pid):
-            os.kill(pid, signal.SIGTERM)
-            time.sleep(5)
-            pid = isLive()
-            if pid != None:
-                logger.debug(OvmHaHeartBeat.start, "SIGTERM cannot stop heartbeat process %s, will try SIGKILL"%pid)
-                os.kill(pid, signal.SIGKILL)
-                time.sleep(5)
-                pid = isLive()
-                if pid != None:
-                    raise Exception("Cannot stop old heartbeat process %s, setup heart beat failed"%pid)
-        
-        def heartBeat(hb):
-            hb.run()
-           
-        def setupHeartBeat():
-            hb = OvmHaHeartBeat(poolPath, ip)
-            p = Process(target=heartBeat, args=(hb,))
-            p.start()
-            pid = p.pid
-            if not isdir(PID_DIR):
-                os.makedirs(PID_DIR)
-            pidFd = open(pidFile, 'w')
-            pidFd.write(str(pid))
-            pidFd.close()
-            logger.info(OvmHaHeartBeat.start, "Set up heart beat successfully, pid is %s" % pid)
-             
-        pid = isLive()
-        if pid != None:
-            stopOldHeartBeat(pid)
-            
-        setupHeartBeat()
-            

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e2a32ab4/ovm/scripts/vm/hypervisor/ovm/OvmHostModule.py
----------------------------------------------------------------------
diff --git a/ovm/scripts/vm/hypervisor/ovm/OvmHostModule.py b/ovm/scripts/vm/hypervisor/ovm/OvmHostModule.py
deleted file mode 100755
index 9cfbd46..0000000
--- a/ovm/scripts/vm/hypervisor/ovm/OvmHostModule.py
+++ /dev/null
@@ -1,304 +0,0 @@
-#/usr/bin/python
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License.  Citrix Systems, Inc.
-# reserves all rights not expressly granted by 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.
-# 
-# Automatically generated by addcopyright.py at 04/03/2012
-
-from OvmCommonModule import *
-from OVSSiteRMServer import get_master_ip, register_server
-from OVSCommons import *
-from OVSXMonitor import xen_get_xm_info
-from OVSXSysInfo import get_agent_version
-from OVSSiteRMServer import get_srv_agent_status
-from OVSXMonitor import sys_perf_info
-from OVSDB import db_get_vm
-from OvmStoragePoolModule import OvmStoragePool
-from OvmHaHeartBeatModule import OvmHaHeartBeat
-import re
-
-logger = OvmLogger('OvmHost')
-
-class OvmHostEncoder(json.JSONEncoder):
-    def default(self, obj):
-        if not isinstance(obj, OvmHost): raise Exception("%s is not instance of OvmHost"%type(obj))
-        dct = {}
-        safeDictSet(obj, dct, 'masterIp')
-        safeDictSet(obj, dct, 'cpuNum')
-        safeDictSet(obj, dct, 'cpuSpeed')
-        safeDictSet(obj, dct, 'totalMemory')
-        safeDictSet(obj, dct, 'freeMemory')
-        safeDictSet(obj, dct, 'dom0Memory')
-        safeDictSet(obj, dct, 'agentVersion')
-        safeDictSet(obj, dct, 'name')
-        safeDictSet(obj, dct, 'dom0KernelVersion')
-        safeDictSet(obj, dct, 'hypervisorVersion')
-        return dct
-        
-
-def fromOvmHost(host):
-    return normalizeToGson(json.dumps(host, cls=OvmHostEncoder))
-    
-class OvmHost(OvmObject):
-    masterIp = ''
-    cpuNum = 0
-    cpuSpeed = 0
-    totalMemory = 0
-    freeMemory = 0
-    dom0Memory = 0
-    agentVersion = ''
-    name = ''
-    dom0KernelVersion = ''
-    hypervisorVersion = ''
-
-    def _getVmPathFromPrimaryStorage(self, vmName):
-        '''
-        we don't have a database to store vm states, so there is no way to retrieve information of a vm
-        when it was already stopped. The trick is to try to find the vm path in primary storage then we 
-        can read information from its configure file.
-        '''
-        mps = OvmStoragePool()._getAllMountPoints()
-        vmPath = None
-        for p in mps:
-            vmPath = join(p, 'running_pool', vmName)
-            if exists(vmPath): break
-        if not vmPath:
-            logger.error(self._getVmPathFromPrimaryStorage, "Cannot find link for %s in any primary storage, the vm was really gone!"%vmName)
-            raise Exception("Cannot find link for %s in any primary storage, the vm was really gone!"%vmName)
-        return vmPath
-    
-    def _vmNameToPath(self, vmName):
-        # the xen_get_vm_path always sucks!!!
-        #return successToMap((vmName))['path']
-        return self._getVmPathFromPrimaryStorage(vmName)
-    
-    def _getAllDomains(self):
-        stdout = timeout_command(["xm", "list"])
-        l = [ line.split()[:2] for line in stdout.splitlines() ]
-        l = [ (name, id) for (name, id) in l if name not in ("Name", "Domain-0") ]
-        return l
-    
-    def _getDomainIdByName(self, vmName):
-        l = self._getAllDomains()
-        for name, id in l:
-            if vmName == name: return id
-        raise NoVmFoundException("No domain id for %s found"%vmName)
-
-    @staticmethod
-    def registerAsMaster(hostname, username="oracle", password="password", port=8899, isSsl=False):
-        try:
-            logger.debug(OvmHost.registerAsMaster, "ip=%s, username=%s, password=%s, port=%s, isSsl=%s"%(hostname, username, password, port, isSsl))
-            exceptionIfNoSuccess(register_server(hostname, 'site', False, username, password, port, isSsl),
-                             "Register %s as site failed"%hostname)
-            exceptionIfNoSuccess(register_server(hostname, 'utility', False, username, password, port, isSsl),
-                             "Register %s as utility failed"%hostname)
-            rs = SUCC()
-            return rs
-        except Exception, e:
-            errmsg = fmt_err_msg(e)
-            logger.error(OvmHost.registerAsMaster, errmsg)
-            raise XmlRpcFault(toErrCode(OvmHost, OvmHost.registerAsMaster), errmsg)
-    
-    @staticmethod
-    def registerAsVmServer(hostname, username="oracle", password="password", port=8899, isSsl=False):
-        try:
-            logger.debug(OvmHost.registerAsVmServer, "ip=%s, username=%s, password=%s, port=%s, isSsl=%s"%(hostname, username, password, port, isSsl))
-            exceptionIfNoSuccess(register_server(hostname, 'xen', False, username, password, port, isSsl),
-                             "Register %s as site failed"%hostname)
-            rs = SUCC()
-            return rs
-        except Exception, e:
-            errmsg = fmt_err_msg(e)
-            logger.error(OvmHost.registerAsVmServer, errmsg)
-            raise XmlRpcFault(toErrCode(OvmHost, OvmHost.registerAsVmServer), errmsg)
-    
-    @staticmethod
-    def ping(hostname):
-        try:
-            logger.debug(OvmHost.ping, "ping %s"%hostname)
-            exceptionIfNoSuccess(get_srv_agent_status(hostname), "Ovs agent is down")
-            rs = SUCC()
-            return rs
-        except Exception, e:
-            errmsg = fmt_err_msg(e)
-            logger.error(OvmHost.ping, errmsg)
-            raise XmlRpcFault(toErrCode(OvmHost, OvmHost.ping, errmsg))
-        
-    @staticmethod
-    def getDetails():
-        try:
-            obj = OvmHost()
-            masterIp = successToMap(get_master_ip())
-            safeSetAttr(obj, 'masterIp', masterIp['ip'])
-            xmInfo = successToMap(xen_get_xm_info())
-            totalMemory = MtoBytes(long(xmInfo['total_memory']))
-            safeSetAttr(obj, 'totalMemory', totalMemory)
-            freeMemory = MtoBytes(long(xmInfo['free_memory']))
-            safeSetAttr(obj, 'freeMemory', freeMemory)
-            dom0Memory = totalMemory - freeMemory
-            safeSetAttr(obj, 'dom0Memory', dom0Memory)
-            cpuNum = int(xmInfo['nr_cpus'])
-            safeSetAttr(obj, 'cpuNum', cpuNum)
-            cpuSpeed = int(xmInfo['cpu_mhz'])
-            safeSetAttr(obj, 'cpuSpeed', cpuSpeed)
-            name = xmInfo['host']
-            safeSetAttr(obj, 'name', name)
-            dom0KernelVersion = xmInfo['release']
-            safeSetAttr(obj, 'dom0KernelVersion', dom0KernelVersion)
-            hypervisorVersion = xmInfo['xen_major'] + '.' + xmInfo['xen_minor'] + xmInfo['xen_extra']
-            safeSetAttr(obj, 'hypervisorVersion', hypervisorVersion)
-            agtVersion = successToMap(get_agent_version())
-            safeSetAttr(obj, 'agentVersion', agtVersion['agent_version'])
-            res = fromOvmHost(obj)
-            logger.debug(OvmHost.getDetails, res)
-            return res
-        except Exception, e:
-            errmsg = fmt_err_msg(e)
-            logger.error(OvmHost.getDetails, errmsg)
-            raise XmlRpcFault(toErrCode(OvmHost, OvmHost.getDetails), errmsg)
-    
-    @staticmethod
-    def getPerformanceStats(bridgeName):
-        try:
-            rxBytesPath = join("/sys/class/net/", bridgeName, "statistics/rx_bytes")
-            txBytesPath = join("/sys/class/net/", bridgeName, "statistics/tx_bytes")
-            if not exists(rxBytesPath): raise Exception("Cannot find %s"%rxBytesPath)
-            if not exists(txBytesPath): raise Exception("Cannot find %s"%txBytesPath)
-            rxBytes = long(doCmd(['cat', rxBytesPath])) / 1000
-            txBytes = long(doCmd(['cat', txBytesPath])) / 1000
-            sysPerf = successToMap(sys_perf_info())
-            cpuUtil = float(100 - float(sysPerf['cpu_idle']) * 100)
-            freeMemory = MtoBytes(long(sysPerf['mem_free']))
-            xmInfo = successToMap(xen_get_xm_info())
-            totalMemory = MtoBytes(long(xmInfo['total_memory']))
-            rs = toGson({"cpuUtil":cpuUtil, "totalMemory":totalMemory, "freeMemory":freeMemory, "rxBytes":rxBytes, "txBytes":txBytes})
-            logger.info(OvmHost.getPerformanceStats, rs)
-            return rs
-        except Exception, e:
-            errmsg = fmt_err_msg(e)
-            logger.error(OvmHost.getPerformanceStats, errmsg)
-            raise XmlRpcFault(toErrCode(OvmHost, OvmHost.getPerformanceStats), errmsg)
-    
-    @staticmethod
-    def getAllVms():
-        def scanStoppedVmOnPrimaryStorage(vms):
-            def isMyVmDirLink(path):
-                return (islink(path) and exists(join(path, 'vm.cfg')) and ('-' in basename(path)) and (exists(join(path, makeOwnerFileName()))))
-                    
-            mps = OvmStoragePool()._getAllMountPoints()
-            for mountPoint in mps:
-                runningPool = join(mountPoint, 'running_pool')
-                if not exists(runningPool):
-                    logger.debug(OvmHost.getAllVms, "Primary storage %s not existing, skip it. this should be first getAllVms() called from Ovm resource configure"%runningPool)
-                    continue
-                    
-                for dir in os.listdir(runningPool):
-                    vmDir = join(runningPool, dir)
-                    if not isMyVmDirLink(vmDir):
-                        logger.debug(OvmHost.getAllVms, "%s is not our vm directory, skip it"%vmDir)
-                        continue
-                    if vms.has_key(dir):
-                        logger.debug(OvmHost.getAllVms, "%s is already in running list, skip it"%dir)
-                        continue
-                    
-                    logger.debug(OvmHost.getAllVms, "Found a stopped vm %s on primary storage %s, report it to management server" % (dir, mountPoint))
-                    vms[dir] = "DOWN"
-                    
-                    
-        try:
-            l = OvmHost()._getAllDomains()
-            dct = {}
-            host = OvmHost()
-            for name, id in l:
-                try:
-                    vmPath = host._getVmPathFromPrimaryStorage(name)
-                    vmStatus = db_get_vm(vmPath)
-                    dct[name] = vmStatus['status']
-                except Exception, e:
-                    logger.debug(OvmHost.getAllVms, "Cannot find link for %s on primary storage, treat it as Error"%name)
-                    dct[name] = 'ERROR'
-                        
-            scanStoppedVmOnPrimaryStorage(dct)
-            rs = toGson(dct)
-            logger.info(OvmHost.getAllVms, rs)
-            return rs
-        except Exception, e:
-            errmsg = fmt_err_msg(e)
-            logger.error(OvmHost.getAllVms, errmsg)
-            raise XmlRpcFault(toErrCode(OvmHost, OvmHost.getAllVms), errmsg)
-    
-    @staticmethod
-    def fence(ip):
-        # try 3 times to avoid race condition that read when heartbeat file is being written
-        def getTimeStamp(hbFile):
-            for i in range(1, 3):
-                f = open(hbFile, 'r') 
-                str = f.readline()
-                items = re.findall(HEARTBEAT_TIMESTAMP_PATTERN, str)
-                if len(items) == 0:
-                    logger.debug(OvmHost.fence, "Get an incorrect heartbeat data %s, will retry %s times" % (str, 3-i))
-                    f.close()
-                    time.sleep(5)
-                else:
-                    f.close()
-                    timestamp = items[0]
-                    return timestamp.lstrip('<timestamp>').rstrip('</timestamp>')
-            
-        # totally check in 6 mins, the update frequency is 2 mins
-        def check(hbFile):
-            for i in range(1, 6):
-                ts = getTimeStamp(hbFile)
-                time.sleep(60)
-                nts = getTimeStamp(hbFile)
-                if ts != nts: return True
-                else: logger.debug(OvmHost.fence, '%s is not updated, old value=%s, will retry %s times'%(hbFile, ts, 6-i))
-            return False
-                
-        try:
-            mountpoints = OvmStoragePool()._getAllMountPoints()
-            hbFile = None
-            for m in mountpoints:
-                p = join(m, HEARTBEAT_DIR, ipToHeartBeatFileName(ip))
-                if exists(p):
-                    hbFile = p
-                    break
-                
-            if not hbFile: raise Exception('Can not find heartbeat file for %s in pools %s'%(ip, mountpoints))
-            rs = toGson({"isLive":check(hbFile)})
-            logger.debug(OvmHost.fence, rs)
-            return rs
-        except Exception, e:
-            errmsg = fmt_err_msg(e)
-            logger.error(OvmHost.fence, errmsg)
-            raise XmlRpcFault(toErrCode(OvmHost, OvmHost.fence), errmsg)
-    
-    @staticmethod
-    def setupHeartBeat(poolUuid, ip):
-        try:
-            sr = OvmStoragePool()._getSrByNameLable(poolUuid)
-            OvmHaHeartBeat.start(sr.mountpoint, ip)
-            return SUCC()
-        except Exception, e:
-            errmsg = fmt_err_msg(e)
-            logger.error(OvmHost.setupHeartBeat, errmsg)
-            raise XmlRpcFault(toErrCode(OvmHost, OvmHost.setupHeartBeat), errmsg)
-    
-    @staticmethod
-    def pingAnotherHost(ip):
-        try:
-            doCmd(['ping', '-c', '1', '-n', '-q', ip])
-            return SUCC()
-        except Exception, e:
-            errmsg = fmt_err_msg(e)
-            logger.error(OvmHost.pingAnotherHost, errmsg)
-            raise XmlRpcFault(toErrCode(OvmHost, OvmHost.pingAnotherHost), errmsg)
-        
-if __name__ == "__main__":
-    print OvmHost.getAllVms()
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e2a32ab4/ovm/scripts/vm/hypervisor/ovm/OvmLoggerModule.py
----------------------------------------------------------------------
diff --git a/ovm/scripts/vm/hypervisor/ovm/OvmLoggerModule.py b/ovm/scripts/vm/hypervisor/ovm/OvmLoggerModule.py
deleted file mode 100644
index 07fe78f..0000000
--- a/ovm/scripts/vm/hypervisor/ovm/OvmLoggerModule.py
+++ /dev/null
@@ -1,51 +0,0 @@
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License.  Citrix Systems, Inc.
-# reserves all rights not expressly granted by 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.
-# 
-# Automatically generated by addcopyright.py at 04/03/2012
-'''
-Created on May 19, 2011
-
-@author: frank
-'''
-import logging
-
-class OvmLogger(object):
-    '''
-    classdocs
-    '''
-
-
-    def __init__(self, className):
-        '''
-        Constructor
-        '''
-        self.className = className
-        self.logger = logging.getLogger(className)
-    
-    def info(self, func, msg=None):
-        assert callable(func), "%s is not a function"%func
-        fmt = "[%s.%s]: "%(self.className, func.__name__)
-        self.logger.info("%s%s"%(fmt,msg))
-    
-    def debug(self, func, msg=None):
-        assert callable(func), "%s is not a function"%func
-        fmt = "[%s.%s]: "%(self.className, func.__name__)
-        self.logger.debug("%s%s"%(fmt,msg))
-    
-    def error(self, func, msg=None):
-        assert callable(func), "%s is not a function"%func
-        fmt = "[%s.%s]: "%(self.className, func.__name__)
-        self.logger.error("%s%s"%(fmt,msg))
-    
-    def warning(self, func, msg=None):
-        assert callable(func), "%s is not a function"%func
-        fmt = "[%s.%s]: "%(self.className, func.__name__)
-        self.logger.warning("%s%s"%(fmt,msg))
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e2a32ab4/ovm/scripts/vm/hypervisor/ovm/OvmNetworkModule.py
----------------------------------------------------------------------
diff --git a/ovm/scripts/vm/hypervisor/ovm/OvmNetworkModule.py b/ovm/scripts/vm/hypervisor/ovm/OvmNetworkModule.py
deleted file mode 100755
index 5813fcd..0000000
--- a/ovm/scripts/vm/hypervisor/ovm/OvmNetworkModule.py
+++ /dev/null
@@ -1,429 +0,0 @@
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License.  Citrix Systems, Inc.
-# reserves all rights not expressly granted by 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.
-# 
-# Automatically generated by addcopyright.py at 04/03/2012
-from OvmCommonModule import *
-import traceback
-import time
-import re
- 
-logger = OvmLogger("OvmNetwork")
-
-class Filter:
-    class Network:
-        IFNAME_LO     = r'(lo)'
-        IFNAME_BRIDGE = r'(xenbr\d+|vlan\d+)'
-        IFNAME_PIF    = r'(eth\d+$|bond\d+$)'
-        IFNAME_VLAN   = r'(eth\d+.\d+$|bond\d+.\d+$)'
-
-
-class Parser(object):
-    '''
-    classdocs
-    '''    
-    def findall(self, pattern, samples):
-        """
-        @param pattern: search pattern
-        @param result: Parser line execution result
-        @return : list of search
-        find result of Parser which has same pattern
-        findall Parser find all pattern in a string
-        """
-        result = []
-        for line in samples:
-            items = re.findall(pattern, line)
-            for item in items:
-                result.append(item)
-        return result
-    
-    def checkPattern(self, pattern, cmd_result):
-        """
-        @param pattern: search pattern
-        @param cmd_result: Parser line execution result
-        @return : True (if pattern is occurred)
-        """
-        for line in cmd_result:
-            items = re.findall(pattern, line)
-            if len(items) > 0:
-                return True
-        return False
-    
-    def search(self, cmd_result, pattern):
-        return None
-    
-class OvmVlanDecoder(json.JSONDecoder):
-    def decode(self, jStr):
-        deDict = asciiLoads(jStr)
-        vlan = OvmVlan()
-        setAttrFromDict(vlan, 'vid', deDict, int)
-        setAttrFromDict(vlan, 'pif', deDict)
-        return vlan
-
-class OvmVlanEncoder(json.JSONEncoder):
-    def default(self, obj):
-        if not isinstance(obj, OvmVlan): raise Exception("%s is not instance of OvmVlan"%type(obj))
-        dct = {}
-        safeDictSet(obj, dct, 'name')
-        safeDictSet(obj, dct, 'vid')
-        safeDictSet(obj, dct, 'pif')
-        return dct
-    
-def toOvmVlan(jStr):
-    return json.loads(jStr, cls=OvmVlanDecoder)
-
-def fromOvmVlan(vlan):
-    return normalizeToGson(json.dumps(vlan, cls=OvmVlanEncoder))
-
-class OvmBridgeDecoder(json.JSONDecoder):
-    def decode(self, jStr):
-        deDic = asciiLoads(jStr)
-        bridge = OvmBridge()
-        setAttrFromDict(bridge, 'name', deDic)
-        setAttrFromDict(bridge, 'attach', deDic)
-        return bridge
-
-class OvmBridgeEncoder(json.JSONEncoder):
-    def default(self, obj):
-        if not isinstance(obj, OvmBridge): raise Exception("%s is not instance of OvmBridge"%type(obj))
-        dct = {}
-        safeDictSet(obj, dct, 'name')
-        safeDictSet(obj, dct, 'attach')
-        safeDictSet(obj, dct, 'interfaces')
-        return dct
-    
-def toOvmBridge(jStr):
-    return json.loads(jStr, cls=OvmBridgeDecoder)
-
-def fromOvmBridge(bridge):
-    return normalizeToGson(json.dumps(bridge, cls=OvmBridgeEncoder))
-
-class OvmInterface(OvmObject):
-    name = ''
-
-class OvmVlan(OvmInterface):
-    vid = 0
-    pif = ''
-
-class OvmBridge(OvmInterface):
-    attach = ''
-    interfaces = []
-
-        
-class OvmNetwork(OvmObject):
-    '''
-    Network
-    '''
-
-    @property
-    def pifs(self):
-        return self._getInterfaces("pif")
-
-    @property
-    def vlans(self):
-        return self._getInterfaces("vlan")
-
-    @property
-    def bridges(self):
-        return self._getInterfaces("bridge")
-    
-    def __init__(self):
-        self.Parser = Parser()
-
-    def _createVlan(self, vlan):
-        """
-        @param jsonString : parameter from client side
-        @return : succ xxxxx
-        ex. jsonString => {vid:100, pif:eth0}
-        ex. return     => 
-        """
-        
-        #Pre-condition
-        #check Physical Interface Name
-        if vlan.pif not in self.pifs.keys():    
-            msg = "Physical Interface(%s) does not exist" % vlan.pif
-            logger.debug(self._createVlan, msg)
-            raise Exception(msg)
-
-        #Pre-condition    
-        #check Vlan Interface Name
-        ifName = "%s.%s" % (vlan.pif, vlan.vid)
-        if ifName in self.vlans.keys():
-            msg = "Vlan Interface(%s) already exist, return it" % ifName
-            logger.debug(self._createVlan, msg)
-            return self.vlans[ifName]
-            
-        doCmd(['vconfig', 'add', vlan.pif, vlan.vid])
-        self.bringUP(ifName)
-        logger.debug(self._createVlan, "Create vlan %s successfully"%ifName)
-        return self.vlans[ifName]
-    
-    def _deleteVlan(self, name):
-        if name not in self.vlans.keys():
-            raise Exception("No vlan device %s found"%name)
-        
-        vlan = self.vlans[name]
-        self.bringDown(vlan.name)
-        doCmd(['vconfig', 'rem', vlan.name])
-        logger.debug(self._deleteVlan, "Delete vlan %s successfully"%vlan.name)
-        
-    
-    def _createBridge(self, bridge):
-        """
-        @return : success
-        ex. {bridge:xapi100, attach:eth0.100}
-        create bridge interface, and attached it 
-        cmd 1: brctl addbr bridge
-        cmd 2: brctl addif brdige attach
-        """
-        
-        if "xenbr" not in bridge.name and "vlan" not in bridge.name:
-            raise Exception("Invalid bridge name %s. Bridge name must be in partten xenbr/vlan, e.g. xenbr0"%bridge.name)
-        
-        #pre-condition
-        #check Bridge Interface Name
-        if bridge.name in self.bridges.keys():
-            msg = "Bridge(%s) already exist, return it" % bridge.name
-            logger.debug(self._createBridge, msg)
-            return self.bridges[bridge.name]
-
-        #pre-condition
-        #check attach must exist
-        #possible to attach in PIF or VLAN 
-        if bridge.attach not in self.vlans.keys() and bridge.attach not in self.pifs.keys():
-            msg = "%s is not either pif or vlan" % bridge.attach
-            logger.error(self._createBridge, msg)
-            raise Exception(msg)
-
-        doCmd(['brctl', 'addbr', bridge.name])
-        doCmd(['brctl', 'addif', bridge.name, bridge.attach])
-        self.bringUP(bridge.name)
-        logger.debug(self._createBridge, "Create bridge %s on %s successfully"%(bridge.name, bridge.attach))
-        return self.bridges[bridge.name]
-    
-    def _getBridges(self):
-        return self.bridges.keys()
-    
-    def _getVlans(self):
-        return self.vlans.keys()
-    
-    def _deleteBridge(self, name):
-        if name not in self.bridges.keys():
-            raise Exception("Can not find bridge %s"%name)
-        
-        bridge = self.bridges[name]
-        if bridge.attach in bridge.interfaces: bridge.interfaces.remove(bridge.attach)
-        if len(bridge.interfaces) != 0:
-            logger.debug(self._deleteBridge, "There are still some interfaces(%s) on bridge %s"%(bridge.interfaces, bridge.name))
-            return False
-        self.bringDown(bridge.name)
-        doCmd(['brctl', 'delbr', bridge.name])
-        logger.debug(self._deleteBridge, "Delete bridge %s successfully"%bridge.name)
-        return True
-        
-    def _getInterfaces(self, type):
-        """
-        @param type : ["pif", "bridge", "tap"]
-        @return : dictionary of Interface Objects
-        get All Interfaces based on type
-        """
-        devices = os.listdir('/sys/class/net')
-        ifs = {}
-        if type == "pif":
-            devs = self.Parser.findall(Filter.Network.IFNAME_PIF, devices)
-            for dev in set(devs):
-                ifInst = OvmInterface()
-                ifInst.name = dev
-                ifs[dev] = ifInst
-                
-        elif type == "vlan":
-            devs = self.Parser.findall(Filter.Network.IFNAME_VLAN, devices)
-            for dev in set(devs):
-                ifInst = OvmVlan()
-                ifInst.name = dev
-                (pif, vid) = dev.split('.')
-                ifInst.pif = pif
-                ifInst.vid = vid
-                ifs[dev] = ifInst
-                 
-        elif type == "bridge":
-            devs = self.Parser.findall(Filter.Network.IFNAME_BRIDGE, devices)
-            for dev in set(devs):
-                ifInst = OvmBridge()
-                ifInst.name = dev
-                devs = os.listdir(join('/sys/class/net', dev, 'brif'))
-                ifInst.interfaces = devs
-                attches = self.Parser.findall(Filter.Network.IFNAME_PIF, devs) + self.Parser.findall(Filter.Network.IFNAME_VLAN, devs)
-                if len(attches) > 1: raise Exception("Multiple PIF on bridge %s (%s)"%(dev, attches))
-                elif len(attches) == 0: ifInst.attach = "null"
-                elif len(attches) == 1: ifInst.attach = attches[0]
-                ifs[dev] = ifInst
-
-        return ifs
-    
-    def bringUP(self, ifName):
-        doCmd(['ifconfig', ifName, 'up'])
-    
-    def bringDown(self, ifName):
-        doCmd(['ifconfig', ifName, 'down'])
-           
-    @staticmethod
-    def createBridge(jStr):
-        try:
-            network = OvmNetwork()
-            network._createBridge(toOvmBridge(jStr))
-            return SUCC()
-        except Exception, e:
-            errmsg = fmt_err_msg(e)
-            logger.error(OvmNetwork.createBridge, errmsg)
-            raise XmlRpcFault(toErrCode(OvmNetwork, OvmNetwork.createBridge), errmsg)
-    
-    @staticmethod
-    def deleteBridge(name):
-        try:
-            network = OvmNetwork()
-            network._deleteBridge(name)
-            return SUCC()
-        except Exception, e:
-            errmsg = fmt_err_msg(e)
-            logger.error(OvmNetwork.deleteBridge, errmsg)
-            raise XmlRpcFault(toErrCode(OvmNetwork, OvmNetwork.deleteBridge), errmsg)
-    
-    @staticmethod
-    def getAllBridges():
-        try:
-            network = OvmNetwork()
-            rs = toGson(network._getBridges())
-            logger.debug(OvmNetwork.getAllBridges, rs)
-            return rs
-        except Exception, e:
-            errmsg = fmt_err_msg(e)
-            logger.error(OvmNetwork.getAllBridges, errmsg)
-            raise XmlRpcFault(toErrCode(OvmNetwork, OvmNetwork.getAllBridges), errmsg)
-    
-    @staticmethod
-    def getBridgeByIp(ip):
-        try:
-            routes = doCmd(['ip', 'route']).split('\n')
-            brName = None
-            for r in routes:
-                if ip in r and "xenbr" in r or "vlan" in r:
-                    brName = r.split(' ')[2]
-                    break
-            if not brName: raise Exception("Cannot find bridge with IP %s"%ip)
-            logger.debug(OvmNetwork.getBridgeByIp, "bridge:%s, ip:%s"%(brName, ip))
-            return toGson({"bridge":brName})
-        except Exception, e:
-            errmsg = fmt_err_msg(e)
-            logger.error(OvmNetwork.getBridgeByIp, errmsg)
-            raise XmlRpcFault(toErrCode(OvmNetwork, OvmNetwork.getBridgeByIp), errmsg)              
-    
-    @staticmethod
-    def getVlans():
-        try:
-            network = OvmNetwork()
-            rs = toGson(network._getVlans())
-            logger.debug(OvmNetwork.getVlans, rs)
-            return rs
-        except Exception, e:
-            errmsg = fmt_err_msg(e)
-            logger.error(OvmNetwork.getVlans, errmsg)
-            raise XmlRpcFault(toErrCode(OvmNetwork, OvmNetwork.getVlans), errmsg)                        
-    
-    @staticmethod
-    def createVlan(jStr):
-        try:
-            network = OvmNetwork()
-            vlan = network._createVlan(toOvmVlan(jStr))
-            rs = fromOvmVlan(vlan)
-            logger.debug(OvmNetwork.createVlan, rs)
-            return rs
-        except Exception, e:
-            errmsg = fmt_err_msg(e)
-            logger.error(OvmNetwork.createVlan, errmsg)
-            raise XmlRpcFault(toErrCode(OvmNetwork, OvmNetwork.createVlan), errmsg)
-    
-    @staticmethod
-    def createVlanBridge(bridgeDetails, vlanDetails):
-        try:
-            network = OvmNetwork()
-            v = toOvmVlan(vlanDetails)
-            b = toOvmBridge(bridgeDetails)
-            vlan = network._createVlan(v)
-            b.attach = vlan.name
-            network._createBridge(b)
-            return SUCC()
-        except Exception, e:
-            errmsg = fmt_err_msg(e)
-            logger.error(OvmNetwork.createVlanBridge, errmsg)
-            raise XmlRpcFault(toErrCode(OvmNetwork, OvmNetwork.createVlanBridge), errmsg)
-    
-    @staticmethod
-    def deleteVlanBridge(name):
-        try:
-            network = OvmNetwork()
-            if name not in network.bridges.keys():
-                logger.debug(OvmNetwork.deleteVlanBridge, "No bridge %s found"%name)
-                return SUCC()
-            
-            bridge = network.bridges[name]
-            vlanName = bridge.attach
-            if network._deleteBridge(name):
-                if vlanName != "null":
-                    network._deleteVlan(vlanName)
-                else:
-                    logger.warning(OvmNetwork.deleteVlanBridge, "Bridge %s has no vlan device"%name)
-            return SUCC()
-        except Exception, e:
-            errmsg = fmt_err_msg(e)
-            logger.error(OvmNetwork.deleteVlanBridge, errmsg)
-            raise XmlRpcFault(toErrCode(OvmNetwork, OvmNetwork.deleteVlanBridge), errmsg)
-    
-    @staticmethod
-    def getBridgeDetails(name):
-        try:
-            network = OvmNetwork()
-            if name not in network.bridges.keys():
-                raise Exception("No bridge %s found"%name)
-            bridge = network.bridges[name]
-            rs = fromOvmBridge(bridge)
-            logger.debug(OvmNetwork.getBridgeDetails, rs)
-            return rs
-        except Exception, e:
-            errmsg = fmt_err_msg(e)
-            logger.error(OvmNetwork.getBridgeDetails, errmsg)
-            raise XmlRpcFault(toErrCode(OvmNetwork, OvmNetwork.getBridgeDetails), errmsg)
-           
-    @staticmethod
-    def deleteVlan(name):
-        try:
-            network = OvmNetwork()
-            network._deleteVlan(name)
-            return SUCC()
-        except Exception, e:
-            errmsg = fmt_err_msg(e)
-            logger.error(OvmNetwork.deleteVlan, errmsg)
-            raise XmlRpcFault(toErrCode(OvmNetwork, OvmNetwork.deleteVlan), errmsg)                      
-        
-if __name__ == "__main__":
-    try:
-        OvmNetwork.getBridgeDetails(sys.argv[1])
-        #=======================================================================
-        # txt = json.dumps({"vid":104, "pif":"eth0"})
-        # txt2 = json.dumps({"name":"xapi3", "attach":"eth0.104"})
-        # print nw.createVlan(txt)
-        # print nw.createBridge(txt2)
-        # 
-        # nw.deleteBridge("xapi3")
-        # nw.deleteVlan("eth0.104")
-        #=======================================================================
-        
-    except Exception, e:
-        print e

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e2a32ab4/ovm/scripts/vm/hypervisor/ovm/OvmOCFS2Module.py
----------------------------------------------------------------------
diff --git a/ovm/scripts/vm/hypervisor/ovm/OvmOCFS2Module.py b/ovm/scripts/vm/hypervisor/ovm/OvmOCFS2Module.py
deleted file mode 100755
index 9a8f0eb..0000000
--- a/ovm/scripts/vm/hypervisor/ovm/OvmOCFS2Module.py
+++ /dev/null
@@ -1,76 +0,0 @@
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License.  Citrix Systems, Inc.
-# reserves all rights not expressly granted by 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.
-# 
-# Automatically generated by addcopyright.py at 04/03/2012
-from OvmCommonModule import *
-
-logger = OvmLogger('OvmOCFS2')  
-class OvmOCFS2(OvmObject):
-    def _prepareConf(self, cluster):
-        conf = '''cluster:
-        node_count = 0
-        name = %s
-        '''%cluster
-        dir = dirname(OCFS2_CONF)
-        if not isdir(dir):
-            os.makedirs(dir)
-            
-        fd = open(OCFS2_CONF, 'w')
-        fd.write(conf)
-        fd.close()
-        
-    def _addNode(self, name, nodeNum, ip, port, cluster, isOnline=True):
-        nodePath = '/sys/kernel/config/cluster/%s/node/%s'%(cluster, name)
-        if exists(nodePath):
-            logger.debug(OvmOCFS2._addNode, "node %s already exists, skip it(%s)"%(name, nodePath))
-            return
-        
-        if not isOnline:
-            cmds = ['o2cb_ctl -C -n', name, '-t node', '-a number=%s'%nodeNum, '-a ip_address=%s'%ip, '-a ip_port=%s'%port, '-a cluster=%s'%cluster]
-        else:
-            cmds = ['o2cb_ctl -C -i -n', name, '-t node', '-a number=%s'%nodeNum, '-a ip_address=%s'%ip, '-a ip_port=%s'%port, '-a cluster=%s'%cluster]
-        
-        try:
-            doCmd(cmds)
-        except ShellExceutedFailedException, e:
-            if e.errCode == 239 or "already exists" in e.stderr:
-                logger.debug(OvmOCFS2._addNode, "node %s already exists, skip it(%s)"%(name, e.stderr))
-            else:
-                raise e
-    
-    def _isClusterOnline(self, cluster):
-        cmds = ['service o2cb status', cluster]
-        res = doCmd(cmds)
-        for line in res.split('\n'):
-            if not 'Checking O2CB cluster' in line: continue
-            return not 'Offline' in line
-    
-    def _load(self):
-        cmd = ['service o2cb load']
-        doCmd(cmd)
-        
-    def _start(self, cluster):
-        #blank line are answer by clicking enter
-        config='''
-y
-o2cb
-%s
-
-
-
-
-EOF
-'''%cluster
-        cmd = ['service o2cb configure', '<<EOF', config]
-        doCmd(cmd)
-        cmd = ['service o2cb start %s'%cluster]
-        doCmd(cmd)
-                

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e2a32ab4/ovm/scripts/vm/hypervisor/ovm/OvmObjectModule.py
----------------------------------------------------------------------
diff --git a/ovm/scripts/vm/hypervisor/ovm/OvmObjectModule.py b/ovm/scripts/vm/hypervisor/ovm/OvmObjectModule.py
deleted file mode 100644
index 0d21dae..0000000
--- a/ovm/scripts/vm/hypervisor/ovm/OvmObjectModule.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License.  Citrix Systems, Inc.
-# reserves all rights not expressly granted by 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.
-# 
-# Automatically generated by addcopyright.py at 04/03/2012
-'''
-Created on May 17, 2011
-
-@author: frank
-'''
-
-class OvmObject(object):
-   pass
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e2a32ab4/ovm/scripts/vm/hypervisor/ovm/OvmPatch.patch
----------------------------------------------------------------------
diff --git a/ovm/scripts/vm/hypervisor/ovm/OvmPatch.patch b/ovm/scripts/vm/hypervisor/ovm/OvmPatch.patch
deleted file mode 100644
index 5f4c7a5..0000000
--- a/ovm/scripts/vm/hypervisor/ovm/OvmPatch.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-*** OVSServices.py	2011-06-06 12:31:23.279919998 -0700
---- /tmp/OVSServices.py	2011-06-06 12:32:13.275919997 -0700
-***************
-*** 68,73 ****
---- 68,75 ----
-  import OVSVMXParser                 #pylint:    disable-msg=W0611
-  import OVSVMDKParser                #pylint:    disable-msg=W0611
-  
-+ import OvmDispatcher
-+ 
-  from OVSWrappers import D
-  from OVSCommons import exposed
-  
-***************
-*** 113,118 ****
---- 115,121 ----
-          self.sleep = sleep
-  
-          self._load_modules()
-+         OvmDispatcher.InitOvmDispacther()
-  
-  #        #xenapi
-  #        import xen.xend.XendAPI as XendAPI


Mime
View raw message