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

Only compare bus number if different #1039

Merged
merged 2 commits into from
Apr 25, 2020

Conversation

dhekimian
Copy link
Contributor

Description

#1032 didn't take all cases into account. This change does.

Acceptance tests

  • Have you added an acceptance test for the functionality being added?
  • Have you run the acceptance tests on this branch? (If so, please include the test log in a gist)

References

@ghost ghost added the size/xs Relative Sizing: Extra-Small label Apr 13, 2020
@dhekimian
Copy link
Contributor Author

@bill-rich In further testing with the change from #1032, we ran into another issue with the sort:

00023.290 ERR [DEBUG] DiskPostCloneOperation: Disk devices located: disk-1000-0,disk-1000-1,disk-1000-2,disk-1000-3,disk-1000-4,disk-1000-5,disk-1000-6,disk-1000-8,disk-1000-9,disk-1000-10,disk-1000-11,disk-1000-12,disk-1000-13,disk-1000-14,disk-1000-15,disk-1001-0
00023.290 ERR [DEBUG] DiskPostCloneOperation: Disk devices order after sort: disk-1000-0,disk-1000-1,disk-1000-2,disk-1000-3,disk-1000-4,disk-1000-5,disk-1000-6,disk-1000-8,disk-1000-10,disk-1000-11,disk-1000-12,disk-1000-13,disk-1000-14,disk-1000-15,disk-1001-0,disk-1000-9

disk-1000-9 was getting sorted to the end. Ended up adding a bunch of debug statements to figure out where the logic was going wrong. Realized the logic need to look at the bus id to properly address the sub-sorting.

Instead of doing:

if liCtlr.(types.BaseVirtualController).GetVirtualController().BusNumber < ljCtlr.(types.BaseVirtualController).GetVirtualController().BusNumber {
	return true
}
if liCtlr.(types.BaseVirtualController).GetVirtualController().BusNumber > ljCtlr.(types.BaseVirtualController).GetVirtualController().BusNumber {
	return false
}

Went with the following to keep from doubling the look up:

liCtlrBus := liCtlr.(types.BaseVirtualController).GetVirtualController().BusNumber
ljCtlrBus := ljCtlr.(types.BaseVirtualController).GetVirtualController().BusNumber
if liCtlrBus != ljCtlrBus {
  return liCtlrBus < ljCtlrBus
}

Tested with the VMware VCSA-7.0.0.10100-15952498 (GA).

@dhekimian
Copy link
Contributor Author

@bill-rich MR #1032 didn't fix all the use cases and I believe this MR fixes it for good. Please merge to replace the changes from #1032

Copy link
Contributor

@bill-rich bill-rich left a comment

Choose a reason for hiding this comment

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

Thanks for keeping pushing through on this issue. Looks good!

@bill-rich bill-rich merged commit 7f42cfa into hashicorp:master Apr 25, 2020
@ghost
Copy link

ghost commented May 26, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators May 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
size/xs Relative Sizing: Extra-Small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants