Search in sources :

Example 11 with VDS

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

Example 12 with VDS

use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.

the class ImportSanStorageModel method getUnregisteredStorageDomains.

protected void getUnregisteredStorageDomains(List<StorageServerConnections> connections) {
    VDS vds = getContainer().getHost().getSelectedItem();
    Frontend.getInstance().runQuery(QueryType.GetUnregisteredBlockStorageDomains, new GetUnregisteredBlockStorageDomainsParameters(vds.getId(), getType(), connections), new AsyncQuery<QueryReturnValue>(returnValue -> {
        Pair<List<StorageDomain>, List<StorageServerConnections>> returnValuePair = returnValue.getReturnValue();
        ArrayList<StorageDomain> storageDomains = (ArrayList<StorageDomain>) returnValuePair.getFirst();
        ArrayList<StorageServerConnections> connections1 = (ArrayList<StorageServerConnections>) returnValuePair.getSecond();
        if (storageDomains != null) {
            addStorageDomains(storageDomains);
        }
        postGetUnregisteredStorageDomains(storageDomains, connections1);
    }));
}
Also used : QueryType(org.ovirt.engine.core.common.queries.QueryType) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) Set(java.util.Set) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Frontend(org.ovirt.engine.ui.frontend.Frontend) List(java.util.List) GetUnregisteredBlockStorageDomainsParameters(org.ovirt.engine.core.common.queries.GetUnregisteredBlockStorageDomainsParameters) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) VDS(org.ovirt.engine.core.common.businessentities.VDS) Pair(org.ovirt.engine.core.common.utils.Pair) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) VDS(org.ovirt.engine.core.common.businessentities.VDS) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) GetUnregisteredBlockStorageDomainsParameters(org.ovirt.engine.core.common.queries.GetUnregisteredBlockStorageDomainsParameters) ArrayList(java.util.ArrayList) Pair(org.ovirt.engine.core.common.utils.Pair)

Example 13 with VDS

use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.

the class VmModelBehaviorBase method doChangeDefaultHost.

protected void doChangeDefaultHost(List<Guid> dedicatedHostIds) {
    getModel().getIsAutoAssign().setEntity(true);
    if (dedicatedHostIds == null) {
        return;
    }
    if (getModel().getDefaultHost().getItems() != null) {
        List<VDS> selectedHosts = new ArrayList<>();
        for (VDS host : getModel().getDefaultHost().getItems()) {
            if (dedicatedHostIds.contains(host.getId())) {
                selectedHosts.add(host);
            }
        }
        if (!selectedHosts.isEmpty()) {
            getModel().getDefaultHost().setSelectedItems(selectedHosts);
            getModel().getIsAutoAssign().setEntity(false);
        }
    }
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) ArrayList(java.util.ArrayList)

Example 14 with VDS

use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.

the class ReplaceBrickPopupView method initEditors.

private void initEditors() {
    showBricksListEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
    serverEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<VDS>() {

        @Override
        public String renderNullSafe(VDS vds) {
            return vds.getHostName();
        }
    });
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) NullSafeRenderer(org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer) EntityModelCheckBoxEditor(org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor)

Example 15 with VDS

use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.

the class AddBrickPopupView method initEditors.

private void initEditors() {
    volumeTypeEditor = new EntityModelLabelEditor<>(new EnumRenderer<GlusterVolumeType>());
    forceEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
    showBricksListEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
    serverEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<VDS>() {

        @Override
        public String renderNullSafe(VDS vds) {
            return vds.getHostName();
        }
    });
}
Also used : EnumRenderer(org.ovirt.engine.ui.common.widget.renderer.EnumRenderer) VDS(org.ovirt.engine.core.common.businessentities.VDS) NullSafeRenderer(org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer) EntityModelCheckBoxEditor(org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor)

Aggregations

VDS (org.ovirt.engine.core.common.businessentities.VDS)578 ArrayList (java.util.ArrayList)160 Test (org.junit.Test)138 Guid (org.ovirt.engine.core.compat.Guid)132 List (java.util.List)78 VM (org.ovirt.engine.core.common.businessentities.VM)65 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)55 HashMap (java.util.HashMap)53 HashSet (java.util.HashSet)48 Map (java.util.Map)45 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)42 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)42 Set (java.util.Set)40 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)39 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)39 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)39 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)38 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)38 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)37 Frontend (org.ovirt.engine.ui.frontend.Frontend)35