5 N_CONF=/etc/neutron/neutron.conf
6 OVS_CONF=/etc/neutron/plugins/ml2/openvswitch_agent.ini
10 neutron_core_plugin_class () {
12 "OpenVSwitch"|"ml2"|"LinuxBridge"|"neutron.plugins.ml2.plugin.Ml2Plugin")
13 NEUTRON_PLUGIN_CLASS=ml2
15 "networking_plumgrid.neutron.plugins.plugin:NeutronPluginPLUMgridV2"|"plumgrid")
16 NEUTRON_PLUGIN_NAME=plumgrid
18 "midonet.neutron.plugin_v1:MidonetPluginV2"|"midonet")
19 NEUTRON_PLUGIN_NAME=midonet
21 "midonet.neutron.plugin_v2:MidonetPluginV2"|"midonet_v2")
22 NEUTRON_PLUGIN_NAME=midonet_v2
24 "networking_nec.nwa.l2.plugin:NECNWAL2Plugin"|"necnwa")
25 NEUTRON_PLUGIN_NAME=nec
27 "vmware_nsx.plugin:NsxMhPlugin"|"vmware")
28 NEUTRON_PLUGIN_NAME=vmware
31 NEUTRON_PLUGIN_CLASS=""
36 write_nova_admin_credentials () {
37 db_get neutron/nova_url
38 pkgos_inifile set ${N_CONF} nova url ${RET}
40 db_get neutron/nova_region
41 pkgos_inifile set ${N_CONF} nova region_name ${RET}
43 db_get neutron/nova_admin_tenant_name
44 NOVA_TENANT_NAME_IN_NEUTRON=${RET}
45 pkgos_inifile set ${N_CONF} nova tenant_name ${RET}
46 pkgos_inifile set ${N_CONF} nova project_name ${RET}
48 db_get neutron/nova_admin_username
49 pkgos_inifile set ${N_CONF} nova username ${RET}
51 db_get neutron/nova_admin_password
52 pkgos_inifile set ${N_CONF} nova password ${RET}
55 if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ] ; then
56 . /usr/share/debconf/confmodule
58 pkgos_var_user_group neutron
59 chmod 755 /var/lib/neutron
61 pkgos_write_new_conf neutron api-paste.ini
62 pkgos_write_new_conf neutron neutron.conf
63 chmod 0660 /etc/neutron/neutron.conf
65 # Sets the core_plugin directive according to the value in debconf
66 db_get neutron/plugin-select
68 if [ -n "${RET}" ] ; then
69 neutron_core_plugin_class ${NEUTRON_plugin}
70 if [ -n "${NEUTRON_PLUGIN_CLASS}" ] ; then
71 pkgos_inifile set ${N_CONF} DEFAULT core_plugin ${NEUTRON_PLUGIN_CLASS}
75 # Write the neutron RabbitMQ credentials
76 pkgos_rabbit_write_conf ${N_CONF} oslo_messaging_rabbit neutron
78 # Set the keystone_authtoken directive
79 pkgos_write_admin_creds ${N_CONF} keystone_authtoken neutron
81 # Set the sql_connection directive
82 pkgos_dbc_postinst --suite neutron ${N_CONF} database connection neutron $@
84 db_get neutron/configure_db
85 if [ "$RET" = "true" ] ; then
86 # Migrating to latest release of the db
87 neutron-db-manage --config-file /etc/neutron/neutron.conf upgrade head
90 # Maintain the OVS config
91 if [ ! -e ${OVS_CONF} ] ; then
92 install -D -m 0640 -o neutron -g neutron /usr/share/neutron-common/openvswitch_agent.ini ${OVS_CONF}
95 if [ "${NEUTRON_plugin_path}" = "OpenVSwitch" ] ; then
96 db_get neutron/tenant_network_type
97 pkgos_inifile set ${OVS_CONF} OVS tenant_network_type "${RET}"
99 db_get neutron/enable_tunneling
100 pkgos_inifile set ${OVS_CONF} OVS enable_tunneling "${RET}"
102 db_get neutron/tunnel_id_ranges
103 pkgos_inifile set ${OVS_CONF} OVS tunnel_id_ranges "${RET}"
105 db_get neutron/local_ip
106 pkgos_inifile set ${OVS_CONF} OVS local_ip "${RET}"
109 write_nova_admin_credentials
112 chown -R neutron:adm /var/log/neutron/
113 chmod 0700 /etc/neutron
114 chmod 0750 /var/log/neutron/
115 chown root:root /etc/neutron/rootwrap.conf
116 chown root:root /etc/neutron/rootwrap.d
117 chmod 0755 /etc/neutron/rootwrap.d
119 # The /var/lib/neutron/dhcp needs to be readable from the nobody user.
120 chmod 755 /var/lib/neutron
121 mkdir -p /var/lib/neutron/dhcp
122 chown neutron:neutron /var/lib/neutron/dhcp
123 chmod 755 /var/lib/neutron/dhcp
125 if [ -f /etc/sudoers.d/neutron_sudoers ] ; then
126 chmod 0440 /etc/sudoers.d/neutron_sudoers