summaryrefslogtreecommitdiffstats
path: root/src/com.gluster.storage.management.server
diff options
context:
space:
mode:
Diffstat (limited to 'src/com.gluster.storage.management.server')
-rw-r--r--src/com.gluster.storage.management.server/.project1
-rw-r--r--src/com.gluster.storage.management.server/.settings/org.eclipse.wst.common.component2
-rw-r--r--src/com.gluster.storage.management.server/WebContent/WEB-INF/web.xml12
-rw-r--r--src/com.gluster.storage.management.server/WebContent/index.html8
-rw-r--r--src/com.gluster.storage.management.server/WebContent/scripts/Globals.py2
-rwxr-xr-xsrc/com.gluster.storage.management.server/WebContent/scripts/vmware-discover-servers.py9
-rw-r--r--src/com.gluster.storage.management.server/WebContent/ssl/gmg-ssl.keystorebin0 -> 1380 bytes
-rw-r--r--src/com.gluster.storage.management.server/build/glusterserver.ant2
-rw-r--r--src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/data/ClusterInfo.java3
-rw-r--r--src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/filters/AuditFilter.java13
-rw-r--r--src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/VolumesResource.java12
-rw-r--r--src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/utils/GlusterUtil.java10
-rw-r--r--src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/utils/SshUtil.java14
-rw-r--r--src/com.gluster.storage.management.server/src/spring/gluster-server-security.xml18
14 files changed, 75 insertions, 31 deletions
diff --git a/src/com.gluster.storage.management.server/.project b/src/com.gluster.storage.management.server/.project
index 86d34a3b..259b3726 100644
--- a/src/com.gluster.storage.management.server/.project
+++ b/src/com.gluster.storage.management.server/.project
@@ -37,6 +37,5 @@
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
- <nature>org.python.pydev.pythonNature</nature>
</natures>
</projectDescription>
diff --git a/src/com.gluster.storage.management.server/.settings/org.eclipse.wst.common.component b/src/com.gluster.storage.management.server/.settings/org.eclipse.wst.common.component
index e9b43da9..dbf56d1e 100644
--- a/src/com.gluster.storage.management.server/.settings/org.eclipse.wst.common.component
+++ b/src/com.gluster.storage.management.server/.settings/org.eclipse.wst.common.component
@@ -5,6 +5,6 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/junit"/>
<property name="java-output-path" value="/com.gluster.storage.management.server/build/classes"/>
- <property name="context-root" value="glustermc"/>
+ <property name="context-root" value="glustermg"/>
</wb-module>
</project-modules>
diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/web.xml b/src/com.gluster.storage.management.server/WebContent/WEB-INF/web.xml
index 7c7d42d3..4aaa3c9b 100644
--- a/src/com.gluster.storage.management.server/WebContent/WEB-INF/web.xml
+++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/web.xml
@@ -3,7 +3,7 @@
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
- <display-name>com.gluster.storage.management.server</display-name>
+ <display-name>glustermg</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
@@ -81,4 +81,14 @@
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
+
+ <security-constraint>
+ <web-resource-collection>
+ <web-resource-name>Gluster Management Gateway</web-resource-name>
+ <url-pattern>/*</url-pattern>
+ </web-resource-collection>
+ <user-data-constraint>
+ <transport-guarantee>CONFIDENTIAL</transport-guarantee>
+ </user-data-constraint>
+</security-constraint>
</web-app>
diff --git a/src/com.gluster.storage.management.server/WebContent/index.html b/src/com.gluster.storage.management.server/WebContent/index.html
new file mode 100644
index 00000000..4c90162a
--- /dev/null
+++ b/src/com.gluster.storage.management.server/WebContent/index.html
@@ -0,0 +1,8 @@
+<html>
+<head>
+<title>Gluster Management Console</title>
+</head>
+<body>
+TODO: Identify the client's platform-browser and invoke appropriate JNLP URL.
+</body>
+</html>
diff --git a/src/com.gluster.storage.management.server/WebContent/scripts/Globals.py b/src/com.gluster.storage.management.server/WebContent/scripts/Globals.py
index 9ae53491..877c6c68 100644
--- a/src/com.gluster.storage.management.server/WebContent/scripts/Globals.py
+++ b/src/com.gluster.storage.management.server/WebContent/scripts/Globals.py
@@ -64,7 +64,7 @@ WEBDAV_DOCUMENT_ROOT_DIR = "/var/www/html"
UPDATES_DIR = "/UPDATES"
TRANSPORT_HOME_DIR = "/transport"
GLUSTERFS_LOG_DIR = "/var/log/glusterfs"
-LOG_DIR = "/var/log/glustermc"
+LOG_DIR = "/var/log/glustermg"
GLUSTER_UPDATES_FILE = "updates.xml"
INSTALLER_STATUS_FILE = "/var/log/install-server-status.log"
diff --git a/src/com.gluster.storage.management.server/WebContent/scripts/vmware-discover-servers.py b/src/com.gluster.storage.management.server/WebContent/scripts/vmware-discover-servers.py
index 6ac15fed..80e6101c 100755
--- a/src/com.gluster.storage.management.server/WebContent/scripts/vmware-discover-servers.py
+++ b/src/com.gluster.storage.management.server/WebContent/scripts/vmware-discover-servers.py
@@ -23,6 +23,8 @@ import struct
import syslog
import Globals
import Common
+import time
+from XmlHandler import *
class TimeoutException(Exception):
pass
@@ -50,7 +52,12 @@ def serverDiscoveryRequest(multiCastGroup, port):
while True:
response = socketReceive.recvfrom(200)
if response and response[0].upper() != "SERVERDISCOVERY":
- servers.append(response[0])
+ dom = XDOM()
+ dom.parseString(response[0])
+ responsetime = dom.getTextByTagRoute("response.time")
+ servername = dom.getTextByTagRoute("response.servername")
+ if time.time() - float(responsetime) < 60:
+ servers.append(servername)
signal.signal(signal.SIGALRM, timeoutSignal)
signal.alarm(3)
except TimeoutException:
diff --git a/src/com.gluster.storage.management.server/WebContent/ssl/gmg-ssl.keystore b/src/com.gluster.storage.management.server/WebContent/ssl/gmg-ssl.keystore
new file mode 100644
index 00000000..2efe19b0
--- /dev/null
+++ b/src/com.gluster.storage.management.server/WebContent/ssl/gmg-ssl.keystore
Binary files differ
diff --git a/src/com.gluster.storage.management.server/build/glusterserver.ant b/src/com.gluster.storage.management.server/build/glusterserver.ant
index 27c91b9d..e9b5b650 100644
--- a/src/com.gluster.storage.management.server/build/glusterserver.ant
+++ b/src/com.gluster.storage.management.server/build/glusterserver.ant
@@ -3,7 +3,7 @@
<echo message="buckminster.output=${buckminster.output}" />
<property name="WEB-INF" value="${basedir}/WebContent/WEB-INF" />
<property name="OUT" value="${buckminster.output}/glusterserver/" />
- <property name="WAR_FILE_NAME" value="glustermc.war" />
+ <property name="WAR_FILE_NAME" value="glustermg.war" />
<property name="TEMP" value="${buckminster.output}/temp" />
<target name="help">
diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/data/ClusterInfo.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/data/ClusterInfo.java
index 3b3401e3..1c3cd347 100644
--- a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/data/ClusterInfo.java
+++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/data/ClusterInfo.java
@@ -18,6 +18,7 @@
*******************************************************************************/
package com.gluster.storage.management.server.data;
+import java.util.ArrayList;
import java.util.List;
import javax.persistence.Entity;
@@ -37,7 +38,7 @@ public class ClusterInfo {
private String name;
@OneToMany(mappedBy="cluster")
- private List<ServerInfo> servers;
+ private List<ServerInfo> servers = new ArrayList<ServerInfo>();
public void setId(Integer id) {
this.id = id;
diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/filters/AuditFilter.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/filters/AuditFilter.java
index b23d9c4f..daaf8f33 100644
--- a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/filters/AuditFilter.java
+++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/filters/AuditFilter.java
@@ -5,13 +5,14 @@ package com.gluster.storage.management.server.filters;
import com.sun.jersey.spi.container.ContainerRequest;
import com.sun.jersey.spi.container.ContainerRequestFilter;
+import com.sun.jersey.spi.container.ContainerResponse;
import com.sun.jersey.spi.container.ContainerResponseFilter;
import com.sun.jersey.spi.container.ResourceFilter;
/**
* Resource filter for maintaining audit trail of resource access
*/
-public class AuditFilter implements ResourceFilter, ContainerRequestFilter {
+public class AuditFilter implements ResourceFilter, ContainerRequestFilter, ContainerResponseFilter {
@Override
public ContainerRequestFilter getRequestFilter() {
@@ -20,12 +21,18 @@ public class AuditFilter implements ResourceFilter, ContainerRequestFilter {
@Override
public ContainerResponseFilter getResponseFilter() {
- return null;
+ return this;
}
@Override
public ContainerRequest filter(ContainerRequest req) {
- System.out.println("Resource access [" + req.getMethod() + "][" + req.getPath() + "]");
+ System.out.println("REQUEST: [" + req.getMethod() + "][" + req.getPath() + "]");
return req;
}
+
+ @Override
+ public ContainerResponse filter(ContainerRequest req, ContainerResponse response) {
+ System.out.println("RESPONSE: [" + req.getMethod() + "][" + req.getPath() + "]");
+ return response;
+ }
}
diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/VolumesResource.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/VolumesResource.java
index fe6de156..a2dfe2e3 100644
--- a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/VolumesResource.java
+++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/VolumesResource.java
@@ -116,8 +116,6 @@ public class VolumesResource {
@InjectParam
private VolumeOptionsDefaults volumeOptionsDefaults;
- private FileUtil fileUtil = new FileUtil();
-
@GET
@Produces(MediaType.TEXT_XML)
public VolumeListResponse getAllVolumes(@PathParam(PATH_PARAM_CLUSTER_NAME) String clusterName) {
@@ -452,7 +450,7 @@ public class VolumesResource {
public void write(OutputStream output) throws IOException, WebApplicationException {
try {
File archiveFile = new File(downloadLogs(volume));
- output.write(fileUtil.readFileAsByteArray(archiveFile));
+ output.write(FileUtil.readFileAsByteArray(archiveFile));
archiveFile.delete();
} catch (Exception e) {
e.printStackTrace();
@@ -464,11 +462,11 @@ public class VolumesResource {
private String downloadLogs(Volume volume) {
// create temporary directory
- File tempDir = fileUtil.createTempDir();
+ File tempDir = FileUtil.createTempDir();
String tempDirPath = tempDir.getPath();
for (Brick brick : volume.getBricks()) {
- String logDir = glusterUtil.getLogLocation(volume.getName(), brick.getBrickDirectory(),
+ String logDir = glusterUtil.getLogLocation(volume.getName(), brick.getQualifiedName(),
brick.getServerName());
String logFileName = glusterUtil.getLogFileNameForBrickDir(brick.getBrickDirectory());
String logFilePath = logDir + CoreConstants.FILE_SEPARATOR + logFileName;
@@ -476,11 +474,11 @@ public class VolumesResource {
serverUtil.getFileFromServer(brick.getServerName(), logFilePath, tempDirPath);
}
- String gzipPath = fileUtil.getTempDirName() + CoreConstants.FILE_SEPARATOR + volume.getName() + "-logs.tar.gz";
+ String gzipPath = FileUtil.getTempDirName() + CoreConstants.FILE_SEPARATOR + volume.getName() + "-logs.tar.gz";
new ProcessUtil().executeCommand("tar", "czvf", gzipPath, "-C", tempDir.getParent(), tempDir.getName());
// delete the temp directory
- fileUtil.recursiveDelete(tempDir);
+ FileUtil.recursiveDelete(tempDir);
return gzipPath;
}
diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/utils/GlusterUtil.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/utils/GlusterUtil.java
index fe725d17..42b204cd 100644
--- a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/utils/GlusterUtil.java
+++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/utils/GlusterUtil.java
@@ -468,18 +468,18 @@ System.out.println(brickDir);
}
public String getLogLocation(String volumeName, String brickName, String knownServer) {
- ProcessResult result = sshUtil.executeRemote(knownServer, "gluster volume log locate " + volumeName + " "
- + brickName);
+ String command = "gluster volume log locate " + volumeName + " " + brickName;
+ ProcessResult result = sshUtil.executeRemote(knownServer, command);
if (!result.isSuccess()) {
- throw new GlusterRuntimeException("Command [gluster volume info] failed with error: ["
- + result.getExitValue() + "][" + result.getOutput() + "]");
+ throw new GlusterRuntimeException("Command [" + command + "] failed with error: [" + result.getExitValue()
+ + "][" + result.getOutput() + "]");
}
String output = result.getOutput();
if (output.startsWith(VOLUME_LOG_LOCATION_PFX)) {
return output.substring(VOLUME_LOG_LOCATION_PFX.length()).trim();
}
- throw new GlusterRuntimeException("Couldn't parse output of [volume log locate] command. [" + output
+ throw new GlusterRuntimeException("Couldn't parse output of command [" + command + "]. Output [" + output
+ "] doesn't start with prefix [" + VOLUME_LOG_LOCATION_PFX + "]");
}
diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/utils/SshUtil.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/utils/SshUtil.java
index a4728d21..4d3661f8 100644
--- a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/utils/SshUtil.java
+++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/utils/SshUtil.java
@@ -314,7 +314,19 @@ public class SshUtil {
}
private ProcessResult executeRemoteWithPubKey(String serverName, String command) {
- return executeCommand(getConnection(serverName), command);
+ try {
+ return executeCommand(getConnection(serverName), command);
+ } catch(GlusterRuntimeException e) {
+ Throwable cause = e.getCause();
+ if(cause != null && cause instanceof IOException) {
+ // cached ssh connection might have gone bad.
+ // remove it and try with a new one
+ sshConnCache.remove(serverName);
+ return executeCommand(getConnection(serverName), command);
+ } else {
+ throw e;
+ }
+ }
}
/**
diff --git a/src/com.gluster.storage.management.server/src/spring/gluster-server-security.xml b/src/com.gluster.storage.management.server/src/spring/gluster-server-security.xml
index 0de97761..59714c87 100644
--- a/src/com.gluster.storage.management.server/src/spring/gluster-server-security.xml
+++ b/src/com.gluster.storage.management.server/src/spring/gluster-server-security.xml
@@ -11,16 +11,18 @@
">
<http auto-config="true" use-expressions="true">
- <intercept-url pattern="/resources/*"
+ <!-- intercept-url pattern="/resources/*"
access="hasRole('ROLE_ADMIN') and fullyAuthenticated" />
- <intercept-url pattern="/*" access="permitAll" />
+ <intercept-url pattern="/*" access="permitAll" /-->
+
<!-- SSL Protection -->
- <!-- <intercept-url pattern="/resources/*" access="hasRole('ROLE_ADMIN')
- and fullyAuthenticated" requires-channel="https"/> <intercept-url pattern="/*"
- access="permitAll" requires-channel="any"/> -->
- <port-mappings>
- <port-mapping http="8080" https="8443" />
- </port-mappings>
+ <intercept-url pattern="/resources/*" access="hasRole('ROLE_ADMIN')
+ and fullyAuthenticated"
+ requires-channel="https" />
+ <intercept-url pattern="/*" access="permitAll" requires-channel="any" />
+ <port-mappings>
+ <port-mapping http="8080" https="8443" />
+ </port-mappings>
<!-- HTTP basic authentication -->
<http-basic />