-
Type:
Problem report
-
Resolution: Unresolved
-
Priority:
Trivial
-
None
-
Affects Version/s: 7.0.31
-
Component/s: Templates (T)
-
None
-
Support backlog
Description
For an ESXi host outside of a cluster (parent is ComputeResource), vmware.hv.discovery returns empty {#CLUSTER.NAME}. As a result:
- official templates put such hosts and their VMs into groups named (hypervisor) and (vm);
- group prototypes using {#CLUSTER.NAME} as a path segment fail:
Cannot discover group: invalid group name "Virtualization/Hypervisors/DC0/".
Steps to reproduce
- Add an ESXi host directly under a datacenter (or datacenter host folder), outside any cluster.
- Link template "VMware"; additionally, create a host prototype on vmware.hv.discovery with group prototype Virtualization/Hypervisors/{#DATACENTER.NAME}/{#CLUSTER.NAME}.
- Run discovery.
Discovery output (reproduced with vcsim):
| HV.NAME | CLUSTER.NAME | PARENT.NAME | PARENT.TYPE |
|---|---|---|---|
| DC0_C0_H0 | DC0_C0 | DC0_C0 | ClusterComputeResource |
| DC0_H0 | DC0 | Datacenter | |
| DC0_H1 | Company | Folder |
Result
| Group prototype | Clustered host | Standalone host |
|---|---|---|
| {#CLUSTER.NAME} (hypervisor) | DC0_C0 (hypervisor) | (hypervisor) |
| {#CLUSTER.NAME} (vm) | DC0_C0 (vm) | (vm) |
| Virtualization/Hypervisors/{#DATACENTER.NAME}/{#CLUSTER.NAME} | Virtualization/Hypervisors/DC0/DC0_C0 | invalid group name error |
Expected
Standalone hosts are placed into meaningful groups.
Suggested fix
In templates "VMware" and "VMware FQDN", add LLD preprocessing with a default value for empty {#CLUSTER.NAME} (verified on 7.0.31):
var d = JSON.parse(value); var arr = Array.isArray(d) ? d : (d.data || []); arr.forEach(function (e) { if (!e['{#CLUSTER.NAME}']) { e['{#CLUSTER.NAME}'] = 'Standalone'; } }); return JSON.stringify(d);
Also document that {#CLUSTER.NAME} is empty for standalone hosts, and document {#PARENT.NAME} / {#PARENT.TYPE}, which can be used as an alternative.