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.

199 lines
6.5 KiB

  1. /*++
  2. Copyright (c) 2002 Microsoft Corporation
  3. Abstract:
  4. @doc
  5. @module vs_clus.hxx | Declaration of CVssClusterAPI
  6. @end
  7. Author:
  8. Adi Oltean [aoltean] 03/13/2001
  9. Revision History:
  10. Name Date Comments
  11. aoltean 03/13/2001 Created
  12. --*/
  13. #pragma once
  14. ////////////////////////////////////////////////////////////////////////
  15. // Standard foo for file name aliasing. This code block must be after
  16. // all includes of VSS header files.
  17. //
  18. #ifdef VSS_FILE_ALIAS
  19. #undef VSS_FILE_ALIAS
  20. #endif
  21. #define VSS_FILE_ALIAS "SPRCLUSH"
  22. //
  23. ////////////////////////////////////////////////////////////////////////
  24. /////////////////////////////////////////////////////////////////////////////
  25. // Classes
  26. class CVssClusterResourceList;
  27. // Implements a low-level API for registry manipulation
  28. class CVssClusterAPI
  29. {
  30. // Constructors/destructors
  31. private:
  32. CVssClusterAPI(const CVssClusterAPI&);
  33. CVssClusterAPI& operator=(const CVssClusterAPI&);
  34. public:
  35. CVssClusterAPI();
  36. // Operations
  37. public:
  38. // Returns FALSE if the cluster API is not present
  39. bool Initialize(
  40. IN LPCWSTR pwszClusterName = NULL
  41. ) throw(HRESULT);
  42. // Add dependency between the corresponding physical disk resources
  43. // - Returns TRUE if a dependency was added
  44. // - Returns FALSE if a dependency was not needed (for example no associated physical resources)
  45. // - Throws an HRESULT on error conditions
  46. bool AddDependency(
  47. IN LPCWSTR pwszFromVolumeName, // To be dependent
  48. IN LPCWSTR pwszToVolumeName // To be dependency
  49. ) throw(HRESULT);
  50. // Remove the dependency between the corresponding physical disk resources
  51. // - Returns TRUE if a dependency was removed
  52. // - Returns FALSE if a dependency was not needed (for example no associated physical resources)
  53. // - Throws an HRESULT on error conditions
  54. bool RemoveDependency(
  55. IN LPCWSTR pwszFromVolumeName, // To be dependent
  56. IN LPCWSTR pwszToVolumeName // To be dependency
  57. ) throw(HRESULT);
  58. // Adds the registry key to the given cluster resource.
  59. // - Returns TRUE if the key was added
  60. // - Returns FALSE if a key could not be added
  61. // - Throws an HRESULT on error conditions
  62. bool AddRegistryKey(
  63. IN LPCWSTR pwszVolumeName,
  64. IN LPCWSTR pwszPathFormat,
  65. IN ...
  66. ) throw(HRESULT);
  67. // Removes the registry key to the given cluster resource.
  68. // - Returns TRUE if the key was removed
  69. // - Returns FALSE if a key could not be removed
  70. // - Throws an HRESULT on error conditions
  71. bool RemoveRegistryKey(
  72. IN LPCWSTR pwszVolumeName,
  73. IN LPCWSTR pwszPathFormat,
  74. IN ...
  75. ) throw(HRESULT);
  76. // Create a task scheduler resource
  77. // The Task Scheduler resource will be dependent on the Physical Disk Resource identified by the volume name
  78. // Then bring the resource online
  79. bool CreateTaskSchedulerResource(
  80. IN LPCWSTR pwszTaskSchedulerResourceName, // This will be the Task Name also
  81. IN LPCWSTR pwszApplicationName,
  82. IN LPCWSTR pwszApplicationParams,
  83. IN INT nTaskTriggersCount,
  84. IN PTASK_TRIGGER ptsTaskTriggersArray,
  85. IN LPCWSTR pwszMakeDependentOnVolumeName // To be dependency
  86. ) throw(HRESULT);
  87. // Update task scheduler information
  88. bool UpdateTaskSchedulerResource(
  89. IN LPCWSTR pwszTaskSchedulerResourceName,
  90. IN INT nTaskTriggersCount,
  91. IN PTASK_TRIGGER ptsTaskTriggersArray
  92. ) throw(HRESULT);
  93. // Delete a task scheduler resource.
  94. // Before that, take the resource offline and remove the dependency
  95. bool DeleteTaskSchedulerResource(
  96. IN LPCWSTR pwszTaskSchedulerResourceName
  97. ) throw(HRESULT);
  98. // Returns the Physical Disk resource that contains the given volume
  99. ISClusResource* GetPhysicalDiskResourceForVolumeName(
  100. IN LPCWSTR pwszVolumeName
  101. ) throw(HRESULT);
  102. // returns TRUE if the two COM objects are identifying the same resource
  103. bool AreResourcesEqual(
  104. IN ISClusResource* pResource1,
  105. IN ISClusResource* pResource2
  106. ) throw(HRESULT);
  107. // Returns TRUE if a dependency can be established
  108. bool CanEstablishDependency(
  109. IN ISClusResource* pFromResource, // To be the dependent
  110. IN ISClusResource* pToResource // To be the dependency
  111. );
  112. // Returns TRUE if a dependency is already established
  113. bool IsDependencyAlreadyEstablished(
  114. IN ISClusResource* pFromResource, // Is dependent
  115. IN ISClusResource* pToResource // Is dependency
  116. );
  117. // Returns true if hte volume belongs to a Physical Disk resource
  118. bool IsVolumeBelongingToPhysicalDiskResource(
  119. IN LPCWSTR pwszVolumeName
  120. ) throw(HRESULT);
  121. // Get the quorum path
  122. void GetQuorumPath(
  123. CComBSTR & bstrQuorumPath
  124. ) throw(HRESULT);
  125. // Implementation
  126. private:
  127. // Returns TRUE if the resource is a Physical Disk resource that contains the given volume
  128. bool IsResourceRefferingVolume(
  129. IN ISClusResource* pResource,
  130. IN LPCWSTR pwszVolumeName
  131. ) throw(HRESULT);
  132. // Copy the given binary data into the variant
  133. void CopyBinaryIntoVariant(
  134. IN PBYTE pbData,
  135. IN DWORD cbSize,
  136. IN OUT CComVariant & variant
  137. ) throw(HRESULT);
  138. // Take the resource offline
  139. void TakeResourceOffline(
  140. IN ISClusResource* pResource
  141. ) throw(HRESULT);
  142. // Bring the resource online
  143. void BringResourceOnline(
  144. IN ISClusResource* pResource
  145. ) throw(HRESULT);
  146. void GetFinalOnlineResourceList(
  147. IN ISClusResource* pResource,
  148. IN OUT CVssClusterResourceList & list
  149. ) throw(HRESULT);
  150. void BringResourceListOnline(
  151. IN CVssClusterResourceList & list
  152. ) throw(HRESULT);
  153. CComQIPtr<ISCluster> m_pCluster;
  154. DWORD m_dwOfflineTimeout;
  155. DWORD m_dwOnlineTimeout;
  156. };