<commit_before>COPRHD Flocker Plugin
======================
The plugin for COPRHD Flocker integration.

## COPRHD Flocker Intergration Block Diagram
 ![alt text]( CoprHD-Flocker.png "CoprHD-Flocker")


verfied versions
CoprHD - 2.4.1
Ubuntu  14.04.03  LTS 
Flocker  1.12.0
Docker  1.11.2 - build b9f10c9


## Installation
---------------
- Install CoprHD 2.4.1, please refer below links to download,build and setup CoprHD.
    https://coprhd.atlassian.net/wiki/display/COP/How+to+Build+and+Run+CoprHD 
    https://coprhd.atlassian.net/wiki/display/COP/How+to+download+and+build+CoprHD 

- once you are able to install and login to CoprHD. you should discover storage systems, create virtual arrays and virtual pools. Below you can see screenshots.

	![alt text]( ViprStorageSystems.png "Storage Arrays")
    
       b. Configure Virtual array 

	![alt text]( ViprVirtualArrays.png "Virtual Arrays")

      c. Configure Virtual Pools - In Virtual pools policies are configured 

	![alt text]( ViprVirtualPools.png "Virtual Pools")


- Install OpeniSCSI 

    * Ubuntu<br>
    ```bash
    sudo apt-get update
    sudo apt-get install -y open-iscsi
    sudo apt-get install -y lsscsi
    sudo apt-get -y install scsitools
    ```
    * Centos<br>
    ```bash
    sudo yum -y install iscsi-initiator-utils
    sudo yum -y install lsscsi
    sudo yum -y install sg3_utils
    ```
	
- Discover iSCSI of storage array<br>
   ```bash
    sudo iscsiadm -m discovery -t st -p {ipaddress of storage array iscsi port}
	```
- Login iSCSI data port<br>
   ```bash
   scsiadm -m node  -p ${ipaddress of storage array iscsi portal} --login
   ```
   
- Install ClusterHQ/Flocker
Refer to ubuntu install notes -> https://docs.clusterhq.com/en/0.4.0/

- Install CoprHD Flocker Plugin 
	```bash
	git clone https://review.coprhd.org/scm/ce/flocker-driver.git
	cd flocker-driver/
	sudo /opt/flocker/bin/python setup.py install
	```

- Install CoprHD-cli 2.3 or above
   ```bash
   Refer section "Install the ViPR Controller CLI on Linux" in the given below link
   http://www.emc.com/collateral/TechnicalDocument/docu62079.pdf
   ```
   
## Usage Instructions
To start the plugin on a node, a configuration file must exist on the node at /etc/flocker/agent.yml.
```bash
control-service: {hostname: ${ipaddress}, port: ${port}}
dataset: {backend: coprhd_flocker_plugin}
version: 1
dataset:
    backend: coprhd_flocker_plugin
    coprhdhost: ${coprhd_hostname}
    port: ${coprhd_port}
    tenant: ${coprhd-tenant}
    project: ${coprhd-project}
    varray: ${coprhd-varray}
    cookiedir: ${cookiedir}
    vpool: ${vpool}
    vpool_gold: ${vpool_gold}
    vpool_silver: ${vpool_silver}
    vpool_bronze: ${vpool_bronze}
	vpool_platinum: ${vpool_platinum}
	hostexportgroup: ${ipaddress of flocker agent host}
	coprhdcli_security_file: ${coprhdcli_security_file}
```

The below test case have been tested 

1. Using docker start a application and provision a volume on demand
2. Using docker move a application from one node to another node with persistent storage 

Docker commands are below 

docker run -v <volume-name>:/data --volume-driver=<driver-name> -ti busybox sh

Debug: 

	The log files are /var/log/flocker  

When docker starts host will get created on Vipr 

![alt text]( ViprExportGroups.png "Storage Arrays")

In Vipr when storage is getting provisioned the same will get refrected in the vipr Dashboard in the task list


10. Generating & using security file
=========================================
pre-requisites easy_install pycrypto

* use the file encrypt_password.py in util folder to generate a
  security file, which has the username and password in an encrypted form.

* Usage of encrypt_password.py:
```
   python encrypt_password.py -user <vipruser> -password <<PASSWORD>>
            -securityfile <complete filepath where encrypted security is stored><commit_msg>corrected spelling mistake<commit_after>COPRHD Flocker Plugin
======================
The plugin for COPRHD Flocker integration.

## COPRHD Flocker Intergration Block Diagram
 ![alt text]( CoprHD-Flocker.png "CoprHD-Flocker")


verfied versions
CoprHD - 2.4.1
Ubuntu  14.04.03  LTS 
Flocker  1.12.0
Docker  1.11.2 - build b9f10c9


## Installation
---------------
- Install CoprHD 2.4.1, please refer below links to download,build and setup CoprHD.
    https://coprhd.atlassian.net/wiki/display/COP/How+to+Build+and+Run+CoprHD 
    https://coprhd.atlassian.net/wiki/display/COP/How+to+download+and+build+CoprHD 

- once you are able to install and login to CoprHD. you should discover storage systems, create virtual arrays and virtual pools. Below you can see screenshots.

	![alt text]( ViprStorageSystems.png "Storage Arrays")
    
       b. Configure Virtual array 

	![alt text]( ViprVirtualArrays.png "Virtual Arrays")

      c. Configure Virtual Pools - In Virtual pools policies are configured 

	![alt text]( ViprVirtualPools.png "Virtual Pools")


- Install OpeniSCSI 

    * Ubuntu<br>
    ```bash
    sudo apt-get update
    sudo apt-get install -y open-iscsi
    sudo apt-get install -y lsscsi
    sudo apt-get -y install scsitools
    ```
    * Centos<br>
    ```bash
    sudo yum -y install iscsi-initiator-utils
    sudo yum -y install lsscsi
    sudo yum -y install sg3_utils
    ```
	
- Discover iSCSI of storage array<br>
   ```bash
    sudo iscsiadm -m discovery -t st -p {ipaddress of storage array iscsi port}
	```
- Login iSCSI data port<br>
   ```bash
   scsiadm -m node  -p ${ipaddress of storage array iscsi portal} --login
   ```
   
- Install ClusterHQ/Flocker
Refer to ubuntu install notes -> https://docs.clusterhq.com/en/0.4.0/

- Install CoprHD Flocker Plugin 
	```bash
	git clone https://review.coprhd.org/scm/ce/flocker-driver.git
	cd flocker-driver/
	sudo /opt/flocker/bin/python setup.py install
	```

- Install CoprHD-cli 2.3 or above
   ```bash
   Refer section "Install the ViPR Controller CLI on Linux" in the given below link
   http://www.emc.com/collateral/TechnicalDocument/docu62079.pdf
   ```
   
## Usage Instructions
To start the plugin on a node, a configuration file must exist on the node at /etc/flocker/agent.yml.
```bash
control-service: {hostname: ${ipaddress}, port: ${port}}
dataset: {backend: coprhd_flocker_plugin}
version: 1
dataset:
    backend: coprhd_flocker_plugin
    coprhdhost: ${coprhd_hostname}
    port: ${coprhd_port}
    tenant: ${coprhd-tenant}
    project: ${coprhd-project}
    varray: ${coprhd-varray}
    cookiedir: ${cookiedir}
    vpool: ${vpool}
    vpool_gold: ${vpool_gold}
    vpool_silver: ${vpool_silver}
    vpool_bronze: ${vpool_bronze}
	vpool_platinum: ${vpool_platinum}
	hostexportgroup: ${ipaddress of flocker agent host}
	coprhdcli_security_file: ${coprhdcli_security_file}
```

The below test case have been tested 

1. Using docker start a application and provision a volume on demand
2. Using docker move a application from one node to another node with persistent storage 

Docker commands are below 

docker run -v <volume-name>:/data --volume-driver=<driver-name> -ti busybox sh

Debug: 

	The log files are /var/log/flocker  

When docker starts host will get created on Vipr 

![alt text]( ViprExportGroups.png "Storage Arrays")

In Vipr when storage is getting provisioned the same will get reflected in the vipr Dashboard in the task list


10. Generating & using security file
=========================================
pre-requisites easy_install pycrypto

* use the file encrypt_password.py in util folder to generate a
  security file, which has the username and password in an encrypted form.

* Usage of encrypt_password.py:
```
   python encrypt_password.py -user <vipruser> -password <<PASSWORD>>
            -securityfile <complete filepath where encrypted security is stored>
{'fraction_non_alphanumeric': 0.1119277885235332, 'fraction_numerical': 0.010315925209542231, 'mean_word_length': 3.63044776119403, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 25, 'https://': 8, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7402008', 'n_tokens_mistral': 2697, 'n_tokens_neox': 2488, 'n_words': 829}