- Timestamp:
- Nov 5, 2021 3:24:36 PM (3 years ago)
- Location:
- trunk/src/VBox/ValidationKit/testdriver
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testdriver/vbox.py
r92238 r92241 3072 3072 for iSlot in range(0, self.oVBox.systemProperties.getMaxNetworkAdapters(oVM.chipsetType)): 3073 3073 try: 3074 oNic = oVM.getNetworkAdapter(iSlot); 3075 if not oNic.enabled: 3076 continue; 3077 sAdpName = self.getNetworkAdapterNameFromType(oNic); 3078 if oNic.attachmentType == vboxcon.NetworkAttachmentType_NAT: 3079 reporter.log2('Enabling "LocalhostReachable" (NAT) for network adapter "%s" in slot %d' % \ 3080 (sAdpName, iSlot)); 3081 oNatEngine = oNic.NATEngine; 3082 oNatEngine.LocalhostReachable = True; 3083 else: 3084 # Other attachments will fail if 'LocalhostReachable' extra data override is present 3085 ## @todo r=andy Is this still needed, as we now have the API (see above) in place? 3086 sKey = 'VBoxInternal/Devices/%s/%d/LUN#0/Config/LocalhostReachable' % (sAdpName, iSlot); 3087 reporter.log2('Disabling "LocalhostReachable" (NAT) for network adapter "%s" in slot %d (key: %s)' % \ 3088 (sAdpName, iSlot, sKey)); 3089 self.oVBox.setExtraData(sKey, ''); 3074 oWrapped.setNicLocalhostReachable(True, iSlot); 3090 3075 except: 3091 3076 reporter.logXcpt(); -
trunk/src/VBox/ValidationKit/testdriver/vboxwrappers.py
r92141 r92241 1617 1617 return True; 1618 1618 1619 def setNicLocalhostReachable(self, fReachable, iNic = 0): 1620 """ 1621 Sets whether the specified NIC can reach the host or not. 1622 Only affects (enabled) NICs configured to NAT at the moment. 1623 1624 Returns True on success and False on failure. Error information is logged. 1625 """ 1626 try: 1627 oNic = self.o.machine.getNetworkAdapter(iNic); 1628 except: 1629 return reporter.errorXcpt('getNetworkAdapter(%s) failed for "%s"' % (iNic, self.sName,)); 1630 1631 try: 1632 if not oNic.enabled: # NIC not enabled? Nothing to do here. 1633 return True; 1634 except: 1635 return reporter.errorXcpt('NIC enabled status (%s) failed for "%s"' % (iNic, self.sName,)); 1636 1637 try: 1638 sAdpName = self.oTstDrv.getNetworkAdapterNameFromType(oNic); 1639 ## @todo Remove this check once we have more attachment types that support this. 1640 if oNic.attachmentType != vboxcon.NetworkAttachmentType_NAT: 1641 # Other attachments will fail if 'LocalhostReachable' extra data override is present 1642 ## @todo r=andy Is this still needed, as we now have the API (see above) in place? 1643 sKey = 'VBoxInternal/Devices/%s/%d/LUN#0/Config/LocalhostReachable' % (sAdpName, iSlot); 1644 reporter.log2('Disabling "LocalhostReachable" (NAT) for network adapter "%s" in slot %d (key: %s)' % \ 1645 (sAdpName, iSlot, sKey)); 1646 self.setExtraData(sKey, ''); 1647 return True; 1648 except: 1649 return reporter.errorXcpt('NIC adapter type failed for "%s"' % (iNic, self.sName,)); 1650 1651 reporter.log('Setting "LocalhostReachable" for network adapter "%s" in slot %d to %s' % (sAdpName, iNic, fReachable)); 1652 1653 try: 1654 oNatEngine = oNic.NATEngine; 1655 except: 1656 return reporter.errorXcpt('Getting NIC NAT engine failed for "%s"' % (iNic, self.sName,)); 1657 1658 try: 1659 oNatEngine.LocalhostReachable = fReachable; 1660 except: 1661 return reporter.errorXcpt('LocalhostReachable failed for "%s"' % (iNic, self.sName,)); 1662 1663 return True; 1664 1619 1665 def setNicMacAddress(self, sMacAddr, iNic = 0): 1620 1666 """
Note:
See TracChangeset
for help on using the changeset viewer.