Call to virStorageVolGetInfo failed: cannot stat file #107

Closed
Freeaqingme opened this Issue Dec 16, 2013 · 20 comments

Comments

Projects
None yet
5 participants

Hi folks,

From time to time, when I reboot something it seems a vagrant box dies. Not really big issue since I can simply destroy the vagrant box, and then restart it. Except, I keep getting this all the time:

root@devvps1:/home/dschimmel/Projects/puppet# vagrant destroy

Vagrant could not detect VirtualBox! Make sure VirtualBox is properly installed.
Vagrant uses the `VBoxManage` binary that ships with VirtualBox, and requires
this to be available on the PATH. If VirtualBox is installed, please find the
`VBoxManage` binary and add it to the PATH environmental variable.
root@devvps1:/home/dschimmel/Projects/puppet# vagrant up --provider=libvirt

Bringing machine 'puppet0' up with 'libvirt' provider...
An error occurred while executing multiple actions in parallel.
Any errors that occurred are shown below.

An unexpected error ocurred when executing the action on the
'puppet0' machine. Please report this as a bug:

Call to virStorageVolGetInfo failed: cannot stat file '/var/lib/libvirt/images/puppet_puppet0.img': No such file or directory

/root/.vagrant.d/gems/gems/fog-1.15.0/lib/fog/libvirt/requests/compute/list_volumes.rb:33:in `info'
/root/.vagrant.d/gems/gems/fog-1.15.0/lib/fog/libvirt/requests/compute/list_volumes.rb:33:in `volume_to_attributes'
/root/.vagrant.d/gems/gems/fog-1.15.0/lib/fog/libvirt/requests/compute/list_volumes.rb:10:in `block (2 levels) in list_volumes'
/root/.vagrant.d/gems/gems/fog-1.15.0/lib/fog/libvirt/requests/compute/list_volumes.rb:9:in `each'
/root/.vagrant.d/gems/gems/fog-1.15.0/lib/fog/libvirt/requests/compute/list_volumes.rb:9:in `block in list_volumes'
/root/.vagrant.d/gems/gems/fog-1.15.0/lib/fog/libvirt/requests/compute/list_volumes.rb:45:in `block in raw_volumes'
/root/.vagrant.d/gems/gems/fog-1.15.0/lib/fog/libvirt/requests/compute/list_volumes.rb:43:in `each'
/root/.vagrant.d/gems/gems/fog-1.15.0/lib/fog/libvirt/requests/compute/list_volumes.rb:43:in `raw_volumes'
/root/.vagrant.d/gems/gems/fog-1.15.0/lib/fog/libvirt/requests/compute/list_volumes.rb:8:in `list_volumes'
/root/.vagrant.d/gems/gems/fog-1.15.0/lib/fog/libvirt/models/compute/volumes.rb:13:in `all'
/root/.vagrant.d/gems/gems/vagrant-libvirt-0.0.13/lib/vagrant-libvirt/action/handle_box_image.rb:39:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/builtin/handle_box_url.rb:24:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in `call'
/root/.vagrant.d/gems/gems/vagrant-libvirt-0.0.13/lib/vagrant-libvirt/action/handle_storage_pool.rb:21:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in `call'
/root/.vagrant.d/gems/gems/vagrant-libvirt-0.0.13/lib/vagrant-libvirt/action/set_name_of_domain.rb:26:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/runner.rb:61:in `block in run'
/opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/util/busy.rb:19:in `busy'
/opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/runner.rb:61:in `run'
/opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/builtin/call.rb:51:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in `call'
/root/.vagrant.d/gems/gems/vagrant-libvirt-0.0.13/lib/vagrant-libvirt/action/connect_libvirt.rb:88:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/builder.rb:116:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/runner.rb:61:in `block in run'
/opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/util/busy.rb:19:in `busy'
/opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/runner.rb:61:in `run'
/opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/machine.rb:147:in `action'
/opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/batch_action.rb:63:in `block (2 levels) in run'
root@devvps1:/home/dschimmel/Projects/puppet# virsh list --all
 Id    Name                           State
----------------------------------------------------

How should I fix? I'm posting it here because the error says to 'please report this as a bug'.

Thanks.

Contributor

kalabiyau commented Dec 16, 2013

@Freeaqingme can you please show output of

vagrant box list

?

That gives me:

# vagrant box list

debian-wheezy (libvirt)
Owner

pronix commented Dec 16, 2013

looks like in Vagrantfile you define not existed image

@pronix What do you mean? It tries to look up a (not per se) related .img file that no more exists. If I rename the folder of my Vagrant file, and touch that .img file, I can spawn a new vps. But I shouldn't have to, and it's hard to explain to users.

Owner

pronix commented Dec 16, 2013

show please Vagrantfile

This is my Vagrantfile:

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

  $script = <<SCRIPT
    rm /etc/puppet/* -rf
    ln -s /vagrant/* /etc/puppet/
    cd /etc/puppet
    puppet apply --confdir=. --verbose --hiera_config=/etc/puppet/hieradata/hiera.yaml \
      --parser future --show_diff --external_nodes=/etc/puppet/node.rb \
      --node_terminus=exec --templatedir=templates manifests/site.pp
SCRIPT

  config.vm.define :puppet0, primary: true do |puppet0|
    puppet0.vm.box = "debian-wheezy"
    puppet0.vm.synced_folder ".", "/vagrant", :nfs => true, :nfs_version => 4
    puppet0.vm.network :private_network, :ip => '10.128.207.194'
    puppet0.vm.hostname = "puppet0.devlocal.mgmt.dcga.ams.example.net"
    puppet0.vm.provision "shell", inline: $script

    puppet0.vm.provider :libvirt do |domain|
      domain.memory = 2048
      domain.cpus = 2
      domain.volume_cache = 'none'
    end

  end

  config.vm.boot_timeout = 360

  config.vm.provider :libvirt do |libvirt|
    libvirt.driver = "qemu"
    libvirt.host = "localhost"
    libvirt.connect_via_ssh = true
    libvirt.username = "root"
    libvirt.storage_pool_name = "default"
  end

end
Owner

pronix commented Dec 16, 2013

which images you have in /var/lib/libvirt/images/ and are you sure than you use this path for store images(/var/lib/libvirt/images/) ?

The problem is that if the puppet_puppet0.img file isn't in that directory, no single box will start. If I touch that file, it will. Even though I did a full vagrant destroy in my puppet/ directory.

Edit: And yes, those paths are correct.

Owner

pronix commented Dec 16, 2013

ok. will wait pull request from you.

I'm sorry, but I'm not sure how to fix this... Even after I do vagrant destroy, somewhere a reference to the box stays behind. But I can't locate it.

Contributor

purpleidea commented Dec 16, 2013

I have this problem too... Not sure what causes it, but a workaround is to restart libvirtd...
Something buggy is causing it most likely... Maybe a file is getting removed manually with rm instead of deleting the stored object with libvirt?

"but a workaround is to restart libvirtd..."

You, sir, are awesome! This tip will save me many, many reinstalls ;)

Contributor

purpleidea commented Dec 16, 2013

You're welcome, but it would be awesome if we could fix this for GOOD!

Restarting libvirtd every 5 minutes is annoying, not practical!

On Mon, Dec 16, 2013 at 3:07 PM, Dolf Schimmel notifications@github.comwrote:

"but a workaround is to restart libvirtd..."

You, sir, are awesome! This tip will save me many, many reinstalls ;)


Reply to this email directly or view it on GitHubhttps://github.com/pradels/vagrant-libvirt/issues/107#issuecomment-30695317
.

I had been searching on the filesystem for a reference to the deleted volume, but couldn't find any. Turns out I wasn't looking in the right place; the reference is kept in-memory.

virsh vol-list  --details  default

Still shows the shouldbe-deleted volume. Removing it seems to fix (needs further testing) the issue of Vagrant not starting any more:

virsh vol-delete puppet_puppet0.img --pool default

I think that means that this issue now entails two things:

  • When you start a box, Vagrant iterates over all virsh volumes. The question is why it does so, as apparently it can be error prone, and I personally can't think of a good reason to do this (there may be one, I'm just not aware of it).
  • When a box is destroyed, all traces seem to be removed. Except for the volume in virsh.
Contributor

purpleidea commented Dec 17, 2013

Indeed it's because it's kept in memory... It could be that something in the code is just "rm"-ing the file as I said above. In any case, I haven't gone source diving, but if someone takes the plunge, I'd sure appreciate it.

Cheers

Owner

pronix commented Dec 18, 2013

sorry,it is not vagrant issue.
configure libvirt require before use vagrant-libivrt.

pronix closed this Dec 18, 2013

Contributor

purpleidea commented Dec 18, 2013

@pronix Not sure why this isn't a vagrant-libvirt issue... It is...
If it's not, maybe you could explain why. Thanks!

@pronix What is there to configure on libvirt that I could have missed? Libvirt has been installed and works just fine outside of vagrant-libvirt.

Owner

pronix commented Dec 18, 2013

something remove your vm images. vagrant-libvirt not responsible for store files

gjunp commented Aug 4, 2014

I have this problem too... after I reinstalled the virtualbox,but the "vagrant box list" works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment