Skip to content

Commit

Permalink
Update plugin to be compatible with Ark v0.10
Browse files Browse the repository at this point in the history
Signed-off-by: Nolan Brubaker <[email protected]>
  • Loading branch information
Nolan Brubaker authored and disrani-px committed Nov 13, 2018
1 parent ba27de5 commit fba6dac
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 39 deletions.
10 changes: 8 additions & 2 deletions ark-blockstore-portworx/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ package main
import (
"github.com/heptio/ark/pkg/plugin"
"github.com/portworx/ark-plugin/pkg/snapshot"
"github.com/sirupsen/logrus"
)

func main() {
portworxPlugin := &snapshot.Plugin{Log: plugin.NewLogger()}
plugin.Serve(plugin.NewBlockStorePlugin(portworxPlugin))
plugin.NewServer(plugin.NewLogger()).
RegisterBlockStore("portworx", newSnapshotPlugin).
Serve()
}

func newSnapshotPlugin(logger logrus.FieldLogger) (interface{}, error) {
return &snapshot.Plugin{Log: logger}, nil
}
16 changes: 0 additions & 16 deletions pkg/snapshot/cloudsnap.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,22 +80,6 @@ func (c *cloudSnapshotPlugin) GetVolumeInfo(volumeID, volumeAZ string) (string,
return "portworx-cloudsnapshot", nil, nil
}

func (c *cloudSnapshotPlugin) IsVolumeReady(volumeID, volumeAZ string) (ready bool, err error) {
volDriver, err := getVolumeDriver()
if err != nil {
return false, err
}

vols, err := volDriver.Inspect([]string{volumeID})
if err != nil {
return false, err
}
if len(vols) == 0 {
return false, fmt.Errorf("Volume %v not found", volumeID)
}
return true, nil
}

func (c *cloudSnapshotPlugin) CreateSnapshot(volumeID, volumeAZ string, tags map[string]string) (string, error) {
volDriver, err := getVolumeDriver()
if err != nil {
Expand Down
16 changes: 0 additions & 16 deletions pkg/snapshot/localsnap.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,6 @@ func (l *localSnapshotPlugin) GetVolumeInfo(volumeID, volumeAZ string) (string,
return "portworx-snapshot", nil, nil
}

func (l *localSnapshotPlugin) IsVolumeReady(volumeID, volumeAZ string) (ready bool, err error) {
volDriver, err := getVolumeDriver()
if err != nil {
return false, err
}

vols, err := volDriver.Inspect([]string{volumeID})
if err != nil {
return false, err
}
if len(vols) == 0 {
return false, fmt.Errorf("Volume %v not found", volumeID)
}
return true, nil
}

func (l *localSnapshotPlugin) CreateSnapshot(volumeID, volumeAZ string, tags map[string]string) (string, error) {
volDriver, err := getVolumeDriver()
if err != nil {
Expand Down
5 changes: 0 additions & 5 deletions pkg/snapshot/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,6 @@ func (p *Plugin) GetVolumeInfo(volumeID, volumeAZ string) (string, *int64, error
return p.plugin.GetVolumeInfo(volumeID, volumeAZ)
}

// IsVolumeReady Check if the volume is ready
func (p *Plugin) IsVolumeReady(volumeID, volumeAZ string) (ready bool, err error) {
return p.plugin.IsVolumeReady(volumeID, volumeAZ)
}

// CreateSnapshot Create a snapshot
func (p *Plugin) CreateSnapshot(volumeID, volumeAZ string, tags map[string]string) (string, error) {
return p.plugin.CreateSnapshot(volumeID, volumeAZ, tags)
Expand Down

0 comments on commit fba6dac

Please sign in to comment.