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
8.1 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2002 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // TaskAnalyzeClusterBase.h
  7. //
  8. // Description:
  9. // CTaskAnalyzeClusterBase declaration.
  10. //
  11. // Maintained By:
  12. // Galen Barbee (GalenB) 01-APR-2002
  13. //
  14. //////////////////////////////////////////////////////////////////////////////
  15. // Make sure that this file is included only once per compile path.
  16. #pragma once
  17. //////////////////////////////////////////////////////////////////////////////
  18. // Include Files
  19. //////////////////////////////////////////////////////////////////////////////
  20. #include "TaskTracking.h"
  21. //////////////////////////////////////////////////////////////////////////////
  22. // Constant Declarations
  23. //////////////////////////////////////////////////////////////////////////////
  24. #define SSR_ANALYSIS_FAILED( _major, _minor, _hr ) \
  25. { \
  26. HRESULT hrTemp; \
  27. hrTemp = THR( HrSendStatusReport( NULL, _major, _minor, 1, 1, 1, _hr, IDS_ERR_ANALYSIS_FAILED_TRY_TO_REANALYZE ) ); \
  28. if ( FAILED( hrTemp ) && SUCCEEDED( _hr ) ) \
  29. { \
  30. _hr = hrTemp; \
  31. } \
  32. }
  33. //////////////////////////////////////////////////////////////////////////////
  34. //++
  35. //
  36. // class CTaskAnalyzeClusterBase
  37. //
  38. // Description:
  39. // This is the base class for the two different analysis tasks.
  40. //
  41. //--
  42. //////////////////////////////////////////////////////////////////////////////
  43. class CTaskAnalyzeClusterBase
  44. : public CTaskTracking
  45. , public IClusCfgCallback
  46. , public INotifyUI
  47. {
  48. private:
  49. // IUnknown
  50. LONG m_cRef;
  51. // ITaskAnalyzeClusterBase
  52. OBJECTCOOKIE m_cookieCompletion; // Task completion cookie
  53. IClusCfgCallback * m_pcccb; // Callback interface
  54. OBJECTCOOKIE * m_pcookies; // Completion cookies for the subtasks.
  55. ULONG m_cCookies; // Count of completion cookies in m_pcookies
  56. ULONG m_cNodes; // Count of nodes in configuration
  57. HANDLE m_event; // Synchronization event to signal when subtasks have completed.
  58. BOOL m_fJoiningMode; // FALSE = forming mode. TRUE = joining mode.
  59. ULONG m_cUserNodes; // The count of nodes that the user entered. It is also the "sizeof" the array, m_pcookiesUser.
  60. OBJECTCOOKIE * m_pcookiesUser; // The cookies of nodes that the user entered.
  61. BSTR m_bstrNodeName;
  62. IClusCfgVerifyQuorum * ((*m_prgQuorumsToCleanup)[]);
  63. ULONG m_idxQuorumToCleanupNext;
  64. INotifyUI * m_pnui;
  65. ITaskManager * m_ptm;
  66. IConnectionManager * m_pcm;
  67. BOOL m_fStop;
  68. // INotifyUI
  69. ULONG m_cSubTasksDone; // The number of subtasks done.
  70. HRESULT m_hrStatus; // Status of callbacks
  71. // Private copy constructor to prevent copying.
  72. CTaskAnalyzeClusterBase( const CTaskAnalyzeClusterBase & nodeSrc );
  73. // Private assignment operator to prevent copying.
  74. const CTaskAnalyzeClusterBase & operator = ( const CTaskAnalyzeClusterBase & nodeSrc );
  75. private:
  76. HRESULT HrWaitForClusterConnection( void );
  77. HRESULT HrCountNumberOfNodes( void );
  78. HRESULT HrCreateSubTasksToGatherNodeInfo( void );
  79. HRESULT HrCreateSubTasksToGatherNodeResourcesAndNetworks( void );
  80. HRESULT HrCheckClusterFeasibility( void );
  81. HRESULT HrAddJoinedNodes( void );
  82. HRESULT HrCheckNodeDomains( void );
  83. HRESULT HrCheckClusterMembership( void );
  84. HRESULT HrCompareResources( void );
  85. HRESULT HrCheckForCommonQuorumResource( void );
  86. HRESULT HrCompareNetworks( void );
  87. HRESULT HrCreateNewNetworkInClusterConfiguration( IClusCfgNetworkInfo * pccmriIn, IClusCfgNetworkInfo ** ppccmriNewOut );
  88. HRESULT HrFreeCookies( void );
  89. HRESULT HrCheckInteroperability( void );
  90. HRESULT HrEnsureAllJoiningNodesSameVersion( DWORD * pdwNodeHighestVersionOut, DWORD * pdwNodeLowestVersionOut, bool * pfAllNodesMatchOut );
  91. HRESULT HrGetUsersNodesCookies( void );
  92. HRESULT HrIsUserAddedNode( BSTR bstrNodeNameIn );
  93. HRESULT HrResourcePrivateDataExchange( IClusCfgManagedResourceInfo * pccmriClusterIn, IClusCfgManagedResourceInfo * pccmriNodeIn );
  94. HRESULT HrCheckQuorumCapabilities( IClusCfgManagedResourceInfo * pccmriNodeResourceIn, OBJECTCOOKIE nodeCookieIn );
  95. HRESULT HrCleanupTask( HRESULT hrCompletionStatusIn );
  96. HRESULT HrAddResurceToCleanupList( IClusCfgVerifyQuorum * piccvqIn );
  97. HRESULT HrCheckPlatformInteroperability( void );
  98. HRESULT HrGetAClusterNodeCookie( IEnumCookies ** ppecNodesOut, DWORD * pdwClusterNodeCookieOut );
  99. HRESULT HrFormatProcessorArchitectureRef( WORD wClusterProcArchIn, WORD wNodeProcArchIn, LPCWSTR pcszNodeNameIn, BSTR * pbstrReferenceOut );
  100. HRESULT HrGetProcessorArchitectureString( WORD wProcessorArchitectureIn, BSTR * pbstrProcessorArchitectureOut );
  101. protected:
  102. OBJECTCOOKIE m_cookieCluster; // Cookie of the cluster to analyze
  103. IObjectManager * m_pom;
  104. BSTR m_bstrQuorumUID; // Quorum device UID
  105. BSTR m_bstrClusterName; // Name of the cluster to analyze
  106. CTaskAnalyzeClusterBase( void );
  107. virtual ~CTaskAnalyzeClusterBase( void );
  108. HRESULT HrInit( void );
  109. HRESULT HrSendStatusReport( LPCWSTR pcszNodeNameIn, CLSID clsidMajorIn, CLSID clsidMinorIn, ULONG ulMinIn, ULONG ulMaxIn, ULONG ulCurrentIn, HRESULT hrIn, int nDescriptionIdIn );
  110. HRESULT HrCreateNewManagedResourceInClusterConfiguration( IClusCfgManagedResourceInfo * pccmriIn, IClusCfgManagedResourceInfo ** ppccmriNewOut );
  111. //
  112. // Overrideable functions.
  113. //
  114. virtual HRESULT HrCreateNewResourceInCluster(
  115. IClusCfgManagedResourceInfo * pccmriIn
  116. , BSTR bstrNodeResNameIn
  117. , BSTR * pbstrNodeResUIDInout
  118. , BSTR bstrNodeNameIn
  119. ) = 0;
  120. virtual HRESULT HrCreateNewResourceInCluster(
  121. IClusCfgManagedResourceInfo * pccmriIn
  122. , IClusCfgManagedResourceInfo ** ppccmriOut
  123. ) = 0;
  124. virtual HRESULT HrCompareDriveLetterMappings( void ) = 0;
  125. virtual HRESULT HrFixupErrorCode( HRESULT hrIn ) = 0;
  126. virtual BOOL BMinimalConfiguration( void ) = 0;
  127. virtual void GetNodeCannotVerifyQuorumStringRefId( DWORD * pdwRefIdOut ) = 0;
  128. virtual void GetNoCommonQuorumToAllNodesStringIds( DWORD * pdwMessageIdOut, DWORD * pdwRefIdOut ) = 0;
  129. virtual HRESULT HrShowLocalQuorumWarning( void ) = 0;
  130. //
  131. // IUnknown implemetation
  132. //
  133. ULONG UlAddRef( void );
  134. ULONG UlRelease( void );
  135. //
  136. // IDoTask / ITaskAnalyzeClusterBase implementation
  137. //
  138. HRESULT HrBeginTask( void );
  139. HRESULT HrStopTask( void );
  140. HRESULT HrSetJoiningMode( void );
  141. HRESULT HrSetCookie( OBJECTCOOKIE cookieIn );
  142. HRESULT HrSetClusterCookie( OBJECTCOOKIE cookieClusterIn );
  143. public:
  144. //
  145. // IClusCfgCallback
  146. //
  147. STDMETHOD( SendStatusReport )(
  148. LPCWSTR pcszNodeNameIn
  149. , CLSID clsidTaskMajorIn
  150. , CLSID clsidTaskMinorIn
  151. , ULONG ulMinIn
  152. , ULONG ulMaxIn
  153. , ULONG ulCurrentIn
  154. , HRESULT hrStatusIn
  155. , LPCWSTR pcszDescriptionIn
  156. , FILETIME * pftTimeIn
  157. , LPCWSTR pcszReferenceIn
  158. );
  159. //
  160. // INotifyUI
  161. //
  162. STDMETHOD( ObjectChanged )( OBJECTCOOKIE cookieIn );
  163. }; //*** class CTaskAnalyzeClusterBase