Network: do not check existence at __init__
This causes a verbose error on normal behaviour that cannot be muted
This commit is contained in:
parent
5f3e504913
commit
e310032b36
1 changed files with 1 additions and 9 deletions
|
@ -4,8 +4,6 @@ from . import settings
|
||||||
from . import util
|
from . import util
|
||||||
from .xml_template import XMLTemplate
|
from .xml_template import XMLTemplate
|
||||||
|
|
||||||
import libvirt
|
|
||||||
|
|
||||||
|
|
||||||
class Network(util.LibvirtObject):
|
class Network(util.LibvirtObject):
|
||||||
class AlreadyExists(Exception):
|
class AlreadyExists(Exception):
|
||||||
|
@ -18,19 +16,13 @@ class Network(util.LibvirtObject):
|
||||||
if not name:
|
if not name:
|
||||||
name = str(self.id)
|
name = str(self.id)
|
||||||
|
|
||||||
self.name = settings.PREFIX + "_" + name
|
self.name = settings.PREFIX + "_link_" + name
|
||||||
self.bridge_id = settings.NETWORK_ID * 0xFF + self.id
|
self.bridge_id = settings.NETWORK_ID * 0xFF + self.id
|
||||||
self.bridge_mac = util.MACAddress(self.id, None)
|
self.bridge_mac = util.MACAddress(self.id, None)
|
||||||
self.ipv4 = util.Addrv4(self.id, None)
|
self.ipv4 = util.Addrv4(self.id, None)
|
||||||
self.ipv6 = util.Addrv6(self.id, None)
|
self.ipv6 = util.Addrv6(self.id, None)
|
||||||
self.lxc_network = None
|
self.lxc_network = None
|
||||||
|
|
||||||
try:
|
|
||||||
if self.conn.networkLookupByName(self.name):
|
|
||||||
raise self.AlreadyExists()
|
|
||||||
except libvirt.libvirtError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def create(self):
|
def create(self):
|
||||||
if self.lxc_network:
|
if self.lxc_network:
|
||||||
raise self.AlreadyExists()
|
raise self.AlreadyExists()
|
||||||
|
|
Loading…
Reference in a new issue