def _remove_redundant_ovs_bridge(running_config): """ Remove OVS Bridge if there is no OVS net/bond anymore. """ for net, attr in iter_ovs_nets(running_config.networks): return for bond, attr in iter_ovs_bonds(running_config.bonds): return log('Removing redundant OVS bridge') destroy_ovs_bridge()
def _destroy_ovs_libvirt_nets(initial_config, running_config): log('Removing OVS and libvirt networks: %s %s' % (initial_config, running_config)) for libvirt_ovs_nets in (iter_ovs_nets(running_config.networks), iter_ovs_nets(initial_config.networks)): for net, attrs in libvirt_ovs_nets: with suppress(libvirtError): # network not found libvirt.removeNetwork(net) destroy_ovs_bridge()