Skip to content

Commit

Permalink
Merge pull request #96 from opoplawski/no-network
Browse files Browse the repository at this point in the history
Allow setting virt-bridge to "none" to disable all network configuration
  • Loading branch information
SchoolGuy committed Apr 1, 2024
2 parents 34360a8 + 792c74b commit 803d356
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions changelog.d/96.added
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow setting virt-bridge to "none" or empty to disable all network configuration
18 changes: 11 additions & 7 deletions koan/virtinstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,8 @@ def _sanitize_nics(nics, bridge, profile_bridge, network_count):
if not bridge:
intf_bridge = intf["virt_bridge"]
if intf_bridge == "":
if profile_bridge == "":
raise InfoException("virt-bridge setting is not defined in cobbler")
intf_bridge = profile_bridge
if profile_bridge != "":
intf_bridge = profile_bridge

else:
if bridge.find(",") == -1:
Expand All @@ -157,7 +156,8 @@ def _sanitize_nics(nics, bridge, profile_bridge, network_count):
bridges = bridge.split(",")
intf_bridge = bridges[counter]

ret.append((intf_bridge, mac))
if intf_bridge != "":
ret.append((intf_bridge, mac))

return ret

Expand Down Expand Up @@ -308,8 +308,9 @@ def build_commandline(
bridge = profile_data["virt_bridge"]

if bridge == "":
raise InfoException("virt-bridge setting is not defined in cobbler")
nics = [(bridge, None)]
nics = [("none", None)]
else:
nics = [(bridge, None)]

kernel = profile_data.get("kernel_local")
initrd = profile_data.get("initrd_local")
Expand Down Expand Up @@ -456,7 +457,10 @@ def build_commandline(
cmd += "--disk path=%s,device=floppy " % floppy

for bridge, mac in nics:
cmd += "--network bridge=%s" % bridge
if bridge == "none":
cmd += "--network none"
else:
cmd += "--network bridge=%s" % bridge
if net_model and not disable_net_model:
cmd += ",model=%s" % net_model
if mac:
Expand Down

0 comments on commit 803d356

Please sign in to comment.