Vagrant + libvirt: question about removing boxes
Hi, I'm running the Vagrant/libvirt combination on an OpenSUSE Leap 15.4 box. It's running nicely and performs way better than the Vagrant/VirtualBox setup I've used before. My user (microlinux) is a member of the 'libvirt' system group: $ groups users libvirt So far I've added three boxes to my system: $ vagrant box list roboxes/centos7 (libvirt, 4.0.2) roboxes/oracle7 (libvirt, 4.0.2) roboxes/rhel7 (libvirt, 4.0.2) These boxes are stored in ~/vagrant.d: $ find .vagrant.d/ -name *.img .vagrant.d/boxes/roboxes-VAGRANTSLASH-centos7/4.0.2/libvirt/box.img .vagrant.d/boxes/roboxes-VAGRANTSLASH-oracle7/4.0.2/libvirt/box.img .vagrant.d/boxes/roboxes-VAGRANTSLASH-rhel7/4.0.2/libvirt/box.img $ du -sh .vagrant.d/ 2,4G .vagrant.d/ After initializing and running the boxes, they seem to be copied to /var/lib/libvirt/images: # cd /var/lib/libvirt/images/ # ls *box.img roboxes-VAGRANTSLASH-centos7_vagrant_box_image_4.0.2_box.img roboxes-VAGRANTSLASH-oracle7_vagrant_box_image_4.0.2_box.img roboxes-VAGRANTSLASH-rhel7_vagrant_box_image_4.0.2_box.img Let's say I want to remove these boxes, here's what I would do: $ vagrant box remove roboxes/rhel7 $ vagrant box remove roboxes/oracle7 $ vagrant box remove roboxes/centos7 The boxes are effectively wiped from ~/vagrant.d: $ du -sh .vagrant.d/ 56K .vagrant.d/ $ find .vagrant.d/ -name *.img But their copies still remain in /var/lib/libvirt/images: # cd /var/lib/libvirt/images # ls *box.img roboxes-VAGRANTSLASH-centos7_vagrant_box_image_4.0.2_box.img roboxes-VAGRANTSLASH-oracle7_vagrant_box_image_4.0.2_box.img roboxes-VAGRANTSLASH-rhel7_vagrant_box_image_4.0.2_box.img So here's my question: is there a way to get 'vagrant box remove' also wipe the images in /var/lib/libvirt/images? Thanks & cheers from the sunny South of France, Niki -- Microlinux - Solutions informatiques durables 7, place de l'église - 30730 Montpezat Site : https://www.microlinux.fr Blog : https://blog.microlinux.fr Mail : info@microlinux.fr Tél. : 04 66 63 10 32 Mob. : 06 51 80 12 12
On Tue, Jun 21, 2022 at 9:32 AM Nicolas Kovacs <info@microlinux.fr> wrote:
So here's my question: is there a way to get 'vagrant box remove' also wipe the images in /var/lib/libvirt/images?
https://github.com/vagrant-libvirt/vagrant-libvirt/issues/85
Le 21/06/2022 à 09:42, Andrei Borzenkov a écrit :
On Tue, Jun 21, 2022 at 9:32 AM Nicolas Kovacs <info@microlinux.fr> wrote:
So here's my question: is there a way to get 'vagrant box remove' also wipe the images in /var/lib/libvirt/images?
https://github.com/vagrant-libvirt/vagrant-libvirt/issues/85
Yeah, I just saw that too. So the problem has been raised in 2013 and regulary discussed for the last nine years without being resolved. Guess it's fair to say that at this point a solution is highly improbable. Looks like the pragmatic approach consists in manually wiping images from /var/lib/libvirt/images using either virsh or virt-manager after running 'vagrant box remove'. If anyone has a better idea, let me know. Cheers, Niki -- Microlinux - Solutions informatiques durables 7, place de l'église - 30730 Montpezat Site : https://www.microlinux.fr Blog : https://blog.microlinux.fr Mail : info@microlinux.fr Tél. : 04 66 63 10 32 Mob. : 06 51 80 12 12
Am 21.06.22 um 09:49 schrieb Nicolas Kovacs:
Le 21/06/2022 à 09:42, Andrei Borzenkov a écrit :
On Tue, Jun 21, 2022 at 9:32 AM Nicolas Kovacs <info@microlinux.fr> wrote:
So here's my question: is there a way to get 'vagrant box remove' also wipe the images in /var/lib/libvirt/images?
https://github.com/vagrant-libvirt/vagrant-libvirt/issues/85
Yeah, I just saw that too. So the problem has been raised in 2013 and regulary discussed for the last nine years without being resolved. Guess it's fair to say that at this point a solution is highly improbable.
Looks like the pragmatic approach consists in manually wiping images from /var/lib/libvirt/images using either virsh or virt-manager after running 'vagrant box remove'.
If anyone has a better idea, let me know.
What about a script which runs 'vagrant box remove' plus removing /var/lib/libvirt/images/* Peter
participants (3)
-
Andrei Borzenkov
-
Nicolas Kovacs
-
Peter McD