<?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>boompty boomp</title>
	<atom:link href="http://blog.defunct.ca/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.defunct.ca</link>
	<description></description>
	<lastBuildDate>Mon, 23 Jan 2012 15:36:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Fast and dirty install of Graphite on Debian Squeeze</title>
		<link>http://blog.defunct.ca/2012/01/23/fast-and-dirty-install-of-graphite-on-debian-squeeze/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=fast-and-dirty-install-of-graphite-on-debian-squeeze</link>
		<comments>http://blog.defunct.ca/2012/01/23/fast-and-dirty-install-of-graphite-on-debian-squeeze/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 15:22:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.defunct.ca/?p=516</guid>
		<description><![CDATA[Please note that this is not a production-ready installation document! As the title suggests, this is a fast and dirty installation of Graphite for testing, and assumes you&#8217;re installing on a new virtual machine dedicated to Graphite. This will break stuff if you run on an existing server! These installation instructions are basically the steps [...]]]></description>
			<content:encoded><![CDATA[<p>Please note that this is not a production-ready installation document!  As the title suggests, this is a fast and dirty installation of Graphite for testing, and assumes you&#8217;re installing on a new virtual machine dedicated to Graphite.  This will break stuff if you run on an existing server!</p>
<p>These installation instructions are basically the steps from <a href="http://graphite.wikidot.com/installation" title="http://graphite.wikidot.com/installation">http://graphite.wikidot.com/installation</a>, with a few minor adjustments to work on Debian Squeeze.</p>
<p>First things first:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># cd /root
# apt-get update
# apt-get install bzr</pre></div></div>

<p>Once bzr&#8217;s installed, we can:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># bzr branch lp:graphite</pre></div></div>

<p>Install Whisper:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># cd graphite/whisper
# python setup.py install</pre></div></div>

<p>At the time of writing, Whisper can be installed from apt-get on Squeeze, but the version doesn&#8217;t match what we&#8217;ve pulled Launchpad.</p>
<p>Install Carbon:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># cd ../carbon
# python setup.py install</pre></div></div>

<p>Now we copy some sample configurations into place:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># cd /opt/graphite/conf
# cp carbon.conf.example carbon.conf
# cp storage-schemas.conf.example storage-schemas.conf</pre></div></div>

<p>Graphite depends on a number of other packages, and I&#8217;ve made every attempt to grab stuff from stock apt repos rather than building (unnecessarily) from source.  To see what&#8217;s missing, run:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">cd /root/graphite
python check-dependencies.py</pre></div></div>

<p>This should return something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># python check-dependencies.py
[FATAL] Unable to import the 'cairo' module, do you have pycairo installed for python 2.6.6?
[FATAL] Unable to import the 'django' module, do you have Django installed for python 2.6.6?
[FATAL] Unable to import the 'tagging' module, do you have django-tagging installed for python 2.6.6?
[WARNING] Unable to import Interface from zope.interface.
Without it, you will be unable to run carbon on this server.
[WARNING] Unable to import the 'mod_python' module, do you have mod_python installed for python 2.6.6?
mod_python is one of the most common ways to run graphite-web under apache.
Without mod_python you will still be able to use the built in development server; which is not
recommended for production use.
wsgi or other approaches for production scale use are also possible without mod_python
[WARNING]
Unable to import the 'memcache' module, do you have python-memcached installed for python 2.6.6?
This feature is not required but greatly improves performance.
&nbsp;
[WARNING]
Unable to import the 'ldap' module, do you have python-ldap installed for python 2.6.6?
Without python-ldap, you will not be able to use LDAP authentication in the graphite webapp.
&nbsp;
[WARNING]
Unable to import the 'twisted' package, do you have Twisted installed for python 2.6.6?
Without Twisted, you cannot run carbon on this server.
[WARNING]
Unable to import the 'txamqp' module, this is required if you want to use AMQP.
Note that txamqp requires python 2.5 or greater.
3 necessary dependencies not met. Graphite will not function until these dependencies are fulfilled.
6 optional dependencies not met. Please consider the warning messages before proceeding.</pre></div></div>

<p>Now, to get this stuff installed:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># apt-get install python-cairo
# apt-get install python-django-tagging
# apt-get install python-twisted
# apt-get install python-memcache
# apt-get install libapache2-mod-wsgi</pre></div></div>

<p>I don&#8217;t know enough about mod_python (which we&#8217;re supposed to install), but the sample vhost configuration below refers to mod_wsgi, so I installed that instead.</p>
<p>Now we configure Apache and modify the sample vhost configuration file provided:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># rm /etc/apache2/sites-enabled/000-default
# cp -a examples/example-graphite-vhost.conf /etc/apache2/sites-enabled/graphite
# cp -a conf/graphite.wsgi.example /opt/graphite/conf/graphite.wsgi
# sed -i s%&quot;@DJANGO_ROOT@/contrib/admin/media/&quot;%&quot;/usr/share/pyshared/django/contrib/admin/media/&quot;% /etc/apache2/sites-enabled/graphite
# sed -i 's%WSGISocketPrefix /etc/httpd/wsgi/%WSGISocketPrefix /var/run/apache2/wsgi%' /etc/apache2/sites-enabled/graphite</pre></div></div>

<p>Once done, go ahead and restart Apache:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># /etc/init.d/apache2 reload</pre></div></div>

<p>Finally:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># cd /opt/graphite/webapp/graphite
# python manage.py syncdb
# chown -R www-data:www-data /opt/graphite/storage/
# cd /opt/graphite/
# ./bin/carbon-cache.py start</pre></div></div>

<p>If that&#8217;s all worked, you should be able to pump data into Graphite:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># echo &quot;carbon.installation.test $RANDOM `date +%s`&quot; | nc -w 1 localhost 2003</pre></div></div>

<p>On the above, if I don&#8217;t pass -w 1 to nc, nc just sits there doing nothing.</p>
<p>Now, browsing your server&#8217;s http://x.x.x.x/ should load up the Graphite app and hopefully you can see a graph for the data you&#8217;ve sent in.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.defunct.ca/2012/01/23/fast-and-dirty-install-of-graphite-on-debian-squeeze/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using nova-network&#8217;s multi_host to remove SPOF</title>
		<link>http://blog.defunct.ca/2011/09/19/using-nova-networks-multi_host-to-remove-spof/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=using-nova-networks-multi_host-to-remove-spof</link>
		<comments>http://blog.defunct.ca/2011/09/19/using-nova-networks-multi_host-to-remove-spof/#comments</comments>
		<pubDate>Mon, 19 Sep 2011 21:32:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[OpenStack]]></category>

		<guid isPermaLink="false">http://blog.defunct.ca/?p=501</guid>
		<description><![CDATA[In http://blog.defunct.ca/2011/07/22/moving-nova-compute-to-a-separate-instance/, I was able to successfully move nova-compute to a separate instance. The only problem here is that the nova-compute instance used nova-network running on the controller, which introduced a single point of failure in our environment. If the controller dropped offline, the gateway for virtual machines running on the compute node would be [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://blog.defunct.ca/2011/07/22/moving-nova-compute-to-a-separate-instance/" title="http://blog.defunct.ca/2011/07/22/moving-nova-compute-to-a-separate-instance/">http://blog.defunct.ca/2011/07/22/moving-nova-compute-to-a-separate-instance/</a>, I was able to successfully move nova-compute to a separate instance.  The only problem here is that the nova-compute instance used nova-network running on the controller, which introduced a single point of failure in our environment.  If the controller dropped offline, the gateway for virtual machines running on the compute node would be inaccessible, meaning instances would not be able to access the outside world until the controller came back online.  </p>
<p>Fortunately, some improvements have been made to Nova as outlined in <a href="http://unchainyourbrain.com/openstack/13-networking-in-nova" title="http://unchainyourbrain.com/openstack/13-networking-in-nova">http://unchainyourbrain.com/openstack/13-networking-in-nova</a>.  Essentially, we can now run a nova-network on each compute node, which forces the compute node to be the gateway for instances running on it.  This means there&#8217;s no longer that dependency between the controller (or whatever runs nova-network) and virtual machines running on the compute node.  </p>
<p>To move to this configuration, I had to run the following on the compute nodes:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># apt-get install nova-network</pre></div></div>

<p>I then had to add the following configurations to the /etc/nova/nova.conf file on the compute nodes:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">--ec2_dmz_host=192.168.0.1
--multi_host</pre></div></div>

<p>Specifying &#8211;ec2_dmz_host=192.168.0.1 causes this iptables rule to get added:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">Chain nova-network-PREROUTING (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 DNAT       tcp  --  any    any     anywhere             169.254.169.254     tcp dpt:www to:192.168.0.1:8773</pre></div></div>

<p>&#8230; and this allows cloud-init on the Ubuntu instances to grab whatever it is they&#8217;re grabbing from the EC2 API running on the controller.  When the Ubuntu instances boot but can&#8217;t hit the EC2 API (I have 192.168.0.1 assigned to my controller, which runs the EC2 API), cloud-init seems to spin forever and the instances never really seems to boot.  If you uninstall cloud-init, the instances will boot, but configuration does not appear to be complete (ie. missing ssh keys in /etc/ssh/).  I tried using my controller&#8217;s public IP or the controller&#8217;s 10.176.65.54 address, but neither seemed to work.  The latter is understandable as the instance will not be able to hit 10.176.65.54 since it&#8217;s not attached to that network, but it was my understanding that it should be able to hit the external IP.</p>
<p>Anyway, I also removed this from /etc/nova/nova.conf on the compute nodes as we no longer have to route through the controller:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">--routing_source_ip=x.x.x.x</pre></div></div>

<p>For good measure:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># /etc/init.d/nova-compute restart
# /etc/init.d/nova-network restart</pre></div></div>

<p>Finally, I deleted my 192.168.0.0/24 on the controller and re-created it:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">nova-manage network create --fixed_range_v4=192.168.0.0/24 --num_networks=1 --network_size=256 --multi_host=T --label=test</pre></div></div>

<p>The key above is specifying the &#8211;multi_host=T.</p>
<p>This was more or less it.  Now when an instance is first started on a compute node, the compute node itself gets an IP assigned from the network above and that IP gets assigned to the bridge br100.  The instances on the host are then configured to use that IP as their gateway and traffic no longer gets routed through the controller.</p>
<p>One thing I noticed while working on this configuration was that my previous VPN connection didn&#8217;t permit multiple clients.  As such, I had to move my VPN server/clients to use tls-server and tls-client, which required a bit more work (see <a href="http://openvpn.net/index.php/open-source/documentation/howto.html#pki" title="http://openvpn.net/index.php/open-source/documentation/howto.html#pki">this</a> for more info).</p>
<p>My openvpn.server file:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">mode server
tls-server
dev tap
ifconfig 192.168.0.1 255.255.0.0
cert /etc/openvpn/controller.crt
key /etc/openvpn/controller.key
dh /usr/share/doc/openvpn/examples/easy-rsa/2.0/keys/dh1024.pem
ca /usr/share/doc/openvpn/examples/easy-rsa/2.0/keys/ca.crt
daemon</pre></div></div>

<p>&#8230; and openvpn.client for compute1:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">tls-client
remote 10.176.65.54
dev tap
cert /etc/openvpn/compute1.crt
key /etc/openvpn/compute1.key
ca /etc/openvpn/ca.crt
daemon
keepalive 10 60
up /etc/openvpn/openvpn.up
up-restart
script-security 2</pre></div></div>

<p>The /etc/openvpn/openvpn.up file contains:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">#!/bin/bash
&nbsp;
/sbin/ifconfig tap0 0.0.0.0 up
/usr/sbin/brctl addif br100 tap0
echo 0</pre></div></div>

<p>Unlike our original configuration, br100 is IPd automatically by nova-network, so we no longer need to set an IP when openvpn starts on the clients.  However, if the controller node (which subsequently runs the openvpn server) restarts, our clients cannot ping the 192.168.0.1 address even after the server comes back online.  By adding the keepalive and up/up-restart entries to the openvpn.client file, we can force openvpn to get HUPd if the connection drops (or the server reboots).</p>
<p>There&#8217;s still a bit of magic happening here, but hopefully I&#8217;ve captured enough of this configuration to reconstruct this setup if necessary.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.defunct.ca/2011/09/19/using-nova-networks-multi_host-to-remove-spof/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unable to console into Ubuntu 10.04 QEMU image</title>
		<link>http://blog.defunct.ca/2011/09/18/unable-to-console-into-ubuntu-10-04-qemu-image/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=unable-to-console-into-ubuntu-10-04-qemu-image</link>
		<comments>http://blog.defunct.ca/2011/09/18/unable-to-console-into-ubuntu-10-04-qemu-image/#comments</comments>
		<pubDate>Sun, 18 Sep 2011 00:01:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[OpenStack]]></category>

		<guid isPermaLink="false">http://blog.defunct.ca/?p=498</guid>
		<description><![CDATA[&#8230; turns out the image was missing /etc/init/ttyS0.conf: &#160; # ttyS0 - getty # # This service maintains a getty on ttyS0 from the point the system is # started until it is shut down again. &#160; start on stopped rc or RUNLEVEL=[2345] stop on runlevel [!2345] &#160; respawn exec /sbin/getty -8 38400 ttyS0 vt102 [...]]]></description>
			<content:encoded><![CDATA[<p>&#8230; turns out the image was missing /etc/init/ttyS0.conf:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">&nbsp;
# ttyS0 - getty
#
# This service maintains a getty on ttyS0 from the point the system is
# started until it is shut down again.
&nbsp;
start on stopped rc or RUNLEVEL=[2345]
stop on runlevel [!2345]
&nbsp;
respawn
exec /sbin/getty -8 38400 ttyS0 vt102</pre></div></div>

<p>Once I dropped that in there, I was able to console into the image.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.defunct.ca/2011/09/18/unable-to-console-into-ubuntu-10-04-qemu-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programmatically interfacing with novaclient</title>
		<link>http://blog.defunct.ca/2011/09/16/programmatically-interfacing-with-novaclient/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=programmatically-interfacing-with-novaclient</link>
		<comments>http://blog.defunct.ca/2011/09/16/programmatically-interfacing-with-novaclient/#comments</comments>
		<pubDate>Fri, 16 Sep 2011 11:02:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[OpenStack]]></category>

		<guid isPermaLink="false">http://blog.defunct.ca/?p=494</guid>
		<description><![CDATA[Guessing most people are aware of this, but documenting for my own knowledge. root@nova-cc:~# python Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53) [GCC 4.5.2] on linux2 Type &#34;help&#34;, &#34;copyright&#34;, &#34;credits&#34; or &#34;license&#34; for more information. &#62;&#62;&#62; from novaclient.v1_0 import client &#62;&#62;&#62; client = client.Client(USERNAME, API_KEY,PROJECT_ID [, AUTH_URL]) &#62;&#62;&#62; client.servers.list() [&#60;Server: Server 40&#62;, &#60;Server: Server 41&#62;, [...]]]></description>
			<content:encoded><![CDATA[<p>Guessing most people are aware of this, but documenting for my own knowledge.  <img src='http://blog.defunct.ca/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">root@nova-cc:~# python
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
[GCC 4.5.2] on linux2
Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
&gt;&gt;&gt; from novaclient.v1_0 import client
&gt;&gt;&gt; client = client.Client(USERNAME, API_KEY,PROJECT_ID [, AUTH_URL])
&gt;&gt;&gt; client.servers.list()
[&lt;Server: Server 40&gt;, &lt;Server: Server 41&gt;, &lt;Server: Server 42&gt;, &lt;Server: Server 43&gt;, &lt;Server: Server 44&gt;, &lt;Server: Server 45&gt;, &lt;Server: Server 46&gt;]
&gt;&gt;&gt; for server in client.servers.list():
...     server.delete()
... 
&gt;&gt;&gt; client.servers.list()
[]
&gt;&gt;&gt;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.defunct.ca/2011/09/16/programmatically-interfacing-with-novaclient/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running openstack-dashboard</title>
		<link>http://blog.defunct.ca/2011/08/02/running-openstack-dashboard/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=running-openstack-dashboard</link>
		<comments>http://blog.defunct.ca/2011/08/02/running-openstack-dashboard/#comments</comments>
		<pubDate>Tue, 02 Aug 2011 15:27:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[OpenStack]]></category>

		<guid isPermaLink="false">http://blog.defunct.ca/?p=483</guid>
		<description><![CDATA[The latest version of openstack-dashboard requires Keystone, and as I understand it this isn&#8217;t supported by the version of Nova I&#8217;m running (2011.3~d2-0ubuntu0~ppa1~natty1). Fortunately, I found this, which outlines how to use an older version of openstack-dashboard that does work without Keystone. # apt-get update # apt-get install bzr # cd /root # bzr branch [...]]]></description>
			<content:encoded><![CDATA[<p>The latest version of openstack-dashboard requires <a href="https://launchpad.net/keystone">Keystone</a>, and as I understand it this isn&#8217;t supported by the version of Nova I&#8217;m running (2011.3~d2-0ubuntu0~ppa1~natty1).  Fortunately, I found <a href="https://answers.launchpad.net/nova/+question/162549">this</a>, which outlines how to use an older version of openstack-dashboard that does work without Keystone.</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># apt-get update
# apt-get install bzr
# cd /root
# bzr branch lp:openstack-dashboard
# cd openstack-dashboard/
# bzr revert -r 46
# cd local
# cp -a local_settings.py.example local_settings.py</pre></div></div>

<p>You now need to configure local_settings.py with correct values for NOVA_DEFAULT_ENDPOINT, NOVA_DEFAULT_REGION, NOVA_ACCESS_KEY, NOVA_SECRET_KEY, NOVA_ADMIN_USER, NOVA_PROJECT.  Most of these values can be ripped out of novarc on your cloud controller.</p>
<p>Continue on with the installation:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># apt-get install -y python-setuptools
# easy_install virtualenv
# python tools/install_venv.py
# tools/with_venv.sh dashboard/manage.py syncdb</pre></div></div>

<p>When you run &#8220;dashboard/manage.py syncdb&#8221;, it&#8217;ll prompt you asking if you want to create a Django superuser (since none exist at this point).  I answered yes, entering a username that matched the value of NOVA_ADMIN_USER.  I initially tried creating a Django user with a different username, and upon logging into openstack-dashboard I failed to see my Nova project.
</pre>
<p>Lastly, go ahead and start up the server:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># tools/with_venv.sh dashboard/manage.py runserver 0.0.0.0:8000</pre></div></div>

<p>At this point, you should be able to access your dashboard on http://x.x.x.x:8000, replacing x.x.x.x with your openstack-dashboard server's IP.</p>
<p>If you run into any issues, refer to <a href="http://docs.openstack.org/bexar/openstack-compute/admin/content/ch06s02.html">this</a>, which contains valid information for this particular version of the dashboard.</p>
<p>Again, running with this old version of the dashboard isn't ideal, and you certainly don't want to run it as root, but hopefully this will point you in the right direction if you struggle to get the latest version to work with Nova.  My next task will to be to get a version of the dashboard and Nova which work together installed and operational.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.defunct.ca/2011/08/02/running-openstack-dashboard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moving nova-compute to a separate instance</title>
		<link>http://blog.defunct.ca/2011/07/22/moving-nova-compute-to-a-separate-instance/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=moving-nova-compute-to-a-separate-instance</link>
		<comments>http://blog.defunct.ca/2011/07/22/moving-nova-compute-to-a-separate-instance/#comments</comments>
		<pubDate>Fri, 22 Jul 2011 21:50:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[OpenStack]]></category>

		<guid isPermaLink="false">http://blog.defunct.ca/?p=468</guid>
		<description><![CDATA[I want to quickly document how I accomplished this. Again, I used virtual machines (running Ubuntu Natty), but used public cloud server instances rather than private virtual machines. First things first. Here&#8217;s the eth1 (private network) addresses assigned to my cloud servers: nova-cc (our Nova cloud controller node): eth1: 10.176.65.54 nova-compute (our Nova compute note, [...]]]></description>
			<content:encoded><![CDATA[<p>I want to quickly document how I accomplished this.  Again, I used virtual machines (running Ubuntu Natty), but used public cloud server instances rather than private virtual machines.  </p>
<p>First things first.  Here&#8217;s the eth1 (private network) addresses assigned to my cloud servers:</p>
<p>nova-cc (our Nova cloud controller node):</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">eth1: 10.176.65.54</pre></div></div>

<p>nova-compute (our Nova compute note, which will run our instances (QEMU or UML):</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">eth1: 10.176.95.220</pre></div></div>

<p>Similar to previous posts, I went ahead and used 192.168.0.0/16 for Nova network as I didn&#8217;t have public IPs, nor did I want to interfere with the 10.176.64.0/18 network which is already used by this cloud provider.</p>
<p>On nova-cc, we need to install mysqld.  Nova defaults to using SQLite, which works great when everything is running off a single instance.  However, now that we&#8217;ve got another instance that needs to talk to nova-cc, we need a SQL server that it can connect to.</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># apt-get update
# apt-get install mysql-server</pre></div></div>

<p>Once installed, edit /etc/mysql/my.cnf and change this from:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">bind-address            = 127.0.0.1</pre></div></div>

<p>to:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">bind-address            = 10.176.65.54</pre></div></div>

<p>Finally, restart mysqld:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># service mysql restart</pre></div></div>

<p>Now hop into the mysql shell and create a database and user/password to connect with:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># mysql -u root
mysql&gt; CREATE DATABASE nova;
mysql&gt; GRANT ALL PRIVILEGES ON nova.* TO nova@10.176.65.54 IDENTIFIED BY 'somepasshere';
mysql&gt; GRANT ALL PRIVILEGES ON nova.* TO nova@10.176.95.220 IDENTIFIED BY 'somepasshere';</pre></div></div>

<p>On nova-compute, the only nova-related package you really need is nova-compute:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># apt-get -y install python-software-properties
# add-apt-repository ppa:nova-core/milestone
# apt-get update
# apt-get install nova-compute</pre></div></div>

<p>On both nova-cc and nova-compute:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># cat &gt;&gt; /etc/nova/nova.conf &lt;&lt; &quot;EOF&quot;
--sql_connection=mysql://somepasshere@10.176.65.54/nova
--image_service=nova.image.glance.GlanceImageService
--glance_api_servers=10.176.65.54:9292
--rabbit_host=10.176.65.54
EOF
# for SERVICE in `ls -1 /etc/init.d/nova*`; do service $SERVICE restart; done</pre></div></div>

<p>Now what we need to do is create our 192.68.0.0/16 network.  We&#8217;ll use OpenVPN to do this, and we&#8217;ll use the eth1 private network (10.176.64.0/18) to do this this.  Again, the idea here is to have a completely separate network which won&#8217;t interfere with what&#8217;s already out there.</p>
<p>On both:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># apt-get install openvpn</pre></div></div>

<p>On nova-cc:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># cd /etc/openvpn
# openvpn --genkey --secret openvpn.key
# scp openvpn.key root@10.176.95.220:/etc/openvpn
# cat &gt; /etc/openvpn/openvpn.server &lt;&lt; &quot;EOF&quot;
dev tap
ifconfig 192.168.0.1 255.255.255.0
secret /etc/openvpn/openvpn.key
daemon
EOF
# cat &gt; /etc/network/if-pre-up.d/00openvpn &lt;&lt; &quot;EOF&quot;
#!/bin/bash
&nbsp;
/usr/sbin/openvpn --config /etc/openvpn/openvpn.server
&nbsp;
exit 0
EOF
# chmod 755 /etc/network/if-pre-up.d/00openvpn</pre></div></div>

<p>On nova-compute:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># cat &gt; /etc/openvpn/openvpn.client &lt;&lt; &quot;EOF&quot;
remote 10.176.65.54
dev tap
ifconfig 192.168.0.3 255.255.255.0
secret /etc/openvpn/openvpn.key
daemon
EOF
# cat &gt; /etc/network/if-pre-up.d/00openvpn &lt;&lt; &quot;EOF&quot;
#!/bin/bash
&nbsp;
/usr/sbin/openvpn --config /etc/openvpn/openvpn.client
&nbsp;
/usr/sbin/brctl addbr br100
/usr/sbin/brctl addif br100 tap0
&nbsp;
/sbin/ifconfig tap0 0.0.0.0
/sbin/ifconfig br100 192.168.0.3
&nbsp;
exit 0
EOF
# chmod 755 /etc/network/if-pre-up.d/00openvpn</pre></div></div>

<p>Finally, on both nodes:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># echo &quot;--flat_interface=tap0&quot; &gt;&gt; /etc/nova/nova/.conf</pre></div></div>

<p>This causes nova-network to bridge into tap0.</p>
<p>Let&#8217;s recap what we&#8217;ve done.  On nova-cc, we&#8217;re configuring OpenVPN to act as a server.  We&#8217;re bringing tap0 up with IP 192.168.0.1/24 and the <em>/etc/network/if-pre-up.d/00openvpn</em> script ensures that the VPN server is started on on boot (specifically, before the other network devices are brought up).  On nova-compute, we configure OpenVPN as a client, and the <em>/etc/network/if-pre-up.d/00openvpn</em> script creates a bridge (br100), adds the tap0 interface to it, and then brings 192.168.0.3 up on br100.  If I recall correctly, the tap0 device doesn&#8217;t appear to be &#8220;up&#8221; until we ifconfig it, which is why we just set it to 0.0.0.0.  Don&#8217;t quote me on this though, as I can&#8217;t quite remember.  <img src='http://blog.defunct.ca/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>I know very little about bridging, but essentially a bridge &#8220;connects two or more different physical ethernets together to form one large (logical) ethernet&#8221; (taken from <em>/usr/share/doc/bridge-utils/HOWTO</em>), and this is precisely what we have done here.  We bridge the virtual interfaces for running instances (ie. vnet0) with tap0 (our VPN connection), which means that nova-cc can speak to instances running on nova-compute, and vice-versa.  This is also essential as dnsmasq (our DHCP server) runs on nova-cc (spawned by nova-network), and without this bridging in place our instances would not be able to have their networking configured automatically on boot by the DHCP server.</p>
<p>Also, the reason why we don&#8217;t have to explicitly configure br100 on nova-cc is because that runs nova-network, which handles the bridging automatically.  The only thing we did need to do on the nova-cc side is instruct nova-network on which device to bridge into (&#8211;flat_interface=tap0).  The last thing I&#8217;ll say here is that OpenVPN used device tun0 by default, but we have to use tap0 (a virtual Ethernet adapter) as brctl creates Ethernet bridges, and a tun device is a &#8220;virtual point-to-point&#8221; link (see <a href="http://openvpn.net/index.php/open-source/faq/75-general/305-what-is-the-difference-between-a-tun-device-and-a-tap-device.html">this</a> for a tad more info).</p>
<p>Go ahead and reboot each instance, one at a time, to ensure that everything comes up as expected.</p>
<p>Once back up, on nova-cc:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># mysql -u root nova
mysql&gt; SELECT * FROM fixed_ips WHERE id=4;
+---------------------+---------------------+------------+---------+----+-------------+------------+-------------+-----------+--------+----------+
| created_at          | updated_at          | deleted_at | deleted | id | address     | network_id | instance_id | allocated | leased | reserved |
+---------------------+---------------------+------------+---------+----+-------------+------------+-------------+-----------+--------+----------+
| 2011-07-22 16:21:35 | 2011-07-22 20:48:26 | NULL       |       0 |  4 | 192.168.0.3 |          1 |        NULL |         0 |      0 |        0 |
+---------------------+---------------------+------------+---------+----+-------------+------------+-------------+-----------+--------+----------+
1 row in set (0.00 sec)
&nbsp;
mysql&gt; UPDATE fixed_ips SET reserved=1 WHERE id=4 LIMIT 1;</pre></div></div>

<p>What we&#8217;re doing here is &#8220;reserving&#8221; 192.168.0.3 for the other end of the VPN link on nova-compute.  192.168.0.2 is already reserved, but I&#8217;m not sure if nova uses this or will use it for something at some point.  As such, just play it safe and reserve another available IP.</p>
<p>In theory, if you now launch an instance on nova-cc, it should build on nova-compute and the IP assigned should be accessible via nova-cc.  The instance on nova-compute will have a gateway of 192.168.0.1 (which is physically on nova-cc), which means that all traffic in and out of the instance will travel through nova-cc.  This also means that if nova-cc goes down, instances will not be able to communicate with the outside world (or potentially each other, though I&#8217;ve not tested myself).</p>
<p>That should be able it.  I&#8217;ve probably missed a few things, but the general gist should be here.  Also, I&#8217;m aware that there are no security best-practices implemented here, but the idea is to just get everything up and running as a proof of concept, and fine-tune later.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.defunct.ca/2011/07/22/moving-nova-compute-to-a-separate-instance/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Can&#8217;t ssh to UML instances when creating w/ valid keypair</title>
		<link>http://blog.defunct.ca/2011/07/14/cannot-ssh-to-uml-instances-when-creating-w-valid-keypair/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=cannot-ssh-to-uml-instances-when-creating-w-valid-keypair</link>
		<comments>http://blog.defunct.ca/2011/07/14/cannot-ssh-to-uml-instances-when-creating-w-valid-keypair/#comments</comments>
		<pubDate>Thu, 14 Jul 2011 22:13:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[OpenStack]]></category>

		<guid isPermaLink="false">http://blog.defunct.ca/?p=455</guid>
		<description><![CDATA[While creating UML instances on nova, I noticed I wasn&#8217;t able to ssh into my instances using the keypair I previously created. Looking at the logs on the nova-compute node, I saw: 2011-07-13 21:15:22,256 INFO nova.virt.libvirt_conn [-] instance instance-0000003d: injecting key into image 3 2011-07-13 21:15:22,256 DEBUG nova.utils [-] Running cmd (subprocess): sudo losetup --find [...]]]></description>
			<content:encoded><![CDATA[<p>While creating UML instances on nova, I noticed I wasn&#8217;t able to ssh into my instances using the keypair I previously created.  Looking at the logs on the nova-compute node, I saw:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">2011-07-13 21:15:22,256 INFO nova.virt.libvirt_conn [-] instance instance-0000003d: injecting key into image 3
2011-07-13 21:15:22,256 DEBUG nova.utils [-] Running cmd (subprocess): sudo losetup --find --show /var/lib/nova/instances/instance-0000003d/disk from (pid=838) execute /usr/lib/pymodules/python2.7/nova/utils.py:143
2011-07-13 21:15:22,424 DEBUG nova.utils [-] Running cmd (subprocess): sudo kpartx -a /dev/loop0 from (pid=838) execute /usr/lib/pymodules/python2.7/nova/utils.py:143
2011-07-13 21:15:22,509 DEBUG nova.utils [-] Running cmd (subprocess): sudo kpartx -d /dev/loop0 from (pid=838) execute /usr/lib/pymodules/python2.7/nova/utils.py:143
2011-07-13 21:15:22,563 DEBUG nova.utils [-] Running cmd (subprocess): sudo losetup --detach /dev/loop0 from (pid=838) execute /usr/lib/pymodules/python2.7/nova/utils.py:143
2011-07-13 21:15:22,604 WARNING nova.virt.libvirt_conn [-] instance instance-0000003d: ignoring error injecting data into image 3 (Mapped device was not found (we can only inject raw disk images): /dev/mapper/loop0p1)</pre></div></div>

<p>I tried running the kpartx commands above, but they didn&#8217;t return anything.  This was because the <a href="http://fs.devloop.org.uk/filesystems/CentOS-5.6/CentOS5.6-AMD64-root_fs.bz2">image</a> I was using had no partition table.  </p>
<p>To fix, I effectively created a new image and copied data from the original one.</p>
<p>To begin, create a spare file (see <a href="https://wiki.archlinux.org/index.php/Sparse_file">this</a> for more info):</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># cd /root
# dd if=/dev/zero of=CentOS5.6-AMD64-new-root_fs bs=1 count=0 seek=1024M</pre></div></div>

<p>Now, create a partition to span the entire disk (replace /dev/loop0 with whatever losetup returns):</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># losetup --show --find CentOS5.6-AMD64-new-root_fs
/dev/loop0
# fdisk /dev/loop0</pre></div></div>

<p>Now, use kpartx to make the partition visible to the host, and create a filesystem on that partition:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># parted
# kpartx -a /dev/loop0
# mke2fs -j /dev/mapper/loop0p1</pre></div></div>

<p>Mount the original image and copy data over:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># losetup --show --find CentOS5.6-AMD64-root_fs 
/dev/loop1
# mkdir /mnt/loop{0,1}
# mount /dev/mapper/loop0p1 /mnt/loop0
# mount /dev/loop1 /mnt/loop1
# cd /mnt/loop1
# rsync -a . /mnt/loop0</pre></div></div>

<p>Update the fstab on the new image (this is necessary as the partition layout has now changed):</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># cd /mnt/loop0/etc
# sed -i 's/ubda/ubda1/g' fstab
# cd /
# umount /mnt/loop{0,1}
# kpartx -d /dev/loop0
# losetup -d /dev/loop{0,1}</pre></div></div>

<p>Modify /etc/nova/libvirt.xml.template, changing this line from:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">&lt;root&gt;/dev/ubda&lt;/root&gt;</pre></div></div>

<p>to:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">&lt;root&gt;/dev/ubda1&lt;/root&gt;</pre></div></div>

<p>That should be about it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.defunct.ca/2011/07/14/cannot-ssh-to-uml-instances-when-creating-w-valid-keypair/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using UML instances on OpenStack Nova</title>
		<link>http://blog.defunct.ca/2011/07/02/using-uml-instances-on-openstack-nova/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=using-uml-instances-on-openstack-nova</link>
		<comments>http://blog.defunct.ca/2011/07/02/using-uml-instances-on-openstack-nova/#comments</comments>
		<pubDate>Fri, 01 Jul 2011 23:58:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[OpenStack]]></category>

		<guid isPermaLink="false">http://blog.defunct.ca/?p=436</guid>
		<description><![CDATA[As mentioned in http://blog.defunct.ca/?p=411, I&#8217;m running OpenStack on a XenServer virtual machine and need to be able to use something like UML to run instances from within the VM. I had to hack a number of things in order to get this to work. First things first. Let&#8217;s get install user-mode-linux: # apt-get update # [...]]]></description>
			<content:encoded><![CDATA[<p>As mentioned in <a href="http://blog.defunct.ca/?p=411">http://blog.defunct.ca/?p=411</a>, I&#8217;m running OpenStack on a XenServer virtual machine and need to be able to use something like UML to run instances from within the VM.  I had to hack a number of things in order to get this to work.</p>
<p>First things first.  Let&#8217;s get install user-mode-linux:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># apt-get update
# apt-get install user-mode-linux</pre></div></div>

<p>Now, grab the CentOS 5.6 x86_64 image from <a href="http://fs.devloop.org.uk/">http://fs.devloop.org.uk/</a> (we&#8217;re using a 64-bit XenServer VM):</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># cd /root
# wget http://fs.devloop.org.uk/filesystems/CentOS-5.6/CentOS5.6-AMD64-root_fs.bz2
# bunzip2 CentOS5.6-AMD64-root_fs.bz2</pre></div></div>

<p>There is an image on <a href="http://wiki.openstack.org/Nova/UML">http://wiki.openstack.org/Nova/UML</a>, however I couldn&#8217;t get this image to boot properly.  As such, I opted for the CentOS 5.6 image above.</p>
<p>A few things within the image needed adjusting, so I:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># mkdir /mnt/image
# losetup --find --show CentOS5.6-AMD64-root_fs
/dev/loop0
# mount /dev/loop0 /mnt/image
# cp -a /usr/lib/uml/modules/2.6.35.1/ /mnt/image/lib/modules/
# chroot /mnt/image
# sed -i 's@LABEL=ROOT@/dev/ubda@g' /etc/fstab
# chkconfig network on
# exit
# umount /mnt/image
# losetup -d /dev/loop0</pre></div></div>

<p>Note that /usr/lib/uml/modules/2.6.35.1/ is provided by the user-mode-linux package on Ubuntu 10.10, so adjust accordingly to what you&#8217;re running.  Also, UML seems to use device /dev/ubda, so we modify /etc/fstab w/ that.</p>
<p>Now we can bundle up the image:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># cd /root
# euca-bundle-image -i CentOS5.6-AMD64-root_fs
# euca-upload-bundle -b uml-image-bucket -m /tmp/CentOS5.6-AMD64-root_fs.manifest.xml
# euca-register uml-image-bucket/CentOS5.6-AMD64-root_fs.manifest.xml</pre></div></div>

<p>Once that&#8217;s done, we remove this from /etc/nova/nova.conf:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">--libvirt_type=qemu</pre></div></div>

<p>&#8230; and add this:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">--libvirt_type=uml
--use_cow_images=false
--libvirt_xml_template=/etc/nova/libvirt.xml.template</pre></div></div>

<p>Since I&#8217;ve specified &#8211;libvirt_xml_template in /etc/nova/nova.conf, we need to now create that file:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># cp -a /usr/share/pyshared/nova/virt/libvirt.xml.template /etc/nova/libvirt.xml.template</pre></div></div>

<p>Now open up /etc/nova/libvirt.xml.template and remove the following:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">#if $getVar('vncserver_host', False)
        &lt;graphics type='vnc' port='-1' autoport='yes' keymap='en-us' listen='${vncserver_host}'/&gt;
#end if</pre></div></div>

<p>The reason for doing this is because it appears that we run into an issue similar to the one reported in <a href="https://bugs.launchpad.net/nova/+bug/749973">here</a>.  Update: I&#8217;ve since created a bug report for this UML issue <a href="https://bugs.launchpad.net/nova/+bug/805083">here</a>.</p>
<p>Now we can restart the nova-compute service and create an instance:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># service nova-compute restart
# euca-run-instances ami-778c501e -k mykey -t m1.tiny</pre></div></div>

<p>(replace ami-778c501e with your image name, which can be found by running euca-describe-images)</p>
<p>If your instance doesn&#8217;t go into a running state, have a look at the libvirt.xml file under /var/lib/nova/instances/####/ (replacing #### w/ your instance&#8217;s name, found by running euca-describe-instances), ensuring that there is no reference to the vnc stuff in there.  If there is, then the template hasn&#8217;t been updated or isn&#8217;t being used correctly.  Otherwise, your instance should be ssh-able, using the IP returned by euca-describe-instances.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.defunct.ca/2011/07/02/using-uml-instances-on-openstack-nova/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenStack Nova install on an Ubuntu 10.10 XenServer virtual machine</title>
		<link>http://blog.defunct.ca/2011/07/01/openstack-nova-install-on-an-ubuntu-10-10-xenserver-virtual-machine/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=openstack-nova-install-on-an-ubuntu-10-10-xenserver-virtual-machine</link>
		<comments>http://blog.defunct.ca/2011/07/01/openstack-nova-install-on-an-ubuntu-10-10-xenserver-virtual-machine/#comments</comments>
		<pubDate>Fri, 01 Jul 2011 08:37:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[OpenStack]]></category>

		<guid isPermaLink="false">http://blog.defunct.ca/?p=411</guid>
		<description><![CDATA[Most of these instructions have been taken from the following two URLs: http://wiki.openstack.org/NovaInstall/DevPkgInstall http://wiki.openstack.org/RunningNova However, I needed some additional steps to get this working in my virtualized environment. Anyway, let&#8217;s get started. First off, get the VM&#8217;s package index and installed packages updated: # apt-get update # apt-get upgrade Now we start with the Nova [...]]]></description>
			<content:encoded><![CDATA[<p>Most of these instructions have been taken from the following two URLs:</p>
<p><a href="http://wiki.openstack.org/NovaInstall/DevPkgInstall">http://wiki.openstack.org/NovaInstall/DevPkgInstall</a><br />
<a href="http://wiki.openstack.org/RunningNova">http://wiki.openstack.org/RunningNova</a></p>
<p>However, I needed some additional steps to get this working in my virtualized environment.</p>
<p>Anyway, let&#8217;s get started.  First off, get the VM&#8217;s package index and installed packages updated:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># apt-get update
# apt-get upgrade</pre></div></div>

<p>Now we start with the Nova installation:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># apt-get install rabbitmq-server
# apt-get install python-software-properties
# add-apt-repository ppa:nova-core/milestone
# apt-get update
# apt-get install python-nova
# apt-get install nova-common nova-doc nova-api nova-network nova-objectstore nova-scheduler nova-compute euca2ools unzip</pre></div></div>

<p>A listing of available OpenStack PPAs is available <a href="http://wiki.openstack.org/PPAs">here</a>.  I&#8217;ve opted to use ppa:nova-core/milestone, which is the &#8220;last development milestone&#8221;.</p>
<p>Instead of creating a file for volumes (as outlined in <a href="http://wiki.openstack.org/RunningNova">http://wiki.openstack.org/RunningNova</a>), I create a partition at the end of my disk (since there&#8217;s free space), and use that instead.  Note that I set the partition to Linux LVM (8e), since we&#8217;ll be using LVM.</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># fdisk /dev/sda
# partprobe
# apt-get install lvm2
# vgcreate nova-volumes /dev/sda2</pre></div></div>

<p>Update: This volume doesn&#8217;t appear to get used when creating images of type qemu or uml.</p>
<p>Now we create a network to be used by our instances.  I didn&#8217;t use 10.0.0.0/8 as per <a href="http://wiki.openstack.org/RunningNova">http://wiki.openstack.org/RunningNova</a>, as my VM is already connected to a subnet in that network, so I use 192.168.0.0/16 instead.</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># nova-manage network create 192.168.0.0/16 1 256</pre></div></div>

<p>This creates:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># nova-manage network list
network           	netmask        	start address  	DNS            
192.168.0.0/24    	255.255.255.0  	192.168.0.3    	None           
#</pre></div></div>

<p>What we now do is create an admin user, create a project, and unzip nova.zip into /root.  Sourcing novarc sets up all our environment variables, and will need to be run each time we log out and back into the host.</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># cd /root
# nova-manage user admin mattt
# nova-manage project create test mattt
# nova-manage project zipfile test mattt
# unzip nova.zip 
Archive:  nova.zip
 extracting: novarc                  
 extracting: pk.pem                  
 extracting: cert.pem                
 extracting: cacert.pem              
# . novarc</pre></div></div>

<p>Now we grab a Linux image to use for our instances, and register it:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># cd /root
# wget http://uec-images.ubuntu.com/releases/10.04/release/ubuntu-10.04-server-uec-amd64.tar.gz
# uec-publish-tarball ubuntu-10.04-server-uec-amd64.tar.gz mybucket
Fri Jul  1 09:23:53 UTC 2011: ====== extracting image ======
Warning: no ramdisk found, assuming '--ramdisk none'
kernel : lucid-server-uec-amd64-vmlinuz-virtual
ramdisk: none
image  : lucid-server-uec-amd64.img
Fri Jul  1 09:24:12 UTC 2011: ====== bundle/upload kernel ======
Fri Jul  1 09:24:14 UTC 2011: ====== bundle/upload image ======
Fri Jul  1 09:25:23 UTC 2011: ====== done ======
emi=&quot;ami-3d4b2b15&quot;; eri=&quot;none&quot;; eki=&quot;aki-4eb969b8&quot;;
#</pre></div></div>

<p>We should now be able to list the image:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># euca-describe-images 
IMAGE	aki-4eb969b8	mybucket/lucid-server-uec-amd64-vmlinuz-virtual.manifest.xml		available	public		x86_64	kernel		
IMAGE	ami-3d4b2b15	mybucket/lucid-server-uec-amd64.img.manifest.xml		available	public		x86_64	machine	aki-4eb969b8	
#</pre></div></div>

<p>Note that when using ppa:nova-core/trunk, I had to do the following to get this to work:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># apt-get install glance
# glance-control api start</pre></div></div>

<p>I&#8217;ll need to circle back to ppa:nova-core/trunk later and see why the default install relies on glance, but doesn&#8217;t install it.</p>
<p>Now we create an ssh key to inject into our images, and we go ahead and spawn an instance.  We use the ami for the image registered above (ami-3d4b2b15 in this case):</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># euca-add-keypair mykey &gt; mykey.priv
# chmod 600 mykey.priv
# euca-run-instances ami-3d4b2b15 -k mykey -t m1.tiny
RESERVATION	r-hcvy99xp	test	default
INSTANCE	i-00000002	ami-3d4b2b15			scheduling	mykey (test, None)	0		m1.tiny	2011-07-01T09:33:39Z	unknown zone
#</pre></div></div>

<p>We should now be able to list our instances, and see the status as &#8220;running&#8221;:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># euca-describe-instances
RESERVATION	r-hcvy99xp	test	default
INSTANCE	i-00000002	ami-3d4b2b15	192.168.0.4	192.168.0.4	running	mykey (test, nova-blog-1gb)	0		m1.tiny	2011-07-01T09:33:39Z	nova
#</pre></div></div>

<p>Note that my original instance creation failed, as it was trying to (by default) create a KVM instance.  Since my hardware doesn&#8217;t support KVM, and I&#8217;m running within a VM already, I had to append this to /etc/nova/nova.conf:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># echo &quot;--libvirt_type=qemu&quot; &gt;&gt; /etc/nova/nova.conf
# service nova-compute restart</pre></div></div>

<p>We should in theory be able to use UML instead of qemu (see <a href="http://wiki.openstack.org/Nova/UML">http://wiki.openstack.org/Nova/UML</a>), but I haven&#8217;t fully tested this.  More information to come.</p>
<p>My instance should now be accessible over the network:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># ping -c 1 192.168.0.4
PING 192.168.0.4 (192.168.0.4) 56(84) bytes of data.
64 bytes from 192.168.0.4: icmp_req=1 ttl=64 time=0.000 ms
&nbsp;
--- 192.168.0.4 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.000/0.000/0.000/0.000 ms
#</pre></div></div>

<p>The IP for the instance can be found via  euca-describe-instances executed above.</p>
<p>Assuming the instance is pingable, I should be able to ssh into it:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># euca-authorize -P tcp -p 22 default
# ssh -i mykey.priv root@192.168.0.4</pre></div></div>

<p>Note that I didn&#8217;t actually have to run euca-authorize in order to ssh into my instance, so I suspect the default security group allows all.</p>
<p>Lastly, you can terminate the instance:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># euca-terminate-instances i-00000002</pre></div></div>

<p>The one final thing I will say is that in order for my instances to be able to access the public Internet, I had to add the following to /etc/nova/nova.conf (replacing x.x.x.x w/ my VM&#8217;s public IP address):</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># echo &quot;--routing_source_ip=x.x.x.x&quot; &gt;&gt; /etc/nova/nova.conf
# echo &quot;--fixed_range=192.168.0.0/24&quot; &gt;&gt; /etc/nova/nova.conf
# service nova-network restart</pre></div></div>

<p>This causes the correct POSTROUTING chain SNAT rules in the nat table to get created, allowing my instance on the 192.168.0.0/24 network to reach the public Internet.</p>
<p>Please let me know if you see any glaringly obvious errors here, and again 99% of this information was obtained from <a href="http://wiki.openstack.org/NovaInstall/DevPkgInstall">http://wiki.openstack.org/NovaInstall/DevPkgInstall</a> and <a href="http://wiki.openstack.org/RunningNova">http://wiki.openstack.org/RunningNova</a>.  I haven&#8217;t given thorough info on what all the commands do as quite frankly I don&#8217;t know myself, but will circle back once I have more knowledge on everything.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.defunct.ca/2011/07/01/openstack-nova-install-on-an-ubuntu-10-10-xenserver-virtual-machine/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cleanly creating a Fedora 14 xen domU from an existing Fedora 14 VM</title>
		<link>http://blog.defunct.ca/2011/02/13/quickly-creating-xen-domu-from/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=quickly-creating-xen-domu-from</link>
		<comments>http://blog.defunct.ca/2011/02/13/quickly-creating-xen-domu-from/#comments</comments>
		<pubDate>Sun, 13 Feb 2011 00:19:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://blog.defunct.ca/?p=400</guid>
		<description><![CDATA[I recently found myself wanting to use a Fedora 14 xen domU on my Debian Lenny dom0, but kept running into problems trying to build Fedora VMs using xen-tools. Although I previously wrote about creating VMs using qemu, I didn&#8217;t have access to a graphical environment w/ qemu and needed another solution. A quick google [...]]]></description>
			<content:encoded><![CDATA[<p>I recently found myself wanting to use a Fedora 14 xen domU on my Debian Lenny dom0, but kept running into problems trying to build Fedora VMs using xen-tools.  Although I previously <a href="http://blog.defunct.ca/?p=95">wrote</a> about creating VMs using qemu, I didn&#8217;t have access to a graphical environment w/ qemu and needed another solution.  A quick google search returned the following <a href="http://www.virtuatopia.com/index.php/Building_a_Xen_Guest_Root_Filesystem_using_yum_and_rpm">link</a>, and thankfully this worked a treat.</p>
<p>Using my <a href="http://www.rackspacecloud.com">Rackspace Cloud Servers</a> account, I fired up a Fedora 14 VM and once logged in ran:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># mkdir -p /xen/var/lib/rpm
# mkdir -p /xen/var/log
# touch /xen/var/log/yum.log
# rpm --root /xen --initdb</pre></div></div>

<p>I then installed the Fedora 14-specific release package:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># rpm -ihv --nodeps --root /xen fedora-release-14-1.noarch</pre></div></div>

<p>Finally, I went ahead and installed all <em>Core</em> packages (a more minimal package set than <em>Base</em>, which is what was used in the original post):</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># yum --installroot=/xen -y groupinstall Core</pre></div></div>

<p>At this point, I tar&#8217;d up /xen and copied over to my xen dom0.  Sadly, this Fedora 14 domU wouldn&#8217;t boot w/ the vmlinuz-2.6.26-2-xen-amd64 kernel on Debian Lenny, but fortunately I had access to a newer pv-ops kernel that does work.  Once I copied kernel modules into the domU and did some final last configurations (setting root password, modifying /etc/fstab), the VM was bootable and appeared to work fine.</p>
<p>In retrospect, I could probably remove some unnecessary packages such as kernel, grub, and so on, but that&#8217;s pretty insignificant and aren&#8217;t worth messing about with at this point in time.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.defunct.ca/2011/02/13/quickly-creating-xen-domu-from/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

