Search in sources :

Example 1 with GlusterServer

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());
                }
            }
        }
    }
}
Also used : GlusterServer(org.ovirt.engine.core.common.businessentities.gluster.GlusterServer) GlusterVolumeTaskStatusForHost(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusForHost) VDS(org.ovirt.engine.core.common.businessentities.VDS)

Example 2 with GlusterServer

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;
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterServer(org.ovirt.engine.core.common.businessentities.gluster.GlusterServer) GlusterGeoRepSessionDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails) Guid(org.ovirt.engine.core.compat.Guid)

Example 3 with GlusterServer

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);
}
Also used : GlusterServer(org.ovirt.engine.core.common.businessentities.gluster.GlusterServer) GlusterDBUtils(org.ovirt.engine.core.dao.gluster.GlusterDBUtils)

Example 4 with GlusterServer

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());
            }
        }
    }
}
Also used : GlusterServer(org.ovirt.engine.core.common.businessentities.gluster.GlusterServer) VDS(org.ovirt.engine.core.common.businessentities.VDS) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)

Example 5 with GlusterServer

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);
    }
}
Also used : VdsStatic(org.ovirt.engine.core.common.businessentities.VdsStatic) GlusterServer(org.ovirt.engine.core.common.businessentities.gluster.GlusterServer) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)

Aggregations

GlusterServer (org.ovirt.engine.core.common.businessentities.gluster.GlusterServer)19 Test (org.junit.Test)8 VdsStatic (org.ovirt.engine.core.common.businessentities.VdsStatic)3 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)3 VDS (org.ovirt.engine.core.common.businessentities.VDS)2 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)2 Guid (org.ovirt.engine.core.compat.Guid)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 GlusterVolumeParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeParameters)1 GlusterGeoRepSession (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)1 GlusterGeoRepSessionDetails (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails)1 GlusterStatus (org.ovirt.engine.core.common.businessentities.gluster.GlusterStatus)1 GlusterVolumeTaskStatusForHost (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusForHost)1 Network (org.ovirt.engine.core.common.businessentities.network.Network)1 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)1 GlusterDBUtils (org.ovirt.engine.core.dao.gluster.GlusterDBUtils)1