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;
}
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;
}
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);
}
}
}
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());
}
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;
}
Aggregations