chef / kitchen-vcenter

A test-kitchen driver for vCenter REST API
https://www.chef.io/implementations/vmware
Apache License 2.0
25 stars 26 forks source link

Enable IP customization using DHCP #112

Closed cattywampus closed 4 years ago

cattywampus commented 4 years ago

Description

This changes updates the CustomizationSpec applied to the cloned VM so that it's IP address can be generated automatically using DHCP if a fixed IPv4 address is not specified. To make this possible the validations on the guest customization settings had to be adjusted to allow ip_address, subnet_mask, and gateway to be optional instead of required. Now if the ip_address is omitted the VM's customization spec will use the CustomizationDhcpIpGenerator when setting up the customized ip settings.

I tested this by:

Signed-off-by: Keith Walters kwalters@taphere.com

Related Issue

Issue #109

Types of changes

Checklist:

mkennedy85 commented 4 years ago

Thanks for the contribution. Looks great and looking forward to leveraging this functionality as well.

mekhanique commented 4 years ago

Would love to see this merged/released soon. We could really use it!

Belogix commented 4 years ago

I am basing some changes off of this, and adding Windows support too (will raise PR in due course). For what it is worth this PR works with my Linux builds and DHCP too, so using it locally until this PR is merged.

cattywampus commented 4 years ago

Thanks @clintoncwolfe. I was able to test it with a static IP address, should have mentioned this in the description (will update).

I'm new to the RbVmomi API. Still kind of feeling my way around and having trouble finding a good source of documentation. My best source of reference for what it provides and how it's used has been the no longer supported chef-provisioning-vsphere gem.

mkennedy85 commented 4 years ago

@cattywampus actually I apologize as I previously shared the incorrect link. Misplacing my resources these days. The VIM operations map to Managed and Data objects in https://code.vmware.com/apis/196/vsphere/doc/. Still new to it, but that was my resources.