fog / fog-libvirt

libvirt provider for fog
MIT License
16 stars 42 forks source link

Avoid querying for all networks by default #113

Closed electrofelix closed 2 years ago

electrofelix commented 2 years ago

Given the network attribute of the nic is assumed to exist, provide this as a filter attribute to skip querying libvirt for all networks and instead request only the one relevant.

This can help avoid a race condition where multiple sets of vagrant machines are being run on the same host using different networks where during delete/destroy the networks of one are removed and yet at the same time the other environment may attempt to access the attributes.

Relates-to: vagrant-libvirt/vagrant-libvirt#1438

electrofelix commented 2 years ago

@geemus I think I've run into a common issue with how filters are currently implemented for fog-libvirt requests. It appears that the structure of the code prevents use of the same logic for the application of the filter. I'm not sure if there is an easy solution to this, just that it appears to make it quite difficult to work out how to write suitable tests and be confident that the behaviour tested aligns with behaviour that will be seen when working with real requests.

geemus commented 2 years ago

@electrofelix thanks for the heads up, I'm not sure off hand, but would be happy to talk through it some more if that would be helpful.