儲存庫 vbox 的更動 63000
- 時間撮記:
- 2016-8-4 下午04:01:32 (8 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/ValidationKit/tests/storage/tdStorageBenchmark1.py
r62484 r63000 262 262 self.asDiskFormatsDef = ['VDI', 'VMDK', 'VHD', 'QED', 'Parallels', 'QCOW', 'iSCSI']; 263 263 self.asDiskFormats = self.asDiskFormatsDef; 264 self.asDiskVariantsDef = ['Dynamic', 'Fixed', 'Split2G']; 265 self.asDiskVariants = self.asDiskVariantsDef; 264 266 self.asTestsDef = ['iozone', 'fio']; 265 267 self.asTests = self.asTestsDef; … … 268 270 self.fTestHost = False; 269 271 self.fUseScratch = False; 272 self.fRecreateStorCfg = True; 270 273 self.oStorCfg = None; 271 274 … … 282 285 reporter.log(' Default: %s' % (':'.join(str(c) for c in self.acCpusDef))); 283 286 reporter.log(' --storage-ctrls <type1[:type2[:...]]>'); 284 reporter.log(' Default: %s' % (':'.join(self.asStorageCtrls )));287 reporter.log(' Default: %s' % (':'.join(self.asStorageCtrlsDef))); 285 288 reporter.log(' --disk-formats <type1[:type2[:...]]>'); 286 reporter.log(' Default: %s' % (':'.join(self.asDiskFormats))); 289 reporter.log(' Default: %s' % (':'.join(self.asDiskFormatsDef))); 290 reporter.log(' --disk-variants <variant1[:variant2[:...]]>'); 291 reporter.log(' Default: %s' % (':'.join(self.asDiskVariantsDef))); 287 292 reporter.log(' --iscsi-targets <target1[:target2[:...]]>'); 288 293 reporter.log(' Default: %s' % (':'.join(self.asIscsiTargets))); … … 301 306 reporter.log(' Use the scratch directory for testing instead of setting up'); 302 307 reporter.log(' fresh volumes on dedicated disks (for development)'); 308 reporter.log(' --always-wipe-storage-cfg'); 309 reporter.log(' Recreate the host storage config before each test'); 310 reporter.log(' --dont-wipe-storage-cfg'); 311 reporter.log(' Don\' recreate the host storage config before each test'); 303 312 return rc; 304 313 … … 330 339 if iArg >= len(asArgs): raise base.InvalidOption('The "--disk-formats" takes a colon separated list of disk formats'); 331 340 self.asDiskFormats = asArgs[iArg].split(':'); 341 elif asArgs[iArg] == '--disk-variants': 342 iArg += 1; 343 if iArg >= len(asArgs): 344 raise base.InvalidOption('The "--disk-variants" takes a colon separated list of disk variants'); 345 self.asDiskVariants = asArgs[iArg].split(':'); 332 346 elif asArgs[iArg] == '--iscsi-targets': 333 347 iArg += 1; … … 358 372 elif asArgs[iArg] == '--use-scratch': 359 373 self.fUseScratch = True; 374 elif asArgs[iArg] == '--always-wipe-storage-cfg': 375 self.fRecreateStorCfg = True; 376 elif asArgs[iArg] == '--dont-wipe-storage-cfg': 377 self.fRecreateStorCfg = False; 360 378 else: 361 379 return vbox.TestDriver.parseOption(self, asArgs, iArg); … … 466 484 return lstDisks; 467 485 486 def getDiskFormatVariantsForTesting(self, sDiskFmt, asVariants): 487 """ 488 Returns a list of disk variants for testing supported by the given 489 disk format and selected for testing. 490 """ 491 lstDskFmts = self.oVBoxMgr.getArray(self.oVBox.systemProperties, 'mediumFormats'); 492 for oDskFmt in lstDskFmts: 493 if oDskFmt.id == sDiskFmt: 494 lstDskVariants = []; 495 lstCaps = self.oVBoxMgr.getArray(oDskFmt, 'capabilities'); 496 for eCap in lstCaps: 497 if eCap == vboxcon.MediumFormatCapabilities_CreateDynamic \ 498 and 'Dynamic' in asVariants: 499 lstDskVariants.append('Dynamic'); 500 elif eCap == vboxcon.MediumFormatCapabilities_CreateFixed \ 501 and 'Fixed' in asVariants: 502 lstDskVariants.append('Fixed'); 503 elif eCap == vboxcon.MediumFormatCapabilities_CreateSplit2G \ 504 and 'Split2G' in asVariants: 505 lstDskVariants.append('Split2G'); 506 elif eCap == vboxcon.MediumFormatCapabilities_TcpNetworking: 507 lstDskVariants.append('Network'); # Solely for iSCSI to get a non empty list 508 509 return lstDskVariants; 510 511 return []; 512 513 def convDiskToMediumVariant(self, sDiskVariant): 514 """ 515 Returns a tuple of medium variant flags matching the given disk variant. 516 """ 517 tMediumVariant = None; 518 if sDiskVariant == 'Dynamic': 519 tMediumVariant = (vboxcon.MediumVariant_Standard, ); 520 elif sDiskVariant == 'Fixed': 521 tMediumVariant = (vboxcon.MediumVariant_Fixed, ); 522 elif sDiskVariant == 'Split2G': 523 tMediumVariant = (vboxcon.MediumVariant_Fixed, vboxcon.MediumVariant_VmdkSplit2G); 524 525 return tMediumVariant; 526 468 527 def testBenchmark(self, sTargetOs, sBenchmark, sMountpoint, oExecutor): 469 528 """ … … 509 568 self.testBenchmark(sTargetOs, sTest, sMountPoint, oExecutor); 510 569 511 def test1OneCfg(self, sVmName, eStorageController, sDiskFormat, sDiskPath, cCpus, fHwVirt, fNestedPaging): 570 def test1OneCfg(self, sVmName, eStorageController, sDiskFormat, sDiskVariant, \ 571 sDiskPath, cCpus, fHwVirt, fNestedPaging): 512 572 """ 513 573 Runs the specified VM thru test #1. … … 563 623 reporter.log('attached "%s" to %s' % (sDiskPath, oSession.sName)); 564 624 else: 625 tMediumVariant = self.convDiskToMediumVariant(sDiskVariant); 565 626 fRc = fRc and oSession.createAndAttachHd(sDiskPath, sDiskFormat, _ControllerTypeToName(eStorageController), \ 566 627 cb = 300*1024*1024*1024, iPort = 0, iDevice = iDevice, \ 567 fImmutable = False );628 fImmutable = False, tMediumVariant = tMediumVariant); 568 629 fRc = fRc and oSession.enableVirtEx(fHwVirt); 569 630 fRc = fRc and oSession.enableNestedPaging(fNestedPaging); … … 627 688 return fRc; 628 689 629 def testBenchmarkOneVM(self, sVmName ):690 def testBenchmarkOneVM(self, sVmName, sMountPoint = None): 630 691 """ 631 692 Runs one VM thru the various benchmark configurations. … … 664 725 else: 665 726 # Create a new default storage config on the host 666 sMountPoint = self.prepareStorage(self.oStorCfg); 727 if sMountPoint is None: 728 sMountPoint = self.prepareStorage(self.oStorCfg); 667 729 if sMountPoint is not None: 668 730 # Create a directory where every normal user can write to. … … 674 736 reporter.testFailure('Failed to prepare storage for VM'); 675 737 676 for sPath in asPaths: 677 reporter.testStart('%s' % (sPath)); 678 679 if sDiskFormat == "iSCSI": 680 sPath = sPath; 681 else: 682 sPath = sPath + "/test.disk"; 683 684 for cCpus in self.acCpus: 685 if cCpus == 1: reporter.testStart('1 cpu'); 686 else: reporter.testStart('%u cpus' % (cCpus)); 687 688 for sVirtMode in self.asVirtModes: 689 if sVirtMode == 'raw' and (cCpus > 1 or sVmName == 'tst-storage'): 690 continue; 691 hsVirtModeDesc = {}; 692 hsVirtModeDesc['raw'] = 'Raw-mode'; 693 hsVirtModeDesc['hwvirt'] = 'HwVirt'; 694 hsVirtModeDesc['hwvirt-np'] = 'NestedPaging'; 695 reporter.testStart(hsVirtModeDesc[sVirtMode]); 696 697 fHwVirt = sVirtMode != 'raw'; 698 fNestedPaging = sVirtMode == 'hwvirt-np'; 699 fRc = self.test1OneCfg(sVmName, eStorageCtrl, sDiskFormat, sPath, \ 700 cCpus, fHwVirt, fNestedPaging) and fRc and True; # pychecker hack. 701 reporter.testDone(); 702 703 reporter.testDone(); 704 reporter.testDone(); 738 asVariants = self.getDiskFormatVariantsForTesting(sDiskFormat, self.asDiskVariants); 739 for sVariant in asVariants: 740 reporter.testStart('%s' % (sVariant)); 741 for sPath in asPaths: 742 if sDiskFormat == "iSCSI": 743 sPath = sPath; 744 else: 745 sPath = sPath + "/test.disk"; 746 747 for cCpus in self.acCpus: 748 if cCpus == 1: reporter.testStart('1 cpu'); 749 else: reporter.testStart('%u cpus' % (cCpus)); 750 751 for sVirtMode in self.asVirtModes: 752 if sVirtMode == 'raw' and (cCpus > 1 or sVmName == 'tst-storage'): 753 continue; 754 hsVirtModeDesc = {}; 755 hsVirtModeDesc['raw'] = 'Raw-mode'; 756 hsVirtModeDesc['hwvirt'] = 'HwVirt'; 757 hsVirtModeDesc['hwvirt-np'] = 'NestedPaging'; 758 reporter.testStart(hsVirtModeDesc[sVirtMode]); 759 760 fHwVirt = sVirtMode != 'raw'; 761 fNestedPaging = sVirtMode == 'hwvirt-np'; 762 fRc = self.test1OneCfg(sVmName, eStorageCtrl, sDiskFormat, sVariant, sPath, \ 763 cCpus, fHwVirt, fNestedPaging) and fRc and True; # pychecker hack. 764 reporter.testDone(); # Virt mode 765 766 reporter.testDone(); # CPU count 767 reporter.testDone(); # Disk variant 705 768 706 769 # Cleanup storage area 707 if sDiskFormat != 'iSCSI' and not self.fUseScratch :770 if sDiskFormat != 'iSCSI' and not self.fUseScratch and self.fRecreateStorCfg: 708 771 self.cleanupStorage(self.oStorCfg); 709 772 710 reporter.testDone(); 711 reporter.testDone(); 712 reporter.testDone(); 773 reporter.testDone(); # Disk format 774 reporter.testDone(); # Controller 775 reporter.testDone(); # VM 713 776 return fRc; 714 777 … … 742 805 reporter.testDone(); 743 806 else: 744 # Loop thru the test VMs. 745 for sVM in self.asTestVMs: 746 # run test on the VM. 747 if not self.testBenchmarkOneVM(sVM): 807 # Create the storage space first if it is not done before every test. 808 sMountPoint = None; 809 if not self.fRecreateStorCfg: 810 reporter.testStart('Create host storage'); 811 sMountPoint = self.prepareStorage(self.oStorCfg); 812 if sMountPoint is None: 813 reporter.testFailure('Failed to prepare host storage'); 748 814 fRc = False; 749 else: 750 fRc = True; 815 reporter.testDone(); 816 817 if fRc: 818 # Loop thru the test VMs. 819 for sVM in self.asTestVMs: 820 # run test on the VM. 821 if not self.testBenchmarkOneVM(sVM, sMountPoint): 822 fRc = False; 751 823 else: 752 824 fRc = False;
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器