anmolbabu has uploaded a new change for review. Change subject: webadmin : status and stop linking ......................................................................
webadmin : status and stop linking User can stop rebalance from status popup. And also status of rebalance is displayed after stopping the rebalance. Change-Id: Id7a291e23f347e5f42a9334bd45d831938c6f5a7 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/volumes/VolumeListModel.java 2 files changed, 80 insertions(+), 21 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/56/19556/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/volumes/VolumeListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/volumes/VolumeListModel.java index 8acfa95..7018b0e 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 @@ -472,6 +472,8 @@ onStop(); } else if (command.getName().equals("OnRemove")) { //$NON-NLS-1$ onRemoveVolume(); + } else if(command.getName().equals("stop_rebalance_from_status")) {//$NON-NLS-1$ + stopRebalance(); } } @@ -490,27 +492,28 @@ } private void stopRebalance() { +/* if (getWindow() != null) { return; } - +*/ if (getSelectedItems() == null) { return; } ConfirmationModel model = new ConfirmationModel(); - setWindow(model); + setConfirmWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().confirmStopVolumeRebalanceTitle()); model.setHashName("volume_rebalance_stop"); //$NON-NLS-1$ model.setMessage(ConstantsManager.getInstance().getConstants().confirmStopVolumeRebalanceMsg()); - +/* ArrayList<String> list = new ArrayList<String>(); for (Object item : getSelectedItems()) { GlusterVolumeEntity volume = (GlusterVolumeEntity) item; list.add(volume.getName()); } model.setItems(list); - +*/ UICommand okCommand = new UICommand("onStopRebalance", this); //$NON-NLS-1$ okCommand.setTitle(ConstantsManager.getInstance().getConstants().ok()); okCommand.setIsDefault(true); @@ -522,10 +525,12 @@ } private void onStopRebalance() { +/* if (getWindow() == null) { return; } - ConfirmationModel model = (ConfirmationModel) getWindow(); + */ + ConfirmationModel model = (ConfirmationModel) getConfirmWindow(); if (model.getProgress() != null) { return; @@ -535,25 +540,48 @@ 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) getConfirmWindow(); + localModel.stopProgress(); + //cancel(); + setConfirmWindow(null); + + VolumeRebalanceStatusModel statusModel; + + GlusterVolumeTaskStatusEntity entity = (GlusterVolumeTaskStatusEntity)result.getReturnValue().getActionReturnValue(); + + if(getWindow() == null) { + statusModel = new VolumeRebalanceStatusModel(volumeEntity); + statusModel.setTitle(ConstantsManager.getInstance().getConstants().volumeRebalanceStatusTitle()); + setWindow(statusModel); + + statusModel.getVolume().setEntity(volumeEntity.getName()); + statusModel.getCluster().setEntity(volumeEntity.getVdsGroupName()); + + UICommand cancelRebalance = new UICommand("CancelRebalanceStatus", VolumeListModel.this);//$NON-NLS-1$ + cancelRebalance.setTitle(ConstantsManager.getInstance().getConstants().close()); + cancelRebalance.setIsCancel(true); + statusModel.getCommands().add(cancelRebalance); + + } else { + statusModel = (VolumeRebalanceStatusModel) getWindow(); + statusModel.getCommands().get(0).setIsVisible(false); + } + + statusModel.showStatus(entity); + + } + }); } + private void showRebalanceStatus() { if (getSelectedItem() == null) { @@ -590,6 +618,15 @@ rebalanceStatusModel.showStatus(rebalanceStatusEntity); + UICommand stopRebalanceFromStatus = new UICommand("stop_rebalance_from_status", VolumeListModel.this);//$NON-NLS-1$ + stopRebalanceFromStatus.setIsCancel(true); + stopRebalanceFromStatus.setTitle(ConstantsManager.getInstance().getConstants().stopRebalance()); + rebalanceStatusModel.getCommands().add(stopRebalanceFromStatus); + + if(rebalanceStatusEntity.getStatusSummary().getStatus() == JobExecutionStatus.ABORTED) { + stopRebalanceFromStatus.setIsVisible(false); + } + UICommand cancelRebalance = new UICommand("CancelRebalanceStatus", VolumeListModel.this);//$NON-NLS-1$ cancelRebalance.setTitle(ConstantsManager.getInstance().getConstants().close()); cancelRebalance.setIsCancel(true); -- To view, visit http://gerrit.ovirt.org/19556 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id7a291e23f347e5f42a9334bd45d831938c6f5a7 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