community.vmware icon indicating copy to clipboard operation
community.vmware copied to clipboard

[WIP] fix(vmware_guest): parameter not correct nicsettings:adapter:ip

Open wombelix opened this issue 3 years ago • 4 comments

SUMMARY

Usage of Customization Spec, when configured to prompt user for Network settings, caused error Failed to create a virtual machine: A specified parameter was not correct: nicsettings:adapter:ip.

This fix ensure IP Address, Subnet Mask and Hostname will be set based on parameter networks and name if parameter customization_spec is used.

Based on not merged PR https://github.com/ansible/ansible/pull/61329/ Fixes https://github.com/ansible-collections/community.vmware/issues/599 Fixes https://github.com/ansible/ansible/issues/55560

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

vmware_guest

ADDITIONAL INFORMATION

wombelix avatar Mar 12 '22 00:03 wombelix

Thanks for your Feedback @mariolenz, let me try to explain in a little more detail why in my opinion the behavior as it is today isn't optimal and we should consider some improvements.

I won't start an argument with you on this. The code is quite complex, and I'm not sure if I fully understand your problem yet. But I agree, we should consider some improvements ;-)

But I'm not sure how those improvements should look like. As I've said, the module is quite complex and changing something here might easily introduce a problem there that nobody thought about. But I'll try to understand more and work with you on this.

Parameter customization_spec as it's implemented today, only works when either DHCP or custom settings is selected in Section Network of the VM Customization Specifications. Using settings from parameter networks in combination with customization_spec just isn't possible because those will be ignored, same for the parameter hostname.

Yes, it looks like all other customization parameters in networks are ignored when customization_spec is defined. I'll try to find the time and have another look at your code. Something tells me there's still a problem, and I want to make sure that my feeling is wrong or that I find out what's wrong.

mariolenz avatar Mar 14 '22 16:03 mariolenz

But I'm not sure how those improvements should look like. As I've said, the module is quite complex and changing something here might easily introduce a problem there that nobody thought about. But I'll try to understand more and work with you on this.

Agree it's complex indeed, as far I can see customization_spec is only used in vmware_guest.py and vmware_guest_instant_clone.py, so it looks like the risk to break things somewhere else in the module seem quite low. But sure, it definitely need further investigation and testing.

Yes, it looks like all other customization parameters in networks are ignored when customization_spec is defined. I'll try to find the time and have another look at your code. Something tells me there's still a problem, and I want to make sure that my feeling is wrong or that I find out what's wrong.

Thanks, appreciated. I used the code in this PR successfully in my Environment to deploy quite a lot of Server yet, so it seems at least like a good starting boot.

I will try to implement and test the support of the following scenario probably next week:

One Interfaces in networks, two in the customization_spec profile, settings of the first one will be set based on values in networks, independent what's configured in the VM Customization Specification, the second one will be left untouched.

wombelix avatar Mar 19 '22 07:03 wombelix

There hasn't been any activity on this PR for quite some time, so I'll close it for now. Feel free to re-open it or open a new one if you think it's important.

mariolenz avatar Apr 24 '23 17:04 mariolenz

@mariolenz apologies that I never finished the PR, needed it to solve a problem in my old Job, were the code probably still run today as custom patch of the ansible collection. But I don't have access to a VMWare Environment anymore to do some refactoring to get it officially merged. Maybe someone else find the work which was done so far useful and might want to finish it one day.

wombelix avatar Apr 25 '23 07:04 wombelix