Generate script to mount a Manila share

kubernetes
jetstream2
Published

October 9, 2024

Jetstream 2 makes creating volumes that are shared across instances as easy as creating standard volumes. This is provided by the Manila service, which creates volumes based on the Ceph file system that can be mounted simultaneously on multiple Jetstream 2 Virtual Machines.

Exosphere, the Jetstream 2 user friendly UI, is able to create and manage shares, and has the convenient feature that it prints out a command that can be executed in a Jetstream virtual machines to mount a Manila share.

This functionality could be useful also outside of Exosphere, for example if we are creating Manila shares programmatically via the Jetstream API.

Therefore I have created a script that generates the same command.

The only requirement is the Openstack Manila client:

    pip install python-manilaclient

I tested with python-manilaclient-5.0.0

We assume we have already created both the Manila share and an access rule (the access rule is created automatically by Exosphere, it needs to be explicitely created if using the CLI).

The script generate_mount_command.sh is available in the usual Github repository under manila/.

It is executed from a client with Openstack-CLI installed with:

SHARENAME="test_share"
bash generate_mount_command.sh $SHARENAME

This will generate a command of the form:

curl https://jetstream2.exosphere.app/exosphere/assets/scripts/mount_ceph.py | sudo python3 - mount \
--access-rule-name='test_share-rw' \
--access-rule-key='xxxx/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--share-path='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--share-name='test_share'

This can be executed at the command line in a Jetstream 2 VM, which does not require any access to the Openstack API.

How to mount on an external machine

FIXME: this is not supported, Manila shares can only be mounted on Jetstream 2 instances.

All Jetstream images have the ceph-common package installed, for other machines, follow the instructions on the Quincy release.

For Ubuntu 22:

wget -q -O- 'https://download.ceph.com/keys/release.asc' | sudo apt-key add -
codename=jammy
sudo apt-add-repository "deb https://download.ceph.com/debian-quincy/ ${codename} main"
sudo apt install ceph-common