Search in sources :

Example 1 with VM

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

the class NetworkVmListModel method remove.

private void remove() {
    if (getWindow() != null) {
        return;
    }
    List<VmNetworkInterface> vnics = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        PairQueryable<VmNetworkInterface, VM> pair = (PairQueryable<VmNetworkInterface, VM>) item;
        vnics.add(pair.getFirst());
    }
    RemoveVmInterfaceModel model = new RemoveVmInterfaceModel(this, vnics, true);
    setWindow(model);
}
Also used : PairQueryable(org.ovirt.engine.core.common.utils.PairQueryable) RemoveVmInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.vms.RemoveVmInterfaceModel) VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) VM(org.ovirt.engine.core.common.businessentities.VM) ArrayList(java.util.ArrayList)

Example 2 with VM

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

the class NetworkVmListModel method syncSearch.

@Override
protected void syncSearch() {
    if (getEntity() == null) {
        return;
    }
    GetVmsAndNetworkInterfacesByNetworkIdParameters params = new GetVmsAndNetworkInterfacesByNetworkIdParameters(getEntity().getId(), NetworkVmFilter.running.equals(getViewFilterType()));
    params.setRefresh(getIsQueryFirstTime());
    final NetworkVmFilter filter = getViewFilterType();
    Frontend.getInstance().runQuery(QueryType.GetVmsAndNetworkInterfacesByNetworkId, params, new AsyncQuery<QueryReturnValue>(returnValue -> {
        if (filter.equals(getViewFilterType())) {
            setItems((Collection<PairQueryable<VmNetworkInterface, VM>>) returnValue.getReturnValue());
        }
    }));
}
Also used : QueryType(org.ovirt.engine.core.common.queries.QueryType) ActionUtils(org.ovirt.engine.core.common.ActionUtils) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) Collection(java.util.Collection) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) ApplicationMode(org.ovirt.engine.core.common.mode.ApplicationMode) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) ArrayList(java.util.ArrayList) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) List(java.util.List) VM(org.ovirt.engine.core.common.businessentities.VM) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) GetVmsAndNetworkInterfacesByNetworkIdParameters(org.ovirt.engine.core.common.queries.GetVmsAndNetworkInterfacesByNetworkIdParameters) PairQueryable(org.ovirt.engine.core.common.utils.PairQueryable) Comparator(java.util.Comparator) VMStatus(org.ovirt.engine.core.common.businessentities.VMStatus) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) NetworkView(org.ovirt.engine.core.common.businessentities.network.NetworkView) RemoveVmInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.vms.RemoveVmInterfaceModel) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) VM(org.ovirt.engine.core.common.businessentities.VM) Collection(java.util.Collection) GetVmsAndNetworkInterfacesByNetworkIdParameters(org.ovirt.engine.core.common.queries.GetVmsAndNetworkInterfacesByNetworkIdParameters)

Example 3 with VM

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

the class NetworkVmListModel method updateActionAvailability.

private void updateActionAvailability() {
    ArrayList<VM> vms = new ArrayList<>();
    Iterable<PairQueryable<VmNetworkInterface, VM>> selectedItems = getSelectedItems() != null ? getSelectedItems() : new ArrayList();
    for (PairQueryable<VmNetworkInterface, VM> item : selectedItems) {
        vms.add(item.getSecond());
    }
    getRemoveCommand().setIsExecutionAllowed(ActionUtils.canExecute(vms, VM.class, ActionType.RemoveVmInterface) && getSelectedItems() != null && !getSelectedItems().isEmpty() && canRemoveVnics());
}
Also used : PairQueryable(org.ovirt.engine.core.common.utils.PairQueryable) VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) VM(org.ovirt.engine.core.common.businessentities.VM) ArrayList(java.util.ArrayList)

Example 4 with VM

use of org.ovirt.engine.core.common.businessentities.VM 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 5 with VM

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

Aggregations

VM (org.ovirt.engine.core.common.businessentities.VM)591 Test (org.junit.Test)178 Guid (org.ovirt.engine.core.compat.Guid)150 ArrayList (java.util.ArrayList)130 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)82 HashMap (java.util.HashMap)69 List (java.util.List)65 VDS (org.ovirt.engine.core.common.businessentities.VDS)63 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)56 Map (java.util.Map)53 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)53 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)41 QueryType (org.ovirt.engine.core.common.queries.QueryType)36 Snapshot (org.ovirt.engine.core.common.businessentities.Snapshot)34 Frontend (org.ovirt.engine.ui.frontend.Frontend)34 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)33 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)32 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)32 Collectors (java.util.stream.Collectors)31 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)31