r/virtual_machine: Address vCenter upgrade issues #405
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A couple of issues come up when vCenter is upgraded:
capacityInBytes
values for virtual machine disk devices are cleared. This is a value we rely on to set the capacity of a disk, so a fallback to capacityInKB is necessary. This is specifically important for templates, as while VMs will be powered on and this value will be populated again, more than likely templates will remain off after the upgrade.disk_sharing
will be unset and unusable. However, this value will now be read in by Terraform due to the upgraded vCenter, albeit with a blank value, and will trigger a diff that will ultimately result in an error. Hence, we skip setting the sharing value if it is blank.Note that the second issue presents another problem that is not fixed by this PR, namely that if only vCenter is upgraded, and the hypervisors are not, more than likely deploying VMs using Terraform will fail until VMs can be deployed using a hardware version that supports disk sharing. This won't be fixed until we have some awareness around VM hardware versions, which is currently not the case.
Fixes #403. Possibly helps with #402 as well but would remain to be seen.