You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ed...@apache.org on 2013/12/12 02:35:44 UTC

git commit: updated refs/heads/4.2-workplace to f9dd2c9

Updated Branches:
  refs/heads/4.2-workplace 94a537005 -> f9dd2c9d4


only when Xenserver-Vdi-Copy-HotFix tag added on xenserver host, then enable the vdi.copy optimization


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

Branch: refs/heads/4.2-workplace
Commit: f9dd2c9d483ba35768d3b80deefb74f54282ae5a
Parents: 94a5370
Author: Edison Su <su...@gmail.com>
Authored: Wed Dec 11 17:35:22 2013 -0800
Committer: Edison Su <su...@gmail.com>
Committed: Wed Dec 11 17:35:22 2013 -0800

----------------------------------------------------------------------
 .../xen/discoverer/XcpServerDiscoverer.java     | 26 ++++--
 .../xen/resource/XenServer620Resource.java      | 15 +--
 .../xen/resource/Xenserver625Resource.java      | 97 ++++++++++++++++++++
 3 files changed, 115 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f9dd2c9d/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
index 33b69cd..777753b 100755
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
@@ -34,13 +34,6 @@ import javax.persistence.EntityExistsException;
 import org.apache.log4j.Logger;
 import org.apache.xmlrpc.XmlRpcException;
 
-import com.xensource.xenapi.Connection;
-import com.xensource.xenapi.Host;
-import com.xensource.xenapi.Pool;
-import com.xensource.xenapi.Session;
-import com.xensource.xenapi.Types.SessionAuthenticationFailed;
-import com.xensource.xenapi.Types.XenAPIException;
-
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.Listener;
 import com.cloud.agent.api.AgentControlAnswer;
@@ -82,6 +75,7 @@ import com.cloud.hypervisor.xen.resource.XenServer602Resource;
 import com.cloud.hypervisor.xen.resource.XenServer610Resource;
 import com.cloud.hypervisor.xen.resource.XenServer620Resource;
 import com.cloud.hypervisor.xen.resource.XenServerConnectionPool;
+import com.cloud.hypervisor.xen.resource.Xenserver625Resource;
 import com.cloud.resource.Discoverer;
 import com.cloud.resource.DiscovererBase;
 import com.cloud.resource.ResourceManager;
@@ -99,6 +93,12 @@ import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.db.SearchCriteriaService;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.exception.HypervisorVersionChangedException;
+import com.xensource.xenapi.Connection;
+import com.xensource.xenapi.Host;
+import com.xensource.xenapi.Pool;
+import com.xensource.xenapi.Session;
+import com.xensource.xenapi.Types.SessionAuthenticationFailed;
+import com.xensource.xenapi.Types.XenAPIException;
 
 @Local(value=Discoverer.class)
 public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, Listener, ResourceStateAdapter {
@@ -419,6 +419,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
 
     protected CitrixResourceBase createServerResource(long dcId, Long podId, Host.Record record) {
     	String prodBrand = record.softwareVersion.get("product_brand");
+
     	if (prodBrand == null) {
     		prodBrand = record.softwareVersion.get("platform_name").trim();
     	} else {
@@ -451,9 +452,14 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
             return new XenServer602Resource();
         else if (prodBrand.equals("XenServer") && prodVersion.equals("6.1.0"))
             return new XenServer610Resource();
-        else if (prodBrand.equals("XenServer") && (prodVersion.equals("6.2.0") || prodVersion.equals("6.2.50")))
-            return new XenServer620Resource();
-        else if (prodBrand.equals("XenServer") && prodVersion.equals("5.6.100")) {
+        else if (prodBrand.equals("XenServer") && (prodVersion.equals("6.2.0"))) {
+            Set<String> tags =record.tags;
+            if (tags.contains("Xenserver-Vdi-Copy-HotFix")) {
+                return new Xenserver625Resource();
+            } else {
+                return new XenServer620Resource();
+            }
+        }else if (prodBrand.equals("XenServer") && prodVersion.equals("5.6.100")) {
             String prodVersionTextShort = record.softwareVersion.get("product_version_text_short").trim();
             if ("5.6 SP2".equals(prodVersionTextShort)) {
                 return new XenServer56SP2Resource();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f9dd2c9d/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer620Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer620Resource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer620Resource.java
index e623aca..51d7cd0 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer620Resource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer620Resource.java
@@ -24,17 +24,13 @@ import javax.ejb.Local;
 
 import org.apache.log4j.Logger;
 
-import org.apache.cloudstack.hypervisor.xenserver.XenServerResourceNewBase;
-
 import com.cloud.resource.ServerResource;
-import com.cloud.storage.resource.StorageSubsystemCommandHandler;
-import com.cloud.storage.resource.StorageSubsystemCommandHandlerBase;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.script.Script;
 
 
 @Local(value=ServerResource.class)
-public class XenServer620Resource extends XenServerResourceNewBase {
+public class XenServer620Resource extends XenServer610Resource {
     private static final Logger s_logger = Logger.getLogger(XenServer620Resource.class);
 
     public XenServer620Resource() {
@@ -49,7 +45,7 @@ public class XenServer620Resource extends XenServerResourceNewBase {
     @Override
     protected List<File> getPatchFiles() {
         List<File> files = new ArrayList<File>();
-        String patch = "scripts/vm/hypervisor/xenserver/xenserver62/patch";
+        String patch = "scripts/vm/hypervisor/xenserver/xenserver60/patch";
         String patchfilePath = Script.findScript("" , patch);
         if (patchfilePath == null) {
             throw new CloudRuntimeException("Unable to find patch file " + patch);
@@ -87,11 +83,4 @@ public class XenServer620Resource extends XenServerResourceNewBase {
         }
         return dynamicMinRam;
     }
-
-    @Override
-    protected StorageSubsystemCommandHandler getStorageHandler() {
-        XenServerStorageProcessor processor = new Xenserver620StorageProcessor(this);
-        return new StorageSubsystemCommandHandlerBase(processor);
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f9dd2c9d/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/Xenserver625Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/Xenserver625Resource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/Xenserver625Resource.java
new file mode 100644
index 0000000..b4c3340
--- /dev/null
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/Xenserver625Resource.java
@@ -0,0 +1,97 @@
+/*
+ * 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.xen.resource;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.apache.cloudstack.hypervisor.xenserver.XenServerResourceNewBase;
+import org.apache.log4j.Logger;
+
+import com.cloud.resource.ServerResource;
+import com.cloud.storage.resource.StorageSubsystemCommandHandler;
+import com.cloud.storage.resource.StorageSubsystemCommandHandlerBase;
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.utils.script.Script;
+
+@Local(value=ServerResource.class)
+public class Xenserver625Resource extends XenServerResourceNewBase {
+    private static final Logger s_logger = Logger.getLogger(XenServer620Resource.class);
+
+    public Xenserver625Resource() {
+        super();
+    }
+
+    @Override
+    protected String getGuestOsType(String stdType, boolean bootFromCD) {
+        return CitrixHelper.getXenServer620GuestOsType(stdType, bootFromCD);
+    }
+
+    @Override
+    protected List<File> getPatchFiles() {
+        List<File> files = new ArrayList<File>();
+        String patch = "scripts/vm/hypervisor/xenserver/xenserver62/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;
+    }
+
+    @Override
+    public long getStaticMax(String os, boolean b, long dynamicMinRam, long dynamicMaxRam){
+        long recommendedValue = CitrixHelper.getXenServer620StaticMax(os, b);
+        if(recommendedValue == 0){
+            s_logger.warn("No recommended value found for dynamic max, setting static max and dynamic max equal");
+            return dynamicMaxRam;
+        }
+        long staticMax = Math.min(recommendedValue, 4l * dynamicMinRam);  // XS constraint for stability
+        if (dynamicMaxRam > staticMax){ // XS contraint that dynamic max <= static max
+            s_logger.warn("dynamixMax " + dynamicMaxRam + " cant be greater than static max " + staticMax + ", can lead to stability issues. Setting static max as much as dynamic max ");
+            return dynamicMaxRam;
+        }
+        return staticMax;
+    }
+
+    @Override
+    public long getStaticMin(String os, boolean b, long dynamicMinRam, long dynamicMaxRam){
+        long recommendedValue = CitrixHelper.getXenServer620StaticMin(os, b);
+        if(recommendedValue == 0){
+            s_logger.warn("No recommended value found for dynamic min");
+            return dynamicMinRam;
+        }
+
+        if(dynamicMinRam < recommendedValue){   // XS contraint that dynamic min > static min
+            s_logger.warn("Vm is set to dynamixMin " + dynamicMinRam + " less than the recommended static min " + recommendedValue + ", could lead to stability issues");
+        }
+        return dynamicMinRam;
+    }
+
+    @Override
+    protected StorageSubsystemCommandHandler getStorageHandler() {
+        XenServerStorageProcessor processor = new Xenserver620StorageProcessor(this);
+        return new StorageSubsystemCommandHandlerBase(processor);
+    }
+
+}
\ No newline at end of file