fix ASTARA_MANAGEMENT_PREFIX and make subnet create dynamic

Change-Id: I0c93b525d008808c9717d508b2af950ed200d278
Closes-Bug: 1525417
This commit is contained in:
Mark McClain 2015-12-11 16:37:03 -05:00
parent afab50fe25
commit 7b5b8625b7
3 changed files with 11 additions and 6 deletions

View File

@ -21,7 +21,6 @@ from oslo_config import cfg
from oslo_log import log as logging
from oslo_serialization import jsonutils
ASTARA_ULA_PREFIX = 'fdca:3ba5:a17a:acda::/64'
ASTARA_MGT_SERVICE_PORT = 5000
ASTARA_BASE_PATH = '/v1/'

View File

@ -17,9 +17,9 @@
from datetime import datetime
import time
import netaddr
from novaclient import client
from novaclient import exceptions as novaclient_exceptions
from oslo_config import cfg
from oslo_log import log as logging
@ -376,7 +376,7 @@ debug:
- verbose: true
bootcmd:
- /usr/local/bin/%(boot_command)s %(mac_address)s %(ip_address)s/64
- /usr/local/bin/%(boot_command)s %(mac_address)s %(ip_address)s/%(prefix)d
users:
- name: astara
@ -405,10 +405,12 @@ def _ssh_key():
def format_userdata(mgt_port):
mgt_net = netaddr.IPNetwork(cfg.CONF.management_prefix)
ctxt = {
'ssh_public_key': _ssh_key(),
'mac_address': mgt_port.mac_address,
'ip_address': mgt_port.fixed_ips[0].ip_address,
'boot_command': cfg.CONF.astara_boot_command
'boot_command': cfg.CONF.astara_boot_command,
'prefix': mgt_net.prefixlen
}
return TEMPLATE % ctxt

View File

@ -32,7 +32,7 @@ ROUTER_INSTANCE_FLAVOR_DISK=${ROUTER_INSTANCE_FLAVOR_DISK:-5}
ROUTER_INSTANCE_FLAVOR_CPUS=${ROUTER_INSTANCE_FLAVOR_CPUS:-1}
PUBLIC_INTERFACE_DEFAULT='eth0'
ASTARA_MANAGEMENT_PREFIX=${ASTARA_MANGEMENT_PREFIX:-"fdca:3ba5:a17a:acda::/64"}
ASTARA_MANAGEMENT_PREFIX=${ASTARA_MANAGEMENT_PREFIX:-"fdca:3ba5:a17a:acda::/64"}
ASTARA_MANAGEMENT_PORT=${ASTARA_MANAGEMENT_PORT:-5000}
ASTARA_API_PORT=${ASTARA_API_PORT:-44250}
@ -213,7 +213,11 @@ function pre_start_astara() {
# Remove the ipv6 subnet created automatically before adding our own.
_remove_subnets mgt
typeset mgt_subnet_id=$(neutron $auth_args subnet-create mgt fdca:3ba5:a17a:acda::/64 --ip-version=6 --ipv6_address_mode=slaac --enable_dhcp | grep ' id ' | awk '{ print $4 }')
local subnet_create_args=""
if [[ "$ASTARA_MANAGEMENT_PREFIX" =~ ':' ]]; then
subnet_create_args="--ip-version=6 --ipv6_address_mode=slaac --enable_dhcp"
fi
typeset mgt_subnet_id=$(neutron $auth_args subnet-create mgt $ASTARA_MANAGEMENT_PREFIX $subnet_create_args | grep ' id ' | awk '{ print $4 }')
iniset $ASTARA_CONF DEFAULT management_subnet_id $mgt_subnet_id
# Remove the private network created by devstack