use of org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepSessionVDSParameters in project ovirt-engine by oVirt.
the class GlusterGeoRepSyncJob method getSessionDetailFromCLI.
private List<GlusterGeoRepSessionDetails> getSessionDetailFromCLI(Cluster cluster, GlusterGeoRepSession session) {
VDS upServer = glusterUtil.getRandomUpServer(cluster.getId());
if (upServer == null) {
log.debug("No UP server found in cluster: {} for geo-rep monitoring", cluster.getName());
return null;
}
try {
VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeGeoRepSessionStatus, new GlusterVolumeGeoRepSessionVDSParameters(upServer.getId(), session.getMasterVolumeName(), session.getSlaveHostName(), session.getSlaveVolumeName(), session.getUserName()));
if (returnValue.getSucceeded()) {
return (List<GlusterGeoRepSessionDetails>) returnValue.getReturnValue();
} else {
log.error("VDS error {}", returnValue.getVdsError().getMessage());
log.debug("VDS error", returnValue.getVdsError());
return null;
}
} catch (Exception e) {
log.error("Exception getting geo-rep status from vds {}", e.getMessage());
log.debug("Exception", e);
return null;
}
}
use of org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepSessionVDSParameters in project ovirt-engine by oVirt.
the class GlusterGeoRepSyncJob method getSessionConfigFromCLI.
private List<GlusterGeoRepSessionConfiguration> getSessionConfigFromCLI(Cluster cluster, GlusterGeoRepSession session) {
VDS upServer = glusterUtil.getRandomUpServer(cluster.getId());
if (upServer == null) {
log.debug("No UP server found in cluster: {} for geo-rep monitoring", cluster.getName());
return null;
}
try {
VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeGeoRepConfigList, new GlusterVolumeGeoRepSessionVDSParameters(upServer.getId(), session.getMasterVolumeName(), session.getSlaveHostName(), session.getSlaveVolumeName(), session.getUserName()));
if (returnValue.getSucceeded()) {
return (List<GlusterGeoRepSessionConfiguration>) returnValue.getReturnValue();
} else {
log.error("VDS error {}", returnValue.getVdsError().getMessage());
log.debug("VDS error", returnValue.getVdsError());
return null;
}
} catch (Exception e) {
log.error("Exception getting geo-rep status from vds {}", e.getMessage());
log.debug("Exception", e);
return null;
}
}
use of org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepSessionVDSParameters in project ovirt-engine by oVirt.
the class CreateGlusterVolumeGeoRepSessionCommand method executeCommand.
@Override
protected void executeCommand() {
boolean rootSession = getParameters().getUserName().equalsIgnoreCase("root");
boolean succeeded = true;
Set<Guid> remoteServerIds = getServerIds(remoteServersSet);
Guid slaveHostId = getParameters().getSlaveHostId();
if (!rootSession) {
ActionReturnValue completeMountBrokerSetupOnSlaveInternalAction = backend.runInternalAction(ActionType.SetupGlusterGeoRepMountBrokerInternal, new SetUpMountBrokerParameters(vdsDao.get(slaveHostId).getClusterId(), new HashSet<>(Collections.singletonList(getParameters().getSlaveHostId())), getParameters().getSlaveVolumeName(), getParameters().getUserName(), getParameters().getUserGroup()));
succeeded = evaluateReturnValue(AuditLogType.GLUSTER_GEOREP_SETUP_MOUNT_BROKER_FAILED, completeMountBrokerSetupOnSlaveInternalAction);
remoteServerIds.remove(slaveHostId);
if (succeeded) {
auditLogDirector.log(this, AuditLogType.GLUSTER_SETUP_GEOREP_MOUNT_BROKER);
if (!remoteServerIds.isEmpty()) {
ActionReturnValue mountBrokerPartialSetupInternalAction = backend.runInternalAction(ActionType.SetupGlusterGeoRepMountBrokerInternal, new SetUpMountBrokerParameters(vdsDao.get(slaveHostId).getClusterId(), remoteServerIds, getParameters().getSlaveVolumeName(), getParameters().getUserName()));
succeeded = evaluateReturnValue(AuditLogType.GLUSTER_GEOREP_SETUP_MOUNT_BROKER_FAILED, mountBrokerPartialSetupInternalAction);
if (succeeded) {
auditLogDirector.log(this, AuditLogType.GLUSTER_SETUP_GEOREP_MOUNT_BROKER);
}
}
}
}
if (succeeded) {
remoteServerIds.add(slaveHostId);
ActionReturnValue setUpPasswordLessSSHinternalAction = runInternalAction(ActionType.SetUpPasswordLessSSHInternal, new SetUpPasswordLessSSHParameters(upServer.getClusterId(), remoteServerIds, getParameters().getUserName()));
succeeded = evaluateReturnValue(errorType, setUpPasswordLessSSHinternalAction);
if (succeeded) {
auditLogDirector.log(this, AuditLogType.SET_UP_PASSWORDLESS_SSH);
VDSReturnValue createVdsReturnValue = runVdsCommand(VDSCommandType.CreateGlusterVolumeGeoRepSession, new GlusterVolumeGeoRepSessionVDSParameters(upServer.getId(), getGlusterVolumeName(), vdsDao.get(slaveHostId).getHostName(), getParameters().getSlaveVolumeName(), getParameters().getUserName(), getParameters().isForce()));
succeeded = evaluateReturnValue(AuditLogType.GLUSTER_GEOREP_SESSION_CREATE_FAILED, createVdsReturnValue);
if (succeeded) {
glusterGeoRepSyncJob.refreshGeoRepDataForVolume(getGlusterVolume());
}
}
}
setSucceeded(succeeded);
}
use of org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepSessionVDSParameters in project ovirt-engine by oVirt.
the class DeleteGeoRepSessionCommand method executeCommand.
@Override
protected void executeCommand() {
VDSReturnValue returnValue = runVdsCommand(VDSCommandType.DeleteGlusterVolumeGeoRepSession, new GlusterVolumeGeoRepSessionVDSParameters(upServer.getId(), getGeoRepSession().getMasterVolumeName(), getGeoRepSession().getSlaveHostName(), getGeoRepSession().getSlaveVolumeName(), getGeoRepSession().getUserName()));
setSucceeded(returnValue.getSucceeded());
if (getSucceeded()) {
glusterGeoRepDao.remove(getGeoRepSession().getId());
} else {
handleVdsError(AuditLogType.GEOREP_SESSION_DELETE_FAILED, returnValue.getVdsError().getMessage());
}
}
use of org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepSessionVDSParameters in project ovirt-engine by oVirt.
the class StartGlusterVolumeGeoRepVDSCommand method executeVdsBrokerCommand.
@Override
protected void executeVdsBrokerCommand() {
GlusterVolumeGeoRepSessionVDSParameters parameters = getParameters();
status = getBroker().glusterVolumeGeoRepSessionStart(parameters.getVolumeName(), parameters.getSlaveHost(), parameters.getSlaveVolume(), parameters.getUserName(), parameters.getForce());
proceedProxyReturnValue();
}
Aggregations