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 duplicate used by entry in storage pool #12366

Merged
merged 1 commit into from
Oct 12, 2023

Conversation

MusicDin
Copy link
Member

Fixes #12335

@MusicDin MusicDin requested a review from tomponline as a code owner October 11, 2023 11:09
Copy link
Member

@tomponline tomponline left a comment

Choose a reason for hiding this comment

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

I would prefer we fix the UsedBy() function so it doesn't return dupes in the first place rather than removing them later on, that feels like a workaround to me.

@tomponline
Copy link
Member

I took a quick look and it appears to be adding the word break after the if statement here would fix it https://github.com/canonical/lxd/blob/main/lxd/storage/storage.go#L232

@MusicDin MusicDin force-pushed the fix/duplicate-pool-entry branch from 6838125 to 1d5f840 Compare October 11, 2023 12:43
@tomponline
Copy link
Member

@MusicDin cool so this fixed it?

Do any of the other UsedBy() functions have a similar issue?

@MusicDin
Copy link
Member Author

Yes, this fixes duplicate output and ignores duplicates in total count of USED BY.

I will check for other resources and fix it if needed - please don't merge it yet.

@MusicDin
Copy link
Member Author

This can be merged. Other resources seem fine. I've tested profiles, networks, storage pools, storage volumes and network zones. If I have missed some resource with usedBy counter please let me know.

@tomponline tomponline merged commit c62f7bf into canonical:main Oct 12, 2023
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate used by entry in storage pool
2 participants