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

Problem with fog when entering sandbox mode #50

Open
mdimjasevic opened this issue Sep 4, 2015 · 7 comments
Open

Problem with fog when entering sandbox mode #50

mdimjasevic opened this issue Sep 4, 2015 · 7 comments

Comments

@mdimjasevic
Copy link

I use libvirt as the provider for my VMs. Here is what happens.

$ vagrant sandbox on
/home/vagrant/gems/gems/sahara-0.0.17/lib/sahara/session/libvirt.rb:1:in require': cannot load such file -- fog (LoadError) from /home/vagrant/gems/gems/sahara-0.0.17/lib/sahara/session/libvirt.rb:1:in<top (required)>'
from /home/marko/.vagrant.d/gems/gems/sahara-0.0.17/lib/sahara/session/factory.rb:12:in require_relative' from /home/marko/.vagrant.d/gems/gems/sahara-0.0.17/lib/sahara/session/factory.rb:12:increate'
from /home/vagrant/gems/gems/sahara-0.0.17/lib/sahara/command/on.rb:21:in block in execute' from /usr/lib/ruby/vendor_ruby/vagrant/plugin/v2/command.rb:226:inblock in with_target_vms'
from /usr/lib/ruby/vendor_ruby/vagrant/plugin/v2/command.rb:220:in each' from /usr/lib/ruby/vendor_ruby/vagrant/plugin/v2/command.rb:220:inwith_target_vms'
from /home/vagrant/gems/gems/sahara-0.0.17/lib/sahara/command/on.rb:19:in execute' from /home/marko/.vagrant.d/gems/gems/sahara-0.0.17/lib/sahara/command/root.rb:52:inexecute'
from /usr/lib/ruby/vendor_ruby/vagrant/cli.rb:42:in execute' from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:258:incli'
from /usr/bin/vagrant:173:in `

'

Is this the fog gem's problem? Or sahara's?

@chekolyn
Copy link
Contributor

chekolyn commented Oct 1, 2015

This is a sahara issue.

Take a look at this vagrant-libvirt issue: vagrant-libvirt/vagrant-libvirt#363

In sahara you have to edit line one of /lib/sahara/session/libvirt.rb

From:

require "fog"

module Sahara
  module Session
    class Libvirt

To:

require "fog/libvirt"

module Sahara
  module Session
    class Libvirt

chekolyn pushed a commit to chekolyn/sahara that referenced this issue Oct 1, 2015
@mdimjasevic
Copy link
Author

Hi @chekolyn ,

Thanks for this! Can you import this fix into Sahara such that everyone has it by default?

@chekolyn
Copy link
Contributor

chekolyn commented Oct 1, 2015

@mdimjasevic

Yup just submitted the pull request. chekolyn@83801c9

@tehsmyers
Copy link

I was hitting this issue, but to me it looks like fog isn't installed where vagrant needs it. My workaround was to vagrant plugin install fog, which got the sandbox subcommand working by putting fog where vagrant was looking for it.

My first thought is that sahara should probably mention this in the Gemfile, but it looks like only libvirt needs it, so the "fix" might as simple as a note in the readme: "If you're using sahara with libvirt, vagrant plugin install fog"

I felt a little bad about lying to vagrant since fog isn't a vagrant plugin, but now sandbox works and I got over it.

@chekolyn
Copy link
Contributor

@seandst

I think you make a good point however the "fog/libvirt" requirement source is from vagrant-libvirt itself
If you take a look at the gemspec; vagrant-libvirt has it as a gem requirement:
https://github.com/pradels/vagrant-libvirt/blob/master/vagrant-libvirt.gemspec

I think the change was somewhat recent:
vagrant-libvirt/vagrant-libvirt@749b431

@tehsmyers
Copy link

Ah, that makes perfect sense, thanks. Now I see how your PR fixes it.

So this is probably fixed with the next release of sahara after the current, and until that's released you can work around it by either manually applying the patch in #50 or being slightly evil like me and installing fog as a vagrant plugin.

@flavio-fernandes
Copy link

Many thanks for this thread and fix!!!

After trying the change I now hit this:

https://gist.github.com/f42ad2deef8908bee8cb

Any ideas?

--flaviof

$ vagrant sandbox on
[vm1] Starting sandbox mode...
/home/ff/.vagrant.d/gems/gems/sahara-0.0.17/lib/sahara/session/libvirt.rb:106:in snapshot_create_xml': Call to virDomainS (Libvirt::Error)failed: operation failed: Error -22 while writing VM from /home/ff/.vagrant.d/gems/gems/sahara-0.0.17/lib/sahara/session/libvirt.rb:106:inon'
from /home/ff/.vagrant.d/gems/gems/sahara-0.0.17/lib/sahara/command/on.rb:28:in block in execute' from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/plugin/v2/command.rb:226:inblock in with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/plugin/v2/command.rb:220:in each' from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/plugin/v2/command.rb:220:inwith_target_vms'
from /home/ff/.vagrant.d/gems/gems/sahara-0.0.17/lib/sahara/command/on.rb:19:in execute' from /home/ff/.vagrant.d/gems/gems/sahara-0.0.17/lib/sahara/command/root.rb:52:inexecute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/cli.rb:42:in execute' from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/environment.rb:301:incli'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/bin/vagrant:174:in `

'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants