Commit 3a5cccef authored by Cristiano Urban's avatar Cristiano Urban
Browse files

IBM Spectrum Protect integration: modified 'getOSPath()' and 'insertStorage()...


IBM Spectrum Protect integration: modified 'getOSPath()' and 'insertStorage() methods, replaced 'getTapePool()' method with 'getHSMFilesystem()'.

Signed-off-by: default avatarCristiano Urban <cristiano.urban@inaf.it>
parent 90e30695
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -171,7 +171,7 @@ class DbConnector(object):
            conn = self.getConnection()
            cursor = conn.cursor(cursor_factory = RealDictCursor)
            cursor.execute("""
                SELECT storage_type, base_path, user_name, tstamp_wrapper_dir, '/' || fs_path AS os_path, content_length, tape_pool
                SELECT storage_type, base_path, user_name, tstamp_wrapper_dir, '/' || fs_path AS os_path, content_length, tape_hsm_fs
                FROM node n
                JOIN location l ON n.location_id = l.location_id
                JOIN storage s ON s.storage_id = l.storage_src_id
@@ -192,7 +192,7 @@ class DbConnector(object):
            tstampWrappedDir = result[0]["tstamp_wrapper_dir"]
            osPath = result[0]["os_path"]
            contentLength = result[0]["content_length"]
            tapePool = result[0]["tape_pool"]
            tapeHSMFilesystem = result[0]["tape_hsm_fs"]
            if tstampWrappedDir is None:
                baseSrcPath = basePath + "/" + userName
            else:
@@ -205,7 +205,7 @@ class DbConnector(object):
                            "username": userName,
                            "osPath": osPath,
                            "contentLength": contentLength,
                            "tapePool": tapePool
                            "tapeHSMFilesystem": tapeHSMFilesystem
                       }
            return fileInfo
        finally:
@@ -824,12 +824,12 @@ class DbConnector(object):
        finally:
            self.connPool.putconn(conn, close = False)

    def getTapePool(self, storageId):
        """Returns the tape pool for a given storage id, if the storage is cold. Otherwise it returns 'False'."""
    def getTapeHSMFilesystem(self, storageId):
        """Returns the tape HSM filesystem for a given storage id, if the storage is cold. Otherwise it returns 'False'."""
        try:
            conn = self.getConnection()
            cursor = conn.cursor(cursor_factory = RealDictCursor)
            cursor.execute("SELECT tape_pool FROM storage WHERE storage_id = %s;", (storageId,))
            cursor.execute("SELECT tape_hsm_fs FROM storage WHERE storage_id = %s;", (storageId,))
            result = cursor.fetchall()
            cursor.close()
        except Exception:
@@ -838,7 +838,7 @@ class DbConnector(object):
            raise
        else:
            if result:
                return result[0]["tape_pool"]
                return result[0]["tape_hsm_fs"]
            else:
                return False
        finally:
@@ -1250,7 +1250,7 @@ class DbConnector(object):

    ##### Storage #####

    def insertStorage(self, storageType, storageBasePath, storageHostname, vospaceUserBasePath, tapePool = None):
    def insertStorage(self, storageType, storageBasePath, storageHostname, vospaceUserBasePath, tapeHSMFilesystem = None):
        """Inserts a storage point."""
        if not self.getStorageId(storageBasePath):
            try:
@@ -1260,14 +1260,14 @@ class DbConnector(object):
                    INSERT INTO storage(storage_type,
                                        base_path,
                                        hostname,
                                        tape_pool)
                                        tape_hsm_fs)
                    VALUES (%s, %s, %s, %s)
                    RETURNING storage_id;
                    """,
                    (storageType,
                     storageBasePath,
                     storageHostname,
                     tapePool,))
                     tapeHSMFilesystem,))
                storageSrcId = cursor.fetchall()[0]["storage_id"]
            except Exception:
                if not conn.closed: