cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject git commit: updated refs/heads/2554 to 1cf87ae
Date Sat, 18 May 2013 06:45:53 GMT
Updated Branches:
  refs/heads/2554 [created] 1cf87aece


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 introducing
getter/setter for the prodVersion which determines guestOS maps.

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/1cf87aec
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1cf87aec
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1cf87aec

Branch: refs/heads/2554
Commit: 1cf87aece54b2b2754f60be590445bcdd229ffc2
Parents: 1851f7f
Author: Prasanna Santhanam <tsp@apache.org>
Authored: Sat May 18 11:46:12 2013 +0530
Committer: Prasanna Santhanam <tsp@apache.org>
Committed: Sat May 18 11:46:12 2013 +0530

----------------------------------------------------------------------
 .../xen/discoverer/XcpServerDiscoverer.java        |   87 ++++++++-------
 .../hypervisor/xen/resource/XcpServerResource.java |   56 ++++++----
 2 files changed, 77 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1cf87aec/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..5c04b34 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;
@@ -79,9 +61,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 +79,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 +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();
@@ -427,32 +426,36 @@ 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");
-        } else if (prodBrand.equals("XCP") && prodVersion.startsWith("1.6")) {
-        	return new XcpServerResource("1.6");
+        // 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")
+                        || prodVersion.startsWith("1.6")
+        )) {
+            XcpServerResource xcpresource = new XcpServerResource();
+            xcpresource.setVersion(prodVersion);
+            return xcpresource;
         }
 
-    	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"))
+        // Citrix Xenserver group of hypervisors
+        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();
-    		}
-    	}
+        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();
+            }
+        }
     	
     	if (prodBrand.equals("XCP_Kronos")) {
     		return new XcpOssResource();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1cf87aec/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..00aa8bb 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) {
+
+    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,15 @@ public class XcpServerResource extends CitrixResourceBase {
     }
 
     @Override
+    protected String getGuestOsType(String stdType, boolean bootFromCD) {
+        if (getVersion().startsWith("1.6")) {
+            return CitrixHelper.getXcp160GuestOsType(stdType);
+        } else {
+            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 +88,6 @@ public class XcpServerResource extends CitrixResourceBase {
         //vm.setMemoryStaticMin(conn,  maxMemsize );
     }
     
-
     protected NetworkUsageAnswer execute(NetworkUsageCommand cmd) {
         try {
             Connection conn = getConnection();
@@ -108,5 +105,16 @@ public class XcpServerResource extends CitrixResourceBase {
         }
     }
 
-    
+    /**
+     * Sets the product version of the xen cloud platform.
+     * Used to determine guestOS types supported on the hypervisor
+     * @param version 1.1, 1.0, 1.4, 1.6 etc
+     */
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public String getVersion() {
+        return this.version;
+    }
 }


Mime
View raw message