Red Hat Bugzilla – Bug 887283
RECIPE_MEMBERS have bad value for VM multihost recipeset
Last modified: 2014-12-07 20:14:11 EST
Created attachment 663627 [details]
Description of problem
The RECIPE_MEMBERS variable should contain all hostnames from particular recipeset. In my case, I requested 3 VMs on one host (physical system):
Steps to Reproduce:
1. submit file from attachment
2. open one of /var/beah/*.env file
3. search for RECIPE_MEMBERS variable
RECIPE_MEMBERS="machine1.example.com testvm1.example.com testvm2.example.com testvm3.example.com"
I assume you are talking about on the host here -- role env vars and RECIPE_MEMBERS should always be set correctly on the guests. On the host you will get None for the guest FQDNs. That's because Beaker doesn't actually know them in advance.
This changed in Beaker 0.10 for bug 655009. Previously Beaker did know the FQDNs in advance, and they were set in RECIPE_MEMBERS and the role env vars. The problem was if the host was on a different VLAN than the allocated guest address it would fail. That was the original point of bug 655009. So Beaker no longer allocates the guest addresses in advance.
The host can fetch the guest FQDNs from Beaker, but the API is not very nice and it doesn't go through beaker-proxy, so consider this a temporary workaround only. Python script pasted below. Bear in mind this only works once the guests have finished installing and have checked in to the Beaker server -- before that, Beaker doesn't know what their FQDNs will be.
Ultimately we need some new multi-host synchronisation mechanisms for guest recipes, which will allow the host to find its guests and vice versa.
s = xmlrpclib.ServerProxy('%sRPC2' % os.environ['BEAKER'])
recipe_xml = s.recipes.to_xml(os.environ['RECIPEID'])
doc = xml.dom.minidom.parseString(recipe_xml)
guests = 
for recipe in doc.getElementsByTagName('recipe'):
if recipe.getAttribute('id') == os.environ['RECIPEID']:
for guestrecipe in doc.getElementsByTagName('guestrecipe'):
print ' '.join(guests)
With these patches, beah will reload roles at the start of every task. So the RECIPE_MEMBERS and role env vars on the host will contain the guest FQDNs, but only for tasks which are started *after* the guests have been installed (so after /distribution/virt/install).
To have updated environment only for a task started after virt/install should be enough for our purpose. Typically for a task runned on Host system in sync with others runned on Guests systems.
Beaker 0.12 has been released.