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