Skip to content

Commit

Permalink
vm/mix/net: remove cleanup_vifs
Browse files Browse the repository at this point in the history
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
  • Loading branch information
marmarek committed Jun 6, 2017
1 parent fa1da42 commit 26f25ae
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions qubes/vm/mix/net.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,6 @@ def on_domain_started(self, event, **kwargs):
if not vm.is_running():
continue
vm.log.info('Attaching network')
# SEE: 1426
vm.cleanup_vifs()

try:
# 1426
Expand Down Expand Up @@ -285,26 +283,6 @@ def is_networked(self):

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():
Expand Down

0 comments on commit 26f25ae

Please sign in to comment.