tdStorageStress1.py revision 580e040eb04ce04ec23c4a2a32ee89445bedcc21
# -*- coding: utf-8 -*-
"""
Storage testcase using xfstests.
"""
__copyright__ = \
"""
Copyright (C) 2012-2015 Oracle Corporation
This file is part of VirtualBox Open Source Edition (OSE), as
available from http://www.virtualbox.org. This file is free software;
General Public License (GPL) as published by the Free Software
Foundation, in version 2 as it comes in the "COPYING" file of the
VirtualBox OSE distribution. VirtualBox OSE is distributed in the
hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
The contents of this file may alternatively be used under the terms
of the Common Development and Distribution License Version 1.0
(CDDL) only, as it comes in the "COPYING.CDDL" file of the
VirtualBox OSE distribution, in which case the provisions of the
CDDL are applicable instead of those of the GPL.
You may elect to license modified versions of this file under the
terms and conditions of either the GPL or the CDDL or both.
"""
__version__ = "$Id$"
# Standard Python imports.
import os;
import sys;
# Only the main script needs to modify the path.
try: __file__
g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
# Validation Kit imports.
from testdriver import reporter;
from testdriver import base;
from testdriver import vbox;
from testdriver import vboxcon;
""" Translate a controller type to a name. """
if eControllerType == vboxcon.StorageControllerType_PIIX3 or eControllerType == vboxcon.StorageControllerType_PIIX4:
sType = "IDE Controller";
sType = "SATA Controller";
sType = "SAS Controller";
elif eControllerType == vboxcon.StorageControllerType_LsiLogic or eControllerType == vboxcon.StorageControllerType_BusLogic:
sType = "SCSI Controller";
else:
sType = "Storage Controller";
return sType;
"""
Storage testcase.
"""
self.oGuestToGuestVM = None;
self.oGuestToGuestSess = None;
self.oGuestToGuestTxs = None;
'/run/media/alexander/CrucialSSD/alexander', \
#
# Overridden methods.
#
return rc;
iArg += 1;
if iArg >= len(asArgs): raise base.InvalidOption('The "--virt-modes" takes a colon separated list of modes');
for s in self.asVirtModes:
if s not in self.asVirtModesDef:
iArg += 1;
if iArg >= len(asArgs): raise base.InvalidOption('The "--cpu-counts" takes a colon separated list of cpu counts');
try: c = int(s);
iArg += 1;
raise base.InvalidOption('The "--storage-ctrls" takes a colon separated list of Storage controller types');
iArg += 1;
if iArg >= len(asArgs): raise base.InvalidOption('The "--disk-formats" takes a colon separated list of disk formats');
iArg += 1;
if iArg >= len(asArgs): raise base.InvalidOption('The "--disk-dirs" takes a colon separated list of directories');
iArg += 1;
iArg += 1;
if iArg >= len(asArgs): raise base.InvalidOption('The "--tests" takes a colon separated list of disk formats');
iArg += 1;
raise base.InvalidOption('The "--guest-fs" takes a colon separated list of filesystem identifiers');
iArg += 1;
if s not in self.asTestVMsDef:
iArg += 1;
if s not in self.asTestVMsDef:
else:
return iArg + 1;
def completeOptions(self):
# Remove skipped VMs from the test list.
except: pass;
def getResourceSet(self):
# Construct the resource list the first time it's queried.
def actionConfig(self):
# Some stupid trickery to guess the location of the iso. ## fixme - testsuite unzip ++
'../../VBoxValidationKitStorIo.iso'));
'../../VBoxValidationKitStorIo.iso'));
break;
break;
# Make sure vboxapi has been imported so we can use the constants.
if not self.importVBoxApi():
return False;
#
# Configure the VMs we're going to use.
#
# Linux VMs
oVM = self.createTestVM('tst-debian', 1, '4.2/storage/debian.vdi', sKind = 'Debian_64', fIoApic = True, \
if oVM is None:
return False;
return True;
def actionExecute(self):
"""
Execute the testcase.
"""
return fRc;
#
# Test execution helpers.
#
"""
Runs all the test programs on the test machine.
"""
_ = oSession;
# Prepare test disks, just create filesystem without partition
'/sbin/' + sMkfsCmd,
'/sbin/' + sMkfsCmd,
# Create test and scratch directory
# Mount test and scratch directory.
('cp', '-r','${CDROM}/${OS.ARCH}/xfstests', '/tmp'));
# Run xfstests (this sh + cd crap is required because the cwd for the script must be in the root
# of the xfstests directory...)
'FSTYP=' + sGuestFs));
else:
return fRc;
# pylint: disable=R0913
"""
Runs the specified VM thru test #1.
Returns a success indicator on the general test execution. This is not
the actual test result.
"""
# Reconfigure the VM
if oSession is not None:
# Attach HD
fRc = fRc and oSession.setStorageControllerType(eStorageController, _ControllerTypeToName(eStorageController));
if sDiskFormat == "iSCSI":
listNames = [];
listValues = [];
else:
# Attach it.
try:
else:
except:
else:
else:
fRc = fRc and oSession.createAndAttachHd(sDiskPath1, sDiskFormat, _ControllerTypeToName(eStorageController), \
fRc = fRc and oSession.createAndAttachHd(sDiskPath2, sDiskFormat, _ControllerTypeToName(eStorageController), \
oSession = None;
else:
# Start up.
oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(sVmName, fCdWait = False, fNatForwardingForTxs = True);
if oSession is not None:
# Fudge factor - Allow the guest to finish starting up.
# cleanup.
# Remove disk
if oSession is not None:
try:
# Remove storage controller if it is not an IDE controller.
oSession = None;
except:
(sDiskPath1, sDiskPath2));
else:
else:
return fRc;
"""
Runs one VM thru the various configurations.
"""
if sStorageCtrl == 'AHCI':
elif sStorageCtrl == 'IDE':
elif sStorageCtrl == 'LsiLogicSAS':
elif sStorageCtrl == 'LsiLogic':
elif sStorageCtrl == 'BusLogic':
else:
eStorageCtrl = None;
continue;
hsVirtModeDesc = {};
return fRc;
"""
Executes test #1.
"""
# Loop thru the test VMs.
# run test on the VM.
else:
return fRc;
if __name__ == '__main__':