Skip to content

ept_rvi_mode and hv_mode always attemp to update on apply #3

@abhinit-kumar

Description

@abhinit-kumar

We are trying to use provider-vsphere latest vSphere version 0.1.0, which is based on Terraform vSphere provider version 2.5.1.
We have encountered an issue with the hvMode variable behavior in this provider version.

Issue Summary:

Default Behavior:
The hvMode variable, when not specified in the composition, is automatically set to hvAuto by default.
The provider supports three values for hvMode: hvAuto, hvOn, hvOff.

Below is the excerpts from composition being used:

---removed for brevity---
            apiVersion: virtualmachine.crossplane.io/v1alpha1
            kind: VSphereVirtualMachine
            metadata:
              name: vmvspheretemplate
              annotations:
                gotemplating.fn.crossplane.io/composition-resource-name: "vmcreation"
            spec:
              forProvider:
                name: {{ $vmName }}
                resourcePoolId: {{ $resourcepoolid }}
                datastoreId: {{ $datastoreid }}
                efiSecureBootEnabled: false
                firmware: "efi"
                numCpus: {{ $cpu }}
                memory: {{ $memory }}
                guestId: {{ $guestid }}
---removed for brevity---

Behavior Observed:
With vSphere V8, the hvMode value in the status field is always blank ("") after applying the claim.
With vSphere V7, the hvMode value is correctly set to hvAuto in status field.

Output of command $kubectl describe VSphereVirtualMachine vmvspheretemplate in vSphere 7:

---removed for brevity---
    Disk:
      Label:                       Hard disk 1
      Size:                        60
    Ept Rvi Mode:                  automatic
    Extra Config Reboot Required:  true
    Firmware:                      bios
    Force Power Off:               true
    Guest Id:                      ubuntu64Guest
    Hardware Version:              19
    Host System Id:                host-xxxx
    Hv Mode:                       hvAuto                                                      <<hvMode: hvAuto applied by the provider
    Ide Controller Count:          2
    Latency Sensitivity:           normal
    Memory:                        2048
    Memory Limit:                  -1
    Memory Share Count:            20480
    Memory Share Level:            normal
    Migrate Wait Timeout:          30
    Name:                          prod-test-110
---removed for brevity---

Output of command $kubectl describe VSphereVirtualMachine vmvspheretemplate in vSphere 8:

---removed for brevity---
    Disk:
      Label:                       Hard disk 1
      Size:                        60
    Ept Rvi Mode:                  automatic
    Extra Config Reboot Required:  true
    Firmware:                      bios
    Force Power Off:               true
    Guest Id:                      ubuntu64Guest
    Hardware Version:              19
    Host System Id:                host-xxxx
    Hv Mode:                       ""                                                             <<hvMode left blank, however being applied continuously by the provider
    Ide Controller Count:          2
    Latency Sensitivity:           normal
    Memory:                        2048
    Memory Limit:                  -1
    Memory Share Count:            20480
    Memory Share Level:            normal
    Migrate Wait Timeout:          30
    Name:                          prod-test-115
---removed for brevity---

Impact:
In vSphere V8 environments, since the hvMode value in the status field is blank, the provider tries to re-apply the claim repeatedly.
Each re-apply leads to a reboot, causing a continuous loop of VM reboot.

Note on Terraform Provider:
When we try to create a virtual machine (VM) using the Terraform provider in vSphere with hashicorp/vsphere:2.9.3, it works as expected.

Reference:
This issue seems related to a known bug discussed in the Terraform vSphere provider GitHub repository given below.

vmware/terraform-provider-vsphere#1902

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions