rancher / old-vm

(OBSOLETE) Package and Run Virtual Machines as Docker Containers
Apache License 2.0
645 stars 133 forks source link

kvm extra arguments and hugepages support #115

Closed jdoucerain closed 5 years ago

jdoucerain commented 5 years ago

The purpose of this pull request is to make ranchervm able to run high performance VM meant to be used network virtual function. One of the requirement for network virtual function is to leverage SRIOV for multiple network interfaces. By consequences, the qemu hypervisor has to be configured to use multiple VFIO type interfaces and hugepages memory backing. This pull request is to propose to add properties to the kubernetes VM object. image_vmtools property to specify an alternate vm-tools image (which would contain a customized startvm script) kvm_extra_args property to specify additional parameters to be passed to qemu (-mem-path, -mem-prealloc, multiple VFIO interfaces,...) use_hugepages property to trigger the use of hugepages as medium for an "empty dir" volume used as "-mem-path" by qemu Here is an example of a VM making use of those new properties


kubectl get vm t2 -o yaml
apiVersion: vm.rancher.io/v1alpha1
kind: VirtualMachine
metadata:
  clusterName: ""
  creationTimestamp: 2018-09-10T14:47:19Z
  finalizers:
  - deletion.vm.rancher.io
  generation: 1
  name: t2
  namespace: ""
  resourceVersion: "4225120"
  selfLink: /apis/vm.rancher.io/v1alpha1/virtualmachines/t2
  uid: 6ac30d2a-b508-11e8-aa28-0cc47af7f61c
spec:
  action: stop
  cpus: 4
  hosted_novnc: true
  image: rancher/vm-ubuntu:16.04.4-server-amd64
  image_vmtools: nsonetwork30/vm-tools
  kvm_extra_args: -cpu host -device vfio-pci,host=81:00.3 -mem-prealloc -mem-path
    /hugepages
  memory_mb: 1024
  node_name: ""
  public_keys:
  - jerome
  use_hugepages: true
status:
  id: i-6ac30d2a
  ip: ""
  mac: 06:fe:6a:c3:0d:2a
  node_ip: xx.xx.xx.xx
  node_name: ""
  state: stopped
  vnc_endpoint: xx.xx.xx.xx:31490
LLParse commented 5 years ago

LGTM