Skip to content

Commit

Permalink
Add support for Cloud snapshots via CSI
Browse files Browse the repository at this point in the history
Signed-off-by: Shyam Radhakrishnan <[email protected]>
  • Loading branch information
sradhakrishnan-px committed Oct 9, 2024
1 parent d41ec0f commit 03da896
Show file tree
Hide file tree
Showing 11 changed files with 2,177 additions and 52 deletions.
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

0 comments on commit 03da896

Please sign in to comment.