Ideally I would like to be able to apply an attribute to hosts that contains an array of strings or integers, and use that to indicate that a particular host is suitable for hosting certain classes of VMs, something like ROLES=“ABC, ABCD, DEF”.
The 5.6 documentation on VM templates requirement expression syntax mentions that the ‘@>’ operator should evaluate against arrays, but I am having trouble getting any any attribute that I enter into a host template to be treated as an array.
I am using the following expression in the VM scheduling requirements:
SCHED_REQUIREMENTS="ROLES @> ABC"
And have attempted multiple different ways to define an array attribute on the host.
The following throw a syntax parsing error when I try to update a host template via
onehost update <ID>:
ROLES=['ABC', 'ABCD', 'DEF']
`ROLES=%w(ABC ABCD DEF)
The following I think are just recognized as strings and not arrays:
ROLES="ABC, ABCD, DEF"
ROLES="ABC ABCD DEF"
The scheduler log shows the following output:
Host 30 discarded for VM 242. It does not fulfill SCHED_REQUIREMENTS: (CLUSTER_ID = 0 | CLUSTER_ID = 101) & !(PUBLIC_CLOUD = YES) & ( ROLES @> ABC )
Mon Mar 11 18:07:06 2019 [Z0][SCHED][D]: Match-making results for VM 242:
Cannot schedule VM, there is no suitable host.
I have had some limited success with using wildcard matching, but this falls down when one of the values is comprised of another value, for example
SCHED_REQUIREMENTS="ROLES = \"*ABC*\"" will match hosts that have the “ABC” role as well as the “ABCD” role.
It also seems like in the template documentation there is no clear pattern as to what parts of the expression require escaped-nested quotes or not.
Is it even possible to create an attribute with an array value that is successfully evaluated by
@>, or alternatively, just generally evaluate a VM placement expression against a host attribute containing multiple values?