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

Allow status and ssh to run without a lock #282

Merged
merged 1 commit into from
Apr 15, 2016

Conversation

Sharpie
Copy link
Contributor

@Sharpie Sharpie commented Apr 13, 2016

Prior to this patch long running operations, such as provisioners, would
prevent vagrant status or vagrant ssh from being run due to Vagrant
action locking. Attempting such actions would result in an error message. This
is inconvienant as shelling into a VM is a common debugging step in figuring
out why a provisioner is taking longer than usual.

Vagrant 1.7 introduced the ability to mark certain actions as not requireing a
lock. This patch adds lock: false to the get_state and get_ssh_info calls
which allows both vagrant status and vagrant ssh to function while a
long-running action is executing in another process. Vagrant 1.6 will ignore
the unknown lock option and fail as usual.

Prior to this patch long running operations, such as provisioners, would
prevent `vagrant status` or `vagrant ssh` from being run due to Vagrant
action locking. Attempting such actions would result in an error message. This
is inconvienant as shelling into a VM is a common debugging step in figuring
out why a provisioner is taking longer than usual.

Vagrant 1.7 introduced the ability to mark certain actions as not requireing a
lock. This patch adds `lock: false` to the `get_state` and `get_ssh_info` calls
which allows both `vagrant status` and `vagrant ssh` to function while a
long-running action is executing in another process. Vagrant 1.6 will ignore
the unknown `lock` option and fail as usual.
@Sharpie
Copy link
Contributor Author

Sharpie commented Apr 13, 2016

Simple reproduction case:

Vagrant.configure('2') do |config|

  config.vm.provider :openstack do |p, o|
    # OpenStack configuration.
  end

  config.vm.define :test do |node|
    # Some long-running provisioner
    node.vm.provision :shell, inline: 'sleep 300'
  end

end

Run vagrant provision test in one terminal. Open a separate terminal and attempt vagrant status or vagrant ssh test. Both will fail with:

An action 'get_state' was attempted on the machine 'test',
but another process is already executing an action on the machine.
Vagrant locks each machine for access by only one process at a time.
Please wait until the other Vagrant process finishes modifying this
machine, then try again.

If you believe this message is in error, please check the process
listing for any "ruby" or "vagrant" processes and kill them. Then
try again.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 92.27% when pulling 44e4cce on Sharpie:dont-lock-for-ssh into 8808736 on ggiamarchi:master.

@ggiamarchi ggiamarchi self-assigned this Apr 15, 2016
@ggiamarchi ggiamarchi added this to the 0.7.2 milestone Apr 15, 2016
@ggiamarchi
Copy link
Owner

Good one, LGTM.

@ggiamarchi ggiamarchi merged commit 7a5d972 into ggiamarchi:master Apr 15, 2016
@Sharpie Sharpie deleted the dont-lock-for-ssh branch April 18, 2016 02:56
Sharpie pushed a commit to Sharpie/vagrant-openstack-provider that referenced this pull request Jul 25, 2016
Allow status and ssh to run without a lock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants