Changeset 68703 in vbox
- Timestamp:
- Sep 7, 2017 5:57:15 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/storage/tdStorageBenchmark1.py
r67039 r68703 50 50 from testdriver import vbox; 51 51 from testdriver import vboxcon; 52 from testdriver import vboxwrappers; 52 53 53 54 import remoteexecutor; … … 455 456 'no-hostiocache' : 'HostCacheOff' 456 457 }; 458 459 # Password ID for encryption. 460 ksPwId = 'EncPwId'; 457 461 458 462 # Array indexes for the test configs. … … 503 507 self.fUseRamDiskDef = False; 504 508 self.fUseRamDisk = self.fUseRamDiskDef; 509 self.fEncryptDiskDef = False; 510 self.fEncryptDisk = self.fEncryptDiskDef; 511 self.sEncryptPwDef = 'TestTestTest'; 512 self.sEncryptPw = self.sEncryptPwDef; 513 self.sEncryptAlgoDef = 'AES-XTS256-PLAIN64'; 514 self.sEncryptAlgo = self.sEncryptAlgoDef; 505 515 506 516 # … … 557 567 reporter.log(' --use-ramdisk'); 558 568 reporter.log(' Default: %s' % (self.fUseRamDiskDef)); 569 reporter.log(' --encrypt-disk'); 570 reporter.log(' Default: %s' % (self.fEncryptDiskDef)); 571 reporter.log(' --encrypt-password'); 572 reporter.log(' Default: %s' % (self.sEncryptPwDef)); 573 reporter.log(' --encrypt-algorithm'); 574 reporter.log(' Default: %s' % (self.sEncryptAlgoDef)); 559 575 return rc; 560 576 … … 642 658 self.fReportBenchmarkResults = False; 643 659 elif asArgs[iArg] == '--io-log-path': 660 iArg += 1; 644 661 if iArg >= len(asArgs): raise base.InvalidOption('The "--io-log-path" takes a path argument'); 645 662 self.sIoLogPath = asArgs[iArg]; … … 648 665 elif asArgs[iArg] == '--use-ramdisk': 649 666 self.fUseRamDisk = True; 667 elif asArgs[iArg] == '--encrypt-disk': 668 self.fEncryptDisk = True; 669 elif asArgs[iArg] == '--encrypt-password': 670 iArg += 1; 671 if iArg >= len(asArgs): raise base.InvalidOption('The "--encrypt-password" takes a string'); 672 self.sEncryptPw = asArgs[iArg]; 673 elif asArgs[iArg] == '--encrypt-algorithm': 674 iArg += 1; 675 if iArg >= len(asArgs): raise base.InvalidOption('The "--encrypt-algorithm" takes a string'); 676 self.sEncryptAlgo = asArgs[iArg]; 650 677 else: 651 678 return vbox.TestDriver.parseOption(self, asArgs, iArg); … … 965 992 oHd = oSession.createDiffHd(oHdParent, sDiskPath, None); 966 993 994 if oHd is not None and iDiffLvl == 0 and self.fEncryptDisk: 995 try: 996 oIProgress = oHd.changeEncryption('', self.sEncryptAlgo, self.sEncryptPw, self.ksPwId); 997 oProgress = vboxwrappers.ProgressWrapper(oIProgress, self.oVBoxMgr, self, 'Encrypting "%s"' % (sDiskPath,)); 998 oProgress.wait(); 999 if oProgress.logResult() is False: 1000 raise base.GenError('Encrypting disk "%s" failed' % (sDiskPath, )); 1001 except: 1002 reporter.errorXcpt('changeEncryption("%s","%s","%s") failed on "%s"' \ 1003 % ('', self.sEncryptAlgo, self.sEncryptPw, oSession.sName) ); 1004 self.oVBox.deleteHdByMedium(oHd); 1005 oHd = None; 1006 else: 1007 reporter.log('Encrypted "%s"' % (sDiskPath,)); 1008 967 1009 return oHd; 1010 1011 def startVmAndConnect(self, sVmName): 1012 """ 1013 Our own implementation of startVmAndConnectToTxsViaTcp to make it possible 1014 to add passwords to a running VM when encryption is used. 1015 """ 1016 oSession = self.startVmByName(sVmName); 1017 if oSession is not None: 1018 # Add password to the session in case encryption is used. 1019 fRc = True; 1020 if self.fEncryptDisk: 1021 try: 1022 oSession.o.console.addDiskEncryptionPassword(self.ksPwId, self.sEncryptPw, False); 1023 except: 1024 reporter.logXcpt(); 1025 fRc = False; 1026 1027 # Connect to TXS. 1028 if fRc: 1029 reporter.log2('startVmAndConnect: Started(/prepared) "%s", connecting to TXS ...' % (sVmName,)); 1030 (fRc, oTxsSession) = self.txsDoConnectViaTcp(oSession, 15*60000, fNatForwardingForTxs = True); 1031 if fRc is True: 1032 if fRc is True: 1033 # Success! 1034 return (oSession, oTxsSession); 1035 else: 1036 reporter.error('startVmAndConnect: txsDoConnectViaTcp failed'); 1037 # If something went wrong while waiting for TXS to be started - take VM screenshot before terminate it 1038 1039 self.terminateVmBySession(oSession); 1040 1041 return (None, None); 968 1042 969 1043 def testOneCfg(self, sVmName, eStorageController, sHostIoCache, sDiskFormat, # pylint: disable=R0913,R0914,R0915 … … 991 1065 # for benchmarks 992 1066 if self.fRecreateStorCfg: 993 sMountPoint = self.prepareStorage(self.oStorCfg, self.fUseRamDisk, cbDisk);1067 sMountPoint = self.prepareStorage(self.oStorCfg, self.fUseRamDisk, 2 * cbDisk); 994 1068 if sMountPoint is not None: 995 1069 # Create a directory where every normal user can write to. … … 1086 1160 if fRc is True: 1087 1161 self.logVmInfo(oVM); 1088 oSession, oTxsSession = self.startVmAndConnect ToTxsViaTcp(sVmName, fCdWait = False, fNatForwardingForTxs = True);1162 oSession, oTxsSession = self.startVmAndConnect(sVmName); 1089 1163 if oSession is not None: 1090 1164 self.addTask(oTxsSession);
Note:
See TracChangeset
for help on using the changeset viewer.