Browse Source

Fix the bug with neutron timeout and rework code

- Fixed the bug with neutron timeout
- Removed unused code
- Fix typos, etc

Change-Id: I4159c8e132b445b2d00a5533597e74cc1d67255f
Closes-bug: #1621778
Alexander Arzhanov 2 years ago
parent
commit
0c8903f5b9

+ 0
- 6
deployment_scripts/add_hyperv_type.sh View File

@@ -1,6 +0,0 @@
1
-#!/bin/bash
2
-
3
-. /root/openrc
4
-
5
-glance image-update $(glance image-list | awk '/ TestVM / {print $2}') --property hypervisor_type=qemu
6
-glance image-update $(glance image-list | awk '/ TestVM-VMDK / {print $2}') --property hypervisor_type=vmware

+ 3
- 4
deployment_scripts/puppet/manifests/agents.pp View File

@@ -1,4 +1,4 @@
1
-#    Copyright 2015 Mirantis, Inc.
1
+#    Copyright 2016 Mirantis, Inc.
2 2
 #
3 3
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
4 4
 #    not use this file except in compliance with the License. You may obtain
@@ -12,7 +12,7 @@
12 12
 #    License for the specific language governing permissions and limitations
13 13
 #    under the License.
14 14
 
15
-notice('MODULAR: fuel-plugin-vmware-dvs/agent')
15
+notice('MODULAR: fuel-plugin-vmware-dvs/agents')
16 16
 
17 17
 $vcenter    = hiera_hash('vcenter', {})
18 18
 $vmware_dvs = hiera_hash('fuel-plugin-vmware-dvs', {})
@@ -22,8 +22,7 @@ $roles      = hiera_array('roles', {})
22 22
 $agents     = get_agents_data($vcenter, $neutron, $vmware_dvs, $n_fqdn, $roles)
23 23
 
24 24
 $defaults   = {
25
-  'neutron_url_timeout' => '3600',
26
-  'py_root'             => '/usr/lib/python2.7/dist-packages',
25
+  'py_root' => '/usr/lib/python2.7/dist-packages',
27 26
 }
28 27
 
29 28
 create_resources(vmware_dvs::agent, $agents, $defaults)

+ 17
- 18
deployment_scripts/puppet/manifests/compute-vmware.pp View File

@@ -1,4 +1,4 @@
1
-#    Copyright 2015 Mirantis, Inc.
1
+#    Copyright 2016 Mirantis, Inc.
2 2
 #
3 3
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
4 4
 #    not use this file except in compliance with the License. You may obtain
@@ -14,22 +14,21 @@
14 14
 
15 15
 notice('MODULAR: fuel-plugin-vmware-dvs/compute-vmware')
16 16
 
17
-$neutron_config     = hiera_hash('neutron_config')
18
-$nova_hash          = hiera_hash('nova')
19
-
20
-$management_vip     = hiera('management_vip')
21
-$service_endpoint   = hiera('service_endpoint', $management_vip)
22
-$neutron_endpoint   = hiera('neutron_endpoint', $management_vip)
23
-$admin_password     = try_get_value($neutron_config, 'keystone/admin_password')
24
-$admin_tenant_name  = try_get_value($neutron_config,
25
-                                  'keystone/admin_tenant', 'services')
26
-$admin_username     = try_get_value($neutron_config,
27
-                                  'keystone/admin_user', 'neutron')
28
-$region_name        = hiera('region', 'RegionOne')
29
-$auth_api_version   = 'v3'
30
-$admin_identity_uri = "http://${service_endpoint}:35357"
31
-$admin_auth_url     = "${admin_identity_uri}/${auth_api_version}"
32
-$neutron_url        = "http://${neutron_endpoint}:9696"
17
+$neutron_config      = hiera_hash('neutron_config')
18
+$management_vip      = hiera('management_vip')
19
+$service_endpoint    = hiera('service_endpoint', $management_vip)
20
+$neutron_endpoint    = hiera('neutron_endpoint', $management_vip)
21
+$admin_password      = try_get_value($neutron_config, 'keystone/admin_password')
22
+$admin_tenant_name   = try_get_value($neutron_config,
23
+                                   'keystone/admin_tenant', 'services')
24
+$admin_username      = try_get_value($neutron_config,
25
+                                   'keystone/admin_user', 'neutron')
26
+$region_name         = hiera('region', 'RegionOne')
27
+$auth_api_version    = 'v3'
28
+$admin_identity_uri  = "http://${service_endpoint}:35357"
29
+$admin_auth_url      = "${admin_identity_uri}/${auth_api_version}"
30
+$neutron_url         = "http://${neutron_endpoint}:9696"
31
+$neutron_url_timeout = '3600'
33 32
 
34 33
 class {'::vmware_dvs::compute':
35 34
   admin_password      => $admin_password,
@@ -38,5 +37,5 @@ class {'::vmware_dvs::compute':
38 37
   admin_username      => $admin_username,
39 38
   admin_auth_url      => $admin_auth_url,
40 39
   neutron_url         => $neutron_url,
41
-  neutron_url_timeout => '3600',
40
+  neutron_url_timeout => $neutron_url_timeout,
42 41
 }

+ 0
- 23
deployment_scripts/puppet/manifests/controllers.pp View File

@@ -1,23 +0,0 @@
1
-#    Copyright 2016 Mirantis, Inc.
2
-#
3
-#    Licensed under the Apache License, Version 2.0 (the "License"); you may
4
-#    not use this file except in compliance with the License. You may obtain
5
-#    a copy of the License at
6
-#
7
-#         http://www.apache.org/licenses/LICENSE-2.0
8
-#
9
-#    Unless required by applicable law or agreed to in writing, software
10
-#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
-#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
-#    License for the specific language governing permissions and limitations
13
-#    under the License.
14
-
15
-notice('MODULAR: fuel-plugin-vmware-dvs/controllers')
16
-
17
-$py_root         = '/usr/lib/python2.7/dist-packages'
18
-$ml2_driver_path = 'neutron/plugins/ml2/drivers/mech_vmware_dvs'
19
-$path            = "${py_root}/${ml2_driver_path}"
20
-
21
-class {'::vmware_dvs::neutron_server':
22
-  path => $path,
23
-}

+ 0
- 1
deployment_scripts/puppet/manifests/flag.pp View File

@@ -1 +0,0 @@
1
-notice('MODULAR: fuel-plugin-vmware-dvs')

+ 3
- 3
deployment_scripts/puppet/manifests/override_hiera.pp View File

@@ -1,4 +1,4 @@
1
-notice('MODULAR: fuel-plugin-vmware-dvs/overrride_hiera')
1
+notice('MODULAR: fuel-plugin-vmware-dvs/override_hiera')
2 2
 
3
-$src = '/etc/hiera/override/plugins.yaml'
4
-$res   = override_hiera($src)
3
+$src = '/etc/hiera/plugins/fuel-plugin-vmware-dvs.yaml'
4
+$res = override_hiera($src)

+ 0
- 25
deployment_scripts/puppet/manifests/restart-nova-compute.pp View File

@@ -1,25 +0,0 @@
1
-#    Copyright 2016 Mirantis, Inc.
2
-#
3
-#    Licensed under the Apache License, Version 2.0 (the "License"); you may
4
-#    not use this file except in compliance with the License. You may obtain
5
-#    a copy of the License at
6
-#
7
-#         http://www.apache.org/licenses/LICENSE-2.0
8
-#
9
-#    Unless required by applicable law or agreed to in writing, software
10
-#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
-#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
-#    License for the specific language governing permissions and limitations
13
-#    under the License.
14
-
15
-notice('MODULAR: fuel-plugin-vmware-dvs/restart-nova-compute')
16
-
17
-$vcenter    = hiera_hash('vcenter')
18
-$vc_setting = parse_vcenter_settings($vcenter['computes'])
19
-
20
-$defaults   = {
21
-  'current_node'   => hiera('fqdn'),
22
-  'role'           => hiera('role'),
23
-}
24
-
25
-create_resources(vmware_dvs::ha_nova_restart, $vc_setting, $defaults)

+ 4
- 13
deployment_scripts/puppet/manifests/site.pp View File

@@ -1,4 +1,4 @@
1
-#    Copyright 2015 Mirantis, Inc.
1
+#    Copyright 2016 Mirantis, Inc.
2 2
 #
3 3
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
4 4
 #    not use this file except in compliance with the License. You may obtain
@@ -11,23 +11,14 @@
11 11
 #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 12
 #    License for the specific language governing permissions and limitations
13 13
 #    under the License.
14
+#
14 15
 
15
-notice('MODULAR: fuel-plugin-vmware-dvs')
16
-
17
-$vcenter          = hiera_hash('vcenter', {})
18
-$computes         = $vcenter['computes'][0]
19
-$vsphere_hostname = $computes['vc_host']
20
-$vsphere_login    = $computes['vc_user']
21
-$vsphere_password = $computes['vc_password']
16
+notice('MODULAR: fuel-plugin-vmware-dvs/site')
22 17
 
23
-$neutron          = hiera_hash('neutron_config', {})
24 18
 $py_root          = '/usr/lib/python2.7/dist-packages'
25 19
 $ml2_plugin_path  = 'neutron/cmd/eventlet/plugins/dvs_neutron_agent.py'
26 20
 $plugin_path      = "${py_root}/${ml2_plugin_path}"
27 21
 
28 22
 class {'::vmware_dvs':
29
-  vsphere_hostname => $vsphere_hostname,
30
-  vsphere_login    => $vsphere_login,
31
-  vsphere_password => $vsphere_password,
32
-  plugin_path      => $plugin_path,
23
+  plugin_path => $plugin_path,
33 24
 }

+ 1
- 1
deployment_scripts/puppet/manifests/vmware-dvs-network-plugins-l2.pp View File

@@ -1,4 +1,4 @@
1
-notice('MODULAR: fuel-plugin-vmware-dvs/plugins/ml2.pp')
1
+notice('MODULAR: fuel-plugin-vmware-dvs/vmware-dvs-network-plugins-l2')
2 2
 
3 3
 class neutron {}
4 4
 class { 'neutron' :}

+ 1
- 1
deployment_scripts/puppet/modules/vmware_dvs/files/dvs_neutron_agent.py View File

@@ -1,4 +1,4 @@
1
-"""Copyright 2015 Mirantis, Inc.
1
+"""Copyright 2016 Mirantis, Inc.
2 2
 
3 3
 Licensed under the Apache License, Version 2.0 (the "License"); you may
4 4
 not use this file except in compliance with the License. You may obtain

+ 1
- 12
deployment_scripts/puppet/modules/vmware_dvs/files/ocf-neutron-dvs-agent View File

@@ -17,7 +17,6 @@
17 17
 # OCF instance parameters:
18 18
 #   OCF_RESKEY_binary
19 19
 #   OCF_RESKEY_config
20
-#   OCF_RESKEY_plugin_config
21 20
 #   OCF_RESKEY_user
22 21
 #   OCF_RESKEY_pid
23 22
 #   OCF_RESKEY_additional_parameters
@@ -35,7 +34,6 @@
35 34
 
36 35
 OCF_RESKEY_binary_default="neutron-dvs-agent"
37 36
 OCF_RESKEY_config_default="/etc/neutron/neutron.conf"
38
-OCF_RESKEY_plugin_config_default="/etc/neutron/plugin.ini"
39 37
 OCF_RESKEY_user_default="neutron"
40 38
 OCF_RESKEY_pid_default="${HA_RSCTMP}/${__SCRIPT_NAME}/${__SCRIPT_NAME}.pid"
41 39
 OCF_RESKEY_log_file_default="/var/log/neutron/vmware-dvs-agent-vcenter-sn.log"
@@ -45,7 +43,6 @@ OCF_RESKEY_debug_default='false'
45 43
 : ${HA_LOGFACILITY="daemon"}
46 44
 : ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}}
47 45
 : ${OCF_RESKEY_config=${OCF_RESKEY_config_default}}
48
-: ${OCF_RESKEY_plugin_config=${OCF_RESKEY_plugin_config_default}}
49 46
 : ${OCF_RESKEY_user=${OCF_RESKEY_user_default}}
50 47
 : ${OCF_RESKEY_pid=${OCF_RESKEY_pid_default}}
51 48
 : ${OCF_RESKEY_log_file=${OCF_RESKEY_log_file_default}}
@@ -100,14 +97,6 @@ Location of the OpenStack Neutron Service (neutron-server) configuration file
100 97
 <content type="string" default="${OCF_RESKEY_config_default}" />
101 98
 </parameter>
102 99
 
103
-<parameter name="plugin_config" unique="0" required="0">
104
-<longdesc lang="en">
105
-Location of the OpenStack VMware DVS agent (${OCF_RESKEY_binary}) configuration file
106
-</longdesc>
107
-<shortdesc lang="en">OpenStack VMware DVS agent (${OCF_RESKEY_binary}) config file</shortdesc>
108
-<content type="string" default="${OCF_RESKEY_plugin_config_default}" />
109
-</parameter>
110
-
111 100
 <parameter name="user" unique="0" required="0">
112 101
 <longdesc lang="en">
113 102
 User running OpenStack VMware DVS Service (${OCF_RESKEY_binary})
@@ -250,7 +239,7 @@ neutron_dvs_agent_start() {
250 239
     # run and detach to background neutron-dvs-agent as daemon.
251 240
     # Don't use ocf_run as we're sending the tool's output
252 241
     su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} --config-file=$OCF_RESKEY_config \
253
-        --config-file=$OCF_RESKEY_plugin_config --log-file=$OCF_RESKEY_log_file $OCF_RESKEY_additional_parameters \
242
+        --log-file=$OCF_RESKEY_log_file $OCF_RESKEY_additional_parameters \
254 243
         >> /dev/null"' 2>&1 & echo $! > $OCF_RESKEY_pid'
255 244
     ocf_log debug "Create pid file: ${OCF_RESKEY_pid} with content $(cat ${OCF_RESKEY_pid})"
256 245
 

+ 23
- 28
deployment_scripts/puppet/modules/vmware_dvs/manifests/agent.pp View File

@@ -1,4 +1,4 @@
1
-#    Copyright 2015 Mirantis, Inc.
1
+#    Copyright 2016 Mirantis, Inc.
2 2
 #
3 3
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
4 4
 #    not use this file except in compliance with the License. You may obtain
@@ -11,25 +11,29 @@
11 11
 #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 12
 #    License for the specific language governing permissions and limitations
13 13
 #    under the License.
14
-
14
+#
15 15
 # === Parameters
16 16
 #
17 17
 # [*host*]
18 18
 #   (required) String. The host parameter for nova-compute process
19
+#   Defaults to 'vcenter-servicename'.
19 20
 #
20 21
 # [*vsphere_hostname*]
21 22
 #   (required) String. This is a name or ip of VMware vSphere server.
23
+#   Defaults to '192.168.0.1'.
22 24
 #
23 25
 # [*vsphere_login*]
24 26
 #   (required) String. This is a name of VMware vSphere user.
27
+#   Defaults to 'administrator@vsphere.local'.
25 28
 #
26 29
 # [*vsphere_password*]
27 30
 #   (required) String. This is a password of VMware vSphere user.
31
+#   Defaults to 'StrongPassword!'.
28 32
 #
29 33
 # [*vsphere_insecure*]
30 34
 #   (optional) If true, the ESX/vCenter server certificate is not verified.
31 35
 #   If false, then the default CA truststore is used for verification.
32
-#   Defaults to 'True'.
36
+#   Defaults to 'true'.
33 37
 #
34 38
 # [*vsphere_ca_file*]
35 39
 #   (optional) The hash name of the CA bundle file and data in format of:
@@ -39,23 +43,24 @@
39 43
 #
40 44
 # [*network_maps*]
41 45
 #   (required) String. This is a name of DVS.
42
-#
43
-# [*neutron_url_timeout*]
44
-#   (required) String. This is the timeout for neutron.
46
+#   Defaults to 'physnet1:dvSwitch1'.
45 47
 #
46 48
 # [*use_fw_driver*]
47 49
 #   (optional) Boolean. Use firewall driver or mock.
50
+#   Defaults to true.
48 51
 #
49 52
 # [*py_root*]
50 53
 #   (optional) String. Path for python's dist-packages.
54
+#   Defaults to '/usr/lib/python2.7/dist-packages'
51 55
 #
52 56
 # [*ha_enabled*]
53 57
 #   (optional) Boolean. True for Corosync using.
58
+#   Defaults to true.
54 59
 #
55 60
 # [*primary*]
56 61
 #   (optional) Boolean. Parameter for using that cs_service.
57
-
58
-
62
+#   Defaults to false.
63
+#
59 64
 define vmware_dvs::agent(
60 65
   $host                = 'vcenter-servicename',
61 66
   $vsphere_hostname    = '192.168.0.1',
@@ -65,29 +70,25 @@ define vmware_dvs::agent(
65 70
   $vsphere_ca_file     = undef,
66 71
   $network_maps        = 'physnet1:dvSwitch1',
67 72
   $use_fw_driver       = true,
68
-  $neutron_url_timeout = '3600',
69 73
   $py_root             = '/usr/lib/python2.7/dist-packages',
70 74
   $ha_enabled          = true,
71 75
   $primary             = false,
72 76
 )
73 77
 {
74
-  $neutron_conf = '/etc/neutron/neutron.conf'
75
-  $ml2_conf     = '/etc/neutron/plugin.ini'
76
-  $ocf_dvs_name = 'ocf-neutron-dvs-agent'
77
-  $ocf_dvs_res  = "/usr/lib/ocf/resource.d/fuel/${ocf_dvs_name}"
78
-  $agent_config = "/etc/neutron/plugins/ml2/vmware_dvs-${host}.ini"
79
-  $agent_name   = "neutron-plugin-vmware-dvs-agent-${host}"
80
-  $agent_init   = "/etc/init/${agent_name}.conf"
81
-  $agent_initd  = "/etc/init.d/${agent_name}"
82
-  $agent_log    = "/var/log/neutron/vmware-dvs-agent-${host}.log"
83
-  $ocf_pid_dir  = '/var/run/resource-agents/ocf-neutron-dvs-agent'
84
-  $ocf_pid      = "${ocf_pid_dir}/${agent_name}.pid"
85
-
78
+  $neutron_conf        = '/etc/neutron/neutron.conf'
79
+  $ocf_dvs_name        = 'ocf-neutron-dvs-agent'
80
+  $ocf_dvs_res         = "/usr/lib/ocf/resource.d/fuel/${ocf_dvs_name}"
81
+  $agent_config        = "/etc/neutron/plugins/ml2/vmware_dvs-${host}.ini"
82
+  $agent_name          = "neutron-plugin-vmware-dvs-agent-${host}"
83
+  $agent_init          = "/etc/init/${agent_name}.conf"
84
+  $agent_initd         = "/etc/init.d/${agent_name}"
85
+  $agent_log           = "/var/log/neutron/vmware-dvs-agent-${host}.log"
86
+  $ocf_pid_dir         = '/var/run/resource-agents/ocf-neutron-dvs-agent'
87
+  $ocf_pid             = "${ocf_pid_dir}/${agent_name}.pid"
86 88
   $vcenter_ca_file     = pick($vsphere_ca_file, {})
87 89
   $vcenter_ca_content  = pick($vcenter_ca_file['content'], {})
88 90
   $vcenter_ca_filepath = "/etc/neutron/vmware-${host}-ca.pem"
89 91
 
90
-
91 92
   if $use_fw_driver {
92 93
     $fw_driver = 'networking_vsphere.agent.firewalls.vcenter_firewall.DVSFirewallDriver'
93 94
   }
@@ -95,11 +96,6 @@ define vmware_dvs::agent(
95 96
     $fw_driver = 'networking_vsphere.agent.firewalls.noop_firewall.NoopvCenterFirewallDriver'
96 97
   }
97 98
 
98
-
99
-  if ! defined(Nova_config['neutron/url_timeout']) {
100
-    nova_config {'neutron/url_timeout': value => $neutron_url_timeout}
101
-  }
102
-
103 99
   if ! defined(File["${py_root}/nova.patch"]) {
104 100
     file {"${py_root}/nova.patch":
105 101
       source => 'puppet:///modules/vmware_dvs/nova.patch',
@@ -169,7 +165,6 @@ define vmware_dvs::agent(
169 165
       'resource-stickiness' => '1'
170 166
     }
171 167
     $parameters         = {
172
-      'plugin_config'         => $ml2_conf,
173 168
       'additional_parameters' => "--config-file=${agent_config}",
174 169
       'log_file'              => $agent_log,
175 170
       'pid'                   => $ocf_pid,

+ 2
- 7
deployment_scripts/puppet/modules/vmware_dvs/manifests/compute.pp View File

@@ -34,8 +34,9 @@
34 34
 #
35 35
 # [*neutron_url_timeout*]
36 36
 #   (optional) String.
37
+#   Defaults to '3600'.
38
+#
37 39
 #
38
-
39 40
 class vmware_dvs::compute(
40 41
   $admin_password,
41 42
   $admin_tenant_name,
@@ -77,10 +78,4 @@ class vmware_dvs::compute(
77 78
   }
78 79
   Nova_config<| |> ~> Service['nova-compute']
79 80
 
80
-  if($::operatingsystem == 'Ubuntu') {
81
-    tweaks::ubuntu_service_override { 'nova-network':
82
-      package_name => 'nova-network',
83
-    }
84
-  }
85
-
86 81
 }

+ 0
- 51
deployment_scripts/puppet/modules/vmware_dvs/manifests/ha_nova_restart.pp View File

@@ -1,51 +0,0 @@
1
-#    Copyright 2016 Mirantis, Inc.
2
-#
3
-#    Licensed under the Apache License, Version 2.0 (the "License"); you may
4
-#    not use this file except in compliance with the License. You may obtain
5
-#    a copy of the License at
6
-#
7
-#         http://www.apache.org/licenses/LICENSE-2.0
8
-#
9
-#    Unless required by applicable law or agreed to in writing, software
10
-#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
-#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
-#    License for the specific language governing permissions and limitations
13
-#    under the License.
14
-
15
-define vmware_dvs::ha_nova_restart(
16
-  $availability_zone_name,
17
-  $vc_cluster,
18
-  $vc_host,
19
-  $vc_user,
20
-  $vc_password,
21
-  $service_name,
22
-  $current_node,
23
-  $target_node,
24
-  $role,
25
-  $datastore_regex    = undef,
26
-  $api_retry_count    = 5,
27
-  $maximum_objects    = 100,
28
-  $nova_compute_conf  = '/etc/nova/nova-compute.conf',
29
-  $task_poll_interval = 5.0,
30
-  $use_linked_clone   = true,
31
-  $wsdl_location      = undef,
32
-  $service_enabled    = false,
33
-)
34
-{
35
-  if $target_node =~ /controller/ and $role =~ /controller/ {
36
-
37
-    $res = "p_nova_compute_vmware_${availability_zone_name}-${service_name}"
38
-    exec {$res:
39
-      path    => '/usr/bin:/usr/sbin:/bin:/sbin',
40
-      command => "crm resource restart ${res}",
41
-    }
42
-  }
43
-
44
-  if $target_node in $current_node {
45
-    exec { 'nova-compute-restart':
46
-      path    => '/usr/bin:/usr/sbin:/bin:/sbin',
47
-      command => 'service nova-compute restart',
48
-    }
49
-  }
50
-
51
-}

+ 8
- 32
deployment_scripts/puppet/modules/vmware_dvs/manifests/init.pp View File

@@ -1,4 +1,4 @@
1
-#    Copyright 2015 Mirantis, Inc.
1
+#    Copyright 2016 Mirantis, Inc.
2 2
 #
3 3
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
4 4
 #    not use this file except in compliance with the License. You may obtain
@@ -11,36 +11,19 @@
11 11
 #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 12
 #    License for the specific language governing permissions and limitations
13 13
 #    under the License.
14
-
14
+#
15 15
 # == Class: ::vmware_dvs
16 16
 #
17
-# install the vmware_dvs neutron ml2 driver and configure the neutron for it
17
+# Install the vmware_dvs neutron ml2 driver and configure the neutron for it.
18 18
 #
19 19
 # === Parameters
20 20
 #
21
-# [*vsphere_hostname*]
22
-#   (required) String. This is a name or ip of VMware vSphere server.
23
-#
24
-# [*vsphere_login*]
25
-#   (required) String. This is a name of VMware vSphere user.
26
-#
27
-# [*vsphere_password*]
28
-#   (required) String. This is a password of VMware vSphere user.
29
-#
30
-# [*network_maps*]
31
-#   (required) String. This is a name of DVS.
32
-#
33
-# [*driver_path*]
34
-#   (required) String. This is the ml2 driver's path.
35
-#
36 21
 # [*plugin_path*]
37 22
 #   (required) String. This is the ml2 plugin's path.
38
-
23
+#   Defaults to 'neutron/cmd/eventlet/plugins/dvs_neutron_agent.py'.
24
+#
39 25
 class vmware_dvs(
40
-  $vsphere_hostname = '192.168.0.1',
41
-  $vsphere_login    = 'administrator@vsphere.loc',
42
-  $vsphere_password = 'StrongPassword!',
43
-  $plugin_path      = 'neutron/cmd/eventlet/plugins/dvs_neutron_agent.py',
26
+  $plugin_path = 'neutron/cmd/eventlet/plugins/dvs_neutron_agent.py',
44 27
 )
45 28
 {
46 29
   package { ['python-suds','python-networking-vsphere']:
@@ -55,16 +38,9 @@ class vmware_dvs(
55 38
     path   => $plugin_path,
56 39
     source => 'puppet:///modules/vmware_dvs/dvs_neutron_agent.py',
57 40
   }
41
+
58 42
   neutron_config {
59 43
     'oslo_messaging_notifications/driver': value => 'messagingv2';
60 44
   }
61
-  neutron_plugin_ml2 {
62
-    'ml2_vmware/vsphere_hostname': value => $vsphere_hostname;
63
-    'ml2_vmware/vsphere_login':    value => $vsphere_login;
64
-    'ml2_vmware/vsphere_password': value => $vsphere_password;
65
-  }
66
-  file {'/etc/neutron/plugin.ini':
67
-    ensure => 'link',
68
-    target => '/etc/neutron/plugins/ml2/ml2_conf.ini',
69
-  }
45
+
70 46
 }

+ 15
- 15
deployment_scripts/puppet/modules/vmware_dvs/manifests/l2.pp View File

@@ -19,9 +19,9 @@ class vmware_dvs::l2 {
19 19
     $primary_controller               = roles_include($neutron_primary_controller_roles)
20 20
     $compute                          = roles_include($neutron_compute_roles)
21 21
 
22
-    $neutron_config = hiera_hash('neutron_config')
22
+    $neutron_config        = hiera_hash('neutron_config')
23 23
     $neutron_server_enable = pick($neutron_config['neutron_server_enable'], true)
24
-    $neutron_nodes = hiera_hash('neutron_nodes')
24
+    $neutron_nodes         = hiera_hash('neutron_nodes')
25 25
 
26 26
     $dpdk_config = hiera_hash('dpdk', {})
27 27
     $enable_dpdk = pick($dpdk_config['enabled'], false)
@@ -45,10 +45,10 @@ class vmware_dvs::l2 {
45 45
     prepare_network_config($network_scheme)
46 46
 
47 47
     $neutron_advanced_config = hiera_hash('neutron_advanced_configuration', { })
48
-    $l2_population     = try_get_value($neutron_advanced_config, 'neutron_l2_pop', false)
49
-    $dvr               = try_get_value($neutron_advanced_config, 'neutron_dvr', false)
50
-    $enable_qos        = pick($neutron_advanced_config['neutron_qos'], false)
51
-    $segmentation_type = try_get_value($neutron_config, 'L2/segmentation_type')
48
+    $l2_population           = try_get_value($neutron_advanced_config, 'neutron_l2_pop', false)
49
+    $dvr                     = try_get_value($neutron_advanced_config, 'neutron_dvr', false)
50
+    $enable_qos              = pick($neutron_advanced_config['neutron_qos'], false)
51
+    $segmentation_type       = try_get_value($neutron_config, 'L2/segmentation_type')
52 52
 
53 53
     if $compute and ! $dvr {
54 54
       $do_floating = false
@@ -69,11 +69,11 @@ class vmware_dvs::l2 {
69 69
     })
70 70
 
71 71
     if $segmentation_type == 'vlan' {
72
-      $net_role_property    = 'neutron/private'
73
-      $iface                = get_network_role_property($net_role_property, 'phys_dev')
74
-      $enable_tunneling = false
75
-      $network_type = 'vlan'
76
-      $tunnel_types = []
72
+      $net_role_property = 'neutron/private'
73
+      $iface             = get_network_role_property($net_role_property, 'phys_dev')
74
+      $enable_tunneling  = false
75
+      $network_type      = 'vlan'
76
+      $tunnel_types      = []
77 77
     } else {
78 78
       $net_role_property = 'neutron/mesh'
79 79
       $tunneling_ip      = get_network_role_property($net_role_property, 'ipaddr')
@@ -81,11 +81,11 @@ class vmware_dvs::l2 {
81 81
       $physical_net_mtu  = pick(get_transformation_property('mtu', $iface[0]), '1500')
82 82
 
83 83
       if $segmentation_type == 'gre' {
84
-        $mtu_offset = '42'
84
+        $mtu_offset   = '42'
85 85
         $network_type = 'gre'
86 86
       } else {
87 87
         # vxlan is the default segmentation type for non-vlan cases
88
-        $mtu_offset = '50'
88
+        $mtu_offset   = '50'
89 89
         $network_type = 'vxlan'
90 90
       }
91 91
       $tunnel_types = [$network_type]
@@ -137,9 +137,9 @@ class vmware_dvs::l2 {
137 137
       }
138 138
 
139 139
       service { 'neutron-server':
140
+        ensure     => $service_ensure,
140 141
         name       => $::neutron::params::server_service,
141 142
         enable     => $neutron_server_enable,
142
-        ensure     => $service_ensure,
143 143
         hasstatus  => true,
144 144
         hasrestart => true,
145 145
         tag        => 'neutron-service',
@@ -174,8 +174,8 @@ class vmware_dvs::l2 {
174 174
 
175 175
     # Stub for upstream neutron manifests
176 176
     package { 'neutron':
177
-      name   => 'binutils',
178 177
       ensure => 'installed',
178
+      name   => 'binutils',
179 179
     }
180 180
 
181 181
   }

+ 0
- 43
deployment_scripts/puppet/modules/vmware_dvs/manifests/neutron_server.pp View File

@@ -1,43 +0,0 @@
1
-#    Copyright 2016 Mirantis, Inc.
2
-#
3
-#    Licensed under the Apache License, Version 2.0 (the "License"); you may
4
-#    not use this file except in compliance with the License. You may obtain
5
-#    a copy of the License at
6
-#
7
-#         http://www.apache.org/licenses/LICENSE-2.0
8
-#
9
-#    Unless required by applicable law or agreed to in writing, software
10
-#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
-#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
-#    License for the specific language governing permissions and limitations
13
-#    under the License.
14
-
15
-# === Parameters
16
-#
17
-# [*path*]
18
-#   (required) String. The path to the mech_vmware_dvs ml2 driver.
19
-#
20
-
21
-class vmware_dvs::neutron_server(
22
-  $path = 'filepath',
23
-)
24
-{
25
-  service { 'neutron-server':
26
-    ensure    => running,
27
-    enable    => true,
28
-    subscribe => File[$path],
29
-  }
30
-
31
-  file_line { 'neutron_timeout':
32
-    path  => '/etc/haproxy/conf.d/085-neutron.cfg',
33
-    line  => '  timeout server 1h',
34
-    after => 'listen neutron',
35
-  }
36
-
37
-  service {'haproxy':
38
-    ensure     => running,
39
-    hasrestart => true,
40
-    restart    => '/sbin/ip netns exec haproxy service haproxy reload',
41
-    subscribe  => File_Line['neutron_timeout'],
42
-  }
43
-}

+ 1
- 1
deployment_scripts/puppet/modules/vmware_dvs/templates/agent_config.erb View File

@@ -2,7 +2,7 @@
2 2
 host=<%= @host %>
3 3
 
4 4
 [securitygroup]
5
-enable_security_group = <%= @use_fw_driver %>
5
+enable_security_group=<%= @use_fw_driver %>
6 6
 firewall_driver=<%= @fw_driver %>
7 7
 
8 8
 [ml2_vmware]

+ 43
- 41
deployment_scripts/puppet/modules/vmware_dvs/templates/agent_init.d.erb View File

@@ -8,18 +8,18 @@
8 8
 # Default-Start:     2 3 4 5
9 9
 # Default-Stop:      0 1 6
10 10
 # Short-Description: Neutron VMware DVS Agent
11
-# Description:       Agent to use within neutron vmware dvs driver
11
+# Description:       Agent to use within Neutron VMware DVS driver
12 12
 ### END INIT INFO
13 13
 
14 14
 # Authors: Igor Gajsin <igajsin@mirantis.com>
15 15
 
16 16
 DESC="Openstack Neutron VMware DVS Plugin Agent"
17 17
 PROJECT_NAME=neutron
18
-NAME=${PROJECT_NAME}-vmware-dvs-agent
18
+NAME=<%= @agent_name %>
19 19
 CONFIG_FILE=<%= @agent_config %>
20 20
 
21 21
 DAEMON=/usr/bin/neutron-dvs-agent
22
-DAEMON_ARGS="--config-file=/etc/neutron/neutron.conf --config-file=/etc/neutron/plugins/ml2/ml2_conf.ini"
22
+DAEMON_ARGS="--config-file=/etc/neutron/neutron.conf"
23 23
 #!/bin/sh
24 24
 # The content after this line comes from openstack-pkg-tools
25 25
 # and has been automatically added to a .init.in script, which
@@ -41,7 +41,7 @@ fi
41 41
 if [ -z "${SYSTEM_USER}" ] ; then
42 42
 	SYSTEM_USER=${PROJECT_NAME}
43 43
 fi
44
-if [ -z "${SYSTEM_USER}" ] ; then
44
+if [ -z "${SYSTEM_GROUP}" ] ; then
45 45
 	SYSTEM_GROUP=${PROJECT_NAME}
46 46
 fi
47 47
 if [ "${SYSTEM_USER}" != "root" ] ; then
@@ -60,10 +60,10 @@ fi
60 60
 
61 61
 # If ran as root, create /var/lock/X, /var/run/X, /var/lib/X and /var/log/X as needed
62 62
 if [ `whoami` = "root" ] ; then
63
-	for i in lock run log lib ; do
64
-		mkdir -p /var/$i/${PROJECT_NAME}
65
-		chown ${SYSTEM_USER} /var/$i/${PROJECT_NAME}
66
-	done
63
+        for i in lock run log lib ; do
64
+		            mkdir -p /var/$i/${PROJECT_NAME}
65
+		            chown ${SYSTEM_USER} /var/$i/${PROJECT_NAME}
66
+	      done
67 67
 fi
68 68
 
69 69
 # This defines init_is_upstart which we use later on (+ more...)
@@ -73,7 +73,9 @@ fi
73 73
 [ -r /etc/default/openstack ] && . /etc/default/openstack
74 74
 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
75 75
 [ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog"
76
-[ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=$LOGFILE"
76
+if [ -z "${NO_OPENSTACK_LOGFILE_DAEMON_ARG}" ] ; then
77
+        [ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=$LOGFILE"
78
+fi
77 79
 
78 80
 do_start() {
79 81
 	start-stop-daemon --start --quiet --background ${STARTDAEMON_CHUID} --make-pidfile --pidfile ${PIDFILE} --chdir /var/lib/${PROJECT_NAME} --startas $DAEMON \
@@ -95,48 +97,48 @@ do_systemd_start() {
95 97
 
96 98
 case "$1" in
97 99
 start)
98
-	init_is_upstart > /dev/null 2>&1 && exit 1
99
-	log_daemon_msg "Starting $DESC" "$NAME"
100
-	do_start
101
-	case $? in
102
-		0|1) log_end_msg 0 ;;
103
-		2) log_end_msg 1 ;;
104
-	esac
100
+	      init_is_upstart > /dev/null 2>&1 && exit 1
101
+	      log_daemon_msg "Starting $DESC" "$NAME"
102
+	      do_start
103
+	      case $? in
104
+		            0|1) log_end_msg 0 ;;
105
+		            2) log_end_msg 1 ;;
106
+	      esac
105 107
 ;;
106 108
 stop)
107
-	init_is_upstart > /dev/null 2>&1 && exit 0
108
-	log_daemon_msg "Stopping $DESC" "$NAME"
109
-	do_stop
110
-	case $? in
111
-		0|1) log_end_msg 0 ;;
112
-		2) log_end_msg 1 ;;
113
-	esac
109
+	      init_is_upstart > /dev/null 2>&1 && exit 0
110
+	      log_daemon_msg "Stopping $DESC" "$NAME"
111
+	      do_stop
112
+	      case $? in
113
+		            0|1) log_end_msg 0 ;;
114
+		            2) log_end_msg 1 ;;
115
+	      esac
114 116
 ;;
115 117
 status)
116
-	status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
118
+	      status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
117 119
 ;;
118 120
 systemd-start)
119
-	do_systemd_start
121
+	      do_systemd_start
120 122
 ;;
121 123
 restart|force-reload)
122
-	init_is_upstart > /dev/null 2>&1 && exit 1
123
-	log_daemon_msg "Restarting $DESC" "$NAME"
124
-	do_stop
125
-	case $? in
126
-	0|1)
127
-		do_start
128
-		case $? in
129
-			0) log_end_msg 0 ;;
130
-			1) log_end_msg 1 ;; # Old process is still running
131
-			*) log_end_msg 1 ;; # Failed to start
132
-		esac
133
-	;;
134
-	*) log_end_msg 1 ;; # Failed to stop
135
-	esac
124
+	      init_is_upstart > /dev/null 2>&1 && exit 1
125
+	      log_daemon_msg "Restarting $DESC" "$NAME"
126
+	      do_stop
127
+	      case $? in
128
+	      0|1)
129
+		            do_start
130
+		            case $? in
131
+			                  0) log_end_msg 0 ;;
132
+			                  1) log_end_msg 1 ;; # Old process is still running
133
+			                  *) log_end_msg 1 ;; # Failed to start
134
+		            esac
135
+	      ;;
136
+	      *) log_end_msg 1 ;; # Failed to stop
137
+	      esac
136 138
 ;;
137 139
 *)
138
-	echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload|systemd-start}" >&2
139
-	exit 3
140
+	      echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload|systemd-start}" >&2
141
+	      exit 3
140 142
 ;;
141 143
 esac
142 144
 

+ 24
- 23
deployment_scripts/puppet/modules/vmware_dvs/templates/agent_init.erb View File

@@ -1,8 +1,8 @@
1
-description "Neutron vmware dvs plugin agent"
1
+description "Neutron VMware DVS plugin agent"
2 2
 author "Igor Gajsin <igajsin@mirantis.com>"
3 3
 
4 4
 start on runlevel [2345]
5
-stop on runlevel [016]
5
+stop on runlevel [!2345]
6 6
 
7 7
 chdir /var/run
8 8
 
@@ -11,32 +11,33 @@ respawn limit 20 5
11 11
 limit nofile 65535 65535
12 12
 
13 13
 pre-start script
14
-        mkdir -p /var/run/neutron
15
-        chown neutron:root /var/run/neutron
14
+        for i in lock run log lib ; do
15
+                mkdir -p /var/$i/neutron
16
+                chown neutron /var/$i/neutron
17
+        done
16 18
 end script
17 19
 
18 20
 script
19
-        [ -r /usr/share/neutron-common/plugin_guess_func ] || exit 0
20
-        . /usr/share/neutron-common/plugin_guess_func
21
-
22
-        if ! [ -r /etc/neutron/neutron.conf ] ; then
23
-                echo "Cloud not read /etc/neutron/neutron.conf: exiting"
24
-                exit 0
25
-        fi
26
-        CURRENT_PLUGIN=`grep "^[ \t]*core_plugin[ \t]*=[ \t]*[._a-zA-Z0-9]*\$" /etc/neutron/neutron.conf | sed -e 's/^[ \t]*core_plugin[ \t]*=[ \t]*//'`
27
-        if [ -z "${CURRENT_PLUGIN}" ] ; then
28
-                echo "No core_plugin= value found: please set it and try again"
29
-                exit 0
30
-        fi
31
-
32
-        neutron_core_plugin_to_plugin_name ${CURRENT_PLUGIN}
33
-        neutron_plugin_ini_path ${NEUTRON_PLUGIN_NAME}
34
-        [ -r "$NEUTRON_PLUGIN_CONFIG" ] && CONF_ARG="--config-file $NEUTRON_PLUGIN_CONFIG --config-file <%= @agent_config %>"
21
+        [ -x "/usr/bin/neutron-dvs-agent" ] || {
22
+          echo "$UPSTART_JOB" "ERROR: /usr/bin/neutron-dvs-agent not exists : exiting";
23
+          exit 0;
24
+        }
25
+        [ -r /etc/neutron/neutron.conf ] || {
26
+          echo "$UPSTART_JOB" "ERROR: Cloud not read /etc/neutron/neutron.conf: exiting";
27
+          exit 0;
28
+        }
29
+        DAEMON_ARGS="--config-file=/etc/neutron/neutron.conf"
30
+        CONFIG_FILE="<%= @agent_config %>"
31
+        USE_SYSLOG=""
32
+        USE_LOGFILE=""
33
+        NO_OPENSTACK_CONFIG_FILE_DAEMON_ARG=""
35 34
         [ -r /etc/default/openstack ] && . /etc/default/openstack
36 35
         [ -r /etc/default/$UPSTART_JOB ] && . /etc/default/$UPSTART_JOB
37
-
38 36
         [ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog"
39 37
         [ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=<%= @agent_log %>"
40
-        exec start-stop-daemon --start --chuid neutron:neutron --exec /usr/bin/neutron-dvs-agent -- \
41
-                --config-file=/etc/neutron/neutron.conf $CONF_ARG $DAEMON_ARGS
38
+        [ -z "$NO_OPENSTACK_CONFIG_FILE_DAEMON_ARG" ] && DAEMON_ARGS="$DAEMON_ARGS --config-file=$CONFIG_FILE"
39
+
40
+        exec start-stop-daemon --start --chdir /var/lib/neutron \
41
+                --chuid neutron:neutron --make-pidfile --pidfile /var/run/neutron/$UPSTART_JOB.pid \
42
+                --exec /usr/bin/neutron-dvs-agent -- ${DAEMON_ARGS}
42 43
 end script

+ 1
- 1
deployment_tasks.yaml View File

@@ -44,7 +44,7 @@
44 44
 - id: vmware-dvs-set-neutron-timeout
45 45
   version: 2.1.0
46 46
   groups: ['primary-controller','controller']
47
-  required_for: [deploy_end]
47
+  required_for: [vmware-vcenter]
48 48
   requires: [openstack-network-server-nova]
49 49
   type: puppet
50 50
   parameters:

Loading…
Cancel
Save