Skip to content

Instantly share code, notes, and snippets.

@liveaverage
Last active June 11, 2019 20:14
Show Gist options
  • Save liveaverage/5195dc545a181fc6cc3ea02cb1dec328 to your computer and use it in GitHub Desktop.
Save liveaverage/5195dc545a181fc6cc3ea02cb1dec328 to your computer and use it in GitHub Desktop.
Ceph Working Session
#####
# Eval Ceph iscsigw boot
#####
### Prereq download/import:
cd /tmp
wget http://mirror.atlantic.net/centos/7/os/x86_64/isolinux/initrd.img
wget http://mirror.atlantic.net/centos/7/os/x86_64/isolinux/vmlinuz
wget https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-1503.raw.xz
xz -d CentOS-7-x86_64-GenericCloud-1503.raw.xz
fdisk -l CentOS-7-x86_64-GenericCloud-1503.raw # This should at least show a single partition, which we'll reference later
ceph osd pool create test 8
rbd import CentOS-7-x86_64-GenericCloud-1503.raw centos7 --pool test
### iSCSI config:
gwcli
/> ls /
/> cd /disks
/disk> create image=centos7 pool=test size=10g
/disk> cd /iscsi-target/iqn.2003-01.com.redhat.iscsi-gw:ceph-igw/hosts
/iscsi-target...eph-igw/hosts> create client_iqn=iqn.1994-05.com.redhat:centos-10g
/iscsi-target...hat:centos-10g> auth chap=usernumber1/userpassword1
/iscsi-target...hat:centos-10g> disk add volumes.centos-10g
### KVM/QEMU config (https://github.com/liveaverage/sosp-ceph/blob/master/sample-virsh-vm.xml#L12-L14)
...
<os>
<type arch='x86_64' machine='pc-i440fx-rhel7.4.0'>hvm</type>
<kernel>/tmp/vmlinuz</kernel>
<initrd>/tmp/initrd.img</initrd>
<cmdline>ip=dhcp iscsi_username=usernumber1 iscsi_password=userpassword1 root=/dev/disk/by-path/ip-192.168.1.105:3260-iscsi-iqn.2003-01.com.redhat.iscsi-gw:ceph-igw-lun-0-part1 ro netroot=iscsi:192.168.1.105::::iqn.2003-01.com.redhat.iscsi-gw:ceph-igw rd.iscsi.initiator=iqn.1994-05.com.redhat:centos-10g</cmdline>
<boot dev='network'/>
</os>
...
...
<interface type='network'>
<mac address='52:54:00:e1:7d:66'/>
<source network='default' bridge='virbr0'/>
<target dev='vnet0'/>
<model type='virtio'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
...
#### Standard gwcli output
[root@ceph1 ~]# gwcli
/iscsi-target...hat:cirros-1g> cd /
/> ls
o- / ......................................................................................... [...]
o- clusters ........................................................................ [Clusters: 1]
| o- ceph .......................................................................... [HEALTH_WARN]
| o- pools .......................................................................... [Pools: 3]
| | o- rbd .................................... [(x3), Commit: 0.00Y/2849076K (0%), Used: 2781b]
| | o- test ..................................... [(x3), Commit: 0.00Y/2849076K (0%), Used: 32b]
| | o- volumes ........................... [(x3), Commit: 9G/2849076K (331%), Used: 1010070149b]
| o- topology ................................................................ [OSDs: 3,MONs: 3]
o- disks .......................................................................... [9G, Disks: 1]
| o- volumes.c7 ........................................................................ [c7 (9G)]
o- iscsi-target ..................................................................... [Targets: 1]
o- iqn.2003-01.com.redhat.iscsi-gw:ceph-igw ...................................... [Gateways: 3]
o- gateways ............................................................ [Up: 3/3, Portals: 3]
| o- ceph1 .............................................................. [192.168.1.122 (UP)]
| o- ceph2 .............................................................. [192.168.1.238 (UP)]
| o- ceph3 .............................................................. [192.168.1.105 (UP)]
o- host-groups .................................................................. [Groups : 0]
o- hosts .............................................................. [Hosts: 1: Auth: CHAP]
o- iqn.1994-05.com.redhat:cirros-1g ............................. [Auth: CHAP, Disks: 1(9G)]
o- lun 0 .................................................. [volumes.c7(9G), Owner: ceph1]
/> exit
#######
# This is seed configuration used by the ceph_iscsi_config modules
# when handling configuration tasks for iscsi gateway(s)
#
# Please do not change this file directly since it is managed by Ansible and will be overwritten
[config]
cluster_name = ceph
gateway_keyring = ceph.client.admin.keyring
# API settings.
# The API supports a number of options that allow you to tailor it to your
# local environment. If you want to run the API under https, you will need to
# create cert/key files that are compatible for each iSCSI gateway node, that is
# not locked to a specific node. SSL cert and key files *must* be called
# 'iscsi-gateway.crt' and 'iscsi-gateway.key' and placed in the '/etc/ceph/' directory
# on *each* gateway node. With the SSL files in place, you can use 'api_secure = true'
# to switch to https mode.
# To support the API, the bear minimum settings are:
api_secure = False
# Optional settings related to the CLI/API service
api_user = admin
api_password = admin
api_port = 5000
loop_delay = 1
trusted_ip_list = 192.168.122.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment