mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 02:34:03 +00:00
Merge pull request #51706 from zhangxiaoyu-zidif/fix-format-local-follow-go
Automatic merge from submit-queue (batch tested with PRs 51819, 51706, 51761, 51818, 51500) Fix local storage code to follow go style **What this PR does / why we need it**: Fix local storage code to follow go style **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
This commit is contained in:
commit
765d9089d2
@ -18,9 +18,10 @@ package local
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/golang/glog"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/golang/glog"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
@ -204,8 +205,7 @@ func (m *localVolumeMounter) SetUpAt(dir string, fsGroup *int64) error {
|
|||||||
defer m.plugin.volumeLocks.UnlockKey(m.globalPath)
|
defer m.plugin.volumeLocks.UnlockKey(m.globalPath)
|
||||||
|
|
||||||
if m.globalPath == "" {
|
if m.globalPath == "" {
|
||||||
err := fmt.Errorf("LocalVolume volume %q path is empty", m.volName)
|
return fmt.Errorf("LocalVolume volume %q path is empty", m.volName)
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err := validation.ValidatePathNoBacksteps(m.globalPath)
|
err := validation.ValidatePathNoBacksteps(m.globalPath)
|
||||||
@ -234,8 +234,7 @@ func (m *localVolumeMounter) SetUpAt(dir string, fsGroup *int64) error {
|
|||||||
fsGroupNew := int64(*fsGroup)
|
fsGroupNew := int64(*fsGroup)
|
||||||
fsGroupSame, fsGroupOld, err := volume.IsSameFSGroup(m.globalPath, fsGroupNew)
|
fsGroupSame, fsGroupOld, err := volume.IsSameFSGroup(m.globalPath, fsGroupNew)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("failed to check fsGroup for %s (%v)", m.globalPath, err)
|
return fmt.Errorf("failed to check fsGroup for %s (%v)", m.globalPath, err)
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
if !fsGroupSame {
|
if !fsGroupSame {
|
||||||
m.plugin.recorder.Eventf(m.pod, v1.EventTypeWarning, events.WarnAlreadyMountedVolume, "The requested fsGroup is %d, but the volume %s has GID %d. The volume may not be shareable.", fsGroupNew, m.volName, fsGroupOld)
|
m.plugin.recorder.Eventf(m.pod, v1.EventTypeWarning, events.WarnAlreadyMountedVolume, "The requested fsGroup is %d, but the volume %s has GID %d. The volume may not be shareable.", fsGroupNew, m.volName, fsGroupOld)
|
||||||
|
Loading…
Reference in New Issue
Block a user