Jump to: navigation, search

Difference between revisions of "ConfigureNova"

(added charset to sqlalchemy mysql connection)
(Removing redundant, outdated information)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 +
Share your working nova.conf files here. You can embed comments into nova.conf using the hash symbol on a new line like so:
  
<pre><nowiki>#!rst
 
Configuring OpenStack Compute (Nova)
 
====================================
 
You have lots of options for configuring your Nova deployment, and this page just covers a few. The main steps for configuration are to edit the nova.conf flags file, configure the database, and then integrate networking into your larger environment.
 
  
Set up configuration file (installed in /etc/nova)
+
<pre><nowiki>
--------------------------------------------------
+
# Sets whether to use IPV6 addresses
 
+
--use_ipv6=false
1.  Nova development has consolidated all config files to nova.conf as of November 2010. There is a default set of options that are already configured in nova.conf:
 
 
 
::
 
 
 
--daemonize=1
 
--dhcpbridge_flagfile=/etc/nova/nova.conf
 
--dhcpbridge=/usr/bin/nova-dhcpbridge
 
--logdir=/var/log/nova
 
--state_path=/var/lib/nova
 
 
 
The following items ALSO need to be defined in /etc/nova/nova.conf. Note that comments CANNOT be in nova.conf but this page outlines some commentary. There seems to be an issue with nova-manage not processing the comments/whitespace correctly:
 
 
 
--sql_connection ###  Location of Nova SQL DB
 
 
 
--s3_host ###  This is where Nova is hosting the objectstore service, which will contain the VM images and buckets
 
 
 
--rabbit_host ### This is where the rabbit AMQP messaging service is hosted
 
 
 
--ec2_host ### This is where the the nova-api service lives
 
 
 
--verbose ###  Optional but very helpful during initial setup
 
 
 
--ec2_url ### The location to interface nova-api
 
 
 
--my_ip: host ip address ## The IP address of the server running nova-api
 
 
 
--network_manager ### Many options here, discussed below.  This is how your controller will communicate with additional Nova nodes and VMs:
 
 
 
nova.network.manager.FlatManager # Simple, no-vlan networking type
 
nova.network.manager. FlatDHCPManager #  Flat networking with DHCP
 
nova.network.manager.VlanManager # Vlan networking with DHCP – /DEFAULT/ if no network manager is defined in nova.conf
 
 
 
--fixed_range=<network/prefix> ###  This will be the IP network that ALL the projects for future VM guests will reside on.  E.g. 192.168.0.0/12
 
 
 
--network_size=<# of addrs> ### This is the total number of IP Addrs to use for VM guests, of all projects.  E.g. 5000
 
 
 
The following code can be cut and paste, and edited to your setup:
 
 
 
Note: CC_ADDR=<the external IP address of your cloud controller>
 
 
 
Detailed explanation of the following example is available above.
 
 
 
::
 
 
 
--sql_connection=mysql://root:nova@<CC_ADDR>/nova?charset=latin1
 
--s3_host=<CC_ADDR>
 
--rabbit_host=<CC_ADDR>
 
--ec2_host=<CC_ADDR>
 
--verbose
 
--ec2_url=http://<CC_ADDR>:8773/services/Cloud
 
--network_manager=nova.network.manager.VlanManager
 
--fixed_range=<network/prefix>
 
--network_size=<# of addrs>
 
 
 
2. Create a “nova” group, and set permissions::
 
 
 
    addgroup nova
 
 
 
The Nova config file should have its owner set to root:nova, and mode set to 0644, since they contain your MySQL server's root password. ::
 
 
 
    chown -R root:nova /etc/nova
 
    chmod 644 /etc/nova/nova.conf
 
 
 
Set up the SQL DB (MySQL example)
 
---------------------------------
 
 
 
1. First you 'preseed' to bypass all the installation prompts::
 
 
 
    bash
 
    MYSQL_PASS=nova
 
    cat <<MYSQL_PRESEED | debconf-set-selections
 
    mysql-server-5.1 mysql-server/root_password password $MYSQL_PASS
 
    mysql-server-5.1 mysql-server/root_password_again password $MYSQL_PASS
 
    mysql-server-5.1 mysql-server/start_on_boot boolean true
 
    MYSQL_PRESEED
 
 
 
2. Install MySQL::
 
 
 
    apt-get install -y mysql-server
 
 
 
3. Edit /etc/mysql/my.cnf to change ‘bind-address’ from localhost to any::
 
 
 
    sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mysql/my.cnf
 
    service mysql restart
 
 
 
4. MySQL DB configuration:
 
 
 
Create NOVA database::
 
 
 
    mysql -uroot -p$MYSQL_PASS -e 'CREATE DATABASE nova;'
 
 
 
Update the DB to include user 'root'@'%' with super user privileges::
 
 
 
    mysql -uroot -p$MYSQL_PASS -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;"
 
 
 
Set mySQL root password::
 
 
 
    mysql -uroot -p$MYSQL_PASS -e "SET PASSWORD FOR 'root'@'%' = PASSWORD('$MYSQL_PASS');"
 
 
 
Configure the Network
 
---------------------
 
 
 
If you use FlatManager as your network manager (as opposed to VlanManager that is shown in the nova.conf example above), there are some additional networking changes you’ll have to make to ensure connectivity between your nodes and VMs.  If you chose VlanManager or FlatDHCP, you may skip this section, as it’s set up for you automatically.
 
 
 
Nova defaults to a bridge device named 'br100'. This needs to be created and somehow integrated into YOUR network. To keep things as simple as possible, have all the VM guests on the same network as the VM hosts (the compute nodes). To do so, set the compute node's external IP address to be on the bridge and add eth0 to that bridge. To do this, edit your network interfaces config to look like the following::
 
 
 
  < begin /etc/network/interfaces >
 
  # The loopback network interface
 
  auto lo
 
  iface lo inet loopback
 
 
 
  # Networking for NOVA
 
  auto br100
 
 
 
  iface br100 inet dhcp
 
          bridge_ports    eth0
 
          bridge_stp      off
 
          bridge_maxwait  0
 
          bridge_fd      0
 
  < end /etc/network/interfaces >
 
 
 
Next, restart networking to apply the changes::
 
 
 
    sudo /etc/init.d/networking restart
 
 
 
Nova Configuration
 
``````````````````
 
 
 
On the Compute node, you should continue with these configuration steps.
 
 
 
Step 1 - Set up the Nova environment
 
------------------------------------
 
 
 
These are the commands you run to update the database if needed, and then set up a user and project::
 
 
 
    /usr/bin/python /usr/bin/nova-manage db sync
 
    /usr/bin/python /usr/bin/nova-manage user admin <user_name>
 
    /usr/bin/python /usr/bin/nova-manage project create <project_name> <user_name>
 
    /usr/bin/python /usr/bin/nova-manage network create <project-network> <number-of-networks-in-project> <IPs in project>
 
 
 
Here is an example of what this looks like with real data::
 
 
 
    /usr/bin/python /usr/bin/nova-manage db sync
 
    /usr/bin/python /usr/bin/nova-manage user admin dub
 
    /usr/bin/python /usr/bin/nova-manage project create dubproject dub
 
    /usr/bin/python /usr/bin/nova-manage network create 192.168.0.0/24 1 255
 
 
 
(I chose a /24 since that falls inside my /12 range I set in ‘fixed-range’ in nova.conf.  Currently, there can only be one network, and I am using the max IP’s available in a  /24.  You can choose to use any valid amount that you would like.)
 
 
 
Note: The nova-manage service assumes that the first IP address is your network (like 192.168.0.0), that the 2nd IP is your gateway (192.168.0.1), and that the broadcast is the very last IP in the range you defined (192.168.0.255). If this is not the case you will need to manually edit the sql db 'networks' table.o.
 
 
 
On running the "nova-manage network create" command, entries are made in the 'networks' and 'fixed_ips' table. However, one of the networks listed in the 'networks' table needs to be marked as bridge in order for the code to know that a bridge exists. The Network is marked as bridged automatically based on the type of network manager selected. You only need to mark the network as a bridge if you chose FlatManager as your network type.
 
 
</nowiki></pre>
 
</nowiki></pre>

Revision as of 20:41, 27 May 2011

Share your working nova.conf files here. You can embed comments into nova.conf using the hash symbol on a new line like so:


# Sets whether to use IPV6 addresses
--use_ipv6=false