# Recovering OpenStack Instances Due to KVM Hypervisor Downtime

This tutorial describes the steps for recovering OpenStack instances on a Linux/KVM hypervisor due to downtime or for maintenance purpose.

### Requirements

1. Two or more hypervisors running the same KVM version. They should be connected to Platform9 private cloud.
2. Shared storage such as NFS or Ceph must be configured identically on hypervisors. In this method, instance disks are not migrated from one storage location to another.
3. Working OpenStack CLI installation as detailed [here](/managed-openstack/5.8/cli-access/cli-access-cli-overview.md).

### Preconditions for NFS Shared Storage

1. Make sure all hypervisors in your environment are configured to use same shared storage.
2. Make sure the instance storage path is identical on all hypervisors; e.g. if you have two hypervisors "A" and "B" which mount NFS share, the local mount point should be identical for both.
3. Make sure that userid and the groupid of the pf9 user is consistent across all hypervisors.

### Steps

1\. Find the instances on the source hypervisor that need to be migrated.

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

```bash
openstack server list --all-projects --host <hypervisor_uuid>
```

{% endtab %}
{% endtabs %}

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

**Note**: record the instance IDs from output above to be used in the below steps.
{% endhint %}

2\. Select a target hypervisor to migrate the instances to.

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

```bash
openstack compute service list --service nova-compute
```

{% endtab %}
{% endtabs %}

Look for hypervisors in the "up" state. Note the UUID of target hypervisor - this will be the value in the Host column.

3\. Perform the migration of a single instance from source to target hypervisor.

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

```bash
nova evacuate <instance_uuid> <destination_hypervisor> --on-shared-storage
```

{% endtab %}
{% endtabs %}

Repeat for each such instance.

### Caveats

* The instance can be rescued only if it was created through Platform9. For example, instances discovered by Platform9 can not be rescued using this method.

### OpenStack Cinder and Neutron

The above method works for instances using Neutron-based networks and Cinder volumes. The KVM tap device created by OpenStack Neutron as well as the Cinder initiator is migrated as part of the evacuate command. However, it is important to note that the migration only works if neutron-networking and cinder-volume services are not impacted by the host downtime.


---

# 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/managed-openstack/5.8/instances/virtual-machines-recover-vm.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.
