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

PWX-39364 - Add support for Cloud snapshots in CSI #2492

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ mockgen:
mockgen -destination=api/mock/mock_volume.go -package=mock github.com/libopenstorage/openstorage/api OpenStorageVolumeServer,OpenStorageVolumeClient
mockgen -destination=api/mock/mock_watch.go -package=mock github.com/libopenstorage/openstorage/api OpenStorageWatchServer,OpenStorageWatchClient,OpenStorageWatch_WatchClient,OpenStorageWatch_WatchServer
mockgen -destination=api/mock/mock_bucket.go -package=mock github.com/libopenstorage/openstorage/api OpenStorageBucketServer,OpenStorageBucketClient
mockgen -destination=api/mock/mock_cloud_backup.go -package=mock github.com/libopenstorage/openstorage/api OpenStorageCloudBackupServer,OpenStorageCloudBackupClient
mockgen -destination=cluster/mock/cluster.mock.go -package=mock github.com/libopenstorage/openstorage/cluster Cluster
mockgen -destination=cluster/mock/cluster_listener.mock.go -package=mock github.com/libopenstorage/openstorage/cluster ClusterListener
mockgen -destination=api/mock/mock_fstrim.go -package=mock github.com/libopenstorage/openstorage/api OpenStorageFilesystemTrimServer,OpenStorageFilesystemTrimClient
Expand All @@ -442,6 +443,8 @@ mockgen:
mockgen -destination=api/server/mock/mock_schedops_k8s.go -package=mock github.com/portworx/sched-ops/k8s/core Ops
mockgen -destination=volume/drivers/mock/driver.mock.go -package=mock github.com/libopenstorage/openstorage/volume VolumeDriver
mockgen -destination=bucket/drivers/mock/bucket_driver.mock.go -package=mock github.com/libopenstorage/openstorage/bucket BucketDriver
mockgen -destination=pkg/loadbalancer/mock/balancer.go -package=mock github.com/libopenstorage/openstorage/pkg/loadbalancer Balancer


osd-tests: install
./hack/csi-sanity-test.sh
Expand Down
1 change: 1 addition & 0 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ const (
SpecIoThrottleWrIOPS = "io_throttle_wr_iops"
SpecIoThrottleRdBW = "io_throttle_rd_bw"
SpecIoThrottleWrBW = "io_throttle_wr_bw"
SpecIoProfileDisableFromSource = "io_profile_disable_from_source"
)

// OptionKey specifies a set of recognized query params.
Expand Down
584 changes: 584 additions & 0 deletions api/mock/mock_cloud_backup.go

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion api/server/sdk/cloud_backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ package sdk
import (
"context"
"fmt"

"github.com/libopenstorage/openstorage/api"
api_err "github.com/libopenstorage/openstorage/api/errors"
"github.com/libopenstorage/openstorage/volume"
"github.com/portworx/kvdb"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
Expand Down Expand Up @@ -410,6 +410,8 @@ func (s *CloudBackupServer) Status(
if err != nil {
if err == volume.ErrInvalidName {
return nil, status.Errorf(codes.Unavailable, "No Backup status found")
} else if err == kvdb.ErrNotFound {
return nil, status.Errorf(codes.NotFound, "Backup not found")
}
return nil, status.Errorf(codes.Internal, "Failed to get status of backup: %v", err)
}
Expand Down
5 changes: 5 additions & 0 deletions api/server/sdk/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ import (
"google.golang.org/grpc/status"
)

// IsErrorUnavailable returns if the given error is due to unavailable
func IsErrorUnavailable(err error) bool {
return FromError(err).Code() == codes.Unavailable
}

// IsErrorNotFound returns if the given error is due to not found
func IsErrorNotFound(err error) bool {
return FromError(err).Code() == codes.NotFound
Expand Down
Loading