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/virutal_machine: Fix gateway discovery behavior #180

Merged
merged 1 commit into from
Sep 28, 2017

Conversation

vancluever
Copy link
Contributor

The current gateway discovery code makes an assumption that any device
tracked by VMware tools that is not virtual hardware on the instance
will be ordered after any devices that are (even though the device key
is properly being used as the source of truth when discovering
interfaces). It does this by using the device index in a specific
gateway entry as the literal index entry for the corresponding device in
the list of devices that have actually been counted for saving in
Terraform state. This will either point to the incorrect device or a
flat out out-of-bounds value, respectively causing incorrect diffs or
crashes.

This fixes the situation by searching for the actual device key in the
guest network information discovered by VMware tools - at the index
specified by the gateway entry, and then searching for that key in the
devices being counted for state. The index of the corresponding entry is
where the gateway is saved. If any of these searches come up dry, either
the gateway has legitimately moved and needs to be fixed or more than
likely was not defined in config.

Fixes #173.

The current gateway discovery code makes an assumption that any device
tracked by VMware tools that is not virtual hardware on the instance
will be ordered after any devices that are (even though the device key
is properly being used as the source of truth when discovering
interfaces). It does this by using the device index in a specific
gateway entry as the literal index entry for the corresponding device in
the list of devices that have actually been counted for saving in
Terraform state. This will either point to the incorrect device or a
flat out out-of-bounds value, respectively causing incorrect diffs or
crashes.

This fixes the situation by searching for the actual device key in the
guest network information discovered by VMware tools - at the index
specified by the gateway entry, and then searching for that key in the
devices being counted for state. The index of the corresponding entry is
where the gateway is saved. If any of these searches come up dry, either
the gateway has legitimately moved and needs to be fixed or more than
likely was not defined in config.

Fixes #173.
@vancluever vancluever force-pushed the b-fix-gateway-discovery-crash branch from 2581e79 to 3d77277 Compare September 26, 2017 21:50
@vancluever vancluever added bug Type: Bug crash Impact: Crash labels Sep 26, 2017
Copy link
Member

@mbfrahry mbfrahry left a comment

Choose a reason for hiding this comment

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

LGTM!

@vancluever vancluever merged commit ccf18f5 into master Sep 28, 2017
@vancluever vancluever deleted the b-fix-gateway-discovery-crash branch October 12, 2017 00:30
@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 crash Impact: Crash
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash when running plan on VMs with multiple network interfaces with no gateway set
2 participants