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);
}
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);
}
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;
}
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);
}
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);
}
Aggregations