use of org.ovirt.engine.core.common.vdscommands.SetVdsStatusVDSCommandParameters in project ovirt-engine by oVirt.
the class HostMonitoring method handleClassCastException.
private void handleClassCastException(ClassCastException cce) {
// This should occur only if the vdsm API is not the same as the cluster API (version mismatch)
log.error("Failure to refresh host '{}' runtime info. Incorrect vdsm version for cluster '{}': {}", vds.getName(), vds.getClusterName(), cce.getMessage());
log.debug("Exception", cce);
if (vds.getStatus() != VDSStatus.PreparingForMaintenance && vds.getStatus() != VDSStatus.Maintenance) {
resourceManager.runVdsCommand(VDSCommandType.SetVdsStatus, new SetVdsStatusVDSCommandParameters(vds.getId(), VDSStatus.Error));
}
}
use of org.ovirt.engine.core.common.vdscommands.SetVdsStatusVDSCommandParameters in project ovirt-engine by oVirt.
the class ManageGlusterServiceCommand method performActionForServicesOfServer.
private void performActionForServicesOfServer() {
List<String> serviceList = getServiceList();
VDSReturnValue returnValue = null;
returnValue = runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(getParameters().getServerId(), serviceList, getParameters().getActionType()));
setSucceeded(returnValue.getSucceeded());
if (!getSucceeded()) {
handleVdsError(getAuditLogTypeValue(), returnValue.getVdsError().getMessage());
} else {
updateService(getParameters().getServerId(), (List<GlusterServerService>) returnValue.getReturnValue());
// if glusterd was restarted, update peer status and host status
if (getParameters().getServiceType() == ServiceType.GLUSTER && (GlusterConstants.MANAGE_GLUSTER_SERVICE_ACTION_TYPE_RESTART.equals(getParameters().getActionType()) || GlusterConstants.MANAGE_GLUSTER_SERVICE_ACTION_TYPE_START.equals(getParameters().getActionType()))) {
glusterServerDao.updatePeerStatus(getParameters().getServerId(), PeerStatus.CONNECTED);
// only if cluster supports only gluster service
if (!getCluster().supportsVirtService()) {
runVdsCommand(VDSCommandType.SetVdsStatus, new SetVdsStatusVDSCommandParameters(getVdsId(), VDSStatus.Initializing));
}
}
}
}
use of org.ovirt.engine.core.common.vdscommands.SetVdsStatusVDSCommandParameters in project ovirt-engine by oVirt.
the class SetVdsStatusVDSCommand method executeVdsIdCommand.
@Override
protected void executeVdsIdCommand() {
final SetVdsStatusVDSCommandParameters parameters = getParameters();
if (_vdsManager != null) {
final VDS vds = getVds();
if (vds.getSpmStatus() != VdsSpmStatus.None && parameters.getStatus() != VDSStatus.Up) {
log.info("VDS '{}' is spm and moved from up calling resetIrs.", vds.getName());
// check if this host was spm and reset if do.
getVDSReturnValue().setSucceeded(resourceManager.runVdsCommand(VDSCommandType.ResetIrs, new ResetIrsVDSCommandParameters(vds.getStoragePoolId(), vds.getId())).getSucceeded());
if (!getVDSReturnValue().getSucceeded()) {
if (getParameters().isStopSpmFailureLogged()) {
AuditLogable base = new AuditLogableImpl();
base.setVdsId(vds.getId());
base.setVdsName(vds.getName());
auditLogDirector.log(base, AuditLogType.VDS_STATUS_CHANGE_FAILED_DUE_TO_STOP_SPM_FAILURE);
}
if (parameters.getStatus() == VDSStatus.PreparingForMaintenance) {
// ResetIrs command failed, SPM host status cannot be moved to Preparing For Maintenance
return;
}
}
}
TransactionSupport.executeInNewTransaction(() -> {
_vdsManager.setStatus(parameters.getStatus(), vds);
_vdsManager.updatePartialDynamicData(parameters.getNonOperationalReason(), parameters.getMaintenanceReason());
_vdsManager.updateStatisticsData(vds.getStatisticsData());
return null;
});
} else {
getVDSReturnValue().setSucceeded(false);
}
}
use of org.ovirt.engine.core.common.vdscommands.SetVdsStatusVDSCommandParameters in project ovirt-engine by oVirt.
the class MaintenanceNumberOfVdssCommand method setVdsStatusToPrepareForMaintenance.
private boolean setVdsStatusToPrepareForMaintenance(VDS vds) {
boolean result = true;
if (vds.getStatus() != VDSStatus.PreparingForMaintenance && vds.getStatus() != VDSStatus.NonResponsive && vds.getStatus() != VDSStatus.Down) {
SetVdsStatusVDSCommandParameters params = new SetVdsStatusVDSCommandParameters(vds.getId(), VDSStatus.PreparingForMaintenance, getParameters().getReason());
params.setStopSpmFailureLogged(true);
result = runVdsCommand(VDSCommandType.SetVdsStatus, params).getSucceeded();
}
return result;
}
Aggregations