Search in sources :

Example 16 with GlusterServer

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

the class GlusterServerDaoTest method testGetById.

@Test
public void testGetById() {
    GlusterServer entity = dao.getByServerId(FixturesTool.GLUSTER_BRICK_SERVER1);
    assertNotNull(entity);
    assertEquals(FixturesTool.GLUSTER_BRICK_SERVER1, entity.getId());
    assertEquals(FixturesTool.GLUSTER_SERVER_UUID1, entity.getGlusterServerUuid());
}
Also used : GlusterServer(org.ovirt.engine.core.common.businessentities.gluster.GlusterServer) Test(org.junit.Test)

Example 17 with GlusterServer

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

the class GlusterServerDaoTest method testSave.

@Test
public void testSave() {
    GlusterServer newEntity = new GlusterServer();
    newEntity.setId(FixturesTool.VDS_GLUSTER_SERVER2);
    newEntity.setGlusterServerUuid(FixturesTool.GLUSTER_SERVER_UUID2);
    newEntity.setPeerStatus(PeerStatus.CONNECTED);
    dao.save(newEntity);
    GlusterServer entity = dao.getByServerId(newEntity.getId());
    assertEquals(newEntity, entity);
}
Also used : GlusterServer(org.ovirt.engine.core.common.businessentities.gluster.GlusterServer) Test(org.junit.Test)

Example 18 with GlusterServer

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

the class GlusterServerDaoTest method testGetByGlusterServerUuid.

@Test
public void testGetByGlusterServerUuid() {
    GlusterServer entity = dao.getByGlusterServerUuid(FixturesTool.GLUSTER_SERVER_UUID1);
    assertNotNull(entity);
    assertEquals(FixturesTool.GLUSTER_BRICK_SERVER1, entity.getId());
    assertEquals(FixturesTool.GLUSTER_SERVER_UUID1, entity.getGlusterServerUuid());
}
Also used : GlusterServer(org.ovirt.engine.core.common.businessentities.gluster.GlusterServer) Test(org.junit.Test)

Example 19 with GlusterServer

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

the class InitGlusterCommandHelper method saveGlusterHostUuid.

private void saveGlusterHostUuid(VDS vds, Guid addedServerUuid) {
    GlusterServer glusterServer = glusterServerDao.getByServerId(vds.getId());
    if (glusterServer == null) {
        glusterServer = new GlusterServer();
        glusterServer.setId(vds.getId());
        glusterServer.setGlusterServerUuid(addedServerUuid);
        glusterServer.setPeerStatus(PeerStatus.CONNECTED);
        glusterServerDao.save(glusterServer);
    } else if (!glusterServer.getGlusterServerUuid().equals(addedServerUuid)) {
        // it's possible that the server is re-installed and gluster uuid has changed,
        // update this in the database.
        glusterServer.setGlusterServerUuid(addedServerUuid);
        glusterServerDao.update(glusterServer);
    }
}
Also used : GlusterServer(org.ovirt.engine.core.common.businessentities.gluster.GlusterServer)

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