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.
This commit is contained in:
Rafal Wojtczuk 2011-07-22 15:07:04 +02:00 committed by Marek Marczykowski
parent abd8b79864
commit 73ec4f595b

View File

@ -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"