VCF 4.1 – update vSAN license key in the failed ‘Add Cluster’ workflow

When you add new vSphere cluster to the management or VI workload domain and provide expired or invalid vSAN license key, the subtask ‘Apply vSAN License in vCenter Server’ will fail:

 In /var/log/vmware/vcf/domainmanager/domainmanager.log you can find more details:

2021-04-21T11:53:22.184+0000 WARN  [vcf_dm,9f492adb1719ed65,0ae2] [c.v.e.s.c.c.v.vsphere.VcManagerBase,dm-exec-8]  VSAN license verification failed - assuming vSAN license not applied
 2021-04-21T11:53:22.184+0000 DEBUG [vcf_dm,9f492adb1719ed65,0ae2] [c.v.v.c.f.p.a.i.BaseApplyLicenseInVcAction,dm-exec-8]  Applying license to entity domain-c40025
 2021-04-21T11:53:22.251+0000 WARN  [vcf_dm,9f492adb1719ed65,0ae2] [c.v.v.c.f.p.a.i.BaseApplyLicenseInVcAction,dm-exec-8]  Unable to apply license, retry 1
 2021-04-21T11:53:22.251+0000 DEBUG [vcf_dm,9f492adb1719ed65,0ae2] [c.v.v.c.f.p.a.i.BaseApplyLicenseInVcAction,dm-exec-8]  Waiting for 60 seconds before applying license
...
...
2021-04-21T11:55:22.377+0000 ERROR [vcf_dm,9f492adb1719ed65,0ae2] [c.v.e.s.o.model.error.ErrorFactory,dm-exec-8]  [F9UIAK] VSPHERE_APPLY_LICENSE_FAILED License application through vCenter failed: domain-c40025
 com.vmware.evo.sddc.orchestrator.exceptions.OrchTaskException: License application through vCenter failed: domain-c40025

To update the invalid vSAN license key in running workflow with the new one just performed below steps:

  1. First get the workload ID value (can be found in subtasks URL)

2. Log in via SSH to the SDDC manager as the vcf user, switch to the root user and use curl to create a json file with the workflow input (remember to replace workflow ID):

curl -s http://localhost/domainmanager/internal/vault/97b108a3-463d-4a10-a8de-5d2b778b3aab -XGET | json_pp > /tmp/add_cluster_vsan_license.json

3. Open add_cluster_vsan_license.json file using vim and replace invalid license key with new one using ‘%s’ to find each occurrence of ‘XXXXX-XXXXX-XXXXXX-XXXXX-XXXXX’ (expired license key) in all lines, and replace it with ‘YYYYY-YYYYY-YYYYY-YYYYY’ (valid license key):

%s/XXXXX-XXXXX-XXXXXX-XXXXX-XXXXX/YYYYY-YYYYY-YYYYY-YYYYY/g

4. Use curl once again to update the input parameters to the workflow ( again, remember to replace workflow ID):

curl -s http://localhost/domainmanager/internal/vault/97b108a3-463d-4a10-a8de-5d2b778b3aab -XPUT -H "Content-type: text/plain" -d @/tmp/add_cluster_vsan_license.json

5. And restart task in SDDC Manager clicking the ‘RESTART TASK’ button next to the failed workflow.

That’s it 🙂