VirtualBox

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

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

typo

  • 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 62125 2016-07-07 20:31:17Z 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: 62125 $"
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.fUseScratch = False;
261 self.oStorCfg = None;
262
263 #
264 # Overridden methods.
265 #
266 def showUsage(self):
267 rc = vbox.TestDriver.showUsage(self);
268 reporter.log('');
269 reporter.log('tdStorageBenchmark1 Options:');
270 reporter.log(' --virt-modes <m1[:m2[:]]');
271 reporter.log(' Default: %s' % (':'.join(self.asVirtModesDef)));
272 reporter.log(' --cpu-counts <c1[:c2[:]]');
273 reporter.log(' Default: %s' % (':'.join(str(c) for c in self.acCpusDef)));
274 reporter.log(' --storage-ctrls <type1[:type2[:...]]>');
275 reporter.log(' Default: %s' % (':'.join(self.asStorageCtrls)));
276 reporter.log(' --disk-formats <type1[:type2[:...]]>');
277 reporter.log(' Default: %s' % (':'.join(self.asDiskFormats)));
278 reporter.log(' --iscsi-targets <target1[:target2[:...]]>');
279 reporter.log(' Default: %s' % (':'.join(self.asIscsiTargets)));
280 reporter.log(' --tests <test1[:test2[:...]]>');
281 reporter.log(' Default: %s' % (':'.join(self.asTests)));
282 reporter.log(' --test-vms <vm1[:vm2[:...]]>');
283 reporter.log(' Test the specified VMs in the given order. Use this to change');
284 reporter.log(' the execution order or limit the choice of VMs');
285 reporter.log(' Default: %s (all)' % (':'.join(self.asTestVMsDef)));
286 reporter.log(' --skip-vms <vm1[:vm2[:...]]>');
287 reporter.log(' Skip the specified VMs when testing.');
288 reporter.log(' --test-host');
289 reporter.log(' Do all configured tests on the host first and report the results');
290 reporter.log(' to get a baseline');
291 reporter.log(' --use-scratch');
292 reporter.log(' Use the scratch directory for testing instead of setting up');
293 reporter.log(' fresh volumes on dedicated disks (for development)');
294 return rc;
295
296 def parseOption(self, asArgs, iArg): # pylint: disable=R0912,R0915
297 if asArgs[iArg] == '--virt-modes':
298 iArg += 1;
299 if iArg >= len(asArgs): raise base.InvalidOption('The "--virt-modes" takes a colon separated list of modes');
300 self.asVirtModes = asArgs[iArg].split(':');
301 for s in self.asVirtModes:
302 if s not in self.asVirtModesDef:
303 raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
304 % (s, ' '.join(self.asVirtModesDef)));
305 elif asArgs[iArg] == '--cpu-counts':
306 iArg += 1;
307 if iArg >= len(asArgs): raise base.InvalidOption('The "--cpu-counts" takes a colon separated list of cpu counts');
308 self.acCpus = [];
309 for s in asArgs[iArg].split(':'):
310 try: c = int(s);
311 except: raise base.InvalidOption('The "--cpu-counts" value "%s" is not an integer' % (s,));
312 if c <= 0: raise base.InvalidOption('The "--cpu-counts" value "%s" is zero or negative' % (s,));
313 self.acCpus.append(c);
314 elif asArgs[iArg] == '--storage-ctrls':
315 iArg += 1;
316 if iArg >= len(asArgs):
317 raise base.InvalidOption('The "--storage-ctrls" takes a colon separated list of Storage controller types');
318 self.asStorageCtrls = asArgs[iArg].split(':');
319 elif asArgs[iArg] == '--disk-formats':
320 iArg += 1;
321 if iArg >= len(asArgs): raise base.InvalidOption('The "--disk-formats" takes a colon separated list of disk formats');
322 self.asDiskFormats = asArgs[iArg].split(':');
323 elif asArgs[iArg] == '--iscsi-targets':
324 iArg += 1;
325 if iArg >= len(asArgs):
326 raise base.InvalidOption('The "--iscsi-targets" takes a colon separated list of iscsi targets');
327 self.asIscsiTargets = asArgs[iArg].split(':');
328 elif asArgs[iArg] == '--tests':
329 iArg += 1;
330 if iArg >= len(asArgs): raise base.InvalidOption('The "--tests" takes a colon separated list of disk formats');
331 self.asTests = asArgs[iArg].split(':');
332 elif asArgs[iArg] == '--test-vms':
333 iArg += 1;
334 if iArg >= len(asArgs): raise base.InvalidOption('The "--test-vms" takes colon separated list');
335 self.asTestVMs = asArgs[iArg].split(':');
336 for s in self.asTestVMs:
337 if s not in self.asTestVMsDef:
338 raise base.InvalidOption('The "--test-vms" value "%s" is not valid; valid values are: %s' \
339 % (s, ' '.join(self.asTestVMsDef)));
340 elif asArgs[iArg] == '--skip-vms':
341 iArg += 1;
342 if iArg >= len(asArgs): raise base.InvalidOption('The "--skip-vms" takes colon separated list');
343 self.asSkipVMs = asArgs[iArg].split(':');
344 for s in self.asSkipVMs:
345 if s not in self.asTestVMsDef:
346 reporter.log('warning: The "--test-vms" value "%s" does not specify any of our test VMs.' % (s));
347 elif asArgs[iArg] == '--test-host':
348 self.fTestHost = True;
349 elif asArgs[iArg] == '--use-scratch':
350 self.fUseScratch = True;
351 else:
352 return vbox.TestDriver.parseOption(self, asArgs, iArg);
353 return iArg + 1;
354
355 def completeOptions(self):
356 # Remove skipped VMs from the test list.
357 for sVM in self.asSkipVMs:
358 try: self.asTestVMs.remove(sVM);
359 except: pass;
360
361 return vbox.TestDriver.completeOptions(self);
362
363 def getResourceSet(self):
364 # Construct the resource list the first time it's queried.
365 if self.asRsrcs is None:
366 self.asRsrcs = [];
367 if 'tst-storage' in self.asTestVMs:
368 self.asRsrcs.append('5.1/storage/tst-storage.vdi');
369
370 return self.asRsrcs;
371
372 def actionConfig(self):
373
374 # Make sure vboxapi has been imported so we can use the constants.
375 if not self.importVBoxApi():
376 return False;
377
378 #
379 # Configure the VMs we're going to use.
380 #
381
382 # Linux VMs
383 if 'tst-storage' in self.asTestVMs:
384 oVM = self.createTestVM('tst-storage', 1, '5.1/storage/tst-storage.vdi', sKind = 'ArchLinux_64', fIoApic = True, \
385 eNic0AttachType = vboxcon.NetworkAttachmentType_NAT, \
386 eNic0Type = vboxcon.NetworkAdapterType_Am79C973);
387 if oVM is None:
388 return False;
389
390 return True;
391
392 def actionExecute(self):
393 """
394 Execute the testcase.
395 """
396 fRc = self.test1();
397 return fRc;
398
399
400 #
401 # Test execution helpers.
402 #
403
404 def prepareStorage(self, oStorCfg):
405 """
406 Prepares the host storage for disk images or direct testing on the host.
407 """
408 # Create a basic pool with the default configuration.
409 sMountPoint = None;
410 fRc, sPoolId = oStorCfg.createStoragePool();
411 if fRc:
412 fRc, sMountPoint = oStorCfg.createVolume(sPoolId);
413 if not fRc:
414 sMountPoint = None;
415 oStorCfg.cleanup();
416
417 return sMountPoint;
418
419 def cleanupStorage(self, oStorCfg):
420 """
421 Cleans up any created storage space for a test.
422 """
423 return oStorCfg.cleanup();
424
425 def testBenchmark(self, sTargetOs, sBenchmark, sMountpoint, oExecutor):
426 """
427 Runs the given benchmark on the test host.
428 """
429 # Create a basic config
430 dCfg = {
431 'RecordSize': '64k',
432 'TestsetSize': '100m',
433 'QueueDepth': '32',
434 'FilePath': sMountpoint,
435 'TargetOs': sTargetOs
436 };
437
438 oTst = None;
439 if sBenchmark == 'iozone':
440 oTst = IozoneTest(oExecutor, dCfg);
441 elif sBenchmark == 'fio':
442 oTst = FioTest(oExecutor, dCfg); # pylint: disable=R0204
443
444 if oTst is not None:
445 reporter.testStart(sBenchmark);
446 fRc = oTst.prepare();
447 if fRc:
448 fRc = oTst.run();
449 if fRc:
450 fRc = oTst.reportResult();
451 else:
452 reporter.testFailure('Running the testcase failed');
453 else:
454 reporter.testFailure('Preparing the testcase failed');
455
456 oTst.cleanup();
457 reporter.testDone();
458
459 return fRc;
460
461 def testBenchmarks(self, sTargetOs, sMountPoint, oExecutor):
462 """
463 Runs all the configured benchmarks on the target.
464 """
465 for sTest in self.asTests:
466 self.testBenchmark(sTargetOs, sTest, sMountPoint, oExecutor);
467
468 def test1OneCfg(self, sVmName, eStorageController, sDiskFormat, sDiskPath, cCpus, fHwVirt, fNestedPaging):
469 """
470 Runs the specified VM thru test #1.
471
472 Returns a success indicator on the general test execution. This is not
473 the actual test result.
474 """
475 oVM = self.getVmByName(sVmName);
476
477 # Reconfigure the VM
478 fRc = True;
479 oSession = self.openSession(oVM);
480 if oSession is not None:
481 # Attach HD
482 fRc = oSession.ensureControllerAttached(_ControllerTypeToName(eStorageController));
483 fRc = fRc and oSession.setStorageControllerType(eStorageController, _ControllerTypeToName(eStorageController));
484
485 if sDiskFormat == "iSCSI":
486 listNames = [];
487 listValues = [];
488 listValues = sDiskPath.split('|');
489 listNames.append('TargetAddress');
490 listNames.append('TargetName');
491 listNames.append('LUN');
492
493 if self.fpApiVer >= 5.0:
494 oHd = oSession.oVBox.createMedium(sDiskFormat, sDiskPath, vboxcon.AccessMode_ReadWrite, \
495 vboxcon.DeviceType_HardDisk);
496 else:
497 oHd = oSession.oVBox.createHardDisk(sDiskFormat, sDiskPath);
498 oHd.type = vboxcon.MediumType_Normal;
499 oHd.setProperties(listNames, listValues);
500
501 # Attach it.
502 if fRc is True:
503 try:
504 if oSession.fpApiVer >= 4.0:
505 oSession.o.machine.attachDevice(_ControllerTypeToName(eStorageController), \
506 1, 0, vboxcon.DeviceType_HardDisk, oHd);
507 else:
508 oSession.o.machine.attachDevice(_ControllerTypeToName(eStorageController), \
509 1, 0, vboxcon.DeviceType_HardDisk, oHd.id);
510 except:
511 reporter.errorXcpt('attachDevice("%s",%s,%s,HardDisk,"%s") failed on "%s"' \
512 % (_ControllerTypeToName(eStorageController), 1, 0, oHd.id, oSession.sName) );
513 fRc = False;
514 else:
515 reporter.log('attached "%s" to %s' % (sDiskPath, oSession.sName));
516 else:
517 fRc = fRc and oSession.createAndAttachHd(sDiskPath, sDiskFormat, _ControllerTypeToName(eStorageController), \
518 cb = 300*1024*1024*1024, iPort = 1, fImmutable = False);
519 fRc = fRc and oSession.enableVirtEx(fHwVirt);
520 fRc = fRc and oSession.enableNestedPaging(fNestedPaging);
521 fRc = fRc and oSession.setCpuCount(cCpus);
522 fRc = fRc and oSession.saveSettings();
523 fRc = oSession.close() and fRc and True; # pychecker hack.
524 oSession = None;
525 else:
526 fRc = False;
527
528 # Start up.
529 if fRc is True:
530 self.logVmInfo(oVM);
531 oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(sVmName, fCdWait = False, fNatForwardingForTxs = True);
532 if oSession is not None:
533 self.addTask(oSession);
534
535 # Fudge factor - Allow the guest to finish starting up.
536 self.sleep(5);
537
538 # Prepare the storage on the guest
539 lstBinaryPaths = ['/bin', '/sbin', '/usr/bin', '/usr/sbin' ];
540 oExecVm = remoteexecutor.RemoteExecutor(oTxsSession, lstBinaryPaths, '${SCRATCH}');
541 oStorCfgVm = storagecfg.StorageCfg(oExecVm, 'linux', [ '/dev/sdb' ]);
542
543 sMountPoint = self.prepareStorage(oStorCfgVm);
544 if sMountPoint is not None:
545 self.testBenchmarks('linux', sMountPoint, oExecVm);
546 self.cleanupStorage(oStorCfgVm);
547 else:
548 reporter.testFailure('Failed to prepare storage for the guest benchmark');
549
550 # cleanup.
551 self.removeTask(oTxsSession);
552 self.terminateVmBySession(oSession)
553
554 # Remove disk
555 oSession = self.openSession(oVM);
556 if oSession is not None:
557 try:
558 oSession.o.machine.detachDevice(_ControllerTypeToName(eStorageController), 1, 0);
559
560 # Remove storage controller if it is not an IDE controller.
561 if eStorageController is not vboxcon.StorageControllerType_PIIX3 \
562 and eStorageController is not vboxcon.StorageControllerType_PIIX4:
563 oSession.o.machine.removeStorageController(_ControllerTypeToName(eStorageController));
564
565 oSession.saveSettings();
566 self.oVBox.deleteHdByLocation(sDiskPath);
567 oSession.saveSettings();
568 oSession.close();
569 oSession = None;
570 except:
571 reporter.errorXcpt('failed to detach/delete disk %s from storage controller' % (sDiskPath));
572 else:
573 fRc = False;
574 else:
575 fRc = False;
576 return fRc;
577
578 def testBenchmarkOneVM(self, sVmName):
579 """
580 Runs one VM thru the various benchmark configurations.
581 """
582 reporter.testStart(sVmName);
583 fRc = True;
584 for sStorageCtrl in self.asStorageCtrls:
585 reporter.testStart(sStorageCtrl);
586
587 if sStorageCtrl == 'AHCI':
588 eStorageCtrl = vboxcon.StorageControllerType_IntelAhci;
589 elif sStorageCtrl == 'IDE':
590 eStorageCtrl = vboxcon.StorageControllerType_PIIX4;
591 elif sStorageCtrl == 'LsiLogicSAS':
592 eStorageCtrl = vboxcon.StorageControllerType_LsiLogicSas;
593 elif sStorageCtrl == 'LsiLogic':
594 eStorageCtrl = vboxcon.StorageControllerType_LsiLogic;
595 elif sStorageCtrl == 'BusLogic':
596 eStorageCtrl = vboxcon.StorageControllerType_BusLogic;
597 else:
598 eStorageCtrl = None;
599
600 for sDiskFormat in self.asDiskFormats:
601 reporter.testStart('%s' % (sDiskFormat));
602
603 if sDiskFormat == "iSCSI":
604 asPaths = self.asIscsiTargets;
605 else:
606 if self.fUseScratch:
607 asPaths = [ self. sScratchPath ];
608 else:
609 # Create a new default storage config on the host
610 sMountPoint = self.prepareStorage(self.oStorCfg);
611 if sMountPoint is not None:
612 # Create a directory where every normal user can write to.
613 self.oStorCfg.mkDirOnVolume(sMountPoint, 'test', 0777);
614 asPaths = [ sMountPoint + '/test' ];
615 else:
616 asPaths = [];
617 fRc = False;
618 reporter.testFailure('Failed to prepare storage for VM');
619
620 for sPath in asPaths:
621 reporter.testStart('%s' % (sPath));
622
623 if sDiskFormat == "iSCSI":
624 sPath = sPath;
625 else:
626 sPath = sPath + "/test.disk";
627
628 for cCpus in self.acCpus:
629 if cCpus == 1: reporter.testStart('1 cpu');
630 else: reporter.testStart('%u cpus' % (cCpus));
631
632 for sVirtMode in self.asVirtModes:
633 if sVirtMode == 'raw' and cCpus > 1:
634 continue;
635 hsVirtModeDesc = {};
636 hsVirtModeDesc['raw'] = 'Raw-mode';
637 hsVirtModeDesc['hwvirt'] = 'HwVirt';
638 hsVirtModeDesc['hwvirt-np'] = 'NestedPaging';
639 reporter.testStart(hsVirtModeDesc[sVirtMode]);
640
641 fHwVirt = sVirtMode != 'raw';
642 fNestedPaging = sVirtMode == 'hwvirt-np';
643 fRc = self.test1OneCfg(sVmName, eStorageCtrl, sDiskFormat, sPath, \
644 cCpus, fHwVirt, fNestedPaging) and fRc and True; # pychecker hack.
645 reporter.testDone();
646
647 reporter.testDone();
648 reporter.testDone();
649 reporter.testDone();
650 reporter.testDone();
651 reporter.testDone();
652 return fRc;
653
654 def test1(self):
655 """
656 Executes test #1.
657 """
658
659 fRc = True;
660 oDiskCfg = self.kdStorageCfgs.get(socket.gethostname().lower());
661
662 # Test the host first if requested
663 if oDiskCfg is not None:
664 lstBinaryPaths = ['/bin', '/sbin', '/usr/bin', '/usr/sbin', \
665 '/opt/csw/bin', '/usr/ccs/bin', '/usr/sfw/bin'];
666 oExecutor = remoteexecutor.RemoteExecutor(None, lstBinaryPaths, self.sScratchPath);
667 self.oStorCfg = storagecfg.StorageCfg(oExecutor, utils.getHostOs(), oDiskCfg);
668
669 if self.fTestHost:
670 reporter.testStart('Host');
671 if self.fUseScratch:
672 sMountPoint = self.sScratchPath;
673 else:
674 sMountPoint = self.prepareStorage(self.oStorCfg);
675 if sMountPoint is not None:
676 fRc = self.testBenchmarks(utils.getHostOs(), sMountPoint, oExecutor);
677 self.cleanupStorage(self.oStorCfg);
678 else:
679 reporter.testFailure('Failed to prepare host storage');
680 reporter.testDone();
681
682 if fRc:
683 # Loop thru the test VMs.
684 for sVM in self.asTestVMs:
685 # run test on the VM.
686 if not self.testBenchmarkOneVM(sVM):
687 fRc = False;
688 else:
689 fRc = True;
690 else:
691 fRc = False;
692
693 return fRc;
694
695
696
697if __name__ == '__main__':
698 sys.exit(tdStorageBenchmark().main(sys.argv));
699
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