From 73ec4f595b6cb3c322e62534b85eaac5cefdd7e3 Mon Sep 17 00:00:00 2001 From: Rafal Wojtczuk Date: Fri, 22 Jul 2011 15:07:04 +0200 Subject: [PATCH] qubes.py: postpone qmmeman.close() There are indications that when parent "xl" process exits, the domain is not booted completely; and xl actions may interfere with qmemman memory balancing. Thus, in VM.start(), we delay releasing of qmemman handle until qrexec_daemon connects successfully. --- dom0/qvm-core/qubes.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dom0/qvm-core/qubes.py b/dom0/qvm-core/qubes.py index 2180407e..ab4c594e 100755 --- a/dom0/qvm-core/qubes.py +++ b/dom0/qvm-core/qubes.py @@ -943,8 +943,6 @@ class QubesVm(object): subprocess.check_call(xl_cmdline) except: raise QubesException("Failed to load VM config") - finally: - qmemman_client.close() # let qmemman_daemon resume balancing xid = self.get_xid() self.xid = xid @@ -976,6 +974,13 @@ class QubesVm(object): self.force_shutdown() raise OSError ("ERROR: Cannot execute qrexec_daemon!") +# close() is not really needed, because the descriptor is close-on-exec +# anyway, the reason to postpone close() is that possibly xl is not done +# constructing the domain after its main process exits +# so we close() when we know the domain is up +# the successful qrexec connect is a good indicator of it + qmemman_client.close() + if preparing_dvm: if verbose: print "--> Preparing config template for DispVM"