Browse Source

Setting up compute nodes to work with nsx-t

Added nsx-t components to compute node
Added create predefined network

Change-Id: I8647c220c4f8750b503568655d1be4a1774845d7
Artem Savinov 2 years ago
parent
commit
fcaa0cc3e5

+ 18
- 0
deployment_scripts/puppet/manifests/compute-nova-config.pp View File

@@ -0,0 +1,18 @@
1
+notice('fuel-plugin-nsx-t: compute_nova_config.pp')
2
+
3
+include ::nova::params
4
+
5
+nova_config {
6
+  'neutron/service_metadata_proxy': value => 'True';
7
+  'neutron/ovs_bridge':             value => 'nsx-managed';
8
+}
9
+
10
+service { 'nova-compute':
11
+  ensure     => running,
12
+  name       => $::nova::params::compute_service_name,
13
+  enable     => true,
14
+  hasstatus  => true,
15
+  hasrestart => true,
16
+}
17
+
18
+Nova_config<| |> ~> Service['nova-compute']

+ 15
- 6
deployment_scripts/puppet/manifests/compute-vmware-nova-config.pp View File

@@ -1,14 +1,9 @@
1 1
 notice('fuel-plugin-nsx-t: compute_vmware_nova_config.pp')
2 2
 
3 3
 include ::nova::params
4
-include ::nsxt::params
5 4
 
6 5
 $neutron_config = hiera_hash('neutron_config')
7 6
 $neutron_metadata_proxy_secret = $neutron_config['metadata']['metadata_proxy_shared_secret']
8
-$nova_parameters = {
9
-  'neutron/service_metadata_proxy'       => { value => 'True' },
10
-  'neutron/metadata_proxy_shared_secret' => { value => $neutron_metadata_proxy_secret }
11
-}
12 7
 
13 8
 $management_vip            = hiera('management_vip')
14 9
 $service_endpoint          = hiera('service_endpoint', $management_vip)
@@ -36,4 +31,18 @@ class {'nova::network::neutron':
36 31
   neutron_ovs_bridge   => '',
37 32
 }
38 33
 
39
-create_resources(nova_config, $nova_parameters)
34
+nova_config {
35
+  'neutron/service_metadata_proxy':       value => 'True';
36
+  'neutron/metadata_proxy_shared_secret': value => $neutron_metadata_proxy_secret;
37
+}
38
+
39
+service { 'nova-compute':
40
+  ensure     => running,
41
+  name       => $::nova::params::compute_service_name,
42
+  enable     => true,
43
+  hasstatus  => true,
44
+  hasrestart => true,
45
+}
46
+
47
+Class['nova::network::neutron'] ~> Service['nova-compute']
48
+Nova_config<| |> ~> Service['nova-compute']

+ 59
- 0
deployment_scripts/puppet/manifests/neutron-network-create.pp View File

@@ -0,0 +1,59 @@
1
+notice('fuel-plugin-nsx-t: neutron-network-create.pp')
2
+
3
+include ::nsxt::params
4
+
5
+$access_hash     = hiera_hash('access',{})
6
+$neutron_config  = hiera_hash('neutron_config')
7
+$floating_net    = try_get_value($neutron_config, 'default_floating_net', 'net04_ext')
8
+$internal_net    = try_get_value($neutron_config, 'default_private_net', 'net04')
9
+$os_tenant_name  = try_get_value($access_hash, 'tenant', 'admin')
10
+$settings        = hiera($::nsxt::params::hiera_key)
11
+
12
+$floating_ip_range = split($settings['floating_ip_range'], '-')
13
+$floating_ip_range_start = $floating_ip_range[0]
14
+$floating_ip_range_end   = $floating_ip_range[1]
15
+$floating_net_allocation_pool = "start=${floating_ip_range_start},end=${floating_ip_range_end}"
16
+
17
+$floating_net_cidr = $settings['floating_net_cidr']
18
+$floating_net_gw = $settings['floating_net_gw']
19
+$default_floating_net_gw = regsubst($floating_net_cidr,'^(\d+\.\d+\.\d+)\.\d+/\d+$','\1.1')
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],
38
+}
39
+
40
+$internal_net_dns = split($settings['internal_net_dns'], ',')
41
+$internal_net_cidr = $settings['internal_net_cidr']
42
+
43
+neutron_network { $internal_net :
44
+  ensure                    => 'present',
45
+  provider_physical_network => false,
46
+  router_external           => false,
47
+  tenant_name               => $os_tenant_name,
48
+  shared                    => true,
49
+}
50
+neutron_subnet { "${internal_net}__subnet" :
51
+  ensure          => 'present',
52
+  cidr            => $internal_net_cidr,
53
+  network_name    => $internal_net,
54
+  tenant_name     => $os_tenant_name,
55
+  gateway_ip      => regsubst($internal_net_cidr,'^(\d+\.\d+\.\d+)\.\d+/\d+$','\1.1'),
56
+  enable_dhcp     => true,
57
+  dns_nameservers => pick($internal_net_dns,[]),
58
+  require         => Neutron_network[$internal_net],
59
+}

deployment_scripts/puppet/manifests/reg-controller-as-transport-node.pp → deployment_scripts/puppet/manifests/reg-node-as-transport-node.pp View File

@@ -1,4 +1,4 @@
1
-notice('fuel-plugin-nsx-t: reg-controller-as-transport-node.pp')
1
+notice('fuel-plugin-nsx-t: reg-node-as-transport-node.pp')
2 2
 
3 3
 include ::nsxt::params
4 4
 
@@ -7,21 +7,28 @@ $managers            = $settings['nsx_api_managers']
7 7
 $user                = $settings['nsx_api_user']
8 8
 $password            = $settings['nsx_api_password']
9 9
 $uplink_profile_uuid = $settings['uplink_profile_uuid']
10
-$static_ip_pool_uuid = $settings['static_ip_pool_uuid']
11
-$transport_zone_uuid = $settings['transport_zone_uuid']
12
-$pnics_pairs         = $settings['pnics_pairs']
10
+$transport_zone_uuid = $settings['default_overlay_tz_uuid']
13 11
 
14
-nsxt_create_transport_node { 'Add transport node':
15
-  ensure            => present,
16
-  managers          => $managers,
17
-  username          => $user,
18
-  password          => $password,
19
-  uplink_profile_id => $uplink_profile_uuid,
20
-  pnics             => $pnics_pairs,
21
-  static_ip_pool_id => $static_ip_pool_uuid,
22
-  transport_zone_id => $transport_zone_uuid,
12
+if 'primary-controller' in hiera('roles') or 'controller' in hiera('roles') {
13
+  $pnics               = $settings['controller_pnics_pairs']
14
+  $static_ip_pool_uuid = $settings['controller_ip_pool_uuid']
15
+} else {
16
+  $pnics               = $settings['compute_pnics_pairs']
17
+  $static_ip_pool_uuid = $settings['compute_ip_pool_uuid']
18
+}
19
+
20
+$vtep_interfaces = get_interfaces($pnics)
21
+up_interface { $vtep_interfaces:
22
+  before => Nsxt_create_transport_node['Add transport node'],
23
+}
24
+
25
+firewall {'0000 Accept STT traffic':
26
+  proto  => 'tcp',
27
+  dport  => ['7471'],
28
+  action => 'accept',
29
+  before => Nsxt_create_transport_node['Add transport node'],
23 30
 }
24
- 
31
+
25 32
 if !$settings['insecure'] {
26 33
   $ca_filename = try_get_value($settings['ca_file'],'name','')
27 34
   if empty($ca_filename) {
@@ -33,9 +40,29 @@ if !$settings['insecure'] {
33 40
   Nsxt_create_transport_node { ca_file => $ca_file }
34 41
 }
35 42
 
36
-firewall {'0000 Accept STT traffic':
37
-  proto  => 'tcp',
38
-  dport  => ['7471'],
39
-  action => 'accept',
40
-  before => Nsxt_create_transport_node['Add transport node'],
43
+nsxt_create_transport_node { 'Add transport node':
44
+  ensure            => present,
45
+  managers          => $managers,
46
+  username          => $user,
47
+  password          => $password,
48
+  uplink_profile_id => $uplink_profile_uuid,
49
+  pnics             => $pnics,
50
+  static_ip_pool_id => $static_ip_pool_uuid,
51
+  transport_zone_id => $transport_zone_uuid,
52
+}
53
+
54
+# workaround, otherwise $title variable not work, always has a value 'main'
55
+define up_interface {
56
+  file { $title:
57
+    ensure  => file,
58
+    path    => "/etc/network/interfaces.d/ifcfg-${title}",
59
+    mode    => '0644',
60
+    content => "auto ${title}\niface ${title} inet manual",
61
+    replace => true,
62
+  } ->
63
+  exec { $title:
64
+    path     => '/usr/sbin:/usr/bin:/sbin:/bin',
65
+    command  => "ifup ${title}",
66
+    provider => 'shell',
67
+  }
41 68
 }

deployment_scripts/puppet/manifests/reg-controller-on-management-plane.pp → deployment_scripts/puppet/manifests/reg-node-on-management-plane.pp View File

@@ -1,4 +1,4 @@
1
-notice('fuel-plugin-nsx-t: reg-controller-on-management-plane.pp')
1
+notice('fuel-plugin-nsx-t: reg-node-on-management-plane.pp')
2 2
 
3 3
 include ::nsxt::params
4 4
 

+ 14
- 0
deployment_scripts/puppet/modules/nsxt/lib/puppet/parser/functions/get_interfaces.rb View File

@@ -0,0 +1,14 @@
1
+module Puppet::Parser::Functions
2
+  newfunction(:get_interfaces, :type => :rvalue, :doc => <<-EOS
3
+Returns the array of interface names for nsx-t VTEPs.
4
+EOS
5
+  ) do |args|
6
+    pnics = args[0]
7
+    vtep_interfaces = []
8
+    pnics.each do |pnic_pair|
9
+      device,uplink = pnic_pair.split(':')
10
+      vtep_interfaces.push(device.strip)
11
+    end
12
+    return vtep_interfaces
13
+  end
14
+end

+ 5
- 1
deployment_scripts/puppet/modules/nsxt/lib/puppet/provider/nsxt_create_transport_node/nsxt_create_transport_node.rb View File

@@ -139,7 +139,11 @@ Puppet::Type.type(:nsxt_create_transport_node).provide(:nsxt_create_transport_no
139 139
 
140 140
   def create_pnics_array(pnics)
141 141
     result_pnic_pairs = []
142
-    pnics.split(/\n+/).each do |pnic_pair|
142
+    # https://projects.puppetlabs.com/issues/9850
143
+    if not pnics.instance_of? Array
144
+      pnics = [pnics]
145
+    end
146
+    pnics.each do |pnic_pair|
143 147
       device,uplink = pnic_pair.split(':')
144 148
       result_pnic_pairs.push({'device_name' => device.strip, 'uplink_name' => uplink.strip})
145 149
     end

+ 2
- 2
deployment_scripts/puppet/modules/nsxt/lib/puppet/type/nsxt_create_transport_node.rb View File

@@ -38,8 +38,8 @@ Puppet::Type.newtype(:nsxt_create_transport_node) do
38 38
     desc 'Ids of Uplink HostSwitch profiles to be associated with this HostSwitch.'
39 39
   end
40 40
 
41
-  newparam(:pnics) do
42
-    desc 'Multiline string with "device_name : uplink_name" pairs. One per line.'
41
+  newparam(:pnics, :array_matching => :all) do
42
+    desc 'Array of string with "device_name : uplink_name" pairs.'
43 43
   end
44 44
 
45 45
   newparam(:static_ip_pool_id) do

+ 52
- 11
deployment_tasks.yaml View File

@@ -20,13 +20,29 @@
20 20
   groups:
21 21
     - compute-vmware
22 22
   required_for:
23
-    - top-role-compute-vmware
23
+    - enable_nova_compute_service
24 24
   requires:
25
+    - top-role-compute-vmware
25 26
     - top-role-compute
26 27
   parameters:
27 28
     puppet_manifest: puppet/manifests/compute-vmware-nova-config.pp
28 29
     puppet_modules: puppet/modules
29
-    timeout: 300
30
+    timeout: 180
31
+
32
+- id: nsx-t-compute-nova-config
33
+  version: 2.0.0
34
+  type: puppet
35
+  groups:
36
+    - compute
37
+  required_for:
38
+    - enable_nova_compute_service
39
+  requires:
40
+    - top-role-compute
41
+    - openstack-network-compute-nova
42
+  parameters:
43
+    puppet_manifest: puppet/manifests/compute-nova-config.pp
44
+    puppet_modules: puppet/modules
45
+    timeout: 180
30 46
 
31 47
 - id: nsx-t-gem-install
32 48
   version: 2.0.0
@@ -36,8 +52,8 @@
36 52
     - controller
37 53
     - compute
38 54
   required_for:
39
-    - nsx-t-reg-controller-on-management-plane
40
-    - nsx-t-reg-controller-as-transport-node
55
+    - nsx-t-reg-node-on-management-plane
56
+    - nsx-t-reg-node-as-transport-node
41 57
   requires:
42 58
     - setup_repositories
43 59
   parameters:
@@ -135,7 +151,6 @@
135 151
   required_for:
136 152
     - primary-openstack-network-agents-metadata
137 153
     - primary-openstack-network-agents-dhcp
138
-    - openstack-network-networks
139 154
   requires:
140 155
     - nsx-t-configure-plugin
141 156
   cross-depends:
@@ -145,35 +160,39 @@
145 160
     puppet_modules: puppet/modules
146 161
     timeout: 300
147 162
 
148
-- id: nsx-t-reg-controller-on-management-plane
163
+- id: nsx-t-reg-node-on-management-plane
149 164
   version: 2.0.0
150 165
   type: puppet
151 166
   groups:
152 167
     - primary-controller
153 168
     - controller
169
+    - compute
154 170
   required_for:
155 171
     - primary-openstack-network-agents-metadata
156 172
     - primary-openstack-network-agents-dhcp
173
+    - openstack-network-end
157 174
   requires:
158 175
     - nsx-t-install-packages
159 176
   parameters:
160
-    puppet_manifest: puppet/manifests/reg-controller-on-management-plane.pp
177
+    puppet_manifest: puppet/manifests/reg-node-on-management-plane.pp
161 178
     puppet_modules: puppet/modules
162 179
     timeout: 300
163 180
 
164
-- id: nsx-t-reg-controller-as-transport-node
181
+- id: nsx-t-reg-node-as-transport-node
165 182
   version: 2.0.0
166 183
   type: puppet
167 184
   groups:
168 185
     - primary-controller
169 186
     - controller
187
+    - compute
170 188
   required_for:
171 189
     - primary-openstack-network-agents-metadata
172 190
     - primary-openstack-network-agents-dhcp
191
+    - openstack-network-end
173 192
   requires:
174
-    - nsx-t-reg-controller-on-management-plane
193
+    - nsx-t-reg-node-on-management-plane
175 194
   parameters:
176
-    puppet_manifest: puppet/manifests/reg-controller-as-transport-node.pp
195
+    puppet_manifest: puppet/manifests/reg-node-as-transport-node.pp
177 196
     puppet_modules: puppet/modules
178 197
     timeout: 300
179 198
 
@@ -203,7 +222,7 @@
203 222
   groups:
204 223
     - primary-controller
205 224
   required_for:
206
-    - openstack-network-networks
225
+    - openstack-network-end
207 226
   requires:
208 227
     - primary-openstack-network-agents-dhcp
209 228
   cross-depends:
@@ -227,6 +246,22 @@
227 246
     puppet_modules: puppet/modules
228 247
     timeout: 120
229 248
 
249
+- id: nsx-t-neutron-network-create
250
+  version: 2.0.0
251
+  type: puppet
252
+  groups:
253
+    - primary-controller
254
+  required_for:
255
+    - openstack-network-routers
256
+  requires:
257
+    - nsx-t-primary-neutron-server-start
258
+    - nsx-t-configure-agents-dhcp
259
+    - primary-openstack-network-agents-metadata
260
+  parameters:
261
+    puppet_manifest: puppet/manifests/neutron-network-create.pp
262
+    puppet_modules: puppet/modules
263
+    timeout: 300
264
+
230 265
 # skipped tasks
231 266
 - id: openstack-network-networks
232 267
   version: 2.0.0
@@ -243,3 +278,9 @@
243 278
 - id: openstack-network-agents-l3
244 279
   version: 2.0.0
245 280
   type: skipped
281
+- id: openstack-network-agents-sriov
282
+  version: 2.0.0
283
+  type: skipped
284
+- id: enable_nova_compute_service
285
+  version: 2.0.0
286
+  type: skipped

+ 58
- 11
environment_config.yaml View File

@@ -85,25 +85,72 @@ attributes:
85 85
       source: *uuid
86 86
       error: 'Enter uplink profile ID'
87 87
     type: "text"
88
-  static_ip_pool_uuid:
88
+  controller_ip_pool_uuid:
89 89
     value: ''
90
-    label: 'IP pool ID for STT VTEP'
90
+    label: 'IP pool ID for controller VTEPs'
91 91
     weight: 50
92 92
     regex:
93 93
       source: *uuid
94 94
       error: 'Enter IP pool ID'
95 95
     type: "text"
96
-  transport_zone_uuid:
97
-    value: ''
98
-    label: 'Transport zone ID'
96
+  controller_pnics_pairs:
97
+    value:
98
+      - 'enp0s1:uplink-1'
99
+    label: 'Colon separated pnics pairs for controller nodes'
100
+    min: 1
99 101
     weight: 55
102
+    type: "text_list"
103
+  compute_ip_pool_uuid:
104
+    value: ''
105
+    label: 'IP pool ID for compute VTEPs'
106
+    weight: 60
100 107
     regex:
101 108
       source: *uuid
102
-      error: 'Enter transport zone ID'
109
+      error: 'Enter IP pool ID'
103 110
     type: "text"
104
-  pnics_pairs:
105
-    value: 'enp0s1:uplink-1'
106
-    label: 'Colon separated pnics pairs, one per line'
111
+  compute_pnics_pairs:
112
+    value:
113
+      - 'enp0s1:uplink-1'
114
+    label: 'Colon separated pnics pairs for compute nodes'
107 115
     min: 1
108
-    weight: 60
109
-    type: "textarea"
116
+    weight: 65
117
+    type: "text_list"
118
+  floating_ip_range:
119
+    value: ''
120
+    label: 'Floating IP range'
121
+    description: 'Dash separated IP addresses allocation pool from external network, e.g. "start_ip_address-end_ip_address"'
122
+    weight: 70
123
+    type: 'text'
124
+    regex:
125
+      source: '^(?:[0-9]{1,3}\.){3}[0-9]{1,3}-(?:[0-9]{1,3}\.){3}[0-9]{1,3}$'
126
+      error: 'Invalid IP ranges'
127
+  floating_net_cidr:
128
+    value: ''
129
+    label: 'External network CIDR'
130
+    description: 'Network in CIDR notation that includes floating IP ranges'
131
+    weight: 75
132
+    type: 'text'
133
+    regex:
134
+      source: '^(?:[0-9]{1,3}\.){3}[0-9]{1,3}/[0-9]{1,2}$'
135
+      error: 'Invalid network in CIDR notation'
136
+  floating_net_gw:
137
+    value: ''
138
+    label: 'Gateway'
139
+    description: 'Default gateway for external network, if not defined, first IP address of the network is used'
140
+    weight: 80
141
+    type: 'text'
142
+  internal_net_cidr:
143
+    value: ''
144
+    label: 'Internal network CIDR'
145
+    description: 'Network in CIDR notation for use as internal'
146
+    weight: 85
147
+    type: 'text'
148
+    regex:
149
+      source: '^(?:[0-9]{1,3}\.){3}[0-9]{1,3}/[0-9]{1,2}$'
150
+      error: 'Invalid network in CIDR notation'
151
+  internal_net_dns:
152
+    value: ''
153
+    label: 'DNS for internal network'
154
+    description: 'Comma separated IP addresses of DNS server for internal network'
155
+    weight: 90
156
+    type: 'text'

Loading…
Cancel
Save