During the CI Squad's 12th Sprint (creation of libvirt reproducer), we created a libvirt reproducer that hard codes the node count to 2 ("subnode-0, subnode-1") as a simplification. After creating the 2 domains (VM's) we obtain the IP address by using a bash script that dumps the domain xml, and uses sed to pull out a MAC address, then uses the "ip neigh" command (with more grep/awk) to determine the IP [1].
This is then used to determine the IP address in a fixed/hard coded way [2] for the 2 provisioned nodes/domains. It's then used so that ansible inventory files can be created for subsequent tasks/functionality.
In order to support a reproducer that can work for an arbitrary number of nodes, the following issues/gaps were identified at the end of sprint 12:
1. need a generic way to enumerate VM's and for each, determine MAC + IP, including mappings from domain name --> mac+IP
2. dynamically set / build variables that could easily be used in with_dict or with_items looping blocks
3. While the bash script approach for doing this works, an alternate implementation might prove useful.
4. (related but a different issue) - suggestion from UA was to use the libvirt guest agent
I've prototyped something [3] that addresses 1-3, and could be updated for 4.
It's CI'd using travis currently, and has UT's.
This card tracks the RFE for libvirt reproducer to take a look to see if prototype might be useful for above goals, and/or to support arbitrary # of nodes.
[1] https://github.com/openstack/tripleo-quickstart/blob/master/roles/libvirt/setup/overcloud/files/get-domain-ip.sh
[2] https://github.com/openstack/tripleo-quickstart/blob/master/roles/libvirt/setup/overcloud/tasks/libvirt_nodepool.yml#L128
[3] https://github.com/halcyondude/ansible-role-virtvars
TLDR - the prototype role yields this:
# "virtvars_ domain_ list": [
# {
# "domain": "tiny0",
# "mac": "52:54:00:ee:d3:61"
# },
# {
# "domain": "tiny2",
# "mac": "52:54:00:2a:e5:c1"
# }
# ]
# "virtvars_ mac_dict" : { 00:ee:d3: 61",
# "tiny0": "52:54:
# "tiny2": "52:54:00:2a:e5:c1"
# }