def createLibvirtNetwork(self, network, bridged=True, iface=None, skipBackup=False): netXml = libvirt.createNetworkDef(network, bridged, iface) if not skipBackup: self._networkBackup(network) libvirt.createNetwork(netXml)
def restoreAtomicNetworkBackup(self): logging.info("Rolling back logical networks configuration " "(restoring atomic logical networks backup)") for network, content in six.iteritems(self._networksBackups): # 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: libvirt.removeNetwork(network) except libvirtError as e: if e.get_error_code() == VIR_ERR_NO_NETWORK: pass if content: libvirt.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 six.iteritems(self._networksBackups): # 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: libvirt.removeNetwork(network) except libvirtError as e: if e.get_error_code() == VIR_ERR_NO_NETWORK: pass if content: libvirt.createNetwork(content) logging.info('Restored %s', network)
def createLibvirtNetwork(self, network, bridged=True, iface=None): netXml = libvirt.createNetworkDef(network, bridged, iface) libvirt.createNetwork(netXml)
def create_libvirt_nets(libvirt_create): for net_xml in six.itervalues(libvirt_create): libvirt.createNetwork(net_xml)