add helpful error messages to nova-manage and update nova.sh
This commit is contained in:
parent
7d7fbf5dfd
commit
72f08004f3
@ -61,6 +61,7 @@ import sys
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
import IPy
|
import IPy
|
||||||
|
from sqlalchemy import exc
|
||||||
|
|
||||||
# If ../nova/__init__.py exists, add ../ to Python search path, so that
|
# If ../nova/__init__.py exists, add ../ to Python search path, so that
|
||||||
# it will override what happens to be installed in /usr/(local/)lib/python...
|
# it will override what happens to be installed in /usr/(local/)lib/python...
|
||||||
@ -255,6 +256,13 @@ class RoleCommands(object):
|
|||||||
self.manager.remove_role(user, role, project)
|
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 UserCommands(object):
|
||||||
"""Class for managing users."""
|
"""Class for managing users."""
|
||||||
|
|
||||||
@ -270,13 +278,19 @@ class UserCommands(object):
|
|||||||
def admin(self, name, access=None, secret=None):
|
def admin(self, name, access=None, secret=None):
|
||||||
"""creates a new admin and prints exports
|
"""creates a new admin and prints exports
|
||||||
arguments: name [access] [secret]"""
|
arguments: name [access] [secret]"""
|
||||||
user = self.manager.create_user(name, access, secret, True)
|
try:
|
||||||
|
user = self.manager.create_user(name, access, secret, True)
|
||||||
|
except exc.OperationalError, e:
|
||||||
|
_db_error(e)
|
||||||
self._print_export(user)
|
self._print_export(user)
|
||||||
|
|
||||||
def create(self, name, access=None, secret=None):
|
def create(self, name, access=None, secret=None):
|
||||||
"""creates a new user and prints exports
|
"""creates a new user and prints exports
|
||||||
arguments: name [access] [secret]"""
|
arguments: name [access] [secret]"""
|
||||||
user = self.manager.create_user(name, access, secret, False)
|
try:
|
||||||
|
user = self.manager.create_user(name, access, secret, False)
|
||||||
|
except exc.OperationalError, e:
|
||||||
|
_db_error(e)
|
||||||
self._print_export(user)
|
self._print_export(user)
|
||||||
|
|
||||||
def delete(self, name):
|
def delete(self, name):
|
||||||
@ -397,9 +411,14 @@ class ProjectCommands(object):
|
|||||||
with open(filename, 'w') as f:
|
with open(filename, 'w') as f:
|
||||||
f.write(zip_file)
|
f.write(zip_file)
|
||||||
except db.api.NoMoreNetworks:
|
except db.api.NoMoreNetworks:
|
||||||
print ('No more networks available. If this is a new '
|
print _('No more networks available. If this is a new '
|
||||||
'installation, you need\nto call something like this:\n\n'
|
'installation, you need\nto call something like this:\n\n'
|
||||||
' nova-manage network create 10.0.0.0/8 10 64\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):
|
class FloatingIpCommands(object):
|
||||||
|
@ -24,6 +24,8 @@ TEST=${TEST:-0}
|
|||||||
USE_LDAP=${USE_LDAP:-0}
|
USE_LDAP=${USE_LDAP:-0}
|
||||||
# Use OpenDJ instead of OpenLDAP when using LDAP
|
# Use OpenDJ instead of OpenLDAP when using LDAP
|
||||||
USE_OPENDJ=${USE_OPENDJ:-0}
|
USE_OPENDJ=${USE_OPENDJ:-0}
|
||||||
|
# Use IPv6
|
||||||
|
USE_IPV6=${USE_IPV6:-0}
|
||||||
LIBVIRT_TYPE=${LIBVIRT_TYPE:-qemu}
|
LIBVIRT_TYPE=${LIBVIRT_TYPE:-qemu}
|
||||||
NET_MAN=${NET_MAN:-VlanManager}
|
NET_MAN=${NET_MAN:-VlanManager}
|
||||||
# NOTE(vish): If you are using FlatDHCP on multiple hosts, set the interface
|
# NOTE(vish): If you are using FlatDHCP on multiple hosts, set the interface
|
||||||
@ -60,6 +62,10 @@ if [ -n "$FLAT_INTERFACE" ]; then
|
|||||||
echo "--flat_interface=$FLAT_INTERFACE" >>$NOVA_DIR/bin/nova.conf
|
echo "--flat_interface=$FLAT_INTERFACE" >>$NOVA_DIR/bin/nova.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "$USE_IPV6" ]; then
|
||||||
|
echo "--use_ipv6" >>$NOVA_DIR/bin/nova.conf
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$CMD" == "branch" ]; then
|
if [ "$CMD" == "branch" ]; then
|
||||||
sudo apt-get install -y bzr
|
sudo apt-get install -y bzr
|
||||||
rm -rf $NOVA_DIR
|
rm -rf $NOVA_DIR
|
||||||
@ -74,7 +80,7 @@ if [ "$CMD" == "install" ]; then
|
|||||||
sudo apt-get install -y python-software-properties
|
sudo apt-get install -y python-software-properties
|
||||||
sudo add-apt-repository ppa:nova-core/trunk
|
sudo add-apt-repository ppa:nova-core/trunk
|
||||||
sudo apt-get update
|
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 user-mode-linux kvm libvirt-bin
|
||||||
sudo apt-get install -y screen euca2ools vlan curl rabbitmq-server
|
sudo apt-get install -y screen euca2ools vlan curl rabbitmq-server
|
||||||
sudo apt-get install -y lvm2 iscsitarget open-iscsi
|
sudo apt-get install -y lvm2 iscsitarget open-iscsi
|
||||||
@ -85,15 +91,16 @@ if [ "$CMD" == "install" ]; then
|
|||||||
sudo /etc/init.d/libvirt-bin restart
|
sudo /etc/init.d/libvirt-bin restart
|
||||||
sudo modprobe nbd
|
sudo modprobe nbd
|
||||||
sudo apt-get install -y python-twisted python-sqlalchemy python-mox python-greenlet python-carrot
|
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-daemon 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-libvirt python-libxml2 python-routes python-cheetah
|
||||||
#For IPV6
|
sudo apt-get install -y python-netaddr python-paste python-pastedeploy python-glance
|
||||||
sudo apt-get install -y python-netaddr
|
|
||||||
sudo apt-get install -y radvd
|
if [ -n "$USE_IPV6" ]; then
|
||||||
#(Nati) Note that this configuration is only needed for nova-network node.
|
sudo apt-get install -y radvd
|
||||||
sudo bash -c "echo 1 > /proc/sys/net/ipv6/conf/all/forwarding"
|
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 bash -c "echo 0 > /proc/sys/net/ipv6/conf/all/accept_ra"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$USE_MYSQL" == 1 ]; then
|
if [ "$USE_MYSQL" == 1 ]; then
|
||||||
cat <<MYSQL_PRESEED | debconf-set-selections
|
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 password $MYSQL_PASS
|
||||||
@ -102,7 +109,7 @@ mysql-server-5.1 mysql-server/start_on_boot boolean true
|
|||||||
MYSQL_PRESEED
|
MYSQL_PRESEED
|
||||||
apt-get install -y mysql-server python-mysqldb
|
apt-get install -y mysql-server python-mysqldb
|
||||||
fi
|
fi
|
||||||
wget http://c2477062.cdn.cloudfiles.rackspacecloud.com/images.tgz
|
wget -c http://c2477062.cdn.cloudfiles.rackspacecloud.com/images.tgz
|
||||||
tar -C $DIR -zxf images.tgz
|
tar -C $DIR -zxf images.tgz
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -115,8 +122,9 @@ function screen_it {
|
|||||||
|
|
||||||
if [ "$CMD" == "run" ]; then
|
if [ "$CMD" == "run" ]; then
|
||||||
killall dnsmasq
|
killall dnsmasq
|
||||||
#For IPv6
|
if [ -n "$USE_IPV6" ]; then
|
||||||
killall radvd
|
killall radvd
|
||||||
|
fi
|
||||||
screen -d -m -S nova -t nova
|
screen -d -m -S nova -t nova
|
||||||
sleep 1
|
sleep 1
|
||||||
if [ "$USE_MYSQL" == 1 ]; then
|
if [ "$USE_MYSQL" == 1 ]; then
|
||||||
@ -149,6 +157,8 @@ if [ "$CMD" == "run" ]; then
|
|||||||
cd $DIR
|
cd $DIR
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# create the database
|
||||||
|
$NOVA_DIR/bin/nova-manage db sync
|
||||||
# create an admin user called 'admin'
|
# create an admin user called 'admin'
|
||||||
$NOVA_DIR/bin/nova-manage user admin admin admin admin
|
$NOVA_DIR/bin/nova-manage user admin admin admin admin
|
||||||
# create a project called 'admin' with project manager of 'admin'
|
# create a project called 'admin' with project manager of 'admin'
|
||||||
@ -177,6 +187,7 @@ if [ "$CMD" == "run" ] || [ "$CMD" == "terminate" ]; then
|
|||||||
sleep 2
|
sleep 2
|
||||||
# delete volumes
|
# delete volumes
|
||||||
. $NOVA_DIR/novarc; euca-describe-volumes | grep vol- | cut -f2 | xargs -n1 euca-delete-volume
|
. $NOVA_DIR/novarc; euca-describe-volumes | grep vol- | cut -f2 | xargs -n1 euca-delete-volume
|
||||||
|
sleep 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$CMD" == "run" ] || [ "$CMD" == "clean" ]; then
|
if [ "$CMD" == "run" ] || [ "$CMD" == "clean" ]; then
|
||||||
@ -191,5 +202,4 @@ if [ "$CMD" == "scrub" ]; then
|
|||||||
else
|
else
|
||||||
virsh list | grep i- | awk '{print \$1}' | xargs -n1 virsh destroy
|
virsh list | grep i- | awk '{print \$1}' | xargs -n1 virsh destroy
|
||||||
fi
|
fi
|
||||||
vblade-persist ls | grep vol- | awk '{print \$1\" \"\$2}' | xargs -n2 vblade-persist destroy
|
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user