Browse Source

Merge "Provide a flag that mark existence of provider network"

Jenkins 2 years ago
parent
commit
c05beb45cd

+ 24
- 17
deployment_scripts/puppet/manifests/neutron-network-create.pp View File

@@ -18,23 +18,30 @@ $floating_net_cidr = $settings['floating_net_cidr']
18 18
 $floating_net_gw = $settings['floating_net_gw']
19 19
 $default_floating_net_gw = regsubst($floating_net_cidr,'^(\d+\.\d+\.\d+)\.\d+/\d+$','\1.1')
20 20
 
21
-neutron_network { $floating_net :
22
-  ensure                    => 'present',
23
-  provider_physical_network => $settings['external_network'],
24
-  provider_network_type     => 'local',
25
-  router_external           => true,
26
-  tenant_name               => $os_tenant_name,
27
-  shared                    => true,
28
-}
29
-neutron_subnet { "${floating_net}__subnet" :
30
-  ensure           => 'present',
31
-  cidr             => $floating_net_cidr,
32
-  network_name     => $floating_net,
33
-  tenant_name      => $os_tenant_name,
34
-  gateway_ip       => pick($floating_net_gw,$default_floating_net_gw),
35
-  enable_dhcp      => false,
36
-  allocation_pools => $floating_net_allocation_pool,
37
-  require          => Neutron_network[$floating_net],
21
+$skip_provider_network = try_get_value('skip_provider_network', false)
22
+
23
+if ! $skip_provider_network {
24
+  neutron_network { $floating_net :
25
+    ensure                    => 'present',
26
+    provider_physical_network => $settings['external_network'],
27
+    provider_network_type     => 'local',
28
+    router_external           => true,
29
+    tenant_name               => $os_tenant_name,
30
+    shared                    => true,
31
+  }
32
+
33
+  neutron_subnet { "${floating_net}__subnet" :
34
+    ensure           => 'present',
35
+    cidr             => $floating_net_cidr,
36
+    network_name     => $floating_net,
37
+    tenant_name      => $os_tenant_name,
38
+    gateway_ip       => pick($floating_net_gw, $default_floating_net_gw),
39
+    enable_dhcp      => false,
40
+    allocation_pools => $floating_net_allocation_pool,
41
+    require          => Neutron_network[$floating_net],
42
+  }
43
+
44
+  skip_provider_network($::nsxt::params::hiera_yml)
38 45
 }
39 46
 
40 47
 $internal_net_dns = split($settings['internal_net_dns'], ',')

+ 8
- 1
deployment_scripts/puppet/modules/nsxt/lib/puppet/parser/functions/hiera_overrides.rb View File

@@ -8,7 +8,14 @@ file name, where write new parameters in yaml format, ex:
8 8
 EOS
9 9
   ) do |args|
10 10
     filename = args[0]
11
-    hiera_overrides = {}
11
+
12
+    begin
13
+      yaml_string = File.read filename
14
+
15
+      hiera_overrides = YAML.load yaml_string
16
+    rescue Errno::ENOENT
17
+      hiera_overrides = {}
18
+    end
12 19
 
13 20
     # override neutron_advanced_configuration
14 21
     neutron_advanced_configuration = {}

+ 24
- 0
deployment_scripts/puppet/modules/nsxt/lib/puppet/parser/functions/skip_provider_network.rb View File

@@ -0,0 +1,24 @@
1
+require 'yaml'
2
+
3
+module Puppet::Parser::Functions
4
+  newfunction(:skip_provider_network, :doc => <<-EOS
5
+Custom function to override hiera parameters, the first argument -
6
+file name, where write new parameters in yaml format, ex:
7
+   hiera_overrides('/etc/hiera/test.yaml')
8
+EOS
9
+  ) do |args|
10
+    filename = args[0]
11
+
12
+    begin
13
+      yaml_string = File.read filename
14
+      hiera_overrides = YAML.load yaml_string
15
+    rescue Errno::ENOENT
16
+      hiera_overrides = {}
17
+    end
18
+
19
+    hiera_overrides['skip_provider_network'] = true
20
+
21
+    # write to hiera override yaml file
22
+    File.open(filename, 'w') { |file| file.write(hiera_overrides.to_yaml) }
23
+  end
24
+end

+ 1
- 0
deployment_scripts/puppet/modules/nsxt/manifests/params.pp View File

@@ -1,5 +1,6 @@
1 1
 class nsxt::params {
2 2
   $hiera_key          = 'nsx-t'
3
+  $hiera_yml          = '/etc/hiera/plugins/nsx-t.yaml'
3 4
   $plugin_package     = 'python-vmware-nsx'
4 5
   $core_plugin        = 'vmware_nsx.plugin.NsxV3Plugin'
5 6
   $nsx_plugin_dir     = '/etc/neutron/plugins/vmware'

+ 0
- 2
deployment_tasks.yaml View File

@@ -257,8 +257,6 @@
257 257
     - nsx-t-primary-neutron-server-start
258 258
     - nsx-t-configure-agents-dhcp
259 259
     - primary-openstack-network-agents-metadata
260
-  condition:
261
-    yaql_exp: "changed($.quantum)"
262 260
   parameters:
263 261
     puppet_manifest: puppet/manifests/neutron-network-create.pp
264 262
     puppet_modules: puppet/modules:/etc/puppet/modules

Loading…
Cancel
Save