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