mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
fix boot from iso/attach iso/disks issue
This commit is contained in:
parent
2e77e3bcd8
commit
712953156b
@ -63,11 +63,16 @@ public class VolumeTO {
|
||||
this.storagePoolUuid = pool.getUuid();
|
||||
this.mountPoint = volume.getFolder();
|
||||
this.chainInfo = volume.getChainInfo();
|
||||
this.deviceId = volume.getDeviceId().intValue();
|
||||
}
|
||||
|
||||
public int getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setDeviceId(int id) {
|
||||
this.deviceId = id;
|
||||
}
|
||||
|
||||
public Storage.StorageResourceType getResourceType() {
|
||||
return resourceType;
|
||||
|
||||
@ -34,6 +34,7 @@ import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
import com.cloud.uservm.UserVm;
|
||||
@ -121,8 +122,8 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
|
||||
return group;
|
||||
}
|
||||
|
||||
public String getHypervisor() {
|
||||
return hypervisor;
|
||||
public HypervisorType getHypervisor() {
|
||||
return HypervisorType.getType(hypervisor);
|
||||
}
|
||||
|
||||
public List<String> getNetworkGroupList() {
|
||||
|
||||
@ -23,6 +23,7 @@ import com.cloud.agent.api.to.VolumeTO;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import com.cloud.template.VirtualMachineTemplate.BootloaderType;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
|
||||
@ -106,4 +107,7 @@ public interface VirtualMachineProfile<T extends VirtualMachine> {
|
||||
VirtualMachine.Type getType();
|
||||
|
||||
void setParameter(String name, Object value);
|
||||
|
||||
void setBootLoaderType(BootloaderType bootLoader);
|
||||
BootloaderType getBootLoaderType();
|
||||
}
|
||||
|
||||
@ -692,7 +692,11 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
||||
|
||||
protected VDI mount(Connection conn, String vmName, VolumeTO volume) throws XmlRpcException, XenAPIException {
|
||||
if (volume.getType() == VolumeType.ISO) {
|
||||
|
||||
String isopath = volume.getPath();
|
||||
if (isopath == null) {
|
||||
return null;
|
||||
}
|
||||
int index = isopath.lastIndexOf("/");
|
||||
|
||||
String mountpoint = isopath.substring(0, index);
|
||||
@ -724,7 +728,11 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
||||
|
||||
VBD.Record vbdr = new VBD.Record();
|
||||
vbdr.VM = vm;
|
||||
vbdr.VDI = vdi;
|
||||
if (vdi != null)
|
||||
vbdr.VDI = vdi;
|
||||
else {
|
||||
vbdr.empty = true;
|
||||
}
|
||||
if (type == VolumeType.ROOT) {
|
||||
vbdr.bootable = true;
|
||||
}
|
||||
|
||||
@ -463,7 +463,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
|
||||
}
|
||||
}
|
||||
} else {
|
||||
VirtualMachineProfileImpl<VMInstanceVO> vmProfile = new VirtualMachineProfileImpl<VMInstanceVO>(vm, template, offering, null, null);
|
||||
VirtualMachineProfileImpl<VMInstanceVO> vmProfile = new VirtualMachineProfileImpl<VMInstanceVO>(vm, template, offering, null, null, null);
|
||||
DeployDestination dest = null;
|
||||
DataCenterDeployment plan = new DataCenterDeployment(dc.getId(), pod.getId(), sp.getClusterId(), null);
|
||||
ExcludeList avoids = new ExcludeList();
|
||||
|
||||
@ -576,7 +576,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
|
||||
ConsoleProxyVO proxy = _consoleProxyDao.findById(proxyVmId);
|
||||
Account systemAcct = _accountMgr.getSystemAccount();
|
||||
User systemUser = _accountMgr.getSystemUser();
|
||||
return _itMgr.start(proxy, null, systemUser, systemAcct);
|
||||
return _itMgr.start(proxy, null, systemUser, systemAcct, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1113,7 +1113,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
|
||||
}
|
||||
ConsoleProxyVO proxy = new ConsoleProxyVO(id, _serviceOffering.getId(), name, _template.getId(), _template.getGuestOSId(), dataCenterId, systemAcct.getDomainId(), systemAcct.getId(), 0);
|
||||
try {
|
||||
proxy = _itMgr.allocate(proxy, _template, _serviceOffering, networks, plan, systemAcct);
|
||||
proxy = _itMgr.allocate(proxy, _template, _serviceOffering, networks, plan, null, systemAcct);
|
||||
} catch (InsufficientCapacityException e) {
|
||||
s_logger.warn("InsufficientCapacity", e);
|
||||
throw new CloudRuntimeException("Insufficient capacity exception", e);
|
||||
|
||||
@ -45,13 +45,10 @@ public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru
|
||||
|
||||
@Override
|
||||
public <T extends VirtualMachine> VirtualMachineTO implement(VirtualMachineProfile<T> vm) {
|
||||
VirtualMachineTemplate template = vm.getTemplate();
|
||||
|
||||
BootloaderType bt = BootloaderType.PyGrub;
|
||||
if (template.getFormat() == Storage.ImageFormat.ISO || template.isRequiresHvm()) {
|
||||
bt = BootloaderType.HVM;
|
||||
if (vm.getBootLoaderType() != null) {
|
||||
bt = vm.getBootLoaderType();
|
||||
}
|
||||
|
||||
VirtualMachineTO to = toVirtualMachineTO(vm);
|
||||
to.setBootloader(bt);
|
||||
|
||||
|
||||
@ -2116,10 +2116,10 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
|
||||
networks.add(new Pair<NetworkVO, NicProfile>(controlConfig, null));
|
||||
|
||||
router = new DomainRouterVO(id, _offering.getId(), VirtualMachineName.getRouterName(id, _instance), _template.getId(), _template.getGuestOSId(), owner.getDomainId(), owner.getId(), guestConfig.getId(), _offering.getOfferHA());
|
||||
router = _itMgr.allocate(router, _template, _offering, networks, plan, owner);
|
||||
router = _itMgr.allocate(router, _template, _offering, networks, plan, null, owner);
|
||||
}
|
||||
|
||||
return _itMgr.start(router, null, _accountService.getSystemUser(), _accountService.getSystemAccount());
|
||||
return _itMgr.start(router, null, _accountService.getSystemUser(), _accountService.getSystemAccount(), null);
|
||||
}
|
||||
|
||||
|
||||
@ -2159,10 +2159,10 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
|
||||
|
||||
router = new DomainRouterVO(id, _offering.getId(), VirtualMachineName.getRouterName(id, _instance), _template.getId(), _template.getGuestOSId(), owner.getDomainId(), owner.getId(), guestConfig.getId(), _offering.getOfferHA());
|
||||
router.setRole(Role.DHCP_USERDATA);
|
||||
router = _itMgr.allocate(router, _template, _offering, networks, plan, owner);
|
||||
router = _itMgr.allocate(router, _template, _offering, networks, plan, null, owner);
|
||||
}
|
||||
|
||||
return _itMgr.start(router, null, _accountService.getSystemUser(), _accountService.getSystemAccount());
|
||||
return _itMgr.start(router, null, _accountService.getSystemUser(), _accountService.getSystemAccount(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -2343,7 +2343,7 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
|
||||
}
|
||||
|
||||
public DomainRouterVO start(DomainRouterVO router, User user, Account caller) throws StorageUnavailableException, InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException {
|
||||
return _itMgr.start(router, null, user, caller);
|
||||
return _itMgr.start(router, null, user, caller, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -2783,6 +2783,7 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
||||
}
|
||||
throw new StorageUnavailableException("Unable to create " + newVol, newVol);
|
||||
}
|
||||
created.first().setDeviceId(newVol.getDeviceId().intValue());
|
||||
newVol.setStatus(AsyncInstanceCreateStatus.Created);
|
||||
newVol.setFolder(created.second().getPath());
|
||||
newVol.setPath(created.first().getPath());
|
||||
|
||||
@ -281,7 +281,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
||||
SecondaryStorageVmVO secStorageVm = _secStorageVmDao.findById(secStorageVmId);
|
||||
Account systemAcct = _accountMgr.getSystemAccount();
|
||||
User systemUser = _accountMgr.getSystemUser();
|
||||
return _itMgr.start(secStorageVm, null, systemUser, systemAcct);
|
||||
return _itMgr.start(secStorageVm, null, systemUser, systemAcct, null);
|
||||
}
|
||||
|
||||
@Override @DB
|
||||
@ -772,7 +772,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
||||
SecondaryStorageVmVO secStorageVm = new SecondaryStorageVmVO(id, _serviceOffering.getId(), name, _template.getId(),
|
||||
_template.getGuestOSId(), dataCenterId, systemAcct.getDomainId(), systemAcct.getId());
|
||||
try {
|
||||
secStorageVm = _itMgr.allocate(secStorageVm, _template, _serviceOffering, networks, plan, systemAcct);
|
||||
secStorageVm = _itMgr.allocate(secStorageVm, _template, _serviceOffering, networks, plan, null, systemAcct);
|
||||
} catch (InsufficientCapacityException e) {
|
||||
s_logger.warn("InsufficientCapacity", e);
|
||||
throw new CloudRuntimeException("Insufficient capacity exception", e);
|
||||
|
||||
@ -60,6 +60,7 @@ import com.cloud.agent.api.StartCommand;
|
||||
import com.cloud.agent.api.StopCommand;
|
||||
import com.cloud.agent.api.VmStatsEntry;
|
||||
import com.cloud.agent.api.storage.CreatePrivateTemplateAnswer;
|
||||
import com.cloud.agent.api.to.VolumeTO;
|
||||
import com.cloud.agent.manager.Commands;
|
||||
import com.cloud.alert.AlertManager;
|
||||
import com.cloud.api.ApiDBUtils;
|
||||
@ -154,6 +155,8 @@ import com.cloud.storage.GuestOSVO;
|
||||
import com.cloud.storage.SnapshotVO;
|
||||
import com.cloud.storage.Storage;
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
import com.cloud.storage.Storage.StorageResourceType;
|
||||
import com.cloud.storage.Storage.TemplateType;
|
||||
import com.cloud.storage.StorageManager;
|
||||
import com.cloud.storage.StoragePoolVO;
|
||||
@ -3756,7 +3759,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
||||
template.getId(), template.getGuestOSId(), offering.getOfferHA(), domainId, owner.getId(), offering.getId(), userData);
|
||||
|
||||
try{
|
||||
if (_itMgr.allocate(vm, template, offering, rootDiskOffering, dataDiskOfferings, networks, null, plan, owner) == null) {
|
||||
if (_itMgr.allocate(vm, template, offering, rootDiskOffering, dataDiskOfferings, networks, null, plan, cmd.getHypervisor(), owner) == null) {
|
||||
return null;
|
||||
}
|
||||
}finally{
|
||||
@ -3792,19 +3795,42 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
||||
|
||||
AccountVO owner = _accountDao.findById(vm.getAccountId());
|
||||
|
||||
vm = _itMgr.start(vm, null, caller, owner);
|
||||
vm = _itMgr.start(vm, null, caller, owner, cmd.getHypervisor());
|
||||
vm.setPassword(password);
|
||||
return vm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean finalizeVirtualMachineProfile(VirtualMachineProfile<UserVmVO> profile, DeployDestination dest, ReservationContext context) {
|
||||
UserVmVO vo = profile.getVirtualMachine();
|
||||
VirtualMachineTemplate template = profile.getTemplate();
|
||||
if (template.getFormat() == ImageFormat.ISO && template.isBootable()) {
|
||||
|
||||
}
|
||||
return true;
|
||||
UserVmVO vo = profile.getVirtualMachine();
|
||||
VirtualMachineTemplate template = profile.getTemplate();
|
||||
if (vo.getIsoId() != null) {
|
||||
template = _templateDao.findById(vo.getIsoId());
|
||||
}
|
||||
if (template != null && template.getFormat() == ImageFormat.ISO && template.isBootable()) {
|
||||
String isoPath = null;
|
||||
Pair<String, String> isoPathPair = _storageMgr.getAbsoluteIsoPath(template.getId(), vo.getDataCenterId());
|
||||
if (isoPathPair == null) {
|
||||
s_logger.warn("Couldn't get absolute iso path");
|
||||
return false;
|
||||
} else {
|
||||
isoPath = isoPathPair.first();
|
||||
}
|
||||
profile.setBootLoaderType(BootloaderType.CD);
|
||||
VolumeTO iso = new VolumeTO(profile.getId(), Volume.VolumeType.ISO, StorageResourceType.STORAGE_POOL, StoragePoolType.ISO, null, template.getName(), null, isoPath,
|
||||
0, null);
|
||||
iso.setDeviceId(3);
|
||||
profile.addDisk(iso);
|
||||
vo.setIsoId(template.getId());
|
||||
} else {
|
||||
/*create a iso placeholder*/
|
||||
VolumeTO iso = new VolumeTO(profile.getId(), Volume.VolumeType.ISO, StorageResourceType.STORAGE_POOL, StoragePoolType.ISO, null, template.getName(), null, null,
|
||||
0, null);
|
||||
iso.setDeviceId(3);
|
||||
profile.addDisk(iso);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -3904,8 +3930,9 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
||||
|
||||
userId = accountAndUserValidation(vmId, account, userId, vm);
|
||||
UserVO user = _userDao.findById(userId);
|
||||
|
||||
return _itMgr.start(vm, null, user, account);
|
||||
VolumeVO disk = _volsDao.findByInstance(vmId).get(0);
|
||||
HypervisorType hyperType = _volsDao.getHypervisorType(disk.getId());
|
||||
return _itMgr.start(vm, null, user, account, hyperType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -25,6 +25,7 @@ import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.OperationTimedoutException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.network.NetworkVO;
|
||||
import com.cloud.service.ServiceOfferingVO;
|
||||
import com.cloud.storage.DiskOfferingVO;
|
||||
@ -48,6 +49,7 @@ public interface VirtualMachineManager extends Manager {
|
||||
List<Pair<NetworkVO, NicProfile>> networks,
|
||||
Map<String, Object> params,
|
||||
DeploymentPlan plan,
|
||||
HypervisorType hyperType,
|
||||
Account owner) throws InsufficientCapacityException, ResourceUnavailableException;
|
||||
|
||||
<T extends VMInstanceVO> T allocate(T vm,
|
||||
@ -57,6 +59,7 @@ public interface VirtualMachineManager extends Manager {
|
||||
Pair<DiskOfferingVO, Long> dataDiskOffering,
|
||||
List<Pair<NetworkVO, NicProfile>> networks,
|
||||
DeploymentPlan plan,
|
||||
HypervisorType hyperType,
|
||||
Account owner) throws InsufficientCapacityException, ResourceUnavailableException;
|
||||
|
||||
<T extends VMInstanceVO> T allocate(T vm,
|
||||
@ -64,9 +67,10 @@ public interface VirtualMachineManager extends Manager {
|
||||
ServiceOfferingVO serviceOffering,
|
||||
List<Pair<NetworkVO, NicProfile>> networkProfiles,
|
||||
DeploymentPlan plan,
|
||||
HypervisorType hyperType,
|
||||
Account owner) throws InsufficientCapacityException, ResourceUnavailableException;
|
||||
|
||||
<T extends VMInstanceVO> T start(T vm, Map<String, Object> params, User caller, Account account) throws InsufficientCapacityException, ResourceUnavailableException;
|
||||
<T extends VMInstanceVO> T start(T vm, Map<String, Object> params, User caller, Account account, HypervisorType hyperType) throws InsufficientCapacityException, ResourceUnavailableException;
|
||||
|
||||
<T extends VMInstanceVO> boolean stop(T vm, User caller, Account account) throws ResourceUnavailableException;
|
||||
|
||||
@ -77,7 +81,7 @@ public interface VirtualMachineManager extends Manager {
|
||||
boolean stateTransitTo(VMInstanceVO vm, Event e, Long id);
|
||||
|
||||
|
||||
<T extends VMInstanceVO> T advanceStart(T vm, Map<String, Object> params, User caller, Account account) throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException, OperationTimedoutException;
|
||||
<T extends VMInstanceVO> T advanceStart(T vm, Map<String, Object> params, User caller, Account account, HypervisorType hyperType) throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException, OperationTimedoutException;
|
||||
|
||||
<T extends VMInstanceVO> boolean advanceStop(T vm, User caller, Account account) throws ResourceUnavailableException, OperationTimedoutException, ConcurrentOperationException;
|
||||
|
||||
|
||||
@ -146,12 +146,13 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Cluster
|
||||
List<Pair<NetworkVO, NicProfile>> networks,
|
||||
Map<String, Object> params,
|
||||
DeploymentPlan plan,
|
||||
HypervisorType hyperType,
|
||||
Account owner) throws InsufficientCapacityException {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Allocating entries for VM: " + vm);
|
||||
}
|
||||
|
||||
VirtualMachineProfileImpl<T> vmProfile = new VirtualMachineProfileImpl<T>(vm, template, serviceOffering, owner, params);
|
||||
VirtualMachineProfileImpl<T> vmProfile = new VirtualMachineProfileImpl<T>(vm, template, serviceOffering, owner, params, hyperType);
|
||||
|
||||
vm.setDataCenterId(plan.getDataCenterId());
|
||||
if (plan.getPodId() != null) {
|
||||
@ -209,12 +210,13 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Cluster
|
||||
Pair<DiskOfferingVO, Long> dataDiskOffering,
|
||||
List<Pair<NetworkVO, NicProfile>> networks,
|
||||
DeploymentPlan plan,
|
||||
HypervisorType hyperType,
|
||||
Account owner) throws InsufficientCapacityException {
|
||||
List<Pair<DiskOfferingVO, Long>> diskOfferings = new ArrayList<Pair<DiskOfferingVO, Long>>(1);
|
||||
if (dataDiskOffering != null) {
|
||||
diskOfferings.add(dataDiskOffering);
|
||||
}
|
||||
return allocate(vm, template, serviceOffering, new Pair<DiskOfferingVO, Long>(serviceOffering, rootSize), diskOfferings, networks, null, plan, owner);
|
||||
return allocate(vm, template, serviceOffering, new Pair<DiskOfferingVO, Long>(serviceOffering, rootSize), diskOfferings, networks, null, plan, hyperType, owner);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -223,8 +225,9 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Cluster
|
||||
ServiceOfferingVO serviceOffering,
|
||||
List<Pair<NetworkVO, NicProfile>> networks,
|
||||
DeploymentPlan plan,
|
||||
HypervisorType hyperType,
|
||||
Account owner) throws InsufficientCapacityException {
|
||||
return allocate(vm, template, serviceOffering, new Pair<DiskOfferingVO, Long>(serviceOffering, null), null, networks, null, plan, owner);
|
||||
return allocate(vm, template, serviceOffering, new Pair<DiskOfferingVO, Long>(serviceOffering, null), null, networks, null, plan, hyperType, owner);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@ -321,16 +324,16 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Cluster
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends VMInstanceVO> T start(T vm, Map<String, Object> params, User caller, Account account) throws InsufficientCapacityException, ResourceUnavailableException {
|
||||
public <T extends VMInstanceVO> T start(T vm, Map<String, Object> params, User caller, Account account, HypervisorType hyperType) throws InsufficientCapacityException, ResourceUnavailableException {
|
||||
try {
|
||||
return advanceStart(vm, params, caller, account);
|
||||
return advanceStart(vm, params, caller, account, hyperType);
|
||||
} catch (ConcurrentOperationException e) {
|
||||
throw new CloudRuntimeException("Unable to start a VM due to concurrent operation", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends VMInstanceVO> T advanceStart(T vm, Map<String, Object> params, User caller, Account account) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException {
|
||||
public <T extends VMInstanceVO> T advanceStart(T vm, Map<String, Object> params, User caller, Account account, HypervisorType hyperType) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException {
|
||||
State state = vm.getState();
|
||||
if (state == State.Starting || state == State.Running) {
|
||||
s_logger.debug("VM is already started: " + vm);
|
||||
@ -358,7 +361,12 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Cluster
|
||||
|
||||
DataCenterDeployment plan = new DataCenterDeployment(vm.getDataCenterId(), vm.getPodId(), null, null);
|
||||
|
||||
HypervisorGuru hvGuru = _hvGurus.get(template.getHypervisorType());
|
||||
HypervisorGuru hvGuru;
|
||||
if (hyperType != null && !hyperType.equals(HypervisorType.None)) {
|
||||
hvGuru = _hvGurus.get(hyperType);
|
||||
} else {
|
||||
hvGuru = _hvGurus.get(template.getHypervisorType());
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
VirtualMachineGuru<T> vmGuru = (VirtualMachineGuru<T>)_vmGurus.get(vm.getType());
|
||||
|
||||
@ -378,7 +386,7 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Cluster
|
||||
stateTransitTo(vm, Event.OperationRetry, dest.getHost().getId());
|
||||
}
|
||||
|
||||
VirtualMachineProfileImpl<T> vmProfile = new VirtualMachineProfileImpl<T>(vm, template, offering, null, params);
|
||||
VirtualMachineProfileImpl<T> vmProfile = new VirtualMachineProfileImpl<T>(vm, template, offering, null, params, hyperType);
|
||||
|
||||
for (DeploymentPlanner planner : _planners) {
|
||||
dest = planner.plan(vmProfile, plan, avoids);
|
||||
|
||||
@ -51,8 +51,9 @@ public class VirtualMachineProfileImpl<T extends VMInstanceVO> implements Virtua
|
||||
BootloaderType _bootloader;
|
||||
|
||||
VirtualMachine.Type _type;
|
||||
HypervisorType _hyperType;
|
||||
|
||||
public VirtualMachineProfileImpl(T vm, VMTemplateVO template, ServiceOfferingVO offering, Account owner, Map<String, Object> params) {
|
||||
public VirtualMachineProfileImpl(T vm, VMTemplateVO template, ServiceOfferingVO offering, Account owner, Map<String, Object> params, HypervisorType hyperType) {
|
||||
_vm = vm;
|
||||
_template = template;
|
||||
_offering = offering;
|
||||
@ -62,10 +63,11 @@ public class VirtualMachineProfileImpl<T extends VMInstanceVO> implements Virtua
|
||||
_params = new HashMap<String, Object>();
|
||||
}
|
||||
_type = vm.getType();
|
||||
_hyperType = hyperType;
|
||||
}
|
||||
|
||||
public VirtualMachineProfileImpl(T vm) {
|
||||
this(vm, null, null, null, null);
|
||||
this(vm, null, null, null, null, null);
|
||||
}
|
||||
|
||||
public VirtualMachineProfileImpl(VirtualMachine.Type type) {
|
||||
@ -95,6 +97,11 @@ public class VirtualMachineProfileImpl<T extends VMInstanceVO> implements Virtua
|
||||
_params.put(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBootLoaderType(BootloaderType bootLoader) {
|
||||
this._bootloader = bootLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualMachineTemplate getTemplate() {
|
||||
if (_template == null) {
|
||||
@ -105,6 +112,9 @@ public class VirtualMachineProfileImpl<T extends VMInstanceVO> implements Virtua
|
||||
|
||||
@Override
|
||||
public HypervisorType getHypervisorType() {
|
||||
if (_hyperType != null && !_hyperType.equals(HypervisorType.None)) {
|
||||
return _hyperType;
|
||||
}
|
||||
getTemplate();
|
||||
return _template.getHypervisorType();
|
||||
}
|
||||
@ -215,4 +225,9 @@ public class VirtualMachineProfileImpl<T extends VMInstanceVO> implements Virtua
|
||||
public String getInstanceName() {
|
||||
return _vm.getInstanceName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BootloaderType getBootLoaderType() {
|
||||
return this._bootloader;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user