-
Notifications
You must be signed in to change notification settings - Fork 274
Add a new smb admin API sub-package #1100
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
Conversation
266c1dd
to
5d2b819
Compare
96c6345
to
0561b58
Compare
I was trying to remember why I did not check off the |
0561b58
to
4f395da
Compare
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.
This looks really good and well structured, thanks.
I only have few minor comments with a suggestion to place the commit admin/smb: add resources.go containing resource management funcs
before admin/smb: add result.go for the apply result types
as I had to jump to check for resourceEntry
from a further commit.
IntentValue Intent `json:"intent"` | ||
ClusterID string `json:"cluster_id"` | ||
AuthMode ClusterAuthMode `json:"auth_mode"` | ||
DomainSettings *DomainSettings `json:"domain_settings,omitempty"` | ||
UserGroupSettings []UserGroupSource `json:"user_group_settings,omitempty"` | ||
CustomDNS []string `json:"custom_dns,omitempty"` | ||
Placement Placement `json:"placement,omitempty"` | ||
Clustering Clustering `json:"clustering,omitempty"` | ||
PublicAddrs []PublicAddress `json:"public_addrs,omitempty"` |
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.
DomainSettings *DomainSettings
. . .
Placement Placement
Clustering Clustering
I hope we don't have any generic guideline to not use the same name for field and its type.
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.
No, I think this is fairly common in Go, but if you think I'm mistaken about that or it just bothers you a lot, let me know.
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.
If you happen to update the patch set again I would like to suggest a change to name it slightly different to avoid a first look confusion. Feel free to ignore if you think its not worth it.
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 it's preferable and I think it is a fairly common convention but I can't find too many links discussing this exact point. I'm going to leave it as-is and wait to see what @ansiwen thinks about this.
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 don't have a strong opinion, I just know that I sometime also use identical names and types, because it feels awkward otherwise, but I also get the point @anoopcs9 is talking about. Usually I would go whatever we do otherwise in go-ceph. Sorry, I'm a bad tie-breaker in this case.
I fixed a lot of the low hanging fruit items that you pointed out, thanks! I will fold/squash the temp commits later after I spend a few more minutes thinking about the remaining items. In the meantime I will let the tests run to find any mistakes in these fixes :-) |
We see CI failure on main because the regression reported via #1107 got fixed on Ceph side. |
8585c6b
to
7f33e31
Compare
fixes and udates squashed, branch rebased |
7f33e31
to
b92b4b3
Compare
Thanks for finding all my lazy copy-and-pasteoid errors that I missed. :-D |
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.
This pull request has been removed from the queue for the following reason: The pull request can't be updated. You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. |
@Mergifyio rebase |
✅ Branch has been successfully rebased |
42935b0
to
287e510
Compare
This pull request has been removed from the queue for the following reason: Pull request #1100 has been dequeued. The pull request rule doesn't match anymore. The following conditions don't match anymore:
You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. |
@Mergifyio requeue |
✅ The queue state of this pull request has been cleaned. It can be re-embarked automatically |
Part of the ceph command api supports commands with additional data in a buffer. Add interfaces that match these function calls in the go-ceph rados package. Signed-off-by: John Mulligan <[email protected]>
Signed-off-by: John Mulligan <[email protected]>
Signed-off-by: John Mulligan <[email protected]>
Signed-off-by: John Mulligan <[email protected]>
Signed-off-by: John Mulligan <[email protected]>
Signed-off-by: John Mulligan <[email protected]>
Signed-off-by: John Mulligan <[email protected]>
The admin_test.go module is the place where we actually test the smb module communicating with our go-ceph smb subpackage. Signed-off-by: John Mulligan <[email protected]>
Add a small commentary on how the smb module is expected to be used. Signed-off-by: John Mulligan <[email protected]>
Signed-off-by: John Mulligan <[email protected]>
Signed-off-by: John Mulligan <[email protected]>
287e510
to
f4ebd17
Compare
Signed-off-by: John Mulligan <[email protected]>
|
||
// MarshalJSON supports marshalling a cluster to JSON. | ||
func (cluster *Cluster) MarshalJSON() ([]byte, error) { | ||
type vCluster Cluster |
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's not clear to me, what v
and w
stands for here. Just like x
and y
?
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 I started off with v
for virtual, and then needed another placeholder so I just chose w
to follow on with v. These types only exist to wrangle the json so I don't think I put a lot of thought into the naming here.
|
||
const ( | ||
// Present resources will be created or updated. | ||
Present = Intent("present") |
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.
Probably has no real-world effect, but want to mention it anyway: like errors.New()
using a pointer to a string instead of the string itself makes the switch-cases faster and allows identical string in different enums.
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 don't think I would want to change it now, but I will keep that in mind for the future.
return false | ||
} | ||
|
||
var rl = []rune("bcdfghjklmnpqrstvwxyz") |
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.
Why are some characters omitted?
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.
So that it makes junk strings and not words. I saw some other project doing that (k8s?) and kinda copied the idea.
// errorMerge is a helper function for combining a lower level error from | ||
// the api with a resultGroup, treating the result group as an error if it | ||
// is not successful. | ||
func errorMerge(results ResultGroup, err error) 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 "merge" is misleading, it is rather selecting.
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.
Far enough, it's a private function so we can change it whenever. Because I am anxious to land this PR after it's been open for almost 2 months I'm going to leave it as-is but I might come back in a follow up PR to adjust this.
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.
No great alternatives are jumping to mind, let me know if you have any suggestions.
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.
errorPick?
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 thought that was obvious from my wording: errorSelect
, but I actually think errorPick
is even better!
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.
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 left a few comments, but no blockers and otherwise LGTM as far as I can tell without knowing more about the business logic. I set do-not-merge
to give a chance to react to the comments. Remove it at your own convenience.
It better reflects what the function does. Per the discussion in ceph#1100 (comment) and subsequent comments. Signed-off-by: John Mulligan <[email protected]>
It better reflects what the function does. Per the discussion in ceph#1100 (comment) and subsequent comments. Signed-off-by: John Mulligan <[email protected]>
It better reflects what the function does. Per the discussion in ceph#1100 (comment) and subsequent comments. Signed-off-by: John Mulligan <[email protected]>
It better reflects what the function does. Per the discussion in #1100 (comment) and subsequent comments. Signed-off-by: John Mulligan <[email protected]>
Add a new smb admin api.
This should be compatible with the recently added smb mgr module in ceph.
Note that the smb module on the ceph side supports a declarative style api where resource specs are the full power interface to use. There are some imperative style apis but we don't need to implement those in this library.
Checklist
//go:build ceph_preview
make api-update
to record new APIsNew or infrequent contributors may want to review the go-ceph Developer's Guide including the section on how we track API Status and the API Stability Plan.
The go-ceph project uses mergify. View the mergify command guide for information on how to interact with mergify. Add a comment with
@Mergifyio
rebase
to rebase your PR when github indicates that the PR is out of date with the base branch.