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 .xml_template import XMLTemplate
|
||||
|
||||
import libvirt
|
||||
|
||||
|
||||
class Network(util.LibvirtObject):
|
||||
class AlreadyExists(Exception):
|
||||
|
@ -18,19 +16,13 @@ class Network(util.LibvirtObject):
|
|||
if not name:
|
||||
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_mac = util.MACAddress(self.id, None)
|
||||
self.ipv4 = util.Addrv4(self.id, None)
|
||||
self.ipv6 = util.Addrv6(self.id, None)
|
||||
self.lxc_network = None
|
||||
|
||||
try:
|
||||
if self.conn.networkLookupByName(self.name):
|
||||
raise self.AlreadyExists()
|
||||
except libvirt.libvirtError:
|
||||
pass
|
||||
|
||||
def create(self):
|
||||
if self.lxc_network:
|
||||
raise self.AlreadyExists()
|
||||
|
|
Loading…
Reference in a new issue