Friday, May 01, 2015

Set up Nova-Docker Driver on OpenStack RDO Kilo on CentOS 7.1

Posting bellow is targeting testing official version of Nova-Doker Driver for Openstack Kilo with development version RDO Kilo.  RDO Kilo installed via `packstack --allinone` on virtual CentOS 7.1
machine running at  Fedora 21 KVM Hypervisor. The only one package python-pip was rebuilt via Fedora Rawhide Repos and re installed on CentOS 7.1
to satisfy requirements for  successful build of Nova-Docker driver. Native  version of docker-io is 1.5 and supports  driver build as is.
Regarding details of pulling in docker images and uploading to glance, please,
view http://lxer.com/module/newswire/view/213505/index.html

*******************************************************
RDO Kilo Setup  ( packstack --allinone )
*******************************************************
# yum -y update
# reboot
# yum install -y https://rdoproject.org/repos/rdo-release.rpm
# yum install epel-release -y
# yum install openstack-packstack -y
# packstack --allinone
********************************************
Up on completion
*********************************************
[root@ip-192-169-142-57 ~(keystone_admin)]# openstack-status
== Nova services ==
openstack-nova-api:                     active
openstack-nova-cert:                    active
openstack-nova-compute:                 active
openstack-nova-network:                 inactive  (disabled on boot)
openstack-nova-scheduler:               active
openstack-nova-conductor:               active
== Glance services ==
openstack-glance-api:                   active
openstack-glance-registry:              active
== Keystone service ==
openstack-keystone:                     inactive  (disabled on boot)
== Horizon service ==
openstack-dashboard:                    active
== neutron services ==
neutron-server:                         active
neutron-dhcp-agent:                     active
neutron-l3-agent:                       active
neutron-metadata-agent:                 active
neutron-openvswitch-agent:              active
== Swift services ==
openstack-swift-proxy:                  active
openstack-swift-account:                active
openstack-swift-container:              active
openstack-swift-object:                 active
== Cinder services ==
openstack-cinder-api:                   active
openstack-cinder-scheduler:             active
openstack-cinder-volume:                active
openstack-cinder-backup:                active
== Ceilometer services ==
openstack-ceilometer-api:               active
openstack-ceilometer-central:           active
openstack-ceilometer-compute:           active
openstack-ceilometer-collector:         active
openstack-ceilometer-alarm-notifier:    active
openstack-ceilometer-alarm-evaluator:   active
openstack-ceilometer-notification:      active
== Support services ==
mysqld:                                 inactive  (disabled on boot)
libvirtd:                               active
openvswitch:                       active
dbus:                                   active
target:                                 active
rabbitmq-server:                  active
memcached:                        active
== Keystone users ==
/usr/lib/python2.7/site-packages/keystoneclient/shell.py:65: DeprecationWarning: The keystone CLI is deprecated in favor of python-openstackclient. For a Python library, continue using python-keystoneclient.
  'python-keystoneclient.', DeprecationWarning)
+----------------------------------+------------+---------+----------------------+
|                id                |    name    | enabled |        email         |
+----------------------------------+------------+---------+----------------------+
| 15fd020320e04795899e90ef05e0c517 |   admin    |   True  |    root@localhost    |
| 01bbee860d1948b4a5c2f31fd2814a65 | ceilometer |   True  | ceilometer@localhost |
| bd515474f34a41f0b54f5e08cf376e02 |   cinder   |   True  |   cinder@localhost   |
| 218f38165c0942c29ba906e2f2f614d5 |    demo    |   True  |                      |
| 74ac2e5e8e684eb19859a771878cae33 |   glance   |   True  |   glance@localhost   |
| c069118301e044529a7a0ccb329ce030 |  neutron   |   True  |  neutron@localhost   |
| d1da487693b847ba9b8177c41624106e |    nova    |   True  |    nova@localhost    |
| 35f8b107c96542eba4d0d630dc3cffc3 |   swift    |   True  |   swift@localhost    |
+----------------------------------+------------+---------+----------------------+
== Glance images ==
+--------------------------------------+---------------------------------+-------------+------------------+------------+--------+
| ID                                   | Name                            | Disk Format | Container Format | Size       | Status |
+--------------------------------------+---------------------------------+-------------+------------------+------------+--------+
| d19e4f3e-6c1c-4cfe-9c6c-8aab08eb31a3 | cirros                          | qcow2       | bare             | 13200896   | active |
| 853a2839-1d5e-4a54-9668-5a338d089ff7 | derby/docker-glassfish41:latest | raw         | docker           | 1104924160 | active |
| e9cfbc8e-153a-497c-a6bc-4868a6675b21 | rastasheep/ubuntu-sshd:14.04    | raw         | docker           | 264313856  | active |

+--------------------------------------+---------------------------------+-------------+------------------+------------+--------+
== Nova managed services ==
+----+------------------+---------------------------------------+----------+---------+-------+----------------------------+-----------------+
| Id | Binary           | Host                                  | Zone     | Status  | State | Updated_at                 | Disabled Reason |
+----+------------------+---------------------------------------+----------+---------+-------+----------------------------+-----------------+
| 1  | nova-consoleauth | ip-192-169-142-57.ip.secureserver.net | internal | enabled | up    | 2015-05-01T13:09:30.000000 | -               |
| 2  | nova-scheduler   | ip-192-169-142-57.ip.secureserver.net | internal | enabled | up    | 2015-05-01T13:09:30.000000 | -               |
| 3  | nova-conductor   | ip-192-169-142-57.ip.secureserver.net | internal | enabled | up    | 2015-05-01T13:09:31.000000 | -               |
| 4  | nova-compute     | ip-192-169-142-57.ip.secureserver.net | nova     | enabled | up    | 2015-05-01T13:09:24.000000 | -               |
| 5  | nova-cert        | ip-192-169-142-57.ip.secureserver.net | internal | enabled | up    | 2015-05-01T13:09:32.000000 | -               |
+----+------------------+---------------------------------------+----------+---------+-------+----------------------------+-----------------+
== Nova networks ==
+--------------------------------------+----------+------+
| ID                                   | Label    | Cidr |
+--------------------------------------+----------+------+
| 0228a0c8-0bcc-4a0f-8837-9454c696c337 | public   | -    |
| 8322038b-00a3-443c-8580-0f1d305891c4 | demo_net | -    |
+--------------------------------------+----------+------+
== Nova instance flavors ==
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name      | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| 1  | m1.tiny   | 512       | 1    | 0         |      | 1     | 1.0         | True      |
| 2  | m1.small  | 2048      | 20   | 0         |      | 1     | 1.0         | True      |
| 3  | m1.medium | 4096      | 40   | 0         |      | 2     | 1.0         | True      |
| 4  | m1.large  | 8192      | 80   | 0         |      | 4     | 1.0         | True      |
| 5  | m1.xlarge | 16384     | 160  | 0         |      | 8     | 1.0         | True      |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
== Nova instances ==
+----+------+--------+------------+-------------+----------+
| ID | Name | Status | Task State | Power State | Networks |
+----+------+--------+------------+-------------+----------+
+----+------+--------+------------+-------------+----------+

At this point we start tuning versions of CentOS 7.1 packages required for
successful build of Kilo Nova-Docker Driver

***************************************************************************
Download from Net  python-pip-6.0.8-1.fc23.src.rpm install and build
on CentOS 7.1
***************************************************************************
$ rpm -iv python-pip-6.0.8-1.fc23.src.rpm
$ cd
$ cd rpmbuild/SPEC
$ rpmbuild -bb ./python-pip.spec
$ cd ../RPMS/noarch
$ sudo yum install python-pip-6.0.8-1.el7.centos.noarch.rpm

*********************************************************************************
Make sure python-pip && python-pbr are installed on system with required versions for driver build
*********************************************************************************
$ rpm -qa | grep python-pbr
    python-pbr-0.10.8-1.el7.noarch
$ rpm -qa | grep python-pip
    python-pip-6.0.8-1.el7.centos.noarch

**********************************************
Install Nova-Docker driver
********************************************** 
# yum install docker-io -y
#
git clone http://github.com/stackforge/nova-docker.git

# cd nova-docker
# git checkout -b kilo origin/stable/kilo
# git branch -v -a
* kilo                           d556444 Do not enable swift/ceilometer/sahara
  master                         d556444 Do not enable swift/ceilometer/sahara
  remotes/origin/HEAD            -> origin/master
  remotes/origin/master          d556444 Do not enable swift/ceilometer/sahara
  remotes/origin/stable/icehouse 9045ca4 Fix lockpath for tests
  remotes/origin/stable/juno     b724e65 Fix tests on stable/juno
  remotes/origin/stable/kilo     d556444 Do not enable swift/ceilometer/sahara
 

# python setup.py install
# systemctl start docker
# systemctl enable docker
# chmod 666  /var/run/docker.sock
# mkdir /etc/nova/rootwrap.d


******************************
Update nova.conf
******************************
vi /etc/nova/nova.conf
set "compute_driver = novadocker.virt.docker.DockerDriver"

************************************************
Next, create the docker.filters file:
************************************************
$ vi /etc/nova/rootwrap.d/docker.filters

Insert Lines

# nova-rootwrap command filters for setting up network in the docker driver
# This file should be owned by (and only-writeable by) the root user
[Filters]
# nova/virt/docker/driver.py: 'ln', '-sf', '/var/run/netns/.*'
ln: CommandFilter, /bin/ln, root

*****************************************
Add line /etc/glance/glance-api.conf
*****************************************
container_formats=ami,ari,aki,bare,ovf,ova,docker
:wq

************************
Restart Services
************************
# systemctl restart openstack-nova-compute
# systemctl status openstack-nova-compute
# systemctl restart openstack-glance-api

*************************************************************
To get access to nova-docker set SELINUX to permissive
*************************************************************

# . keystonerc_demo 

# neutron security-group-rule-create --protocol icmp \
  --direction ingress --remote-ip-prefix 0.0.0.0/0 default

#  neutron security-group-rule-create --protocol tcp \
  --port-range-min 22 --port-range-max 22 \
  --direction ingress --remote-ip-prefix 0.0.0.0/0 default

# neutron security-group-rule-create --protocol tcp \
  --port-range-min 80 --port-range-max 80 \
  --direction ingress --remote-ip-prefix 0.0.0.0/0 default

****************************************
Uploading docker image to glance
****************************************
# . keystonerc_admin
#  docker pull rastasheep/ubuntu-sshd:14.04
#  docker save rastasheep/ubuntu-sshd:14.04 | glance image-create --is-public=True   --container-format=docker --disk-format=raw --name rastasheep/ubuntu-sshd:14.04

*************************************
Querying compute-nodes tables 
*************************************

     and proceed with uploading docker images and launching containers

  
  
 
   Upload docker image (pulled in) to glance as admin :-
 
 
  Launching NovaDocker container via uploaded wordpress image :-