add support for eagerly zeroed / scrubbed disks

This commit is contained in:
Anselm Eberhardt 2020-02-17 08:58:06 +01:00
parent 5a87760702
commit 6c749eecf7
No known key found for this signature in database
GPG Key ID: D5F05DF315DE64D8
2 changed files with 5 additions and 0 deletions

View File

@ -53,6 +53,7 @@ type NIC struct {
type CreateConfig struct {
DiskThinProvisioned bool
DiskEagerlyScrub bool
DiskControllerType string // example: "scsi", "pvscsi"
DiskSize int64
@ -503,6 +504,7 @@ func addDisk(_ *Driver, devices object.VirtualDeviceList, config *CreateConfig)
Backing: &types.VirtualDiskFlatVer2BackingInfo{
DiskMode: string(types.VirtualDiskModePersistent),
ThinProvisioned: types.NewBool(config.DiskThinProvisioned),
EagerlyScrub: types.NewBool(config.DiskEagerlyScrub),
},
},
CapacityInKB: config.DiskSize * 1024,

View File

@ -42,6 +42,8 @@ type CreateConfig struct {
DiskSize int64 `mapstructure:"disk_size"`
// Enable VMDK thin provisioning for VM. Defaults to `false`.
DiskThinProvisioned bool `mapstructure:"disk_thin_provisioned"`
// Enable VMDK eager scrubbing for VM. Defaults to `false`.
DiskEagerlyScrub bool `mapstructure:"disk_eagerly_scrub"`
// Set network VM will be connected to.
Network string `mapstructure:"network"`
// Set VM network card type. Example `vmxnet3`.
@ -115,6 +117,7 @@ func (s *StepCreateVM) Run(_ context.Context, state multistep.StateBag) multiste
vm, err = d.CreateVM(&driver.CreateConfig{
DiskThinProvisioned: s.Config.DiskThinProvisioned,
DiskEagerlyScrub: s.Config.DiskEagerlyScrub,
DiskControllerType: s.Config.DiskControllerType,
DiskSize: s.Config.DiskSize,
Name: s.Location.VMName,