Changeset 63008 in vbox for trunk/src/VBox/ValidationKit/tests/storage
- Timestamp:
- Aug 4, 2016 8:31:09 PM (8 years ago)
- Location:
- trunk/src/VBox/ValidationKit/tests/storage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/storage/storagecfg.py
r62190 r63008 95 95 StorageConfigOs.__init__(self); 96 96 97 def _getActivePoolsStartingWith(self, oExec, sPoolIdStart): 98 """ 99 Returns a list of pools starting with the given ID or None on failure. 100 """ 101 lstPools = None; 102 fRc, sOutput = oExec.execBinary('zpool', ('list', '-H')); 103 if fRc: 104 lstPools = []; 105 asPools = sOutput.splitlines(); 106 for sPool in asPools: 107 if sPool.startswith(sPoolIdStart): 108 # Extract the whole name and add it to the list. 109 asItems = sPool.split(' '); 110 lstPools.append(asItems[0]); 111 return lstPools; 112 113 def _getActiveVolumesInPoolStartingWith(self, oExec, sPool, sVolumeIdStart): 114 """ 115 Returns a list of active volumes for the given pool starting with the given 116 identifier or None on failure. 117 """ 118 lstVolumes = None; 119 fRc, sOutput = oExec.execBinary('zfs', ('list', '-H')); 120 if fRc: 121 lstVolumes = []; 122 asVolumes = sOutput.splitlines(); 123 for sVolume in asVolumes: 124 if sVolume.startswith(sPool + '/' + sVolumeIdStart): 125 # Extract the whole name and add it to the list. 126 asItems = sVolume.split(' '); 127 lstVolumes.append(asItems[0]); 128 return lstVolumes; 129 97 130 def getDisksMatchingRegExp(self, sRegExp): 98 131 """ … … 148 181 """ 149 182 fRc, _ = oExec.execBinary('zpool', ('destroy', sPool)); 183 return fRc; 184 185 def cleanupPoolsAndVolumes(self, oExec, sPoolIdStart, sVolIdStart): 186 """ 187 Cleans up any pools and volumes starting with the name in the given 188 parameters. 189 """ 190 fRc = True; 191 lstPools = self._getActivePoolsStartingWith(oExec, sPoolIdStart); 192 if lstPools is not None: 193 for sPool in lstPools: 194 lstVolumes = self._getActiveVolumesInPoolStartingWith(oExec, sPool, sVolIdStart); 195 if lstVolumes is not None: 196 # Destroy all the volumes first 197 for sVolume in lstVolumes: 198 fRc2 = oExec.execBinaryNoStdOut('zfs', ('destroy', sVolume)); 199 if not fRc2: 200 fRc = fRc2; 201 202 # Destroy the pool 203 fRc2 = self.destroyPool(oExec, sPool); 204 if not fRc2: 205 fRc = fRc2; 206 else: 207 fRc = False; 208 else: 209 fRc = False; 210 150 211 return fRc; 151 212 … … 279 340 return fRc; 280 341 342 def cleanupPoolsAndVolumes(self, oExec, sPoolIdStart, sVolIdStart): 343 """ 344 Cleans up any pools and volumes starting with the name in the given 345 parameters. 346 """ 347 # @todo: Needs implementation, for LVM based configs a similar approach can be used 348 # as for Solaris. 349 _ = oExec; 350 _ = sPoolIdStart; 351 _ = sVolIdStart; 352 return True; 353 281 354 class StorageCfg(object): 282 355 """ … … 459 532 return self.oExec.mkDir(sMountPoint + '/' + sDir, fMode); 460 533 534 def cleanupLeftovers(self): 535 """ 536 Tries to cleanup any leftover pools and volumes from a failed previous run. 537 """ 538 return self.oStorOs.cleanupPoolsAndVolumes('pool', 'vol'); 539 -
trunk/src/VBox/ValidationKit/tests/storage/tdStorageBenchmark1.py
r63000 r63008 791 791 self.oStorCfg = storagecfg.StorageCfg(oExecutor, utils.getHostOs(), oDiskCfg); 792 792 793 # Try to cleanup any leftovers from a previous run first. 794 fRc = self.oStorCfg.cleanupLeftovers(); 795 if not fRc: 796 reporter.error('Failed to cleanup any leftovers from a previous run'); 797 793 798 if self.fTestHost: 794 799 reporter.testStart('Host');
Note:
See TracChangeset
for help on using the changeset viewer.