VirtualBox

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

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

ValidationKit/vboxwrappers.py: fix typos

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 27.9 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3# $Id: tdStorageBenchmark1.py 62181 2016-07-12 09:03:26Z 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: 62181 $"
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 ('reverse readers', 'ReverseRead'),
153 ('random readers', 'RandomRead'),
154 ('mixed workload', 'MixedWorkload'),
155 ('random writers', 'RandomWrite'),
156 ('pwrite writers', 'PWrite'),
157 ('pread readers', 'PRead'),
158 ('readers', 'FirstRead')];
159 self.sRecordSize = dCfg.get('RecordSize', '4k');
160 self.sTestsetSize = dCfg.get('TestsetSize', '2g');
161 self.sQueueDepth = dCfg.get('QueueDepth', '32');
162 self.sFilePath = dCfg.get('FilePath', '/mnt/iozone');
163 self.fDirectIo = True;
164
165 sTargetOs = dCfg.get('TargetOs');
166 if sTargetOs == 'solaris':
167 self.fDirectIo = False;
168
169 def prepare(self, cMsTimeout = 30000):
170 """ Prepares the testcase """
171 _ = cMsTimeout;
172 return True; # Nothing to do.
173
174 def run(self, cMsTimeout = 30000):
175 """ Runs the testcase """
176 tupArgs = ('-r', self.sRecordSize, '-s', self.sTestsetSize, \
177 '-t', '1', '-T', '-F', self.sFilePath + '/iozone.tmp');
178 if self.fDirectIo:
179 tupArgs += ('-I',);
180 fRc, sOutput = self.oExecutor.execBinary('iozone', tupArgs);
181 if fRc:
182 self.sResult = sOutput;
183
184 _ = cMsTimeout;
185 return fRc;
186
187 def cleanup(self):
188 """ Cleans up any leftovers from the testcase. """
189 return True;
190
191 def reportResult(self):
192 """
193 Reports the test results to the test manager.
194 """
195
196 fRc = True;
197 if self.sResult is not None:
198 try:
199 asLines = self.sResult.splitlines();
200 for sLine in asLines:
201 sLine = sLine.strip();
202 if sLine.startswith('Children') is True:
203 # Extract the value
204 idxValue = sLine.rfind('=');
205 if idxValue is -1:
206 raise Exception('IozoneTest: Invalid state');
207
208 idxValue += 1;
209 while sLine[idxValue] == ' ':
210 idxValue += 1;
211
212 idxValueEnd = idxValue;
213 while sLine[idxValueEnd] == '.' or sLine[idxValueEnd].isdigit():
214 idxValueEnd += 1;
215
216 for sNeedle, sTestVal in self.lstTests:
217 if sLine.rfind(sNeedle) is not -1:
218 reporter.testValue(sTestVal, sLine[idxValue:idxValueEnd],
219 constants.valueunit.g_asNames[constants.valueunit.KILOBYTES_PER_SEC]);
220 except:
221 fRc = False;
222 else:
223 fRc = False;
224
225 return fRc;
226
227
228class tdStorageBenchmark(vbox.TestDriver): # pylint: disable=R0902
229 """
230 Storage benchmark.
231 """
232
233 # Global storage configs for the testbox
234 kdStorageCfgs = {
235 'testboxstor1.de.oracle.com': r'c[3-9]t\dd0\Z',
236 'adaris': [ '/dev/sda' ]
237 };
238
239 def __init__(self):
240 vbox.TestDriver.__init__(self);
241 self.asRsrcs = None;
242 self.oGuestToGuestVM = None;
243 self.oGuestToGuestSess = None;
244 self.oGuestToGuestTxs = None;
245 self.asTestVMsDef = ['tst-storage'];
246 self.asTestVMs = self.asTestVMsDef;
247 self.asSkipVMs = [];
248 self.asVirtModesDef = ['hwvirt', 'hwvirt-np', 'raw',]
249 self.asVirtModes = self.asVirtModesDef
250 self.acCpusDef = [1, 2,]
251 self.acCpus = self.acCpusDef;
252 self.asStorageCtrlsDef = ['AHCI', 'IDE', 'LsiLogicSAS', 'LsiLogic', 'BusLogic'];
253 self.asStorageCtrls = self.asStorageCtrlsDef;
254 self.asDiskFormatsDef = ['VDI', 'VMDK', 'VHD', 'QED', 'Parallels', 'QCOW', 'iSCSI'];
255 self.asDiskFormats = self.asDiskFormatsDef;
256 self.asTestsDef = ['iozone', 'fio'];
257 self.asTests = self.asTestsDef;
258 self.asIscsiTargetsDef = [ ]; # @todo: Configure one target for basic iSCSI testing
259 self.asIscsiTargets = self.asIscsiTargetsDef;
260 self.fTestHost = False;
261 self.fUseScratch = False;
262 self.oStorCfg = None;
263
264 #
265 # Overridden methods.
266 #
267 def showUsage(self):
268 rc = vbox.TestDriver.showUsage(self);
269 reporter.log('');
270 reporter.log('tdStorageBenchmark1 Options:');
271 reporter.log(' --virt-modes <m1[:m2[:]]');
272 reporter.log(' Default: %s' % (':'.join(self.asVirtModesDef)));
273 reporter.log(' --cpu-counts <c1[:c2[:]]');
274 reporter.log(' Default: %s' % (':'.join(str(c) for c in self.acCpusDef)));
275 reporter.log(' --storage-ctrls <type1[:type2[:...]]>');
276 reporter.log(' Default: %s' % (':'.join(self.asStorageCtrls)));
277 reporter.log(' --disk-formats <type1[:type2[:...]]>');
278 reporter.log(' Default: %s' % (':'.join(self.asDiskFormats)));
279 reporter.log(' --iscsi-targets <target1[:target2[:...]]>');
280 reporter.log(' Default: %s' % (':'.join(self.asIscsiTargets)));
281 reporter.log(' --tests <test1[:test2[:...]]>');
282 reporter.log(' Default: %s' % (':'.join(self.asTests)));
283 reporter.log(' --test-vms <vm1[:vm2[:...]]>');
284 reporter.log(' Test the specified VMs in the given order. Use this to change');
285 reporter.log(' the execution order or limit the choice of VMs');
286 reporter.log(' Default: %s (all)' % (':'.join(self.asTestVMsDef)));
287 reporter.log(' --skip-vms <vm1[:vm2[:...]]>');
288 reporter.log(' Skip the specified VMs when testing.');
289 reporter.log(' --test-host');
290 reporter.log(' Do all configured tests on the host first and report the results');
291 reporter.log(' to get a baseline');
292 reporter.log(' --use-scratch');
293 reporter.log(' Use the scratch directory for testing instead of setting up');
294 reporter.log(' fresh volumes on dedicated disks (for development)');
295 return rc;
296
297 def parseOption(self, asArgs, iArg): # pylint: disable=R0912,R0915
298 if asArgs[iArg] == '--virt-modes':
299 iArg += 1;
300 if iArg >= len(asArgs): raise base.InvalidOption('The "--virt-modes" takes a colon separated list of modes');
301 self.asVirtModes = asArgs[iArg].split(':');
302 for s in self.asVirtModes:
303 if s not in self.asVirtModesDef:
304 raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
305 % (s, ' '.join(self.asVirtModesDef)));
306 elif asArgs[iArg] == '--cpu-counts':
307 iArg += 1;
308 if iArg >= len(asArgs): raise base.InvalidOption('The "--cpu-counts" takes a colon separated list of cpu counts');
309 self.acCpus = [];
310 for s in asArgs[iArg].split(':'):
311 try: c = int(s);
312 except: raise base.InvalidOption('The "--cpu-counts" value "%s" is not an integer' % (s,));
313 if c <= 0: raise base.InvalidOption('The "--cpu-counts" value "%s" is zero or negative' % (s,));
314 self.acCpus.append(c);
315 elif asArgs[iArg] == '--storage-ctrls':
316 iArg += 1;
317 if iArg >= len(asArgs):
318 raise base.InvalidOption('The "--storage-ctrls" takes a colon separated list of Storage controller types');
319 self.asStorageCtrls = asArgs[iArg].split(':');
320 elif asArgs[iArg] == '--disk-formats':
321 iArg += 1;
322 if iArg >= len(asArgs): raise base.InvalidOption('The "--disk-formats" takes a colon separated list of disk formats');
323 self.asDiskFormats = asArgs[iArg].split(':');
324 elif asArgs[iArg] == '--iscsi-targets':
325 iArg += 1;
326 if iArg >= len(asArgs):
327 raise base.InvalidOption('The "--iscsi-targets" takes a colon separated list of iscsi targets');
328 self.asIscsiTargets = asArgs[iArg].split(':');
329 elif asArgs[iArg] == '--tests':
330 iArg += 1;
331 if iArg >= len(asArgs): raise base.InvalidOption('The "--tests" takes a colon separated list of disk formats');
332 self.asTests = asArgs[iArg].split(':');
333 elif asArgs[iArg] == '--test-vms':
334 iArg += 1;
335 if iArg >= len(asArgs): raise base.InvalidOption('The "--test-vms" takes colon separated list');
336 self.asTestVMs = asArgs[iArg].split(':');
337 for s in self.asTestVMs:
338 if s not in self.asTestVMsDef:
339 raise base.InvalidOption('The "--test-vms" value "%s" is not valid; valid values are: %s' \
340 % (s, ' '.join(self.asTestVMsDef)));
341 elif asArgs[iArg] == '--skip-vms':
342 iArg += 1;
343 if iArg >= len(asArgs): raise base.InvalidOption('The "--skip-vms" takes colon separated list');
344 self.asSkipVMs = asArgs[iArg].split(':');
345 for s in self.asSkipVMs:
346 if s not in self.asTestVMsDef:
347 reporter.log('warning: The "--test-vms" value "%s" does not specify any of our test VMs.' % (s));
348 elif asArgs[iArg] == '--test-host':
349 self.fTestHost = True;
350 elif asArgs[iArg] == '--use-scratch':
351 self.fUseScratch = True;
352 else:
353 return vbox.TestDriver.parseOption(self, asArgs, iArg);
354 return iArg + 1;
355
356 def completeOptions(self):
357 # Remove skipped VMs from the test list.
358 for sVM in self.asSkipVMs:
359 try: self.asTestVMs.remove(sVM);
360 except: pass;
361
362 return vbox.TestDriver.completeOptions(self);
363
364 def getResourceSet(self):
365 # Construct the resource list the first time it's queried.
366 if self.asRsrcs is None:
367 self.asRsrcs = [];
368 if 'tst-storage' in self.asTestVMs:
369 self.asRsrcs.append('5.0/storage/tst-storage.vdi');
370
371 return self.asRsrcs;
372
373 def actionConfig(self):
374
375 # Make sure vboxapi has been imported so we can use the constants.
376 if not self.importVBoxApi():
377 return False;
378
379 #
380 # Configure the VMs we're going to use.
381 #
382
383 # Linux VMs
384 if 'tst-storage' in self.asTestVMs:
385 oVM = self.createTestVM('tst-storage', 1, '5.0/storage/tst-storage.vdi', sKind = 'ArchLinux_64', fIoApic = True, \
386 eNic0AttachType = vboxcon.NetworkAttachmentType_NAT, \
387 eNic0Type = vboxcon.NetworkAdapterType_Am79C973);
388 if oVM is None:
389 return False;
390
391 return True;
392
393 def actionExecute(self):
394 """
395 Execute the testcase.
396 """
397 fRc = self.test1();
398 return fRc;
399
400
401 #
402 # Test execution helpers.
403 #
404
405 def prepareStorage(self, oStorCfg):
406 """
407 Prepares the host storage for disk images or direct testing on the host.
408 """
409 # Create a basic pool with the default configuration.
410 sMountPoint = None;
411 fRc, sPoolId = oStorCfg.createStoragePool();
412 if fRc:
413 fRc, sMountPoint = oStorCfg.createVolume(sPoolId);
414 if not fRc:
415 sMountPoint = None;
416 oStorCfg.cleanup();
417
418 return sMountPoint;
419
420 def cleanupStorage(self, oStorCfg):
421 """
422 Cleans up any created storage space for a test.
423 """
424 return oStorCfg.cleanup();
425
426 def testBenchmark(self, sTargetOs, sBenchmark, sMountpoint, oExecutor):
427 """
428 Runs the given benchmark on the test host.
429 """
430 # Create a basic config
431 dCfg = {
432 'RecordSize': '64k',
433 'TestsetSize': '100m',
434 'QueueDepth': '32',
435 'FilePath': sMountpoint,
436 'TargetOs': sTargetOs
437 };
438
439 oTst = None;
440 if sBenchmark == 'iozone':
441 oTst = IozoneTest(oExecutor, dCfg);
442 elif sBenchmark == 'fio':
443 oTst = FioTest(oExecutor, dCfg); # pylint: disable=R0204
444
445 if oTst is not None:
446 reporter.testStart(sBenchmark);
447 fRc = oTst.prepare();
448 if fRc:
449 fRc = oTst.run();
450 if fRc:
451 fRc = oTst.reportResult();
452 else:
453 reporter.testFailure('Running the testcase failed');
454 else:
455 reporter.testFailure('Preparing the testcase failed');
456
457 oTst.cleanup();
458 reporter.testDone();
459
460 return fRc;
461
462 def testBenchmarks(self, sTargetOs, sMountPoint, oExecutor):
463 """
464 Runs all the configured benchmarks on the target.
465 """
466 for sTest in self.asTests:
467 self.testBenchmark(sTargetOs, sTest, sMountPoint, oExecutor);
468
469 def test1OneCfg(self, sVmName, eStorageController, sDiskFormat, sDiskPath, cCpus, fHwVirt, fNestedPaging):
470 """
471 Runs the specified VM thru test #1.
472
473 Returns a success indicator on the general test execution. This is not
474 the actual test result.
475 """
476 oVM = self.getVmByName(sVmName);
477
478 # Reconfigure the VM
479 fRc = True;
480 oSession = self.openSession(oVM);
481 if oSession is not None:
482 # Attach HD
483 fRc = oSession.ensureControllerAttached(_ControllerTypeToName(eStorageController));
484 fRc = fRc and oSession.setStorageControllerType(eStorageController, _ControllerTypeToName(eStorageController));
485
486 if sDiskFormat == "iSCSI":
487 listNames = [];
488 listValues = [];
489 listValues = sDiskPath.split('|');
490 listNames.append('TargetAddress');
491 listNames.append('TargetName');
492 listNames.append('LUN');
493
494 if self.fpApiVer >= 5.0:
495 oHd = oSession.oVBox.createMedium(sDiskFormat, sDiskPath, vboxcon.AccessMode_ReadWrite, \
496 vboxcon.DeviceType_HardDisk);
497 else:
498 oHd = oSession.oVBox.createHardDisk(sDiskFormat, sDiskPath);
499 oHd.type = vboxcon.MediumType_Normal;
500 oHd.setProperties(listNames, listValues);
501
502 # Attach it.
503 if fRc is True:
504 try:
505 if oSession.fpApiVer >= 4.0:
506 oSession.o.machine.attachDevice(_ControllerTypeToName(eStorageController), \
507 1, 0, vboxcon.DeviceType_HardDisk, oHd);
508 else:
509 oSession.o.machine.attachDevice(_ControllerTypeToName(eStorageController), \
510 1, 0, vboxcon.DeviceType_HardDisk, oHd.id);
511 except:
512 reporter.errorXcpt('attachDevice("%s",%s,%s,HardDisk,"%s") failed on "%s"' \
513 % (_ControllerTypeToName(eStorageController), 1, 0, oHd.id, oSession.sName) );
514 fRc = False;
515 else:
516 reporter.log('attached "%s" to %s' % (sDiskPath, oSession.sName));
517 else:
518 fRc = fRc and oSession.createAndAttachHd(sDiskPath, sDiskFormat, _ControllerTypeToName(eStorageController), \
519 cb = 300*1024*1024*1024, iPort = 1, fImmutable = False);
520 fRc = fRc and oSession.enableVirtEx(fHwVirt);
521 fRc = fRc and oSession.enableNestedPaging(fNestedPaging);
522 fRc = fRc and oSession.setCpuCount(cCpus);
523 fRc = fRc and oSession.saveSettings();
524 fRc = oSession.close() and fRc and True; # pychecker hack.
525 oSession = None;
526 else:
527 fRc = False;
528
529 # Start up.
530 if fRc is True:
531 self.logVmInfo(oVM);
532 oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(sVmName, fCdWait = False, fNatForwardingForTxs = True);
533 if oSession is not None:
534 self.addTask(oSession);
535
536 # Fudge factor - Allow the guest to finish starting up.
537 self.sleep(5);
538
539 # Prepare the storage on the guest
540 lstBinaryPaths = ['/bin', '/sbin', '/usr/bin', '/usr/sbin' ];
541 oExecVm = remoteexecutor.RemoteExecutor(oTxsSession, lstBinaryPaths, '${SCRATCH}');
542 oStorCfgVm = storagecfg.StorageCfg(oExecVm, 'linux', [ '/dev/sdb' ]);
543
544 sMountPoint = self.prepareStorage(oStorCfgVm);
545 if sMountPoint is not None:
546 self.testBenchmarks('linux', sMountPoint, oExecVm);
547 self.cleanupStorage(oStorCfgVm);
548 else:
549 reporter.testFailure('Failed to prepare storage for the guest benchmark');
550
551 # cleanup.
552 self.removeTask(oTxsSession);
553 self.terminateVmBySession(oSession)
554
555 # Remove disk
556 oSession = self.openSession(oVM);
557 if oSession is not None:
558 try:
559 oSession.o.machine.detachDevice(_ControllerTypeToName(eStorageController), 1, 0);
560
561 # Remove storage controller if it is not an IDE controller.
562 if eStorageController is not vboxcon.StorageControllerType_PIIX3 \
563 and eStorageController is not vboxcon.StorageControllerType_PIIX4:
564 oSession.o.machine.removeStorageController(_ControllerTypeToName(eStorageController));
565
566 oSession.saveSettings();
567 self.oVBox.deleteHdByLocation(sDiskPath);
568 oSession.saveSettings();
569 oSession.close();
570 oSession = None;
571 except:
572 reporter.errorXcpt('failed to detach/delete disk %s from storage controller' % (sDiskPath));
573 else:
574 fRc = False;
575 else:
576 fRc = False;
577 return fRc;
578
579 def testBenchmarkOneVM(self, sVmName):
580 """
581 Runs one VM thru the various benchmark configurations.
582 """
583 reporter.testStart(sVmName);
584 fRc = True;
585 for sStorageCtrl in self.asStorageCtrls:
586 reporter.testStart(sStorageCtrl);
587
588 if sStorageCtrl == 'AHCI':
589 eStorageCtrl = vboxcon.StorageControllerType_IntelAhci;
590 elif sStorageCtrl == 'IDE':
591 eStorageCtrl = vboxcon.StorageControllerType_PIIX4;
592 elif sStorageCtrl == 'LsiLogicSAS':
593 eStorageCtrl = vboxcon.StorageControllerType_LsiLogicSas;
594 elif sStorageCtrl == 'LsiLogic':
595 eStorageCtrl = vboxcon.StorageControllerType_LsiLogic;
596 elif sStorageCtrl == 'BusLogic':
597 eStorageCtrl = vboxcon.StorageControllerType_BusLogic;
598 else:
599 eStorageCtrl = None;
600
601 for sDiskFormat in self.asDiskFormats:
602 reporter.testStart('%s' % (sDiskFormat));
603
604 if sDiskFormat == "iSCSI":
605 asPaths = self.asIscsiTargets;
606 else:
607 if self.fUseScratch:
608 asPaths = [ self.sScratchPath ];
609 else:
610 # Create a new default storage config on the host
611 sMountPoint = self.prepareStorage(self.oStorCfg);
612 if sMountPoint is not None:
613 # Create a directory where every normal user can write to.
614 self.oStorCfg.mkDirOnVolume(sMountPoint, 'test', 0777);
615 asPaths = [ sMountPoint + '/test' ];
616 else:
617 asPaths = [];
618 fRc = False;
619 reporter.testFailure('Failed to prepare storage for VM');
620
621 for sPath in asPaths:
622 reporter.testStart('%s' % (sPath));
623
624 if sDiskFormat == "iSCSI":
625 sPath = sPath;
626 else:
627 sPath = sPath + "/test.disk";
628
629 for cCpus in self.acCpus:
630 if cCpus == 1: reporter.testStart('1 cpu');
631 else: reporter.testStart('%u cpus' % (cCpus));
632
633 for sVirtMode in self.asVirtModes:
634 if sVirtMode == 'raw' and cCpus > 1:
635 continue;
636 hsVirtModeDesc = {};
637 hsVirtModeDesc['raw'] = 'Raw-mode';
638 hsVirtModeDesc['hwvirt'] = 'HwVirt';
639 hsVirtModeDesc['hwvirt-np'] = 'NestedPaging';
640 reporter.testStart(hsVirtModeDesc[sVirtMode]);
641
642 fHwVirt = sVirtMode != 'raw';
643 fNestedPaging = sVirtMode == 'hwvirt-np';
644 fRc = self.test1OneCfg(sVmName, eStorageCtrl, sDiskFormat, sPath, \
645 cCpus, fHwVirt, fNestedPaging) and fRc and True; # pychecker hack.
646 reporter.testDone();
647
648 reporter.testDone();
649 reporter.testDone();
650 reporter.testDone();
651 reporter.testDone();
652 reporter.testDone();
653 return fRc;
654
655 def test1(self):
656 """
657 Executes test #1.
658 """
659
660 fRc = True;
661 oDiskCfg = self.kdStorageCfgs.get(socket.gethostname().lower());
662
663 # Test the host first if requested
664 if oDiskCfg is not None:
665 lstBinaryPaths = ['/bin', '/sbin', '/usr/bin', '/usr/sbin', \
666 '/opt/csw/bin', '/usr/ccs/bin', '/usr/sfw/bin'];
667 oExecutor = remoteexecutor.RemoteExecutor(None, lstBinaryPaths, self.sScratchPath);
668 self.oStorCfg = storagecfg.StorageCfg(oExecutor, utils.getHostOs(), oDiskCfg);
669
670 if self.fTestHost:
671 reporter.testStart('Host');
672 if self.fUseScratch:
673 sMountPoint = self.sScratchPath;
674 else:
675 sMountPoint = self.prepareStorage(self.oStorCfg);
676 if sMountPoint is not None:
677 fRc = self.testBenchmarks(utils.getHostOs(), sMountPoint, oExecutor);
678 self.cleanupStorage(self.oStorCfg);
679 else:
680 reporter.testFailure('Failed to prepare host storage');
681 reporter.testDone();
682
683 if fRc:
684 # Loop thru the test VMs.
685 for sVM in self.asTestVMs:
686 # run test on the VM.
687 if not self.testBenchmarkOneVM(sVM):
688 fRc = False;
689 else:
690 fRc = True;
691 else:
692 fRc = False;
693
694 return fRc;
695
696if __name__ == '__main__':
697 sys.exit(tdStorageBenchmark().main(sys.argv));
698
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