Search in sources :

Example 66 with ActionParametersBase

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

the class RegisterTemplateModel method onSave.

protected void onSave() {
    List<ActionParametersBase> parameters = prepareActionParameters();
    ActionType actionType = ActionType.ImportVmTemplateFromConfiguration;
    onSave(actionType, parameters);
}
Also used : ActionType(org.ovirt.engine.core.common.action.ActionType) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 67 with ActionParametersBase

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

the class RegisterVmModel method prepareParameters.

private List<ActionParametersBase> prepareParameters() {
    ArrayList<ActionParametersBase> parameters = new ArrayList<>();
    for (RegisterVmData registerVmData : getEntities().getItems()) {
        VM vm = registerVmData.getEntity();
        Cluster cluster = registerVmData.getCluster().getSelectedItem();
        ImportVmFromConfParameters params = new ImportVmFromConfParameters(cloneExternalVnicProfiles(cluster), registerVmData.getReassignMacs().getEntity());
        params.setContainerId(vm.getId());
        params.setStorageDomainId(getStorageDomainId());
        params.setImagesExistOnTargetStorageDomain(true);
        params.setClusterId(cluster != null ? cluster.getId() : null);
        params.setAllowPartialImport(registerVmData.getAllowPartialImport().getEntity());
        if (isQuotaEnabled()) {
            Quota quota = registerVmData.getClusterQuota().getSelectedItem();
            params.setQuotaId(quota != null ? quota.getId() : null);
            params.setDiskMap(vm.getDiskMap());
            updateDiskQuotas(new ArrayList<>(params.getDiskMap().values()));
        }
        parameters.add(params);
    }
    return parameters;
}
Also used : Quota(org.ovirt.engine.core.common.businessentities.Quota) RegisterVmData(org.ovirt.engine.ui.uicommonweb.models.vms.register.RegisterVmData) VM(org.ovirt.engine.core.common.businessentities.VM) ArrayList(java.util.ArrayList) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) ImportVmFromConfParameters(org.ovirt.engine.core.common.action.ImportVmFromConfParameters) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 68 with ActionParametersBase

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

the class StorageDataCenterListModel method onDetach.

private void onDetach() {
    final ConfirmationModel model = (ConfirmationModel) getWindow();
    if (!model.validate()) {
        return;
    }
    setdetachPrms(new ArrayList<ActionParametersBase>());
    setremovePrms(new ArrayList<ActionParametersBase>());
    for (Object item : getSelectedItems()) {
        StorageDomain storageDomain = (StorageDomain) item;
        if (storageDomain.getStorageType() != StorageType.LOCALFS) {
            DetachStorageDomainFromPoolParameters param = new DetachStorageDomainFromPoolParameters();
            param.setStorageDomainId(getEntity().getId());
            if (storageDomain.getStoragePoolId() != null) {
                param.setStoragePoolId(storageDomain.getStoragePoolId());
            }
            getdetachPrms().add(param);
        } else {
            AsyncDataProvider.getInstance().getLocalStorageHost(new AsyncQuery<>(locaVds -> {
                StorageDomain storage = getEntity();
                RemoveStorageDomainParameters tempVar = new RemoveStorageDomainParameters(storage.getId());
                tempVar.setVdsId(locaVds != null ? locaVds.getId() : null);
                tempVar.setDoFormat(model.getForce().getEntity());
                RemoveStorageDomainParameters removeStorageDomainParameters = tempVar;
                getremovePrms().add(removeStorageDomainParameters);
                if (getremovePrms().size() + getdetachPrms().size() == getSelectedItems().size()) {
                    Frontend.getInstance().runMultipleAction(ActionType.RemoveStorageDomain, getremovePrms());
                }
            }), storageDomain.getStoragePoolName());
        }
        if (getdetachPrms().size() > 0) {
            Frontend.getInstance().runMultipleAction(ActionType.DetachStorageDomainFromPool, getdetachPrms());
        }
    }
    cancel();
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) LexoNumericComparator(org.ovirt.engine.core.common.businessentities.comparators.LexoNumericComparator) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) StorageDomainPoolParametersBase(org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) Model(org.ovirt.engine.ui.uicommonweb.models.Model) AttachStorageDomainToPoolParameters(org.ovirt.engine.core.common.action.AttachStorageDomainToPoolParameters) RemoveStorageDomainParameters(org.ovirt.engine.core.common.action.RemoveStorageDomainParameters) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) ActionUtils(org.ovirt.engine.core.common.ActionUtils) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) StoragePoolStatus(org.ovirt.engine.core.common.businessentities.StoragePoolStatus) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) StorageDomainSharedStatus(org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus) List(java.util.List) StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) Comparator(java.util.Comparator) Collections(java.util.Collections) DeactivateStorageDomainWithOvfUpdateParameters(org.ovirt.engine.core.common.action.DeactivateStorageDomainWithOvfUpdateParameters) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) DetachStorageDomainFromPoolParameters(org.ovirt.engine.core.common.action.DetachStorageDomainFromPoolParameters) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) RemoveStorageDomainParameters(org.ovirt.engine.core.common.action.RemoveStorageDomainParameters) DetachStorageDomainFromPoolParameters(org.ovirt.engine.core.common.action.DetachStorageDomainFromPoolParameters) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 69 with ActionParametersBase

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

the class StorageDataCenterListModel method activate.

private void activate() {
    ArrayList<ActionParametersBase> list = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        StorageDomain a = (StorageDomain) item;
        StorageDomainPoolParametersBase parameters = new StorageDomainPoolParametersBase();
        parameters.setStorageDomainId(getEntity().getId());
        if (a.getStoragePoolId() != null) {
            parameters.setStoragePoolId(a.getStoragePoolId());
        }
        list.add(parameters);
    }
    Frontend.getInstance().runMultipleAction(ActionType.ActivateStorageDomain, list, result -> {
    }, null);
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StorageDomainPoolParametersBase(org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase) ArrayList(java.util.ArrayList) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 70 with ActionParametersBase

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

the class UploadImageModel method pauseUploads.

public static void pauseUploads(List<? extends Disk> disks) {
    ArrayList<ActionParametersBase> list = new ArrayList<>();
    for (Disk disk : disks) {
        ImageTransfer updates = new ImageTransfer();
        updates.setPhase(ImageTransferPhase.PAUSED_USER);
        TransferImageStatusParameters parameters = new TransferImageStatusParameters();
        parameters.setUpdates(updates);
        parameters.setDiskId(disk.getId());
        list.add(parameters);
    }
    Frontend.getInstance().runMultipleAction(ActionType.TransferImageStatus, list);
}
Also used : ImageTransfer(org.ovirt.engine.core.common.businessentities.storage.ImageTransfer) ArrayList(java.util.ArrayList) TransferImageStatusParameters(org.ovirt.engine.core.common.action.TransferImageStatusParameters) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Aggregations

ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)204 ArrayList (java.util.ArrayList)149 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)53 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)52 ActionType (org.ovirt.engine.core.common.action.ActionType)45 Test (org.junit.Test)44 Guid (org.ovirt.engine.core.compat.Guid)35 VDS (org.ovirt.engine.core.common.businessentities.VDS)26 List (java.util.List)23 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)23 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)20 VM (org.ovirt.engine.core.common.businessentities.VM)19 QueryType (org.ovirt.engine.core.common.queries.QueryType)18 Frontend (org.ovirt.engine.ui.frontend.Frontend)18 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)18 IFrontendActionAsyncCallback (org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback)18 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)16 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)16 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)16 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)15