Search in sources :

Example 6 with GlusterServerService

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;
}
Also used : GlusterServerService(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService) HashMap(java.util.HashMap) Guid(org.ovirt.engine.core.compat.Guid)

Example 7 with GlusterServerService

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;
}
Also used : GlusterServiceStatus(org.ovirt.engine.core.common.businessentities.gluster.GlusterServiceStatus) HashMap(java.util.HashMap) GlusterServerService(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService)

Example 8 with GlusterServerService

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));
            }
        }
    }
}
Also used : SetVdsStatusVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.SetVdsStatusVDSCommandParameters) GlusterServerService(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService) GlusterServiceVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterServiceVDSParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 9 with GlusterServerService

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);
        }
    }
}
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 10 with GlusterServerService

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