Search in sources :

Example 1 with GlusterServiceVDSParameters

use of org.ovirt.engine.core.common.vdscommands.gluster.GlusterServiceVDSParameters 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 2 with GlusterServiceVDSParameters

use of org.ovirt.engine.core.common.vdscommands.gluster.GlusterServiceVDSParameters in project ovirt-engine by oVirt.

the class SetupGlusterGeoRepMountBrokerInternalCommand method restartGlusterd.

private VDSReturnValue restartGlusterd(Guid serverId) {
    getCustomValues().put(GlusterConstants.VDS_NAME, vdsDao.get(serverId).getName());
    GlusterServiceVDSParameters params = new GlusterServiceVDSParameters(serverId, Collections.singletonList("glusterd"), GlusterConstants.MANAGE_GLUSTER_SERVICE_ACTION_TYPE_RESTART);
    VDSReturnValue restartGlusterdReturnValue = runVdsCommand(VDSCommandType.ManageGlusterService, params);
    return restartGlusterdReturnValue;
}
Also used : GlusterServiceVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterServiceVDSParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 3 with GlusterServiceVDSParameters

use of org.ovirt.engine.core.common.vdscommands.gluster.GlusterServiceVDSParameters 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;
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) GlusterServerService(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService) ArrayList(java.util.ArrayList) GlusterServiceVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterServiceVDSParameters) Callable(java.util.concurrent.Callable) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue) Pair(org.ovirt.engine.core.common.utils.Pair)

Example 4 with GlusterServiceVDSParameters

use of org.ovirt.engine.core.common.vdscommands.gluster.GlusterServiceVDSParameters in project ovirt-engine by oVirt.

the class ActivateVdsCommand method executeCommand.

@Override
protected void executeCommand() {
    final VDS vds = getVds();
    try (EngineLock monitoringLock = acquireMonitorLock("Activate host")) {
        executionHandler.updateSpecificActionJobCompleted(vds.getId(), ActionType.MaintenanceVds, false);
        setSucceeded(setVdsStatus(VDSStatus.Unassigned).getSucceeded());
        if (getSucceeded()) {
            TransactionSupport.executeInNewTransaction(() -> {
                // set network to operational / non-operational
                List<Network> networks = networkDao.getAllForCluster(vds.getClusterId());
                networkClusterHelper.setStatus(vds.getClusterId(), networks);
                return null;
            });
            // Start glusterd service on the node, which would haven been stopped due to maintenance
            if (vds.getClusterSupportsGlusterService()) {
                runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(vds.getId(), Arrays.asList("glusterd"), "restart"));
            }
        }
    }
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) Network(org.ovirt.engine.core.common.businessentities.network.Network) GlusterServiceVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterServiceVDSParameters) EngineLock(org.ovirt.engine.core.utils.lock.EngineLock)

Example 5 with GlusterServiceVDSParameters

use of org.ovirt.engine.core.common.vdscommands.gluster.GlusterServiceVDSParameters in project ovirt-engine by oVirt.

the class HostMaintenanceCallback method stopGlusterServices.

private void stopGlusterServices(Guid vdsId) {
    // Stop glusterd service first
    boolean succeeded = resourceManager.runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(vdsId, Arrays.asList("glusterd"), "stop")).getSucceeded();
    if (succeeded) {
        // Stop other gluster related processes on the node
        succeeded = resourceManager.runVdsCommand(VDSCommandType.StopGlusterProcesses, new VdsIdVDSCommandParametersBase(vdsId)).getSucceeded();
        // Mark the bricks as DOWN on this node
        if (succeeded) {
            List<GlusterBrickEntity> bricks = glusterBrickDao.getGlusterVolumeBricksByServerId(vdsId);
            bricks.forEach(brick -> brick.setStatus(GlusterStatus.DOWN));
            glusterBrickDao.updateBrickStatuses(bricks);
        }
    }
    if (!succeeded) {
        log.error("Failed to stop gluster services while moving the host '{}' to maintenance", getHostName(vdsId));
    }
}
Also used : VdsIdVDSCommandParametersBase(org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterServiceVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterServiceVDSParameters)

Aggregations

GlusterServiceVDSParameters (org.ovirt.engine.core.common.vdscommands.gluster.GlusterServiceVDSParameters)5 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)3 VDS (org.ovirt.engine.core.common.businessentities.VDS)2 GlusterServerService (org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService)2 ArrayList (java.util.ArrayList)1 Callable (java.util.concurrent.Callable)1 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)1 Network (org.ovirt.engine.core.common.businessentities.network.Network)1 Pair (org.ovirt.engine.core.common.utils.Pair)1 SetVdsStatusVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.SetVdsStatusVDSCommandParameters)1 VdsIdVDSCommandParametersBase (org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase)1 EngineLock (org.ovirt.engine.core.utils.lock.EngineLock)1