bug 12158: only allow storage migration through migratevm api, iff no data disks attached to the vm. As data disks may have different service offering with the specified storage pool

status 12158: resolved fixed
This commit is contained in:
Edison Su 2011-12-20 17:09:41 -08:00
parent 39f03cf7c6
commit 009fa8c079

View File

@ -3235,6 +3235,11 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
if (vm.getType() != VirtualMachine.Type.User) {
throw new InvalidParameterValueException("can only do storage migration on user vm");
}
List<VolumeVO> vols = _volsDao.findByInstance(vm.getId());
if (vols.size() > 1) {
throw new InvalidParameterValueException("Data disks attached to the vm, can not migrate. Need to dettach data disks at first");
}
HypervisorType destHypervisorType = _clusterDao.findById(destPool.getClusterId()).getHypervisorType();
if (vm.getHypervisorType() != destHypervisorType) {