# -*- coding: utf-8 -*-
# $Id$
"""
VirtualBox Validation Kit - Storage snapshotting and merging testcase.
"""
__copyright__ = \
"""
Copyright (C) 2013 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.
"""
# Standard Python imports.
import os;
import sys;
import uuid;
# 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.
""" 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 benchmark.
"""
self.oGuestToGuestVM = None;
self.oGuestToGuestSess = None;
self.oGuestToGuestTxs = None;
#
# Overridden methods.
#
return rc;
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 s not in self.asTestVMsDef:
iArg += 1;
if s not in self.asTestVMsDef:
else:
return iArg + 1;
# Remove skipped VMs from the test list.
except: pass;
# Construct the resource list the first time it's queried.
# 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.
#
# Windows VMs
oVM = self.createTestVM('tst-win7-vhd', 1, '4.2/storage/win7.vhd', sKind = 'Windows7', fIoApic = True, \
if oVM is None:
return False;
# Linux VMs
oVM = self.createTestVM('tst-debian-vhd', 1, '4.2/storage/debian.vhd', sKind = 'Debian_64', fIoApic = True, \
if oVM is None:
return False;
oVM = self.createTestVM('tst-debian-vdi', 1, '4.2/storage/debian.vdi', sKind = 'Debian_64', fIoApic = True, \
if oVM is None:
return False;
return True;
"""
Execute the testcase.
"""
return fRc;
#
# Test execution helpers.
#
"""
Uploads a test file to the test machine.
"""
fRc = self.txsUploadString(oSession, oTxsSession, self.sRndData, '${SCRATCH}/' + str(uuid.uuid4()), \
return fRc;
"""
Runs the specified VM thru test #1.
Returns a success indicator on the general test execution. This is not
the actual test result.
"""
# @ŧodo: Implement support for different formats.
_ = sDiskFormat;
# Reconfigure the VM
if oSession is not None:
# Attach HD
fRc = fRc and oSession.setStorageControllerType(eStorageController, _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.
# Do a snapshot first.
# cleanup.
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;
return fRc;
"""
Executes test #1.
"""
# Loop thru the test VMs.
# run test on the VM.
else:
return fRc;
if __name__ == '__main__':