From 3d316ca2f96f156f4582cf8854d08294afb66c89 Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Thu, 19 Apr 2012 01:13:26 +0200 Subject: [PATCH] dom0/core: introduce "Starting" state (#520) Represent VM which is running, but gui daemon hasn't connected yet. --- dom0/qvm-core/qubes.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/dom0/qvm-core/qubes.py b/dom0/qvm-core/qubes.py index 8f6c7d0c..b081777c 100755 --- a/dom0/qvm-core/qubes.py +++ b/dom0/qvm-core/qubes.py @@ -632,14 +632,28 @@ class QubesVm(object): elif dominfo['dying']: return "Dying" else: - return "Running" + if not self.is_fully_usable(): + return "Starting" + else: + return "Running" else: return 'Halted' return "NA" + def is_fully_usable(self): + xid = self.get_xid() + if xid < 0: + return False + if not os.path.exists('/var/run/qubes/guid_running.%d' % xid): + return False + # currently qrexec daemon doesn't cleanup socket in /var/run/qubes, so + # it can be left from some other VM + return True + def is_running(self): - if self.get_power_state() == "Running": + # in terms of Xen and internal logic - starting VM is running + if self.get_power_state() in ["Running", "Starting"]: return True else: return False