Skip to content
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

Fix disk creation resulting in 'invalid configuration for device' error #2009

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Yannik
Copy link
Contributor

@Yannik Yannik commented Feb 27, 2024

SUMMARY

Under some circumstances, disk creation fails with an invalid configuration for device error.
Once this error shows up for a VM, it persistently happens whenever trying to add disks, however, I do not know how to make it show up for a VM, sometimes it is just there.

In comparing the API calls done by VCenter (which works) and ansible (which fails with the error above), I noticed that VCenter sets fileOperation to create. Setting this in ansible, as done in this patch, fixes the disk creation in ansible.

The docs describe the fileOperation parameter like this:

Type of operation being performed on the backing of the specified virtual device. If no file operation is specified in the VirtualDeviceSpec, then any backing filenames in the VirtualDevice must refer to files that already exist. The "replace" and "delete" values for this property are only applicable to virtual disk backing files.

So it really must be set when the backing file does not exist, (which it ofc doesn't when creating a disk).

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

vm_device_helper

@Yannik
Copy link
Contributor Author

Yannik commented Feb 27, 2024

@mariolenz

The CI stage is failing with this error:

ERROR: Found 5 pylint issue(s) which need to be resolved:
ERROR: plugins/module_utils/vmware.py:1091:13: unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck.
ERROR: plugins/module_utils/vmware.py:1093:13: unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck.
ERROR: plugins/module_utils/vmware.py:1095:13: unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck.
ERROR: scripts/inventory/vmware_inventory.py:286:11: unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck.
ERROR: tests/unit/mock/loader.py:33:15: unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck.

However, none of these LOC are touched by my PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant