Search in sources :

Example 1 with GlusterVolumeTaskStatusEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity in project ovirt-engine by oVirt.

the class VolumeListModel method showRebalanceStatus.

private void showRebalanceStatus() {
    if (getSelectedItem() == null) {
        return;
    }
    final ConfirmationModel cModel = new ConfirmationModel();
    final GlusterVolumeEntity volumeEntity = getSelectedItem();
    setConfirmWindow(cModel);
    cModel.setTitle(ConstantsManager.getInstance().getConstants().rebalanceStatusTitle());
    // $NON-NLS-1$
    cModel.startProgress(ConstantsManager.getInstance().getConstants().fetchingDataMessage());
    cModel.setHelpTag(HelpTag.volume_rebalance_status);
    // $NON-NLS-1$
    cModel.setHashName("volume_rebalance_status");
    // $NON-NLS-1$
    final UICommand rebalanceStatusOk = new UICommand("closeConfirmationWindow", VolumeListModel.this);
    rebalanceStatusOk.setTitle(ConstantsManager.getInstance().getConstants().ok());
    rebalanceStatusOk.setIsCancel(true);
    cModel.getCommands().add(rebalanceStatusOk);
    AsyncDataProvider.getInstance().getGlusterRebalanceStatus(new AsyncQuery<>(returnValue -> {
        cModel.stopProgress();
        GlusterVolumeTaskStatusEntity rebalanceStatusEntity = returnValue.getReturnValue();
        if ((rebalanceStatusEntity == null) || !returnValue.getSucceeded()) {
            cModel.setMessage(ConstantsManager.getInstance().getMessages().rebalanceStatusFailed(volumeEntity.getName()));
        } else {
            setConfirmWindow(null);
            if (getWindow() == null) {
                VolumeRebalanceStatusModel rebalanceStatusModel = new VolumeRebalanceStatusModel(volumeEntity);
                rebalanceStatusModel.setTitle(ConstantsManager.getInstance().getConstants().volumeRebalanceStatusTitle());
                setWindow(rebalanceStatusModel);
                rebalanceStatusModel.setHelpTag(HelpTag.volume_rebalance_status);
                // $NON-NLS-1$
                rebalanceStatusModel.setHashName("volume_rebalance_status");
                rebalanceStatusModel.getVolume().setEntity(volumeEntity.getName());
                rebalanceStatusModel.getCluster().setEntity(volumeEntity.getClusterName());
                // $NON-NLS-1$
                UICommand stopRebalanceFromStatus = new UICommand("stop_rebalance_from_status", VolumeListModel.this);
                stopRebalanceFromStatus.setTitle(ConstantsManager.getInstance().getConstants().stopRebalance());
                rebalanceStatusModel.getCommands().add(stopRebalanceFromStatus);
                rebalanceStatusModel.setStopReblanceFromStatus(stopRebalanceFromStatus);
                // $NON-NLS-1$
                UICommand cancelRebalance = new UICommand("CancelRebalanceStatus", VolumeListModel.this);
                cancelRebalance.setTitle(ConstantsManager.getInstance().getConstants().close());
                cancelRebalance.setIsCancel(true);
                rebalanceStatusModel.getCommands().add(cancelRebalance);
                rebalanceStatusModel.showStatus(rebalanceStatusEntity);
            } else {
                VolumeRebalanceStatusModel statusModel = (VolumeRebalanceStatusModel) getWindow();
                statusModel.getCommands().get(0).setIsExecutionAllowed(false);
                statusModel.showStatus(rebalanceStatusEntity);
            }
        }
    }), volumeEntity.getClusterId(), volumeEntity.getId());
}
Also used : SearchType(org.ovirt.engine.core.common.interfaces.SearchType) Arrays(java.util.Arrays) SearchObjects(org.ovirt.engine.core.searchbackend.SearchObjects) Inject(com.google.inject.Inject) ApplicationMode(org.ovirt.engine.core.common.mode.ApplicationMode) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) GlusterVolumeActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeActionParameters) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GetConfigurationValueParameters(org.ovirt.engine.core.common.queries.GetConfigurationValueParameters) GlusterVolumeSnapshotConfig(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) GlusterVolumeParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeParameters) TransportType(org.ovirt.engine.core.common.businessentities.gluster.TransportType) HasEntity(org.ovirt.engine.ui.uicommonweb.models.HasEntity) VolumeBrickListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeBrickListModel) VolumeRebalanceStatusModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeRebalanceStatusModel) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) GlusterVolumeUtils(org.ovirt.engine.ui.frontend.utils.GlusterVolumeUtils) JobExecutionStatus(org.ovirt.engine.core.common.job.JobExecutionStatus) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) VolumeSnapshotOptionModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeSnapshotOptionModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) GlusterClusterSnapshotConfigModel(org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterClusterSnapshotConfigModel) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterStatus(org.ovirt.engine.core.common.businessentities.gluster.GlusterStatus) List(java.util.List) GlusterAsyncTask(org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask) VolumeGeneralModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeGeneralModel) VolumeGeoRepListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeGeoRepListModel) GlusterTaskType(org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType) QueryType(org.ovirt.engine.core.common.queries.QueryType) PermissionListModel(org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel) GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity) Guid(org.ovirt.engine.core.compat.Guid) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) GlusterVolumeType(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType) GlusterVolumeSnapshotListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeSnapshotListModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) Frontend(org.ovirt.engine.ui.frontend.Frontend) GlusterVolumeSnapshotConfigModel(org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeSnapshotConfigModel) GlusterVolumeOptionEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity) CreateGlusterVolumeParameters(org.ovirt.engine.core.common.action.gluster.CreateGlusterVolumeParameters) Linq(org.ovirt.engine.ui.uicommonweb.Linq) SearchStringMapping(org.ovirt.engine.ui.uicommonweb.models.SearchStringMapping) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) VolumeEventListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeEventListModel) VolumeParameterListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeParameterListModel) VolumeProfileStatisticsModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeProfileStatisticsModel) VolumeModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeModel) ListWithSimpleDetailsModel(org.ovirt.engine.ui.uicommonweb.models.ListWithSimpleDetailsModel) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants) GlusterVolumeOptionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeOptionParameters) GlusterVolumeRebalanceParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeRebalanceParameters) WebAdminApplicationPlaces(org.ovirt.engine.ui.uicommonweb.place.WebAdminApplicationPlaces) UpdateGlusterVolumeSnapshotConfigParameters(org.ovirt.engine.core.common.action.gluster.UpdateGlusterVolumeSnapshotConfigParameters) VolumeStatus(org.ovirt.engine.ui.frontend.utils.GlusterVolumeUtils.VolumeStatus) VolumeRebalanceStatusModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeRebalanceStatusModel) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity)

Example 2 with GlusterVolumeTaskStatusEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity in project ovirt-engine by oVirt.

the class GetGlusterVolumeRemoveBricksStatusVDSCommand method executeVdsBrokerCommand.

@Override
protected void executeVdsBrokerCommand() {
    String volumeName = getParameters().getVolumeName();
    List<GlusterBrickEntity> bricksList = getParameters().getBricks();
    String[] brickNames = new String[bricksList.size()];
    for (int count = 0; count < bricksList.size(); count++) {
        brickNames[count] = bricksList.get(count).getQualifiedName();
    }
    result = getBroker().glusterVolumeRemoveBrickStatus(volumeName, brickNames);
    proceedProxyReturnValue();
    // Set the current engine time as status time
    GlusterVolumeTaskStatusEntity entity = result.getStatusDetails();
    entity.setStatusTime(new Date());
    setReturnValue(entity);
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity) Date(java.util.Date)

Example 3 with GlusterVolumeTaskStatusEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity in project ovirt-engine by oVirt.

the class GetGlusterVolumeRebalanceStatusVDSCommand method executeVdsBrokerCommand.

@Override
protected void executeVdsBrokerCommand() {
    String volumeName = getParameters().getVolumeName();
    result = getBroker().glusterVolumeRebalanceStatus(volumeName);
    proceedProxyReturnValue();
    // Set the current engine time as status time
    GlusterVolumeTaskStatusEntity entity = result.getStatusDetails();
    entity.setStatusTime(new Date());
    setReturnValue(entity);
}
Also used : GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity) Date(java.util.Date)

Example 4 with GlusterVolumeTaskStatusEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity in project ovirt-engine by oVirt.

the class VolumeBrickListModel method showRemoveBricksStatus.

private void showRemoveBricksStatus() {
    final GlusterVolumeEntity volumeEntity = getVolumeEntity();
    final ArrayList<GlusterBrickEntity> bricks = new ArrayList<>();
    for (GlusterBrickEntity brick : volumeEntity.getBricks()) {
        if (brick.getAsyncTask() != null && brick.getAsyncTask().getTaskId() != null) {
            bricks.add(brick);
        }
    }
    final ConfirmationModel cModel = new ConfirmationModel();
    cModel.setHelpTag(HelpTag.volume_remove_bricks_status);
    // //$NON-NLS-1$
    cModel.setHashName("volume_remove_bricks_status");
    // $NON-NLS-1$
    UICommand removeBrickStatusOk = new UICommand("CancelConfirmation", VolumeBrickListModel.this);
    removeBrickStatusOk.setTitle(ConstantsManager.getInstance().getConstants().ok());
    removeBrickStatusOk.setIsCancel(true);
    cModel.startProgress(ConstantsManager.getInstance().getConstants().fetchingDataMessage());
    cModel.getCommands().add(removeBrickStatusOk);
    cModel.setTitle(ConstantsManager.getInstance().getConstants().removeBricksStatusTitle());
    setConfirmWindow(cModel);
    // $NON-NLS-1$
    final UICommand stopRemoveBrickFromStatus = new UICommand("StopRemoveBricksOnStatus", this);
    stopRemoveBrickFromStatus.setTitle(ConstantsManager.getInstance().getConstants().stopRemoveBricksButton());
    stopRemoveBrickFromStatus.setIsExecutionAllowed(false);
    // $NON-NLS-1$
    final UICommand commitRemoveBrickFromStatus = new UICommand("CommitRemoveBricksOnStatus", this);
    commitRemoveBrickFromStatus.setTitle(ConstantsManager.getInstance().getConstants().commitRemoveBricksButton());
    commitRemoveBrickFromStatus.setIsExecutionAllowed(false);
    // $NON-NLS-1$
    final UICommand retainBricksFromStatus = new UICommand("RetainBricksOnStatus", this);
    retainBricksFromStatus.setTitle(ConstantsManager.getInstance().getConstants().retainBricksButton());
    retainBricksFromStatus.setIsExecutionAllowed(false);
    // $NON-NLS-1$
    final UICommand cancelCommand = new UICommand("CancelRemoveBricksStatus", this);
    cancelCommand.setTitle(ConstantsManager.getInstance().getConstants().close());
    cancelCommand.setIsCancel(true);
    AsyncDataProvider.getInstance().getGlusterRemoveBricksStatus(new AsyncQuery<>(returnValue -> {
        cModel.stopProgress();
        if (returnValue.getSucceeded() && returnValue.getReturnValue() != null) {
            cancelConfirmation();
            RemoveBrickStatusModel removeBrickStatusModel;
            GlusterVolumeTaskStatusEntity removeBrickStatusEntity = returnValue.getReturnValue();
            if (getWindow() == null) {
                removeBrickStatusModel = new RemoveBrickStatusModel(volumeEntity, bricks);
                removeBrickStatusModel.setTitle(ConstantsManager.getInstance().getConstants().removeBricksStatusTitle());
                removeBrickStatusModel.setHelpTag(HelpTag.volume_remove_bricks_status);
                // //$NON-NLS-1$
                removeBrickStatusModel.setHashName("volume_remove_bricks_status");
                setWindow(removeBrickStatusModel);
                removeBrickStatusModel.getVolume().setEntity(volumeEntity.getName());
                removeBrickStatusModel.getCluster().setEntity(volumeEntity.getClusterName());
                removeBrickStatusModel.addStopRemoveBricksCommand(stopRemoveBrickFromStatus);
                removeBrickStatusModel.addCommitRemoveBricksCommand(commitRemoveBrickFromStatus);
                removeBrickStatusModel.addRetainBricksCommand(retainBricksFromStatus);
                removeBrickStatusModel.getCommands().add(cancelCommand);
            } else {
                removeBrickStatusModel = (RemoveBrickStatusModel) getWindow();
            }
            removeBrickStatusModel.showStatus(removeBrickStatusEntity);
        } else {
            cModel.setMessage(ConstantsManager.getInstance().getMessages().removeBrickStatusFailed(volumeEntity.getName()));
        }
    }), volumeEntity.getClusterId(), volumeEntity.getId(), bricks);
}
Also used : GlusterTaskType(org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType) GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) HashMap(java.util.HashMap) GlusterVolumeReplaceBrickActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeReplaceBrickActionParameters) GlusterVolumeType(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GetConfigurationValueParameters(org.ovirt.engine.core.common.queries.GetConfigurationValueParameters) Mempool(org.ovirt.engine.core.common.businessentities.gluster.Mempool) Map(java.util.Map) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) GlusterVolumeRemoveBricksParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters) VolumeListModel(org.ovirt.engine.ui.uicommonweb.models.volumes.VolumeListModel) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) GlusterClientInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterClientInfo) JobExecutionStatus(org.ovirt.engine.core.common.job.JobExecutionStatus) GlusterVolumeBricksActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeBricksActionParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Iterator(java.util.Iterator) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails) List(java.util.List) VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) BrickDetails(org.ovirt.engine.core.common.businessentities.gluster.BrickDetails) GlusterAsyncTask(org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask) GlusterVolumeResetBrickActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeResetBrickActionParameters) VDS(org.ovirt.engine.core.common.businessentities.VDS) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ArrayList(java.util.ArrayList) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity)

Example 5 with GlusterVolumeTaskStatusEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity in project ovirt-engine by oVirt.

the class GlusterTaskStatisticalQueryTest method getTaskEntity.

private GlusterVolumeTaskStatusEntity getTaskEntity() {
    GlusterVolumeTaskStatusEntity entity = new GlusterVolumeTaskStatusEntity();
    List<GlusterVolumeTaskStatusForHost> hostStatusList = new ArrayList<>();
    hostStatusList.add(getTaskStatusForHost(0));
    hostStatusList.add(getTaskStatusForHost(1));
    entity.setHostwiseStatusDetails(hostStatusList);
    return entity;
}
Also used : GlusterVolumeTaskStatusForHost(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusForHost) ArrayList(java.util.ArrayList) GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity)

Aggregations

GlusterVolumeTaskStatusEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity)16 Date (java.util.Date)6 JobExecutionStatus (org.ovirt.engine.core.common.job.JobExecutionStatus)4 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)4 ArrayList (java.util.ArrayList)3 GlusterAsyncTask (org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask)3 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)3 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)3 List (java.util.List)2 Test (org.junit.Test)2 AbstractQueryTest (org.ovirt.engine.core.bll.AbstractQueryTest)2 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)2 ActionType (org.ovirt.engine.core.common.action.ActionType)2 GlusterTaskType (org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType)2 GlusterVolumeType (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType)2 ConfigValues (org.ovirt.engine.core.common.config.ConfigValues)2 GetConfigurationValueParameters (org.ovirt.engine.core.common.queries.GetConfigurationValueParameters)2 GlusterVolumeRemoveBricksVDSParameters (org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeRemoveBricksVDSParameters)2 Frontend (org.ovirt.engine.ui.frontend.Frontend)2 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)2