Skip to content

Commit

Permalink
Fix added vMI configuration to support ARM
Browse files Browse the repository at this point in the history
Signed-off-by: hellocloudnative <200922702@qq.com>
  • Loading branch information
hellocloudnative committed Oct 25, 2021
1 parent 9329229 commit e297201
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 34 deletions.
64 changes: 30 additions & 34 deletions examples/vmi-arm.yaml
Original file line number Diff line number Diff line change
@@ -1,37 +1,33 @@
---
apiVersion: kubevirt.io/v1
kind: VirtualMachine
kind: VirtualMachineInstance
metadata:
name: arm
labels:
special: vmi-arm
name: vmi-arm
spec:
running: true
template:
metadata:
labels:
kubevirt.io/domain: arm
spec:
domain:
cpu:
cores: 4
devices:
autoattachGraphicsDevice: true
inputs:
- type: tablet
bus: virtio
name: tablet01
- type: keyboard
bus: usb
name: keyboard01
disks:
- bootOrder: 1
disk:
bus: virtio
name: cdromiso
machine:
type: virt
resources:
requests:
memory: 2G
volumes:
- name: cdromiso
persistentVolumeClaim:
claimName: iso-arm
domain:
devices:
autoattachGraphicsDevice: true
disks:
- disk:
bus: virtio
name: cdromiso
inputs:
- bus: virtio
name: tablet01
type: tablet
- bus: usb
name: keyboard01
type: keyboard
machine:
type: virtio
resources:
requests:
memory: 2G
terminationGracePeriodSeconds: 0
volumes:
- name: cdromiso
persistentVolumeClaim:
claimName: iso-arm

14 changes: 14 additions & 0 deletions tools/vms-generator/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const (
VmiGPU = "vmi-gpu"
VmiMacvtap = "vmi-macvtap"
VmTemplateFedora = "vm-template-fedora"
VmiArm = "vmi-arm"
VmTemplateRHEL7 = "vm-template-rhel7"
VmTemplateWindows = "vm-template-windows2012r2"
)
Expand Down Expand Up @@ -1051,3 +1052,16 @@ func GetVMIMacvtap() *v1.VirtualMachineInstance {
vmi.Spec.Domain.Devices.Interfaces = []v1.Interface{{Name: macvtapNetworkName, InterfaceBindingMethod: v1.InterfaceBindingMethod{Macvtap: macvtap}}}
return vmi
}

func GetVMIArm() *v1.VirtualMachineInstance {
vmi := getBaseVMI(VmiArm)
vmi.Spec.Domain.Resources.Requests[k8sv1.ResourceMemory] = resource.MustParse("2G")
_true := true
vmi.Spec.Domain.Devices.AutoattachGraphicsDevice = &_true
vmi.Spec.Domain.Machine = &v1.Machine{Type: "virtio"}
vmi.Spec.Domain.Devices.Inputs = []v1.Input{{Name: "tablet01", Bus: "virtio", Type: "tablet"}, {Name: "keyboard01", Bus: "usb", Type: "keyboard"}}
addPVCDisk(&vmi.Spec, "iso-arm", busVirtio, "cdromiso")
return vmi

}

1 change: 1 addition & 0 deletions tools/vms-generator/vms-generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ pciHostDevices:
utils.VmiGPU: utils.GetVMIGPU(),
utils.VmiMacvtap: utils.GetVMIMacvtap(),
utils.VmiKernelBoot: utils.GetVMIKernelBoot(),
utils.VmiArm: utils.GetVMIArm(),
}

var vmireplicasets = map[string]*v1.VirtualMachineInstanceReplicaSet{
Expand Down

0 comments on commit e297201

Please sign in to comment.