use of org.ovirt.engine.core.common.action.CreateSnapshotForVmParameters in project ovirt-engine by oVirt.
the class RunVmCommand method createStatelessSnapshot.
private void createStatelessSnapshot() {
warnIfNotAllDisksPermitSnapshots();
log.info("Creating stateless snapshot for VM '{}' ({})", getVm().getName(), getVm().getId());
CreateSnapshotForVmParameters createAllSnapshotsFromVmParameters = buildCreateSnapshotParameters();
ActionReturnValue actionReturnValue = runInternalAction(ActionType.CreateSnapshotForVm, createAllSnapshotsFromVmParameters, createContextForStatelessSnapshotCreation());
// setting lock to null in order not to release lock twice
setLock(null);
setSucceeded(actionReturnValue.getSucceeded());
if (!actionReturnValue.getSucceeded()) {
if (areDisksLocked(actionReturnValue)) {
throw new EngineException(EngineError.IRS_IMAGE_STATUS_ILLEGAL);
}
getReturnValue().setFault(actionReturnValue.getFault());
log.error("Failed to create stateless snapshot for VM '{}' ({})", getVm().getName(), getVm().getId());
}
}
use of org.ovirt.engine.core.common.action.CreateSnapshotForVmParameters in project ovirt-engine by oVirt.
the class BackendSnapshotsResource method doAdd.
protected Response doAdd(Snapshot snapshot, boolean block) {
validateParameters(snapshot, "description");
CreateSnapshotForVmParameters snapshotParams = new CreateSnapshotForVmParameters(parentId, snapshot.getDescription());
if (snapshot.isSetPersistMemorystate()) {
snapshotParams.setSaveMemory(snapshot.isPersistMemorystate());
}
if (snapshot.isSetDiskAttachments()) {
Map<Guid, Guid> diskToImageIds = mapDisks(snapshot.getDiskAttachments());
snapshotParams.setDiskIds(diskToImageIds.keySet());
snapshotParams.setDiskToImageIds(diskToImageIds);
}
return performCreate(ActionType.CreateSnapshotForVm, snapshotParams, new SnapshotIdResolver(), block);
}
use of org.ovirt.engine.core.common.action.CreateSnapshotForVmParameters in project ovirt-engine by oVirt.
the class GlusterStorageSyncCommand method getCreateSnapshotParameters.
protected CreateSnapshotForVmParameters getCreateSnapshotParameters(VM vm) {
Set<Guid> diskIds = vm.getDiskList().stream().map(BaseDisk::getId).collect(Collectors.toSet());
CreateSnapshotForVmParameters params = new CreateSnapshotForVmParameters(vm.getId(), vm.getName() + getStorageDomain().getName() + DR_SNAPSHOT_NAME_SUFFIX, false);
params.setParentCommand(getActionType());
params.setSnapshotType(SnapshotType.REGULAR);
params.setParentParameters(getParameters());
params.setDiskIds(diskIds);
params.setNeedsLocking(false);
params.setEndProcedure(EndProcedure.COMMAND_MANAGED);
return params;
}
use of org.ovirt.engine.core.common.action.CreateSnapshotForVmParameters in project ovirt-engine by oVirt.
the class LiveMigrateDiskCommand method getCreateSnapshotParameters.
protected CreateSnapshotForVmParameters getCreateSnapshotParameters() {
CreateSnapshotForVmParameters params = new CreateSnapshotForVmParameters(getParameters().getVmId(), getDiskAlias() + " " + StorageConstants.LSM_AUTO_GENERATED_SNAPSHOT_DESCRIPTION, false);
params.setParentCommand(ActionType.LiveMigrateDisk);
params.setSnapshotType(Snapshot.SnapshotType.REGULAR);
params.setParentParameters(getParameters());
params.setImagesParameters(getParameters().getImagesParameters());
params.setTaskGroupSuccess(getParameters().getTaskGroupSuccess());
params.setDiskIds(getImageGroupIds());
params.setDiskIdsToIgnoreInChecks(getImageGroupIds());
params.setNeedsLocking(false);
params.setEndProcedure(EndProcedure.COMMAND_MANAGED);
return params;
}
use of org.ovirt.engine.core.common.action.CreateSnapshotForVmParameters in project ovirt-engine by oVirt.
the class RunVmCommand method buildCreateSnapshotParameters.
private CreateSnapshotForVmParameters buildCreateSnapshotParameters() {
CreateSnapshotForVmParameters parameters = new CreateSnapshotForVmParameters(getVm().getId(), STATELESS_SNAPSHOT_DESCRIPTION, false);
parameters.setShouldBeLogged(false);
parameters.setParentCommand(getActionType());
parameters.setParentParameters(getParameters());
parameters.setEntityInfo(getParameters().getEntityInfo());
parameters.setSnapshotType(SnapshotType.STATELESS);
return parameters;
}
Aggregations