use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService in project ovirt-engine by oVirt.
the class GlusterServiceSyncJob method getExistingServicesMap.
private Map<Guid, GlusterServerService> getExistingServicesMap(VDS server) {
List<GlusterServerService> existingServices = serverServiceDao.getByServerId(server.getId());
Map<Guid, GlusterServerService> existingServicesMap = new HashMap<>();
if (existingServices != null) {
for (GlusterServerService service : existingServices) {
existingServicesMap.put(service.getServiceId(), service);
}
}
return existingServicesMap;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService in project ovirt-engine by oVirt.
the class GlusterServiceSyncJob method updateStatusToUnknown.
private Map<String, GlusterServiceStatus> updateStatusToUnknown(Collection<GlusterServerService> existingServices) {
Map<String, GlusterServiceStatus> serviceStatusMap = new HashMap<>();
for (GlusterServerService existingService : existingServices) {
existingService.setStatus(GlusterServiceStatus.UNKNOWN);
serviceStatusMap.put(existingService.getServiceName(), existingService.getStatus());
}
serverServiceDao.updateAll(existingServices);
return serviceStatusMap;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService in project ovirt-engine by oVirt.
the class ManageGlusterServiceCommand method performActionForServicesOfServer.
private void performActionForServicesOfServer() {
List<String> serviceList = getServiceList();
VDSReturnValue returnValue = null;
returnValue = runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(getParameters().getServerId(), serviceList, getParameters().getActionType()));
setSucceeded(returnValue.getSucceeded());
if (!getSucceeded()) {
handleVdsError(getAuditLogTypeValue(), returnValue.getVdsError().getMessage());
} else {
updateService(getParameters().getServerId(), (List<GlusterServerService>) returnValue.getReturnValue());
// if glusterd was restarted, update peer status and host status
if (getParameters().getServiceType() == ServiceType.GLUSTER && (GlusterConstants.MANAGE_GLUSTER_SERVICE_ACTION_TYPE_RESTART.equals(getParameters().getActionType()) || GlusterConstants.MANAGE_GLUSTER_SERVICE_ACTION_TYPE_START.equals(getParameters().getActionType()))) {
glusterServerDao.updatePeerStatus(getParameters().getServerId(), PeerStatus.CONNECTED);
// only if cluster supports only gluster service
if (!getCluster().supportsVirtService()) {
runVdsCommand(VDSCommandType.SetVdsStatus, new SetVdsStatusVDSCommandParameters(getVdsId(), VDSStatus.Initializing));
}
}
}
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService 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.GlusterServerService in project ovirt-engine by oVirt.
the class GlusterServerServiceDaoTest method insertTestService.
private GlusterServerService insertTestService() {
GlusterServerService service = new GlusterServerService();
service.setId(NEW_SERVICE_ID);
service.setServerId(FixturesTool.GLUSTER_BRICK_SERVER1);
service.setServiceId(SERVICE2_ID);
service.setServiceType(SERVICE2_TYPE);
service.setStatus(GlusterServiceStatus.UNKNOWN);
service.setMessage("test message");
service.setPid(NEW_PID);
service.setHostName(VDS_NAME1);
dao.save(service);
return service;
}
Aggregations