re-indent HWConfig struct comments

This commit is contained in:
Adrien Delorme 2019-09-03 17:35:29 +02:00
parent a841da960d
commit ba9ffcbf73
2 changed files with 132 additions and 113 deletions

View File

@ -14,16 +14,15 @@ import (
type HWConfig struct { type HWConfig struct {
// The number of cpus to use when building the VM. // The number of cpus to use when building the VM.
CpuCount int `mapstructure:"cpus" required:"false"` CpuCount int `mapstructure:"cpus" required:"false"`
// The amount of memory to use when building the VM // The amount of memory to use when building the VM in megabytes.
// in megabytes.
MemorySize int `mapstructure:"memory" required:"false"` MemorySize int `mapstructure:"memory" required:"false"`
// The number of cores per socket to use when building the VM. // The number of cores per socket to use when building the VM. This
// This corresponds to the cpuid.coresPerSocket option in the .vmx file. // corresponds to the cpuid.coresPerSocket option in the .vmx file.
CoreCount int `mapstructure:"cores" required:"false"` CoreCount int `mapstructure:"cores" required:"false"`
// This is the network type that the virtual machine will // This is the network type that the virtual machine will be created with.
// be created with. This can be one of the generic values that map to a device // This can be one of the generic values that map to a device such as
// such as hostonly, nat, or bridged. If the network is not one of these // hostonly, nat, or bridged. If the network is not one of these values,
// values, then it is assumed to be a VMware network device. (VMnet0..x) // then it is assumed to be a VMware network device. (VMnet0..x)
Network string `mapstructure:"network" required:"false"` Network string `mapstructure:"network" required:"false"`
// This is the ethernet adapter type the the virtual machine will be // This is the ethernet adapter type the the virtual machine will be
// created with. By default the `e1000` network adapter type will be used // created with. By default the `e1000` network adapter type will be used
@ -32,62 +31,73 @@ type HWConfig struct {
// machine](https://kb.vmware.com/s/article/1001805) for desktop VMware // machine](https://kb.vmware.com/s/article/1001805) for desktop VMware
// clients. For ESXi, refer to the proper ESXi documentation. // clients. For ESXi, refer to the proper ESXi documentation.
NetworkAdapterType string `mapstructure:"network_adapter_type" required:"false"` NetworkAdapterType string `mapstructure:"network_adapter_type" required:"false"`
// Specify whether to enable VMware's virtual soundcard // Specify whether to enable VMware's virtual soundcard device when
// device when building the VM. Defaults to false. // building the VM. Defaults to false.
Sound bool `mapstructure:"sound" required:"false"` Sound bool `mapstructure:"sound" required:"false"`
// Enable VMware's USB bus when building the guest VM. // Enable VMware's USB bus when building the guest VM. Defaults to false.
// Defaults to false. To enable usage of the XHCI bus for USB 3 (5 Gbit/s), // To enable usage of the XHCI bus for USB 3 (5 Gbit/s), one can use the
// one can use the vmx_data option to enable it by specifying true for // vmx_data option to enable it by specifying true for the usb_xhci.present
// the usb_xhci.present property. // property.
USB bool `mapstructure:"usb" required:"false"` USB bool `mapstructure:"usb" required:"false"`
// This specifies a serial port to add to the VM. // This specifies a serial port to add to the VM. It has a format of
// It has a format of `Type:option1,option2,...`. The field `Type` can be one // `Type:option1,option2,...`. The field `Type` can be one of the following
// of the following values: `FILE`, `DEVICE`, `PIPE`, `AUTO`, or `NONE`. // values: `FILE`, `DEVICE`, `PIPE`, `AUTO`, or `NONE`.
//
// * `FILE:path(,yield)` - Specifies the path to the local file to be used
// as the serial port.
//
// * `yield` (bool) - This is an optional boolean that specifies
// whether the vm should yield the cpu when polling the port. By
// default, the builder will assume this as `FALSE`.
//
// * `DEVICE:path(,yield)` - Specifies the path to the local device to be
//  used as the serial port. If `path` is empty, then default to the first
// serial port.
//
// * `yield` (bool) - This is an optional boolean that specifies
// whether the vm should yield the cpu when polling the port. By
// default, the builder will assume this as `FALSE`.
//
// * `PIPE:path,endpoint,host(,yield)` - Specifies to use the named-pipe
// "path" as a serial port. This has a few options that determine how the
// VM should use the named-pipe.
// //
// * `FILE:path(,yield)` - Specifies the path to the local file to be used as the
// serial port.
// * `yield` (bool) - This is an optional boolean that specifies whether
// the vm should yield the cpu when polling the port.
// By default, the builder will assume this as `FALSE`.
// * `DEVICE:path(,yield)` - Specifies the path to the local device to be used
// as the serial port. If `path` is empty, then
// default to the first serial port.
// * `yield` (bool) - This is an optional boolean that specifies whether
// the vm should yield the cpu when polling the port.
// By default, the builder will assume this as `FALSE`.
// * `PIPE:path,endpoint,host(,yield)` - Specifies to use the named-pipe "path"
// as a serial port. This has a few
// options that determine how the VM
// should use the named-pipe.
// * `endpoint` (string) - Chooses the type of the VM-end, which can be // * `endpoint` (string) - Chooses the type of the VM-end, which can be
// either a `client` or `server`. // either a `client` or `server`.
// * `host` (string) - Chooses the type of the host-end, which can be either //
// an `app` (application) or `vm` (another virtual-machine). // * `host` (string) - Chooses the type of the host-end, which can
// * `yield` (bool) - This is an optional boolean that specifies whether // be either `app` (application) or `vm` (another virtual-machine).
// the vm should yield the cpu when polling the port. //
// By default, the builder will assume this as `FALSE`. // * `yield` (bool) - This is an optional boolean that specifies
// whether the vm should yield the cpu when polling the port. By
// default, the builder will assume this as `FALSE`.
//
// * `AUTO:(yield)` - Specifies to use auto-detection to determine the
// serial port to use. This has one option to determine how the VM should
// support the serial port.
//
// * `yield` (bool) - This is an optional boolean that specifies
// whether the vm should yield the cpu when polling the port. By
// default, the builder will assume this as `FALSE`.
// //
// * `AUTO:(yield)` - Specifies to use auto-detection to determine the serial
// port to use. This has one option to determine how the VM
// should support the serial port.
// * `yield` (bool) - This is an optional boolean that specifies whether
// the vm should yield the cpu when polling the port.
// By default, the builder will assume this as `FALSE`.
// * `NONE` - Specifies to not use a serial port. (default) // * `NONE` - Specifies to not use a serial port. (default)
Serial string `mapstructure:"serial" required:"false"`
// This specifies a parallel port to add to the VM. It
// has the format of `Type:option1,option2,...`. Type can be one of the
// following values: `FILE`, `DEVICE`, `AUTO`, or `NONE`.
// //
// * `FILE:path` - Specifies the path to the local file to be used for the Serial string `mapstructure:"serial" required:"false"`
// parallel port. // This specifies a parallel port to add to the VM. It has the format of
// * `DEVICE:path` - Specifies the path to the local device to be used for the // `Type:option1,option2,...`. Type can be one of the following values:
// parallel port. // `FILE`, `DEVICE`, `AUTO`, or `NONE`.
// * `AUTO:direction` - Specifies to use auto-detection to determine the //
// parallel port. Direction can be `BI` to specify // * `FILE:path` - Specifies the path to the local file to be used
// bidirectional communication or `UNI` to specify // for the parallel port.
// unidirectional communication. //
// * `NONE` - Specifies to not use a parallel port. (default) // * `DEVICE:path` - Specifies the path to the local device to be used
// for the parallel port.
//
// * `AUTO:direction` - Specifies to use auto-detection to determine the
// parallel port. Direction can be `BI` to specify bidirectional
// communication or `UNI` to specify unidirectional communication.
//
// * `NONE` - Specifies to not use a parallel port. (default)
Parallel string `mapstructure:"parallel" required:"false"` Parallel string `mapstructure:"parallel" required:"false"`
} }

View File

@ -2,16 +2,15 @@
- `cpus` (int) - The number of cpus to use when building the VM. - `cpus` (int) - The number of cpus to use when building the VM.
- `memory` (int) - The amount of memory to use when building the VM - `memory` (int) - The amount of memory to use when building the VM in megabytes.
in megabytes.
- `cores` (int) - The number of cores per socket to use when building the VM. - `cores` (int) - The number of cores per socket to use when building the VM. This
This corresponds to the cpuid.coresPerSocket option in the .vmx file. corresponds to the cpuid.coresPerSocket option in the .vmx file.
- `network` (string) - This is the network type that the virtual machine will - `network` (string) - This is the network type that the virtual machine will be created with.
be created with. This can be one of the generic values that map to a device This can be one of the generic values that map to a device such as
such as hostonly, nat, or bridged. If the network is not one of these hostonly, nat, or bridged. If the network is not one of these values,
values, then it is assumed to be a VMware network device. (VMnet0..x) then it is assumed to be a VMware network device. (VMnet0..x)
- `network_adapter_type` (string) - This is the ethernet adapter type the the virtual machine will be - `network_adapter_type` (string) - This is the ethernet adapter type the the virtual machine will be
created with. By default the `e1000` network adapter type will be used created with. By default the `e1000` network adapter type will be used
@ -20,60 +19,70 @@
machine](https://kb.vmware.com/s/article/1001805) for desktop VMware machine](https://kb.vmware.com/s/article/1001805) for desktop VMware
clients. For ESXi, refer to the proper ESXi documentation. clients. For ESXi, refer to the proper ESXi documentation.
- `sound` (bool) - Specify whether to enable VMware's virtual soundcard - `sound` (bool) - Specify whether to enable VMware's virtual soundcard device when
device when building the VM. Defaults to false. building the VM. Defaults to false.
- `usb` (bool) - Enable VMware's USB bus when building the guest VM. - `usb` (bool) - Enable VMware's USB bus when building the guest VM. Defaults to false.
Defaults to false. To enable usage of the XHCI bus for USB 3 (5 Gbit/s), To enable usage of the XHCI bus for USB 3 (5 Gbit/s), one can use the
one can use the vmx_data option to enable it by specifying true for vmx_data option to enable it by specifying true for the usb_xhci.present
the usb_xhci.present property. property.
- `serial` (string) - This specifies a serial port to add to the VM. - `serial` (string) - This specifies a serial port to add to the VM. It has a format of
It has a format of `Type:option1,option2,...`. The field `Type` can be one `Type:option1,option2,...`. The field `Type` can be one of the following
of the following values: `FILE`, `DEVICE`, `PIPE`, `AUTO`, or `NONE`. values: `FILE`, `DEVICE`, `PIPE`, `AUTO`, or `NONE`.
* `FILE:path(,yield)` - Specifies the path to the local file to be used
as the serial port.
* `yield` (bool) - This is an optional boolean that specifies
whether the vm should yield the cpu when polling the port. By
default, the builder will assume this as `FALSE`.
* `DEVICE:path(,yield)` - Specifies the path to the local device to be
  used as the serial port. If `path` is empty, then default to the first
serial port.
* `yield` (bool) - This is an optional boolean that specifies
whether the vm should yield the cpu when polling the port. By
default, the builder will assume this as `FALSE`.
* `PIPE:path,endpoint,host(,yield)` - Specifies to use the named-pipe
"path" as a serial port. This has a few options that determine how the
VM should use the named-pipe.
* `FILE:path(,yield)` - Specifies the path to the local file to be used as the
serial port.
* `yield` (bool) - This is an optional boolean that specifies whether
the vm should yield the cpu when polling the port.
By default, the builder will assume this as `FALSE`.
* `DEVICE:path(,yield)` - Specifies the path to the local device to be used
as the serial port. If `path` is empty, then
default to the first serial port.
* `yield` (bool) - This is an optional boolean that specifies whether
the vm should yield the cpu when polling the port.
By default, the builder will assume this as `FALSE`.
* `PIPE:path,endpoint,host(,yield)` - Specifies to use the named-pipe "path"
as a serial port. This has a few
options that determine how the VM
should use the named-pipe.
* `endpoint` (string) - Chooses the type of the VM-end, which can be * `endpoint` (string) - Chooses the type of the VM-end, which can be
either a `client` or `server`. either a `client` or `server`.
* `host` (string) - Chooses the type of the host-end, which can be either
an `app` (application) or `vm` (another virtual-machine). * `host` (string) - Chooses the type of the host-end, which can
* `yield` (bool) - This is an optional boolean that specifies whether be either `app` (application) or `vm` (another virtual-machine).
the vm should yield the cpu when polling the port.
By default, the builder will assume this as `FALSE`. * `yield` (bool) - This is an optional boolean that specifies
whether the vm should yield the cpu when polling the port. By
default, the builder will assume this as `FALSE`.
* `AUTO:(yield)` - Specifies to use auto-detection to determine the
serial port to use. This has one option to determine how the VM should
support the serial port.
* `yield` (bool) - This is an optional boolean that specifies
whether the vm should yield the cpu when polling the port. By
default, the builder will assume this as `FALSE`.
* `AUTO:(yield)` - Specifies to use auto-detection to determine the serial
port to use. This has one option to determine how the VM
should support the serial port.
* `yield` (bool) - This is an optional boolean that specifies whether
the vm should yield the cpu when polling the port.
By default, the builder will assume this as `FALSE`.
* `NONE` - Specifies to not use a serial port. (default) * `NONE` - Specifies to not use a serial port. (default)
- `parallel` (string) - This specifies a parallel port to add to the VM. It - `parallel` (string) - This specifies a parallel port to add to the VM. It has the format of
has the format of `Type:option1,option2,...`. Type can be one of the `Type:option1,option2,...`. Type can be one of the following values:
following values: `FILE`, `DEVICE`, `AUTO`, or `NONE`. `FILE`, `DEVICE`, `AUTO`, or `NONE`.
* `FILE:path` - Specifies the path to the local file to be used for the * `FILE:path` - Specifies the path to the local file to be used
parallel port. for the parallel port.
* `DEVICE:path` - Specifies the path to the local device to be used for the
parallel port. * `DEVICE:path` - Specifies the path to the local device to be used
* `AUTO:direction` - Specifies to use auto-detection to determine the for the parallel port.
parallel port. Direction can be `BI` to specify
bidirectional communication or `UNI` to specify * `AUTO:direction` - Specifies to use auto-detection to determine the
unidirectional communication. parallel port. Direction can be `BI` to specify bidirectional
* `NONE` - Specifies to not use a parallel port. (default) communication or `UNI` to specify unidirectional communication.
* `NONE` - Specifies to not use a parallel port. (default)