Condor Cloud
~~~~~~~~~~~~

This document explains how to go about setting up the condor cloud.
The condor cloud uses the deltacloud driver as the API to implement a
private cloud system.

Requirements:
- One x86_64 machine to run as the master condor server.  This server will
  have the condor-cloud rpm on it.
- Zero or more (the master can run VMs) x86_64 machines to use as nodes to run
  cloud instances on.  These machines will each have the condor-cloud-node rpm
  installed and be configured to talk to the master.
- If you wish to use multiple nodes, some form of shared storage for the
  filesystem in /var/lib/condor-cloud/shared_images will need to be
  configured.  We show you how to configure NFS for this task below.

Networking
~~~~~~~~~~

Since the cloud is a network based system, you will want to enable bridging
on each system you want to run instances on.  This will allow your VMs to
directly talk on the network and be reachable via ssh etc.  This step must be
done on both the master and nodes.

You will have to configure your ethernet device.  Create a file
corresponding to your main network interface.  This would typically be
'eth0' but depends on the configuration of the hardware etc.  For eth0
we would create the file /etc/sysconfig/network-scripts/ifcfg-eth0.
It should look like:

DEVICE=eth0
# change the hardware address to match the hardware address your NIC uses
HWADDR=00:16:76:D6:C9:45
ONBOOT=yes
BRIDGE=br0

Now we want to create a bridge.  Create the file:
/etc/sysconfig/network-scripts/ifcfg-br0:

DEVICE=br0
TYPE=Bridge
BOOTPROTO=dhcp
ONBOOT=yes
DELAY=0

Note that if you use a bridge name other than br0 you will have to edit
the configuration in deltacloud (more on that below).

Disable NetworkManager and start regular network service:

# chkconfig NetworkManager off
# chkconfig network on
# service NetworkManager stop
# service network start

Configure iptables to allow all traffic to be forwarded across the bridge.

# iptables -I FORWARD -m physdev --physdev-is-bridged -j ACCEPT
# service iptables save
# service iptables restart

Restart libvirt:

# service libvirtd reload


Condor Cloud Master Configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This steps you through setting up the master as configured by default, which
will only allow you the single machine to start instances on.  To set up a
distributed cloud with more than one node, follow these instructions and then
continue on to the node configuration for a distributed cloud configuration.

First step is to install condor-cloud rpm (which you probably
already have).  This will install condor, libvirt, kvm and
deltacloud core.  It also installs a sample configuration as
/etc/condor/config.d/50condor_cloud.config and the supporting scripts
for condor to operate as a cloud.

Configure condor to start on boot and start it now:

# chkconfig condor on
# service condor start

Next we configure deltacloud core to start on bootup with the condor backend driver in
place.  Edit /etc/rc.d/init.d/deltacloud-core and change:

DRIVER="${DRIVER:-ec2}"

to:

DRIVER="${DRIVER:-condor}"

Turn on the deltacloud core service and start it:

# chkconfig deltacloud-core on
# service deltacloud-core start

Install a valid KVM image in /var/lib/condor-cloud/shared_images.
Note that there is a directory for staging images since it can take a
long time to copy them.  For this reason you can first copy them into
/var/lib/condor-cloud/shared_images/staging and them 'mv' them into
/var/lib/condor-cloud/shared_images.

You should then be able to browse to http://localhost:3002/api and see the
image(s) you have installed, start them, stop them etc.


Adding Nodes
~~~~~~~~~~~~

Once you have the master set up, you can add as many nodes to the system as
you like.

Once you have a basic fedora machine up and running, install the
condor-cloud-node rpm to provide the basics needed to run as a condor
cloud node.

Configure bridged networking on the node machine as described above.

You must now configure condor to connect to the master condor-cloud host.
The easiest way to do this is to create a new file on the node as
/etc/condor/config.d/40cloud_node.config:

CONDOR_HOST = <master hostname>
ALLOW_WRITE = $(ALLOW_WRITE), $(CONDOR_HOST)

where "<master hostname>" should be replaced with the host name of your
master condor cloud system.  You will also likely have to configure the
firewall on the master system to allow it to connect.  There are also various
authentication schemes available for greater security.

More details can be found at:

http://spinningmatt.wordpress.com/2011/06/12/getting-started-creating-a-multiple-node-condor-pool/

Shared Storage for Images
~~~~~~~~~~~~~~~~~~~~~~~~~

In addition to configuring the condor nodes, you must also have shared storage
available for the images.  The easiest way to do this is to configure the
master as an NFS sever and then have the nodes mount the export.  Of course
you can configure this however you see fit.  Note also that the
/var/lib/condor-cloud/local_cache should have a good amount of storage space
available as it will copy the images from /var/lib/condor-cloud/shared_images
to make starting/running the instances faster.

To configure NFS on the master condor-cloud system, edit /etc/exports and add:

/var/lib/condor-cloud/shared_images 172.31.0.0/24(ro)

Where the ip address range is dependant upon your network configuration.

Unfortunately running NFSv3 on the server basically requires that you turn off
the firewall.  For this reason you may wish to contemplate a different
arrangement.  However I will document how to do this here as a guide.  Turn
off the firewall:

# service iptables stop

Start the nfs server:

# chkconfig --levels 235 nfs on
# /etc/init.d/nfs start

On each node that you configure, add the following to /etc/fstab:

<condor cloud master>:/var/lib/condor-cloud/shared_images /var/lib/condor-cloud/shared_images nfs defaults 0 0

Where of course '<condor cloud master>' is the hostname of the master server.


