VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/tests/storage/tdStorageBenchmark1.py@ 62118

Last change on this file since 62118 was 62118, checked in by vboxsync, 9 years ago

ValidationKit/tests/storage: More hacking on the storage benchmark testcase

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 27.3 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3# $Id: tdStorageBenchmark1.py 62118 2016-07-07 16:16:44Z vboxsync $
4
5"""
6VirtualBox Validation Kit - Storage benchmark.
7"""
8
9__copyright__ = \
10"""
11Copyright (C) 2012-2015 Oracle Corporation
12
13This file is part of VirtualBox Open Source Edition (OSE), as
14available from http://www.215389.xyz. This file is free software;
15you can redistribute it and/or modify it under the terms of the GNU
16General Public License (GPL) as published by the Free Software
17Foundation, in version 2 as it comes in the "COPYING" file of the
18VirtualBox OSE distribution. VirtualBox OSE is distributed in the
19hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
20
21The contents of this file may alternatively be used under the terms
22of the Common Development and Distribution License Version 1.0
23(CDDL) only, as it comes in the "COPYING.CDDL" file of the
24VirtualBox OSE distribution, in which case the provisions of the
25CDDL are applicable instead of those of the GPL.
26
27You may elect to license modified versions of this file under the
28terms and conditions of either the GPL or the CDDL or both.
29"""
30__version__ = "$Revision: 62118 $"
31
32
33# Standard Python imports.
34import os;
35import socket;
36import sys;
37import StringIO;
38
39# Only the main script needs to modify the path.
40try: __file__
41except: __file__ = sys.argv[0];
42g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
43sys.path.append(g_ksValidationKitDir);
44
45# Validation Kit imports.
46from common import constants;
47from common import utils;
48from testdriver import reporter;
49from testdriver import base;
50from testdriver import vbox;
51from testdriver import vboxcon;
52
53import remoteexecutor;
54import storagecfg;
55
56def _ControllerTypeToName(eControllerType):
57 """ Translate a controller type to a name. """
58 if eControllerType == vboxcon.StorageControllerType_PIIX3 or eControllerType == vboxcon.StorageControllerType_PIIX4:
59 sType = "IDE Controller";
60 elif eControllerType == vboxcon.StorageControllerType_IntelAhci:
61 sType = "SATA Controller";
62 elif eControllerType == vboxcon.StorageControllerType_LsiLogicSas:
63 sType = "SAS Controller";
64 elif eControllerType == vboxcon.StorageControllerType_LsiLogic or eControllerType == vboxcon.StorageControllerType_BusLogic:
65 sType = "SCSI Controller";
66 else:
67 sType = "Storage Controller";
68 return sType;
69
70class FioTest(object):
71 """
72 Flexible I/O tester testcase.
73 """
74
75 kdHostIoEngine = {
76 'solaris': ('solarisaio', False),
77 'linux': ('libaio', True)
78 };
79
80 def __init__(self, oExecutor, dCfg = None):
81 self.oExecutor = oExecutor;
82 self.sCfgFileId = None;
83 self.dCfg = dCfg;
84
85 def prepare(self, cMsTimeout = 30000):
86 """ Prepares the testcase """
87
88 sTargetOs = self.dCfg.get('TargetOs', 'linux');
89 sIoEngine, fDirectIo = self.kdHostIoEngine.get(sTargetOs);
90 if sIoEngine is None:
91 return False;
92
93 cfgBuf = StringIO.StringIO();
94 cfgBuf.write('[global]\n');
95 cfgBuf.write('bs=' + self.dCfg.get('RecordSize', '4k') + '\n');
96 cfgBuf.write('ioengine=' + sIoEngine + '\n');
97 cfgBuf.write('iodepth=' + self.dCfg.get('QueueDepth', '32') + '\n');
98 cfgBuf.write('size=' + self.dCfg.get('TestsetSize', '2g') + '\n');
99 if fDirectIo:
100 cfgBuf.write('direct=1\n');
101 else:
102 cfgBuf.write('direct=0\n');
103 cfgBuf.write('directory=' + self.dCfg.get('FilePath', '/mnt') + '\n');
104
105 cfgBuf.write('[seq-write]\n');
106 cfgBuf.write('rw=write\n');
107 cfgBuf.write('stonewall\n');
108
109 cfgBuf.write('[rand-write]\n');
110 cfgBuf.write('rw=randwrite\n');
111 cfgBuf.write('stonewall\n');
112
113 cfgBuf.write('[seq-read]\n');
114 cfgBuf.write('rw=read\n');
115 cfgBuf.write('stonewall\n');
116
117 cfgBuf.write('[rand-read]\n');
118 cfgBuf.write('rw=randread\n');
119 cfgBuf.write('stonewall\n');
120
121 self.sCfgFileId = self.oExecutor.copyString(cfgBuf.getvalue(), 'aio-test', cMsTimeout);
122 return self.sCfgFileId is not None;
123
124 def run(self, cMsTimeout = 30000):
125 """ Runs the testcase """
126 _ = cMsTimeout
127 fRc, sOutput = self.oExecutor.execBinary('fio', (self.sCfgFileId,));
128 # @todo: Parse output.
129 _ = sOutput;
130 return fRc;
131
132 def cleanup(self):
133 """ Cleans up any leftovers from the testcase. """
134
135 def reportResult(self):
136 """
137 Reports the test results to the test manager.
138 """
139 return True;
140
141class IozoneTest(object):
142 """
143 I/O zone testcase.
144 """
145 def __init__(self, oExecutor, dCfg = None):
146 self.oExecutor = oExecutor;
147 self.sResult = None;
148 self.lstTests = [ ('initial writers', 'FirstWrite'),
149 ('rewriters', 'Rewrite'),
150 ('re-readers', 'ReRead'),
151 ('stride readers', 'StrideRead'),
152 ('random readers', 'RandomRead'),
153 ('mixed workload', 'MixedWorkload'),
154 ('random writers', 'RandomWrite'),
155 ('pwrite writers', 'PWrite'),
156 ('pread readers', 'PRead'),
157 ('readers', 'FirstRead')];
158 self.sRecordSize = dCfg.get('RecordSize', '4k');
159 self.sTestsetSize = dCfg.get('TestsetSize', '2g');
160 self.sQueueDepth = dCfg.get('QueueDepth', '32');
161 self.sFilePath = dCfg.get('FilePath', '/mnt/iozone');
162 self.fDirectIo = True;
163
164 sTargetOs = dCfg.get('TargetOs');
165 if sTargetOs == 'solaris':
166 self.fDirectIo = False;
167
168 def prepare(self, cMsTimeout = 30000):
169 """ Prepares the testcase """
170 _ = cMsTimeout;
171 return True; # Nothing to do.
172
173 def run(self, cMsTimeout = 30000):
174 """ Runs the testcase """
175 tupArgs = ('-r', self.sRecordSize, '-s', self.sTestsetSize, \
176 '-t', '1', '-T', '-H', self.sQueueDepth, '-F', self.sFilePath + '/iozone.tmp');
177 if self.fDirectIo:
178 tupArgs += ('-I',);
179 fRc, sOutput = self.oExecutor.execBinary('iozone', tupArgs);
180 if fRc:
181 self.sResult = sOutput;
182
183 _ = cMsTimeout;
184 return fRc;
185
186 def cleanup(self):
187 """ Cleans up any leftovers from the testcase. """
188 return True;
189
190 def reportResult(self):
191 """
192 Reports the test results to the test manager.
193 """
194
195 fRc = True;
196 if self.sResult is not None:
197 try:
198 asLines = self.sResult.splitlines();
199 for sLine in asLines:
200 sLine = sLine.strip();
201 if sLine.startswith('Children') is True:
202 # Extract the value
203 idxValue = sLine.rfind('=');
204 if idxValue is -1:
205 raise Exception('IozoneTest: Invalid state');
206
207 idxValue += 1;
208 while sLine[idxValue] == ' ':
209 idxValue += 1;
210
211 idxValueEnd = idxValue;
212 while sLine[idxValueEnd] == '.' or sLine[idxValueEnd].isdigit():
213 idxValueEnd += 1;
214
215 for sNeedle, sTestVal in self.lstTests:
216 if sLine.rfind(sNeedle) is not -1:
217 reporter.testValue(sTestVal, sLine[idxValue:idxValueEnd],
218 constants.valueunit.g_asNames[constants.valueunit.KILOBYTES_PER_SEC]);
219 except:
220 fRc = False;
221 else:
222 fRc = False;
223
224 return fRc;
225
226
227class tdStorageBenchmark(vbox.TestDriver): # pylint: disable=R0902
228 """
229 Storage benchmark.
230 """
231
232 # Global storage configs for the testbox
233 kdStorageCfgs = {
234 'testboxstor1.de.oracle.com': r'c[3-9]t\dd0\Z',
235 'adaris': [ '/dev/sda' ]
236 };
237
238 def __init__(self):
239 vbox.TestDriver.__init__(self);
240 self.asRsrcs = None;
241 self.oGuestToGuestVM = None;
242 self.oGuestToGuestSess = None;
243 self.oGuestToGuestTxs = None;
244 self.asTestVMsDef = ['tst-storage'];
245 self.asTestVMs = self.asTestVMsDef;
246 self.asSkipVMs = [];
247 self.asVirtModesDef = ['hwvirt', 'hwvirt-np', 'raw',]
248 self.asVirtModes = self.asVirtModesDef
249 self.acCpusDef = [1, 2,]
250 self.acCpus = self.acCpusDef;
251 self.asStorageCtrlsDef = ['AHCI', 'IDE', 'LsiLogicSAS', 'LsiLogic', 'BusLogic'];
252 self.asStorageCtrls = self.asStorageCtrlsDef;
253 self.asDiskFormatsDef = ['VDI', 'VMDK', 'VHD', 'QED', 'Parallels', 'QCOW', 'iSCSI'];
254 self.asDiskFormats = self.asDiskFormatsDef;
255 self.asTestsDef = ['iozone', 'fio'];
256 self.asTests = self.asTestsDef;
257 self.asIscsiTargetsDef = [ ]; # @todo: Configure one target for basic iSCSI testing
258 self.asIscsiTargets = self.asIscsiTargetsDef;
259 self.fTestHost = False;
260 self.oStorCfg = None;
261
262 #
263 # Overridden methods.
264 #
265 def showUsage(self):
266 rc = vbox.TestDriver.showUsage(self);
267 reporter.log('');
268 reporter.log('tdStorageBenchmark1 Options:');
269 reporter.log(' --virt-modes <m1[:m2[:]]');
270 reporter.log(' Default: %s' % (':'.join(self.asVirtModesDef)));
271 reporter.log(' --cpu-counts <c1[:c2[:]]');
272 reporter.log(' Default: %s' % (':'.join(str(c) for c in self.acCpusDef)));
273 reporter.log(' --storage-ctrls <type1[:type2[:...]]>');
274 reporter.log(' Default: %s' % (':'.join(self.asStorageCtrls)));
275 reporter.log(' --disk-formats <type1[:type2[:...]]>');
276 reporter.log(' Default: %s' % (':'.join(self.asDiskFormats)));
277 reporter.log(' --iscsi-targets <target1[:target2[:...]]>');
278 reporter.log(' Default: %s' % (':'.join(self.asIscsiTargets)));
279 reporter.log(' --tests <test1[:test2[:...]]>');
280 reporter.log(' Default: %s' % (':'.join(self.asTests)));
281 reporter.log(' --test-vms <vm1[:vm2[:...]]>');
282 reporter.log(' Test the specified VMs in the given order. Use this to change');
283 reporter.log(' the execution order or limit the choice of VMs');
284 reporter.log(' Default: %s (all)' % (':'.join(self.asTestVMsDef)));
285 reporter.log(' --skip-vms <vm1[:vm2[:...]]>');
286 reporter.log(' Skip the specified VMs when testing.');
287 reporter.log(' --test-host');
288 reporter.log(' Do all configured tests on the host first and report the results');
289 reporter.log(' to get a baseline');
290 return rc;
291
292 def parseOption(self, asArgs, iArg): # pylint: disable=R0912,R0915
293 if asArgs[iArg] == '--virt-modes':
294 iArg += 1;
295 if iArg >= len(asArgs): raise base.InvalidOption('The "--virt-modes" takes a colon separated list of modes');
296 self.asVirtModes = asArgs[iArg].split(':');
297 for s in self.asVirtModes:
298 if s not in self.asVirtModesDef:
299 raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
300 % (s, ' '.join(self.asVirtModesDef)));
301 elif asArgs[iArg] == '--cpu-counts':
302 iArg += 1;
303 if iArg >= len(asArgs): raise base.InvalidOption('The "--cpu-counts" takes a colon separated list of cpu counts');
304 self.acCpus = [];
305 for s in asArgs[iArg].split(':'):
306 try: c = int(s);
307 except: raise base.InvalidOption('The "--cpu-counts" value "%s" is not an integer' % (s,));
308 if c <= 0: raise base.InvalidOption('The "--cpu-counts" value "%s" is zero or negative' % (s,));
309 self.acCpus.append(c);
310 elif asArgs[iArg] == '--storage-ctrls':
311 iArg += 1;
312 if iArg >= len(asArgs):
313 raise base.InvalidOption('The "--storage-ctrls" takes a colon separated list of Storage controller types');
314 self.asStorageCtrls = asArgs[iArg].split(':');
315 elif asArgs[iArg] == '--disk-formats':
316 iArg += 1;
317 if iArg >= len(asArgs): raise base.InvalidOption('The "--disk-formats" takes a colon separated list of disk formats');
318 self.asDiskFormats = asArgs[iArg].split(':');
319 elif asArgs[iArg] == '--iscsi-targets':
320 iArg += 1;
321 if iArg >= len(asArgs):
322 raise base.InvalidOption('The "--iscsi-targets" takes a colon separated list of iscsi targets');
323 self.asIscsiTargets = asArgs[iArg].split(':');
324 elif asArgs[iArg] == '--tests':
325 iArg += 1;
326 if iArg >= len(asArgs): raise base.InvalidOption('The "--tests" takes a colon separated list of disk formats');
327 self.asTests = asArgs[iArg].split(':');
328 elif asArgs[iArg] == '--test-vms':
329 iArg += 1;
330 if iArg >= len(asArgs): raise base.InvalidOption('The "--test-vms" takes colon separated list');
331 self.asTestVMs = asArgs[iArg].split(':');
332 for s in self.asTestVMs:
333 if s not in self.asTestVMsDef:
334 raise base.InvalidOption('The "--test-vms" value "%s" is not valid; valid values are: %s' \
335 % (s, ' '.join(self.asTestVMsDef)));
336 elif asArgs[iArg] == '--skip-vms':
337 iArg += 1;
338 if iArg >= len(asArgs): raise base.InvalidOption('The "--skip-vms" takes colon separated list');
339 self.asSkipVMs = asArgs[iArg].split(':');
340 for s in self.asSkipVMs:
341 if s not in self.asTestVMsDef:
342 reporter.log('warning: The "--test-vms" value "%s" does not specify any of our test VMs.' % (s));
343 elif asArgs[iArg] == '--test-host':
344 self.fTestHost = True;
345 else:
346 return vbox.TestDriver.parseOption(self, asArgs, iArg);
347 return iArg + 1;
348
349 def completeOptions(self):
350 # Remove skipped VMs from the test list.
351 for sVM in self.asSkipVMs:
352 try: self.asTestVMs.remove(sVM);
353 except: pass;
354
355 return vbox.TestDriver.completeOptions(self);
356
357 def getResourceSet(self):
358 # Construct the resource list the first time it's queried.
359 if self.asRsrcs is None:
360 self.asRsrcs = [];
361 if 'tst-storage' in self.asTestVMs:
362 self.asRsrcs.append('5.1/storage/tst-storage.vdi');
363
364 return self.asRsrcs;
365
366 def actionConfig(self):
367
368 # Make sure vboxapi has been imported so we can use the constants.
369 if not self.importVBoxApi():
370 return False;
371
372 #
373 # Configure the VMs we're going to use.
374 #
375
376 # Linux VMs
377 if 'tst-storage' in self.asTestVMs:
378 oVM = self.createTestVM('tst-storage', 1, '5.1/storage/tst-storage.vdi', sKind = 'ArchLinux_64', fIoApic = True, \
379 eNic0AttachType = vboxcon.NetworkAttachmentType_NAT, \
380 eNic0Type = vboxcon.NetworkAdapterType_Am79C973);
381 if oVM is None:
382 return False;
383
384 return True;
385
386 def actionExecute(self):
387 """
388 Execute the testcase.
389 """
390 fRc = self.test1();
391 return fRc;
392
393
394 #
395 # Test execution helpers.
396 #
397
398 def prepareStorage(self, oStorCfg):
399 """
400 Prepares the host storage for disk images or direct testing on the host.
401 """
402 # Create a basic pool with the default configuration.
403 sMountPoint = None;
404 fRc, sPoolId = oStorCfg.createStoragePool();
405 if fRc:
406 fRc, sMountPoint = oStorCfg.createVolume(sPoolId);
407 if not fRc:
408 sMountPoint = None;
409 oStorCfg.cleanup();
410
411 return sMountPoint;
412
413 def cleanupStorage(self, oStorCfg):
414 """
415 Cleans up any created storage space for a test.
416 """
417 return oStorCfg.cleanup();
418
419 def testBenchmark(self, sTargetOs, sBenchmark, sMountpoint, oExecutor):
420 """
421 Runs the given benchmark on the test host.
422 """
423 # Create a basic config
424 dCfg = {
425 'RecordSize': '64k',
426 'TestsetSize': '100m',
427 'QueueDepth': '32',
428 'FilePath': sMountpoint,
429 'TargetOs': sTargetOs
430 };
431
432 oTst = None;
433 if sBenchmark == 'iozone':
434 oTst = IozoneTest(oExecutor, dCfg);
435 elif sBenchmark == 'fio':
436 oTst = FioTest(oExecutor, dCfg); # pylint: disable=R0204
437
438 if oTst is not None:
439 reporter.testStart(sBenchmark);
440 fRc = oTst.prepare();
441 if fRc:
442 fRc = oTst.run();
443 if fRc:
444 fRc = oTst.reportResult();
445 else:
446 reporter.testFailure('Running the testcase failed');
447 else:
448 reporter.testFailure('Preparing the testcase failed');
449
450 oTst.cleanup();
451 reporter.testDone();
452
453 return fRc;
454
455 def testBenchmarks(self, sTargetOs, sMountPoint, oExecutor):
456 """
457 Runs all the configured benchmarks on the target.
458 """
459 for sTest in self.asTests:
460 self.testBenchmark(sTargetOs, sTest, sMountPoint, oExecutor);
461
462 def test1OneCfg(self, sVmName, eStorageController, sDiskFormat, sDiskPath, cCpus, fHwVirt, fNestedPaging):
463 """
464 Runs the specified VM thru test #1.
465
466 Returns a success indicator on the general test execution. This is not
467 the actual test result.
468 """
469 oVM = self.getVmByName(sVmName);
470
471 # Reconfigure the VM
472 fRc = True;
473 oSession = self.openSession(oVM);
474 if oSession is not None:
475 # Attach HD
476 fRc = oSession.ensureControllerAttached(_ControllerTypeToName(eStorageController));
477 fRc = fRc and oSession.setStorageControllerType(eStorageController, _ControllerTypeToName(eStorageController));
478
479 if sDiskFormat == "iSCSI":
480 listNames = [];
481 listValues = [];
482 listValues = sDiskPath.split('|');
483 listNames.append('TargetAddress');
484 listNames.append('TargetName');
485 listNames.append('LUN');
486
487 if self.fpApiVer >= 5.0:
488 oHd = oSession.oVBox.createMedium(sDiskFormat, sDiskPath, vboxcon.AccessMode_ReadWrite, \
489 vboxcon.DeviceType_HardDisk);
490 else:
491 oHd = oSession.oVBox.createHardDisk(sDiskFormat, sDiskPath);
492 oHd.type = vboxcon.MediumType_Normal;
493 oHd.setProperties(listNames, listValues);
494
495 # Attach it.
496 if fRc is True:
497 try:
498 if oSession.fpApiVer >= 4.0:
499 oSession.o.machine.attachDevice(_ControllerTypeToName(eStorageController), \
500 1, 0, vboxcon.DeviceType_HardDisk, oHd);
501 else:
502 oSession.o.machine.attachDevice(_ControllerTypeToName(eStorageController), \
503 1, 0, vboxcon.DeviceType_HardDisk, oHd.id);
504 except:
505 reporter.errorXcpt('attachDevice("%s",%s,%s,HardDisk,"%s") failed on "%s"' \
506 % (_ControllerTypeToName(eStorageController), 1, 0, oHd.id, oSession.sName) );
507 fRc = False;
508 else:
509 reporter.log('attached "%s" to %s' % (sDiskPath, oSession.sName));
510 else:
511 fRc = fRc and oSession.createAndAttachHd(sDiskPath, sDiskFormat, _ControllerTypeToName(eStorageController), \
512 cb = 300*1024*1024*1024, iPort = 1, fImmutable = False);
513 fRc = fRc and oSession.enableVirtEx(fHwVirt);
514 fRc = fRc and oSession.enableNestedPaging(fNestedPaging);
515 fRc = fRc and oSession.setCpuCount(cCpus);
516 fRc = fRc and oSession.saveSettings();
517 fRc = oSession.close() and fRc and True; # pychecker hack.
518 oSession = None;
519 else:
520 fRc = False;
521
522 # Start up.
523 if fRc is True:
524 self.logVmInfo(oVM);
525 oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(sVmName, fCdWait = False, fNatForwardingForTxs = True);
526 if oSession is not None:
527 self.addTask(oSession);
528
529 # Fudge factor - Allow the guest to finish starting up.
530 self.sleep(5);
531
532 # Prepare the storage on the guest
533 lstBinaryPaths = ['/bin', '/sbin', '/usr/bin', '/usr/sbin' ];
534 oExecVm = remoteexecutor.RemoteExecutor(oTxsSession, lstBinaryPaths, '${SCRATCH}');
535 oStorCfgVm = storagecfg.StorageCfg(oExecVm, 'linux', [ '/dev/sdb' ]);
536
537 sMountPoint = self.prepareStorage(oStorCfgVm);
538 if sMountPoint is not None:
539 self.testBenchmarks('linux', sMountPoint, oExecVm);
540 self.cleanupStorage(oStorCfgVm);
541 else:
542 reporter.testFailure('Failed to prepare storage for the guest benchmark');
543
544 # cleanup.
545 self.removeTask(oTxsSession);
546 self.terminateVmBySession(oSession)
547
548 # Remove disk
549 oSession = self.openSession(oVM);
550 if oSession is not None:
551 try:
552 oSession.o.machine.detachDevice(_ControllerTypeToName(eStorageController), 1, 0);
553
554 # Remove storage controller if it is not an IDE controller.
555 if eStorageController is not vboxcon.StorageControllerType_PIIX3 \
556 and eStorageController is not vboxcon.StorageControllerType_PIIX4:
557 oSession.o.machine.removeStorageController(_ControllerTypeToName(eStorageController));
558
559 oSession.saveSettings();
560 self.oVBox.deleteHdByLocation(sDiskPath);
561 oSession.saveSettings();
562 oSession.close();
563 oSession = None;
564 except:
565 reporter.errorXcpt('failed to detach/delete disk %s from storage controller' % (sDiskPath));
566 else:
567 fRc = False;
568 else:
569 fRc = False;
570 return fRc;
571
572 def testBenchmarkOneVM(self, sVmName):
573 """
574 Runs one VM thru the various benchmark configurations.
575 """
576 reporter.testStart(sVmName);
577 fRc = True;
578 for sStorageCtrl in self.asStorageCtrls:
579 reporter.testStart(sStorageCtrl);
580
581 if sStorageCtrl == 'AHCI':
582 eStorageCtrl = vboxcon.StorageControllerType_IntelAhci;
583 elif sStorageCtrl == 'IDE':
584 eStorageCtrl = vboxcon.StorageControllerType_PIIX4;
585 elif sStorageCtrl == 'LsiLogicSAS':
586 eStorageCtrl = vboxcon.StorageControllerType_LsiLogicSas;
587 elif sStorageCtrl == 'LsiLogic':
588 eStorageCtrl = vboxcon.StorageControllerType_LsiLogic;
589 elif sStorageCtrl == 'BusLogic':
590 eStorageCtrl = vboxcon.StorageControllerType_BusLogic;
591 else:
592 eStorageCtrl = None;
593
594 for sDiskFormat in self.asDiskFormats:
595 reporter.testStart('%s' % (sDiskFormat));
596
597 if sDiskFormat == "iSCSI":
598 asPaths = self.asIscsiTargets;
599 else:
600 # Create a new default storage config on the host
601 sMountPoint = self.prepareStorage(self.oStorCfg);
602 if sMountPoint is not None:
603 asPaths = [ sMountPoint ];
604 else:
605 asPaths = [];
606 fRc = False;
607 reporter.testFailure('Failed to prepare storage for VM');
608
609 for sPath in asPaths:
610 reporter.testStart('%s' % (sPath));
611
612 if sDiskFormat == "iSCSI":
613 sPath = sPath;
614 else:
615 # Create a directory where every normal user can write to.
616 self.oStorCfg.mkDirOnVolume(sPath, 'test', 0777);
617 sPath = sPath + "/test/test.disk";
618
619 for cCpus in self.acCpus:
620 if cCpus == 1: reporter.testStart('1 cpu');
621 else: reporter.testStart('%u cpus' % (cCpus));
622
623 for sVirtMode in self.asVirtModes:
624 if sVirtMode == 'raw' and cCpus > 1:
625 continue;
626 hsVirtModeDesc = {};
627 hsVirtModeDesc['raw'] = 'Raw-mode';
628 hsVirtModeDesc['hwvirt'] = 'HwVirt';
629 hsVirtModeDesc['hwvirt-np'] = 'NestedPaging';
630 reporter.testStart(hsVirtModeDesc[sVirtMode]);
631
632 fHwVirt = sVirtMode != 'raw';
633 fNestedPaging = sVirtMode == 'hwvirt-np';
634 fRc = self.test1OneCfg(sVmName, eStorageCtrl, sDiskFormat, sPath, \
635 cCpus, fHwVirt, fNestedPaging) and fRc and True; # pychecker hack.
636 reporter.testDone();
637
638 reporter.testDone();
639 reporter.testDone();
640 reporter.testDone();
641 reporter.testDone();
642 reporter.testDone();
643 return fRc;
644
645 def test1(self):
646 """
647 Executes test #1.
648 """
649
650 fRc = True;
651 oDiskCfg = self.kdStorageCfgs.get(socket.gethostname().lower());
652
653 # Test the host first if requested
654 if oDiskCfg is not None:
655 lstBinaryPaths = ['/bin', '/sbin', '/usr/bin', '/usr/sbin', \
656 '/opt/csw/bin', '/usr/ccs/bin', '/usr/sfw/bin'];
657 oExecutor = remoteexecutor.RemoteExecutor(None, lstBinaryPaths, self.sScratchPath);
658 self.oStorCfg = storagecfg.StorageCfg(oExecutor, utils.getHostOs(), oDiskCfg);
659
660 if self.fTestHost:
661 reporter.testStart('Host');
662 sMountPoint = self.prepareStorage(self.oStorCfg);
663 if sMountPoint is not None:
664 fRc = self.testBenchmarks(utils.getHostOs(), sMountPoint, oExecutor);
665 self.cleanupStorage(self.oStorCfg);
666 else:
667 reporter.testFailure('Failed to prepare host storage');
668 reporter.testDone();
669
670 if fRc:
671 # Loop thru the test VMs.
672 for sVM in self.asTestVMs:
673 # run test on the VM.
674 if not self.testBenchmarkOneVM(sVM):
675 fRc = False;
676 else:
677 fRc = True;
678 else:
679 fRc = False;
680
681 return fRc;
682
683
684
685if __name__ == '__main__':
686 sys.exit(tdStorageBenchmark().main(sys.argv));
687
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette