Search in sources :

Example 11 with GlusterServerService

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

the class GlusterServerServiceDaoTest method testSaveAndGet.

@Test
public void testSaveAndGet() {
    GlusterServerService service = dao.get(NEW_SERVICE_ID);
    assertNull(service);
    GlusterServerService newService = insertTestService();
    service = dao.get(NEW_SERVICE_ID);
    assertNotNull(service);
    assertEquals(newService, service);
}
Also used : GlusterServerService(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService) Test(org.junit.Test)

Example 12 with GlusterServerService

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

the class ManageGlusterServiceCommandTest method getGlusterServerServicesByServerIdAndServiceType.

private List<GlusterServerService> getGlusterServerServicesByServerIdAndServiceType(Guid serverId, ServiceType serviceType, GlusterServiceStatus status) {
    List<GlusterServerService> serviceList = new ArrayList<>();
    GlusterServerService srvc1 = new GlusterServerService();
    srvc1.setMessage("test-msg1");
    srvc1.setPid(10000);
    srvc1.setPort(20000);
    srvc1.setServerId(serverId);
    srvc1.setServiceId((status == GlusterServiceStatus.RUNNING) ? startedServiceId1 : stoppedServiceId1);
    srvc1.setServiceName("srvc1");
    srvc1.setServiceType(serviceType);
    srvc1.setStatus(status);
    serviceList.add(srvc1);
    GlusterServerService srvc2 = new GlusterServerService();
    srvc2.setMessage("test-msg2");
    srvc2.setPid(30000);
    srvc2.setPort(40000);
    srvc2.setServerId(serverId);
    srvc2.setServiceId((status == GlusterServiceStatus.RUNNING) ? startedServiceId2 : stoppedServiceId2);
    srvc2.setServiceName("srvc2");
    srvc2.setServiceType(serviceType);
    srvc2.setStatus(status);
    serviceList.add(srvc2);
    return serviceList;
}
Also used : GlusterServerService(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService) ArrayList(java.util.ArrayList)

Example 13 with GlusterServerService

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

the class ManageGlusterServiceCommand method getCallableVdsCmdList.

private List<Callable<Pair<VDS, VDSReturnValue>>> getCallableVdsCmdList() {
    List<VDS> servers = glusterUtil.getAllUpServers(getClusterId());
    final List<String> serviceList = getServiceList();
    List<Callable<Pair<VDS, VDSReturnValue>>> commandList = new ArrayList<>();
    for (final VDS upServer : servers) {
        commandList.add(() -> {
            VDSReturnValue returnValue = runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(upServer.getId(), serviceList, getParameters().getActionType()));
            Pair<VDS, VDSReturnValue> pairRetVal = new Pair<>(upServer, returnValue);
            if (returnValue.getSucceeded()) {
                updateService(upServer.getId(), (List<GlusterServerService>) returnValue.getReturnValue());
            } else {
                errors.add(returnValue.getVdsError().getMessage());
            }
            return pairRetVal;
        });
    }
    return commandList;
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) GlusterServerService(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService) ArrayList(java.util.ArrayList) GlusterServiceVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterServiceVDSParameters) Callable(java.util.concurrent.Callable) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue) Pair(org.ovirt.engine.core.common.utils.Pair)

Example 14 with GlusterServerService

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

the class GetGlusterVolumeAdvancedDetailsQuery method executeQueryCommand.

@Override
protected void executeQueryCommand() {
    clusterId = getParameters().getClusterId();
    detailRequired = getParameters().isDetailRequired();
    Guid volumeId = getParameters().getVolumeId();
    if (volumeId != null) {
        GlusterVolumeEntity volume = glusterVolumeDao.getById(volumeId);
        if (volume == null) {
            throw new RuntimeException(EngineMessage.GLUSTER_VOLUME_ID_INVALID.toString());
        }
        brick = getBrick(getParameters().getBrickId());
        getQueryReturnValue().setReturnValue(fetchAdvancedDetails(volume.getName()));
    } else {
        GlusterVolumeAdvancedDetails advancedDetails = getServiceInfo();
        if (advancedDetails != null) {
            List<GlusterServerService> serviceList = advancedDetails.getServiceInfo();
            if (serviceList != null) {
                for (GlusterServerService service : serviceList) {
                    String hostName = glusterDBUtils.getHostNameOrIP(service.getGlusterHostUuid());
                    if (hostName != null) {
                        service.setHostName(hostName);
                    }
                }
            }
        }
        getQueryReturnValue().setReturnValue(advancedDetails);
    }
}
Also used : GlusterServerService(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails) Guid(org.ovirt.engine.core.compat.Guid)

Example 15 with GlusterServerService

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

the class GlusterServiceSyncJobTest method createServerService.

private GlusterServerService createServerService(Guid serverId, Guid serviceId, String serviceName, GlusterServiceStatus status) {
    GlusterServerService service = new GlusterServerService();
    service.setId(Guid.newGuid());
    service.setServerId(serverId);
    service.setServiceId(serviceId);
    service.setStatus(status);
    service.setServiceName(serviceName);
    return service;
}
Also used : GlusterServerService(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService)

Aggregations

GlusterServerService (org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService)23 Guid (org.ovirt.engine.core.compat.Guid)7 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)5 Test (org.junit.Test)4 GlusterServiceStatus (org.ovirt.engine.core.common.businessentities.gluster.GlusterServiceStatus)4 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)4 List (java.util.List)3 VDS (org.ovirt.engine.core.common.businessentities.VDS)2 GlusterService (org.ovirt.engine.core.common.businessentities.gluster.GlusterService)2 ServiceType (org.ovirt.engine.core.common.businessentities.gluster.ServiceType)2 GlusterServiceVDSParameters (org.ovirt.engine.core.common.vdscommands.gluster.GlusterServiceVDSParameters)2 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)2 Context (com.google.gwt.cell.client.Cell.Context)1 SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)1 Column (com.google.gwt.user.cellview.client.Column)1 Collections (java.util.Collections)1 Comparator (java.util.Comparator)1 Map (java.util.Map)1 Callable (java.util.concurrent.Callable)1