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