use of org.ovirt.engine.core.common.businessentities.SubchainInfo in project ovirt-engine by oVirt.
the class RemoveSnapshotCommand method getAllDisksSnapshot.
/**
* The base snapshot is the parent of the top snapshot. This is reversed the if old cold merge
* is performed (pre-4.1).
*
* @param snapshots list of the parent snapshot disks
* @return list of subchains which contain the base and top snapshots.
*/
protected List<SubchainInfo> getAllDisksSnapshot(List<DiskImage> snapshots) {
Set<DiskImage> topSnapshots = diskImageDao.getAllSnapshotsForParents(snapshots.stream().map(DiskImage::getImageId).collect(Collectors.toList()));
Map<Guid, DiskImage> baseSnapshotMap = snapshots.stream().collect(Collectors.toMap(DiskImage::getImageId, Function.identity()));
return topSnapshots.stream().map(topSnapshot -> {
if (!isQemuimgCommitSupported() && getSnapshotActionType() == ActionType.RemoveSnapshotSingleDisk) {
return new SubchainInfo(topSnapshot, baseSnapshotMap.get(topSnapshot.getParentId()));
} else {
return new SubchainInfo(baseSnapshotMap.get(topSnapshot.getParentId()), topSnapshot);
}
}).collect(Collectors.toList());
}
use of org.ovirt.engine.core.common.businessentities.SubchainInfo in project ovirt-engine by oVirt.
the class ColdMergeSnapshotSingleDiskCommand method buildColdMergeParameters.
private ColdMergeCommandParameters buildColdMergeParameters(DiskImage baseVolume, DiskImage topVolume) {
SubchainInfo subchainInfo = new SubchainInfo(getDiskImage().getStorageIds().get(0), baseVolume, topVolume);
ColdMergeCommandParameters parameters = new ColdMergeCommandParameters(getDiskImage().getStoragePoolId(), subchainInfo);
parameters.setEndProcedure(ActionParametersBase.EndProcedure.COMMAND_MANAGED);
parameters.setParentCommand(getActionType());
parameters.setParentParameters(getParameters());
return parameters;
}
use of org.ovirt.engine.core.common.businessentities.SubchainInfo in project ovirt-engine by oVirt.
the class MultipleStorageDomainsValidator method allDomainsHaveSpaceForMerge.
/**
* Validates that all the domains have enough space for the request
* @return {@link ValidationResult#VALID} if all the domains have enough free space, or a {@link ValidationResult} with the first low-on-space domain encountered.
*/
public ValidationResult allDomainsHaveSpaceForMerge(List<SubchainInfo> snapshots, ActionType snapshotActionType) {
final Map<Guid, List<SubchainInfo>> storageToSnapshots = getDomainsToSnapshotsMap(snapshots);
return validOrFirstFailure(entry -> {
Guid sdId = entry.getKey();
List<SubchainInfo> subchain = storageToSnapshots.get(sdId);
return getStorageDomainValidator(entry).hasSpaceForMerge(subchain, snapshotActionType);
});
}
use of org.ovirt.engine.core.common.businessentities.SubchainInfo in project ovirt-engine by oVirt.
the class ColdMergeCommand method completeGenerationInfo.
private void completeGenerationInfo() {
SubchainInfo info = getParameters().getSubchainInfo();
DiskImage image = imagesHandler.getVolumeInfoFromVdsm(getParameters().getStoragePoolId(), info.getStorageDomainId(), info.getImageGroupId(), info.getBaseImageId());
info.setBaseImageGeneration(image.getImage().getGeneration());
persistCommandIfNeeded();
}
use of org.ovirt.engine.core.common.businessentities.SubchainInfo in project ovirt-engine by oVirt.
the class ColdMergeCommand method attemptToFenceJob.
@Override
public void attemptToFenceJob() {
SubchainInfo info = getParameters().getSubchainInfo();
VdsmImageLocationInfo locationInfo = new VdsmImageLocationInfo(info.getStorageDomainId(), info.getImageGroupId(), info.getBaseImageId(), info.getBaseImageGeneration());
FenceVolumeJobCommandParameters parameters = new FenceVolumeJobCommandParameters(locationInfo);
parameters.setParentCommand(getActionType());
parameters.setParentParameters(getParameters());
parameters.setStoragePoolId(getParameters().getStoragePoolId());
parameters.setEndProcedure(ActionParametersBase.EndProcedure.COMMAND_MANAGED);
runInternalActionWithTasksContext(ActionType.FenceVolumeJob, parameters);
}
Aggregations