diff options
Diffstat (limited to 'src')
5 files changed, 35 insertions, 414 deletions
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/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'] |
