Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

213 lines
8.3 KiB

  1. #
  2. # The following three paramters should come from an input file.
  3. # They are the branch ID number, the branch timezone and the hub ID number to
  4. # which the branch is assigned.
  5. #
  6. my $Usage = "
  7. Specific Usage: perl $0 [cmd options] \> output
  8. Process the erac.mrs configuration script.
  9. Command line options must be prefixed with a dash.
  10. The required input options to this script are:
  11. -DBchID=nnnnn : to provide a value for the Bch ID parameter.
  12. -DHubID=nnnnn : to provide a value for the Hub ID parameter.
  13. ";
  14. FRSSUP::CheckForHelp(\%CMD_PARS, \$Usage);
  15. #
  16. # Check the input parameters.
  17. #
  18. FRSSUP::ShowHelp("ERROR - Required parameter BchID not found.", \$Usage) if (!exists $CMD_VARS{"BchID"});
  19. push @bchID, $CMD_VARS{"BchID"};
  20. FRSSUP::ShowHelp("ERROR - Required parameter HubID not found.", \$Usage) if (!exists $CMD_VARS{"HubID"});
  21. push @hubID, $CMD_VARS{"HubID"};
  22. push @bchTimeZone, 0; # place holder for now.
  23. # Restriction: script array variables must be prefixed with "@".
  24. # for testing
  25. #@hubID = ("0000" , "0000" , "0000" , "0000" );
  26. #@bchID = ("1003002", "1000043", "1007692", "2000001");
  27. #
  28. # For the present all schedules will use central time. (GMT-6)
  29. #@bchTimeZone = ("-6:00", "-6:00" , "-6:00" , "-6:00" );
  30. #for ($i=0; $i<150; $i++ ) {push @bchID, 300000+$i; push @bchTimeZone, 0; push @hubID, "0000";}
  31. #
  32. # Restriction: script scalar variables must be prefixed with "$".
  33. ## TEST # $domain = "na";
  34. $domain = "FRSDIFF";
  35. #
  36. # define a "subroutine" to do the actual creation of the two member
  37. # replica set. Each user defined calling parameter is
  38. # associated with an argument type for use when the "subroutine" is called.
  39. #
  40. # Restriction: All "subroutines" must be defined before they are first called.
  41. #
  42. FRS_SUB CREATE_WORK_RS(/HA=SET_ELEMENT # Hub server
  43. /B=VARCON # Branch server
  44. /SC1=SCHEDULE # schedule
  45. /SETTINGSDN=SET_ELEMENT ) # The parent Settings object
  46. #
  47. # Define an FRS replica set object under the settingsdn object.
  48. # The object name for the FRS Replica Set object is based on the {rep_set_name}
  49. # parameter from the branch server object.
  50. #
  51. # Restriction: All subroutine argument refs are surrounded by "%".
  52. # References to parameters in other objects use the
  53. # notation "->{...}".
  54. #
  55. SET: FRS_REPLICASET (/UNDER=%SETTINGSDN% /TYPE=DFS
  56. /ONAME=%B%->{rep_set_name})
  57. #
  58. # Create the two FRS member objects underneath the SET object just created.
  59. # Parameters for the member object attributes come from the /SERVER argument
  60. # but they can also be replaced by paramters to the FRS_MEMBER command.
  61. # For example, the staging and root paths come from the /SERVER argument but the
  62. # root path could be changed by adding "/RP="newroot"" to the param list below.
  63. #
  64. # Restriction: References to tags that name a set of objects are
  65. # surrounded by angle brackets. So "<SET>" below refers
  66. # the FRS_REPLICASET object just defined above.
  67. #
  68. MHA: FRS_MEMBER (/UNDER=<SET> /SERVER=%HA% /COMPUTER=%HA%->{COMPUTER}
  69. /ONAME="ComputerObjectGuid")
  70. MB: FRS_MEMBER (/UNDER=<SET> /SERVER=%B% /COMPUTER=%B%->{COMPUTER}
  71. /ONAME="ComputerObjectGuid" /MAKE_PRIMARY_MEMBER )
  72. #
  73. # Update the replica set object to include the ref to the primary member
  74. # The hub server in this case.
  75. #
  76. # SET: FRS_REPLICASET (/UNDER=%SETTINGSDN% /TYPE=DFS
  77. # /ONAME=%B%->{rep_set_name} /PRIMARY_MEMBER=<MHA>)
  78. #
  79. # Create the connection objects between the members defined above.
  80. # Note use of angle brackets.
  81. # To use the timezone supplied on the branch's FRS_SERVER object
  82. # add the following parameter to each FRS_CONNECTION object below.
  83. # /TIME_ZONE=%B%->{time_zone}
  84. #
  85. FRS_CONNECTION (/TO=<MB> /FROM=<MHA> /SCHED=%SC1%
  86. /ONAME="FROM-".%HA%->{ONAME}."-TO-".%B%->{ONAME} )
  87. FRS_CONNECTION (/TO=<MHA> /FROM=<MB> /SCHED=%SC1%
  88. /ONAME="FROM-".%B%->{ONAME}."-TO-".%HA%->{ONAME} )
  89. #
  90. # The tags defined above (i.e. SET, MHA, and MB) are local to the
  91. # subroutine. They are undefined when the subroutine completes.
  92. #
  93. FRS_END_SUB
  94. #
  95. # Create the parameters for the FRS_SERVER objects for each branch.
  96. #
  97. for ($ib=0; $ib<scalar(@bchID); $ib++) {
  98. # The branch name ($bchName) is a concatenation (use of ".") of the rootpath
  99. # branch id parameter and a constant suffix.
  100. # The hub root path uses the branch name (no "." since inside dbl-quotes)
  101. # so it is unique for each replica set serviced by this hub.
  102. # In FRS, no two replica sets on the same server can have overlapping root paths.
  103. $bchName = $bchID[$ib]; # test # . "-I01";
  104. $bchNt4Acct = "$domain\\$bchName\$"; # need to define outside of params due to trailing $
  105. $hubName = $hubID[$ib]; # test # "STL-FSNA-I" . $hubID[$ib];
  106. $hubRootPath = "C:\\BRANCHES\\$bchName"; # need double slashes outside params
  107. $hubNt4Acct = "$domain\\$hubName\$"; # need to define outside of params due to trailing $
  108. HUB: FRS_SERVER (/RP=$hubRootPath
  109. /SP="C:\FRS-STAGING" # can use single slashes inside params
  110. /COMPUTER=$hubNt4Acct
  111. /ONAME=$hubName
  112. /DNS_NAME="$hubName.frs0419.nttest.microsoft.com"
  113. )
  114. # TEST ## /DNS_NAME="$hubName.$domain.erac.com"
  115. BCH: FRS_SERVER (/RP="D:\USERS"
  116. /SP="C:\FRS-STAGING"
  117. /COMPUTER=$bchNt4Acct
  118. /ONAME=$bchName
  119. /time_zone=$bchTimeZone[$ib] # carry the timezone thru the server data.
  120. /DNS_NAME="$bchName.frs0419.nttest.microsoft.com"
  121. /rep_set_name="dfsroot|$bchName" )
  122. # TEST ## /DNS_NAME="$bchName.$domain.erac.com"
  123. }
  124. #
  125. # Restriction: Any time with a ":" must be enclosed in quotes. See /REPL_DURATION,
  126. # /TIME_ZONE and /DISABLE below.
  127. #
  128. # Restriction: The current schedule generator does not make efficient use of
  129. # daily variations in the blackout periods. Make the blackout
  130. # periods the same for each day of the week.
  131. #
  132. PRIMARY_SCH: FRS_SCHEDULE (/REPL_INTERVAL=24 # Once per day
  133. /REPL_DURATION="2:00" # 2 hour window
  134. /TIME_ZONE="-6:00" # Central time.
  135. /REPL_OFFSET="18:00" # starting offset
  136. /STAGGER="0:15" # successive members start at 15min deltas
  137. /METHOD=1 # repeating schedule
  138. /NAME='Primary Sched'
  139. /DISABLE="su:05:00-su:18:00,mo:05:00-mo:18:00,tu:05:00-tu:18:00,we:05:00-we:18:00,th:05:00-th:18:00,fr:05:00-fr:18:00,sa:05:00-sa:18:00"
  140. )
  141. ON_SCHED: FRS_SCHEDULE (/OVERRIDE="su:00-sa:23:45" /METHOD=2)
  142. #
  143. # Define the FRS Settings Object.
  144. #
  145. SETTINGS: FRS_SETTINGS (
  146. /DN="cn=system,dc=frs0419,dc=nttest,dc=microsoft,dc=com"
  147. /ONAME = "cn=file replication service"
  148. )
  149. # # test # /DN="cn=dfs volumes,cn=file replication service,cn=system,dc=na,dc=erac,dc=com"
  150. # # test # /ONAME="cn=dfs root"
  151. #
  152. # Iterate through all branch servers in the "BCH" set.
  153. #
  154. for ($ib=0; $ib<scalar(@bchID); $ib++) {
  155. #
  156. # Call the subroutine defined above to create a replica set for this branch.
  157. # The notation <HUB>[$ib] is like an array reference in that it selects
  158. # a single item from the "HUB" server set defined above. The index value
  159. # can be an expression. Also note that set tags declared outside a
  160. # subroutine are global.
  161. #
  162. CREATE_WORK_RS ( /HA=<HUB>[$ib]
  163. /B=<BCH>[$ib]
  164. /SC1=<ON_SCHED>
  165. /SETTINGSDN=<SETTINGS>)
  166. #
  167. # offset the schedule by the next stagger amount for the next branch.
  168. #
  169. FRS_STAGGER (/SCHED=<PRIMARY_SCH>)
  170. }