Browse Source

Actual fixtures for VMware and up generate script

- provide actual yaml fixtures for VMware (iso 352)
- add VMware case for generate_yamls.sh
- fix admin_net_tpl, list_free_nodes, save_yamls,
  clean_env functions

Change-Id: I7202b964beceae148a853c1c055dea6b259a3f69
Partial-Bug: 1541849
Related-Bug: 1535339
Alexander Arzhanov 2 years ago
parent
commit
3b9b77cdce

+ 2733
- 0
hiera/neut_vlan.vmware.cinder-vmware.compute-vmware-cinder-vmware.yaml
File diff suppressed because it is too large
View File


+ 2733
- 0
hiera/neut_vlan.vmware.cinder-vmware.compute-vmware-compute-vmware.yaml
File diff suppressed because it is too large
View File


+ 2898
- 0
hiera/neut_vlan.vmware.cinder-vmware.compute-vmware-primary-controller.yaml
File diff suppressed because it is too large
View File


+ 2786
- 0
hiera/neut_vlan.vmware.glance-primary-controller.yaml
File diff suppressed because it is too large
View File


+ 92
- 7
utils/generate_yamls.sh View File

@@ -6,7 +6,7 @@
6 6
 
7 7
 CWD=$(cd `dirname $0` && pwd -P)
8 8
 
9
-mkdir ./yamls
9
+mkdir -p ./yamls
10 10
 rm -f ./yamls/*
11 11
 
12 12
 function generate_fake_nodes_fixtures {
@@ -54,7 +54,6 @@ function enable_ceph {
54 54
   attr["editable"]["storage"]["auth_s3_keystone_ceph"]["value"] = true
55 55
   File.open(ARGV[0], "w").write(attr.to_yaml)' "cluster_$1/attributes.yaml"
56 56
   fuel env --attributes --env $1 --upload
57
-  rm -rf "cluster_$1"
58 57
 }
59 58
 
60 59
 function enable_cblock {
@@ -64,7 +63,6 @@ function enable_cblock {
64 63
   attr["editable"]["storage"]["volumes_block_device"]["value"] = true
65 64
   File.open(ARGV[0], "w").write(attr.to_yaml)' "cluster_$1/attributes.yaml"
66 65
   fuel env --attributes --env $1 --upload
67
-  rm -rf "cluster_$1"
68 66
 }
69 67
 
70 68
 function enable_murano_sahara_ceilometer {
@@ -105,6 +103,74 @@ function enable_neutron_dvr {
105 103
   fuel env --attributes --env $1 --upload
106 104
 }
107 105
 
106
+function enable_vcenter {
107
+  fuel env --attributes --env $1 --download
108
+  ruby -ryaml -e '
109
+  attr = YAML.load(File.read(ARGV[0]))
110
+  attr["editable"]["common"]["use_vcenter"]["value"] = true
111
+  File.open(ARGV[0], "w").write(attr.to_yaml)' "cluster_$1/attributes.yaml"
112
+  fuel env --attributes --env $1 --upload
113
+}
114
+
115
+function enable_vcenter_glance {
116
+  fuel env --attributes --env $1 --download
117
+  ruby -ryaml -e '
118
+  attr = YAML.load(File.read(ARGV[0]))
119
+  attr["editable"]["storage"]["images_vcenter"]["value"] = true
120
+  File.open(ARGV[0], "w").write(attr.to_yaml)' "cluster_$1/attributes.yaml"
121
+  fuel env --attributes --env $1 --upload
122
+}
123
+
124
+function vmware_settings {
125
+  compute_vmware=$2
126
+  fuel --env $1 vmware-settings --download
127
+  ruby -ryaml -e '
128
+  vmware = YAML.load(File.read(ARGV[0]))
129
+  vcenter_cred = {
130
+    "vcenter_host"=>"172.16.0.254", "vcenter_password"=>"Qwer!1234",
131
+    "vcenter_username"=>"administrator@vsphere.local"
132
+  }
133
+  vmware["editable"]["value"]["availability_zones"][0].merge! vcenter_cred
134
+  File.open(ARGV[0], "w").write(vmware.to_yaml)' "vmware_settings_$1.yaml"
135
+  if [ "$compute_vmware" = "compute-vmware" ]; then
136
+    env_id=`envid $1`
137
+    node_id=$(list_free_nodes | sed -n '1p')
138
+    fuel --env $env_id node set --node $node_id --role compute-vmware
139
+    ruby -ryaml -e '
140
+    $compute_vmware_node = ARGV[1]
141
+    puts $compute_vmware_node
142
+    vmware = YAML.load(File.read(ARGV[0]))
143
+    vmware_computes = {
144
+      "datastore_regex"=>".*", "service_name"=>"vm_cluster1",
145
+      "target_node"=>{"current"=>{"id"=>$compute_vmware_node,
146
+      "label"=>$compute_vmware_node}, "options"=>[{"id"=>"controllers",
147
+      "label"=>"controllers"}, {"id"=>$compute_vmware_node,
148
+      "label"=>$compute_vmware_node}]}, "vsphere_cluster"=>"Cluster1"
149
+      }
150
+    vmware["editable"]["value"]["availability_zones"][0]["nova_computes"][0].merge! vmware_computes
151
+    File.open(ARGV[0], "w").write(vmware.to_yaml)' "vmware_settings_$1.yaml" "node-$node_id"
152
+  else
153
+    ruby -ryaml -e '
154
+    vmware = YAML.load(File.read(ARGV[0]))
155
+    vmware_computes = {
156
+      "datastore_regex"=>".*", "service_name"=>"vm_cluster1",
157
+      "target_node"=>{"current"=>{"id"=>"controllers",
158
+      "label"=>"controllers"}, "options"=>[{"id"=>"controllers",
159
+      "label"=>"controllers"}]}, "vsphere_cluster"=>"Cluster1"
160
+      }
161
+     vmware_glance = {
162
+      "ca_file"=>{"content"=>"RSA", "name"=>"vcenter-ca.pem"},
163
+      "datacenter"=>"Datacenter", "datastore"=>"nfs",
164
+      "vcenter_host"=>"172.16.0.254", "vcenter_password"=>"Qwer!1234",
165
+      "vcenter_username"=>"administrator@vsphere.local"
166
+      }
167
+    vmware["editable"]["value"]["availability_zones"][0]["nova_computes"][0].merge! vmware_computes
168
+    vmware["editable"]["value"]["glance"].merge! vmware_glance
169
+    File.open(ARGV[0], "w").write(vmware.to_yaml)' "vmware_settings_$1.yaml"
170
+  fi
171
+    fuel --env $1 vmware-settings --upload
172
+}
173
+
108 174
 function enable_nova_quota {
109 175
   fuel env --attributes --env $1 --download
110 176
   ruby -ryaml -e '
@@ -141,8 +207,8 @@ function list_free_nodes {
141 207
 }
142 208
 
143 209
 function save_yamls {
144
-  envid=`fuel env | grep $1 | awk '{print $1}'`
145
-  fuel deployment --default --env $envid 2>/dev/null
210
+  env=`envid $1`
211
+  fuel deployment --default --env $env 2>/dev/null
146 212
 }
147 213
 
148 214
 function envid {
@@ -196,6 +262,15 @@ function generate_yamls {
196 262
   if [ "${name/dvr}" != "$name" ] ; then
197 263
     enable_neutron_dvr $env
198 264
   fi
265
+  if [ "${name/vmware.glance}" != "$name" ] ; then
266
+    enable_vcenter $env
267
+    enable_vcenter_glance $env
268
+    vmware_settings $env
269
+  fi
270
+  if [ "${name/vmware.cinder-vmware.compute-vmware}" != "$name" ] ; then
271
+    enable_vcenter $env
272
+    vmware_settings $env compute-vmware
273
+  fi
199 274
   if [ "${name/public_ssl}" != "$name" ] ; then
200 275
     enable_public_ssl $env
201 276
   fi
@@ -236,8 +311,9 @@ function clean_env {
236 311
     fuel env --delete --env $env
237 312
     rm -rf "cluster_$env"
238 313
     rm -rf "deployment_$env"
314
+    rm -rf "vmware_settings_$env.yaml"
239 315
     rm -f network_${env}.yaml
240
-    sleep 80
316
+    sleep 60
241 317
   fi
242 318
   clean_fake_nodes
243 319
 }
@@ -245,7 +321,6 @@ function clean_env {
245 321
 function add_nodegroup {
246 322
   env=`envid $1`
247 323
   name=$2
248
-
249 324
   fuel --env $env nodegroup --create --name $name
250 325
 }
251 326
 
@@ -281,6 +356,16 @@ fuel env --create --name test_neutron_vlan --rel 2 --net vlan
281 356
 generate_yamls 'test_neutron_vlan' 'neut_vlan.dvr' 'controller controller controller' 'primary-controller'
282 357
 clean_env 'test_neutron_vlan'
283 358
 
359
+# Neutron vlan VMware vCenter + VMware Glance
360
+fuel env --create --name test_neutron_vlan --rel 2 --net vlan
361
+generate_yamls 'test_neutron_vlan' 'neut_vlan.vmware.glance' 'controller controller controller' 'primary-controller'
362
+clean_env 'test_neutron_vlan'
363
+
364
+# Neutron vlan VMware vCenter + cinder-vmware + compute-vmware
365
+fuel env --create --name test_neutron_vlan --rel 2 --net vlan
366
+generate_yamls 'test_neutron_vlan' 'neut_vlan.vmware.cinder-vmware.compute-vmware' 'controller controller controller cinder-vmware' 'primary-controller compute-vmware cinder-vmware'
367
+clean_env 'test_neutron_vlan'
368
+
284 369
 # Neutron tun addons + ceph
285 370
 fuel env --create --name test_neutron_tun --rel 2 --net tun
286 371
 generate_yamls 'test_neutron_tun' 'neut_tun.ceph.murano.sahara.ceil' 'controller controller compute ceph-osd ceph-osd mongo mongo' 'primary-controller controller compute ceph-osd primary-mongo mongo'

Loading…
Cancel
Save