Debian7搭建OpenStack的一些问题

除了某种原因pip以及一些python包十分难Download外,github上提供的devstack安装方法在debian_7_x86_64环境上,还有一些未知或者已知因素的问题

1:错误信息:

 '[' deb = deb ']'
+ sudo service tgt restart
tgt: unrecognized service
+ exit_trap
+ local r=1
++ jobs -p
+ jobs=13601
+ [[ -n 13601 ]]
+ [[ -n '' ]]
+ kill_spinner
+ '[' '!' -z '' ']'
+ [[ 1 -ne 0 ]]
+ echo 'Error on exit'
Error on exit
+ [[ -z /opt/stack/logs ]]
+ /home/stack/devstack/tools/worlddump.py -d /opt/stack/logs
World dumping... see /opt/stack/logs/worlddump-2015-06-07-152812.txt for details
+ exit 1

在debian上很奇怪,tgt并没有添加到service当中,但是有安装,路径为/usr/sbin/tgtd,而安装过程中源代码为

vim lib/cinder
148             if is_ubuntu; then
149                 sudo service tgt restart
150             else
151                 restart_service tgtd
152             fi

这里就手动将is_ubuntu的分支修改为:

sudo /usr/sbin/tgtd

2:错误信息:

++ get_field 2
++ local data field
++ read data
Unable to create the network. No tenant network is available for allocation.
+ NET_ID=
+ die_if_not_set 559 NET_ID 'Failure creating NET_ID for private 67a104f879144c11bb4edeb35952b264'
+ local exitcode=0
++ set +o
++ grep xtrace
+ local 'xtrace=set -o xtrace'
+ set +o xtrace
[Call Trace]
./stack.sh:1235:create_neutron_initial_network
/home/stack/devstack/lib/neutron-legacy:559:die_if_not_set
/home/stack/devstack/functions-common:114:die
[ERROR] /home/stack/devstack/functions-common:559 Failure creating NET_ID for private 67a104f879144c11bb4edeb35952b264
Error on exit

查看了下源码,报错的地方:

1232 # Once neutron agents are started setup initial network elements
1233 if is_service_enabled q-svc && [[ "$NEUTRON_CREATE_INITIAL_NETWORKS" == "True" ]]; then
                               1234     echo_summary "Creating initial neutron network elements"

~                              1235     create_neutron_initial_network

~                              1236     setup_neutron_debug

~                              1237 fi

错误位置559行:
   _neutron_setup_interface_d  555         sudo ip link set br-int up

    _neutron_setup_keystone     556         sudo ip link set $PUBLIC_INTERFACE up

    _neutron_setup_rootwrap     557     else

    _neutron_third_party_do     558         NET_ID=$(neutron net-create --tenant-id $TENANT_ID "$PRIVATE_NETWORK_NAME" | grep ' id ' | get_field 2)

    _ssh_check_neutron          559         die_if_not_set $LINENO NET_ID "Failure creating NET_ID for $PRIVATE_NETWORK_NAME $TENANT_ID"

    check_neutron_third_party_  560

    cleanup_neutron             561         if [[ "$IP_VERSION" =~ 4.* ]]; then

    configure_neutron           562             # Create IPv4 private subnet

    configure_neutron_third_pa  563             SUBNET_ID=$(_neutron_create_private_subnet_v4)

    create_neutron_accounts     564         fi

    create_neutron_cache_dir    565
    create_neutron_initial_net  566         if [[ "$IP_VERSION" =~ .*6 ]]; then

这里看起来十分复杂,重新执行了下./stack.sh之后,这里又没有抱错了

 

3:错误信息:

++ grep router_gateway
+ ROUTER_GW_IP=172.24.4.2
+ die_if_not_set 1271 ROUTER_GW_IP 'Failure retrieving ROUTER_GW_IP'
+ local exitcode=0
++ set +o
++ grep xtrace
+ local 'xtrace=set -o xtrace'
+ set +o xtrace
+ sudo route add -net 10.0.0.0/24 gw 172.24.4.2
SIOCADDRT: File exists
+ exit_trap
+ local r=7
++ jobs -p
+ jobs=1385
+ [[ -n 1385 ]]
+ [[ -n '' ]]
+ kill_spinner
+ '[' '!' -z '' ']'
+ [[ 7 -ne 0 ]]
+ echo 'Error on exit'
Error on exit
+ [[ -z /opt/stack/logs ]]
+ /home/stack/devstack/tools/worlddump.py -d /opt/stack/logs
World dumping... see /opt/stack/logs/worlddump-2015-06-07-163646.txt for details

原因:route的位置为:/sbin/route,而不再系统环境变量path中

stack@commonqa-lihui:~/devstack$ export PATH=$PATH:/sbin
stack@commonqa-lihui:~/devstack$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin

除此之外,还有一个Error on exit的错误退出,错误代码在:

446 trap exit_trap EXIT
    err_trap                    447 function exit_trap {
    exit_trap                   448     local r=$?
    kill_spinner                449     jobs=$(jobs -p)
    read_password               450     # Only do the kill when we're logging through a process substitution,
    spinner                     451     # which currently is only to verbose logfile
                                452     if [[ -n $jobs && -n "$LOGFILE" && "$VERBOSE" == "True" ]]; then
~                               453         echo "exit_trap: cleaning up child processes"
~                               454         kill 2>&1 $jobs
~                               455     fi
~                               456
~                               457     # Kill the last spinner process
~                               458     kill_spinner
~                               459
~                               460     if [[ $r -ne 0 ]]; then
~                               461         echo "Error on exit"
~                               462         if [[ -z $LOGDIR ]]; then
~                               463             $TOP_DIR/tools/worlddump.py
~                               464         else
~                               465             $TOP_DIR/tools/worlddump.py -d $LOGDIR
~                               466         fi
~                               467     fi
~                               468
~                               469     exit $r
~                               470 }

原因$?是上一次的命令,而重新执行脚本的时候,route是存在的,因此route add的$r不为0,导致异常退出

需要手动执行:

root@commonqa-lihui:~# sudo route del -net 10.0.0.0 netmask 255.255.255.0 gw 172.24.4.2 dev br-ex

4:错误信息

++ [[ False == \T\r\u\e ]]
++ sudo ovs-vsctl set Bridge br-ex other_config:disable-in-band=true
++ echo br-ex
+ local ext_gw_interface=br-ex
+ local ipv6_cidr_len=64
+ sudo ip -6 addr add 2001:db8::2/64 dev br-ex
RTNETLINK answers: File exists
+ exit_trap
+ local r=2
++ jobs -p
+ jobs=17810
+ [[ -n 17810 ]]
+ [[ -n '' ]]
+ kill_spinner
+ '[' '!' -z '' ']'
+ [[ 2 -ne 0 ]]
+ echo 'Error on exit'
Error on exit
+ [[ -z /opt/stack/logs ]]
+ /home/stack/devstack/tools/worlddump.py -d /opt/stack/logs
World dumping... see /opt/stack/logs/worlddump-2015-06-08-020913.txt for details

报错的代码位置:

1278 # Configure neutron router for IPv6 public access
neutron-legacy (/home/stack/de 1279 function _neutron_configure_router_v6 {

  function                     1280     neutron router-interface-add $ROUTER_ID $IPV6_SUBNET_ID

    _configure_dvr             1281     # Create a public subnet on the external network
    _configure_neutron_ceilome 1282     local ipv6_id_and_ext_gw_ip=$(_neutron_create_public_subnet_v6 $EXT_NET_ID)

    _configure_neutron_common  1283     local ipv6_ext_gw_ip=$(echo $ipv6_id_and_ext_gw_ip | get_field 2)

    _configure_neutron_debug_c 1284     local ipv6_pub_subnet_id=$(echo $ipv6_id_and_ext_gw_ip | get_field 5)

    _configure_neutron_dhcp_ag 1285

    _configure_neutron_fwaas   1286     # If the external network has not already been set as the default router

    _configure_neutron_l3_agen 1287     # gateway when configuring an IPv4 public subnet, do so now

    _configure_neutron_lbaas   1288     if [[ "$IP_VERSION" == "6" ]]; then

    _configure_neutron_metadat 1289         neutron router-gateway-set $ROUTER_ID $EXT_NET_ID

    _configure_neutron_meterin 1290     fi

    _configure_neutron_plugin_ 1291

    _configure_neutron_service 1292     # This logic is specific to using the l3-agent for layer 3

    _configure_neutron_vpn     1293     if is_service_enabled q-l3; then

    _create_neutron_conf_dir   1294         # Ensure IPv6 forwarding is enabled on the host

    _determine_config_l3       1295         sudo sysctl -w net.ipv6.conf.all.forwarding=1

    _determine_config_server   1296         # Configure and enable public bridge

    _determine_config_vpn      1297         # Override global IPV6_ROUTER_GW_IP with the true value from neutron

    _get_net_id                1298         IPV6_ROUTER_GW_IP=`neutron port-list -c fixed_ips | grep $ipv6_pub_subnet_id | awk -F '"' -v subnet_id=$i
pv6_pub_subnet_id '$4 =
    _get_probe_cmd_prefix           = subnet_id { print $8; }'`

    _move_neutron_addresses_ro 1299         die_if_not_set $LINENO IPV6_ROUTER_GW_IP "Failure retrieving IPV6_ROUTER_GW_IP"

    _neutron_configure_router_ 1300

    _neutron_configure_router_ 1301         if is_neutron_ovs_base_plugin && [[ "$Q_USE_NAMESPACE" = "True" ]]; then

    _neutron_create_private_su 1302             local ext_gw_interface=$(_neutron_get_ext_gw_interface)

    _neutron_create_private_su 1303             local ipv6_cidr_len=${IPV6_PUBLIC_RANGE#*/}

    _neutron_create_public_sub 1304

    _neutron_create_public_sub 1305             # Configure interface for public bridge

    _neutron_deploy_rootwrap_f 1306             sudo ip -6 addr add $ipv6_ext_gw_ip/$ipv6_cidr_len dev $ext_gw_interface

    _neutron_get_ext_gw_interf 1307             sudo ip -6 route add $FIXED_RANGE_V6 via $IPV6_ROUTER_GW_IP dev $ext_gw_interface

    _neutron_service_plugin_cl 1308         fi

    _neutron_set_router_id     1309         _neutron_set_router_id

    _neutron_setup_interface_d 1310     fi

    _neutron_setup_keystone    1311 }

原因是执行命令报的错:

stack@commonqa-lihui:~/devstack$ sudo ip -6 addr add 2001:db8::2/64 dev br-ex
RTNETLINK answers: File exists

需要手动删除:

stack@commonqa-lihui:~$ sudo ip -6 addr del 2001:db8::2/64 dev br-ex

删除后,ifconfig里就会少了这行:

inet6 addr: 2001:db8::2/64 Scope:Global

 

基本碰到的问题就是这些了,除此之外,一些主要模块nova等,如果git速度慢,可以换个环境git clone,然后再传到安装的机器上,位置为:

/opt/stack/

基本就能正常安装了

发表评论