Search in sources :

Example 91 with VDS

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

the class HostListModel method upgrade.

public void upgrade() {
    final VDS host = getSelectedItem();
    Model model = createUpgradeModel(host);
    setWindow(model);
    model.initialize();
    // $NON-NLS-1$
    model.getCommands().add(UICommand.createCancelUiCommand("Cancel", this));
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) TagModel(org.ovirt.engine.ui.uicommonweb.models.tags.TagModel) TagListModel(org.ovirt.engine.ui.uicommonweb.models.tags.TagListModel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) HostGeneralModel.createUpgradeModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostGeneralModel.createUpgradeModel) HostErrataCountModel(org.ovirt.engine.ui.uicommonweb.models.HostErrataCountModel) PermissionListModel(org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel) HostGlusterSwiftListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.HostGlusterSwiftListModel) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) HostGlusterStorageDevicesListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.HostGlusterStorageDevicesListModel) HostMaintenanceConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.HostMaintenanceConfirmationModel) NumaSupportModel(org.ovirt.engine.ui.uicommonweb.models.hosts.numa.NumaSupportModel) Model(org.ovirt.engine.ui.uicommonweb.models.Model) TaskListModel(org.ovirt.engine.ui.uicommonweb.models.events.TaskListModel) ListWithSimpleDetailsModel(org.ovirt.engine.ui.uicommonweb.models.ListWithSimpleDetailsModel) HostAffinityLabelListModel(org.ovirt.engine.ui.uicommonweb.models.configure.labels.list.HostAffinityLabelListModel) TagAssigningModel(org.ovirt.engine.ui.uicommonweb.TagAssigningModel) HostDeviceListModel(org.ovirt.engine.ui.uicommonweb.models.vms.hostdev.HostDeviceListModel)

Example 92 with VDS

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

the class HostListModel method updateActionAvailability.

private void updateActionAvailability() {
    List<VDS> items = getSelectedItems() != null ? getSelectedItems() : new ArrayList<VDS>();
    boolean isAllPMEnabled = items.stream().allMatch(VDS::isPmEnabled);
    getEditCommand().setIsExecutionAllowed(items.size() == 1 && ActionUtils.canExecute(items, VDS.class, ActionType.UpdateVds));
    getEditWithPMemphasisCommand().setIsExecutionAllowed(items.size() == 1 && ActionUtils.canExecute(items, VDS.class, ActionType.UpdateVds));
    getRemoveCommand().setIsExecutionAllowed(items.size() > 0 && ActionUtils.canExecute(items, VDS.class, ActionType.RemoveVds));
    getActivateCommand().setIsExecutionAllowed(items.size() > 0 && ActionUtils.canExecute(items, VDS.class, ActionType.ActivateVds));
    // or special case where its installation failed but its oVirt node
    boolean approveAvailability = items.size() == 1 && (ActionUtils.canExecute(items, VDS.class, ActionType.ApproveVds) || (items.get(0).getStatus() == VDSStatus.InstallFailed && items.get(0).isOvirtVintageNode()));
    getApproveCommand().setIsExecutionAllowed(approveAvailability);
    boolean installAvailability = false;
    if (singleHostSelected(items)) {
        VDS host = items.get(0);
        installAvailability = host.getStatus() == VDSStatus.InstallFailed || host.getStatus() == VDSStatus.Maintenance;
    }
    getInstallCommand().setIsExecutionAllowed(installAvailability);
    boolean webConsoleAvailability = singleHostSelected(items);
    getHostConsoleCommand().setIsExecutionAllowed(webConsoleAvailability);
    boolean checkForUpgradeAvailability = false;
    if (singleHostSelected(items)) {
        VDS host = items.get(0);
        checkForUpgradeAvailability = canCheckForHostUpgrade(host);
    }
    getCheckForUpgradeCommand().setIsExecutionAllowed(checkForUpgradeAvailability);
    boolean upgradeAvailability = false;
    if (singleHostSelected(items)) {
        VDS host = items.get(0);
        upgradeAvailability = canUpgradeHost(host);
    }
    getUpgradeCommand().setIsExecutionAllowed(upgradeAvailability);
    getEnrollCertificateCommand().setIsExecutionAllowed(installAvailability);
    getMaintenanceCommand().setIsExecutionAllowed(items.size() > 0 && ActionUtils.canExecute(items, VDS.class, ActionType.MaintenanceVds));
    getSshRestartCommand().setIsExecutionAllowed(items.size() > 0 && ActionUtils.canExecute(items, VDS.class, ActionType.SshHostReboot));
    getSshStopCommand().setIsExecutionAllowed(items.size() > 0 && ActionUtils.canExecute(items, VDS.class, ActionType.VdsPowerDown));
    getRestartCommand().setIsExecutionAllowed(items.size() > 0 && ActionUtils.canExecute(items, VDS.class, ActionType.RestartVds) && isAllPMEnabled);
    getStartCommand().setIsExecutionAllowed(items.size() > 0 && ActionUtils.canExecute(items, VDS.class, ActionType.StartVds) && isAllPMEnabled);
    getStopCommand().setIsExecutionAllowed(items.size() > 0 && ActionUtils.canExecute(items, VDS.class, ActionType.StopVds) && isAllPMEnabled);
    setIsPowerManagementEnabled(getRestartCommand().getIsExecutionAllowed() || getStartCommand().getIsExecutionAllowed() || getStopCommand().getIsExecutionAllowed());
    getManualFenceCommand().setIsExecutionAllowed(items.size() == 1);
    getAssignTagsCommand().setIsExecutionAllowed(items.size() > 0);
    getSelectAsSpmCommand().setIsExecutionAllowed(isSelectAsSpmCommandAllowed(items));
    updateConfigureLocalStorageCommandAvailability();
    getRefreshCapabilitiesCommand().setIsExecutionAllowed(items.size() > 0 && ActionUtils.canExecute(items, VDS.class, ActionType.RefreshHostCapabilities));
    boolean numaVisible = false;
    if (getSelectedItem() != null) {
        numaVisible = getSelectedItem().isNumaSupport();
    }
    getNumaSupportCommand().setIsVisible(numaVisible);
    updateHaMaintenanceAvailability();
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS)

Example 93 with VDS

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

the class NetworkHostListModel method syncSearch.

@Override
protected void syncSearch() {
    if (getEntity() == null) {
        return;
    }
    final NetworkHostFilter filter = getViewFilterType();
    AsyncQuery<QueryReturnValue> asyncQuery = new AsyncQuery<>(returnValue -> {
        if (filter.equals(getViewFilterType())) {
            final Iterable returnList = returnValue.getReturnValue();
            if (NetworkHostFilter.unattached.equals(getViewFilterType())) {
                final List<PairQueryable<VdsNetworkInterface, VDS>> items = new ArrayList<>();
                for (Object obj : returnList) {
                    items.add(new PairQueryable<VdsNetworkInterface, VDS>(null, (VDS) obj));
                }
                setItems(items);
            } else if (NetworkHostFilter.attached.equals(getViewFilterType())) {
                initAttachedInterfaces((Collection<PairQueryable<VdsNetworkInterface, VDS>>) returnList);
            }
        }
    });
    IdQueryParameters params = new IdQueryParameters(getEntity().getId());
    params.setRefresh(getIsQueryFirstTime());
    if (NetworkHostFilter.unattached.equals(getViewFilterType())) {
        Frontend.getInstance().runQuery(QueryType.GetVdsWithoutNetwork, params, asyncQuery);
    } else if (NetworkHostFilter.attached.equals(getViewFilterType())) {
        Frontend.getInstance().runQuery(QueryType.GetVdsAndNetworkInterfacesByNetworkId, params, asyncQuery);
    }
    setIsQueryFirstTime(false);
}
Also used : PairQueryable(org.ovirt.engine.core.common.utils.PairQueryable) VDS(org.ovirt.engine.core.common.businessentities.VDS) ArrayList(java.util.ArrayList) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface) Collection(java.util.Collection)

Example 94 with VDS

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

the class AddDataCenterRM method rollback3.

public void rollback3() {
    Enlistment enlistment = context.enlistment;
    EnlistmentContext enlistmentContext = (EnlistmentContext) enlistment.getContext();
    HostListModel<?> model = enlistmentContext.getModel();
    VDS host = context.hostFoundById;
    boolean abort = false;
    if (model.getSelectedItem() != null) {
        // Perform rollback only when the host is in maintenance.
        if (host.getStatus() != VDSStatus.Maintenance) {
            abort = true;
        }
    } else {
        abort = true;
    }
    if (abort) {
        context.enlistment = null;
        enlistment.done();
        return;
    }
    StoragePool dataCenter = context.dataCenterFoundById;
    // Perform rollback only when the Data Center is un uninitialized.
    if (dataCenter.getStatus() != StoragePoolStatus.Uninitialized) {
        context.enlistment = null;
        enlistment.done();
        return;
    }
    if (enlistmentContext.getOldClusterId() != null) {
        // Switch host back to previous cluster.
        Frontend.getInstance().runAction(ActionType.ChangeVDSCluster, new ChangeVDSClusterParameters(enlistmentContext.getOldClusterId(), host.getId()), result -> {
            ActionReturnValue returnValue = result.getReturnValue();
            context.changeVDSClusterReturnValue = returnValue;
            rollback4();
        });
    } else {
        context.enlistment = null;
        enlistment.done();
    }
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) VDS(org.ovirt.engine.core.common.businessentities.VDS) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) PreparingEnlistment(org.ovirt.engine.ui.uicompat.PreparingEnlistment) Enlistment(org.ovirt.engine.ui.uicompat.Enlistment) ChangeVDSClusterParameters(org.ovirt.engine.core.common.action.ChangeVDSClusterParameters)

Example 95 with VDS

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

the class AddDataCenterRM method rollback2.

public void rollback2() {
    Enlistment enlistment = context.enlistment;
    EnlistmentContext enlistmentContext = (EnlistmentContext) enlistment.getContext();
    HostListModel<?> model = enlistmentContext.getModel();
    VDS host = model.getSelectedItem();
    // Retrieve host to make sure we have an updated status etc.
    AsyncDataProvider.getInstance().getHostById(new AsyncQuery<>(returnValue -> {
        context.hostFoundById = returnValue;
        rollback3();
    }), host.getId());
}
Also used : ClusterParametersBase(org.ovirt.engine.core.common.action.ClusterParametersBase) StoragePoolParametersBase(org.ovirt.engine.core.common.action.StoragePoolParametersBase) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) StoragePoolStatus(org.ovirt.engine.core.common.businessentities.StoragePoolStatus) IEnlistmentNotification(org.ovirt.engine.ui.uicompat.IEnlistmentNotification) Linq(org.ovirt.engine.ui.uicommonweb.Linq) Guid(org.ovirt.engine.core.compat.Guid) PreparingEnlistment(org.ovirt.engine.ui.uicompat.PreparingEnlistment) StringHelper(org.ovirt.engine.core.compat.StringHelper) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) StoragePoolManagementParameter(org.ovirt.engine.core.common.action.StoragePoolManagementParameter) Objects(java.util.Objects) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) Enlistment(org.ovirt.engine.ui.uicompat.Enlistment) ChangeVDSClusterParameters(org.ovirt.engine.core.common.action.ChangeVDSClusterParameters) AsyncQuery(org.ovirt.engine.ui.frontend.AsyncQuery) DataCenterModel(org.ovirt.engine.ui.uicommonweb.models.datacenters.DataCenterModel) VDS(org.ovirt.engine.core.common.businessentities.VDS) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) VDS(org.ovirt.engine.core.common.businessentities.VDS) PreparingEnlistment(org.ovirt.engine.ui.uicompat.PreparingEnlistment) Enlistment(org.ovirt.engine.ui.uicompat.Enlistment)

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