Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
6f82f407
Commit
6f82f407
authored
Apr 24, 2018
by
Shubheksha Jalan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace path with filepath
parent
4344d337
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
20 additions
and
23 deletions
+20
-23
attacher.go
pkg/volume/aws_ebs/attacher.go
+2
-2
aws_ebs.go
pkg/volume/aws_ebs/aws_ebs.go
+2
-3
aws_ebs_block.go
pkg/volume/aws_ebs/aws_ebs_block.go
+1
-2
aws_ebs_block_test.go
pkg/volume/aws_ebs/aws_ebs_block_test.go
+4
-4
aws_ebs_test.go
pkg/volume/aws_ebs/aws_ebs_test.go
+2
-2
attacher.go
pkg/volume/azure_dd/attacher.go
+1
-2
azure_common.go
pkg/volume/azure_dd/azure_common.go
+2
-2
azure_common_linux.go
pkg/volume/azure_dd/azure_common_linux.go
+4
-4
azure_file_test.go
pkg/volume/azure_file/azure_file_test.go
+2
-2
No files found.
pkg/volume/aws_ebs/attacher.go
View file @
6f82f407
...
@@ -19,7 +19,7 @@ package aws_ebs
...
@@ -19,7 +19,7 @@ package aws_ebs
import
(
import
(
"fmt"
"fmt"
"os"
"os"
"path"
"path
/filepath
"
"strconv"
"strconv"
"time"
"time"
...
@@ -249,7 +249,7 @@ func (plugin *awsElasticBlockStorePlugin) NewDetacher() (volume.Detacher, error)
...
@@ -249,7 +249,7 @@ func (plugin *awsElasticBlockStorePlugin) NewDetacher() (volume.Detacher, error)
}
}
func
(
detacher
*
awsElasticBlockStoreDetacher
)
Detach
(
volumeName
string
,
nodeName
types
.
NodeName
)
error
{
func
(
detacher
*
awsElasticBlockStoreDetacher
)
Detach
(
volumeName
string
,
nodeName
types
.
NodeName
)
error
{
volumeID
:=
aws
.
KubernetesVolumeID
(
path
.
Base
(
volumeName
))
volumeID
:=
aws
.
KubernetesVolumeID
(
file
path
.
Base
(
volumeName
))
if
_
,
err
:=
detacher
.
awsVolumes
.
DetachDisk
(
volumeID
,
nodeName
);
err
!=
nil
{
if
_
,
err
:=
detacher
.
awsVolumes
.
DetachDisk
(
volumeID
,
nodeName
);
err
!=
nil
{
glog
.
Errorf
(
"Error detaching volumeID %q: %v"
,
volumeID
,
err
)
glog
.
Errorf
(
"Error detaching volumeID %q: %v"
,
volumeID
,
err
)
...
...
pkg/volume/aws_ebs/aws_ebs.go
View file @
6f82f407
...
@@ -19,7 +19,6 @@ package aws_ebs
...
@@ -19,7 +19,6 @@ package aws_ebs
import
(
import
(
"fmt"
"fmt"
"os"
"os"
"path"
"path/filepath"
"path/filepath"
"strconv"
"strconv"
"strings"
"strings"
...
@@ -387,12 +386,12 @@ func makeGlobalPDPath(host volume.VolumeHost, volumeID aws.KubernetesVolumeID) s
...
@@ -387,12 +386,12 @@ func makeGlobalPDPath(host volume.VolumeHost, volumeID aws.KubernetesVolumeID) s
// Clean up the URI to be more fs-friendly
// Clean up the URI to be more fs-friendly
name
:=
string
(
volumeID
)
name
:=
string
(
volumeID
)
name
=
strings
.
Replace
(
name
,
"://"
,
"/"
,
-
1
)
name
=
strings
.
Replace
(
name
,
"://"
,
"/"
,
-
1
)
return
path
.
Join
(
host
.
GetPluginDir
(
awsElasticBlockStorePluginName
),
mount
.
MountsInGlobalPDPath
,
name
)
return
file
path
.
Join
(
host
.
GetPluginDir
(
awsElasticBlockStorePluginName
),
mount
.
MountsInGlobalPDPath
,
name
)
}
}
// Reverses the mapping done in makeGlobalPDPath
// Reverses the mapping done in makeGlobalPDPath
func
getVolumeIDFromGlobalMount
(
host
volume
.
VolumeHost
,
globalPath
string
)
(
string
,
error
)
{
func
getVolumeIDFromGlobalMount
(
host
volume
.
VolumeHost
,
globalPath
string
)
(
string
,
error
)
{
basePath
:=
path
.
Join
(
host
.
GetPluginDir
(
awsElasticBlockStorePluginName
),
mount
.
MountsInGlobalPDPath
)
basePath
:=
file
path
.
Join
(
host
.
GetPluginDir
(
awsElasticBlockStorePluginName
),
mount
.
MountsInGlobalPDPath
)
rel
,
err
:=
filepath
.
Rel
(
basePath
,
globalPath
)
rel
,
err
:=
filepath
.
Rel
(
basePath
,
globalPath
)
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Errorf
(
"Failed to get volume id from global mount %s - %v"
,
globalPath
,
err
)
glog
.
Errorf
(
"Failed to get volume id from global mount %s - %v"
,
globalPath
,
err
)
...
...
pkg/volume/aws_ebs/aws_ebs_block.go
View file @
6f82f407
...
@@ -18,7 +18,6 @@ package aws_ebs
...
@@ -18,7 +18,6 @@ package aws_ebs
import
(
import
(
"fmt"
"fmt"
"path"
"path/filepath"
"path/filepath"
"strconv"
"strconv"
"strings"
"strings"
...
@@ -164,7 +163,7 @@ func (ebs *awsElasticBlockStore) GetGlobalMapPath(spec *volume.Spec) (string, er
...
@@ -164,7 +163,7 @@ func (ebs *awsElasticBlockStore) GetGlobalMapPath(spec *volume.Spec) (string, er
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
err
return
""
,
err
}
}
return
path
.
Join
(
ebs
.
plugin
.
host
.
GetVolumeDevicePluginDir
(
awsElasticBlockStorePluginName
),
string
(
volumeSource
.
VolumeID
)),
nil
return
file
path
.
Join
(
ebs
.
plugin
.
host
.
GetVolumeDevicePluginDir
(
awsElasticBlockStorePluginName
),
string
(
volumeSource
.
VolumeID
)),
nil
}
}
// GetPodDeviceMapPath returns pod device map path and volume name
// GetPodDeviceMapPath returns pod device map path and volume name
...
...
pkg/volume/aws_ebs/aws_ebs_block_test.go
View file @
6f82f407
...
@@ -18,7 +18,7 @@ package aws_ebs
...
@@ -18,7 +18,7 @@ package aws_ebs
import
(
import
(
"os"
"os"
"path"
"path
/filepath
"
"testing"
"testing"
"k8s.io/api/core/v1"
"k8s.io/api/core/v1"
...
@@ -47,7 +47,7 @@ func TestGetVolumeSpecFromGlobalMapPath(t *testing.T) {
...
@@ -47,7 +47,7 @@ func TestGetVolumeSpecFromGlobalMapPath(t *testing.T) {
//deferred clean up
//deferred clean up
defer
os
.
RemoveAll
(
tmpVDir
)
defer
os
.
RemoveAll
(
tmpVDir
)
expectedGlobalPath
:=
path
.
Join
(
tmpVDir
,
testGlobalPath
)
expectedGlobalPath
:=
file
path
.
Join
(
tmpVDir
,
testGlobalPath
)
//Bad Path
//Bad Path
badspec
,
err
:=
getVolumeSpecFromGlobalMapPath
(
""
)
badspec
,
err
:=
getVolumeSpecFromGlobalMapPath
(
""
)
...
@@ -102,8 +102,8 @@ func TestGetPodAndPluginMapPaths(t *testing.T) {
...
@@ -102,8 +102,8 @@ func TestGetPodAndPluginMapPaths(t *testing.T) {
//deferred clean up
//deferred clean up
defer
os
.
RemoveAll
(
tmpVDir
)
defer
os
.
RemoveAll
(
tmpVDir
)
expectedGlobalPath
:=
path
.
Join
(
tmpVDir
,
testGlobalPath
)
expectedGlobalPath
:=
file
path
.
Join
(
tmpVDir
,
testGlobalPath
)
expectedPodPath
:=
path
.
Join
(
tmpVDir
,
testPodPath
)
expectedPodPath
:=
file
path
.
Join
(
tmpVDir
,
testPodPath
)
spec
:=
getTestVolume
(
false
,
true
/*isBlock*/
)
spec
:=
getTestVolume
(
false
,
true
/*isBlock*/
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
:=
volume
.
VolumePluginMgr
{}
...
...
pkg/volume/aws_ebs/aws_ebs_test.go
View file @
6f82f407
...
@@ -19,7 +19,7 @@ package aws_ebs
...
@@ -19,7 +19,7 @@ package aws_ebs
import
(
import
(
"fmt"
"fmt"
"os"
"os"
"path"
"path
/filepath
"
"testing"
"testing"
"k8s.io/api/core/v1"
"k8s.io/api/core/v1"
...
@@ -129,7 +129,7 @@ func TestPlugin(t *testing.T) {
...
@@ -129,7 +129,7 @@ func TestPlugin(t *testing.T) {
t
.
Errorf
(
"Got a nil Mounter"
)
t
.
Errorf
(
"Got a nil Mounter"
)
}
}
volPath
:=
path
.
Join
(
tmpDir
,
"pods/poduid/volumes/kubernetes.io~aws-ebs/vol1"
)
volPath
:=
file
path
.
Join
(
tmpDir
,
"pods/poduid/volumes/kubernetes.io~aws-ebs/vol1"
)
path
:=
mounter
.
GetPath
()
path
:=
mounter
.
GetPath
()
if
path
!=
volPath
{
if
path
!=
volPath
{
t
.
Errorf
(
"Got unexpected path: %s"
,
path
)
t
.
Errorf
(
"Got unexpected path: %s"
,
path
)
...
...
pkg/volume/azure_dd/attacher.go
View file @
6f82f407
...
@@ -20,7 +20,6 @@ import (
...
@@ -20,7 +20,6 @@ import (
"context"
"context"
"fmt"
"fmt"
"os"
"os"
"path"
"path/filepath"
"path/filepath"
"runtime"
"runtime"
"strconv"
"strconv"
...
@@ -209,7 +208,7 @@ func (a *azureDiskAttacher) GetDeviceMountPath(spec *volume.Spec) (string, error
...
@@ -209,7 +208,7 @@ func (a *azureDiskAttacher) GetDeviceMountPath(spec *volume.Spec) (string, error
}
}
if
volumeSource
.
Kind
==
nil
{
// this spec was constructed from info on the node
if
volumeSource
.
Kind
==
nil
{
// this spec was constructed from info on the node
pdPath
:=
path
.
Join
(
a
.
plugin
.
host
.
GetPluginDir
(
azureDataDiskPluginName
),
mount
.
MountsInGlobalPDPath
,
volumeSource
.
DataDiskURI
)
pdPath
:=
file
path
.
Join
(
a
.
plugin
.
host
.
GetPluginDir
(
azureDataDiskPluginName
),
mount
.
MountsInGlobalPDPath
,
volumeSource
.
DataDiskURI
)
return
pdPath
,
nil
return
pdPath
,
nil
}
}
...
...
pkg/volume/azure_dd/azure_common.go
View file @
6f82f407
...
@@ -20,7 +20,7 @@ import (
...
@@ -20,7 +20,7 @@ import (
"fmt"
"fmt"
"io/ioutil"
"io/ioutil"
"os"
"os"
"path"
"path
/filepath
"
libstrings
"strings"
libstrings
"strings"
storage
"github.com/Azure/azure-sdk-for-go/arm/storage"
storage
"github.com/Azure/azure-sdk-for-go/arm/storage"
...
@@ -76,7 +76,7 @@ func makeGlobalPDPath(host volume.VolumeHost, diskUri string, isManaged bool) (s
...
@@ -76,7 +76,7 @@ func makeGlobalPDPath(host volume.VolumeHost, diskUri string, isManaged bool) (s
}
}
// "{m for managed b for blob}{hashed diskUri or DiskId depending on disk kind }"
// "{m for managed b for blob}{hashed diskUri or DiskId depending on disk kind }"
diskName
:=
fmt
.
Sprintf
(
uniqueDiskNameTemplate
,
prefix
,
hashedDiskUri
)
diskName
:=
fmt
.
Sprintf
(
uniqueDiskNameTemplate
,
prefix
,
hashedDiskUri
)
pdPath
:=
path
.
Join
(
host
.
GetPluginDir
(
azureDataDiskPluginName
),
mount
.
MountsInGlobalPDPath
,
diskName
)
pdPath
:=
file
path
.
Join
(
host
.
GetPluginDir
(
azureDataDiskPluginName
),
mount
.
MountsInGlobalPDPath
,
diskName
)
return
pdPath
,
nil
return
pdPath
,
nil
}
}
...
...
pkg/volume/azure_dd/azure_common_linux.go
View file @
6f82f407
...
@@ -20,7 +20,7 @@ package azure_dd
...
@@ -20,7 +20,7 @@ package azure_dd
import
(
import
(
"fmt"
"fmt"
"path"
"path
/filepath
"
"strconv"
"strconv"
libstrings
"strings"
libstrings
"strings"
...
@@ -124,7 +124,7 @@ func findDiskByLunWithConstraint(lun int, io ioHandler, azureDisks []string) (st
...
@@ -124,7 +124,7 @@ func findDiskByLunWithConstraint(lun int, io ioHandler, azureDisks []string) (st
if
lun
==
l
{
if
lun
==
l
{
// find the matching LUN
// find the matching LUN
// read vendor and model to ensure it is a VHD disk
// read vendor and model to ensure it is a VHD disk
vendorPath
:=
path
.
Join
(
sys_path
,
name
,
"vendor"
)
vendorPath
:=
file
path
.
Join
(
sys_path
,
name
,
"vendor"
)
vendorBytes
,
err
:=
io
.
ReadFile
(
vendorPath
)
vendorBytes
,
err
:=
io
.
ReadFile
(
vendorPath
)
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Errorf
(
"failed to read device vendor, err: %v"
,
err
)
glog
.
Errorf
(
"failed to read device vendor, err: %v"
,
err
)
...
@@ -136,7 +136,7 @@ func findDiskByLunWithConstraint(lun int, io ioHandler, azureDisks []string) (st
...
@@ -136,7 +136,7 @@ func findDiskByLunWithConstraint(lun int, io ioHandler, azureDisks []string) (st
continue
continue
}
}
modelPath
:=
path
.
Join
(
sys_path
,
name
,
"model"
)
modelPath
:=
file
path
.
Join
(
sys_path
,
name
,
"model"
)
modelBytes
,
err
:=
io
.
ReadFile
(
modelPath
)
modelBytes
,
err
:=
io
.
ReadFile
(
modelPath
)
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Errorf
(
"failed to read device model, err: %v"
,
err
)
glog
.
Errorf
(
"failed to read device model, err: %v"
,
err
)
...
@@ -149,7 +149,7 @@ func findDiskByLunWithConstraint(lun int, io ioHandler, azureDisks []string) (st
...
@@ -149,7 +149,7 @@ func findDiskByLunWithConstraint(lun int, io ioHandler, azureDisks []string) (st
}
}
// find a disk, validate name
// find a disk, validate name
dir
:=
path
.
Join
(
sys_path
,
name
,
"block"
)
dir
:=
file
path
.
Join
(
sys_path
,
name
,
"block"
)
if
dev
,
err
:=
io
.
ReadDir
(
dir
);
err
==
nil
{
if
dev
,
err
:=
io
.
ReadDir
(
dir
);
err
==
nil
{
found
:=
false
found
:=
false
devName
:=
dev
[
0
]
.
Name
()
devName
:=
dev
[
0
]
.
Name
()
...
...
pkg/volume/azure_file/azure_file_test.go
View file @
6f82f407
...
@@ -20,7 +20,7 @@ import (
...
@@ -20,7 +20,7 @@ import (
"fmt"
"fmt"
"io/ioutil"
"io/ioutil"
"os"
"os"
"path"
"path
/filepath
"
"reflect"
"reflect"
"strings"
"strings"
"testing"
"testing"
...
@@ -149,7 +149,7 @@ func testPlugin(t *testing.T, tmpDir string, volumeHost volume.VolumeHost) {
...
@@ -149,7 +149,7 @@ func testPlugin(t *testing.T, tmpDir string, volumeHost volume.VolumeHost) {
if
mounter
==
nil
{
if
mounter
==
nil
{
t
.
Errorf
(
"Got a nil Mounter"
)
t
.
Errorf
(
"Got a nil Mounter"
)
}
}
volPath
:=
path
.
Join
(
tmpDir
,
"pods/poduid/volumes/kubernetes.io~azure-file/vol1"
)
volPath
:=
file
path
.
Join
(
tmpDir
,
"pods/poduid/volumes/kubernetes.io~azure-file/vol1"
)
path
:=
mounter
.
GetPath
()
path
:=
mounter
.
GetPath
()
if
path
!=
volPath
{
if
path
!=
volPath
{
t
.
Errorf
(
"Got unexpected path: %s"
,
path
)
t
.
Errorf
(
"Got unexpected path: %s"
,
path
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment