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.

193 lines
5.2 KiB

  1. #
  2. # Check that command line parameter -DSERVERS=filename is supplied.
  3. #
  4. .FRS_EVAL (if (!exists $CMD_VARS{"SERVERS"}) {print STDERR "ERROR - Required parameter -DSERVERS=filename not found."; exit} )
  5. #
  6. # The following is the Usage string for the generated script.
  7. #
  8. # The REPLICA_SET_NAME parameter could come from the command line of the
  9. # generated script or from the input file.
  10. #
  11. my $Usage = "
  12. Specific Usage: perl $0 [cmd options] \> output
  13. Process the genbchoff.mrs configuration script.
  14. Command line options must be prefixed with a dash.
  15. The required input options to this script are:
  16. -DREPLICA_SET_NAME=\"name of replica set\"
  17. The REPLICA_SET_NAME parameter overrides the value set to the
  18. \$replica_set_name variable in the server_input_file.
  19. ";
  20. #
  21. # Output the Usage string if generated script is invoked with -? or -h
  22. #
  23. FRSSUP::CheckForHelp(\%CMD_PARS, \$Usage);
  24. #
  25. # The following function creates the connection objects for a hub spoke topology.
  26. #
  27. FRS_SUB CREATE_HUB_SPOKE_CONN(/HUBSET=SET_REF_SET # Hubs
  28. /BCHSET=SET_REF_SET # Branches
  29. /SC1=SCHEDULE )
  30. $Hx = 0;
  31. $NHub = FRS_COUNT_SET(/SET=%HUBSET%);
  32. #print " NHUB = $NHub\n\n";
  33. #
  34. # RESTRICTION: don't PUT FRS FUNCTION REFS INSIDE A QUOTED STRING.
  35. #
  36. #print " NBCH FRS _COUNT_SET( /SET= % BCHSET % ) ", FRS_COUNT_SET(/SET= %BCHSET% ), "\n" ;
  37. #
  38. # Create the topology
  39. #
  40. foreach $bch (FRS_ARRAY(/SET=%BCHSET%)) {
  41. #print "working on branch: $bch->{MNAME}\n";
  42. $hubsrv = %HUBSET%[$Hx];
  43. #
  44. # RESTRICTION: need braces around MNAME.
  45. #
  46. FRS_CONNECTION (/TO=$bch /FROM=%HUBSET%[$Hx] /SCHED=%SC1%
  47. /TIME_ZONE=$bch->{time_zone}
  48. /ONAME="FROM-".$hubsrv->{MNAME}."-TO-".$bch->{MNAME} )
  49. FRS_CONNECTION (/TO=%HUBSET%[$Hx] /FROM=$bch /SCHED=%SC1%
  50. /TIME_ZONE=$hubsrv->{time_zone}
  51. /ONAME="FROM-".$bch->{MNAME}."-TO-".$hubsrv->{MNAME} )
  52. $Hx=($Hx+1) % $NHub;
  53. if ($Hx == 0) {
  54. FRS_STAGGER (/SCHED=%SC1%)
  55. }
  56. }
  57. FRS_END_SUB
  58. #
  59. # The following function creates the connection objects for a ring topology.
  60. #
  61. FRS_SUB CREATE_RING_CONN(/HUBSET=SET_REF_SET )
  62. #FRS_SHOW(/SET=%HUBSET%)
  63. $Ringx = 0;
  64. $RingCount = FRS_COUNT_SET(/SET=%HUBSET%);
  65. #print " RingCount = $RingCount\n\n";
  66. #
  67. # Create the topology
  68. #
  69. for ($Ringx=0; $Ringx < $RingCount-1; $Ringx++) {
  70. $RM1 = %HUBSET%[$Ringx];
  71. $RM2 = %HUBSET%[($Ringx+1) % $RingCount];
  72. #
  73. # RESTRICTION: need braces around MNAME.
  74. #
  75. FRS_CONNECTION (/TO=$RM1 /FROM=$RM2 /SCHED=ON
  76. /TIME_ZONE=$RM1->{time_zone}
  77. /ONAME="FROM-".$RM2->{MNAME}."-TO-".$RM1->{MNAME} )
  78. FRS_CONNECTION (/TO=$RM2 /FROM=$RM1 /SCHED=ON
  79. /TIME_ZONE=$RM2->{time_zone}
  80. /ONAME="FROM-".$RM1->{MNAME}."-TO-".$RM2->{MNAME} )
  81. }
  82. FRS_END_SUB
  83. #
  84. # The following function builds the member objects for a hub spoke topology
  85. # and creates the connection objects.
  86. #
  87. FRS_SUB CREATE_HUB_SPOKE(/HUBSET=SET_REF_SET # Hubs
  88. /BCHSET=SET_REF_SET # branches
  89. /SC1=SCHEDULE
  90. /REPSETDN=SET_ELEMENT)
  91. #FRSSUP::PrintHash(\%__args);
  92. #FRS_SHOW(/SET=%HUBSET%)
  93. #
  94. # Create the hub member objects
  95. #
  96. # Restriction: All subroutine argument refs are surrounded by "%".
  97. # References to parameters in other objects use the
  98. # notation "->{...}". e.g. COMPUTER, MNAME, id
  99. #
  100. foreach $hub (FRS_ARRAY(/SET=%HUBSET%)) {
  101. MOBJHUB: FRS_MEMBER (/UNDER=%REPSETDN%
  102. /SERVER=$hub
  103. /COMPUTER=$hub->{COMPUTER}
  104. /ONAME=$hub->{MNAME} )
  105. }
  106. #
  107. # create the branch member objects.
  108. #
  109. foreach $bch (FRS_SET(/SET=%BCHSET%)) {
  110. MOBJBCH: FRS_MEMBER (/UNDER=%REPSETDN%
  111. /SERVER=$bch
  112. /COMPUTER=$bch->{COMPUTER}
  113. /ONAME=$bch->{MNAME} )
  114. }
  115. CREATE_RING_CONN(/HUBSET=<MOBJHUB> )
  116. CREATE_HUB_SPOKE_CONN(/HUBSET=<MOBJHUB> # Hubs
  117. /BCHSET=<MOBJBCH> # Branches
  118. /SC1=%SC1% )
  119. FRS_END_SUB
  120. #
  121. # Pull in the server declaration file.
  122. #
  123. .FRS_INCLUDE ($CMD_VARS{"SERVERS"})
  124. if (exists $CMD_VARS{"REPLICA_SET_NAME"}) {
  125. $replica_set_name = $CMD_VARS{"REPLICA_SET_NAME"};
  126. }
  127. FRSSUP::ShowHelp("ERROR - Required parameter replica set name not found.", \$Usage) if (!defined $replica_set_name);
  128. SET: FRS_REPLICASET (/UNDER=<SETTINGS> /TYPE=DFS /ONAME=$replica_set_name)
  129. CREATE_HUB_SPOKE(/HUBSET=<HUB> # Hubs
  130. /BCHSET=<BCH> # Branches
  131. /SC1=<PRIMARY_SCH>
  132. /REPSETDN=<SET>)