Browse Source

Fixed bug: Network issue while deploying OpenStack nodes.

Change-Id: I6775ca64f8f55890543f1380d11b6579ba1cc0e2
yaduvanshidinesh 2 years ago
parent
commit
042cc51940

+ 39
- 18
deployment_scripts/puppet/modules/nitrous/manifests/init.pp View File

@@ -50,8 +50,6 @@ class nitrous {
50 50
   $opsvm_pool_type = $hiera_values['selective_opsvm_pool']
51 51
 
52 52
   $kvm_hosts = opsvm_filter($ops_vms_array, $kvm_hostname, br-fw-admin, br-mgmt)
53
-  $vlan_tag = split($stg_nm, '\.')
54
-  $vlan_id = $::nitrous::vlan_tag[1]
55 53
   $nic_bond = pick($network_scheme['transformations'])
56 54
   $mgmt = $nic_bond[6]
57 55
   $mgmt_brg = pick($mgmt['bridge'])
@@ -62,7 +60,9 @@ class nitrous {
62 60
   $prv = $nic_bond[8]
63 61
   $prv_brg = pick($prv['bridge'])
64 62
   $prv_nm = pick($prv['name'])
65
-
63
+  $vlan_tag = split($prv_nm, '\.')
64
+  $vlan_id = $::nitrous::vlan_tag[1]
65
+  
66 66
   if !($proxy_line == 'undef') {
67 67
     file_line { 'env_proxy':
68 68
       ensure  => 'present',
@@ -73,7 +73,7 @@ class nitrous {
73 73
 
74 74
   exec { "src_bash":
75 75
     command => "bash -c 'source $env_conf'",
76
-    path    => '/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin',
76
+    path    => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games',
77 77
   }
78 78
 
79 79
   file_line { 'agent_conf' :
@@ -92,23 +92,44 @@ class nitrous {
92 92
   }
93 93
 
94 94
   if !($vlan_id == '') {
95
-    file { '/usr/local/bin/rm_vlan.sh':
96
-      ensure  => 'present',
97
-      owner   => 'root',
98
-      group   => 'root',
99
-      mode    => '0766',
100
-      content => template('nitrous/vlan.erb'),
95
+    exec { 'add_brg':
96
+      command => "brctl addif br-mgmt bond0",
97
+      path    => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games',
101 98
     }
102
-   exec { 'remove_vlan':
103
-     command => '/usr/local/bin/rm_vlan.sh',
104
-     path    => '/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin',
105
-   } 
106
-   exec { 'add_brg':
107
-     command => "brctl addif br-mgmt bond0",
108
-     path    => '/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin',
109
-   } 
110 99
   }
111 100
 
101
+  define rm_br::rm_int( $brg, $nm){
102
+    if !($::nitrous::vlan_id == '') {
103
+      exec { "brctl delif $brg $nm && sleep 3":
104
+        onlyif    => "brctl show $brg | grep -F $nm",
105
+        path      => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games',
106
+        logoutput => true,
107
+      }->
108
+      exec { "vconfig rem $nm && sleep 3":
109
+        onlyif    => "ip addr show | grep -F $nm",
110
+        path      => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games',
111
+        logoutput => true,
112
+      }
113
+    }
114
+  }
115
+
116
+  $br_int ={
117
+    'mgmt' =>{
118
+     brg => "$mgmt_brg",
119
+     nm => "$mgmt_nm",
120
+    },
121
+    'stg' =>{
122
+      brg => "$stg_brg",
123
+      nm => "$stg_nm",
124
+    },
125
+    'prv' =>{
126
+      brg => "$prv_brg",
127
+      nm => "$prv_nm",
128
+    },
129
+  }
130
+ 
131
+  create_resources(rm_br::rm_int, $br_int)
132
+
112 133
   file { '/usr/bin/opsvm':
113 134
     ensure  => 'present',
114 135
     owner   => 'root',

+ 0
- 40
deployment_scripts/puppet/modules/nitrous/templates/vlan.erb View File

@@ -1,40 +0,0 @@
1
-#!/bin/sh
2
-#
3
-# Copyright (c) 2016 AT&T Inc.
4
-#
5
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
6
-# not use this file except in compliance with the License. You may obtain
7
-# a copy of the License at
8
-#
9
-# http://www.apache.org/licenses/LICENSE-2.0
10
-#
11
-# Unless required by applicable law or agreed to in writing, software
12
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
-# License for the specific language governing permissions and limitations
15
-# under the License.
16
-
17
-brctl delif <%= @mgmt_brg %> <%= @mgmt_nm %>
18
-if [ $? == 0 ]; then
19
-echo "Deleted <%= @mgmt_nm %>" > /var/log/nitrous-vlan.log
20
-vconfig rem <%= @mgmt_nm %>
21
- if [ $? == 0 ]; then
22
-   echo "Removed <%= @mgmt_nm %>" >> /var/log/nitrous-vlan.log
23
- fi
24
-fi
25
-brctl delif <%= @stg_brg %>  <%= @stg_nm %>
26
-if [ $? == 0 ]; then
27
-echo "Deleted <%= @stg_nm %>" >> /var/log/nitrous-vlan.log
28
-vconfig rem <%= @stg_nm %>
29
- if [ $? == 0 ]; then
30
-   echo "Removed <%= @stg_nm %>" >> /var/log/nitrous-vlan.log
31
- fi
32
-fi
33
-brctl delif <%= @prv_brg %> <%= @prv_nm %>
34
-if [ $? == 0 ]; then
35
-echo "Deleted <%= @prv_nm %>" >> /var/log/nitrous-vlan.log
36
-vconfig rem <%= @prv_nm %>
37
-if [ $? == 0 ]; then
38
-   echo "Removed <%= @prv_nm %>" >> /var/log/nitrous-vlan.log
39
- fi
40
-fi

Loading…
Cancel
Save