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.

200 lines
7.6 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. $domain = "na";
  34. #
  35. # define a "subroutine" to do the actual creation of the two member
  36. # replica set. Each user defined calling parameter is
  37. # associated with an argument type for use when the "subroutine" is called.
  38. #
  39. # Restriction: All "subroutines" must be defined before they are first called.
  40. #
  41. FRS_SUB CREATE_WORK_RS(/HA=SET_ELEMENT # Hub server
  42. /B=VARCON # Branch server
  43. /SC1=SCHEDULE # schedule
  44. /SETTINGSDN=SET_ELEMENT ) # The parent Settings object
  45. #
  46. # Define an FRS replica set object under the settingsdn object.
  47. # The object name for the FRS Replica Set object is based on the {rep_set_name}
  48. # parameter from the branch server object.
  49. #
  50. # Restriction: All subroutine argument refs are surrounded by "%".
  51. # References to parameters in other objects use the
  52. # notation "->{...}".
  53. #
  54. SET: FRS_REPLICASET (/UNDER=%SETTINGSDN% /TYPE=DFS
  55. /ONAME=%B%->{rep_set_name})
  56. #
  57. # Create the two FRS member objects underneath the SET object just created.
  58. # Parameters for the member object attributes come from the /SERVER argument
  59. # but they can also be replaced by paramters to the FRS_MEMBER command.
  60. # For example, the staging and root paths come from the /SERVER argument but the
  61. # root path could be changed by adding "/RP="newroot"" to the param list below.
  62. #
  63. # Restriction: References to tags that name a set of objects are
  64. # surrounded by angle brackets. So "<SET>" below refers
  65. # the FRS_REPLICASET object just defined above.
  66. #
  67. MHA: FRS_MEMBER (/UNDER=<SET> /SERVER=%HA% /COMPUTER=%HA%->{COMPUTER}
  68. /ONAME="ComputerObjectGuid" /MAKE_PRIMARY_MEMBER )
  69. MB: FRS_MEMBER (/UNDER=<SET> /SERVER=%B% /COMPUTER=%B%->{COMPUTER}
  70. /ONAME="ComputerObjectGuid" )
  71. #
  72. # Create the connection objects between the members defined above.
  73. # Note use of angle brackets.
  74. # To use the timezone supplied on the branch's FRS_SERVER object
  75. # add the following parameter to each FRS_CONNECTION object below.
  76. # /TIME_ZONE=%B%->{time_zone}
  77. #
  78. FRS_CONNECTION (/TO=<MB> /FROM=<MHA> /SCHED=%SC1%
  79. /ONAME="FROM-".%HA%->{ONAME}."-TO-".%B%->{ONAME} )
  80. FRS_CONNECTION (/TO=<MHA> /FROM=<MB> /SCHED=%SC1%
  81. /ONAME="FROM-".%B%->{ONAME}."-TO-".%HA%->{ONAME} )
  82. #
  83. # The tags defined above (i.e. SET, MHA, and MB) are local to the
  84. # subroutine. They are undefined when the subroutine completes.
  85. #
  86. FRS_END_SUB
  87. #
  88. # Create the parameters for the FRS_SERVER objects for each branch.
  89. #
  90. for ($ib=0; $ib<scalar(@bchID); $ib++) {
  91. # The branch name ($bchName) is a concatenation (use of ".") of the rootpath
  92. # branch id parameter and a constant suffix.
  93. # The hub root path uses the branch name (no "." since inside dbl-quotes)
  94. # so it is unique for each replica set serviced by this hub.
  95. # In FRS, no two replica sets on the same server can have overlapping root paths.
  96. $bchName = $bchID[$ib] . "-I01";
  97. $bchNt4Acct = "$domain\\$bchName\$"; # need to define outside of params due to trailing $
  98. $hubName = "STL-FSNA-I" . $hubID[$ib];
  99. $hubRootPath = "C:\\BRANCHES\\$bchName"; # need double slashes outside params
  100. $hubNt4Acct = "$domain\\$hubName\$"; # need to define outside of params due to trailing $
  101. HUB: FRS_SERVER (/RP=$hubRootPath
  102. /SP="C:\FRS-STAGING" # can use single slashes inside params
  103. /COMPUTER=$hubNt4Acct
  104. /ONAME=$hubName
  105. /DNS_NAME="$hubName.$domain.erac.com"
  106. )
  107. BCH: FRS_SERVER (/RP="D:\USERS"
  108. /SP="C:\FRS-STAGING"
  109. /COMPUTER=$bchNt4Acct
  110. /ONAME=$bchName
  111. /time_zone=$bchTimeZone[$ib] # carry the timezone thru the server data.
  112. /DNS_NAME="$bchName.$domain.erac.com"
  113. /rep_set_name="dfsroot|$bchName" )
  114. }
  115. #
  116. # Restriction: Any time with a ":" must be enclosed in quotes. See /REPL_DURATION,
  117. # /TIME_ZONE and /DISABLE below.
  118. #
  119. # Restriction: The current schedule generator does not make efficient use of
  120. # daily variations in the blackout periods. Make the blackout
  121. # periods the same for each day of the week.
  122. #
  123. PRIMARY_SCH: FRS_SCHEDULE (/REPL_INTERVAL=24 # Once per day
  124. /REPL_DURATION="2:00" # 2 hour window
  125. /TIME_ZONE="-6:00" # Central time.
  126. /REPL_OFFSET="18:00" # starting offset
  127. /STAGGER="0:15" # successive members start at 15min deltas
  128. /METHOD=1 # repeating schedule
  129. /NAME='Primary Sched'
  130. /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"
  131. )
  132. ON_SCHED: FRS_SCHEDULE (/OVERRIDE="su:00-sa:23:45" /METHOD=2)
  133. #
  134. # Define the FRS Settings Object.
  135. #
  136. SETTINGS: FRS_SETTINGS (
  137. /DN="cn=dfs volumes,cn=file replication service,cn=system,dc=na,dc=erac,dc=com"
  138. /ONAME="cn=dfsroot"
  139. )
  140. #
  141. # Iterate through all branch servers in the "BCH" set.
  142. #
  143. for ($ib=0; $ib<scalar(@bchID); $ib++) {
  144. #
  145. # Call the subroutine defined above to create a replica set for this branch.
  146. # The notation <HUB>[$ib] is like an array reference in that it selects
  147. # a single item from the "HUB" server set defined above. The index value
  148. # can be an expression. Also note that set tags declared outside a
  149. # subroutine are global.
  150. #
  151. CREATE_WORK_RS ( /HA=<HUB>[$ib]
  152. /B=<BCH>[$ib]
  153. /SC1=<ON_SCHED>
  154. /SETTINGSDN=<SETTINGS>)
  155. #
  156. # offset the schedule by the next stagger amount for the next branch.
  157. #
  158. FRS_STAGGER (/SCHED=<PRIMARY_SCH>)
  159. }