Search in sources :

Example 6 with ManagementNetworkOnClusterOperationParameters

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

the class BackendClustersResource method createAddCommandParams.

private ManagementNetworkOnClusterOperationParameters createAddCommandParams(org.ovirt.engine.api.model.Cluster cluster, StoragePool dataCenter) {
    Cluster clusterEntity = map(cluster, map(dataCenter));
    if (!(cluster.isSetErrorHandling() && cluster.getErrorHandling().isSetOnError())) {
        clusterEntity.setMigrateOnError(null);
    }
    final Guid managementNetworkId = managementNetworkFinder.getManagementNetworkId(cluster, dataCenter.getId());
    return new ManagementNetworkOnClusterOperationParameters(clusterEntity, managementNetworkId);
}
Also used : ManagementNetworkOnClusterOperationParameters(org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Guid(org.ovirt.engine.core.compat.Guid)

Example 7 with ManagementNetworkOnClusterOperationParameters

use of org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters 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 8 with ManagementNetworkOnClusterOperationParameters

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

the class AddClusterCommandTest method createParameters.

private static ManagementNetworkOnClusterOperationParameters createParameters(Cluster cluster) {
    ManagementNetworkOnClusterOperationParameters parameters = new ManagementNetworkOnClusterOperationParameters(cluster);
    parameters.setCorrelationId(CORRELATION_ID);
    return parameters;
}
Also used : ManagementNetworkOnClusterOperationParameters(org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters)

Example 9 with ManagementNetworkOnClusterOperationParameters

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

the class BackendClusterEnabledFeatureResource method remove.

@Override
public Response remove() {
    Cluster cluster = BackendClusterFeatureHelper.getClusterWithFeatureDisabled(this, clusterId, guid);
    ManagementNetworkOnClusterOperationParameters param = new ManagementNetworkOnClusterOperationParameters(cluster);
    return performAction(ActionType.UpdateCluster, param);
}
Also used : ManagementNetworkOnClusterOperationParameters(org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters) Cluster(org.ovirt.engine.core.common.businessentities.Cluster)

Example 10 with ManagementNetworkOnClusterOperationParameters

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

the class DataCenterGuideModel method onAddCluster.

public void onAddCluster() {
    ClusterModel model = (ClusterModel) getWindow();
    Cluster cluster = ClusterListModel.buildCluster(model, new Cluster());
    if (model.getProgress() != null) {
        return;
    }
    model.startProgress();
    Frontend.getInstance().runAction(ActionType.AddCluster, new ManagementNetworkOnClusterOperationParameters(cluster), result -> {
        DataCenterGuideModel localModel = (DataCenterGuideModel) result.getState();
        localModel.postOnAddCluster(result.getReturnValue());
    }, this);
}
Also used : ClusterModel(org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterModel) ManagementNetworkOnClusterOperationParameters(org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters) Cluster(org.ovirt.engine.core.common.businessentities.Cluster)

Aggregations

ManagementNetworkOnClusterOperationParameters (org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters)11 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)8 ClusterModel (org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterModel)2 ArrayList (java.util.ArrayList)1 WebApplicationException (javax.ws.rs.WebApplicationException)1 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 ActionType (org.ovirt.engine.core.common.action.ActionType)1 ClusterOperationParameters (org.ovirt.engine.core.common.action.ClusterOperationParameters)1 SetNonOperationalVdsParameters (org.ovirt.engine.core.common.action.SetNonOperationalVdsParameters)1 AdditionalFeature (org.ovirt.engine.core.common.businessentities.AdditionalFeature)1 ServerCpu (org.ovirt.engine.core.common.businessentities.ServerCpu)1 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)1 SupportedAdditionalClusterFeature (org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature)1 Network (org.ovirt.engine.core.common.businessentities.network.Network)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)1 Guid (org.ovirt.engine.core.compat.Guid)1 Version (org.ovirt.engine.core.compat.Version)1 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)1