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.

265 lines
6.6 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. backup.h
  5. Abstract:
  6. definitions for backup test exe
  7. Brian Berkowitz [brianb] 06/02/2000
  8. TBD:
  9. Revision History:
  10. Name Date Comments
  11. brianb 06/02/2000 Created
  12. brianb 06/12/2000 Added comments
  13. --*/
  14. // options for snapshotting volumes
  15. typedef enum VSTST_BACKUP_VOLUMES
  16. {
  17. VSTST_BV_UNDEFINE = 0,
  18. VSTST_BV_ONE, // snapshot a single volume during a pass
  19. VSTST_BV_SOME, // snasphot several volumes during a pass
  20. VSTST_BV_ALL // snapshot all volumes during a pass
  21. };
  22. // actual implementation of the test
  23. class CVsBackupTest :
  24. public IVsTstRunningTest,
  25. public CVsTstClientLogger
  26. {
  27. public:
  28. // constructor
  29. CVsBackupTest();
  30. // destructor
  31. ~CVsBackupTest();
  32. // callback to run the test
  33. HRESULT RunTest
  34. (
  35. CVsTstINIConfig *pConfig, // configuration file
  36. CVsTstClientMsg *pMsg, // message pipe
  37. CVsTstParams *pParams // command line parameters
  38. );
  39. // callback to shutdown the test
  40. HRESULT ShutdownTest(VSTST_SHUTDOWN_REASON reason)
  41. {
  42. UNREFERENCED_PARAMETER(reason);
  43. m_bTerminateTest = true;
  44. return S_OK;
  45. }
  46. private:
  47. enum
  48. {
  49. // max number of volumes this test will deal with
  50. MAX_VOLUME_COUNT = 2048,
  51. // maximum number of simultaneous snapshots that this test will deal with
  52. MAX_SNAPSHOT_SET_COUNT = 128
  53. };
  54. // do a single run of the backup test
  55. void RunBackupTest();
  56. // obtain state of the writers and validate the state
  57. bool GetAndValidateWriterState
  58. (
  59. IVssBackupComponents *pvbc,
  60. VSS_WRITER_STATE ws1,
  61. VSS_WRITER_STATE ws2 = VSS_WS_UNKNOWN,
  62. VSS_WRITER_STATE ws3 = VSS_WS_UNKNOWN,
  63. VSS_WRITER_STATE ws4 = VSS_WS_UNKNOWN,
  64. VSS_WRITER_STATE ws5 = VSS_WS_UNKNOWN,
  65. VSS_WRITER_STATE ws6 = VSS_WS_UNKNOWN,
  66. VSS_WRITER_STATE ws7 = VSS_WS_UNKNOWN
  67. );
  68. // wait for a response from an asynchronous call. Cycles controls
  69. // when a cancel of the asynchronous call is issued. The writer states
  70. // are valid states for writers during the asynchronous call
  71. HRESULT WaitLoop
  72. (
  73. IVssBackupComponents *pvbc,
  74. IVssAsync *pAsync,
  75. UINT cycles,
  76. VSS_WRITER_STATE ws1,
  77. VSS_WRITER_STATE ws2 = VSS_WS_UNKNOWN,
  78. VSS_WRITER_STATE ws3 = VSS_WS_UNKNOWN,
  79. VSS_WRITER_STATE ws4 = VSS_WS_UNKNOWN,
  80. VSS_WRITER_STATE ws5 = VSS_WS_UNKNOWN,
  81. VSS_WRITER_STATE ws6 = VSS_WS_UNKNOWN,
  82. VSS_WRITER_STATE ws7 = VSS_WS_UNKNOWN
  83. );
  84. // if components are being backed up, indicate that components were
  85. // successfully backed up
  86. void SetComponentsSuccessfullyBackedUp(IVssBackupComponents *pvbc);
  87. // validate metadata obtained by writers and add components to backup
  88. // components document, if component backup is used
  89. void GetMetadataAndSetupComponents(IVssBackupComponents *pvbc);
  90. // add a volume to the snapshot set based on the path
  91. void DoAddToSnapshotSet
  92. (
  93. IN IVssBackupComponents *pvbc,
  94. IN LPCWSTR bstrPath
  95. );
  96. // validate a IVssWMFiledesc object
  97. void ValidateFiledesc(IVssWMFiledesc *pFiledesc);
  98. // assert a privilege, either backup or restore
  99. BOOL AssertPrivilege(LPCWSTR privName);
  100. // remove volumes that are not candidates for the snapshot
  101. // based on test configuration
  102. void RemoveNonCandidateVolumes();
  103. // choose a volume to backup from non-snapshotted volumes
  104. void ChooseVolumeToBackup(IVssBackupComponents *pvbc);
  105. // delete a snapshot set
  106. void DoDeleteSnapshotSet(IVssBackupComponents *pvbc, VSS_ID id);
  107. // delete a list of strings
  108. void DeleteVolumeList(LPWSTR *rgwsz, UINT cwsz);
  109. // build a volume list
  110. void BuildVolumeList(LPCWSTR wszOption, UINT *pcVolumes, LPWSTR **prgwsz);
  111. // delete snapshot sets that are cached by the serial test
  112. void DeleteCachedSnapshotSets();
  113. // configuration file
  114. CVsTstINIConfig *m_pConfig;
  115. // command line parameters
  116. CVsTstParams *m_pParams;
  117. // flag indicating that test should be terminated after the current
  118. // run is complete
  119. bool m_bTerminateTest;
  120. // range for cancelling PrepareBackup
  121. LONGLONG m_llCancelPrepareBackupLow;
  122. LONGLONG m_llCancelPrepareBackupHigh;
  123. // range for cancelling DoSnapshotSet
  124. LONGLONG m_llCancelDoSnapshotSetLow;
  125. LONGLONG m_llCancelDoSnapshotSetHigh;
  126. // range for cancelling BackupComplete
  127. LONGLONG m_llCancelBackupCompleteLow;
  128. LONGLONG m_llCancelBackupCompleteHigh;
  129. // number of cycles to loop until calling cancel during PrepareBackup
  130. UINT m_cyclesCancelPrepareBackup;
  131. // number of cycles to loop until calling cancel during DoSnapshotSet
  132. UINT m_cyclesCancelDoSnapshotSet;
  133. // number of cycles to loop until calling cancel during BackupComplete
  134. UINT m_cyclesCancelBackupComplete;
  135. // is this a component backup
  136. bool m_bComponentBackup;
  137. // is this a volume backup
  138. bool m_bVolumeBackup;
  139. // is this a serial volume (i.e., multiple backups on different volumes) backup
  140. bool m_bSerialBackup;
  141. // should ntfs volumes be backed up
  142. bool m_bBackupNTFS;
  143. // should fat32 volumes be backed up
  144. bool m_bBackupFAT32;
  145. // should fat16 volumes be backed up
  146. bool m_bBackupFAT16;
  147. // should raw volumes be backed up
  148. bool m_bBackupRAW;
  149. // how many volumes should be backed up at a time
  150. VSTST_BACKUP_VOLUMES m_backupVolumes;
  151. // volume list
  152. CVsTstVolumeList m_volumeList;
  153. // number of volumes in the volume list
  154. UINT m_cVolumes;
  155. // number of volumes left in the volume list
  156. UINT m_cVolumesLeft;
  157. // array of snapshot sets created
  158. VSS_ID m_rgSnapshotSetIds[MAX_SNAPSHOT_SET_COUNT];
  159. // array of backup components objects created
  160. IVssBackupComponents *m_rgvbc[MAX_SNAPSHOT_SET_COUNT];
  161. // # of snapshot sets
  162. UINT m_cSnapshotSets;
  163. // array of assigned volumes
  164. bool m_rgbAssignedVolumes[MAX_VOLUME_COUNT];
  165. // array of excluded volumes
  166. LPWSTR *m_rgwszExcludedVolumes;
  167. // count of excluded volumes
  168. UINT m_cExcludedVolumes;
  169. // array of volumes to include in the snapshot
  170. LPWSTR *m_rgwszIncludedVolumes;
  171. // number of volumes in included array
  172. UINT m_cIncludedVolumes;
  173. // perform random fills of volumes to check diff allocation code
  174. bool m_bRandomFills;
  175. // perform selected fills of volumes
  176. bool m_bSelectedFills;
  177. // try to fragment volumes when filling them
  178. bool m_bFragmentWhenFilling;
  179. // array of volumes that should be filled
  180. LPWSTR *m_rgwszFillVolumes;
  181. // number of volumes that should be filled
  182. UINT m_cFillVolumes;
  183. // array of volumes
  184. LPWSTR m_wszVolumesSnapshot;
  185. // size of volume array
  186. UINT m_cwcVolumesSnapshot;
  187. // time for wait interval
  188. UINT m_waitTime;
  189. };