In my host, i create 6 vfs and use dpdk-devbind.py to bind vfio-pci driver to them.
root@ubuntu:~# python3 dpdk-devbind.py -s
Network devices using DPDK-compatible driver
============================================
0000:3d:06.0 'Ethernet Virtual Function 700 Series 37cd' drv=vfio-pci unused=i40evf
0000:3d:06.1 'Ethernet Virtual Function 700 Series 37cd' drv=vfio-pci unused=i40evf
0000:3d:06.2 'Ethernet Virtual Function 700 Series 37cd' drv=vfio-pci unused=i40evf
0000:3d:06.3 'Ethernet Virtual Function 700 Series 37cd' drv=vfio-pci unused=i40evf
0000:3d:06.4 'Ethernet Virtual Function 700 Series 37cd' drv=vfio-pci unused=i40evf
0000:3d:06.5 'Ethernet Virtual Function 700 Series 37cd' drv=vfio-pci unused=i40evf
Network devices using kernel driver
===================================
0000:18:00.0 'Ethernet Controller X710 for 10GbE SFP+ 1572' if=enp24s0f0 drv=i40e unused=vfio-pci
0000:18:00.1 'Ethernet Controller X710 for 10GbE SFP+ 1572' if=enp24s0f1 drv=i40e unused=vfio-pci
0000:3d:00.0 'Ethernet Connection X722 for 10GBASE-T 37d2' if=eno1 drv=i40e unused=vfio-pci *Active*
0000:3d:00.1 'Ethernet Connection X722 for 10GBASE-T 37d2' if=eno2 drv=i40e unused=vfio-pci
0000:af:00.0 'Ethernet Controller X710 for 10GbE SFP+ 1572' if=enp175s0f0 drv=i40e unused=vfio-pci
0000:af:00.1 'Ethernet Controller X710 for 10GbE SFP+ 1572' if=enp175s0f1 drv=i40e unused=vfio-pci
No 'Crypto' devices detected
============================
No 'Eventdev' devices detected
==============================
No 'Mempool' devices detected
=============================
No 'Compress' devices detected
==============================
The required envs are all set correctly.
And then i use sriov-cni, sriov-device-plugin and multus-v3.3-tp, they are all tested in plaint pod in k8s and worked well.
This is the sriov device plugin conf and when it works i can get them in my node description.
root@ubuntu:~# vim cirros-vm.yaml
name: cirros-vm
annotations:
k8s.v1.cni.cncf.io/networks: sriovnet
# This tells CRI Proxy that this pod belongs to Virtlet runtime
kubernetes.io/target-runtime: virtlet.cloud
# inject ssh keys via cloud-init
VirtletSSHKeys: |
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCaJEcFDXEK2ZbX0ZLS1EIYFZRbDAcRfuVjpstSc0De8+sV1aiu+dePxdkuDRwqFtCyk6dEZkssjOkBXtri00MECLkir6FcH3kKOJtbJ6vy3uaJc9w1ERo+wyl6SkAh/+JTJkp7QRXj8oylW5E20LsbnA/dIwWzAF51PPwF7A7FtNg9DnwPqMkxFo1Th/buOMKbP5ZA1mmNNtmzbMpMfJATvVyiv3ccsSJKOiyQr6UG+j7sc/7jMVz5Xk34Vd0l8GwcB0334MchHckmqDB142h/NCWTr8oLakDNvkfC1YneAfAO41hDkUbxPtVBG5M/o7P4fxoqiHEX+ZLfRxDtHB53 me@localhost
spec:
# This nodeSelector specification tells Kubernetes to run this
# pod only on the nodes that have extraRuntime=virtlet label.
# This label is used by Virtlet DaemonSet to select nodes
# that must have Virtlet runtime
nodeSelector:
extraRuntime: virtlet
containers:
- name: cirros-vm
# This specifies the image to use.
# virtlet.cloud/ prefix is used by CRI proxy, the remaining part
# of the image name is prepended with https:// and used to download the image
image: virtlet.cloud/cirros
imagePullPolicy: IfNotPresent
# tty and stdin required for `kubectl attach -t` to work
tty: true
stdin: true
resources:
requests:
intel.com/intel_sriov: '1'
limits:
intel.com/intel_sriov: '1'
The pod description shows that:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 14s default-scheduler Successfully assigned default/cirros-vm to ubuntu
Warning Failed 5s kubelet, ubuntu Error: "/run/virtlet.sock": rpc error: code = 2 desc = failed to create domain "bdb42e55-51d5-57a3-5648-a20f0460e785": virError(Code=1, Domain=10, Message='internal error: process exited while connecting to monitor: I0925 02:15:00.333997 19563 vmwrapper.go:66] Obtaining PID of the VM container process...
nsfix reexec: pid 19563: entering the namespaces of target pid 8826
2019-09-25T02:15:00.412368Z qemu-system-x86_64: -drive file=/dev/vfio/vfio,format=raw,if=none,id=drive-scsi0-0-0-1: Could not refresh total sector count: Illegal seek')
Normal Pulled 4s (x2 over 7s) kubelet, ubuntu Container image "virtlet.cloud/cirros" already present on machine
Normal Created 4s (x2 over 6s) kubelet, ubuntu Created container cirros-vm
Warning Failed 4s kubelet, ubuntu Error: "/run/virtlet.sock": rpc error: code = 2 desc = failed to create domain "bdb42e55-51d5-57a3-5648-a20f0460e785": virError(Code=1, Domain=10, Message='internal error: process exited while connecting to monitor: I0925 02:15:01.855683 19834 vmwrapper.go:66] Obtaining PID of the VM container process...
nsfix reexec: pid 19834: entering the namespaces of target pid 8826
2019-09-25T02:15:01.912965Z qemu-system-x86_64: -drive file=/dev/vfio/vfio,format=raw,if=none,id=drive-scsi0-0-0-1: Could not refresh total sector count: Illegal seek')
Login the virtlet pod and virsh dumpxml of the vm, i find the /dev/vfio/vfio and /dev/vfio/86 (the vf assigned to this vm) was a disk device, what wrong with it?
In my host, i create 6 vfs and use dpdk-devbind.py to bind vfio-pci driver to them.
The required envs are all set correctly.
And then i use sriov-cni, sriov-device-plugin and multus-v3.3-tp, they are all tested in plaint pod in k8s and worked well. This is the sriov device plugin conf and when it works i can get them in my node description.
I create a network:
And when i apply a virtlet vm:
The pod description shows that:
Login the virtlet pod and virsh dumpxml of the vm, i find the /dev/vfio/vfio and /dev/vfio/86 (the vf assigned to this vm) was a disk device, what wrong with it?