modified ctrlnets to use an id starting at 9001, to avoid string based ids
This commit is contained in:
parent
18e5598203
commit
d056578e9d
2 changed files with 4 additions and 5 deletions
|
@ -71,6 +71,7 @@ NODES = {
|
||||||
NodeTypes.LXC: LxcNode,
|
NodeTypes.LXC: LxcNode,
|
||||||
}
|
}
|
||||||
NODES_TYPE = {NODES[x]: x for x in NODES}
|
NODES_TYPE = {NODES[x]: x for x in NODES}
|
||||||
|
CTRL_NET_ID = 9001
|
||||||
|
|
||||||
|
|
||||||
class Session(object):
|
class Session(object):
|
||||||
|
@ -1667,9 +1668,7 @@ class Session(object):
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
def get_control_net(self, net_index):
|
def get_control_net(self, net_index):
|
||||||
# TODO: all nodes use an integer id and now this wants to use a string
|
return self.get_node(CTRL_NET_ID + net_index)
|
||||||
_id = f"ctrl{net_index}net"
|
|
||||||
return self.get_node(_id)
|
|
||||||
|
|
||||||
def add_remove_control_net(self, net_index, remove=False, conf_required=True):
|
def add_remove_control_net(self, net_index, remove=False, conf_required=True):
|
||||||
"""
|
"""
|
||||||
|
@ -1716,7 +1715,7 @@ class Session(object):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# build a new controlnet bridge
|
# build a new controlnet bridge
|
||||||
_id = f"ctrl{net_index}net"
|
_id = CTRL_NET_ID + net_index
|
||||||
|
|
||||||
# use the updown script for control net 0 only.
|
# use the updown script for control net 0 only.
|
||||||
updown_script = None
|
updown_script = None
|
||||||
|
|
|
@ -723,7 +723,7 @@ class CtrlNet(CoreNetwork):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
session,
|
session,
|
||||||
_id="ctrlnet",
|
_id=None,
|
||||||
name=None,
|
name=None,
|
||||||
prefix=None,
|
prefix=None,
|
||||||
hostid=None,
|
hostid=None,
|
||||||
|
|
Loading…
Add table
Reference in a new issue