Workload Domain Import Fails in VCF 9.0 for 2 Node vSAN cluster with "cannot access local variable 'esxi_cluster_moid'"
search cancel

Workload Domain Import Fails in VCF 9.0 for 2 Node vSAN cluster with "cannot access local variable 'esxi_cluster_moid'"

book

Article ID: 423350

calendar_today

Updated On:

Products

VCF Operations VMware Cloud Foundation

Issue/Introduction

  • When attempting to import a brownfield Workload Domain (specifically a 2-Node vSAN cluster configuration) into an existing VMware Cloud Foundation (VCF) 9.0 SDDC Manager, the operation fails.
  • The error displayed in the SDDC Manager UI / VCF Ops UI
    Import operation for import with id c0ac####-####-####-####-########fc90 failed internally. Command was python3 /opt/vmware/vcf/domainmanager/scripts/vcf-import-tool/vcf_brownfield.py import --skip-ssh-thumbprint-validation --sso-user [email protected] --domain-name Example-Domain-Name --vcenter importedvcenter.example.com --internal-vcf-auth --nsx-deployment-spec-path /tmp/nsxDeploymentSpec.json --skip-nsx-overlay --output-dir /var/log/vmware/vcf/domainmanager/brownfield/c0ac####-####-####-####-########fc90/ --non-interactive. Please check the log files located in /var/log/vmware/vcf/domainmanager/brownfield/c0ac####-####-####-####-########fc90/ on the SDDC Manager appliance

     

  • Error in /var/log/vmware/vcf/domainmanager/domainmanager.log in SDDC Manager
    DEBUG [vcf_dm,69##########################38,5162] [c.v.v.v.s.b.u.BrownfieldImportProgressReportService,dm-exec-9]  Deserialized progress report of the task with id 1b38####-####-####-####-########43de: {"process_id":"1b38####-####-####-####-########43de","status":"completed with error","progress":{"step":"2","step_dription":"Discover vCenter and build inventory and credentials payloads."},"total_steps":4,"errors":[{"error_code":"*****","message":"Result status code from set datasource: 400","severity":"ERROR"},{"error_code":"OPERATION_ISSUE","message":"Fatal exception: (\"cannot access local variable 'esxi_cluster_moid' where it is not associated with a value\",)","severity":"ERROR"}]}

     

    ERROR [vcf_dm,69##########################38,5162] [c.v.e.s.o.model.error.ErrorFactory,dm-exec-9]  [G0HSG4] IMPORT_OPERATION_FAILED Import operation for import with id 1b38####-####-####-####-########43de failed internally. Command was python3 /opt/vmware/vcf/domainmanager/scripts/vcf-import-tool/vcf_brownfield.py import --skip-ssh-thumbprint-validation --sso-user [email protected] --domain-name 2NodevSAN --vcenter importedvcenter.example.com --internal-vcf-auth --nsx-deployment-spec-path /tmp/nsxDeploymentSpec.json --skip-nsx-overlay --output-dir /var/log/vmware/vcf/domainmanager/brownfield/1b38####-####-####-####-########43de/ --non-interactive. Please check the log files located in /var/log/vmware/vcf/domainmanager/brownfield/1b38####-####-####-####-########43de/ on the SDDC Manager appliance

     

    com.vmware.evo.sddc.orchestrator.exceptions.OrchTaskException: Import operation for import with id 1b38####-####-####-####-########43de failed internally. Command was python3 /opt/vmware/vcf/domainmanager/scripts/vcf-import-tool/vcf_brownfield.py import --skip-ssh-thumbprint-validation --sso-user [email protected] --domain-name 2NodevSAN --vcenter importedvcenter.example.com --internal-vcf-auth --nsx-deployment-spec-path /tmp/nsxDeploymentSpec.json --skip-nsx-overlay --output-dir /var/log/vmware/vcf/domainmanager/brownfield/1b38####-####-####-####-########43de/ --non-interactive. Please check the log files located in

     

  • Error in /var/log/vmware/vcf/domainmanager/brownfield/1b38####-####-####-####-########43de/vcf_brownfield.log in SDDC Manager
    [INFO] discover_domain:286: [3/5] Starting discovery of ESXis in vCenter: importedvcenter.example.com
    [INFO] sddc_manager_helper:640: Service to get features list: domain manager, Feature: feature.vcf.vgl-3###2.brownfield.import
    [INFO] sddc_manager_helper:667: Retrieving feature toggle info from domain manager
    [INFO] request_helper:25: Response status from [93mFeatures info retrieval: 200[00m
    [INFO] sddc_manager_helper:645: Obtained feature status feature.vcf.vgl-3###2.brownfield.import=true
    [INFO] discover_domain:323: >>>>>> [1/3] Starting discovery of ESXi host: vsanwitnesshost.example.com
    [INFO] discover_domain:330: Host vsanwitnesshost.example.com is standalone
    [CRITICAL] vcf_brownfield:62: [91mFatal exception: ("cannot access local variable 'esxi_cluster_moid' where it is not associated with a value",)[00m
    Traceback (most recent call last):
      File "/opt/vmware/vcf/domainmanager/scripts/vcf-import-tool/vcf_brownfield.py", line 1435, in <module>
        main()
      File "/opt/vmware/vcf/domainmanager/scripts/vcf-import-tool/vcf_brownfield.py", line 1408, in main
        operation_successful: bool = convert_import(
                                     ^^^^^^^^^^^^^^^
      File "/opt/vmware/vcf/domainmanager/scripts/vcf-import-tool/vcf_brownfield.py", line 799, in convert_import
        discovery_output: Optional[DiscoveryModel] = discovery.discover_domain(domain_type, backup_password,
                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/vmware/vcf/domainmanager/scripts/vcf-import-tool/domain_discovery/discover_domain.py", line 1415, in discover_domain
        inventory_payload: dict[str, Any] = self.build_inventory_payload(domain_type, vcenter_vm, activating_status, existing_datastore_name, preferred_datastore_source_id_by_cluster_source_id, is_sync, cluster_id_by_cluster_source_id)
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/vmware/vcf/domainmanager/scripts/vcf-import-tool/domain_discovery/discover_domain.py", line 1128, in build_inventory_payload
        self.build_host_entities(nfs_ips_by_cluster_moid, vsan_enabled_cluster_moids, activating_status, cluster_to_primary_ds, cluster_to_primary_ds_type, is_sync, cluster_id_by_cluster_source_id)
      File "/opt/vmware/vcf/domainmanager/scripts/vcf-import-tool/domain_discovery/discover_domain.py", line 335, in build_host_entities
        logger.info(f"For host {esxi_hostname} Parent esxi_cluster_moid {esxi_cluster_moid}")
                                                                         ^^^^^^^^^^^^^^^^^
    UnboundLocalError: cannot access local variable 'esxi_cluster_moid' where it is not associated with a value

Environment

  • VMware Cloud Foundation
  • VMware Cloud Foundation Operations

Cause

  • This issue is caused by the inventory placement of the vSAN Witness host within the vCenter Server being imported.
  • The VCF 9.0 brownfield import script (vcf_brownfield.py) fails to correctly parse the parent object ID (esxi_cluster_moid) when the vSAN Witness appliance is located inside a Folder in the vCenter inventory. The script expects the standalone witness host to be associated directly with the Datacenter or a Cluster context that allows it to resolve the Managed Object ID (MOID) correctly.

Resolution

To resolve this issue, the vSAN Witness host must be moved out of any folder structures in the vCenter inventory.

Steps to follow

  1. Log in to the vCenter Server intended for import.
  2. Navigate to the Hosts and Clusters view.
  3. Locate the vSAN Witness Host
  4. If the host is inside a generic folder, drag and drop the host so it resides directly under the Datacenter object.
  5. Ensure the Witness host is not nested within any other folder structures.
  6. Return to the VMware Cloud Foundation Operations.
  7. Restart the Workload Domain import workflow.