Monday, May 23, 2016

Backport upstream commits to stable RDO Mitaka release && Deployments with Keystone API V3

Posting bellow is written  with intend to avoid waiting until "koji" build will appear in updates repo of stable RDO Mitaka release, what might take a couple of months or so. Actually, it doesn't require knowledge how to write properly source RH's rpm file. It just needs picking up raw content of git commits from upstream git repo converting them into patches and rebuild required src.rpm(s) with patch(es) needed. There is also not commonly known command `rpm -qf` which is very useful when you need to detect which rpm has installed particular file. Just to know which src.rpm should be downloaded for git commit referencing
say "cinder.rb"

[root@ServerCentOS72 /]# find . -name cinder.rb -print
find: ‘./run/user/1000/gvfs’: Permission denied
./usr/share/openstack-puppet/modules/cinder/lib/puppet/provider/cinder.rb

[root@ServerCentOS72 /]# rpm -qf /usr/share/openstack-puppet/modules/cinder/lib/puppet/provider/cinder.rb
openstack-puppet-modules-8.0.4-2.el7.centos.noarch

*******************************
Thus download from
*******************************

1. https://cbs.centos.org/koji/buildinfo?buildID=10895
openstack-packstack-8.0.0-1.el7.src.rpm 
2. https://cbs.centos.org/koji/buildinfo?buildID=10859
openstack-puppet-modules-8.0.4-1.el7.src.rpm


[boris@ServerCentOS72 Downloads]$ ls -l
total 3116
-rw-rw-r--. 1 boris boris  170107 May 21 21:26 openstack-packstack-8.0.0-1.el7.src.rpm
-rw-rw-r--. 1 boris boris 3015046 May 21 18:33 openstack-puppet-modules-8.0.4-1.el7.src.rpm

****************
Then run :-
****************

$ rpm -iv openstack-packstack-8.0.0-1.el7.src.rpm
$ rpm -iv  openstack-puppet-modules-8.0.4-1.el7.src.rpm
$ cd ../rpmbuild

In folder ~boris/rpmbuild/SOURCES
create to patch files :-

0001-Use-versionless-auth_url-for-cinder.patch
0001-Enable-keystone-v3-support-for-cinder_type.patch

********************************************************************
In second patch file insert "cinder" in path to *.rb files
********************************************************************

diff --git a/cinder/lib/puppet/provider/cinder_type/openstack.rb b/cinder/lib/puppet/provider/cinder_type/openstack.rb
index feaea49..9aa31c5 100644
--- a/cinder/lib/puppet/provider/cinder_type/openstack.rb
+++ b/cinder/lib/puppet/provider/cinder_type/openstack.rb
@@ -32,6 +32,10 @@ class Puppet::Provider::Cinder < Puppet::Provider::Openstack

. . . . .

diff --git a/cinder/lib/puppet/provider/cinder_type/openstack.rb b/cinder/lib/puppet/provider/cinder_type/openstack.rb
index feaea49..9aa31c5 100644
--- a/cinder/lib/puppet/provider/cinder_type/openstack.rb
+++ b/cinder/lib/puppet/provider/cinder_type/openstack.rb
@@ -7,7 +7,7 @@ Puppet::Type.type(:cinder_type).provide(

. . . . . .

diff --git a/cinder/spec/unit/provider/cinder_spec.rb b/cinder/spec/unit/provider/cinder_spec.rb
index cfc8850..246ae58 100644
--- a/cinder/spec/unit/provider/cinder_spec.rb
+++ b/cinder/spec/unit/provider/cinder_spec.rb
@@ -24,10 +24,12 @@ describe Puppet::Provider::Cinder do


Finally SOURES folder would  look like :-


  **********************
  Next step is :-
  **********************

  $ cd ../SPECS

  and update *.spec files , so that they would understand that patches placed
  into SOURCES folder have to be applied to corresponding *.tar.gz archives
  before building phase itself.

*****************************************
First openstack-packstack.spec :-
*****************************************

Name:           openstack-packstack
Version:        8.0.0
Release:        2%{?milestone}%{?dist} <== increase 1 to 2
Summary:        Openstack Install Utility

Group:          Applications/System
License:        ASL 2.0 and GPLv2
URL:            https://github.com/openstack/packstack
Source0:        http://tarballs.openstack.org/packstack/packstack-%{upstream_version}.tar.gz
Patch0:         0001-Use-versionless-auth_url-for-cinder.patch  <=== Add line 
. . . . . .

%prep
%setup -n packstack-%{upstream_version}
%patch0 -p1  <==  Add line

:wq

*****************************************
Second openstack-puppet-modules.spec
*****************************************
Name:           openstack-puppet-modules
Epoch:          1
Version:        8.0.4
Release:        2%{?milestone}%{?dist}  <===  increase 1 to 2
Summary:        Puppet modules used to deploy OpenStack
License:        ASL 2.0 and GPLv2 and GPLv3

URL:         https://github.com/redhat-openstack

Source0:    https://github.com/redhat-openstack/%{name}/archive/%{upstream_version}.tar.gz
Patch0:    0001-Enable-keystone-v3-support-for-cinder_type.patch <== Add line

. . . . .

%prep
%setup -q -n %{name}-%{?upstream_version}
%patch0 -p1  <== Add line

:wq

******************************************
Attempt rpmbuild for each spec file
******************************************

$ rpmbuild -bb openstack-packstack.spec
$ rpmbuild -bb openstack-puppet-modules.spec

If particular build is missing some packages it will report their's names to screen
This packages could be usually installed via yum, otherwise you have a problem
with local build.
If each build output finishes with message like
Wrote: /home/boris/rpmbuild/RPMS/noarch/openstack-puppet-modules-8.0.4-2.el7.centos.noarch.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.wX6p3q
+ umask 022
+ cd /home/boris/rpmbuild/BUILD
+ cd openstack-puppet-modules-8.0.4
+ /usr/bin/rm -rf /home/boris/rpmbuild/BUILDROOT/openstack-puppet-modules-8.0.4-2.el7.centos.x86_64
+ exit 0

Everything is going fine. In particular case results will be written
to ../RPMS/noarch


Then

$ cd ../RPMS/noarch

and create installation script

[boris@ServerCentOS72 SPECS]$ cd ../RPMS/noarch
[boris@ServerCentOS72 noarch]$ ls -l
total 3428
-rwxrwxr-x. 1 boris boris     239 May 21 21:40 install
-rw-rw-r--. 1 boris boris  247312 May 21 21:34 openstack-packstack-8.0.0-2.el7.centos.noarch.rpm
-rw-rw-r--. 1 boris boris   17376 May 21 21:34 openstack-packstack-doc-8.0.0-2.el7.centos.noarch.rpm
-rw-rw-r--. 1 boris boris   16792 May 21 21:34 openstack-packstack-puppet-8.0.0-2.el7.centos.noarch.rpm
-rw-rw-r--. 1 boris boris 3212844 May 21 21:38 openstack-puppet-modules-8.0.4-2.el7.centos.noarch.rpm

[boris@ServerCentOS72 noarch]$ cat install
sudo yum install openstack-packstack-8.0.0-2.el7.centos.noarch.rpm \
openstack-packstack-doc-8.0.0-2.el7.centos.noarch.rpm \
openstack-packstack-puppet-8.0.0-2.el7.centos.noarch.rpm \
openstack-puppet-modules-8.0.4-2.el7.centos.noarch.rpm

****************************
Run install :-
****************************
[boris@ServerCentOS72 noarch]$ ./install

Due to increased  release (1=>2) old rpms should be replaced by just been built

[root@ServerCentOS72 ~]# rpm -qa  \*openstack-packstack\*
openstack-packstack-doc-8.0.0-2.el7.centos.noarch
openstack-packstack-puppet-8.0.0-2.el7.centos.noarch
openstack-packstack-8.0.0-2.el7.centos.noarch

[root@ServerCentOS72 ~]# rpm -qa \*openstack-puppet-modules\*
openstack-puppet-modules-8.0.4-2.el7.centos.noarch

****************************************************************
Since that point following entry in your answer-file :-
****************************************************************

# Identity service API version string. ['v2.0', 'v3']
CONFIG_KEYSTONE_API_VERSION=v3

won't cause cinder puppet to crash packstack run, no matter of kind of your deployment

References
1. https://bugzilla.redhat.com/show_bug.cgi?id=1330289