cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chipchild...@apache.org
Subject git commit: updated refs/heads/4.1 to 8ea1601
Date Mon, 20 May 2013 18:55:17 GMT
Updated Branches:
  refs/heads/4.1 61e871136 -> 8ea1601bd


CLOUDSTACK-2554: CloudStack fails to load XCP 1.6 hypervisors

Missing default constructor fails the agent manager reloading the XCP
resource on reboot of management server. This is fixed by using the
default constructor as do other Xen resources and include a new resource
ala XenServers for XCP1.6.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
(cherry picked from commit 806aeb990d28179ff532e97dbf64f87cd3d5ca34)

Conflicts:
	plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java

Signed-off-by: Prasanna Santhanam <tsp@apache.org>


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

Branch: refs/heads/4.1
Commit: 8ea1601bd3a9ad04f6f0a6c03be540303d05fef8
Parents: 61e8711
Author: Prasanna Santhanam <tsp@apache.org>
Authored: Sat May 18 11:46:12 2013 +0530
Committer: Chip Childers <chip.childers@gmail.com>
Committed: Mon May 20 19:50:38 2013 +0100

----------------------------------------------------------------------
 .../xen/discoverer/XcpServerDiscoverer.java        |  107 ++++++++-------
 .../hypervisor/xen/resource/CitrixHelper.java      |    4 +-
 .../xen/resource/XcpServer16Resource.java          |   32 +++++
 .../hypervisor/xen/resource/XcpServerResource.java |   55 ++------
 4 files changed, 104 insertions(+), 94 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8ea1601b/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 04982a5..9417d57 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
@@ -16,24 +16,6 @@
 // under the License.
 package com.cloud.hypervisor.xen.discoverer;
 
-import java.net.InetAddress;
-import java.net.URI;
-import java.net.UnknownHostException;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Queue;
-import java.util.Set;
-
-import javax.ejb.Local;
-import javax.inject.Inject;
-import javax.naming.ConfigurationException;
-import javax.persistence.EntityExistsException;
-
-import org.apache.log4j.Logger;
-import org.apache.xmlrpc.XmlRpcException;
-
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.Listener;
 import com.cloud.agent.api.AgentControlAnswer;
@@ -65,6 +47,7 @@ import com.cloud.hypervisor.Hypervisor;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.hypervisor.xen.resource.CitrixResourceBase;
 import com.cloud.hypervisor.xen.resource.XcpOssResource;
+import com.cloud.hypervisor.xen.resource.XcpServer16Resource;
 import com.cloud.hypervisor.xen.resource.XcpServerResource;
 import com.cloud.hypervisor.xen.resource.XenServer56FP1Resource;
 import com.cloud.hypervisor.xen.resource.XenServer56Resource;
@@ -97,6 +80,22 @@ import com.xensource.xenapi.Pool;
 import com.xensource.xenapi.Session;
 import com.xensource.xenapi.Types.SessionAuthenticationFailed;
 import com.xensource.xenapi.Types.XenAPIException;
+import org.apache.log4j.Logger;
+import org.apache.xmlrpc.XmlRpcException;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+import javax.persistence.EntityExistsException;
+import java.net.InetAddress;
+import java.net.URI;
+import java.net.UnknownHostException;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Queue;
+import java.util.Set;
 
 @Local(value=Discoverer.class)
 public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, Listener,
ResourceStateAdapter {
@@ -419,6 +418,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer,
L
     	} else {
     		prodBrand = prodBrand.trim();
     	}
+
     	String prodVersion = record.softwareVersion.get("product_version");
     	if (prodVersion == null) {
     		prodVersion = record.softwareVersion.get("platform_version").trim();
@@ -426,36 +426,35 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer,
L
     		prodVersion = prodVersion.trim();
     	}
 
-        if(prodBrand.equals("XCP") && (prodVersion.equals("1.0.0") ||  prodVersion.equals("1.1.0")
|| prodVersion.equals("5.6.100") || prodVersion.startsWith("1.4"))) {
-            return new XcpServerResource("1.1");
+        // Xen Cloud Platform group of hypervisors
+        if (prodBrand.equals("XCP") && (
+                prodVersion.equals("1.0.0")
+                        || prodVersion.equals("1.1.0")
+                        || prodVersion.equals("5.6.100")
+                        || prodVersion.startsWith("1.4")
+        )) {
+            return new XcpServerResource();
         } else if (prodBrand.equals("XCP") && prodVersion.startsWith("1.6")) {
-        	return new XcpServerResource("1.6");
-        }
-
-    	if(prodBrand.equals("XenServer") && prodVersion.equals("5.6.0")) 
-    		return new XenServer56Resource();
-
-    	if (prodBrand.equals("XenServer") && prodVersion.equals("6.0.0"))
-    		return new XenServer600Resource();
-
-    	if (prodBrand.equals("XenServer") && prodVersion.equals("6.0.2"))
-    		return new XenServer602Resource();
-    	
-        if (prodBrand.equals("XenServer") && prodVersion.equals("6.1.0"))
+            return new XcpServer16Resource();
+        } // Citrix Xenserver group of hypervisors
+        else if (prodBrand.equals("XenServer") && prodVersion.equals("5.6.0"))
+            return new XenServer56Resource();
+        else if (prodBrand.equals("XenServer") && prodVersion.equals("6.0.0"))
+            return new XenServer600Resource();
+        else if (prodBrand.equals("XenServer") && prodVersion.equals("6.0.2"))
+            return new XenServer602Resource();
+        else if (prodBrand.equals("XenServer") && prodVersion.equals("6.1.0"))
             return new XenServer610Resource();
-
-    	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();
-    		} else if("5.6 FP1".equals(prodVersionTextShort)) {
-    			return new XenServer56FP1Resource();
-    		}
-    	}
-    	
-    	if (prodBrand.equals("XCP_Kronos")) {
-    		return new XcpOssResource();
-    	}
+        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();
+            } else if ("5.6 FP1".equals(prodVersionTextShort)) {
+                return new XenServer56FP1Resource();
+            }
+        } else if (prodBrand.equals("XCP_Kronos")) {
+            return new XcpOssResource();
+        }
     	
         String msg = "Only support XCP 1.0.0, 1.1.0, 1.4.x, 1.5 beta, 1.6.x; XenServer 5.6,
 XenServer 5.6 FP1, XenServer 5.6 SP2, Xenserver 6.0, 6.0.2, 6.1.0 but this one is " + prodBrand
+ " " + prodVersion;
     			_alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST, dcId, podId, msg, msg);
@@ -584,10 +583,12 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer,
L
         Map<String, String> details = startup.getHostDetails();
         String prodBrand = details.get("product_brand").trim();
         String prodVersion = details.get("product_version").trim();
-        
-        if(prodBrand.equals("XCP") && (prodVersion.equals("1.0.0") || prodVersion.equals("1.1.0")
|| prodVersion.equals("5.6.100")  || prodVersion.startsWith("1.4") || prodVersion.startsWith("1.6")))
{
+
+        if (prodBrand.equals("XCP") && (prodVersion.equals("1.0.0") || prodVersion.equals("1.1.0")
|| prodVersion.equals("5.6.100") || prodVersion.startsWith("1.4"))) {
             resource = XcpServerResource.class.getName();
-        } else if(prodBrand.equals("XenServer") && prodVersion.equals("5.6.0")) {
+        } else if (prodBrand.equals("XCP") && prodVersion.startsWith("1.6")) {
+            resource = XcpServer16Resource.class.getName();
+        } else if (prodBrand.equals("XenServer") && prodVersion.equals("5.6.0"))
{
             resource = XenServer56Resource.class.getName();
         } else if (prodBrand.equals("XenServer") && prodVersion.equals("6.0.0"))
{
             resource = XenServer600Resource.class.getName();
@@ -595,15 +596,15 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer,
L
             resource = XenServer602Resource.class.getName();
         } else if (prodBrand.equals("XenServer") && prodVersion.equals("6.1.0"))
{
             resource = XenServer610Resource.class.getName();
-        } else if(prodBrand.equals("XenServer") && prodVersion.equals("5.6.100"))
 {
+        } else if (prodBrand.equals("XenServer") && prodVersion.equals("5.6.100"))
{
             String prodVersionTextShort = details.get("product_version_text_short").trim();
-            if("5.6 SP2".equals(prodVersionTextShort)) {
+            if ("5.6 SP2".equals(prodVersionTextShort)) {
                 resource = XenServer56SP2Resource.class.getName();
-            } else if("5.6 FP1".equals(prodVersionTextShort)) {
+            } else if ("5.6 FP1".equals(prodVersionTextShort)) {
                 resource = XenServer56FP1Resource.class.getName();
             }
         } else if (prodBrand.equals("XCP_Kronos")) {
-        	resource = XcpOssResource.class.getName();
+            resource = XcpOssResource.class.getName();
         }
         
         if( resource == null ){

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8ea1601b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixHelper.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixHelper.java
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixHelper.java
index 52641f6..4436fcc 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixHelper.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixHelper.java
@@ -16,11 +16,11 @@
 // under the License.
 package com.cloud.hypervisor.xen.resource;
 
+import org.apache.log4j.Logger;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 
-import org.apache.log4j.Logger;
-
 /**
  * Reduce bloat inside CitrixResourceBase
  *

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8ea1601b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServer16Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServer16Resource.java
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServer16Resource.java
new file mode 100644
index 0000000..8cb7997
--- /dev/null
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServer16Resource.java
@@ -0,0 +1,32 @@
+/*
+ * 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;
+
+public class XcpServer16Resource extends XcpServerResource {
+
+    public XcpServer16Resource() {
+        super();
+    }
+
+    @Override
+    protected String getGuestOsType(String stdType, boolean bootFromCD) {
+        return CitrixHelper.getXcp160GuestOsType(stdType);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8ea1601b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java
index e4fc9ef..51ee305 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java
@@ -16,15 +16,6 @@
 // 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.log4j.Logger;
-import org.apache.xmlrpc.XmlRpcException;
-
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.Command;
 import com.cloud.agent.api.NetworkUsageAnswer;
@@ -33,18 +24,25 @@ import com.cloud.resource.ServerResource;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.script.Script;
 import com.xensource.xenapi.Connection;
-import com.xensource.xenapi.VM;
 import com.xensource.xenapi.Types.XenAPIException;
+import com.xensource.xenapi.VM;
+import org.apache.log4j.Logger;
+import org.apache.xmlrpc.XmlRpcException;
+
+import javax.ejb.Local;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
 
 @Local(value=ServerResource.class)
 public class XcpServerResource extends CitrixResourceBase {
-	  private final static Logger s_logger = Logger.getLogger(XcpServerResource.class);
-	  private String version;
-    public XcpServerResource(String version) {
+    private final static Logger s_logger = Logger.getLogger(XcpServerResource.class);
+    private String version;
+
+    public XcpServerResource() {
         super();
-        this.version = version;
     }
-    
+
     @Override
     public Answer executeRequest(Command cmd) {
         if (cmd instanceof NetworkUsageCommand) {
@@ -53,15 +51,6 @@ public class XcpServerResource extends CitrixResourceBase {
             return super.executeRequest(cmd);
         }
     }
-    
-    @Override
-    protected String getGuestOsType(String stdType, boolean bootFromCD) {
-    	if (version.equalsIgnoreCase("1.6")) {
-    		return CitrixHelper.getXcp160GuestOsType(stdType);
-    	} else {
-    		return CitrixHelper.getXcpGuestOsType(stdType);
-    	}
-    }
 
     @Override
     protected List<File> getPatchFiles() {
@@ -77,19 +66,9 @@ public class XcpServerResource extends CitrixResourceBase {
     }
 
     @Override
-    protected void setMemory(Connection conn, VM vm, long memsize) throws XmlRpcException,
XenAPIException {
-
-        vm.setMemoryStaticMin(conn, 33554432L);
-        vm.setMemoryDynamicMin(conn, 33554432L);
-        vm.setMemoryDynamicMax(conn, 33554432L);
-        vm.setMemoryStaticMax(conn, 33554432L);
-
-        vm.setMemoryStaticMax(conn, memsize);
-        vm.setMemoryDynamicMax(conn, memsize);
-        vm.setMemoryDynamicMin(conn, memsize);
-        vm.setMemoryStaticMin(conn, memsize);
+    protected String getGuestOsType(String stdType, boolean bootFromCD) {
+        return CitrixHelper.getXcpGuestOsType(stdType);
     }
-    
 
     protected NetworkUsageAnswer execute(NetworkUsageCommand cmd) {
         try {
@@ -104,9 +83,7 @@ public class XcpServerResource extends CitrixResourceBase {
             return answer;
         } catch (Exception ex) {
             s_logger.warn("Failed to get network usage stats due to ", ex);
-            return new NetworkUsageAnswer(cmd, ex); 
+            return new NetworkUsageAnswer(cmd, ex);
         }
     }
-
-    
 }


Mime
View raw message