# Instance Tenant Transfer

## Problem

There is a need to change the tenant in which an instance is hosted.

There is not supported method of changing an existing instance's tenancy.

Instance data must be transferred to the destination tenant.

## Environment

* Platform9 Managed OpenStack - v4.0 and Higher

## Procedure

If the source instance is booting from volume, the following steps may be executed in the UI to recreate the instance in the destination tenant.

1. Scope to the source tenant.
2. Power-off and snapshot the instance. [virtual-machines-instance-snapshot](https://platform9.com/docs/v5.2/openstack/virtual-machines-instance-snapshot)
3. Create a volume from the newly created snapshot. [create-volume-from-snapshot](https://platform9.com/docs/openstack/storage-create-volume-from-snapshot)
4. Upload the volume as an Glance image. [upload-volume-as-image](https://platform9.com/docs/openstack/images-upload-volume-as-image)

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

Ensure the newly created Image is Public so it may be used by other tenants.
{% endhint %}

4. Scope to the destination tenant.
5. Create a new instance with the newly available Glance image.

## **Alternative Procedure**

If exposing the image as Public is not a viable option, the instance volume may be transferred to the destination tenant by leveraging the OpenStack CLI.

1. Scope to the source tenant.
2. Power-off and snapshot the instance. [virtual-machines-instance-snapshot](https://platform9.com/docs/v5.2/openstack/virtual-machines-instance-snapshot)
3. Create a volume from the newly created snapshot. [create-volume-from-snapshot](https://platform9.com/docs/openstack/storage-create-volume-from-snapshot)
4. Via CLI, transfer the newly created volume.

{% tabs %}
{% tab title="Bash" %}

```bash
# source from_tenant.rc
# openstack volume transfer request create 1ffe881b-93fd-4030-9dc4-0acf1a0126fc
+------------+--------------------------------------+
| Field      | Value                                |
+------------+--------------------------------------+
| auth_key   | bee4e665a35a3a7a                     |
| created_at | 2022-09-28T00:50:17.835651           |
| id         | c459d215-3c46-4915-96f4-5c5c7077ed2a |
| name       | None                                 |
| volume_id  | 1ffe881b-93fd-4030-9dc4-0acf1a0126fc |
+------------+--------------------------------------+

# source to_tenant.rc
# openstack volume transfer request accept --auth-key bee4e665a35a3a7a c459d215-3c46-4915-96f4-5c5c7077ed2a
+-----------+--------------------------------------+
| Field     | Value                                |
+-----------+--------------------------------------+
| id        | c459d215-3c46-4915-96f4-5c5c7077ed2a |
| name      | None                                 |
| volume_id | 1ffe881b-93fd-4030-9dc4-0acf1a0126fc |
+-----------+--------------------------------------+
```

{% endtab %}
{% endtabs %}

5. In the UI, scope to the destination tenant. Browse to *Volumes and Snapshots* and find the volume. Ensure *Bootable* is set to *True*.
6. Create a new instance with the newly available volume by selecting *Boot Instance From Existing Volume* during creation.

## Additional Information


---

# 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://platform9.com/kb/pmo/how-to/instance-tenant-transfer.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.
