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