# Virtual Machine Leasing

## VM Leasing

VM leasing lets you enforce automatic *power-off* or *deletion* of virtual machines (VMs) after a fixed amount of time. Leases are defined **once per tenant** and inherited by every existing and future VM that belongs to that tenant. Administrators and self-service users can also override the lease for an individual VM when needed.

### Lease-End Actions

| Action        | Result                                                        | Typical Use Case                                   |
| ------------- | ------------------------------------------------------------- | -------------------------------------------------- |
| **Power Off** | VM is gracefully shut down. Disks and metadata are retained.  | Development or lab workloads you may revive later. |
| **Delete**    | VM (and its attached ephemeral disks) is permanently removed. | Disposable environments or cost-control scenarios. |

## Tenant-Level Lease Policy

You can set the tenant-level lease policy by navigating to **Settings** **>** **Tenants & Users** **>** **Tenants** (on left navigation pane) **>** choose a **Tenant** **>** click the **Manage Lease Policy** button on the table header.

The tenant lease policy management screens allow you to manage the following lease configuration:

**Enable Lease Policy**: Turns leasing on or off for the tenant.

**Lease Duration**: The total time in *Days, Hours, Minutes* that each VM may run before the lease expires. The timer starts at VM creation.

**Action Upon Lease Expiration:** Defines the action triggered on lease expiration.

* **Power Off VM (default**): the VM is shut down.
* **Delete VM:** the VM is deleted.

{% hint style="info" %}
**Info**

Caution If you shorten the lease and existing VMs have already exceeded the new duration, the chosen lease-end action executes immediately.
{% endhint %}

## Per-VM Lease Customization

You can modify a lease at the VM level by navigating to **Virtual Machines** on the left-hand navigation pane **>** **Virtual Machines** **>** select a **virtual machine** **>** **Other** dropdown in the table header **>** **Customize Lease**

You can perform the following actions on the VM lease from the customization screen.

* **Specify action upon lease expiration:** Defines the action triggered on lease expiration for the selected VM. **This selection overrides the action set at the tenant level.**
  * **Power Off VM (default**): the VM is shut down.
  * **Delete VM:** the VM is deleted.
* **End sooner**: Pick a new date/time earlier than the current expiration to force an earlier shutdown or deletion.
* **Extend unexpired VMs**: Extend the lease by *up to one additional lease period* as defined in the tenant policy (e.g., +5 days if the policy is 5 days). You can repeat extensions indefinitely.
* **Extend expired VMs**: Even after a VM’s lease has expired, you can grant an extension (subject to the same maximum).

{% hint style="info" %}
**Info**

After a VM is powered-off by the lease engine, any manual power-on is only momentary. PCD will power the VM off again almost immediately.
{% endhint %}

## Permissions Matrix

The following table outlines the VM leasing permissions that the Admin, Self-Service, and Read-Only roles have.

| Role                  | Set Tenant Policy | Edit Lease (VM-level) | Create VM |
| --------------------- | ----------------- | --------------------- | --------- |
| **Admin**             | ✔                 | ✔                     | ✔         |
| **Self-service User** | ✖                 | ✔                     | ✔         |
| **Read-only User**    | ✖                 | ✖                     | ✖         |

## Troubleshooting

| Symptom                                      | Cause                                      | Resolution                                             |
| -------------------------------------------- | ------------------------------------------ | ------------------------------------------------------ |
| VM powers off immediately after you start it | Lease already expired                      | Extend the lease or disable the tenant-level policy.   |
| Cannot extend lease beyond a certain date    | Max extension equals one full lease period | Increase the lease duration at the tenant level first. |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.platform9.com/private-cloud-director/2026.1/virtualized-clusters/virtualmachine/virtual-machine-leasing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
