vm/mix/net: fix handling network detach/attach on VM startup
- catch both QubesException and libvirtError - do not kill starting VM just because an error while connecting _other_ VMs to it - try to detach network first (and do not abort on error) - if libvirt/libxl will manage to cleanup stale interface this way, the attach operation below may succeed. Fixes QubesOS/qubes-issues#3163
This commit is contained in:
parent
86026e364f
commit
a6a7efc9a7
@ -262,15 +262,13 @@ class NetVMMixin(qubes.events.Emitter):
|
||||
vm.log.info('Attaching network')
|
||||
|
||||
try:
|
||||
# 1426
|
||||
vm.run('modprobe -r xen-netfront xennet',
|
||||
user='root', wait=True)
|
||||
except: # pylint: disable=bare-except
|
||||
pass
|
||||
vm.detach_network()
|
||||
except (qubes.exc.QubesException, libvirt.libvirtError):
|
||||
vm.log.warning('Cannot detach old network', exc_info=1)
|
||||
|
||||
try:
|
||||
vm.attach_network()
|
||||
except qubes.exc.QubesException:
|
||||
except (qubes.exc.QubesException, libvirt.libvirtError):
|
||||
vm.log.warning('Cannot attach network', exc_info=1)
|
||||
|
||||
@qubes.events.handler('domain-pre-shutdown')
|
||||
|
Loading…
Reference in New Issue
Block a user