cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync#!/usr/bin/env python
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# -*- coding: utf-8 -*-
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync"""
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncStorage testcase using xfstests.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync"""
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync__copyright__ = \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync"""
1c43cacd545be15afb64413d49eccbecff95e759vboxsyncCopyright (C) 2012-2015 Oracle Corporation
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncThis file is part of VirtualBox Open Source Edition (OSE), as
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncavailable from http://www.virtualbox.org. This file is free software;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncyou can redistribute it and/or modify it under the terms of the GNU
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncGeneral Public License (GPL) as published by the Free Software
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncFoundation, in version 2 as it comes in the "COPYING" file of the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncVirtualBox OSE distribution. VirtualBox OSE is distributed in the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsynchope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncThe contents of this file may alternatively be used under the terms
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncof the Common Development and Distribution License Version 1.0
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync(CDDL) only, as it comes in the "COPYING.CDDL" file of the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncVirtualBox OSE distribution, in which case the provisions of the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncCDDL are applicable instead of those of the GPL.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncYou may elect to license modified versions of this file under the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncterms and conditions of either the GPL or the CDDL or both.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync"""
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync__version__ = "$Id$"
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# Standard Python imports.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport os;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport sys;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# Only the main script needs to modify the path.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsynctry: __file__
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncexcept: __file__ = sys.argv[0];
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncg_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncsys.path.append(g_ksValidationKitDir);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# Validation Kit imports.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncfrom testdriver import reporter;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncfrom testdriver import base;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncfrom testdriver import vbox;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncfrom testdriver import vboxcon;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncdef _ControllerTypeToName(eControllerType):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync """ Translate a controller type to a name. """
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if eControllerType == vboxcon.StorageControllerType_PIIX3 or eControllerType == vboxcon.StorageControllerType_PIIX4:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sType = "IDE Controller";
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync elif eControllerType == vboxcon.StorageControllerType_IntelAhci:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sType = "SATA Controller";
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync elif eControllerType == vboxcon.StorageControllerType_LsiLogicSas:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sType = "SAS Controller";
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync elif eControllerType == vboxcon.StorageControllerType_LsiLogic or eControllerType == vboxcon.StorageControllerType_BusLogic:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sType = "SCSI Controller";
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync else:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sType = "Storage Controller";
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return sType;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncclass tdStorageStress(vbox.TestDriver): # pylint: disable=R0902
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync """
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Storage testcase.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync """
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def __init__(self):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync vbox.TestDriver.__init__(self);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asRsrcs = None;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.oGuestToGuestVM = None;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.oGuestToGuestSess = None;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.oGuestToGuestTxs = None;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asTestVMsDef = ['tst-debian'];
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asTestVMs = self.asTestVMsDef;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asSkipVMs = [];
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asVirtModesDef = ['hwvirt', 'hwvirt-np', 'raw',]
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asVirtModes = self.asVirtModesDef
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.acCpusDef = [1, 2,]
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.acCpus = self.acCpusDef;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asStorageCtrlsDef = ['AHCI', 'IDE', 'LsiLogicSAS', 'LsiLogic', 'BusLogic'];
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asStorageCtrls = self.asStorageCtrlsDef;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asDiskFormatsDef = ['VDI', 'VMDK', 'VHD', 'QED', 'Parallels', 'QCOW'];
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asDiskFormats = self.asDiskFormatsDef;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asTestsDef = ['xfstests'];
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asTests = self.asTestsDef;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asGuestFs = ['xfs', 'ext4', 'btrfs'];
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asGuestFsDef = self.asGuestFs;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asIscsiTargetsDef = ['aurora|iqn.2011-03.home.aurora:aurora.storagebench|1'];
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asIscsiTargets = self.asIscsiTargetsDef;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asDirsDef = ['/run/media/alexander/OWCSSD/alexander', \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync '/run/media/alexander/CrucialSSD/alexander', \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync '/run/media/alexander/HardDisk/alexander', \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync '/home/alexander'];
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asDirs = self.asDirsDef;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync #
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Overridden methods.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync #
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def showUsage(self):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync rc = vbox.TestDriver.showUsage(self);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log('');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log('tdStorageBenchmark1 Options:');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' --virt-modes <m1[:m2[:]]');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' Default: %s' % (':'.join(self.asVirtModesDef)));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' --cpu-counts <c1[:c2[:]]');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' Default: %s' % (':'.join(str(c) for c in self.acCpusDef)));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' --storage-ctrls <type1[:type2[:...]]>');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' Default: %s' % (':'.join(self.asStorageCtrls)));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' --disk-formats <type1[:type2[:...]]>');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' Default: %s' % (':'.join(self.asDiskFormats)));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' --disk-dirs <path1[:path2[:...]]>');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' Default: %s' % (':'.join(self.asDirs)));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' --iscsi-targets <target1[:target2[:...]]>');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' Default: %s' % (':'.join(self.asIscsiTargets)));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' --tests <test1[:test2[:...]]>');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' Default: %s' % (':'.join(self.asTests)));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' --guest-fs <fs1[:fs2[:...]]>');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' Default: %s' % (':'.join(self.asGuestFs)));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' --test-vms <vm1[:vm2[:...]]>');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' Test the specified VMs in the given order. Use this to change');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' the execution order or limit the choice of VMs');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' Default: %s (all)' % (':'.join(self.asTestVMsDef)));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' --skip-vms <vm1[:vm2[:...]]>');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' Skip the specified VMs when testing.');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return rc;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def parseOption(self, asArgs, iArg): # pylint: disable=R0912,R0915
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if asArgs[iArg] == '--virt-modes':
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync iArg += 1;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if iArg >= len(asArgs): raise base.InvalidOption('The "--virt-modes" takes a colon separated list of modes');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asVirtModes = asArgs[iArg].split(':');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync for s in self.asVirtModes:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if s not in self.asVirtModesDef:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync % (s, ' '.join(self.asVirtModesDef)));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync elif asArgs[iArg] == '--cpu-counts':
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync iArg += 1;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if iArg >= len(asArgs): raise base.InvalidOption('The "--cpu-counts" takes a colon separated list of cpu counts');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.acCpus = [];
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync for s in asArgs[iArg].split(':'):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync try: c = int(s);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync except: raise base.InvalidOption('The "--cpu-counts" value "%s" is not an integer' % (s,));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if c <= 0: raise base.InvalidOption('The "--cpu-counts" value "%s" is zero or negative' % (s,));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.acCpus.append(c);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync elif asArgs[iArg] == '--storage-ctrls':
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync iArg += 1;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if iArg >= len(asArgs):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync raise base.InvalidOption('The "--storage-ctrls" takes a colon separated list of Storage controller types');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asStorageCtrls = asArgs[iArg].split(':');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync elif asArgs[iArg] == '--disk-formats':
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync iArg += 1;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if iArg >= len(asArgs): raise base.InvalidOption('The "--disk-formats" takes a colon separated list of disk formats');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asDiskFormats = asArgs[iArg].split(':');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync elif asArgs[iArg] == '--disk-dirs':
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync iArg += 1;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if iArg >= len(asArgs): raise base.InvalidOption('The "--disk-dirs" takes a colon separated list of directories');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asDirs = asArgs[iArg].split(':');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync elif asArgs[iArg] == '--iscsi-targets':
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync iArg += 1;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if iArg >= len(asArgs):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync raise base.InvalidOption('The "--iscsi-targets" takes a colon separated list of iscsi targets');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asIscsiTargets = asArgs[iArg].split(':');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync elif asArgs[iArg] == '--tests':
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync iArg += 1;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if iArg >= len(asArgs): raise base.InvalidOption('The "--tests" takes a colon separated list of disk formats');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asTests = asArgs[iArg].split(':');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync elif asArgs[iArg] == '--guest-fs':
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync iArg += 1;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if iArg >= len(asArgs):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync raise base.InvalidOption('The "--guest-fs" takes a colon separated list of filesystem identifiers');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asGuestFs = asArgs[iArg].split(':');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync elif asArgs[iArg] == '--test-vms':
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync iArg += 1;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if iArg >= len(asArgs): raise base.InvalidOption('The "--test-vms" takes colon separated list');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asTestVMs = asArgs[iArg].split(':');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync for s in self.asTestVMs:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if s not in self.asTestVMsDef:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync raise base.InvalidOption('The "--test-vms" value "%s" is not valid; valid values are: %s' \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync % (s, ' '.join(self.asTestVMsDef)));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync elif asArgs[iArg] == '--skip-vms':
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync iArg += 1;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if iArg >= len(asArgs): raise base.InvalidOption('The "--skip-vms" takes colon separated list');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asSkipVMs = asArgs[iArg].split(':');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync for s in self.asSkipVMs:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if s not in self.asTestVMsDef:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log('warning: The "--test-vms" value "%s" does not specify any of our test VMs.' % (s));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync else:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return vbox.TestDriver.parseOption(self, asArgs, iArg);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return iArg + 1;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def completeOptions(self):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Remove skipped VMs from the test list.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync for sVM in self.asSkipVMs:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync try: self.asTestVMs.remove(sVM);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync except: pass;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return vbox.TestDriver.completeOptions(self);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def getResourceSet(self):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Construct the resource list the first time it's queried.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if self.asRsrcs is None:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asRsrcs = [];
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if 'tst-debian' in self.asTestVMs:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asRsrcs.append('4.2/storage/debian.vdi');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return self.asRsrcs;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def actionConfig(self):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Some stupid trickery to guess the location of the iso. ## fixme - testsuite unzip ++
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sVBoxValidationKit_iso = os.path.abspath(os.path.join(os.path.dirname(__file__),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync '../../VBoxValidationKitStorIo.iso'));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if not os.path.isfile(sVBoxValidationKit_iso):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sVBoxValidationKit_iso = os.path.abspath(os.path.join(os.path.dirname(__file__),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync '../../VBoxValidationKitStorIo.iso'));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if not os.path.isfile(sVBoxValidationKit_iso):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sVBoxValidationKit_iso = '/mnt/ramdisk/vbox/svn/trunk/validationkit/VBoxValidationKitStorIo.iso';
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if not os.path.isfile(sVBoxValidationKit_iso):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sVBoxValidationKit_iso = '/mnt/ramdisk/vbox/svn/trunk/testsuite/VBoxTestSuiteStorIo.iso';
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if not os.path.isfile(sVBoxValidationKit_iso):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sCur = os.getcwd();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync for i in range(0, 10):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sVBoxValidationKit_iso = os.path.join(sCur, 'validationkit/VBoxValidationKitStorIo.iso');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if os.path.isfile(sVBoxValidationKit_iso):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync break;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sVBoxValidationKit_iso = os.path.join(sCur, 'testsuite/VBoxTestSuiteStorIo.iso');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if os.path.isfile(sVBoxValidationKit_iso):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync break;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sCur = os.path.abspath(os.path.join(sCur, '..'));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if i is None: pass; # shut up pychecker/pylint.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if not os.path.isfile(sVBoxValidationKit_iso):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sVBoxValidationKit_iso = '/mnt/VirtualBox/VBoxValidationKitStorIo.iso';
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if not os.path.isfile(sVBoxValidationKit_iso):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sVBoxValidationKit_iso = '/mnt/VirtualBox/VBoxTestSuiteStorIo.iso';
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Make sure vboxapi has been imported so we can use the constants.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if not self.importVBoxApi():
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return False;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync #
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Configure the VMs we're going to use.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync #
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Linux VMs
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if 'tst-debian' in self.asTestVMs:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oVM = self.createTestVM('tst-debian', 1, '4.2/storage/debian.vdi', sKind = 'Debian_64', fIoApic = True, \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync eNic0AttachType = vboxcon.NetworkAttachmentType_NAT, \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync eNic0Type = vboxcon.NetworkAdapterType_Am79C973, \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sDvdImage = sVBoxValidationKit_iso);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if oVM is None:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return False;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return True;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def actionExecute(self):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync """
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Execute the testcase.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync """
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = self.test1();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return fRc;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync #
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Test execution helpers.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync #
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def test1RunTestProgs(self, oSession, oTxsSession, fRc, sTestName, sGuestFs):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync """
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Runs all the test programs on the test machine.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync """
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync _ = oSession;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testStart(sTestName);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sMkfsCmd = 'mkfs.' + sGuestFs;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Prepare test disks, just create filesystem without partition
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testStart('Preparation');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = fRc and self.txsRunTest(oTxsSession, 'Create FS 1', 60000, \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync '/sbin/' + sMkfsCmd,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync (sMkfsCmd, '/dev/sdb'));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = fRc and self.txsRunTest(oTxsSession, 'Create FS 2', 60000, \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync '/sbin/' + sMkfsCmd,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync (sMkfsCmd, '/dev/sdc'));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Create test and scratch directory
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = fRc and self.txsRunTest(oTxsSession, 'Create /mnt/test', 10000, \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync '/bin/mkdir',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ('mkdir', '/mnt/test'));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = fRc and self.txsRunTest(oTxsSession, 'Create /mnt/scratch', 10000, \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync '/bin/mkdir',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ('mkdir', '/mnt/scratch'));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Mount test and scratch directory.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = fRc and self.txsRunTest(oTxsSession, 'Mount /mnt/test', 10000, \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync '/bin/mount',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ('mount', '/dev/sdb','/mnt/test'));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = fRc and self.txsRunTest(oTxsSession, 'Mount /mnt/scratch', 10000, \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync '/bin/mount',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ('mount', '/dev/sdc','/mnt/scratch'));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = fRc and self.txsRunTest(oTxsSession, 'Copying xfstests', 10000, \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync '/bin/cp',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ('cp', '-r','${CDROM}/${OS.ARCH}/xfstests', '/tmp'));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testDone();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Run xfstests (this sh + cd crap is required because the cwd for the script must be in the root
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # of the xfstests directory...)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testStart('xfstests');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if fRc and 'xfstests' in self.asTests:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = self.txsRunTest(oTxsSession, 'xfstests', 3600000, \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync '/bin/sh',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ('sh', '-c', '(cd /tmp/xfstests && ./check -g auto)'), \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ('TEST_DIR=/mnt/test', 'TEST_DEV=/dev/sdb', 'SCRATCH_MNT=/mnt/scratch', 'SCRATCH_DEV=/dev/sdc', \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync 'FSTYP=' + sGuestFs));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testDone();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync else:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testDone(fSkipped = True);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testDone(not fRc);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return fRc;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # pylint: disable=R0913
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def test1OneCfg(self, sVmName, eStorageController, sDiskFormat, sDiskPath1, sDiskPath2, \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sGuestFs, cCpus, fHwVirt, fNestedPaging):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync """
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Runs the specified VM thru test #1.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Returns a success indicator on the general test execution. This is not
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync the actual test result.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync """
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oVM = self.getVmByName(sVmName);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Reconfigure the VM
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = True;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oSession = self.openSession(oVM);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if oSession is not None:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Attach HD
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = oSession.ensureControllerAttached(_ControllerTypeToName(eStorageController));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = fRc and oSession.setStorageControllerType(eStorageController, _ControllerTypeToName(eStorageController));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if sDiskFormat == "iSCSI":
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync listNames = [];
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync listValues = [];
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync listValues = sDiskPath1.split('|');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync listNames.append('TargetAddress');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync listNames.append('TargetName');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync listNames.append('LUN');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
580e040eb04ce04ec23c4a2a32ee89445bedcc21vboxsync if self.fpApiVer >= 5.0:
e82aaaf270b32b83fee099582f58a99e4cb8d411vboxsync oHd = oSession.oVBox.createMedium(sDiskFormat, sDiskPath1, vboxcon.AccessMode_ReadWrite, \
0d9a76629aa83c707e766682193318511762592avboxsync vboxcon.DeviceType_HardDisk);
1c43cacd545be15afb64413d49eccbecff95e759vboxsync else:
1c43cacd545be15afb64413d49eccbecff95e759vboxsync oHd = oSession.oVBox.createHardDisk(sDiskFormat, sDiskPath1);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oHd.type = vboxcon.MediumType_Normal;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oHd.setProperties(listNames, listValues);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Attach it.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if fRc is True:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync try:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if oSession.fpApiVer >= 4.0:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oSession.o.machine.attachDevice(_ControllerTypeToName(eStorageController), \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync 1, 0, vboxcon.DeviceType_HardDisk, oHd);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync else:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oSession.o.machine.attachDevice(_ControllerTypeToName(eStorageController), \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync 1, 0, vboxcon.DeviceType_HardDisk, oHd.id);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync except:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.errorXcpt('attachDevice("%s",%s,%s,HardDisk,"%s") failed on "%s"' \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync % (_ControllerTypeToName(eStorageController), 1, 0, oHd.id, oSession.sName) );
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = False;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync else:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log('attached "%s" to %s' % (sDiskPath1, oSession.sName));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync else:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = fRc and oSession.createAndAttachHd(sDiskPath1, sDiskFormat, _ControllerTypeToName(eStorageController), \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync cb = 10*1024*1024*1024, iPort = 1, fImmutable = False);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = fRc and oSession.createAndAttachHd(sDiskPath2, sDiskFormat, _ControllerTypeToName(eStorageController), \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync cb = 10*1024*1024*1024, iPort = 2, fImmutable = False);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = fRc and oSession.enableVirtEx(fHwVirt);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = fRc and oSession.enableNestedPaging(fNestedPaging);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = fRc and oSession.setCpuCount(cCpus);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = fRc and oSession.saveSettings();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = oSession.close() and fRc and True; # pychecker hack.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oSession = None;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync else:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = False;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Start up.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if fRc is True:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.logVmInfo(oVM);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(sVmName, fCdWait = False, fNatForwardingForTxs = True);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if oSession is not None:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.addTask(oSession);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Fudge factor - Allow the guest to finish starting up.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.sleep(5);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = self.test1RunTestProgs(oSession, oTxsSession, fRc, 'stress testing', sGuestFs);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # cleanup.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.removeTask(oTxsSession);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.terminateVmBySession(oSession)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Remove disk
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oSession = self.openSession(oVM);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if oSession is not None:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync try:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oSession.o.machine.detachDevice(_ControllerTypeToName(eStorageController), 1, 0);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oSession.o.machine.detachDevice(_ControllerTypeToName(eStorageController), 2, 0);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Remove storage controller if it is not an IDE controller.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if eStorageController is not vboxcon.StorageControllerType_PIIX3 \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync and eStorageController is not vboxcon.StorageControllerType_PIIX4:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oSession.o.machine.removeStorageController(_ControllerTypeToName(eStorageController));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oSession.saveSettings();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oSession.oVBox.deleteHdByLocation(sDiskPath1);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oSession.oVBox.deleteHdByLocation(sDiskPath2);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oSession.saveSettings();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oSession.close();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oSession = None;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync except:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.errorXcpt('failed to detach/delete disks %s and %s from storage controller' % \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync (sDiskPath1, sDiskPath2));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync else:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = False;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync else:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = False;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return fRc;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def test1OneVM(self, sVmName):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync """
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Runs one VM thru the various configurations.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync """
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testStart(sVmName);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = True;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync for sStorageCtrl in self.asStorageCtrls:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testStart(sStorageCtrl);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if sStorageCtrl == 'AHCI':
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync eStorageCtrl = vboxcon.StorageControllerType_IntelAhci;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync elif sStorageCtrl == 'IDE':
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync eStorageCtrl = vboxcon.StorageControllerType_PIIX4;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync elif sStorageCtrl == 'LsiLogicSAS':
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync eStorageCtrl = vboxcon.StorageControllerType_LsiLogicSas;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync elif sStorageCtrl == 'LsiLogic':
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync eStorageCtrl = vboxcon.StorageControllerType_LsiLogic;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync elif sStorageCtrl == 'BusLogic':
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync eStorageCtrl = vboxcon.StorageControllerType_BusLogic;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync else:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync eStorageCtrl = None;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync for sDiskFormat in self.asDiskFormats:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testStart('%s' % (sDiskFormat,));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync asPaths = self.asDirs;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync for sDir in asPaths:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testStart('%s' % (sDir,));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sPathDisk1 = sDir + "/disk1.disk";
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sPathDisk2 = sDir + "/disk2.disk";
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync for sGuestFs in self.asGuestFs:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testStart('%s' % (sGuestFs,));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync for cCpus in self.acCpus:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if cCpus == 1: reporter.testStart('1 cpu');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync else: reporter.testStart('%u cpus' % (cCpus,));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync for sVirtMode in self.asVirtModes:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if sVirtMode == 'raw' and cCpus > 1:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync continue;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync hsVirtModeDesc = {};
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync hsVirtModeDesc['raw'] = 'Raw-mode';
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync hsVirtModeDesc['hwvirt'] = 'HwVirt';
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync hsVirtModeDesc['hwvirt-np'] = 'NestedPaging';
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testStart(hsVirtModeDesc[sVirtMode]);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fHwVirt = sVirtMode != 'raw';
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fNestedPaging = sVirtMode == 'hwvirt-np';
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = self.test1OneCfg(sVmName, eStorageCtrl, sDiskFormat, sPathDisk1, sPathDisk2, \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sGuestFs, cCpus, fHwVirt, fNestedPaging) and fRc and True;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testDone();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testDone();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testDone();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testDone();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testDone();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testDone();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testDone();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return fRc;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def test1(self):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync """
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Executes test #1.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync """
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Loop thru the test VMs.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync for sVM in self.asTestVMs:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # run test on the VM.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if not self.test1OneVM(sVM):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = False;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync else:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = True;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return fRc;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncif __name__ == '__main__':
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sys.exit(tdStorageStress().main(sys.argv));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync