Add neutron metering role into kolla-ansible

Refer to neutron docs [1][2]
[1]: https://docs.openstack.org/neutron/pike/admin/archives/adv-config.html#l3-metering-service-driver
[2]: https://wiki.openstack.org/wiki/Neutron/Metering/Bandwidth
Co-Authored-By: ZhijunWei <wzj334965317@outlook.com>

Change-Id: I4a676d041bc2a86497cb139d9347365738b156df
This commit is contained in:
caoyuan 2017-04-15 19:51:16 +08:00
parent 7598edca5b
commit a5badc89f2
12 changed files with 119 additions and 0 deletions

View File

@ -517,6 +517,7 @@ enable_neutron_bgp_dragent: "no"
enable_neutron_provider_networks: "no" enable_neutron_provider_networks: "no"
enable_neutron_segments: "no" enable_neutron_segments: "no"
enable_neutron_sfc: "no" enable_neutron_sfc: "no"
enable_neutron_metering: "no"
enable_neutron_infoblox_ipam_agent: "no" enable_neutron_infoblox_ipam_agent: "no"
enable_nova_serialconsole_proxy: "no" enable_nova_serialconsole_proxy: "no"
enable_nova_ssh: "yes" enable_nova_ssh: "yes"

View File

@ -306,6 +306,9 @@ neutron
[neutron-infoblox-ipam-agent:children] [neutron-infoblox-ipam-agent:children]
neutron neutron
[neutron-metering-agent:children]
neutron
[ironic-neutron-agent:children] [ironic-neutron-agent:children]
neutron neutron

View File

@ -325,6 +325,9 @@ neutron
[neutron-infoblox-ipam-agent:children] [neutron-infoblox-ipam-agent:children]
neutron neutron
[neutron-metering-agent:children]
neutron
[ironic-neutron-agent:children] [ironic-neutron-agent:children]
neutron neutron

View File

@ -193,6 +193,19 @@ neutron_services:
- "/run:/run:shared" - "/run:/run:shared"
- "kolla_logs:/var/log/kolla/" - "kolla_logs:/var/log/kolla/"
dimensions: "{{ neutron_infoblox_ipam_agent_dimensions }}" dimensions: "{{ neutron_infoblox_ipam_agent_dimensions }}"
neutron-metering-agent:
container_name: "neutron_metering_agent"
image: "{{ neutron_metering_agent_image_full }}"
privileged: True
enabled: "{{ enable_neutron_metering | bool }}"
group: "neutron-metering-agent"
host_in_groups: "{{ inventory_hostname in groups['neutron-metering-agent'] }}"
volumes:
- "{{ node_config_directory }}/neutron-metering-agent/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "/run:/run:shared"
- "kolla_logs:/var/log/kolla/"
dimensions: "{{ neutron_metering_agent_dimensions }}"
ironic-neutron-agent: ironic-neutron-agent:
container_name: "ironic_neutron_agent" container_name: "ironic_neutron_agent"
image: "{{ ironic_neutron_agent_image_full }}" image: "{{ ironic_neutron_agent_image_full }}"
@ -260,6 +273,10 @@ neutron_infoblox_ipam_agent_image: "{{ docker_registry ~ '/' if docker_registry
neutron_infoblox_ipam_agent_tag: "{{ neutron_tag }}" neutron_infoblox_ipam_agent_tag: "{{ neutron_tag }}"
neutron_infoblox_ipam_agent_image_full: "{{ neutron_infoblox_ipam_agent_image }}:{{ neutron_infoblox_ipam_agent_tag }}" neutron_infoblox_ipam_agent_image_full: "{{ neutron_infoblox_ipam_agent_image }}:{{ neutron_infoblox_ipam_agent_tag }}"
neutron_metering_agent_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ neutron_install_type }}-neutron-metering-agent"
neutron_metering_agent_tag: "{{ neutron_tag }}"
neutron_metering_agent_image_full: "{{ neutron_metering_agent_image }}:{{ neutron_metering_agent_tag }}"
ironic_neutron_agent_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ neutron_install_type }}-ironic-neutron-agent" ironic_neutron_agent_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ neutron_install_type }}-ironic-neutron-agent"
ironic_neutron_agent_tag: "{{ neutron_tag }}" ironic_neutron_agent_tag: "{{ neutron_tag }}"
ironic_neutron_agent_image_full: "{{ ironic_neutron_agent_image }}:{{ ironic_neutron_agent_tag }}" ironic_neutron_agent_image_full: "{{ ironic_neutron_agent_image }}:{{ ironic_neutron_agent_tag }}"
@ -275,6 +292,7 @@ neutron_server_dimensions: "{{ default_container_dimensions }}"
neutron_bgp_dragent_dimensions: "{{ default_container_dimensions }}" neutron_bgp_dragent_dimensions: "{{ default_container_dimensions }}"
neutron_infoblox_ipam_agent_dimensions: "{{ default_container_dimensions }}" neutron_infoblox_ipam_agent_dimensions: "{{ default_container_dimensions }}"
neutron_openvswitch_agent_xenapi_dimensions: "{{ default_container_dimensions }}" neutron_openvswitch_agent_xenapi_dimensions: "{{ default_container_dimensions }}"
neutron_metering_agent_dimensions: "{{ default_container_dimensions }}"
ironic_neutron_agent_dimensions: "{{ default_container_dimensions }}" ironic_neutron_agent_dimensions: "{{ default_container_dimensions }}"
@ -332,6 +350,8 @@ service_plugins:
enabled: "{{ enable_neutron_lbaas | bool and not enable_octavia | bool }}" enabled: "{{ enable_neutron_lbaas | bool and not enable_octavia | bool }}"
- name: "lbaasv2-proxy" - name: "lbaasv2-proxy"
enabled: "{{ enable_neutron_lbaas | bool and enable_octavia | bool }}" enabled: "{{ enable_neutron_lbaas | bool and enable_octavia | bool }}"
- name: "metering"
enabled: "{{ enable_neutron_metering | bool }}"
- name: "neutron_dynamic_routing.services.bgp.bgp_plugin.BgpPlugin" - name: "neutron_dynamic_routing.services.bgp.bgp_plugin.BgpPlugin"
enabled: "{{ enable_neutron_bgp_dragent | bool }}" enabled: "{{ enable_neutron_bgp_dragent | bool }}"
- name: "qos" - name: "qos"

View File

@ -344,6 +344,31 @@
or neutron_ml2_conf | changed or neutron_ml2_conf | changed
or neutron_infoblox_ipam_agent_container | changed or neutron_infoblox_ipam_agent_container | changed
- name: Restart neutron-metering-agent container
vars:
service_name: "neutron-metering-agent"
service: "{{ neutron_services[service_name] }}"
config_json: "{{ neutron_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
neutron_conf: "{{ neutron_confs.results|selectattr('item.key', 'equalto', service_name)|first }}"
neutron_metering_agent_container: "{{ check_neutron_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
become: true
kolla_docker:
action: "recreate_or_restart_container"
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
volumes: "{{ service.volumes }}"
dimensions: "{{ service.dimensions }}"
privileged: "{{ service.privileged | default(False) }}"
when:
- kolla_action != "config"
- service.enabled | bool
- service.host_in_groups | bool
- config_json | changed
or neutron_conf | changed
or neutron_metering_agent_ini | changed
or neutron_metering_agent_container | changed
- name: Restart ironic-neutron-agent container - name: Restart ironic-neutron-agent container
vars: vars:
service_name: "ironic-neutron-agent" service_name: "ironic-neutron-agent"

View File

@ -55,6 +55,7 @@
- "neutron-l3-agent" - "neutron-l3-agent"
- "neutron-linuxbridge-agent" - "neutron-linuxbridge-agent"
- "neutron-metadata-agent" - "neutron-metadata-agent"
- "neutron-metering-agent"
- "neutron-openvswitch-agent" - "neutron-openvswitch-agent"
- "neutron-openvswitch-agent-xenapi" - "neutron-openvswitch-agent-xenapi"
- "neutron-server" - "neutron-server"
@ -306,6 +307,24 @@
notify: notify:
- "Restart {{ service_name }} container" - "Restart {{ service_name }} container"
- name: Copying over metering_agent.ini
become: true
vars:
service_name: "neutron-metering-agent"
neutron_metering_agent: "{{ neutron_services[service_name] }}"
merge_configs:
sources:
- "{{ role_path }}/templates/metering_agent.ini.j2"
- "{{ node_custom_config }}/neutron/metering_agent.ini"
dest: "{{ node_config_directory }}/{{ service_name }}/metering_agent.ini"
mode: "0660"
register: neutron_metering_agent_ini
when:
- neutron_metering_agent.enabled | bool
- neutron_metering_agent.host_in_groups | bool
notify:
- "Restart {{ service_name }} container"
- name: Copying over ironic_neutron_agent.ini - name: Copying over ironic_neutron_agent.ini
become: true become: true
vars: vars:
@ -373,6 +392,7 @@
- "neutron-l3-agent" - "neutron-l3-agent"
- "neutron-linuxbridge-agent" - "neutron-linuxbridge-agent"
- "neutron-metadata-agent" - "neutron-metadata-agent"
- "neutron-metering-agent"
- "neutron-openvswitch-agent" - "neutron-openvswitch-agent"
- "neutron-openvswitch-agent-xenapi" - "neutron-openvswitch-agent-xenapi"
- "neutron-server" - "neutron-server"

View File

@ -0,0 +1,3 @@
[DEFAULT]
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
driver = neutron.services.metering.drivers.iptables.iptables_driver.IptablesMeteringDriver

View File

@ -0,0 +1,36 @@
{
"command": "neutron-metering-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/metering_agent.ini",
"config_files": [
{
"source": "{{ container_config_directory }}/neutron.conf",
"dest": "/etc/neutron/neutron.conf",
"owner": "neutron",
"perm": "0600"
},
{
"source": "{{ container_config_directory }}/metering_agent.ini",
"dest": "/etc/neutron/metering_agent.ini",
"owner": "neutron",
"perm": "0600"
},
{
"source": "{{ container_config_directory }}/policy.json",
"dest": "/etc/neutron/policy.json",
"owner": "neutron",
"perm": "0600",
"optional": true
}
],
"permissions": [
{
"path": "/var/log/kolla/neutron",
"owner": "neutron:neutron",
"recurse": true
},
{
"path": "/var/lib/neutron/kolla",
"owner": "neutron:neutron",
"recurse": true
}
]
}

View File

@ -654,6 +654,7 @@
- neutron-lbaas-agent - neutron-lbaas-agent
- ironic-neutron-agent - ironic-neutron-agent
- neutron-metadata-agent - neutron-metadata-agent
- neutron-metering-agent
- compute - compute
- manila-share - manila-share
serial: '{{ kolla_serial|default("0") }}' serial: '{{ kolla_serial|default("0") }}'

View File

@ -255,6 +255,7 @@ kolla_internal_vip_address: "10.10.10.254"
#enable_neutron_vpnaas: "no" #enable_neutron_vpnaas: "no"
#enable_neutron_sriov: "no" #enable_neutron_sriov: "no"
#enable_neutron_sfc: "no" #enable_neutron_sfc: "no"
#enable_neutron_metering: "no"
#enable_nova_fake: "no" #enable_nova_fake: "no"
#enable_nova_serialconsole_proxy: "no" #enable_nova_serialconsole_proxy: "no"
#enable_nova_ssh: "yes" #enable_nova_ssh: "yes"

View File

@ -0,0 +1,3 @@
---
features:
- Add neutron-metering-agent into kolla-ansible

View File

@ -302,6 +302,9 @@ neutron
[neutron-infoblox-ipam-agent:children] [neutron-infoblox-ipam-agent:children]
neutron neutron
[neutron-metering-agent:children]
neutron
[ironic-neutron-agent:children] [ironic-neutron-agent:children]
neutron neutron