def min_tx_rate_support(): device_mappings = helpers.parse_mappings( cfg.CONF.SRIOV_NIC.physical_device_mappings, unique_keys=False) devices_to_test = set() for devices_in_physnet in device_mappings.values(): for device in devices_in_physnet: devices_to_test.add(device) # NOTE(ralonsoh): the VF used by default is 0. Each SR-IOV configured # NIC should have configured at least 1 VF. VF_NUM = 0 devices_without_support = set() for device in devices_to_test: try: ip_link = ip_lib.IpLinkCommand(device) # NOTE(ralonsoh): to set min_tx_rate, first is needed to set # max_tx_rate and max_tx_rate >= min_tx_rate. vf_config = {'vf': VF_NUM, 'rate': {'min_tx_rate': int(400), 'max_tx_rate': int(500)}} ip_link.set_vf_feature(vf_config) vf_config = {'vf': VF_NUM, 'rate': {'min_tx_rate': 0, 'max_tx_rate': 0}} ip_link.set_vf_feature(vf_config) except ip_lib.InvalidArgument: devices_without_support.add(device) if devices_without_support: LOG.debug('The following NICs do not support "min_tx_rate": %s', devices_without_support) return False return True
def setUp(self): super(TestIpLinkCommand, self).setUp() self.parent._run.return_value = LINK_SAMPLE[1] self.command = 'link' self.link_cmd = ip_lib.IpLinkCommand(self.parent)