mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-07-27 23:01:12 +00:00
Add new PCI format support for pcipassthrough (#3916)
* add devpassthrough support * add new pci format for pcipassthrough * add new pci format support * polished * update doc
This commit is contained in:
@@ -82,7 +82,27 @@ After the VM object is created, several key attributes need to be specified with
|
||||
|
||||
chtab node=vm1 vm.vidpassword=abc123
|
||||
|
||||
10. Set **netboot** attribute
|
||||
10. (optional)For assigning PCI devices to the VM, set **othersettings** value: ::
|
||||
|
||||
chtab node=vm1 vm.othersettings="devpassthrough:0000:01:00.2"
|
||||
|
||||
Or: ::
|
||||
|
||||
chtab node=vm1 vm.othersettings="devpassthrough:pci_0000_01_00_2"
|
||||
|
||||
Take assigning SR-IOV VFs to the VM as an example:
|
||||
|
||||
* Use ``lspci`` to get VFs PCI from hypervisor: ::
|
||||
|
||||
lspci|grep -i "Virtual Function"
|
||||
0000:01:00.1 Infiniband controller: Mellanox Technologies MT27700 Family [ConnectX-4 Virtual Function]
|
||||
0000:01:00.2 Infiniband controller: Mellanox Technologies MT27700 Family [ConnectX-4 Virtual Function]
|
||||
|
||||
* Set the VFs PCI into ``vm`` table on MN: ::
|
||||
|
||||
chtab node=vm1 vm.othersettings="devpassthrough:0000:01:00.1,0000:01:00.2"
|
||||
|
||||
11. Set **netboot** attribute
|
||||
|
||||
* **[x86_64]** ::
|
||||
|
||||
|
@@ -226,7 +226,7 @@ qq{ link,ro - The file is readonly, and will be placed in tmpfs on the booted no
|
||||
'vncport' => 'Tracks the current VNC display port (currently not meant to be set',
|
||||
'textconsole' => 'Tracks the Psuedo-TTY that maps to the serial port or console of a VM',
|
||||
'powerstate' => "This flag is used by xCAT to track the last known power state of the VM.",
|
||||
'othersettings' => "This allows specifying a semicolon delimited list of key->value pairs to include in a vmx file of VMware or KVM. For partitioning on normal power machines, this option is used to specify the hugepage and/or bsr information, the value is like:'hugepage:1,bsr=2'. For KVM cpu pinning, this option is used to specify the physical cpu set on the host, the value is like:\"vcpupin:'0-15,^8'\",Its syntax is a comma separated list and a special markup using '-' and '^' (ex. '0-4', '0-3,^2') can also be allowed, the '-' denotes the range and the '^' denotes exclusive. For KVM memory binding, the value is like:'membind:0', restrict a guest to allocate memory from the specified set of NUMA nodes. For PCI passthrough, the value is like:'devpassthrough:pci_0001_01_00_0,pci_0000_03_00_0',the PCI devices are assigned to a virtual machine, and the virtual machine can use this I/O exclusively, the devices list are a list of PCI device names delimited with comma, the PCI device names can be obtained by running B<virsh nodedev-list> on the host.",
|
||||
'othersettings' => "This allows specifying a semicolon delimited list of key->value pairs to include in a vmx file of VMware or KVM. For partitioning on normal power machines, this option is used to specify the hugepage and/or bsr information, the value is like:'hugepage:1,bsr=2'. For KVM cpu pinning, this option is used to specify the physical cpu set on the host, the value is like:\"vcpupin:'0-15,^8'\",Its syntax is a comma separated list and a special markup using '-' and '^' (ex. '0-4', '0-3,^2') can also be allowed, the '-' denotes the range and the '^' denotes exclusive. For KVM memory binding, the value is like:'membind:0', restrict a guest to allocate memory from the specified set of NUMA nodes. For PCI passthrough, the value is like:'devpassthrough:pci_0001_01_00_0,pci_0000_03_00_0', the value for PCI device format also can be like:'devpassthrough:0001:01:00.1', the PCI devices are assigned to a virtual machine, and the virtual machine can use this I/O exclusively, the devices list are a list of PCI device names delimited with comma, the PCI device names can be obtained by running B<virsh nodedev-list> on the host.",
|
||||
'guestostype' => "This allows administrator to specify an identifier for OS to pass through to virtualization stack. Normally this should be ignored as xCAT will translate from nodetype.os rather than requiring this field be used\n",
|
||||
'beacon' => "This flag is used by xCAT to track the state of the identify LED with respect to the VM.",
|
||||
'datacenter' => "Optionally specify a datacenter for the VM to exist in (only applicable to VMWare)",
|
||||
|
@@ -783,6 +783,15 @@ sub build_xmldesc {
|
||||
#prepare the xml hash for pci passthrough
|
||||
my @prdevarray;
|
||||
foreach my $devname (@passthrudevices) {
|
||||
#This is for SR-IOV vfio
|
||||
#Change vfio format 0000:01:00.2 to pci_0000_01_00_2
|
||||
if ( $devname =~ m/(\w:)+(\w)+.(\w)/ ){
|
||||
$devname =~ s/[:|.]/_/g;
|
||||
if ( $devname !~ /^pci_/ ) {
|
||||
$devname ="pci_".$devname
|
||||
}
|
||||
}
|
||||
|
||||
my $devobj = $hypconn->get_node_device_by_name($devname);
|
||||
unless ($devobj) {
|
||||
return -1;
|
||||
|
Reference in New Issue
Block a user