Get OpenStack Manila running with Vagrant and Devstack

Overview

In this blog post you will setup an isolated, virtualized demo environment for the OpenStack shared file system service Manila using Vagrant and DevStack. You will also learn how to create a Manila share and mount it in a VM. The benefits of this guide are that you will have a disposable, isolated demo environment which can be brought up with only a few commands and where you can learn about Manila and test its functionality. You can also tear down the environment in the same manner. The downside is that the resulting demo environment will have considerably less performance due to (nested) virtualization.

 

Introduction

Manila is a proposed shared/distributed file system service for OpenStack. It is an integrated solution that allows to create shares, e.g., NFS or CIFS shares, grant access to those shares for clients like VMs, and take snapshots of shares. For example, as a tenant in OpenStack you could use Manila to create a 50 GB NFS share using it as a shared document repository for the marketing department. You can then grant access to those shares and finally mount it in several VMs provisioned for the marketing department. Unlike Cinder volumes today, Manila shares can be mounted within several VMs simultaneously.

 

Recently, Greg Loughmiller wrote a blog post on how to get Manila running with DevStack. Building on Greg's blog post and Bob Callaway's Manila with Icehouse instructions, this post will show you how to use an automated  installation of a Manila test environment and how to create and mount a share. The post comes in two parts. The first part explains how to create a disposable, virtualized Manila test environment with only a handful of commands using Vagrant and DevStack. The second part shows you how to use Manila to create a share and mount it in a VM.

 

 

Part I - Creating a Manila test environment

Hardware and software requirements

Software wise, you need to install VirtualBox and Vagrant for your environment. Hardware wise, you should have enough horsepower to support a virtualized environment with at minimum 4 GB of free memory and about 5 GB of free disk space.

 

Test environment: These instructions were successfully performed on Linux Mint 16, 64 bit, kernel 3.11.0-12, running on a ThinkPad T430 Intel Core i5-3320M system with 128GB SSD and 8 GB RAM, VirtualBox version 4.3.0r89960, and Vagrant 1.5.2. Another installation was also performed on Mac OS X Mavericks on a MacBook Pro (Late 2013) with SSD and 16 GB RAM.

 

Installation steps

 

1. Download the OpenStack Manila with Vagrant and DevStack GitHub repository:

If you have git installed go to a), if you don't have git installed follow the instructions in b):

a ) Clone the project:

 

~ $ git clone https://github.com/tlichten/vagrant-devstack-manila

 

b ) Download the project zipfile and unzip it. Rename the folder vagrant-devstack-manila-master to  vagrant-devstack-manila.

 

2. Building and bringing up the demo OpenStack environment

Change to the directory of the project and bring up the environment using vagrant.

 

~ $ cd vagrant-devstack-manila

~/vagrant-devstack-manila $ vagrant up

Bringing machine 'default' up with 'virtualbox' provider...

==> default: Importing base box 'trusty'...

==> default: Matching MAC address for NAT networking...

==> default: Clearing any previously set forwarded ports...

...

The DevStack script will run for quite a while and will deploy an Ubuntu based VM with a single-node OpenStack environment that has the Manila service enabled and running. Please note, that this may take a long time. In the test setup it took about 30 minutes to complete.

Once DevStack completes, it will tell you where the OpenStack dashboard, Horizon, is running:

 

Horizon is now available at http://192.168.33.10/

Keystone is serving at http://192.168.33.10:5000/v2.0/

Examples on using novaclient command line is in exercise.sh

The default users are: admin and demo

The password: devstack

This is your host ip: 192.168.33.10

 

You have successfully completed the first part and installed an OpenStack environment with Manila. In the second part, you will use this environment to create a share and mount it in a VM.

 

Part II - Creating a Manila share and mounting it in a VM

1. Logging into the demo environment, creating a Manila share network and share

Use vagrant to log into the previously deployed VM via ssh:

 

~/vagrant-devstack-manila $ vagrant ssh

Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-34-generic x86_64)

...

Switch to the devstack directory:

 

vagrant@devstack:~ $ cd devstack

 

Source the environment for the demo user and demo tenant:

 

vagrant@devstack:~/devstack $ source openrc demo demo

 

List the  Neutron networks and their subnets:

 

vagrant@devstack:~/devstack $ neutron net-list

+--------------------------------------+---------+--------------------------------------------------+

| id                                   | name    | subnets                                          |

+--------------------------------------+---------+--------------------------------------------------+

| 12b6b40e-2dfa-4f74-97b4-9157beac45a2 | private | c0bffa27-69e7-42fc-a6a0-f53fc75da9af 10.0.0.0/24 |

| 38722865-73ea-41d8-a2d3-b17f979e0a6d | public  | e9ca159a-4f0b-499d-924f-724b3235f6cb             |

+--------------------------------------+---------+--------------------------------------------------+

 

For the 'private' network, note down the network id as well as the associated subnet id. Use this information to create a Manila share network for the 'private' network:

 

vagrant@devstack:~/devstack $ manila share-network-create --neutron-net-id 12b6b40e-2dfa-4f74-97b4-9157beac45a2 --neutron-subnet-idc0bffa27-69e7-42fc-a6a0-f53fc75da9af --name MyShareNetwork

+-------------------+--------------------------------------+

|      Property     |                Value                 |

+-------------------+--------------------------------------+

|        cidr       |                 None                 |

|     created_at    |      2014-08-20T14:37:27.560960      |

|    description    |                 None                 |

|         id        | f9de5e52-b03c-4b89-8991-ea5c8cdb94f8 |

|     ip_version    |                 None                 |

|        name       |            MyShareNetwork            |

|    network_type   |                 None                 |

|   neutron_net_id  | 12b6b40e-2dfa-4f74-97b4-9157beac45a2 |

| neutron_subnet_id | c0bffa27-69e7-42fc-a6a0-f53fc75da9af |

|     project_id    |   a4dbe1d62c1f4586934efec21da085f0   |

|  segmentation_id  |                 None                 |

|       status      |                 None                 |

|     updated_at    |                 None                 |

+-------------------+--------------------------------------+

 

Note down the share network id for the just created share network. Use this information to create a Manila share within this share network. In this example we are creating a share with the size of 1 GB which will be exposed though NFS:

 

vagrant@devstack:~/devstack $ manila create --share-network f9de5e52-b03c-4b89-8991-ea5c8cdb94f8 --name MyShare NFS 1

+-------------------+--------------------------------------+

|      Property     |                Value                 |

+-------------------+--------------------------------------+

|         id        | 444d5477-80df-4a87-b686-f35fead23db5 |

|        name       |               MyShare                |

...

+-------------------+--------------------------------------+

 

In this setup we are using the generic driver for Manila. The generic driver will deploy a service VM for the share-network. In this example, a Ubuntu based service VM will boot which has a NFS server running and is exposing the share. You can monitor the status of the share:

 

vagrant@devstack:~/devstack $ manila list

+--------------------------------------+---------+------+-------------+----------+-----------------+

|                  ID                  |   Name  | Size | Share Proto |  Status  | Export location |

+--------------------------------------+---------+------+-------------+----------+-----------------+

| 444d5477-80df-4a87-b686-f35fead23db5 | MyShare |  1   |     NFS     | creating |       None      |

+--------------------------------------+---------+------+-------------+----------+-----------------+

 

The creation will take a few minutes due to nested virtualization. In the test environment it took around 10 minutes. Eventually the share will have the status "available" and an export location:

+--------------------------------------+---------+------+-------------+-----------+---------------------------------------------------------------+

|                  ID                  |   Name  | Size | Share Proto |   Status  |                        Export location                        |

+--------------------------------------+---------+------+-------------+-----------+---------------------------------------------------------------+

| 444d5477-80df-4a87-b686-f35fead23db5 | MyShare |  1   |     NFS     | available | 10.254.0.3:/shares/share-444d5477-80df-4a87-b686-f35fead23db5 |

+--------------------------------------+---------+------+-------------+-----------+---------------------------------------------------------------+

 

Note down the share id for allowing access to it as well as the export location for mounting it in a VM as described next.

 

2. Creating a VM, allowing the VM to access the share, and mounting the share

 

In order to be able to ping and ssh into the VM to be created, adjust the default security rules:

 

        vagrant@devstack:~/devstack $ neutron security-group-rule-create --protocol icmp default

Created a new security_group_rule:

+-------------------+--------------------------------------+

| Field             | Value                                |

+-------------------+--------------------------------------+

| direction         | ingress                              |

| ethertype         | IPv4                                 |

...

 

    vagrant@devstack:~/devstack $ neutron security-group-rule-create --protocol tcp --port-range-min 22 --port-range-max 22 default

Created a new security_group_rule:

+-------------------+--------------------------------------+

| Field             | Value                                |

+-------------------+--------------------------------------+

| direction         | ingress                              |

| ethertype         | IPv4                                 |

...

 

 

Boot a new VM based on the Ubuntu image Manila is using:

 

vagrant@devstack:~/devstack $ nova boot --poll --flavor m1.nano --image ubuntu_1204_nfs_cifs demo-vm0

+--------------------------------------+-------------------------------------------------------------+

| Property                             | Value                                                       |

+--------------------------------------+-------------------------------------------------------------+

...

| id                                   | 3e9dfd06-c95a-46bf-a14e-e217f7aedf28                        |

| image                                | ubuntu_1204_nfs_cifs (682bb0a5-a0e4-4a6d-ad57-7655879bf137) |

| name                                 | demo-vm0                                                    |

| security_groups                      | default                                                     |

| status                               | BUILD                                                       |

| tenant_id                            | a4dbe1d62c1f4586934efec21da085f0                            |

| updated                              | 2014-08-20T14:50:24Z                                        |

| user_id                              | 9ca4e2090465484da15b316417dea3d3                            |

...

+--------------------------------------+-------------------------------------------------------------+

Server building... 100% complete

Finished

 

This will take several minutes to complete due to nested virtualization. Determine the status and assigned IP address of the VM:

 

vagrant@devstack:~/devstack $ nova list

+--------------------------------------+----------+--------+------------+-------------+------------------+

| ID                                   | Name     | Status | Task State | Power State | Networks         |

+--------------------------------------+----------+--------+------------+-------------+------------------+

| 3e9dfd06-c95a-46bf-a14e-e217f7aedf28 | demo-vm0 | ACTIVE | -          | Running     | private=10.0.0.2 |

+--------------------------------------+----------+--------+------------+-------------+------------------+

 

Allow the VM to access the previously created share using the share id of 'MyShare' and the IP address of the VM:

 

vagrant@devstack:~/devstack $ manila access-allow 444d5477-80df-4a87-b686-f35fead23db5 ip 10.0.0.2

+-------------+--------------------------------------+

|   Property  |                Value                 |

+-------------+--------------------------------------+

|  access_to  |               10.0.0.2               |

| access_type |                  ip                  |

|  created_at |      2014-08-20T14:56:12.761067      |

|   deleted   |                False                 |

|  deleted_at |                 None                 |

|      id     | 4b2030c1-a200-4315-be8f-c13e6cc1a2fe |

|   share_id  | 444d5477-80df-4a87-b686-f35fead23db5 |

|    state    |                 new                  |

|  updated_at |                 None                 |

+-------------+--------------------------------------+

 

 

Now, in order to be able to ssh into the VM, create a new floating IP and assign it to the VM:

 

vagrant@devstack:~/devstack $ nova floating-ip-create public

+------------+-----------+----------+--------+

| Ip         | Server Id | Fixed Ip | Pool   |

+------------+-----------+----------+--------+

| 172.24.4.3 | -         | -        | public |

+------------+-----------+----------+--------+

 

vagrant@devstack:~/devstack $ nova add-floating-ip demo-vm0 172.24.4.3

 

Once the VM's network is brought up which can take several minutes due to nested virtualization, you should be able to ping it.

 

        vagrant@devstack:~/devstack $ ping 172.24.4.3

 

Please wait until you can ping the VM. In the test environment this took around 6 minutes.

 

The ssh service may take a few more moments to start. After that, you will be able to ssh into it. The password is 'ubuntu' .

 

    vagrant@devstack:~/devstack $ ssh ubuntu@172.24.4.3

Welcome to Ubuntu 12.04.4 LTS (GNU/Linux 3.2.0-59-virtual i686)

...

 

From the VM you can now mount the export location of the previously created share:

 

ubuntu@ubuntu:~ $ sudo mkdir /mnt/share

 

ubuntu@ubuntu:~ $ sudo mount -t nfs 10.254.0.3:/shares/share-444d5477-80df-4a87-b686-f35fead23db5 /mnt/share

 

ubuntu@ubuntu:~ $ touch /mnt/share/hello_world

 

You have successfully completed the second part and created a Manila share and mounted it in a VM.

 

On the host system, you can tear down the environment with 'vagrant destroy'  and recreate it from scratch with 'vagrant up' .

 

Enjoy!

 

About Thomas

Thomas is a Cloud Platform Architect and has been working in the IT industry for several years, with a strong background in Software Engineering.

Follow on Twitter: @tlichtenntap