code: func (l VirtualDeviceList) CreateDisk(c types.BaseVirtualController, ds types.ManagedObjectReference, name string) *types.VirtualDisk {
  	// If name is not specified, one will be chosen for you.
  	// But if when given, make sure it ends in .vmdk, otherwise it will be treated as a directory.
  	if len(name) > 0 && filepath.Ext(name) != ".vmdk" {
  		name += ".vmdk"
  	}
  
  	device := &types.VirtualDisk{
  		VirtualDevice: types.VirtualDevice{
  			Backing: &types.VirtualDiskFlatVer2BackingInfo{
  				DiskMode:        string(types.VirtualDiskModePersistent),
  				ThinProvisioned: types.NewBool(true),
  				VirtualDeviceFileBackingInfo: types.VirtualDeviceFileBackingInfo{
  					FileName:  name,
  					Datastore: &ds,
  				},
  			},
  		},
  	}
  
  	l.AssignController(device, c)
  	return device
  }
docs: // CreateDisk creates a new VirtualDisk device which can be added to a VM.