Skip to content

Add support for target cluster that exists in a host folder #18

@powercleee

Description

@powercleee

Describe the bug

During the deployment of the VCF Installer appliance to a vCenter Server, it will fail if the target cluster exists in a host folder hierarchy under the Datacenter object. The code assumes the cluster exists directly under the Datacenter object.

Example hierarchy:

Datacenter > Host Folder > Target Cluster

Reproduction steps

Error received:

Opening OVA source: /holodeck-runtime/bin/9.0/VCF-SDDC-Manager-Appliance-9.0.0.0.24703748.ova
The manifest validates
Error: Locator does not refer to an object: vi://user%40domain.local@lab1vc01.domain.local:443/DATACENTER/host/CLUSTER
Completed with errors
07-07-2025 20:28:36  VCFInstaller[14426]: [ERROR] VCF Installer deployment failed
07-07-2025 20:28:36  VCFInstaller[14426]: [ERROR] Failed to deploy OVF template after 6 retries. Terminating

In this case, the destination needed to be:

vi://user%40domain.local@lab1vc01.domain.local:443/DATACENTER/host/FOLDER/CLUSTER

Please see recommended code changes below.

Expected behavior

The following code needs to be modified to support this configuration:

In the "Holodeck" PowerShell module, the VcfInstaller.psm1 function, starting at line 53, add the following block to build the full folder hierarchy:

$cluster_name = $target_host.cluster

# Build the full cluster path including any host folders
try {
    $cluster_obj = Get-Cluster -Name $cluster_name
    $path_parts = @($cluster_obj.Name)

    # Traverse up the parent folder hierarchy until we reach the host folder
    $current_folder = $cluster_obj.ParentFolder
    while ($current_folder -and $current_folder.Name -ne "host") {
        $path_parts = @($current_folder.Name) + $path_parts
        $current_folder = $current_folder.ParentFolder
    }

    $cls = $path_parts -join "/"
    Write-Log -Message "Using cluster path: $cls"
}
catch {
    Write-Log -Message "Could not get cluster object, using cluster name directly: $cluster_name" -Level "WARN"
    $cls = $cluster_name
}

This is right before the ovftool block.

Additional context

No response

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions