Search in sources :

Example 21 with Guid

use of org.ovirt.engine.core.compat.Guid in project ovirt-engine by oVirt.

the class InstanceTypeListModel method onDeleteInstanceType.

private void onDeleteInstanceType() {
    final ConfirmationModel model = (ConfirmationModel) getConfirmWindow();
    boolean latchChecked = !model.validate();
    if (model.getProgress() != null || latchChecked) {
        return;
    }
    model.startProgress();
    Guid instanceTypeId = getSelectedItem().getId();
    Frontend.getInstance().runAction(ActionType.RemoveVmTemplate, new VmTemplateManagementParameters(instanceTypeId), result -> {
        model.stopProgress();
        cancel();
    }, this);
}
Also used : ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) Guid(org.ovirt.engine.core.compat.Guid) VmTemplateManagementParameters(org.ovirt.engine.core.common.action.VmTemplateManagementParameters)

Example 22 with Guid

use of org.ovirt.engine.core.compat.Guid in project ovirt-engine by oVirt.

the class NewClusterPolicyModel method refreshCustomProperties.

private void refreshCustomProperties(PolicyUnit toRemove, boolean reset) {
    if (!customPropertiesInitialized) {
        return;
    }
    Map<String, String> policyProperties = new HashMap<>();
    Map<Guid, PolicyUnit> allPolicyUnits = new HashMap<>();
    for (PolicyUnit policyUnit : getUsedFilters()) {
        allPolicyUnits.put(policyUnit.getId(), policyUnit);
    }
    for (Pair<PolicyUnit, Integer> pair : getUsedFunctions()) {
        allPolicyUnits.put(pair.getFirst().getId(), pair.getFirst());
    }
    if (toRemove != null && !allPolicyUnits.containsKey(toRemove.getId())) {
        if (toRemove.getParameterRegExMap() != null) {
            for (Entry<String, String> entry : toRemove.getParameterRegExMap().entrySet()) {
                getCustomProperties().remove(entry.getKey());
            }
        }
    }
    PolicyUnit selectedItem = loadBalanceList.getSelectedItem();
    allPolicyUnits.put(selectedItem.getId(), selectedItem);
    for (PolicyUnit policyUnit : allPolicyUnits.values()) {
        if (policyUnit.getParameterRegExMap() != null) {
            policyProperties.putAll(policyUnit.getParameterRegExMap());
        }
    }
    Map<String, String> defaultMap = new HashMap<>(getCustomProperties());
    if (!reset) {
        defaultMap.putAll(KeyValueModel.convertProperties(getCustomPropertySheet().serialize()));
    }
    getCustomPropertySheet().setKeyValueMap(policyProperties);
    getCustomPropertySheet().deserialize(KeyValueModel.convertProperties(defaultMap));
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Guid(org.ovirt.engine.core.compat.Guid) PolicyUnit(org.ovirt.engine.core.common.scheduling.PolicyUnit)

Example 23 with Guid

use of org.ovirt.engine.core.compat.Guid in project ovirt-engine by oVirt.

the class NewClusterPolicyModel method initFilters.

private void initFilters() {
    getUsedFilters().clear();
    getUnusedFilters().clear();
    if (clusterPolicy.getFilters() == null) {
        getUnusedFilters().addAll(getFilterPolicyUnits(policyUnits));
        return;
    }
    HashMap<Guid, PolicyUnit> map = (HashMap<Guid, PolicyUnit>) ((HashMap<Guid, PolicyUnit>) policyUnitsMap).clone();
    for (Guid policyUnitId : clusterPolicy.getFilters()) {
        map.remove(policyUnitId);
        getUsedFilters().add(policyUnitsMap.get(policyUnitId));
    }
    initFilterPositions();
    getUnusedFilters().addAll(getFilterPolicyUnits(new ArrayList<>(map.values())));
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ArrayList(java.util.ArrayList) Guid(org.ovirt.engine.core.compat.Guid) PolicyUnit(org.ovirt.engine.core.common.scheduling.PolicyUnit)

Example 24 with Guid

use of org.ovirt.engine.core.compat.Guid in project ovirt-engine by oVirt.

the class VmAffinityGroupListModel method getNewAffinityGroup.

@Override
protected AffinityGroup getNewAffinityGroup() {
    AffinityGroup affinityGroup = super.getNewAffinityGroup();
    affinityGroup.setVmIds(new ArrayList<Guid>());
    affinityGroup.getVmIds().add(getEntity().getId());
    return affinityGroup;
}
Also used : Guid(org.ovirt.engine.core.compat.Guid) AffinityGroup(org.ovirt.engine.core.common.scheduling.AffinityGroup)

Example 25 with Guid

use of org.ovirt.engine.core.compat.Guid in project ovirt-engine by oVirt.

the class GuideModel method checkVdsClusterChangeSucceeded.

protected void checkVdsClusterChangeSucceeded(final String searchStr, final List<ActionParametersBase> changeVdsParameterList, final List<ActionParametersBase> activateVdsParameterList) {
    final Map<Guid, Guid> hostClusterIdMap = new HashMap<>();
    for (ActionParametersBase param : changeVdsParameterList) {
        hostClusterIdMap.put(((ChangeVDSClusterParameters) param).getVdsId(), ((ChangeVDSClusterParameters) param).getClusterId());
    }
    Frontend.getInstance().runQuery(QueryType.Search, new SearchParameters(searchStr, SearchType.VDS), new AsyncQuery<QueryReturnValue>(returnValue -> {
        List<VDS> hosts = returnValue.getReturnValue();
        boolean succeeded = true;
        for (VDS host : hosts) {
            if (!host.getClusterId().equals(hostClusterIdMap.get(host.getId()))) {
                succeeded = false;
            }
        }
        if (!succeeded) {
            getWindow().stopProgress();
            cancel();
            errorPopupManager.show(ConstantsManager.getInstance().getConstants().hostChangeClusterTimeOut());
        } else {
            activateHostsAfterClusterChange(searchStr, activateVdsParameterList);
        }
    }));
}
Also used : SearchType(org.ovirt.engine.core.common.interfaces.SearchType) QueryType(org.ovirt.engine.core.common.queries.QueryType) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) MoveHostData(org.ovirt.engine.ui.uicommonweb.models.hosts.MoveHostData) Guid(org.ovirt.engine.core.compat.Guid) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) HashMap(java.util.HashMap) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) MoveHost(org.ovirt.engine.ui.uicommonweb.models.hosts.MoveHost) List(java.util.List) VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) ErrorPopupManager(org.ovirt.engine.ui.uicommonweb.ErrorPopupManager) TypeResolver(org.ovirt.engine.ui.uicommonweb.TypeResolver) Map(java.util.Map) ChangeVDSClusterParameters(org.ovirt.engine.core.common.action.ChangeVDSClusterParameters) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) VDS(org.ovirt.engine.core.common.businessentities.VDS) ObservableCollection(org.ovirt.engine.ui.uicompat.ObservableCollection) Timer(com.google.gwt.user.client.Timer) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) VDS(org.ovirt.engine.core.common.businessentities.VDS) HashMap(java.util.HashMap) List(java.util.List) Guid(org.ovirt.engine.core.compat.Guid) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Aggregations

Guid (org.ovirt.engine.core.compat.Guid)1431 ArrayList (java.util.ArrayList)330 Test (org.junit.Test)322 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)219 HashMap (java.util.HashMap)211 List (java.util.List)167 VM (org.ovirt.engine.core.common.businessentities.VM)144 Map (java.util.Map)118 VDS (org.ovirt.engine.core.common.businessentities.VDS)117 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)106 HashSet (java.util.HashSet)102 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)89 Pair (org.ovirt.engine.core.common.utils.Pair)79 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)77 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)72 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)70 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)69 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)57 ActionType (org.ovirt.engine.core.common.action.ActionType)56 Set (java.util.Set)52