mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-6358: Missing patches in master for VMware
This commit is contained in:
parent
09069fcc87
commit
62e63a1bf7
|
|
@ -138,7 +138,11 @@ public class DefaultVMSnapshotStrategy extends ManagerBase implements VMSnapshot
|
|||
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());
|
||||
if (guestOsMapping == null) {
|
||||
ccmd.setPlatformEmulator(null);
|
||||
} else {
|
||||
ccmd.setPlatformEmulator(guestOsMapping.getGuestOsName());
|
||||
}
|
||||
ccmd.setWait(_wait);
|
||||
|
||||
answer = (CreateVMSnapshotAnswer)agentMgr.send(hostId, ccmd);
|
||||
|
|
@ -349,6 +353,12 @@ public class DefaultVMSnapshotStrategy extends ManagerBase implements VMSnapshot
|
|||
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());
|
||||
RevertToVMSnapshotCommand revertToSnapshotCommand = new RevertToVMSnapshotCommand(vmInstanceName, vmSnapshotTO, volumeTOs, guestOS.getDisplayName());
|
||||
if (guestOsMapping == null) {
|
||||
revertToSnapshotCommand.setPlatformEmulator(null);
|
||||
} else {
|
||||
revertToSnapshotCommand.setPlatformEmulator(guestOsMapping.getGuestOsName());
|
||||
}
|
||||
|
||||
RevertToVMSnapshotAnswer answer = (RevertToVMSnapshotAnswer)agentMgr.send(hostId, revertToSnapshotCommand);
|
||||
if (answer != null && answer.getResult()) {
|
||||
|
|
|
|||
|
|
@ -81,11 +81,13 @@ import com.cloud.network.dao.PhysicalNetworkTrafficTypeVO;
|
|||
import com.cloud.secstorage.CommandExecLogDao;
|
||||
import com.cloud.secstorage.CommandExecLogVO;
|
||||
import com.cloud.storage.DataStoreRole;
|
||||
import com.cloud.storage.GuestOSHypervisorVO;
|
||||
import com.cloud.storage.GuestOSVO;
|
||||
import com.cloud.storage.Storage;
|
||||
import com.cloud.storage.Volume;
|
||||
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.storage.secondary.SecondaryStorageVmManager;
|
||||
import com.cloud.template.VirtualMachineTemplate.BootloaderType;
|
||||
|
|
@ -112,6 +114,8 @@ public class VMwareGuru extends HypervisorGuruBase implements HypervisorGuru, Co
|
|||
@Inject
|
||||
private GuestOSDao _guestOsDao;
|
||||
@Inject
|
||||
GuestOSHypervisorDao _guestOsHypervisorDao;
|
||||
@Inject
|
||||
private HostDao _hostDao;
|
||||
@Inject
|
||||
private HostDetailsDao _hostDetailsDao;
|
||||
|
|
@ -309,6 +313,13 @@ public class VMwareGuru extends HypervisorGuruBase implements HypervisorGuru, Co
|
|||
GuestOSVO guestOS = _guestOsDao.findById(vm.getVirtualMachine().getGuestOSId());
|
||||
to.setOs(guestOS.getDisplayName());
|
||||
to.setHostName(vm.getHostName());
|
||||
HostVO host = _hostDao.findById(vm.getVirtualMachine().getHostId());
|
||||
GuestOSHypervisorVO guestOsMapping = _guestOsHypervisorDao.findByOsIdAndHypervisor(guestOS.getId(), getHypervisorType().toString(), host.getHypervisorVersion());
|
||||
if (guestOsMapping == null) {
|
||||
to.setPlatformEmulator(null);
|
||||
} else {
|
||||
to.setPlatformEmulator(guestOsMapping.getGuestOsName());
|
||||
}
|
||||
return to;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ import java.util.Random;
|
|||
import java.util.Set;
|
||||
import java.util.TimeZone;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
@ -238,7 +239,6 @@ import com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost;
|
|||
import com.cloud.hypervisor.vmware.mo.VmwareHypervisorHostNetworkSummary;
|
||||
import com.cloud.hypervisor.vmware.mo.VmwareHypervisorHostResourceSummary;
|
||||
import com.cloud.hypervisor.vmware.util.VmwareContext;
|
||||
import com.cloud.hypervisor.vmware.util.VmwareGuestOsMapper;
|
||||
import com.cloud.hypervisor.vmware.util.VmwareHelper;
|
||||
import com.cloud.network.Networks;
|
||||
import com.cloud.network.Networks.BroadcastDomainType;
|
||||
|
|
@ -1408,7 +1408,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
|||
tearDownVm(vmMo);
|
||||
}else if (!hyperHost.createBlankVm(vmNameOnVcenter, vmInternalCSName, vmSpec.getCpus(), vmSpec.getMaxSpeed().intValue(),
|
||||
getReservedCpuMHZ(vmSpec), vmSpec.getLimitCpuUse(), (int)(vmSpec.getMaxRam() / (1024 * 1024)), getReservedMemoryMb(vmSpec),
|
||||
translateGuestOsIdentifier(vmSpec.getArch(), vmSpec.getOs()).value(), rootDiskDataStoreDetails.first(), false)) {
|
||||
translateGuestOsIdentifier(vmSpec.getArch(), vmSpec.getOs(), vmSpec.getPlatformEmulator()).value(), rootDiskDataStoreDetails.first(), false)) {
|
||||
throw new Exception("Failed to create VM. vmName: " + vmInternalCSName);
|
||||
}
|
||||
}
|
||||
|
|
@ -1432,7 +1432,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
|||
}
|
||||
|
||||
VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();
|
||||
String guestOsId = translateGuestOsIdentifier(vmSpec.getArch(), vmSpec.getOs()).value();
|
||||
String guestOsId = translateGuestOsIdentifier(vmSpec.getArch(), vmSpec.getOs(), vmSpec.getPlatformEmulator()).value();
|
||||
|
||||
VmwareHelper.setBasicVmConfig(vmConfigSpec, vmSpec.getCpus(), vmSpec.getMaxSpeed(),
|
||||
getReservedCpuMHZ(vmSpec), (int)(vmSpec.getMaxRam() / (1024 * 1024)), getReservedMemoryMb(vmSpec),
|
||||
|
|
@ -4426,13 +4426,25 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
|||
}
|
||||
}
|
||||
|
||||
private VirtualMachineGuestOsIdentifier translateGuestOsIdentifier(String cpuArchitecture, String cloudGuestOs) {
|
||||
private VirtualMachineGuestOsIdentifier translateGuestOsIdentifier(String cpuArchitecture, String guestOs, String cloudGuestOs) {
|
||||
if (cpuArchitecture == null) {
|
||||
s_logger.warn("CPU arch is not set, default to i386. guest os: " + cloudGuestOs);
|
||||
s_logger.warn("CPU arch is not set, default to i386. guest os: " + guestOs);
|
||||
cpuArchitecture = "i386";
|
||||
}
|
||||
|
||||
VirtualMachineGuestOsIdentifier identifier = VmwareGuestOsMapper.getGuestOsIdentifier(cloudGuestOs);
|
||||
if(cloudGuestOs == null) {
|
||||
s_logger.warn("Guest OS mapping name is not set for guest os: " + guestOs);
|
||||
}
|
||||
|
||||
VirtualMachineGuestOsIdentifier identifier = null;
|
||||
try {
|
||||
if (cloudGuestOs != null) {
|
||||
identifier = VirtualMachineGuestOsIdentifier.fromValue(cloudGuestOs);
|
||||
s_logger.debug("Using mapping name : " + identifier.toString());
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
s_logger.warn("Unable to find Guest OS Identifier in VMware for mapping name: " + cloudGuestOs + ". Continuing with defaults.");
|
||||
}
|
||||
if (identifier != null) {
|
||||
return identifier;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue