Search in sources :

Example 1 with VdsIdAndVdsVDSCommandParametersBase

use of org.ovirt.engine.core.common.vdscommands.VdsIdAndVdsVDSCommandParametersBase in project ovirt-engine by oVirt.

the class AutoRecoveryManager method recoverImpl.

public void recoverImpl() {
    check(vdsDao, ActionType.ActivateVds, arg -> {
        final VdsActionParameters params = new VdsActionParameters(arg.getId());
        params.setRunSilent(true);
        return params;
    }, list -> {
        List<VDS> filtered = new ArrayList<>(list.size());
        List<VdsNetworkInterface> nics;
        for (VDS vds : list) {
            if (vds.getNonOperationalReason() == NonOperationalReason.NETWORK_INTERFACE_IS_DOWN) {
                backend.getResourceManager().runVdsCommand(VDSCommandType.GetStats, new VdsIdAndVdsVDSCommandParametersBase(vds));
                nics = vds.getInterfaces();
            } else {
                nics = interfaceDao.getAllInterfacesForVds(vds.getId());
            }
            Map<String, Set<String>> problematicNics = NetworkMonitoringHelper.determineProblematicNics(nics, networkDao.getAllForCluster(vds.getClusterId()));
            if (problematicNics.isEmpty()) {
                filtered.add(vds);
            }
        }
        return filtered;
    }, "hosts");
    check(storageDomainDao, ActionType.ConnectDomainToStorage, arg -> {
        final StorageDomainPoolParametersBase params = new StorageDomainPoolParametersBase(arg.getId(), arg.getStoragePoolId());
        params.setRunSilent(true);
        return params;
    }, list -> list, "storage domains");
}
Also used : Set(java.util.Set) VDS(org.ovirt.engine.core.common.businessentities.VDS) VdsIdAndVdsVDSCommandParametersBase(org.ovirt.engine.core.common.vdscommands.VdsIdAndVdsVDSCommandParametersBase) StorageDomainPoolParametersBase(org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase) VdsActionParameters(org.ovirt.engine.core.common.action.VdsActionParameters) ArrayList(java.util.ArrayList) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)

Example 2 with VdsIdAndVdsVDSCommandParametersBase

use of org.ovirt.engine.core.common.vdscommands.VdsIdAndVdsVDSCommandParametersBase in project ovirt-engine by oVirt.

the class HostSetupNetworksCommand method executeCommand.

@Override
protected void executeCommand() {
    if (noChangesDetected()) {
        log.info("No changes were detected in setup networks for host '{}' (ID: '{}')", getVdsName(), getVdsId());
        setSucceeded(true);
        return;
    }
    try (EngineLock monitoringLock = acquireMonitorLock("Host setup networks")) {
        int timeout = getSetupNetworksTimeout();
        FutureVDSCall<VDSReturnValue> setupNetworksTask = invokeSetupNetworksCommand(timeout);
        try {
            VDSReturnValue retVal = setupNetworksTask.get(timeout, TimeUnit.SECONDS);
            if (retVal != null) {
                if (!retVal.getSucceeded() && retVal.getVdsError() == null && getParameters().rollbackOnFailure()) {
                    throw new EngineException(EngineError.SETUP_NETWORKS_ROLLBACK, retVal.getExceptionString());
                }
                VdsHandler.handleVdsResult(retVal);
                if (retVal.getSucceeded()) {
                    VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetCapabilities, new VdsIdAndVdsVDSCommandParametersBase(getVds()));
                    VDS updatedHost = (VDS) returnValue.getReturnValue();
                    persistNetworkChanges(updatedHost);
                }
                setSucceeded(true);
            }
        } catch (TimeoutException e) {
            log.debug("Host Setup networks command timed out for {} seconds", timeout);
        }
    }
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) VdsIdAndVdsVDSCommandParametersBase(org.ovirt.engine.core.common.vdscommands.VdsIdAndVdsVDSCommandParametersBase) EngineException(org.ovirt.engine.core.common.errors.EngineException) EngineLock(org.ovirt.engine.core.utils.lock.EngineLock) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue) TimeoutException(java.util.concurrent.TimeoutException)

Example 3 with VdsIdAndVdsVDSCommandParametersBase

use of org.ovirt.engine.core.common.vdscommands.VdsIdAndVdsVDSCommandParametersBase in project ovirt-engine by oVirt.

the class InitVdsOnUpCommand method proceedVdsStats.

private Pair<Boolean, List<StorageDomainStatic>> proceedVdsStats(boolean shouldCheckReportedDomains, StoragePool storagePool) {
    Pair<Boolean, List<StorageDomainStatic>> returnValue = new Pair<>(true, null);
    try {
        runVdsCommand(VDSCommandType.GetStats, new VdsIdAndVdsVDSCommandParametersBase(getVds()));
        if (shouldCheckReportedDomains) {
            List<Guid> problematicDomainsIds = fetchDomainsReportedAsProblematic(getVds().getDomains(), storagePool);
            for (Guid domainId : problematicDomainsIds) {
                StorageDomainStatic domainInfo = storageDomainStaticDao.get(domainId);
                log.error("Storage Domain '{}' of pool '{}' is in problem in host '{}'", domainInfo != null ? domainInfo.getStorageName() : domainId, getStoragePool().getName(), getVds().getName());
                if (domainInfo == null || domainInfo.getStorageDomainType().isDataDomain()) {
                    returnValue.setFirst(false);
                    if (returnValue.getSecond() == null) {
                        returnValue.setSecond(new ArrayList<>());
                    }
                    returnValue.getSecond().add(domainInfo);
                }
            }
        }
    } catch (EngineException e) {
        log.error("Could not get Host statistics for Host '{}': {}", getVds().getName(), e.getMessage());
        log.debug("Exception", e);
        returnValue.setFirst(false);
    }
    return returnValue;
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) VdsIdAndVdsVDSCommandParametersBase(org.ovirt.engine.core.common.vdscommands.VdsIdAndVdsVDSCommandParametersBase) EngineException(org.ovirt.engine.core.common.errors.EngineException) List(java.util.List) ArrayList(java.util.ArrayList) Guid(org.ovirt.engine.core.compat.Guid) Pair(org.ovirt.engine.core.common.utils.Pair)

Example 4 with VdsIdAndVdsVDSCommandParametersBase

use of org.ovirt.engine.core.common.vdscommands.VdsIdAndVdsVDSCommandParametersBase in project ovirt-engine by oVirt.

the class VdsManager method refreshHostSync.

public void refreshHostSync(VDS vds) {
    VDSReturnValue caps = resourceManager.runVdsCommand(VDSCommandType.GetCapabilities, new VdsIdAndVdsVDSCommandParametersBase(vds));
    handleRefreshCapabilitiesResponse(vds, caps, true);
}
Also used : VdsIdAndVdsVDSCommandParametersBase(org.ovirt.engine.core.common.vdscommands.VdsIdAndVdsVDSCommandParametersBase) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 5 with VdsIdAndVdsVDSCommandParametersBase

use of org.ovirt.engine.core.common.vdscommands.VdsIdAndVdsVDSCommandParametersBase in project ovirt-engine by oVirt.

the class VdsManager method getHardwareInfo.

public void getHardwareInfo(VDS vds) {
    // Verify version capabilities
    Set<Version> hostVersions = vds.getSupportedClusterVersionsSet();
    Version clusterCompatibility = vds.getClusterCompatibilityVersion();
    // API won't exist for the host and an exception will be raised by VDSM.
    if (hostVersions != null && hostVersions.contains(clusterCompatibility)) {
        resourceManager.runVdsCommand(VDSCommandType.GetHardwareInfoAsync, new VdsIdAndVdsVDSCommandParametersBase(vds).withCallback(new HardwareInfoCallback(vds)));
    }
}
Also used : Version(org.ovirt.engine.core.compat.Version) VdsIdAndVdsVDSCommandParametersBase(org.ovirt.engine.core.common.vdscommands.VdsIdAndVdsVDSCommandParametersBase)

Aggregations

VdsIdAndVdsVDSCommandParametersBase (org.ovirt.engine.core.common.vdscommands.VdsIdAndVdsVDSCommandParametersBase)6 ArrayList (java.util.ArrayList)3 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)3 List (java.util.List)2 VDS (org.ovirt.engine.core.common.businessentities.VDS)2 EngineException (org.ovirt.engine.core.common.errors.EngineException)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Set (java.util.Set)1 TimeoutException (java.util.concurrent.TimeoutException)1 StorageDomainPoolParametersBase (org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase)1 VdsActionParameters (org.ovirt.engine.core.common.action.VdsActionParameters)1 HostDevice (org.ovirt.engine.core.common.businessentities.HostDevice)1 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)1 VmDevice (org.ovirt.engine.core.common.businessentities.VmDevice)1 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)1 Pair (org.ovirt.engine.core.common.utils.Pair)1 Guid (org.ovirt.engine.core.compat.Guid)1 Version (org.ovirt.engine.core.compat.Version)1 EngineLock (org.ovirt.engine.core.utils.lock.EngineLock)1