diff --git a/README.md b/README.md index 421ee11f..6e6d6820 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,7 @@ The table below lists the guest operating systems that are covered by the templa | Microsoft Windows Server 2016 | [windows2k16](templates/windows2k16.tpl.yaml) | | Microsoft Windows Server 2019 | [windows2k19](templates/windows2k19.tpl.yaml) | | Microsoft Windows 10 | [windows10](templates/windows10.tpl.yaml) | +| Microsoft Windows 11 | [windows11](templates/windows11.tpl.yaml) | | Fedora | [fedora](templates/fedora.tpl.yaml) | | Red Hat Enterprise Linux 6 | [rhel6](templates/rhel6.tpl.yaml) | | Red Hat Enterprise Linux 7 | [rhel7](templates/rhel7.tpl.yaml) | diff --git a/automation/test-windows.sh b/automation/test-windows.sh index 1dbdc725..a049430c 100755 --- a/automation/test-windows.sh +++ b/automation/test-windows.sh @@ -4,6 +4,7 @@ set -ex namespace="kubevirt" template_name="windows2k12r2" +username="Administrator" dv_name="${TARGET}-datavolume-original" @@ -70,6 +71,10 @@ workloads=("server" "highperformance") if [[ $TARGET =~ windows10.* ]]; then template_name="windows10" workloads=("desktop") +elif [[ $TARGET =~ windows11.* ]]; then + template_name="windows11" + username="Administrator11" + workloads=("desktop") elif [[ $TARGET =~ windows2016.* ]]; then template_name="windows2k16" elif [[ $TARGET =~ windows2019.* ]]; then @@ -78,7 +83,6 @@ fi delete_vm(){ vm_name=$1 - local template_name=$2 set +e #stop vm ./virtctl stop $vm_name -n $namespace @@ -113,7 +117,7 @@ run_vm(){ current_time=0 # run ipconfig /all command on windows vm - while [[ $(oc exec -n $namespace -i winrmcli -- ./usr/bin/winrm-cli -hostname $ipAddressVMI -port 5985 -username "Administrator" -password "Heslo123" "ipconfig /all" | grep "IPv4 Address" | wc -l ) -eq 0 ]] ; do + while [[ $(oc exec -n $namespace -i winrmcli -- ./usr/bin/winrm-cli -hostname $ipAddressVMI -port 5985 -username $username -password "Heslo123" "ipconfig /all" | grep "IPv4 Address" | wc -l ) -eq 0 ]] ; do # VM can be stopped during test and recreated. That will change IP, so to be sure, get IP at every iteration ipAddressVMI=$(oc get vmi $vm_name -o json -n $namespace| jq -r '.status.interfaces[0].ipAddress') current_time=$((current_time + sample)) diff --git a/generate-templates.yaml b/generate-templates.yaml index 236dc0f4..25b3a3bd 100644 --- a/generate-templates.yaml +++ b/generate-templates.yaml @@ -360,3 +360,15 @@ - {flavor: large, workload: highperformance, memsize: "8Gi", cpus: 2, iothreads: True, emulatorthread: True, multiqueue: True, tablet: True, default: False} vars: osinfoname: win10 + + - name: Generate Windows 11 templates + template: + src: windows11.tpl.yaml + dest: "{{ playbook_dir }}/dist/templates/windows11-{{ item.workload }}-{{ item.flavor }}.yaml" + with_items: + - {flavor: medium, workload: desktop, memsize: "4Gi", cpus: 1, iothreads: False, emulatorthread: False, multiqueue: False, tablet: True, default: True} + - {flavor: medium, workload: highperformance, memsize: "4Gi", cpus: 1, iothreads: True, emulatorthread: True, multiqueue: True, tablet: True, default: False} + - {flavor: large, workload: desktop, memsize: "8Gi", cpus: 2, iothreads: False, emulatorthread: False, multiqueue: False, tablet: True, default: False} + - {flavor: large, workload: highperformance, memsize: "8Gi", cpus: 2, iothreads: True, emulatorthread: True, multiqueue: True, tablet: True, default: False} + vars: + osinfoname: win11 diff --git a/osinfo-db-override/os/microsoft.com/win-11.xml b/osinfo-db-override/os/microsoft.com/win-11.xml new file mode 100644 index 00000000..eda48b0c --- /dev/null +++ b/osinfo-db-override/os/microsoft.com/win-11.xml @@ -0,0 +1,38 @@ + + + + + win11 + Microsoft Windows 11 + 11.0 + Microsoft Corporation + Microsoft Corporation + Корпорація Microsoft + Microsoft Corporation + Microsoft Corporation + Microsoft Corporation + Microsoft Corporation + Microsoft Corporation + Microsoft Corporation + Microsoft Corporation + Microsoft Corporation + Microsoft Corporation + Microsoft Corporation + winnt + win + + + 2021-10-05 + + + + + 1000000000 + 2 + 4294967296 + 68719476736 + + + + diff --git a/templates/windows10.tpl.yaml b/templates/windows10.tpl.yaml index 1a17239c..abefd253 100644 --- a/templates/windows10.tpl.yaml +++ b/templates/windows10.tpl.yaml @@ -56,7 +56,7 @@ objects: "path": "jsonpath::.spec.domain.devices.disks[*].disk.bus", "valid": "jsonpath::.spec.domain.devices.disks[*].disk.bus", "rule": "enum", - "message": "virto disk bus type has better performance, install virtio drivers in VM and change bus type", + "message": "virtio disk bus type has better performance, install virtio drivers in VM and change bus type", "values": ["virtio"], "justWarning": true }, { diff --git a/templates/windows11.tpl.yaml b/templates/windows11.tpl.yaml new file mode 100644 index 00000000..a4c02ceb --- /dev/null +++ b/templates/windows11.tpl.yaml @@ -0,0 +1,202 @@ +apiVersion: template.openshift.io/v1 +kind: Template +metadata: + name: windows11-{{ item.workload }}-{{ item.flavor }} + annotations: + openshift.io/display-name: "Microsoft Windows 11 VM" + description: >- + Template for Microsoft Windows 11 VM. + A PVC with the Windows disk image must be available. + tags: "hidden,kubevirt,virtualmachine,windows" + iconClass: "icon-windows" + openshift.io/provider-display-name: "KubeVirt" + openshift.io/documentation-url: "https://github.com/kubevirt/common-templates" + openshift.io/support-url: "https://github.com/kubevirt/common-templates/issues" + template.openshift.io/bindable: "false" + template.kubevirt.io/version: v1alpha1 + defaults.template.kubevirt.io/disk: rootdisk + defaults.template.kubevirt.io/network: default + template.kubevirt.io/editable: | + /objects[0].spec.template.spec.domain.cpu.cores + /objects[0].spec.template.spec.domain.resources.requests.memory + /objects[0].spec.template.spec.domain.devices.disks + /objects[0].spec.template.spec.volumes + /objects[0].spec.template.spec.networks + name.os.template.kubevirt.io/win11: {{ lookup('osinfo', osinfoname).name }} + labels: + os.template.kubevirt.io/win11: "true" + workload.template.kubevirt.io/{{ item.workload }}: "true" + flavor.template.kubevirt.io/{{ item.flavor }}: "true" + template.kubevirt.io/type: "base" + template.kubevirt.io/version: "{{ lookup('env', 'VERSION') | default('devel', true) }}" +{% if item.default %} + template.kubevirt.io/default-os-variant: "true" +{% endif %} +objects: +- apiVersion: kubevirt.io/v1 + kind: VirtualMachine + metadata: + name: ${NAME} + labels: + vm.kubevirt.io/template: windows11-{{ item.workload }}-{{ item.flavor }} + vm.kubevirt.io/template.version: "{{ lookup('env', 'VERSION') | default('devel', true) }}" + vm.kubevirt.io/template.revision: "{{ lookup('env', 'REVISION') | default(1, true) }}" + app: ${NAME} + annotations: + vm.kubevirt.io/validations: | + [ + { + "name": "minimal-required-memory", + "path": "jsonpath::.spec.domain.resources.requests.memory", + "rule": "integer", + "message": "This VM requires more memory.", + "min": {{ lookup('osinfo', osinfoname)["minimum_resources.architecture=x86_64.ram"] }} + }, { + "name": "windows-virtio-bus", + "path": "jsonpath::.spec.domain.devices.disks[*].disk.bus", + "valid": "jsonpath::.spec.domain.devices.disks[*].disk.bus", + "rule": "enum", + "message": "virtio disk bus type has better performance, install virtio drivers in VM and change bus type", + "values": ["virtio"], + "justWarning": true + }, { + "name": "windows-disk-bus", + "path": "jsonpath::.spec.domain.devices.disks[*].disk.bus", + "valid": "jsonpath::.spec.domain.devices.disks[*].disk.bus", + "rule": "enum", + "message": "disk bus has to be either virtio or sata or scsi", + "values": ["virtio", "sata", "scsi"] + }, { + "name": "windows-cd-bus", + "path": "jsonpath::.spec.domain.devices.disks[*].cdrom.bus", + "valid": "jsonpath::.spec.domain.devices.disks[*].cdrom.bus", + "rule": "enum", + "message": "cd bus has to be sata", + "values": ["sata"] + }, { + "name": "minimal-required-cores", + "path": "jsonpath::.spec.domain.cpu.cores", + "rule": "integer", + "message": "This VM requires more cores.", + "min": 2 + } + ] + spec: + dataVolumeTemplates: + - apiVersion: cdi.kubevirt.io/v1beta1 + kind: DataVolume + metadata: + name: ${NAME} + spec: + storage: + resources: + requests: + storage: 64Gi + sourceRef: + kind: DataSource + name: ${DATA_SOURCE_NAME} + namespace: ${DATA_SOURCE_NAMESPACE} + running: false + template: + metadata: + annotations: + vm.kubevirt.io/os: "windows11" + vm.kubevirt.io/workload: "{{ item.workload }}" + vm.kubevirt.io/flavor: "{{ item.flavor }}" + labels: + kubevirt.io/domain: ${NAME} + kubevirt.io/size: {{ item.flavor }} + spec: + domain: + clock: + utc: {} + timer: + hpet: + present: false + pit: + tickPolicy: delay + rtc: + tickPolicy: catchup + hyperv: {} + cpu: + sockets: {{ item.cpus }} + cores: 2 + threads: 1 +{% if item.iothreads or item.emulatorthread %} + dedicatedCpuPlacement: True +{% endif %} +{% if item.emulatorthread %} + isolateEmulatorThread: True +{% endif %} + resources: + requests: + memory: {{ item.memsize }} + features: + acpi: {} + apic: {} + smm: {} + hyperv: + relaxed: {} + vapic: {} + vpindex: {} + spinlocks: + spinlocks: 8191 + synic: {} + synictimer: + direct: {} + tlbflush: {} + frequencies: {} + reenlightenment: {} + ipi: {} + runtime: {} + reset: {} + firmware: + bootloader: + efi: + secureBoot: true + devices: +{% if item.multiqueue %} + networkInterfaceMultiqueue: True +{% endif %} + disks: + - disk: +{% if item.workload == "highperformance" %} + bus: virtio +{% else %} + bus: sata +{% endif %} + name: rootdisk + interfaces: + - masquerade: {} +{% if item.multiqueue %} + model: virtio +{% else %} + model: e1000e +{% endif %} + name: default +{% if item.tablet %} + inputs: + - type: tablet + bus: usb + name: tablet +{% endif %} + tpm: {} + terminationGracePeriodSeconds: 3600 + volumes: + - dataVolume: + name: ${NAME} + name: rootdisk + networks: + - name: default + pod: {} +parameters: +- name: NAME + description: VM name + generate: expression + from: "windows-[a-z0-9]{6}" +- name: DATA_SOURCE_NAME + description: Name of the DataSource to clone + value: win11 +- name: DATA_SOURCE_NAMESPACE + description: Namespace of the DataSource + value: kubevirt-os-images diff --git a/templates/windows2k12.tpl.yaml b/templates/windows2k12.tpl.yaml index ccffb93f..52af4b9a 100644 --- a/templates/windows2k12.tpl.yaml +++ b/templates/windows2k12.tpl.yaml @@ -56,7 +56,7 @@ objects: "path": "jsonpath::.spec.domain.devices.disks[*].disk.bus", "valid": "jsonpath::.spec.domain.devices.disks[*].disk.bus", "rule": "enum", - "message": "virto disk bus type has better performance, install virtio drivers in VM and change bus type", + "message": "virtio disk bus type has better performance, install virtio drivers in VM and change bus type", "values": ["virtio"], "justWarning": true }, { diff --git a/templates/windows2k16.tpl.yaml b/templates/windows2k16.tpl.yaml index 877940d8..8c3c9ac0 100644 --- a/templates/windows2k16.tpl.yaml +++ b/templates/windows2k16.tpl.yaml @@ -56,7 +56,7 @@ objects: "path": "jsonpath::.spec.domain.devices.disks[*].disk.bus", "valid": "jsonpath::.spec.domain.devices.disks[*].disk.bus", "rule": "enum", - "message": "virto disk bus type has better performance, install virtio drivers in VM and change bus type", + "message": "virtio disk bus type has better performance, install virtio drivers in VM and change bus type", "values": ["virtio"], "justWarning": true }, { diff --git a/templates/windows2k19.tpl.yaml b/templates/windows2k19.tpl.yaml index 0e644998..714142c3 100644 --- a/templates/windows2k19.tpl.yaml +++ b/templates/windows2k19.tpl.yaml @@ -56,7 +56,7 @@ objects: "path": "jsonpath::.spec.domain.devices.disks[*].disk.bus", "valid": "jsonpath::.spec.domain.devices.disks[*].disk.bus", "rule": "enum", - "message": "virto disk bus type has better performance, install virtio drivers in VM and change bus type", + "message": "virtio disk bus type has better performance, install virtio drivers in VM and change bus type", "values": ["virtio"], "justWarning": true }, {