use of org.ovirt.engine.core.common.asynctasks.EntityInfo in project ovirt-engine by oVirt.
the class CreateImagePlaceholderCommand method executeCommand.
@Override
protected void executeCommand() {
getParameters().setEntityInfo(new EntityInfo(VdcObjectType.Disk, getParameters().getImageGroup()));
Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand());
VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.CloneImageGroupStructure, new TargetDomainImageGroupVDSCommandParameters(getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), getParameters().getImageGroup(), getParameters().getDstStorageDomain()));
if (vdsReturnValue.getSucceeded()) {
getTaskIdList().add(createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId()));
}
setSucceeded(true);
}
use of org.ovirt.engine.core.common.asynctasks.EntityInfo in project ovirt-engine by oVirt.
the class SyncImageGroupDataCommand method executeCommand.
@Override
protected void executeCommand() {
getParameters().setEntityInfo(new EntityInfo(VdcObjectType.Disk, getParameters().getImageGroup()));
Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand());
VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.SyncImageGroupData, new SyncImageGroupDataVDSCommandParameters(getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), getParameters().getImageGroup(), getParameters().getDstStorageDomain(), SyncImageGroupDataVDSCommandParameters.SYNC_TYPE_INTERNAL));
if (vdsReturnValue.getSucceeded()) {
getParameters().setVdsmTaskIds(new ArrayList<>());
getParameters().getVdsmTaskIds().add(createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId()));
getReturnValue().getVdsmTaskIdList().add(getParameters().getVdsmTaskIds().get(0));
}
setSucceeded(true);
}
use of org.ovirt.engine.core.common.asynctasks.EntityInfo in project ovirt-engine by oVirt.
the class BackendVmDisksResourceTest method testAttachDisk.
@Test
public void testAttachDisk() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpCreationExpectations(ActionType.AttachDiskToVm, AttachDetachVmDiskParameters.class, new String[] { "VmId", "EntityInfo" }, new Object[] { VM_ID, new EntityInfo(VdcObjectType.Disk, DISK_ID) }, true, true, null, null, null, QueryType.GetDiskByDiskId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { DISK_ID }, asList(getEntity(0)));
Disk model = getModel();
// means this is an existing disk --> attach
model.setId(DISK_ID.toString());
model.setProvisionedSize(1024 * 1024L);
Response response = collection.add(model);
assertEquals(201, response.getStatus());
}
use of org.ovirt.engine.core.common.asynctasks.EntityInfo in project ovirt-engine by oVirt.
the class RemoveVmTemplateFromImportExportCommand method executeCommand.
@Override
protected void executeCommand() {
getParameters().setEntityInfo(new EntityInfo(VdcObjectType.VmTemplate, getVmTemplateId()));
RemoveVMVDSCommandParameters tempVar = new RemoveVMVDSCommandParameters(getParameters().getStoragePoolId(), getVmTemplateId());
tempVar.setStorageDomainId(getParameters().getStorageDomainId());
runVdsCommand(VDSCommandType.RemoveVM, tempVar);
List<DiskImage> images = getParameters().getImages();
setSucceeded(true);
if (!images.isEmpty()) {
for (DiskImage image : images) {
ArrayList<Guid> storageIds = new ArrayList<>();
storageIds.add(getParameters().getStorageDomainId());
image.setStorageIds(storageIds);
image.setStoragePoolId(getParameters().getStoragePoolId());
}
RemoveAllVmImagesParameters tempVar2 = new RemoveAllVmImagesParameters(getVmId(), images);
tempVar2.setParentCommand(getActionType());
tempVar2.setEntityInfo(getParameters().getEntityInfo());
tempVar2.setForceDelete(true);
tempVar2.setParentParameters(getParameters());
ActionReturnValue vdcRetValue = runInternalActionWithTasksContext(ActionType.RemoveAllVmImages, tempVar2);
if (vdcRetValue.getSucceeded()) {
getReturnValue().getVdsmTaskIdList().addAll(vdcRetValue.getInternalVdsmTaskIdList());
} else {
getReturnValue().setFault(vdcRetValue.getFault());
setSucceeded(false);
}
}
}
use of org.ovirt.engine.core.common.asynctasks.EntityInfo in project ovirt-engine by oVirt.
the class ImportVmCommand method buildMoveOrCopyImageGroupParametersForMemoryConfImage.
private MoveOrCopyImageGroupParameters buildMoveOrCopyImageGroupParametersForMemoryConfImage(Guid containerID, Guid storageId, Guid imageId, Guid volumeId) {
MoveOrCopyImageGroupParameters params = new MoveOrCopyImageGroupParameters(containerID, imageId, volumeId, imageId, volumeId, storageId, ImageOperation.Copy);
params.setParentCommand(getActionType());
// This volume is always of type 'sparse' and format 'cow' so no need to convert,
// and there're no snapshots for it so no reason to use copy collapse
params.setUseCopyCollapse(false);
params.setEntityInfo(new EntityInfo(VdcObjectType.VM, getVm().getId()));
params.setCopyVolumeType(CopyVolumeType.LeafVol);
params.setForceOverride(getParameters().getForceOverride());
params.setParentParameters(getParameters());
params.setSourceDomainId(getParameters().getSourceDomainId());
params.setStoragePoolId(getParameters().getStoragePoolId());
params.setImportEntity(true);
return params;
}
Aggregations