VirtualBox

Ignore:
Timestamp:
Mar 25, 2015 1:04:20 PM (10 years ago)
Author:
vboxsync
Message:

tdTreeDepth1.py: new test for checking if VBoxSVC can deal with the maximum medium and snapshot tree depths
vboxwrappers.py: add functionality for creating base and diff disk images, and allow attaching them to a VM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testdriver/vboxwrappers.py

    r54432 r54938  
    16471647        return fRc;
    16481648
    1649     def attachHd(self, sHd, sController = "IDE Controller", iPort = 0, iDevice = 0, fImmutable = True):
     1649    def attachHd(self, sHd, sController = "IDE Controller", iPort = 0, iDevice = 0, fImmutable = True, fForceResource = True):
    16501650        """
    16511651        Attaches a HD to a VM.
     
    16531653        """
    16541654        # Input validation.
    1655         if not self.oTstDrv.isResourceFile(sHd):
     1655        if fForceResource and not self.oTstDrv.isResourceFile(sHd):
    16561656            reporter.fatal('"%s" is not in the resource set' % (sHd,));
    16571657            return None;
     
    16611661
    16621662        # Find the HD, registering it if necessary (as immutable).
    1663         sFullName = self.oTstDrv.getFullResourceName(sHd);
     1663        if fForceResource:
     1664            sFullName = self.oTstDrv.getFullResourceName(sHd);
     1665        else:
     1666            sFullName = sHd;
    16641667        try:
    16651668            oHd = self.oVBox.findHardDisk(sFullName);
     
    17031706        return fRc;
    17041707
     1708    def createBaseHd(self, sHd, sFmt = "VDI", cb = 10*1024*1024*1024):
     1709        """
     1710        Creates a base HD.
     1711        Returns Medium object on success and None on failure.  Error information is logged.
     1712        """
     1713        try:
     1714            if self.fpApiVer >= 4.4:
     1715                oHd = self.oVBox.createMedium(sFmt, sHd, vboxcon.AccessMode_ReadWrite, vboxcon.DeviceType_HardDisk);
     1716            else:
     1717                oHd = self.oVBox.createHardDisk(sFmt, sHd);
     1718            oProgressXpcom = oHd.createBaseStorage(cb, (vboxcon.MediumVariant_Standard, ))
     1719            oProgress = ProgressWrapper(oProgressXpcom, self.oVBoxMgr, self.oTstDrv, 'create base disk %s' % (sHd));
     1720            oProgress.wait();
     1721            oProgress.logResult();
     1722        except:
     1723            reporter.errorXcpt('failed to create base hd "%s"' % (sHd));
     1724            oHd = None
     1725
     1726        return oHd;
     1727
     1728    def createDiffHd(self, oParentHd, sHd, sFmt = "VDI"):
     1729        """
     1730        Creates a differencing HD.
     1731        Returns Medium object on success and None on failure.  Error information is logged.
     1732        """
     1733        try:
     1734            if self.fpApiVer >= 4.4:
     1735                oHd = self.oVBox.createMedium(sFmt, sHd, vboxcon.AccessMode_ReadWrite, vboxcon.DeviceType_HardDisk);
     1736            else:
     1737                oHd = self.oVBox.createHardDisk(sFmt, sHd);
     1738            oProgressXpcom = oParentHd.createDiffStorage(oHd, (vboxcon.MediumVariant_Standard, ))
     1739            oProgress = ProgressWrapper(oProgressXpcom, self.oVBoxMgr, self.oTstDrv, 'create diff disk %s' % (sHd));
     1740            oProgress.wait();
     1741            oProgress.logResult();
     1742        except:
     1743            reporter.errorXcpt('failed to create diff hd "%s"' % (sHd));
     1744            oHd = None
     1745
     1746        return oHd;
     1747
    17051748    def createAndAttachHd(self, sHd, sFmt = "VDI", sController = "IDE Controller", cb = 10*1024*1024*1024, \
    17061749                          iPort = 0, iDevice = 0, fImmutable = True):
     
    17121755            return False;
    17131756
    1714         try:
    1715             if self.fpApiVer >= 4.4:
    1716                 oHd = self.oVBox.createMedium(sFmt, sHd, vboxcon.AccessMode_ReadWrite, vboxcon.DeviceType_HardDisk);
    1717             else:
    1718                 oHd = self.oVBox.createHardDisk(sFmt, sHd);
    1719             oProgressXpcom = oHd.createBaseStorage(cb, (vboxcon.MediumVariant_Standard, ))
    1720             oProgress = ProgressWrapper(oProgressXpcom, self.oVBoxMgr, self.oTstDrv, 'create disk %s' % (sHd));
    1721             oProgress.wait();
    1722             oProgress.logResult();
    1723         except:
    1724             reporter.errorXcpt('failed to create hd "%s"' % (sHd));
     1757        oHd = self.createBaseHd(sHd, sFmt, cb)
     1758        if oHd is None:
    17251759            return False;
    17261760
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette