Beispiel #1
0
 def createLibvirtNetwork(
     self, network, bridged=True, iface=None, skipBackup=False, qosInbound=None, qosOutbound=None
 ):
     netXml = libvirtCfg.createNetworkDef(network, bridged, iface, qosInbound=qosInbound, qosOutbound=qosOutbound)
     if not skipBackup:
         self._networkBackup(network)
     libvirtCfg.createNetwork(netXml)
Beispiel #2
0
 def createLibvirtNetwork(self, network, bridged=True, iface=None,
                          skipBackup=False, qosInbound=None,
                          qosOutbound=None):
     netXml = libvirtCfg.createNetworkDef(network, bridged, iface,
                                          qosInbound=qosInbound,
                                          qosOutbound=qosOutbound)
     if not skipBackup:
         self._networkBackup(network)
     libvirtCfg.createNetwork(netXml)
Beispiel #3
0
    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)
Beispiel #4
0
    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)
Beispiel #5
0
 def createLibvirtNetwork(self, network, bridged, iface, qosInbound=None,
                          qosOutbound=None):
     netXml = libvirtCfg.createNetworkDef(network, bridged, iface,
                                          qosInbound, qosOutbound)
     libvirtCfg.createNetwork(netXml)