Skip to content
This repository has been archived by the owner on Feb 9, 2019. It is now read-only.

Commit

Permalink
allow the usage of mount options
Browse files Browse the repository at this point in the history
  • Loading branch information
Hayley Swimelar committed Jun 21, 2018
1 parent ac3eea4 commit 4a644ea
Show file tree
Hide file tree
Showing 40 changed files with 6,648 additions and 62 deletions.
2 changes: 1 addition & 1 deletion go.mod
@@ -1,3 +1,3 @@
module github.com/LINBIT/linstor-flexvolume

require github.com/LINBIT/golinstor v0.8.1
require github.com/LINBIT/golinstor v0.8.3
28 changes: 17 additions & 11 deletions pkg/api/api.go
Expand Up @@ -75,6 +75,7 @@ type options struct {
XFSDataSW string `json:"xfsDataSw"`
XFSLogDev string `json:"xfsLogDev"`
DisklessStoragePool string `json:"disklessStoragePool"`
MountOpts string `json:"mountOpts"`

// Parsed option ready to pass to linstor.FSUtil
xfsDataSW int
Expand Down Expand Up @@ -180,11 +181,11 @@ func (api FlexVolumeApi) attach(s []string) (string, int) {
return string(res), EXITBADAPICALL
}

resource := linstor.Resource{
resource := linstor.NewResourceDeployment(linstor.ResourceDeploymentConfig{
Name: opts.getResource(),
ClientList: []string{s[2]},
DisklessStoragePool: opts.DisklessStoragePool,
}
})

err = resource.Assign()
if err != nil {
Expand Down Expand Up @@ -223,7 +224,8 @@ func (api FlexVolumeApi) detach(s []string) (string, int) {
return tooFewArgsResponse(s)
}

resource := linstor.Resource{Name: s[1]}
resource := linstor.NewResourceDeployment(
linstor.ResourceDeploymentConfig{Name: s[1]})

// Do not unassign resources that have local storage.
if !resource.IsClient(s[2]) {
Expand Down Expand Up @@ -257,15 +259,18 @@ func (api FlexVolumeApi) mountDevice(s []string) (string, int) {
})
return string(res), EXITBADAPICALL
}
r := linstor.NewResourceDeployment(
linstor.ResourceDeploymentConfig{Name: opts.getResource()})

mounter := linstor.FSUtil{
Resource: &linstor.Resource{Name: opts.getResource()},
FSType: opts.FsType,
BlockSize: opts.blockSize,
Force: opts.force,
XFSDataSU: opts.XFSDataSU,
XFSDataSW: opts.xfsDataSW,
XFSLogDev: opts.XFSLogDev,
ResourceDeployment: &r,
FSType: opts.FsType,
BlockSize: opts.blockSize,
Force: opts.force,
XFSDataSU: opts.XFSDataSU,
XFSDataSW: opts.xfsDataSW,
XFSLogDev: opts.XFSLogDev,
MountOpts: opts.MountOpts,
}

err = mounter.Mount(s[1])
Expand Down Expand Up @@ -340,7 +345,8 @@ func (api FlexVolumeApi) isAttached(s []string) (string, int) {
return string(res), EXITBADAPICALL
}

resource := linstor.Resource{Name: opts.getResource()}
resource := linstor.NewResourceDeployment(
linstor.ResourceDeploymentConfig{Name: opts.getResource()})

ok, err := resource.OnNode(s[2])
if err != nil {
Expand Down
6 changes: 6 additions & 0 deletions vendor/github.com/LINBIT/golinstor/go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4a644ea

Please sign in to comment.