# Image Library High Availability

You can create a highly available deployment of <code class="expression">space.vars.product\_name</code> image library service in a region by enabling image library role on multiple hosts. This feature requires the use of shared storage backend for image library storage. Once configured, this feature enables seamless access to images across host failures or maintenance events for hosts assigned with image library role.

## Prerequisites

Following are the pre-requisites for enabling high availability for image library service:

* A shared storage backend (e.g., NFS, or other block storage volume backend) is available and accessible by all hosts that will be assigned the image library role.
* All hosts that will be assigned the image library role must be located in the same region. <code class="expression">space.vars.product\_name</code> does not support cross region image library deployment currently.
* Networking and firewall rules allow image-related traffic between image library hosts and all other hosts configured with rest of the <code class="expression">space.vars.product\_name</code> services.

## Supported Storage Backends

Following table describes the supported and unsupported backends for configuring high availability for image library service.

| **Backend Type**       | **HA Support**                                                |
| ---------------------- | ------------------------------------------------------------- |
| File-based (e.g., NFS) | Must be mounted on all image library hosts with the same path |
| Block Storage Volume   | Recommended for scalable and resilient storage                |

## How High Availability Works in Image Library

* When images are stored on shared storage, any image library host can serve them for VM or volume creation.
* During image creation, <code class="expression">space.vars.product\_name</code> dynamically selects an available and healthy image library host. If one of the image library hosts is offline, the system transparently retries with another active image library host to create the image, ensuring uninterrupted service.

## Deployment Steps

### Step 1: Configure Shared Storage Backend

The image library can be configured to use block storage as it's backend. You can do this by providing the name of the volume type for the block storage backend you'd like to use while specifying image library location as part of the cluster blueprint configuration. This informs the image library service to use block storage as the persistent backend to save and retrieve images.

Alternatively, if using file-based shared storage (e.g., NFS), it must be mounted or attached on each host where the image library role will be enabled **with the exact same path.**

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

```bash
mount -t nfs <NFS_SERVER>:/<EXPORTED_PATH> /var/opt/imagelibrary/data
ls -l /var/opt/imagelibrary/data
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
**Important**

When using file-based shared storage, each image library host must mount the storage at the exact same path location.
{% endhint %}

### Step 2: Enable Image Library Role on Multiple Hosts

1. Navigate to Infrastructure > Hosts in the <code class="expression">space.vars.product\_name</code> UI.
2. Select the target host.
3. Click Edit Roles and assign the Image Library role.
4. Repeat this for all hosts that should be part of your highly available image library service setup.

### Step 3: Validate that image library service is running

Run the following command on each host enabled with the image library role:

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

```yaml
systemctl status pf9-glance-api
```

{% endtab %}
{% endtabs %}

Check that:

* The pf9-glance-api service is active.
* No errors are reported in `/var/log/pf9/glance-api.log`.

You can also validate from the <code class="expression">space.vars.product\_name</code> UI by checking the Settings > API Access > API Endpoints and check that `image-cluster` service is available with multiple image library endpoints.
