Skip to content

Commit

Permalink
Merge pull request #1441 from shaloulcy/remove_ceph_volume
Browse files Browse the repository at this point in the history
refactor: remove ceph volume plugin
  • Loading branch information
rudyfly authored Jun 1, 2018
2 parents d41da05 + b0b2928 commit dabd3bb
Show file tree
Hide file tree
Showing 26 changed files with 166 additions and 2,480 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ validate-swagger: ## run swagger validate
.PHONY: modules
modules:
@./hack/module --clean
@./hack/module --add-volume=github.com/alibaba/pouch/storage/volume/modules/ceph
@./hack/module --add-volume=github.com/alibaba/pouch/storage/volume/modules/tmpfs
@./hack/module --add-volume=github.com/alibaba/pouch/storage/volume/modules/local

Expand Down
6 changes: 1 addition & 5 deletions apis/server/volume_bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ func (s *Server) createVolume(ctx context.Context, rw http.ResponseWriter, req *
driver = volumetypes.DefaultBackend
}

if err := s.VolumeMgr.Create(ctx, name, driver, options, labels); err != nil {
return err
}

volume, err := s.VolumeMgr.Get(ctx, name)
volume, err := s.VolumeMgr.Create(ctx, name, driver, options, labels)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion daemon/mgr/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -1796,7 +1796,7 @@ func (mgr *ContainerManager) attachVolume(ctx context.Context, name string, meta
opts := map[string]string{
"backend": driver,
}
if err := mgr.VolumeMgr.Create(ctx, name, meta.HostConfig.VolumeDriver, opts, nil); err != nil {
if _, err := mgr.VolumeMgr.Create(ctx, name, meta.HostConfig.VolumeDriver, opts, nil); err != nil {
logrus.Errorf("failed to create volume: %s, err: %v", name, err)
return "", "", errors.Wrap(err, "failed to create volume")
}
Expand Down
27 changes: 9 additions & 18 deletions daemon/mgr/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package mgr
import (
"context"
"os"
"path"
"strings"

"github.com/alibaba/pouch/pkg/errtypes"
Expand All @@ -16,7 +15,7 @@ import (
// VolumeMgr defines interface to manage container volume.
type VolumeMgr interface {
// Create is used to create volume.
Create(ctx context.Context, name, driver string, options, labels map[string]string) error
Create(ctx context.Context, name, driver string, options, labels map[string]string) (*types.Volume, error)

// Get returns the information of volume that specified name/id.
Get(ctx context.Context, name string) (*types.Volume, error)
Expand Down Expand Up @@ -59,33 +58,25 @@ func NewVolumeManager(cfg volume.Config) (*VolumeManager, error) {
}

// Create is used to create volume.
func (vm *VolumeManager) Create(ctx context.Context, name, driver string, options, labels map[string]string) error {
func (vm *VolumeManager) Create(ctx context.Context, name, driver string, options, labels map[string]string) (*types.Volume, error) {
if driver == "" {
driver = types.DefaultBackend
}

id := types.VolumeID{
Name: name,
Driver: driver,
Options: map[string]string{},
Selectors: map[string]string{},
Labels: map[string]string{},
}

if labels != nil {
id.Labels = labels
} else {
id.Labels = map[string]string{}
}

for key, opt := range options {
if strings.HasPrefix(key, "selector.") {
key = strings.TrimPrefix(key, "selector.")
id.Selectors[key] = opt
continue
}

id.Options[key] = opt
}

// set default volume mount path
if mount, ok := id.Options["mount"]; !ok || mount == "" {
id.Options["mount"] = path.Dir(vm.core.VolumeMetaPath)
if options != nil {
id.Options = options
}

return vm.core.CreateVolume(id)
Expand Down
115 changes: 0 additions & 115 deletions storage/controlserver/client/client.go

This file was deleted.

28 changes: 0 additions & 28 deletions storage/controlserver/client/errors.go

This file was deleted.

Loading

0 comments on commit dabd3bb

Please sign in to comment.