cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject [12/39] git commit: updated refs/heads/vpc-toolkit-hugo to 34bed5f
Date Thu, 17 Jul 2014 08:10:56 GMT
CLOUDSTACK-6358: Missing patches in master branch


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

Branch: refs/heads/vpc-toolkit-hugo
Commit: 6831ed4026c47870b40d1dea0b0f9d0e71d9d37d
Parents: a49bb7e
Author: amoghvk <amogh.vasekar@citrix.com>
Authored: Mon Jul 14 15:17:58 2014 -0700
Committer: amoghvk <amogh.vasekar@citrix.com>
Committed: Mon Jul 14 15:17:58 2014 -0700

----------------------------------------------------------------------
 .../cloud/agent/api/to/VirtualMachineTO.java    | 17 +++++--
 .../cloud/agent/api/VMSnapshotBaseCommand.java  | 11 ++++-
 .../vmsnapshot/DefaultVMSnapshotStrategy.java   | 14 ++++++
 .../test/src/VMSnapshotStrategyTest.java        | 52 ++++++++++++++++++++
 .../storage/helper/HypervisorHelperImpl.java    | 11 +++++
 .../src/com/cloud/hypervisor/XenServerGuru.java | 27 ++++++----
 .../xenserver/resource/CitrixResourceBase.java  | 17 ++++---
 .../xenserver/resource/XcpOssResource.java      | 26 ++++++----
 .../xenserver/resource/XcpServer16Resource.java | 11 ++++-
 .../xenserver/resource/XcpServerResource.java   |  8 ++-
 .../resource/XenServer56FP1Resource.java        | 13 ++++-
 .../xenserver/resource/XenServer56Resource.java | 48 +++++++++++-------
 .../resource/XenServer56SP2Resource.java        | 13 ++++-
 .../resource/XenServer600Resource.java          | 13 ++++-
 .../resource/XenServer602Resource.java          | 15 +++++-
 .../resource/XenServer610Resource.java          | 13 ++++-
 .../resource/XenServer620Resource.java          | 26 +++++++---
 .../resource/XenServer620SP1Resource.java       | 32 +++++++-----
 .../resource/Xenserver625Resource.java          | 15 ++++--
 19 files changed, 297 insertions(+), 85 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6831ed40/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/to/VirtualMachineTO.java b/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
index bbd8385..a1d9452 100644
--- a/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
+++ b/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
@@ -47,6 +47,7 @@ public class VirtualMachineTO {
     String hostName;
     String arch;
     String os;
+    String platformEmulator;
     String bootArgs;
     String[] bootupScripts;
     boolean rebootOnCrash;
@@ -65,7 +66,7 @@ public class VirtualMachineTO {
     public VirtualMachineTO(long id, String instanceName, VirtualMachine.Type type, int cpus, Integer speed, long minRam, long maxRam, BootloaderType bootloader,
             String os, boolean enableHA, boolean limitCpuUse, String vncPassword) {
         this.id = id;
-        this.name = instanceName;
+        name = instanceName;
         this.type = type;
         this.cpus = cpus;
         this.speed = speed;
@@ -81,7 +82,7 @@ public class VirtualMachineTO {
     public VirtualMachineTO(long id, String instanceName, VirtualMachine.Type type, int cpus, Integer minSpeed, Integer maxSpeed, long minRam, long maxRam,
             BootloaderType bootloader, String os, boolean enableHA, boolean limitCpuUse, String vncPassword) {
         this.id = id;
-        this.name = instanceName;
+        name = instanceName;
         this.type = type;
         this.cpus = cpus;
         this.minSpeed = minSpeed;
@@ -236,7 +237,7 @@ public class VirtualMachineTO {
     }
 
     public String getVncPassword() {
-        return this.vncPassword;
+        return vncPassword;
     }
 
     public void setVncPassword(String vncPassword) {
@@ -244,7 +245,7 @@ public class VirtualMachineTO {
     }
 
     public String getVncAddr() {
-        return this.vncAddr;
+        return vncAddr;
     }
 
     public void setVncAddr(String vncAddr) {
@@ -275,4 +276,12 @@ public class VirtualMachineTO {
         this.gpuDevice = gpuDevice;
     }
 
+    public String getPlatformEmulator() {
+        return platformEmulator;
+    }
+
+    public void setPlatformEmulator(String platformEmulator) {
+        this.platformEmulator = platformEmulator;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6831ed40/core/src/com/cloud/agent/api/VMSnapshotBaseCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/VMSnapshotBaseCommand.java b/core/src/com/cloud/agent/api/VMSnapshotBaseCommand.java
index 3625dc9..8b9f021 100644
--- a/core/src/com/cloud/agent/api/VMSnapshotBaseCommand.java
+++ b/core/src/com/cloud/agent/api/VMSnapshotBaseCommand.java
@@ -28,10 +28,11 @@ public class VMSnapshotBaseCommand extends Command {
     protected VMSnapshotTO target;
     protected String vmName;
     protected String guestOSType;
+    protected String platformEmulator;
 
     public VMSnapshotBaseCommand(String vmName, VMSnapshotTO snapshot, List<VolumeObjectTO> volumeTOs, String guestOSType) {
         this.vmName = vmName;
-        this.target = snapshot;
+        target = snapshot;
         this.volumeTOs = volumeTOs;
         this.guestOSType = guestOSType;
     }
@@ -72,4 +73,12 @@ public class VMSnapshotBaseCommand extends Command {
     public void setGuestOSType(String guestOSType) {
         this.guestOSType = guestOSType;
     }
+
+    public String getPlatformEmulator() {
+        return platformEmulator;
+    }
+
+    public void setPlatformEmulator(String platformEmulator) {
+        this.platformEmulator = platformEmulator;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6831ed40/engine/storage/snapshot/src/org/apache/cloudstack/storage/vmsnapshot/DefaultVMSnapshotStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/vmsnapshot/DefaultVMSnapshotStrategy.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/vmsnapshot/DefaultVMSnapshotStrategy.java
index e86bd23..9154b34 100644
--- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/vmsnapshot/DefaultVMSnapshotStrategy.java
+++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/vmsnapshot/DefaultVMSnapshotStrategy.java
@@ -45,11 +45,15 @@ import com.cloud.event.EventTypes;
 import com.cloud.event.UsageEventUtils;
 import com.cloud.exception.AgentUnavailableException;
 import com.cloud.exception.OperationTimedoutException;
+import com.cloud.host.HostVO;
+import com.cloud.host.dao.HostDao;
 import com.cloud.storage.DiskOfferingVO;
+import com.cloud.storage.GuestOSHypervisorVO;
 import com.cloud.storage.GuestOSVO;
 import com.cloud.storage.VolumeVO;
 import com.cloud.storage.dao.DiskOfferingDao;
 import com.cloud.storage.dao.GuestOSDao;
+import com.cloud.storage.dao.GuestOSHypervisorDao;
 import com.cloud.storage.dao.VolumeDao;
 import com.cloud.uservm.UserVm;
 import com.cloud.utils.NumbersUtil;
@@ -73,6 +77,8 @@ public class DefaultVMSnapshotStrategy extends ManagerBase implements VMSnapshot
     @Inject
     GuestOSDao guestOSDao;
     @Inject
+    GuestOSHypervisorDao guestOsHypervisorDao;
+    @Inject
     UserVmDao userVmDao;
     @Inject
     VMSnapshotDao vmSnapshotDao;
@@ -85,6 +91,8 @@ public class DefaultVMSnapshotStrategy extends ManagerBase implements VMSnapshot
     VolumeDao volumeDao;
     @Inject
     DiskOfferingDao diskOfferingDao;
+    @Inject
+    HostDao hostDao;
 
     @Override
     public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
@@ -126,7 +134,11 @@ public class DefaultVMSnapshotStrategy extends ManagerBase implements VMSnapshot
             else
                 vmSnapshotVO.setParent(current.getId());
 
+            HostVO host = hostDao.findById(hostId);
+            GuestOSHypervisorVO guestOsMapping = guestOsHypervisorDao.findByOsIdAndHypervisor(guestOS.getId(), host.getHypervisorType().toString(), host.getHypervisorVersion());
+
             CreateVMSnapshotCommand ccmd = new CreateVMSnapshotCommand(userVm.getInstanceName(), target, volumeTOs, guestOS.getDisplayName(), userVm.getState());
+            ccmd.setPlatformEmulator(guestOsMapping.getGuestOsName());
             ccmd.setWait(_wait);
 
             answer = (CreateVMSnapshotAnswer)agentMgr.send(hostId, ccmd);
@@ -335,6 +347,8 @@ public class DefaultVMSnapshotStrategy extends ManagerBase implements VMSnapshot
             Long hostId = vmSnapshotHelper.pickRunningHost(vmSnapshot.getVmId());
             GuestOSVO guestOS = guestOSDao.findById(userVm.getGuestOSId());
             RevertToVMSnapshotCommand revertToSnapshotCommand = new RevertToVMSnapshotCommand(vmInstanceName, vmSnapshotTO, volumeTOs, guestOS.getDisplayName());
+            HostVO host = hostDao.findById(hostId);
+            GuestOSHypervisorVO guestOsMapping = guestOsHypervisorDao.findByOsIdAndHypervisor(guestOS.getId(), host.getHypervisorType().toString(), host.getHypervisorVersion());
 
             RevertToVMSnapshotAnswer answer = (RevertToVMSnapshotAnswer)agentMgr.send(hostId, revertToSnapshotCommand);
             if (answer != null && answer.getResult()) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6831ed40/engine/storage/snapshot/test/src/VMSnapshotStrategyTest.java
----------------------------------------------------------------------
diff --git a/engine/storage/snapshot/test/src/VMSnapshotStrategyTest.java b/engine/storage/snapshot/test/src/VMSnapshotStrategyTest.java
index 9eaa7e1..22cf9c1 100644
--- a/engine/storage/snapshot/test/src/VMSnapshotStrategyTest.java
+++ b/engine/storage/snapshot/test/src/VMSnapshotStrategyTest.java
@@ -58,9 +58,14 @@ import com.cloud.agent.api.RevertToVMSnapshotAnswer;
 import com.cloud.agent.api.VMSnapshotTO;
 import com.cloud.exception.AgentUnavailableException;
 import com.cloud.exception.OperationTimedoutException;
+import com.cloud.host.HostVO;
+import com.cloud.host.dao.HostDao;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.storage.GuestOSHypervisorVO;
 import com.cloud.storage.GuestOSVO;
 import com.cloud.storage.dao.DiskOfferingDao;
 import com.cloud.storage.dao.GuestOSDao;
+import com.cloud.storage.dao.GuestOSHypervisorDao;
 import com.cloud.storage.dao.VolumeDao;
 import com.cloud.utils.component.ComponentContext;
 import com.cloud.utils.exception.CloudRuntimeException;
@@ -83,9 +88,13 @@ public class VMSnapshotStrategyTest extends TestCase {
     @Inject
     GuestOSDao guestOSDao;
     @Inject
+    GuestOSHypervisorDao guestOsHypervisorDao;
+    @Inject
     AgentManager agentMgr;
     @Inject
     VMSnapshotDao vmSnapshotDao;
+    @Inject
+    HostDao hostDao;
 
     @Override
     @Before
@@ -98,6 +107,9 @@ public class VMSnapshotStrategyTest extends TestCase {
         Long hostId = 1L;
         Long vmId = 1L;
         Long guestOsId = 1L;
+        HypervisorType hypervisorType = HypervisorType.Any;
+        String hypervisorVersion = "default";
+        String guestOsName = "Other";
         List<VolumeObjectTO> volumeObjectTOs = new ArrayList<VolumeObjectTO>();
         VMSnapshotVO vmSnapshot = Mockito.mock(VMSnapshotVO.class);
         UserVmVO userVmVO = Mockito.mock(UserVmVO.class);
@@ -108,7 +120,15 @@ public class VMSnapshotStrategyTest extends TestCase {
         Mockito.when(userVmDao.findById(Matchers.anyLong())).thenReturn(userVmVO);
         GuestOSVO guestOSVO = Mockito.mock(GuestOSVO.class);
         Mockito.when(guestOSDao.findById(Matchers.anyLong())).thenReturn(guestOSVO);
+        GuestOSHypervisorVO guestOSHypervisorVO = Mockito.mock(GuestOSHypervisorVO.class);
+        Mockito.when(guestOSHypervisorVO.getGuestOsName()).thenReturn(guestOsName);
+        Mockito.when(guestOsHypervisorDao.findById(Matchers.anyLong())).thenReturn(guestOSHypervisorVO);
+        Mockito.when(guestOsHypervisorDao.findByOsIdAndHypervisor(Matchers.anyLong(), Matchers.anyString(), Matchers.anyString())).thenReturn(guestOSHypervisorVO);
         Mockito.when(agentMgr.send(Matchers.anyLong(), Matchers.any(Command.class))).thenReturn(null);
+        HostVO hostVO = Mockito.mock(HostVO.class);
+        Mockito.when(hostDao.findById(Matchers.anyLong())).thenReturn(hostVO);
+        Mockito.when(hostVO.getHypervisorType()).thenReturn(hypervisorType);
+        Mockito.when(hostVO.getHypervisorVersion()).thenReturn(hypervisorVersion);
         Exception e = null;
         try {
             vmSnapshotStrategy.takeVMSnapshot(vmSnapshot);
@@ -131,6 +151,9 @@ public class VMSnapshotStrategyTest extends TestCase {
         Long hostId = 1L;
         Long vmId = 1L;
         Long guestOsId = 1L;
+        HypervisorType hypervisorType = HypervisorType.Any;
+        String hypervisorVersion = "default";
+        String guestOsName = "Other";
         List<VolumeObjectTO> volumeObjectTOs = new ArrayList<VolumeObjectTO>();
         VMSnapshotVO vmSnapshot = Mockito.mock(VMSnapshotVO.class);
         UserVmVO userVmVO = Mockito.mock(UserVmVO.class);
@@ -141,12 +164,20 @@ public class VMSnapshotStrategyTest extends TestCase {
         Mockito.when(userVmDao.findById(Matchers.anyLong())).thenReturn(userVmVO);
         GuestOSVO guestOSVO = Mockito.mock(GuestOSVO.class);
         Mockito.when(guestOSDao.findById(Matchers.anyLong())).thenReturn(guestOSVO);
+        GuestOSHypervisorVO guestOSHypervisorVO = Mockito.mock(GuestOSHypervisorVO.class);
+        Mockito.when(guestOSHypervisorVO.getGuestOsName()).thenReturn(guestOsName);
+        Mockito.when(guestOsHypervisorDao.findById(Matchers.anyLong())).thenReturn(guestOSHypervisorVO);
+        Mockito.when(guestOsHypervisorDao.findByOsIdAndHypervisor(Matchers.anyLong(), Matchers.anyString(), Matchers.anyString())).thenReturn(guestOSHypervisorVO);
         VMSnapshotTO vmSnapshotTO = Mockito.mock(VMSnapshotTO.class);
         Mockito.when(vmSnapshotHelper.getSnapshotWithParents(Matchers.any(VMSnapshotVO.class))).thenReturn(vmSnapshotTO);
         Mockito.when(vmSnapshotDao.findById(Matchers.anyLong())).thenReturn(vmSnapshot);
         Mockito.when(vmSnapshot.getId()).thenReturn(1L);
         Mockito.when(vmSnapshot.getCreated()).thenReturn(new Date());
         Mockito.when(agentMgr.send(Matchers.anyLong(), Matchers.any(Command.class))).thenReturn(null);
+        HostVO hostVO = Mockito.mock(HostVO.class);
+        Mockito.when(hostDao.findById(Matchers.anyLong())).thenReturn(hostVO);
+        Mockito.when(hostVO.getHypervisorType()).thenReturn(hypervisorType);
+        Mockito.when(hostVO.getHypervisorVersion()).thenReturn(hypervisorVersion);
         Exception e = null;
         try {
             vmSnapshotStrategy.revertVMSnapshot(vmSnapshot);
@@ -168,6 +199,9 @@ public class VMSnapshotStrategyTest extends TestCase {
         Long hostId = 1L;
         Long vmId = 1L;
         Long guestOsId = 1L;
+        HypervisorType hypervisorType = HypervisorType.Any;
+        String hypervisorVersion = "default";
+        String guestOsName = "Other";
         List<VolumeObjectTO> volumeObjectTOs = new ArrayList<VolumeObjectTO>();
         VMSnapshotVO vmSnapshot = Mockito.mock(VMSnapshotVO.class);
         UserVmVO userVmVO = Mockito.mock(UserVmVO.class);
@@ -178,12 +212,20 @@ public class VMSnapshotStrategyTest extends TestCase {
         Mockito.when(userVmDao.findById(Matchers.anyLong())).thenReturn(userVmVO);
         GuestOSVO guestOSVO = Mockito.mock(GuestOSVO.class);
         Mockito.when(guestOSDao.findById(Matchers.anyLong())).thenReturn(guestOSVO);
+        GuestOSHypervisorVO guestOSHypervisorVO = Mockito.mock(GuestOSHypervisorVO.class);
+        Mockito.when(guestOSHypervisorVO.getGuestOsName()).thenReturn(guestOsName);
+        Mockito.when(guestOsHypervisorDao.findById(Matchers.anyLong())).thenReturn(guestOSHypervisorVO);
+        Mockito.when(guestOsHypervisorDao.findByOsIdAndHypervisor(Matchers.anyLong(), Matchers.anyString(), Matchers.anyString())).thenReturn(guestOSHypervisorVO);
         VMSnapshotTO vmSnapshotTO = Mockito.mock(VMSnapshotTO.class);
         Mockito.when(vmSnapshotHelper.getSnapshotWithParents(Matchers.any(VMSnapshotVO.class))).thenReturn(vmSnapshotTO);
         Mockito.when(vmSnapshotDao.findById(Matchers.anyLong())).thenReturn(vmSnapshot);
         Mockito.when(vmSnapshot.getId()).thenReturn(1L);
         Mockito.when(vmSnapshot.getCreated()).thenReturn(new Date());
         Mockito.when(agentMgr.send(Matchers.anyLong(), Matchers.any(Command.class))).thenReturn(null);
+        HostVO hostVO = Mockito.mock(HostVO.class);
+        Mockito.when(hostDao.findById(Matchers.anyLong())).thenReturn(hostVO);
+        Mockito.when(hostVO.getHypervisorType()).thenReturn(hypervisorType);
+        Mockito.when(hostVO.getHypervisorVersion()).thenReturn(hypervisorVersion);
 
         Exception e = null;
         try {
@@ -228,6 +270,11 @@ public class VMSnapshotStrategyTest extends TestCase {
         }
 
         @Bean
+        public GuestOSHypervisorDao guestOsHypervisorDao() {
+            return Mockito.mock(GuestOSHypervisorDao.class);
+        }
+
+        @Bean
         public UserVmDao userVmDao() {
             return Mockito.mock(UserVmDao.class);
         }
@@ -256,5 +303,10 @@ public class VMSnapshotStrategyTest extends TestCase {
         public DiskOfferingDao diskOfferingDao() {
             return Mockito.mock(DiskOfferingDao.class);
         }
+
+        @Bean
+        public HostDao hostDao() {
+            return Mockito.mock(HostDao.class);
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6831ed40/engine/storage/src/org/apache/cloudstack/storage/helper/HypervisorHelperImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/helper/HypervisorHelperImpl.java b/engine/storage/src/org/apache/cloudstack/storage/helper/HypervisorHelperImpl.java
index b41c1fa..ff62fb8 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/helper/HypervisorHelperImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/helper/HypervisorHelperImpl.java
@@ -44,8 +44,12 @@ import com.cloud.agent.api.VMSnapshotTO;
 import com.cloud.agent.api.to.DataTO;
 import com.cloud.exception.AgentUnavailableException;
 import com.cloud.exception.OperationTimedoutException;
+import com.cloud.host.HostVO;
+import com.cloud.host.dao.HostDao;
+import com.cloud.storage.GuestOSHypervisorVO;
 import com.cloud.storage.GuestOSVO;
 import com.cloud.storage.dao.GuestOSDao;
+import com.cloud.storage.dao.GuestOSHypervisorDao;
 import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.vm.VirtualMachine;
@@ -60,9 +64,13 @@ public class HypervisorHelperImpl implements HypervisorHelper {
     @Inject
     GuestOSDao guestOSDao;
     @Inject
+    GuestOSHypervisorDao guestOsHypervisorDao;
+    @Inject
     ConfigurationDao configurationDao;
     @Inject
     AgentManager agentMgr;
+    @Inject
+    HostDao hostDao;
 
     @Override
     public DataTO introduceObject(DataTO object, Scope scope, Long storeId) {
@@ -117,6 +125,9 @@ public class HypervisorHelperImpl implements HypervisorHelper {
         List<VolumeObjectTO> volumeTOs = vmSnapshotHelper.getVolumeTOList(virtualMachine.getId());
         CreateVMSnapshotCommand ccmd =
             new CreateVMSnapshotCommand(virtualMachine.getInstanceName(), vmSnapshotTO, volumeTOs, guestOS.getDisplayName(), virtualMachine.getState());
+        HostVO host = hostDao.findById(hostId);
+        GuestOSHypervisorVO guestOsMapping = guestOsHypervisorDao.findByOsIdAndHypervisor(guestOS.getId(), host.getHypervisorType().toString(), host.getHypervisorVersion());
+        ccmd.setPlatformEmulator(guestOsMapping.getGuestOsName());
         ccmd.setWait(wait);
         try {
             Answer answer = agentMgr.send(hostId, ccmd);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6831ed40/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/XenServerGuru.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/XenServerGuru.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/XenServerGuru.java
index 89e4ab5..620d711 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/XenServerGuru.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/XenServerGuru.java
@@ -22,6 +22,16 @@ import java.util.List;
 import javax.ejb.Local;
 import javax.inject.Inject;
 
+import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
+import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
+import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
+import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
+import org.apache.cloudstack.hypervisor.xenserver.XenserverConfigs;
+import org.apache.cloudstack.storage.command.CopyCommand;
+import org.apache.cloudstack.storage.command.DettachCommand;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
+import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
+
 import com.cloud.agent.api.Command;
 import com.cloud.agent.api.to.DataObjectType;
 import com.cloud.agent.api.to.DataStoreTO;
@@ -32,30 +42,24 @@ import com.cloud.agent.api.to.VirtualMachineTO;
 import com.cloud.host.HostVO;
 import com.cloud.host.dao.HostDao;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.storage.GuestOSHypervisorVO;
 import com.cloud.storage.GuestOSVO;
 import com.cloud.storage.VolumeVO;
 import com.cloud.storage.dao.GuestOSDao;
+import com.cloud.storage.dao.GuestOSHypervisorDao;
 import com.cloud.storage.dao.VolumeDao;
 import com.cloud.template.VirtualMachineTemplate.BootloaderType;
 import com.cloud.utils.Pair;
 import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 
-import org.apache.cloudstack.hypervisor.xenserver.XenserverConfigs;
-import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
-import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
-import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
-import org.apache.cloudstack.storage.command.CopyCommand;
-import org.apache.cloudstack.storage.command.DettachCommand;
-import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
-import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
-
 @Local(value = HypervisorGuru.class)
 public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru {
     @Inject
     GuestOSDao _guestOsDao;
     @Inject
+    GuestOSHypervisorDao _guestOsHypervisorDao;
+    @Inject
     EndPointSelector endPointSelector;
     @Inject
     HostDao hostDao;
@@ -87,6 +91,9 @@ public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru
         // Determine the VM's OS description
         GuestOSVO guestOS = _guestOsDao.findById(vm.getVirtualMachine().getGuestOSId());
         to.setOs(guestOS.getDisplayName());
+        HostVO host = hostDao.findById(vm.getVirtualMachine().getHostId());
+        GuestOSHypervisorVO guestOsMapping = _guestOsHypervisorDao.findByOsIdAndHypervisor(guestOS.getId(), getHypervisorType().toString(), host.getHypervisorVersion());
+        to.setPlatformEmulator(guestOsMapping.getGuestOsName());
 
         return to;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6831ed40/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 a9840bd..0f42df3 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
@@ -805,7 +805,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
             try {
                 vm = getVM(conn, vmName);
             } catch (Exception e) {
-                vm = createWorkingVM(conn, vmName, cmd.getGuestOSType(), listVolumeTo);
+                vm = createWorkingVM(conn, vmName, cmd.getGuestOSType(), cmd.getPlatformEmulator(), listVolumeTo);
             }
 
             if (vm == null) {
@@ -1289,7 +1289,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
     }
 
     protected VM createVmFromTemplate(Connection conn, VirtualMachineTO vmSpec, Host host) throws XenAPIException, XmlRpcException {
-        String guestOsTypeName = getGuestOsType(vmSpec.getOs(), vmSpec.getBootloader() == BootloaderType.CD);
+        String guestOsTypeName = getGuestOsType(vmSpec.getOs(), vmSpec.getPlatformEmulator(), vmSpec.getBootloader() == BootloaderType.CD);
         Set<VM> templates = VM.getByNameLabel(conn, guestOsTypeName);
         assert templates.size() == 1 : "Should only have 1 template but found " + templates.size();
         VM template = templates.iterator().next();
@@ -1386,7 +1386,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
                         TemplateObjectTO iso = (TemplateObjectTO)disk.getData();
                         String osType = iso.getGuestOsType();
                         if (osType != null) {
-                            String isoGuestOsName = getGuestOsType(osType, vmSpec.getBootloader() == BootloaderType.CD);
+                            String isoGuestOsName = getGuestOsType(osType, vmSpec.getPlatformEmulator(), vmSpec.getBootloader() == BootloaderType.CD);
                             if (!isoGuestOsName.equals(guestOsTypeName)) {
                                 vmSpec.setBootloader(BootloaderType.PyGrub);
                             }
@@ -6389,6 +6389,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
         List<VolumeObjectTO> listVolumeTo = cmd.getVolumeTOs();
         VirtualMachine.State vmState = cmd.getVmState();
         String guestOSType = cmd.getGuestOSType();
+        String platformEmulator = cmd.getPlatformEmulator();
 
         boolean snapshotMemory = cmd.getTarget().getType() == VMSnapshot.Type.DiskAndMemory;
         long timeout = cmd.getWait();
@@ -6423,7 +6424,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
                     vm = getVM(conn, vmName);
                 } catch (Exception e) {
                     if (!snapshotMemory) {
-                        vm = createWorkingVM(conn, vmName, guestOSType, listVolumeTo);
+                        vm = createWorkingVM(conn, vmName, guestOSType, platformEmulator, listVolumeTo);
                     }
                 }
 
@@ -6511,9 +6512,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
         }
     }
 
-    private VM createWorkingVM(Connection conn, String vmName, String guestOSType, List<VolumeObjectTO> listVolumeTo) throws BadServerResponse, Types.VmBadPowerState, Types.SrFull,
+    private VM createWorkingVM(Connection conn, String vmName, String guestOSType, String platformEmulator, List<VolumeObjectTO> listVolumeTo) throws BadServerResponse,
+            Types.VmBadPowerState, Types.SrFull,
     Types.OperationNotAllowed, XenAPIException, XmlRpcException {
-        String guestOsTypeName = getGuestOsType(guestOSType, false);
+        //below is redundant but keeping for consistency and code readabilty
+        String guestOsTypeName = platformEmulator;
         if (guestOsTypeName == null) {
             String msg =
                     " Hypervisor " + this.getClass().getName() + " doesn't support guest OS type " + guestOSType + ". you can choose 'Other install media' to run it as HVM";
@@ -7098,7 +7101,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
     }
 
     /*Override by subclass*/
-    protected String getGuestOsType(String stdType, boolean bootFromCD) {
+    protected String getGuestOsType(String stdType, String platformEmulator, boolean bootFromCD) {
         return stdType;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6831ed40/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XcpOssResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XcpOssResource.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XcpOssResource.java
index 170730e..1c49a5b 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XcpOssResource.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XcpOssResource.java
@@ -27,6 +27,15 @@ import javax.ejb.Local;
 import org.apache.log4j.Logger;
 import org.apache.xmlrpc.XmlRpcException;
 
+import com.xensource.xenapi.Connection;
+import com.xensource.xenapi.Host;
+import com.xensource.xenapi.SR;
+import com.xensource.xenapi.Types;
+import com.xensource.xenapi.Types.XenAPIException;
+import com.xensource.xenapi.VBD;
+import com.xensource.xenapi.VDI;
+import com.xensource.xenapi.VM;
+
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.Command;
 import com.cloud.agent.api.NetworkUsageAnswer;
@@ -40,14 +49,6 @@ import com.cloud.resource.ServerResource;
 import com.cloud.storage.Storage;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.script.Script;
-import com.xensource.xenapi.Connection;
-import com.xensource.xenapi.Host;
-import com.xensource.xenapi.SR;
-import com.xensource.xenapi.Types;
-import com.xensource.xenapi.Types.XenAPIException;
-import com.xensource.xenapi.VBD;
-import com.xensource.xenapi.VDI;
-import com.xensource.xenapi.VM;
 
 @Local(value = ServerResource.class)
 public class XcpOssResource extends CitrixResourceBase {
@@ -78,6 +79,7 @@ public class XcpOssResource extends CitrixResourceBase {
         return true;
     }
 
+    @Override
     protected StartupStorageCommand initializeLocalSR(Connection conn) {
         SR extsr = getLocalEXTSR(conn);
         if (extsr != null) {
@@ -111,13 +113,17 @@ public class XcpOssResource extends CitrixResourceBase {
     }
 
     @Override
-    protected String getGuestOsType(String stdType, boolean bootFromCD) {
+    protected String getGuestOsType(String stdType, String platformEmulator, boolean bootFromCD) {
         if (stdType.equalsIgnoreCase("Debian GNU/Linux 6(64-bit)")) {
             return "Debian Squeeze 6.0 (64-bit)";
         } else if (stdType.equalsIgnoreCase("CentOS 5.6 (64-bit)")) {
             return "CentOS 5 (64-bit)";
         } else {
-            return CitrixHelper.getXcpGuestOsType(stdType);
+            if (platformEmulator == null || platformEmulator.isEmpty()) {
+                s_logger.debug("Can't find the guest os: " + stdType + " mapping into XCP's guestOS type, start it as HVM guest");
+                platformEmulator = "Other install media";
+            }
+            return platformEmulator;
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6831ed40/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XcpServer16Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XcpServer16Resource.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XcpServer16Resource.java
index f5bede8..3fcbcc4 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XcpServer16Resource.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XcpServer16Resource.java
@@ -19,14 +19,21 @@
 
 package com.cloud.hypervisor.xenserver.resource;
 
+import org.apache.log4j.Logger;
+
 public class XcpServer16Resource extends XcpServerResource {
+    private final static Logger s_logger = Logger.getLogger(XcpServer16Resource.class);
 
     public XcpServer16Resource() {
         super();
     }
 
     @Override
-    protected String getGuestOsType(String stdType, boolean bootFromCD) {
-        return CitrixHelper.getXcp160GuestOsType(stdType);
+    protected String getGuestOsType(String stdType, String platformEmulator, boolean bootFromCD) {
+        if (platformEmulator == null) {
+            s_logger.debug("Can't find the guest os: " + stdType + " mapping into XCP's guestOS type, start it as HVM guest");
+            platformEmulator = "Other install media";
+        }
+        return platformEmulator;
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6831ed40/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XcpServerResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XcpServerResource.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XcpServerResource.java
index 2825008..b4cc59b 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XcpServerResource.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XcpServerResource.java
@@ -71,8 +71,12 @@ public class XcpServerResource extends CitrixResourceBase {
     }
 
     @Override
-    protected String getGuestOsType(String stdType, boolean bootFromCD) {
-        return CitrixHelper.getXcpGuestOsType(stdType);
+    protected String getGuestOsType(String stdType, String platformEmulator, boolean bootFromCD) {
+        if (platformEmulator == null) {
+            s_logger.debug("Can't find the guest os: " + stdType + " mapping into XCP's guestOS type, start it as HVM guest");
+            platformEmulator = "Other install media";
+        }
+        return platformEmulator;
     }
 
     protected NetworkUsageAnswer execute(NetworkUsageCommand cmd) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6831ed40/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer56FP1Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer56FP1Resource.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer56FP1Resource.java
index ddedaf5..e1669a5 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer56FP1Resource.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer56FP1Resource.java
@@ -52,8 +52,17 @@ public class XenServer56FP1Resource extends XenServer56Resource {
     }
 
     @Override
-    protected String getGuestOsType(String stdType, boolean bootFromCD) {
-        return CitrixHelper.getXenServer56FP1GuestOsType(stdType, bootFromCD);
+    protected String getGuestOsType(String stdType, String platformEmulator, boolean bootFromCD) {
+        if (platformEmulator == null) {
+            if (!bootFromCD) {
+                s_logger.debug("Can't find the guest os: " + stdType + " mapping into XenServer 5.6 FP1 guestOS type, start it as HVM guest");
+                platformEmulator = "Other install media";
+            } else {
+                String msg = "XenServer 5.6 FP1 DOES NOT support Guest OS type " + stdType;
+                s_logger.warn(msg);
+            }
+        }
+        return platformEmulator;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6831ed40/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer56Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer56Resource.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer56Resource.java
index 4ce8648..d3e17bd 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer56Resource.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer56Resource.java
@@ -16,6 +16,25 @@
 // under the License.
 package com.cloud.hypervisor.xenserver.resource;
 
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+import org.apache.xmlrpc.XmlRpcException;
+
+import com.xensource.xenapi.Connection;
+import com.xensource.xenapi.Host;
+import com.xensource.xenapi.Network;
+import com.xensource.xenapi.PIF;
+import com.xensource.xenapi.Types.IpConfigurationMode;
+import com.xensource.xenapi.Types.XenAPIException;
+import com.xensource.xenapi.VLAN;
+import com.xensource.xenapi.VM;
+
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.CheckOnHostAnswer;
 import com.cloud.agent.api.CheckOnHostCommand;
@@ -30,22 +49,6 @@ import com.cloud.utils.ExecutionResult;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.script.Script;
 import com.cloud.utils.ssh.SSHCmdHelper;
-import com.xensource.xenapi.Connection;
-import com.xensource.xenapi.Host;
-import com.xensource.xenapi.Network;
-import com.xensource.xenapi.PIF;
-import com.xensource.xenapi.Types.IpConfigurationMode;
-import com.xensource.xenapi.Types.XenAPIException;
-import com.xensource.xenapi.VLAN;
-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;
-import java.util.Set;
 
 @Local(value = ServerResource.class)
 public class XenServer56Resource extends CitrixResourceBase {
@@ -63,8 +66,17 @@ public class XenServer56Resource extends CitrixResourceBase {
     }
 
     @Override
-    protected String getGuestOsType(String stdType, boolean bootFromCD) {
-        return CitrixHelper.getXenServerGuestOsType(stdType, bootFromCD);
+    protected String getGuestOsType(String stdType, String platformEmulator, boolean bootFromCD) {
+        if (platformEmulator == null) {
+            if (!bootFromCD) {
+                s_logger.debug("Can't find the guest os: " + stdType + " mapping into XenServer 5.6 guestOS type, start it as HVM guest");
+                platformEmulator = "Other install media";
+            } else {
+                String msg = "XenServer 5.6 doesn't support Guest OS type " + stdType;
+                s_logger.warn(msg);
+            }
+        }
+        return platformEmulator;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6831ed40/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer56SP2Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer56SP2Resource.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer56SP2Resource.java
index cfe6f15..563f9c3 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer56SP2Resource.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer56SP2Resource.java
@@ -39,8 +39,17 @@ public class XenServer56SP2Resource extends XenServer56FP1Resource {
     }
 
     @Override
-    protected String getGuestOsType(String stdType, boolean bootFromCD) {
-        return CitrixHelper.getXenServer56SP2GuestOsType(stdType, bootFromCD);
+    protected String getGuestOsType(String stdType, String platformEmulator, boolean bootFromCD) {
+        if (platformEmulator == null) {
+            if (!bootFromCD) {
+                s_logger.debug("Can't find the guest os: " + stdType + " mapping into XenServer 5.6 SP2 guestOS type, start it as HVM guest");
+                platformEmulator = "Other install media";
+            } else {
+                String msg = "XenServer 5.6 SP2 DOES NOT support Guest OS type " + stdType;
+                s_logger.warn(msg);
+            }
+        }
+        return platformEmulator;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6831ed40/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer600Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer600Resource.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer600Resource.java
index c5f762c..4d7fc8b 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer600Resource.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer600Resource.java
@@ -37,8 +37,17 @@ public class XenServer600Resource extends XenServer56SP2Resource {
     }
 
     @Override
-    protected String getGuestOsType(String stdType, boolean bootFromCD) {
-        return CitrixHelper.getXenServer600GuestOsType(stdType, bootFromCD);
+    protected String getGuestOsType(String stdType, String platformEmulator, boolean bootFromCD) {
+        if (platformEmulator == null) {
+            if (!bootFromCD) {
+                s_logger.debug("Can't find the guest os: " + stdType + " mapping into XenServer 6.0.0 guestOS type, start it as HVM guest");
+                platformEmulator = "Other install media";
+            } else {
+                String msg = "XenServer 6.0.0 DOES NOT support Guest OS type " + stdType;
+                s_logger.warn(msg);
+            }
+        }
+        return platformEmulator;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6831ed40/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer602Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer602Resource.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer602Resource.java
index f180adb..042599a 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer602Resource.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer602Resource.java
@@ -16,7 +16,9 @@
 // under the License.
 package com.cloud.hypervisor.xenserver.resource;
 import javax.ejb.Local;
+
 import org.apache.log4j.Logger;
+
 import com.cloud.resource.ServerResource;
 
 @Local(value = ServerResource.class)
@@ -28,8 +30,17 @@ public class XenServer602Resource extends XenServer600Resource {
     }
 
     @Override
-    protected String getGuestOsType(String stdType, boolean bootFromCD) {
-        return CitrixHelper.getXenServer602GuestOsType(stdType, bootFromCD);
+    protected String getGuestOsType(String stdType, String platformEmulator, boolean bootFromCD) {
+        if (platformEmulator == null) {
+            if (!bootFromCD) {
+                s_logger.debug("Can't find the guest os: " + stdType + " mapping into XenServer 6.0.2 guestOS type, start it as HVM guest");
+                platformEmulator = "Other install media";
+            } else {
+                String msg = "XenServer 6.0.2 DOES NOT support Guest OS type " + stdType;
+                s_logger.warn(msg);
+            }
+        }
+        return platformEmulator;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6831ed40/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer610Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer610Resource.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer610Resource.java
index 7807f93..b099c99 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer610Resource.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer610Resource.java
@@ -73,8 +73,17 @@ public class XenServer610Resource extends XenServer602Resource {
     }
 
     @Override
-    protected String getGuestOsType(String stdType, boolean bootFromCD) {
-        return CitrixHelper.getXenServer610GuestOsType(stdType, bootFromCD);
+    protected String getGuestOsType(String stdType, String platformEmulator, boolean bootFromCD) {
+        if (platformEmulator == null) {
+            if (!bootFromCD) {
+                s_logger.debug("Can't find the guest os: " + stdType + " mapping into XenServer 6.1.0 guestOS type, start it as HVM guest");
+                platformEmulator = "Other install media";
+            } else {
+                String msg = "XenServer 6.1.0 DOES NOT support Guest OS type " + stdType;
+                s_logger.warn(msg);
+            }
+        }
+        return platformEmulator;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6831ed40/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer620Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer620Resource.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer620Resource.java
index 0c8cc0b..4b43023 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer620Resource.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer620Resource.java
@@ -15,11 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 package com.cloud.hypervisor.xenserver.resource;
-import com.xensource.xenapi.Connection;
-import com.xensource.xenapi.Host;
-import com.xensource.xenapi.HostPatch;
-import com.xensource.xenapi.PoolPatch;
-import org.apache.cloudstack.hypervisor.xenserver.XenserverConfigs;
 import java.util.Map;
 import java.util.Set;
 
@@ -27,6 +22,13 @@ import javax.ejb.Local;
 
 import org.apache.log4j.Logger;
 
+import com.xensource.xenapi.Connection;
+import com.xensource.xenapi.Host;
+import com.xensource.xenapi.HostPatch;
+import com.xensource.xenapi.PoolPatch;
+
+import org.apache.cloudstack.hypervisor.xenserver.XenserverConfigs;
+
 import com.cloud.agent.api.StartupRoutingCommand;
 import com.cloud.resource.ServerResource;
 
@@ -39,8 +41,17 @@ public class XenServer620Resource extends XenServer610Resource {
     }
 
     @Override
-    protected String getGuestOsType(String stdType, boolean bootFromCD) {
-        return CitrixHelper.getXenServer620GuestOsType(stdType, bootFromCD);
+    protected String getGuestOsType(String stdType, String platformEmulator, boolean bootFromCD) {
+        if (platformEmulator == null) {
+            if (!bootFromCD) {
+                s_logger.debug("Can't find the guest os: " + stdType + " mapping into XenServer 6.2.0 guestOS type, start it as HVM guest");
+                platformEmulator = "Other install media";
+            } else {
+                String msg = "XenServer 6.2.0 DOES NOT support Guest OS type " + stdType;
+                s_logger.warn(msg);
+            }
+        }
+        return platformEmulator;
     }
 
     @Override
@@ -91,6 +102,7 @@ public class XenServer620Resource extends XenServer610Resource {
         return false;
     }
 
+    @Override
     protected void fillHostInfo(Connection conn, StartupRoutingCommand cmd) {
         super.fillHostInfo(conn, cmd);
         Map<String, String> details = cmd.getHostDetails();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6831ed40/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer620SP1Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer620SP1Resource.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer620SP1Resource.java
index 3584ff2..8e23764 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer620SP1Resource.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer620SP1Resource.java
@@ -28,15 +28,6 @@ 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.GetGPUStatsAnswer;
-import com.cloud.agent.api.GetGPUStatsCommand;
-import com.cloud.agent.api.StartCommand;
-import com.cloud.agent.api.StartupRoutingCommand;
-import com.cloud.agent.api.VgpuTypesInfo;
-import com.cloud.agent.api.to.GPUDeviceTO;
-import com.cloud.resource.ServerResource;
 import com.xensource.xenapi.Connection;
 import com.xensource.xenapi.GPUGroup;
 import com.xensource.xenapi.Host;
@@ -47,6 +38,16 @@ import com.xensource.xenapi.VGPUType;
 import com.xensource.xenapi.VGPUType.Record;
 import com.xensource.xenapi.VM;
 
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+import com.cloud.agent.api.GetGPUStatsAnswer;
+import com.cloud.agent.api.GetGPUStatsCommand;
+import com.cloud.agent.api.StartCommand;
+import com.cloud.agent.api.StartupRoutingCommand;
+import com.cloud.agent.api.VgpuTypesInfo;
+import com.cloud.agent.api.to.GPUDeviceTO;
+import com.cloud.resource.ServerResource;
+
 @Local(value=ServerResource.class)
 public class XenServer620SP1Resource extends XenServer620Resource {
     private static final Logger s_logger = Logger.getLogger(XenServer620SP1Resource.class);
@@ -164,8 +165,17 @@ public class XenServer620SP1Resource extends XenServer620Resource {
     }
 
     @Override
-    protected String getGuestOsType(String stdType, boolean bootFromCD) {
-        return CitrixHelper.getXenServer620SP1GuestOsType(stdType, bootFromCD);
+    protected String getGuestOsType(String stdType, String platformEmulator, boolean bootFromCD) {
+        if (platformEmulator == null) {
+            if (!bootFromCD) {
+                s_logger.debug("Can't find the guest os: " + stdType + " mapping into XenServer 6.2.0 guestOS type, start it as HVM guest");
+                platformEmulator = "Other install media";
+            } else {
+                String msg = "XenServer 6.2.0 DOES NOT support Guest OS type " + stdType;
+                s_logger.warn(msg);
+            }
+        }
+        return platformEmulator;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6831ed40/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625Resource.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625Resource.java
index 546f32c..de108e4 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625Resource.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625Resource.java
@@ -28,9 +28,9 @@ import org.apache.log4j.Logger;
 import org.apache.xmlrpc.XmlRpcException;
 
 import com.xensource.xenapi.Connection;
+import com.xensource.xenapi.Host;
 import com.xensource.xenapi.Types;
 import com.xensource.xenapi.VM;
-import com.xensource.xenapi.Host;
 
 import org.apache.cloudstack.hypervisor.xenserver.XenServerResourceNewBase;
 
@@ -50,8 +50,17 @@ public class Xenserver625Resource extends XenServerResourceNewBase {
     }
 
     @Override
-    protected String getGuestOsType(String stdType, boolean bootFromCD) {
-        return CitrixHelper.getXenServer625GuestOsType(stdType, bootFromCD);
+    protected String getGuestOsType(String stdType, String platformEmulator, boolean bootFromCD) {
+        if (platformEmulator == null) {
+            if (!bootFromCD) {
+                s_logger.debug("Can't find the guest os: " + stdType + " mapping into XenServer 6.2.5 guestOS type, start it as HVM guest");
+                platformEmulator = "Other install media";
+            } else {
+                String msg = "XenServer 6.2.5 DOES NOT support Guest OS type " + stdType;
+                s_logger.warn(msg);
+            }
+        }
+        return platformEmulator;
     }
 
     @Override


Mime
View raw message