| 1 |
This project provides the common logic and CLI tools for creating and managing |
| 2 |
LIO gateways for Ceph. |
| 3 |
|
| 4 |
It includes the ```rbd-target-api``` daemon which is responsible for restoring |
| 5 |
the state of LIO following a gateway reboot/outage and replaces the existing |
| 6 |
'target' service. |
| 7 |
|
| 8 |
It also includes the CLI tool ```gwcli``` which can be used to configure and |
| 9 |
manage the Ceph iSCSI gateway, which replaces the existing ```targetcli``` |
| 10 |
CLI tool. This CLI tool utilizes the ```rbd-target-api``` server daemon to |
| 11 |
configure multiple gateways concurrently. |
| 12 |
|
| 13 |
Here's an example of the shell interface the gwcli tool provides: |
| 14 |
|
| 15 |
[ceph-iscsi]$ gwcli ls |
| 16 |
o- / .................................................................................. [...] |
| 17 |
o- cluster .................................................................. [Clusters: 1] |
| 18 |
| o- ceph ..................................................................... [HEALTH_OK] |
| 19 |
| o- pools ................................................................... [Pools: 3] |
| 20 |
| | o- ec ........................................ [(2+1), Commit: 0b/40G (0%), Used: 0b] |
| 21 |
| | o- iscsi ..................................... [(x3), Commit: 0b/20G (0%), Used: 18b] |
| 22 |
| | o- rbd ....................................... [(x3), Commit: 8G/20G (40%), Used: 5K] |
| 23 |
| o- topology ......................................................... [OSDs: 3,MONs: 3] |
| 24 |
o- disks ................................................................... [8G, Disks: 5] |
| 25 |
| o- rbd ....................................................................... [rbd (8G)] |
| 26 |
| o- disk_1 ............................................................... [disk_1 (1G)] |
| 27 |
| o- disk_2 ............................................................... [disk_2 (2G)] |
| 28 |
| o- disk_3 ............................................................... [disk_3 (2G)] |
| 29 |
| o- disk_4 ............................................................... [disk_4 (1G)] |
| 30 |
| o- disk_5 ............................................................... [disk_5 (2G)] |
| 31 |
o- iscsi-targets ............................................................. [Targets: 1] |
| 32 |
o- iqn.2003-01.com.redhat.iscsi-gw:ceph-gw1 ................... [Auth: CHAP, Gateways: 2] |
| 33 |
| o- disks ................................................................... [Disks: 1] |
| 34 |
| | o- rbd/disk_1 .............................................. [Owner: rh7-gw2, Lun: 0] |
| 35 |
| o- gateways ..................................................... [Up: 2/2, Portals: 2] |
| 36 |
| | o- rh7-gw1 .................................................... [192.168.122.69 (UP)] |
| 37 |
| | o- rh7-gw2 .................................................... [192.168.122.14 (UP)] |
| 38 |
o- host-groups ........................................................... [Groups : 0] |
| 39 |
o- hosts ................................................ [Auth: ACL_ENABLED, Hosts: 1] |
| 40 |
| o- iqn.1994-05.com.redhat:rh7-client .......... [LOGGED-IN, Auth: CHAP, Disks: 1(2G)] |
| 41 |
| o- lun 0 ......................................... [rbd.disk_1(2G), Owner: rh7-gw2] |
| 42 |
o- iqn.2003-01.com.redhat.iscsi-gw:ceph-gw2 ................... [Auth: None, Gateways: 2] |
| 43 |
o- disks ................................................................... [Disks: 1] |
| 44 |
| o- rbd/disk_2 .............................................. [Owner: rh7-gw1, Lun: 0] |
| 45 |
o- gateways ..................................................... [Up: 2/2, Portals: 2] |
| 46 |
| o- rh7-gw1 ................................................... [2006:ac81::1103 (UP)] |
| 47 |
| o- rh7-gw2 ................................................... [2006:ac81::1104 (UP)] |
| 48 |
o- host-groups ........................................................... [Groups : 0] |
| 49 |
o- hosts ................................................ [Auth: ACL_ENABLED, Hosts: 1] |
| 50 |
o- iqn.1994-05.com.redhat:rh7-client .......... [LOGGED-IN, Auth: None, Disks: 1(2G)] |
| 51 |
o- lun 0 ......................................... [rbd.disk_2(2G), Owner: rh7-gw1] |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
The rbd-target-api daemon utilises the flask's internal development server to |
| 56 |
provide the REST api. It is normally not used in a production context, but |
| 57 |
given this specific use case it provides a simple way to provide an admin |
| 58 |
interface - at least for the first release! |
| 59 |
|
| 60 |
The API has been tested with Firefox RESTclient add-on with https (based on a common |
| 61 |
self-signed certificate). With the certificate in place on each gateway you can |
| 62 |
add basic auth credentials to match the local api configuration in the RESTclient |
| 63 |
and use the client as follows; |
| 64 |
|
| 65 |
Add a Header content type for application/x-www-form-urlencoded |
| 66 |
METHOD: PUT URL: https://192.168.122.69:5000/api/gateway/iqn.2003-01.com.redhat.iscsi-gw:ceph-gw1/rh7-gw1 |
| 67 |
select the urlencoded content type and the basic auth credentials |
| 68 |
add the required variables to the body section in the client ui |
| 69 |
eg. ip_address=192.168.122.69 |
| 70 |
Click 'SEND' |
| 71 |
|
| 72 |
|
| 73 |
Curl Examples: |
| 74 |
If the UI is not your thing, curl probably is! Here's an example of using |
| 75 |
curl to create a gateway node. |
| 76 |
|
| 77 |
curl --user admin:admin -d ip_address=192.168.122.14 \ |
| 78 |
-X PUT http://192.168.122.14:5000/api/gateway/iqn.2003-01.com.redhat.iscsi-gw:ceph-gw1/rh7-gw2 |
| 79 |
|
| 80 |
IPv6 Support: |
| 81 |
Make sure the IPv6 addresses used are global unicast ones, and then the |
| 82 |
URL link could be: |
| 83 |
|
| 84 |
curl --user admin:admin -d ip_address=2006:ac81::1104 \ |
| 85 |
-X PUT http://[2006:ac81::1104]:5000/api/gateway/iqn.2003-01.com.redhat.iscsi-gw:ceph-gw2/rh7-gw2 |
| 86 |
|
| 87 |
And mixing the IPv4 and IPv6 addresses is also allowed as below: |
| 88 |
|
| 89 |
curl --user admin:admin -d ip_address=192.168.122.14 \ |
| 90 |
-X PUT http://[2006:ac81::1104]:5000/api/gateway/iqn.2003-01.com.redhat.iscsi-gw:ceph-gw1/rh7-gw2 |
| 91 |
|
| 92 |
curl --user admin:admin -d ip_address=2006:ac81::1104 \ |
| 93 |
-X PUT http://192.168.122.14:5000/api/gateway/iqn.2003-01.com.redhat.iscsi-gw:ceph-gw2/rh7-gw2 |
| 94 |
|
| 95 |
NOTE: please make sure both the IPv4 and IPv6 addresses are in the trusted |
| 96 |
ip list in iscsi-gateway.cfg. |
| 97 |
|
| 98 |
|
| 99 |
## Installation |
| 100 |
### Via RPM |
| 101 |
Simply install the provided rpm with |
| 102 |
```rpm -ivh ceph-iscsi-<ver>.el7.noarch.rpm``` |
| 103 |
|
| 104 |
### Manually |
| 105 |
|
| 106 |
The following packages are required by ceph-iscsi and must be |
| 107 |
installed before starting the rbd-target-api service: |
| 108 |
|
| 109 |
python-requests |
| 110 |
python-flask |
| 111 |
python-rados |
| 112 |
python-rbd |
| 113 |
python-netifaces |
| 114 |
python-rtslib |
| 115 |
python-configshell |
| 116 |
python-cryptography |
| 117 |
python-flask |
| 118 |
pyOpenSSL |
| 119 |
|
| 120 |
To install the python package that provides the application logic, run the provided setup.py script |
| 121 |
i.e. ```> python setup.py install``` |
| 122 |
|
| 123 |
For the management daemon (rbd-target-api), simply copy the following files into their equivalent places on each gateway |
| 124 |
- <archive_root>/usr/lib/systemd/system/rbd-target-gw.service --> /lib/systemd/system |
| 125 |
- <archive_root>/usr/lib/systemd/system/rbd-target-api.service --> /lib/systemd/system |
| 126 |
- <archive_root>/usr/bin/rbd-target-gw --> /usr/bin |
| 127 |
- <archive_root>/usr/bin/rbd-target-api --> /usr/bin |
| 128 |
- <archive_root>/usr/bin/gwcli --> /usr/bin |
| 129 |
|
| 130 |
## Configuration |
| 131 |
|
| 132 |
Once the package is in installed, the Ceph ceph-iscsi instructions found |
| 133 |
here: |
| 134 |
|
| 135 |
http://docs.ceph.com/docs/master/rbd/iscsi-target-cli/ |
| 136 |
|
| 137 |
can be used to create a iscsi-gateway.cfg and create a target. |