mirror of https://github.com/apache/cloudstack.git
bug 11428: Under VMware with current version, for snapshot related related operations,
1) if snapshot is originally created from root volume, allow only CreateTemplateCommand from snapshot 2) if snapshot is originally created from data volume, allow only CreateVolumeCommand from snapshot Reviewed by - Kishan status 11428: resolved fixed
This commit is contained in:
parent
fff9e275b1
commit
18a243e1d6
|
|
@ -109,6 +109,7 @@ import com.cloud.exception.ResourceAllocationException;
|
|||
import com.cloud.exception.ResourceInUseException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.exception.StorageUnavailableException;
|
||||
import com.cloud.exception.UnsupportedServiceException;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.host.Status;
|
||||
|
|
@ -1712,6 +1713,12 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
|||
throw new InvalidParameterValueException("unable to find a snapshot with id " + snapshotId + " for this account");
|
||||
}
|
||||
}
|
||||
|
||||
// bug #11428. Operation not supported if vmware and snapshots parent volume = ROOT
|
||||
if(snapshotCheck.getHypervisorType() == HypervisorType.VMware
|
||||
&& ApiDBUtils.findVolumeById(snapshotCheck.getVolumeId()).getVolumeType() == Type.ROOT){
|
||||
throw new UnsupportedServiceException("operation not supported, snapshot with id " + snapshotId + " is created from ROOT volume");
|
||||
}
|
||||
}
|
||||
|
||||
// Verify that zone exists
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ import com.cloud.exception.PermissionDeniedException;
|
|||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.exception.StorageUnavailableException;
|
||||
import com.cloud.exception.UnsupportedServiceException;
|
||||
import com.cloud.exception.VirtualMachineMigrationException;
|
||||
import com.cloud.ha.HighAvailabilityManager;
|
||||
import com.cloud.host.Host;
|
||||
|
|
@ -1394,6 +1395,8 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
|||
hyperType = _volsDao.getHypervisorType(volumeId);
|
||||
} else { // create template from snapshot
|
||||
SnapshotVO snapshot = _snapshotDao.findById(snapshotId);
|
||||
volume = _volsDao.findById(snapshot.getVolumeId());
|
||||
|
||||
if (snapshot == null) {
|
||||
throw new InvalidParameterValueException("Failed to create private template record, unable to find snapshot " + snapshotId);
|
||||
}
|
||||
|
|
@ -1401,11 +1404,16 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
|||
if (snapshot.getStatus() != Snapshot.Status.BackedUp) {
|
||||
throw new InvalidParameterValueException("Snapshot id=" + snapshotId + " is not in " + Snapshot.Status.BackedUp + " state yet and can't be used for template creation");
|
||||
}
|
||||
|
||||
// bug #11428. Operation not supported if vmware and snapshots parent volume = ROOT
|
||||
if(snapshot.getHypervisorType() == HypervisorType.VMware && volume.getVolumeType() == Type.DATADISK){
|
||||
throw new UnsupportedServiceException("operation not supported, snapshot with id " + snapshotId + " is created from Data Disk");
|
||||
}
|
||||
|
||||
domainId = snapshot.getDomainId();
|
||||
accountId = snapshot.getAccountId();
|
||||
hyperType = snapshot.getHypervisorType();
|
||||
volume = _volsDao.findById(snapshot.getVolumeId());
|
||||
|
||||
}
|
||||
|
||||
if (!isAdmin) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue