Search in sources :

Example 1 with RemoveVMVDSCommandParameters

use of org.ovirt.engine.core.common.vdscommands.RemoveVMVDSCommandParameters 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)

Aggregations

ArrayList (java.util.ArrayList)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 RemoveAllVmImagesParameters (org.ovirt.engine.core.common.action.RemoveAllVmImagesParameters)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