- Timestamp:
- Sep 8, 2016 9:49:41 AM (8 years ago)
- Location:
- trunk/src/VBox/ValidationKit
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testdriver/vboxwrappers.py
r63746 r63761 1838 1838 Returns Medium object on success and None on failure. Error information is logged. 1839 1839 """ 1840 # Detect the proper format if requested 1841 if sFmt is None: 1842 try: 1843 oHdFmt = oParentHd.mediumFormat; 1844 lstCaps = self.oVBoxMgr.getArray(oHdFmt, 'capabilities'); 1845 if vboxcon.MediumFormatCapabilities_Differencing in lstCaps: 1846 sFmt = oHdFmt.id; 1847 else: 1848 sFmt = 'VDI'; 1849 except: 1850 reporter.errorXcpt('failed to get preferred diff format for "%s"' % (sHd)); 1851 return None; 1840 1852 try: 1841 1853 if self.fpApiVer >= 5.0: -
trunk/src/VBox/ValidationKit/tests/storage/storagecfg.py
r63143 r63761 324 324 # Wipe partition table 325 325 sDiskPath = self.dSimplePools.get(sPool); 326 fRc = oExec.execBinaryNoStdOut('sfdisk', ('--no-reread', '--wipe', 'always', '-q', '-f', sDiskPath));326 fRc = oExec.execBinaryNoStdOut('sfdisk', ('--no-reread', '--wipe', 'always', '-q', '-f', '--delete', sDiskPath)); 327 327 else: 328 328 fRc = oExec.execBinaryNoStdOut('lvremove', (sPool + '/' + sVol,)); -
trunk/src/VBox/ValidationKit/tests/storage/tdStorageBenchmark1.py
r63746 r63761 433 433 kiVmName = 0; 434 434 kiStorageCtrl = 1; 435 kiHostIoCache = 2 435 kiHostIoCache = 2; 436 436 kiDiskFmt = 3; 437 437 kiDiskVar = 4; … … 465 465 self.asIscsiTargetsDef = [ ]; # @todo: Configure one target for basic iSCSI testing 466 466 self.asIscsiTargets = self.asIscsiTargetsDef; 467 self.cDiffLvlsDef = 0; 468 self.cDiffLvls = self.cDiffLvlsDef; 467 469 self.fTestHost = False; 468 470 self.fUseScratch = False; … … 496 498 reporter.log(' --test-sets <set1[:set2[:...]]>'); 497 499 reporter.log(' Default: %s' % (':'.join(self.asTestSetsDef))); 500 reporter.log(' --diff-levels <number of diffs>'); 501 reporter.log(' Default: %s' % (self.cDiffLvlsDef)); 498 502 reporter.log(' --test-vms <vm1[:vm2[:...]]>'); 499 503 reporter.log(' Test the specified VMs in the given order. Use this to change'); … … 568 572 if iArg >= len(asArgs): raise base.InvalidOption('The "--test-sets" takes a colon separated list of test sets'); 569 573 self.asTestSets = asArgs[iArg].split(':'); 574 elif asArgs[iArg] == '--diff-levels': 575 iArg += 1; 576 if iArg >= len(asArgs): raise base.InvalidOption('The "--diff-levels" takes an integer'); 577 try: self.cDiffLvls = int(asArgs[iArg]); 578 except: raise base.InvalidOption('The "--diff-levels" value "%s" is not an integer' % (asArgs[iArg],)); 570 579 elif asArgs[iArg] == '--test-vms': 571 580 iArg += 1; … … 856 865 return fRc; 857 866 867 def createHd(self, oSession, sDiskFormat, sDiskVariant, iDiffLvl, oHdParent, \ 868 sDiskPath, cbDisk): 869 """ 870 Creates a new disk with the given parameters returning the medium object 871 on success. 872 """ 873 874 oHd = None; 875 if sDiskFormat == "iSCSI" and iDiffLvl == 0: 876 listNames = []; 877 listValues = []; 878 listValues = self.asIscsiTargets[0].split('|'); 879 listNames.append('TargetAddress'); 880 listNames.append('TargetName'); 881 listNames.append('LUN'); 882 883 if self.fpApiVer >= 5.0: 884 oHd = oSession.oVBox.createMedium(sDiskFormat, sDiskPath, vboxcon.AccessMode_ReadWrite, \ 885 vboxcon.DeviceType_HardDisk); 886 else: 887 oHd = oSession.oVBox.createHardDisk(sDiskFormat, sDiskPath); 888 oHd.type = vboxcon.MediumType_Normal; 889 oHd.setProperties(listNames, listValues); 890 else: 891 if iDiffLvl == 0: 892 tMediumVariant = self.convDiskToMediumVariant(sDiskVariant); 893 oHd = oSession.createBaseHd(sDiskPath + '/base.disk', sDiskFormat, cbDisk, \ 894 cMsTimeout = 3600 * 1000, tMediumVariant = tMediumVariant); 895 else: 896 sDiskPath = sDiskPath + '/diff_%u.disk' % (iDiffLvl); 897 oHd = oSession.createDiffHd(oHdParent, sDiskPath, None); 898 899 return oHd; 900 858 901 def testOneCfg(self, sVmName, eStorageController, sHostIoCache, sDiskFormat, # pylint: disable=R0913,R0915 859 902 sDiskVariant, sDiskPath, cCpus, sIoTest, sVirtMode, sTestSet): … … 892 935 return fRc; 893 936 894 # Reconfigure the VM 895 oSession = self.openSession(oVM); 896 if oSession is not None: 897 # Attach HD 898 fRc = oSession.ensureControllerAttached(_ControllerTypeToName(eStorageController)); 899 fRc = fRc and oSession.setStorageControllerType(eStorageController, _ControllerTypeToName(eStorageController)); 900 901 if sHostIoCache == 'hostiocache': 902 fRc = fRc and oSession.setStorageControllerHostIoCache(_ControllerTypeToName(eStorageController), True); 903 elif sHostIoCache == 'no-hostiocache': 904 fRc = fRc and oSession.setStorageControllerHostIoCache(_ControllerTypeToName(eStorageController), False); 905 906 iDevice = 0; 907 if eStorageController == vboxcon.StorageControllerType_PIIX3 or \ 908 eStorageController == vboxcon.StorageControllerType_PIIX4: 909 iDevice = 1; # Master is for the OS. 910 911 if sDiskFormat == "iSCSI": 912 listNames = []; 913 listValues = []; 914 listValues = self.asIscsiTargets[0].split('|'); 915 listNames.append('TargetAddress'); 916 listNames.append('TargetName'); 917 listNames.append('LUN'); 918 919 if self.fpApiVer >= 5.0: 920 oHd = oSession.oVBox.createMedium(sDiskFormat, sDiskPath, vboxcon.AccessMode_ReadWrite, \ 921 vboxcon.DeviceType_HardDisk); 922 else: 923 oHd = oSession.oVBox.createHardDisk(sDiskFormat, sDiskPath); 924 oHd.type = vboxcon.MediumType_Normal; 925 oHd.setProperties(listNames, listValues); 926 927 # Attach it. 928 if fRc is True: 937 lstDisks = []; # List of disks we have to delete afterwards. 938 939 for iDiffLvl in range(self.cDiffLvls + 1): 940 941 if iDiffLvl == 0: 942 reporter.testStart('Base'); 943 else: 944 reporter.testStart('Diff %u' % (iDiffLvl)); 945 946 # Reconfigure the VM 947 oSession = self.openSession(oVM); 948 if oSession is not None: 949 # Attach HD 950 fRc = oSession.ensureControllerAttached(_ControllerTypeToName(eStorageController)); 951 fRc = fRc and oSession.setStorageControllerType(eStorageController, _ControllerTypeToName(eStorageController)); 952 953 if sHostIoCache == 'hostiocache': 954 fRc = fRc and oSession.setStorageControllerHostIoCache(_ControllerTypeToName(eStorageController), True); 955 elif sHostIoCache == 'no-hostiocache': 956 fRc = fRc and oSession.setStorageControllerHostIoCache(_ControllerTypeToName(eStorageController), False); 957 958 iDevice = 0; 959 if eStorageController == vboxcon.StorageControllerType_PIIX3 or \ 960 eStorageController == vboxcon.StorageControllerType_PIIX4: 961 iDevice = 1; # Master is for the OS. 962 963 oHdParent = None; 964 if iDiffLvl > 0: 965 oHdParent = lstDisks[0]; 966 oHd = self.createHd(oSession, sDiskFormat, sDiskVariant, iDiffLvl, oHdParent, sDiskPath, cbDisk); 967 if oHd is not None: 968 lstDisks.insert(0, oHd); 929 969 try: 930 970 if oSession.fpApiVer >= 4.0: … … 940 980 else: 941 981 reporter.log('attached "%s" to %s' % (sDiskPath, oSession.sName)); 942 else:943 tMediumVariant = self.convDiskToMediumVariant(sDiskVariant);944 fRc = fRc and oSession.createAndAttachHd(sDiskPath + '/test.disk', sDiskFormat, \945 _ControllerTypeToName(eStorageController), \946 cb = cbDisk, iPort = 0, iDevice = iDevice, \947 fImmutable = False, cMsTimeout = 3600 * 1000, \948 tMediumVariant = tMediumVariant);949 fRc = fRc and oSession.enableVirtEx(fHwVirt);950 fRc = fRc and oSession.enableNestedPaging(fNestedPaging);951 fRc = fRc and oSession.setCpuCount(cCpus);952 fRc = fRc and oSession.saveSettings();953 fRc = oSession.close() and fRc and True; # pychecker hack.954 oSession = None;955 else:956 fRc = False;957 958 # Start up.959 if fRc is True:960 self.logVmInfo(oVM);961 oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(sVmName, fCdWait = False, fNatForwardingForTxs = True);962 if oSession is not None:963 self.addTask(oSession);964 965 # Fudge factor - Allow the guest to finish starting up.966 self.sleep(5);967 968 # Prepare the storage on the guest969 lstBinaryPaths = ['/bin', '/sbin', '/usr/bin', '/usr/sbin' ];970 oExecVm = remoteexecutor.RemoteExecutor(oTxsSession, lstBinaryPaths, '${SCRATCH}');971 oStorCfgVm = storagecfg.StorageCfg(oExecVm, 'linux', self.getGuestDisk(oSession, oTxsSession, \972 eStorageController));973 974 sMountPoint = self.prepareStorage(oStorCfgVm);975 if sMountPoint is not None:976 self.testBenchmark('linux', sIoTest, sMountPoint, oExecVm, dTestSet);977 self.cleanupStorage(oStorCfgVm);978 982 else: 979 reporter.testFailure('Failed to prepare storage for the guest benchmark'); 980 981 # cleanup. 982 self.removeTask(oTxsSession); 983 self.terminateVmBySession(oSession) 983 fRc = False; 984 fRc = fRc and oSession.enableVirtEx(fHwVirt); 985 fRc = fRc and oSession.enableNestedPaging(fNestedPaging); 986 fRc = fRc and oSession.setCpuCount(cCpus); 987 fRc = fRc and oSession.saveSettings(); 988 fRc = oSession.close() and fRc and True; # pychecker hack. 989 oSession = None; 984 990 else: 985 991 fRc = False; 986 992 987 # Remove disk 988 oSession = self.openSession(oVM); 989 if oSession is not None: 990 try: 991 oSession.o.machine.detachDevice(_ControllerTypeToName(eStorageController), 0, iDevice); 992 993 # Remove storage controller if it is not an IDE controller. 994 if eStorageController is not vboxcon.StorageControllerType_PIIX3 \ 995 and eStorageController is not vboxcon.StorageControllerType_PIIX4: 996 oSession.o.machine.removeStorageController(_ControllerTypeToName(eStorageController)); 997 998 oSession.saveSettings(); 999 self.oVBox.deleteHdByLocation(sDiskPath + '/test.disk'); 1000 oSession.saveSettings(); 1001 oSession.close(); 1002 oSession = None; 1003 except: 1004 reporter.errorXcpt('failed to detach/delete disk %s from storage controller' % (sDiskPath)); 1005 else: 1006 fRc = False; 1007 1008 # Cleanup storage area 1009 if sDiskFormat != 'iSCSI' and not self.fUseScratch and self.fRecreateStorCfg: 1010 self.cleanupStorage(self.oStorCfg); 993 # Start up. 994 if fRc is True: 995 self.logVmInfo(oVM); 996 oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(sVmName, fCdWait = False, fNatForwardingForTxs = True); 997 if oSession is not None: 998 self.addTask(oSession); 999 1000 # Fudge factor - Allow the guest to finish starting up. 1001 self.sleep(5); 1002 1003 # Prepare the storage on the guest 1004 lstBinaryPaths = ['/bin', '/sbin', '/usr/bin', '/usr/sbin' ]; 1005 oExecVm = remoteexecutor.RemoteExecutor(oTxsSession, lstBinaryPaths, '${SCRATCH}'); 1006 oStorCfgVm = storagecfg.StorageCfg(oExecVm, 'linux', self.getGuestDisk(oSession, oTxsSession, \ 1007 eStorageController)); 1008 1009 sMountPoint = self.prepareStorage(oStorCfgVm); 1010 if sMountPoint is not None: 1011 self.testBenchmark('linux', sIoTest, sMountPoint, oExecVm, dTestSet); 1012 self.cleanupStorage(oStorCfgVm); 1013 else: 1014 reporter.testFailure('Failed to prepare storage for the guest benchmark'); 1015 1016 # cleanup. 1017 self.removeTask(oTxsSession); 1018 self.terminateVmBySession(oSession) 1019 else: 1020 fRc = False; 1021 1022 # Remove disk 1023 oSession = self.openSession(oVM); 1024 if oSession is not None: 1025 try: 1026 oSession.o.machine.detachDevice(_ControllerTypeToName(eStorageController), 0, iDevice); 1027 1028 # Remove storage controller if it is not an IDE controller. 1029 if eStorageController is not vboxcon.StorageControllerType_PIIX3 \ 1030 and eStorageController is not vboxcon.StorageControllerType_PIIX4: 1031 oSession.o.machine.removeStorageController(_ControllerTypeToName(eStorageController)); 1032 1033 oSession.saveSettings(); 1034 oSession.saveSettings(); 1035 oSession.close(); 1036 oSession = None; 1037 except: 1038 reporter.errorXcpt('failed to detach/delete disk %s from storage controller' % (sDiskPath)); 1039 else: 1040 fRc = False; 1041 1042 reporter.testDone(); 1043 1044 # Delete all disks 1045 for oHd in lstDisks: 1046 self.oVBox.deleteHdByMedium(oHd); 1047 1048 # Cleanup storage area 1049 if sDiskFormat != 'iSCSI' and not self.fUseScratch and self.fRecreateStorCfg: 1050 self.cleanupStorage(self.oStorCfg); 1011 1051 1012 1052 return fRc; … … 1054 1094 1055 1095 # Test the host first if requested 1056 if oDiskCfg is not None :1096 if oDiskCfg is not None or self.fUseScratch: 1057 1097 lstBinaryPaths = ['/bin', '/sbin', '/usr/bin', '/usr/sbin', \ 1058 1098 '/opt/csw/bin', '/usr/ccs/bin', '/usr/sfw/bin']; 1059 1099 oExecutor = remoteexecutor.RemoteExecutor(None, lstBinaryPaths, self.sScratchPath); 1060 self.oStorCfg = storagecfg.StorageCfg(oExecutor, utils.getHostOs(), oDiskCfg); 1061 1062 # Try to cleanup any leftovers from a previous run first. 1063 fRc = self.oStorCfg.cleanupLeftovers(); 1064 if not fRc: 1065 reporter.error('Failed to cleanup any leftovers from a previous run'); 1100 if not self.fUseScratch: 1101 self.oStorCfg = storagecfg.StorageCfg(oExecutor, utils.getHostOs(), oDiskCfg); 1102 1103 # Try to cleanup any leftovers from a previous run first. 1104 fRc = self.oStorCfg.cleanupLeftovers(); 1105 if not fRc: 1106 reporter.error('Failed to cleanup any leftovers from a previous run'); 1066 1107 1067 1108 if self.fTestHost: … … 1088 1129 # Create the storage space first if it is not done before every test. 1089 1130 sMountPoint = None; 1090 if not self.fRecreateStorCfg: 1131 if self.fUseScratch: 1132 sMountPoint = self.sScratchPath; 1133 elif not self.fRecreateStorCfg: 1091 1134 reporter.testStart('Create host storage'); 1092 1135 sMountPoint = self.prepareStorage(self.oStorCfg);
Note:
See TracChangeset
for help on using the changeset viewer.