<commit_before># RBDSR - XenServer Storage Manager plugin for CEPH
This plugin adds support of Ceph block devices into XenServer.
It supports creation of VDI as RBD device in Ceph pool. 
It uses Ceph snapshots and clones to handle VDI snapshots. It also supports Xapi Storage Migration (XSM).

## Installation 

This plugin uses **rbd**, **rbd-nbd** add **rbd-fuse** utilities for manipulating RBD devices, so you need to install ceph-common, rbd-nbd and rbd-fuse packages from ceph repository on your XenServer hosts.

1. Make backup copy of ```CentOS-Base.repo``` and ```Citrix.repo```
 
		# cd /etc/yum.repos.d/
		# cp CentOS-Base.repo CentOS-Base.repo.orig
		# cp Citrix.repo Citrix.repo.orig

2. Make these changes in ```CentOS-Base.repo```

	In ```[base]``` section

	comment out the line
	
		baseurl=http://www.uk.xensource.com/linux/distros/CentOS/7.0.1406/os/x86_64/

	uncomment the line
	
		#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/

	In ```[updates]``` section

	comment out the line

		baseurl=http://www.uk.xensource.com/linux/distros/CentOS/7.0.1406/updates-20140901/x86_64/

	uncomment the line

		#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/

	In ```[extras]``` section

	comment out the line

		baseurl=http://www.uk.xensource.com/linux/distros/CentOS/7.0.1406/extras-20140902/x86_64/

	uncomment the line

		#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/

	replace ```$releasever``` in uncommented lines with 7.2.1511

3. Disable Citrix.repo

		[citrix]
		enabled=0

4. Create ```ceph.repo``` file and put in it next lines:

		[ceph]
		name=Ceph packages for $basearch
		baseurl=http://download.ceph.com/rpm-infernalis/el7/$basearch
		enabled=1
		priority=2
		gpgcheck=1
		type=rpm-md
		gpgkey=https://download.ceph.com/keys/release.asc
		
		[ceph-noarch]
		name=Ceph noarch packages
		baseurl=http://download.ceph.com/rpm-infernalis/el7/noarch
		enabled=1
		priority=2
		gpgcheck=1
		type=rpm-md
		gpgkey=https://download.ceph.com/keys/release.asc
		
		[ceph-source]
		name=Ceph source packages
		baseurl=http://download.ceph.com/rpm-infernalis/el7/SRPMS
		enabled=0
		priority=2
		gpgcheck=1
		type=rpm-md
		gpgkey=https://download.ceph.com/keys/release.asc

	I use Infernalis release but you can use other.
	If so then you should change the ```baseurl``` lines in ceph.repo accordingly your release

5. Install ```the release.asc``` key:

		# rpm --import 'https://download.ceph.com/keys/release.asc'

6. Install required packages:

		# yum install epel-release	
		# yum install yum-plugin-priorities.noarch
		# yum install snappy leveldb gdisk python-argparse gperftools-libs
		# yum install fuse fuse-libs
		# yum install ceph-common rbd-fuse rbd-nbd

7. Restore backup copy of ```CentOS-Base.repo``` and ```Citrix.repo```

		# cp CentOS-Base.repo.orig CentOS-Base.repo
		# cp Citrix.repo.orig Citrix.repo

8. Disable ```epel.repo```

		[epel]
		enabled=0
	
		[epel-debuginfo]
		enabled=0
	
		[epel-source]
		enabled=0

9. Disable ceph.repo

		[ceph]
		enabled=0
	
		[ceph-noarch]
		enabled=0
	
		[ceph-source]
		enabled=0

10. Put the ```waitdmmerging.sh``` into ```/usr/bin/``` and change permission: 

		# chmod 755 /usr/bin/waitdmmerging.sh

11. Put the ```RBDSR.py``` and ```cephutils.py``` into  ```/opt/xensource/sm``` and compile them:

		# python -m compileall RBDSR.py
		# python -O -m compileall RBDSR.py
		# python -m compileall cephutils.py
		# python -O -m compileall cephutils.py

12. Make softlink to ```RBDSR.py``` in ```/opt/xensource/sm```
	
		# ln -s RBDSR.py RBDSR 


13. Add RBDSR plugin to whitelist of SM plugins in ```/etc/xapi.conf```

		# Whitelist of SM plugins
		sm-plugins= rbd cifs ext nfs iscsi lvmoiscsi dummy file hba rawhba udev iso lvm lvmohba lvmofcoe

14. Create ```/etc/ceph/ceph.conf``` accordingly you Ceph cluster. The easiest way is just copy it from your Ceph cluster node

15. Copy ```/etc/ceph/ceph.client.admin.keyring``` to XenServer hosts from your Ceph cluster node. 

16. Restart XAPI tool-stack on XenServer hosts

		# xe-toolstack-restart 


## Usage

1. Create a pool on your Ceph cluster to store VDI images (should be executed on Ceph cluster node):

		# uuidgen
		4ceb0f8a-1539-40a4-bee2-450a025b04e1
<commit_msg>Update docs to reflect changes about ceph_plugin.py<commit_after># RBDSR - XenServer Storage Manager plugin for CEPH
This plugin adds support of Ceph block devices into XenServer.
It supports creation of VDI as RBD device in Ceph pool. 
It uses Ceph snapshots and clones to handle VDI snapshots. It also supports Xapi Storage Migration (XSM).

## Installation 

This plugin uses **rbd**, **rbd-nbd** add **rbd-fuse** utilities for manipulating RBD devices, so you need to install ceph-common, rbd-nbd and rbd-fuse packages from ceph repository on your XenServer hosts.

1. Make backup copy of ```CentOS-Base.repo``` and ```Citrix.repo```
 
		# cd /etc/yum.repos.d/
		# cp CentOS-Base.repo CentOS-Base.repo.orig
		# cp Citrix.repo Citrix.repo.orig

2. Make these changes in ```CentOS-Base.repo```

	In ```[base]``` section

	comment out the line
	
		baseurl=http://www.uk.xensource.com/linux/distros/CentOS/7.0.1406/os/x86_64/

	uncomment the line
	
		#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/

	In ```[updates]``` section

	comment out the line

		baseurl=http://www.uk.xensource.com/linux/distros/CentOS/7.0.1406/updates-20140901/x86_64/

	uncomment the line

		#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/

	In ```[extras]``` section

	comment out the line

		baseurl=http://www.uk.xensource.com/linux/distros/CentOS/7.0.1406/extras-20140902/x86_64/

	uncomment the line

		#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/

	replace ```$releasever``` in uncommented lines with 7.2.1511

3. Disable Citrix.repo

		[citrix]
		enabled=0

4. Create ```ceph.repo``` file and put in it next lines:

		[ceph]
		name=Ceph packages for $basearch
		baseurl=http://download.ceph.com/rpm-infernalis/el7/$basearch
		enabled=1
		priority=2
		gpgcheck=1
		type=rpm-md
		gpgkey=https://download.ceph.com/keys/release.asc
		
		[ceph-noarch]
		name=Ceph noarch packages
		baseurl=http://download.ceph.com/rpm-infernalis/el7/noarch
		enabled=1
		priority=2
		gpgcheck=1
		type=rpm-md
		gpgkey=https://download.ceph.com/keys/release.asc
		
		[ceph-source]
		name=Ceph source packages
		baseurl=http://download.ceph.com/rpm-infernalis/el7/SRPMS
		enabled=0
		priority=2
		gpgcheck=1
		type=rpm-md
		gpgkey=https://download.ceph.com/keys/release.asc

	I use Infernalis release but you can use other.
	If so then you should change the ```baseurl``` lines in ceph.repo accordingly your release

5. Install ```the release.asc``` key:

		# rpm --import 'https://download.ceph.com/keys/release.asc'

6. Install required packages:

		# yum install epel-release	
		# yum install yum-plugin-priorities.noarch
		# yum install snappy leveldb gdisk python-argparse gperftools-libs
		# yum install fuse fuse-libs
		# yum install ceph-common rbd-fuse rbd-nbd

7. Restore backup copy of ```CentOS-Base.repo``` and ```Citrix.repo```

		# cp CentOS-Base.repo.orig CentOS-Base.repo
		# cp Citrix.repo.orig Citrix.repo

8. Disable ```epel.repo```

		[epel]
		enabled=0
	
		[epel-debuginfo]
		enabled=0
	
		[epel-source]
		enabled=0

9. Disable ceph.repo

		[ceph]
		enabled=0
	
		[ceph-noarch]
		enabled=0
	
		[ceph-source]
		enabled=0

10. Put the ```waitdmmerging.sh``` into ```/usr/bin/``` and change permission: 

		# cp waitdmmerging.sh /usr/bin
		# chmod 755 /usr/bin/waitdmmerging.sh

11. Copy ```ceph_plugin.py``` to ```/etc/xapi.d/plugins``` and rename it to ```ceph_plugin``` 

		# cp ceph_plugin.py /etc/xapi.d/plugins/ceph_plugin

12. Set execute permissions on all python scripts

		# chmod +x *.py
		
13. Put the ```RBDSR.py``` and ```cephutils.py``` into  ```/opt/xensource/sm``` and compile them:

		# cp cephutils.py RBDSR.py /opt/xensource/sm
		# cd /opt/xensource/sm
		# python -m compileall RBDSR.py
		# python -O -m compileall RBDSR.py
		# python -m compileall cephutils.py
		# python -O -m compileall cephutils.py

14. Make softlink to ```RBDSR.py``` in ```/opt/xensource/sm```
	
		# ln -s RBDSR.py RBDSR 


14. Add RBDSR plugin to whitelist of SM plugins in ```/etc/xapi.conf```

		# Whitelist of SM plugins
		sm-plugins= rbd cifs ext nfs iscsi lvmoiscsi dummy file hba rawhba udev iso lvm lvmohba lvmofcoe

15. Create ```/etc/ceph/ceph.conf``` accordingly you Ceph cluster. The easiest way is just copy it from your Ceph cluster node

16. Copy ```/etc/ceph/ceph.client.admin.keyring``` to XenServer hosts from your Ceph cluster node. 

17. Restart XAPI tool-stack on XenServer hosts

		# xe-toolstack-restart 


## Usage

1. Create a pool on your Ceph cluster to store VDI images (should be executed on Ceph cluster node):

		# uuidgen
		4ceb0f8a-1539-40a4-bee2-450a025b04e1

{'fraction_non_alphanumeric': 0.12724618149146452, 'fraction_numerical': 0.026954177897574125, 'mean_word_length': 3.585478887744593, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7498616', 'n_tokens_mistral': 3704, 'n_tokens_neox': 3302, 'n_words': 877}