class ServerAdmin(): def __init__(self, parent=None): self.admin = AdminInterface(SERVICE, '/org/ganesha/nfsd/admin', 'org.ganesha.nfsd.admin') def shutdown(self): print("Shutting down server.") status, msg = self.admin.shutdown() self.status_message(status, msg) def grace(self, ipaddr): print("Start grace period.") status, msg = self.admin.grace(ipaddr) self.status_message(status, msg) def purge_netgroups(self): print("Purging netgroups cache") status, msg = self.admin.purge_netgroups() self.status_message(status, msg) def purge_idmap(self): print("Purging idmapper cache") status, msg = self.admin.purge_idmap() self.status_message(status, msg) def purge_gids(self): print("Purging gids cache") status, msg = self.admin.purge_gids() self.status_message(status, msg) def status_message(self, status, errormsg): print("Returns: status = %s, %s" % (str(status), errormsg))
class ServerAdmin(): def __init__(self, parent=None): self.admin = AdminInterface(SERVICE, '/org/ganesha/nfsd/admin', 'org.ganesha.nfsd.admin') def shutdown(self): print("Shutting down server.") status, msg = self.admin.shutdown() self.status_message(status, msg) def grace(self, ipaddr): print("Start grace period.") status, msg = self.admin.grace(ipaddr) self.status_message(status, msg) def purge_netgroups(self): print("Purging netgroups cache") status, msg = self.admin.purge_netgroups() self.status_message(status, msg) def purge_idmap(self): print("Purging idmapper cache") status, msg = self.admin.purge_idmap() self.status_message(status, msg) def purge_gids(self): print("Purging gids cache") status, msg = self.admin.purge_gids() self.status_message(status, msg) def show_version(self): status, msg, versions = self.admin.GetAll() if status: print("NFS-Ganesha Release = V{}".format( versions['VERSION_RELEASE'])) try: print("ganesha compiled on {} at {}".format( versions['VERSION_COMPILE_DATE'], versions['VERSION_COMPILE_TIME'])) print("Release comment = {}".format( versions['VERSION_COMMENT'])) print("Git HEAD = {}".format(versions['VERSION_GIT_HEAD'])) print("Git Describe = {}".format( versions['VERSION_GIT_DESCRIBE'])) except KeyError: pass else: self.status_message(status, msg) def status_message(self, status, errormsg): print("Returns: status = %s, %s" % (str(status), errormsg))