From ff9c0c49eaa53a054d4e2a847221a7bc797ffb92 Mon Sep 17 00:00:00 2001 From: Ekaterina Chernova Date: Thu, 12 Feb 2015 19:31:48 +0300 Subject: [PATCH] Remove hardcoded dns from config file If no nameserver list is provided to a neutron subnet, it uses the DHCP (gateway) address which in turn forwards to dnsmasq. So dns_nameservers will be set to emptylist in heat templete. In case user wants to set different dns from default, he may edit the config parameter, witch is not removed. The name of parameters is changes to dns_nameservers (with s at the end) to correspond the same name in heat template. Change-Id: Iba8b12b8bc78f821e11debb58f20cb713a9dc9c7 Closes-Bug: #1367877 --- doc/source/install/manual.rst | 4 ++++ .../Classes/resources/NeutronNetwork.yaml | 17 +++++++---------- murano/common/config.py | 6 +++--- .../unit/policy/expected_rules_wordpress.txt | 1 - murano/tests/unit/policy/model_complex.yaml | 3 +-- murano/tests/unit/policy/wordpress.yaml | 3 +-- 6 files changed, 16 insertions(+), 18 deletions(-) diff --git a/doc/source/install/manual.rst b/doc/source/install/manual.rst index 43d4dee6..6d5bfdcb 100644 --- a/doc/source/install/manual.rst +++ b/doc/source/install/manual.rst @@ -192,6 +192,10 @@ Install the API service and Engine login = %RABBITMQ_USER% password = %RABBITMQ_PASSWORD% virtual_host = %RABBITMQ_SERVER_VIRTUAL_HOST% + + [networking] + default_dns = 8.8.8.8 # In case openstack neutron has no default + # DNS configured .. #. Create a virtual environment and install Murano prerequisites. We will use diff --git a/meta/io.murano/Classes/resources/NeutronNetwork.yaml b/meta/io.murano/Classes/resources/NeutronNetwork.yaml index 06434b9d..78ec13eb 100644 --- a/meta/io.murano/Classes/resources/NeutronNetwork.yaml +++ b/meta/io.murano/Classes/resources/NeutronNetwork.yaml @@ -27,14 +27,12 @@ Properties: Contract: $.string() Usage: InOut - dnsNameserver: - Contract: $.string() + dnsNameservers: + # This property is optional, + # since neutron default dns will be used in case of empty + Contract: [$.string()] Usage: InOut - useDefaultDns: - Contract: $.bool().notNull() - Default: true - Methods: initialize: Body: @@ -46,10 +44,9 @@ Methods: Body: - If: not $.getAttr(deployed, false) Then: - - If: $.useDefaultDns and (not bool($.dnsNameserver)) + - If: $.dnsNameservers = null Then: - - $.dnsNameserver: $._netExplorer.getDefaultDns() - + - $.dnsNameservers: $._netExplorer.getDefaultDns() - $template: $._createNetwork() - If: $.autoUplink and (not bool($.externalRouterId)) Then: @@ -87,7 +84,7 @@ Methods: properties: network: { get_resource: $._getNetworkName() } ip_version: 4 - dns_nameservers: [ $.dnsNameserver ] + dns_nameservers: $.dnsNameservers cidr: $.subnetCidr diff --git a/murano/common/config.py b/murano/common/config.py index 6ce4cb0d..e55ea3ad 100644 --- a/murano/common/config.py +++ b/murano/common/config.py @@ -166,9 +166,9 @@ networking_opts = [ help='Template IP address for generating environment ' 'subnet cidrs'), - cfg.StrOpt('default_dns', default='8.8.8.8', - help='Default DNS nameserver to be assigned to ' - 'created Networks'), + cfg.ListOpt('default_dns', default=[], + help='List of default DNS nameservers to be assigned to ' + 'created Networks'), cfg.StrOpt('external_network', default='ext-net', help='ID or name of the external network for routers ' diff --git a/murano/tests/unit/policy/expected_rules_wordpress.txt b/murano/tests/unit/policy/expected_rules_wordpress.txt index 19bb8f54..0b9b93ea 100644 --- a/murano/tests/unit/policy/expected_rules_wordpress.txt +++ b/murano/tests/unit/policy/expected_rules_wordpress.txt @@ -2,7 +2,6 @@ murano:objects+("83bff5acf8354816b08cf9b4917c898d", "de305d5475b4431badb2eb6b9e5 murano:properties+("83bff5acf8354816b08cf9b4917c898d", "name", "wordpress-env") murano:parent_types+("83bff5acf8354816b08cf9b4917c898d", "io.murano.Object") murano:objects+("c46770dec1db483ca2322914b842e50f", "83bff5acf8354816b08cf9b4917c898d", "io.murano.resources.NeutronNetwork") -murano:properties+("c46770dec1db483ca2322914b842e50f", "useDefaultDns", "True") murano:properties+("c46770dec1db483ca2322914b842e50f", "name", "wordpress-env-network") murano:properties+("c46770dec1db483ca2322914b842e50f", "autogenerateSubnet", "True") murano:properties+("c46770dec1db483ca2322914b842e50f", "autoUplink", "True") diff --git a/murano/tests/unit/policy/model_complex.yaml b/murano/tests/unit/policy/model_complex.yaml index 64213b82..88d7c110 100644 --- a/murano/tests/unit/policy/model_complex.yaml +++ b/murano/tests/unit/policy/model_complex.yaml @@ -44,10 +44,9 @@ defaultNetworks: '?': {id: 7bac482a4c194b6e8dea81e6ce606db6, type: io.murano.resources.NeutronNetwork} autoUplink: true autogenerateSubnet: true - dnsNameserver: null + dnsNameservers: null externalRouterId: null name: quick-env-12-network subnetCidr: null - useDefaultDns: true flat: null name: quick-env-12 \ No newline at end of file diff --git a/murano/tests/unit/policy/wordpress.yaml b/murano/tests/unit/policy/wordpress.yaml index 20f3f9be..166e33bf 100644 --- a/murano/tests/unit/policy/wordpress.yaml +++ b/murano/tests/unit/policy/wordpress.yaml @@ -3,11 +3,10 @@ defaultNetworks: '?': {id: c46770dec1db483ca2322914b842e50f, type: io.murano.resources.NeutronNetwork} autoUplink: true autogenerateSubnet: true - dnsNameserver: null + dnsNameservers: null externalRouterId: null name: wordpress-env-network subnetCidr: null - useDefaultDns: true flat: null name: wordpress-env '?': {type: io.murano.Environment, id: 83bff5acf8354816b08cf9b4917c898d}