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
4 changes: 4 additions & 0 deletions data/data/install.openshift.io_installconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2110,6 +2110,10 @@ spec:
type: integer
type: object
type: object
diskType:
description: Disk Type Thin specifies if thin disks should be
use instead of thick
type: string
folder:
description: Folder is the absolute path of the folder that will
be used and/or created for virtual machines. The absolute path
Expand Down
1 change: 1 addition & 0 deletions data/data/vsphere/pre-bootstrap/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ resource "vsphereprivate_import_ova" "import" {
network = var.vsphere_network
folder = local.folder
tag = vsphere_tag.tag.id
disk_type = var.vsphere_disk_type
}

resource "vsphere_tag_category" "category" {
Expand Down
5 changes: 4 additions & 1 deletion data/data/vsphere/variables-vsphere.tf
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,7 @@ variable "vsphere_control_plane_num_cpus" {
variable "vsphere_control_plane_cores_per_socket" {
type = number
}

variable "vsphere_disk_type" {
type = string
default = "eagerZeroedThick"
}
1 change: 1 addition & 0 deletions docs/user/vsphere/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Beyond the [platform-agnostic `install-config.yaml` properties](../customization
* `cpus` (optional integer): The total number of virtual processor cores to assign a vm.
* `coresPerSocket` (optional integer): The number of cores per socket in a vm. The number of vCPUs on the vm will be cpus/coresPerSocket (default is 1).
* `memoryMB` (optional integer): The size of a VM's memory in megabytes.
* `disk_type` (optional string): DiskType is the name of the disk provisioning type for vsphere, for e.g thick or thin, by default it will be eagerZeroedThick.

## Examples

Expand Down
1 change: 1 addition & 0 deletions pkg/asset/cluster/tfvars.go
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ func (t *TerraformVariables) Generate(parents asset.Parents) error {
Cluster: installConfig.Config.VSphere.Cluster,
ImageURL: string(*rhcosImage),
PreexistingFolder: preexistingFolder,
DiskType: installConfig.Config.Platform.VSphere.DiskType,
},
)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ func resourceVSpherePrivateImportOva() *schema.Resource {
ForceNew: true,
ValidateFunc: validation.NoZeroValues,
},
"disk_type": {
Type: schema.TypeString,
Description: "The name of the disk provisioning, for e.g eagerZeroedThick or thin, by default it will be thick.",
Required: true,
ForceNew: true,
},
},
}
}
Expand Down Expand Up @@ -347,11 +353,22 @@ func resourceVSpherePrivateImportOvaCreate(d *schema.ResourceData, meta interfac
Name: ovfEnvelope.Network.Networks[0].Name,
Network: importOvaParams.Network.Reference(),
}}

var diskType types.OvfCreateImportSpecParamsDiskProvisioningType

if d.Get("disk_type") == "thin" {
diskType = types.OvfCreateImportSpecParamsDiskProvisioningTypeThin
} else if d.Get("disk_type") == "thick" {
diskType = types.OvfCreateImportSpecParamsDiskProvisioningTypeThick
Comment thread
jcpowermac marked this conversation as resolved.
Outdated
} else {
diskType = types.OvfCreateImportSpecParamsDiskProvisioningTypeEagerZeroedThick
}
// This is a very minimal spec for importing
// an OVF.
cisp := types.OvfCreateImportSpecParams{
EntityName: d.Get("name").(string),
NetworkMapping: networkMappings,
DiskProvisioning: string(diskType),
EntityName: d.Get("name").(string),
NetworkMapping: networkMappings,
}

m := ovf.NewManager(client)
Expand Down
34 changes: 19 additions & 15 deletions pkg/tfvars/vsphere/vsphere.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,26 @@ import (
"github.com/pkg/errors"

"github.com/openshift/installer/pkg/tfvars/internal/cache"
"github.com/openshift/installer/pkg/types/vsphere"
)

type config struct {
VSphereURL string `json:"vsphere_url"`
VSphereUsername string `json:"vsphere_username"`
VSpherePassword string `json:"vsphere_password"`
MemoryMiB int64 `json:"vsphere_control_plane_memory_mib"`
DiskGiB int32 `json:"vsphere_control_plane_disk_gib"`
NumCPUs int32 `json:"vsphere_control_plane_num_cpus"`
NumCoresPerSocket int32 `json:"vsphere_control_plane_cores_per_socket"`
Cluster string `json:"vsphere_cluster"`
Datacenter string `json:"vsphere_datacenter"`
Datastore string `json:"vsphere_datastore"`
Folder string `json:"vsphere_folder"`
Network string `json:"vsphere_network"`
Template string `json:"vsphere_template"`
OvaFilePath string `json:"vsphere_ova_filepath"`
PreexistingFolder bool `json:"vsphere_preexisting_folder"`
VSphereURL string `json:"vsphere_url"`
VSphereUsername string `json:"vsphere_username"`
VSpherePassword string `json:"vsphere_password"`
MemoryMiB int64 `json:"vsphere_control_plane_memory_mib"`
DiskGiB int32 `json:"vsphere_control_plane_disk_gib"`
NumCPUs int32 `json:"vsphere_control_plane_num_cpus"`
NumCoresPerSocket int32 `json:"vsphere_control_plane_cores_per_socket"`
Cluster string `json:"vsphere_cluster"`
Datacenter string `json:"vsphere_datacenter"`
Datastore string `json:"vsphere_datastore"`
Folder string `json:"vsphere_folder"`
Network string `json:"vsphere_network"`
Template string `json:"vsphere_template"`
OvaFilePath string `json:"vsphere_ova_filepath"`
PreexistingFolder bool `json:"vsphere_preexisting_folder"`
DiskType vsphere.DiskType `json:"vsphere_disk_type"`
}

// TFVarsSources contains the parameters to be converted into Terraform variables
Expand All @@ -36,6 +38,7 @@ type TFVarsSources struct {
Cluster string
ImageURL string
PreexistingFolder bool
DiskType vsphere.DiskType
}

//TFVars generate vSphere-specific Terraform variables
Expand Down Expand Up @@ -68,6 +71,7 @@ func TFVars(sources TFVarsSources) ([]byte, error) {
Template: controlPlaneConfig.Template,
OvaFilePath: cachedImage,
PreexistingFolder: sources.PreexistingFolder,
DiskType: sources.DiskType,
}

return json.MarshalIndent(cfg, "", " ")
Expand Down
19 changes: 18 additions & 1 deletion pkg/types/vsphere/platform.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
package vsphere

// Platform stores any global configuration used for vsphere platforms.
// DiskType is a disk provisioning type for vsphere.
type DiskType string

const (
Comment thread
jcpowermac marked this conversation as resolved.
Outdated
// DiskTypeThin uses Thin disk type for vsphere in the cluster.
DiskTypeThin DiskType = "thin"

// DiskTypeThick uses Thick disk type for vsphere in the cluster.
DiskTypeThick DiskType = "thick"

// DiskTypeEagerZeroedThick uses EagerZeroedThick disk type for vsphere in the cluster.
DiskTypeEagerZeroedThick DiskType = "eagerZeroedThick"
)

// Platform stores any global configuration used for vsphere platforms
type Platform struct {
// VCenter is the domain name or IP address of the vCenter.
VCenter string `json:"vCenter"`
Expand Down Expand Up @@ -47,4 +61,7 @@ type Platform struct {

// Network specifies the name of the network to be used by the cluster.
Network string `json:"network,omitempty"`

// Disk Type Thin specifies if thin disks should be use instead of thick
DiskType DiskType `json:"diskType,omitempty"`
}