setup-compute-network.sh 2.33 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#!/bin/sh

##
## Setup a OpenStack compute node for Nova.
##

set -x

# Gotta know the rules!
if [ $EUID -ne 0 ] ; then
    echo "This script must be run as root" 1>&2
    exit 1
fi

# Grab our libs
. "`dirname $0`/setup-lib.sh"

if [ "$HOSTNAME" = "$CONTROLLER" -o "$HOSTNAME" = "$NETWORKMANAGER" ]; then
    exit 0;
fi

if [ -f $OURDIR/setup-compute-network-done ]; then
    exit 0
fi

26 27
logtstart "compute-network"

28 29 30 31
if [ -f $SETTINGS ]; then
    . $SETTINGS
fi

32
$DIRNAME/setup-network-plugin.sh
33

34 35 36 37
crudini --set /etc/nova/nova.conf DEFAULT \
    network_api_class nova.network.neutronv2.api.API
crudini --set /etc/nova/nova.conf DEFAULT \
    security_group_api neutron
38 39 40 41 42 43 44
if [ "${ML2PLUGIN}" = "openvswitch" ]; then
    crudini --set /etc/nova/nova.conf DEFAULT linuxnet_interface_driver \
	nova.network.linux_net.LinuxOVSInterfaceDriver
else
    crudini --set /etc/nova/nova.conf DEFAULT linuxnet_interface_driver \
	nova.network.linux_net.NeutronLinuxBridgeInterfaceDriver
fi
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
crudini --set /etc/nova/nova.conf DEFAULT \
    firewall_driver nova.virt.firewall.NoopFirewallDriver

crudini --set /etc/nova/nova.conf neutron \
    url http://$CONTROLLER:9696
crudini --set /etc/nova/nova.conf neutron \
    auth_strategy keystone
if [ $OSVERSION -le $OSKILO ]; then
    crudini --set /etc/nova/nova.conf neutron \
	admin_auth_url http://$CONTROLLER:35357/v2.0
    crudini --set /etc/nova/nova.conf neutron \
	admin_tenant_name service
    crudini --set /etc/nova/nova.conf neutron \
	admin_username neutron
    crudini --set /etc/nova/nova.conf neutron \
	admin_password ${NEUTRON_PASS}
else
    crudini --set /etc/nova/nova.conf neutron \
	auth_url http://$CONTROLLER:35357
64 65 66
    crudini --set /etc/nova/nova.conf neutron ${AUTH_TYPE_PARAM} password
    crudini --set /etc/nova/nova.conf neutron ${PROJECT_DOMAIN_PARAM} default
    crudini --set /etc/nova/nova.conf neutron ${USER_DOMAIN_PARAM} default
67 68 69 70
    crudini --set /etc/nova/nova.conf neutron region_name $REGION
    crudini --set /etc/nova/nova.conf neutron project_name service
    crudini --set /etc/nova/nova.conf neutron username neutron
    crudini --set /etc/nova/nova.conf neutron password ${NEUTRON_PASS}
71

72 73 74 75
    if [ $OSVERSION -ge $OSMITAKA ]; then
	crudini --set /etc/nova/nova.conf neutron \
	    memcached_servers ${CONTROLLER}:11211
    fi
76 77
fi

78 79
touch $OURDIR/setup-compute-network-done

80 81
logtend "compute-network"

82
exit 0