use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.
the class GlusterAsyncTaskStatusQueryBase method updateHostIP.
private void updateHostIP(GlusterVolumeTaskStatusEntity taskStatus) {
if (taskStatus != null) {
for (GlusterVolumeTaskStatusForHost hostStatus : taskStatus.getHostwiseStatusDetails()) {
GlusterServer glusterServer = glusterServerDao.getByGlusterServerUuid(hostStatus.getHostUuid());
if (glusterServer != null) {
VDS host = vdsDao.get(glusterServer.getId());
if (host != null) {
hostStatus.setHostName(host.getName());
hostStatus.setHostId(host.getId());
}
}
}
}
}
use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.
the class GlusterGeoRepSyncJob method getSessionDetailFromCLI.
private List<GlusterGeoRepSessionDetails> getSessionDetailFromCLI(Cluster cluster, GlusterGeoRepSession session) {
VDS upServer = glusterUtil.getRandomUpServer(cluster.getId());
if (upServer == null) {
log.debug("No UP server found in cluster: {} for geo-rep monitoring", cluster.getName());
return null;
}
try {
VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeGeoRepSessionStatus, new GlusterVolumeGeoRepSessionVDSParameters(upServer.getId(), session.getMasterVolumeName(), session.getSlaveHostName(), session.getSlaveVolumeName(), session.getUserName()));
if (returnValue.getSucceeded()) {
return (List<GlusterGeoRepSessionDetails>) returnValue.getReturnValue();
} else {
log.error("VDS error {}", returnValue.getVdsError().getMessage());
log.debug("VDS error", returnValue.getVdsError());
return null;
}
} catch (Exception e) {
log.error("Exception getting geo-rep status from vds {}", e.getMessage());
log.debug("Exception", e);
return null;
}
}
use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.
the class GlusterGeoRepSyncJob method getSessionConfigFromCLI.
private List<GlusterGeoRepSessionConfiguration> getSessionConfigFromCLI(Cluster cluster, GlusterGeoRepSession session) {
VDS upServer = glusterUtil.getRandomUpServer(cluster.getId());
if (upServer == null) {
log.debug("No UP server found in cluster: {} for geo-rep monitoring", cluster.getName());
return null;
}
try {
VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeGeoRepConfigList, new GlusterVolumeGeoRepSessionVDSParameters(upServer.getId(), session.getMasterVolumeName(), session.getSlaveHostName(), session.getSlaveVolumeName(), session.getUserName()));
if (returnValue.getSucceeded()) {
return (List<GlusterGeoRepSessionConfiguration>) returnValue.getReturnValue();
} else {
log.error("VDS error {}", returnValue.getVdsError().getMessage());
log.debug("VDS error", returnValue.getVdsError());
return null;
}
} catch (Exception e) {
log.error("Exception getting geo-rep status from vds {}", e.getMessage());
log.debug("Exception", e);
return null;
}
}
use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.
the class GlusterHookStatusChangeCommand method executeCommand.
@Override
protected void executeCommand() {
entity = getGlusterHook();
addCustomValue(GlusterConstants.HOOK_NAME, entity.getName());
if (getAllUpServers().size() < clusterUtils.getServerCount(getGlusterHook().getClusterId())) {
errors.add(EngineMessage.CLUSTER_ALL_SERVERS_NOT_UP.toString());
}
List<Callable<Pair<VDS, VDSReturnValue>>> taskList = new ArrayList<>();
for (final VDS upServer : getAllUpServers()) {
taskList.add(() -> {
VDSReturnValue returnValue = runVdsCommand(getStatusChangeVDSCommand(), new GlusterHookVDSParameters(upServer.getId(), entity.getGlusterCommand(), entity.getStage(), entity.getName()));
return new Pair<>(upServer, returnValue);
});
}
boolean atLeastOneSuccess = false;
List<Pair<VDS, VDSReturnValue>> pairResults = ThreadPoolUtil.invokeAll(taskList);
for (Pair<VDS, VDSReturnValue> pairResult : pairResults) {
VDSReturnValue retValue = pairResult.getSecond();
if (retValue.getSucceeded()) {
atLeastOneSuccess = true;
// update status in database
updateServerHookStatusInDb(getGlusterHook().getId(), pairResult.getFirst().getId(), getNewStatus());
} else {
errors.add(retValue.getVdsError().getMessage());
}
}
setSucceeded(atLeastOneSuccess);
if (errors.size() > 0) {
// conflict in status
entity.addStatusConflict();
handleVdsErrors(getAuditLogTypeValue(), errors);
addCustomValue(GlusterConstants.FAILURE_MESSAGE, StringUtils.join(errors, System.lineSeparator()));
}
// The intention was to enable/disable hook. So we update the entity with new status if command succeeded
if (getSucceeded()) {
entity.setStatus(getNewStatus());
// no longer conflicts as all hooks have same status
entity.removeStatusConflict();
updateHookInDb(entity);
if (entity.getConflictStatus() == 0) {
// all conflicts have been resolved, remove server hooks
glusterHooksDao.removeGlusterServerHooks(entity.getId());
}
}
}
use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.
the class CreateGlusterVolumeGeoRepSessionCommand method fetchRemoteServers.
private Set<VDS> fetchRemoteServers() {
Set<VDS> remoteServers = new HashSet<>();
List<GlusterBrickEntity> slaveBricks = slaveVolume.getBricks();
for (GlusterBrickEntity currentBrick : slaveBricks) {
remoteServers.add(vdsDao.get(currentBrick.getServerId()));
}
return remoteServers;
}
Aggregations