clc-chef-metal-vsphere 0.3.32 → 0.3.33

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd00184db58d16015203e91e92cd82447b24aa63
4
- data.tar.gz: bbee8ee23bad1d04376dec8cc403db3dee9de282
3
+ metadata.gz: c386928597c16e1c09da241aaf74e2df8957da24
4
+ data.tar.gz: 9b0051985272d8b4852ce3f3b9b2ea62350621d2
5
5
  SHA512:
6
- metadata.gz: 7318e5f4c4337a04ebe0984549c1acc21a9601db4ece5f81d68d3d6abcb05d851a3febd30e3ea93ddb296e1ecd852fd63402b4be4ccb1e5bfde2a61df05cd7eb
7
- data.tar.gz: 9674cd6581201e306b7d77dab530dc9c445260c71a7d7ed4fd14922c4c9c997bc007d087a2a5589c4313a21afe72473e4f20d52858f403be051f3b4a74cb4b03
6
+ metadata.gz: 1458e0af757009ed5e225294612f15457cdd8377b3319cd71738e175b64aacda93f3874e7868ff7aaba7513d81fd7f94187a21357546f8bf7092524655e68f56
7
+ data.tar.gz: 1f31bfe97a2fc544db9efad7934fb13d6960a363f98e8161588c3ecede4a0d1e933f1b4e47ae587aec6d3f5df6deec99580918c78223fb89522cb2ea5a940f57
@@ -1,3 +1,3 @@
1
1
  module ChefMetalVsphere
2
- VERSION = '0.3.32'
2
+ VERSION = '0.3.33'
3
3
  end
@@ -201,12 +201,12 @@ module ChefMetalVsphere
201
201
  bootstrap_options = bootstrap_options_for(machine_spec, machine_options)
202
202
 
203
203
  transport = nil
204
- if !ip_for(bootstrap_options, vm).nil?
205
- vm_ip = ip_for(bootstrap_options, vm)
204
+ vm_ip = ip_for(bootstrap_options, vm)
205
+ if !vm_ip.nil?
206
206
  transport = transport_for(machine_spec, machine_options, vm)
207
207
  end
208
208
 
209
- if transport.nil? || !transport.available?
209
+ if transport.nil? || !transport.available? || !(vm.guest.net.map { |net| net.ipAddress}.flatten).include?(vm_ip)
210
210
  action_handler.report_progress "waiting up to #{machine_options[:ready_timeout]} seconds for customizations to complete and find #{vm_ip}"
211
211
  now = Time.now.utc
212
212
 
@@ -231,6 +231,18 @@ module ChefMetalVsphere
231
231
  action_handler.report_progress "IP address obtained: #{vm.guest.ipAddress}"
232
232
  end
233
233
 
234
+ domain = bootstrap_options[:customization_spec][:domain]
235
+ if vm.config.guestId.start_with?('win') && domain != 'local'
236
+ now = Time.now.utc
237
+ trimmed_name = machine_spec.name.byteslice(0,15)
238
+ expected_name="#{trimmed_name}.#{domain}"
239
+ action_handler.report_progress "waiting to domain join and be named expected_name"
240
+ until (Time.now.utc - now) > 30 || (vm.guest.hostName == expected_name) do
241
+ print "."
242
+ sleep 5
243
+ end
244
+ end
245
+
234
246
  begin
235
247
  wait_for_transport(action_handler, machine_spec, machine_options, vm)
236
248
  rescue Timeout::Error
@@ -251,6 +263,8 @@ module ChefMetalVsphere
251
263
  setup_ubuntu_dns(machine, bootstrap_options, machine_spec)
252
264
  end
253
265
 
266
+ add_extra_nic(action_handler, vm_template_for(bootstrap_options), bootstrap_options, vm)
267
+
254
268
  machine
255
269
  end
256
270
 
@@ -392,17 +406,22 @@ module ChefMetalVsphere
392
406
  def clone_vm(action_handler, bootstrap_options)
393
407
  vm_name = bootstrap_options[:name]
394
408
  datacenter = bootstrap_options[:datacenter]
395
- template_folder = bootstrap_options[:template_folder]
396
- template_name = bootstrap_options[:template_name]
397
409
 
398
410
  vm = find_vm(datacenter, bootstrap_options[:vm_folder], vm_name)
399
411
  return vm if vm
400
412
 
401
- vm_template = find_vm(datacenter, template_folder, template_name) or raise("vSphere VM Template not found [#{template_folder}/#{template_name}]")
413
+ vm_template = vm_template_for(bootstrap_options)
402
414
 
403
415
  do_vm_clone(action_handler, datacenter, vm_template, vm_name, bootstrap_options)
404
416
  end
405
417
 
418
+ def vm_template_for(bootstrap_options)
419
+ datacenter = bootstrap_options[:datacenter]
420
+ template_folder = bootstrap_options[:template_folder]
421
+ template_name = bootstrap_options[:template_name]
422
+ find_vm(datacenter, template_folder, template_name) or raise("vSphere VM Template not found [#{template_folder}/#{template_name}]")
423
+ end
424
+
406
425
  def machine_for(machine_spec, machine_options, vm = nil)
407
426
  vm ||= vm_for(machine_spec)
408
427
  if !vm
@@ -96,7 +96,7 @@ module ChefMetalVsphere
96
96
  connectable = RbVmomi::VIM::VirtualDeviceConnectInfo(
97
97
  :allowGuestControl => true,
98
98
  :connected => true,
99
- :startConnected => operation.value == 'edit')
99
+ :startConnected => true)
100
100
  device = RbVmomi::VIM::VirtualVmxnet3(
101
101
  :backing => nic_backing_info,
102
102
  :deviceInfo => RbVmomi::VIM::Description(:label => network_label, :summary => network_name),
@@ -149,15 +149,19 @@ module ChefMetalVsphere
149
149
  vm = find_vm(dc_name, options[:vm_folder], vm_name)
150
150
 
151
151
  unless options[:additional_disk_size_gb].nil?
152
- deviceAdditions.push(virtual_disk_for(vm, options))
152
+ task = vm.ReconfigVM_Task(:spec => RbVmomi::VIM.VirtualMachineConfigSpec(:deviceChange => [virtual_disk_for(vm, options)]))
153
+ task.wait_for_completion
153
154
  end
154
155
 
155
- unless deviceAdditions.count == 0
156
+ vm
157
+ end
158
+
159
+ def add_extra_nic(action_handler, vm_template, options, vm)
160
+ deviceAdditions, changes = network_device_changes(action_handler, vm_template, options)
161
+ if deviceAdditions.count > 0
156
162
  task = vm.ReconfigVM_Task(:spec => RbVmomi::VIM.VirtualMachineConfigSpec(:deviceChange => deviceAdditions))
157
163
  task.wait_for_completion
158
164
  end
159
-
160
- vm
161
165
  end
162
166
 
163
167
  def relocate_spec_for(dc_name, vm_template, options)
@@ -171,7 +175,7 @@ module ChefMetalVsphere
171
175
  raise 'either :host or :resource_pool must be specified when cloning from a VM Template' if pool.nil?
172
176
  end
173
177
 
174
- if options.has_key?(:use_linked_template)
178
+ if options.has_key?(:use_linked_clone)
175
179
  create_delta_disk(vm_template)
176
180
  rspec.diskMoveType = :moveChildMostDiskBacking
177
181
  else
@@ -179,7 +183,7 @@ module ChefMetalVsphere
179
183
  rspec.datastore = find_datastore(datacenter, options[:datastore])
180
184
  end
181
185
  end
182
-
186
+
183
187
  rspec
184
188
  end
185
189
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clc-chef-metal-vsphere
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.32
4
+ version: 0.3.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - CenturyLink Cloud