-
Notifications
You must be signed in to change notification settings - Fork 985
Misc tweaks #15719
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
Misc tweaks #15719
Conversation
lxd/profiles_utils.go
Outdated
| ) | ||
|
|
||
| func doProfileUpdate(s *state.State, p api.Project, profileName string, id int64, profile *api.Profile, req api.ProfilePut) error { | ||
| func doProfileUpdate(s *state.State, p api.Project, profileName string, profile *api.Profile, req api.ProfilePut) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can use id in the below database transactions:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth checking if id is already available at the call sites. We should minimize calls to cluster.GetProfileID().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 95 in 74f662d
| err = cluster.UpdateProfile(ctx, tx.Tx(), p.Name, profileName, cluster.Profile{ |
cluster.UpdateProfile() which immediately get the profile ID: https://github.com/canonical/lxd/blob/main/lxd/db/cluster/profiles.mapper.go#L479 ... only to get it again later. This being in a .mapper.go makes it a bit more annoying to fix.
I think I'll back down on those changes as this sounds like it require more work than I'm willing to do ATM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kadinsayani I think you've found a good thing to look at more closely but I'm just saying that I don't have the cycles to do that ATM ;)
a9b23d3 to
850028b
Compare
kadinsayani
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Signed-off-by: Simon Deziel <[email protected]>
Also stop exporting that function that is only used locally. Signed-off-by: Simon Deziel <[email protected]>
Signed-off-by: Simon Deziel <[email protected]>
Signed-off-by: Simon Deziel <[email protected]>
Signed-off-by: Simon Deziel <[email protected]>
Signed-off-by: Simon Deziel <[email protected]>
…ncePostClusteringMigrateWithRemoteStorage` Signed-off-by: Simon Deziel <[email protected]>
…lustering()` Signed-off-by: Simon Deziel <[email protected]>
…AAS()` Signed-off-by: Simon Deziel <[email protected]>
…aemon()` Signed-off-by: Simon Deziel <[email protected]>
tomponline
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks
No description provided.