From 397e4da1097d75e56d15edd494d9765ff58329b6 Mon Sep 17 00:00:00 2001 From: Shireesh Anjal Date: Wed, 23 Mar 2011 19:05:38 +0530 Subject: introducing subresource defaultoptions under volumes resource --- .../server/constants/VolumeOptionsDefaults.java | 51 ++++++++++++++++++++++ .../server/resources/VolumesResource.java | 15 ++++++- 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 com.gluster.storage.management.server/src/com/gluster/storage/management/server/constants/VolumeOptionsDefaults.java (limited to 'com.gluster.storage.management.server/src') 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. + * 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 + * . + */ +package com.gluster.storage.management.server.constants; + +import java.util.HashMap; +import java.util.Map; + +public class VolumeOptionsDefaults { + public static final Map OPTIONS = new HashMap(); + + 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 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 -- cgit