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

Add cloud group backup API to SDK #1130

Merged

Conversation

ggriffiths
Copy link
Contributor

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 a user passes in a list of volumes, they must have access to ALL volumes in that list. If the user does not have access to a single volumes, the call fails.
  • If a user passes in a groupID, they must have access to ALL volumes in that group. My reason for this:
    If userA has access to 25 volumes inside a GroupA, and asks userB to backup GroupA, 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.

@ggriffiths ggriffiths requested review from lpabon and talakad May 30, 2019 20:41
@ggriffiths ggriffiths changed the title Add cloud group backup API Add cloud group backup API to SDK May 30, 2019
@ggriffiths ggriffiths force-pushed the sdk_cloud_group_backup branch from 180963f to 169ca29 Compare May 30, 2019 21:03
}
credId := req.GetCredentialId()
var err error
if len(req.GetGroupId()) == 0 && len(req.GetVolumeIds()) == 0 {
Copy link
Contributor

@talakad talakad Jun 3, 2019

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 {
Copy link
Contributor

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.


// Check ownership for group ID
if len(req.GetGroupId()) > 0 {
if err := checkAccessFromDriverForGroupId(ctx, s.driver(ctx), req.GetGroupId(), api.Ownership_Read); err != nil {
Copy link
Contributor

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
}
}

Copy link
Contributor

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?

@ggriffiths ggriffiths force-pushed the sdk_cloud_group_backup branch 4 times, most recently from 1ee691d to b34cb1b Compare June 3, 2019 23:20
}

switch {
// VolumeIDs and at least a GroupID or Labels are provided. Get filtered volumes based on GroupID and/or Labels,
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

Copy link
Contributor

@talakad talakad left a 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]>
@ggriffiths ggriffiths force-pushed the sdk_cloud_group_backup branch from b34cb1b to f179b6e Compare June 5, 2019 18:38
@ggriffiths ggriffiths merged commit 34048f4 into libopenstorage:master Jun 5, 2019
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.

Add cloud group-backup in SDK
2 participants