bug 11428: For volumes use findIdIncludingRemoved since volumes can be removed

Reviewed by - Kishan
status 11428: resolved fixed
This commit is contained in:
Nitin 2011-11-07 19:05:44 +05:30
parent 18a243e1d6
commit e9b21dad49
2 changed files with 3 additions and 2 deletions

View File

@ -1716,7 +1716,7 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
// bug #11428. Operation not supported if vmware and snapshots parent volume = ROOT
if(snapshotCheck.getHypervisorType() == HypervisorType.VMware
&& ApiDBUtils.findVolumeById(snapshotCheck.getVolumeId()).getVolumeType() == Type.ROOT){
&& _volumeDao.findByIdIncludingRemoved(snapshotCheck.getVolumeId()).getVolumeType() == Type.ROOT){
throw new UnsupportedServiceException("operation not supported, snapshot with id " + snapshotId + " is created from ROOT volume");
}
}

View File

@ -1396,6 +1396,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
} else { // create template from snapshot
SnapshotVO snapshot = _snapshotDao.findById(snapshotId);
volume = _volsDao.findById(snapshot.getVolumeId());
VolumeVO snapshotVolume = _volsDao.findByIdIncludingRemoved(snapshot.getVolumeId());
if (snapshot == null) {
throw new InvalidParameterValueException("Failed to create private template record, unable to find snapshot " + snapshotId);
@ -1406,7 +1407,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
}
// bug #11428. Operation not supported if vmware and snapshots parent volume = ROOT
if(snapshot.getHypervisorType() == HypervisorType.VMware && volume.getVolumeType() == Type.DATADISK){
if(snapshot.getHypervisorType() == HypervisorType.VMware && snapshotVolume.getVolumeType() == Type.DATADISK){
throw new UnsupportedServiceException("operation not supported, snapshot with id " + snapshotId + " is created from Data Disk");
}