summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Gajsin <igajsin@mirantis.com>2016-09-20 15:35:08 +0300
committerIgor Gajsin <igajsin@mirantis.com>2016-09-20 15:35:08 +0300
commitb19b88653d74423e2ef6f31c7149cdeb8f0f44c6 (patch)
treebfab54dc00e772d6b5af7090b06599f56627a331
parent337e8b8b6f273fb5782630fab657b5b557c49e8a (diff)
Fix the bug that prevent assign 2 Cluster to one controller
In some cases Ruby uses pointer instead of copying something for optimization. But it allows to side effects. It was cause of that bug. After cloning one variable by var.dup the problem was fixed. Change-Id: Ide58c184f4cb9b655e11a13afb8c05bfc5149ab9 Closes-bug: #1625092
Notes
Notes (review): Code-Review+2: Igor Gajsin <igajsin@mirantis.com> Workflow+1: Igor Gajsin <igajsin@mirantis.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Tue, 20 Sep 2016 12:43:00 +0000 Reviewed-on: https://review.openstack.org/373253 Project: openstack/fuel-plugin-vmware-dvs Branch: refs/heads/master
-rw-r--r--deployment_scripts/puppet/modules/vmware_dvs/lib/puppet/parser/functions/get_agents_data.rb21
1 files changed, 9 insertions, 12 deletions
diff --git a/deployment_scripts/puppet/modules/vmware_dvs/lib/puppet/parser/functions/get_agents_data.rb b/deployment_scripts/puppet/modules/vmware_dvs/lib/puppet/parser/functions/get_agents_data.rb
index 59a1d3e..376877b 100644
--- a/deployment_scripts/puppet/modules/vmware_dvs/lib/puppet/parser/functions/get_agents_data.rb
+++ b/deployment_scripts/puppet/modules/vmware_dvs/lib/puppet/parser/functions/get_agents_data.rb
@@ -13,9 +13,11 @@
13 controllersp = args[4].any? {|role| role.include?("controller")} 13 controllersp = args[4].any? {|role| role.include?("controller")}
14 primaryp = args[4].any? {|role| role.include?("primary")} 14 primaryp = args[4].any? {|role| role.include?("primary")}
15 agents = [] 15 agents = []
16
16 vcenter.each {|vc| 17 vcenter.each {|vc|
17 if (vc["target_node"] == "controllers" and controllersp) or current_node == vc["target_node"] 18 if (vc["target_node"] == "controllers" and controllersp) or current_node == vc["target_node"]
18 agent = {} 19 agent = {}
20 ns = netmaps.dup
19 agent["host"] = vc["availability_zone_name"] + "-" + vc["service_name"] 21 agent["host"] = vc["availability_zone_name"] + "-" + vc["service_name"]
20 agent["vsphere_hostname"] = vc["vc_host"] 22 agent["vsphere_hostname"] = vc["vc_host"]
21 agent["vsphere_login"] = vc["vc_user"] 23 agent["vsphere_login"] = vc["vc_user"]
@@ -23,18 +25,13 @@
23 agent["vsphere_insecure"] = vc["vc_insecure"] 25 agent["vsphere_insecure"] = vc["vc_insecure"]
24 agent["vsphere_ca_file"] = vc["vc_ca_file"] 26 agent["vsphere_ca_file"] = vc["vc_ca_file"]
25 cluster = vc["vc_cluster"] 27 cluster = vc["vc_cluster"]
26 netmaps = netmaps.keep_if {|s| s =~ /^#{cluster}/}.first.split(":") 28 ns = ns.keep_if {|s| s =~ /^#{cluster}/}.first.split(":")
27 if netmaps.length == 4 29 vds = ns[1]
28 vds = netmaps[1] 30 uplinks = false
29 uplinks = netmaps[2] + ":" + netmaps[3] 31 if ns.length == 4
30 elsif netmaps.length == 3 32 uplinks = ns[2] + ":" + ns[3]
31 vds = netmaps[1] 33 elsif ns.length == 3
32 uplinks = netmaps[2] 34 uplinks = ns[2]
33 elsif netmaps.length == 2
34 vds = netmaps[1]
35 uplinks = false
36 else
37 raise 'Wrong vmware_dvs_net_maps'
38 end 35 end
39 agent["network_maps"] = physnet + ":" + vds 36 agent["network_maps"] = physnet + ":" + vds
40 agent["uplink_maps"] = physnet + ":" + uplinks if uplinks 37 agent["uplink_maps"] = physnet + ":" + uplinks if uplinks