From 77da23fba2937fa546427635c94f9f0cbc511ecf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sun, 3 May 2015 20:40:37 +0200 Subject: [PATCH] dispvm: fix netvm presence reporting If desired netvm presence is different than during savefile creation(*), defer setting the netvm until new DispVM is running - otherwise kernel there will not notice the change and will either have (not working) 'eth0' when it shouldn't, or will not have it while it should. Additionally set dispvm.uses_default_netvm = False, so GUI tools will display actual netvm value. (*) Actually compare to netvm set for dispvm template (`TEMPLATE-dvm` VM), which can be different if user just changed that but not regenerated dispvm savefile yet. Fixes qubesos/qubes-issues#985 Related to qubesos/qubes-issues#862 --- dispvm/qfile-daemon-dvm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dispvm/qfile-daemon-dvm b/dispvm/qfile-daemon-dvm index 0e872350..7a59113b 100755 --- a/dispvm/qfile-daemon-dvm +++ b/dispvm/qfile-daemon-dvm @@ -88,7 +88,11 @@ class QfileDaemonDvm: assert os.path.exists(sys.argv[5]), "Invalid firewall.conf location" dispvm.firewall_conf = sys.argv[5] if vm.qid != 0: - dispvm.netvm = vm.dispvm_netvm + dispvm.uses_default_netvm = False + # netvm can be changed before restore, + # but cannot be enabled/disabled + if (dispvm.netvm is None) == (vm.dispvm_netvm is None): + dispvm.netvm = vm.dispvm_netvm # Wait for tar to finish if tar_process.wait() != 0: sys.stderr.write('Failed to unpack saved-cows.tar') @@ -96,6 +100,10 @@ class QfileDaemonDvm: return None print >>sys.stderr, "time=%s, VM starting" % (str(time.time())) dispvm.start() + if vm.qid != 0: + # if need to enable/disable netvm, do it while DispVM is alive + if (dispvm.netvm is None) != (vm.dispvm_netvm is None): + dispvm.netvm = vm.dispvm_netvm print >>sys.stderr, "time=%s, VM started" % (str(time.time())) qvm_collection.save() qvm_collection.unlock_db()