A mash up of openstack and pacemaker-cloud

This is a mash up of openstack and pacemaker-cloud

1) Setup openstackĀ  (from https://fedoraproject.org/wiki/Getting_started_with_OpenStack_Nova)
mkdir nova-test-day && cd nova-test-day/
sudo yum install --enablerepo=updates-testing openstack-nova
sudo service rabbitmq-server start
sudo chkconfig rabbitmq-server on
for svc in api registry; do sudo service openstack-glance-$svc start; done
for svc in api registry; do sudo chkconfig openstack-glance-$svc on; done
sudo dd if=/dev/zero of=/var/lib/nova/nova-volumes.img bs=1M seek=20k count=0
sudo vgcreate nova-volumes $(sudo losetup --show -f /var/lib/nova/nova-volumes.img)
for svc in api objectstore compute network volume scheduler; do sudo service openstack-nova-$svc start; done
for svc in api objectstore compute network volume scheduler; do sudo chkconfig openstack-nova-$svc on; done
sudo nova-manage user admin asalkeld
sudo nova-manage project create deployment1 asalkeld
sudo nova-manage network create openstack-net 1 256 --bridge=br0
sudo nova-manage project zipfile deployment1 asalkeld
sudo chmod 600 nova.zip
sudo chown asalkeld:salkeld nova.zip
mkdir novacreds && cd novacreds
unzip ../nova.zip
. ./novarc
ssh-keygen -f nova_key
euca-add-keypair nova_key > nova_key.priv
chmod 600 nova*

2) Install pacemaker-cloud and oz
sudo yum install pacemaker-cloud oz

3) create the image using oz

cat f15-ha.tdl
 <description>My Fedora 15 x86_64 template</description>
  <install type='iso'>
    <package name="httpd"><file>httpd</file></package>
    <package name="vim"><file>vim</file></package>
    <package name="dmidecode"><file>dmidecode</file></package>
    <package name="matahari-host"><file>matahari-host</file></package>
    <package name="matahari-service"><file>matahari-service</file></package>
    <package name="resource-agents"><file>resource-agents</file></package>
   <command name='update-all'>yum -y update</command>
   <command name='setup-rc-local'>
sed -i 's/rhgb quiet/console=ttyS0/' /boot/grub/grub.conf

cat >> /etc/rc.local &lt;&lt; EOF
if [ ! -d /root/.ssh ]; then
  mkdir -p /root/.ssh
  chmod 700 /root/.ssh

# Fetch public key using HTTP
while [ ! -f /root/.ssh/authorized_keys ]; do
    curl -f > /tmp/aws-key 2>/dev/null
    if [ \$? -eq 0 ]; then
        cat /tmp/aws-key >> /root/.ssh/authorized_keys
        chmod 0600 /root/.ssh/authorized_keys
        restorecon /root/.ssh/authorized_keys
        rm -f /tmp/aws-key
        echo "Successfully retrieved AWS public key from instance metadata"
        FAILED=\$((\$FAILED + 1))
        if [ \$FAILED -ge \$ATTEMPTS ]; then
            echo "Failed to retrieve AWS public key after \$FAILED attempts, quitting"
        echo "Could not retrieve AWS public key (attempt #\$FAILED/\$ATTEMPTS), retrying in 5 seconds..."
        sleep 5

while true ; do
    gdbus introspect --system --dest org.freedesktop.NetworkManager --object-path /org/freedesktop/NetworkManager/Devices/0 | grep \"State = 100\" > /dev/null
    if [ \$? -eq 0 ] ; then
    sleep 1
systemctl start matahari-host.service
systemctl start matahari-service.service

sudo oz-install -d4 -u f15-ha.tdl

6) Start qpid
sudo systemctl start pcloud-qpidd.service

7) Start the image

sudo nova-manage image image_register /var/lib/libvirt/images/fedora15_x86_64.dsk asalkeld f15
glance index
sudo modprobe nbd
euca-run-instances f15 -k nova_key

8) On the vm

ssh -i nova_key.priv root@
setenforce 0
vim /etc/sysconfig/selinux
# ^ make permissive
vim /etc/sysconfig/matahari
# ^ set broker to br0 ip address ( for me)
vim /etc/sysconfig/network
# ^ set hostname to f15
systemctl restart matahari-service.service
systemctl restart matahari-host.service

systemctl status httpd.service
httpd.service - LSB: start and stop Apache HTTP Server
	  Loaded: loaded (/etc/rc.d/init.d/httpd)
	  Active: inactive (dead)
	  CGroup: name=systemd:/system/httpd.service
# ^ note httpd not running

9) Get the vm uuid

qmf: list agents
QMF Agents:
       Id  Vendor               Product  Instance                              Epoch
    *  1   apache.org           qpidd    a41e4388-6fe6-4378-b605-c88152917348  1
       2   matahariproject.org  host     50f5d0b7-2e14-4dbc-916a-313fd333a4e8  1
       3   matahariproject.org  service  a1a67db6-86aa-459f-a5f6-ea618d078b34  1
qmf: set default  3
qmf: query Resources org.matahariproject
Data Objects Returned: 1:
    Number  Data Address
    1       Resources
qmf: show 1
    Name      Value
    hostname  f15
    uuid      006a52d3345c7bca8732f92fed1d97b9
qmf: quit

10) Create the deployment1.xml

vim /var/run/deployment1.xml

# so make sure the uuid is the same as the one above

cat /var/run/deployment1.xml
<?xml version="1.0"?>
<deployable name="deployment1" uuid="deployment1">
    <assembly name="f15" uuid="006a52d3345c7bca8732f92fed1d97b9">
        <service name="rcs_t_f15_1" provider="pacemaker" class="lsb" type="httpd" monitor_interval="65s"/>

11) Start dped

dped -v  deployment1

check on the vm that httpd process is running and it gets restarted if killed
(this works for me)

Now all I need to do is make this easier:)
  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

%d bloggers like this: