Commit 31edda74 authored by Cristiano Urban's avatar Cristiano Urban
Browse files

Removed support for 'portal' storage location + minor changes.

parent 6983adde
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ EXAMPLES
            for st in storageList:
                storageIdList.append(st["storage_id"])
            storageId = None
            while not storageId in storageIdList:
            while storageId not in storageIdList:
                try:
                    storageId = input("Please, insert a storage id: ")
                    storageId = int(storageId)
@@ -97,7 +97,7 @@ EXAMPLES
            print("! process is running.                                        !")
            print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n")
            confirm = None
            while not confirm in ( "yes", "no" ):
            while confirm not in ( "yes", "no" ):
                try:
                    confirm = input("Are you sure to proceed? [yes/no]: ")
                except KeyboardInterrupt:
+8 −14
Original line number Diff line number Diff line
@@ -27,22 +27,18 @@ class VOSStorage(RedisRPCClient):
    def add(self):
        storageType = None
        storageBasePath = None
        storageBaseUrl = None
        storageHostname = None
        while not storageType in ("cold", "hot", "portal"):
        while storageType not in ("cold", "hot"):
                try:
                    storageType = input("\nStorage type ['cold', 'hot' or 'portal']: ")
                    storageType = input("\nStorage type ['cold' or 'hot']: ")
                except ValueError:
                    print("Input type is not valid!")
                except EOFError:
                    print("\nPlease, use CTRL+C to quit.")
                except KeyboardInterrupt:
                    sys.exit("\nCTRL+C detected. Exiting...")
        while not (storageBasePath or storageBaseUrl):
        while not storageBasePath:
            try:
                if storageType == "portal":
                    storageBaseUrl = input("\nStorage base url: ")
                else:
                storageBasePath = input("\nStorage base path: ")
            except ValueError:
                print("Input type is not valid!")
@@ -62,7 +58,6 @@ class VOSStorage(RedisRPCClient):
        storageRequest = { "requestType": "STORAGE_ADD",
                           "storageType": storageType,
                           "basePath": storageBasePath,
                           "baseUrl": storageBaseUrl,
                           "hostname": storageHostname }
        storageResponse = self.call(storageRequest)

@@ -93,7 +88,7 @@ class VOSStorage(RedisRPCClient):
            for st in storageList:
                storageIdList.append(st["storage_id"])
            storageId = None
            while not storageId in storageIdList:
            while storageId not in storageIdList:
                try:
                    storageId = input("Please, insert a storage id: ")
                    storageId = int(storageId)
@@ -110,7 +105,7 @@ class VOSStorage(RedisRPCClient):
            print("! must do it manually.                                          !")
            print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n")
            confirm = None
            while not confirm in ( "yes", "no" ):
            while confirm not in ( "yes", "no" ):
                try:
                    confirm = input("Are you sure to proceed? [yes/no]: ")
                except KeyboardInterrupt:
@@ -179,11 +174,10 @@ DESCRIPTION
           prints the full storage point list


       Supported storage types are: 'hot', 'cold' and 'portal'.
       Supported storage types are: 'hot' and 'cold'.
       
       Adding 'hot' or 'cold' storage points requires a base path
       to be specified (e.g. '/mnt/my_storage/users').
       For 'portal' storage points a base URL is required.

       All storage points require a valid hostname or IP address.
    """)
+2 −2
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ class VOSUser(RedisRPCClient):
            for user in userList:
                userIdList.append(user["user_id"])
            userId = None
            while not userId in userIdList:
            while userId not in userIdList:
                try:
                    userId = input("\nPlease, insert a valid user ID: ")
                except ValueError:
@@ -109,7 +109,7 @@ class VOSUser(RedisRPCClient):
            print("! you must do it manually.                            !")
            print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n")
            confirm = None
            while not confirm in ( "yes", "no" ):
            while confirm not in ( "yes", "no" ):
                try:
                    confirm = input("Are you sure to proceed? [yes/no]: ")
                except KeyboardInterrupt:
+16 −22
Original line number Diff line number Diff line
@@ -1189,7 +1189,7 @@ class DbConnector(object):

    ##### Storage #####

    def insertStorage(self, storageType, basePath, baseUrl, hostname):
    def insertStorage(self, storageType, basePath, hostname):
        """Inserts a storage point."""
        if not self.getStorageId(basePath):
            try:
@@ -1198,14 +1198,12 @@ class DbConnector(object):
                cursor.execute("""
                    INSERT INTO storage(storage_type,
                                        base_path,
                                        base_url,
                                        hostname)
                    VALUES (%s, %s, %s, %s)
                    VALUES (%s, %s, %s)
                    RETURNING storage_id;
                    """,
                    (storageType,
                     basePath,
                     baseUrl,
                     hostname,))
                storageSrcId = cursor.fetchall()[0]["storage_id"]
            except Exception:
@@ -1213,7 +1211,6 @@ class DbConnector(object):
                    conn.rollback()
                raise
            else:
                if storageType == "cold" or storageType == "hot":
                try:
                    cursor.execute("""
                        SELECT storage_id
@@ -1229,9 +1226,6 @@ class DbConnector(object):
                    raise
                else:
                    locationType = "async"
                else:
                    storageDestId = storageSrcId
                    locationType = "portal"
                try:
                    cursor.execute("""
                        INSERT INTO location(location_type,
+7 −10
Original line number Diff line number Diff line
@@ -49,9 +49,7 @@ class StorageRPCServer(RedisRPCServer):
        elif requestBody["requestType"] == "STORAGE_ADD":
            storageType = requestBody["storageType"]
            storageBasePath = requestBody["basePath"]
            storageBaseUrl = requestBody["baseUrl"]
            storageHostname = requestBody["hostname"]
            if storageType != "portal":
            if not os.path.exists(storageBasePath):
                errorMsg = "Base path doesn't exist."
                self.logger.error(errorMsg)
@@ -62,7 +60,6 @@ class StorageRPCServer(RedisRPCServer):
            try:
                result = self.dbConn.insertStorage(storageType,
                                                   storageBasePath,
                                                   storageBaseUrl,
                                                   storageHostname)
            except Exception:
                errorMsg = "Database error."