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.

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