Search in sources :

Example 1 with GlusterService

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

the class GlusterServicesReturn method getService.

private GlusterServerService getService(Map<String, Object> serviceMap) {
    GlusterServerService serverService = new GlusterServerService();
    serverService.setServiceName((String) serviceMap.get(NAME));
    String pid = (String) serviceMap.get(PID);
    serverService.setPid(StringUtils.isEmpty(pid) ? null : Integer.parseInt(pid));
    serverService.setStatus(GlusterServiceStatus.valueOf((String) serviceMap.get(STATUS)));
    serverService.setMessage((String) serviceMap.get(MESSAGE));
    serverService.setServerId(serverId);
    GlusterService service = servicesMap.get(serverService.getServiceName());
    if (service != null) {
        serverService.setServiceId(service.getId());
        serverService.setServiceType(service.getServiceType());
    }
    return serverService;
}
Also used : GlusterServerService(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService) GlusterService(org.ovirt.engine.core.common.businessentities.gluster.GlusterService)

Example 2 with GlusterService

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

the class GlusterServicesReturn method getServicesMap.

private static Map<String, GlusterService> getServicesMap() {
    Map<String, GlusterService> serviceNames = new HashMap<>();
    List<GlusterService> services = DbFacade.getInstance().getGlusterServiceDao().getAll();
    for (GlusterService service : services) {
        serviceNames.put(service.getServiceName(), service);
    }
    return serviceNames;
}
Also used : HashMap(java.util.HashMap) GlusterService(org.ovirt.engine.core.common.businessentities.gluster.GlusterService)

Example 3 with GlusterService

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

the class ManageGlusterServiceCommand method updateService.

private void updateService(Guid serverId, List<GlusterServerService> fetchedServerServices) {
    // form the list of service ids
    List<Guid> serviceIds = new ArrayList<>();
    for (GlusterService srvc : glusterServiceDao.getByServiceType(getParameters().getServiceType())) {
        serviceIds.add(srvc.getId());
    }
    for (GlusterServerService serverService : fetchedServerServices) {
        if (serviceIds.contains(serverService.getServiceId())) {
            serverService.setStatus(manageActionDetailsMap.get(getParameters().getActionType()).getStatus());
            glusterServerServiceDao.updateByServerIdAndServiceType(serverService);
        } else {
            glusterServerServiceDao.save(serverService);
        }
    }
}
Also used : GlusterServerService(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService) ArrayList(java.util.ArrayList) GlusterService(org.ovirt.engine.core.common.businessentities.gluster.GlusterService) Guid(org.ovirt.engine.core.compat.Guid)

Example 4 with GlusterService

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

the class GlusterServiceDaoTest method testGet.

@Test
public void testGet() {
    GlusterService service = dao.get(GLUSTER_SWIFT_SERVICE1_ID);
    assertNotNull(service);
    assertEquals(ServiceType.GLUSTER_SWIFT, service.getServiceType());
    assertEquals(GLUSTER_SWIFT_SERVICE1, service.getServiceName());
}
Also used : GlusterService(org.ovirt.engine.core.common.businessentities.gluster.GlusterService) Test(org.junit.Test)

Example 5 with GlusterService

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

the class GlusterServiceSyncJobTest method createGlusterService.

private GlusterService createGlusterService(Guid serviceId, String serviceName, ServiceType type) {
    GlusterService service = new GlusterService();
    service.setId(serviceId);
    service.setServiceName(serviceName);
    service.setServiceType(type);
    return service;
}
Also used : GlusterService(org.ovirt.engine.core.common.businessentities.gluster.GlusterService)

Aggregations

GlusterService (org.ovirt.engine.core.common.businessentities.gluster.GlusterService)8 ArrayList (java.util.ArrayList)3 Test (org.junit.Test)2 GlusterServerService (org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService)2 HashMap (java.util.HashMap)1 Guid (org.ovirt.engine.core.compat.Guid)1