default to kvm, but revert to qemu

This commit is contained in:
Jesse Andrews 2011-09-16 16:28:13 -07:00
parent 9b01ffb05e
commit d1879c5cfb

View file

@ -87,8 +87,9 @@ EC2_DMZ_HOST=${EC2_DMZ_HOST:-$HOST_IP}
# ip or you risk breaking things. # ip or you risk breaking things.
# FLAT_INTERFACE=eth0 # FLAT_INTERFACE=eth0
# Nova hypervisor configuration # Nova hypervisor configuration. We default to **kvm** but will drop back to
LIBVIRT_TYPE=${LIBVIRT_TYPE:-qemu} # **qemu** if we are unable to load the kvm module.
LIBVIRT_TYPE=${LIBVIRT_TYPE:-kvm}
# Mysql connection info # Mysql connection info
MYSQL_USER=${MYSQL_USER:-root} MYSQL_USER=${MYSQL_USER:-root}
@ -156,6 +157,11 @@ git_clone https://github.com/cloudbuilders/openstack-munin.git $MUNIN_DIR
# Initialization # Initialization
# ============== # ==============
# create a new named screen to store things in
screen -d -m -S nova -t nova
sleep 1
# setup our checkouts so they are installed into python path # setup our checkouts so they are installed into python path
# allowing ``import nova`` or ``import glance.client`` # allowing ``import nova`` or ``import glance.client``
cd $NOVA_DIR; sudo python setup.py develop cd $NOVA_DIR; sudo python setup.py develop
@ -282,53 +288,21 @@ fi
# Nova # Nova
# ---- # ----
function add_nova_flag {
echo "$1" >> $NOVA_DIR/bin/nova.conf
}
# (re)create nova.conf
rm -f $NOVA_DIR/bin/nova.conf
add_nova_flag "--verbose"
add_nova_flag "--nodaemon"
add_nova_flag "--dhcpbridge_flagfile=$NOVA_DIR/bin/nova.conf"
add_nova_flag "--network_manager=nova.network.manager.$NET_MAN"
add_nova_flag "--my_ip=$HOST_IP"
add_nova_flag "--public_interface=$INTERFACE"
add_nova_flag "--vlan_interface=$INTERFACE"
add_nova_flag "--sql_connection=$BASE_SQL_CONN/nova"
add_nova_flag "--libvirt_type=$LIBVIRT_TYPE"
add_nova_flag "--osapi_extensions_path=$API_DIR/extensions"
add_nova_flag "--vncproxy_url=http://$HOST_IP:6080"
add_nova_flag "--vncproxy_wwwroot=$NOVNC_DIR/"
add_nova_flag "--api_paste_config=$KEYSTONE_DIR/examples/paste/nova-api-paste.ini"
add_nova_flag "--image_service=nova.image.glance.GlanceImageService"
add_nova_flag "--ec2_dmz_host=$EC2_DMZ_HOST"
add_nova_flag "--rabbit_host=$RABBIT_HOST"
add_nova_flag "--glance_api_servers=$GLANCE_HOSTPORT"
if [ -n "$FLAT_INTERFACE" ]; then
add_nova_flag "--flat_interface=$FLAT_INTERFACE"
fi
if [ -n "$MULTI_HOST" ]; then
add_nova_flag "--multi_host=$MULTI_HOST"
fi
# create a new named screen to store things in
screen -d -m -S nova -t nova
sleep 1
if [[ "$ENABLED_SERVICES" =~ "n-cpu" ]]; then if [[ "$ENABLED_SERVICES" =~ "n-cpu" ]]; then
# attempt to load modules: kvm (hardware virt) and nbd (network block # attempt to load modules: nbd (network block device - used to manage
# device - used to manage qcow images) # qcow images) and kvm (hardware based virtualization). If unable to
# load kvm, set the libvirt type to qemu.
sudo modprobe nbd || true sudo modprobe nbd || true
sudo modprobe kvm || true if ! sudo modprobe kvm; then
LIBVIRT_TYPE=qemu
fi
# User needs to be member of libvirtd group for nova-compute to use libvirt. # User needs to be member of libvirtd group for nova-compute to use libvirt.
sudo usermod -a -G libvirtd `whoami` sudo usermod -a -G libvirtd `whoami`
# if kvm wasn't running before we need to restart libvirt to enable it # if kvm wasn't running before we need to restart libvirt to enable it
sudo /etc/init.d/libvirt-bin restart sudo /etc/init.d/libvirt-bin restart
## FIXME(ja): should LIBVIRT_TYPE be kvm if kvm module is loaded?
# setup nova instance directory # setup nova instance directory
mkdir -p $NOVA_DIR/instances mkdir -p $NOVA_DIR/instances
@ -364,6 +338,36 @@ if [[ "$ENABLED_SERVICES" =~ "mysql" ]]; then
$NOVA_DIR/bin/nova-manage floating create $FLOATING_RANGE $NOVA_DIR/bin/nova-manage floating create $FLOATING_RANGE
fi fi
function add_nova_flag {
echo "$1" >> $NOVA_DIR/bin/nova.conf
}
# (re)create nova.conf
rm -f $NOVA_DIR/bin/nova.conf
add_nova_flag "--verbose"
add_nova_flag "--nodaemon"
add_nova_flag "--dhcpbridge_flagfile=$NOVA_DIR/bin/nova.conf"
add_nova_flag "--network_manager=nova.network.manager.$NET_MAN"
add_nova_flag "--my_ip=$HOST_IP"
add_nova_flag "--public_interface=$INTERFACE"
add_nova_flag "--vlan_interface=$INTERFACE"
add_nova_flag "--sql_connection=$BASE_SQL_CONN/nova"
add_nova_flag "--libvirt_type=$LIBVIRT_TYPE"
add_nova_flag "--osapi_extensions_path=$API_DIR/extensions"
add_nova_flag "--vncproxy_url=http://$HOST_IP:6080"
add_nova_flag "--vncproxy_wwwroot=$NOVNC_DIR/"
add_nova_flag "--api_paste_config=$KEYSTONE_DIR/examples/paste/nova-api-paste.ini"
add_nova_flag "--image_service=nova.image.glance.GlanceImageService"
add_nova_flag "--ec2_dmz_host=$EC2_DMZ_HOST"
add_nova_flag "--rabbit_host=$RABBIT_HOST"
add_nova_flag "--glance_api_servers=$GLANCE_HOSTPORT"
if [ -n "$FLAT_INTERFACE" ]; then
add_nova_flag "--flat_interface=$FLAT_INTERFACE"
fi
if [ -n "$MULTI_HOST" ]; then
add_nova_flag "--multi_host=$MULTI_HOST"
fi
# Keystone # Keystone
# -------- # --------