Browse Source

Merge "add multiple uplinks support"

Jenkins 2 years ago
parent
commit
59cf082060

+ 13
- 4
deployment_scripts/puppet/modules/vmware_dvs/lib/puppet/parser/functions/get_agents_data.rb View File

@@ -7,7 +7,7 @@
7 7
     raise(Puppet::ParseError, 'Shoud have 5 arguments!') if args.size < 4 or args[0] == ""
8 8
     vcenter = args[0]['computes']
9 9
     physnet = args[1]["predefined_networks"]["admin_internal_net"]["L2"]["physnet"]
10
-    netmaps = args[2]["vmware_dvs_net_maps"].delete(' ')
10
+    netmaps = args[2]["vmware_dvs_net_maps"].delete(' ').split("\n")
11 11
     use_fw_driver = args[2]["vmware_dvs_fw_driver"]
12 12
     current_node = args[3].split(".")[0]
13 13
     controllersp = args[4].any? {|role| role.include?("controller")}
@@ -23,12 +23,21 @@
23 23
         agent["vsphere_insecure"] = vc["vc_insecure"]
24 24
         agent["vsphere_ca_file"] = vc["vc_ca_file"]
25 25
         cluster = vc["vc_cluster"]
26
-        if netmaps.include? ':'
27
-          vds = netmaps.split(";").collect{|k| k.split(":")}.select{|x| x[0] == cluster}.collect{|x| x[1]}[0]
26
+        netmaps = netmaps.keep_if {|s| s =~ /^#{cluster}/}.first.split(":")
27
+        if netmaps.length == 4
28
+          vds = netmaps[1]
29
+          uplinks = netmaps[2] + ":" + netmaps[3]
30
+        elsif netmaps.length == 3
31
+          vds = netmaps[1]
32
+          uplinks = netmaps[2]
33
+        elsif netmaps.length == 2
34
+          vds = netmaps[1]
35
+          uplinks = false
28 36
         else
29
-          vds = netmaps
37
+          raise 'Wrong vmware_dvs_net_maps'
30 38
         end
31 39
         agent["network_maps"] = physnet + ":" + vds
40
+        agent["uplink_maps"] =  physnet + ":" + uplinks if uplinks
32 41
         agent["use_fw_driver"] = use_fw_driver
33 42
         agent["ha_enabled"] = controllersp
34 43
         agent["primary"] = primaryp

+ 5
- 0
deployment_scripts/puppet/modules/vmware_dvs/manifests/agent.pp View File

@@ -45,6 +45,10 @@
45 45
 #   (required) String. This is a name of DVS.
46 46
 #   Defaults to 'physnet1:dvSwitch1'.
47 47
 #
48
+# [*uplink_maps*]
49
+#   (required) String. This is a string that explains uplinks usage policy.
50
+#   Defaults to undef.
51
+#
48 52
 # [*use_fw_driver*]
49 53
 #   (optional) Boolean. Use firewall driver or mock.
50 54
 #   Defaults to true.
@@ -69,6 +73,7 @@ define vmware_dvs::agent(
69 73
   $vsphere_insecure    = true,
70 74
   $vsphere_ca_file     = undef,
71 75
   $network_maps        = 'physnet1:dvSwitch1',
76
+  $uplink_maps         = undef,
72 77
   $use_fw_driver       = true,
73 78
   $py_root             = '/usr/lib/python2.7/dist-packages',
74 79
   $ha_enabled          = true,

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

@@ -7,9 +7,12 @@ firewall_driver=<%= @fw_driver %>
7 7
 
8 8
 [ml2_vmware]
9 9
 vsphere_login=<%= @vsphere_login %>
10
-network_maps=<%= @network_maps %>
11 10
 vsphere_hostname=<%= @vsphere_hostname %>
12 11
 vsphere_password=<%= @vsphere_password %>
12
+network_maps=<%= @network_maps %>
13
+<% if @uplink_maps -%>
14
+uplink_maps=<%= @uplink_maps%>
15
+<% end -%>
13 16
 insecure=<%= @agent_vcenter_insecure_real %>
14 17
 <% if @agent_vcenter_ca_filepath and @agent_vcenter_ca_filepath \
15 18
   != "<SERVICE DEFAULT>" and !@agent_vcenter_ca_filepath.empty? -%>

+ 2
- 2
environment_config.yaml View File

@@ -15,9 +15,9 @@ attributes:
15 15
   vmware_dvs_net_maps:
16 16
     value: ""
17 17
     label: "Enter the Cluster to dvSwitch mapping."
18
-    description: "List of ClusterName:dvSwitchName pairs, separated by semicolon."
18
+    description: "List of strings with format ClusterName:dvSwitchName:TeamingUplink1;TeamingUplink2:FallbackUplink1;FallbackUplink2."
19 19
     weight: 25
20
-    type: "text"
20
+    type: "textarea"
21 21
     regex:
22 22
       source: &non_empty_string '\S'
23 23
       error: "Empty name of dvSwitch"

Loading…
Cancel
Save