Search in sources :

Example 1 with VmPool

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

the class PoolDiskListModel method onEntityChanged.

@Override
protected void onEntityChanged() {
    super.onEntityChanged();
    VmPool pool = getEntity();
    if (pool != null) {
        Frontend.getInstance().runQuery(QueryType.GetVmDataByPoolId, new IdQueryParameters(pool.getVmPoolId()), new AsyncQuery<QueryReturnValue>(result -> {
            if (result != null) {
                VM vm = result.getReturnValue();
                if (vm == null) {
                    return;
                }
                setVM(vm);
                syncSearch();
            }
        }));
    }
}
Also used : VmPool(org.ovirt.engine.core.common.businessentities.VmPool) QueryType(org.ovirt.engine.core.common.queries.QueryType) Frontend(org.ovirt.engine.ui.frontend.Frontend) VM(org.ovirt.engine.core.common.businessentities.VM) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) VmDiskListModelBase(org.ovirt.engine.ui.uicommonweb.models.vms.VmDiskListModelBase) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) VmPool(org.ovirt.engine.core.common.businessentities.VmPool) VM(org.ovirt.engine.core.common.businessentities.VM)

Example 2 with VmPool

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

the class PoolInterfaceListModel method onEntityChanged.

@Override
protected void onEntityChanged() {
    super.onEntityChanged();
    VmPool pool = getEntity();
    if (pool != null) {
        Frontend.getInstance().runQuery(QueryType.GetVmDataByPoolId, new IdQueryParameters(pool.getVmPoolId()), new AsyncQuery<QueryReturnValue>(result -> {
            if (result != null) {
                VM vm = result.getReturnValue();
                if (vm == null) {
                    return;
                }
                syncSearch(QueryType.GetVmInterfacesByVmId, new IdQueryParameters(vm.getId()));
            }
        }));
    }
}
Also used : VmPool(org.ovirt.engine.core.common.businessentities.VmPool) QueryType(org.ovirt.engine.core.common.queries.QueryType) Frontend(org.ovirt.engine.ui.frontend.Frontend) VM(org.ovirt.engine.core.common.businessentities.VM) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) VmPool(org.ovirt.engine.core.common.businessentities.VmPool) VM(org.ovirt.engine.core.common.businessentities.VM)

Example 3 with VmPool

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

the class PoolListModel method onRemove.

public void onRemove() {
    ConfirmationModel model = (ConfirmationModel) getWindow();
    if (model.getProgress() != null) {
        return;
    }
    ArrayList<ActionParametersBase> list = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        VmPool pool = (VmPool) item;
        list.add(new VmPoolParametersBase(pool.getVmPoolId()));
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.RemoveVmPool, list, result -> {
        ConfirmationModel localModel = (ConfirmationModel) result.getState();
        localModel.stopProgress();
        cancel();
    }, model);
}
Also used : VmPoolParametersBase(org.ovirt.engine.core.common.action.VmPoolParametersBase) VmPool(org.ovirt.engine.core.common.businessentities.VmPool) ArrayList(java.util.ArrayList) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 4 with VmPool

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

the class AddVmPoolCommand method getJobMessageProperties.

@Override
public Map<String, String> getJobMessageProperties() {
    if (jobProperties == null) {
        jobProperties = new HashMap<>();
        VmPool vmPool = getParameters().getVmPool();
        String vmPoolName = vmPool == null ? StringUtils.EMPTY : vmPool.getName();
        jobProperties.put(VdcObjectType.VmPool.name().toLowerCase(), vmPoolName);
        Guid vmTemplateId = getVmTemplateId();
        String templateName = getVmTemplateName();
        if (StringUtils.isEmpty(templateName)) {
            templateName = vmTemplateId == null ? StringUtils.EMPTY : vmTemplateId.toString();
        }
        jobProperties.put(VdcObjectType.VmTemplate.name().toLowerCase(), templateName);
    }
    return jobProperties;
}
Also used : VmPool(org.ovirt.engine.core.common.businessentities.VmPool) Guid(org.ovirt.engine.core.compat.Guid)

Example 5 with VmPool

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

the class CommonVmPoolCommandTestAbstract method mockVmPools.

/**
 * Mock VM pools.
 */
private VmPool mockVmPools() {
    VmPool pool = new VmPool();
    pool.setName("simplePoolName");
    pool.setClusterId(clusterId);
    pool.setVmPoolId(vmPoolId);
    return pool;
}
Also used : VmPool(org.ovirt.engine.core.common.businessentities.VmPool)

Aggregations

VmPool (org.ovirt.engine.core.common.businessentities.VmPool)32 Test (org.junit.Test)12 VM (org.ovirt.engine.core.common.businessentities.VM)9 ArrayList (java.util.ArrayList)8 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)8 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)7 Guid (org.ovirt.engine.core.compat.Guid)7 QueryType (org.ovirt.engine.core.common.queries.QueryType)6 List (java.util.List)5 Frontend (org.ovirt.engine.ui.frontend.Frontend)5 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)5 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)5 ActionType (org.ovirt.engine.core.common.action.ActionType)4 VmPoolParametersBase (org.ovirt.engine.core.common.action.VmPoolParametersBase)4 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)3 AddVmPoolParameters (org.ovirt.engine.core.common.action.AddVmPoolParameters)3 VmPoolType (org.ovirt.engine.core.common.businessentities.VmPoolType)3 SearchType (org.ovirt.engine.core.common.interfaces.SearchType)3 SearchParameters (org.ovirt.engine.core.common.queries.SearchParameters)3 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)3