diff options
author | Selvasundaram <selvam@gluster.com> | 2011-11-25 18:50:36 +0530 |
---|---|---|
committer | Selvasundaram <selvam@gluster.com> | 2011-11-25 18:50:36 +0530 |
commit | 3f62ef93b9977f73a0441c088105aa5cc1332de5 (patch) | |
tree | 5789d783a07bfaf883d7e589f42c27987dc0432f | |
parent | 6a7ca2f7733d15f57d278275f55d65c5de0c561e (diff) | |
parent | 45e68b0cae66c4e67098bfab5877c172ed8c584e (diff) |
Merge branch 'master' of github.com:gluster/gmc
-rwxr-xr-x | build/create-rpms.sh | 21 | ||||
-rwxr-xr-x | build/gmc-buckminster.commands | 21 | ||||
-rwxr-xr-x | build/gmc-build.sh | 65 | ||||
-rwxr-xr-x | build/gmc-checkout.sh | 6 | ||||
-rwxr-xr-x | build/gmg-buckminster.commands | 21 | ||||
-rwxr-xr-x | build/gmg-install.sh | 172 | ||||
-rwxr-xr-x | build/junit-buckminster.commands | 20 | ||||
-rwxr-xr-x | build/package-backend.sh | 21 | ||||
-rwxr-xr-x | build/package-gateway.sh | 21 | ||||
-rw-r--r-- | src/com.gluster.storage.management.console.feature.webstart/build/gluster.keystore | bin | 2738 -> 0 bytes | |||
-rw-r--r-- | src/com.gluster.storage.management.console.feature.webstart/build/glustermc.ant | 2 | ||||
-rwxr-xr-x | src/com.gluster.storage.management.gateway.scripts/src/backend/format_device.py | 53 | ||||
-rwxr-xr-x | src/com.gluster.storage.management.gateway.scripts/src/backend/get_filesystem_type.py | 4 | ||||
-rwxr-xr-x | src/com.gluster.storage.management.gateway.scripts/src/backend/get_server_details.py | 5 |
14 files changed, 394 insertions, 38 deletions
diff --git a/build/create-rpms.sh b/build/create-rpms.sh index db7ea679..d0ad909b 100755 --- a/build/create-rpms.sh +++ b/build/create-rpms.sh @@ -1,3 +1,24 @@ +#!/bin/bash + +#------------------------------------------------------------------ +# Copyright (c) 2006-2011 Gluster, Inc. <http://www.gluster.com> +# This file is part of GlusterFS. +# +# Gluster Management Gateway is free software; you can redistribute +# it and/or modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# GlusterFS 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 +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +# <http://www.gnu.org/licenses/>. +#------------------------------------------------------------------ + FILE_ERR=1 RPM_ERR=2 sudo cp glustermg-backend-${VERSION}.tar.gz /usr/src/redhat/SOURCES || exit ${FILE_ERR} diff --git a/build/gmc-buckminster.commands b/build/gmc-buckminster.commands index 86b254e1..1a2a88e9 100755 --- a/build/gmc-buckminster.commands +++ b/build/gmc-buckminster.commands @@ -1,4 +1,23 @@ -# Buckminster commands to build Gluster Management Console projects +#------------------------------------------------------------------ +# Copyright (c) 2006-2011 Gluster, Inc. <http://www.gluster.com> +# This file is part of GlusterFS. +# +# Gluster Management Console is free software; you can redistribute +# it and/or modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# GlusterFS 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 +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +# <http://www.gnu.org/licenses/>. +#------------------------------------------------------------------ + +# Buckminster commands to build Gluster Management Console importtarget --active gmc-target/com.gluster.storage.management.console.target/gmc.target diff --git a/build/gmc-build.sh b/build/gmc-build.sh index c25713a9..dcebdfc8 100755 --- a/build/gmc-build.sh +++ b/build/gmc-build.sh @@ -1,3 +1,24 @@ +#!/bin/bash + +#------------------------------------------------------------------ +# Copyright (c) 2006-2011 Gluster, Inc. <http://www.gluster.com> +# This file is part of GlusterFS. +# +# Gluster Management Console is free software; you can redistribute +# it and/or modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# GlusterFS 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 +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +# <http://www.gnu.org/licenses/>. +#------------------------------------------------------------------ + USAGE_ERR=1 BUCKMINSTER_URL=http://download.eclipse.org/tools/buckminster/headless-3.7/ @@ -62,6 +83,27 @@ install_buckminster() ./buckminster install ${BUCKMINSTER_URL} org.eclipse.buckminster.emma.headless.feature } +# Create keystore for jar signing (self signed) +setup_keys() +{ + mkdir -p ${KEYS_DIR} + cd ${KEYS_DIR} + keytool -genkeypair -keystore gluster.keystore -storepass gluster -alias gluster -keyalg RSA << EOF +Gluster +Gluster +Gluster +Dummy +Dummy +US +yes +EOF + + keytool -selfcert -alias gluster -keystore gluster.keystore << EOF +gluster +EOF + cd - +} + configure_workspace() { echo "Configuring the workspace..." @@ -76,11 +118,6 @@ configure_workspace() echo "Importing target platform..." ${BUCKMINSTER_HOME}/buckminster importtarget -data ${WORKSPACE_DIR} --active gmc-target/com.gluster.storage.management.console.target/gmc.target - echo "Importing component query for glustermc..." - ${BUCKMINSTER_HOME}/buckminster import -data ${WORKSPACE_DIR} build/com.gluster.storage.management.console.feature.webstart.cquery - #${BUCKMINSTER_HOME}/buckminster import -data ${WORKSPACE_DIR} build/com.gluster.storage.management.core.cquery - echo "Importing component query for glustermg..." - ${BUCKMINSTER_HOME}/buckminster import -data ${WORKSPACE_DIR} build/com.gluster.storage.management.gateway.cquery cd - } @@ -95,14 +132,17 @@ build_gmc() mkdir -p ${DIST_DIR} fi - echo "Building GMC for [${os}.${ws}.${arch}" + echo "Importing component query for glustermc..." + ${BUCKMINSTER_HOME}/buckminster import -data ${WORKSPACE_DIR} build/com.gluster.storage.management.console.feature.webstart.cquery + + echo "Building GMC for [${os}.${ws}.${arch}]" ${BUCKMINSTER_HOME}/buckminster perform -Dbuckminster.output.root=${DIST_DIR} -data ${WORKSPACE_DIR} -Dtarget.os=${os} -Dtarget.ws=${ws} -Dtarget.arch=${arch} -Dcbi.include.source=false --properties ${PROPERTIES_FILE} ${GMC_WEBSTART_PROJECT}#create.eclipse.jnlp.product - ${BUCKMINSTER_HOME}/buckminster perform -Dbuckminster.output.root=${DIST_DIR} --properties ${PROPERTIES_FILE} ${GMC_WEBSTART_PROJECT}#copy.root.files + ${BUCKMINSTER_HOME}/buckminster perform -Dbuckminster.output.root=${DIST_DIR} -data ${WORKSPACE_DIR} --properties ${PROPERTIES_FILE} ${GMC_WEBSTART_PROJECT}#copy.root.files # buckminster signs the jars using eclipse certificate - hence unsign and sign them again echo "Signing product jars..." - ${BUCKMINSTER_HOME}/buckminster perform --properties ${PROPERTIES_FILE} ${GMC_WEBSTART_PROJECT}#unsign.jars - ${BUCKMINSTER_HOME}/buckminster perform --properties ${PROPERTIES_FILE} ${GMC_WEBSTART_PROJECT}#sign.jars + ${BUCKMINSTER_HOME}/buckminster perform -data ${WORKSPACE_DIR} -Dbuckminster.output.root=${DIST_DIR} --properties ${PROPERTIES_FILE} ${GMC_WEBSTART_PROJECT}#unsign.jars + ${BUCKMINSTER_HOME}/buckminster perform -data ${WORKSPACE_DIR} -Dbuckminster.output.root=${DIST_DIR} -Djar.signing.keystore=${KEYS_DIR}/gluster.keystore --properties ${PROPERTIES_FILE} ${GMC_WEBSTART_PROJECT}#sign.jars } build_gmg() @@ -113,8 +153,13 @@ build_gmg() mkdir -p ${DIST_DIR} fi + echo "Importing component query for glustermg..." + ${BUCKMINSTER_HOME}/buckminster import -data ${WORKSPACE_DIR} build/com.gluster.storage.management.core.cquery + ${BUCKMINSTER_HOME}/buckminster import -data ${WORKSPACE_DIR} build/com.gluster.storage.management.gateway.cquery + echo "Building CORE..." ${BUCKMINSTER_HOME}/buckminster perform -Dbuckminster.output.root=${DIST_DIR} -data ${WORKSPACE_DIR} -Dcbi.include.source=false --properties ${PROPERTIES_FILE} ${GMC_CORE_PROJECT}#bundle.jar + echo "Building Gateway..." ${BUCKMINSTER_HOME}/buckminster perform -Dbuckminster.output.root=${DIST_DIR} -data ${WORKSPACE_DIR} -Dcbi.include.source=false --properties ${PROPERTIES_FILE} ${GMG_PROJECT}#archive @@ -172,6 +217,7 @@ BUILD_MODE=${1} BASE_DIR=${PWD}/../.. TOOLS_DIR=${BASE_DIR}/tools DIST_BASE=${BASE_DIR}/dist +KEYS_DIR=${TOOLS_DIR}/keys BUCKMINSTER_HOME=${TOOLS_DIR}/buckminster WORKSPACE_DIR=${BUCKMINSTER_HOME}/workspace PROPERTIES_FILE=${WORKSPACE_DIR}/build/glustermc_build.properties @@ -180,6 +226,7 @@ SCRIPT_DIR=${PWD} if [ "${BUILD_MODE}" == "${TYPE_ALL}" -o "${BUILD_MODE}" == "${TYPE_SETUP}" ]; then get_director install_buckminster + setup_keys fi if [ "${BUILD_MODE}" == "${TYPE_ALL}" -o "${BUILD_MODE}" == "${TYPE_BUILD}" ]; then diff --git a/build/gmc-checkout.sh b/build/gmc-checkout.sh deleted file mode 100755 index e7ba352c..00000000 --- a/build/gmc-checkout.sh +++ /dev/null @@ -1,6 +0,0 @@ -# cleans the workspace and checks out gmc projects in to it - -cd ${WORKSPACE} -rm -rf gmc-src gmc-target -git clone /data/private/gmc-src.git -git clone /data/private/gmc-target.git diff --git a/build/gmg-buckminster.commands b/build/gmg-buckminster.commands index 2d6ea9e6..46c9886b 100755 --- a/build/gmg-buckminster.commands +++ b/build/gmg-buckminster.commands @@ -1,4 +1,23 @@ -# Buckminster commands to build Gluster Management Console projects +#------------------------------------------------------------------ +# Copyright (c) 2006-2011 Gluster, Inc. <http://www.gluster.com> +# This file is part of GlusterFS. +# +# Gluster Management Gateway is free software; you can redistribute +# it and/or modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# GlusterFS 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 +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +# <http://www.gnu.org/licenses/>. +#------------------------------------------------------------------ + +# Buckminster commands to build Gluster Management Gateway importtarget --active gmc-target/com.gluster.storage.management.console.target/gmc.target diff --git a/build/gmg-install.sh b/build/gmg-install.sh new file mode 100755 index 00000000..7e0e23f4 --- /dev/null +++ b/build/gmg-install.sh @@ -0,0 +1,172 @@ +#!/bin/bash + +#------------------------------------------------------------------ +# Copyright (c) 2006-2011 Gluster, Inc. <http://www.gluster.com> +# This file is part of GlusterFS. +# +# Gluster Management Gateway is free software; you can redistribute +# it and/or modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# GlusterFS 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 +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +# <http://www.gnu.org/licenses/>. +#------------------------------------------------------------------ + +# Variables +GMG_LOG_DIR="/var/log/glustermg"; +GMG_ROOT_DIR="/opt/glustermg" +GMG_KEYS_DIR="${GMG_ROOT_DIR}/keys" +USAGE_ERR=1 +TOMCAT_ERR=2 +JAVA_ERR=3 +TAR_ERR=4 + +function quit() +{ + echo ${1} + echo + exit ${2} +} + +function post_install() +{ + if [ ! -f /etc/init.d/$TOMCAT_BIN ]; then + echo "All operations completed. Please restart tomcat." + else + echo "Re-starting [${TOMCAT_BIN}].." + service $TOMCAT_BIN restart; + fi + echo +} + +function configure_server() +{ + TOMCAT_CONFIG_FILE="/etc/sysconfig/$TOMCAT_BIN" + if [ -f ${TOMCAT_CONFIG_FILE} ]; then + if ! grep -q '^JAVA_HOME="/usr/lib/jvm/jre-1.6.0-openjdk.x86_64"' ${TOMCAT_CONFIG_FILE}; then + sed -i 's/^JAVA_HOME=/# JAVA_HOME=/g' ${TOMCAT_CONFIG_FILE} + echo 'JAVA_HOME="/usr/lib/jvm/jre-1.6.0-openjdk.x86_64"' >> ${TOMCAT_CONFIG_FILE} + fi + + if ! grep -q '# Added by Gluster: JAVA_OPTS="${JAVA_OPTS} -Xms1024m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=256m"' ${TOMCAT_CONFIG_FILE}; then + echo '# Added by Gluster: JAVA_OPTS="${JAVA_OPTS} -Xms1024m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=256m"' >> ${TOMCAT_CONFIG_FILE} + echo 'JAVA_OPTS="${JAVA_OPTS} -Xms1024m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=256m"' >> ${TOMCAT_CONFIG_FILE} + fi + fi + + if ! grep -q ${GMG_HOME_DIR}/glustermg/ssl/gmg-ssl.keystore $TOMCAT_DIR/conf/server.xml; then + sed -i '/<\/Service>/i \ + <Connector SSLEnabled="true" \ + clientAuth="false" \ + executor="tomcatThreadPool" \ + maxThreads="150" \ + port="8443" \ + keystoreFile="$TOMCAT_DIR/webapps/glustermg/ssl/gmg-ssl.keystore" \ + keystorePass="gluster" \ + protocol="org.apache.coyote.http11.Http11Protocol" \ + scheme="https" \ + secure="true" \ + sslProtocol="TLS" />' $TOMCAT_DIR/conf/server.xml + sed -i "s,keystoreFile=\"\$TOMCAT_DIR/webapps/glustermg/ssl/gmg-ssl.keystore\",keystoreFile=\"$TOMCAT_DIR/webapps/glustermg/ssl/gmg-ssl.keystore\"," $TOMCAT_DIR/conf/server.xml + fi + if ! grep -q "org.apache.catalina.authenticator.NonLoginAuthenticator" $TOMCAT_DIR/conf/context.xml; then + sed -i '/<\/Context>/i \ + <Valve className="org.apache.catalina.authenticator.NonLoginAuthenticator" \ + disableProxyCaching="false" />' $TOMCAT_DIR/conf/context.xml + fi + + GMG_SCRIPTS_DIR="${GMG_HOME_DIR}/glustermg/scripts" + ln -sf ${GMG_SCRIPTS_DIR}/grun.py /usr/sbin/grun.py + ln -sf ${GMG_SCRIPTS_DIR}/add_user_cifs_all.py /usr/sbin/add_user_cifs_all.py + ln -sf ${GMG_SCRIPTS_DIR}/delete_user_cifs_all.py /usr/sbin/delete_user_cifs_all.py + ln -sf ${GMG_SCRIPTS_DIR}/setup_cifs_config_all.py /usr/sbin/setup_cifs_config_all.py + ln -sf ${GMG_SCRIPTS_DIR}/gmg-reset-password.sh /usr/sbin/gmg-reset-password.sh +} + +function make_dirs() +{ + mkdir -p $GMG_HOME_DIR $GMG_KEYS_DIR $GMG_LOG_DIR; + if [ ! -f ${GMG_KEYS_DIR}/gluster.pem ]; then + ssh-keygen -t rsa -f /opt/glustermg/keys/gluster.pem -N '' + mv -f /opt/glustermg/keys/gluster.pem.pub /opt/glustermg/keys/gluster.pub + fi + chown -R tomcat:tomcat $GMG_HOME_DIR $GMG_LOG_DIR; +} + + +function check_tar_gz() +{ + file $GMG_ARCHIVE_PATH | grep "gzip" > /dev/null; + if [ $? != 0 ] ; then + quit "The given filename is not a gunzipped tarball. The file name must be of the form glustermg-version.war.tar.gz" ${TAR_ERR} + fi +} + +function get_GMG_VERSION() +{ + # Format is /path/to/glustermg-version.war.tar.gz + # Remove prefix + PART1=${GMG_ARCHIVE_PATH#*glustermg-} + # Remove suffix + GMG_VERSION=${PART1%.war.tar.gz} + + GMG_HOME_DIR="${GMG_HOME_DIR}/${GMG_VERSION}"; +} + +function check_tomcat_dir() +{ + WEBAPPS_DIR="${TOMCAT_DIR}/webapps/" + if [ ! -d "${WEBAPPS_DIR}" ]; then + quit "There is no webapps directory in [${TOMCAT_DIR}]." ${TOMCAT_ERR} + fi + TOMCAT_BIN=$(basename /usr/sbin/tomcat* ); +} + +function check_java_version() +{ + java -version 2>/dev/null || quit "java command not available. Please make sure that Java >=1.6.0 is installed and is present in \$PATH" ${JAVA_ERR} + JAVA_VERSION=`java -version 2>&1 |awk 'NR==1{ gsub(/"/,""); gsub(/_.*/, ""); print $3 }'` + MINVERSION=1.6 + + if expr $JAVA_VERSION \>= $MINVER > /dev/null; then + echo "Found java version [${JAVA_VERSION}]" + else + quit "Java minimum version expected [${MINVER}], found [${JAVA_VERSION}]!" ${JAVA_ERR} + fi +} + +function install_gmg() +{ + tar -xvf ${GMG_ARCHIVE_PATH} -C ${GMG_HOME_DIR} + ln -fs ${GMG_HOME_DIR}/glustermg ${WEBAPPS_DIR} +} + +#----------------------------------- +# Main Action Body +#----------------------------------- + +if [ "x$1" == "x" ] || [ "x$1$2" == "x$1" ] || [ $# -gt 2 ]; then + echo "Usage: $0 <path to glustermg-version.war.tar.gz> <path to tomcat directory>"; + exit 1; +fi + +GMG_ARCHIVE_PATH="$1"; +TOMCAT_DIR="$2"; + +check_tomcat_dir +check_java_version +check_tar_gz +get_GMG_VERSION + +make_dirs +install_gmg + +configure_server +post_install diff --git a/build/junit-buckminster.commands b/build/junit-buckminster.commands index bfd7a320..6f604a74 100755 --- a/build/junit-buckminster.commands +++ b/build/junit-buckminster.commands @@ -1,3 +1,23 @@ +#------------------------------------------------------------------ +# Copyright (c) 2006-2011 Gluster, Inc. <http://www.gluster.com> +# This file is part of GlusterFS. +# +# Gluster Management Console is free software; you can redistribute +# it and/or modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# GlusterFS 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 +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +# <http://www.gnu.org/licenses/>. +#------------------------------------------------------------------ + +# Buckminster commands for JUnit test run importtarget --active gmc-target/com.gluster.storage.management.console.target/gmc.target import build/com.gluster.storage.management.core.cquery diff --git a/build/package-backend.sh b/build/package-backend.sh index f9fc57be..93fb7542 100755 --- a/build/package-backend.sh +++ b/build/package-backend.sh @@ -1,3 +1,24 @@ +#!/bin/bash + +#------------------------------------------------------------------ +# Copyright (c) 2006-2011 Gluster, Inc. <http://www.gluster.com> +# This file is part of GlusterFS. +# +# Gluster Management Gateway is free software; you can redistribute +# it and/or modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# GlusterFS 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 +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +# <http://www.gnu.org/licenses/>. +#------------------------------------------------------------------ + ROOT_DIR=glustermg-backend-${VERSION} DIR_NAME=${ROOT_DIR}/gmg-scripts TAR_NAME=${ROOT_DIR}.tar diff --git a/build/package-gateway.sh b/build/package-gateway.sh index bce436d9..2a50855c 100755 --- a/build/package-gateway.sh +++ b/build/package-gateway.sh @@ -1,3 +1,24 @@ +#!/bin/bash + +#------------------------------------------------------------------ +# Copyright (c) 2006-2011 Gluster, Inc. <http://www.gluster.com> +# This file is part of GlusterFS. +# +# Gluster Management Gateway is free software; you can redistribute +# it and/or modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# GlusterFS 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 +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +# <http://www.gnu.org/licenses/>. +#------------------------------------------------------------------ + WAR_NAME="glustermg.war" WAR_SCRIPTS_DIR=${WAR_NAME}/scripts NEW_WAR_NAME="glustermg" diff --git a/src/com.gluster.storage.management.console.feature.webstart/build/gluster.keystore b/src/com.gluster.storage.management.console.feature.webstart/build/gluster.keystore Binary files differdeleted file mode 100644 index ee3bc3a9..00000000 --- a/src/com.gluster.storage.management.console.feature.webstart/build/gluster.keystore +++ /dev/null diff --git a/src/com.gluster.storage.management.console.feature.webstart/build/glustermc.ant b/src/com.gluster.storage.management.console.feature.webstart/build/glustermc.ant index 6b0152f6..93bf3ccb 100644 --- a/src/com.gluster.storage.management.console.feature.webstart/build/glustermc.ant +++ b/src/com.gluster.storage.management.console.feature.webstart/build/glustermc.ant @@ -12,7 +12,7 @@ </target> <target name="sign"> - <signjar alias="gluster" storepass="gluster" keypass="gluster" keystore="/var/lib/jenkins/gmc/gluster.keystore"> + <signjar alias="gluster" storepass="gluster" keypass="gluster" keystore="${jar.signing.keystore}"> <fileset dir="${export.dir}/plugins"> <include name="*.jar" /> </fileset> diff --git a/src/com.gluster.storage.management.gateway.scripts/src/backend/format_device.py b/src/com.gluster.storage.management.gateway.scripts/src/backend/format_device.py index 5cdfd1c9..8630635c 100755 --- a/src/com.gluster.storage.management.gateway.scripts/src/backend/format_device.py +++ b/src/com.gluster.storage.management.gateway.scripts/src/backend/format_device.py @@ -5,6 +5,7 @@ import os import sys +import stat p1 = os.path.abspath(os.path.dirname(sys.argv[0])) p2 = "%s/common" % os.path.dirname(p1) if not p1 in sys.path: @@ -15,10 +16,11 @@ import Globals import Utils import DiskUtils +SIZE_TB_16 = 17179869184L def main(): if Utils.runCommand("wget -t 1 -T 1 -q -O /dev/null %s" % Globals.AWS_WEB_SERVICE_URL) == 0: - sys.stderr.write("format device unsupported") + sys.stderr.write("format device unsupported\n") sys.exit(1) if len(sys.argv) != 4: @@ -28,37 +30,52 @@ def main(): fsType = sys.argv[1] mountPoint = sys.argv[2] device = DiskUtils.getDevice(sys.argv[3]) + deviceName = DiskUtils.getDeviceName(sys.argv[3]) + + if not os.path.exists(device): + sys.stderr.write("device %s not found\n" % sys.argv[3]) + sys.exit(2) + + try: + if not stat.S_ISBLK(os.stat(device).st_mode): + sys.stderr.write("%s is not a block device\n" % sys.argv[3]) + sys.exit(3) + except OSError, e: + Utils.log("unable to get device %s mode: %s" % (device, str(e))) + sys.stderr.write("unable to get device %s mode\n" % sys.argv[3]) + sys.exit(-2) + + if fsType in ['ext3', 'ext4', 'ext4dev']: + deviceSize = DiskUtils.getProcPartitions()[deviceName]['Size'] + if deviceSize >= SIZE_TB_16: + Utils.log("device %s, size %s is greater than %s size for fstype %s" % (device, deviceSize, SIZE_TB_16, fsType)) + sys.stderr.write("size of device %s is unsupported for fstype %s\n" % (sys.argv[3], fsType)) + sys.exit(4) if DiskUtils.isDataDiskPartitionFormatted(device): - Utils.log("device %s already formatted" % device) sys.stderr.write("device %s already formatted\n" % sys.argv[3]) - sys.exit(2) + sys.exit(5) if os.path.exists(mountPoint): if not os.path.isdir(mountPoint): - Utils.log("mount point %s exists but not a directory" % mountPoint) sys.stderr.write("mount point %s exists but not a directory" % mountPoint) - sys.exit(3) + sys.exit(6) procMounts = Utils.readFile("/proc/mounts") if procMounts.find(" %s " % mountPoint) != -1: - Utils.log("mount point %s already has a mount" % mountPoint) sys.stderr.write("mount point %s already has a mount\n" % mountPoint) - sys.exit(4) + sys.exit(7) if procMounts.find(" %s/" % mountPoint) != -1: - Utils.log("mount point %s has a submount" % mountPoint) sys.stderr.write("mount point %s has a submount\n" % mountPoint) - sys.exit(5) + sys.exit(8) else: status = Utils.runCommand("mkdir -p %s" % mountPoint, output=True, root=True) if status["Status"] != 0: - Utils.log("failed to create mount point %s" % mountPoint) sys.stderr.write("failed to create mount point %s\n" % mountPoint) - sys.exit(6) + sys.exit(9) if fsType not in Utils.getFileSystemType(): - Utils.log("invalid file system type %s" % fsType) - sys.stderr.write("invalid file system type %s\n" % fsType) - sys.exit(7) + sys.stderr.write("unsupported file system type %s\n" % fsType) + sys.exit(10) deviceFormatLockFile = Utils.getDeviceFormatLockFile(device) deviceFormatStatusFile = Utils.getDeviceFormatStatusFile(device) @@ -69,18 +86,18 @@ def main(): line = Utils.readFile(deviceFormatStatusFile) if not line: sys.stderr.write("failed to read format status file %s\n" % deviceFormatStatusFile) - sys.exit(-2) + sys.exit(-3) if line.strip().upper() == "COMPLETED": sys.stderr.write("Device %s already formatted\n" % sys.argv[3]) - sys.exit(8) + sys.exit(11) else: sys.stderr.write("Formatting device %s already running\n" % sys.argv[3]) - sys.exit(9) + sys.exit(12) if os.path.exists(deviceFormatLockFile): Utils.log("lock file %s exists" % deviceFormatLockFile) sys.stderr.write("Formatting device %s already running\n" % sys.argv[3]) - sys.exit(10) + sys.exit(13) command = ["%s/format_device_background.py" % p1, fsType, mountPoint, sys.argv[3]] Utils.runCommandBG(command) diff --git a/src/com.gluster.storage.management.gateway.scripts/src/backend/get_filesystem_type.py b/src/com.gluster.storage.management.gateway.scripts/src/backend/get_filesystem_type.py index 00cb3a59..de4b4bb0 100755 --- a/src/com.gluster.storage.management.gateway.scripts/src/backend/get_filesystem_type.py +++ b/src/com.gluster.storage.management.gateway.scripts/src/backend/get_filesystem_type.py @@ -13,8 +13,10 @@ if not p2 in sys.path: sys.path.append(p2) import Utils +SUPPORTED_FSTYPE = ['ext3', 'ext4', 'ext4dev', 'xfs'] + def main(): - print "\n".join(Utils.getFileSystemType()) + print "\n".join(list(set(Utils.getFileSystemType()).intersection(set(SUPPORTED_FSTYPE)))) if __name__ == "__main__": main() diff --git a/src/com.gluster.storage.management.gateway.scripts/src/backend/get_server_details.py b/src/com.gluster.storage.management.gateway.scripts/src/backend/get_server_details.py index be1e38e6..26b9059a 100755 --- a/src/com.gluster.storage.management.gateway.scripts/src/backend/get_server_details.py +++ b/src/com.gluster.storage.management.gateway.scripts/src/backend/get_server_details.py @@ -163,7 +163,10 @@ def getDiskDom(): partitionTag.appendChild(diskDom.createTag("name", partName)) partitionTag.appendChild(diskDom.createTag("uuid", partValues["Uuid"])) partitionTag.appendChild(diskDom.createTag("fsType", partValues["FsType"])) - if partValues["FsType"]: + if partValues["MountPoint"] and partValues["MountPoint"] in ["/", "/boot"]: + partitionTag.appendChild(diskDom.createTag("status", "INITIALIZED")) + partitionTag.appendChild(diskDom.createTag("type", "BOOT")) + elif partValues["FsType"]: partitionTag.appendChild(diskDom.createTag("status", "INITIALIZED")) partitionTag.appendChild(diskDom.createTag("type", "DATA")) else: |