Search in sources :

Example 1 with RemoveAllVmImagesParameters

use of org.ovirt.engine.core.common.action.RemoveAllVmImagesParameters 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);
        }
    }
}
Also used : RemoveAllVmImagesParameters(org.ovirt.engine.core.common.action.RemoveAllVmImagesParameters) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) EntityInfo(org.ovirt.engine.core.common.asynctasks.EntityInfo) ArrayList(java.util.ArrayList) Guid(org.ovirt.engine.core.compat.Guid) RemoveVMVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.RemoveVMVDSCommandParameters) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Example 2 with RemoveAllVmImagesParameters

use of org.ovirt.engine.core.common.action.RemoveAllVmImagesParameters in project ovirt-engine by oVirt.

the class RemoveVmCommand method buildRemoveAllVmImagesParameters.

private RemoveAllVmImagesParameters buildRemoveAllVmImagesParameters(List<DiskImage> images) {
    RemoveAllVmImagesParameters params = new RemoveAllVmImagesParameters(getVmId(), images);
    if (!isExecutedAsChildCommand()) {
        params.setParentCommand(getActionType());
        params.setEntityInfo(getParameters().getEntityInfo());
        params.setParentParameters(getParameters());
    } else {
        params.setParentCommand(getParameters().getParentCommand());
        params.setEntityInfo(getParameters().getParentParameters().getEntityInfo());
        params.setParentParameters(getParameters().getParentParameters());
    }
    return params;
}
Also used : RemoveAllVmImagesParameters(org.ovirt.engine.core.common.action.RemoveAllVmImagesParameters)

Aggregations

RemoveAllVmImagesParameters (org.ovirt.engine.core.common.action.RemoveAllVmImagesParameters)2 ArrayList (java.util.ArrayList)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 EntityInfo (org.ovirt.engine.core.common.asynctasks.EntityInfo)1 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)1 RemoveVMVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.RemoveVMVDSCommandParameters)1 Guid (org.ovirt.engine.core.compat.Guid)1