kubevirt: Failed to perform memory hotplug

What happened: Failed to hotplug memory to a VM.

What you expected to happen: Memory should have been hotplugged to the VM.

How to reproduce it (as minimally and precisely as possible): Tried to follow https://kubevirt.io/user-guide/compute/memory_hotplug/.

Tested on current latest main branch 904b5b49c339b1a3cbdc430c71da89d6353f4286 with the following kubevirtci settings:

export KUBEVIRT_PROVIDER=k8s-1.32
export KUBEVIRT_WITH_CNAO=true
export KUBEVIRT_DEPLOY_CDI=false
export KUBEVIRT_NUM_NODES=3
export KUBEVIRT_DEPLOY_NET_BINDING_CNI=true
  1. Apply the following KubeVirt spec:
apiVersion: kubevirt.io/v1
kind: KubeVirt
metadata:
  name: kubevirt
spec:
  certificateRotateStrategy:
    selfSigned:
      ca:
        duration: 20m0s
        renewBefore: 12m0s
      server:
        duration: 14m0s
        renewBefore: 10m0s
  configuration:
    vmRolloutStrategy: "LiveUpdate"
    developerConfiguration:
      featureGates:
      - CPUManager
      - ExperimentalIgnitionSupport
      - Sidecar
      - Snapshot
      - HostDisk
      - EnableVirtioFsConfigVolumes
      - EnableVirtioFsStorageVolumes
      - HotplugVolumes
      - DownwardMetrics
      - ExpandDisks
      - WorkloadEncryptionSEV
      - VMExport
      - KubevirtSeccompProfile
    network:
      binding:
        passt:
          computeResourceOverhead:
            requests:
              memory: 500Mi
          migration: {}
          networkAttachmentDefinition: netbindingpasst
          sidecarImage: registry:5000/kubevirt/network-passt-binding:devel
    seccompConfiguration:
      virtualMachineInstanceProfile:
        customProfile:
          localhostProfile: kubevirt/kubevirt.json
  customizeComponents: {}
  imagePullPolicy: IfNotPresent
  workloadUpdateStrategy:
    workloadUpdateMethods:
    - LiveMigrate
  1. Apply the following VM spec:
---
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
  labels:
    kubevirt.io/vm: vm-fedora
  name: vm-fedora
spec:
  runStrategy: Always
  template:
    metadata:
      labels:
        kubevirt.io/vm: vm-fedora
    spec:
      domain:
        memory:
          guest: 1Gi
          maxGuest: 2Gi
        devices:
          interfaces:
            - name: default
              masquerade: {}
          disks:
          - disk:
              bus: virtio
            name: containerdisk
          - disk:
              bus: virtio
            name: cloudinitdisk
      terminationGracePeriodSeconds: 0
      networks:
        - name: default
          pod: {}
      volumes:
      - containerDisk:
          image: registry:5000/kubevirt/fedora-with-test-tooling-container-disk:devel
        name: containerdisk
      - cloudInitNoCloud:
          userData: |-
            #cloud-config
            password: fedora
            chpasswd: { expire: False }
        name: cloudinitdisk
  1. Set spec.template.spec.domain.memory.guest to 2Gi.

Additional context: Add any other context about the problem here.

Environment:

  • KubeVirt version (use virtctl version): 904b5b49c339b1a3cbdc430c71da89d6353f4286
  • Kubernetes version (use kubectl version): 1.32
  • VM or VMI specifications: N/A
  • Cloud provider or hardware configuration: N/A
  • OS (e.g. from /etc/os-release): N/A
  • Kernel (e.g. uname -a): N/A
  • Install tools: N/A
  • Others: N/A

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 27 (26 by maintainers)

Most upvoted comments

I’ve opened https://github.com/kubevirt/kubevirt/pull/14665 as per @orelmisan suggestion to enhance the functests to test the actual guest memory, like I did in my PR that got closed. PTAL.

Thank you @iholder101!

@orelmisan can we close the issue, or do you keep it opened until we push a docs PR?

I haven’t had a chance to look into @enp0s3’s suggestion from https://github.com/kubevirt/kubevirt/issues/14622#issuecomment-2849346222. I hope to get to it next week.

And of course updating the documentation is always great 😉

It looks like it is require to do something manually on the guest side: https://docs.kernel.org/admin-guide/mm/memory-hotplug.html#id8