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
This commit is contained in:
parent
b985bf3b65
commit
77da23fba2
@ -88,7 +88,11 @@ class QfileDaemonDvm:
|
|||||||
assert os.path.exists(sys.argv[5]), "Invalid firewall.conf location"
|
assert os.path.exists(sys.argv[5]), "Invalid firewall.conf location"
|
||||||
dispvm.firewall_conf = sys.argv[5]
|
dispvm.firewall_conf = sys.argv[5]
|
||||||
if vm.qid != 0:
|
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
|
# Wait for tar to finish
|
||||||
if tar_process.wait() != 0:
|
if tar_process.wait() != 0:
|
||||||
sys.stderr.write('Failed to unpack saved-cows.tar')
|
sys.stderr.write('Failed to unpack saved-cows.tar')
|
||||||
@ -96,6 +100,10 @@ class QfileDaemonDvm:
|
|||||||
return None
|
return None
|
||||||
print >>sys.stderr, "time=%s, VM starting" % (str(time.time()))
|
print >>sys.stderr, "time=%s, VM starting" % (str(time.time()))
|
||||||
dispvm.start()
|
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()))
|
print >>sys.stderr, "time=%s, VM started" % (str(time.time()))
|
||||||
qvm_collection.save()
|
qvm_collection.save()
|
||||||
qvm_collection.unlock_db()
|
qvm_collection.unlock_db()
|
||||||
|
Loading…
Reference in New Issue
Block a user