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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations