> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polystack.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Live Resize of vCPU and Memory

> Resize vCPU and memory on a running instance using the Polystack Dashboard's Resource Adjustment dialog, when the guest tools and drivers permit it.

## Overview

Live resize of vCPU and memory lets you adjust compute resources for a **running
instance** within the bounds configured on the instance's flavor. The Dashboard provides
a slider-based dialog for intuitive resource adjustment while the instance stays online.

Live resize can increase or decrease vCPU and memory when the guest operating system,
guest tools, and virtualization drivers permit the change. Guest behavior matters: some
operating systems support both directions cleanly, while others may require drivers,
manual CPU online steps, or a reboot before the new resource state is fully visible.

<Note>
  **Prerequisites**

  * Instance must be in `Active` status
  * The instance must not be locked
  * The flavor must have live resize enabled (`hw:cpu_min` or `hw:mem_min` extra specs) — if you do not see **Adjust Resources** in the actions menu, the flavor does not support live resize
  * The guest operating system must have the required guest tools and drivers for CPU and memory changes
</Note>

***

## Resize vCPU or Memory

<Tabs>
  <Tab title="Dashboard" icon="gauge">
    <Steps titleSize="h3">
      <Step title="Open the Resource Adjustment dialog">
        Navigate to **Compute > Instances**. Click the **More** dropdown on
        the instance row, then select **Adjust Resources** under the
        **Configuration Update** group.

        <Note>
          This action only appears for instances in `Active` status whose flavor
          has live resize enabled. If you do not see it, contact your administrator
          to configure a live-resize-enabled flavor.
        </Note>
      </Step>

      <Step title="Adjust resources with sliders">
        The dialog shows the current state and adjustment controls:

        | Field              | Description                                                                 |
        | ------------------ | --------------------------------------------------------------------------- |
        | **Instance**       | Instance name (read-only)                                                   |
        | **Current Info**   | Current vCPU count and memory allocation (read-only)                        |
        | **vCPUs**          | Slider input — drag or type to set between minimum and maximum vCPUs        |
        | **Memory (GiB)**   | Slider input — adjust between minimum and maximum memory in 0.25 GiB steps  |
        | **Make permanent** | Checkbox — persist the configuration after a soft reboot (default: checked) |

        The dialog fetches the live instance status to determine the current and
        allowed resource ranges. Color-coded hints indicate the scaling method:

        | Color  | Meaning                                             |
        | ------ | --------------------------------------------------- |
        | Green  | virtio-mem — fully adjustable in both directions    |
        | Yellow | No balloon driver detected — limited memory scaling |
        | Blue   | DIMM hotplug information                            |

        <Tip>
          The vCPU slider step aligns to the CPU thread count configured in the
          flavor. For example, with 2 threads per core, vCPUs adjust in steps of 2.
        </Tip>
      </Step>

      <Step title="Apply the change">
        Click **Confirm**. Polystack applies the requested live resize while the
        instance remains running, subject to guest operating system and driver support.

        <Warning>
          Reducing memory while applications are using it may cause out-of-memory
          events inside the guest. Check application memory usage before reducing
          memory.
        </Warning>
      </Step>

      <Step title="Verify inside the instance">
        SSH into the instance and confirm the new resources:

        ```bash title="Check vCPU count" theme={null}
        lscpu | grep "^CPU(s):"
        ```

        ```bash title="Check available memory" theme={null}
        free -h
        ```

        <Check>The guest OS shows the updated vCPU count and memory after the live resize is applied.</Check>
      </Step>
    </Steps>
  </Tab>

  <Tab title="CLI" icon="terminal">
    ```bash title="Source credentials" theme={null}
    source openrc.sh
    ```

    Live resize uses the platform Nova API extension. The
    `openstack` CLI does not have a native command for this operation.

    <CodeGroup>
      ```bash title="Check current live resource status" theme={null}
      curl -s -H "X-Auth-Token: $TOKEN" \
        "$NOVA_ENDPOINT/v2.1/servers/<INSTANCE_ID>/polystack-status" | python3 -m json.tool
      ```

      ```bash title="Adjust vCPU count" theme={null}
      curl -X POST -H "X-Auth-Token: $TOKEN" \
        -H "Content-Type: application/json" \
        -d '{"current_vcpus": 4}' \
        "$NOVA_ENDPOINT/v2.1/os-polystack-adjust/<INSTANCE_ID>"
      ```

      ```bash title="Adjust memory (in MB)" theme={null}
      curl -X POST -H "X-Auth-Token: $TOKEN" \
        -H "Content-Type: application/json" \
        -d '{"current_memory_mb": 8192}' \
        "$NOVA_ENDPOINT/v2.1/os-polystack-adjust/<INSTANCE_ID>"
      ```

      ```bash title="Adjust both simultaneously" theme={null}
      curl -X POST -H "X-Auth-Token: $TOKEN" \
        -H "Content-Type: application/json" \
        -d '{"current_vcpus": 4, "current_memory_mb": 8192}' \
        "$NOVA_ENDPOINT/v2.1/os-polystack-adjust/<INSTANCE_ID>"
      ```
    </CodeGroup>
  </Tab>
</Tabs>

***

## Comparison: Live Resize vs. Flavor Resize

|                       | **Live Resize of vCPU and Memory**                            | **Flavor Resize**                    |
| --------------------- | ------------------------------------------------------------- | ------------------------------------ |
| **Instance state**    | Instance stays running while Polystack applies the change     | Reboot required                      |
| **Scope**             | vCPU and memory only                                          | vCPU, memory, and disk               |
| **Direction**         | Up or down within flavor envelope, when guest support permits | Up or down (disk: up only)           |
| **Confirmation step** | No — instant                                                  | Yes — must confirm or revert         |
| **Dashboard action**  | More > Configuration Update > Adjust Resources                | More > Configuration Update > Resize |
| **Use case**          | Responding to live load changes                               | Permanent tier change                |

***

## Troubleshooting

<AccordionGroup>
  <Accordion title="Adjust Resources not visible in the menu" defaultOpen>
    The instance's flavor does not have live resize enabled. The flavor must have
    `hw:cpu_min` or `hw:mem_min` extra specs set. Contact your administrator to
    configure a live-resize-enabled flavor, or resize to a flavor that supports it.
  </Accordion>

  <Accordion title="Scaling request rejected">
    The requested value is outside the allowed range. The minimum and maximum are
    determined by the flavor's `hw:cpu_min` / `hw:mem_min` (minimum) and the flavor's
    vCPUs / memory (maximum). Try a value within the slider range.
  </Accordion>

  <Accordion title="Guest OS does not show new vCPUs">
    On older Linux kernels (before 4.15), new CPUs may need to be brought online manually:

    ```bash title="Bring hotplugged CPUs online" theme={null}
    for cpu in /sys/devices/system/cpu/cpu*/online; do echo 1 > $cpu; done
    ```

    Modern kernels (4.15+) bring CPUs online automatically.
  </Accordion>

  <Accordion title="Memory resize has no effect">
    The guest OS memory driver may not be loaded or may not support the requested
    direction. Check inside the guest:

    ```bash title="Check balloon driver" theme={null}
    lsmod | grep virtio_balloon
    ```

    If not loaded: `modprobe virtio_balloon` and add `virtio_balloon` to
    `/etc/modules` for persistence. Some guest operating systems require
    virtio-mem, ballooning, DIMM hotplug support, or a reboot before memory changes
    are fully visible.
  </Accordion>
</AccordionGroup>

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Admin: Enable Live Resize" href="/services/compute/live-resize-admin" color="#bf9667">
    Configure flavors with hot-add extra specs and resource bounds
  </Card>

  <Card title="Resize Instance" href="/services/compute/resize-instance" color="#bf9667">
    Standard flavor resize — change vCPU, memory, and disk with a reboot
  </Card>

  <Card title="Flavors" href="/services/compute/flavors" color="#bf9667">
    View available flavors and their live resize capabilities
  </Card>

  <Card title="Launch an Instance" href="/services/compute/launch-instance" color="#bf9667">
    Create an instance with a live-resize-enabled flavor
  </Card>
</CardGroup>
