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
2ffc7e0a
Unverified
Commit
2ffc7e0a
authored
Sep 18, 2018
by
k8s-ci-robot
Committed by
GitHub
Sep 18, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #68759 from davidz627/fix/testDelete
UnmountDevice (GetMountRefs) should not fail if path does not exist
parents
e7eb2691
704573d3
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
37 additions
and
7 deletions
+37
-7
mount_linux.go
pkg/util/mount/mount_linux.go
+5
-0
mount_linux_test.go
pkg/util/mount/mount_linux_test.go
+4
-0
mount_windows.go
pkg/util/mount/mount_windows.go
+5
-0
nsenter_mount.go
pkg/util/mount/nsenter_mount.go
+7
-0
operation_generator.go
pkg/volume/util/operationexecutor/operation_generator.go
+2
-0
pv_util.go
test/e2e/framework/pv_util.go
+3
-0
generic_persistent_volume-disruptive.go
test/e2e/storage/generic_persistent_volume-disruptive.go
+5
-4
nfs_persistent_volume-disruptive.go
test/e2e/storage/nfs_persistent_volume-disruptive.go
+6
-3
No files found.
pkg/util/mount/mount_linux.go
View file @
2ffc7e0a
...
@@ -1005,6 +1005,11 @@ func (mounter *Mounter) SafeMakeDir(subdir string, base string, perm os.FileMode
...
@@ -1005,6 +1005,11 @@ func (mounter *Mounter) SafeMakeDir(subdir string, base string, perm os.FileMode
}
}
func
(
mounter
*
Mounter
)
GetMountRefs
(
pathname
string
)
([]
string
,
error
)
{
func
(
mounter
*
Mounter
)
GetMountRefs
(
pathname
string
)
([]
string
,
error
)
{
if
_
,
err
:=
os
.
Stat
(
pathname
);
os
.
IsNotExist
(
err
)
{
return
[]
string
{},
nil
}
else
if
err
!=
nil
{
return
nil
,
err
}
realpath
,
err
:=
filepath
.
EvalSymlinks
(
pathname
)
realpath
,
err
:=
filepath
.
EvalSymlinks
(
pathname
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
...
pkg/util/mount/mount_linux_test.go
View file @
2ffc7e0a
...
@@ -110,6 +110,10 @@ func TestGetMountRefs(t *testing.T) {
...
@@ -110,6 +110,10 @@ func TestGetMountRefs(t *testing.T) {
"/var/lib/kubelet/plugins/kubernetes.io/gce-pd/mounts/gce-pd2"
,
"/var/lib/kubelet/plugins/kubernetes.io/gce-pd/mounts/gce-pd2"
,
},
},
},
},
{
"/var/fake/directory/that/doesnt/exist"
,
[]
string
{},
},
}
}
for
i
,
test
:=
range
tests
{
for
i
,
test
:=
range
tests
{
...
...
pkg/util/mount/mount_windows.go
View file @
2ffc7e0a
...
@@ -459,6 +459,11 @@ func getAllParentLinks(path string) ([]string, error) {
...
@@ -459,6 +459,11 @@ func getAllParentLinks(path string) ([]string, error) {
}
}
func
(
mounter
*
Mounter
)
GetMountRefs
(
pathname
string
)
([]
string
,
error
)
{
func
(
mounter
*
Mounter
)
GetMountRefs
(
pathname
string
)
([]
string
,
error
)
{
if
_
,
err
:=
os
.
Stat
(
normalizeWindowsPath
(
pathname
));
os
.
IsNotExist
(
err
)
{
return
[]
string
{},
nil
}
else
if
err
!=
nil
{
return
nil
,
err
}
refs
,
err
:=
getAllParentLinks
(
normalizeWindowsPath
(
pathname
))
refs
,
err
:=
getAllParentLinks
(
normalizeWindowsPath
(
pathname
))
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
...
pkg/util/mount/nsenter_mount.go
View file @
2ffc7e0a
...
@@ -337,6 +337,13 @@ func (mounter *NsenterMounter) SafeMakeDir(subdir string, base string, perm os.F
...
@@ -337,6 +337,13 @@ func (mounter *NsenterMounter) SafeMakeDir(subdir string, base string, perm os.F
}
}
func
(
mounter
*
NsenterMounter
)
GetMountRefs
(
pathname
string
)
([]
string
,
error
)
{
func
(
mounter
*
NsenterMounter
)
GetMountRefs
(
pathname
string
)
([]
string
,
error
)
{
exists
,
err
:=
mounter
.
ExistsPath
(
pathname
)
if
err
!=
nil
{
return
nil
,
err
}
if
!
exists
{
return
[]
string
{},
nil
}
hostpath
,
err
:=
mounter
.
ne
.
EvalSymlinks
(
pathname
,
true
/* mustExist */
)
hostpath
,
err
:=
mounter
.
ne
.
EvalSymlinks
(
pathname
,
true
/* mustExist */
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
...
pkg/volume/util/operationexecutor/operation_generator.go
View file @
2ffc7e0a
...
@@ -1433,6 +1433,8 @@ func isDeviceOpened(deviceToDetach AttachedVolume, mounter mount.Interface) (boo
...
@@ -1433,6 +1433,8 @@ func isDeviceOpened(deviceToDetach AttachedVolume, mounter mount.Interface) (boo
//TODO: refer to #36092
//TODO: refer to #36092
glog
.
V
(
3
)
.
Infof
(
"The path isn't device path or doesn't exist. Skip checking device path: %s"
,
deviceToDetach
.
DevicePath
)
glog
.
V
(
3
)
.
Infof
(
"The path isn't device path or doesn't exist. Skip checking device path: %s"
,
deviceToDetach
.
DevicePath
)
deviceOpened
=
false
deviceOpened
=
false
}
else
if
devicePathErr
!=
nil
{
return
false
,
deviceToDetach
.
GenerateErrorDetailed
(
"PathIsDevice failed"
,
devicePathErr
)
}
else
{
}
else
{
deviceOpened
,
deviceOpenedErr
=
mounter
.
DeviceOpened
(
deviceToDetach
.
DevicePath
)
deviceOpened
,
deviceOpenedErr
=
mounter
.
DeviceOpened
(
deviceToDetach
.
DevicePath
)
if
deviceOpenedErr
!=
nil
{
if
deviceOpenedErr
!=
nil
{
...
...
test/e2e/framework/pv_util.go
View file @
2ffc7e0a
...
@@ -507,6 +507,9 @@ func testPodSuccessOrFail(c clientset.Interface, ns string, pod *v1.Pod) error {
...
@@ -507,6 +507,9 @@ func testPodSuccessOrFail(c clientset.Interface, ns string, pod *v1.Pod) error {
// Deletes the passed-in pod and waits for the pod to be terminated. Resilient to the pod
// Deletes the passed-in pod and waits for the pod to be terminated. Resilient to the pod
// not existing.
// not existing.
func
DeletePodWithWait
(
f
*
Framework
,
c
clientset
.
Interface
,
pod
*
v1
.
Pod
)
error
{
func
DeletePodWithWait
(
f
*
Framework
,
c
clientset
.
Interface
,
pod
*
v1
.
Pod
)
error
{
if
pod
==
nil
{
return
nil
}
return
DeletePodWithWaitByName
(
f
,
c
,
pod
.
GetName
(),
pod
.
GetNamespace
())
return
DeletePodWithWaitByName
(
f
,
c
,
pod
.
GetName
(),
pod
.
GetNamespace
())
}
}
...
...
test/e2e/storage/generic_persistent_volume-disruptive.go
View file @
2ffc7e0a
...
@@ -61,10 +61,11 @@ var _ = utils.SIGDescribe("GenericPersistentVolume[Disruptive]", func() {
...
@@ -61,10 +61,11 @@ var _ = utils.SIGDescribe("GenericPersistentVolume[Disruptive]", func() {
var
(
var
(
clientPod
*
v1
.
Pod
clientPod
*
v1
.
Pod
pvc
*
v1
.
PersistentVolumeClaim
pvc
*
v1
.
PersistentVolumeClaim
pv
*
v1
.
PersistentVolume
)
)
BeforeEach
(
func
()
{
BeforeEach
(
func
()
{
framework
.
Logf
(
"Initializing pod and pvcs for test"
)
framework
.
Logf
(
"Initializing pod and pvcs for test"
)
clientPod
,
pvc
=
createPodPVCFromSC
(
f
,
c
,
ns
)
clientPod
,
pvc
,
pv
=
createPodPVCFromSC
(
f
,
c
,
ns
)
})
})
for
_
,
test
:=
range
disruptiveTestTable
{
for
_
,
test
:=
range
disruptiveTestTable
{
func
(
t
disruptiveTest
)
{
func
(
t
disruptiveTest
)
{
...
@@ -76,13 +77,13 @@ var _ = utils.SIGDescribe("GenericPersistentVolume[Disruptive]", func() {
...
@@ -76,13 +77,13 @@ var _ = utils.SIGDescribe("GenericPersistentVolume[Disruptive]", func() {
}
}
AfterEach
(
func
()
{
AfterEach
(
func
()
{
framework
.
Logf
(
"Tearing down test spec"
)
framework
.
Logf
(
"Tearing down test spec"
)
tearDownTestCase
(
c
,
f
,
ns
,
clientPod
,
pvc
,
nil
)
tearDownTestCase
(
c
,
f
,
ns
,
clientPod
,
pvc
,
pv
,
false
)
pvc
,
clientPod
=
nil
,
nil
pvc
,
clientPod
=
nil
,
nil
})
})
})
})
})
})
func
createPodPVCFromSC
(
f
*
framework
.
Framework
,
c
clientset
.
Interface
,
ns
string
)
(
*
v1
.
Pod
,
*
v1
.
PersistentVolumeClaim
)
{
func
createPodPVCFromSC
(
f
*
framework
.
Framework
,
c
clientset
.
Interface
,
ns
string
)
(
*
v1
.
Pod
,
*
v1
.
PersistentVolumeClaim
,
*
v1
.
PersistentVolume
)
{
var
err
error
var
err
error
test
:=
storageClassTest
{
test
:=
storageClassTest
{
name
:
"default"
,
name
:
"default"
,
...
@@ -99,5 +100,5 @@ func createPodPVCFromSC(f *framework.Framework, c clientset.Interface, ns string
...
@@ -99,5 +100,5 @@ func createPodPVCFromSC(f *framework.Framework, c clientset.Interface, ns string
By
(
"Creating a pod with dynamically provisioned volume"
)
By
(
"Creating a pod with dynamically provisioned volume"
)
pod
,
err
:=
framework
.
CreateNginxPod
(
c
,
ns
,
nil
,
pvcClaims
)
pod
,
err
:=
framework
.
CreateNginxPod
(
c
,
ns
,
nil
,
pvcClaims
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"While creating pods for kubelet restart test"
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"While creating pods for kubelet restart test"
)
return
pod
,
pvc
return
pod
,
pvc
,
pvs
[
0
]
}
}
test/e2e/storage/nfs_persistent_volume-disruptive.go
View file @
2ffc7e0a
...
@@ -208,7 +208,7 @@ var _ = utils.SIGDescribe("NFSPersistentVolumes[Disruptive][Flaky]", func() {
...
@@ -208,7 +208,7 @@ var _ = utils.SIGDescribe("NFSPersistentVolumes[Disruptive][Flaky]", func() {
AfterEach
(
func
()
{
AfterEach
(
func
()
{
framework
.
Logf
(
"Tearing down test spec"
)
framework
.
Logf
(
"Tearing down test spec"
)
tearDownTestCase
(
c
,
f
,
ns
,
clientPod
,
pvc
,
pv
)
tearDownTestCase
(
c
,
f
,
ns
,
clientPod
,
pvc
,
pv
,
true
/* force PV delete */
)
pv
,
pvc
,
clientPod
=
nil
,
nil
,
nil
pv
,
pvc
,
clientPod
=
nil
,
nil
,
nil
})
})
...
@@ -277,11 +277,14 @@ func initTestCase(f *framework.Framework, c clientset.Interface, pvConfig framew
...
@@ -277,11 +277,14 @@ func initTestCase(f *framework.Framework, c clientset.Interface, pvConfig framew
}
}
// tearDownTestCase destroy resources created by initTestCase.
// tearDownTestCase destroy resources created by initTestCase.
func
tearDownTestCase
(
c
clientset
.
Interface
,
f
*
framework
.
Framework
,
ns
string
,
client
*
v1
.
Pod
,
pvc
*
v1
.
PersistentVolumeClaim
,
pv
*
v1
.
PersistentVolume
)
{
func
tearDownTestCase
(
c
clientset
.
Interface
,
f
*
framework
.
Framework
,
ns
string
,
client
*
v1
.
Pod
,
pvc
*
v1
.
PersistentVolumeClaim
,
pv
*
v1
.
PersistentVolume
,
forceDeletePV
bool
)
{
// Ignore deletion errors. Failing on them will interrupt test cleanup.
// Ignore deletion errors. Failing on them will interrupt test cleanup.
framework
.
DeletePodWithWait
(
f
,
c
,
client
)
framework
.
DeletePodWithWait
(
f
,
c
,
client
)
framework
.
DeletePersistentVolumeClaim
(
c
,
pvc
.
Name
,
ns
)
framework
.
DeletePersistentVolumeClaim
(
c
,
pvc
.
Name
,
ns
)
if
pv
!=
nil
{
if
forceDeletePV
&&
pv
!=
nil
{
framework
.
DeletePersistentVolume
(
c
,
pv
.
Name
)
framework
.
DeletePersistentVolume
(
c
,
pv
.
Name
)
return
}
}
err
:=
framework
.
WaitForPersistentVolumeDeleted
(
c
,
pv
.
Name
,
5
*
time
.
Second
,
5
*
time
.
Minute
)
framework
.
ExpectNoError
(
err
,
"Persistent Volume %v not deleted by dynamic provisioner"
,
pv
.
Name
)
}
}
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