diff mbox

[pynfs,04/12] Get rid of the client records as well as the session records

Message ID 1480228001-64821-5-git-send-email-loghyr@primarydata.com (mailing list archive)
State New, archived
Headers show

Commit Message

Thomas Haynes Nov. 27, 2016, 6:26 a.m. UTC
Signed-off-by: Tom Haynes <loghyr@primarydata.com>
---
 nfs4.1/nfs4client.py                | 5 ++++-
 nfs4.1/server41tests/environment.py | 5 +++++
 nfs4.1/testmod.py                   | 1 +
 3 files changed, 10 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/nfs4.1/nfs4client.py b/nfs4.1/nfs4client.py
index 0a25bcf..2e22695 100644
--- a/nfs4.1/nfs4client.py
+++ b/nfs4.1/nfs4client.py
@@ -40,6 +40,7 @@  class NFS4Client(rpc.Client, rpc.Server):
         self.server_address = (host, port)
         self.c1 = self.connect(self.server_address)
         self.sessions = {} # XXX Really, this should be per server
+        self.clients = {} # XXX Really, this should be per server
         self.ctrl_proc = ctrl_proc
         self.summary = summary
 
@@ -313,7 +314,9 @@  class NFS4Client(rpc.Client, rpc.Server):
                             cred)
         nfs4lib.check(res, expect)
         if expect == NFS4_OK:
-            return ClientRecord(res.resarray[0], self, cred, protect)
+            client_rec = ClientRecord(res.resarray[0], self, cred, protect)
+            self.clients[client_rec.clientid] = client_rec
+            return client_rec
         else:
             return None
 
diff --git a/nfs4.1/server41tests/environment.py b/nfs4.1/server41tests/environment.py
index 7384b3c..a910a69 100644
--- a/nfs4.1/server41tests/environment.py
+++ b/nfs4.1/server41tests/environment.py
@@ -257,6 +257,11 @@  class Environment(testmod.Environment):
         for sessionid in self.c1.sessions.keys():
             self.c1.compound([op.destroy_session(sessionid)])
 
+    def clean_clients(self):
+        """Destroy client name env.c1"""
+        for clientid in self.c1.clients.keys():
+            self.c1.compound([op.destroy_clientid(clientid)])
+
 #########################################
 debug_fail = False
 
diff --git a/nfs4.1/testmod.py b/nfs4.1/testmod.py
index ce25974..c5ca0fe 100644
--- a/nfs4.1/testmod.py
+++ b/nfs4.1/testmod.py
@@ -222,6 +222,7 @@  class Test(object):
             self.runtest(self, environment)
             self.result = self._pass_result
 	    environment.clean_sessions()
+	    environment.clean_clients()
         except KeyboardInterrupt:
             raise
         except TestException, e: