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.

305 lines
14 KiB

  1. @REM ----------------------------------------------------------------------------------
  2. @REM This batch file excercises some basic functionality of a cluster using the
  3. @REM cluscli.exe tool.
  4. @REM
  5. @REM
  6. @REM Author: SriniG
  7. @REM History: 7-3-1996 First batch of tests
  8. @REM ----------------------------------------------------------------------------------
  9. @REM ----------------------------------------------------------------------------------
  10. @REM The following parameters should be set in the cmd shell in which this script is
  11. @REM run. They are:
  12. @REM (1) NAME_OF_CLUSTER
  13. @REM (2) NAME_OF_NODE1
  14. @REM (3) NAME_OF_NODE2
  15. @REM (4) NAME_OF_GROUP
  16. @REM (5) NAME_OF_RESOURCE1
  17. @REM (6) NAME_OF_RESOURCE2
  18. @REM (7) NAME_OF_RESOURCETYPE
  19. @REM ----------------------------------------------------------------------------------
  20. @setlocal
  21. @if "%1"=="/?" goto USAGE
  22. @if "%1"=="-?" goto USAGE
  23. @REM We set the environment by calling the bvtenv.cmd which should be tailored accordingly
  24. @if not exist .\bvtenv.cmd goto USAGE
  25. @call bvtenv.cmd
  26. @REM This is used for rename operations... the original names are restored
  27. @set TEMP_NAME=XYZ123
  28. @REM check if the required env variables are set
  29. @if "%NAME_OF_CLUSTER%"=="" goto USAGE
  30. @if "%NAME_OF_NODE1%"=="" goto USAGE
  31. @if "%NAME_OF_NODE2%"=="" goto USAGE
  32. @if "%NAME_OF_GROUP%"=="" goto USAGE
  33. @if "%NAME_OF_RESOURCE1%"=="" goto USAGE
  34. @if "%NAME_OF_RESOURCE2%"=="" goto USAGE
  35. @REM if "%NAME_OF_RESOURCETYPE%"=="" goto USAGE
  36. @set STATS=1
  37. @REM ----------------------------------------------------------------------------------
  38. @REM Check the status of the two nodes
  39. @REM ----------------------------------------------------------------------------------
  40. cluscli -status -c %NAME_OF_CLUSTER% node %NAME_OF_NODE1%
  41. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  42. cluscli -status -c %NAME_OF_CLUSTER% node %NAME_OF_NODE2%
  43. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  44. @REM ----------------------------------------------------------------------------------
  45. @REM Pause and resume each node in turn
  46. @REM ----------------------------------------------------------------------------------
  47. cluscli -pause -c %NAME_OF_CLUSTER% node %NAME_OF_NODE1%
  48. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  49. cluscli -resume -c %NAME_OF_CLUSTER% node %NAME_OF_NODE1%
  50. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  51. cluscli -pause -c %NAME_OF_CLUSTER% node %NAME_OF_NODE2%
  52. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  53. cluscli -resume -c %NAME_OF_CLUSTER% node %NAME_OF_NODE2%
  54. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  55. @REM ----------------------------------------------------------------------------------
  56. @REM Create a group, find status, enumerate, online, find status, offline, find status,
  57. @REM rename, get params
  58. @REM ----------------------------------------------------------------------------------
  59. cluscli -create -c %NAME_OF_CLUSTER% group %NAME_OF_GROUP%
  60. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  61. cluscli -status -c %NAME_OF_CLUSTER% group %NAME_OF_GROUP%
  62. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  63. cluscli -enum -c %NAME_OF_CLUSTER% group %NAME_OF_GROUP%
  64. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  65. cluscli -online -c %NAME_OF_CLUSTER% group %NAME_OF_GROUP%
  66. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  67. cluscli -status -c %NAME_OF_CLUSTER% group %NAME_OF_GROUP%
  68. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  69. cluscli -offline -c %NAME_OF_CLUSTER% group %NAME_OF_GROUP%
  70. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  71. cluscli -status -c %NAME_OF_CLUSTER% group %NAME_OF_GROUP%
  72. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  73. @REM Get params for this group
  74. cluscli -params -c %NAME_OF_CLUSTER% group %NAME_OF_GROUP%
  75. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  76. @REM Rename the group to temp and back again
  77. cluscli -rename -c %NAME_OF_CLUSTER% group %NAME_OF_GROUP% %TEMP_NAME%
  78. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  79. cluscli -rename -c %NAME_OF_CLUSTER% group %TEMP_NAME% %NAME_OF_GROUP%
  80. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  81. @REM ----------------------------------------------------------------------------------
  82. @REM Move the group between the different nodes ... once with no node specified,
  83. @REM twice with the two nodes specified, repeat with the group online
  84. @REM ----------------------------------------------------------------------------------
  85. cluscli -move -c %NAME_OF_CLUSTER% group %NAME_OF_GROUP%
  86. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  87. cluscli -move -c %NAME_OF_CLUSTER% group %NAME_OF_GROUP% %NAME_OF_NODE1%
  88. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  89. cluscli -move -c %NAME_OF_CLUSTER% group %NAME_OF_GROUP% %NAME_OF_NODE2%
  90. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  91. @REM Bring the group online and do the same
  92. cluscli -online -c %NAME_OF_CLUSTER% group %NAME_OF_GROUP%
  93. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  94. cluscli -move -c %NAME_OF_CLUSTER% group %NAME_OF_GROUP%
  95. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  96. cluscli -move -c %NAME_OF_CLUSTER% group %NAME_OF_GROUP% %NAME_OF_NODE1%
  97. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  98. cluscli -move -c %NAME_OF_CLUSTER% group %NAME_OF_GROUP% %NAME_OF_NODE2%
  99. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  100. @REM ----------------------------------------------------------------------------------
  101. @REM Obtain the params associated with the resourctype
  102. @REM ----------------------------------------------------------------------------------
  103. cluscli -params -c %NAME_OF_CLUSTER% resourcetype %NAME_OF_RESOURCETYPE%
  104. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  105. @REM ----------------------------------------------------------------------------------
  106. @REM We create a resource %NAME_OF_RESOURCE1%, and do various operations on it.
  107. @REM The resource is deleted at the end of this section.
  108. @REM ----------------------------------------------------------------------------------
  109. cluscli -create -c %NAME_OF_CLUSTER% resource %NAME_OF_RESOURCE1% %NAME_OF_GROUP% %NAME_OF_RESOURCETYPE% -p :CommandLine "/k ECHO %NAME_OF_RESOURCE1%" -p :ImageName cmd.exe -p :CurrentDirectory %HOMEDRIVE%%HOMEPATH%
  110. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  111. @REM get status of the resource
  112. cluscli -status -c %NAME_OF_CLUSTER% resource %NAME_OF_RESOURCE1%
  113. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  114. @REM bring resource online
  115. cluscli -online -c %NAME_OF_CLUSTER% resource %NAME_OF_RESOURCE1%
  116. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  117. @REM bring resource offline
  118. cluscli -offline -c %NAME_OF_CLUSTER% resource %NAME_OF_RESOURCE1%
  119. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  120. @REM enum resource
  121. cluscli -enum -c %NAME_OF_CLUSTER% resource %NAME_OF_RESOURCE1%
  122. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  123. @REM BUG BUG Delete owner and addowner functionality not implemented yet
  124. @goto SKIPowner
  125. @REM addowner and deleteowner
  126. cluscli -addowner -c %NAME_OF_CLUSTER% resource %NAME_OF_RESOURCE1% %NAME_OF_NODE1%
  127. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  128. cluscli -deleteowner -c %NAME_OF_CLUSTER% resource %NAME_OF_RESOURCE1% %NAME_OF_NODE1%
  129. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  130. :SKIPowner
  131. @REM rename the resource to temp name and back
  132. cluscli -rename -c %NAME_OF_CLUSTER% resource %NAME_OF_RESOURCE1% %TEMP_NAME%
  133. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  134. cluscli -rename -c %NAME_OF_CLUSTER% resource %TEMP_NAME% %NAME_OF_RESOURCE1%
  135. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  136. @REM get the params associated with the resource
  137. cluscli -params -c %NAME_OF_CLUSTER% resource %NAME_OF_RESOURCE1%
  138. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  139. @REM delete the resource
  140. cluscli -delete -c %NAME_OF_CLUSTER% resource %NAME_OF_RESOURCE1%
  141. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  142. @REM ----------------------------------------------------------------------------------
  143. @REM We create two resources %NAME_OF_RESOURCE1%, %NAME_OF_RESOURCE2%
  144. @REM and do various dependency operations on it.
  145. @REM The resources are deleted at the end of this section.
  146. @REM ----------------------------------------------------------------------------------
  147. cluscli -create -c %NAME_OF_CLUSTER% resource %NAME_OF_RESOURCE1% %NAME_OF_GROUP% %NAME_OF_RESOURCETYPE% -p :CommandLine "/k ECHO %NAME_OF_RESOURCE1%" -p :ImageName cmd.exe -p :CurrentDirectory %HOMEDRIVE%%HOMEPATH%
  148. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  149. cluscli -create -c %NAME_OF_CLUSTER% resource %NAME_OF_RESOURCE2% %NAME_OF_GROUP% %NAME_OF_RESOURCETYPE% -p :CommandLine "/k ECHO %NAME_OF_RESOURCE2%" -p :ImageName cmd.exe -p :CurrentDirectory %HOMEDRIVE%%HOMEPATH%
  150. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  151. @REM make resource2 depend upon resource1
  152. cluscli -adddepend -c %NAME_OF_CLUSTER% resource %NAME_OF_RESOURCE2% %NAME_OF_RESOURCE1%
  153. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  154. @REM bring resource1 online
  155. cluscli -online -c %NAME_OF_CLUSTER% resource %NAME_OF_RESOURCE1%
  156. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  157. @REM bring resource2 offline
  158. cluscli -offline -c %NAME_OF_CLUSTER% resource %NAME_OF_RESOURCE2%
  159. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  160. @REM bring resource1 offline
  161. cluscli -offline -c %NAME_OF_CLUSTER% resource %NAME_OF_RESOURCE1%
  162. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  163. @REM remove resource2 dependency upon resource1
  164. cluscli -deletedepend -c %NAME_OF_CLUSTER% resource %NAME_OF_RESOURCE2% %NAME_OF_RESOURCE1%
  165. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  166. @REM ----------------------------------------------------------------------------------
  167. @REM We try to rename the cluster to the temp name and back to the original, BUG-BUG:
  168. @REM Need to change after cluster naming issues are resolved
  169. @REM ----------------------------------------------------------------------------------
  170. @REM BUG BUG Not able to restore Cluster name so don't do it...
  171. @goto skipclusname
  172. cluscli -rename -c %NAME_OF_CLUSTER% cluster %TEMP_NAME%
  173. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  174. cluscli -rename -c %TEMP_NAME% cluster %NAME_OF_CLUSTER%
  175. @if errorlevel 1 set /A STATS=%STATS% + 1 & echo ***************** BVT Failure %STATS% *****************
  176. :skipclusname
  177. :cleanup
  178. @echo.
  179. @echo.
  180. @echo Cleaning up ...............................
  181. @echo.
  182. cluscli -delete -c %NAME_OF_CLUSTER% resource %NAME_OF_RESOURCE1%
  183. @if errorlevel 1 echo !!!! WARNING: Could not delete resource %NAME_OF_RESOURCE1% !!!!
  184. cluscli -delete -c %NAME_OF_CLUSTER% resource %NAME_OF_RESOURCE2%
  185. @if errorlevel 1 echo !!!! WARNING: Could not delete resource %NAME_OF_RESOURCE2% !!!!
  186. cluscli -delete -c %NAME_OF_CLUSTER% group %NAME_OF_GROUP%
  187. @if errorlevel 1 echo !!!! WARNING: Could not delete resource %NAME_OF_GROUP% !!!!
  188. @goto EXIT
  189. :USAGE
  190. @echo Usage: %0
  191. @echo The following environment variables should be set in the file bvtenv.cmd
  192. @echo (The file should be placed in the same dir from which clusbvt is run.)
  193. @echo They are:
  194. @echo (1) NAME_OF_CLUSTER
  195. @echo (2) NAME_OF_NODE1
  196. @echo (3) NAME_OF_NODE2
  197. @echo (4) NAME_OF_GROUP
  198. @echo (5) NAME_OF_RESOURCE1
  199. @echo (6) NAME_OF_RESOURCE2
  200. @echo (7) NAME_OF_RESOURCETYPE
  201. @echo The clustername, nodenames and resource type should be valid entities.
  202. @echo The group, resource1 and resource2 should not exist i.e. they get deleted
  203. @echo at the end of the run
  204. @goto END
  205. :EXIT
  206. @set /A STATS=%STATS% - 1
  207. @echo.
  208. @echo.
  209. @echo *******************************************************************************
  210. @echo No. of BVT Tests failed = %STATS%
  211. @echo *******************************************************************************
  212. @echo.
  213. @echo.
  214. :END
  215. @endlocal