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

r/virtual_machine: Validate exact disk type when using linked_clone #277

Merged
merged 1 commit into from
Dec 6, 2017

Conversation

vancluever
Copy link
Contributor

A VM that's cloned with linked_clone and different disk mode options
that what is set on the source template will end up with inconsistent
settings post-clone, causing a read-update failure that will leave the
VM in a state that is irrecoverable to Terraform - the only way to
rectify the situation is to delete the VM and start over with a new
state.

This adds extra validation to make sure that thin_provisioned and
eagerly_scrub are set to the same settings as the source template's
counterpart disk, along with validating that the disk is the exact same
size (something that wasn't done yet).

Fixes #275.


PS: There will be a larger-ish PR (mainly because of adjustments to tests) that will follow this one to add thin_provisioned and eagerly_scrub attributes to the vsphere_virtual_machine data source. This will help ensure that these can be fetched in the same way we have the data source fetching disk_sizes currently.

A VM that's cloned with linked_clone and different disk mode options
that what is set on the source template will end up with inconsistent
settings post-clone, causing a read-update failure that will leave the
VM in a state that is irrecoverable to Terrform - the only way to
rectify the situation is to delete the VM and start over with a new
state.

This adds extra validation to make sure that thin_provisioned and
eagerly_scrub are set to the same settings as the source template's
counterpart disk, along with validating that the disk is the exact same
size (something that wasn't done yet).

Fixes #275.
@vancluever vancluever added enhancement Type: Enhancement bug Type: Bug and removed enhancement Type: Enhancement labels Dec 6, 2017
Copy link

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

LGTM - assuming the tests pass 👍

@vancluever
Copy link
Contributor Author

Thanks @tombuildsstuff! No regressions in a number of existing clone tests

=== RUN   TestAccResourceVSphereVirtualMachine
=== RUN   TestAccResourceVSphereVirtualMachine/clone_from_template
=== RUN   TestAccResourceVSphereVirtualMachine/clone,_multi-nic_(template_should_have_one)
=== RUN   TestAccResourceVSphereVirtualMachine/clone_with_different_timezone
=== RUN   TestAccResourceVSphereVirtualMachine/clone_with_bad_timezone
=== RUN   TestAccResourceVSphereVirtualMachine/clone_with_different_hostname
=== RUN   TestAccResourceVSphereVirtualMachine/clone_with_extra_disks
=== RUN   TestAccResourceVSphereVirtualMachine/clone_with_cdrom
--- PASS: TestAccResourceVSphereVirtualMachine (908.33s)
    --- PASS: TestAccResourceVSphereVirtualMachine/clone_from_template (124.53s)
    --- PASS: TestAccResourceVSphereVirtualMachine/clone,_multi-nic_(template_should_have_one) (122.93s)
    --- PASS: TestAccResourceVSphereVirtualMachine/clone_with_different_timezone (120.07s)
    --- PASS: TestAccResourceVSphereVirtualMachine/clone_with_bad_timezone (0.01s)
    --- PASS: TestAccResourceVSphereVirtualMachine/clone_with_different_hostname (120.03s)
    --- PASS: TestAccResourceVSphereVirtualMachine/clone_with_extra_disks (294.76s)
    --- PASS: TestAccResourceVSphereVirtualMachine/clone_with_cdrom (126.01s)

@vancluever vancluever merged commit 1863be0 into master Dec 6, 2017
@vancluever vancluever deleted the b-vm-clone-linkedvalidate branch December 6, 2017 22:36
@ghost ghost locked and limited conversation to collaborators Apr 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Type: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

r/virtual_machine: Enforce disk provisioning options on linked clones
2 participants