In Havana, Neutron has now a Metering Agent which gets meters from
virtual routers.
This patchs aims to allow devstack using this new service.
Change-Id: I17ad83799d60384247b98cc8a93ac032f641c721
Signed-off-by: Emilien Macchi <emilien.macchi@enovance.com>
| ... | ... |
@@ -139,6 +139,7 @@ following settings in your `localrc` : |
| 139 | 139 |
enable_service q-dhcp |
| 140 | 140 |
enable_service q-l3 |
| 141 | 141 |
enable_service q-meta |
| 142 |
+ enable_service q-metering |
|
| 142 | 143 |
enable_service neutron |
| 143 | 144 |
# Optional, to enable tempest configuration as part of devstack |
| 144 | 145 |
enable_service tempest |
| ... | ... |
@@ -202,6 +202,12 @@ source $TOP_DIR/lib/neutron_plugins/$Q_PLUGIN |
| 202 | 202 |
# Hardcoding for 1 service plugin for now |
| 203 | 203 |
source $TOP_DIR/lib/neutron_plugins/services/loadbalancer |
| 204 | 204 |
|
| 205 |
+# Agent metering service plugin functions |
|
| 206 |
+# ------------------------------------------- |
|
| 207 |
+ |
|
| 208 |
+# Hardcoding for 1 service plugin for now |
|
| 209 |
+source $TOP_DIR/lib/neutron_plugins/services/metering |
|
| 210 |
+ |
|
| 205 | 211 |
# VPN service plugin functions |
| 206 | 212 |
# ------------------------------------------- |
| 207 | 213 |
# Hardcoding for 1 service plugin for now |
| ... | ... |
@@ -231,6 +237,9 @@ function configure_neutron() {
|
| 231 | 231 |
if is_service_enabled q-lbaas; then |
| 232 | 232 |
_configure_neutron_lbaas |
| 233 | 233 |
fi |
| 234 |
+ if is_service_enabled q-metering; then |
|
| 235 |
+ _configure_neutron_metering |
|
| 236 |
+ fi |
|
| 234 | 237 |
if is_service_enabled q-vpn; then |
| 235 | 238 |
_configure_neutron_vpn |
| 236 | 239 |
fi |
| ... | ... |
@@ -451,6 +460,10 @@ function start_neutron_agents() {
|
| 451 | 451 |
if is_service_enabled q-lbaas; then |
| 452 | 452 |
screen_it q-lbaas "cd $NEUTRON_DIR && python $AGENT_LBAAS_BINARY --config-file $NEUTRON_CONF --config-file=$LBAAS_AGENT_CONF_FILENAME" |
| 453 | 453 |
fi |
| 454 |
+ |
|
| 455 |
+ if is_service_enabled q-metering; then |
|
| 456 |
+ screen_it q-metering "cd $NEUTRON_DIR && python $AGENT_METERING_BINARY --config-file $NEUTRON_CONF --config-file $METERING_AGENT_CONF_FILENAME" |
|
| 457 |
+ fi |
|
| 454 | 458 |
} |
| 455 | 459 |
|
| 456 | 460 |
# stop_neutron() - Stop running processes (non-screen) |
| ... | ... |
@@ -630,6 +643,11 @@ function _configure_neutron_lbaas() {
|
| 630 | 630 |
neutron_agent_lbaas_configure_agent |
| 631 | 631 |
} |
| 632 | 632 |
|
| 633 |
+function _configure_neutron_metering() {
|
|
| 634 |
+ neutron_agent_metering_configure_common |
|
| 635 |
+ neutron_agent_metering_configure_agent |
|
| 636 |
+} |
|
| 637 |
+ |
|
| 633 | 638 |
function _configure_neutron_fwaas() {
|
| 634 | 639 |
neutron_fwaas_configure_common |
| 635 | 640 |
neutron_fwaas_configure_driver |
| 636 | 641 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,30 @@ |
| 0 |
+# Neutron metering plugin |
|
| 1 |
+# --------------------------- |
|
| 2 |
+ |
|
| 3 |
+# Save trace setting |
|
| 4 |
+MY_XTRACE=$(set +o | grep xtrace) |
|
| 5 |
+set +o xtrace |
|
| 6 |
+ |
|
| 7 |
+ |
|
| 8 |
+AGENT_METERING_BINARY="$NEUTRON_BIN_DIR/neutron-metering-agent" |
|
| 9 |
+METERING_PLUGIN="neutron.services.metering.metering_plugin.MeteringPlugin" |
|
| 10 |
+ |
|
| 11 |
+function neutron_agent_metering_configure_common() {
|
|
| 12 |
+ if [[ $Q_SERVICE_PLUGIN_CLASSES == '' ]]; then |
|
| 13 |
+ Q_SERVICE_PLUGIN_CLASSES=$METERING_PLUGIN |
|
| 14 |
+ else |
|
| 15 |
+ Q_SERVICE_PLUGIN_CLASSES="$Q_SERVICE_PLUGIN_CLASSES,$METERING_PLUGIN" |
|
| 16 |
+ fi |
|
| 17 |
+} |
|
| 18 |
+ |
|
| 19 |
+function neutron_agent_metering_configure_agent() {
|
|
| 20 |
+ METERING_AGENT_CONF_PATH=/etc/neutron/services/metering |
|
| 21 |
+ mkdir -p $METERING_AGENT_CONF_PATH |
|
| 22 |
+ |
|
| 23 |
+ METERING_AGENT_CONF_FILENAME="$METERING_AGENT_CONF_PATH/metering_agent.ini" |
|
| 24 |
+ |
|
| 25 |
+ cp $NEUTRON_DIR/etc/metering_agent.ini $METERING_AGENT_CONF_FILENAME |
|
| 26 |
+} |
|
| 27 |
+ |
|
| 28 |
+# Restore xtrace |
|
| 29 |
+$MY_XTRACE |