def restoreAtomicNetworkBackup(self): logging.info("Rolling back logical networks configuration " "(restoring atomic logical networks backup)") for network, content in self._networksBackups.iteritems(): # Networks with content None should be removed. # Networks with real content should be recreated. # To avoid libvirt errors during recreation we need # to remove the old network first try: libvirtCfg.removeNetwork(network) except libvirt.libvirtError as e: if e.get_error_code() == libvirt.VIR_ERR_NO_NETWORK: pass if content: libvirtCfg.createNetwork(content) logging.info("Restored %s", network)
def restoreAtomicNetworkBackup(self): logging.info("Rolling back logical networks configuration " "(restoring atomic logical networks backup)") for network, content in self._networksBackups.iteritems(): # Networks with content None should be removed. # Networks with real content should be recreated. # To avoid libvirt errors during recreation we need # to remove the old network first try: libvirtCfg.removeNetwork(network) except libvirt.libvirtError as e: if e.get_error_code() == libvirt.VIR_ERR_NO_NETWORK: pass if content: libvirtCfg.createNetwork(content) logging.info('Restored %s', network)
def removeLibvirtNetwork(self, network, skipBackup=False): if not skipBackup: self._networkBackup(network) libvirtCfg.removeNetwork(network)
def removeLibvirtNetwork(self, network): libvirtCfg.removeNetwork(network)