Search in sources :

Example 31 with GlusterGeoRepSession

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession in project ovirt-engine by oVirt.

the class GeoRepSessionCommandTest method getGeoRepSession.

protected GlusterGeoRepSession getGeoRepSession(Guid gSessionId, GeoRepSessionStatus status) {
    GlusterGeoRepSession session = new GlusterGeoRepSession();
    session.setStatus(status);
    session.setId(gSessionId);
    return session;
}
Also used : GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)

Example 32 with GlusterGeoRepSession

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession in project ovirt-engine by oVirt.

the class GlusterVolumeGeoRepStatus method getSession.

protected GlusterGeoRepSession getSession(String masterVolumeName, Map<String, Object> innerMap) {
    GlusterGeoRepSession geoRepSession = new GlusterGeoRepSession();
    // sessionKey in the form - the uuid is the gluster server uuid on master
    // <sessionKey>11ae7a03-e793-4270-8fc4-b42def8b3051:ssh://192.168.122.14::slave2:bd52ddf1-9659-4168-8197-c62e9f3e855c</sessionKey>
    String sessionKey = (String) innerMap.get(SESSION_KEY);
    String[] sessSplit = sessionKey.split("([://]+)");
    // Older gluster versions doesn't have slave volume ID in the sessionKey, it is added in Glusterfs 3.7.12
    String slaveNode = sessSplit[2];
    if (slaveNode.contains("@")) {
        String[] hostComponents = slaveNode.split("@");
        slaveNode = hostComponents[hostComponents.length - 1];
        geoRepSession.setUserName(hostComponents[0]);
    }
    String slaveVolume = (String) innerMap.get(REMOTE_VOL_NAME);
    geoRepSession.setSlaveHostName(slaveNode);
    geoRepSession.setSlaveVolumeName(slaveVolume);
    geoRepSession.setSessionKey(sessionKey);
    geoRepSession.setMasterVolumeName(masterVolumeName);
    return geoRepSession;
}
Also used : GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)

Example 33 with GlusterGeoRepSession

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession in project ovirt-engine by oVirt.

the class GlusterStorageDomainDRSyncJob method syncData.

@OnTimerMethodAnnotation("syncData")
public void syncData(String storageDomainId, String geoRepSessionId) {
    try {
        // Get storage domain and georep session
        StorageDomain storageDomain = storageDomainDao.get(new Guid(storageDomainId));
        if (storageDomain == null) {
            log.error("No storage domain found for id '{}'", storageDomainId);
            return;
        }
        GlusterGeoRepSession session = geoRepDao.getById(new Guid(geoRepSessionId));
        if (session == null) {
            log.error("No geo-replication session found for id '{}'", geoRepSessionId);
            return;
        }
        backend.runInternalAction(ActionType.GlusterStorageSync, new GlusterStorageSyncCommandParameters(storageDomain.getId(), session.getId()), ExecutionHandler.createInternalJobContext());
    } catch (Exception e) {
        log.error("Error running dr sync", e);
    }
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession) GlusterStorageSyncCommandParameters(org.ovirt.engine.core.common.action.GlusterStorageSyncCommandParameters) Guid(org.ovirt.engine.core.compat.Guid) OnTimerMethodAnnotation(org.ovirt.engine.core.utils.timer.OnTimerMethodAnnotation)

Example 34 with GlusterGeoRepSession

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession in project ovirt-engine by oVirt.

the class GlusterGeoRepDaoTest method testSave.

@Test
public void testSave() {
    GlusterGeoRepSession newSession = getGlusterGeoRepSession();
    dao.save(newSession);
    GlusterGeoRepSession session = dao.getById(newSession.getId());
    assertEquals(newSession, session);
}
Also used : GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession) Test(org.junit.Test)

Example 35 with GlusterGeoRepSession

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession in project ovirt-engine by oVirt.

the class GlusterGeoRepDaoTest method testGetBySlaveHostAndVolume.

@Test
public void testGetBySlaveHostAndVolume() {
    GlusterGeoRepSession session = dao.getGeoRepSession(FixturesTool.GLUSTER_VOLUME_UUID1, new Guid("44f645f6-3fe9-4b35-a30c-be0d1a835ea8"), "slave-replica");
    assertNotNull(session);
    assertEquals(FixturesTool.GLUSTER_GEOREP_SESSION_ID, session.getId());
}
Also used : GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession) Guid(org.ovirt.engine.core.compat.Guid) Test(org.junit.Test)

Aggregations

GlusterGeoRepSession (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)49 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)12 EngineLock (org.ovirt.engine.core.utils.lock.EngineLock)9 GlusterVolumeGeoRepSessionParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeGeoRepSessionParameters)8 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)8 Test (org.junit.Test)7 ArrayList (java.util.ArrayList)6 VDS (org.ovirt.engine.core.common.businessentities.VDS)6 Guid (org.ovirt.engine.core.compat.Guid)6 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)5 GlusterVolumeGeoRepSessionVDSParameters (org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepSessionVDSParameters)5 GlusterGeoRepSessionDetails (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails)3 GlusterVolumeSnapshotEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity)3 HashMap (java.util.HashMap)2 Callable (java.util.concurrent.Callable)2 StorageDomainDR (org.ovirt.engine.core.common.businessentities.StorageDomainDR)2 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)2 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)2 EngineException (org.ovirt.engine.core.common.errors.EngineException)2 CreateGlusterVolumeSnapshotVDSParameters (org.ovirt.engine.core.common.vdscommands.gluster.CreateGlusterVolumeSnapshotVDSParameters)2