File: nova-common.config.in

package info (click to toggle)
nova 2%3A22.0.1-2%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 47,176 kB
  • sloc: python: 375,733; pascal: 1,781; sh: 1,142; makefile: 149; xml: 83; sql: 43
file content (89 lines) | stat: -rw-r--r-- 3,142 bytes parent folder | download
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/sh
set -e

. /usr/share/debconf/confmodule

NOVA_CONF=/etc/nova/nova.conf

#PKGOS-INCLUDE#

manage_nova_my_ip () {
	pkgos_inifile get ${NOVA_CONF} DEFAULT my_ip
	if [ -n "${RET}" ] && [ ! "${RET}" = "NOT_FOUND" ] ; then
		db_set nova/my-ip "${RET}"
	else
		DEFROUTE_IF=`awk '{ if ( $2 == "00000000" ) print $1 }' /proc/net/route | head -n 1`
		if [ -n "${DEFROUTE_IF}" ] ; then
			DEFROUTE_IP=$(LC_ALL=C ip addr show "${DEFROUTE_IF}" | grep inet | head -n 1 | awk '{print $2}' | cut -d/ -f1 | grep -E '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$' || true)
		fi
		if [ -z "${DEFROUTE_IP}" ] ; then
			HOSTNAME_IP=$(hostname -i)
			if [ -n "${HOSTNAME_IP}" ] ; then
				DEFROUTE_IP=${HOSTNAME_IP}
			fi
		fi
		if [ -n "${DEFROUTE_IP}" ] ; then
			db_set nova/my-ip ${DEFROUTE_IP}
		fi
	fi
	db_input high nova/my-ip || true
	db_go
}

read_placement_config () {
	# If we want to setup placement correctly, we need
	# to have keystone_auth url specified from user correctly.
	# If user didn't configure ksat via debconf, we will not configure
	# placement as well
	db_get nova/configure_ksat
	if  [ "${RET}" = "true" ] ; then
		db_input high nova/configure_placement || true
		db_go
		db_get nova/configure_placement
		if  [ "${RET}" = "true" ] ; then
			pkgos_read_config -p high ${NOVA_CONF} placement project_name nova/placement_admin_tenant_name
			pkgos_read_config -p high ${NOVA_CONF} placement region_name nova/placement_os_region_name
			pkgos_read_config -p high ${NOVA_CONF} placement username nova/placement_admin_username
			pkgos_read_config -p high ${NOVA_CONF} placement password nova/placement_admin_password
		fi
	fi
}

read_neutron_config () {
	# If we want to setup neutron correctly, we need
	# to have keystone_auth url specified from user correctly.
	# If user didn't configure ksat via debconf, we will not configure
	# neutron as well
	db_get nova/configure_ksat
	if  [ "${RET}" = "true" ] ; then
		db_input high nova/configure_neutron || true
		db_go
		db_get nova/configure_neutron
		if  [ "${RET}" = "true" ] ; then
			# Keystone auth credential to talk to Neutron
			pkgos_read_config -p high ${NOVA_CONF} neutron endpoint_override nova/neutron_url
			pkgos_read_config -p medium ${NOVA_CONF} neutron project_name nova/neutron_admin_tenant_name
			pkgos_read_config -p medium ${NOVA_CONF} neutron username nova/neutron_admin_username
			pkgos_read_config -p high ${NOVA_CONF} neutron password nova/neutron_admin_password

			# The metadata_proxy_shared_secret
			pkgos_read_config -p high ${NOVA_CONF} neutron metadata_proxy_shared_secret nova/metadata_secret
		fi
	fi
}

pkgos_var_user_group nova /bin/sh
pkgos_dbc_read_conf -pkg nova-common ${NOVA_CONF} database connection nova $@
pkgos_rabbit_read_conf ${NOVA_CONF} oslo_messaging_rabbit nova
pkgos_read_admin_creds ${NOVA_CONF} keystone_authtoken nova
read_neutron_config
read_placement_config

manage_nova_my_ip

# Cinder os_region_name config
pkgos_read_config -p high ${NOVA_CONF} cinder os_region_name nova/cinder_os_region_name
# Glance api_servers config
pkgos_read_config -p high ${NOVA_CONF} glance api_servers nova/glance_api_servers

exit 0