Add cindercompatibleapi binary file
[stor4nfv.git] / tutorials / stor4nfv-only-scenario.md
1 ## 1. How to install an opensds local cluster
2 ### Pre-config (Ubuntu 16.04)
3 All the installation work is tested on `Ubuntu 16.04`, please make sure you have installed the right one. Also `root` user is suggested before the installation work starts.
4
5 * packages
6
7 Install following packages:
8 ```bash
9 apt-get install -y git curl wget
10 ```
11 * docker
12
13 Install docker:
14 ```bash
15 wget https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/docker-ce_18.03.1~ce-0~ubuntu_amd64.deb
16 dpkg -i docker-ce_18.03.1~ce-0~ubuntu_amd64.deb 
17 ```
18
19 ### Download opensds-installer code
20 ```bash
21 git clone https://gerrit.opnfv.org/gerrit/stor4nfv
22 cd stor4nfv/ci/ansible
23 ```
24
25 ### Install ansible tool
26 To install ansible, run the commands below:
27 ```bash
28 # This step is needed to upgrade ansible to version 2.4.2 which is required for the "include_tasks" ansible command.
29 chmod +x ./install_ansible.sh && ./install_ansible.sh
30 ansible --version # Ansible version 2.4.x is required.
31 ```
32
33 ### Configure opensds cluster variables:
34 ##### System environment:
35 If you want to integrate stor4nfv with k8s csi, please modify `nbp_plugin_type` to `csi` and also change `opensds_endpoint` field in `group_vars/common.yml`:
36 ```yaml
37 # 'hotpot_only' is the default integration way, but you can change it to 'csi'
38 # or 'flexvolume'
39 nbp_plugin_type: hotpot_only
40 # The IP (127.0.0.1) should be replaced with the opensds actual endpoint IP
41 opensds_endpoint: http://127.0.0.1:50040
42 ```
43
44 ##### LVM
45 If `lvm` is chosen as storage backend, modify `group_vars/osdsdock.yml`:
46 ```yaml
47 enabled_backend: lvm 
48 ```
49
50 Modify ```group_vars/lvm/lvm.yaml```, change `tgtBindIp` to your real host ip if needed:
51 ```yaml
52 tgtBindIp: 127.0.0.1 
53 ```
54
55 ##### Ceph
56 If `ceph` is chosen as storage backend, modify `group_vars/osdsdock.yml`:
57 ```yaml
58 enabled_backend: ceph # Change it according to the chosen backend. Supported backends include 'lvm', 'ceph', and 'cinder'.
59 ```
60
61 Configure ```group_vars/ceph/all.yml``` with an example below:
62 ```yml
63 ceph_origin: repository
64 ceph_repository: community
65 ceph_stable_release: luminous # Choose luminous as default version
66 public_network: "192.168.3.0/24" # Run 'ip -4 address' to check the ip address
67 cluster_network: "{{ public_network }}"
68 monitor_interface: eth1 # Change to the network interface on the target machine
69 devices: # For ceph devices, append ONE or MULTIPLE devices like the example below:
70   - '/dev/sda' # Ensure this device exists and available if ceph is chosen
71   #- '/dev/sdb'  # Ensure this device exists and available if ceph is chosen
72 osd_scenario: collocated
73 ```
74
75 ##### Cinder
76 If `cinder` is chosen as storage backend, modify `group_vars/osdsdock.yml`:
77 ```yaml
78 enabled_backend: cinder # Change it according to the chosen backend. Supported backends include 'lvm', 'ceph', and 'cinder'
79
80 # Use block-box install cinder_standalone if true, see details in:
81 use_cinder_standalone: true
82 ```
83
84 Configure the auth and pool options to access cinder in `group_vars/cinder/cinder.yaml`. Do not need to make additional configure changes if using cinder standalone.
85
86 ### Check if the hosts can be reached
87 ```bash
88 ansible all -m ping -i local.hosts
89 ```
90
91 ### Run opensds-ansible playbook to start deploy
92 ```bash
93 ansible-playbook site.yml -i local.hosts
94 ```
95
96 ## 2. How to test opensds cluster
97 ### OpenSDS CLI
98 Firstly configure opensds CLI tool:
99 ```bash
100 sudo cp /opt/opensds-linux-amd64/bin/osdsctl /usr/local/bin/
101 export OPENSDS_ENDPOINT=http://{your_real_host_ip}:50040
102 export OPENSDS_AUTH_STRATEGY=keystone
103 source /opt/stack/devstack/openrc admin admin
104
105 osdsctl pool list # Check if the pool resource is available
106 ```
107
108 Then create a default profile:
109 ```
110 osdsctl profile create '{"name": "default", "description": "default policy"}'
111 ```
112
113 Create a volume:
114 ```
115 osdsctl volume create 1 --name=test-001
116 ```
117
118 List all volumes:
119 ```
120 osdsctl volume list
121 ```
122
123 Delete the volume:
124 ```
125 osdsctl volume delete <your_volume_id>
126 ```
127
128 ### OpenSDS UI
129 OpenSDS UI dashboard is available at `http://{your_host_ip}:8088`, please login the dashboard using the default admin credentials: `admin/opensds@123`. Create tenant, user, and profiles as admin.
130
131 Logout of the dashboard as admin and login the dashboard again as a non-admin user to create volume, snapshot, expand volume, create volume from snapshot, create volume group.
132
133 ## 3. How to purge and clean opensds cluster
134
135 ### Run opensds-ansible playbook to clean the environment
136 ```bash
137 ansible-playbook clean.yml -i local.hosts
138 ```
139
140 ### Run ceph-ansible playbook to clean ceph cluster if ceph is deployed
141 ```bash
142 cd /opt/ceph-ansible
143 sudo ansible-playbook infrastructure-playbooks/purge-cluster.yml -i ceph.hosts
144 ```
145
146 In addition, clean up the logical partition on the physical block device used by ceph, using the ```fdisk``` tool.
147
148 ### Remove ceph-ansible source code (optional)
149 ```bash
150 sudo rm -rf /opt/ceph-ansible
151 ```