Changeset 54938 in vbox for trunk/src/VBox/ValidationKit/testdriver
- Timestamp:
- Mar 25, 2015 1:04:20 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testdriver/vboxwrappers.py
r54432 r54938 1647 1647 return fRc; 1648 1648 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): 1650 1650 """ 1651 1651 Attaches a HD to a VM. … … 1653 1653 """ 1654 1654 # Input validation. 1655 if not self.oTstDrv.isResourceFile(sHd):1655 if fForceResource and not self.oTstDrv.isResourceFile(sHd): 1656 1656 reporter.fatal('"%s" is not in the resource set' % (sHd,)); 1657 1657 return None; … … 1661 1661 1662 1662 # 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; 1664 1667 try: 1665 1668 oHd = self.oVBox.findHardDisk(sFullName); … … 1703 1706 return fRc; 1704 1707 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 1705 1748 def createAndAttachHd(self, sHd, sFmt = "VDI", sController = "IDE Controller", cb = 10*1024*1024*1024, \ 1706 1749 iPort = 0, iDevice = 0, fImmutable = True): … … 1712 1755 return False; 1713 1756 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: 1725 1759 return False; 1726 1760
Note:
See TracChangeset
for help on using the changeset viewer.