use of org.ovirt.engine.core.common.asynctasks.EntityInfo in project ovirt-engine by oVirt.
the class UpdateVmVersionCommand method init.
@Override
protected void init() {
super.init();
getParameters().setEntityInfo(new EntityInfo(VdcObjectType.VM, getParameters().getVmId()));
if (getVm() != null) {
if (getParameters().getNewTemplateVersion() != null) {
setVmTemplate(vmTemplateDao.get(getParameters().getNewTemplateVersion()));
} else {
setVmTemplate(vmTemplateDao.getTemplateWithLatestVersionInChain(getVm().getVmtGuid()));
}
}
}
use of org.ovirt.engine.core.common.asynctasks.EntityInfo in project ovirt-engine by oVirt.
the class CreateSnapshotForVmCommand method init.
@Override
public void init() {
getParameters().setUseCinderCommandCallback(isCinderDisksExist());
getParameters().setEntityInfo(new EntityInfo(VdcObjectType.VM, getVmId()));
setSnapshotName(getParameters().getDescription());
setStoragePoolId(getVm() != null ? getVm().getStoragePoolId() : null);
}
use of org.ovirt.engine.core.common.asynctasks.EntityInfo in project ovirt-engine by oVirt.
the class RemoveSnapshotCommand method executeCommand.
@Override
protected void executeCommand() {
if (!getVm().isDown() && !getVm().isQualifiedForSnapshotMerge()) {
log.error("Cannot remove VM snapshot. Vm is not Down, Up or Paused");
throw new EngineException(EngineError.VM_NOT_QUALIFIED_FOR_SNAPSHOT_MERGE);
}
final Snapshot snapshot = snapshotDao.get(getParameters().getSnapshotId());
boolean snapshotHasImages = hasImages();
boolean removeSnapshotMemory = isMemoryVolumeRemoveable(snapshot);
// No need for locking, VDSM tasks, and all that jazz.
if (!snapshotHasImages && !removeSnapshotMemory) {
snapshotDao.remove(getParameters().getSnapshotId());
setSucceeded(true);
return;
}
lockSnapshot(snapshot);
if (getParameters().isFreeLockNeeded()) {
freeLock();
}
getParameters().setEntityInfo(new EntityInfo(VdcObjectType.VM, getVmId()));
boolean useTaskManagerToRemoveMemory = false;
if (snapshotHasImages) {
removeImages();
if (getSnapshotActionType() == ActionType.RemoveSnapshotSingleDiskLive) {
persistCommand(getParameters().getParentCommand(), true);
useTaskManagerToRemoveMemory = true;
}
}
if (removeSnapshotMemory) {
removeMemory(snapshot, useTaskManagerToRemoveMemory);
if (!snapshotHasImages) {
// no async tasks - ending command manually
endVmCommand();
}
}
setSucceeded(true);
}
use of org.ovirt.engine.core.common.asynctasks.EntityInfo in project ovirt-engine by oVirt.
the class AddVmAndCloneImageCommand method createCopyParameters.
protected MoveOrCopyImageGroupParameters createCopyParameters(DiskImage diskImage, Guid srcStorageDomainId, Guid srcImageGroupId, Guid srcImageId, ActionType parentCommandType) {
MoveOrCopyImageGroupParameters params = new MoveOrCopyImageGroupParameters(getVmId(), srcImageGroupId, srcImageId, diskImage.getId(), diskImage.getImageId(), diskImage.getStorageIds().get(0), ImageOperation.Copy);
params.setAddImageDomainMapping(false);
params.setCopyVolumeType(CopyVolumeType.LeafVol);
params.setVolumeFormat(diskImage.getVolumeFormat());
params.setVolumeType(diskImage.getVolumeType());
params.setUseCopyCollapse(true);
params.setSourceDomainId(srcStorageDomainId);
params.setWipeAfterDelete(diskImage.isWipeAfterDelete());
params.setEntityInfo(new EntityInfo(VdcObjectType.VM, getVmId()));
params.setParentParameters(getParameters());
params.setParentCommand(parentCommandType);
return params;
}
use of org.ovirt.engine.core.common.asynctasks.EntityInfo in project ovirt-engine by oVirt.
the class AttachUserToVmFromPoolAndRunCommand method runVm.
private ActionReturnValue runVm() {
RunVmParams runVmParams = new RunVmParams(getVmId());
runVmParams.setSessionId(getParameters().getSessionId());
runVmParams.setEntityInfo(new EntityInfo(VdcObjectType.VM, getVmId()));
runVmParams.setParentCommand(getActionType());
runVmParams.setParentParameters(getParameters());
runVmParams.setEndProcedure(EndProcedure.COMMAND_MANAGED);
runVmParams.setRunAsStateless(!getVmPool().isStateful());
ExecutionContext runVmContext = createRunVmContext();
ActionReturnValue actionReturnValue = runInternalAction(ActionType.RunVm, runVmParams, cloneContext().withExecutionContext(runVmContext).withCompensationContext(null));
getTaskIdList().addAll(actionReturnValue.getInternalVdsmTaskIdList());
return actionReturnValue;
}
Aggregations