Is it possible to create a host asynchronously?

Problem:
We are mainly creating hosts directly from our Workflow engine. This usually works fine, but for Windows hosts, where we need to clone from templates instead of installing, depending on which Datastore VMWare puts the VM into (using storage pods), the cloning can take a long time which leads to the POST request timing out and the workflow in our workflow engine failing. The host is created fine, but the workflow still is marked as failed.
Is there any known workaround to this behavior or a way to create a host in an “async” fashion from the API? If have found an old thread stating there was no async back then, but I thought it might be worth asking again since some years have passed. Also the soggested workaround there does not help for us since the problem is in another part of provisioning.

Expected outcome:
Workflow engine not reciving a timeout during host creation.

Foreman and Proxy versions:
2.0

Foreman and Proxy plugin versions:
Katello 3.15

Distribution and version:
RHEL 7

Other relevant data:
For now, we have reverted to targeting the datastores directly instead of storage pods, but our VMWare team is not super happy with this solution. The problem seams to occure every time the storage pod assingns the VM to a different datastore than the one holding the template we clone from.

This is a problem of Foreman’s design - orchestration is built around ActiveRecord, we would probably need to do a big refactoring in order to support that. We have Tasks/Dynflow built exactly for that, but I do not think if this is on our agenda right now.

1 Like

Thanks for the clarification.
Are there any known workarounds we could apply for a scenario like ours? Or is our best option to just “let it timeout and check later if it succeeded”?

No workaround to my knowledge. Btw there was a PoC worked on before to move the migration to be tasks based. It was working quite well, the problem was with tasks being a plugin. We’d need to merge that to core first, there was a general support for that. It’s not on anyones roadmap afaik.

1 Like

Thanks for the help everyone!
For now, we will continue deploying to datastores directly to ensure we deploy to the right datastore. Maybe we can find a solution to the problem of the workflow side of things.