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.

204 lines
4.7 KiB

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