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.

169 lines
5.5 KiB

  1. ## Command line defined variables.
  2. ## SERVERS => 'genbchoff.srv'
  3. ## Command line defined parameters.
  4. use frsobjsup;
  5. package main;
  6. my ($__HashRef, $__k, $__v);
  7. my (%CMD_VARS, %CMD_PARS);
  8. &FRSSUP::ProcessCmdLine(\%CMD_VARS, \%CMD_PARS);
  9. my $Usage = "
  10. Specific Usage: perl $0 [cmd options] \> output
  11. Process the genbchoff.mrs configuration script.
  12. Command line options must be prefixed with a dash.
  13. The required input options to this script are:
  14. -DREPLICA_SET_NAME=\"name of replica set\"
  15. The REPLICA_SET_NAME parameter overrides the value set to the
  16. \$replica_set_name variable in the server_input_file.
  17. ";
  18. FRSSUP::CheckForHelp(\%CMD_PARS, \$Usage);
  19. sub CREATE_HUB_SPOKE_CONN {
  20. my %__args = (@_);
  21. my ($__HashRef, $__k, $__v);
  22. $Hx = 0;
  23. $NHub = scalar @{
  24. $__args{HUBSET} }
  25. ;
  26. #print " NHUB = $NHub\n\n"
  27. #print " NBCH FRS _COUNT_SET( /SET= % BCHSET % ) "
  28. foreach $bch ( @{
  29. $__args{BCHSET} }
  30. ) {
  31. #print "working on branch: $bch->{MNAME}\n"
  32. $hubsrv = $__args{HUBSET}[$Hx];
  33. FRS_CONNECTION->New(
  34. TO=>$bch, FROM=>$__args{HUBSET}[$Hx], SCHED=>$__args{SC1}, TIME_ZONE=>$bch->{time_zone}, ONAME=>"FROM-".$hubsrv->{MNAME}."-TO-".$bch->{MNAME}
  35. );
  36. FRS_CONNECTION->New(
  37. TO=>$__args{HUBSET}[$Hx], FROM=>$bch, SCHED=>$__args{SC1}, TIME_ZONE=>$hubsrv->{time_zone}, ONAME=>"FROM-".$bch->{MNAME}."-TO-".$hubsrv->{MNAME}
  38. );
  39. $Hx=($Hx+1) % $NHub;
  40. if ($Hx == 0) {
  41. FRS_SCHEDULE::FRS_STAGGER(
  42. SCHED=>$__args{SC1} );
  43. }
  44. }
  45. } # FRS_END_SUB
  46. sub CREATE_RING_CONN {
  47. my %__args = (@_);
  48. my ($__HashRef, $__k, $__v);
  49. $Ringx = 0;
  50. $RingCount = scalar @{
  51. $__args{HUBSET} }
  52. ;
  53. #print " RingCount = $RingCount\n\n"
  54. for ($Ringx=0; $Ringx < $RingCount-1; $Ringx++) {
  55. $RM1 = $__args{HUBSET}[$Ringx];
  56. $RM2 = $__args{HUBSET}[($Ringx+1) % $RingCount];
  57. FRS_CONNECTION->New(
  58. TO=>$RM1, FROM=>$RM2, SCHED=>ON, TIME_ZONE=>$RM1->{time_zone}, ONAME=>"FROM-".$RM2->{MNAME}."-TO-".$RM1->{MNAME}
  59. );
  60. FRS_CONNECTION->New(
  61. TO=>$RM2, FROM=>$RM1, SCHED=>ON, TIME_ZONE=>$RM2->{time_zone}, ONAME=>"FROM-".$RM1->{MNAME}."-TO-".$RM2->{MNAME}
  62. );
  63. }
  64. } # FRS_END_SUB
  65. sub CREATE_HUB_SPOKE {
  66. my %__args = (@_);
  67. my ($__HashRef, $__k, $__v);
  68. #FRSSUP::PrintHash(\%
  69. # Restriction: All subroutine argument refs are surrounded by "%"
  70. # notation "->{...}"
  71. foreach $hub ( @{
  72. $__args{HUBSET} }
  73. ) {
  74. $__HashRef = FRS_MEMBER->New(
  75. UNDER=>$__args{REPSETDN}, SERVER=>$hub, COMPUTER=>$hub->{COMPUTER}, ONAME=>$hub->{MNAME}
  76. );
  77. &FRSSUP::AddToSet("MOBJHUB", $__HashRef);
  78. }
  79. foreach $bch ( @{ FRSSUP::FRS_SET(
  80. SET=>$__args{BCHSET} ) }
  81. ) {
  82. $__HashRef = FRS_MEMBER->New(
  83. UNDER=>$__args{REPSETDN}, SERVER=>$bch, COMPUTER=>$bch->{COMPUTER}, ONAME=>$bch->{MNAME}
  84. );
  85. &FRSSUP::AddToSet("MOBJBCH", $__HashRef);
  86. }
  87. &CREATE_RING_CONN (
  88. HUBSET=>&FRSSUP::SelectSet(MOBJHUB) );
  89. &CREATE_HUB_SPOKE_CONN (
  90. HUBSET=>&FRSSUP::SelectSet(MOBJHUB), BCHSET=>&FRSSUP::SelectSet(MOBJBCH), SC1=>$__args{SC1} );
  91. &FRSSUP::DeleteSet("MOBJHUB");
  92. &FRSSUP::DeleteSet("MOBJBCH");
  93. } # FRS_END_SUB
  94. $replica_set_name = "genbchoff-test-1hub";
  95. $__HashRef = FRS_SETTINGS->New(
  96. DN=>"cn=system,dc=frs0419,dc=nttest,dc=microsoft,dc=com", ONAME=>"cn=file replication service"
  97. );
  98. &FRSSUP::AddToSet("SETTINGS", $__HashRef);
  99. $__HashRef = FRS_SERVER->New(
  100. COMPUTER=>'FRSDIFF\\sudarctest1$', DNS_NAME=>"sudarctest1.frs0419.nttest.microsoft.com", MNAME=>"H-sudarctest1", RP=>"E:\\RSB", SP=>"D:\\staging", MAKE_PRIMARY_MEMBER=>TRUE
  101. );
  102. &FRSSUP::AddToSet("HUB", $__HashRef);
  103. $__HashRef = FRS_SERVER->New(
  104. COMPUTER=>'FRSDIFF\\sudarctest4$', DNS_NAME=>"sudarctest4.frs0419.nttest.microsoft.com", MNAME=>"B-sudarctest4", RP=>"D:\\RSB", SP=>"D:\\staging"
  105. );
  106. &FRSSUP::AddToSet("BCH", $__HashRef);
  107. $__HashRef = FRS_SERVER->New(
  108. COMPUTER=>'FRSDIFF\\DREWSAM-SRV$', DNS_NAME=>"DREWSAM-SRV.frs0419.nttest.microsoft.com", MNAME=>"B-DREWSAM-SRV", RP=>"D:\\RSB", SP=>"D:\\staging"
  109. );
  110. &FRSSUP::AddToSet("BCH", $__HashRef);
  111. $__HashRef = FRS_SERVER->New(
  112. COMPUTER=>'FRSDIFF\\sudarctest2$', DNS_NAME=>"sudarctest2.frs0419.nttest.microsoft.com", MNAME=>"B-sudarctest2", RP=>"D:\\RSB", SP=>"D:\\staging"
  113. );
  114. &FRSSUP::AddToSet("BCH", $__HashRef);
  115. $__HashRef = FRS_SCHEDULE->New(
  116. REPL_INTERVAL=>4, REPL_DURATION=>"1:30", TIME_ZONE=>"-5:00", REPL_OFFSET=>0, STAGGER=>"0:15", METHOD=>1, NAME=>'Primary Sched', DISABLE=>"mo:07:30-mo:18:00,tu:07:30-tu:18:00,we:07:30-we:18:00,th:07:30-th:18:00,fr:07:30-fr:18:00"
  117. );
  118. &FRSSUP::AddToSet("PRIMARY_SCH", $__HashRef);
  119. if (exists $CMD_VARS{"REPLICA_SET_NAME"}) {
  120. $replica_set_name = $CMD_VARS{"REPLICA_SET_NAME"};
  121. }
  122. FRSSUP::ShowHelp("ERROR - Required parameter replica set name not found.", \$Usage) if (!defined $replica_set_name);
  123. $__HashRef = FRS_REPLICASET->New(
  124. UNDER=>&FRSSUP::SelectSet(SETTINGS)->[0], TYPE=>DFS, ONAME=>$replica_set_name
  125. );
  126. &FRSSUP::AddToSet("SET", $__HashRef);
  127. &CREATE_HUB_SPOKE (
  128. HUBSET=>&FRSSUP::SelectSet(HUB), BCHSET=>&FRSSUP::SelectSet(BCH), SC1=>&FRSSUP::SelectSet(PRIMARY_SCH)->[0], REPSETDN=>&FRSSUP::SelectSet(SET)->[0] );
  129. __END__