Search in sources :

Example 1 with GlusterVolumeEntity

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

the class GlusterStorageModel method volumeSelectedItemChanged.

private void volumeSelectedItemChanged() {
    GlusterVolumeEntity volume = getGlusterVolumes().getSelectedItem();
    Boolean useLinkGlusterVolume = getLinkGlusterVolume().getEntity();
    // $NON-NLS-1$
    String mountOptions = "";
    if (volume == null || !useLinkGlusterVolume) {
        return;
    }
    Set<String> addressSet = new LinkedHashSet<>();
    for (GlusterBrickEntity brick : volume.getBricks()) {
        addressSet.add(brick.getNetworkId() != null && !brick.getNetworkAddress().isEmpty() ? brick.getNetworkAddress() : brick.getServerName());
    }
    List<String> addressList = new ArrayList<>();
    addressList.addAll(addressSet);
    if (addressList.size() >= 1) {
        // the first server is already used to mount volume
        addressList.remove(0);
    }
    if (addressList.size() > 0) {
        mountOptions = StorageConstants.GLUSTER_BACKUP_SERVERS_MNT_OPTION + "=" + // $NON-NLS-1$ //$NON-NLS-2$
        String.join(":", addressList);
    }
    getMountOptions().setEntity(mountOptions);
}
Also used : LinkedHashSet(java.util.LinkedHashSet) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ArrayList(java.util.ArrayList)

Example 2 with GlusterVolumeEntity

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

the class VolumeListModel method removeVolume.

private void removeVolume() {
    if (getWindow() != null) {
        return;
    }
    ConfirmationModel model = new ConfirmationModel();
    setWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().removeVolumesTitle());
    model.setHelpTag(HelpTag.remove_volume);
    // $NON-NLS-1$
    model.setHashName("remove_volume");
    if (isMetaVolumeInList(getSelectedItems())) {
        model.setNote(ConstantsManager.getInstance().getConstants().removeMetaVolumeWarning());
    } else {
        model.setNote(ConstantsManager.getInstance().getConstants().removeVolumesWarning());
    }
    if (getSelectedItems() == null) {
        return;
    }
    ArrayList<String> list = new ArrayList<>();
    for (GlusterVolumeEntity item : getSelectedItems()) {
        list.add(item.getName());
    }
    model.setItems(list);
    // $NON-NLS-1$
    UICommand tempVar = UICommand.createDefaultOkUiCommand("OnRemove", this);
    model.getCommands().add(tempVar);
    // $NON-NLS-1$
    UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this);
    model.getCommands().add(tempVar2);
}
Also used : 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)

Example 3 with GlusterVolumeEntity

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

the class VolumeListModel method onConfigureVolumeSnapshotOptions.

public void onConfigureVolumeSnapshotOptions() {
    GlusterVolumeSnapshotConfigModel volumeSnapshotConfigModel = (GlusterVolumeSnapshotConfigModel) getWindow();
    GlusterVolumeEntity volumeEntity = volumeSnapshotConfigModel.getSelectedVolumeEntity();
    List<GlusterVolumeSnapshotConfig> vdsParams = new ArrayList<>();
    for (EntityModel<VolumeSnapshotOptionModel> volumeCfg : volumeSnapshotConfigModel.getConfigOptions().getItems()) {
        vdsParams.add(new GlusterVolumeSnapshotConfig(volumeEntity.getClusterId(), volumeEntity.getId(), volumeCfg.getEntity().getOptionName(), volumeCfg.getEntity().getOptionValue()));
    }
    Frontend.getInstance().runAction(ActionType.UpdateGlusterVolumeSnapshotConfig, new UpdateGlusterVolumeSnapshotConfigParameters(volumeEntity.getClusterId(), volumeEntity.getId(), vdsParams), result -> {
        if (result.getReturnValue() != null && result.getReturnValue().getSucceeded()) {
            cancel();
        }
        if (getConfirmWindow() != null) {
            setConfirmWindow(null);
        }
    }, this);
}
Also used : GlusterVolumeSnapshotConfig(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterVolumeSnapshotConfigModel(org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeSnapshotConfigModel) ArrayList(java.util.ArrayList) VolumeSnapshotOptionModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeSnapshotOptionModel) UpdateGlusterVolumeSnapshotConfigParameters(org.ovirt.engine.core.common.action.gluster.UpdateGlusterVolumeSnapshotConfigParameters)

Example 4 with GlusterVolumeEntity

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

the class VolumeListModel method onRemoveVolume.

private void onRemoveVolume() {
    if (getWindow() == null) {
        return;
    }
    ConfirmationModel model = (ConfirmationModel) getWindow();
    if (model.getProgress() != null) {
        return;
    }
    if (getSelectedItems() == null) {
        return;
    }
    ArrayList<ActionParametersBase> list = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        GlusterVolumeEntity volume = (GlusterVolumeEntity) item;
        list.add(new GlusterVolumeActionParameters(volume.getId(), false));
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.DeleteGlusterVolume, list, result -> {
        ConfirmationModel localModel = (ConfirmationModel) result.getState();
        localModel.stopProgress();
        cancel();
    }, model);
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ArrayList(java.util.ArrayList) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) GlusterVolumeActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeActionParameters)

Example 5 with GlusterVolumeEntity

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

the class VolumeListModel method startVolumeProfiling.

private void startVolumeProfiling() {
    if (getSelectedItems() == null) {
        return;
    }
    List<GlusterVolumeEntity> selectedVolumesList = getSelectedItems();
    ArrayList<ActionParametersBase> parameters = new ArrayList<>();
    for (GlusterVolumeEntity currentSelectedVolume : selectedVolumesList) {
        GlusterVolumeParameters parameter = new GlusterVolumeParameters(currentSelectedVolume.getId());
        parameters.add(parameter);
    }
    Frontend.getInstance().runMultipleAction(ActionType.StartGlusterVolumeProfile, parameters);
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ArrayList(java.util.ArrayList) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) GlusterVolumeParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeParameters) CreateGlusterVolumeParameters(org.ovirt.engine.core.common.action.gluster.CreateGlusterVolumeParameters)

Aggregations

GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)220 ArrayList (java.util.ArrayList)57 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)49 Test (org.junit.Test)47 Guid (org.ovirt.engine.core.compat.Guid)30 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)30 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)26 GlusterAsyncTask (org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask)20 VDS (org.ovirt.engine.core.common.businessentities.VDS)19 HashMap (java.util.HashMap)16 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)16 List (java.util.List)15 Map (java.util.Map)15 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)15 ActionType (org.ovirt.engine.core.common.action.ActionType)13 GlusterGeoRepSession (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)13 GlusterVolumeSnapshotEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity)13 GlusterVolumeType (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType)13 GlusterVolumeRemoveBricksParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters)12 GlusterTaskType (org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType)12