use of org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession in project ovirt-engine by oVirt.
the class DeleteAllGlusterVolumeSnapshotsCommand method executeCommand.
@Override
public void executeCommand() {
if (georepSessions != null) {
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_ALL_SNAPSHOTS_DELETE_FAILED, EngineError.NoUpServerFoundInRemoteCluster.name());
setSucceeded(false);
return;
}
List<GlusterVolumeSnapshotEntity> slaveVolumeSnapshots = glusterVolumeSnapshotDao.getAllByVolumeId(slaveVolume.getId());
try (EngineLock lock = acquireEngineLock(session.getSlaveVolumeId(), LockingGroup.GLUSTER_SNAPSHOT)) {
if (!deleteAllGlusterVolumeSnapshots(slaveUpServer.getId(), slaveVolume.getName(), slaveVolumeSnapshots)) {
return;
}
// Check and remove soft limit alert for the volume
glusterUtil.checkAndRemoveVolumeSnapshotLimitsAlert(slaveVolume);
}
}
}
deleteAllGlusterVolumeSnapshots(getUpServer().getId(), getGlusterVolumeName(), snapshots);
// Check and remove soft limit alert for the volume
glusterUtil.checkAndRemoveVolumeSnapshotLimitsAlert(getGlusterVolume());
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession in project ovirt-engine by oVirt.
the class DeleteGlusterVolumeSnapshotCommand method executeCommand.
@Override
public void executeCommand() {
if (georepSessions != null) {
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_DELETE_FAILED, EngineError.NoUpServerFoundInRemoteCluster.name());
setSucceeded(false);
return;
}
try (EngineLock lock = acquireEngineLock(session.getSlaveVolumeId(), LockingGroup.GLUSTER_SNAPSHOT)) {
if (!deleteGlusterVolumeSnapshot(slaveUpServer.getId(), slaveVolume.getName(), getSnapshot().getSnapshotName())) {
return;
}
// Check and remove soft limit alert for the volume
glusterUtil.checkAndRemoveVolumeSnapshotLimitsAlert(slaveVolume);
}
}
}
deleteGlusterVolumeSnapshot(getUpServer().getId(), getGlusterVolumeName(), getSnapshot().getSnapshotName());
// Check and remove soft limit alert for the volume
glusterUtil.checkAndRemoveVolumeSnapshotLimitsAlert(getGlusterVolume());
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession in project ovirt-engine by oVirt.
the class GlusterStorageGeoRepSyncCallback method evaluateGeoRepSessionStatus.
private void evaluateGeoRepSessionStatus(CommandBase<?> rootCommand) {
GlusterVolumeGeoRepSessionParameters parameters = (GlusterVolumeGeoRepSessionParameters) rootCommand.getParameters();
GlusterGeoRepSession session = geoRepDao.getById(parameters.getGeoRepSessionId());
if (session == null) {
rootCommand.setCommandStatus(CommandStatus.FAILED);
return;
}
session.setSessionDetails((ArrayList<GlusterGeoRepSessionDetails>) geoRepDao.getGeoRepSessionDetails(session.getId()));
switch(session.getStatus()) {
case ACTIVE:
// check if checkpoint is completed
if (session.isCheckPointCompleted()) {
// stop the geo-rep session
stopGeoRepSessionCommand(rootCommand, session);
rootCommand.setCommandStatus(CommandStatus.SUCCEEDED);
}
break;
case FAULTY:
rootCommand.setCommandStatus(CommandStatus.FAILED);
default:
break;
}
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession in project ovirt-engine by oVirt.
the class GlusterVolumeGeoRepStatus method populateSession.
private GlusterGeoRepSession populateSession(String volumeName, Map<String, Object> innerMap) {
GlusterGeoRepSession geoRepSession = getSession(volumeName, innerMap);
ArrayList<GlusterGeoRepSessionDetails> geoRepSessionDetails = new ArrayList<>();
if (innerMap.containsKey(BRICKS)) {
for (Object brickSession : (Object[]) innerMap.get(BRICKS)) {
geoRepSessionDetails.add(getSessionDetails((Map<String, Object>) brickSession));
}
}
geoRepSession.setSessionDetails(geoRepSessionDetails);
return geoRepSession;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession in project ovirt-engine by oVirt.
the class VolumeGeoRepListModel method confirmGeoRepAction.
private void confirmGeoRepAction(String title, HelpTag helpTag, String hashName, String commandName, String action) {
GlusterGeoRepSession selectedSession = getSelectedItem();
if (selectedSession == null) {
return;
}
initializeGeoRepActionConfirmation(title, helpTag, hashName, null, null, commandName, selectedSession.getMasterVolumeName(), selectedSession.getSlaveVolumeName(), selectedSession.getSlaveHostName(), messages.geoRepActionConfirmationMessage(action));
}
Aggregations