use of org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase in project ovirt-engine by oVirt.
the class CommitNetworkChangesCommand method executeCommand.
@Override
protected void executeCommand() {
VDSReturnValue retVal = runVdsCommand(VDSCommandType.SetSafeNetworkConfig, new VdsIdVDSCommandParametersBase(getParameters().getVdsId()));
vdsDynamicDao.updateNetConfigDirty(getParameters().getVdsId(), false);
setSucceeded(retVal.getSucceeded());
}
use of org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase in project ovirt-engine by oVirt.
the class InitGlusterCommandHelper method syncGlusterWebhook.
private void syncGlusterWebhook(VDS vds) {
try {
// check if there's a server that's online other than the one being added.
VDS newUpServer = getNewUpServer(vds, vds);
if (newUpServer == null) {
log.debug("No alternate up server to sync webhook for server '{}' ", vds.getHostName());
return;
}
VDSReturnValue returnValue = runVdsCommand(VDSCommandType.SyncGlusterWebhook, new VdsIdVDSCommandParametersBase(newUpServer.getId()));
if (!returnValue.getSucceeded()) {
log.error("Could not sync webhooks to gluster server '{}': {}", vds.getHostName(), returnValue.getExceptionString());
}
} catch (Exception e) {
log.error("Could not sync webhooks to gluster server '{}': {}", vds.getHostName(), e.getMessage());
log.debug("Exception", e);
}
}
use of org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase in project ovirt-engine by oVirt.
the class InitGlusterCommandHelper method getGlusterPeers.
@SuppressWarnings("unchecked")
private List<GlusterServerInfo> getGlusterPeers(VDS upServer) {
List<GlusterServerInfo> glusterServers = new ArrayList<>();
VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GlusterServersList, new VdsIdVDSCommandParametersBase(upServer.getId()));
if (!returnValue.getSucceeded()) {
AuditLogable logable = GlusterEventFactory.createEvent(upServer, returnValue);
auditLogDirector.log(logable, AuditLogType.GLUSTER_SERVERS_LIST_FAILED);
} else {
glusterServers = (List<GlusterServerInfo>) returnValue.getReturnValue();
}
return glusterServers;
}
use of org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase in project ovirt-engine by oVirt.
the class GetGlusterHostPublicKeysQuery method executeQueryCommand.
@SuppressWarnings("unchecked")
@Override
protected void executeQueryCommand() {
VDSReturnValue readPubKeyReturnValue = runVdsCommand(VDSCommandType.GetGlusterHostsPubKey, new VdsIdVDSCommandParametersBase(getParameters().getId()));
getQueryReturnValue().setReturnValue(readPubKeyReturnValue.getReturnValue());
}
use of org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase in project ovirt-engine by oVirt.
the class SpmStopVDSCommand method executeVdsBrokerCommand.
@Override
protected void executeVdsBrokerCommand() {
boolean lockAcquired = false;
try {
if (canVdsBeReached()) {
lockAcquired = lockManager.acquireLock(retrieveVdsExecutionLock()).getFirst();
if (!lockAcquired) {
getVDSReturnValue().setVdsError(new VDSError(EngineError.ENGINE, "Failed to acquire vds execution lock - related operation is under execution"));
getVDSReturnValue().setSucceeded(false);
return;
}
boolean performSpmStop = true;
Map<Guid, AsyncTaskStatus> unclearedTasks = null;
try {
VDSReturnValue vdsReturnValue = resourceManager.runVdsCommand(VDSCommandType.HSMGetAllTasksStatuses, new VdsIdVDSCommandParametersBase(getVds().getId()));
if (isNotSPM(vdsReturnValue)) {
return;
}
getVDSReturnValue().setSucceeded(vdsReturnValue.getSucceeded());
getVDSReturnValue().setVdsError(vdsReturnValue.getVdsError());
if (vdsReturnValue.getReturnValue() != null) {
unclearedTasks = (HashMap<Guid, AsyncTaskStatus>) vdsReturnValue.getReturnValue();
performSpmStop = unclearedTasks.isEmpty();
}
} catch (Exception e) {
performSpmStop = false;
log.info("SpmStopVDSCommand::Could not get tasks on vds '{}': {}", getVds().getName(), e.getMessage());
log.debug("Exception", e);
}
if (performSpmStop) {
log.info("SpmStopVDSCommand::Stopping SPM on vds '{}', pool id '{}'", getVds().getName(), getParameters().getStoragePoolId());
status = getBroker().spmStop(getParameters().getStoragePoolId().toString());
proceedProxyReturnValue();
} else {
getVDSReturnValue().setSucceeded(false);
if (getVDSReturnValue().getVdsError() == null) {
String unclearedTasksDetails = unclearedTasks.entrySet().stream().map(entry -> String.format("Task '%s', status '%s'", entry.getKey(), entry.getValue().getStatus())).collect(Collectors.joining("\n"));
log.error("SpmStopVDSCommand::Not stopping SPM on vds '{}', pool id '{}' as there are uncleared tasks '{}'", getVds().getName(), getParameters().getStoragePoolId(), unclearedTasksDetails);
VDSError error = new VDSError(EngineError.TaskInProgress, unclearedTasksDetails);
getVDSReturnValue().setVdsError(error);
} else if (getVDSReturnValue().getVdsError().getCode() == EngineError.VDS_NETWORK_ERROR) {
log.info("SpmStopVDSCommand::Could not get tasks on vds '{}' - network exception, not stopping spm! pool id '{}'", getVds().getName(), getParameters().getStoragePoolId());
}
}
} else {
log.info("SpmStopVDSCommand:: vds '{}' is in '{}' status - not performing spm stop, pool id '{}'", getVds().getName(), getVds().getStatus(), getParameters().getStoragePoolId());
getVDSReturnValue().setVdsError(new VDSError(EngineError.VDS_NETWORK_ERROR, "Vds is in incorrect status"));
getVDSReturnValue().setSucceeded(false);
}
} catch (RuntimeException exp) {
log.warn("Could not stop spm of pool '{}' on vds '{}': {}", getParameters().getStoragePoolId(), getParameters().getVdsId(), exp.getMessage());
log.debug("Exception", exp);
getVDSReturnValue().setExceptionObject(exp);
getVDSReturnValue().setSucceeded(false);
} finally {
if (lockAcquired) {
lockManager.releaseLock(retrieveVdsExecutionLock());
}
}
}
Aggregations