use of org.ovirt.engine.core.common.vdscommands.VDSReturnValue in project ovirt-engine by oVirt.
the class GlusterVolumeRemoveBricksCommand method executeCommand.
@Override
protected void executeCommand() {
int replicaCount = (getGlusterVolume().getVolumeType() == GlusterVolumeType.REPLICATE || getGlusterVolume().getVolumeType() == GlusterVolumeType.DISTRIBUTED_REPLICATE) ? getParameters().getReplicaCount() : 0;
VDSReturnValue returnValue = runVdsCommand(VDSCommandType.StartRemoveGlusterVolumeBricks, new GlusterVolumeRemoveBricksVDSParameters(upServer.getId(), getGlusterVolumeName(), getParameters().getBricks(), replicaCount, true));
setSucceeded(returnValue.getSucceeded());
if (getSucceeded()) {
glusterDBUtils.removeBricksFromVolumeInDb(getGlusterVolume(), getParameters().getBricks(), replicaCount);
} else {
handleVdsError(AuditLogType.GLUSTER_VOLUME_REMOVE_BRICKS_FAILED, returnValue.getVdsError().getMessage());
return;
}
}
use of org.ovirt.engine.core.common.vdscommands.VDSReturnValue 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.VDSReturnValue in project ovirt-engine by oVirt.
the class PauseGlusterVolumeGeoRepSessionCommand method executeCommand.
@Override
protected void executeCommand() {
GlusterGeoRepSession session = getGeoRepSession();
VDSReturnValue returnValue = runVdsCommand(VDSCommandType.PauseGlusterVolumeGeoRepSession, new GlusterVolumeGeoRepSessionVDSParameters(upServer.getId(), session.getMasterVolumeName(), session.getSlaveHostName(), session.getSlaveVolumeName(), session.getUserName(), getParameters().isForce()));
setSucceeded(returnValue.getSucceeded());
if (!getSucceeded()) {
handleVdsError(AuditLogType.GLUSTER_VOLUME_GEO_REP_PAUSE_FAILED, returnValue.getVdsError().getMessage());
return;
} else {
session.setStatus(GeoRepSessionStatus.PAUSED);
glusterGeoRepDao.updateSession(session);
}
}
use of org.ovirt.engine.core.common.vdscommands.VDSReturnValue in project ovirt-engine by oVirt.
the class ReplaceGlusterVolumeBrickCommand method executeCommand.
@Override
protected void executeCommand() {
VDSReturnValue returnValue = runVdsCommand(VDSCommandType.ReplaceGlusterVolumeBrick, new ReplaceGlusterVolumeBrickActionVDSParameters(upServer.getId(), getGlusterVolumeName(), getParameters().getExistingBrick().getQualifiedName(), getParameters().getNewBrick().getQualifiedName()));
setSucceeded(returnValue.getSucceeded());
if (getSucceeded()) {
getParameters().getNewBrick().setStatus(getParameters().getExistingBrick().getStatus());
glusterBrickDao.replaceBrick(getParameters().getExistingBrick(), getParameters().getNewBrick());
} else {
handleVdsError(AuditLogType.GLUSTER_VOLUME_REPLACE_BRICK_FAILED, returnValue.getVdsError().getMessage());
return;
}
}
use of org.ovirt.engine.core.common.vdscommands.VDSReturnValue in project ovirt-engine by oVirt.
the class GlusterTasksService method getTaskListForCluster.
public Map<Guid, GlusterAsyncTask> getTaskListForCluster(Guid id) {
VDS upServer = glusterUtil.getRandomUpServer(id);
if (upServer == null) {
log.info("No up server in cluster");
return null;
}
VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GlusterTasksList, new VdsIdVDSCommandParametersBase(upServer.getId()));
if (returnValue.getSucceeded()) {
List<GlusterAsyncTask> tasks = (List<GlusterAsyncTask>) returnValue.getReturnValue();
Map<Guid, GlusterAsyncTask> tasksMap = new HashMap<>();
for (GlusterAsyncTask task : tasks) {
tasksMap.put(task.getTaskId(), task);
}
return tasksMap;
} else {
log.error("Error: {}", returnValue.getVdsError());
throw new EngineException(EngineError.GlusterVolumeStatusAllFailedException, returnValue.getVdsError().getMessage());
}
}
Aggregations