VirtualBox

Changeset 70658 in vbox for trunk/src/VBox/ValidationKit


Ignore:
Timestamp:
Jan 20, 2018 7:24:37 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
120394
Message:

ValidationKit/vboxtestvms.py: Moved the VM creation to the TestVm class.

File:
1 edited

Legend:

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

    r70657 r70658  
    350350        return asRet;
    351351
     352    def createVm(self, oTestDrv, eNic0AttachType = None, sDvdImage = None):
     353        """
     354        Creates the VM with defaults and the few tweaks as per the arguments.
     355
     356        Returns same as vbox.TestDriver.createTestVM.
     357        """
     358        if sDvdImage is not None:
     359            sMyDvdImage = sDvdImage;
     360        else:
     361            sMyDvdImage = self.sDvdImage;
     362
     363        if eNic0AttachType is not None:
     364            eMyNic0AttachType = eNic0AttachType;
     365        elif self.sNic0AttachType is None:
     366            eMyNic0AttachType = None;
     367        elif self.sNic0AttachType == 'nat':
     368            eMyNic0AttachType = vboxcon.NetworkAttachmentType_NAT;
     369        elif self.sNic0AttachType == 'bridged':
     370            eMyNic0AttachType = vboxcon.NetworkAttachmentType_Bridged;
     371        else:
     372            assert False, self.sNic0AttachType;
     373
     374        return self.createVmInner(oTestDrv, eMyNic0AttachType, sMyDvdImage);
     375
     376    def createVmInner(self, oTestDrv, eNic0AttachType, sDvdImage):
     377        """
     378        Same as createVm but parameters resolved.
     379
     380        Returns same as vbox.TestDriver.createTestVM.
     381        """
     382        reporter.log2('');
     383        reporter.log2('Calling createTestVM on %s...' % (self.sVmName,))
     384        return oTestDrv.createTestVM(self.sVmName,
     385                                     1,                 # iGroup
     386                                     sHd                = self.sHd,
     387                                     sKind              = self.sKind,
     388                                     fIoApic            = self.fIoApic,
     389                                     fPae               = self.fPae,
     390                                     eNic0AttachType    = eNic0AttachType,
     391                                     sDvdImage          = sDvdImage,
     392                                     sDvdControllerType = self.sDvdControllerType,
     393                                     sHddControllerType = self.sHddControllerType,
     394                                     sFloppy            = self.sFloppy,
     395                                     fVmmDevTestingPart = self.fVmmDevTestingPart,
     396                                     fVmmDevTestingMmio = self.fVmmDevTestingPart,
     397                                     sFirmwareType      = self.sFirmwareType,
     398                                     sChipsetType       = self.sChipsetType);
     399
    352400    def getReconfiguredVm(self, oTestDrv, cCpus, sVirtMode, sParavirtMode = None):
    353401        """
     
    810858                oVM = oTestDrv.addTestMachine(oTestVm.sVmName);
    811859            else:
    812                 ## @todo This could possibly be moved to the TestVM object.
    813                 if sDvdImage is not None:
    814                     sMyDvdImage = sDvdImage;
    815                 else:
    816                     sMyDvdImage = oTestVm.sDvdImage;
    817 
    818                 if eNic0AttachType is not None:
    819                     eMyNic0AttachType = eNic0AttachType;
    820                 elif oTestVm.sNic0AttachType is None:
    821                     eMyNic0AttachType = None;
    822                 elif oTestVm.sNic0AttachType == 'nat':
    823                     eMyNic0AttachType = vboxcon.NetworkAttachmentType_NAT;
    824                 elif oTestVm.sNic0AttachType == 'bridged':
    825                     eMyNic0AttachType = vboxcon.NetworkAttachmentType_Bridged;
    826                 else:
    827                     assert False, oTestVm.sNic0AttachType;
    828 
    829                 oVM = oTestDrv.createTestVM(oTestVm.sVmName, 1,
    830                                             sHd                = oTestVm.sHd,
    831                                             sKind              = oTestVm.sKind,
    832                                             fIoApic            = oTestVm.fIoApic,
    833                                             fPae               = oTestVm.fPae,
    834                                             eNic0AttachType    = eMyNic0AttachType,
    835                                             sDvdImage          = sMyDvdImage,
    836                                             sDvdControllerType = oTestVm.sDvdControllerType,
    837                                             sHddControllerType = oTestVm.sHddControllerType,
    838                                             sFloppy            = oTestVm.sFloppy,
    839                                             fVmmDevTestingPart = oTestVm.fVmmDevTestingPart,
    840                                             fVmmDevTestingMmio = oTestVm.fVmmDevTestingPart,
    841                                             sFirmwareType      = oTestVm.sFirmwareType,
    842                                             sChipsetType       = oTestVm.sChipsetType);
     860                oVM = oTestVm.createVm(oTestDrv, eNic0AttachType, sDvdImage);
    843861            if oVM is None:
    844862                return False;
Note: See TracChangeset for help on using the changeset viewer.

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