Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Snapshots of VM using a non-unique uuid #2340

Open
4 tasks done
ldumaine opened this issue Feb 6, 2025 · 2 comments
Open
4 tasks done

Snapshots of VM using a non-unique uuid #2340

ldumaine opened this issue Feb 6, 2025 · 2 comments
Labels
bug Type: Bug needs-triage Status: Issue Needs Triage

Comments

@ldumaine
Copy link

ldumaine commented Feb 6, 2025

Community Guidelines

  • I have read and agree to the HashiCorp Community Guidelines .
  • Vote on this issue by adding a 👍 reaction to the original issue initial description to help the maintainers prioritize.
  • Do not leave "+1" or other comments that do not add relevant information or questions.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Terraform

1.10.5

Terraform Provider

2.11.1

VMware vSphere

8.0.2

Description

We replicate virtual machines between datacenters using Veeam. By design, when a VM replica is created, it acquires the same MAC address and UUID as the original VM, see https://www.veeam.com/kb1669
As the same UUID is shared for both production VM and replica, when I create some snapshots for these VMs using vsphere_virtual_machine_snapshot, sometimes the snapshot is made on the replica instead of the production VM .

I'd appreciate there was some mechanisms to avoid that.
I thought of some:
Either an optional argument for the vsphere_virtual_machine_snapshot, like "virtual_machine_name", where I could specify the name of the VM that should be snapshotted. So the provider make sure the snapshotted one bears this name.
Either some euristichs: "when two VM share the same UUID , snapshot the one with the shortest name (replicas names based on original names but longer)", or "when two VM share the same UUID , and only one of the is powered on, snapshot the powered one".

Maybe I could help ? Could take some time as I am not a seasoned dev and I'm unfamiliar with this source code.

Affected Resources or Data Sources

vsphere_virtual_machine_snapshot

Terraform Configuration

resource "vsphere_virtual_machine_snapshot" "snapshots_LVM {
virtual_machine_uuid = some_uuid_that_is_used_on_several_VMS
snapshot_name = "TEST"
description = "for reproducing bug"
memory = false
quiesce = true
consolidate = true
}

Debug Output

.

Panic Output

No response

Expected Behavior

the production VM is snapshotted

Actual Behavior

the replica is snapshotted

Steps to Reproduce

Use veeam to replicate some VMs.
Create a snapshot of these VM using the vsphere provider.

Environment Details

No response

Screenshots

No response

References

No response

@ldumaine ldumaine added bug Type: Bug needs-triage Status: Issue Needs Triage labels Feb 6, 2025
Copy link

github-actions bot commented Feb 6, 2025

Hello, ldumaine! 🖐

Thank you for submitting an issue for this provider. The issue will now enter into the issue lifecycle.

If you want to contribute to this project, please review the contributing guidelines and information on submitting pull requests.

@ldumaine
Copy link
Author

ldumaine commented Feb 7, 2025

Seems the VMware API will only return a single entity, even if there are multiple matches.
https://vdc-download.vmware.com/vmwb-repository/dcr-public/dce91b06-cc93-42d6-b277-78fb13a16d6e/7d3494a5-bca7-400f-a18f-f539787ec798/vim.SearchIndex.html#findByUuid
So proposed mechanisms wouldn't be possible.
I see the API allows to restrict the search to a specific datacenter.
That would help as, more often than not, replicas and source VM will be on different datacenters.
So an optional argument for the vsphere_virtual_machine_snapshot, "datacenter_id", where the datacenter of the VM that should be snapshotted could be specified, would be very helpful.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Type: Bug needs-triage Status: Issue Needs Triage
Projects
None yet
Development

No branches or pull requests

1 participant