Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle parallel executions adding/removing networks #1738

Open
electrofelix opened this issue May 1, 2023 · 0 comments
Open

Handle parallel executions adding/removing networks #1738

electrofelix opened this issue May 1, 2023 · 0 comments

Comments

@electrofelix
Copy link
Contributor

electrofelix commented May 1, 2023

When multiple executions of vagrant with vagrant-libvirt are performed at the or near same time, networks that do not have the :libvirt__always_destroy flag set to false can sometimes be removed by one instance while another was in the middle of creating a new domain that relies on it.

Once an instance has a network interface added that is connected to a network, it will automatically prevent the network definition from being removed. The operations of when vagrant checks to see if a network needs to be created and being attached to the associated domain is not atomic. This allows an opportunity for another instance to remove by accident.

While it might be possible to add a lock around each network create, domain creation, then subsequent network device attachment, it is likely to cause many issues and require combining a great deal of operations that are current separated out into different actions.

Suggested approach:

  • Add a generic locking mechanism that works for both local and remote interactions as well as across multiple users
  • Support a vagrant-libvirt XML namespace being added to network definitions
  • Annotate the networks created by vagrant-libvirt as owned by the plugin and update the teardown to only remove networks managed by vagrant-libvirt
  • Add locking around network creation
  • Annotate the network with the list of domains that should be using this network definition, removing any references to domains that no longer exist.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant