Browse Source

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
Marek Marczykowski-Górecki 7 years ago
parent
commit
26f25aeecd
1 changed files with 0 additions and 22 deletions
  1. 0 22
      qubes/vm/mix/net.py

+ 0 - 22
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():