示例#1
0
    def _enable_interfaces(self, index, idx, vfs, cfg):
        vf_spoofchk = "ip link set {0} vf 0 spoofchk off"

        vf = self.networks[vfs[0]]
        vpci = PciAddress(vf['vpci'].strip())
        # Generate the vpci for the interfaces
        slot = index + idx + 10
        vf['vpci'] = \
            "{}:{}:{:02x}.{}".format(vpci.domain, vpci.bus, slot, vpci.function)
        Libvirt.add_sriov_interfaces(vf['vpci'], vf['vf_pci']['vf_pci'],
                                     vf['mac'], str(cfg))
        self.connection.execute("ifconfig %s up" % vf['interface'])
        self.connection.execute(vf_spoofchk.format(vf['interface']))
示例#2
0
 def test_add_sriov_interfaces(self, mock_et, mock_add_interface_address):
     pci_address = PciAddress.parse_address("0000:00:04.0", multi_line=True)
     result = Libvirt.add_sriov_interfaces("0000:00:05.0", "0000:00:04.0",
                                           "00:00:00:00:00:01", "xml")
     self.assertIsNone(result)