def __init__(self, sysbus, parent=None): super(ShowExports, self).__init__() self.exportmgr = ExportMgr(SERVICE, '/org/ganesha/nfsd/ExportMgr', sysbus, self.show_status) self.show_status.connect(self.status_message) self.exportmgr.show_exports.connect(self.proc_exports) self.exportmgr.display_export.connect(self.proc_export)
class ShowExports(QtCore.QObject): show_status = QtCore.pyqtSignal(bool, str) def __init__(self, sysbus, parent=None): super(ShowExports, self).__init__() self.exportmgr = ExportMgr(SERVICE, '/org/ganesha/nfsd/ExportMgr', sysbus, self.show_status) self.show_status.connect(self.status_message) self.exportmgr.show_exports.connect(self.proc_exports) self.exportmgr.display_export.connect(self.proc_export) def showexports(self): self.exportmgr.ShowExports() print("Show exports") def addexport(self, conf_path, exp_expr): self.exportmgr.AddExport(conf_path, exp_expr) print("Add Export in %s" % conf_path) def updateexport(self, conf_path, exp_expr): self.exportmgr.UpdateExport(conf_path, exp_expr) print("Update Export in %s" % conf_path) def removeexport(self, exp_id): self.exportmgr.RemoveExport(exp_id) print("Remove Export with id %d" % int(exp_id)) def displayexport(self, exp_id): self.exportmgr.DisplayExport(exp_id) print("Display export with id %d" % int(exp_id)) def proc_export(self, id, path, pseudo, tag): print("export %d: path = %s, pseudo = %s, tag = %s" % (id, path, pseudo, tag)) sys.exit() def proc_exports(self, ts, exports): print("Timestamp: ", time.ctime(ts[0]), ts[1], " nsecs") if len(exports) == 0: print("No exports") else: print("Exports:") print( " Id, path, nfsv3, mnt, nlm4, rquota,nfsv40, nfsv41, 9p, last" ) for export in exports: print( " %d, %s, %s, %s, %s, %s, %s, %s, %s, %s %d nsecs" % (export.ExportID, export.ExportPath, export.HasNFSv3, export.HasMNT, export.HasNLM4, export.HasRQUOTA, export.HasNFSv40, export.HasNFSv41, export.Has9P, time.ctime(export.LastTime[0]), export.LastTime[1])) sys.exit() def status_message(self, status, errormsg): print("Error: status = %s, %s" % (str(status), errormsg)) sys.exit()
class ShowExports(QtCore.QObject): show_status = QtCore.pyqtSignal(bool, str) def __init__(self, sysbus, parent=None): super(ShowExports, self).__init__() self.exportmgr = ExportMgr(SERVICE, '/org/ganesha/nfsd/ExportMgr', sysbus, self.show_status) self.show_status.connect(self.status_message) self.exportmgr.show_exports.connect(self.proc_exports) def showexports(self): self.exportmgr.ShowExports() print "Show exports" def proc_exports(self, ts, exports): print "Timestamp: ", time.ctime(ts[0]), ts[1], " nsecs" if len(exports) == 0: print "No exports" else: print "Exports:" print " Id, path, nfsv3, mnt, nlm4, rquota,nfsv40, nfsv41, 9p, last" for export in exports: print( " %d, %s, %s, %s, %s, %s, %s, %s, %s, %s %d nsecs" % (export.ExportID, export.ExportPath, export.HasNFSv3, export.HasMNT, export.HasNLM4, export.HasRQUOTA, export.HasNFSv40, export.HasNFSv41, export.Has9P, time.ctime(export.LastTime[0]), export.LastTime[1])) sys.exit() def status_message(self, status, errormsg): print "Error: status = %s, %s" % (str(status), errormsg) sys.exit()
def __init__(self, sysbus, parent=None): QtGui.QWidget.__init__(self, parent) # Init ourself from the Designer UI self.ui = Ui_MainWindow() self.ui.setupUi(self) # light up the admin interface self.admin = AdminInterface(SERVICE, '/org/ganesha/nfsd/admin', sysbus, self.show_status) self.exportmgr = ExportMgr(SERVICE, '/org/ganesha/nfsd/ExportMgr', sysbus, self.show_status) self.clientmgr = ClientMgr(SERVICE, '/org/ganesha/nfsd/ClientMgr', sysbus, self.show_status) self.logmanager = LogManager(SERVICE, sysbus, self.show_status) self.logdialog = LogSetDialog(self.logmanager) self.show_status.connect(self.status_message) # Connect up the ui menubar #File self.ui.actionDBus_connect.triggered.connect(self.connect_gsh) self.ui.actionQuit.triggered.connect(self.quit) #Manage #Manage->Clients self.ui.actionAdd_Client.triggered.connect(self.add_client) self.ui.actionRemove_Client.triggered.connect(self.remove_client) #Manage->Exports self.ui.actionExports.triggered.connect(self.export_mgr) #Manage->Log Levels self.ui.actionLog_Settings.triggered.connect(self.logsettings) #Manage->Admin self.ui.actionReset_Grace.triggered.connect(self.reset_grace) self.ui.actionShutdown.triggered.connect(self.shutdown) self.ui.actionReload.triggered.connect(self.reload) #View self.ui.actionStatistics.triggered.connect(self.stats) self.ui.actionViewExports.triggered.connect(self.view_exports) self.ui.actionViewClients.triggered.connect(self.view_clients) #Help self.ui.actionAbout.triggered.connect(self.help) # Dbus data models self.exports_show_model = ExportTableModel(self.exportmgr) self.clients_show_model = ClientTableModel(self.clientmgr) # Tabs, tables, and views self.ui.exports.setModel(self.exports_show_model) self.ui.exports.resizeColumnsToContents() self.ui.exports.verticalHeader().setVisible(False) self.ui.clients.setModel(self.clients_show_model) self.ui.clients.resizeColumnsToContents() self.ui.clients.verticalHeader().setVisible(False)