Create and use a CephFS Type share

Note

To create shares, the project must be allowed to use Manila Service. If you don’t have access yet, please request it following instructions at this page.

Attatch the VMs to the storage network

Warning

Attaching the VM to a storage network is only necessary on GAIA cloud.

Before creating the share, it is necessary to have at least one virtual machine connected to a storage network that will be able to see the vast shares.

To attach the VM on a storage network, on the Horizon Dashboard, open the tab Project > Compute > Instances. Select the desired VM and click on “Attach Interface”. In the popup menu, select the network GAIA_OS_CEPHFS.

Repeat the same operation for each VM that will mount the shared filesystem.

Create the share

On the Share > Shares tab, create the share clicking on the button Create share. In the popup menu set:

  • share name: the name you want to give to the share

  • share protocol: select “CephFS”

  • size: the size of your shared filesystem

  • type: cephfs_type

  • Availability Zone, Share Group and Make visible for all projects: leave blank

../../../_images/op_share_cephfs_img1.png
  • share name: the name you want to give to the share

  • share protocol: select “CephFS”

  • size: the size of your shared filesystem

  • type: cephfs

  • Availability Zone, Share Group and Make visible for all projects: leave blank

../../../_images/op_share_cephfs_g_img1.png

Set access rule

On the tab Share > Shares select the share just created and in the dropdown menu select Manage Rules.

../../../_images/op_share_cephfs_img2.png

Click on Add rule and set:

  • access type: cephx

  • access level: read-write or read-only (depending on your needs)

  • access to: write the name of the client (in our example “charlie”)

../../../_images/op_share_cephfs_img3.png

After clicking on the “add” button, go back to the Share > Shares. Click on the brand new share to display the Share Overview. The “Export locations: Path” and “access key” and “access to” keys are displayed. This information will be used to mount the share on the virtual machines.

Mount the share on the VMs

You are now ready to mount the share on VMs. In the following example, we will consider two VM with Ubuntu. Please refer to the network guide of the operating system of your VM to be sure about the operations to be done.

From here on, the procedure differs between different clouds. Please select the cloud you are using to see the appropriate instructions.

  • Login in the first VM, configure the network interface attached to the storage network

    • ip a command lists all the network interfaces. Find the new interface, attached to the storage network, and refer to the mac-address of the interface to be sure.

      ../../../_images/op_share_cephfs_img4.png
    • Create a new file in the /etc/netplan directory to configure such new interface (in our example “ens7”), and enable it

      $ sudo su
      $ cd /etc/netplan
      $ cp <file-cloud-init> <file-ens-number>   - example: cp 50-cloud-init.yaml ens7.yaml -
      
      $ vim <file-ens-number> ==> Modify the value of the fields "ens", "mtu <value>", "macaddress <value>" and "set-name < value>" with the values shown by "ip a" command.
      
      -- example of the ens7.yaml is --
      
      network:
      version: 2
      ethernets:
          ens7:
              dhcp4: true
              match:
                  macaddress: <your MAC address>
              mtu: <MTU value>
              set-name: ens7
      
      $ netplan apply ==> to enable the new interface
      $ ip a ==> check that the interface is enabled
      
      ../../../_images/op_share_cephfs_img5.png
      • Install the client, by installing the package named “ceph-common” (NOTE: Beware that different versions of ceph-common are available for different versions of Ubuntu and the syntax of the mount command could change.)

      • Create the mount point in the virtual machines (in our example “/mnt/share_manila”) and mount the share

      • To mount the share you will need some information contained in the “Share Overview” page on OpenStack dashboard, in particular you will need the values of PATH, ACCESS_TO and ACCESS KEY (here an example):

        ../../../_images/op_share_cephfs_img6.png

The command is:

sudo mount.ceph <CLIENT_ACCESS_TO>@482d24d4-df47-11eb-8d80-0c42a1f53648.g100_fs=<FS_ADDRESS> <mount point on the VM>  -o  mon_addr=<MON_IPS>,secretfile=<SECRET_FILE>

Where <FS_ADDRESS> and <MON_IPS> are the two parts of the “Path” string on OpenStack:

  • <MON_IPS> is the first numeric part of the “Path” string, up to “:/volumes”, where each IP has to be separated using the character “/” instead of “,”

  • <FS_ADDRESS> is everything else, from “/volumes/” to the end of the string

Finally, the <SECRET_FILE> is the path to a text file that contains the string <ACCESS_KEY>. Following the same example that uses the picture from above:

sudo mount.ceph  charlie@482d24d4-df47-11eb-8d80-0c42a1f53648.g100_fs=/volumes/_nogroup/43aa4ecc-1db6-4952-b2dd-6336b45075d5 /mnt/share_manila/ -o mon_addr=10.35.1.9:6789/10.35.1.10:6789/10.35.1.11:6789/10.35.1.12:6789/10.35.1.13:6789,secretfile=/home/ubuntu/my_secret_file.txt

The command is:

sudo mount -t ceph -v <mount PATH> <mount point on the VM> -o  name=<CLIENT_ACCESS_TO>,secret=<ACCESS_KEY>

An example of the complete command is:

sudo mount -t ceph -v 10.35.1.9:6789,10.35.1.10:6789,10.35.1.11:6789,10.35.1.12:6789,10.35.1.13:6789:/volumes/_nogroup/43aa4ecc-1db6-4952-b2dd-6336b45075d5 /mnt/share_manila/ -o name=my-client-name,secret=AQBP07Nejv/RLhAABYqQ5tvgePh2EP7EL0UuhQ==

NOTE: If you are using a different Linux distribution, please refer to the ceph user manual to be sure that the syntax you are using is appropriate for the ceph version installed.

  • Then repeat the same steps for the second VM as well. Now the two VMs share the same filesystem

  • In the OpenStack dashboard, click on “Project → Compute → Instances” and select the first VM. Click on “Attach Interface” and select the network named “GAIA_OS_CEPHFS”. Repeat the same operation for the second VM.

  • Login on the VM

  • Install the package “ceph-common” on the two VMs.

    $ sudo apt update
    $ sudo apt install ceph-common
    
  • Login in the first VM, and under /etc/ceph/ create the file ceph.conf with the following content:

    [client]
    client quota = true
    mon host = 10.137.64.187:6789, 10.137.64.186:6789, 10.137.64.185:6789
    
  • Then, create the file ceph.client.<CLIENT_ACCESS_TO>.keyring (where <CLIENT_ACCESS_TO> is the value of the field “Access to” in the Share Overview page) with the following content:

    [client.<CLIENT_ACCESS_TO>]
    key = <ACCESS_KEY>
    
  • Login in the second VM and repeat the same steps to create the files ceph.conf and ceph.client.<CLIENT_ACCESS_TO>.keyring with the same content as in the first VM.

  • Create the mount point in the virtual machines (in our example “/mnt/share_manila”) and mount the share

  • To mount the share you will need some information contained in the “Share Overview” page on OpenStack dashboard, in particular you will need the values of PATH, ACCESS_TO and ACCESS KEY (here an example):

    ../../../_images/op_share_cephfs_img6.png

The command is:

sudo mount -t ceph <PATH> <MOUNT_POINT> -o name=<NAME>

Where <PATH>, <MOUNT_POINT> and <MON_IPS> are the following:

  • <PATH> is the value of the field “Export locations: Path” in the Share Overview page

  • <MOUNT_POINT> is the path to the mount point on the VM (in our example “/mnt/share_manila”)

  • <NAME> is the value of the field “Access to” in the Share Overview page

NOTE: If you are using a different Linux distribution, please refer to the ceph user manual to be sure that the syntax you are using is appropriate for the ceph version installed.

  • Then repeat the same steps for the second VM as well. Now the two VMs share the same filesystem