<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Adam Young's Web Log &#187; Openstack</title>
	<atom:link href="http://adam.younglogic.com/category/software/openstack/feed/" rel="self" type="application/rss+xml" />
	<link>http://adam.younglogic.com</link>
	<description>The Notebook of a Programmer Climber Musician Ex-Soldier</description>
	<lastBuildDate>Tue, 21 May 2013 16:20:53 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Keystone venv notes</title>
		<link>http://adam.younglogic.com/2013/05/more-keystone-venv-notes/</link>
		<comments>http://adam.younglogic.com/2013/05/more-keystone-venv-notes/#comments</comments>
		<pubDate>Tue, 21 May 2013 16:20:53 +0000</pubDate>
		<dc:creator>Adam Young</dc:creator>
				<category><![CDATA[Openstack]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://adam.younglogic.com/?p=2672</guid>
		<description><![CDATA[If you try running the unit tests, but you are missing a C library required to build a python module in the venv, you can continue building with python tools/install_venv.py Code coverage can be generated using: ./run_tests.sh -c Which will &#8230; <a href="http://adam.younglogic.com/2013/05/more-keystone-venv-notes/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>If you try running the unit tests, but you are missing a C library required to build a python module in the venv, you can continue building with</p>
<pre class="brush:bash">
 python tools/install_venv.py
</pre>
<p>Code coverage can be generated using:</p>
<pre class="brush:bash">
./run_tests.sh -c
</pre>
<p>Which will generate a report in keystone/covhtml/.  <A href="http://admiyo.fedorapeople.org/openstack/keystone/coverage/">An example one is posted here:</a></p>
]]></content:encoded>
			<wfw:commentRss>http://adam.younglogic.com/2013/05/more-keystone-venv-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kerberizing PostgreSQL with FreeIPA for Keystone</title>
		<link>http://adam.younglogic.com/2013/05/kerberizing-postgresql-with-freeipa-for-keystone/</link>
		<comments>http://adam.younglogic.com/2013/05/kerberizing-postgresql-with-freeipa-for-keystone/#comments</comments>
		<pubDate>Thu, 02 May 2013 14:21:19 +0000</pubDate>
		<dc:creator>Adam Young</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[FreeIPA]]></category>
		<category><![CDATA[Kerberos]]></category>
		<category><![CDATA[Openstack]]></category>

		<guid isPermaLink="false">http://adam.younglogic.com/?p=2614</guid>
		<description><![CDATA[There are many factors to weight when choosing which relational database management system (RDBMS) to deploy for a given application.  One reason I have been working with PostgreSQL for Keystone is that it support Kerberos Authentication. Why Kerberize Postgresql Direct &#8230; <a href="http://adam.younglogic.com/2013/05/kerberizing-postgresql-with-freeipa-for-keystone/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>There are many factors to weight when choosing which relational database management system (RDBMS) to deploy for a given application.  One reason I have been working with PostgreSQL for Keystone is that it support Kerberos Authentication.</p>
<p><span id="more-2614"></span></p>
<h2>Why Kerberize Postgresql</h2>
<p>Direct access to the RDBMS might be required for many reasons.</p>
<ul>
<li>A shared instance between servers</li>
<li>The database might be in a large replicated cluster managed as a service for the enterprise</li>
<li>The database instance  might provide a read only snapshot of live data for reporting</li>
<li>Some applications might use the Database as a persistant RPC mechanism</li>
</ul>
<p>In the case of OpenStack, we want to make Keystone highly available.  As such, each Keystone instance will not get its own database instance, but instead will share a back end.</p>
<h2>Puppetized Install and Configuraton</h2>
<p>From a shell prompt:</p>
<pre class="brush:bash">Yum install puppet puppet-server tar postgresql
puppet module install puppetlabs/postgresql</pre>
<p>Create a site.pp file for applying gss api to the pg_hba.conf file:</p>
<pre class="brush:bash">

class { 'postgresql::server':
  config_hash => {
    'ip_mask_deny_postgres_user' => '0.0.0.0/32',
    #do not explicitly set 'ip_mask_allow_all_users' 
    #and it will default to localhost only
    'listen_addresses'           => '*',
    'manage_redhat_firewall'     => true,
  },
}
postgresql::pg_hba_rule { 'allow application network to access app database':
  description => "Open up postgresql for access from 192.168.0/24",
  type => 'host',
  database => 'all',
  user => 'all',
  address => '192.168.0.0/24',
  auth_method => 'gss'
}

</pre>
<p>Apply it with</p>
<pre class="brush:bash">
 puppet apply --verbose /root/site.pp
</pre>
<p>Check the postgres access controls in <a href="http://www.postgresql.org/docs/9.2/static/auth-pg-hba-conf.html">/var/lib/pgsql/data/pg_hba.conf</a><br />
You need a line like this.</p>
<pre class="brush:bash">host    all     all     192.168.0.0/24  gss</pre>
<p>Make sure you don&#8217;t have some other rule that will conflict with it. For example, In an earlier pass I had to comment out:</p>
<pre class="brush:bash">#host   all     all     0.0.0.0/0       md5
#host   all     all     ::1/128 md5</pre>
<p>Which preceded it and were triggering a password request from the psql command.</p>
<p>Kerberos for Postgres: Create new service in IPA.</p>
<pre class="brush:bash">
ipa service-add postgres/pg.openstack.freeipa.org
ipa-getkeytab -s ipa.openstack.freeipa.org -p postgres/pg.openstack.freeipa.org@OPENSTACK.FREEIPA.ORG  -k /var/lib/pgsql/data/pg.keytab
chown postgres:postgres /var/lib/pgsql/data/pg.keytab</pre>
<h2>Postgres Config</h2>
<p>Edit Postgresql.conf</p>
<p><a title="GSSAPI-AUTH for Postgres" href="http://www.postgresql.org/docs/9.2/static/auth-methods.html#GSSAPI-AUTH">The information to do this is out of the Postgres manual</a></p>
<pre class="brush:bash"># Kerberos and GSSAPI
krb_server_keyfile = '/var/lib/pgsql/data/pg.keytab'
krb_srvname = 'postgres'
host    all     all     192.168.0.0/24  krb5</pre>
<p>Firewall:</p>
<p>Either iptables open port 5432:</p>
<pre class="brush:bash">lokkit -p 5432:tcp</pre>
<p>Or open it with firewall-cmd:</p>
<pre class="brush:bash">firewall-cmd --add-port=5432/tcp</pre>
<p>To Test:</p>
<pre class="brush:bash">psql -h pg.openstack.freeipa.org -d keystone -U keystone</pre>
<p>Run klist afterwards to see the Postgres service ticket:</p>
<pre class="brush:bash">Ticket cache: FILE:/tmp/krb5cc_1615800001
Default principal: keystone@OPENSTACK.FREEIPA.ORG

Valid starting     Expires            Service principal
05/02/13 03:31:28  05/03/13 03:31:28  krbtgt/OPENSTACK.FREEIPA.ORG@OPENSTACK.FREEIPA.ORG
05/02/13 03:31:33  05/03/13 03:31:28  postgres/pg.openstack.freeipa.org@OPENSTACK.FREEIPA.ORG</pre>
<p>On the Keystone side install Postgres client libraries for Keystone</p>
<pre class="brush:bash">yum install python-psycopg2 postgresql</pre>
<p>In /etc/keystone/keystone.conf</p>
<pre class="brush:bash">connection = postgresql://pg.openstack.freeipa.org/keystone?krbsrvname=postgres</pre>
<p>Assuming you are going to run this for a non-interactive service, you will need a cron job to fetch the tgt on a regular basis.</p>
<pre class="brush:bash">crontab /etc/keystone/keystone.crontab
1 0,6,12,18 * * *   su - keystone -c "KRB5CCNAME=FILE:/tmp/krb5cc_1615800001 kinit keystone -k -t /var/kerberos/krb5/user/1615800001/client.keytab"</pre>
]]></content:encoded>
			<wfw:commentRss>http://adam.younglogic.com/2013/05/kerberizing-postgresql-with-freeipa-for-keystone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Securing OpenStack with FreeIPA</title>
		<link>http://adam.younglogic.com/2013/04/secure-openstack-with-freeipa/</link>
		<comments>http://adam.younglogic.com/2013/04/secure-openstack-with-freeipa/#comments</comments>
		<pubDate>Mon, 29 Apr 2013 20:39:55 +0000</pubDate>
		<dc:creator>Adam Young</dc:creator>
				<category><![CDATA[Openstack]]></category>

		<guid isPermaLink="false">http://adam.younglogic.com/?p=2648</guid>
		<description><![CDATA[I gave a talk at the OpenStack summit in Portland about using FreeIPA to secure OpenStack. You can see the video here. I have HTMLified my slides if you wish to browse through them.]]></description>
				<content:encoded><![CDATA[<p>I gave a talk at the OpenStack summit in Portland about using FreeIPA to secure OpenStack.  <a href="https://www.openstack.org/summit/portland-2013/session-videos/presentation/securing-openstack-with-freeipa" title="Summit Presentation Video" target="_blank">You can see the video here</a>.  I have <a href="http://adam.younglogic.com/presentations/SecuringOpenstackFreeIPA/Securing-OpenStack-FreeIPA.html" title="Slides in HTML form" target="_blank">HTMLified my slides</a> if you wish to browse through them.</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.younglogic.com/2013/04/secure-openstack-with-freeipa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running PostgreSQL and Mysql Unit tests in Keystone</title>
		<link>http://adam.younglogic.com/2013/04/database-tests-keystone/</link>
		<comments>http://adam.younglogic.com/2013/04/database-tests-keystone/#comments</comments>
		<pubDate>Mon, 22 Apr 2013 20:20:05 +0000</pubDate>
		<dc:creator>Adam Young</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Openstack]]></category>

		<guid isPermaLink="false">http://adam.younglogic.com/?p=2632</guid>
		<description><![CDATA[We don&#8217;t include the postgres or Mysql drivers inside the virtual env for Keystone, so you need to explicitly install them in order to run the unit tests. For Postgresql: sudo yum install postgresql-devel . .venv/bin/activate pip install psycopg2 For &#8230; <a href="http://adam.younglogic.com/2013/04/database-tests-keystone/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>We don&#8217;t include the postgres or Mysql drivers inside the virtual env for Keystone, so you need to explicitly install them in order to run the unit tests.  </p>
<p><span id="more-2632"></span><br />
For Postgresql:</p>
<pre class="brush:bash">
sudo yum install postgresql-devel
. .venv/bin/activate
pip install psycopg2
</pre>
<p>For MySQL</p>
<pre class="brush:bash">
sudo yum install mysql-devel
. .venv/bin/activate
pip install MySQL-python
</pre>
<p>Now to run the unit tests, uncomment the driver line in <em>tests/backend_sql.conf</em> and run </p>
<pre class="brush:bash">
./run_tests.sh -x test_sql_upgrade
</pre>
]]></content:encoded>
			<wfw:commentRss>http://adam.younglogic.com/2013/04/database-tests-keystone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trusts and Role Based Access Control for Open Stack</title>
		<link>http://adam.younglogic.com/2013/03/trusts-rbac/</link>
		<comments>http://adam.younglogic.com/2013/03/trusts-rbac/#comments</comments>
		<pubDate>Wed, 20 Mar 2013 15:59:48 +0000</pubDate>
		<dc:creator>Adam Young</dc:creator>
				<category><![CDATA[Openstack]]></category>
		<category><![CDATA[PKI]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://adam.younglogic.com/?p=2594</guid>
		<description><![CDATA[Bearer tokens are vulnerable to replay attacks. OK, so what are our options? Something where the user proves, via cryptography that they have the right to actually use the token. It doesn&#8217;t matter if it is X509, Kerberos, or something &#8230; <a href="http://adam.younglogic.com/2013/03/trusts-rbac/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Bearer tokens are vulnerable to replay attacks. OK,   so what are our options?   Something where the user proves, via cryptography that they have the right to actually use the token.  It doesn&#8217;t matter if it is X509, Kerberos, or something we cook up ourselves, it is going to resolve to proving you have the right to use that token. </p>
<p>If tokens must be validated by the owner, we effectively break the ability of Open Stack to hand around bearer tokens to get work done.  We are going to have to get a lot of stuff right in order to keep from breaking things.   Fortunately, we now have the tools to work around this, and to better secure an OpenStack system:  Trusts and Role Based Access Control.<br />
<span id="more-2594"></span><br />
The use case I came up with was &#8220;create VM from CLI  in a very simplified state.</p>
<p>The actors here are</p>
<p>1. Me, the end user (ayoung with multiple roles in the project younglogic)<br />
2. Keystone<br />
3. Nova API<br />
4. Quantum<br />
5. Glance<br />
6. Swift<br />
7. Nova Compute</p>
<p>We&#8217;ll lump all of Quantum&#8217;s, Swift&#8217;s, and Glance&#8217;s separate components together for now. </p>
<p>So I run the CLI command saying &#8220;create me a new virtual machine.&#8221;  At this point, what do I have?  I have an unscoped token from Keystone that allows horizon to list my projects, and I probably have a scoped token from keystone with my roles in the younglogic project.  Lets assume that there are not transferable:  any action I take will get signed by me, and if the service that I pass my token on to needs to call another it won&#8217;t be able to use my token.  It will have to use its own.</p>
<p>So the token that I&#8217;ve gotten out of keystone goes to Nova.  The first thing that Nova needs to do is move the image from Glance to the Nova Compute.  Nova needs a token the will give it permission to do that.  Say that API is protected by the role &#8220;Consumes Images&#8221;  I need to create a trust for the Nova server with:</p>
<p>{trustor=ayoung, trustee=nova-api,project=younglogic,roles=["Consumes Images"]}  I probably should give it a relatively short time out:  say an hour, as we might be queued up.  Impersonation is not required, as this is done at the project level.</p>
<p>Glance already has a trust set up for me to talk to swift.  That trust allows the glance service user to access all of my images. Since the images are store by users and not by projects  the glance trust is an impersonation trust.  How does glance know to use this trust for images in my project when the request came in from the Nova user?  Good question, and it is an issue yet to be resolved.  But a mapping is possible.</p>
<p>Now nova needs to push the image to nova-compute.  Again, this is done via the trust token, and it probably makes sense that the same role, &#8220;Consumes Images&#8221; be used to push the image to the compute node.  While Nova Compute may trust Nova API, by using the trust, we assure that the resources are assigned to the project. </p>
<p>Now we have to go to Quantum and add the new IP address to the network for this Virtual machine.  Again, we can use the &#8220;Consumes Images&#8221; role, but that seems a little specific.  Probably more correct to give a role along the lines of &#8220;Modifies Network Addresses&#8221; as that role could be used for many things.  However, both of these roles could be on the initial trust token.  So {trustor=ayoung, trustee=nova-api,project=younglogic,roles=["Consumes Images","Modifies Network Addresses"]}</p>
<p>Now we need to actually create a virtual machine from the image.  Lets assume that there are people that would be able to create a virtual machine only if the image was in place already, but could not deploy a new image.  Thus, we will grant yet a third role &#8220;Creates VM&#8221;.  And a fourth &#8220;Power Cycles VM&#8221;.  It depends on the granularity of trust we want to place around the operations.  So our completed token looks roughly like this:</p>
<p>{trustor=ayoung, trustee=nova-api,project=younglogic,roles=["Consumes Images","Modifies Network Addresses", "Creates VM", "Power Cycles VM"], expires=now + 1 hour}</p>
<p>This is pseudo-code: these user IDs would be uuids and the time would be an absolute time, not relative.</p>
<p>Note now that it is the trust that lasts for an hour.  However, we can make the tokens very short lived.  The rule of thumb should be &#8220;long enough to push a request and get a response via HTTP.&#8221;  In the case of Nova API making calls to Glance, Quantum, and Nova Compute, it can continue to reuse a token until it is about to expire, an the get a new one, so that if the quantum call returns immediately, it doesn&#8217;t need to get a new token before going to Nova Compute.  If, on the other hand, the glance call takes 15 minutes, it only needs the token to be valid at the start of the call, and it can fetch a new token once it needs it.</p>
<p>This example is obviosuly the abbreviated version of what happens.  There are lots of details elided for the sake of clarity. What is important is how Trusts can be used in conjunction with RBAC to provide a more secure Open Stack deployment.</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.younglogic.com/2013/03/trusts-rbac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Keystone, MySQL and Fedora 18</title>
		<link>http://adam.younglogic.com/2013/03/keystone-mysql-and-fedora-18/</link>
		<comments>http://adam.younglogic.com/2013/03/keystone-mysql-and-fedora-18/#comments</comments>
		<pubDate>Fri, 08 Mar 2013 19:34:23 +0000</pubDate>
		<dc:creator>Adam Young</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Openstack]]></category>

		<guid isPermaLink="false">http://adam.younglogic.com/?p=2577</guid>
		<description><![CDATA[It looks like the access model for MySQL has changed between F17 and F18. openstack-db fails with a permission on the root user.  However, the following works: As the keystone user (I suspect the openstack-db call made the keystone user, &#8230; <a href="http://adam.younglogic.com/2013/03/keystone-mysql-and-fedora-18/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>It looks like the access model for MySQL has changed between F17 and F18.</p>
<p>openstack-db fails with a permission on the root user.  However, the following works:</p>
<ol>
<li>As the keystone user  (I suspect the openstack-db call made the keystone user, or maybe that is done by the RPM install?)
<li>run mysql,  (no params, using the default identification, which I assume is PAM based?)
<li>create a user named keystone.
<li>and grant that user perms to create a db.
</ol>
<pre class="brush:bash">
su - keystone
mysql
</pre>
<pre class="brush:sql">
create user 'keystone'@'localhost' identified by 'keystone';
grant all  PRIVILEGES on *.* to 'keystone'@'localhost';
</pre>
<p>exit mysql and log in as that user:</p>
<pre class="brush:bash">
mysql --user=keystone --password=keystone
</pre>
<p>Create the keystone database:</p>
<pre class="brush:sql">
create database keystone;
</pre>
<p>Log out and run the dbsync</p>
<pre class="brush:bash">
keystone-manage db_sync
</pre>
<p>Obviously, this leaves the DB User with too many permissions, but it is a start.</p>
<p>If I now try to run the command</p>
<pre class="brush:bash">
openstack-db --service glance --init
Please enter the password for the 'root' MySQL user:
</pre>
<p>Even setting the password in MySQL doesn&#8217;t work</p>
<pre class="brush:sql">
UPDATE mysql.user SET Password=PASSWORD('keystone') WHERE User='root' AND Host='localhost';
</pre>
<pre class="brush:bash">
[root@f18-keystone mysql]# openstack-db --service glance --init
Please enter the password for the 'root' MySQL user:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Failed to connect to the MySQL server.  Please check your root user credentials.
</pre>
<p>I tried it with the unix password as well.</p>
<p>Note that I can connect using the following SQL Alchemy URL:</p>
<pre class="brush:bash">
connection = mysql://keystone:keystone@localhost/keystone?unix_socket=/var/lib/mysql/mysql.sock
</pre>
<p>I think this is preferable to exposing TCP sockets around in the case that the Keystone server and MySQL server are co-located.</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.younglogic.com/2013/03/keystone-mysql-and-fedora-18/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Meet the Red Hat OpenStack Team: Adam Young</title>
		<link>http://adam.younglogic.com/2013/02/meet-rhos-team-adam-young/</link>
		<comments>http://adam.younglogic.com/2013/02/meet-rhos-team-adam-young/#comments</comments>
		<pubDate>Mon, 18 Feb 2013 22:39:04 +0000</pubDate>
		<dc:creator>Adam Young</dc:creator>
				<category><![CDATA[Openstack]]></category>

		<guid isPermaLink="false">http://adam.younglogic.com/?p=2460</guid>
		<description><![CDATA[We thought it would be a good idea to have a &#8220;Meet the Red Hat Open Stack Team&#8221; series of blog post. This is me. When and why did you join Red Hat ? I Started in July of 2009. &#8230; <a href="http://adam.younglogic.com/2013/02/meet-rhos-team-adam-young/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>We thought it would be a good idea to have a &#8220;Meet the Red Hat Open Stack Team&#8221; series of blog post. This is me.<br />
<span id="more-2460"></span></p>
<p><strong>When and why did you join Red Hat ?</strong></p>
<p>I Started in July of 2009. Why?<a href="http://adam.younglogic.com/2012/11/why-i-work-at-red-hat/"> There is a Long answer to that.</a></p>
<p><strong>What part of the world are you based in ?</strong><br />
Massachusetts. I work out of the Westford office, which is our Engineering Headquarters.</p>
<p><strong>What were you doing before joining the OpenStack Team?</strong><br />
I worked on <a href="http://www.freeipa.org/page/Main_Page">FreeIPA</a>, which Red Hat packages as <a href="http://www.redhat.com/products/identity-management">Red Hat Identity Management.</a></p>
<p><strong>What were you doing before joining Red Hat ?</strong><br />
Immediately prior to joining Red Hat I was at VMware. I was nominally on the High Availability team, but all my efforts were around either running Open Source tools on the VMware platform or getting VMware tools to run on Linux. Much more fun was what I was doing prior to VMware.</p>
<p>In the middle of the Decade, I worked at Penguin Computing on Scyld Beowulf, now Scyld ClusterWare. This was a lot of fun. We were building a single system image where the process space was distributed across multiple physical compute nodes. Although we targeted it at the High Performance Computing market, it was solution that had something to offer to many aspects of large scale computing.</p>
<p><strong>What OpenStack projects are you involved in?</strong><br />
I work almost exclusively on Keystone. I seem to have become the clearing house for LDAP support, but others are picking that up. I am more focuses on HATEOAS, PKI, and the trusts work, as well as general concepts around Identity Management.</p>
<p><strong>What have you contributed to OpenStack in the last 3-6 months ?</strong></p>
<p>For the Essex release, my biggest contribution was reintroducing LDAP support to Keystone. There has been a fair amount of follow on work from that.</p>
<p>For the Folsom release, my biggest contribution was PKI tokens.</p>
<p>As a member of Keystone Core, my biggest contribution is doing code reviews.</p>
<p>Thus far in Grizzly I&#8217;ve done a fair number of bug fixes and refactoring. I&#8217;ve spent a good amount of time building up the SQL upgrade tests and dealing with issues specific to our threading model.  Probably the most non-interesting but essential thing has been to change how users are assigned to projects.  In order to tie in with Role Based Access Control, that assignment is now done via a Role as well.  It seems small, but it is an essential change, and other things will work better because of it.</p>
<p><strong>What are you working on currently / in the next few months for OpenStack ?</strong><br />
My current tasks involve mechanisms for delegating authority, whether between users or services. <a href="https://blueprints.launchpad.net/keystone/+spec/trusts">More information here: </a></p>
<p><strong>What do you enjoy most about working on OpenStack ?</strong><br />
The people that are involved with Keystone are top notch, and yet there is a surprising lack of Ego. Joe Heck is one Heck of a tech lead, and Dolph Matthews is just fantastic. We recently picked up a couple more core developers who have really helped move things along: Guang Yee and Henry Nash. The member of non-core contributors is growing, and several of them have picked up pieces of work that were originally on my plate, and proceeded to implement them better than I would have. We all have out interests, and they seem to be complementary. So, one of my roles has been to help get people up to speed in the development process.</p>
<p>The automation support for the workflow is one of the smoothest I&#8217;ve had the pleasure to work with: Open Blueprint, record Bug, write code, submit to Gerrit. Making changes due to feedback from code reviews has become painless as I&#8217;ve better learned git. Keeping track of what I need to do, including new change requests that are posted for review has never been easier for me. Which is good, because there is a lot to do.</p>
<p>But most of all, I love the fact that Open Stack is generating so much excitement. I feel lucky to be paid to work on it full time. Which is also a part of my answer to the question of Why I work at Red Hat.</p>
<p><strong>What advice do you have for people interested in OpenStack ?</strong><br />
Get involved. Code reviews are always welcome. Nothing will get you in better with the existing team members than providing input. Documentation fixes, bug reports, comments on blueprints, and testing. Get involved. Open Stack is a collaborative effort. Collaborate.</p>
<p><strong>What other open source projects have you been involved in ?</strong><br />
While here at Red Hat, I first worked on <a href="http://www.rhq-project.org">RHQ</a>, and later <a href="http://www.freeipa.org/page/Main_Page">FreeIPA</a>, with a touch of <a href="http://www.pulpproject.org">Pulp</a> and <a href="https://fedorahosted.org/candlepin">Candlepin</a> in the middle. At one point I was focused on the <a href="http://pki.fedoraproject.org/wiki/PKI_Main_Page">Certificate Server</a> that is used by FreeIPA.<br />
I am still working to get <a href="https://fedorahosted.org/bproc">BProc</a> into more of an Open Source development model. Even though it is GPL code, the development has been done in house for too many years.<br />
My first Open Source contribution was to a PalmOS application for studying Chinese called <a href="http://dragon-char.sourceforge.net">Dragon Character Training</a> where I built a &#8220;game&#8221; to test you in the pronunciation of the Chinese words.</p>
<p><strong>When did you first start using Linux and what distro was it ?</strong><br />
1998. Red Hat 6. A good friend of mine, <a href="http://richmond.indymedia.org/newswire/display/12049/index.php">Mike DeBeer</a>, helped get me over the initial learning curve. I&#8217;ve bounced back and forth between Red Hat and Debian over the years.</p>
<p><strong>What desktop environment are you running ?</strong><br />
I run Gnome 3 and Fedora 18 right now, basically because I try to keep current and support what the Fedora and the Gnome teams are actively developing. I switch to KDE from time to time, as I actually am a C++ coder at heart.</p>
<p><strong>What are your preferred programming language and/or dev tools ?</strong><br />
All programming languages have their sweet spot, and all have their warts. I&#8217;m learning to think in Python more and more as I work on Open Stack. I&#8217;ve done a fair amount of C++, Java and Straight C in the past, and am pretty handy with Bash as well.</p>
<p>For coding, I am an IDE person. I got very comfortable using Eclipse during my Java coding days. Now that I am focused on Python, I use Eclipse PyDev as my primary IDE, and often fall back to EMACS. I am also conversant in vi and tend to use that for very quick tasks.</p>
<p><strong>Where is your blog / twitter / Google+ / YouTube profile found ?</strong><br />
Blog is http://adam.younglogic.com. I don&#8217;t tend to use much of the other technologies. I have a Google+ account, but my launchpad ID is far more used.</p>
<p><strong>What else would you like to say to the OpenStack community?</strong><br />
We need more code reviews. The more eyeballs on the code, the better. Use code reviews as a way to get to learn the code.</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.younglogic.com/2013/02/meet-rhos-team-adam-young/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Puppet to setup PostgreSQL for Keystone on Fedora</title>
		<link>http://adam.younglogic.com/2013/02/puppet-postgresql-keystone/</link>
		<comments>http://adam.younglogic.com/2013/02/puppet-postgresql-keystone/#comments</comments>
		<pubDate>Fri, 08 Feb 2013 04:07:37 +0000</pubDate>
		<dc:creator>Adam Young</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Openstack]]></category>

		<guid isPermaLink="false">http://adam.younglogic.com/?p=2535</guid>
		<description><![CDATA[Using Puppet to manage software configuration makes sense. Setting up PostgreSQL support for Keystone development and testing has been my excuse to learn it. sudo yum install puppet sudo puppet module install puppetlabs/postgresql Then create a file /etc/puppet/site.pp Put this &#8230; <a href="http://adam.younglogic.com/2013/02/puppet-postgresql-keystone/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Using Puppet to manage software configuration makes sense. Setting up PostgreSQL support for Keystone development and testing has been my excuse to learn it.</p>
<pre class="brush:bash">sudo yum install puppet
sudo puppet module install puppetlabs/postgresql</pre>
<p>Then create a file /etc/puppet/site.pp</p>
<p>Put this line in it:</p>
<pre class="brush:bash">class { 'postgresql::server': }

postgresql::db{ 'keystone':
  user          =&gt; 'keystone',
  password      =&gt; 'keystone',
  grant         =&gt; 'all',
}</pre>
<pre class="brush:bash">sudo  puppet apply --verbose /etc/puppet/site.pp</pre>
<p>Confirm that postgresql is running:</p>
<pre class="brush:bash">systemctl status postgresql.service</pre>
<p>Should get you</p>
<pre class="brush:bash">postgresql.service - PostgreSQL database server
	  Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled)
	  Active: active (running) since Thu, 03 Jan 2013 13:26:46 -0500; 43min ago
	 Process: 17529 ExecStop=/usr/bin/pg_ctl stop -D ${PGDATA} -s -m fast (code=exited, status=0/SUCCESS)
	 Process: 17553 ExecStart=/usr/bin/pg_ctl start -D ${PGDATA} -s -o -p ${PGPORT} -w -t 300 (code=exited, status=0/SUCCESS)
	 Process: 17545 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
	Main PID: 17556 (postgres)
	  CGroup: name=systemd:/system/postgresql.service
		  ├ 17556 /usr/bin/postgres -D /var/lib/pgsql/data -p 5432
		  ├ 17557 postgres: logger process   
		  ├ 17559 postgres: writer process   
		  ├ 17560 postgres: wal writer process   
		  ├ 17561 postgres: autovacuum launcher process   
		  └ 17562 postgres: stats collector process</pre>
<p>Test we can connect to the PostgreSQL command line tool:</p>
<pre class="brush:bash">psql -h localhost -U keystone keystone 
Password for user keystone: 
psql (9.1.7)
Type "help" for help.

keystone=&gt; \d</pre>
<p>To run the Keystone unit test test against the database, alter the file /opt/stack/keystone/tests/backend_sql.conf. Comment out the sqlite connection line, and uncomment the postgresql line.</p>
<pre class="brush:bash">[sql]
#connection = sqlite://
#To Test MySQL:
#connection = mysql://root:keystone@localhost/keystone?charset=utf8
#To Test PostgreSQL:
connection = postgresql://keystone:keystone@localhost/keystone?client_encoding=utf8
idle_timeout = 200</pre>
<p>Then you can run the unit tests with</p>
<pre class="brush:bash">./run_tests.sh -N test_sql_upgrade</pre>
<p>If the tests fail (and they will), they will leave the database in an unusable state. You can drop the database and recreate with puppet:</p>
<pre class="brush:bash">sudo su postgres -c "dropdb keystone"
sudo  puppet apply --verbose /etc/puppet/site.pp</pre>
]]></content:encoded>
			<wfw:commentRss>http://adam.younglogic.com/2013/02/puppet-postgresql-keystone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A SQL upgrade script in Keystone</title>
		<link>http://adam.younglogic.com/2013/01/sql-upgrade-keystone/</link>
		<comments>http://adam.younglogic.com/2013/01/sql-upgrade-keystone/#comments</comments>
		<pubDate>Sat, 19 Jan 2013 03:32:41 +0000</pubDate>
		<dc:creator>Adam Young</dc:creator>
				<category><![CDATA[Openstack]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[revision control]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://adam.younglogic.com/?p=2546</guid>
		<description><![CDATA[The SQL migration mechanism in Keystone is interesting enough to warrant some attention. If you need to modify the SQL database in any of the Open Stack projects, you are going to use a similar approach. Here is a step &#8230; <a href="http://adam.younglogic.com/2013/01/sql-upgrade-keystone/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>The SQL migration mechanism in Keystone is interesting enough to warrant some attention.  If you need to modify the SQL database in any of the Open Stack projects, you are going to use a similar approach.  Here is a step by step I have recorded of a SQL upgrade script I am writing for a feature in Keystone.<br />
<span id="more-2546"></span></p>
<p>SQL upgrade scripts are in <A href="https://github.com/openstack/keystone/tree/master/keystone/common/sql/migrate_repo/versions">keystone/common/sql/migrate_repo/versions</a> and are number in the order in which they are executed.  The initial tables for Keystone are created in the script <A href="https://github.com/openstack/keystone/blob/master/keystone/common/sql/migrate_repo/versions/001_add_initial_tables.py">001_add_initial_tables.p</a></p>
<p>I am trying to <a href="https://blueprints.launchpad.net/keystone/+spec/replace-tenant-user-membership">Replace Tenant-User Membership with a default role.</a>  The first step is to create the default role.</p>
<p>To start with, I am going to create a new role called &#8220;Member&#8221; in the Roles table.  If a role with this name already exists, I will leave it in place.</p>
<p>This makes downgrade a little tricky.  I won&#8217;t know if the &#8220;member&#8221; role existed on upgrade.  Ordinarily, I would remove this role, but I can&#8217;t without breaking some users deployments. Thus, the downgrade for this is going to be a no-op.</p>
<p>As of the time of this writing, the highest number script is 013.  So to start, I create a new script with a sequence number of 014: 014_membership_role.py.  I make it as simple as possible.</p>
<pre class="brush:python">

def upgrade(migrate_engine):
    pass

def downgrade(migrate_engine):
    pass

</pre>
<p>To run the upgrade tests from the command line.  </p>
<pre class="brush:bash">
./run_tests.sh test_sql_upgrade
</pre>
<p>That seems to imply that all is well.  But we don&#8217;t really know if anything was done there.  I, of course, ran in the debugger, so I could set a break point, but if you are not, all you know is it seems to work.  Since we are espousing test driven design, lets make sure we run the upgrade test&#8230;at least for very limited values of &#8220;sure&#8221;.</p>
<p>Open up the file <a href="https://github.com/openstack/keystone/blob/master/tests/test_sql_upgrade.py">tests/test_sql_upgrade.py</a> and add a new test:  I will call it:  upgrade_default_roles.</p>
<pre class="brush:python">
    def test_upgrade_default_roles(self):
        self.upgrade(13)
        self.upgrade(14)
</pre>
<p>And re-run the test.  Since we are going to be focusing on this test, we can speed things up to run just this test:</p>
<pre class="brush:bash">
./run_tests.sh test_sql_upgrade:SqlUpgradeTests.test_upgrade_default_roles
test_upgrade_default_roles (test_sql_upgrade.SqlUpgradeTests) ... ok
</pre>
<p>If you are paranoid, you will once again admit that you don&#8217;t know that this did anything.  I like it when new test fail.  So, to start with, I am going to explicitly throw an exception in my upgrade script.  </p>
<pre class="brush:python">

from keystone import exception

def upgrade(migrate_engine):
    raise exception.NotImplemented()

def downgrade(migrate_engine):
    pass
</pre>
<p>Now my output starts with:</p>
<pre class="brush:bash">
./run_tests.sh test_sql_upgrade:SqlUpgradeTests.test_upgrade_default_roles
test_upgrade_default_roles (test_sql_upgrade.SqlUpgradeTests) ... ERROR
</pre>
<p>And continues on with information to help in debugging.</p>
<p>OK, I run with my tests directory in a ram disk. This speeds up running the tests, but means that if I don&#8217;t commit my changes, I&#8217;ll lose them on a reboot.  I also might get distracted and have to work on something else.  So, I commit, to git.</p>
<pre class="brush:bash">
young@ayoung530 keystone (project_member)]$ git status
# On branch project_member
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#	modified:   tests/test_sql_upgrade.py
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	keystone/common/sql/migrate_repo/versions/014_membership_role.py
no changes added to commit (use "git add" and/or "git commit -a")
[ayoung@ayoung530 keystone (project_member)]$ git add tests/test_sql_upgrade.py  keystone/common/sql/migrate_repo/versions/014_membership_role.py
[ayoung@ayoung530 keystone (project_member)]$ git commit -m "start of default role work."
[project_member 2115c76] start of default role work.
 2 files changed, 13 insertions(+)
 create mode 100644 keystone/common/sql/migrate_repo/versions/014_membership_role.py
</pre>
<p>Now, if I come back to this branch later, I run my tests, they fail, and I am immediately back in the coding zone.  </p>
<p>I can modify my upgrade script to always insert the new role.  I&#8217;ll put in a corresponding downgrade script that deletes the row.  Since my database is empty to start, I know this will succeed.</p>
<pre class="brush:python">
import sqlalchemy
import uuid
from keystone import exception

def upgrade(migrate_engine):
    meta = sqlalchemy.MetaData()
    meta.bind = migrate_engine
    role_table = sqlalchemy.Table('role', meta, autoload=True)
    conn = migrate_engine.connect()
    conn.execute(role_table.insert(),
                 id=uuid.uuid4().hex, name="Member", extra="{}")


def downgrade(migrate_engine):
    meta = sqlalchemy.MetaData()
    meta.bind = migrate_engine
    role_table = sqlalchemy.Table('role', meta, autoload=True)
    conn = migrate_engine.connect()
    conn.execute(role_table.delete().where(role_table.c.name=='Member'))

</pre>
<p>While running the test shows that this succeeds, it doesn&#8217;t do much.  What I will now do is add a test that queries the table to make sure the new value is in there.  The following test runs both the upgrade and the downgrade.  This is an interim step.  If we were going to keep the downgrade around, we would make a separate unit test for upgrade and for downgrade.</p>
<pre class="brush:python">
    def test_upgrade_default_roles(self):
        self.upgrade(13)
        session = self.Session()
        count = session.execute("select count(*) as c from role where name='Member'").fetchone()['c']
        self.assertEquals(0, count)
        self.upgrade(14)
        count = session.execute("select count(*) as c from role where name='Member'").fetchone()['c']
        self.assertEquals(1, count)
        self.downgrade(13)
        count = session.execute("select count(*) as c from role where name='Member'").fetchone()['c']
        self.assertEquals(0, count)
</pre>
<p>Of course, now other unit tests fail, but that is a tale for another day.</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.younglogic.com/2013/01/sql-upgrade-keystone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reviewing Code</title>
		<link>http://adam.younglogic.com/2012/12/reviewing-code/</link>
		<comments>http://adam.younglogic.com/2012/12/reviewing-code/#comments</comments>
		<pubDate>Fri, 14 Dec 2012 03:35:28 +0000</pubDate>
		<dc:creator>Adam Young</dc:creator>
				<category><![CDATA[Openstack]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://adam.younglogic.com/?p=2514</guid>
		<description><![CDATA[Code reviews are vital to the success of any software project. In Open Stack, code must be reviewed to be accepted. If there are not enough people doing code reviews, the reviews get stagnant, and the project can&#8217;t move forward. &#8230; <a href="http://adam.younglogic.com/2012/12/reviewing-code/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Code reviews are vital to the success of any software project. In Open Stack, code must be reviewed to be accepted. If there are not enough people doing code reviews, the reviews get stagnant, and the project can&#8217;t move forward.</p>
<p>Right now, there are only three active core contributors focused on Keystone.  There are a couple people that are core on multiple projects the pay attention to Keystone from time to time, but mostly it is just three of us.</p>
<p><span id="more-2514"></span></p>
<h2>How the review scoring works</h2>
<p>On Keystone, we need a total of +4 before merging a commit. This means:</p>
<p>Two core at +2 each.<br />
or<br />
Two community at +1 each and One core at +2.</p>
<p>I could say four community at +1 each, but a core member still needs to click &#8220;approve&#8221; so their name goes on it anyway.</p>
<p>If the patch is created by one of the core team members, they can&#8217;t review or approve it.  If we rely only on the core developers, and one of use writes the patch, all three of us have to be involved. That is fine for really important things, and sometimes we want to hold a patch until the other core see it.  But it doesn&#8217;t scale.</p>
<h2>How to get involved</h2>
<p>Find a review request and review it.  Even if it has been reviewed by someone else. If anything at all seems out of place, -1 it and place a reason on it. If the original author thinks your reason is not sufficient, they will let you know. You can decide remove it later.  If you review something and you don&#8217;t understand it, put questions into the review. Feel free to -1 it until you understand the rationale. We are very unlikely to merge something that has a -1 next to it, but we have enough confidence in our convictions that we will do so if we feel warranted. Most of all, if a code review has a -1, the person who posted the patch will want to address it quickly, as most people won&#8217;t bother reviewing a patch that already has a -1.  If you criticism is at all warranted, the author will address it and submit another patch.</p>
<p>I assure you that we will take a review more seriously if it has negative comments and constructive criticism than if someone just says &#8220;Looks Good.&#8221;  If the patch is non-trivial, it will have something that can be improved.</p>
<p>Ask question, get involved, and keep things moving. I assure you, it means that once you post code for review, your review requests will get more attention as they come in.</p>
<h2>What to review</h2>
<p>You may be wondering how to track what code reviews are out there.</p>
<p><a href="https://review.openstack.org/#/q/status:open+project:openstack/keystone,n,z" target="_blank"> For the Keystone Server, the review requests are here.</a></p>
<p><a href="https://review.openstack.org/#/q/status:open+project:openstack/python-keystoneclient,n,z" target="_blank">Here are the review requests for the client.</a></p>
<p>You will need a launchpad account. <a href=" https://launchpad.net/keystone/" target="_blank">More information here.</a></p>
<h2>How to get comfortable better at code reviews</h2>
<p>So, how do you review code? Good question. It can be daunting looking at a brand new code base, and a change you don&#8217;t understand. Make the review process be your way of understanding the code better.  I&#8217;d recommend actually running  the code.   <a href="http://adam.younglogic.com/2012/12/keystone-and-eclipse-pydev/" target="_blank">My previous post</a> talked through how to get to that start state.  Set a break point and step through the code.  Look at the parameters that are sent in to the functions.</p>
<p><a href="http://adam.younglogic.com/2010/01/code-review-checklist/" target="_blank">Here is a list of things you can think about while looking at the code.</a></p>
<p>There are some things that are specific to Open Stack worth mentioning.</p>
<ul>
<li>Eventlet is a greenthreaded Web server.  Blocking calls in native libraries can make it hang.</li>
<li>We want to be able to support Apache HTTPD as well as Eventlet, so Eventlet specific code needs to be isolated.</li>
<li>You can see the code coverage by running ./run_tests.sh &#8211;coverage, which will generate an HTML based report in keystone/covhtml. Look at the code that was submitted and make sure it is 100% covered</li>
<li>No code will get merged if it can&#8217;t pass the unit tests and functional tests.  Don&#8217;t be worried that you will approve something that is broken.</li>
<li>If a patch is submitted without a blueprint or a bug, and it is not clear what problem the patch is solving, that is sufficient grounds for a -1.   The code may be perfect, but it needs to be documented.</li>
<li>We are very concerned about backward compatibility.  Keep an eye on any patches that may change previous behavior.</li>
</ul>
<p>Feel free to ask me questions. As you can tell, I am not shy, and I try to be n00b13 friendly, especially if you are showing an interest and trying to make Keystone and Open Stack better.</p>
<p>If you are wondering how to get involved in Open Stack, I suggest you do some code reviews.</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.younglogic.com/2012/12/reviewing-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
