diff options
| author | Selvasundaram <selvam@gluster.com> | 2011-08-17 20:57:21 +0530 |
|---|---|---|
| committer | Selvasundaram <selvam@gluster.com> | 2011-08-17 20:57:21 +0530 |
| commit | 383c7271a0a91310bd2eb55e24a548daf912b854 (patch) | |
| tree | cef4d1db2de393b151aa7beead7fec90e51679ad /src | |
| parent | 541ee69293c434ded70f26027b48352b560aba0a (diff) | |
| parent | 11517e925780a8e69ac98080ec1d0eff3f230e71 (diff) | |
Merge branch 'master' of github.com:gluster/console
Diffstat (limited to 'src')
20 files changed, 119 insertions, 554 deletions
diff --git a/src/com.gluster.storage.management.console/icons/tango/32x32/add-brick-disabled.png b/src/com.gluster.storage.management.console/icons/tango/32x32/add-brick-disabled.png Binary files differnew file mode 100644 index 00000000..925c8b44 --- /dev/null +++ b/src/com.gluster.storage.management.console/icons/tango/32x32/add-brick-disabled.png diff --git a/src/com.gluster.storage.management.console/icons/tango/32x32/remove-server-disabled.png b/src/com.gluster.storage.management.console/icons/tango/32x32/remove-server-disabled.png Binary files differnew file mode 100644 index 00000000..3f31d216 --- /dev/null +++ b/src/com.gluster.storage.management.console/icons/tango/32x32/remove-server-disabled.png diff --git a/src/com.gluster.storage.management.console/icons/tango/32x32/remove-volume-disabled.png b/src/com.gluster.storage.management.console/icons/tango/32x32/remove-volume-disabled.png Binary files differnew file mode 100644 index 00000000..5eb09cfd --- /dev/null +++ b/src/com.gluster.storage.management.console/icons/tango/32x32/remove-volume-disabled.png diff --git a/src/com.gluster.storage.management.console/icons/tango/32x32/reset-volume-option-disabled.png b/src/com.gluster.storage.management.console/icons/tango/32x32/reset-volume-option-disabled.png Binary files differnew file mode 100644 index 00000000..c4c955f5 --- /dev/null +++ b/src/com.gluster.storage.management.console/icons/tango/32x32/reset-volume-option-disabled.png diff --git a/src/com.gluster.storage.management.console/icons/tango/32x32/volume-rebalance-disabled.png b/src/com.gluster.storage.management.console/icons/tango/32x32/volume-rebalance-disabled.png Binary files differnew file mode 100644 index 00000000..35d49af7 --- /dev/null +++ b/src/com.gluster.storage.management.console/icons/tango/32x32/volume-rebalance-disabled.png diff --git a/src/com.gluster.storage.management.console/plugin.xml b/src/com.gluster.storage.management.console/plugin.xml index 9cadd537..6fb95258 100644 --- a/src/com.gluster.storage.management.console/plugin.xml +++ b/src/com.gluster.storage.management.console/plugin.xml @@ -427,6 +427,7 @@ allowLabelUpdate="false" class="com.gluster.storage.management.console.actions.DeleteVolumeAction" definitionId="com.gluster.storage.management.console.commands.DeleteVolume" + disabledIcon="icons/tango/32x32/remove-volume-disabled.png" icon="icons/tango/32x32/remove-volume.png" id="com.gluster.storage.management.console.actions.DeleteVolumeAction" label="&Delete Volume(s)" @@ -538,6 +539,7 @@ allowLabelUpdate="false" class="com.gluster.storage.management.console.actions.DeleteVolumeAction" definitionId="com.gluster.storage.management.console.commands.DeleteVolume" + disabledIcon="icons/tango/32x32/remove-volume-disabled.png" icon="icons/tango/32x32/remove-volume.png" id="com.gluster.storage.management.console.actions.DeleteVolumeAction" label="&Delete Volume" @@ -568,6 +570,7 @@ allowLabelUpdate="false" class="com.gluster.storage.management.console.actions.ResetVolumeOptionsAction" definitionId="com.gluster.storage.management.console.commands.ResetVolumeOptions" + disabledIcon="icons/tango/32x32/reset-volume-option-disabled.png" icon="icons/tango/32x32/reset-volume-option.png" id="com.gluster.storage.management.console.actions.ResetVolumeOptionsAction" label="Reset &Options" @@ -583,6 +586,7 @@ allowLabelUpdate="false" class="com.gluster.storage.management.console.actions.RebalanceVolumeAction" definitionId="com.gluster.storage.management.console.commands.RebalanceVolume" + disabledIcon="icons/tango/32x32/volume-rebalance-disabled.png" icon="icons/tango/32x32/volume-rebalance.png" id="com.gluster.storage.management.console.actions.RebalanceVolumeAction" label="&Rebalance Volume" @@ -646,6 +650,7 @@ allowLabelUpdate="false" class="com.gluster.storage.management.console.actions.AddBrickAction" definitionId="com.gluster.storage.management.console.commands.AddDisk" + disabledIcon="icons/tango/32x32/add-brick-disabled.png" icon="icons/tango/32x32/add-brick.png" id="com.gluster.storage.management.console.actions.AddDiskAction" label="&Add Brick" @@ -705,6 +710,7 @@ allowLabelUpdate="false" class="com.gluster.storage.management.console.actions.RemoveServerAction" definitionId="com.gluster.storage.management.console.commands.RemoveServer" + disabledIcon="icons/tango/32x32/remove-server-disabled.png" icon="icons/tango/32x32/remove-server.png" id="com.gluster.storage.management.console.actions.RemoveServerAction" label="&Remove Server(s)" @@ -763,6 +769,7 @@ allowLabelUpdate="false" class="com.gluster.storage.management.console.actions.RemoveServerAction" definitionId="com.gluster.storage.management.console.commands.RemoveServer" + disabledIcon="icons/tango/32x32/remove-server-disabled.png" icon="icons/tango/32x32/remove-server.png" id="com.gluster.storage.management.console.actions.RemoveServerAction" label="&Remove Server(s)" diff --git a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/dialogs/LoginDialog.java b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/dialogs/LoginDialog.java index cbb23367..4bbcb36b 100644 --- a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/dialogs/LoginDialog.java +++ b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/dialogs/LoginDialog.java @@ -157,9 +157,8 @@ public class LoginDialog extends Dialog { @Override protected Control createDialogArea(Composite parent) { parent.setBackgroundImage(guiHelper.getImage(IImageKeys.DIALOG_SPLASH_IMAGE)); - parent.setBackgroundMode(SWT.INHERIT_FORCE); // Makes sure that child - // composites inherit - // the same background + // Makes sure that child composites inherit the same background + parent.setBackgroundMode(SWT.INHERIT_FORCE); composite = (Composite) super.createDialogArea(parent); configureDialogLayout(composite); @@ -178,6 +177,7 @@ public class LoginDialog extends Dialog { @Override protected void createButtonsForButtonBar(Composite parent) { configureButtonCompositeLayout(parent); + GridData layoutData = new GridData(390, 130); layoutData.horizontalAlignment = SWT.CENTER; layoutData.verticalAlignment = SWT.TOP; @@ -186,20 +186,20 @@ public class LoginDialog extends Dialog { layoutData = new GridData(); layoutData.widthHint = 70; - layoutData.horizontalAlignment = SWT.LEFT; - layoutData.grabExcessHorizontalSpace = true; - - okButton = createButton(parent, IDialogConstants.OK_ID, "&Login", true); - okButton.setLayoutData(layoutData); - - layoutData = new GridData(); - layoutData.widthHint = 70; layoutData.horizontalAlignment = SWT.RIGHT; layoutData.grabExcessHorizontalSpace = true; Button cancelButton = createButton(parent, IDialogConstants.CANCEL_ID, "&Cancel", false); cancelButton.setLayoutData(layoutData); + layoutData = new GridData(); + layoutData.widthHint = 70; + layoutData.horizontalAlignment = SWT.LEFT; + layoutData.grabExcessHorizontalSpace = true; + + okButton = createButton(parent, IDialogConstants.OK_ID, "&Login", true); + okButton.setLayoutData(layoutData); + setupDataBinding(); } diff --git a/src/com.gluster.storage.management.gateway.scripts/src/backend/Commands.py b/src/com.gluster.storage.management.gateway.scripts/src/backend/Commands.py deleted file mode 100644 index c728b565..00000000 --- a/src/com.gluster.storage.management.gateway.scripts/src/backend/Commands.py +++ /dev/null @@ -1,78 +0,0 @@ -COMMAND_CREATE_VOLUME = "create-volume" -COMMAND_DELETE_VOLUME = "delete-volume" -COMMAND_START_VOLUME = "start-volume" -COMMAND_STOP_VOLUME = "stop-volume" -COMMAND_GET_VOLUME_HEALTH_STATUS = "get-volume-health-status" -COMMAND_GET_VOLUME_LIST = "get-volume-list" -COMMAND_GET_VOLUME_LOG = "get-volume-log" -COMMAND_CLEAR_VOLUME_LOGS = "clear-volume-logs" -COMMAND_GET_VOLUME_PROPERTY = "get-volume-property" -COMMAND_SET_VOLUME_PROPERTY = "set-volume-property" -COMMAND_GET_VOLUME_STATUS = "get-volume-status" -COMMAND_DOWNLOAD_VOLUME_LOGS = "download-volume-logs" -COMMAND_DELETE_SERVER = "delete-server" -COMMAND_GET_SERVER_DATE = "get-server-date" -COMMAND_GET_SERVER_VERSION_INFO = "get-server-version-info" -COMMAND_GET_INSTALLER_INFO = "get-installer-info" -COMMAND_GET_SERVER_LIST = "get-server-list" -COMMAND_GET_SERVER_SERVICE_STATUS = "get-server-service-status" -COMMAND_GET_STORAGE_SERVER_POOL_INFO = "get-storage-server-pool-info" -COMMAND_INSTALL_SERVER_BACKGROUND = "install-server-background" -COMMAND_PREPARE_DATA_DISK_BACKGROUND = "prepare-data-disk-background" -COMMAND_SET_SERVER_DATE = "set-server-date" -COMMAND_SET_SERVER_NETWORK_CONFIG = "set-server-network-config" -COMMAND_SET_STORAGE_SERVER_POOL_INFO = "set-storage-server-pool-info" -COMMAND_GET_SERVER_NETWORK_CONFIG = "get-server-network-config" -COMMAND_INSTALL_SERVER_STATUS = "install-server-status" -COMMAND_GET_SERVER_DISK_LIST = "get-server-disk-list" -COMMAND_PREPARE_DATA_DISK_STATUS = "prepare-data-disk-status" -COMMAND_GET_SERVER_SYSTEM_RESOURCE = "get-server-system-resource" -COMMAND_GET_SERVER_RESOURCE_RRD = "get-server-resource-rrd" -COMMAND_RUN_SERVER_SERVICE = "run-server-service" -COMMAND_SHUTDOWN_SERVER = "shutdown-server" -COMMAND_GET_SERVER_STATUS = "get-server-status" -COMMAND_GET_SERVER_LOG = "get-server-log" -COMMAND_DOWNLOAD_SERVER_LOGS = "download-server-logs" -COMMAND_CLEAR_SERVER_LOGS = "clear-server-logs" -COMMAND_GET_SERVER_RESOURCE_RRD = "get-server-resource-rrd" -COMMAND_GET_GSN_USER_INFO = "get-gsn-user-info" -COMMAND_SET_GSN_USER_INFO = "set-gsn-user-info" -COMMAND_GET_GLUSTER_UPDATE_INFO = "get-gluster-update-info" -COMMAND_DOWNLOAD_GLUSTER_UPDATE_BACKGROUND = "download-gluster-update-background" -COMMAND_DOWNLOAD_GLUSTER_UPDATE_STATUS = "download-gluster-update-status" -COMMAND_INSTALL_GLUSTER_UPDATE = "install-gluster-update" -COMMAND_EXPORT_CONFIG = "export-config" -COMMAND_IMPORT_CONFIG = "import-config" -COMMAND_SET_SYSTEM_PASSWORD = "set-system-password" -COMMAND_GET_SERVER_VOLUME_LIST = "get-server-volume-list" -COMMAND_RECONFIGURE_VOLUME = "reconfigure-volume" -COMMAND_SET_SERVER_DIRECTORY_SERVICE_CONFIG = "set-server-directory-service-config" -COMMAND_GET_SERVER_DIRECTORY_SERVICE_CONFIG = "get-server-directory-service-config" -COMMAND_JOIN_SERVER_TO_DIRECTORY_SERVICE = "join-server-to-directory-service" -COMMAND_SET_SERVER_TIME_CONFIG = "set-server-time-config" -COMMAND_GET_SERVER_TIME_CONFIG = "get-server-time-config" -COMMAND_LOGIN = "login" -COMMAND_LOGOUT = "logout" -COMMAND_GET_LOGIN_STATUS = "get-login-status" -COMMAND_GET_SERVER_TRANSPORT_LIST = "get-server-transport-list" -COMMAND_ADD_SERVER_PARTITION = "add-server-partition" -COMMAND_ADD_VOLUME_USER = "add-volume-user" -COMMAND_GET_PARTITION_VOLUME_LIST = "get-partition-volume-list" -COMMAND_GET_VOLUME_USER_INFO = "get-volume-user-info" -COMMAND_GET_VOLUME_USER_LIST = "get-volume-user-list" -COMMAND_MIGRATE_PARTITION_BACKGROUND = "migrate-partition-background" -COMMAND_MIGRATE_PARTITION_STATUS = "migrate-partition-status" -COMMAND_MIGRATE_VOLUME_SERVER_PARTITION_BACKGROUND = "migrate-volume-server-partition-background" -COMMAND_MIGRATE_VOLUME_SERVER_PARTITION_STATUS = "migrate-volume-server-partition-status" -COMMAND_REMOVE_SERVER_PARTITION = "remove-server-partition" -COMMAND_REMOVE_VOLUME_USER = "remove-volume-user" -COMMAND_RENAME_VOLUME_USER = "rename-volume-user" -COMMAND_RENAME_VOLUME = "rename-volume" -COMMAND_RUN_SERVER_SERVICE = "run-server-service" -COMMAND_SET_VOLUME_USER_PASSWORD = "set-volume-user-password" -COMMAND_STOP_PARTITION_MIGRATION = "stop-partition-migration" -COMMAND_STOP_VOLUME_SERVER_PARTITION_MIGRATION = "stop-volume-server-partition-migration" -COMMAND_GET_SERVER_DISK_INFO = "get-server-disk-info" -COMMAND_INITIALIZE_SERVER_DISK = "initialize-server-disk" -COMMAND_SET_SERVER_COUNT = "set-server-count" -COMMAND_GET_SERVER_COUNT = "get-server-count" diff --git a/src/com.gluster.storage.management.gateway.scripts/src/backend/DiskUtils.py b/src/com.gluster.storage.management.gateway.scripts/src/backend/DiskUtils.py index 341c9083..deebb388 100644 --- a/src/com.gluster.storage.management.gateway.scripts/src/backend/DiskUtils.py +++ b/src/com.gluster.storage.management.gateway.scripts/src/backend/DiskUtils.py @@ -1,21 +1,16 @@ -# Copyright (c) 2010 Gluster, Inc. <http://www.gluster.com> -# This file is part of Gluster Storage Platform. +#!/usr/bin/python +# Copyright (C) 2011 Gluster, Inc. <http://www.gluster.com> +# This file is part of Gluster Management Gateway. # -# Gluster Storage Platform 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. -# -# Gluster Storage Platform 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/>. import os +import sys +p1 = os.path.abspath(os.path.dirname(sys.argv[0])) +p2 = "%s/common" % os.path.dirname(p1) +if not p1 in sys.path: + sys.path.append(p1) +if not p2 in sys.path: + sys.path.append(p2) import glob from copy import deepcopy import dbus @@ -24,7 +19,7 @@ import time import Utils import Disk import Protocol -from FsTabUtils import * +import FsTabUtils ONE_MB_SIZE = 1048576 @@ -113,7 +108,7 @@ def readFile(fileName): def getRootPartition(fsTabFile=Globals.FSTAB_FILE): - fsTabEntryList = readFsTab(fsTabFile) + fsTabEntryList = FsTabUtils.readFsTab(fsTabFile) for fsTabEntry in fsTabEntryList: if fsTabEntry["MountPoint"] == "/": if fsTabEntry["Device"].startswith("UUID="): @@ -384,39 +379,6 @@ def getDiskInfo(diskDeviceList=None): def getDiskList(diskDeviceList=None): return diskInfo["disks"] -def readFsTab(fsTabFile=Globals.FSTAB_FILE): - try: - fsTabfp = open(fsTabFile) - except IOError, e: - Utils.log("readFsTab(): " + str(e)) - return None - - fsTabEntryList = [] - for line in fsTabfp: - tokens = line.strip().split() - if not tokens or tokens[0].startswith('#'): - continue - fsTabEntry = {} - fsTabEntry["Device"] = None - fsTabEntry["MountPoint"] = None - fsTabEntry["FsType"] = None - fsTabEntry["Options"] = None - fsTabEntry["DumpOption"] = 0 - fsTabEntry["fsckOrder"] = 0 - try: - fsTabEntry["Device"] = tokens[0] - fsTabEntry["MountPoint"] = tokens[1] - fsTabEntry["FsType"] = tokens[2] - fsTabEntry["Options"] = tokens[3] - fsTabEntry["DumpOption"] = tokens[4] - fsTabEntry["fsckOrder"] = tokens[5] - except IndexError: - pass - if fsTabEntry["Device"] and fsTabEntry["MountPoint"] and fsTabEntry["FsType"] and fsTabEntry["Options"]: - fsTabEntryList.append(fsTabEntry) - fsTabfp.close() - return fsTabEntryList - def checkDiskMountPoint(diskMountPoint): try: @@ -533,7 +495,7 @@ def isDataDiskPartitionFormatted(device): if not uuid: return False - for fsTabEntry in readFsTab(): + for fsTabEntry in FsTabUtils.readFsTab(): if fsTabEntry["Device"] == ("UUID=%s" % uuid) and fsTabEntry["MountPoint"] == mountPoint: return True return False @@ -782,156 +744,6 @@ def isDiskInFormat(device): return isDataDiskPartitionFormatted(device) -def diskOrder(serverExportList): - newServerExportList = [] - while serverExportList: - serverExport = deepcopy(serverExportList[0]) - if newServerExportList and serverExport.split(":")[0] == newServerExportList[-1].split(":")[0]: - inserted = False - for i in range(0, len(newServerExportList) - 1): - if serverExport.split(":")[0] == newServerExportList[i].split(":")[0]: - continue - if i == 0: - newServerExportList.insert(i, serverExport) - inserted = True - break - if serverExport.split(":")[0] == newServerExportList[i - 1].split(":")[0]: - continue - newServerExportList.insert(i, serverExport) - inserted = True - break - if not inserted: - newServerExportList.append(serverExport) - else: - newServerExportList.append(serverExport) - serverExportList.remove(serverExport) - i = 0 - while serverExportList and i < len(serverExportList): - if serverExport.split(":")[0] == serverExportList[i].split(":")[0]: - i += 1 - continue - serverExport = deepcopy(serverExportList[i]) - newServerExportList.append(serverExport) - serverExportList.remove(serverExport) - return newServerExportList - - -def updateServerDiskConfig(serverName, diskDom, requestFlag=True, partitionFlag=True): - command = "command.server." - if not requestFlag: - command = "" - diskList = {} - for tagE in diskDom.getElementsByTagRoute(command + "disk"): - diskList[diskDom.getTextByTagRoute(command + "device")] = tagE - configDom = XDOM() - if not configDom.parseFile("%s/%s/disk.xml" % (Globals.SERVER_VOLUME_CONF_DIR, serverName)): - return diskDom.writexml("%s/%s/disk.xml" % (Globals.SERVER_VOLUME_CONF_DIR, serverName)) - diskTag = configDom.getElementsByTagRoute("disks.disk") - disks = configDom.getElementsByTagRoute("disks") - if not (diskTag or disks): - return None - for tagE in diskTag: - diskDom = XDOM() - diskDom.setDomObj(tagE) - device = diskDom.getTextByTagRoute("device") - if partitionFlag and device in diskList: - disks[0].removeChild(tagE) - disks[0].appendChild(deepcopy(diskList[device])) - continue - if not partitionFlag and device in diskList: - partitionList = [] - for childNodeTag in tagE.childNodes: - if childNodeTag.nodeName == 'partition': - partitionList.append(childNodeTag) - tagE.childNodes = [] - tagE.childNodes = diskList[device].childNodes + partitionList - return configDom.writexml("%s/%s/disk.xml" % (Globals.SERVER_VOLUME_CONF_DIR, serverName)) - - -def compareDisksDom(diskDomA, diskDomB, requestFlag=True): - command = "command.server.disk." - if not requestFlag: - command = "" - sourceDiskList = {} - sourceDisk = {} - for tagE in diskDomA.getElementsByTagRoute("disk"): - sourceDisk["description"] = diskDomA.getTextByTagRoute("description") - sourceDisk["size"] = diskDomA.getTextByTagRoute("size") - sourceDisk["init"] = diskDomA.getTextByTagRoute("init") - sourceDisk["interface"] = diskDomA.getTextByTagRoute("interface") - sourceDiskList[diskDomA.getTextByTagRoute("device")] = sourceDisk - objDiskList = {} - objDisk = {} - for tagE in diskDomB.getElementsByTagRoute("disk"): - objDisk["description"] = diskDomB.getTextByTagRoute("description") - objDisk["size"] = diskDomB.getTextByTagRoute("size") - objDisk["init"] = diskDomB.getTextByTagRoute("init") - objDisk["interface"] = diskDomB.getTextByTagRoute("interface") - objDiskList[diskDomB.getTextByTagRoute("device")] = objDisk - return sourceDiskList == objDiskList - - -def compareDiskDom(diskDomA, diskDomB, requestFlag=True): - command = "command.server.disk." - if not requestFlag: - command = "" - sourceDisk = {} - sourceDisk["device"] = diskDomA.getTextByTagRoute("device") - sourceDisk["description"] = diskDomA.getTextByTagRoute("description") - sourceDisk["size"] = diskDomA.getTextByTagRoute("size") - sourceDisk["init"] = diskDomA.getTextByTagRoute("init") - sourceDisk["interface"] = diskDomA.getTextByTagRoute("interface") - for tagE in diskDomA.getElementsByTagRoute("partition"): - sourceDiskPartitions = {} - partitionDom = XDOM() - partitionDom.setDomObj(tagE) - sourceDiskPartitions["size"] = partitionDom.getTextByTagRoute("size") - #sourceDiskPartitions["free"] = partitionDom.getTextByTagRoute("free") - sourceDiskPartitions["format"] = partitionDom.getTextByTagRoute("format") - sourceDiskPartitions["uuid"] = partitionDom.getTextByTagRoute("uuid") - sourceDisk[partitionDom.getTextByTagRoute("device")] = sourceDiskPartitions - - objDisk = {} - objDisk["device"] = diskDomB.getTextByTagRoute(command + "device") - objDisk["description"] = diskDomB.getTextByTagRoute(command + "description") - objDisk["size"] = diskDomB.getTextByTagRoute(command + "size") - objDisk["init"] = diskDomB.getTextByTagRoute(command + "init") - objDisk["interface"] = diskDomB.getTextByTagRoute(command + "interface") - for tagE in diskDomB.getElementsByTagRoute(command + "partition"): - objDiskPartitions = {} - partitionDom = XDOM() - partitionDom.setDomObj(tagE) - objDiskPartitions["size"] = partitionDom.getTextByTagRoute("size") - #objDiskPartitions["free"] = partitionDom.getTextByTagRoute("free") - objDiskPartitions["format"] = partitionDom.getTextByTagRoute("format") - objDiskPartitions["uuid"] = partitionDom.getTextByTagRoute("uuid") - objDisk[partitionDom.getTextByTagRoute("device")] = objDiskPartitions - return sourceDisk == objDisk - - -def getServerConfigDiskDom(serverName, diskName=None): - diskConfigDom = XDOM() - if not diskConfigDom.parseFile("%s/%s/disk.xml" % (Globals.SERVER_VOLUME_CONF_DIR, serverName)): - Utils.log("Unable to parse %s/%s/disk.xml" % (Globals.SERVER_VOLUME_CONF_DIR, serverName)) - return None - diskTag = diskConfigDom.getElementsByTagRoute("disks.disk") - if not diskTag: - Utils.log("Unable to reterive disk information %s/%s/disk.xml" % (Globals.SERVER_VOLUME_CONF_DIR, serverName)) - return None - if diskName: - for tagE in diskTag: - diskDom = XDOM() - diskDom.setDomObj(tagE) - if diskName == diskDom.getTextByTagRoute("device"): - return diskDom - return None - - for tagE in diskTag: - for partitionTag in tagE.getElementsByTagName("partition"): - tagE.removeChild(partitionTag) - return diskConfigDom - - def getDeviceMountPoint(device): try: fp = open("/proc/mounts") diff --git a/src/com.gluster.storage.management.gateway.scripts/src/backend/FsTabUtils.py b/src/com.gluster.storage.management.gateway.scripts/src/backend/FsTabUtils.py index fcac4196..a9adf4de 100644 --- a/src/com.gluster.storage.management.gateway.scripts/src/backend/FsTabUtils.py +++ b/src/com.gluster.storage.management.gateway.scripts/src/backend/FsTabUtils.py @@ -1,20 +1,16 @@ -# Copyright (C) 2010 Gluster, Inc. <http://www.gluster.com> -# This file is part of Gluster Storage Platform. +#!/usr/bin/python +# Copyright (C) 2011 Gluster, Inc. <http://www.gluster.com> +# This file is part of Gluster Management Gateway. # -# Gluster Storage Platform 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. -# -# Gluster Storage Platform 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/>. +import os +import sys +p1 = os.path.abspath(os.path.dirname(sys.argv[0])) +p2 = "%s/common" % os.path.dirname(p1) +if not p1 in sys.path: + sys.path.append(p1) +if not p2 in sys.path: + sys.path.append(p2) import Globals def readFsTab(fsTabFile=Globals.FSTAB_FILE): diff --git a/src/com.gluster.storage.management.gateway.scripts/src/backend/GetServerNetworkConfig.py b/src/com.gluster.storage.management.gateway.scripts/src/backend/GetServerNetworkConfig.py deleted file mode 100644 index 54f68caf..00000000 --- a/src/com.gluster.storage.management.gateway.scripts/src/backend/GetServerNetworkConfig.py +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright (C) 2009 Gluster, Inc. <http://www.gluster.com> -# This file is part of Gluster Storage Platform. -# -# Gluster Storage Platform 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. -# -# Gluster Storage Platform 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/>. - -import os -import sys -p1 = os.path.abspath(os.path.dirname(sys.argv[0])) -p2 = "%s/common" % os.path.dirname(p1) -if not p1 in sys.path: - sys.path.append(p1) -if not p2 in sys.path: - sys.path.append(p2) -import syslog -import Globals -import Commands -import re -from ServerUtils import * -from Protocol import * -from NetworkUtils import * - -def getServerNetworkConfig(requestXml): - serverName = requestXml.getTextByTagRoute("command.server-name") - version = requestXml.getVersion() - messageId = requestXml.getAttribute("id") - - if not serverName: - responseDom = ResponseXml(Commands.COMMAND_GET_SERVER_NETWORK_CONFIG, "No server name given", messageId, version) - responseDom.appendTagRoute("server.name", serverName) - return responseDom - responseDom = ResponseXml(Commands.COMMAND_GET_SERVER_NETWORK_CONFIG, "OK", messageId, version) - serverTag = responseDom.createTag("server", None) - serverTag.appendChild(responseDom.createTag("name", serverName)) - nameServerList, domain, searchDomain = readResolvConfFile() - if domain: - domainName = domain[0] - else: - domainName = None - serverTag.appendChild(responseDom.createTag("domainname", domainName)) - i = 1 - for dns in nameServerList: - serverTag.appendChild(responseDom.createTag("dns%s" % i, dns)) - i += 1 - #TODO: probe and retrieve timezone, ntp-server, preferred-network details and update the tags - configDom = XDOM() - if configDom.parseFile("%s/%s/network.xml" % (Globals.SERVER_CONF_DIR, serverName)): - serverTag.appendChild(responseDom.createTag("timezone", configDom.getTextByTagRoute("network.timezone"))) - serverTag.appendChild(responseDom.createTag("ntp-server", configDom.getTextByTagRoute("network.ntp-server"))) - preferredNetwork = configDom.getTextByTagRoute("network.preferred-network") - if not preferredNetwork: - preferredNetwork = "any" - serverTag.appendChild(responseDom.createTag("preferred-network", preferredNetwork)) - - deviceList = {} - for device in getNetDeviceList(): - deviceList[device["device"]] = device - try: - macAddress = open("/sys/class/net/%s/address" % device["device"]).read().strip() - except IOError: - continue - interfaceTag = responseDom.createTag("interface", None) - interfaceTag.appendChild(responseDom.createTag("device", device["device"])) - interfaceTag.appendChild(responseDom.createTag("description", device["description"])) - interfaceTag.appendChild(responseDom.createTag("hwaddr", macAddress)) - if deviceList[device["device"]]: - if deviceList[device["device"]]["onboot"]: - interfaceTag.appendChild(responseDom.createTag("onboot", "yes")) - else: - interfaceTag.appendChild(responseDom.createTag("onboot", "no")) - interfaceTag.appendChild(responseDom.createTag("bootproto", deviceList[device["device"]]["bootproto"])) - interfaceTag.appendChild(responseDom.createTag("ipaddr", deviceList[device["device"]]["ipaddr"])) - interfaceTag.appendChild(responseDom.createTag("netmask", deviceList[device["device"]]["netmask"])) - interfaceTag.appendChild(responseDom.createTag("gateway", deviceList[device["device"]]["gateway"])) - if deviceList[device["device"]]["mode"]: - interfaceTag.appendChild(responseDom.createTag("mode", deviceList[device["device"]]["mode"])) - if deviceList[device["device"]]["master"]: - interfaceTag.appendChild(responseDom.createTag("bonding", "yes")) - spliter = re.compile(r'[\D]') - interfaceTag.appendChild(responseDom.createTag("bondid", spliter.split(device["master"])[-1])) - else: - interfaceTag.appendChild(responseDom.createTag("onboot", "no")) - interfaceTag.appendChild(responseDom.createTag("bootproto", "none")) - serverTag.appendChild(interfaceTag) - responseDom.appendTag(serverTag) - return responseDom - -def test(): - requestString = """<command request="get-server-network-config" id="123" version="3.1.2.2"> -<server-name>s1</server-name></command>""" - requestDom = RequestXml(requestString) - print getServerNetworkConfig(requestDom).toxml() diff --git a/src/com.gluster.storage.management.gateway.scripts/src/backend/clear_volume_directory.py b/src/com.gluster.storage.management.gateway.scripts/src/backend/clear_volume_directory.py index 029787e5..0f8248d8 100755 --- a/src/com.gluster.storage.management.gateway.scripts/src/backend/clear_volume_directory.py +++ b/src/com.gluster.storage.management.gateway.scripts/src/backend/clear_volume_directory.py @@ -29,24 +29,22 @@ def main(): volumeDirectory = args[0] if not os.path.exists(volumeDirectory): - sys.stderr.write("Given volume directory path:%s does not exists" % volumeDirectory) + sys.stderr.write("Given volume directory path:%s does not exists\n" % volumeDirectory) sys.exit(1) + # trim '/' at the end + if '/' == volumeDirectory[-1]: + volumeDirectory = volumeDirectory[:-1] newVolumeDirectoryName = "%s_%s" % (volumeDirectory, time.time()) - rv = Utils.runCommand("mv -f %s %s" % (volumeDirectory, newVolumeDirectoryName), output=True, root=True) - if rv["Stderr"]: - sys.stderr.write(Utils.stripEmptyLines(rv["Stderr"])) + if Utils.runCommand("mv -f %s %s" % (volumeDirectory, newVolumeDirectoryName), root=True) != 0: + sys.stderr.write("Failed to rename volume directory\n") sys.exit(2) if not options.todelete: sys.exit(0) - rv = Utils.runCommand("rm -fr %s" % newVolumeDirectoryName, output=True, root=True) - if rv["Stderr"]: - sys.stderr.write(Utils.stripEmptyLines(rv["Stderr"])) - sys.exit(3) - - sys.exit(0) + rv = Utils.runCommand("rm -fr %s" % newVolumeDirectoryName, root=True) != 0 + sys.exit(rv) if __name__ == "__main__": main() diff --git a/src/com.gluster.storage.management.gateway.scripts/src/backend/create_volume_directory.py b/src/com.gluster.storage.management.gateway.scripts/src/backend/create_volume_directory.py index e295f249..66354412 100755 --- a/src/com.gluster.storage.management.gateway.scripts/src/backend/create_volume_directory.py +++ b/src/com.gluster.storage.management.gateway.scripts/src/backend/create_volume_directory.py @@ -1,20 +1,8 @@ #!/usr/bin/python -# Copyright (C) 2010 Gluster, Inc. <http://www.gluster.com> -# This file is part of Gluster Storage Platform. +# Copyright (C) 2011 Gluster, Inc. <http://www.gluster.com> +# This file is part of Gluster Management Gateway. # -# Gluster Storage Platform 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. -# -# Gluster Storage Platform 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/>. + import os import sys p1 = os.path.abspath(os.path.dirname(sys.argv[0])) @@ -35,7 +23,7 @@ def createDirectory(disk, volumeName): if not diskUuid: Utils.log("failed to find disk:%s uuid" % disk) rs.appendTagRoute("status.code", "-1") - rs.appendTagRoute("status.message", "Error: Unable to find disk uuid") + rs.appendTagRoute("status.message", "Error: Failed to find disk uuid") return rs.toprettyxml() # Retrieving disk mount point using disk uuid @@ -53,27 +41,17 @@ def createDirectory(disk, volumeName): rs.appendTagRoute("status.code", "-2") rs.appendTagRoute("status.message", "Volume directory already exists!") return rs.toprettyxml() - - if not os.path.exists(volumeDirectory): - command = ["sudo", "mkdir", volumeDirectory] - rv = Utils.runCommandFG(command, stdout=True, root=True) - message = Utils.stripEmptyLines(rv["Stdout"]) - if rv["Stderr"]: - error = Utils.stripEmptyLines(rv["Stderr"]) - message += "Error: [%s]" % (error) - Utils.log("failed to create volume directory %s, %s" % (volumeDirectory, error)) - rs.appendTagRoute("status.code", rv["Status"]) - rs.appendTagRoute("status.message", message) - return rs.toprettyxml() - - if not rv["Status"]: - rv["Status"] = "0" - if rv["Status"] == "0": - message = volumeDirectory + + rv = Utils.runCommand("mkdir %s" % volumeDirectory, output=True, root=True) + if rv["Status"] != 0: rs.appendTagRoute("status.code", rv["Status"]) - rs.appendTagRoute("status.message", message) + rs.appendTagRoute("status.message", "Failed to create volume directory") return rs.toprettyxml() + rs.appendTagRoute("status.code", rv["Status"]) + rs.appendTagRoute("status.message", volumeDirectory) + return rs.toprettyxml() + def main(): if len(sys.argv) != 3: sys.stderr.write("usage: %s <disk name> <volume name>\n" % os.path.basename(sys.argv[0])) diff --git a/src/com.gluster.storage.management.gateway.scripts/src/backend/get_disk_mount_point.py b/src/com.gluster.storage.management.gateway.scripts/src/backend/get_disk_mount_point.py index 2f4a39c3..cf966fec 100755 --- a/src/com.gluster.storage.management.gateway.scripts/src/backend/get_disk_mount_point.py +++ b/src/com.gluster.storage.management.gateway.scripts/src/backend/get_disk_mount_point.py @@ -1,24 +1,18 @@ #!/usr/bin/python -# Copyright (C) 2010 Gluster, Inc. <http://www.gluster.com> -# This file is part of Gluster Storage Platform. +# Copyright (C) 2011 Gluster, Inc. <http://www.gluster.com> +# This file is part of Gluster Management Gateway. # -# Gluster Storage Platform 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. -# -# Gluster Storage Platform 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/>. import os +import sys +p1 = os.path.abspath(os.path.dirname(sys.argv[0])) +p2 = "%s/common" % os.path.dirname(p1) +if not p1 in sys.path: + sys.path.append(p1) +if not p2 in sys.path: + sys.path.append(p2) import Utils -from DiskUtils import * +import FsTabUtils from XmlHandler import ResponseXml @@ -32,7 +26,7 @@ def getmountpoint(path): rs = ResponseXml() mountPoint = None - for line in readFsTab(): + for line in FsTabUtils.readFsTab(): if path.startswith(line['MountPoint']): if not mountPoint: mountPoint = line['MountPoint'] diff --git a/src/com.gluster.storage.management.gateway.scripts/src/backend/get_rrd_cpu_details.py b/src/com.gluster.storage.management.gateway.scripts/src/backend/get_rrd_cpu_details.py index e60d7199..774f8e4e 100755 --- a/src/com.gluster.storage.management.gateway.scripts/src/backend/get_rrd_cpu_details.py +++ b/src/com.gluster.storage.management.gateway.scripts/src/backend/get_rrd_cpu_details.py @@ -14,10 +14,16 @@ if not p2 in sys.path: from XmlHandler import ResponseXml import Utils -def getCpuData(period): - cpuRrdFile = "/var/lib/rrd/cpu.rrd" - rs = ResponseXml() +CPU_RRD_FILE = "/var/lib/rrd/cpu.rrd" + +def main(): + if len(sys.argv) != 2: + sys.stderr.write("usage: %s <PERIOD>\n" % os.path.basename(sys.argv[0])) + sys.exit(-1) + + period = sys.argv[1] + rs = ResponseXml() command = "rrdtool xport --start -%s \ DEF:cpuuser=%s:user:AVERAGE \ DEF:cpusystem=%s:system:AVERAGE \ @@ -29,26 +35,14 @@ def getCpuData(period): CDEF:totalpct=userpct,systempct,+ \ XPORT:userpct:userpct \ XPORT:systempct:systempct \ - XPORT:totalpct:totalpct" % (period, cpuRrdFile, cpuRrdFile, cpuRrdFile) + XPORT:totalpct:totalpct" % (period, CPU_RRD_FILE, CPU_RRD_FILE, CPU_RRD_FILE) rv = Utils.runCommand(command, output=True, root=True) - message = Utils.stripEmptyLines(rv["Stdout"]) - if rv["Stderr"]: - error = Utils.stripEmptyLines(rv["Stderr"]) - message += "Error: [%s]" % (error) - Utils.log("failed to create RRD file for cpu usages %s" % file) + if rv["Status"] != 0: rs.appendTagRoute("status.code", rv["Status"]) - rs.appendTagRoute("status.message", message) - return rs.toxml() - return rv["Stdout"] - -def main(): - if len(sys.argv) != 2: - sys.stderr.write("usage: %s <period>\n" % os.path.basename(sys.argv[0])) - sys.exit(-1) - - period = sys.argv[1] - print getCpuData(period) + rs.appendTagRoute("status.message", "Failed to get RRD data of CPU") + print rs.toxml() + print rv["Stdout"] sys.exit(0) if __name__ == "__main__": diff --git a/src/com.gluster.storage.management.gateway.scripts/src/backend/get_rrd_memory_details.py b/src/com.gluster.storage.management.gateway.scripts/src/backend/get_rrd_memory_details.py index a6dd4987..a9272b1f 100755 --- a/src/com.gluster.storage.management.gateway.scripts/src/backend/get_rrd_memory_details.py +++ b/src/com.gluster.storage.management.gateway.scripts/src/backend/get_rrd_memory_details.py @@ -1,20 +1,7 @@ #!/usr/bin/python -# Copyright (C) 2010 Gluster, Inc. <http://www.gluster.com> -# This file is part of Gluster Storage Platform. +# Copyright (C) 2011 Gluster, Inc. <http://www.gluster.com> +# This file is part of Gluster Management Gateway. # -# Gluster Storage Platform 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. -# -# Gluster Storage Platform 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/>. # Input command: get_rrd_memory_details.py 1hour # OUTPUT as bellow: @@ -54,8 +41,15 @@ import syslog from XmlHandler import ResponseXml import Utils -def getMemData(period): - memRrdFile = "/var/lib/rrd/mem.rrd" +MEMORY_RRD_FILE = "/var/lib/rrd/mem.rrd" + +def main(): + if len(sys.argv) != 2: + sys.stderr.write("usage: %s <PERIOD>\n" % os.path.basename(sys.argv[0])) + sys.exit(-1) + + period = sys.argv[1] + rs = ResponseXml() command = "rrdtool xport --start -%s \ DEF:free=%s:memfree:AVERAGE \ @@ -69,26 +63,14 @@ def getMemData(period): XPORT:free:memoryFree \ XPORT:cache:memoryCache \ XPORT:buffer:memoryBuffer \ - XPORT:total:totalMemory" % (period, memRrdFile, memRrdFile, memRrdFile, memRrdFile) + XPORT:total:totalMemory" % (period, MEMORY_RRD_FILE, MEMORY_RRD_FILE, MEMORY_RRD_FILE, MEMORY_RRD_FILE) rv = Utils.runCommand(command, output=True, root=True) - message = Utils.stripEmptyLines(rv["Stdout"]) - if rv["Stderr"]: - error = Utils.stripEmptyLines(rv["Stderr"]) - message += "Error: [%s]" % (error) - Utils.log("failed to create RRD file for memory usages %s" % file) + if rv["Status"] != 0: rs.appendTagRoute("status.code", rv["Status"]) - rs.appendTagRoute("status.message", message) - return rs.toxml() - return rv["Stdout"] - -def main(): - if len(sys.argv) != 2: - sys.stderr.write("usage: %s <period>\n" % os.path.basename(sys.argv[0])) - sys.exit(-1) - - period = sys.argv[1] - print getMemData(period) + rs.appendTagRoute("status.message", "Failed to get RRD data of memory usage") + print rs.toxml() + print rv["Stdout"] sys.exit(0) if __name__ == "__main__": diff --git a/src/com.gluster.storage.management.gateway.scripts/src/backend/get_rrd_net_details.py b/src/com.gluster.storage.management.gateway.scripts/src/backend/get_rrd_net_details.py index c319c888..f4a7a465 100755 --- a/src/com.gluster.storage.management.gateway.scripts/src/backend/get_rrd_net_details.py +++ b/src/com.gluster.storage.management.gateway.scripts/src/backend/get_rrd_net_details.py @@ -1,20 +1,8 @@ #!/usr/bin/python -# Copyright (C) 2010 Gluster, Inc. <http://www.gluster.com> -# This file is part of Gluster Storage Platform. +# Copyright (C) 2011 Gluster, Inc. <http://www.gluster.com> +# This file is part of Gluster Management Gateway. # -# Gluster Storage Platform 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. -# -# Gluster Storage Platform 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/>. + import os import sys p1 = os.path.abspath(os.path.dirname(sys.argv[0])) @@ -42,14 +30,11 @@ def main(): XPORT:received:received \ XPORT:transmitted:transmitted \ XPORT:total:total" % (period, device, device) + rv = Utils.runCommand(command, output=True, root=True) - message = Utils.stripEmptyLines(rv["Stdout"]) - if rv["Stderr"]: - error = Utils.stripEmptyLines(rv["Stderr"]) - message += "Error: [%s]" % (error) - Utils.log("failed to get RRD information of device %s" % file) + if rv["Status"] != 0: rs.appendTagRoute("status.code", rv["Status"]) - rs.appendTagRoute("status.message", message) + rs.appendTagRoute("status.message", "Failed to get RRD information of device %s" % device) print rs.toxml() print rv["Stdout"] sys.exit(0) 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 ecbe1237..2b353f2a 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 @@ -104,8 +104,8 @@ def getServerDetails(listall): try: diskDom = DiskUtils.getDiskDom() except dbus.dbus_bindings.DBusException, e: - sys.stderr.write("Failed to connect HAL to get device details. Please check if HAL services are running\n") - Utils.log("Failed to connect HAL to get device details") + sys.stderr.write("%s. Please check if HAL services are running\n" % str(e)) + Utils.log("failed to get disk details :%s" % str(e)) sys.exit(1) if not diskDom: sys.stderr.write("No disk found!") diff --git a/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/utils/AbstractStatsFactory.java b/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/utils/AbstractStatsFactory.java index 26b2caa3..d9c12f25 100644 --- a/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/utils/AbstractStatsFactory.java +++ b/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/utils/AbstractStatsFactory.java @@ -103,7 +103,11 @@ public abstract class AbstractStatsFactory implements StatsFactory { Double data = rowData.get(i); if(!data.isNaN()) { // data is available. add it. - aggregatedStatsRowData.set(i, aggregatedStatsRowData.get(i) + data); + Double oldData = aggregatedStatsRowData.get(i); + if(oldData.isNaN()) { + oldData = 0d; + } + aggregatedStatsRowData.set(i, oldData + data); // increment record count. this will be used for calculating average of aggregated data. dataCount[rowNum][i]++; } diff --git a/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/utils/GlusterUtil.java b/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/utils/GlusterUtil.java index 86337a6a..d9c1df3c 100644 --- a/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/utils/GlusterUtil.java +++ b/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/utils/GlusterUtil.java @@ -135,9 +135,6 @@ public class GlusterUtil { public List<GlusterServer> getGlusterServers(GlusterServer knownServer) { String output = getPeerStatus(knownServer.getName()); - if (output == null) { - return null; - } knownServer.setUuid(getUuid(knownServer.getName())); @@ -207,13 +204,12 @@ public class GlusterUtil { * @return Outout of the "gluster peer status" command */ private String getPeerStatus(String knownServer) { - String output; ProcessResult result = getSshUtil().executeRemote(knownServer, "gluster peer status"); if (!result.isSuccess()) { - output = null; + throw new GlusterRuntimeException("Couldn't get peer status on server [" + knownServer + "]. Error: " + + result); } - output = result.getOutput(); - return output; + return result.getOutput(); } public void addServer(String existingServer, String newServer) { |
