anmolbabu has uploaded a new change for review. Change subject: web admin : Status display after stopping rebalance ......................................................................
web admin : Status display after stopping rebalance Status is displayed after stopping rebalance Change-Id: I66c44df37b20b4454d51aacc58e8a4a33794318f Signed-off-by: Anmol Babu <anb...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/StopRebalanceGlusterVolumeCommand.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeRebalanceStatusModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/volumes/VolumeListModel.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/VolumeModule.java 4 files changed, 68 insertions(+), 20 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/02/19402/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/StopRebalanceGlusterVolumeCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/StopRebalanceGlusterVolumeCommand.java index cfa82e7..1d27ac1 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/StopRebalanceGlusterVolumeCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/StopRebalanceGlusterVolumeCommand.java @@ -1,12 +1,16 @@ package org.ovirt.engine.core.bll.gluster; +import java.util.List; + import org.ovirt.engine.core.bll.NonTransactiveCommandAttribute; import org.ovirt.engine.core.common.AuditLogType; import org.ovirt.engine.core.common.action.gluster.GlusterVolumeRebalanceParameters; import org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType; import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity; +import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity; import org.ovirt.engine.core.common.errors.VdcBllMessages; import org.ovirt.engine.core.common.job.JobExecutionStatus; +import org.ovirt.engine.core.common.job.Step; import org.ovirt.engine.core.common.job.StepEnum; import org.ovirt.engine.core.common.vdscommands.VDSCommandType; import org.ovirt.engine.core.common.vdscommands.VDSReturnValue; @@ -61,10 +65,28 @@ .getMessage()); return; } + else { + // Run the VDSM verb to get the status + VDSReturnValue vdsRettunValueStatus = + runVdsCommand(VDSCommandType.GetGlusterVolumeRebalanceStatus, + new GlusterVolumeVDSParameters(upServer.getId(), getGlusterVolumeName())); + + // Set the volume re-balance start time + GlusterVolumeTaskStatusEntity entity = + (GlusterVolumeTaskStatusEntity) vdsRettunValueStatus.getReturnValue(); + List<Step> stepsList = + getDbFacade().getStepDao() + .getStepsByExternalId(getGlusterVolumeDao().getById(getParameters().getVolumeId()) + .getAsyncTask() + .getStepId()); + if (stepsList != null && !stepsList.isEmpty()) { + entity.setStartTime(stepsList.get(0).getStartTime()); + } + getReturnValue().setActionReturnValue(entity); + } endStepJob(); releaseVolumeLock(); - getReturnValue().setActionReturnValue(vdsReturnaValue); } @Override diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeRebalanceStatusModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeRebalanceStatusModel.java index 4bb3f67..7431e34 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeRebalanceStatusModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeRebalanceStatusModel.java @@ -108,7 +108,9 @@ setStatusAvailable(true); }else { setStatusAvailable(false); - refresh(getEntity()); + if (!(rebalanceStatusEntity.getStatusSummary().getStatus() == JobExecutionStatus.ABORTED)) { + refresh(getEntity()); + } } } 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 dc7e129..9337cee 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 @@ -68,6 +68,14 @@ return newVolumeCommand; } + public UICommand getOkCommand() { + return okCommand; + } + + public void setOkCommand(UICommand okCommand) { + this.okCommand = okCommand; + } + private void setNewVolumeCommand(UICommand value) { newVolumeCommand = value; @@ -475,6 +483,8 @@ Frontend.RunMultipleAction(VdcActionType.StartRebalanceGlusterVolume, list); } + UICommand okCommand; + private void stopRebalance() { if (getWindow() != null) { return; @@ -497,9 +507,10 @@ } model.setItems(list); - UICommand okCommand = new UICommand("onStopRebalance", this); //$NON-NLS-1$ + okCommand = new UICommand("onStopRebalance", this); //$NON-NLS-1$ okCommand.setTitle(ConstantsManager.getInstance().getConstants().ok()); okCommand.setIsDefault(true); + setOkCommand(okCommand); model.getCommands().add(okCommand); UICommand cancelCommand = new UICommand("Cancel", this); //$NON-NLS-1$ cancelCommand.setTitle(ConstantsManager.getInstance().getConstants().cancel()); @@ -521,24 +532,36 @@ return; } - ArrayList<VdcActionParametersBase> list = new ArrayList<VdcActionParametersBase>(); - for (Object item : getSelectedItems()) { - GlusterVolumeEntity volume = (GlusterVolumeEntity) item; - list.add(new GlusterVolumeRebalanceParameters(volume.getId(), false, false)); - } - model.startProgress(null); - Frontend.RunMultipleAction(VdcActionType.StopRebalanceGlusterVolume, list, - new IFrontendMultipleActionAsyncCallback() { - @Override - public void executed(FrontendMultipleActionAsyncResult result) { - ConfirmationModel localModel = (ConfirmationModel) result.getState(); - localModel.stopProgress(); - cancel(); - } + final GlusterVolumeEntity volumeEntity = (GlusterVolumeEntity) getSelectedItem(); + GlusterVolumeRebalanceParameters param = new GlusterVolumeRebalanceParameters(volumeEntity.getId(), false, false); - }, model); + Frontend.RunAction(VdcActionType.StopRebalanceGlusterVolume, param, new IFrontendActionAsyncCallback() { + + @Override + public void executed(FrontendActionAsyncResult result) { + ConfirmationModel localModel = (ConfirmationModel) getWindow(); + localModel.stopProgress(); + cancel(); + setConfirmWindow(null); + + VolumeRebalanceStatusModel statusModel = new VolumeRebalanceStatusModel(volumeEntity); + statusModel.setTitle(ConstantsManager.getInstance().getConstants().volumeRebalanceStatusTitle()); + setWindow(statusModel); + + statusModel.getVolume().setEntity(volumeEntity.getName()); + statusModel.getCluster().setEntity(volumeEntity.getVdsGroupName()); + + GlusterVolumeTaskStatusEntity entity = (GlusterVolumeTaskStatusEntity)result.getReturnValue().getActionReturnValue(); + statusModel.showStatus(entity); + + UICommand cancelRebalance = new UICommand("CancelRebalanceStatus", VolumeListModel.this);//$NON-NLS-1$ + cancelRebalance.setTitle(ConstantsManager.getInstance().getConstants().close()); + cancelRebalance.setIsCancel(true); + statusModel.getCommands().add(cancelRebalance); + } + }); } private void showRebalanceStatus() { @@ -558,11 +581,12 @@ public void onSuccess(Object model, Object returnValue) { GlusterVolumeTaskStatusEntity rebalanceStatusEntity = (GlusterVolumeTaskStatusEntity) returnValue; - cModel.stopProgress(); if ((rebalanceStatusEntity == null) || (rebalanceStatusEntity.getStatusSummary().getStatus() == JobExecutionStatus.UNKNOWN)) { + cModel.stopProgress(); cModel.setMessage(ConstantsManager.getInstance().getMessages().rebalanceStatusConfirmationMessage(volumeEntity.getName())); cModel.getCommands().add(rebalanceStatusOk); } else { + cModel.stopProgress(); setConfirmWindow(null); VolumeRebalanceStatusModel rebalanceStatusModel = new VolumeRebalanceStatusModel(volumeEntity); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/VolumeModule.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/VolumeModule.java index 878a00a..28abf88 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/VolumeModule.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/VolumeModule.java @@ -57,7 +57,7 @@ if (lastExecutedCommand == getModel().getNewVolumeCommand()) { return popupProvider.get(); } - else if (lastExecutedCommand == getModel().getStatusRebalanceCommand()) { + else if (lastExecutedCommand == getModel().getStatusRebalanceCommand() || lastExecutedCommand == getModel().getOkCommand()) { return rebalanceStatusPopupProvider.get(); } else { -- To view, visit http://gerrit.ovirt.org/19402 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I66c44df37b20b4454d51aacc58e8a4a33794318f Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: anmolbabu <anb...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches