Search in sources :

Example 16 with GlusterVolumeGeoRepSessionVDSParameters

use of org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepSessionVDSParameters in project ovirt-engine by oVirt.

the class GlusterGeoRepSyncJob method getSessionsFromCLI.

private Map<String, GlusterGeoRepSession> getSessionsFromCLI(Cluster cluster, GlusterVolumeEntity volume) {
    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;
    }
    String volName = volume != null ? volume.getName() : null;
    // get details of geo-rep sessions in cluster
    VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeGeoRepSessionList, new GlusterVolumeGeoRepSessionVDSParameters(upServer.getId(), volName));
    if (returnValue.getSucceeded()) {
        List<GlusterGeoRepSession> sessions = (List<GlusterGeoRepSession>) returnValue.getReturnValue();
        HashMap<String, GlusterGeoRepSession> sessionsMap = new HashMap<>();
        if (sessions == null) {
            return sessionsMap;
        }
        for (GlusterGeoRepSession session : sessions) {
            sessionsMap.put(session.getSessionKey(), session);
        }
        return sessionsMap;
    } else {
        log.error("VDS error {}", returnValue.getVdsError().getMessage());
        log.debug("VDS error", returnValue.getVdsError());
        return null;
    }
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) HashMap(java.util.HashMap) GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession) GlusterVolumeGeoRepSessionVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepSessionVDSParameters) ArrayList(java.util.ArrayList) List(java.util.List) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Aggregations

GlusterVolumeGeoRepSessionVDSParameters (org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepSessionVDSParameters)16 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)9 GlusterGeoRepSession (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)5 ArrayList (java.util.ArrayList)4 List (java.util.List)3 VDS (org.ovirt.engine.core.common.businessentities.VDS)3 HashSet (java.util.HashSet)2 SetUpMountBrokerParameters (org.ovirt.engine.core.common.action.gluster.SetUpMountBrokerParameters)2 SetUpPasswordLessSSHParameters (org.ovirt.engine.core.common.action.gluster.SetUpPasswordLessSSHParameters)2 EngineException (org.ovirt.engine.core.common.errors.EngineException)2 Guid (org.ovirt.engine.core.compat.Guid)2 HashMap (java.util.HashMap)1 Callable (java.util.concurrent.Callable)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 GlusterVolumeGeoRepSessionParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeGeoRepSessionParameters)1 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)1