Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

domain := &libvirtxml.Domain{
        Devices&libvirtxml.DomainDeviceList{
            Emulator"/vmwrapper",
            Inputs[]libvirtxml.DomainInput{
                {Type"tablet"Bus"usb"},
            },
            Graphics: []libvirtxml.DomainGraphic{
                {VNC: &libvirtxml.DomainGraphicVNC{Port: -1}},
            },
            Videos: []libvirtxml.DomainVideo{
                {Model: libvirtxml.DomainVideoModel{Type: "cirrus"}},
            },
            Controllers: []libvirtxml.DomainController{
                {Type: "scsi"Index: &scsiControllerIndex, Model"virtio-scsi"},
            },
        },

...

Fix

continue

...


Key Point

Because Virtlet create a VM by libvirt instance. So we config QAT devices to its domain file to finish the QAT device assignment. Virtlet can get the QAT device id from the environment vailables which advertised by QAT device plugin and passed by Kubelet. Then we can easily assign a QAT vf deivce into a Virtlet VM by PCI-passthrough supported by libvirt hostdev api.


<hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x3d' slot='0x02' function='0x2'/>
      </source>
      <alias name='hostdev0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</hostdev>


And for further code information, you can get from the my fork version of Virtlet in https://github.com/leyao-daily/virtlet

Example

I have upload the QAT enabled imaged into docker hub and you can download it by 'docker pull leyao/virtlet:qat'. After the Virtlet Pod running, you can setup a VM with QAT vf device. Add the orange line with the number of QAT vf you want to assign into spec.containers.resource.limits/requests of your Virtlet VM yaml file like below.


...

resources:
    requests:
        cpu: 4000m
        memory: 8192Mi
        qat.intel.com/generic: '1'
        intel.com/intel_sriov: '1'
    limits:
        cpu: 4000m
        memory: 8192Mi
        qat.intel.com/generic: '1'
        intel.com/intel_sriov: '1'

...