From: Vásáry Dániel Date: Thu, 8 Oct 2020 07:01:45 +0000 (+0000) Subject: git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube... X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=f0709415778ce202c37bf790efb75f3356a197b3;p=mediacube.git git-tfs-id: [tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C31977 --- diff --git a/server/user.jobengine.osgi.commons/src/user/commons/remotestore/TSMLister.java b/server/user.jobengine.osgi.commons/src/user/commons/remotestore/TSMLister.java index b85e1463..266ace44 100644 --- a/server/user.jobengine.osgi.commons/src/user/commons/remotestore/TSMLister.java +++ b/server/user.jobengine.osgi.commons/src/user/commons/remotestore/TSMLister.java @@ -17,12 +17,11 @@ import user.tsm.client.TSMBufferedClient; public class TSMLister implements IDirectoryLister { - private static final String DELIMITER = "/"; + private static final String DELIMITER = System.getProperty("tsm.delimiter", "/"); private static final String NODENAME = System.getProperty("tsm.nodename", "JOBENGINE"); - private static final String FSNAME = System.getProperty("tsm.fsname", "JOBENGINE"); - private static final String ALTERNATE_FSNAME = System.getProperty("tsm.fsname.alternate", "JOBENGINE"); - private static final String HLNAME = System.getProperty("tsm.hlname", "JOBENGINE"); - private static final String LLNAMEQUALIFIER = System.getProperty("tsm.llname.qualifier", File.separator); + private static final String FSNAME = System.getProperty("tsm.fsname", "/JOBENGINE"); + private static final String ALTERNATE_FSNAME = System.getProperty("tsm.fsname.alternate"); + private static final String HLNAME = System.getProperty("tsm.hlname", "/JOBENGINE"); private static final Logger logger = LogManager.getLogger(); private TSMBufferedClient client; @@ -69,12 +68,12 @@ public class TSMLister implements IDirectoryLister { String currentFileName = fileName; logger.info("Getting {}, {}, {}", FSNAME, HLNAME, currentFileName); - TSMBackupFileObject backupFileObject = client.getActiveBackupFileObject(FSNAME, DELIMITER, DELIMITER + currentFileName); + TSMBackupFileObject backupFileObject = client.getActiveBackupFileObject(FSNAME, HLNAME, DELIMITER + currentFileName); //probaljuk meg a masik tarbol if (backupFileObject == null) { logger.info("Getting {}, {}, {}", ALTERNATE_FSNAME, HLNAME, currentFileName); - backupFileObject = client.getActiveBackupFileObject(ALTERNATE_FSNAME, DELIMITER, DELIMITER + currentFileName); + backupFileObject = client.getActiveBackupFileObject(ALTERNATE_FSNAME, HLNAME, DELIMITER + currentFileName); } //probaljuk meg kiterjesztes nelkul is @@ -121,7 +120,7 @@ public class TSMLister implements IDirectoryLister { // } catch (Exception e) { // logger.info(e.getMessage()); // } - TSMOutputStream outputStream = new TSMOutputStream(client, FSNAME, DELIMITER, remoteFile); + TSMOutputStream outputStream = new TSMOutputStream(client, FSNAME, HLNAME, DELIMITER, remoteFile); outputStream.open(); return outputStream; } diff --git a/server/user.jobengine.osgi.commons/src/user/commons/remotestore/TSMOutputStream.java b/server/user.jobengine.osgi.commons/src/user/commons/remotestore/TSMOutputStream.java index 03463dab..5a8a2541 100644 --- a/server/user.jobengine.osgi.commons/src/user/commons/remotestore/TSMOutputStream.java +++ b/server/user.jobengine.osgi.commons/src/user/commons/remotestore/TSMOutputStream.java @@ -1,6 +1,7 @@ package user.commons.remotestore; import java.io.FileNotFoundException; +import java.io.IOException; import java.io.OutputStream; import user.commons.RemoteFile; @@ -18,11 +19,11 @@ public class TSMOutputStream extends OutputStream { private long sizeEstimate; //highLevelName == delimiter - public TSMOutputStream(TSMBufferedClient client, String filespaceName, String highLevelName, RemoteFile remoteFile) { + public TSMOutputStream(TSMBufferedClient client, String filespaceName, String highLevelName, String delimiter, RemoteFile remoteFile) { this.client = client; this.filespaceName = filespaceName; this.highLevelName = highLevelName; - this.fileName = remoteFile.getName(); + this.fileName = delimiter + remoteFile.getName(); this.sizeEstimate = remoteFile.getSize(); } @@ -37,12 +38,12 @@ public class TSMOutputStream extends OutputStream { } public void open() throws TSMException, FileNotFoundException { - backupObject = new TSMBackupFileObject(filespaceName, highLevelName, highLevelName + fileName); + backupObject = new TSMBackupFileObject(filespaceName, highLevelName, fileName); backupObject.setSizeEstimate(sizeEstimate); } @Override - public void write(byte[] buffer, int off, int byteCount) { + public void write(byte[] buffer, int off, int byteCount) throws IOException { if (client != null) { if (!initialized) { client.setBufferSize(byteCount); @@ -52,6 +53,7 @@ public class TSMOutputStream extends OutputStream { client.send(buffer, backupObject, byteCount); } catch (Exception e) { e.printStackTrace(); + throw new IOException(e); } } } diff --git a/server/user.tsm.client/src/user/tsm/client/TSMBufferedClient.java b/server/user.tsm.client/src/user/tsm/client/TSMBufferedClient.java index 88845add..bebe3628 100644 --- a/server/user.tsm.client/src/user/tsm/client/TSMBufferedClient.java +++ b/server/user.tsm.client/src/user/tsm/client/TSMBufferedClient.java @@ -141,6 +141,7 @@ public class TSMBufferedClient extends TSMClient { throw new TSMException(dsmHandle, rc); object.bytesWorked(byteCount); } catch (Exception e) { + vote(TSMAPIConstants.DSM_VOTE_ABORT); throw e; } @@ -157,8 +158,14 @@ public class TSMBufferedClient extends TSMClient { } catch (Exception e) { logger.catching(e); } - if (result != TSMAPIConstants.DSM_RC_OK) - throw new TSMException(dsmHandle, rc, endTxnExOut.getReason()); + + if (result == TSMAPIConstants.DSM_RC_CHECK_REASON_CODE) { + logger.error("dsmEndTxnEx error, reason code {}", endTxnExOut.getReason()); + } else { + if (result != TSMAPIConstants.DSM_RC_OK) + throw new TSMException(dsmHandle, rc, endTxnExOut.getReason()); + } + return result; } }