Generate bridge.conf instead of just list of bridges

QEMU's bridge.conf is now directly usable, yet really easy to both
generate and parse, should that be needed in the future.

This partially breaks layers of abstraction, but the point of the script
is to make setup easy, not to be an example of clean code :-)
master
LEdoian 3 years ago
parent 26f1299b59
commit a1a73c8cd5

@ -54,7 +54,8 @@ for i, n in [(x, 'net_'+str(x)) for x in range(1, 8)]:
def dump_bridges(fn): def dump_bridges(fn):
with open(fn, 'w+') as f: with open(fn, 'w+') as f:
for br in bridges: for br in bridges:
f.write(bridges[br].name + '\n') # Generate bridge.conf for the host
f.write('allow ' + bridges[br].name + '\n')
# Connections # Connections
# dict[ net_num -> [comp_names] # dict[ net_num -> [comp_names]
@ -77,7 +78,7 @@ for net, cs in conns.items():
comps[c].add_to_bridge(bridges[net]) comps[c].add_to_bridge(bridges[net])
os.mkdir('output') os.mkdir('output')
dump_bridges('output/bridges') dump_bridges('output/bridge.conf')
for c in comps.values(): for c in comps.values():
c.gen_files() c.gen_files()

Loading…
Cancel
Save