Shubhendu Tripathi has uploaded a new change for review. Change subject: gluster: Modified to disable the new snapshot creation ......................................................................
gluster: Modified to disable the new snapshot creation Modified to disable the option for new snapshot creation if some of the brick(s) are down for a volume. Also added a canDoAction engine side to take care of the same scenario. Change-Id: I2ed296a6afc4dfa5f3e7023c0dc40b7da4ad4392 Bug-Url: https://bugzilla.redhat.com/1213238 Signed-off-by: Shubhendu Tripathi <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeSnapshotCommand.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeSnapshotListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/volumes/VolumeListModel.java 3 files changed, 23 insertions(+), 4 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/16/40716/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeSnapshotCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeSnapshotCommand.java index a76f2ff..9e3594d 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeSnapshotCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeSnapshotCommand.java @@ -13,6 +13,7 @@ import org.ovirt.engine.core.common.action.gluster.GlusterVolumeGeoRepSessionParameters; import org.ovirt.engine.core.common.businessentities.VDS; import org.ovirt.engine.core.common.businessentities.gluster.GeoRepSessionStatus; +import org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity; import org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession; import org.ovirt.engine.core.common.businessentities.gluster.GlusterSnapshotStatus; import org.ovirt.engine.core.common.businessentities.gluster.GlusterStatus; @@ -198,6 +199,13 @@ return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_SNAPSHOT_ALREADY_EXISTS); } + List<GlusterBrickEntity> bricks = volume.getBricks(); + for (GlusterBrickEntity brick : bricks) { + if (!brick.isOnline()) { + return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_ONE_OR_MORE_BRICKS_ARE_DOWN); + } + } + for (GlusterGeoRepSession session : georepSessions) { if (session.getSlaveNodeUuid() == null || session.getSlaveVolumeId() == null) { // Slave cluster is not maintained by engine, so cannot pause geo-rep session and create snapshot for diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeSnapshotListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeSnapshotListModel.java index c54afae..bdf22af 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeSnapshotListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeSnapshotListModel.java @@ -577,7 +577,7 @@ snapshot.setDescription(snapshotModel.getDescription().getEntity()); CreateGlusterVolumeSnapshotParameters parameter = - new CreateGlusterVolumeSnapshotParameters(snapshot, true); + new CreateGlusterVolumeSnapshotParameters(snapshot, false); snapshotModel.startProgress(null); Frontend.getInstance().runAction(VdcActionType.CreateGlusterVolumeSnapshot, diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/volumes/VolumeListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/volumes/VolumeListModel.java index 18afc43..cdafe33 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/volumes/VolumeListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/volumes/VolumeListModel.java @@ -558,13 +558,13 @@ && asyncTask.getStatus() == JobExecutionStatus.STARTED; allowConfigureVolumeSnapshotOptions = volumeEntity.getStatus() == GlusterStatus.UP; allowCreateGeoRepSession = volumeEntity.getStatus() == GlusterStatus.UP; + allowCreateSnapshot = isCreateSnapshotAvailable(volumeEntity); } else { allowStopRebalance = false; } allowStatusRebalance = getRebalanceStatusAvailability(getSelectedItems()); allowProfileStatisticsDetails = getProfileStatisticsAvailability(list); - allowCreateSnapshot = isCreateSnapshotAvailable(list); allowEditSnapshotSchedule = isEditSnapshotScheduleAvailable(list); } getStartCommand().setIsExecutionAllowed(allowStart); @@ -591,8 +591,19 @@ getNewGeoRepSessionCommand().setIsExecutionAllowed(allowCreateGeoRepSession); } - private boolean isCreateSnapshotAvailable(List<GlusterVolumeEntity> list) { - return ((list.size() == 1) && (list.get(0).getStatus() == GlusterStatus.UP)); + private boolean isCreateSnapshotAvailable(GlusterVolumeEntity volume) { + if (volume.getStatus() == GlusterStatus.UP) { + List<GlusterBrickEntity> bricks = volume.getBricks(); + for (GlusterBrickEntity brick : bricks) { + if (brick.getStatus() != GlusterStatus.UP) { + return false; + } + } + + return true; + } else { + return false; + } } private boolean isEditSnapshotScheduleAvailable(List<GlusterVolumeEntity> list) { -- To view, visit https://gerrit.ovirt.org/40716 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2ed296a6afc4dfa5f3e7023c0dc40b7da4ad4392 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.5-gluster Gerrit-Owner: Shubhendu Tripathi <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
