From 4d620b0904096addd52f74cc8c67210ba1f3a656 Mon Sep 17 00:00:00 2001 From: Agnieszka Kostrzewa Date: Tue, 24 Apr 2012 12:06:08 +0200 Subject: [PATCH] Logs available for non-running VMs --- qubesmanager/main.py | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/qubesmanager/main.py b/qubesmanager/main.py index 00f08f6..6991ac7 100755 --- a/qubesmanager/main.py +++ b/qubesmanager/main.py @@ -1398,26 +1398,29 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow): running = vm.is_running() #logs menu - if not running: - self.logs_menu.setEnabled(False) - else: - self.logs_menu.clear() + self.logs_menu.clear() + if vm.qid == 0: + text = "/var/log/xen/console/hypervisor.log" + action = self.logs_menu.addAction(QIcon(":/log.png"), text) + action.setData(QVariant(text)) self.logs_menu.setEnabled(True) - - xid = vm.xid - - #xl console - if xid != None: - if xid != 0: - text = "/var/log/xen/console/guest-"+vm.name+".log" - action = self.logs_menu.addAction(QIcon(":/log.png"), text) - action.setData(QVariant(text)) + else: + menu_empty = True + text = "/var/log/xen/console/guest-"+vm.name+".log" + if os.path.exists(text): + action = self.logs_menu.addAction(QIcon(":/log.png"), text) + action.setData(QVariant(text)) + menu_empty = False - text = "/var/log/xen/console/guest-"+vm.name+"-dm.log" - if os.path.exists(text): - action = self.logs_menu.addAction(QIcon(":/log.png"), text) - action.setData(QVariant(text)) + text = "/var/log/xen/console/guest-"+vm.name+"-dm.log" + if os.path.exists(text): + action = self.logs_menu.addAction(QIcon(":/log.png"), text) + action.setData(QVariant(text)) + menu_empty = False + if running: + xid = vm.xid + if xid != None: text = "/var/log/qubes/guid."+str(xid)+".log" action = self.logs_menu.addAction(QIcon(":/log.png"), text) action.setData(QVariant(text)) @@ -1425,11 +1428,10 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow): text = "/var/log/qubes/qrexec."+str(xid)+".log" action = self.logs_menu.addAction(QIcon(":/log.png"), text) action.setData(QVariant(text)) - else: - text = "/var/log/xen/console/hypervisor.log" - action = self.logs_menu.addAction(QIcon(":/log.png"), text) - action.setData(QVariant(text)) + menu_empty = False + self.logs_menu.setEnabled(not menu_empty) + # blk menu if not running: self.blk_menu.setEnabled(False)