Source code of Windows XP (NT5)
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.

186 lines
8.2 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1999-2001 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // PostCfgManager.h
  7. //
  8. // Description:
  9. // CPostCfgManager implementation.
  10. //
  11. // Maintained By:
  12. // Galen Barbee (GalenB) 09-JUN-2000
  13. //
  14. //////////////////////////////////////////////////////////////////////////////
  15. // Make sure that this file is included only once per compile path.
  16. #pragma once
  17. //////////////////////////////////////////////////////////////////////////////
  18. // Include Files
  19. //////////////////////////////////////////////////////////////////////////////
  20. //////////////////////////////////////////////////////////////////////////////
  21. // Constant Declarations
  22. //////////////////////////////////////////////////////////////////////////////
  23. //////////////////////////////////////////////////////////////////////////////
  24. //++
  25. //
  26. // class CPostCfgManager
  27. //
  28. // Description:
  29. // The class CPostCfgManager inplements the PostCfgManager
  30. // interface.
  31. //
  32. // Interfaces:
  33. // IPostCfgManager
  34. // IClusCfgInitialize
  35. // IClusCfgCallback
  36. //
  37. //--
  38. //////////////////////////////////////////////////////////////////////////////
  39. class
  40. CPostCfgManager
  41. : public IPostCfgManager // private
  42. , public IClusCfgInitialize
  43. , public IClusCfgCallback
  44. {
  45. private:
  46. //
  47. // Private types
  48. //
  49. // Stucture for one entry in the resource type GUID to resource type name map.
  50. struct SResTypeGUIDAndName
  51. {
  52. GUID m_guidTypeGUID;
  53. WCHAR * m_pszTypeName;
  54. }; //*** SResTypeGUIDAndName
  55. // IUnknown
  56. LONG m_cRef; // Reference counter
  57. // Pointer to the callback interface.
  58. IClusCfgCallback * m_pcccb; // Callback to the client
  59. // The locale id
  60. LCID m_lcid; // Local ID of the client
  61. // IPostCfgManager
  62. IEnumClusCfgManagedResources * m_peccmr; // Enumer of managed resources
  63. IClusCfgClusterInfo * m_pccci; // Cluster configuration list
  64. ULONG m_cResources; // Count of resources in list
  65. ULONG m_cAllocedResources; // Count of alloc'ed resources
  66. CResourceEntry ** m_rgpResources; // List of pointers to Resource Entries
  67. ULONG m_idxIPAddress; // Cluster IP Address resource index
  68. ULONG m_idxClusterName; // Cluster Name resource index
  69. ULONG m_idxQuorumResource; // Quorum resource index
  70. ULONG m_idxLastStorage; // Last storage resource examined
  71. HCLUSTER m_hCluster; // Cluster handle
  72. ULONG m_cNetName; // Net Name instance counter
  73. ULONG m_cIPAddress; // IP Address instance counter
  74. SResTypeGUIDAndName * m_pgnResTypeGUIDNameMap; // Map between resource type GUID and its name
  75. ULONG m_idxNextMapEntry; // Index of the first free map entry
  76. ULONG m_cMapSize; // Count of the number of elements in the map buffer.
  77. DWORD m_dwLocalQuorumStatusMax; // The max of the status report range for local quorum deletion.
  78. ECommitMode m_ecmCommitChangesMode; // What are we doing, create cluster, adding nodes, or cleaning up?
  79. BOOL m_isQuorumChanged:1; // Set this flag if a better quorum resource has been found.
  80. BSTR m_bstrNodeName;
  81. private: // Methods
  82. CPostCfgManager( void );
  83. ~CPostCfgManager( void );
  84. // Private copy constructor to prevent copying.
  85. CPostCfgManager( const CPostCfgManager & nodeSrc );
  86. // Private assignment operator to prevent copying.
  87. const CPostCfgManager & operator = ( const CPostCfgManager & nodeSrc );
  88. HRESULT HrInit( void );
  89. HRESULT HrPreCreateResources( void );
  90. HRESULT HrCreateGroups( void );
  91. HRESULT HrCreateResources( void );
  92. HRESULT HrPostCreateResources( void );
  93. HRESULT HrFindNextSharedStorage( ULONG * pidxInout );
  94. HRESULT HrAttemptToAssignStorageToResource( ULONG idxResourceIn, EDependencyFlags dfResourceFlagsIn );
  95. HRESULT HrMovedDependentsToAnotherResource( ULONG idxSourceIn, ULONG idxDestIn );
  96. HRESULT HrSetGroupOnResourceAndItsDependents( ULONG idxResourceIn, CGroupHandle * pghIn );
  97. HRESULT HrFindGroupFromResourceOrItsDependents( ULONG idxResourceIn, CGroupHandle ** pghOut );
  98. HRESULT HrCreateResourceAndDependents( ULONG idxResourceIn );
  99. HRESULT HrPostCreateResourceAndDependents( ULONG idxResourceIn );
  100. HRESULT HrPreInitializeExistingResources( void );
  101. HRESULT HrAddSpecialResource( BSTR bstrNameIn, const CLSID * pclsidTypeIn, const CLSID * pclsidClassTypeIn );
  102. HRESULT HrCreateResourceInstance( ULONG idxResourceIn, HGROUP hGroupIn, LPCWSTR pszResTypeIn, HRESOURCE * phResourceOut );
  103. HRESULT HrGetCoreClusterResourceNames(
  104. BSTR * pbstrClusterNameResourceNameOut
  105. , HRESOURCE * phClusterNameResourceOut
  106. , BSTR * pbstrClusterIPAddressNameOut
  107. , HRESOURCE * phClusterIPAddressResourceOut
  108. , BSTR * pbstrClusterQuorumResourceNameOut
  109. , HRESOURCE * phClusterQuorumResourceOut
  110. );
  111. //HRESULT HrIsLocalQuorum( BSTR bstrNameIn );
  112. // Enumerate all components on the local computer registered for resource type
  113. // configuration.
  114. HRESULT HrConfigureResTypes( IUnknown * punkResTypeServicesIn );
  115. // Instantiates a resource type configuration component and calls the appropriate methods.
  116. HRESULT HrProcessResType( const CLSID & rclsidResTypeCLSIDIn, IUnknown * punkResTypeServicesIn );
  117. // Notify all components on the local computer registered to get
  118. // notification of cluster member set change (create, add node or evict).
  119. HRESULT HrNotifyMemberSetChangeListeners( void );
  120. // Instantiates cluster member set change listener and notifies it.
  121. HRESULT HrProcessMemberSetChangeListener( const CLSID & rclsidListenerClsidIn );
  122. // Create a mapping between a resource type GUID and a resource type name.
  123. HRESULT HrMapResTypeGUIDToName( const GUID & rcguidTypeGuidIn, const WCHAR * pcszTypeNameIn );
  124. // Given a resource type GUID this function finds the resource type name if any.
  125. const WCHAR * PcszLookupTypeNameByGUID( const GUID & rcguidTypeGuidIn );
  126. // Callback function used to delete the local quorum resource.
  127. static DWORD S_DwDeleteLocalQuorumResource( HCLUSTER hClusterIn , HRESOURCE hSelfIn, HRESOURCE hCurrentResourceIn, PVOID pvParamIn );
  128. #if defined(DEBUG)
  129. void
  130. DebugDumpDepencyTree( void );
  131. #endif // DEBUG
  132. public: // Methods
  133. static HRESULT S_HrCreateInstance( IUnknown ** ppunkOut );
  134. // IUnknown
  135. STDMETHOD( QueryInterface )( REFIID riid, LPVOID *ppv );
  136. STDMETHOD_( ULONG, AddRef )( void );
  137. STDMETHOD_( ULONG, Release )( void );
  138. // IPostCfgManager - private
  139. STDMETHOD( CommitChanges )( IEnumClusCfgManagedResources * peccmrIn, IClusCfgClusterInfo * pccciIn );
  140. // IClusCfgInitialize
  141. STDMETHOD( Initialize )( IUnknown * punkCallbackIn, LCID lcidIn );
  142. // IClusCfgCallback
  143. STDMETHOD( SendStatusReport )(
  144. LPCWSTR pcszNodeNameIn
  145. , CLSID clsidTaskMajorIn
  146. , CLSID clsidTaskMinorIn
  147. , ULONG ulMinIn
  148. , ULONG ulMaxIn
  149. , ULONG ulCurrentIn
  150. , HRESULT hrStatusIn
  151. , LPCWSTR pcszDescriptionIn
  152. , FILETIME * pftTimeIn
  153. , LPCWSTR pcszReferenceIn
  154. );
  155. }; //*** Class CPostCfgManager