use of org.ovirt.engine.core.common.businessentities.VDSStatus in project ovirt-engine by oVirt.
the class ResourceManager method addVds.
public void addVds(VDS vds, boolean isInternal, boolean scheduleJobs) {
VdsManager vdsManager = vdsManagerFactory.create(vds, this);
if (isInternal) {
VDSStatus status = vds.getStatus();
switch(vds.getStatus()) {
case Error:
status = VDSStatus.Up;
break;
case Reboot:
case NonResponsive:
case Connecting:
case Installing:
status = VDSStatus.Unassigned;
break;
}
if (status != vds.getStatus()) {
vdsManager.setStatus(status, vds);
vdsManager.updateStatisticsData(vds.getStatisticsData());
}
// set pending to 0
vds.setPendingVcpusCount(0);
vdsManager.updateDynamicData(vds.getDynamicData());
}
if (scheduleJobs) {
vdsManager.scheduleJobs();
}
vdsManagersDict.put(vds.getId(), vdsManager);
log.info("VDS '{}' was added to the Resource Manager", vds.getId());
}
use of org.ovirt.engine.core.common.businessentities.VDSStatus in project ovirt-engine by oVirt.
the class VdsManager method processRefreshCapabilitiesResponse.
public VDSStatus processRefreshCapabilitiesResponse(AtomicBoolean processHardwareCapsNeeded, VDS vds, VDS oldVDS, VDSReturnValue caps) {
if (caps.getSucceeded()) {
// hence warning in case of permissive as well.
if (vds.getSELinuxEnforceMode() == null || vds.getSELinuxEnforceMode().equals(SELinuxMode.DISABLED) || (vds.getClusterSupportsGlusterService() && vds.getSELinuxEnforceMode().equals(SELinuxMode.PERMISSIVE))) {
AuditLogable auditLogable = createAuditLogableForHost(vds);
auditLogable.addCustomValue("Mode", vds.getSELinuxEnforceMode() == null ? "UNKNOWN" : vds.getSELinuxEnforceMode().name());
auditLogDirector.log(auditLogable, AuditLogType.VDS_NO_SELINUX_ENFORCEMENT);
if (vds.getSELinuxEnforceMode() != null) {
log.warn("Host '{}' is running with SELinux in '{}' mode", vds.getName(), vds.getSELinuxEnforceMode());
} else {
log.warn("Host '{}' does not report SELinux enforcement information.", vds.getName());
}
}
VDSStatus returnStatus = vds.getStatus();
NonOperationalReason nonOperationalReason = getHostNetworkTopologyPersister().persistAndEnforceNetworkCompliance(vds);
if (nonOperationalReason != NonOperationalReason.NONE) {
setIsSetNonOperationalExecuted(true);
if (returnStatus != VDSStatus.NonOperational) {
log.debug("monitoring: vds '{}' networks do not match its cluster networks, vds will be moved to NonOperational", vds);
vds.setStatus(VDSStatus.NonOperational);
vds.setNonOperationalReason(nonOperationalReason);
}
}
// We process the software capabilities.
VDSStatus oldStatus = vds.getStatus();
if (oldStatus != VDSStatus.Up) {
// persist to db the host's cpu_flags.
// TODO this needs to be revisited - either all the logic is in-memory or based on db
vdsDynamicDao.updateCpuFlags(vds.getId(), vds.getCpuFlags());
processHostFeaturesReported(vds);
monitoringStrategy.processHardwareCapabilities(vds);
}
monitoringStrategy.processSoftwareCapabilities(vds);
returnStatus = vds.getStatus();
if (returnStatus != oldStatus && returnStatus == VDSStatus.NonOperational) {
setIsSetNonOperationalExecuted(true);
}
processHardwareCapsNeeded.set(monitoringStrategy.processHardwareCapabilitiesNeeded(oldVDS, vds));
return returnStatus;
} else if (caps.getExceptionObject() != null) {
throw caps.getExceptionObject();
} else {
log.error("refreshCapabilities:GetCapabilitiesVDSCommand failed with no exception!");
throw new RuntimeException(caps.getExceptionString());
}
}
use of org.ovirt.engine.core.common.businessentities.VDSStatus in project ovirt-engine by oVirt.
the class PowerSavingBalancePolicyUnit method processPmAction.
private void processPmAction(Pair<VDS, VDSStatus> action) {
VDS vds = action.getFirst();
VDSStatus currentStatus = vds.getStatus();
VDSStatus targetStatus = action.getSecond();
if (targetStatus == VDSStatus.Maintenance && currentStatus == VDSStatus.Up) {
logAction(vds, AuditLogType.PM_POLICY_UP_TO_MAINTENANCE);
/* Up -> Maint */
Guid[] vdsList = new Guid[] { vds.getId() };
MaintenanceNumberOfVdssParameters parameters = new MaintenanceNumberOfVdssParameters(Arrays.asList(vdsList), true, true);
Backend.getInstance().runInternalAction(ActionType.MaintenanceNumberOfVdss, parameters, ExecutionHandler.createInternalJobContext());
} else if (targetStatus == VDSStatus.Down && currentStatus == VDSStatus.Maintenance) {
logAction(vds, AuditLogType.PM_POLICY_MAINTENANCE_TO_DOWN);
/* Maint -> Down */
VdsPowerDownParameters parameters = new VdsPowerDownParameters(vds.getId());
parameters.setKeepPolicyPMEnabled(true);
Backend.getInstance().runInternalAction(ActionType.VdsPowerDown, parameters, ExecutionHandler.createInternalJobContext());
} else if (targetStatus == VDSStatus.Up && currentStatus == VDSStatus.Maintenance) {
logAction(vds, AuditLogType.PM_POLICY_TO_UP);
/* Maint -> Up */
VdsActionParameters parameters = new VdsActionParameters(vds.getId());
Backend.getInstance().runInternalAction(ActionType.ActivateVds, parameters, ExecutionHandler.createInternalJobContext());
} else if (targetStatus == VDSStatus.Up && currentStatus == VDSStatus.Down) {
logAction(vds, AuditLogType.PM_POLICY_TO_UP);
/* Down -> Up */
FenceVdsActionParameters parameters = new FenceVdsActionParameters(vds.getId());
Backend.getInstance().runInternalAction(ActionType.StartVds, parameters, ExecutionHandler.createInternalJobContext());
} else {
/* Should not ever happen... */
log.error("Unknown host power management transition '{}' -> '{}'", currentStatus, targetStatus);
}
}
use of org.ovirt.engine.core.common.businessentities.VDSStatus in project ovirt-engine by oVirt.
the class FenceVdsBaseCommand method executeCommand.
@Override
protected void executeCommand() {
log.info("Power-Management: {} of host '{}' initiated.", getAction(), getVdsName());
audit(AuditLogType.FENCE_OPERATION_STARTED);
VDSStatus lastStatus = getVds().getStatus();
FenceOperationResult result = null;
try {
setup();
result = createHostFenceActionExecutor(getVds(), getParameters().getFencingPolicy()).fence(getAction());
handleResult(result);
if (getSucceeded()) {
log.info("Power-Management: {} host '{}' succeeded.", getAction(), getVdsName());
audit(AuditLogType.FENCE_OPERATION_SUCCEEDED);
} else {
log.info("Power-Management: {} host '{}' failed.", getAction(), getVdsName());
audit(AuditLogType.FENCE_OPERATION_FAILED);
}
} finally {
if (!getSucceeded()) {
setStatus(lastStatus);
if (result != null && result.getStatus() != Status.SKIPPED_DUE_TO_POLICY) {
// show alert only if command was not skipped due to fencing policy
alertIfPowerManagementOperationFailed();
}
throw new EngineException(EngineError.VDS_FENCE_OPERATION_FAILED);
} else {
teardown();
}
}
}
use of org.ovirt.engine.core.common.businessentities.VDSStatus in project ovirt-engine by oVirt.
the class StartVdsCommand method validate.
@Override
protected boolean validate() {
boolean retValue = super.validate();
VDS vds = getVds();
if (vds != null) {
VDSStatus vdsStatus = vds.getStatus();
if (vdsStatus == VDSStatus.Connecting) {
retValue = false;
addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_VDS_INTERMITENT_CONNECTIVITY);
} else if (!legalStatusForStartingVds(vdsStatus)) {
addValidationMessage(EngineMessage.VDS_STATUS_NOT_VALID_FOR_START);
retValue = false;
log.error("VDS status for vds '{}' '{}' is '{}'", vds.getId(), vds.getName(), vdsStatus);
}
}
return retValue;
}
Aggregations