vm/mix/net: remove cleanup_vifs

With libvirt in place, this isn't enough - libvirt also keep VM
configuration in its memory and adjusting xenstore doesn't change that.
In fact changing xenstore behind it back make it even worse in some
situations.

QubesOS/qubes-issues#1426
This commit is contained in:
Marek Marczykowski-Górecki 2017-06-06 22:17:00 +02:00
parent fa1da422d1
commit 26f25aeecd
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -203,8 +203,6 @@ class NetVMMixin(qubes.events.Emitter):
if not vm.is_running(): if not vm.is_running():
continue continue
vm.log.info('Attaching network') vm.log.info('Attaching network')
# SEE: 1426
vm.cleanup_vifs()
try: try:
# 1426 # 1426
@ -285,26 +283,6 @@ class NetVMMixin(qubes.events.Emitter):
return self.netvm is not None return self.netvm is not None
def cleanup_vifs(self):
'''Remove stale network device backends.
Libvirt does not remove vif when backend domain is down, so we must do
it manually. This method is one big hack for #1426.
'''
dev_basepath = '/local/domain/%d/device/vif' % self.xid
for dev in self.app.vmm.xs.ls('', dev_basepath) or []:
# check if backend domain is alive
backend_xid = int(self.app.vmm.xs.read('',
'{}/{}/backend-id'.format(dev_basepath, dev)))
if backend_xid in self.app.vmm.libvirt_conn.listDomainsID():
# check if device is still active
if self.app.vmm.xs.read('',
'{}/{}/state'.format(dev_basepath, dev)) == '4':
continue
# remove dead device
self.app.vmm.xs.rm('', '{}/{}'.format(dev_basepath, dev))
def reload_firewall_for_vm(self, vm): def reload_firewall_for_vm(self, vm):
''' Reload the firewall rules for the vm ''' ''' Reload the firewall rules for the vm '''
if not self.is_running(): if not self.is_running():