use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServer 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.gluster.GlusterServer in project ovirt-engine by oVirt.
the class GlusterVolumeGeoRepStatus method getSessionDetails.
protected GlusterGeoRepSessionDetails getSessionDetails(Map<String, Object> innerMap) {
GlusterGeoRepSessionDetails details = new GlusterGeoRepSessionDetails();
Guid masterNodeGlusterId;
if (innerMap.containsKey(HOST_UUID)) {
masterNodeGlusterId = new Guid(innerMap.get(HOST_UUID).toString());
} else {
log.error("Master node uuid is not available");
return null;
}
String masterBrickDir = innerMap.containsKey(BRICK_NAME) ? innerMap.get(BRICK_NAME).toString() : null;
GlusterServer glusterServer = getDbUtils().getServerByUuid(masterNodeGlusterId);
if (glusterServer != null) {
GlusterBrickEntity brick = getDbUtils().getGlusterBrickByServerUuidAndBrickDir(glusterServer.getId(), masterBrickDir);
if (brick != null) {
details.setMasterBrickId(brick.getId());
}
}
if (details.getMasterBrickId() == null) {
log.error("Brick information could not be retrieved for gluster host id {} and brick dir {}", masterNodeGlusterId, masterBrickDir);
}
String slave = innerMap.containsKey(REMOTE_HOST) ? innerMap.get(REMOTE_HOST).toString() : null;
details.setSlaveHostName(slave);
details.setStatus(GeoRepSessionStatus.from((String) innerMap.get(STATUS)));
details.setCrawlStatus(GeoRepCrawlStatus.from((String) innerMap.get(CRAWL_STATUS)));
details.setCheckPointStatus((String) innerMap.get(CHECK_POINT_STATUS));
return details;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServer in project ovirt-engine by oVirt.
the class GlusterVolumeStatusReturn method getBrickEntity.
private GlusterBrickEntity getBrickEntity(GlusterVolumeEntity volume, Map<String, Object> brick) {
String brickName = (String) brick.get(BRICK);
String glusterHostUuid = (String) brick.get(HOST_UUID);
if (!StringUtils.isEmpty(glusterHostUuid)) {
GlusterServer glusterServer = Injector.get(GlusterDBUtils.class).getServerByUuid(Guid.createGuidFromString(glusterHostUuid));
if (glusterServer == null) {
log.warn("Could not update brick '{}' to volume '{}' - server uuid '{}' not found", brickName, volume.getName(), glusterHostUuid);
return null;
}
String[] brickParts = brickName.split(":", -1);
if (brickParts.length != 2) {
log.warn("Invalid brick representation '{}'", brickName);
return null;
}
String brickDir = brickParts[1];
return DbFacade.getInstance().getGlusterBrickDao().getBrickByServerIdAndDirectory(glusterServer.getId(), brickDir);
}
return GlusterCoreUtil.getBrickByQualifiedName(volume.getBricks(), brickName);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServer in project ovirt-engine by oVirt.
the class GlusterSyncJob method updateStatusAndpeerProbeOtherIface.
private void updateStatusAndpeerProbeOtherIface(Network glusterNetwork, VDS host, GlusterServerInfo fetchedServerInfo) {
GlusterServer glusterServer = serverDao.get(host.getId());
if (glusterServer == null) {
return;
}
if (glusterServer.getPeerStatus() == PeerStatus.DISCONNECTED && fetchedServerInfo.getStatus() == PeerStatus.CONNECTED) {
// change the status to indicate that host is now part of cluster
serverDao.updatePeerStatus(host.getId(), PeerStatus.CONNECTED);
}
if (glusterNetwork == null || host.getStatus() != VDSStatus.Up) {
return;
}
List<VdsNetworkInterface> interfaces = interfaceDao.getAllInterfacesForVds(host.getId());
for (VdsNetworkInterface iface : interfaces) {
if (glusterNetwork.getName().equals(iface.getNetworkName()) && StringUtils.isNotBlank(iface.getIpv4Address()) && !glusterServer.getKnownAddresses().contains(iface.getIpv4Address())) {
// get another server in the cluster
VDS upServer = getAlternateUpServerInCluster(host.getClusterId(), host.getId());
if (upServer != null) {
boolean peerProbed = glusterPeerProbeAdditionalInterface(upServer, iface.getIpv4Address());
if (peerProbed) {
serverDao.addKnownAddress(host.getId(), iface.getIpv4Address());
}
} else {
log.warn("probe could not be done for server '{}' as no alternate UP server found", host.getHostName());
}
}
}
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServer in project ovirt-engine by oVirt.
the class GeorepEventSubscriber method processEvent.
@Override
public void processEvent(GlusterEvent event) {
if (event == null) {
log.debug("No event to process!");
return;
}
GlusterServer glusterServer = glusterServerDao.getByGlusterServerUuid(Guid.createGuidFromString(event.getNodeId()));
if (glusterServer == null) {
log.debug("Could not determine gluster server from event '{}'", event);
return;
}
VdsStatic host = vdsStaticDao.get(glusterServer.getId());
if (host == null) {
log.debug("No host corresponding to gluster server in '{}'", event);
return;
}
if (event.getEvent().equalsIgnoreCase(EVENT_GEOREP_CHECKPOINT_COMPLETED)) {
GlusterVolumeEntity masterVol = glusterVolumeDao.getByName(host.getClusterId(), (String) event.getMessage().get(MASTER_VOLUME));
if (masterVol == null) {
log.debug("Could not determine master volume from event '{}'", event);
return;
}
GlusterGeoRepSession session = geoRepDao.getGeoRepSession(masterVol.getId(), (String) event.getMessage().get(SLAVE_HOST), (String) event.getMessage().get(SLAVE_VOLUME));
// hence forcing sync for now.
if (session != null) {
log.debug("received event for session '{}'", session.getSessionKey());
}
geoRepSyncJob.refreshGeoRepDataForVolume(masterVol);
}
}
Aggregations