1.6. Changing compute resources of a VM

Increase CPU and memory of your virtual machine

In this chapter, you will increase the CPU and memory of your virtual machine.

Task 1.6.1: Increase CPU and memory of your VM in the web console

The tab “Configuration” of your VM allows you to change the specifics of your VM, including the compute resources.

Task hint

Navigate to your VM and click on “Configuration”:

OpenShift VM Configuration

Click on the current CPU and memory resources to change them:

OpenShift VM Configuration

Select the desired target CPU and memory value, then click save:

OpenShift VM Configuration

Task 1.6.2: Increase CPU and memory of your VM on the CLI

To increase the compute resources of your VM on the CLI, you can edit or patch the VirtualMachine object.

Task hint
oc --namespace lab-<username> \
  patch vm lab01-firstvm --type='json' -p=\
  '[{"op": "replace", "path": "/spec/template/spec/domain/cpu/sockets", "value": 2}, \
    {"op": "replace", "path": "/spec/template/spec/domain/memory/guest", "value": 1Gi}]'

If your change is applied by live migrating the VM, you can watch the progress of the migration.

watch "oc --namespace lab-<username> \
  get vmi lab01-firstvm -o jsonpath=\
  '{.status.conditions}{.status.currentCPUTopology}{.status.memory}'|jq"

The output should be similar to:

Every 2.0s: oc --namespace lab-<username> \
  get vmi lab01-firstvm -o jsonpath=\
  '{.status.conditions}{.status.currentCPUTopology}{.status.memory}'|jq
[
  {
    "lastProbeTime": null,
    "lastTransitionTime": "2026-05-19T11:05:36Z",
    "status": "True",
    "type": "Ready"
  },
  {
    "lastProbeTime": null,
    "lastTransitionTime": null,
    "status": "True",
    "type": "LiveMigratable"
  },
  {
    "lastProbeTime": null,
    "lastTransitionTime": null,
    "status": "True",
    "type": "StorageLiveMigratable"
  }
]
{
  "cores": 1,
  "sockets": 1,
  "threads": 1
}
{
  "guestAtBoot": "128Mi",
  "guestCurrent": "128Mi",
  "guestRequested": "128Mi"
}

When the live migration takes place, the output should indicate with HotVCPUChange that the CPU can be hot-plugged:

Every 2.0s: oc --namespace lab-<username> \
  get vmi lab01-firstvm -o jsonpath=\
  '{.status.conditions}{.status.currentCPUTopology}{.status.memory}'|jq
[
  {
    "lastProbeTime": null,
    "lastTransitionTime": "2026-05-19T11:05:36Z",
    "status": "True",
    "type": "Ready"
  },
  {
    "lastProbeTime": null,
    "lastTransitionTime": null,
    "status": "True",
    "type": "LiveMigratable"
  },
  {
    "lastProbeTime": null,
    "lastTransitionTime": null,
    "status": "True",
    "type": "StorageLiveMigratable"
  },
  {
    "lastProbeTime": null,
    "lastTransitionTime": null,
    "status": "True",
    "type": "HotVCPUChange"
  }
]
{
  "cores": 1,
  "sockets": 1,
  "threads": 1
}
{
  "guestAtBoot": "128Mi",
  "guestCurrent": "128Mi",
  "guestRequested": "128Mi"
}

And finally to:

Every 2.0s: oc --namespace lab-<username> \
  get vmi lab01-firstvm -o jsonpath=\
  '{.status.conditions}{.status.currentCPUTopology}{.status.memory}'|jq
[
  {
    "lastProbeTime": null,
    "lastTransitionTime": "2026-05-19T12:01:35Z",
    "status": "True",
    "type": "Ready"
  },
  {
    "lastProbeTime": null,
    "lastTransitionTime": null,
    "status": "True",
    "type": "LiveMigratable"
  },
  {
    "lastProbeTime": null,
    "lastTransitionTime": null,
    "status": "True",
    "type": "StorageLiveMigratable"
  }
]
{
  "cores": 1,
  "sockets": 2,
  "threads": 1
}
{
  "guestAtBoot": "128Mi",
  "guestCurrent": "128Mi",
  "guestRequested": "128Mi"
}

As you can see, hot-plug was successful for CPU but not for memory. For memory hot-plug to work, the VM must have at least 1GiB of memory allocated. A restart of the VM is necessarry for the change to take effect.

If we restart the VM and increase the memory again, we can see that memory is hot-plugged as well (HotMemoryChange).

Task hint
oc --namespace lab-<username> \
  patch vm lab01-firstvm --type='json' -p=\
  '[{"op": "replace", "path": "/spec/template/spec/domain/memory/guest", "value": 2Gi}]'
Every 2.0s: oc --namespace lab-<username> \
  get vmi lab01-firstvm -o jsonpath=\
  '{.status.conditions}{.status.currentCPUTopology}{.status.memory}'|jq
[
  {
    "lastProbeTime": null,
    "lastTransitionTime": "2026-05-19T12:09:08Z",
    "status": "True",
    "type": "Ready"
  },
  {
    "lastProbeTime": null,
    "lastTransitionTime": null,
    "status": "True",
    "type": "LiveMigratable"
  },
  {
    "lastProbeTime": null,
    "lastTransitionTime": null,
    "status": "True",
    "type": "StorageLiveMigratable"
  },
  {
    "lastProbeTime": null,
    "lastTransitionTime": null,
    "status": "True",
    "type": "HotMemoryChange"
  }
]
{
  "cores": 1,
  "sockets": 2,
  "threads": 1
}
{
  "guestAtBoot": "1Gi",
  "guestCurrent": "1Gi",
  "guestRequested": "1Gi"
}

After the live migration has finished:

Every 2.0s: oc --namespace lab-<username> \
  get vmi lab01-firstvm -o jsonpath=\
  '{.status.conditions}{.status.currentCPUTopology}{.status.memory}'|jq
[
  {
    "lastProbeTime": null,
    "lastTransitionTime": "2026-05-19T12:18:34Z",
    "status": "True",
    "type": "Ready"
  },
  {
    "lastProbeTime": null,
    "lastTransitionTime": null,
    "status": "True",
    "type": "LiveMigratable"
  },
  {
    "lastProbeTime": null,
    "lastTransitionTime": null,
    "status": "True",
    "type": "StorageLiveMigratable"
  }
]
{
  "cores": 1,
  "sockets": 2,
  "threads": 1
}
{
  "guestAtBoot": "1Gi",
  "guestCurrent": "1Gi",
  "guestRequested": "2Gi"
}