cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject [1/5] git commit: updated refs/heads/CLOUDSTACK-2554 to 76e19d5
Date Sun, 19 May 2013 13:02:54 GMT
Updated Branches:
  refs/heads/CLOUDSTACK-2554 [created] 76e19d5f5


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>


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

Branch: refs/heads/CLOUDSTACK-2554
Commit: 66303b5ee52e1172e19b608e8c8b75a2b9e883d0
Parents: 92b3138
Author: Prasanna Santhanam <tsp@apache.org>
Authored: Sat May 18 11:46:12 2013 +0530
Committer: Prasanna Santhanam <tsp@apache.org>
Committed: Sun May 19 18:26:04 2013 +0530

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66303b5e/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 562a7fe..f0121e7 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;
@@ -79,9 +62,9 @@ import com.cloud.resource.ResourceManager;
 import com.cloud.resource.ResourceStateAdapter;
 import com.cloud.resource.ServerResource;
 import com.cloud.resource.UnableDeleteHostException;
-import com.cloud.storage.VMTemplateVO;
 import com.cloud.storage.Storage.ImageFormat;
 import com.cloud.storage.Storage.TemplateType;
+import com.cloud.storage.VMTemplateVO;
 import com.cloud.storage.dao.VMTemplateDao;
 import com.cloud.storage.dao.VMTemplateHostDao;
 import com.cloud.user.Account;
@@ -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 {
@@ -420,6 +419,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();
@@ -427,36 +427,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);
@@ -585,10 +584,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();
@@ -596,15 +597,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/66303b5e/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 34b8f29..0f71c7b 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/66303b5e/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/66303b5e/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 6baf6a0..77dcb8f 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,6 +66,11 @@ public class XcpServerResource extends CitrixResourceBase {
     }
 
     @Override
+    protected String getGuestOsType(String stdType, boolean bootFromCD) {
+        return CitrixHelper.getXcpGuestOsType(stdType);
+    }
+
+    @Override
     protected void setMemory(Connection conn, VM vm, long minMemsize, long maxMemsize) throws
XmlRpcException, XenAPIException {
 
         vm.setMemoryStaticMin(conn, 33554432L);
@@ -90,7 +84,6 @@ public class XcpServerResource extends CitrixResourceBase {
         //vm.setMemoryStaticMin(conn,  maxMemsize );
     }
     
-
     protected NetworkUsageAnswer execute(NetworkUsageCommand cmd) {
         try {
             Connection conn = getConnection();
@@ -107,6 +100,4 @@ public class XcpServerResource extends CitrixResourceBase {
             return new NetworkUsageAnswer(cmd, ex);
         }
     }
-
-    
 }


Mime
View raw message