Menu

STAF won't start on DHCP enabled VMs without a valid host name

Help
2017-01-10
2017-01-11
  • Sander Pool

    Sander Pool - 2017-01-10

    Hi,

    We create VMs on the fly for running test scripts. The ESX template has STAF installed and indeed it tries to start when the new VM boots. It fails with this error:

    Error code: 47
    Reason : Error creating interface. STAFConnectionProviderConstruct: Could not determine logical/physical identifier.Error code: 22 Reason: Unknown host name: qataas-template.mycompany.com, gethostbyname()

    The name of the host is not valid (it is the name of the template and not known to DNS). The system has an IP address and can be reached using ssh and other protocols. Only STAF can't deal with this situation. Things work fine when I set the hostname to the IP address but that means I need to ssh into the system and then reboot before it is operational. I found a thread from '08 where this same problem was briefly discussed. Are there other options? Why does STAF need to do a hostname based IP lookup of itself? Is it worthwhile for me to build a custom STAF that does not do this or will it all fall apart?

    I suppose another alternative is to set the hostname of the template to localhost or some other name that resolves. Will STAF work if I instantiate multiple VMs with the same name but different IP addresses?

    Thanks,

    Sander
    
     
  • Sharon Lucas

    Sharon Lucas - 2017-01-10

    This error is talked about in section "3.3.18. Explain startup error: Error creating interface. Could not determine logical/physical identifier. " in the STAF FAQ at http://staf.sourceforge.net/current/STAFFAQ.htm#d0e179 where it suggests getting around this issue on Unix systems by adding an entry to the hosts file.

    STAF uses the hostname over the IP address for the logical machine ID when possible. Some of the history for this is because when DHCP is used, the IP address of a system can change. Note that STAF handles things like process completion notifications from long running processes and matches by logical machine ID to better ensure a match when DHCP addresses are being used.

    There is an open Feature #415 "Add Option to make STAF NOT lookup hostnames" at https://sourceforge.net/p/staf/feature-requests/415/ that has not yet been implemented where others have also requested this ability. I haven't had time to look at it, but it someone else had time and could contribute it back to the project, that would be great. It should be possible to implement, but I haven't looked at it in depth.

    The STAF logical machine ID for each system should be unique.

     
  • Sander Pool

    Sander Pool - 2017-01-11

    Hi,

    Thanks for explaining the situation. For now I will assign the IP address as the hostname which ensures the hostname is unique and can be used for completion notifications. I understand the concern of IP addressses changing. When a new VM is added I use the VMWare API to look up the IP address and store that in a database. Before using the VM for a STAF process I first STAF ping it. If the ping fails I look up the IP address again.

    Sander

     

Log in to post a comment.