From 36bb68a72d09fa61a19522690116cacd4e21768d Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Fri, 14 Oct 2022 18:38:39 +0400 Subject: [PATCH] tart run: deprecate --with-softnet and introduce --net-softnet (#274) --- Sources/tart/Commands/Run.swift | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Sources/tart/Commands/Run.swift b/Sources/tart/Commands/Run.swift index 117940f0..744214bc 100644 --- a/Sources/tart/Commands/Run.swift +++ b/Sources/tart/Commands/Run.swift @@ -37,7 +37,8 @@ struct Run: AsyncParsableCommand { + "Note that this feature is experimental and there may be bugs present when using VNC.")) var vncExperimental: Bool = false - @Flag var withSoftnet: Bool = false + @Flag(help: ArgumentHelp(visibility: .private)) + var withSoftnet: Bool = false @Option(help: ArgumentHelp(""" Additional disk attachments with an optional read-only specifier\n(e.g. --disk=\"disk.bin\" --disk=\"ubuntu.iso:ro\") @@ -64,6 +65,10 @@ struct Run: AsyncParsableCommand { """, valueName: "interface name")) var netBridged: String? + @Flag(help: ArgumentHelp("Use software networking instead of the default shared (NAT) networking", + discussion: "Learn how to configure Softnet for use with Tart here: https://github.com/cirruslabs/softnet")) + var netSoftnet: Bool = false + func validate() throws { if vnc && vncExperimental { throw ValidationError("--vnc and --vnc-experimental are mutually exclusive") @@ -73,6 +78,10 @@ struct Run: AsyncParsableCommand { throw ValidationError("--with-softnet and --net-bridged are mutually exclusive") } + if netBridged != nil && netSoftnet { + throw ValidationError("--net-bridged and --net-softnet are mutually exclusive") + } + if graphics && noGraphics { throw ValidationError("--graphics and --no-graphics are mutually exclusive") } @@ -145,7 +154,7 @@ struct Run: AsyncParsableCommand { } func userSpecifiedNetwork(vmDir: VMDirectory) throws -> Network? { - if withSoftnet { + if withSoftnet || netSoftnet { let config = try VMConfig.init(fromURL: vmDir.configURL) return try Softnet(vmMACAddress: config.macAddress.string)