Add openstack instance second NIC

Anybody has sample code on how to add a second NIC to an Openstack instance at provisioning time?

Posting in case someone has the same question. Found this code that does what we need:

Check add_networks.

@jhernandez hello

the right place for setting networks should be placement step in state machine. Method is called best_fit_openstack. Doing something like this will set any networks you need.

prov = $evm.root[“miq_provision”]
private_networks = { |x| x.external_facing == false }
prov.set_option(:networks, [{:network_id => private_networks[0].id}, {:network_id => private_networks[1].id}])

I never tried add_networks, it might work too.