diff options
| author | Shireesh Anjal <shireesh@gluster.com> | 2011-03-23 19:05:38 +0530 |
|---|---|---|
| committer | Shireesh Anjal <shireesh@gluster.com> | 2011-03-23 19:10:00 +0530 |
| commit | 397e4da1097d75e56d15edd494d9765ff58329b6 (patch) | |
| tree | 21d07d533857ab458185f5ec34d4c2424cd62bf4 | |
| parent | 195695e266bc0cdd00c183760d0501e0d6c9114a (diff) | |
introducing subresource defaultoptions under volumes resource
6 files changed, 71 insertions, 7 deletions
diff --git a/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/RESTConstants.java b/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/RESTConstants.java index 8474d601..3642e788 100644 --- a/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/RESTConstants.java +++ b/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/RESTConstants.java @@ -30,6 +30,6 @@ public class RESTConstants { public static final String FORM_PARAM_VALUE_START = "start"; public static final String FORM_PARAM_VALUE_STOP = "stop"; public static final String PATH_PARAM_VOLUME_NAME = "volumeName"; - public static final String PATH_PARAM_RUNNING_TASKS = "/cluster/runningtasks"; + public static final String SUBRESOURCE_DEFAULT_OPTIONS = "defaultoptions"; } diff --git a/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StartVolumeAction.java b/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StartVolumeAction.java index 70c51119..66a8b232 100644 --- a/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StartVolumeAction.java +++ b/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StartVolumeAction.java @@ -42,12 +42,12 @@ public class StartVolumeAction extends AbstractActionDelegate { VolumesClient client = new VolumesClient(modelManager.getSecurityToken()); Status status = client.startVolume(volume.getName()); if (status.isSuccess()) { - new MessageDialog(window.getShell(), action.getDescription(), null, "Volume [" + new MessageDialog(Display.getCurrent().getActiveShell(), action.getDescription(), null, "Volume [" + volume.getName() + "] started successfully!", MessageDialog.INFORMATION, new String[] { "OK" }, 0) .open(); modelManager.updateVolumeStatus(volume, VOLUME_STATUS.ONLINE); } else { - new MessageDialog(window.getShell(), action.getDescription(), null, "Volume [" + new MessageDialog(Display.getCurrent().getActiveShell(), action.getDescription(), null, "Volume [" + volume.getName() + "] could not be started! Error: [" + status + "]", MessageDialog.ERROR, new String[] { "OK" }, 0).open(); } diff --git a/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StopVolumeAction.java b/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StopVolumeAction.java index a4e2c8d3..5eff2d5d 100644 --- a/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StopVolumeAction.java +++ b/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StopVolumeAction.java @@ -42,12 +42,12 @@ public class StopVolumeAction extends AbstractActionDelegate { VolumesClient client = new VolumesClient(modelManager.getSecurityToken()); Status status = client.stopVolume(volume.getName()); if (status.isSuccess()) { - new MessageDialog(window.getShell(), action.getDescription(), null, "Volume [" + new MessageDialog(Display.getCurrent().getActiveShell(), action.getDescription(), null, "Volume [" + volume.getName() + "] stopped successfully!", MessageDialog.INFORMATION, new String[] { "OK" }, 0) .open(); modelManager.updateVolumeStatus(volume, VOLUME_STATUS.OFFLINE); } else { - new MessageDialog(window.getShell(), action.getDescription(), null, "Volume [" + new MessageDialog(Display.getCurrent().getActiveShell(), action.getDescription(), null, "Volume [" + volume.getName() + "] could not be stopped! Error: [" + status + "]", MessageDialog.ERROR, new String[] { "OK" }, 0).open(); } diff --git a/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/VolumeSummaryView.java b/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/VolumeSummaryView.java index c56ba71f..798c2a40 100644 --- a/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/VolumeSummaryView.java +++ b/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/VolumeSummaryView.java @@ -20,7 +20,6 @@ import com.gluster.storage.management.client.GlusterDataModelManager; import com.gluster.storage.management.core.model.DefaultClusterListener; import com.gluster.storage.management.core.model.Event; import com.gluster.storage.management.core.model.Event.EVENT_TYPE; -import com.gluster.storage.management.core.model.GlusterServer; import com.gluster.storage.management.core.model.Volume; import com.gluster.storage.management.core.model.Volume.NAS_PROTOCOL; import com.gluster.storage.management.core.model.Volume.VOLUME_TYPE; @@ -231,6 +230,7 @@ public class VolumeSummaryView extends ViewPart { lblStatusValue.setText(volume.getStatusStr()); lblStatusValue.setImage(volume.getStatus() == Volume.VOLUME_STATUS.ONLINE ? guiHelper .getImage(IImageKeys.STATUS_ONLINE) : guiHelper.getImage(IImageKeys.STATUS_OFFLINE)); + lblStatusValue.redraw(); } private void createTransportTypeField(Composite section) { diff --git a/com.gluster.storage.management.server/src/com/gluster/storage/management/server/constants/VolumeOptionsDefaults.java b/com.gluster.storage.management.server/src/com/gluster/storage/management/server/constants/VolumeOptionsDefaults.java new file mode 100644 index 00000000..fe675056 --- /dev/null +++ b/com.gluster.storage.management.server/src/com/gluster/storage/management/server/constants/VolumeOptionsDefaults.java @@ -0,0 +1,51 @@ +/** + * DefaultVolumeOptions.java + * + * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com> + * This file is part of Gluster Management Console. + * + * Gluster Management Console is free software; you can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Gluster Management Console is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License + * for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * <http://www.gnu.org/licenses/>. + */ +package com.gluster.storage.management.server.constants; + +import java.util.HashMap; +import java.util.Map; + +public class VolumeOptionsDefaults { + public static final Map<String, String> OPTIONS = new HashMap<String, String>(); + + static { + OPTIONS.put("cluster.stripe-block-size", "*:128KB"); + OPTIONS.put("cluster.self-heal-window-size", "16"); + OPTIONS.put("cluster.data-self-heal-algorithm", "full/diff"); + OPTIONS.put("network.frame-timeout", "1800"); + OPTIONS.put("network.ping-timeout", "42"); + OPTIONS.put("auth.allow", "*"); + OPTIONS.put("auth.reject", "NONE"); + OPTIONS.put("performance.cache-refresh-timeout", "1"); + OPTIONS.put("performance.cache-size", "32MB"); + OPTIONS.put("performance.write-behind-window-size", "1MB"); + OPTIONS.put("performance.cache-max-file-size", "?"); + OPTIONS.put("performance.cache-min-file-size", "?"); + OPTIONS.put("performance.io-thread-count", "?"); + OPTIONS.put("diagnostics.latency-measurement", "off"); + OPTIONS.put("diagnostics.dump-fd-stats", "off"); + OPTIONS.put("diagnostics.brick-log-level", "NORMAL"); + OPTIONS.put("diagnostics.client-log-level", "NORMAL"); + OPTIONS.put("nfs.enable-ino32", "off"); + OPTIONS.put("nfs.mem-factor", "15"); + OPTIONS.put("transport.keepalive", "?"); + } +}
\ No newline at end of file diff --git a/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/VolumesResource.java b/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/VolumesResource.java index c370fd53..75f9e3ab 100644 --- a/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/VolumesResource.java +++ b/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/VolumesResource.java @@ -25,12 +25,15 @@ import static com.gluster.storage.management.core.constants.RESTConstants.FORM_P import static com.gluster.storage.management.core.constants.RESTConstants.FORM_PARAM_VALUE_STOP; import static com.gluster.storage.management.core.constants.RESTConstants.PATH_PARAM_VOLUME_NAME; import static com.gluster.storage.management.core.constants.RESTConstants.PATH_RESOURCE_VOLUMES; +import static com.gluster.storage.management.core.constants.RESTConstants.SUBRESOURCE_DEFAULT_OPTIONS; import java.util.ArrayList; import java.util.List; +import java.util.Map; import javax.ws.rs.Consumes; import javax.ws.rs.FormParam; +import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; @@ -47,6 +50,7 @@ import com.gluster.storage.management.core.model.Volume.VOLUME_TYPE; import com.gluster.storage.management.core.utils.GlusterUtil; import com.gluster.storage.management.core.utils.ProcessResult; import com.gluster.storage.management.core.utils.ProcessUtil; +import com.gluster.storage.management.server.constants.VolumeOptionsDefaults; import com.sun.jersey.spi.resource.Singleton; @Singleton @@ -123,4 +127,13 @@ public class VolumesResource { } return new Status(Status.STATUS_CODE_FAILURE, "Invalid operation code [" + operation + "]"); } -} + + @GET + @Path(SUBRESOURCE_DEFAULT_OPTIONS) + @Produces(MediaType.TEXT_XML) + public Map<String, String> getDefaultOptions() { + // TODO: Fetch all volume options with their default values from GlusterFS + // whenever such a CLI command is made available in GlusterFS + return VolumeOptionsDefaults.OPTIONS; + } +}
\ No newline at end of file |
