Search in sources :

Example 1 with SetNonOperationalVdsParameters

use of org.ovirt.engine.core.common.action.SetNonOperationalVdsParameters in project ovirt-engine by oVirt.

the class ActivateStorageDomainCommand method refreshAllVdssInPool.

private void refreshAllVdssInPool() {
    final List<Guid> vdsIdsToSetNonOperational = new ArrayList<>();
    getEventQueue().submitEventSync(new Event(getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), null, EventType.POOLREFRESH, ""), () -> {
        runSynchronizeOperation(new RefreshPoolSingleAsyncOperationFactory(), vdsIdsToSetNonOperational);
        return null;
    });
    for (Guid vdsId : vdsIdsToSetNonOperational) {
        Map<String, String> customLogValues = Collections.singletonMap("StorageDomainNames", getStorageDomainName());
        SetNonOperationalVdsParameters tempVar = new SetNonOperationalVdsParameters(vdsId, STORAGE_DOMAIN_UNREACHABLE, customLogValues);
        tempVar.setStorageDomainId(getStorageDomain().getId());
        tempVar.setTransactionScopeOption(TransactionScopeOption.RequiresNew);
        runInternalAction(ActionType.SetNonOperationalVds, tempVar, ExecutionHandler.createInternalJobContext(getContext()));
    }
}
Also used : SetNonOperationalVdsParameters(org.ovirt.engine.core.common.action.SetNonOperationalVdsParameters) ArrayList(java.util.ArrayList) Event(org.ovirt.engine.core.common.eventqueue.Event) RefreshPoolSingleAsyncOperationFactory(org.ovirt.engine.core.bll.storage.pool.RefreshPoolSingleAsyncOperationFactory) Guid(org.ovirt.engine.core.compat.Guid)

Example 2 with SetNonOperationalVdsParameters

use of org.ovirt.engine.core.common.action.SetNonOperationalVdsParameters in project ovirt-engine by oVirt.

the class HandleVdsCpuFlagsOrClusterChangedCommand method executeCommand.

@Override
protected void executeCommand() {
    String clusterCpuName = getVds().getClusterCpuName();
    Cluster grp = clusterDao.get(getVds().getClusterId());
    ServerCpu sc = getCpuFlagsManagerHandler().findMaxServerCpuByFlags(getVds().getCpuFlags(), getVds().getClusterCompatibilityVersion());
    if (sc == null) {
        // operational
        if (!StringUtils.isEmpty(getVds().getCpuFlags())) {
            foundCPU = false;
        } else {
            _hasFlags = false;
        }
        log.error("Could not find server cpu for server '{}' ({}), flags: '{}'", getVds().getName(), getVdsId(), getVds().getCpuFlags());
    }
    // Checks whether the host and the cluster have the same architecture
    if (_hasFlags && foundCPU) {
        if (grp.getArchitecture() != ArchitectureType.undefined && sc.getArchitecture() != grp.getArchitecture()) {
            architectureMatch = false;
            addCustomValue("VdsArchitecture", sc.getArchitecture().name());
            addCustomValue("ClusterArchitecture", grp.getArchitecture().name());
            SetNonOperationalVdsParameters tempVar = new SetNonOperationalVdsParameters(getVdsId(), NonOperationalReason.ARCHITECTURE_INCOMPATIBLE_WITH_CLUSTER);
            runInternalAction(ActionType.SetNonOperationalVds, tempVar, ExecutionHandler.createInternalJobContext(getContext()));
        } else {
            // if cluster doesn't have cpu then get the cpu from the vds
            if (StringUtils.isEmpty(clusterCpuName)) {
                // update group with the cpu name
                grp.setCpuName(sc.getCpuName());
                grp.setArchitecture(sc.getArchitecture());
                updateMigrateOnError(grp);
                // use suppress in order to update group even if action fails
                // (out of the transaction)
                ManagementNetworkOnClusterOperationParameters tempVar = new ManagementNetworkOnClusterOperationParameters(grp);
                tempVar.setTransactionScopeOption(TransactionScopeOption.Suppress);
                tempVar.setIsInternalCommand(true);
                runInternalAction(ActionType.UpdateCluster, tempVar);
                clusterCpuName = sc.getCpuName();
            }
        }
    }
    // If the host CPU name is not found by the CpuFlagsManagerHandler class, report an error
    if (architectureMatch) {
        List<String> missingFlags = getCpuFlagsManagerHandler().missingServerCpuFlags(clusterCpuName, getVds().getCpuFlags(), getVds().getClusterCompatibilityVersion());
        if (!StringUtils.isEmpty(getVds().getCpuFlags()) && (!foundCPU || missingFlags != null)) {
            if (missingFlags != null) {
                addCustomValue("CpuFlags", StringUtils.join(missingFlags, ", "));
                if (missingFlags.contains("nx")) {
                    auditLogDirector.log(this, AuditLogType.CPU_FLAGS_NX_IS_MISSING);
                }
            }
            SetNonOperationalVdsParameters tempVar2 = new SetNonOperationalVdsParameters(getVdsId(), NonOperationalReason.CPU_TYPE_INCOMPATIBLE_WITH_CLUSTER);
            runInternalAction(ActionType.SetNonOperationalVds, tempVar2, ExecutionHandler.createInternalJobContext(getContext()));
        } else {
            // if no need to change to non operational then don't log the command
            setCommandShouldBeLogged(false);
        }
    }
    setSucceeded(true);
}
Also used : SetNonOperationalVdsParameters(org.ovirt.engine.core.common.action.SetNonOperationalVdsParameters) ManagementNetworkOnClusterOperationParameters(org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters) ServerCpu(org.ovirt.engine.core.common.businessentities.ServerCpu) Cluster(org.ovirt.engine.core.common.businessentities.Cluster)

Example 3 with SetNonOperationalVdsParameters

use of org.ovirt.engine.core.common.action.SetNonOperationalVdsParameters in project ovirt-engine by oVirt.

the class HandleVdsVersionCommand method reportNonOperationReason.

private void reportNonOperationReason(NonOperationalReason reason, Map<String, String> customLogValues) {
    SetNonOperationalVdsParameters tempVar = new SetNonOperationalVdsParameters(getVdsId(), reason, customLogValues);
    runInternalAction(ActionType.SetNonOperationalVds, tempVar, ExecutionHandler.createInternalJobContext(getContext()));
}
Also used : SetNonOperationalVdsParameters(org.ovirt.engine.core.common.action.SetNonOperationalVdsParameters)

Example 4 with SetNonOperationalVdsParameters

use of org.ovirt.engine.core.common.action.SetNonOperationalVdsParameters in project ovirt-engine by oVirt.

the class AttestThread method setNonOperational.

private void setNonOperational(NonOperationalReason reason, VDS vds, Map<String, String> customLogValues) {
    SetNonOperationalVdsParameters tempVar = new SetNonOperationalVdsParameters(vds.getId(), reason, customLogValues);
    Backend.getInstance().runInternalAction(ActionType.SetNonOperationalVds, tempVar, ExecutionHandler.createInternalJobContext());
}
Also used : SetNonOperationalVdsParameters(org.ovirt.engine.core.common.action.SetNonOperationalVdsParameters)

Example 5 with SetNonOperationalVdsParameters

use of org.ovirt.engine.core.common.action.SetNonOperationalVdsParameters in project ovirt-engine by oVirt.

the class VdsEventListener method vdsNonOperational.

@Override
public void vdsNonOperational(Guid vdsId, NonOperationalReason reason, boolean logCommand, Guid domainId, Map<String, String> customLogValues) {
    executionHandler.updateSpecificActionJobCompleted(vdsId, ActionType.MaintenanceVds, false);
    SetNonOperationalVdsParameters tempVar = new SetNonOperationalVdsParameters(vdsId, reason, customLogValues);
    tempVar.setStorageDomainId(domainId);
    tempVar.setShouldBeLogged(logCommand);
    backend.runInternalAction(ActionType.SetNonOperationalVds, tempVar, ExecutionHandler.createInternalJobContext());
}
Also used : SetNonOperationalVdsParameters(org.ovirt.engine.core.common.action.SetNonOperationalVdsParameters)

Aggregations

SetNonOperationalVdsParameters (org.ovirt.engine.core.common.action.SetNonOperationalVdsParameters)7 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)2 ArrayList (java.util.ArrayList)1 RefreshPoolSingleAsyncOperationFactory (org.ovirt.engine.core.bll.storage.pool.RefreshPoolSingleAsyncOperationFactory)1 ManagementNetworkOnClusterOperationParameters (org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters)1 ServerCpu (org.ovirt.engine.core.common.businessentities.ServerCpu)1 Event (org.ovirt.engine.core.common.eventqueue.Event)1 Guid (org.ovirt.engine.core.compat.Guid)1