Support Bridged Network (#78)

* Support Bridged Network

Inspired by https://github.com/cirruslabs/tart/issues/473

* Fixed tests
This commit is contained in:
Fedor Korotkov
2023-04-20 15:04:07 +04:00
committed by GitHub
parent a8771a046e
commit dd5e588eb0
4 changed files with 21 additions and 17 deletions
+11 -8
View File
@@ -13,7 +13,8 @@ var ErrVMFailed = errors.New("failed to create VM")
var image string
var cpu uint64
var memory uint64
var softnet bool
var netSoftnet bool
var netBridged string
var headless bool
var stringToStringResources map[string]string
@@ -28,7 +29,8 @@ func newCreateVMCommand() *cobra.Command {
command.PersistentFlags().StringVar(&image, "image", "ghcr.io/cirruslabs/macos-ventura-base:latest", "image to use")
command.PersistentFlags().Uint64Var(&cpu, "cpu", 4, "number of CPUs to use")
command.PersistentFlags().Uint64Var(&memory, "memory", 8*1024, "megabytes of memory to use")
command.PersistentFlags().BoolVar(&softnet, "softnet", false, "whether to use Softnet network isolation")
command.PersistentFlags().BoolVar(&netSoftnet, "net-softnet", false, "whether to use Softnet network isolation")
command.PersistentFlags().StringVar(&netBridged, "net-bridged", "", "whether to use Bridged network mode")
command.PersistentFlags().BoolVar(&headless, "headless", true, "whether to run without graphics")
command.PersistentFlags().StringToStringVar(&stringToStringResources, "resources", map[string]string{},
"resources to request for this VM")
@@ -54,11 +56,12 @@ func runCreateVM(cmd *cobra.Command, args []string) error {
Meta: v1.Meta{
Name: name,
},
Image: image,
CPU: cpu,
Memory: memory,
Softnet: softnet,
Headless: headless,
Resources: resources,
Image: image,
CPU: cpu,
Memory: memory,
NetSoftnet: netSoftnet,
NetBridged: netBridged,
Headless: headless,
Resources: resources,
})
}