You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ni...@apache.org on 2014/05/08 00:03:24 UTC
git commit: updated refs/heads/4.4-forward to 8f37841
Repository: cloudstack
Updated Branches:
refs/heads/4.4-forward b9284db85 -> 8f37841eb
CLOUDSTACK-6358: As a part of supporting dynamic guest OS defined by user, removing the hard-coded dependencies.
This patch is for XenServer.
1. Local testing on XenServer 6.0.2
2. Successfully got up system VMs
3. Successfully created a CentOS VM
4. Created VM snapshot and reverted to snapshot
5. Manipulated guest_os_hypervisor table for mapping, and checked for correct propagation of platform emulator.
Signed off by :- Nitin Mehta<ni...@citrix.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8f37841e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8f37841e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8f37841e
Branch: refs/heads/4.4-forward
Commit: 8f37841eb49532a729c9cc42a61e610da05b04a3
Parents: b9284db
Author: Amogh Vasekar <am...@citrix.com>
Authored: Wed May 7 14:53:07 2014 -0700
Committer: Nitin Mehta <ni...@citrix.com>
Committed: Wed May 7 14:55:35 2014 -0700
----------------------------------------------------------------------
.../cloud/agent/api/to/VirtualMachineTO.java | 13 +-
.../cloud/agent/api/VMSnapshotBaseCommand.java | 11 +-
.../vmsnapshot/DefaultVMSnapshotStrategy.java | 15 +-
.../test/src/VMSnapshotStrategyTest.java | 53 ++++++-
.../storage/helper/HypervisorHelperImpl.java | 11 ++
.../src/com/cloud/hypervisor/XenServerGuru.java | 27 ++--
.../xen/resource/CitrixResourceBase.java | 155 ++++++++++---------
.../hypervisor/xen/resource/XcpOssResource.java | 26 ++--
.../xen/resource/XcpServer16Resource.java | 12 +-
.../xen/resource/XcpServerResource.java | 8 +-
.../xen/resource/XenServer56FP1Resource.java | 13 +-
.../xen/resource/XenServer56Resource.java | 48 +++---
.../xen/resource/XenServer56SP2Resource.java | 13 +-
.../xen/resource/XenServer600Resource.java | 14 +-
.../xen/resource/XenServer602Resource.java | 15 +-
.../xen/resource/XenServer610Resource.java | 13 +-
.../xen/resource/XenServer620Resource.java | 26 +++-
.../xen/resource/XenServer620SP1Resource.java | 32 ++--
.../xen/resource/Xenserver625Resource.java | 13 +-
19 files changed, 367 insertions(+), 151 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f37841e/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..45bad79 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;
@@ -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/8f37841e/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 d2abd54..2752965 100644
--- a/core/src/com/cloud/agent/api/VMSnapshotBaseCommand.java
+++ b/core/src/com/cloud/agent/api/VMSnapshotBaseCommand.java
@@ -26,10 +26,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;
}
@@ -70,4 +71,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/8f37841e/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..21f4968 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 {
@@ -108,7 +116,6 @@ public class DefaultVMSnapshotStrategy extends ManagerBase implements VMSnapshot
boolean result = false;
try {
GuestOSVO guestOS = guestOSDao.findById(userVm.getGuestOSId());
-
List<VolumeObjectTO> volumeTOs = vmSnapshotHelper.getVolumeTOList(userVm.getId());
VMSnapshotTO current = null;
@@ -126,7 +133,10 @@ 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);
@@ -334,7 +344,10 @@ public class DefaultVMSnapshotStrategy extends ManagerBase implements VMSnapshot
snapshot.getCurrent(), parent, true);
Long hostId = vmSnapshotHelper.pickRunningHost(vmSnapshot.getVmId());
GuestOSVO guestOS = guestOSDao.findById(userVm.getGuestOSId());
+ HostVO host = hostDao.findById(hostId);
+ GuestOSHypervisorVO guestOsMapping = guestOsHypervisorDao.findByOsIdAndHypervisor(guestOS.getId(), host.getHypervisorType().toString(), host.getHypervisorVersion());
RevertToVMSnapshotCommand revertToSnapshotCommand = new RevertToVMSnapshotCommand(vmInstanceName, vmSnapshotTO, volumeTOs, guestOS.getDisplayName());
+ revertToSnapshotCommand.setPlatformEmulator(guestOsMapping.getGuestOsName());
RevertToVMSnapshotAnswer answer = (RevertToVMSnapshotAnswer)agentMgr.send(hostId, revertToSnapshotCommand);
if (answer != null && answer.getResult()) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f37841e/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..6100c59 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(guestOsHypervisorDao.findById(Matchers.anyLong())).thenReturn(guestOSHypervisorVO);
+ Mockito.when(guestOsHypervisorDao.findByOsIdAndHypervisor(Matchers.anyLong(), Matchers.anyString(), Matchers.anyString())).thenReturn(guestOSHypervisorVO);
+ Mockito.when(guestOSHypervisorVO.getGuestOsName()).thenReturn(guestOsName);
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,13 +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 {
vmSnapshotStrategy.deleteVMSnapshot(vmSnapshot);
@@ -228,6 +269,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 +302,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/8f37841e/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/8f37841e/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java
index 89e4ab5..620d711 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java
+++ b/plugins/hypervisors/xen/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/8f37841e/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index 49ffaa5..2b6fb11 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -16,6 +16,77 @@
// under the License.
package com.cloud.hypervisor.xen.resource;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Queue;
+import java.util.Random;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.TimeoutException;
+
+import javax.ejb.Local;
+import javax.naming.ConfigurationException;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.log4j.Logger;
+import org.apache.xmlrpc.XmlRpcException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import com.trilead.ssh2.SCPClient;
+import com.xensource.xenapi.Bond;
+import com.xensource.xenapi.Connection;
+import com.xensource.xenapi.Console;
+import com.xensource.xenapi.Host;
+import com.xensource.xenapi.HostCpu;
+import com.xensource.xenapi.HostMetrics;
+import com.xensource.xenapi.Network;
+import com.xensource.xenapi.PBD;
+import com.xensource.xenapi.PIF;
+import com.xensource.xenapi.Pool;
+import com.xensource.xenapi.SR;
+import com.xensource.xenapi.Session;
+import com.xensource.xenapi.Task;
+import com.xensource.xenapi.Types;
+import com.xensource.xenapi.Types.BadServerResponse;
+import com.xensource.xenapi.Types.VmPowerState;
+import com.xensource.xenapi.Types.XenAPIException;
+import com.xensource.xenapi.VBD;
+import com.xensource.xenapi.VBDMetrics;
+import com.xensource.xenapi.VDI;
+import com.xensource.xenapi.VGPU;
+import com.xensource.xenapi.VIF;
+import com.xensource.xenapi.VLAN;
+import com.xensource.xenapi.VM;
+import com.xensource.xenapi.VMGuestMetrics;
+import com.xensource.xenapi.XenAPIObject;
+
+import org.apache.cloudstack.storage.command.StorageSubSystemCommand;
+import org.apache.cloudstack.storage.to.TemplateObjectTO;
+import org.apache.cloudstack.storage.to.VolumeObjectTO;
+
import com.cloud.agent.IAgentControl;
import com.cloud.agent.api.Answer;
import com.cloud.agent.api.AttachIsoCommand;
@@ -177,73 +248,6 @@ import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachine.PowerState;
import com.cloud.vm.VirtualMachine.State;
import com.cloud.vm.snapshot.VMSnapshot;
-import com.trilead.ssh2.SCPClient;
-import com.xensource.xenapi.Bond;
-import com.xensource.xenapi.Connection;
-import com.xensource.xenapi.Console;
-import com.xensource.xenapi.Host;
-import com.xensource.xenapi.HostCpu;
-import com.xensource.xenapi.HostMetrics;
-import com.xensource.xenapi.Network;
-import com.xensource.xenapi.PBD;
-import com.xensource.xenapi.PIF;
-import com.xensource.xenapi.Pool;
-import com.xensource.xenapi.SR;
-import com.xensource.xenapi.Session;
-import com.xensource.xenapi.Task;
-import com.xensource.xenapi.Types;
-import com.xensource.xenapi.Types.BadServerResponse;
-import com.xensource.xenapi.Types.VmPowerState;
-import com.xensource.xenapi.Types.XenAPIException;
-import com.xensource.xenapi.VBD;
-import com.xensource.xenapi.VBDMetrics;
-import com.xensource.xenapi.VDI;
-import com.xensource.xenapi.VGPU;
-import com.xensource.xenapi.VIF;
-import com.xensource.xenapi.VLAN;
-import com.xensource.xenapi.VM;
-import com.xensource.xenapi.VMGuestMetrics;
-import com.xensource.xenapi.XenAPIObject;
-import org.apache.cloudstack.storage.command.StorageSubSystemCommand;
-import org.apache.cloudstack.storage.to.TemplateObjectTO;
-import org.apache.cloudstack.storage.to.VolumeObjectTO;
-import org.apache.log4j.Logger;
-import org.apache.xmlrpc.XmlRpcException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import java.util.concurrent.TimeoutException;
-
-import javax.ejb.Local;
-import javax.naming.ConfigurationException;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Queue;
-import java.util.Random;
-import java.util.Set;
-import java.util.UUID;
/**
* CitrixResourceBase encapsulates the calls to the XenServer Xapi process
@@ -805,7 +809,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) {
@@ -1345,7 +1349,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);
if ( templates == null || templates.isEmpty() ){
s_logger.debug("Cannot find template : " + guestOsTypeName + " on XS version: " + this.getClass().getName());
@@ -1445,7 +1449,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);
}
@@ -6434,6 +6438,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();
@@ -6468,7 +6473,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);
}
}
@@ -6556,9 +6561,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";
@@ -7142,7 +7149,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/8f37841e/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpOssResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpOssResource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpOssResource.java
index 4a69d3a..cd59ae0 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpOssResource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/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/8f37841e/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
index 8cb7997..ff71ade 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServer16Resource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServer16Resource.java
@@ -19,14 +19,20 @@
package com.cloud.hypervisor.xen.resource;
-public class XcpServer16Resource extends XcpServerResource {
+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/8f37841e/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 cc623bf..026f609 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
@@ -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/8f37841e/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
index 3dc527e..b792fa4 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/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/8f37841e/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56Resource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56Resource.java
index a78ed81..1bdcc3d 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56Resource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56Resource.java
@@ -16,6 +16,25 @@
// under the License.
package com.cloud.hypervisor.xen.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;
@@ -29,22 +48,6 @@ import com.cloud.resource.ServerResource;
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 {
@@ -62,8 +65,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/8f37841e/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56SP2Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56SP2Resource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56SP2Resource.java
index 9e7d5dd..becb42d 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56SP2Resource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/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/8f37841e/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer600Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer600Resource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer600Resource.java
index 021b9cb..ac03d5d 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer600Resource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer600Resource.java
@@ -37,8 +37,18 @@ 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.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/8f37841e/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer602Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer602Resource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer602Resource.java
index 5c9bfbb..783cd44 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer602Resource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer602Resource.java
@@ -16,7 +16,9 @@
// under the License.
package com.cloud.hypervisor.xen.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/8f37841e/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer610Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer610Resource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer610Resource.java
index 0c3e1e9..6597cef 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer610Resource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/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/8f37841e/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer620Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer620Resource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer620Resource.java
index c10dc1e..44d880b 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer620Resource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer620Resource.java
@@ -15,16 +15,20 @@
// specific language governing permissions and limitations
// under the License.
package com.cloud.hypervisor.xen.resource;
+import java.util.Map;
+import java.util.Set;
+
+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 java.util.Map;
-import java.util.Set;
-import javax.ejb.Local;
-import org.apache.log4j.Logger;
+
import com.cloud.agent.api.StartupRoutingCommand;
import com.cloud.resource.ServerResource;
@@ -37,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
@@ -89,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/8f37841e/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer620SP1Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer620SP1Resource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer620SP1Resource.java
index de9225f..8e9bfa9 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer620SP1Resource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/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/8f37841e/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/Xenserver625Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/Xenserver625Resource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/Xenserver625Resource.java
index b1442de..d290194 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/Xenserver625Resource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/Xenserver625Resource.java
@@ -49,8 +49,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