summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/nova-manage29
-rwxr-xr-xcontrib/nova.sh92
-rw-r--r--doc/source/adminguide/multi.node.install.rst131
-rw-r--r--doc/source/adminguide/nova.manage.rst35
-rw-r--r--doc/source/adminguide/single.node.install.rst28
-rw-r--r--doc/source/man/novamanage.rst35
-rw-r--r--nova/db/api.py1
-rw-r--r--nova/db/sqlalchemy/session.py3
-rw-r--r--nova/exception.py18
9 files changed, 227 insertions, 145 deletions
diff --git a/bin/nova-manage b/bin/nova-manage
index 1c885f8a6..1b70ebf17 100755
--- a/bin/nova-manage
+++ b/bin/nova-manage
@@ -267,6 +267,14 @@ class RoleCommands(object):
self.manager.remove_role(user, role, project)
+def _db_error(caught_exception):
+ print caught_exception
+ print _("The above error may show that the database has not "
+ "been created.\nPlease create a database using "
+ "nova-manage sync db before running this command.")
+ exit(1)
+
+
class UserCommands(object):
"""Class for managing users."""
@@ -282,13 +290,19 @@ class UserCommands(object):
def admin(self, name, access=None, secret=None):
"""creates a new admin and prints exports
arguments: name [access] [secret]"""
- user = self.manager.create_user(name, access, secret, True)
+ try:
+ user = self.manager.create_user(name, access, secret, True)
+ except exception.DBError, e:
+ _db_error(e)
self._print_export(user)
def create(self, name, access=None, secret=None):
"""creates a new user and prints exports
arguments: name [access] [secret]"""
- user = self.manager.create_user(name, access, secret, False)
+ try:
+ user = self.manager.create_user(name, access, secret, False)
+ except exception.DBError, e:
+ _db_error(e)
self._print_export(user)
def delete(self, name):
@@ -409,9 +423,14 @@ class ProjectCommands(object):
with open(filename, 'w') as f:
f.write(zip_file)
except db.api.NoMoreNetworks:
- print ('No more networks available. If this is a new '
- 'installation, you need\nto call something like this:\n\n'
- ' nova-manage network create 10.0.0.0/8 10 64\n\n')
+ print _('No more networks available. If this is a new '
+ 'installation, you need\nto call something like this:\n\n'
+ ' nova-manage network create 10.0.0.0/8 10 64\n\n')
+ except exception.ProcessExecutionError, e:
+ print e
+ print _("The above error may show that the certificate db has not "
+ "been created.\nPlease create a database by running a "
+ "nova-api server on this host.")
class FloatingIpCommands(object):
diff --git a/contrib/nova.sh b/contrib/nova.sh
index 08dc89bae..9259035ca 100755
--- a/contrib/nova.sh
+++ b/contrib/nova.sh
@@ -1,15 +1,14 @@
#!/usr/bin/env bash
DIR=`pwd`
CMD=$1
-SOURCE_BRANCH=lp:nova
-if [ -n "$2" ]; then
- SOURCE_BRANCH=$2
+if [ "$CMD" = "branch" ]; then
+ SOURCE_BRANCH=${2:-lp:nova}
+ DIRNAME=${3:-nova}
+else
+ DIRNAME=${2:-nova}
fi
-DIRNAME=nova
+
NOVA_DIR=$DIR/$DIRNAME
-if [ -n "$3" ]; then
- NOVA_DIR=$DIR/$3
-fi
if [ ! -n "$HOST_IP" ]; then
# NOTE(vish): This will just get the first ip in the list, so if you
@@ -24,6 +23,8 @@ TEST=${TEST:-0}
USE_LDAP=${USE_LDAP:-0}
# Use OpenDJ instead of OpenLDAP when using LDAP
USE_OPENDJ=${USE_OPENDJ:-0}
+# Use IPv6
+USE_IPV6=${USE_IPV6:-0}
LIBVIRT_TYPE=${LIBVIRT_TYPE:-qemu}
NET_MAN=${NET_MAN:-VlanManager}
# NOTE(vish): If you are using FlatDHCP on multiple hosts, set the interface
@@ -43,30 +44,17 @@ else
AUTH=dbdriver.DbDriver
fi
-mkdir -p /etc/nova
-cat >$NOVA_DIR/bin/nova.conf << NOVA_CONF_EOF
---verbose
---nodaemon
---dhcpbridge_flagfile=$NOVA_DIR/bin/nova.conf
---network_manager=nova.network.manager.$NET_MAN
---cc_host=$HOST_IP
---routing_source_ip=$HOST_IP
---sql_connection=$SQL_CONN
---auth_driver=nova.auth.$AUTH
---libvirt_type=$LIBVIRT_TYPE
-NOVA_CONF_EOF
-
-if [ -n "$FLAT_INTERFACE" ]; then
- echo "--flat_interface=$FLAT_INTERFACE" >>$NOVA_DIR/bin/nova.conf
-fi
-
if [ "$CMD" == "branch" ]; then
sudo apt-get install -y bzr
+ if [ ! -e "$DIR/.bzr" ]; then
+ bzr init-repo $DIR
+ fi
rm -rf $NOVA_DIR
bzr branch $SOURCE_BRANCH $NOVA_DIR
cd $NOVA_DIR
mkdir -p $NOVA_DIR/instances
mkdir -p $NOVA_DIR/networks
+ exit
fi
# You should only have to run this once
@@ -74,7 +62,7 @@ if [ "$CMD" == "install" ]; then
sudo apt-get install -y python-software-properties
sudo add-apt-repository ppa:nova-core/trunk
sudo apt-get update
- sudo apt-get install -y dnsmasq kpartx kvm gawk iptables ebtables
+ sudo apt-get install -y dnsmasq-base kpartx kvm gawk iptables ebtables
sudo apt-get install -y user-mode-linux kvm libvirt-bin
sudo apt-get install -y screen euca2ools vlan curl rabbitmq-server
sudo apt-get install -y lvm2 iscsitarget open-iscsi
@@ -85,16 +73,16 @@ if [ "$CMD" == "install" ]; then
sudo /etc/init.d/libvirt-bin restart
sudo modprobe nbd
sudo apt-get install -y python-twisted python-sqlalchemy python-mox python-greenlet python-carrot
- sudo apt-get install -y python-daemon python-eventlet python-gflags python-ipy
+ sudo apt-get install -y python-migrate python-eventlet python-gflags python-ipy python-tempita
sudo apt-get install -y python-libvirt python-libxml2 python-routes python-cheetah
- sudo apt-get install -y python-paste python-pastedeploy
-#For IPV6
- sudo apt-get install -y python-netaddr
- sudo apt-get install -y radvd
-#(Nati) Note that this configuration is only needed for nova-network node.
- sudo bash -c "echo 1 > /proc/sys/net/ipv6/conf/all/forwarding"
- sudo bash -c "echo 0 > /proc/sys/net/ipv6/conf/all/accept_ra"
-
+ sudo apt-get install -y python-netaddr python-paste python-pastedeploy python-glance
+
+ if [ "$USE_IPV6" == 1 ]; then
+ sudo apt-get install -y radvd
+ sudo bash -c "echo 1 > /proc/sys/net/ipv6/conf/all/forwarding"
+ sudo bash -c "echo 0 > /proc/sys/net/ipv6/conf/all/accept_ra"
+ fi
+
if [ "$USE_MYSQL" == 1 ]; then
cat <<MYSQL_PRESEED | debconf-set-selections
mysql-server-5.1 mysql-server/root_password password $MYSQL_PASS
@@ -103,8 +91,10 @@ mysql-server-5.1 mysql-server/start_on_boot boolean true
MYSQL_PRESEED
apt-get install -y mysql-server python-mysqldb
fi
- wget http://c2477062.cdn.cloudfiles.rackspacecloud.com/images.tgz
- tar -C $DIR -zxf images.tgz
+ mkdir -p $DIR/images
+ wget -c http://images.ansolabs.com/tty.tgz
+ tar -C $DIR/images -zxf tty.tgz
+ exit
fi
NL=`echo -ne '\015'`
@@ -115,9 +105,31 @@ function screen_it {
}
if [ "$CMD" == "run" ]; then
+
+ cat >$NOVA_DIR/bin/nova.conf << NOVA_CONF_EOF
+--verbose
+--nodaemon
+--dhcpbridge_flagfile=$NOVA_DIR/bin/nova.conf
+--network_manager=nova.network.manager.$NET_MAN
+--cc_host=$HOST_IP
+--routing_source_ip=$HOST_IP
+--sql_connection=$SQL_CONN
+--auth_driver=nova.auth.$AUTH
+--libvirt_type=$LIBVIRT_TYPE
+NOVA_CONF_EOF
+
+ if [ -n "$FLAT_INTERFACE" ]; then
+ echo "--flat_interface=$FLAT_INTERFACE" >>$NOVA_DIR/bin/nova.conf
+ fi
+
+ if [ "$USE_IPV6" == 1 ]; then
+ echo "--use_ipv6" >>$NOVA_DIR/bin/nova.conf
+ fi
+
killall dnsmasq
- #For IPv6
- killall radvd
+ if [ "$USE_IPV6" == 1 ]; then
+ killall radvd
+ fi
screen -d -m -S nova -t nova
sleep 1
if [ "$USE_MYSQL" == 1 ]; then
@@ -150,6 +162,8 @@ if [ "$CMD" == "run" ]; then
cd $DIR
fi
+ # create the database
+ $NOVA_DIR/bin/nova-manage db sync
# create an admin user called 'admin'
$NOVA_DIR/bin/nova-manage user admin admin admin admin
# create a project called 'admin' with project manager of 'admin'
@@ -178,6 +192,7 @@ if [ "$CMD" == "run" ] || [ "$CMD" == "terminate" ]; then
sleep 2
# delete volumes
. $NOVA_DIR/novarc; euca-describe-volumes | grep vol- | cut -f2 | xargs -n1 euca-delete-volume
+ sleep 2
fi
if [ "$CMD" == "run" ] || [ "$CMD" == "clean" ]; then
@@ -192,5 +207,4 @@ if [ "$CMD" == "scrub" ]; then
else
virsh list | grep i- | awk '{print \$1}' | xargs -n1 virsh destroy
fi
- vblade-persist ls | grep vol- | awk '{print \$1\" \"\$2}' | xargs -n2 vblade-persist destroy
fi
diff --git a/doc/source/adminguide/multi.node.install.rst b/doc/source/adminguide/multi.node.install.rst
index df7078180..f2f25b060 100644
--- a/doc/source/adminguide/multi.node.install.rst
+++ b/doc/source/adminguide/multi.node.install.rst
@@ -1,84 +1,85 @@
Installing Nova on Multiple Servers
===================================
-
+
When you move beyond evaluating the technology and into building an actual
production environment, you will need to know how to configure your datacenter
and how to deploy components across your clusters. This guide should help you
through that process.
-
+
You can install multiple nodes to increase performance and availability of the OpenStack Compute installation.
-
+
This setup is based on an Ubuntu Lucid 10.04 installation with the latest updates. Most of this works around issues that need to be resolved either in packaging or bug-fixing. It also needs to eventually be generalized, but the intent here is to get the multi-node configuration bootstrapped so folks can move forward.
For a starting architecture, these instructions describing installing a cloud controller node and a compute node. The cloud controller node contains the nova- services plus the database. The compute node installs all the nova-services but then refers to the database installation, which is hosted by the cloud controller node.
Requirements for a multi-node installation
------------------------------------------
-
+
* You need a real database, compatible with SQLAlchemy (mysql, postgresql) There's not a specific reason to choose one over another, it basically depends what you know. MySQL is easier to do High Availability (HA) with, but people may already know PostgreSQL. We should document both configurations, though.
* For a recommended HA setup, consider a MySQL master/slave replication, with as many slaves as you like, and probably a heartbeat to kick one of the slaves into being a master if it dies.
* For performance optimization, split reads and writes to the database. MySQL proxy is the easiest way to make this work if running MySQL.
-
+
Assumptions
-----------
-
+
* Networking is configured between/through the physical machines on a single subnet.
* Installation and execution are both performed by ROOT user.
+
Scripted Installation
---------------------
-A script available to get your OpenStack cloud running quickly. You can copy the file to the server where you want to install OpenStack Compute services - typically you would install a compute node and a cloud controller node.
+A script available to get your OpenStack cloud running quickly. You can copy the file to the server where you want to install OpenStack Compute services - typically you would install a compute node and a cloud controller node.
-You must run these scripts with root permissions.
+You must run these scripts with root permissions.
From a server you intend to use as a cloud controller node, use this command to get the cloud controller script. This script is a work-in-progress and the maintainer plans to keep it up, but it is offered "as-is." Feel free to collaborate on it in GitHub - https://github.com/dubsquared/OpenStack-NOVA-Installer-Script/.
::
-
+
wget --no-check-certificate https://github.com/dubsquared/OpenStack-NOVA-Installer-Script/raw/master/Nova_CC_Installer_v0.1
Ensure you can execute the script by modifying the permissions on the script file.
::
-
+
sudo chmod 755 Nova_CC_Installer_v0.1
::
-
+
sudo ./Nova_CC_Installer_v0.1
-Next, from a server you intend to use as a compute node (doesn't contain the database), install the nova services. Copy the nova.conf from the cloud controller node to the compute node.
+Next, from a server you intend to use as a compute node (doesn't contain the database), install the nova services. Copy the nova.conf from the cloud controller node to the compute node.
Restart related services::
-
+
libvirtd restart; service nova-network restart; service nova-compute restart; service nova-api restart; service nova-objectstore restart; service nova-scheduler restart
You can go to the `Configuration section`_ for next steps.
Manual Installation - Step-by-Step
----------------------------------
-The following sections show you how to install Nova manually with a cloud controller node and a separate compute node. The cloud controller node contains the database plus all nova- services, and the compute node runs nova- services only.
+The following sections show you how to install Nova manually with a cloud controller node and a separate compute node. The cloud controller node contains the database plus all nova- services, and the compute node runs nova- services only.
Cloud Controller Installation
`````````````````````````````
On the cloud controller node, you install nova services and the related helper applications, and then configure with the nova.conf file. You will then copy the nova.conf file to the compute node, which you install as a second node in the `Compute Installation`_.
-
+
Step 1 - Use apt-get to get the latest code
-------------------------------------------
1. Setup Nova PPA with https://launchpad.net/~nova-core/+archive/trunk. The ‘python-software-properties’ package is a pre-requisite for setting up the nova package repo:
::
-
+
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:nova-core/trunk
-
+
2. Run update.
::
-
+
sudo apt-get update
3. Install python required packages, nova-packages, and helper apps.
@@ -93,15 +94,15 @@ Step 2 Set up configuration file (installed in /etc/nova)
---------------------------------------------------------
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. I’ve added some explanation of the variables, as comments CANNOT be in nova.conf. There seems to be an issue with nova-manage not processing the comments/whitespace correctly:
--sql_connection ### Location of Nova SQL DB
@@ -131,31 +132,31 @@ 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
--s3_host=<CC_ADDR>
--rabbit_host=<CC_ADDR>
---cc_host=<CC_ADDR>
---verbose
+--cc_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>
-
+--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
-
+ chmod 644 /etc/nova/nova.conf
+
Step 3 - Setup the SQL DB (MySQL for this setup)
------------------------------------------------
-
+
1. First you 'preseed' to bypass all the installation prompts::
bash
@@ -165,59 +166,59 @@ Step 3 - Setup the SQL DB (MySQL for this setup)
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');"
-
+ mysql -uroot -p$MYSQL_PASS -e "SET PASSWORD FOR 'root'@'%' = PASSWORD('$MYSQL_PASS');"
+
Compute Node Installation
`````````````````````````
-
+
Repeat steps 1 and 2 from the Cloud Controller Installation section above, then configure the network for your Compute instances on the Compute node. Copy the nova.conf file from the Cloud Controller node to this node.
-
+
Network Configuration
---------------------
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
Configuration
@@ -234,32 +235,32 @@ These are the commands you run to update the database if needed, and then set up
/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 this 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. This is ONLY necessary if you chose FlatManager as your network type. More information can be found at the end of this document discussing setting up the bridge device.
-
-
+
+
Step 2 - Create Nova certifications
-----------------------------------
-
-1. Generate the certs as a zip file. These are the certs you will use to launch instances, bundle images, and all the other assorted api functions.
+
+1. Generate the certs as a zip file. These are the certs you will use to launch instances, bundle images, and all the other assorted api functions.
::
mkdir –p /root/creds
/usr/bin/python /usr/bin/nova-manage project zipfile $NOVA_PROJECT $NOVA_PROJECT_USER /root/creds/novacreds.zip
-
-2. Unzip them in your home directory, and add them to your environment.
+
+2. Unzip them in your home directory, and add them to your environment.
::
@@ -271,7 +272,7 @@ Step 3 - Restart all relevant services
--------------------------------------
Restart all six services in total, just to cover the entire spectrum::
-
+
libvirtd restart; service nova-network restart; service nova-compute restart; service nova-api restart; service nova-objectstore restart; service nova-scheduler restart
Step 4 - Closing steps, and cleaning up
@@ -294,19 +295,19 @@ You can then use `euca2ools` to test some items::
euca-describe-images
euca-describe-instances
-
+
If you have issues with the API key, you may need to re-source your creds file::
. /root/creds/novarc
-
+
If you don’t get any immediate errors, you’re successfully making calls to your cloud!
-Spinning up a VM for Testing
+Spinning up a VM for Testing
````````````````````````````
-(This excerpt is from Thierry Carrez's blog, with reference to http://wiki.openstack.org/GettingImages.)
+(This excerpt is from Thierry Carrez's blog, with reference to http://wiki.openstack.org/GettingImages.)
-The image that you will use here will be a ttylinux image, so this is a limited function server. You will be able to ping and SSH to this instance, but it is in no way a full production VM.
+The image that you will use here will be a ttylinux image, so this is a limited function server. You will be able to ping and SSH to this instance, but it is in no way a full production VM.
UPDATE: Due to `bug 661159 <https://bugs.launchpad.net/nova/+bug/661159>`_, we can’t use images without ramdisks yet, so we can’t use the classic Ubuntu cloud images from http://uec-images.ubuntu.com/releases/ yet. For the sake of this tutorial, we’ll use the `ttylinux images from Scott Moser instead <http://smoser.brickies.net/ubuntu/ttylinux-uec/>`_.
@@ -332,13 +333,13 @@ Boot your instance:
::
- euca-run-instances $emi -k mykey -t m1.tiny
+ euca-run-instances $emi -k mykey -t m1.tiny
($emi is replaced with the output from the previous command)
Checking status, and confirming communication:
-Once you have booted the instance, you can check the status the the `euca-describe-instances` command. Here you can view the instance ID, IP, and current status of the VM.
+Once you have booted the instance, you can check the status the the `euca-describe-instances` command. Here you can view the instance ID, IP, and current status of the VM.
::
@@ -360,4 +361,4 @@ You can determine the instance-id with `euca-describe-instances`, and the format
For more information in creating you own custom (production ready) instance images, please visit http://wiki.openstack.org/GettingImages for more information!
-Enjoy your new private cloud, and play responsibly! \ No newline at end of file
+Enjoy your new private cloud, and play responsibly!
diff --git a/doc/source/adminguide/nova.manage.rst b/doc/source/adminguide/nova.manage.rst
index 0ec67c69c..0e9a29b6b 100644
--- a/doc/source/adminguide/nova.manage.rst
+++ b/doc/source/adminguide/nova.manage.rst
@@ -42,6 +42,17 @@ You can also run with a category argument such as user to see a list of all comm
These sections describe the available categories and arguments for nova-manage.
+Nova Db
+~~~~~~~
+
+``nova-manage db version``
+
+ Print the current database version.
+
+``nova-manage db sync``
+
+ Sync the database up to the most recent version. This is the standard way to create the db as well.
+
Nova User
~~~~~~~~~
@@ -68,7 +79,7 @@ Nova User
``nova-manage user modify <accesskey> <secretkey> <admin?T/F>``
Updates the indicated user keys, indicating with T or F if the user is an admin user. Leave any argument blank if you do not want to update it.
-
+
Nova Project
~~~~~~~~~~~~
@@ -79,7 +90,7 @@ Nova Project
``nova-manage project create <projectname>``
Create a new nova project with the name <projectname> (you still need to do nova-manage project add <projectname> to add it to the database).
-
+
``nova-manage project delete <projectname>``
Delete a nova project with the name <projectname>.
@@ -87,7 +98,7 @@ Nova Project
``nova-manage project environment <projectname> <username>``
Exports environment variables for the named project to a file named novarc.
-
+
``nova-manage project list``
Outputs a list of all the projects to the screen.
@@ -103,27 +114,27 @@ Nova Project
``nova-manage project zipfile``
Compresses all related files for a created project into a zip file nova.zip.
-
+
Nova Role
~~~~~~~~~
-nova-manage role <action> [<argument>]
+nova-manage role <action> [<argument>]
``nova-manage role add <username> <rolename> <(optional) projectname>``
- Add a user to either a global or project-based role with the indicated <rolename> assigned to the named user. Role names can be one of the following five roles: admin, itsec, projectmanager, netadmin, developer. If you add the project name as the last argument then the role is assigned just for that project, otherwise the user is assigned the named role for all projects.
+ Add a user to either a global or project-based role with the indicated <rolename> assigned to the named user. Role names can be one of the following five roles: admin, itsec, projectmanager, netadmin, developer. If you add the project name as the last argument then the role is assigned just for that project, otherwise the user is assigned the named role for all projects.
``nova-manage role has <username> <projectname>``
Checks the user or project and responds with True if the user has a global role with a particular project.
``nova-manage role remove <username> <rolename>``
- Remove the indicated role from the user.
+ Remove the indicated role from the user.
Nova Shell
~~~~~~~~~~
``nova-manage shell bpython``
- Starts a new bpython shell.
+ Starts a new bpython shell.
``nova-manage shell ipython``
@@ -150,12 +161,12 @@ Nova VPN
``nova-manage vpn run <projectname>``
- Starts the VPN for the named project.
+ Starts the VPN for the named project.
``nova-manage vpn spawn``
Runs all VPNs.
-
+
Nova Floating IPs
~~~~~~~~~~~~~~~~~
@@ -165,8 +176,8 @@ Nova Floating IPs
``nova-manage floating delete <ip_range>``
- Deletes floating IP addresses in the range given.
-
+ Deletes floating IP addresses in the range given.
+
``nova-manage floating list``
Displays a list of all floating IP addresses.
diff --git a/doc/source/adminguide/single.node.install.rst b/doc/source/adminguide/single.node.install.rst
index 119e3855b..ff43aa90b 100644
--- a/doc/source/adminguide/single.node.install.rst
+++ b/doc/source/adminguide/single.node.install.rst
@@ -52,7 +52,13 @@ When the installation is complete, you'll see the following lines:
Finished processing dependencies for nova==2010.1
-Step 4: Create a Nova administrator
+Step 4: Create the Nova Database
+--------------------------------
+Type or copy/paste in the following line to create your nova db::
+
+ sudo nova-manage db sync
+
+Step 5: Create a Nova administrator
-----------------------------------
Type or copy/paste in the following line to create a user named "anne."::
@@ -63,10 +69,10 @@ You see an access key and a secret key export, such as these made-up ones:::
export EC2_ACCESS_KEY=4e6498a2-blah-blah-blah-17d1333t97fd
export EC2_SECRET_KEY=0a520304-blah-blah-blah-340sp34k05bbe9a7
-Step 5: Create the network
+Step 6: Create the network
--------------------------
-Type or copy/paste in the following line to create a network prior to creating a project.
+Type or copy/paste in the following line to create a network prior to creating a project.
::
@@ -76,7 +82,7 @@ For this command, the IP address is the cidr notation for your netmask, such as
After running this command, entries are made in the 'networks' and 'fixed_ips' table in the database.
-Step 6: Create a project with the user you created
+Step 7: Create a project with the user you created
--------------------------------------------------
Type or copy/paste in the following line to create a project named IRT (for Ice Road Truckers, of course) with the newly-created user named anne.
@@ -106,7 +112,7 @@ Type or copy/paste in the following line to create a project named IRT (for Ice
Data Base Updated
-Step 7: Unzip the nova.zip
+Step 8: Unzip the nova.zip
--------------------------
You should have a nova.zip file in your current working directory. Unzip it with this command:
@@ -128,7 +134,7 @@ You'll see these files extract.
extracting: cacert.pem
-Step 8: Source the rc file
+Step 9: Source the rc file
--------------------------
Type or copy/paste the following to source the novarc file in your current working directory.
@@ -137,14 +143,14 @@ Type or copy/paste the following to source the novarc file in your current worki
. novarc
-Step 9: Pat yourself on the back :)
+Step 10: Pat yourself on the back :)
-----------------------------------
Congratulations, your cloud is up and running, you’ve created an admin user, created a network, retrieved the user's credentials and put them in your environment.
Now you need an image.
-Step 9: Get an image
+Step 11: Get an image
--------------------
To make things easier, we've provided a small image on the Rackspace CDN. Use this command to get it on your server.
@@ -168,7 +174,7 @@ To make things easier, we've provided a small image on the Rackspace CDN. Use th
-Step 10: Decompress the image file
+Step 12: Decompress the image file
----------------------------------
Use this command to extract the image files:::
@@ -187,7 +193,7 @@ You get a directory listing like so:::
|-- image
`-- info.json
-Step 11: Send commands to upload sample image to the cloud
+Step 13: Send commands to upload sample image to the cloud
----------------------------------------------------------
Type or copy/paste the following commands to create a manifest for the kernel.::
@@ -340,7 +346,7 @@ You should see this in response:::
Type or copy/paste the following commands to ssh to the instance using your private key.::
ssh -i mykey.priv root@10.0.0.3
-
+
Troubleshooting Installation
----------------------------
diff --git a/doc/source/man/novamanage.rst b/doc/source/man/novamanage.rst
index 0cb6c7c90..bb9d7a7fe 100644
--- a/doc/source/man/novamanage.rst
+++ b/doc/source/man/novamanage.rst
@@ -42,6 +42,17 @@ You can also run with a category argument such as user to see a list of all comm
These sections describe the available categories and arguments for nova-manage.
+Nova Db
+~~~~~~~
+
+``nova-manage db version``
+
+ Print the current database version.
+
+``nova-manage db sync``
+
+ Sync the database up to the most recent version. This is the standard way to create the db as well.
+
Nova User
~~~~~~~~~
@@ -68,7 +79,7 @@ Nova User
``nova-manage user modify <accesskey> <secretkey> <admin?T/F>``
Updates the indicated user keys, indicating with T or F if the user is an admin user. Leave any argument blank if you do not want to update it.
-
+
Nova Project
~~~~~~~~~~~~
@@ -79,7 +90,7 @@ Nova Project
``nova-manage project create <projectname>``
Create a new nova project with the name <projectname> (you still need to do nova-manage project add <projectname> to add it to the database).
-
+
``nova-manage project delete <projectname>``
Delete a nova project with the name <projectname>.
@@ -87,7 +98,7 @@ Nova Project
``nova-manage project environment <projectname> <username>``
Exports environment variables for the named project to a file named novarc.
-
+
``nova-manage project list``
Outputs a list of all the projects to the screen.
@@ -103,27 +114,27 @@ Nova Project
``nova-manage project zipfile``
Compresses all related files for a created project into a zip file nova.zip.
-
+
Nova Role
~~~~~~~~~
-nova-manage role <action> [<argument>]
+nova-manage role <action> [<argument>]
``nova-manage role add <username> <rolename> <(optional) projectname>``
- Add a user to either a global or project-based role with the indicated <rolename> assigned to the named user. Role names can be one of the following five roles: admin, itsec, projectmanager, netadmin, developer. If you add the project name as the last argument then the role is assigned just for that project, otherwise the user is assigned the named role for all projects.
+ Add a user to either a global or project-based role with the indicated <rolename> assigned to the named user. Role names can be one of the following five roles: admin, itsec, projectmanager, netadmin, developer. If you add the project name as the last argument then the role is assigned just for that project, otherwise the user is assigned the named role for all projects.
``nova-manage role has <username> <projectname>``
Checks the user or project and responds with True if the user has a global role with a particular project.
``nova-manage role remove <username> <rolename>``
- Remove the indicated role from the user.
+ Remove the indicated role from the user.
Nova Shell
~~~~~~~~~~
``nova-manage shell bpython``
- Starts a new bpython shell.
+ Starts a new bpython shell.
``nova-manage shell ipython``
@@ -150,20 +161,20 @@ Nova VPN
``nova-manage vpn run <projectname>``
- Starts the VPN for the named project.
+ Starts the VPN for the named project.
``nova-manage vpn spawn``
Runs all VPNs.
-
+
Nova Floating IPs
~~~~~~~~~~~~~~~~~
``nova-manage floating create <host> <ip_range>``
Creates floating IP addresses for the named host by the given range.
- floating delete <ip_range> Deletes floating IP addresses in the range given.
-
+ floating delete <ip_range> Deletes floating IP addresses in the range given.
+
``nova-manage floating list``
Displays a list of all floating IP addresses.
diff --git a/nova/db/api.py b/nova/db/api.py
index da1e3d1f2..c6c03fb0e 100644
--- a/nova/db/api.py
+++ b/nova/db/api.py
@@ -71,7 +71,6 @@ class NoMoreTargets(exception.Error):
"""No more available blades"""
pass
-
###################
diff --git a/nova/db/sqlalchemy/session.py b/nova/db/sqlalchemy/session.py
index c3876c02a..dc885f138 100644
--- a/nova/db/sqlalchemy/session.py
+++ b/nova/db/sqlalchemy/session.py
@@ -22,6 +22,7 @@ Session Handling for SQLAlchemy backend
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
+from nova import exception
from nova import flags
FLAGS = flags.FLAGS
@@ -43,4 +44,6 @@ def get_session(autocommit=True, expire_on_commit=False):
autocommit=autocommit,
expire_on_commit=expire_on_commit))
session = _MAKER()
+ session.query = exception.wrap_db_error(session.query)
+ session.flush = exception.wrap_db_error(session.flush)
return session
diff --git a/nova/exception.py b/nova/exception.py
index 2320e2214..f604fd63a 100644
--- a/nova/exception.py
+++ b/nova/exception.py
@@ -81,6 +81,24 @@ class TimeoutException(Error):
pass
+class DBError(Error):
+ """Wraps an implementation specific exception"""
+ def __init__(self, inner_exception):
+ self.inner_exception = inner_exception
+ super(DBError, self).__init__(str(inner_exception))
+
+
+def wrap_db_error(f):
+ def _wrap(*args, **kwargs):
+ try:
+ return f(*args, **kwargs)
+ except Exception, e:
+ LOG.exception(_('DB exception wrapped'))
+ raise DBError(e)
+ return _wrap
+ _wrap.func_name = f.func_name
+
+
def wrap_exception(f):
def _wrap(*args, **kw):
try: