The replication source volume script (RepSrcPost.js) and the replication destination volume script (RepDstPost.js) are prepared for a post-processing script, which is stored in the following directory. This script must be customized according to the processing requirements.
<Environment directory>\etc\repl\scripts
<Shared disk>:\etc\opt\swstorage\etc\repl\scripts
1: // AdvancedCopy Manager for Windows 2: // All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2009 3: // 4: // RepSrcPost.js: Post-Processing Script for Replication(Source) 5: // 6: // [Parameters] 7: // 1st argument: device name of source volume 8: // 9: // [Return Values] 10: // 0: The script ended normally. 11: // 2: The number of the arguments is incorrect. 12: // (1,3): unused, but must not be used because older versions use this value. 13: // 4: An error other than the above occurred. 14: 15: try { 16: // create global objects 17: var WshShell = WScript.CreateObject("WScript.Shell"); // create Shell object 18: var WshEnv = WshShell.Environment("PROCESS"); // create Environment object 19: var fsObj = WScript.CreateObject("Scripting.FileSystemObject"); // create FileSystemObject object 20: 21: // create SwstReplicationPostProc object 22: var proc = new SwstReplicationPostProc(); 23: 24: // do nothing if postprocessing file exists 25: if (fsObj.FileExists(proc.postFileName) == false) { 26: SwstQuit(0); 27: } 28: 29: // get postprocessing type 30: var postProcType = proc.getPostProcData(proc.postFileName); 31: switch(postProcType) { 32: case "none": 33: proc.doNothing(); 34: break; 35: } 36: 37: // clear temporary files 38: proc.deletePostFile(proc.postFileName); 39: SwstQuit(0); 40: } catch (e) { 41: SwstQuit(9); 42: } 43: 44: function SwstReplicationPostProc() 45: { 46: // member variables 47: this.svName = WScript.Arguments.length!=1?SwstQuit(1):WScript.Arguments.Item(0); // device name of source volume 48: this.postFileName = getDataPathName() + "\\" + getPutFileName(this.svName) + ".spre"; // name of postprocessing file 49: 50: // member functions 51: this.getPostProcData = getPostProcData; // self-explanatory 52: this.doNothing = doNothing; // self-explanatory 53: this.deletePostFile = deletePostFile; // self-explanatory 54: } 55: 56: function getPostProcData(postfile) 57: { 58: var iomode = 1; // means read-only mode 59: var create = false; // means not to create a file 60: var postFileStream = fsObj.OpenTextFile(postfile, iomode, create); 61: var postData = postFileStream.ReadLine(); 62: postFileStream.Close(); 63: return postData; 64: } 65: 66: function doNothing() 67: { 68: // do nothing 69: } 70: 71: function deletePostFile(postfile) 72: { 73: if (fsObj.FileExists(postfile) == true) { 74: fsObj.DeleteFile(postfile); 75: } 76: } 77: 78: function SwstQuit(exitStatus) 79: { 80: switch(exitStatus) { 81: case 0: 82: WScript.Quit(0); 83: case 1: 84: WScript.Echo("[Replication Postprocessing] The number of the arguments is incorrect."); 85: WScript.Quit(2); 86: default: 87: WScript.Echo("[Replication Postprocessing] The script exited abnormally."); 88: WScript.Quit(4); 89: } 90: } 91: 92: function getDataPathName() 93: { 94: return WshShell.RegRead(getSetupInfoKey() + "\\etcPathName") + "\\etc\\repl\\data\\DEFAULT"; 95: } 96: 97: function getBinPathName() 98: { 99: return WshShell.RegRead(getSetupInfoKey() + "\\PathName") + "\\bin"; 100: } 101: 102: function getSetupInfoKey() 103: { 104: var nodeName = WshEnv.Item("SWSTGNODE"); 105: if( nodeName != "" ){ 106: return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion\\" + nodeName; 107: } 108: return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion"; 109: } 110: 111: function getPutFileName(deviceName){ 112: var fileName; 113: if( isSafeDISKName(deviceName) ){ 114: var re = /(\S+)\/(\S+):(\S+)/; 115: fileName = deviceName.replace(re, "$1_$2_$3"); 116: }else{ 117: fileName = deviceName; 118: } 119: return(fileName); 120: } 121: 122: function getGXDXPX(deviceName){ 123: var gXdXpX; 124: if( isSafeDISKName(deviceName) ){ 125: var re = /(\S+)\/(\S+):(\S+)/; 126: gXdXpX = deviceName.replace(re, "$3"); 127: }else{ 128: gXdXpX = deviceName; 129: } 130: return(gXdXpX); 131: } 132: 133: function isSafeDISKName(deviceName){ 134: var key = ":g"; 135: var s = deviceName.indexOf(key); 136: if ( s < 0 ) { 137: return (false); 138: } else { 139: return (true); 140: } 141: }
1: // AdvancedCopy Manager for Windows 2: // All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2009 3: // 4: // RepDstPost.js: Post-Processing Script for Replication(Destination) 5: // 6: // [Parameters] 7: // 1st argument: device name of destination volume 8: // 9: // [Return Values] 10: // 0: The script ended normally. 11: // 2: The number of the arguments is incorrect. 12: // (1,3,5-7): unused, but must not be used because older versions use these values. 13: // 4: An error other than the above occurred. 14: 15: try { 16: // create global objects 17: var WshShell = WScript.CreateObject("WScript.Shell"); // create Shell object 18: var WshEnv = WshShell.Environment("PROCESS"); // create Environment object 19: var fsObj = WScript.CreateObject("Scripting.FileSystemObject"); // create FileSystemObject object 20: 21: // create SwstReplicationPostProc object 22: var proc = new SwstReplicationPostProc(); 23: 24: // do nothing if postprocessing file exists 25: if (fsObj.FileExists(proc.postFileName) == false) { 26: SwstQuit(0); 27: } 28: 29: // get postprocessing type 30: var postProcType = proc.getPostProcData(proc.postFileName); 31: switch(postProcType) { 32: case "none": 33: proc.doNothing(); 34: break; 35: } 36: 37: // clear temporary files 38: proc.deletePostFile(proc.postFileName); 39: SwstQuit(0); 40: } catch (e) { 41: SwstQuit(9); 42: } 43: 44: function SwstReplicationPostProc() 45: { 46: // member variables 47: this.dvName = WScript.Arguments.length!=1?SwstQuit(1):WScript.Arguments.Item(0); // device name of destination volume 48: this.postFileName = getDataPathName() + "\\" + getPutFileName(this.dvName) + ".dpre"; // name of postprocessing file 49: 50: // member functions 51: this.getPostProcData = getPostProcData; // self-explanatory 52: this.doNothing = doNothing; // self-explanatory 53: this.deletePostFile = deletePostFile; // self-explanatory 54: } 55: 56: function getPostProcData(postfile) 57: { 58: var iomode = 1; // means read-only mode 59: var create = false; // means not to create a file 60: var postFileStream = fsObj.OpenTextFile(postfile, iomode, create); 61: var postData = postFileStream.ReadLine(); 62: postFileStream.Close(); 63: return postData; 64: } 65: 66: function doNothing() 67: { 68: // do nothing 69: } 70: 71: function deletePostFile(postfile) 72: { 73: if (fsObj.FileExists(postfile) == true) { 74: fsObj.DeleteFile(postfile); 75: } 76: } 77: 78: function SwstQuit(exitStatus) 79: { 80: switch(exitStatus) { 81: case 0: 82: WScript.Quit(0); 83: case 1: 84: WScript.Echo("[Replication Postprocessing] The number of the arguments is incorrect."); 85: WScript.Quit(2); 86: default: 87: WScript.Echo("[Replication Postprocessing] The script exited abnormally."); 88: WScript.Quit(4); 89: } 90: } 91: 92: function getDataPathName() 93: { 94: return WshShell.RegRead(getSetupInfoKey() + "\\etcPathName") + "\\etc\\repl\\data\\DEFAULT"; 95: } 96: 97: function getBinPathName() 98: { 99: return WshShell.RegRead(getSetupInfoKey() + "\\PathName") + "\\bin"; 100: } 101: 102: function getSetupInfoKey() 103: { 104: var nodeName = WshEnv.Item("SWSTGNODE"); 105: if( nodeName != "" ){ 106: return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion\\" + nodeName; 107: } 108: return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion"; 109: } 110: 111: function getPutFileName(deviceName){ 112: var fileName; 113: if( isSafeDISKName(deviceName) ){ 114: var re = /(\S+)\/(\S+):(\S+)/; 115: fileName = deviceName.replace(re, "$1_$2_$3"); 116: }else{ 117: fileName = deviceName; 118: } 119: return(fileName); 120: } 121: 122: function getGXDXPX(deviceName){ 123: var gXdXpX; 124: if( isSafeDISKName(deviceName) ){ 125: var re = /(\S+)\/(\S+):(\S+)/; 126: gXdXpX = deviceName.replace(re, "$3"); 127: }else{ 128: gXdXpX = deviceName; 129: } 130: return(gXdXpX); 131: } 132: 133: function isSafeDISKName(deviceName){ 134: var key = ":g"; 135: var s = deviceName.indexOf(key); 136: if ( s < 0 ) { 137: return (false); 138: } else { 139: return (true); 140: } 141: }
Point
The volume is locked/unlocked, and the buffer is flushed by the command, not by the script. Therefore, the source pre-processing and post-processing scripts are executed immediately before and after (respectively) the source/destination volumes are locked/unlocked and the buffer is flushed. The source/destination pre-processing and post-processing scripts do not perform any processing.
Note
In replication pre-processing for the source volume and destination volume, to avoid a temporary access conflict with other applications, locking is retried if it cannot complete its operation. If the number of times that locking is executed reaches the specified retry count limit, the command ends abnormally. If an abnormal end occurs, a process that is using the source volume or destination volume remains active. Stop all applications and services involved, or take other appropriate measures so that the volume cannot be used by another process.
Although the retry count limit can be changed by creating volume locking specification files and re-setting the count (for details on the files, refer to "C.2.4 Copy source volume locking specification file" and " C.2.5 Copy destination volume locking specification file"), the files do not need to be created if appropriate measures have been taken to prevent other processes from using the target volumes during replication processing execution.
For synchronous-type replication (i.e., EC) in which the destination volume is a shared volume in a clustered system, to prevent the clustered system from being accessed by another process, the destination volume is locked only while swsrpstartsync (Synchronous processing start command) and swsrpmake (Replication creation command) are running (see the figure above). That is, the destination volume remains unlocked from the time that the start replication command is executed to the time that the create replication command is executed.
This may cause a message to be output to the event log. This message is described in "13.1.1.12 Error messages displayed an event viewer". However, this is not a major problem, and the message can be ignored.