From 26f25aeecdb4950089a208471617bae3d8c020cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 6 Jun 2017 22:17:00 +0200 Subject: [PATCH] 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 --- qubes/vm/mix/net.py | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/qubes/vm/mix/net.py b/qubes/vm/mix/net.py index fefbcddb..580656af 100644 --- a/qubes/vm/mix/net.py +++ b/qubes/vm/mix/net.py @@ -203,8 +203,6 @@ class NetVMMixin(qubes.events.Emitter): if not vm.is_running(): continue vm.log.info('Attaching network') - # SEE: 1426 - vm.cleanup_vifs() try: # 1426 @@ -285,26 +283,6 @@ class NetVMMixin(qubes.events.Emitter): 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): ''' Reload the firewall rules for the vm ''' if not self.is_running():