Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions pkg/drivers/vmware/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ import (
)

const (
defaultSSHUser = "docker"
defaultSSHPass = "tcuser"
defaultDiskSize = 20000
defaultCPU = 1
defaultMemory = 1024
defaultWaitIP = 30000
defaultSSHUser = "docker"
defaultSSHPass = "tcuser"
defaultDiskSize = 20000
defaultCPU = 1
defaultMemory = 1024
defaultWaitIP = 30000
defaultNetworkType = "nat"
)

// Config specifies the configuration of driver VMware
Expand All @@ -49,17 +50,19 @@ type Config struct {
ConfigDriveURL string
NoShare bool

WaitIP int
WaitIP int
NetworkType string
}

// NewConfig creates a new Config
func NewConfig(hostname, storePath string) *Config {
return &Config{
CPU: defaultCPU,
Memory: defaultMemory,
DiskSize: defaultDiskSize,
SSHPassword: defaultSSHPass,
WaitIP: defaultWaitIP,
CPU: defaultCPU,
Memory: defaultMemory,
DiskSize: defaultDiskSize,
SSHPassword: defaultSSHPass,
WaitIP: defaultWaitIP,
NetworkType: defaultNetworkType,
BaseDriver: &drivers.BaseDriver{
SSHUser: defaultSSHUser,
MachineName: hostname,
Expand Down Expand Up @@ -125,5 +128,11 @@ func (c *Config) GetCreateFlags() []mcnflag.Flag {
Usage: "time to wait for vmrun to get an ip (in milliseconds)",
Value: defaultWaitIP,
},
mcnflag.StringFlag{
EnvVar: "VMWARE_NETWORK_TYPE",
Name: "vmware-network-type",
Usage: "Network connection type to use (e.g. 'nat', 'bridged', 'hostonly')",
Value: defaultNetworkType,
},
}
}
1 change: 1 addition & 0 deletions pkg/drivers/vmware/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
d.SSHPort = 22
d.NoShare = flags.Bool("vmware-no-share")
d.WaitIP = flags.Int("vmware-wait-ip")
d.NetworkType = flags.String("vmware-network-type")

// We support a maximum of 16 cpu to be consistent with Virtual Hardware 10
// specs.
Expand Down
2 changes: 1 addition & 1 deletion pkg/drivers/vmware/vmx.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const vmx = `
config.version = "8"
displayName = "{{.MachineName}}"
ethernet0.present = "TRUE"
ethernet0.connectionType = "nat"
ethernet0.connectionType = "{{.NetworkType}}"
ethernet0.virtualDev = "vmxnet3"
ethernet0.wakeOnPcktRcv = "FALSE"
ethernet0.addressType = "generated"
Expand Down