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 migration when datastore_cluster_id changes #1546

Conversation

pascal-hofmann
Copy link
Contributor

@pascal-hofmann pascal-hofmann commented Jan 3, 2022

Description

When changing the datastore_cluster_id of a vsphere_virtual_machine the disks are not migrated to datastores of the new datastore cluster because no storage migration is triggered. This PR fixes this.

Acceptance tests

Release Note

resource/virtual_machine: Fix migration of all disks and configuration files when the datastore_cluster_id is changed on the resource. GH-1546

References

Closes #1454

@github-actions github-actions bot added provider Type: Provider size/xs Relative Sizing: Extra-Small labels Jan 3, 2022
@tenthirtyam tenthirtyam added the bug Type: Bug label Feb 3, 2022
@tenthirtyam tenthirtyam changed the title Force disk migration when datastore cluster changes Fix disk migration when datastore_cluster_id changes Feb 3, 2022
@appilon
Copy link
Contributor

appilon commented Feb 3, 2022

@tenthirtyam Can this be manualy reproduced and verified to be fixed?

@tenthirtyam
Copy link
Collaborator

@appilon, yes! I can test this with some NFS-backed datastore clusters to confirm and will report back the results.

Stay tuned!

@tenthirtyam
Copy link
Collaborator

Status: Currently running some change of datastore_cluster_id tests based on the change and some regression testing on datastore_id to ensure no implications.

@tenthirtyam
Copy link
Collaborator

I've reviewed this change in my testbed under vSphere v7.0.3c with two NFS-backed datastore clusters.

I can confirm that it resolves the linked issue.

  • ✅ When changing datastore_cluster_id at the top-most level of a vsphere_virtual_machine resource, all disks are relocated to the updated datastore_cluster_id.
  • ✅ No regression impact to changing to datastore_id at the top-most level of a vsphere_virtual_machine resource or at the disk level.

Notes:

  • 🧹 While changes to datastore_cluster_id at the top-most will move all disks, for datastore_id it will only move the VM configuration (e.g. .vmx) files. This is not a regression, but it is the current behavior. It is overcome by adding datastore_id to each disk.
  • 🛠️ Changes between datastore_cluster_id to datastore_id (and visa-versa) will not move the resource's disks between the two. While this is not a regression and is the current behavior, it is not ideal.

Copy link
Collaborator

@tenthirtyam tenthirtyam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@appilon appilon merged commit 4a03135 into hashicorp:master Feb 4, 2022
@pascal-hofmann pascal-hofmann deleted the force-storage-migration-on-datastore-cluster-change branch February 7, 2022 10:54
@tenthirtyam tenthirtyam added this to the v2.1.0 milestone Feb 14, 2022
@github-actions
Copy link

github-actions bot commented Mar 2, 2022

This functionality has been released in v2.1.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

github-actions bot commented Apr 2, 2022

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Type: Bug provider Type: Provider size/xs Relative Sizing: Extra-Small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changing datastore_cluster_id on vsphere_virtual_machine resource does not move virtual machine
3 participants