Merge lp:~vishvananda/nova/friendly-db into lp:~hudson-openstack/nova/trunk

Proposed by Vish Ishaya
Status: Merged
Approved by: Vish Ishaya
Approved revision: 591
Merged at revision: 619
Proposed branch: lp:~vishvananda/nova/friendly-db
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 955 lines (+227/-145)
9 files modified
bin/nova-manage (+24/-5)
contrib/nova.sh (+53/-39)
doc/source/adminguide/multi.node.install.rst (+66/-65)
doc/source/adminguide/nova.manage.rst (+23/-12)
doc/source/adminguide/single.node.install.rst (+17/-11)
doc/source/man/novamanage.rst (+23/-12)
nova/db/api.py (+0/-1)
nova/db/sqlalchemy/session.py (+3/-0)
nova/exception.py (+18/-0)
To merge this branch: bzr merge lp:~vishvananda/nova/friendly-db
Reviewer Review Type Date Requested Status
Eric Day (community) Needs Fixing
Devin Carlen (community) Approve
Review via email: mp+46797@code.launchpad.net

Description of the change

This branch updates docs to reflect the db sync addition. It additionally adds some useful errors to nova-manage to help people that are using old guides. It wraps sqlalchemy errors in generic DBError. Finally, it updates nova.sh to use current settings.

To post a comment you must log in.
Revision history for this message
Devin Carlen (devcamcar) wrote :

approve

review: Approve
Revision history for this message
Eric Day (eday) wrote :

This bin/nova-manage should not be touching sqlalchemy directly (what if we use a different driver for nova.db, or use ldap for auth?). I would wrap this exception at the sqlalchemy driver layer and raise a different exception as part of the auth_manager API.

review: Needs Fixing
Revision history for this message
Vish Ishaya (vishvananda) wrote :

I will fix the exception that eric mentioned tomorrow, but considering the number of bug reports about this particular error, It might be good to merge this and file a different bug to switch the exception.

Revision history for this message
Devin Carlen (devcamcar) wrote :

agree, let's put this in for now and create a separate bug to track Eric's concerns.

Revision history for this message
Vish Ishaya (vishvananda) wrote :

I actually fixed edays concerns. There is a generic db error now.

Revision history for this message
Devin Carlen (devcamcar) wrote :

Cool, with edays concerns fixed we can safely merge this now.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :
Download full text (21.0 KiB)

The attempt to merge lp:~vishvananda/nova/friendly-db into lp:nova failed. Below is the output from the failed tests.

AdminAPITest
    test_admin_disabled ok
    test_admin_enabled ok
APITest
    test_exceptions_are_converted_to_faults ok
Test
    test_authorize_token ok
    test_authorize_user ok
    test_bad_token ok
    test_bad_user ok
    test_no_user ok
    test_token_expiry ok
TestLimiter
    test_authorize_token ok
TestFaults
    test_fault_parts ok
    test_raise ok
    test_retry_header ok
FlavorsTest
    test_get_flavor_by_id ok
    test_get_flavor_list ok
GlanceImageServiceTest
    test_create ok
    test_create_and_show_non_existing_image ok
    test_delete ok
    test_update ok
ImageControllerWithGlanceServiceTest
    test_get_image_details ok
    test_get_image_index ok
LocalImageServiceTest
    test_create ok
    test_create_and_show_non_existing_image ok
    test_delete ok
    test_update ok
LimiterTest
    test_minute ok
    test_one_per_period ok
    test_second ok
    test_users_get_separate_buckets ok
    test_we_can_go_indefinitely_if_we_spread_out_requests ok
WSGIAppProxyTest
    test_200 ok
    test_403 ok
    test_failure ok
WSGIAppTest
    test_escaping ok
    test_good_urls ok
    test_invalid_methods ok
    test_invalid_urls ok
    test_response_to_delays ok
ServersTest
    test_create_backup_schedules ok
    test_create_instance ok
    test_delete_backup_schedules ok
    test_delete_server_instance ok
    test_get_all_server_details ok
    ...

lp:~vishvananda/nova/friendly-db updated
590. By Vish Ishaya

merged trunk

591. By Vish Ishaya

fix pep8 issue (and my commit hook that didn't catch it)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/nova-manage'
2--- bin/nova-manage 2011-01-24 18:07:12 +0000
3+++ bin/nova-manage 2011-01-25 23:31:21 +0000
4@@ -267,6 +267,14 @@
5 self.manager.remove_role(user, role, project)
6
7
8+def _db_error(caught_exception):
9+ print caught_exception
10+ print _("The above error may show that the database has not "
11+ "been created.\nPlease create a database using "
12+ "nova-manage sync db before running this command.")
13+ exit(1)
14+
15+
16 class UserCommands(object):
17 """Class for managing users."""
18
19@@ -282,13 +290,19 @@
20 def admin(self, name, access=None, secret=None):
21 """creates a new admin and prints exports
22 arguments: name [access] [secret]"""
23- user = self.manager.create_user(name, access, secret, True)
24+ try:
25+ user = self.manager.create_user(name, access, secret, True)
26+ except exception.DBError, e:
27+ _db_error(e)
28 self._print_export(user)
29
30 def create(self, name, access=None, secret=None):
31 """creates a new user and prints exports
32 arguments: name [access] [secret]"""
33- user = self.manager.create_user(name, access, secret, False)
34+ try:
35+ user = self.manager.create_user(name, access, secret, False)
36+ except exception.DBError, e:
37+ _db_error(e)
38 self._print_export(user)
39
40 def delete(self, name):
41@@ -409,9 +423,14 @@
42 with open(filename, 'w') as f:
43 f.write(zip_file)
44 except db.api.NoMoreNetworks:
45- print ('No more networks available. If this is a new '
46- 'installation, you need\nto call something like this:\n\n'
47- ' nova-manage network create 10.0.0.0/8 10 64\n\n')
48+ print _('No more networks available. If this is a new '
49+ 'installation, you need\nto call something like this:\n\n'
50+ ' nova-manage network create 10.0.0.0/8 10 64\n\n')
51+ except exception.ProcessExecutionError, e:
52+ print e
53+ print _("The above error may show that the certificate db has not "
54+ "been created.\nPlease create a database by running a "
55+ "nova-api server on this host.")
56
57
58 class FloatingIpCommands(object):
59
60=== modified file 'contrib/nova.sh'
61--- contrib/nova.sh 2011-01-18 19:41:32 +0000
62+++ contrib/nova.sh 2011-01-25 23:31:21 +0000
63@@ -1,15 +1,14 @@
64 #!/usr/bin/env bash
65 DIR=`pwd`
66 CMD=$1
67-SOURCE_BRANCH=lp:nova
68-if [ -n "$2" ]; then
69- SOURCE_BRANCH=$2
70+if [ "$CMD" = "branch" ]; then
71+ SOURCE_BRANCH=${2:-lp:nova}
72+ DIRNAME=${3:-nova}
73+else
74+ DIRNAME=${2:-nova}
75 fi
76-DIRNAME=nova
77+
78 NOVA_DIR=$DIR/$DIRNAME
79-if [ -n "$3" ]; then
80- NOVA_DIR=$DIR/$3
81-fi
82
83 if [ ! -n "$HOST_IP" ]; then
84 # NOTE(vish): This will just get the first ip in the list, so if you
85@@ -24,6 +23,8 @@
86 USE_LDAP=${USE_LDAP:-0}
87 # Use OpenDJ instead of OpenLDAP when using LDAP
88 USE_OPENDJ=${USE_OPENDJ:-0}
89+# Use IPv6
90+USE_IPV6=${USE_IPV6:-0}
91 LIBVIRT_TYPE=${LIBVIRT_TYPE:-qemu}
92 NET_MAN=${NET_MAN:-VlanManager}
93 # NOTE(vish): If you are using FlatDHCP on multiple hosts, set the interface
94@@ -43,30 +44,17 @@
95 AUTH=dbdriver.DbDriver
96 fi
97
98-mkdir -p /etc/nova
99-cat >$NOVA_DIR/bin/nova.conf << NOVA_CONF_EOF
100---verbose
101---nodaemon
102---dhcpbridge_flagfile=$NOVA_DIR/bin/nova.conf
103---network_manager=nova.network.manager.$NET_MAN
104---cc_host=$HOST_IP
105---routing_source_ip=$HOST_IP
106---sql_connection=$SQL_CONN
107---auth_driver=nova.auth.$AUTH
108---libvirt_type=$LIBVIRT_TYPE
109-NOVA_CONF_EOF
110-
111-if [ -n "$FLAT_INTERFACE" ]; then
112- echo "--flat_interface=$FLAT_INTERFACE" >>$NOVA_DIR/bin/nova.conf
113-fi
114-
115 if [ "$CMD" == "branch" ]; then
116 sudo apt-get install -y bzr
117+ if [ ! -e "$DIR/.bzr" ]; then
118+ bzr init-repo $DIR
119+ fi
120 rm -rf $NOVA_DIR
121 bzr branch $SOURCE_BRANCH $NOVA_DIR
122 cd $NOVA_DIR
123 mkdir -p $NOVA_DIR/instances
124 mkdir -p $NOVA_DIR/networks
125+ exit
126 fi
127
128 # You should only have to run this once
129@@ -74,7 +62,7 @@
130 sudo apt-get install -y python-software-properties
131 sudo add-apt-repository ppa:nova-core/trunk
132 sudo apt-get update
133- sudo apt-get install -y dnsmasq kpartx kvm gawk iptables ebtables
134+ sudo apt-get install -y dnsmasq-base kpartx kvm gawk iptables ebtables
135 sudo apt-get install -y user-mode-linux kvm libvirt-bin
136 sudo apt-get install -y screen euca2ools vlan curl rabbitmq-server
137 sudo apt-get install -y lvm2 iscsitarget open-iscsi
138@@ -85,16 +73,16 @@
139 sudo /etc/init.d/libvirt-bin restart
140 sudo modprobe nbd
141 sudo apt-get install -y python-twisted python-sqlalchemy python-mox python-greenlet python-carrot
142- sudo apt-get install -y python-daemon python-eventlet python-gflags python-ipy
143+ sudo apt-get install -y python-migrate python-eventlet python-gflags python-ipy python-tempita
144 sudo apt-get install -y python-libvirt python-libxml2 python-routes python-cheetah
145- sudo apt-get install -y python-paste python-pastedeploy
146-#For IPV6
147- sudo apt-get install -y python-netaddr
148- sudo apt-get install -y radvd
149-#(Nati) Note that this configuration is only needed for nova-network node.
150- sudo bash -c "echo 1 > /proc/sys/net/ipv6/conf/all/forwarding"
151- sudo bash -c "echo 0 > /proc/sys/net/ipv6/conf/all/accept_ra"
152-
153+ sudo apt-get install -y python-netaddr python-paste python-pastedeploy python-glance
154+
155+ if [ "$USE_IPV6" == 1 ]; then
156+ sudo apt-get install -y radvd
157+ sudo bash -c "echo 1 > /proc/sys/net/ipv6/conf/all/forwarding"
158+ sudo bash -c "echo 0 > /proc/sys/net/ipv6/conf/all/accept_ra"
159+ fi
160+
161 if [ "$USE_MYSQL" == 1 ]; then
162 cat <<MYSQL_PRESEED | debconf-set-selections
163 mysql-server-5.1 mysql-server/root_password password $MYSQL_PASS
164@@ -103,8 +91,10 @@
165 MYSQL_PRESEED
166 apt-get install -y mysql-server python-mysqldb
167 fi
168- wget http://c2477062.cdn.cloudfiles.rackspacecloud.com/images.tgz
169- tar -C $DIR -zxf images.tgz
170+ mkdir -p $DIR/images
171+ wget -c http://images.ansolabs.com/tty.tgz
172+ tar -C $DIR/images -zxf tty.tgz
173+ exit
174 fi
175
176 NL=`echo -ne '\015'`
177@@ -115,9 +105,31 @@
178 }
179
180 if [ "$CMD" == "run" ]; then
181+
182+ cat >$NOVA_DIR/bin/nova.conf << NOVA_CONF_EOF
183+--verbose
184+--nodaemon
185+--dhcpbridge_flagfile=$NOVA_DIR/bin/nova.conf
186+--network_manager=nova.network.manager.$NET_MAN
187+--cc_host=$HOST_IP
188+--routing_source_ip=$HOST_IP
189+--sql_connection=$SQL_CONN
190+--auth_driver=nova.auth.$AUTH
191+--libvirt_type=$LIBVIRT_TYPE
192+NOVA_CONF_EOF
193+
194+ if [ -n "$FLAT_INTERFACE" ]; then
195+ echo "--flat_interface=$FLAT_INTERFACE" >>$NOVA_DIR/bin/nova.conf
196+ fi
197+
198+ if [ "$USE_IPV6" == 1 ]; then
199+ echo "--use_ipv6" >>$NOVA_DIR/bin/nova.conf
200+ fi
201+
202 killall dnsmasq
203- #For IPv6
204- killall radvd
205+ if [ "$USE_IPV6" == 1 ]; then
206+ killall radvd
207+ fi
208 screen -d -m -S nova -t nova
209 sleep 1
210 if [ "$USE_MYSQL" == 1 ]; then
211@@ -150,6 +162,8 @@
212 cd $DIR
213 fi
214
215+ # create the database
216+ $NOVA_DIR/bin/nova-manage db sync
217 # create an admin user called 'admin'
218 $NOVA_DIR/bin/nova-manage user admin admin admin admin
219 # create a project called 'admin' with project manager of 'admin'
220@@ -178,6 +192,7 @@
221 sleep 2
222 # delete volumes
223 . $NOVA_DIR/novarc; euca-describe-volumes | grep vol- | cut -f2 | xargs -n1 euca-delete-volume
224+ sleep 2
225 fi
226
227 if [ "$CMD" == "run" ] || [ "$CMD" == "clean" ]; then
228@@ -192,5 +207,4 @@
229 else
230 virsh list | grep i- | awk '{print \$1}' | xargs -n1 virsh destroy
231 fi
232- vblade-persist ls | grep vol- | awk '{print \$1\" \"\$2}' | xargs -n2 vblade-persist destroy
233 fi
234
235=== modified file 'doc/source/adminguide/multi.node.install.rst'
236--- doc/source/adminguide/multi.node.install.rst 2011-01-20 20:56:29 +0000
237+++ doc/source/adminguide/multi.node.install.rst 2011-01-25 23:31:21 +0000
238@@ -1,84 +1,85 @@
239
240 Installing Nova on Multiple Servers
241 ===================================
242-
243+
244 When you move beyond evaluating the technology and into building an actual
245 production environment, you will need to know how to configure your datacenter
246 and how to deploy components across your clusters. This guide should help you
247 through that process.
248-
249+
250 You can install multiple nodes to increase performance and availability of the OpenStack Compute installation.
251-
252+
253 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.
254
255 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.
256
257 Requirements for a multi-node installation
258 ------------------------------------------
259-
260+
261 * 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.
262 * 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.
263 * For performance optimization, split reads and writes to the database. MySQL proxy is the easiest way to make this work if running MySQL.
264-
265+
266 Assumptions
267 -----------
268-
269+
270 * Networking is configured between/through the physical machines on a single subnet.
271 * Installation and execution are both performed by ROOT user.
272
273+
274 Scripted Installation
275 ---------------------
276-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.
277+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.
278
279-You must run these scripts with root permissions.
280+You must run these scripts with root permissions.
281
282 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/.
283
284 ::
285-
286+
287 wget --no-check-certificate https://github.com/dubsquared/OpenStack-NOVA-Installer-Script/raw/master/Nova_CC_Installer_v0.1
288
289 Ensure you can execute the script by modifying the permissions on the script file.
290
291 ::
292-
293+
294 sudo chmod 755 Nova_CC_Installer_v0.1
295
296
297 ::
298-
299+
300 sudo ./Nova_CC_Installer_v0.1
301
302-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.
303+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.
304
305 Restart related services::
306-
307+
308 libvirtd restart; service nova-network restart; service nova-compute restart; service nova-api restart; service nova-objectstore restart; service nova-scheduler restart
309
310 You can go to the `Configuration section`_ for next steps.
311
312 Manual Installation - Step-by-Step
313 ----------------------------------
314-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.
315+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.
316
317 Cloud Controller Installation
318 `````````````````````````````
319 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`_.
320-
321+
322 Step 1 - Use apt-get to get the latest code
323 -------------------------------------------
324
325 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:
326
327 ::
328-
329+
330 sudo apt-get install python-software-properties
331 sudo add-apt-repository ppa:nova-core/trunk
332-
333+
334 2. Run update.
335
336 ::
337-
338+
339 sudo apt-get update
340
341 3. Install python required packages, nova-packages, and helper apps.
342@@ -93,15 +94,15 @@
343 ---------------------------------------------------------
344
345 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:
346-
347+
348 ::
349-
350+
351 --daemonize=1
352 --dhcpbridge_flagfile=/etc/nova/nova.conf
353 --dhcpbridge=/usr/bin/nova-dhcpbridge
354 --logdir=/var/log/nova
355 --state_path=/var/lib/nova
356-
357+
358 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:
359
360 --sql_connection ### Location of Nova SQL DB
361@@ -131,31 +132,31 @@
362 Note: CC_ADDR=<the external IP address of your cloud controller>
363
364 Detailed explanation of the following example is available above.
365-
366+
367 ::
368-
369+
370 --sql_connection=mysql://root:nova@<CC_ADDR>/nova
371 --s3_host=<CC_ADDR>
372 --rabbit_host=<CC_ADDR>
373---cc_host=<CC_ADDR>
374---verbose
375+--cc_host=<CC_ADDR>
376+--verbose
377 --ec2_url=http://<CC_ADDR>:8773/services/Cloud
378 --network_manager=nova.network.manager.VlanManager
379 --fixed_range=<network/prefix>
380---network_size=<# of addrs>
381-
382+--network_size=<# of addrs>
383+
384 2. Create a “nova” group, and set permissions::
385
386 addgroup nova
387-
388+
389 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. ::
390
391 chown -R root:nova /etc/nova
392- chmod 644 /etc/nova/nova.conf
393-
394+ chmod 644 /etc/nova/nova.conf
395+
396 Step 3 - Setup the SQL DB (MySQL for this setup)
397 ------------------------------------------------
398-
399+
400 1. First you 'preseed' to bypass all the installation prompts::
401
402 bash
403@@ -165,59 +166,59 @@
404 mysql-server-5.1 mysql-server/root_password_again password $MYSQL_PASS
405 mysql-server-5.1 mysql-server/start_on_boot boolean true
406 MYSQL_PRESEED
407-
408+
409 2. Install MySQL::
410-
411+
412 apt-get install -y mysql-server
413-
414+
415 3. Edit /etc/mysql/my.cnf to change ‘bind-address’ from localhost to any::
416
417 sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mysql/my.cnf
418 service mysql restart
419
420 4. MySQL DB configuration:
421-
422+
423 Create NOVA database::
424
425 mysql -uroot -p$MYSQL_PASS -e 'CREATE DATABASE nova;'
426-
427+
428 Update the DB to include user 'root'@'%' with super user privileges::
429
430 mysql -uroot -p$MYSQL_PASS -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;"
431-
432+
433 Set mySQL root password::
434
435- mysql -uroot -p$MYSQL_PASS -e "SET PASSWORD FOR 'root'@'%' = PASSWORD('$MYSQL_PASS');"
436-
437+ mysql -uroot -p$MYSQL_PASS -e "SET PASSWORD FOR 'root'@'%' = PASSWORD('$MYSQL_PASS');"
438+
439 Compute Node Installation
440 `````````````````````````
441-
442+
443 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.
444-
445+
446 Network Configuration
447 ---------------------
448
449 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.
450-
451+
452 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::
453
454 < begin /etc/network/interfaces >
455 # The loopback network interface
456 auto lo
457 iface lo inet loopback
458-
459+
460 # Networking for NOVA
461 auto br100
462-
463+
464 iface br100 inet dhcp
465 bridge_ports eth0
466 bridge_stp off
467 bridge_maxwait 0
468 bridge_fd 0
469 < end /etc/network/interfaces >
470-
471+
472 Next, restart networking to apply the changes::
473-
474+
475 sudo /etc/init.d/networking restart
476
477 Configuration
478@@ -234,32 +235,32 @@
479 /usr/bin/python /usr/bin/nova-manage user admin <user_name>
480 /usr/bin/python /usr/bin/nova-manage project create <project_name> <user_name>
481 /usr/bin/python /usr/bin/nova-manage network create <project-network> <number-of-networks-in-project> <IPs in project>
482-
483+
484 Here is an example of what this looks like with real data::
485
486 /usr/bin/python /usr/bin/nova-manage db sync
487 /usr/bin/python /usr/bin/nova-manage user admin dub
488 /usr/bin/python /usr/bin/nova-manage project create dubproject dub
489 /usr/bin/python /usr/bin/nova-manage network create 192.168.0.0/24 1 255
490-
491+
492 (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.)
493-
494+
495 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.
496-
497+
498 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.
499-
500-
501+
502+
503 Step 2 - Create Nova certifications
504 -----------------------------------
505-
506-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.
507+
508+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.
509
510 ::
511
512 mkdir –p /root/creds
513 /usr/bin/python /usr/bin/nova-manage project zipfile $NOVA_PROJECT $NOVA_PROJECT_USER /root/creds/novacreds.zip
514-
515-2. Unzip them in your home directory, and add them to your environment.
516+
517+2. Unzip them in your home directory, and add them to your environment.
518
519 ::
520
521@@ -271,7 +272,7 @@
522 --------------------------------------
523
524 Restart all six services in total, just to cover the entire spectrum::
525-
526+
527 libvirtd restart; service nova-network restart; service nova-compute restart; service nova-api restart; service nova-objectstore restart; service nova-scheduler restart
528
529 Step 4 - Closing steps, and cleaning up
530@@ -294,19 +295,19 @@
531
532 euca-describe-images
533 euca-describe-instances
534-
535+
536 If you have issues with the API key, you may need to re-source your creds file::
537
538 . /root/creds/novarc
539-
540+
541 If you don’t get any immediate errors, you’re successfully making calls to your cloud!
542
543-Spinning up a VM for Testing
544+Spinning up a VM for Testing
545 ````````````````````````````
546
547-(This excerpt is from Thierry Carrez's blog, with reference to http://wiki.openstack.org/GettingImages.)
548+(This excerpt is from Thierry Carrez's blog, with reference to http://wiki.openstack.org/GettingImages.)
549
550-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.
551+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.
552
553 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/>`_.
554
555@@ -332,13 +333,13 @@
556
557 ::
558
559- euca-run-instances $emi -k mykey -t m1.tiny
560+ euca-run-instances $emi -k mykey -t m1.tiny
561
562 ($emi is replaced with the output from the previous command)
563
564 Checking status, and confirming communication:
565
566-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.
567+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.
568
569 ::
570
571@@ -360,4 +361,4 @@
572
573 For more information in creating you own custom (production ready) instance images, please visit http://wiki.openstack.org/GettingImages for more information!
574
575-Enjoy your new private cloud, and play responsibly!
576\ No newline at end of file
577+Enjoy your new private cloud, and play responsibly!
578
579=== modified file 'doc/source/adminguide/nova.manage.rst'
580--- doc/source/adminguide/nova.manage.rst 2011-01-04 22:58:08 +0000
581+++ doc/source/adminguide/nova.manage.rst 2011-01-25 23:31:21 +0000
582@@ -42,6 +42,17 @@
583
584 These sections describe the available categories and arguments for nova-manage.
585
586+Nova Db
587+~~~~~~~
588+
589+``nova-manage db version``
590+
591+ Print the current database version.
592+
593+``nova-manage db sync``
594+
595+ Sync the database up to the most recent version. This is the standard way to create the db as well.
596+
597 Nova User
598 ~~~~~~~~~
599
600@@ -68,7 +79,7 @@
601 ``nova-manage user modify <accesskey> <secretkey> <admin?T/F>``
602
603 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.
604-
605+
606 Nova Project
607 ~~~~~~~~~~~~
608
609@@ -79,7 +90,7 @@
610 ``nova-manage project create <projectname>``
611
612 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).
613-
614+
615 ``nova-manage project delete <projectname>``
616
617 Delete a nova project with the name <projectname>.
618@@ -87,7 +98,7 @@
619 ``nova-manage project environment <projectname> <username>``
620
621 Exports environment variables for the named project to a file named novarc.
622-
623+
624 ``nova-manage project list``
625
626 Outputs a list of all the projects to the screen.
627@@ -103,27 +114,27 @@
628 ``nova-manage project zipfile``
629
630 Compresses all related files for a created project into a zip file nova.zip.
631-
632+
633 Nova Role
634 ~~~~~~~~~
635
636-nova-manage role <action> [<argument>]
637+nova-manage role <action> [<argument>]
638 ``nova-manage role add <username> <rolename> <(optional) projectname>``
639
640- 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.
641+ 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.
642
643 ``nova-manage role has <username> <projectname>``
644 Checks the user or project and responds with True if the user has a global role with a particular project.
645
646 ``nova-manage role remove <username> <rolename>``
647- Remove the indicated role from the user.
648+ Remove the indicated role from the user.
649
650 Nova Shell
651 ~~~~~~~~~~
652
653 ``nova-manage shell bpython``
654
655- Starts a new bpython shell.
656+ Starts a new bpython shell.
657
658 ``nova-manage shell ipython``
659
660@@ -150,12 +161,12 @@
661
662 ``nova-manage vpn run <projectname>``
663
664- Starts the VPN for the named project.
665+ Starts the VPN for the named project.
666
667 ``nova-manage vpn spawn``
668
669 Runs all VPNs.
670-
671+
672 Nova Floating IPs
673 ~~~~~~~~~~~~~~~~~
674
675@@ -165,8 +176,8 @@
676
677 ``nova-manage floating delete <ip_range>``
678
679- Deletes floating IP addresses in the range given.
680-
681+ Deletes floating IP addresses in the range given.
682+
683 ``nova-manage floating list``
684
685 Displays a list of all floating IP addresses.
686
687=== modified file 'doc/source/adminguide/single.node.install.rst'
688--- doc/source/adminguide/single.node.install.rst 2011-01-20 20:56:29 +0000
689+++ doc/source/adminguide/single.node.install.rst 2011-01-25 23:31:21 +0000
690@@ -52,7 +52,13 @@
691 Finished processing dependencies for nova==2010.1
692
693
694-Step 4: Create a Nova administrator
695+Step 4: Create the Nova Database
696+--------------------------------
697+Type or copy/paste in the following line to create your nova db::
698+
699+ sudo nova-manage db sync
700+
701+Step 5: Create a Nova administrator
702 -----------------------------------
703 Type or copy/paste in the following line to create a user named "anne."::
704
705@@ -63,10 +69,10 @@
706 export EC2_ACCESS_KEY=4e6498a2-blah-blah-blah-17d1333t97fd
707 export EC2_SECRET_KEY=0a520304-blah-blah-blah-340sp34k05bbe9a7
708
709-Step 5: Create the network
710+Step 6: Create the network
711 --------------------------
712
713-Type or copy/paste in the following line to create a network prior to creating a project.
714+Type or copy/paste in the following line to create a network prior to creating a project.
715
716 ::
717
718@@ -76,7 +82,7 @@
719
720 After running this command, entries are made in the 'networks' and 'fixed_ips' table in the database.
721
722-Step 6: Create a project with the user you created
723+Step 7: Create a project with the user you created
724 --------------------------------------------------
725 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.
726
727@@ -106,7 +112,7 @@
728 Data Base Updated
729
730
731-Step 7: Unzip the nova.zip
732+Step 8: Unzip the nova.zip
733 --------------------------
734
735 You should have a nova.zip file in your current working directory. Unzip it with this command:
736@@ -128,7 +134,7 @@
737 extracting: cacert.pem
738
739
740-Step 8: Source the rc file
741+Step 9: Source the rc file
742 --------------------------
743 Type or copy/paste the following to source the novarc file in your current working directory.
744
745@@ -137,14 +143,14 @@
746 . novarc
747
748
749-Step 9: Pat yourself on the back :)
750+Step 10: Pat yourself on the back :)
751 -----------------------------------
752 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.
753
754 Now you need an image.
755
756
757-Step 9: Get an image
758+Step 11: Get an image
759 --------------------
760 To make things easier, we've provided a small image on the Rackspace CDN. Use this command to get it on your server.
761
762@@ -168,7 +174,7 @@
763
764
765
766-Step 10: Decompress the image file
767+Step 12: Decompress the image file
768 ----------------------------------
769 Use this command to extract the image files:::
770
771@@ -187,7 +193,7 @@
772 |-- image
773 `-- info.json
774
775-Step 11: Send commands to upload sample image to the cloud
776+Step 13: Send commands to upload sample image to the cloud
777 ----------------------------------------------------------
778
779 Type or copy/paste the following commands to create a manifest for the kernel.::
780@@ -340,7 +346,7 @@
781 Type or copy/paste the following commands to ssh to the instance using your private key.::
782
783 ssh -i mykey.priv root@10.0.0.3
784-
785+
786
787 Troubleshooting Installation
788 ----------------------------
789
790=== modified file 'doc/source/man/novamanage.rst'
791--- doc/source/man/novamanage.rst 2010-11-17 21:54:19 +0000
792+++ doc/source/man/novamanage.rst 2011-01-25 23:31:21 +0000
793@@ -42,6 +42,17 @@
794
795 These sections describe the available categories and arguments for nova-manage.
796
797+Nova Db
798+~~~~~~~
799+
800+``nova-manage db version``
801+
802+ Print the current database version.
803+
804+``nova-manage db sync``
805+
806+ Sync the database up to the most recent version. This is the standard way to create the db as well.
807+
808 Nova User
809 ~~~~~~~~~
810
811@@ -68,7 +79,7 @@
812 ``nova-manage user modify <accesskey> <secretkey> <admin?T/F>``
813
814 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.
815-
816+
817 Nova Project
818 ~~~~~~~~~~~~
819
820@@ -79,7 +90,7 @@
821 ``nova-manage project create <projectname>``
822
823 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).
824-
825+
826 ``nova-manage project delete <projectname>``
827
828 Delete a nova project with the name <projectname>.
829@@ -87,7 +98,7 @@
830 ``nova-manage project environment <projectname> <username>``
831
832 Exports environment variables for the named project to a file named novarc.
833-
834+
835 ``nova-manage project list``
836
837 Outputs a list of all the projects to the screen.
838@@ -103,27 +114,27 @@
839 ``nova-manage project zipfile``
840
841 Compresses all related files for a created project into a zip file nova.zip.
842-
843+
844 Nova Role
845 ~~~~~~~~~
846
847-nova-manage role <action> [<argument>]
848+nova-manage role <action> [<argument>]
849 ``nova-manage role add <username> <rolename> <(optional) projectname>``
850
851- 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.
852+ 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.
853
854 ``nova-manage role has <username> <projectname>``
855 Checks the user or project and responds with True if the user has a global role with a particular project.
856
857 ``nova-manage role remove <username> <rolename>``
858- Remove the indicated role from the user.
859+ Remove the indicated role from the user.
860
861 Nova Shell
862 ~~~~~~~~~~
863
864 ``nova-manage shell bpython``
865
866- Starts a new bpython shell.
867+ Starts a new bpython shell.
868
869 ``nova-manage shell ipython``
870
871@@ -150,20 +161,20 @@
872
873 ``nova-manage vpn run <projectname>``
874
875- Starts the VPN for the named project.
876+ Starts the VPN for the named project.
877
878 ``nova-manage vpn spawn``
879
880 Runs all VPNs.
881-
882+
883 Nova Floating IPs
884 ~~~~~~~~~~~~~~~~~
885
886 ``nova-manage floating create <host> <ip_range>``
887
888 Creates floating IP addresses for the named host by the given range.
889- floating delete <ip_range> Deletes floating IP addresses in the range given.
890-
891+ floating delete <ip_range> Deletes floating IP addresses in the range given.
892+
893 ``nova-manage floating list``
894
895 Displays a list of all floating IP addresses.
896
897=== modified file 'nova/db/api.py'
898--- nova/db/api.py 2011-01-25 19:49:29 +0000
899+++ nova/db/api.py 2011-01-25 23:31:21 +0000
900@@ -71,7 +71,6 @@
901 """No more available blades"""
902 pass
903
904-
905 ###################
906
907
908
909=== modified file 'nova/db/sqlalchemy/session.py'
910--- nova/db/sqlalchemy/session.py 2011-01-03 18:55:52 +0000
911+++ nova/db/sqlalchemy/session.py 2011-01-25 23:31:21 +0000
912@@ -22,6 +22,7 @@
913 from sqlalchemy import create_engine
914 from sqlalchemy.orm import sessionmaker
915
916+from nova import exception
917 from nova import flags
918
919 FLAGS = flags.FLAGS
920@@ -43,4 +44,6 @@
921 autocommit=autocommit,
922 expire_on_commit=expire_on_commit))
923 session = _MAKER()
924+ session.query = exception.wrap_db_error(session.query)
925+ session.flush = exception.wrap_db_error(session.flush)
926 return session
927
928=== modified file 'nova/exception.py'
929--- nova/exception.py 2011-01-19 02:00:28 +0000
930+++ nova/exception.py 2011-01-25 23:31:21 +0000
931@@ -81,6 +81,24 @@
932 pass
933
934
935+class DBError(Error):
936+ """Wraps an implementation specific exception"""
937+ def __init__(self, inner_exception):
938+ self.inner_exception = inner_exception
939+ super(DBError, self).__init__(str(inner_exception))
940+
941+
942+def wrap_db_error(f):
943+ def _wrap(*args, **kwargs):
944+ try:
945+ return f(*args, **kwargs)
946+ except Exception, e:
947+ LOG.exception(_('DB exception wrapped'))
948+ raise DBError(e)
949+ return _wrap
950+ _wrap.func_name = f.func_name
951+
952+
953 def wrap_exception(f):
954 def _wrap(*args, **kw):
955 try: