Installing OpenStack Compute Controller services
Before creating a server for running OpenStack Compute services for running instances, there are some final services that need be installed on the Controller node where the OpenStack Identity and Image services are running. Separating our Controller services from the Compute nodes allows us to scale our OpenStack environment resources horizontally in the Controller and Compute services.
install some further packages to the Controller node, which are:
nova-scheduler: The scheduler picks the server for fulfilling the request to run the instance
nova-api: Service for making requests to OpenStack to operate the services within it; for example, you make a call to this service to start up a new Nova instance
nova-conductor: A new service introduced in the Grizzly release to remove direct database calls by the Compute service
nova-objectstore: File storage service
nova-common: Common Python libraries that underpin all of the OpenStack
environment
nova-cert: The Nova certificate management service, used for authentication to Nova
ntp: Network Time Protocol is essential in a multi-node environment; the nodes must have the same time (tolerance is within five seconds and outside of this you get unpredictable results)
dnsmasq: DNS forwarder and DHCP service that allocates the addresses to your instances in your environment
vagrant ssh controller
1. install the required packages
sudo apt-get update
sudo apt-get -y install rabbitmq-server nova-api nova-conductor nova-scheduler nova-objectstore dnsmasq
2. install and configure NTP
sudo apt-get -y install ntp
3. edit /etc/ntp.conf to keep server times in sync
# Replace ntp.ubuntu.com with an NTP server on your network
server ntp.ubuntu.com
server 127.127.1.0
fudge 127.127.1.0 stratum 10
4. restart the service
sudo service ntp restart
Creating a sandbox Compute server with VirtualBox and Vagrant
1. execute the steps in the Creating a sandbox environment with VirtualBox recipe of Chapter1
2. edit the Vagrant file
# -*- mode: ruby -*-
# vi: set ft=ruby :
nodes = {
'controller' => [1, 200],
'compute' => [1, 201],
}
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.box_url ="http://files.vagrantup.com/precise64.box"
nodes.each do |prefix, (count, ip_start)|
count.times do |i|
hostname = "%s" % [prefix, (i+1)]
config.vm.define "#{hostname}" do |box|
box.vm.hostname = "#{hostname}.book"
box.vm.network :private_network, ip: "172.16.0.#{ip_start+i}", :netmask => "255.255.0.0"
box.vm.network :private_network, ip: "10.10.0.#{ip_start+i}", :netmask => "255.255.0.0"
# If using VirtualBox
box.vm.provider :virtualbox do |vbox|
vbox.customize ["modifyvm", :id, "--memory", 1024]
if prefix == "compute"
vbox.customize ["modifyvm", :id, "--memory", 3172]
vbox.customize ["modifyvm", :id, "--cpus", 2]
end
end
end
end
end
end
3. power on the compute node
vagrant up compute
Installing OpenStack Compute packages
nova-compute: The main package for running the virtual machine instances.
nova-network: Network service that controls DHCP, DNS, and Routing. This will also
manage and run dnsmasq for us to provide these services.
nova-api-metadata: The Nova API metadata front-end. It is used when we are running a multi-host Nova network in our environment so our compute instances can download metadata.
nova-compute-qemu: Provides QEmu services on our compute host. It is only required where hardware virtualization assist isn't available (as required to run OpenStack under VirtualBox).
ntp: Network Time Protocol is essential in a multi-node environment that the nodes have the same time (tolerance is within five seconds and outside of this you get unpredictable results).
vagrant ssh compute
1. install the required packages
sudo apt-get update
sudo apt-get -y install nova-compute nova-network nova-api-metadata nova-compute-qemu
2. install and configure NTP
sudo apt-get -y install ntp
3. edit /etc/ntp.conf to keep server times in sync
# Replace ntp.ubuntu.com with an NTP server on your network
server ntp.ubuntu.com
server 127.127.1.0
fudge 127.127.1.0 stratum 10
4. restart the ntp service
sudo service ntp restart
Configuring database services
OpenStack supports a number of database backends-an internal SQLite database(the default), MySQL, and Postgres.
vagrant ssh controller
1. configure a database user of nova for use by OpenStack Compute
MYSQL_ROOT_PASS=openstack
mysql -uroot -p$MYSQL_ROOT_PASS -e 'CREATE DATABASE nova;'
MYSQL_NOVA_PASS=openstack
mysql -uroot -p${MYSQL_ROOT_PASSWORD} -e "GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY '${MYSQL_NOVA_PASSWORD}';"
mysql -uroot -p${MYSQL_ROOT_PASSWORD} -e "GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY '${MYSQL_NLOVA_PASSWORD}';"
2. reference MySQL server in /etc/nova/nova.conf file to use MySQL by adding the sql_connection flag
sql_connection=mysql://nova:openstack@172.16.0.200/nova
Configuring OpenStack Compute
vagrant ssh controller
vagrant ssh compute
1. amend the /etc/nova/nova.conf file to have the following contens
[DEFAULT]
dhcpbridge_flagfile=/etc/nova/nova.conf
dhcpbridge=/usr/bin/nova-dhcpbridge
logdir=/var/log/nova
state_path=/var/lib/nova
lock_path=/var/lock/nova
root_helper=sudo nova-rootwrap /etc/nova/rootwrap.conf
verbose=True
api_paste_config=/etc/nova/api-paste.ini
enabled_apis=ec2,osapi_compute,metadata
# Libvirt and Virtualization
libvirt_use_virtio_for_bridges=True
connection_type=libvirt
libvirt_type=qemu
# Database
sql_connection=mysql://nova:openstack@172.16.0.200/nova
# Messaging
rabbit_host=172.16.0.200
# EC2 API Flags
ec2_host=172.16.0.200
ec2_dmz_host=172.16.0.200
ec2_private_dns_show_ip=True
# Networking
public_interface=eth1
force_dhcp_release=True
auto_assign_floating_ip=True
# Images
image_service=nova.image.glance.GlanceImageService
glance_api_servers=172.16.0.200:9292
# Scheduler
scheduler_default_filters=AllHostsFilter
# Object Storage
iscsi_helper=tgtadm
# Auth
auth_strategy=keystone
2. Repeat Step 1 and create the file /etc/nova/nova.conf on the Compute host.
3. back on the controller host
sudo nova-manage db sync
4. create the privat enetwork
sudo nova-mange network create privateNet --fixed_range_v4=10.0.10.0/24 --network_size=64 --bridge_interface=eth2
5. set a public network range
sudo nova-manage floating create --ip_range=172.16.10.0/24