Loading client/vos_storage +24 −18 Original line number Original line Diff line number Diff line #!/usr/bin/env python #!/usr/bin/env python import os import sys import sys from amqp_client import AMQPClient from amqp_client import AMQPClient Loading @@ -22,6 +21,7 @@ class VOSStorage(AMQPClient): def add(self): def add(self): storageType = None storageType = None storageBasePath = None storageBasePath = None storageBaseUrl = None storageHostname = None storageHostname = None while not storageType in ("cold", "hot", "portal"): while not storageType in ("cold", "hot", "portal"): try: try: Loading @@ -32,7 +32,11 @@ class VOSStorage(AMQPClient): print("\nPlease, use CTRL+C to quit.") print("\nPlease, use CTRL+C to quit.") except KeyboardInterrupt: except KeyboardInterrupt: sys.exit("\nCTRL+C detected. Exiting...") sys.exit("\nCTRL+C detected. Exiting...") while not (storageBasePath or storageBaseUrl): try: try: if storageType == "portal": storageBaseUrl = input("\nStorage base url: ") else: storageBasePath = input("\nStorage base path: ") storageBasePath = input("\nStorage base path: ") except ValueError: except ValueError: print("Input type is not valid!") print("Input type is not valid!") Loading @@ -40,6 +44,7 @@ class VOSStorage(AMQPClient): print("\nPlease, use CTRL+C to quit.") print("\nPlease, use CTRL+C to quit.") except KeyboardInterrupt: except KeyboardInterrupt: sys.exit("\nCTRL+C detected. Exiting...") sys.exit("\nCTRL+C detected. Exiting...") while not storageHostname: try: try: storageHostname = input("\nStorage hostname: ") storageHostname = input("\nStorage hostname: ") except ValueError: except ValueError: Loading @@ -51,6 +56,7 @@ class VOSStorage(AMQPClient): storageRequest = { "requestType": "STORAGE_ADD", storageRequest = { "requestType": "STORAGE_ADD", "storageType": storageType, "storageType": storageType, "basePath": storageBasePath, "basePath": storageBasePath, "baseUrl": storageBaseUrl, "hostname": storageHostname } "hostname": storageHostname } storageResponse = self.call(storageRequest) storageResponse = self.call(storageRequest) Loading Loading @@ -93,7 +99,7 @@ class VOSStorage(AMQPClient): except KeyboardInterrupt: except KeyboardInterrupt: sys.exit("\nCTRL+C detected. Exiting...") sys.exit("\nCTRL+C detected. Exiting...") print() print() print("!!!!!!!!!!!!!!!!!!!!!!!!!!WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") print("! This operation will remove the selected storage location only !") print("! This operation will remove the selected storage location only !") print("! from the database. !") print("! from the database. !") print("! The mount point on the transfer node will not be removed, you !") print("! The mount point on the transfer node will not be removed, you !") Loading transfer_service/storage_amqp_server.py +9 −6 Original line number Original line Diff line number Diff line Loading @@ -24,7 +24,7 @@ class StorageAMQPServer(AMQPServer): super(StorageAMQPServer, self).__init__(host, port, queue) super(StorageAMQPServer, self).__init__(host, port, queue) def execute_callback(self, requestBody): def execute_callback(self, requestBody): # 'requestType', 'mountPoint', 'hostname' and 'storageType' attributes are mandatory # 'requestType' attribute is mandatory if "requestType" not in requestBody: if "requestType" not in requestBody: response = { "responseType": "ERROR", response = { "responseType": "ERROR", "errorCode": 1, "errorCode": 1, Loading @@ -33,9 +33,11 @@ class StorageAMQPServer(AMQPServer): elif requestBody["requestType"] == "STORAGE_ADD": elif requestBody["requestType"] == "STORAGE_ADD": self.storageType = requestBody["storageType"] self.storageType = requestBody["storageType"] self.storageBasePath = requestBody["basePath"] self.storageBasePath = requestBody["basePath"] self.storageBaseUrl = requestBody["baseUrl"] self.storageHostname = requestBody["hostname"] self.storageHostname = requestBody["hostname"] if not os.path.exists(self.storageBasePath) and self.storageType != "portal": if self.storageType != "portal": if not os.path.exists(self.storageBasePath): response = { "responseType": "ERROR", response = { "responseType": "ERROR", "errorCode": 2, "errorCode": 2, "errorMsg": "Base path doesn't exist."} "errorMsg": "Base path doesn't exist."} Loading @@ -44,6 +46,7 @@ class StorageAMQPServer(AMQPServer): self.dbConn.connect() self.dbConn.connect() result = self.dbConn.insertStorage(self.storageType, result = self.dbConn.insertStorage(self.storageType, self.storageBasePath, self.storageBasePath, self.storageBaseUrl, self.storageHostname) self.storageHostname) self.dbConn.disconnect() self.dbConn.disconnect() Loading Loading
client/vos_storage +24 −18 Original line number Original line Diff line number Diff line #!/usr/bin/env python #!/usr/bin/env python import os import sys import sys from amqp_client import AMQPClient from amqp_client import AMQPClient Loading @@ -22,6 +21,7 @@ class VOSStorage(AMQPClient): def add(self): def add(self): storageType = None storageType = None storageBasePath = None storageBasePath = None storageBaseUrl = None storageHostname = None storageHostname = None while not storageType in ("cold", "hot", "portal"): while not storageType in ("cold", "hot", "portal"): try: try: Loading @@ -32,7 +32,11 @@ class VOSStorage(AMQPClient): print("\nPlease, use CTRL+C to quit.") print("\nPlease, use CTRL+C to quit.") except KeyboardInterrupt: except KeyboardInterrupt: sys.exit("\nCTRL+C detected. Exiting...") sys.exit("\nCTRL+C detected. Exiting...") while not (storageBasePath or storageBaseUrl): try: try: if storageType == "portal": storageBaseUrl = input("\nStorage base url: ") else: storageBasePath = input("\nStorage base path: ") storageBasePath = input("\nStorage base path: ") except ValueError: except ValueError: print("Input type is not valid!") print("Input type is not valid!") Loading @@ -40,6 +44,7 @@ class VOSStorage(AMQPClient): print("\nPlease, use CTRL+C to quit.") print("\nPlease, use CTRL+C to quit.") except KeyboardInterrupt: except KeyboardInterrupt: sys.exit("\nCTRL+C detected. Exiting...") sys.exit("\nCTRL+C detected. Exiting...") while not storageHostname: try: try: storageHostname = input("\nStorage hostname: ") storageHostname = input("\nStorage hostname: ") except ValueError: except ValueError: Loading @@ -51,6 +56,7 @@ class VOSStorage(AMQPClient): storageRequest = { "requestType": "STORAGE_ADD", storageRequest = { "requestType": "STORAGE_ADD", "storageType": storageType, "storageType": storageType, "basePath": storageBasePath, "basePath": storageBasePath, "baseUrl": storageBaseUrl, "hostname": storageHostname } "hostname": storageHostname } storageResponse = self.call(storageRequest) storageResponse = self.call(storageRequest) Loading Loading @@ -93,7 +99,7 @@ class VOSStorage(AMQPClient): except KeyboardInterrupt: except KeyboardInterrupt: sys.exit("\nCTRL+C detected. Exiting...") sys.exit("\nCTRL+C detected. Exiting...") print() print() print("!!!!!!!!!!!!!!!!!!!!!!!!!!WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") print("! This operation will remove the selected storage location only !") print("! This operation will remove the selected storage location only !") print("! from the database. !") print("! from the database. !") print("! The mount point on the transfer node will not be removed, you !") print("! The mount point on the transfer node will not be removed, you !") Loading
transfer_service/storage_amqp_server.py +9 −6 Original line number Original line Diff line number Diff line Loading @@ -24,7 +24,7 @@ class StorageAMQPServer(AMQPServer): super(StorageAMQPServer, self).__init__(host, port, queue) super(StorageAMQPServer, self).__init__(host, port, queue) def execute_callback(self, requestBody): def execute_callback(self, requestBody): # 'requestType', 'mountPoint', 'hostname' and 'storageType' attributes are mandatory # 'requestType' attribute is mandatory if "requestType" not in requestBody: if "requestType" not in requestBody: response = { "responseType": "ERROR", response = { "responseType": "ERROR", "errorCode": 1, "errorCode": 1, Loading @@ -33,9 +33,11 @@ class StorageAMQPServer(AMQPServer): elif requestBody["requestType"] == "STORAGE_ADD": elif requestBody["requestType"] == "STORAGE_ADD": self.storageType = requestBody["storageType"] self.storageType = requestBody["storageType"] self.storageBasePath = requestBody["basePath"] self.storageBasePath = requestBody["basePath"] self.storageBaseUrl = requestBody["baseUrl"] self.storageHostname = requestBody["hostname"] self.storageHostname = requestBody["hostname"] if not os.path.exists(self.storageBasePath) and self.storageType != "portal": if self.storageType != "portal": if not os.path.exists(self.storageBasePath): response = { "responseType": "ERROR", response = { "responseType": "ERROR", "errorCode": 2, "errorCode": 2, "errorMsg": "Base path doesn't exist."} "errorMsg": "Base path doesn't exist."} Loading @@ -44,6 +46,7 @@ class StorageAMQPServer(AMQPServer): self.dbConn.connect() self.dbConn.connect() result = self.dbConn.insertStorage(self.storageType, result = self.dbConn.insertStorage(self.storageType, self.storageBasePath, self.storageBasePath, self.storageBaseUrl, self.storageHostname) self.storageHostname) self.dbConn.disconnect() self.dbConn.disconnect() Loading