class ManageClients(): def __init__(self, parent=None): self.clientmgr = ClientMgr(SERVICE, '/org/ganesha/nfsd/ClientMgr', 'org.ganesha.nfsd.clientmgr') def status_message(self, status, errormsg): print "Returns: status = %s, %s" % (str(status), errormsg) def addclient(self, ipaddr): print "Add a client %s" % (ipaddr) status, errormsg = self.clientmgr.AddClient(ipaddr) self.status_message(status, errormsg) def removeclient(self, ipaddr): print "Remove a client %s" % (ipaddr) status, errormsg = self.clientmgr.RemoveClient(ipaddr) self.status_message(status, errormsg) def showclients(self): print "Show clients" status, errormsg, reply = self.clientmgr.ShowClients() if status == True: ts = reply[0] clients = reply[1] self.proc_clients(ts, clients) else: self.status_message(status, errormsg) def proc_clients(self, ts, clients): print "Timestamp: ", time.ctime(ts[0]), ts[1], " nsecs" if len(clients) == 0: print "No clients" else: print "Clients:" print " IP addr, nfsv3, mnt, nlm4, rquota,nfsv40, nfsv41, nfsv42, 9p, last" for client in clients: print (" %s, %s, %s, %s, %s, %s, %s, %s, %s, %s %d nsecs" % (client.ClientIP, client.HasNFSv3, client.HasMNT, client.HasNLM4, client.HasRQUOTA, client.HasNFSv40, client.HasNFSv41, client.HasNFSv42, client.Has9P, time.ctime(client.LastTime[0]), client.LastTime[1]))
def __init__(self, parent=None): self.clientmgr = ClientMgr(SERVICE, '/org/ganesha/nfsd/ClientMgr', 'org.ganesha.nfsd.clientmgr')