mirror of https://github.com/apache/cloudstack.git
Moved the rest of VirtualMachineManager to be vm agnostic
This commit is contained in:
parent
9bc5870f01
commit
e99a1ef1d9
|
|
@ -51,7 +51,6 @@ import com.cloud.exception.InsufficientCapacityException;
|
|||
import com.cloud.exception.InsufficientServerCapacityException;
|
||||
import com.cloud.exception.OperationTimedoutException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.exception.VirtualMachineMigrationException;
|
||||
import com.cloud.ha.dao.HighAvailabilityDao;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.HostVO;
|
||||
|
|
@ -573,20 +572,15 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai
|
|||
try {
|
||||
work.setStep(Step.Migrating);
|
||||
_haDao.update(work.getId(), work);
|
||||
|
||||
VMInstanceVO vm = _instanceDao.findById(vmId);
|
||||
|
||||
if (!_itMgr.migrateAway(work.getType(), vmId, srcHostId)) {
|
||||
s_logger.warn("Unable to migrate vm from " + srcHostId);
|
||||
_resourceMgr.maintenanceFailed(srcHostId);
|
||||
}
|
||||
_itMgr.migrateAway(vm.getUuid(), srcHostId);
|
||||
return null;
|
||||
} catch (InsufficientServerCapacityException e) {
|
||||
s_logger.warn("Insufficient capacity for migrating a VM.");
|
||||
_resourceMgr.maintenanceFailed(srcHostId);
|
||||
return (System.currentTimeMillis() >> 10) + _migrateRetryInterval;
|
||||
} catch (VirtualMachineMigrationException e) {
|
||||
s_logger.warn("Looks like VM is still starting, we need to retry migrating the VM later.");
|
||||
_resourceMgr.maintenanceFailed(srcHostId);
|
||||
return (System.currentTimeMillis() >> 10) + _migrateRetryInterval;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import org.apache.cloudstack.api.command.user.volume.MigrateVolumeCmd;
|
|||
import org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.UploadVolumeCmd;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||
|
||||
import com.cloud.agent.api.to.VirtualMachineTO;
|
||||
import com.cloud.deploy.DeployDestination;
|
||||
|
|
@ -41,6 +40,7 @@ import com.cloud.storage.Volume.Type;
|
|||
import com.cloud.user.Account;
|
||||
import com.cloud.vm.DiskProfile;
|
||||
import com.cloud.vm.VMInstanceVO;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
|
||||
public interface VolumeManager extends VolumeApiService {
|
||||
|
|
@ -91,8 +91,8 @@ public interface VolumeManager extends VolumeApiService {
|
|||
@Override
|
||||
Volume migrateVolume(MigrateVolumeCmd cmd);
|
||||
|
||||
<T extends VMInstanceVO> void migrateVolumes(T vm, VirtualMachineTO vmTo, Host srcHost, Host destHost,
|
||||
Map<VolumeVO, StoragePoolVO> volumeToPool);
|
||||
void migrateVolumes(VirtualMachine vm, VirtualMachineTO vmTo, Host srcHost, Host destHost,
|
||||
Map<Volume, StoragePool> volumeToPool);
|
||||
|
||||
boolean storageMigration(VirtualMachineProfile vm, StoragePool destPool);
|
||||
|
||||
|
|
|
|||
|
|
@ -2243,15 +2243,15 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T extends VMInstanceVO> void migrateVolumes(T vm, VirtualMachineTO vmTo, Host srcHost, Host destHost,
|
||||
Map<VolumeVO, StoragePoolVO> volumeToPool) {
|
||||
public void migrateVolumes(VirtualMachine vm, VirtualMachineTO vmTo, Host srcHost, Host destHost,
|
||||
Map<Volume, StoragePool> volumeToPool) {
|
||||
// Check if all the vms being migrated belong to the vm.
|
||||
// Check if the storage pool is of the right type.
|
||||
// Create a VolumeInfo to DataStore map too.
|
||||
Map<VolumeInfo, DataStore> volumeMap = new HashMap<VolumeInfo, DataStore>();
|
||||
for (Map.Entry<VolumeVO, StoragePoolVO> entry : volumeToPool.entrySet()) {
|
||||
VolumeVO volume = entry.getKey();
|
||||
StoragePoolVO storagePool = entry.getValue();
|
||||
for (Map.Entry<Volume, StoragePool> entry : volumeToPool.entrySet()) {
|
||||
Volume volume = entry.getKey();
|
||||
StoragePool storagePool = entry.getValue();
|
||||
StoragePool destPool = (StoragePool)dataStoreMgr.getDataStore(storagePool.getId(),
|
||||
DataStoreRole.Primary);
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,9 @@ import javax.ejb.Local;
|
|||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
|
||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||
import org.apache.cloudstack.affinity.AffinityGroupService;
|
||||
|
|
@ -66,8 +69,6 @@ import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
|
|||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||
import org.apache.cloudstack.storage.to.TemplateObjectTO;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.api.Answer;
|
||||
|
|
@ -735,8 +736,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||
private UserVm rebootVirtualMachine(long userId, long vmId)
|
||||
throws InsufficientCapacityException, ResourceUnavailableException {
|
||||
UserVmVO vm = _vmDao.findById(vmId);
|
||||
User caller = _accountMgr.getActiveUser(userId);
|
||||
Account owner = _accountMgr.getAccount(vm.getAccountId());
|
||||
|
||||
if (vm == null || vm.getState() == State.Destroyed
|
||||
|| vm.getState() == State.Expunging || vm.getRemoved() != null) {
|
||||
|
|
@ -746,10 +745,10 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||
|
||||
if (vm.getState() == State.Running && vm.getHostId() != null) {
|
||||
collectVmDiskStatistics(vm);
|
||||
return _itMgr.reboot(vm, null, caller, owner);
|
||||
_itMgr.reboot(vm.getUuid(), null);
|
||||
return _vmDao.findById(vmId);
|
||||
} else {
|
||||
s_logger.error("Vm id=" + vmId
|
||||
+ " is not in Running state, failed to reboot");
|
||||
s_logger.error("Vm id=" + vmId + " is not in Running state, failed to reboot");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -3875,8 +3874,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||
if (uservm != null) {
|
||||
collectVmDiskStatistics(uservm);
|
||||
}
|
||||
VMInstanceVO migratedVm = _itMgr.migrate(vm, srcHostId, dest);
|
||||
return migratedVm;
|
||||
_itMgr.migrate(vm.getUuid(), srcHostId, dest);
|
||||
return _vmDao.findById(vmId);
|
||||
}
|
||||
|
||||
private boolean checkIfHostIsDedicated(HostVO host) {
|
||||
|
|
@ -4164,7 +4163,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||
}
|
||||
|
||||
List<VolumeVO> vmVolumes = _volsDao.findUsableVolumesForInstance(vm.getId());
|
||||
Map<VolumeVO, StoragePoolVO> volToPoolObjectMap = new HashMap<VolumeVO, StoragePoolVO>();
|
||||
Map<Volume, StoragePool> volToPoolObjectMap = new HashMap<Volume, StoragePool>();
|
||||
if (!isVMUsingLocalStorage(vm) && destinationHost.getClusterId().equals(srcHost.getClusterId())) {
|
||||
if (volumeToPool.isEmpty()) {
|
||||
// If the destination host is in the same cluster and volumes do not have to be migrated across pools
|
||||
|
|
@ -4214,8 +4213,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||
|
||||
checkHostsDedication(vm, srcHostId, destinationHost.getId());
|
||||
|
||||
VMInstanceVO migratedVm = _itMgr.migrateWithStorage(vm, srcHostId, destinationHost.getId(), volToPoolObjectMap);
|
||||
return migratedVm;
|
||||
_itMgr.migrateWithStorage(vm.getUuid(), srcHostId, destinationHost.getId(), volToPoolObjectMap);
|
||||
return _vmDao.findById(vm.getId());
|
||||
}
|
||||
|
||||
@DB
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@ import java.net.URI;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||
|
||||
import com.cloud.agent.api.to.NicTO;
|
||||
import com.cloud.agent.api.to.VirtualMachineTO;
|
||||
import com.cloud.deploy.DeployDestination;
|
||||
|
|
@ -43,9 +41,7 @@ import com.cloud.service.ServiceOfferingVO;
|
|||
import com.cloud.storage.DiskOfferingVO;
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.storage.VolumeVO;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.component.Manager;
|
||||
import com.cloud.utils.fsm.NoTransitionException;
|
||||
|
|
@ -96,15 +92,16 @@ public interface VirtualMachineManager extends Manager {
|
|||
|
||||
void destroy(String vmUuid) throws AgentUnavailableException, OperationTimedoutException, ConcurrentOperationException;
|
||||
|
||||
boolean migrateAway(VirtualMachine.Type type, long vmid, long hostId) throws InsufficientServerCapacityException, VirtualMachineMigrationException;
|
||||
void migrateAway(String vmUuid, long hostId) throws InsufficientServerCapacityException;
|
||||
|
||||
<T extends VMInstanceVO> T migrate(T vm, long srcHostId, DeployDestination dest) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException;
|
||||
void migrate(String vmUuid, long srcHostId, DeployDestination dest) throws ResourceUnavailableException, ConcurrentOperationException;
|
||||
|
||||
<T extends VMInstanceVO> T migrateWithStorage(T vm, long srcId, long destId, Map<VolumeVO, StoragePoolVO> volumeToPool) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException;
|
||||
void migrateWithStorage(String vmUuid, long srcId, long destId, Map<Volume, StoragePool> volumeToPool) throws ResourceUnavailableException, ConcurrentOperationException;
|
||||
|
||||
<T extends VMInstanceVO> T reboot(T vm, Map<VirtualMachineProfile.Param, Object> params, User caller, Account account) throws InsufficientCapacityException, ResourceUnavailableException;
|
||||
void reboot(String vmUuid, Map<VirtualMachineProfile.Param, Object> params) throws InsufficientCapacityException, ResourceUnavailableException;
|
||||
|
||||
<T extends VMInstanceVO> T advanceReboot(T vm, Map<VirtualMachineProfile.Param, Object> params, User caller, Account account) throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException, OperationTimedoutException;
|
||||
void advanceReboot(String vmUuid, Map<VirtualMachineProfile.Param, Object> params) throws InsufficientCapacityException, ResourceUnavailableException,
|
||||
ConcurrentOperationException, OperationTimedoutException;
|
||||
|
||||
/**
|
||||
* Check to see if a virtual machine can be upgraded to the given service offering
|
||||
|
|
|
|||
|
|
@ -1443,17 +1443,18 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T extends VMInstanceVO> T migrate(T vmm, long srcHostId, DeployDestination dest) throws ResourceUnavailableException, ConcurrentOperationException,
|
||||
ManagementServerException,
|
||||
VirtualMachineMigrationException {
|
||||
VMInstanceVO vm = _vmDao.findByUuid(vmm.getUuid());
|
||||
public void migrate(String vmUuid, long srcHostId, DeployDestination dest) throws ResourceUnavailableException, ConcurrentOperationException {
|
||||
VMInstanceVO vm = _vmDao.findByUuid(vmUuid);
|
||||
if (vm == null) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Unable to find the vm " + vm);
|
||||
s_logger.debug("Unable to find the vm " + vmUuid);
|
||||
}
|
||||
throw new CloudRuntimeException("Unable to find a virtual machine with id " + vmm.getUuid());
|
||||
throw new CloudRuntimeException("Unable to find a virtual machine with id " + vmUuid);
|
||||
}
|
||||
migrate(vm, srcHostId, dest);
|
||||
}
|
||||
|
||||
protected void migrate(VMInstanceVO vm, long srcHostId, DeployDestination dest) throws ResourceUnavailableException, ConcurrentOperationException {
|
||||
s_logger.info("Migrating " + vm + " to " + dest);
|
||||
|
||||
long dstHostId = dest.getHost().getId();
|
||||
|
|
@ -1474,7 +1475,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("VM is not Running, unable to migrate the vm " + vm);
|
||||
}
|
||||
throw new VirtualMachineMigrationException("VM is not Running, unable to migrate the vm currently " + vm + " , current state: " + vm.getState().toString());
|
||||
throw new CloudRuntimeException("VM is not Running, unable to migrate the vm currently " + vm + " , current state: " + vm.getState().toString());
|
||||
}
|
||||
|
||||
short alertType = AlertManager.ALERT_TYPE_USERVM_MIGRATE;
|
||||
|
|
@ -1542,8 +1543,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
try {
|
||||
MigrateAnswer ma = (MigrateAnswer) _agentMgr.send(vm.getLastHostId(), mc);
|
||||
if (!ma.getResult()) {
|
||||
s_logger.error("Unable to migrate due to " + ma.getDetails());
|
||||
return null;
|
||||
throw new CloudRuntimeException("Unable to migrate due to " + ma.getDetails());
|
||||
}
|
||||
} catch (OperationTimedoutException e) {
|
||||
if (e.isActive()) {
|
||||
|
|
@ -1570,13 +1570,12 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
s_logger.error("AgentUnavailableException while cleanup on source host: " + srcHostId);
|
||||
}
|
||||
cleanup(vmGuru, new VirtualMachineProfileImpl(vm), work, Event.AgentReportStopped, true);
|
||||
return null;
|
||||
throw new CloudRuntimeException("Unable to complete migration for " + vm);
|
||||
}
|
||||
} catch (OperationTimedoutException e) {
|
||||
}
|
||||
|
||||
migrated = true;
|
||||
return vmm;
|
||||
} finally {
|
||||
if (!migrated) {
|
||||
s_logger.info("Migration was unsuccessful. Cleaning up: " + vm);
|
||||
|
|
@ -1604,11 +1603,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
}
|
||||
}
|
||||
|
||||
private Map<VolumeVO, StoragePoolVO> getPoolListForVolumesForMigration(VirtualMachineProfile profile,
|
||||
Host host, Map<VolumeVO, StoragePoolVO> volumeToPool) {
|
||||
private Map<Volume, StoragePool> getPoolListForVolumesForMigration(VirtualMachineProfile profile, Host host, Map<Volume, StoragePool> volumeToPool) {
|
||||
List<VolumeVO> allVolumes = _volsDao.findUsableVolumesForInstance(profile.getId());
|
||||
for (VolumeVO volume : allVolumes) {
|
||||
StoragePoolVO pool = volumeToPool.get(volume);
|
||||
StoragePool pool = volumeToPool.get(volume);
|
||||
DiskOfferingVO diskOffering = _diskOfferingDao.findById(volume.getDiskOfferingId());
|
||||
StoragePoolVO currentPool = _storagePoolDao.findById(volume.getPoolId());
|
||||
if (pool != null) {
|
||||
|
|
@ -1692,10 +1690,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T extends VMInstanceVO> T migrateWithStorage(T vmm, long srcHostId, long destHostId,
|
||||
Map<VolumeVO, StoragePoolVO> volumeToPool) throws ResourceUnavailableException, ConcurrentOperationException,
|
||||
ManagementServerException, VirtualMachineMigrationException {
|
||||
VMInstanceVO vm = _vmDao.findByUuid(vmm.getUuid());
|
||||
public void migrateWithStorage(String vmUuid, long srcHostId, long destHostId, Map<Volume, StoragePool> volumeToPool) throws ResourceUnavailableException,
|
||||
ConcurrentOperationException {
|
||||
VMInstanceVO vm = _vmDao.findByUuid(vmUuid);
|
||||
|
||||
HostVO srcHost = _hostDao.findById(srcHostId);
|
||||
HostVO destHost = _hostDao.findById(destHostId);
|
||||
|
|
@ -1756,14 +1753,13 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
s_logger.error("AgentUnavailableException while cleanup on source host: " + srcHostId);
|
||||
}
|
||||
cleanup(vmGuru, new VirtualMachineProfileImpl(vm), work, Event.AgentReportStopped, true);
|
||||
return null;
|
||||
throw new CloudRuntimeException("VM not found on desintation host. Unable to complete migration for " + vm);
|
||||
}
|
||||
} catch (OperationTimedoutException e) {
|
||||
s_logger.warn("Error while checking the vm " + vm + " is on host " + destHost, e);
|
||||
}
|
||||
|
||||
migrated = true;
|
||||
return vmm;
|
||||
} finally {
|
||||
if (!migrated) {
|
||||
s_logger.info("Migration was unsuccessful. Cleaning up: " + vm);
|
||||
|
|
@ -1832,11 +1828,11 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean migrateAway(VirtualMachine.Type vmType, long vmId, long srcHostId) throws InsufficientServerCapacityException, VirtualMachineMigrationException {
|
||||
VMInstanceVO vm = _vmDao.findById(vmId);
|
||||
public void migrateAway(String vmUuid, long srcHostId) throws InsufficientServerCapacityException {
|
||||
VMInstanceVO vm = _vmDao.findByUuid(vmUuid);
|
||||
if (vm == null) {
|
||||
s_logger.debug("Unable to find a VM for " + vmId);
|
||||
return true;
|
||||
s_logger.debug("Unable to find a VM for " + vmUuid);
|
||||
throw new CloudRuntimeException("Unable to find " + vmUuid);
|
||||
}
|
||||
|
||||
VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
|
||||
|
|
@ -1844,7 +1840,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
Long hostId = vm.getHostId();
|
||||
if (hostId == null) {
|
||||
s_logger.debug("Unable to migrate because the VM doesn't have a host id: " + vm);
|
||||
return true;
|
||||
throw new CloudRuntimeException("Unable to migrate " + vmUuid);
|
||||
}
|
||||
|
||||
Host host = _hostDao.findById(hostId);
|
||||
|
|
@ -1876,38 +1872,28 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
}
|
||||
|
||||
excludes.addHost(dest.getHost().getId());
|
||||
VMInstanceVO vmInstance = null;
|
||||
try {
|
||||
vmInstance = migrate(vm, srcHostId, dest);
|
||||
migrate(vm, srcHostId, dest);
|
||||
return;
|
||||
} catch (ResourceUnavailableException e) {
|
||||
s_logger.debug("Unable to migrate to unavailable " + dest);
|
||||
} catch (ConcurrentOperationException e) {
|
||||
s_logger.debug("Unable to migrate VM due to: " + e.getMessage());
|
||||
} catch (ManagementServerException e) {
|
||||
s_logger.debug("Unable to migrate VM: " + e.getMessage());
|
||||
} catch (VirtualMachineMigrationException e) {
|
||||
s_logger.debug("Got VirtualMachineMigrationException, Unable to migrate: " + e.getMessage());
|
||||
if (vm.getState() == State.Starting) {
|
||||
s_logger.debug("VM seems to be still Starting, we should retry migration later");
|
||||
throw e;
|
||||
} else {
|
||||
s_logger.debug("Unable to migrate VM, VM is not in Running or even Starting state, current state: " + vm.getState().toString());
|
||||
}
|
||||
}
|
||||
if (vmInstance != null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
advanceStop(vm, true);
|
||||
return true;
|
||||
throw new CloudRuntimeException("Unable to migrate " + vm);
|
||||
} catch (ResourceUnavailableException e) {
|
||||
s_logger.debug("Unable to stop VM due to " + e.getMessage());
|
||||
throw new CloudRuntimeException("Unable to migrate " + vm);
|
||||
} catch (ConcurrentOperationException e) {
|
||||
s_logger.debug("Unable to stop VM due to " + e.getMessage());
|
||||
throw new CloudRuntimeException("Unable to migrate " + vm);
|
||||
} catch (OperationTimedoutException e) {
|
||||
s_logger.debug("Unable to stop VM due to " + e.getMessage());
|
||||
throw new CloudRuntimeException("Unable to migrate " + vm);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1938,18 +1924,18 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T extends VMInstanceVO> T reboot(T vm, Map<VirtualMachineProfile.Param, Object> params, User caller, Account account) throws InsufficientCapacityException, ResourceUnavailableException {
|
||||
public void reboot(String vmUuid, Map<VirtualMachineProfile.Param, Object> params) throws InsufficientCapacityException, ResourceUnavailableException {
|
||||
try {
|
||||
return advanceReboot(vm, params, caller, account);
|
||||
advanceReboot(vmUuid, params);
|
||||
} catch (ConcurrentOperationException e) {
|
||||
throw new CloudRuntimeException("Unable to reboot a VM due to concurrent operation", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends VMInstanceVO> T advanceReboot(T vm, Map<VirtualMachineProfile.Param, Object> params, User caller, Account account) throws InsufficientCapacityException,
|
||||
ConcurrentOperationException, ResourceUnavailableException {
|
||||
T rebootedVm = null;
|
||||
public void advanceReboot(String vmUuid, Map<VirtualMachineProfile.Param, Object> params) throws InsufficientCapacityException, ConcurrentOperationException,
|
||||
ResourceUnavailableException {
|
||||
VMInstanceVO vm = _vmDao.findByUuid(vmUuid);
|
||||
|
||||
DataCenter dc = _configMgr.getZone(vm.getDataCenterId());
|
||||
Host host = _hostDao.findById(vm.getHostId());
|
||||
|
|
@ -1968,16 +1954,13 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
|
||||
Answer rebootAnswer = cmds.getAnswer(RebootAnswer.class);
|
||||
if (rebootAnswer != null && rebootAnswer.getResult()) {
|
||||
rebootedVm = vm;
|
||||
return rebootedVm;
|
||||
return;
|
||||
}
|
||||
s_logger.info("Unable to reboot VM " + vm + " on " + dest.getHost() + " due to " + (rebootAnswer == null ? " no reboot answer" : rebootAnswer.getDetails()));
|
||||
} catch (OperationTimedoutException e) {
|
||||
s_logger.warn("Unable to send the reboot command to host " + dest.getHost() + " for the vm " + vm + " due to operation timeout", e);
|
||||
throw new CloudRuntimeException("Failed to reboot the vm on host " + dest.getHost());
|
||||
}
|
||||
|
||||
return rebootedVm;
|
||||
}
|
||||
|
||||
public Command cleanup(VirtualMachine vm) {
|
||||
|
|
|
|||
|
|
@ -79,8 +79,10 @@ import com.cloud.network.NetworkManager;
|
|||
import com.cloud.server.ConfigurationServer;
|
||||
import com.cloud.service.ServiceOfferingVO;
|
||||
import com.cloud.storage.DiskOfferingVO;
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.storage.StoragePoolHostVO;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.storage.VolumeManager;
|
||||
import com.cloud.storage.VolumeVO;
|
||||
import com.cloud.storage.dao.DiskOfferingDao;
|
||||
|
|
@ -104,134 +106,149 @@ import com.cloud.vm.snapshot.VMSnapshotManager;
|
|||
|
||||
public class VirtualMachineManagerImplTest {
|
||||
|
||||
@Spy VirtualMachineManagerImpl _vmMgr = new VirtualMachineManagerImpl();
|
||||
@Mock
|
||||
VolumeManager _storageMgr;
|
||||
@Mock
|
||||
Account _account;
|
||||
@Mock
|
||||
AccountManager _accountMgr;
|
||||
@Mock
|
||||
ConfigurationManager _configMgr;
|
||||
@Mock
|
||||
CapacityManager _capacityMgr;
|
||||
@Mock
|
||||
AgentManager _agentMgr;
|
||||
@Mock
|
||||
AccountDao _accountDao;
|
||||
@Mock
|
||||
ConfigurationDao _configDao;
|
||||
@Mock
|
||||
HostDao _hostDao;
|
||||
@Mock
|
||||
UserDao _userDao;
|
||||
@Mock
|
||||
UserVmDao _vmDao;
|
||||
@Mock
|
||||
ItWorkDao _workDao;
|
||||
@Mock
|
||||
VMInstanceDao _vmInstanceDao;
|
||||
@Mock
|
||||
VMTemplateDao _templateDao;
|
||||
@Mock
|
||||
VolumeDao _volsDao;
|
||||
@Mock
|
||||
RestoreVMCmd _restoreVMCmd;
|
||||
@Mock
|
||||
AccountVO _accountMock;
|
||||
@Mock
|
||||
UserVO _userMock;
|
||||
@Mock
|
||||
UserVmVO _vmMock;
|
||||
@Mock
|
||||
VMInstanceVO _vmInstance;
|
||||
@Mock
|
||||
HostVO _host;
|
||||
@Mock
|
||||
VMTemplateVO _templateMock;
|
||||
@Mock
|
||||
VolumeVO _volumeMock;
|
||||
@Mock
|
||||
List<VolumeVO> _rootVols;
|
||||
@Mock
|
||||
ItWorkVO _work;
|
||||
@Mock
|
||||
ConfigurationServer _configServer;
|
||||
@Mock
|
||||
HostVO hostVO;
|
||||
@Mock
|
||||
UserVmDetailVO _vmDetailVO;
|
||||
@Spy
|
||||
VirtualMachineManagerImpl _vmMgr = new VirtualMachineManagerImpl();
|
||||
@Mock
|
||||
VolumeManager _storageMgr;
|
||||
@Mock
|
||||
Account _account;
|
||||
@Mock
|
||||
AccountManager _accountMgr;
|
||||
@Mock
|
||||
ConfigurationManager _configMgr;
|
||||
@Mock
|
||||
CapacityManager _capacityMgr;
|
||||
@Mock
|
||||
AgentManager _agentMgr;
|
||||
@Mock
|
||||
AccountDao _accountDao;
|
||||
@Mock
|
||||
ConfigurationDao _configDao;
|
||||
@Mock
|
||||
HostDao _hostDao;
|
||||
@Mock
|
||||
UserDao _userDao;
|
||||
@Mock
|
||||
UserVmDao _vmDao;
|
||||
@Mock
|
||||
ItWorkDao _workDao;
|
||||
@Mock
|
||||
VMInstanceDao _vmInstanceDao;
|
||||
@Mock
|
||||
VMTemplateDao _templateDao;
|
||||
@Mock
|
||||
VolumeDao _volsDao;
|
||||
@Mock
|
||||
RestoreVMCmd _restoreVMCmd;
|
||||
@Mock
|
||||
AccountVO _accountMock;
|
||||
@Mock
|
||||
UserVO _userMock;
|
||||
@Mock
|
||||
UserVmVO _vmMock;
|
||||
@Mock
|
||||
VMInstanceVO _vmInstance;
|
||||
@Mock
|
||||
HostVO _host;
|
||||
@Mock
|
||||
VMTemplateVO _templateMock;
|
||||
@Mock
|
||||
VolumeVO _volumeMock;
|
||||
@Mock
|
||||
List<VolumeVO> _rootVols;
|
||||
@Mock
|
||||
ItWorkVO _work;
|
||||
@Mock
|
||||
ConfigurationServer _configServer;
|
||||
@Mock
|
||||
HostVO hostVO;
|
||||
@Mock
|
||||
UserVmDetailVO _vmDetailVO;
|
||||
|
||||
@Mock ClusterDao _clusterDao;
|
||||
@Mock HostPodDao _podDao;
|
||||
@Mock DataCenterDao _dcDao;
|
||||
@Mock DiskOfferingDao _diskOfferingDao;
|
||||
@Mock PrimaryDataStoreDao _storagePoolDao;
|
||||
@Mock UserVmDetailsDao _vmDetailsDao;
|
||||
@Mock StoragePoolHostDao _poolHostDao;
|
||||
@Mock NetworkManager _networkMgr;
|
||||
@Mock HypervisorGuruManager _hvGuruMgr;
|
||||
@Mock VMSnapshotManager _vmSnapshotMgr;
|
||||
@Mock
|
||||
ClusterDao _clusterDao;
|
||||
@Mock
|
||||
HostPodDao _podDao;
|
||||
@Mock
|
||||
DataCenterDao _dcDao;
|
||||
@Mock
|
||||
DiskOfferingDao _diskOfferingDao;
|
||||
@Mock
|
||||
PrimaryDataStoreDao _storagePoolDao;
|
||||
@Mock
|
||||
UserVmDetailsDao _vmDetailsDao;
|
||||
@Mock
|
||||
StoragePoolHostDao _poolHostDao;
|
||||
@Mock
|
||||
NetworkManager _networkMgr;
|
||||
@Mock
|
||||
HypervisorGuruManager _hvGuruMgr;
|
||||
@Mock
|
||||
VMSnapshotManager _vmSnapshotMgr;
|
||||
|
||||
// Mock objects for vm migration with storage test.
|
||||
@Mock DiskOfferingVO _diskOfferingMock;
|
||||
@Mock StoragePoolVO _srcStoragePoolMock;
|
||||
@Mock StoragePoolVO _destStoragePoolMock;
|
||||
@Mock HostVO _srcHostMock;
|
||||
@Mock HostVO _destHostMock;
|
||||
@Mock Map<VolumeVO, StoragePoolVO> _volumeToPoolMock;
|
||||
// Mock objects for vm migration with storage test.
|
||||
@Mock
|
||||
DiskOfferingVO _diskOfferingMock;
|
||||
@Mock
|
||||
StoragePoolVO _srcStoragePoolMock;
|
||||
@Mock
|
||||
StoragePoolVO _destStoragePoolMock;
|
||||
@Mock
|
||||
HostVO _srcHostMock;
|
||||
@Mock
|
||||
HostVO _destHostMock;
|
||||
@Mock
|
||||
Map<Volume, StoragePool> _volumeToPoolMock;
|
||||
|
||||
@Before
|
||||
public void setup(){
|
||||
MockitoAnnotations.initMocks(this);
|
||||
@Before
|
||||
public void setup() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
|
||||
_vmMgr._templateDao = _templateDao;
|
||||
_vmMgr._volsDao = _volsDao;
|
||||
_vmMgr.volumeMgr = _storageMgr;
|
||||
_vmMgr._accountDao = _accountDao;
|
||||
_vmMgr._accountMgr = _accountMgr;
|
||||
_vmMgr._configMgr = _configMgr;
|
||||
_vmMgr._capacityMgr = _capacityMgr;
|
||||
_vmMgr._hostDao = _hostDao;
|
||||
_vmMgr._nodeId = 1L;
|
||||
_vmMgr._workDao = _workDao;
|
||||
_vmMgr._agentMgr = _agentMgr;
|
||||
_vmMgr._podDao = _podDao;
|
||||
_vmMgr._clusterDao = _clusterDao;
|
||||
_vmMgr._dcDao = _dcDao;
|
||||
_vmMgr._diskOfferingDao = _diskOfferingDao;
|
||||
_vmMgr._storagePoolDao = _storagePoolDao;
|
||||
_vmMgr._poolHostDao= _poolHostDao;
|
||||
_vmMgr._networkMgr = _networkMgr;
|
||||
_vmMgr._hvGuruMgr = _hvGuruMgr;
|
||||
_vmMgr._vmSnapshotMgr = _vmSnapshotMgr;
|
||||
_vmMgr._vmDao = _vmInstanceDao;
|
||||
_vmMgr._configServer = _configServer;
|
||||
_vmMgr._uservmDetailsDao = _vmDetailsDao;
|
||||
_vmMgr._templateDao = _templateDao;
|
||||
_vmMgr._volsDao = _volsDao;
|
||||
_vmMgr.volumeMgr = _storageMgr;
|
||||
_vmMgr._accountDao = _accountDao;
|
||||
_vmMgr._accountMgr = _accountMgr;
|
||||
_vmMgr._configMgr = _configMgr;
|
||||
_vmMgr._capacityMgr = _capacityMgr;
|
||||
_vmMgr._hostDao = _hostDao;
|
||||
_vmMgr._nodeId = 1L;
|
||||
_vmMgr._workDao = _workDao;
|
||||
_vmMgr._agentMgr = _agentMgr;
|
||||
_vmMgr._podDao = _podDao;
|
||||
_vmMgr._clusterDao = _clusterDao;
|
||||
_vmMgr._dcDao = _dcDao;
|
||||
_vmMgr._diskOfferingDao = _diskOfferingDao;
|
||||
_vmMgr._storagePoolDao = _storagePoolDao;
|
||||
_vmMgr._poolHostDao = _poolHostDao;
|
||||
_vmMgr._networkMgr = _networkMgr;
|
||||
_vmMgr._hvGuruMgr = _hvGuruMgr;
|
||||
_vmMgr._vmSnapshotMgr = _vmSnapshotMgr;
|
||||
_vmMgr._vmDao = _vmInstanceDao;
|
||||
_vmMgr._configServer = _configServer;
|
||||
_vmMgr._uservmDetailsDao = _vmDetailsDao;
|
||||
|
||||
when(_vmMock.getId()).thenReturn(314l);
|
||||
when(_vmInstance.getId()).thenReturn(1L);
|
||||
when(_vmInstance.getServiceOfferingId()).thenReturn(2L);
|
||||
when(_vmInstance.getInstanceName()).thenReturn("myVm");
|
||||
when(_vmInstance.getHostId()).thenReturn(2L);
|
||||
when(_vmInstance.getType()).thenReturn(VirtualMachine.Type.User);
|
||||
when(_host.getId()).thenReturn(1L);
|
||||
when(_hostDao.findById(anyLong())).thenReturn(null);
|
||||
when(_configMgr.getServiceOffering(anyLong())).thenReturn(getSvcoffering(512));
|
||||
when(_workDao.persist(_work)).thenReturn(_work);
|
||||
when(_workDao.update("1", _work)).thenReturn(true);
|
||||
when(_work.getId()).thenReturn("1");
|
||||
doNothing().when(_work).setStep(ItWorkVO.Step.Done);
|
||||
when(_vmMock.getId()).thenReturn(314l);
|
||||
when(_vmInstance.getId()).thenReturn(1L);
|
||||
when(_vmInstance.getServiceOfferingId()).thenReturn(2L);
|
||||
when(_vmInstance.getInstanceName()).thenReturn("myVm");
|
||||
when(_vmInstance.getHostId()).thenReturn(2L);
|
||||
when(_vmInstance.getType()).thenReturn(VirtualMachine.Type.User);
|
||||
when(_host.getId()).thenReturn(1L);
|
||||
when(_hostDao.findById(anyLong())).thenReturn(null);
|
||||
when(_configMgr.getServiceOffering(anyLong())).thenReturn(getSvcoffering(512));
|
||||
when(_workDao.persist(_work)).thenReturn(_work);
|
||||
when(_workDao.update("1", _work)).thenReturn(true);
|
||||
when(_work.getId()).thenReturn("1");
|
||||
doNothing().when(_work).setStep(ItWorkVO.Step.Done);
|
||||
when(_vmInstanceDao.findByUuid(any(String.class))).thenReturn(_vmMock);
|
||||
//doNothing().when(_volsDao).detachVolume(anyLong());
|
||||
//when(_work.setStep(ItWorkVO.Step.Done)).thenReturn("1");
|
||||
//doNothing().when(_volsDao).detachVolume(anyLong());
|
||||
//when(_work.setStep(ItWorkVO.Step.Done)).thenReturn("1");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test(expected=CloudRuntimeException.class)
|
||||
public void testScaleVM1() throws Exception {
|
||||
}
|
||||
|
||||
@Test(expected = CloudRuntimeException.class)
|
||||
public void testScaleVM1() throws Exception {
|
||||
|
||||
DeployDestination dest = new DeployDestination(null, null, null, _host);
|
||||
long l = 1L;
|
||||
|
|
@ -241,8 +258,8 @@ public class VirtualMachineManagerImplTest {
|
|||
|
||||
}
|
||||
|
||||
@Test (expected=CloudRuntimeException.class)
|
||||
public void testScaleVM2() throws Exception {
|
||||
@Test(expected = CloudRuntimeException.class)
|
||||
public void testScaleVM2() throws Exception {
|
||||
|
||||
DeployDestination dest = new DeployDestination(null, null, null, _host);
|
||||
long l = 1L;
|
||||
|
|
@ -260,15 +277,16 @@ public class VirtualMachineManagerImplTest {
|
|||
when(_configServer.getConfigValue(Config.MemOverprovisioningFactor.key(), Config.ConfigurationParameterScope.cluster.toString(), 1L)).thenReturn("1.0");
|
||||
when(_configServer.getConfigValue(Config.CPUOverprovisioningFactor.key(), Config.ConfigurationParameterScope.cluster.toString(), 1L)).thenReturn("1.0");
|
||||
ScaleVmCommand reconfigureCmd = new ScaleVmCommand("myVmName", newServiceOffering.getCpu(),
|
||||
newServiceOffering.getSpeed(), newServiceOffering.getSpeed(), newServiceOffering.getRamSize(), newServiceOffering.getRamSize(), newServiceOffering.getLimitCpuUse(), true);
|
||||
newServiceOffering.getSpeed(), newServiceOffering.getSpeed(), newServiceOffering.getRamSize(), newServiceOffering.getRamSize(),
|
||||
newServiceOffering.getLimitCpuUse(), true);
|
||||
Answer answer = new ScaleVmAnswer(reconfigureCmd, true, "details");
|
||||
when(_agentMgr.send(2l, reconfigureCmd)).thenReturn(null);
|
||||
_vmMgr.reConfigureVm(_vmInstance, getSvcoffering(256), false);
|
||||
|
||||
}
|
||||
|
||||
@Test (expected=CloudRuntimeException.class)
|
||||
public void testScaleVM3() throws Exception {
|
||||
@Test(expected = CloudRuntimeException.class)
|
||||
public void testScaleVM3() throws Exception {
|
||||
|
||||
/*VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
|
||||
|
||||
|
|
@ -285,10 +303,9 @@ public class VirtualMachineManagerImplTest {
|
|||
|
||||
}
|
||||
|
||||
private ServiceOfferingVO getSvcoffering(int ramSize) {
|
||||
|
||||
private ServiceOfferingVO getSvcoffering(int ramSize){
|
||||
|
||||
long id = 4L;
|
||||
long id = 4L;
|
||||
String name = "name";
|
||||
String displayText = "displayText";
|
||||
int cpu = 1;
|
||||
|
|
@ -303,7 +320,7 @@ public class VirtualMachineManagerImplTest {
|
|||
}
|
||||
|
||||
private void initializeMockConfigForMigratingVmWithVolumes() throws OperationTimedoutException,
|
||||
ResourceUnavailableException {
|
||||
ResourceUnavailableException {
|
||||
|
||||
// Mock the source and destination hosts.
|
||||
when(_srcHostMock.getId()).thenReturn(5L);
|
||||
|
|
@ -315,7 +332,7 @@ public class VirtualMachineManagerImplTest {
|
|||
when(_vmMock.getId()).thenReturn(1L);
|
||||
when(_vmMock.getHypervisorType()).thenReturn(HypervisorType.XenServer);
|
||||
when(_vmMock.getState()).thenReturn(State.Running).thenReturn(State.Running).thenReturn(State.Migrating)
|
||||
.thenReturn(State.Migrating);
|
||||
.thenReturn(State.Migrating);
|
||||
when(_vmMock.getHostId()).thenReturn(5L);
|
||||
when(_vmInstance.getId()).thenReturn(1L);
|
||||
when(_vmInstance.getServiceOfferingId()).thenReturn(2L);
|
||||
|
|
@ -323,7 +340,7 @@ public class VirtualMachineManagerImplTest {
|
|||
when(_vmInstance.getHostId()).thenReturn(5L);
|
||||
when(_vmInstance.getType()).thenReturn(VirtualMachine.Type.User);
|
||||
when(_vmInstance.getState()).thenReturn(State.Running).thenReturn(State.Running).thenReturn(State.Migrating)
|
||||
.thenReturn(State.Migrating);
|
||||
.thenReturn(State.Migrating);
|
||||
|
||||
// Mock the work item.
|
||||
when(_workDao.persist(any(ItWorkVO.class))).thenReturn(_work);
|
||||
|
|
@ -391,43 +408,43 @@ public class VirtualMachineManagerImplTest {
|
|||
when(_agentMgr.send(anyLong(), isA(CheckVirtualMachineCommand.class))).thenReturn(checkVmAnswerMock);
|
||||
|
||||
// Mock the state transitions of vm.
|
||||
Pair<Long, Long> opaqueMock = new Pair<Long, Long> (_vmMock.getHostId(), _destHostMock.getId());
|
||||
Pair<Long, Long> opaqueMock = new Pair<Long, Long>(_vmMock.getHostId(), _destHostMock.getId());
|
||||
when(_vmSnapshotMgr.hasActiveVMSnapshotTasks(anyLong())).thenReturn(false);
|
||||
when(_vmInstanceDao.updateState(State.Running, Event.MigrationRequested, State.Migrating, _vmMock, opaqueMock))
|
||||
.thenReturn(true);
|
||||
.thenReturn(true);
|
||||
when(_vmInstanceDao.updateState(State.Migrating, Event.OperationSucceeded, State.Running, _vmMock, opaqueMock))
|
||||
.thenReturn(true);
|
||||
.thenReturn(true);
|
||||
}
|
||||
|
||||
// Check migration of a vm with its volumes within a cluster.
|
||||
@Test
|
||||
public void testMigrateWithVolumeWithinCluster() throws ResourceUnavailableException, ConcurrentOperationException,
|
||||
ManagementServerException, VirtualMachineMigrationException, OperationTimedoutException {
|
||||
ManagementServerException, VirtualMachineMigrationException, OperationTimedoutException {
|
||||
|
||||
initializeMockConfigForMigratingVmWithVolumes();
|
||||
when(_srcHostMock.getClusterId()).thenReturn(3L);
|
||||
when(_destHostMock.getClusterId()).thenReturn(3L);
|
||||
|
||||
_vmMgr.migrateWithStorage(_vmInstance, _srcHostMock.getId(), _destHostMock.getId(), _volumeToPoolMock);
|
||||
_vmMgr.migrateWithStorage(_vmInstance.getUuid(), _srcHostMock.getId(), _destHostMock.getId(), _volumeToPoolMock);
|
||||
}
|
||||
|
||||
// Check migration of a vm with its volumes across a cluster.
|
||||
@Test
|
||||
public void testMigrateWithVolumeAcrossCluster() throws ResourceUnavailableException, ConcurrentOperationException,
|
||||
ManagementServerException, VirtualMachineMigrationException, OperationTimedoutException {
|
||||
ManagementServerException, VirtualMachineMigrationException, OperationTimedoutException {
|
||||
|
||||
initializeMockConfigForMigratingVmWithVolumes();
|
||||
when(_srcHostMock.getClusterId()).thenReturn(3L);
|
||||
when(_destHostMock.getClusterId()).thenReturn(4L);
|
||||
|
||||
_vmMgr.migrateWithStorage(_vmInstance, _srcHostMock.getId(), _destHostMock.getId(), _volumeToPoolMock);
|
||||
_vmMgr.migrateWithStorage(_vmInstance.getUuid(), _srcHostMock.getId(), _destHostMock.getId(), _volumeToPoolMock);
|
||||
}
|
||||
|
||||
// Check migration of a vm fails when src and destination pool are not of same type; that is, one is shared and
|
||||
// other is local.
|
||||
@Test(expected=CloudRuntimeException.class)
|
||||
@Test(expected = CloudRuntimeException.class)
|
||||
public void testMigrateWithVolumeFail1() throws ResourceUnavailableException, ConcurrentOperationException,
|
||||
ManagementServerException, VirtualMachineMigrationException, OperationTimedoutException {
|
||||
ManagementServerException, VirtualMachineMigrationException, OperationTimedoutException {
|
||||
|
||||
initializeMockConfigForMigratingVmWithVolumes();
|
||||
when(_srcHostMock.getClusterId()).thenReturn(3L);
|
||||
|
|
@ -436,13 +453,13 @@ public class VirtualMachineManagerImplTest {
|
|||
when(_destStoragePoolMock.isLocal()).thenReturn(true);
|
||||
when(_diskOfferingMock.getUseLocalStorage()).thenReturn(false);
|
||||
|
||||
_vmMgr.migrateWithStorage(_vmInstance, _srcHostMock.getId(), _destHostMock.getId(), _volumeToPoolMock);
|
||||
_vmMgr.migrateWithStorage(_vmInstance.getUuid(), _srcHostMock.getId(), _destHostMock.getId(), _volumeToPoolMock);
|
||||
}
|
||||
|
||||
// Check migration of a vm fails when vm is not in Running state.
|
||||
@Test(expected=ConcurrentOperationException.class)
|
||||
@Test(expected = ConcurrentOperationException.class)
|
||||
public void testMigrateWithVolumeFail2() throws ResourceUnavailableException, ConcurrentOperationException,
|
||||
ManagementServerException, VirtualMachineMigrationException, OperationTimedoutException {
|
||||
ManagementServerException, VirtualMachineMigrationException, OperationTimedoutException {
|
||||
|
||||
initializeMockConfigForMigratingVmWithVolumes();
|
||||
when(_srcHostMock.getClusterId()).thenReturn(3L);
|
||||
|
|
@ -450,6 +467,6 @@ public class VirtualMachineManagerImplTest {
|
|||
|
||||
when(_vmMock.getState()).thenReturn(State.Stopped);
|
||||
|
||||
_vmMgr.migrateWithStorage(_vmInstance, _srcHostMock.getId(), _destHostMock.getId(), _volumeToPoolMock);
|
||||
_vmMgr.migrateWithStorage(_vmInstance.getUuid(), _srcHostMock.getId(), _destHostMock.getId(), _volumeToPoolMock);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue