Skip to content
Open
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
21 changes: 21 additions & 0 deletions apis/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,27 @@ type VirtualMachineCloneSpec struct {
// +listMapKey=name
// +kubebuilder:validation:MaxItems=29
DataDisks []VSphereDisk `json:"dataDisks,omitempty"`
// nestedHV controls nested hardware-assisted virtualization.
// Defaults to the eponymous property value in the template from which the
// virtual machine is cloned.
// Check the compatibility with the ESXi version before setting the value.
// +optional
// +kubebuilder:validation:Enum=enabled;disabled
NestedHV string `json:"nestedHV,omitempty"`
// ftEncryptionMode is the encrypted fault tolerance mode.
// Defaults to the eponymous property value in the template from which the
// virtual machine is cloned.
// Check the compatibility with the ESXi version before setting the value.
// +optional
// +kubebuilder:validation:Enum=ftEncryptionDisabled;ftEncryptionOpportunistic;ftEncryptionRequired
FtEncryptionMode string `json:"ftEncryptionMode,omitempty"`
// migrateEncryption is the encrypted vMotion mode.
// Defaults to the eponymous property value in the template from which the
// virtual machine is cloned.
// Check the compatibility with the ESXi version before setting the value.
// +optional
// +kubebuilder:validation:Enum=disabled;opportunistic;required
MigrateEncryption string `json:"migrateEncryption,omitempty"`
}

// VirtualMachineResources is the definition of the VM's cpu and memory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,17 @@ spec:
Folder is the name, inventory path, managed object reference or the managed
object ID of the folder in which the virtual machine is created/located.
type: string
ftEncryptionMode:
description: |-
ftEncryptionMode is the encrypted fault tolerance mode.
Defaults to the eponymous property value in the template from which the
virtual machine is cloned.
Check the compatibility with the ESXi version before setting the value.
enum:
- ftEncryptionDisabled
- ftEncryptionOpportunistic
- ftEncryptionRequired
type: string
guestSoftPowerOffTimeout:
description: |-
GuestSoftPowerOffTimeout sets the wait timeout for shutdown in the VM guest.
Expand All @@ -176,6 +187,17 @@ spec:
virtual machine is cloned.
format: int64
type: integer
migrateEncryption:
description: |-
migrateEncryption is the encrypted vMotion mode.
Defaults to the eponymous property value in the template from which the
virtual machine is cloned.
Check the compatibility with the ESXi version before setting the value.
enum:
- disabled
- opportunistic
- required
type: string
namingStrategy:
description: NamingStrategy allows configuring the naming strategy
used when calculating the name of the VSphereVM.
Expand All @@ -198,6 +220,16 @@ spec:
so we highly recommend to use a template which leads to a name shorter than 63 characters.
type: string
type: object
nestedHV:
description: |-
nestedHV controls nested hardware-assisted virtualization.
Defaults to the eponymous property value in the template from which the
virtual machine is cloned.
Check the compatibility with the ESXi version before setting the value.
enum:
- enabled
- disabled
type: string
network:
description: Network is the network configuration for this machine's
VM.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,17 @@ spec:
Folder is the name, inventory path, managed object reference or the managed
object ID of the folder in which the virtual machine is created/located.
type: string
ftEncryptionMode:
description: |-
ftEncryptionMode is the encrypted fault tolerance mode.
Defaults to the eponymous property value in the template from which the
virtual machine is cloned.
Check the compatibility with the ESXi version before setting the value.
enum:
- ftEncryptionDisabled
- ftEncryptionOpportunistic
- ftEncryptionRequired
type: string
guestSoftPowerOffTimeout:
description: |-
GuestSoftPowerOffTimeout sets the wait timeout for shutdown in the VM guest.
Expand All @@ -187,6 +198,17 @@ spec:
virtual machine is cloned.
format: int64
type: integer
migrateEncryption:
description: |-
migrateEncryption is the encrypted vMotion mode.
Defaults to the eponymous property value in the template from which the
virtual machine is cloned.
Check the compatibility with the ESXi version before setting the value.
enum:
- disabled
- opportunistic
- required
type: string
namingStrategy:
description: NamingStrategy allows configuring the naming
strategy used when calculating the name of the VSphereVM.
Expand All @@ -209,6 +231,16 @@ spec:
so we highly recommend to use a template which leads to a name shorter than 63 characters.
type: string
type: object
nestedHV:
description: |-
nestedHV controls nested hardware-assisted virtualization.
Defaults to the eponymous property value in the template from which the
virtual machine is cloned.
Check the compatibility with the ESXi version before setting the value.
enum:
- enabled
- disabled
type: string
network:
description: Network is the network configuration for this
machine's VM.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,17 @@ spec:
Folder is the name, inventory path, managed object reference or the managed
object ID of the folder in which the virtual machine is created/located.
type: string
ftEncryptionMode:
description: |-
ftEncryptionMode is the encrypted fault tolerance mode.
Defaults to the eponymous property value in the template from which the
virtual machine is cloned.
Check the compatibility with the ESXi version before setting the value.
enum:
- ftEncryptionDisabled
- ftEncryptionOpportunistic
- ftEncryptionRequired
type: string
guestSoftPowerOffTimeout:
description: |-
GuestSoftPowerOffTimeout sets the wait timeout for shutdown in the VM guest.
Expand All @@ -203,6 +214,27 @@ spec:
virtual machine is cloned.
format: int64
type: integer
migrateEncryption:
description: |-
migrateEncryption is the encrypted vMotion mode.
Defaults to the eponymous property value in the template from which the
virtual machine is cloned.
Check the compatibility with the ESXi version before setting the value.
enum:
- disabled
- opportunistic
- required
type: string
nestedHV:
description: |-
nestedHV controls nested hardware-assisted virtualization.
Defaults to the eponymous property value in the template from which the
virtual machine is cloned.
Check the compatibility with the ESXi version before setting the value.
enum:
- enabled
- disabled
type: string
network:
description: Network is the network configuration for this machine's
VM.
Expand Down
13 changes: 13 additions & 0 deletions pkg/services/govmomi/vcenter/clone.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,19 @@ func Clone(ctx context.Context, vmCtx *capvcontext.VMContext, bootstrapData []by
spec.Location.Disk = getDiskLocators(disks, *datastoreRef, isLinkedClone)
spec.Location.Datastore = datastoreRef

switch vmCtx.VSphereVM.Spec.NestedHV {
case "enabled":
spec.Config.NestedHVEnabled = ptr.To(true)
case "disabled":
spec.Config.NestedHVEnabled = ptr.To(false)
}
if vmCtx.VSphereVM.Spec.FtEncryptionMode != "" {
spec.Config.FtEncryptionMode = vmCtx.VSphereVM.Spec.FtEncryptionMode
}
if vmCtx.VSphereVM.Spec.MigrateEncryption != "" {
spec.Config.FtEncryptionMode = vmCtx.VSphereVM.Spec.MigrateEncryption
}

log.Info(fmt.Sprintf("Cloning Machine with clone mode %s", vmCtx.VSphereVM.Status.CloneMode))
task, err := tpl.Clone(ctx, folder, vmCtx.VSphereVM.Name, spec)
if err != nil {
Expand Down
Loading