New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stable vmWare VM disk creation (vsphere_guest only) #28706
Conversation
The test
The test
The test
The test
The test
|
ec8bac6
to
011b854
Compare
011b854
to
064df96
Compare
Removed natsort dependency and fixed trailing spaces |
876f215
to
ef5cace
Compare
Added some comment to vm_disk docs about numbering and warning about number gaps |
The test
|
ef5cace
to
49506b1
Compare
@digennarot can you review one more time? :) |
* Create more than 15 disks during reconfigure and creation * Allow to specify SCSI controller and unit * Create needed SCSI controllers automatically * Fix disk ordering 04 Jan 2018: * rebased against latest 2.5 * cleaned up code to have less duplicates * relaxed restriction to specify esxi hostname for vm creation VM can now be created in resource pool from scratch * removed buggy restriction to require force together with state
107bd8b
to
3600257
Compare
Thanks for the PR. Closing this PR since |
SUMMARY
Comprehensive fix for creating large arrays on vsphere. Unfortunately only for old module for now.
Background:
For large disk configurations in vm_disk field, the module failed to create disk arrays when vm was created from scratch or reconfigured, when more than 15 disks where requested. Additionally the disks where created in wrong order. Wrong here means, module uses dictionary sort and disk 10 is created as as 'Hard disk 2' for example, while natural sort should be used in the process.
While I saw several fixes merged already which try to fix the issue, none of them addressed two other, namely having predictable SCSI controller and lun setting and creating disks in predictable for human order
This pull request is supposed to fix all three issues, by introducing extra parameters: controller and unit in disk dict. This fix works for both creating from scratch or reconfiguring later
The fix falls back gracefully for simple setups with < 16 disks, and allows to omit these parameters for first 15 disks, however user still can specify them and they will be honored. For disk1 till disk15, the controller is assumed to be 0 if missing and unit number is assumed to be disk id - 1 for disk1 to disk7 and disk id for disk8 to disk15
Limitations:
Unfortunately, as it appears vsphere doesn't allow to predictably name hard disks via API and enforces it's own numbering. This means the disk ids should appear in the dict without gaps. Means you can't create disk 15 without creating first 14 disks, otherwise numbers will not match anymore and subsequent task runs may fail or behave unpredictably.
Disk numbering in vsphere begins with 1, so there should be no disk0 entry in the vm_disk. This might break for users who have it, since before vsphere created it as 'Hard disk 1', enforcing it. With this fix, disk id in vm_disk dict is used to actually match the disk in vm, so requirement for the number is much stricter.
Fixes #19326 I suppose, however there were already several patches for that version merged anyway
ISSUE TYPE
COMPONENT NAME
vsphere_guest
ANSIBLE VERSION
ADDITIONAL INFORMATION
Way to reproduce the problem would involve playing with quite some playbooks and some screenshots, so instead of pasting tons of yaml, here is general guidance and important piece of boring code for copy:
Create any vm with disk array that has more than 15 disks via playbook
or
Create small vm and add disks during reconfiguring
Observe the disk numbers assigned by vsphere are not matching dict specified for disks above 10
Observe error when reconfiguring for more than 15 disks
I'll simply paste the tedious piece for anyone who will test this