-
Notifications
You must be signed in to change notification settings - Fork 118
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
Add cloud group backup API to SDK #1130
Add cloud group backup API to SDK #1130
Conversation
180963f
to
169ca29
Compare
api/server/sdk/cloud_backup.go
Outdated
} | ||
credId := req.GetCredentialId() | ||
var err error | ||
if len(req.GetGroupId()) == 0 && len(req.GetVolumeIds()) == 0 { |
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.
users could request group cloud backups for volumes with matching labels. Check needs to include nil labels as well.
|
||
// Check ownership for all volume IDs | ||
if len(req.GetVolumeIds()) > 0 { | ||
if err := checkAccessFromDriverForVolumeIds(ctx, s.driver(ctx), req.GetVolumeIds(), api.Ownership_Read); err != nil { |
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.
these checks need to consider labels and group id as well.
api/server/sdk/cloud_backup.go
Outdated
|
||
// Check ownership for group ID | ||
if len(req.GetGroupId()) > 0 { | ||
if err := checkAccessFromDriverForGroupId(ctx, s.driver(ctx), req.GetGroupId(), api.Ownership_Read); err != nil { |
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 should include labels and must be done only len(req.GetVolumeIds() ==0.
return nil, err | ||
} | ||
} | ||
|
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 both groupID and volume list is not specified and only labels are provided, permissions perhaps should be checked for those volumes with matching labels?
1ee691d
to
b34cb1b
Compare
} | ||
|
||
switch { | ||
// VolumeIDs and at least a GroupID or Labels are provided. Get filtered volumes based on GroupID and/or Labels, |
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.
Nice!
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.
Looks good to me.
Signed-off-by: Grant Griffiths <[email protected]>
b34cb1b
to
f179b6e
Compare
What this PR does / why we need it:
This PR adds support for Cloud group backup in the SDK Server
Which issue(s) this PR fixes (optional)
Closes #1129
Special notes for your reviewer:
I have made the following two assumptions regarding ownership:
If userA has access to 25 volumes inside a
GroupA
, and asks userB to backupGroupA
, but userB only has access to 5 out of the 25 volumes, it would be dangerous to only backup those 5 volumes. This is because UserA asked for a backup of all of GroupA, but userB only has partial access to the volumes in that group. Returning successfully in this case would give UserB false confidence that the entirety of GroupA has been backed up.