diff options
| author | Shireesh Anjal <shireesh@gluster.com> | 2011-03-28 17:55:00 +0530 |
|---|---|---|
| committer | Shireesh Anjal <shireesh@gluster.com> | 2011-03-28 17:55:00 +0530 |
| commit | b27c5d68d3ffa47c92e0fcd7d0873ac2d6b8fca8 (patch) | |
| tree | 4104c16d5107628e4302c4eeab6d6d3d73ad716c | |
| parent | 1e988cd864827cbfaba2d6d215200b0cd3ddb0bb (diff) | |
Story #15 - "Volume Options" View - New classes to fetch volume options defaults
Signed-off-by: Shireesh Anjal <shireesh@gluster.com>
4 files changed, 161 insertions, 31 deletions
diff --git a/com.gluster.storage.management.client/src/com/gluster/storage/management/client/DiscoveredServersClient.java b/com.gluster.storage.management.client/src/com/gluster/storage/management/client/DiscoveredServersClient.java index 5ea050b9..0cc18037 100644 --- a/com.gluster.storage.management.client/src/com/gluster/storage/management/client/DiscoveredServersClient.java +++ b/com.gluster.storage.management.client/src/com/gluster/storage/management/client/DiscoveredServersClient.java @@ -45,11 +45,6 @@ public class DiscoveredServersClient extends AbstractClient { MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl(); queryParams.putSingle("details", getDetails.toString()); - // TODO: Used during development to check the response contents. - // to be removed later - String response = (String) fetchResource(queryParams, String.class); - System.out.println(response); - return ((Response) fetchResource(queryParams, responseClass)).getData(); } diff --git a/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/VolumeOptionInfo.java b/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/VolumeOptionInfo.java new file mode 100644 index 00000000..44e45df5 --- /dev/null +++ b/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/VolumeOptionInfo.java @@ -0,0 +1,66 @@ +/** + * VolumeOptionInfo.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.core.model; + +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Class to hold information about a volume option + */ +@XmlRootElement(name = "volumeOption") +public class VolumeOptionInfo { + private String name; + private String description; + private String defaultValue; + + public VolumeOptionInfo() { + } + + public VolumeOptionInfo(String name, String description, String defaultValue) { + setName(name); + setDescription(description); + setDefaultValue(defaultValue); + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } +}
\ No newline at end of file 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 index fe675056..384038f4 100644 --- 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 @@ -20,32 +20,101 @@ */ package com.gluster.storage.management.server.constants; -import java.util.HashMap; -import java.util.Map; +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; + +import com.gluster.storage.management.core.constants.CoreConstants; +import com.gluster.storage.management.core.model.VolumeOptionInfo; + +@XmlRootElement public class VolumeOptionsDefaults { - public static final Map<String, String> OPTIONS = new HashMap<String, String>(); + @XmlElementWrapper(name = "volumeOptions") + @XmlElement(name = "volumeOption", type = VolumeOptionInfo.class) + public List<VolumeOptionInfo> options; + + public VolumeOptionsDefaults() { + } - 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", "?"); + public VolumeOptionsDefaults getDefaults() { + options = getVolumeOptionsInfo(); + return this; + } + + /** + * Fetches the list of all volume options with their information from GlusterFS and returns the same + * + * @return List of volume option information objects + */ + private List<VolumeOptionInfo> getVolumeOptionsInfo() { + List<VolumeOptionInfo> volumeOptionsInfo = new ArrayList<VolumeOptionInfo>(); + + volumeOptionsInfo + .add(new VolumeOptionInfo( + "cluster.stripe-block-size", + "This could be used in case of a stripe setup. Specifies the size of the stripe unit that will read from or written to the striped servers. " + + CoreConstants.NEWLINE + + "Optionally different stripe unit sizes can be specified for different fies, with the following pattern <filename-pattern:blk-size>. ", + "*:128KB")); + volumeOptionsInfo + .add(new VolumeOptionInfo( + "cluster.self-heal-window-size", + "Specifies the number of maximum number blocks per file for which self-heal process would be applied simultaneously.", + "16")); + volumeOptionsInfo.add(new VolumeOptionInfo("cluster.data-self-heal-algorithm", + "cluster.data-self-heal-algorithm", "auto")); + volumeOptionsInfo + .add(new VolumeOptionInfo( + "network.frame-timeout", + "The time frame after which the operation has to be declared as dead, if the server does not respond for a particular operation.", + "1800")); + volumeOptionsInfo.add(new VolumeOptionInfo("network.ping-timeout", + "The time duration for which the client waits to check if the server is responsive.", "42")); + volumeOptionsInfo.add(new VolumeOptionInfo("auth.allow", + "'IP addresses/Host name' of the clients which should be allowed to access the the volume.", "*")); + volumeOptionsInfo.add(new VolumeOptionInfo("auth.reject", + "'IP addresses/Host name' of the clients which should be denied to access the volume.", "NONE")); + volumeOptionsInfo + .add(new VolumeOptionInfo( + "performance.cache-refresh-timeout", + "The cached data for a file will be retained till 'cache-refresh-timeout' seconds, after which data re-validation is performed.", + "1")); + volumeOptionsInfo.add(new VolumeOptionInfo("performance.cache-size", "Size of the read cache.", "32MB")); + volumeOptionsInfo.add(new VolumeOptionInfo("performance.write-behind-window-size", + "Size of the per-file write-behind buffer.", "1MB")); + volumeOptionsInfo.add(new VolumeOptionInfo("performance.cache-max-file-size", + "performance.cache-max-file-size", "-1")); + volumeOptionsInfo.add(new VolumeOptionInfo("performance.cache-min-file-size", + "performance.cache-min-file-size", "0")); + volumeOptionsInfo + .add(new VolumeOptionInfo( + "performance.io-thread-count", + " Number of threads in the thread-pool in the bricks to improve the concurrency in I/O s of server side.", + "16")); + volumeOptionsInfo + .add(new VolumeOptionInfo( + "diagnostics.latency-measurement", + "Statistics related to the latency of each operation would be tracked inside GlusterFS data-structures.", + "off")); + volumeOptionsInfo.add(new VolumeOptionInfo("diagnostics.dump-fd-stats", + "Statistics related to file-operations would be tracked inside GlusterFS data-structures.", "off")); + volumeOptionsInfo.add(new VolumeOptionInfo("diagnostics.brick-log-level", + "Changes the log-level of the bricks (servers).", "NORMAL")); + volumeOptionsInfo.add(new VolumeOptionInfo("diagnostics.client-log-level", + "Changes the log-level of the clients.", "NORMAL")); + volumeOptionsInfo.add(new VolumeOptionInfo("nfs.enable-ino32", + "Use this option from the CLI to make Gluster NFS return 32-bit inode numbers instead of 64-bit.", + "off")); + volumeOptionsInfo + .add(new VolumeOptionInfo( + "nfs.mem-factor", + "This option specifies a multiple that determines the total amount of memory used. Increases this increases the performance of NFS.", + "15")); + volumeOptionsInfo.add(new VolumeOptionInfo("transport.keepalive", "transport.keepalive", "on")); + + return volumeOptionsInfo; } }
\ 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 35571d01..dfa5a5cc 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 @@ -85,9 +85,9 @@ public class VolumesResource { @GET @Path(SUBRESOURCE_DEFAULT_OPTIONS) @Produces(MediaType.TEXT_XML) - public Map<String, String> getDefaultOptions() { + public VolumeOptionsDefaults 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; + return new VolumeOptionsDefaults().getDefaults(); } }
\ No newline at end of file |
