cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject git commit: updated refs/heads/master to 06437da
Date Fri, 06 Feb 2015 09:15:31 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 1c616392d -> 06437dadf


CLOUDSTACK-8220: Let's have a separate XenServer 6.5 resource

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


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

Branch: refs/heads/master
Commit: 06437dadf51160252724767fc219de19f96de374
Parents: 1c61639
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Fri Feb 6 14:44:10 2015 +0530
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Fri Feb 6 14:44:10 2015 +0530

----------------------------------------------------------------------
 .../discoverer/XcpServerDiscoverer.java         |   3 +-
 .../xenserver/resource/CitrixResourceBase.java  |   4 +-
 .../resource/XenServer650Resource.java          |  50 +++
 .../hypervisor/xenserver/cloud-plugin-storage   | 301 +++++++++++++++++++
 scripts/vm/hypervisor/xenserver/vmops           |   2 +
 .../xenserver/xenserver62/cloud-plugin-storage  | 301 -------------------
 .../vm/hypervisor/xenserver/xenserver62/patch   |   6 +-
 .../vm/hypervisor/xenserver/xenserver65/patch   |  66 ++++
 8 files changed, 426 insertions(+), 307 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/06437dad/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java
b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java
index bbd5376..ad47359 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java
@@ -56,6 +56,7 @@ import com.cloud.hypervisor.xenserver.resource.XenServer620Resource;
 import com.cloud.hypervisor.xenserver.resource.XenServer620SP1Resource;
 import com.cloud.hypervisor.xenserver.resource.XenServerConnectionPool;
 import com.cloud.hypervisor.xenserver.resource.Xenserver625Resource;
+import com.cloud.hypervisor.xenserver.resource.XenServer650Resource;
 import com.cloud.resource.Discoverer;
 import com.cloud.resource.DiscovererBase;
 import com.cloud.resource.ResourceStateAdapter;
@@ -411,7 +412,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer,
L
         else if (prodBrand.equals("XenServer") && prodVersion.equals("6.1.0"))
             return new XenServer610Resource();
         else if (prodBrand.equals("XenServer") && prodVersion.equals("6.5.0"))
-            return new Xenserver625Resource();
+            return new Xenserver650Resource();
         else if (prodBrand.equals("XenServer") && prodVersion.equals("6.2.0")) {
             if (hotfix != null && hotfix.equals(XenserverConfigs.XSHotFix62ESP1004))
{
                 return new Xenserver625Resource();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/06437dad/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
index a3c894d..0d2d473 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
@@ -1346,9 +1346,9 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
             if (vmSpec.isEnableDynamicallyScaleVm() && !isDmcEnabled(conn, host))
{
                 s_logger.warn("Host " + host.getHostname(conn) + " does not support dynamic
scaling, so the vm " + vmSpec.getName() + " is not dynamically scalable");
             }
-            vmr.memoryStaticMin = vmSpec.getMaxRam();
+            vmr.memoryStaticMin = vmSpec.getMinRam();
             vmr.memoryStaticMax = vmSpec.getMaxRam();
-            vmr.memoryDynamicMin = vmSpec.getMaxRam();;
+            vmr.memoryDynamicMin = vmSpec.getMinRam();;
             vmr.memoryDynamicMax = vmSpec.getMaxRam();
 
             vmr.VCPUsMax = (long) vmSpec.getCpus();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/06437dad/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer650Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer650Resource.java
b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer650Resource.java
new file mode 100644
index 0000000..4fa82a8
--- /dev/null
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer650Resource.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.cloud.hypervisor.xenserver.resource;
+
+import com.cloud.resource.ServerResource;
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.utils.script.Script;
+import org.apache.log4j.Logger;
+
+import javax.ejb.Local;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+@Local(value=ServerResource.class)
+public class XenServer650Resource extends Xenserver625Resource {
+    private static final Logger s_logger = Logger.getLogger(XenServer650Resource.class);
+
+    public XenServer650Resource() {
+        super();
+    }
+
+    protected List<File> getPatchFiles() {
+        List files = new ArrayList();
+        String patch = "scripts/vm/hypervisor/xenserver/xenserver65/patch";
+        String patchfilePath = Script.findScript("", patch);
+        if (patchfilePath == null) {
+            throw new CloudRuntimeException("Unable to find patch file " + patch);
+        }
+        File file = new File(patchfilePath);
+        files.add(file);
+        return files;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/06437dad/scripts/vm/hypervisor/xenserver/cloud-plugin-storage
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/cloud-plugin-storage b/scripts/vm/hypervisor/xenserver/cloud-plugin-storage
new file mode 100644
index 0000000..207d4f4
--- /dev/null
+++ b/scripts/vm/hypervisor/xenserver/cloud-plugin-storage
@@ -0,0 +1,301 @@
+#!/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.
+
+# Version @VERSION@
+#
+# A plugin for executing script needed by vmops cloud 
+
+import os, sys, time
+import XenAPIPlugin
+if os.path.exists("/opt/xensource/sm"):
+    sys.path.extend(["/opt/xensource/sm/", "/usr/local/sbin/", "/sbin/"])
+if os.path.exists("/usr/lib/xcp/sm"):
+    sys.path.extend(["/usr/lib/xcp/sm/", "/usr/local/sbin/", "/sbin/"])
+
+import SR, VDI, SRCommand, util, lvutil
+from util import CommandException
+import vhdutil
+import shutil
+import lvhdutil
+import errno
+import subprocess
+import xs_errors
+import cleanup
+import stat
+import random
+import cloudstack_pluginlib as lib
+import logging
+
+lib.setup_logging("/var/log/cloud/cloud.log")
+
+VHDUTIL = "vhd-util"
+VHD_PREFIX = 'VHD-'
+CLOUD_DIR = '/var/run/cloud_mount'
+
+def echo(fn):
+    def wrapped(*v, **k):
+        name = fn.__name__
+        logging.debug("#### CLOUD enter  %s ####" % name )
+        res = fn(*v, **k)
+        logging.debug("#### CLOUD exit  %s ####" % name )
+        return res
+    return wrapped
+
+def getPrimarySRPath(primaryStorageSRUuid, isISCSI):
+    if isISCSI:
+        primarySRDir = lvhdutil.VG_PREFIX + primaryStorageSRUuid
+        return os.path.join(lvhdutil.VG_LOCATION, primarySRDir)
+    else:
+        return os.path.join(SR.MOUNT_BASE, primaryStorageSRUuid)
+
+def getBackupVHD(UUID):
+    return UUID + '.' + SR.DEFAULT_TAP
+
+def getVHD(UUID, isISCSI):
+    if isISCSI:
+        return VHD_PREFIX + UUID
+    else:
+        return UUID + '.' + SR.DEFAULT_TAP
+
+def getIsTrueString(stringValue):
+    booleanValue = False
+    if (stringValue and stringValue == 'true'):
+        booleanValue = True
+    return booleanValue
+
+def makeUnavailable(uuid, primarySRPath, isISCSI):
+    if not isISCSI:
+        return
+    VHD = getVHD(uuid, isISCSI)
+    path = os.path.join(primarySRPath, VHD)
+    manageAvailability(path, '-an')
+    return
+
+def manageAvailability(path, value):
+    if path.__contains__("/var/run/sr-mount"):
+        return
+    logging.debug("Setting availability of " + path + " to " + value)
+    try:
+        cmd = ['/usr/sbin/lvchange', value, path]
+        util.pread2(cmd)
+    except: #CommandException, (rc, cmdListStr, stderr):
+        #errMsg = "CommandException thrown while executing: " + cmdListStr + " with return
code: " + str(rc) + " and stderr: " + stderr
+        errMsg = "Unexpected exception thrown by lvchange"
+        logging.debug(errMsg)
+        if value == "-ay":
+            # Raise an error only if we are trying to make it available.
+            # Just warn if we are trying to make it unavailable after the
+            # snapshot operation is done.
+            raise xs_errors.XenError(errMsg)
+    return
+
+
+def checkVolumeAvailablility(path):
+    try:
+        if not isVolumeAvailable(path):
+            # The VHD file is not available on XenSever. The volume is probably
+            # inactive or detached.
+            # Do lvchange -ay to make it available on XenServer
+            manageAvailability(path, '-ay')
+    except:
+        errMsg = "Could not determine status of ISCSI path: " + path
+        logging.debug(errMsg)
+        raise xs_errors.XenError(errMsg)
+
+    success = False
+    i = 0
+    while i < 6:
+        i = i + 1
+        # Check if the vhd is actually visible by checking for the link
+        # set isISCSI to true
+        success = isVolumeAvailable(path)
+        if success:
+            logging.debug("Made vhd: " + path + " available and confirmed that it is visible")
+            break
+
+        # Sleep for 10 seconds before checking again.
+        time.sleep(10)
+
+    # If not visible within 1 min fail
+    if not success:
+        logging.debug("Could not make vhd: " +  path + " available despite waiting for 1
minute. Does it exist?")
+
+    return success
+
+def isVolumeAvailable(path):
+    # Check if iscsi volume is available on this XenServer.
+    status = "0"
+    try:
+        p = subprocess.Popen(["/bin/bash", "-c", "if [ -L " + path + " ]; then echo 1; else
echo 0;fi"], stdout=subprocess.PIPE)
+        status = p.communicate()[0].strip("\n")
+    except:
+        errMsg = "Could not determine status of ISCSI path: " + path
+        logging.debug(errMsg)
+        raise xs_errors.XenError(errMsg)
+
+    return (status == "1")
+
+def scanParent(path):
+    # Do a scan for the parent for ISCSI volumes
+    # Note that the parent need not be visible on the XenServer
+    parentUUID = ''
+    try:
+        lvName = os.path.basename(path)
+        dirname = os.path.dirname(path)
+        vgName = os.path.basename(dirname)
+        vhdInfo = vhdutil.getVHDInfoLVM(lvName, lvhdutil.extractUuid, vgName)
+        parentUUID = vhdInfo.parentUuid
+    except:
+        errMsg = "Could not get vhd parent of " + path
+        logging.debug(errMsg)
+        raise xs_errors.XenError(errMsg)
+    return parentUUID
+
+def getParentOfSnapshot(snapshotUuid, primarySRPath, isISCSI):
+    snapshotVHD    = getVHD(snapshotUuid, isISCSI)
+    snapshotPath   = os.path.join(primarySRPath, snapshotVHD)
+
+    baseCopyUuid = ''
+    if isISCSI:
+        checkVolumeAvailablility(snapshotPath)
+        baseCopyUuid = scanParent(snapshotPath)
+    else:
+        baseCopyUuid = getParent(snapshotPath, isISCSI)
+
+    logging.debug("Base copy of snapshotUuid: " + snapshotUuid + " is " + baseCopyUuid)
+    return baseCopyUuid
+
+def getParent(path, isISCSI):
+    parentUUID = ''
+    try :
+        if isISCSI:
+            parentUUID = vhdutil.getParent(path, lvhdutil.extractUuid)
+        else:
+            parentUUID = vhdutil.getParent(path, cleanup.FileVDI.extractUuid)
+    except:
+        errMsg = "Could not get vhd parent of " + path
+        logging.debug(errMsg)
+        raise xs_errors.XenError(errMsg)
+    return parentUUID
+
+def getVhdParent(session, args):
+    logging.debug("getParent with " + str(args))
+    try:
+        primaryStorageSRUuid      = args['primaryStorageSRUuid']
+        snapshotUuid              = args['snapshotUuid']
+        isISCSI                   = getIsTrueString(args['isISCSI'])
+
+        primarySRPath = getPrimarySRPath(primaryStorageSRUuid, isISCSI)
+        logging.debug("primarySRPath: " + primarySRPath)
+
+        baseCopyUuid = getParentOfSnapshot(snapshotUuid, primarySRPath, isISCSI)
+
+        return  baseCopyUuid
+    except:
+        logging.debug('getVhdParent', exc_info=True)
+        raise xs_errors.XenError("Failed to getVhdParent")
+def makedirs(path):
+    if not os.path.isdir(path):
+        try:
+            os.makedirs(path)
+        except OSError, (errno, strerror):
+            umount(path)
+            if os.path.isdir(path):
+                return
+            errMsg = "OSError while creating " + path + " with errno: " + str(errno) + "
and strerr: " + strerror
+            logging.debug(errMsg)
+            raise xs_errors.XenError(errMsg)
+    return
+
+def umount(localDir):
+    try:
+        cmd = ['umount', localDir]
+        util.pread2(cmd)
+    except CommandException:
+        errMsg = "CommandException raised while trying to umount " + localDir
+        logging.debug(errMsg)
+        raise xs_errors.XenError(errMsg)
+
+    logging.debug("Successfully unmounted " + localDir)
+    return
+
+@echo
+def mountNfsSecondaryStorage(session, args):
+    remoteDir = args['remoteDir']
+    localDir  = args['localDir']
+    mounted = False
+    f = open("/proc/mounts", 'r')
+    for line in f:
+        tokens = line.split(" ")
+        if len(tokens) > 2 and tokens[0] == remoteDir and tokens[1] == localDir:
+            mounted = True
+
+    if mounted:
+        return "true"
+
+    makedirs(localDir)
+    options = "soft,tcp,timeo=133,retrans=1"
+    try:
+        cmd = ['mount', '-o', options, remoteDir, localDir]
+        txt = util.pread2(cmd)
+    except:
+        txt = ''
+        errMsg = "Unexpected error while trying to mount " + remoteDir + " to " + localDir
+        logging.debug(errMsg)
+        raise xs_errors.XenError(errMsg)
+    logging.debug("Successfully mounted " + remoteDir + " to " + localDir)
+
+    return "true"
+
+@echo
+def umountNfsSecondaryStorage(session, args):
+    localDir = args['localDir']
+    try:
+        cmd = ['umount', localDir]
+        util.pread2(cmd)
+    except CommandException:
+        errMsg = "CommandException raised while trying to umount " + localDir
+        logging.debug(errMsg)
+        raise xs_errors.XenError(errMsg)
+    try:
+        os.system("rmdir " + localDir)
+    except:
+        pass
+    logging.debug("Successfully unmounted " + localDir)
+    return "true"
+
+@echo
+def makeDirectory(session, args):
+    path = args['path']
+    if not os.path.isdir(path):
+        try:
+            os.makedirs(path)
+        except OSError, (errno, strerror):
+            if os.path.isdir(path):
+                return "true"
+            errMsg = "OSError while creating " + path + " with errno: " + str(errno) + "
and strerr: " + strerror
+            logging.debug(errMsg)
+            raise xs_errors.XenError(errMsg)
+    return "true"
+
+if __name__ == "__main__":
+    XenAPIPlugin.dispatch({"getVhdParent":getVhdParent, "mountNfsSecondaryStorage":mountNfsSecondaryStorage,
+        "umountNfsSecondaryStorage":umountNfsSecondaryStorage,
+        "makeDirectory":makeDirectory})
+    
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/06437dad/scripts/vm/hypervisor/xenserver/vmops
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/vmops b/scripts/vm/hypervisor/xenserver/vmops
index f224c1d..62a60bb 100755
--- a/scripts/vm/hypervisor/xenserver/vmops
+++ b/scripts/vm/hypervisor/xenserver/vmops
@@ -780,6 +780,8 @@ def default_network_rules(session, args):
         util.pread2(['iptables', '-F', vmchain_default])        
 
     vmipset = vm_name
+    if len(vmipset) > 28:
+        vmipset = vmipset[0:27]
     #create ipset and add vm ips to that ip set
     if create_ipset_forvm(vmipset) == False:
        logging.debug(" failed to create ipset for rule " + str(tokens))

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/06437dad/scripts/vm/hypervisor/xenserver/xenserver62/cloud-plugin-storage
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xenserver62/cloud-plugin-storage b/scripts/vm/hypervisor/xenserver/xenserver62/cloud-plugin-storage
deleted file mode 100644
index 207d4f4..0000000
--- a/scripts/vm/hypervisor/xenserver/xenserver62/cloud-plugin-storage
+++ /dev/null
@@ -1,301 +0,0 @@
-#!/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.
-
-# Version @VERSION@
-#
-# A plugin for executing script needed by vmops cloud 
-
-import os, sys, time
-import XenAPIPlugin
-if os.path.exists("/opt/xensource/sm"):
-    sys.path.extend(["/opt/xensource/sm/", "/usr/local/sbin/", "/sbin/"])
-if os.path.exists("/usr/lib/xcp/sm"):
-    sys.path.extend(["/usr/lib/xcp/sm/", "/usr/local/sbin/", "/sbin/"])
-
-import SR, VDI, SRCommand, util, lvutil
-from util import CommandException
-import vhdutil
-import shutil
-import lvhdutil
-import errno
-import subprocess
-import xs_errors
-import cleanup
-import stat
-import random
-import cloudstack_pluginlib as lib
-import logging
-
-lib.setup_logging("/var/log/cloud/cloud.log")
-
-VHDUTIL = "vhd-util"
-VHD_PREFIX = 'VHD-'
-CLOUD_DIR = '/var/run/cloud_mount'
-
-def echo(fn):
-    def wrapped(*v, **k):
-        name = fn.__name__
-        logging.debug("#### CLOUD enter  %s ####" % name )
-        res = fn(*v, **k)
-        logging.debug("#### CLOUD exit  %s ####" % name )
-        return res
-    return wrapped
-
-def getPrimarySRPath(primaryStorageSRUuid, isISCSI):
-    if isISCSI:
-        primarySRDir = lvhdutil.VG_PREFIX + primaryStorageSRUuid
-        return os.path.join(lvhdutil.VG_LOCATION, primarySRDir)
-    else:
-        return os.path.join(SR.MOUNT_BASE, primaryStorageSRUuid)
-
-def getBackupVHD(UUID):
-    return UUID + '.' + SR.DEFAULT_TAP
-
-def getVHD(UUID, isISCSI):
-    if isISCSI:
-        return VHD_PREFIX + UUID
-    else:
-        return UUID + '.' + SR.DEFAULT_TAP
-
-def getIsTrueString(stringValue):
-    booleanValue = False
-    if (stringValue and stringValue == 'true'):
-        booleanValue = True
-    return booleanValue
-
-def makeUnavailable(uuid, primarySRPath, isISCSI):
-    if not isISCSI:
-        return
-    VHD = getVHD(uuid, isISCSI)
-    path = os.path.join(primarySRPath, VHD)
-    manageAvailability(path, '-an')
-    return
-
-def manageAvailability(path, value):
-    if path.__contains__("/var/run/sr-mount"):
-        return
-    logging.debug("Setting availability of " + path + " to " + value)
-    try:
-        cmd = ['/usr/sbin/lvchange', value, path]
-        util.pread2(cmd)
-    except: #CommandException, (rc, cmdListStr, stderr):
-        #errMsg = "CommandException thrown while executing: " + cmdListStr + " with return
code: " + str(rc) + " and stderr: " + stderr
-        errMsg = "Unexpected exception thrown by lvchange"
-        logging.debug(errMsg)
-        if value == "-ay":
-            # Raise an error only if we are trying to make it available.
-            # Just warn if we are trying to make it unavailable after the
-            # snapshot operation is done.
-            raise xs_errors.XenError(errMsg)
-    return
-
-
-def checkVolumeAvailablility(path):
-    try:
-        if not isVolumeAvailable(path):
-            # The VHD file is not available on XenSever. The volume is probably
-            # inactive or detached.
-            # Do lvchange -ay to make it available on XenServer
-            manageAvailability(path, '-ay')
-    except:
-        errMsg = "Could not determine status of ISCSI path: " + path
-        logging.debug(errMsg)
-        raise xs_errors.XenError(errMsg)
-
-    success = False
-    i = 0
-    while i < 6:
-        i = i + 1
-        # Check if the vhd is actually visible by checking for the link
-        # set isISCSI to true
-        success = isVolumeAvailable(path)
-        if success:
-            logging.debug("Made vhd: " + path + " available and confirmed that it is visible")
-            break
-
-        # Sleep for 10 seconds before checking again.
-        time.sleep(10)
-
-    # If not visible within 1 min fail
-    if not success:
-        logging.debug("Could not make vhd: " +  path + " available despite waiting for 1
minute. Does it exist?")
-
-    return success
-
-def isVolumeAvailable(path):
-    # Check if iscsi volume is available on this XenServer.
-    status = "0"
-    try:
-        p = subprocess.Popen(["/bin/bash", "-c", "if [ -L " + path + " ]; then echo 1; else
echo 0;fi"], stdout=subprocess.PIPE)
-        status = p.communicate()[0].strip("\n")
-    except:
-        errMsg = "Could not determine status of ISCSI path: " + path
-        logging.debug(errMsg)
-        raise xs_errors.XenError(errMsg)
-
-    return (status == "1")
-
-def scanParent(path):
-    # Do a scan for the parent for ISCSI volumes
-    # Note that the parent need not be visible on the XenServer
-    parentUUID = ''
-    try:
-        lvName = os.path.basename(path)
-        dirname = os.path.dirname(path)
-        vgName = os.path.basename(dirname)
-        vhdInfo = vhdutil.getVHDInfoLVM(lvName, lvhdutil.extractUuid, vgName)
-        parentUUID = vhdInfo.parentUuid
-    except:
-        errMsg = "Could not get vhd parent of " + path
-        logging.debug(errMsg)
-        raise xs_errors.XenError(errMsg)
-    return parentUUID
-
-def getParentOfSnapshot(snapshotUuid, primarySRPath, isISCSI):
-    snapshotVHD    = getVHD(snapshotUuid, isISCSI)
-    snapshotPath   = os.path.join(primarySRPath, snapshotVHD)
-
-    baseCopyUuid = ''
-    if isISCSI:
-        checkVolumeAvailablility(snapshotPath)
-        baseCopyUuid = scanParent(snapshotPath)
-    else:
-        baseCopyUuid = getParent(snapshotPath, isISCSI)
-
-    logging.debug("Base copy of snapshotUuid: " + snapshotUuid + " is " + baseCopyUuid)
-    return baseCopyUuid
-
-def getParent(path, isISCSI):
-    parentUUID = ''
-    try :
-        if isISCSI:
-            parentUUID = vhdutil.getParent(path, lvhdutil.extractUuid)
-        else:
-            parentUUID = vhdutil.getParent(path, cleanup.FileVDI.extractUuid)
-    except:
-        errMsg = "Could not get vhd parent of " + path
-        logging.debug(errMsg)
-        raise xs_errors.XenError(errMsg)
-    return parentUUID
-
-def getVhdParent(session, args):
-    logging.debug("getParent with " + str(args))
-    try:
-        primaryStorageSRUuid      = args['primaryStorageSRUuid']
-        snapshotUuid              = args['snapshotUuid']
-        isISCSI                   = getIsTrueString(args['isISCSI'])
-
-        primarySRPath = getPrimarySRPath(primaryStorageSRUuid, isISCSI)
-        logging.debug("primarySRPath: " + primarySRPath)
-
-        baseCopyUuid = getParentOfSnapshot(snapshotUuid, primarySRPath, isISCSI)
-
-        return  baseCopyUuid
-    except:
-        logging.debug('getVhdParent', exc_info=True)
-        raise xs_errors.XenError("Failed to getVhdParent")
-def makedirs(path):
-    if not os.path.isdir(path):
-        try:
-            os.makedirs(path)
-        except OSError, (errno, strerror):
-            umount(path)
-            if os.path.isdir(path):
-                return
-            errMsg = "OSError while creating " + path + " with errno: " + str(errno) + "
and strerr: " + strerror
-            logging.debug(errMsg)
-            raise xs_errors.XenError(errMsg)
-    return
-
-def umount(localDir):
-    try:
-        cmd = ['umount', localDir]
-        util.pread2(cmd)
-    except CommandException:
-        errMsg = "CommandException raised while trying to umount " + localDir
-        logging.debug(errMsg)
-        raise xs_errors.XenError(errMsg)
-
-    logging.debug("Successfully unmounted " + localDir)
-    return
-
-@echo
-def mountNfsSecondaryStorage(session, args):
-    remoteDir = args['remoteDir']
-    localDir  = args['localDir']
-    mounted = False
-    f = open("/proc/mounts", 'r')
-    for line in f:
-        tokens = line.split(" ")
-        if len(tokens) > 2 and tokens[0] == remoteDir and tokens[1] == localDir:
-            mounted = True
-
-    if mounted:
-        return "true"
-
-    makedirs(localDir)
-    options = "soft,tcp,timeo=133,retrans=1"
-    try:
-        cmd = ['mount', '-o', options, remoteDir, localDir]
-        txt = util.pread2(cmd)
-    except:
-        txt = ''
-        errMsg = "Unexpected error while trying to mount " + remoteDir + " to " + localDir
-        logging.debug(errMsg)
-        raise xs_errors.XenError(errMsg)
-    logging.debug("Successfully mounted " + remoteDir + " to " + localDir)
-
-    return "true"
-
-@echo
-def umountNfsSecondaryStorage(session, args):
-    localDir = args['localDir']
-    try:
-        cmd = ['umount', localDir]
-        util.pread2(cmd)
-    except CommandException:
-        errMsg = "CommandException raised while trying to umount " + localDir
-        logging.debug(errMsg)
-        raise xs_errors.XenError(errMsg)
-    try:
-        os.system("rmdir " + localDir)
-    except:
-        pass
-    logging.debug("Successfully unmounted " + localDir)
-    return "true"
-
-@echo
-def makeDirectory(session, args):
-    path = args['path']
-    if not os.path.isdir(path):
-        try:
-            os.makedirs(path)
-        except OSError, (errno, strerror):
-            if os.path.isdir(path):
-                return "true"
-            errMsg = "OSError while creating " + path + " with errno: " + str(errno) + "
and strerr: " + strerror
-            logging.debug(errMsg)
-            raise xs_errors.XenError(errMsg)
-    return "true"
-
-if __name__ == "__main__":
-    XenAPIPlugin.dispatch({"getVhdParent":getVhdParent, "mountNfsSecondaryStorage":mountNfsSecondaryStorage,
-        "umountNfsSecondaryStorage":umountNfsSecondaryStorage,
-        "makeDirectory":makeDirectory})
-    
-

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/06437dad/scripts/vm/hypervisor/xenserver/xenserver62/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xenserver62/patch b/scripts/vm/hypervisor/xenserver/xenserver62/patch
index 03cdfad..939e97c 100644
--- a/scripts/vm/hypervisor/xenserver/xenserver62/patch
+++ b/scripts/vm/hypervisor/xenserver/xenserver62/patch
@@ -5,9 +5,9 @@
 # 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
@@ -34,7 +34,7 @@ ovs-vif-flows.py=..,0755,/etc/xapi.d/plugins
 cloudstack_plugins.conf=..,0644,/etc/xensource
 cloudstack_pluginlib.py=..,0755,/etc/xapi.d/plugins
 ovstunnel=..,0755,/etc/xapi.d/plugins
-cloud-plugin-storage=,0755,/etc/xapi.d/plugins
+cloud-plugin-storage=..,0755,/etc/xapi.d/plugins
 systemvm.iso=../../../../../vms,0644,/opt/xensource/packages/iso
 id_rsa.cloud=../../../systemvm,0600,/root/.ssh
 network_info.sh=..,0755,/opt/cloud/bin

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/06437dad/scripts/vm/hypervisor/xenserver/xenserver65/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xenserver65/patch b/scripts/vm/hypervisor/xenserver/xenserver65/patch
new file mode 100644
index 0000000..939e97c
--- /dev/null
+++ b/scripts/vm/hypervisor/xenserver/xenserver65/patch
@@ -0,0 +1,66 @@
+# 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.
+
+# This file specifies the files that need
+# to be transferred over to the XenServer.
+# The format of this file is as follows:
+# [Name of file]=[source path],[file permission],[destination path]
+# [destination path] is required.
+# If [file permission] is missing, 755 is assumed.
+# If [source path] is missing, it looks in the same
+# directory as the patch file.
+# If [source path] starts with '/', then it is absolute path.
+# If [source path] starts with '~', then it is path relative to management server home directory.
+# If [source path] does not start with '/' or '~', then it is relative path to the location
of the patch file. 
+vmops=..,0755,/etc/xapi.d/plugins
+vmopspremium=..,0755,/etc/xapi.d/plugins
+vmopsSnapshot=..,0755,/etc/xapi.d/plugins
+xen-ovs-vif-flows.rules=..,0644,/etc/udev/rules.d
+ovs-vif-flows.py=..,0755,/etc/xapi.d/plugins
+cloudstack_plugins.conf=..,0644,/etc/xensource
+cloudstack_pluginlib.py=..,0755,/etc/xapi.d/plugins
+ovstunnel=..,0755,/etc/xapi.d/plugins
+cloud-plugin-storage=..,0755,/etc/xapi.d/plugins
+systemvm.iso=../../../../../vms,0644,/opt/xensource/packages/iso
+id_rsa.cloud=../../../systemvm,0600,/root/.ssh
+network_info.sh=..,0755,/opt/cloud/bin
+setupxenserver.sh=..,0755,/opt/cloud/bin
+make_migratable.sh=..,0755,/opt/cloud/bin
+setup_iscsi.sh=..,0755,/opt/cloud/bin
+pingtest.sh=../../..,0755,/opt/cloud/bin
+router_proxy.sh=../../../../network/domr/,0755,/opt/cloud/bin
+cloud-setup-bonding.sh=..,0755,/opt/cloud/bin
+kill_copy_process.sh=..,0755,/opt/cloud/bin
+setup_heartbeat_sr.sh=..,0755,/opt/cloud/bin
+setup_heartbeat_file.sh=..,0755,/opt/cloud/bin
+check_heartbeat.sh=..,0755,/opt/cloud/bin
+xenheartbeat.sh=..,0755,/opt/cloud/bin
+launch_hb.sh=..,0755,/opt/cloud/bin
+upgrade_snapshot.sh=..,0755,/opt/cloud/bin
+cloud-clean-vlan.sh=..,0755,/opt/cloud/bin
+cloud-prepare-upgrade.sh=..,0755,/opt/cloud/bin
+swift=..,0755,/opt/cloud/bin
+swiftxen=..,0755,/etc/xapi.d/plugins
+s3xen=..,0755,/etc/xapi.d/plugins
+add_to_vcpus_params_live.sh=..,0755,/opt/cloud/bin
+ovs-pvlan=..,0755,/etc/xapi.d/plugins
+ovs-pvlan-dhcp-host.sh=../../../network,0755,/opt/cloud/bin
+ovs-pvlan-vm.sh=../../../network,0755,/opt/cloud/bin
+ovs-pvlan-cleanup.sh=../../../network,0755,/opt/cloud/bin
+ovs-get-dhcp-iface.sh=..,0755,/opt/cloud/bin
+ovs-get-bridge.sh=..,0755,/opt/cloud/bin
+cloudlog=..,0644,/etc/logrotate.d


Mime
View raw message