modified ctrlnets to use an id starting at 9001, to avoid string based ids

This commit is contained in:
Blake Harnden 2019-10-21 09:36:07 -07:00
parent 18e5598203
commit d056578e9d
2 changed files with 4 additions and 5 deletions

View file

@ -71,6 +71,7 @@ NODES = {
NodeTypes.LXC: LxcNode,
}
NODES_TYPE = {NODES[x]: x for x in NODES}
CTRL_NET_ID = 9001
class Session(object):
@ -1667,9 +1668,7 @@ class Session(object):
return -1
def get_control_net(self, net_index):
# TODO: all nodes use an integer id and now this wants to use a string
_id = f"ctrl{net_index}net"
return self.get_node(_id)
return self.get_node(CTRL_NET_ID + net_index)
def add_remove_control_net(self, net_index, remove=False, conf_required=True):
"""
@ -1716,7 +1715,7 @@ class Session(object):
return None
# 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.
updown_script = None

View file

@ -723,7 +723,7 @@ class CtrlNet(CoreNetwork):
def __init__(
self,
session,
_id="ctrlnet",
_id=None,
name=None,
prefix=None,
hostid=None,