@@ -109,24 +109,6 @@ func waitTillNPodsRunningOnNodes(ctx context.Context, c clientset.Interface, nod
109
109
})
110
110
}
111
111
112
- // Restart the passed-in nfs-server by issuing a `/usr/sbin/rpc.nfsd 1` command in the
113
- // pod's (only) container. This command changes the number of nfs server threads from
114
- // (presumably) zero back to 1, and therefore allows nfs to open connections again.
115
- func restartNfsServer (serverPod * v1.Pod ) {
116
- const startcmd = "/usr/sbin/rpc.nfsd 1"
117
- ns := fmt .Sprintf ("--namespace=%v" , serverPod .Namespace )
118
- e2ekubectl .RunKubectlOrDie (ns , "exec" , ns , serverPod .Name , "--" , "/bin/sh" , "-c" , startcmd )
119
- }
120
-
121
- // Stop the passed-in nfs-server by issuing a `/usr/sbin/rpc.nfsd 0` command in the
122
- // pod's (only) container. This command changes the number of nfs server threads to 0,
123
- // thus closing all open nfs connections.
124
- func stopNfsServer (serverPod * v1.Pod ) {
125
- const stopcmd = "/usr/sbin/rpc.nfsd 0"
126
- ns := fmt .Sprintf ("--namespace=%v" , serverPod .Namespace )
127
- e2ekubectl .RunKubectlOrDie (ns , "exec" , ns , serverPod .Name , "--" , "/bin/sh" , "-c" , stopcmd )
128
- }
129
-
130
112
// Creates a pod that mounts an nfs volume that is served by the nfs-server pod. The container
131
113
// will execute the passed in shell cmd. Waits for the pod to start.
132
114
// Note: the nfs plugin is defined inline, no PV or PVC.
@@ -437,7 +419,7 @@ var _ = SIGDescribe("kubelet", func() {
437
419
pod = createPodUsingNfs (ctx , f , c , ns , nfsIP , t .podCmd )
438
420
439
421
ginkgo .By ("Stop the NFS server" )
440
- stopNfsServer ( nfsServerPod )
422
+ e2evolume . StopNFSServer ( f , nfsServerPod )
441
423
442
424
ginkgo .By ("Delete the pod mounted to the NFS volume -- expect failure" )
443
425
err := e2epod .DeletePodWithWait (ctx , c , pod )
@@ -448,7 +430,7 @@ var _ = SIGDescribe("kubelet", func() {
448
430
checkPodCleanup (ctx , c , pod , false )
449
431
450
432
ginkgo .By ("Restart the nfs server" )
451
- restartNfsServer ( nfsServerPod )
433
+ e2evolume . RestartNFSServer ( f , nfsServerPod )
452
434
453
435
ginkgo .By ("Verify that the deleted client pod is now cleaned up" )
454
436
checkPodCleanup (ctx , c , pod , true )
0 commit comments