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
f2e89886
Commit
f2e89886
authored
Aug 25, 2017
by
Serguei Bezverkhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes cross platform build failure
Closes #51358
parent
acdf625e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
16 deletions
+19
-16
local.go
pkg/volume/local/local.go
+1
-16
volume_linux.go
pkg/volume/volume_linux.go
+14
-0
volume_unsupported.go
pkg/volume/volume_unsupported.go
+4
-0
No files found.
pkg/volume/local/local.go
View file @
f2e89886
...
...
@@ -20,7 +20,6 @@ import (
"fmt"
"github.com/golang/glog"
"os"
"syscall"
"k8s.io/api/core/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
...
...
@@ -233,7 +232,7 @@ func (m *localVolumeMounter) SetUpAt(dir string, fsGroup *int64) error {
if
len
(
refs
)
>
0
{
fsGroupNew
:=
int64
(
*
fsGroup
)
fsGroupSame
,
fsGroupOld
,
err
:=
i
sSameFSGroup
(
m
.
globalPath
,
fsGroupNew
)
fsGroupSame
,
fsGroupOld
,
err
:=
volume
.
I
sSameFSGroup
(
m
.
globalPath
,
fsGroupNew
)
if
err
!=
nil
{
err
=
fmt
.
Errorf
(
"failed to check fsGroup for %s (%v)"
,
m
.
globalPath
,
err
)
return
err
...
...
@@ -293,20 +292,6 @@ func (m *localVolumeMounter) SetUpAt(dir string, fsGroup *int64) error {
return
nil
}
// isSameFSGroup is called only for requests to mount an already mounted
// volume. It checks if fsGroup of new mount request is the same or not.
// It returns false if it not the same. It also returns current Gid of a path
// provided for dir variable.
func
isSameFSGroup
(
dir
string
,
fsGroup
int64
)
(
bool
,
int
,
error
)
{
info
,
err
:=
os
.
Stat
(
dir
)
if
err
!=
nil
{
glog
.
Errorf
(
"Error getting stats for %s (%v)"
,
dir
,
err
)
return
false
,
0
,
err
}
s
:=
info
.
Sys
()
.
(
*
syscall
.
Stat_t
)
return
int
(
s
.
Gid
)
==
int
(
fsGroup
),
int
(
s
.
Gid
),
nil
}
type
localVolumeUnmounter
struct
{
*
localVolume
}
...
...
pkg/volume/volume_linux.go
View file @
f2e89886
...
...
@@ -89,3 +89,17 @@ func SetVolumeOwnership(mounter Mounter, fsGroup *int64) error {
return
nil
})
}
// IsSameFSGroup is called only for requests to mount an already mounted
// volume. It checks if fsGroup of new mount request is the same or not.
// It returns false if it not the same. It also returns current Gid of a path
// provided for dir variable.
func
IsSameFSGroup
(
dir
string
,
fsGroup
int64
)
(
bool
,
int
,
error
)
{
info
,
err
:=
os
.
Stat
(
dir
)
if
err
!=
nil
{
glog
.
Errorf
(
"Error getting stats for %s (%v)"
,
dir
,
err
)
return
false
,
0
,
err
}
s
:=
info
.
Sys
()
.
(
*
syscall
.
Stat_t
)
return
int
(
s
.
Gid
)
==
int
(
fsGroup
),
int
(
s
.
Gid
),
nil
}
pkg/volume/volume_unsupported.go
View file @
f2e89886
...
...
@@ -21,3 +21,7 @@ package volume
func
SetVolumeOwnership
(
mounter
Mounter
,
fsGroup
*
int64
)
error
{
return
nil
}
func
IsSameFSGroup
(
dir
string
,
fsGroup
int64
)
(
bool
,
int
,
error
)
{
return
true
,
int
(
fsGroup
),
nil
}
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