Skip to content

Commit dd41268

Browse files
authored
Merge pull request #460 from stackhpc/multinode-manila
Add support for manila in multinode
2 parents 076407e + 92a30f0 commit dd41268

File tree

13 files changed

+249
-10
lines changed

13 files changed

+249
-10
lines changed

doc/source/configuration/cephadm.rst

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,19 +242,26 @@ for Cinder, Cinder backup, Glance, and Nova in Kolla Ansible.
242242
Ceph Commands
243243
~~~~~~~~~~~~~
244244

245-
It is possible to run an arbitrary list of commands against the cluster after deployment
246-
by setting the ``cephadm_commands`` variable. ``cephadm_commands`` should be a list of commands
247-
to pass to ``cephadm shell -- ceph``. For example:
245+
It is possible to run an arbitrary list of commands against the cluster after
246+
deployment by setting the ``cephadm_commands_pre`` and ``cephadm_commands_post``
247+
variables. Each should be a list of commands to pass to ``cephadm shell --
248+
ceph``. For example:
248249

249250
.. code:: yaml
250251
251252
# A list of commands to pass to cephadm shell -- ceph. See stackhpc.cephadm.commands
252253
# for format.
253-
cephadm_commands:
254+
cephadm_commands_pre:
254255
# Configure Prometheus exporter to listen on a specific interface. The default
255256
# is to listen on all interfaces.
256257
- "config set mgr mgr/prometheus/server_addr 10.0.0.1"
257258
259+
Both variables have the same format, however commands in the
260+
``cephadm_commands_pre`` list are executed before the rest of the Ceph
261+
post-deployment configuration is applied. Commands in the
262+
``cephadm_commands_post`` list are executed after the rest of the Ceph
263+
post-deployment configuration is applied.
264+
258265
Deployment
259266
==========
260267

doc/source/contributor/environments/ci-multinode.rst

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,153 @@ Final steps
5353
1. ``source kayobe-env --environment ci-aio``
5454
2. Run ``kayobe overcloud host configure``
5555
3. Run ``kayobe overcloud service deploy``
56+
57+
58+
Manila
59+
======
60+
The Multinode environment supports Manila with the CephFS native backend, but it
61+
is not enabled by default. To enable it, set the following in
62+
``/etc/kayobe/environments/ci-multinode/kolla.yml``:
63+
64+
.. code-block:: yaml
65+
66+
kolla_enable_manila: true
67+
kolla_enable_manila_backend_cephfs: true
68+
69+
And re-run ``kayobe overcloud service deploy`` if you are working on an existing
70+
deployment.
71+
72+
To test it, you will need two virtual machines. Cirros does not support the Ceph
73+
kernel client, so you will need to use a different image. Any regular Linux
74+
distribution should work. As an example, we will use Ubuntu 20.04.
75+
76+
Download the image locally:
77+
78+
.. code-block:: bash
79+
80+
wget http://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img
81+
82+
Upload the image to Glance:
83+
84+
.. code-block:: bash
85+
86+
openstack image create --container-format bare --disk-format qcow2 --file focal-server-cloudimg-amd64.img Ubuntu-20.04 --progress
87+
88+
Create a keypair:
89+
90+
.. code-block:: bash
91+
92+
openstack keypair create --private-key ~/.ssh/id_rsa id_rsa
93+
94+
Create two virtual machines from the image:
95+
96+
.. code-block:: bash
97+
98+
openstack server create --flavor m1.small --image Ubuntu-20.04 --key-name id_rsa --network admin-tenant ubuntu-client-1
99+
openstack server create --flavor m1.small --image Ubuntu-20.04 --key-name id_rsa --network admin-tenant ubuntu-client-2
100+
101+
Wait until the instances are active. It is worth noting that this process can
102+
take a while, especially if the overcloud is deployed to virtual machines. You
103+
can monitor the progress with the following command:
104+
105+
.. code-block:: bash
106+
107+
watch openstack server list
108+
109+
Once they are active, create two floating IPs:
110+
111+
.. code-block:: bash
112+
113+
openstack floating ip create external
114+
openstack floating ip create external
115+
116+
Associate the floating IPs to the instances:
117+
118+
.. code-block:: bash
119+
120+
openstack server add floating ip ubuntu-client-1 <floating-ip-1>
121+
openstack server add floating ip ubuntu-client-2 <floating-ip-2>
122+
123+
124+
Then SSH into each instance and install the Ceph client:
125+
126+
.. code-block:: bash
127+
128+
sudo apt update
129+
sudo apt install -y ceph-common
130+
131+
132+
Back on the host, install the Manila client:
133+
134+
.. code-block:: bash
135+
136+
sudo dnf install -y python-manilaclient
137+
138+
Then create a share type and share:
139+
140+
.. code-block:: bash
141+
142+
manila type-create cephfs-type false --is_public true
143+
manila type-key cephfs-type set vendor_name=Ceph storage_protocol=CEPHFS
144+
manila create --name test-share --share-type cephfs-type CephFS 2
145+
146+
Wait until the share is available:
147+
148+
.. code-block:: bash
149+
150+
manila list
151+
152+
Then allow access to the shares to two users:
153+
154+
.. code-block:: bash
155+
156+
manila access-allow test-share cephx alice
157+
manila access-allow test-share cephx bob
158+
159+
Show the access list to make sure the state of both entries is ``active`` and
160+
take note of the access keys:
161+
162+
.. code-block:: bash
163+
164+
manila access-list test-share
165+
166+
And take note of the path to the share:
167+
168+
.. code-block:: bash
169+
170+
manila share-export-location-list test-share
171+
172+
SSH into the first instance, create a directory for the share, and mount it:
173+
174+
.. code-block:: bash
175+
176+
mkdir testdir
177+
sudo mount -t ceph {path} -o name=alice,secret='{access_key}' testdir
178+
179+
Where the path is the path to the share from the previous step, and the secret
180+
is the access key for the user alice.
181+
182+
Then create a file in the share:
183+
184+
.. code-block:: bash
185+
186+
sudo touch testdir/testfile
187+
188+
SSH into the second instance, create a directory for the share, and mount it:
189+
190+
.. code-block:: bash
191+
192+
mkdir testdir
193+
sudo mount -t ceph {path} -o name=bob,secret='{access_key}' testdir
194+
195+
Where the path is the same as before, and the secret is the access key for the
196+
user bob.
197+
198+
Then check that the file created in the first instance is visible in the second
199+
instance:
200+
201+
.. code-block:: bash
202+
203+
ls testdir
204+
205+
If it shows the test file then the share is working correctly.

etc/kayobe/ansible/cephadm-commands.yml renamed to etc/kayobe/ansible/cephadm-commands-post.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
- name: Ensure additional Ceph commands are run
2+
- name: Ensure additional Ceph commands are run after post-deployment configuration
33
gather_facts: false
44
hosts: mons
55
become: true
@@ -9,3 +9,5 @@
99
tasks:
1010
- import_role:
1111
name: stackhpc.cephadm.commands
12+
vars:
13+
cephadm_commands: "{{ cephadm_commands_post }}"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
- name: Ensure additional Ceph commands are run before post-deployment configuration
3+
gather_facts: false
4+
hosts: mons
5+
become: true
6+
tags:
7+
- cephadm
8+
- cephadm-commands
9+
tasks:
10+
- import_role:
11+
name: stackhpc.cephadm.commands
12+
vars:
13+
cephadm_commands: "{{ cephadm_commands_pre }}"

etc/kayobe/ansible/cephadm.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
---
22
# Deploy Ceph via Cephadm. Create EC profiles, CRUSH rules, pools and keys.
33
- import_playbook: cephadm-deploy.yml
4-
- import_playbook: cephadm-commands.yml
4+
- import_playbook: cephadm-commands-pre.yml
55
- import_playbook: cephadm-ec-profiles.yml
66
- import_playbook: cephadm-crush-rules.yml
77
- import_playbook: cephadm-pools.yml
88
- import_playbook: cephadm-keys.yml
9+
- import_playbook: cephadm-commands-post.yml

etc/kayobe/cephadm.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,12 @@ cephadm_cluster_network: "{{ storage_mgmt_net_name | net_cidr }}"
6060
# List of Cephx keys. See stackhpc.cephadm.keys role for format.
6161
#cephadm_keys:
6262

63-
# A list of commands to pass to cephadm shell -- ceph. See stackhpc.cephadm.commands
64-
# for format.
65-
#cephadm_commands:
63+
# A list of commands to pass to cephadm shell -- ceph. See
64+
# stackhpc.cephadm.commands for format. Pre commands run before the rest of the
65+
# post-deployment configuration, post commands run after the rest of the
66+
# post-deployment configuration.
67+
#cephadm_commands_pre:
68+
#cephadm_commands_post:
6669

6770
###############################################################################
6871
# Kolla Ceph auto-configuration.

etc/kayobe/environments/ci-multinode/cephadm.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ cephadm_pools:
3535
- name: vms
3636
application: rbd
3737
state: present
38+
- name: cephfs_data
39+
application: cephfs
40+
state: "{{ 'present' if (kolla_enable_manila | bool and kolla_enable_manila_backend_cephfs_native | bool) else 'absent' }}"
41+
- name: cephfs_metadata
42+
application: cephfs
43+
state: "{{ 'present' if (kolla_enable_manila | bool and kolla_enable_manila_backend_cephfs_native | bool) else 'absent' }}"
3844

3945
# List of Cephx keys. See stackhpc.cephadm.keys role for format.
4046
cephadm_keys:
@@ -56,3 +62,16 @@ cephadm_keys:
5662
osd: "profile rbd pool=images"
5763
mgr: "profile rbd pool=images"
5864
state: present
65+
- name: client.manila
66+
caps:
67+
mon: "allow r"
68+
mgr: "allow rw"
69+
state: "{{ 'present' if (kolla_enable_manila | bool and kolla_enable_manila_backend_cephfs_native | bool) else 'absent' }}"
70+
71+
# List of Cephadm commands to run. See stackhpc.cephadm.commands role for format.
72+
cephadm_commands_pre: []
73+
74+
cephadm_commands_post: "{{ cephadm_commands_manila_cephfs_native if (kolla_enable_manila | bool and kolla_enable_manila_backend_cephfs_native | bool) else [] }}"
75+
cephadm_commands_manila_cephfs_native:
76+
- "fs new manila-cephfs cephfs_metadata cephfs_data"
77+
- "orch apply mds manila-cephfs"

etc/kayobe/environments/ci-multinode/inventory/group_vars/seed/network-interfaces

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ external_interface: "{{ vxlan_interfaces[0].device }}.{{ external_vlan }}"
1010

1111
public_interface: "{{ vxlan_interfaces[0].device }}.{{ public_vlan }}"
1212

13+
# The storage interface is required for routing manila traffic between VMs and
14+
# the Storage nodes.
15+
storage_interface: "{{ vxlan_interfaces[0].device }}.{{ storage_vlan }}"
16+
1317
###############################################################################
1418
# Dummy variable to allow Ansible to accept this file.
1519
workaround_ansible_issue_8743: yes

etc/kayobe/environments/ci-multinode/kolla.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ kolla_enable_cinder_backup: true
44
kolla_enable_neutron_provider_networks: true
55
kolla_enable_ovn: true
66
kolla_enable_octavia: true
7+
8+
# The multinode environment supports Manila but it is not enabled by default.
9+
# kolla_enable_manila: true
10+
# kolla_enable_manila_backend_cephfs_native: true

etc/kayobe/environments/ci-multinode/kolla/globals.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ es_heap_size: 1g
2222
octavia_auto_configure: "no"
2323
octavia_provider_drivers: "ovn:OVN provider"
2424
octavia_provider_agents: "ovn"
25+
26+
# Manila CephFS configuration
27+
manila_cephfs_filesystem_name: manila-cephfs

etc/kayobe/environments/ci-multinode/seed.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,29 @@ seed_bootstrap_user: "{{ os_distribution if os_distribution == 'ubuntu' else 'cl
33
seed_lvm_groups:
44
- "{{ stackhpc_lvm_group_rootvg }}"
55

6+
seed_extra_network_interfaces: >
7+
"{{ seed_extra_network_interfaces_external +
8+
(seed_extra_network_interfaces_manila if (kolla_enable_manila | bool and kolla_enable_manila_backend_cephfs_native | bool) else []) }}"
9+
610
# Seed has been provided an external interface
711
# for tempest tests and SSH access to machines.
8-
seed_extra_network_interfaces:
12+
seed_extra_network_interfaces_external:
913
- "external"
1014
- "public"
1115

16+
# Seed requires access to the storage network for manila-cephfs.
17+
seed_extra_network_interfaces_manila:
18+
- "storage"
19+
1220
# Enable IP routing and source NAT on the seed, allowing it to be used as the
1321
# external subnet gateway and provide internet access for VMs in the deployment.
1422
seed_enable_snat: true
23+
24+
snat_rules_default:
25+
- interface: "{{ ansible_facts.default_ipv4.interface }}"
26+
source_ip: "{{ ansible_facts.default_ipv4.address }}"
27+
snat_rules_manila:
28+
- interface: "{{ storage_interface }}"
29+
source_ip: "{{ ansible_facts[storage_interface].ipv4.address }}"
30+
# Only add the storage snat rule if we are using manila-cephfs.
31+
snat_rules: "{{ snat_rules_default + snat_rules_manila if (kolla_enable_manila | bool and kolla_enable_manila_backend_cephfs_native | bool) else snat_rules_default }}"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
features:
3+
- |
4+
Adds support for Manila in the ci-multinode environment using the CephFS
5+
native backend. This is disabled by default, but can be enabled by setting
6+
the following variables in the kayobe configuration:
7+
`kolla_enable_manila: true`
8+
`kolla_enable_manila_backend_cephfs_native: true`
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
features:
3+
- |
4+
Split `cephadm_commands` into `cephadm_commands_pre` and
5+
`cephadm_commands_post` commands. This allows the user to run commands that
6+
must be run before the rest of the post-deployment configuration, as well
7+
as commands that rely on resources created by the post-deployment config.
8+

0 commit comments

Comments
 (0)