use of org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession in project ovirt-engine by oVirt.
the class SubTabStorageDRView method initTable.
void initTable() {
getTable().enableColumnResizing();
AbstractTextColumn<StorageDomainDR> sessionColumn = new AbstractTextColumn<StorageDomainDR>() {
@Override
public String getValue(StorageDomainDR storageDomainDR) {
GlusterGeoRepSession session = getDetailModel().getGeoRepSessionsMap().get(storageDomainDR.getGeoRepSessionId());
if (session == null) {
return storageDomainDR.getGeoRepSessionId().toString();
} else {
return messages.geoRepRemoteSessionName(session.getSlaveHostName(), session.getSlaveVolumeName());
}
}
};
// $NON-NLS-1$
getTable().addColumn(sessionColumn, constants.geoRepSlaveVolume(), "300px");
AbstractTextColumn<StorageDomainDR> scheduleColumn = new AbstractTextColumn<StorageDomainDR>() {
@Override
public String getValue(StorageDomainDR storageDomainDR) {
StorageSyncSchedule schedule = new StorageSyncSchedule(storageDomainDR.getScheduleCronExpression());
return schedule.toString();
}
};
// $NON-NLS-1$
getTable().addColumn(scheduleColumn, constants.scheduleLabel(), "300px");
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession in project ovirt-engine by oVirt.
the class RestoreGlusterVolumeSnapshotCommand method restoreSlaveVolumesToSnapshot.
private boolean restoreSlaveVolumesToSnapshot(List<GlusterGeoRepSession> geoRepSessions) {
for (GlusterGeoRepSession session : geoRepSessions) {
GlusterVolumeEntity slaveVolume = glusterVolumeDao.getById(session.getSlaveVolumeId());
if (slaveVolume == null) {
// continue with other sessions and try to pause
continue;
}
VDS slaveUpServer = glusterUtil.getRandomUpServer(slaveVolume.getClusterId());
if (slaveUpServer == null) {
handleVdsError(AuditLogType.GLUSTER_VOLUME_SNAPSHOT_RESTORE_FAILED, EngineError.NoUpServerFoundInRemoteCluster.name());
setSucceeded(false);
return false;
}
try (EngineLock lock = acquireEngineLock(slaveVolume.getClusterId(), LockingGroup.GLUSTER_SNAPSHOT)) {
if (!restoreVolumeToSnapshot(slaveUpServer.getId(), slaveVolume, getSnapshot().getSnapshotName())) {
return false;
}
}
}
return true;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession in project ovirt-engine by oVirt.
the class RestoreGlusterVolumeSnapshotCommand method resumeGeoRepSessions.
private boolean resumeGeoRepSessions(List<GlusterGeoRepSession> geoRepSessions) {
for (GlusterGeoRepSession session : geoRepSessions) {
GlusterVolumeEntity slaveVolume = glusterVolumeDao.getById(session.getSlaveVolumeId());
if (slaveVolume == null) {
// continue with other sessions and try to pause
continue;
}
try (EngineLock lock = acquireGeoRepSessionLock(session.getId())) {
ActionReturnValue retVal = runInternalAction(ActionType.ResumeGeoRepSession, new GlusterVolumeGeoRepSessionParameters(getGlusterVolumeId(), session.getId()));
if (!retVal.getSucceeded()) {
handleVdsError(AuditLogType.GLUSTER_VOLUME_GEO_REP_RESUME_FAILED, retVal.getExecuteFailedMessages().toString());
setSucceeded(false);
return false;
}
}
}
return true;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession in project ovirt-engine by oVirt.
the class RestoreGlusterVolumeSnapshotCommand method stopGeoReplicationSessions.
private boolean stopGeoReplicationSessions(List<GlusterGeoRepSession> geoRepSessions) {
for (GlusterGeoRepSession session : geoRepSessions) {
if (!(session.getStatus() == GeoRepSessionStatus.STOPPED || session.getStatus() == GeoRepSessionStatus.CREATED)) {
try (EngineLock lock = acquireGeoRepSessionLock(session.getId())) {
ActionReturnValue retVal = runInternalAction(ActionType.StopGeoRepSession, new GlusterVolumeGeoRepSessionParameters(getGlusterVolumeId(), session.getId()));
if (!retVal.getSucceeded()) {
handleVdsError(AuditLogType.GEOREP_SESSION_STOP_FAILED, retVal.getExecuteFailedMessages().toString());
setSucceeded(false);
return false;
}
session.setStatus(GeoRepSessionStatus.STOPPED);
engineStoppedSessions.add(session);
}
}
}
return true;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession in project ovirt-engine by oVirt.
the class ResumeGeoRepSessionCommand method executeCommand.
@Override
protected void executeCommand() {
GlusterGeoRepSession session = getGeoRepSession();
VDSReturnValue returnValue = runVdsCommand(VDSCommandType.ResumeGeoRepSession, new GlusterVolumeGeoRepSessionVDSParameters(upServer.getId(), session.getMasterVolumeName(), session.getSlaveHostName(), session.getSlaveVolumeName(), session.getUserName(), parameters.isForce()));
setSucceeded(returnValue.getSucceeded());
if (!getSucceeded()) {
handleVdsError(AuditLogType.GLUSTER_VOLUME_GEO_REP_RESUME_FAILED, returnValue.getVdsError().getMessage());
return;
}
}
Aggregations