mirror of
https://github.com/OpenNebula/one.git
synced 2026-12-03 21:52:31 +09:00
F #5940: Improve PCI Passthrough and SRIOV support
- SHORT_ADDRESS can be used to select specific devices (useful on
homogenous clusters or nic attach operations). This name has been
selected because of:
1. It is the attrbute shown host info
2. It does not collide with the reserved ADDRESS attribute
- New test and add functions that considers both allocation methods: by
name (VENDOR/CLASS/DEVICE) or address (SHORT_ADDRESS)
- Parameter check on VM creation
- revert and add method use the same pci_attribute function to add info
to the VM PCI attribute
- Remove well-known attributes when parsing PCI devices (ADDRESS,
PREV_ADDRES, BUS, FUNCTION, SLOT, NUMA_NODE, UUID)
- Support for attach and detach NIC with PCI attributes
* onevm_exec.rb looks for PCI devices for ATTACH=YES when attaching/detaching an interface
* script action are now written in Ruby
* KVM module with common actions (hostdev/interface device str)
* Minor changes in xmlparser and OpenNebulaVM classes
- PCI selection options to onevm nic-attach:
* pci short_address
* pci_device device ID
* pci_vendor vendor ID
* pci_class class ID
- VF can be configured by setting some parameters through IP link (e.g.
MAC or VLAN_ID). This commit includes a mixin to activate_vf
* one_vmm_exec.rb looks for PCI VN_MAD drivers
* VM class (VNM) adds a @pcis array
* activate_vf should be called in the pre stage. The following drivers
acticate VFs (VLAN_ID is implemented as 802.1Q tag)
- 802.1Q
- bridge
- fw
- ovswitch
* Supported attributes for VF:
- MAC
- VLAN_ID
- spoof checking (SPOOFCHK)
- trust (TRUST)
- Predictable PCI addresses for guests is only enabled if PCI bus 1
is present (PCI bridge bus cannot be hotplugged)
- Improve integration with Libvirt/QEMU:
* When attach, only activate the VF being attached
* Attach: Use <interface> and not <hostdev> for VF. There seems to be a race
condition between accessing the vfio device and permission setup.
* Attach: Remove address on attach as it may fail beacuse PCI controller
is not present, e.g.:
ATTACHNIC: Could not attach NIC to 28534240: error: Failed to attach device
from /dev/fd/63 error: XML error: Invalid PCI address 0000:01:01.0.
Only PCI buses up to 0 are available ExitCode: 1
* Detach: Detach always use <hostdev> as libvirt fails to identified the
device just by address when using <interface>
- Suntone Support: The "Hardware" profile of a network interface (NIC) of a VM can be of three types, now exposed in Sunstone:
* "Emulated" it includes the hardware model emulated by Qemu
* "PCI - Automatic" oned hw scheduler will pick the best PCI device for the NIC
* "PCI - Manual" user can specify the PCI device by its short-address as shown in host information
This commits also enables the attach/detach operations on PCI based NICs in Suntone. *Note*: only for KVM VMs
(reverts commit aafd5f3014)
(reverts commit 671ef0b2d91aba00b1e6c63e19c4a50c3af20f6f)
This commit is contained in:
12 files changed
+100
-30
No files matched your search
@@ -3413,7 +3413,7 @@ int VirtualMachine::set_up_attach_nic(VirtualMachineTemplate * tmpl, string& err
|
||||
if ( is_pci )
|
||||
{
|
||||
Nebula& nd = Nebula::instance();
|
||||
string default_bus;
|
||||
string bus;
|
||||
|
||||
std::vector<const VectorAttribute*> pcis;
|
||||
|
||||
@@ -3435,9 +3435,9 @@ int VirtualMachine::set_up_attach_nic(VirtualMachineTemplate * tmpl, string& err
|
||||
|
||||
_new_nic->replace("PCI_ID", max_pci_id + 1);
|
||||
|
||||
nd.get_configuration_attribute("PCI_PASSTHROUGH_BUS", default_bus);
|
||||
nd.get_configuration_attribute("PCI_PASSTHROUGH_BUS", bus);
|
||||
|
||||
if ( HostSharePCI::set_pci_address(_new_nic.get(), default_bus, false) != 0 )
|
||||
if ( HostSharePCI::set_pci_address(_new_nic.get(), bus, false) != 0 )
|
||||
{
|
||||
err = "Wrong BUS in PCI attribute";
|
||||
return -1;
|
||||
|
||||
@@ -315,8 +315,7 @@ int VirtualMachine::parse_vrouter(string& error_str, Template * tmpl)
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
static int check_pci_attributes(VectorAttribute * pci, const string& default_bus,
|
||||
string& error_str)
|
||||
int VirtualMachine::check_pci_attributes(VectorAttribute * pci, string& error_str)
|
||||
{
|
||||
static std::vector<std::string> attrs = {"VENDOR", "DEVICE", "CLASS"};
|
||||
bool found = false;
|
||||
@@ -383,10 +382,16 @@ int VirtualMachine::parse_pci(string& error_str, Template * tmpl)
|
||||
|
||||
for (auto& attr : array_pci)
|
||||
{
|
||||
if ( check_pci_attributes(attr, default_bus, error_str) != 0 )
|
||||
if ( check_pci_attributes(attr, error_str) != 0 )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( HostSharePCI::set_pci_address(attr, default_bus, true) != 0 )
|
||||
{
|
||||
error_str = "Wrong BUS in PCI attribute";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user