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.

207 lines
4.7 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1999-2001 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // CClusNetCreate.cpp
  7. //
  8. // Description:
  9. // Contains the definition of the CClusNetCreate class.
  10. //
  11. // Maintained By:
  12. // David Potter (DavidP) 14-JUN-2001
  13. // Vij Vasu (Vvasu) 08-MAR-2000
  14. //
  15. //////////////////////////////////////////////////////////////////////////////
  16. //////////////////////////////////////////////////////////////////////////////
  17. // Include Files
  18. //////////////////////////////////////////////////////////////////////////////
  19. // The precompiled header.
  20. #include "Pch.h"
  21. // The header for this file
  22. #include "CClusNetCreate.h"
  23. // For the CBaseClusterAddNode class.
  24. #include "CBaseClusterAddNode.h"
  25. //////////////////////////////////////////////////////////////////////////////
  26. //++
  27. //
  28. // CClusNetCreate::CClusNetCreate
  29. //
  30. // Description:
  31. // Constructor of the CClusNetCreate class
  32. //
  33. // Arguments:
  34. // pbcaParentActionIn
  35. // Pointer to the base cluster action of which this action is a part.
  36. //
  37. // Return Value:
  38. // None.
  39. //
  40. // Exceptions Thrown:
  41. // CAssert
  42. // If the parameters are incorrect.
  43. //
  44. // Any exceptions thrown by underlying functions
  45. //
  46. //--
  47. //////////////////////////////////////////////////////////////////////////////
  48. CClusNetCreate::CClusNetCreate(
  49. CBaseClusterAddNode * pbcanParentActionIn
  50. )
  51. : BaseClass( pbcanParentActionIn )
  52. {
  53. TraceFunc( "" );
  54. SetRollbackPossible( true );
  55. TraceFuncExit();
  56. } //*** CClusNetCreate::CClusNetCreate
  57. //////////////////////////////////////////////////////////////////////////////
  58. //++
  59. //
  60. // CClusNetCreate::~CClusNetCreate
  61. //
  62. // Description:
  63. // Destructor of the CClusNetCreate class.
  64. //
  65. // Arguments:
  66. // None.
  67. //
  68. // Return Value:
  69. // None.
  70. //
  71. // Exceptions Thrown:
  72. // Any exceptions thrown by underlying functions
  73. //
  74. //--
  75. //////////////////////////////////////////////////////////////////////////////
  76. CClusNetCreate::~CClusNetCreate( void )
  77. {
  78. TraceFunc( "" );
  79. TraceFuncExit();
  80. } //*** CClusNetCreate::~CClusNetCreate
  81. //////////////////////////////////////////////////////////////////////////////
  82. //++
  83. //
  84. // CClusNetCreate::Commit
  85. //
  86. // Description:
  87. // Create and start the service.
  88. //
  89. // Arguments:
  90. // None.
  91. //
  92. // Return Value:
  93. // None.
  94. //
  95. // Exceptions Thrown:
  96. // Any that are thrown by the contained actions.
  97. //
  98. //--
  99. //////////////////////////////////////////////////////////////////////////////
  100. void
  101. CClusNetCreate::Commit( void )
  102. {
  103. TraceFunc( "" );
  104. // Call the base class commit method.
  105. BaseClass::Commit();
  106. try
  107. {
  108. ConfigureService();
  109. } // try:
  110. catch( ... )
  111. {
  112. // If we are here, then something went wrong with the create.
  113. LogMsg( "[BC] Caught exception during commit." );
  114. //
  115. // Cleanup anything that the failed create might have done.
  116. // Catch any exceptions thrown during Cleanup to make sure that there
  117. // is no collided unwind.
  118. //
  119. try
  120. {
  121. CleanupService( );
  122. }
  123. catch( ... )
  124. {
  125. //
  126. // The rollback of the committed action has failed.
  127. // There is nothing that we can do.
  128. // We certainly cannot rethrow this exception, since
  129. // the exception that caused the rollback is more important.
  130. //
  131. TW32( ERROR_CLUSCFG_ROLLBACK_FAILED );
  132. LogMsg( "[BC] THIS COMPUTER MAY BE IN AN INVALID STATE. Caught an exception during cleanup." );
  133. } // catch: all
  134. // Rethrow the exception thrown by commit.
  135. throw;
  136. } // catch: all
  137. // If we are here, then everything went well.
  138. SetCommitCompleted( true );
  139. TraceFuncExit();
  140. } //*** CClusNetCreate::Commit
  141. //////////////////////////////////////////////////////////////////////////////
  142. //++
  143. //
  144. // CClusNetCreate::Rollback
  145. //
  146. // Description:
  147. // Cleanup the service.
  148. //
  149. // Arguments:
  150. // None.
  151. //
  152. // Return Value:
  153. // None.
  154. //
  155. // Exceptions Thrown:
  156. // Any that are thrown by the underlying functions.
  157. //
  158. //--
  159. //////////////////////////////////////////////////////////////////////////////
  160. void
  161. CClusNetCreate::Rollback( void )
  162. {
  163. TraceFunc( "" );
  164. // Call the base class rollback method.
  165. BaseClass::Rollback();
  166. // Cleanup this action.
  167. CleanupService();
  168. SetCommitCompleted( false );
  169. TraceFuncExit();
  170. } //*** CClusNetCreate::Rollback