From efa725a06577003ba9561f871d8f69683d6de052 Mon Sep 17 00:00:00 2001 From: Adam Jensen Date: Tue, 14 Nov 2023 21:06:01 -0500 Subject: [PATCH] WIP: try libvirt --- .github/workflows/build.yml | 8 ++++---- Vagrantfile | 39 +++++++++++++------------------------ 2 files changed, 18 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dc3bc2e..a54a7e3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: - name: Install Vagrant and QEMU run: | sudo apt-get install -qq -o=Dpkg::Use-Pty=0 moreutils - sudo chronic apt-get install -qq -o=Dpkg::Use-Pty=0 vagrant qemu-system virtualbox + sudo chronic apt-get install -qq -o=Dpkg::Use-Pty=0 vagrant qemu-system virtualbox qemu libvirt-daemon-system libvirt-clients libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev ruby-libvirt ebtables dnsmasq-base # - name: Cache Vagrant boxes # uses: actions/cache@v3 # with: @@ -32,11 +32,11 @@ jobs: - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up VM + shell: sudo bash {0} run: | - rm -rf ~/.vagrant - rm -rf ~/.vagrant.d vagrant plugin install vagrant-disksize - vagrant plugin install vagrant-qemu + vagrant plugin install vagrant-libvirt + vagrant plugin install vagrant-mutate vagrant status vagrant up --provider libvirt ${{ matrix.box }} - name: Package box diff --git a/Vagrantfile b/Vagrantfile index 05f3776..098a55d 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,6 +1,4 @@ Vagrant.configure("2") do |config| - config.disksize.size = "16GB" - config.vm.define "fbsd_12" do |c| c.vm.box = "roboxes/freebsd12" end @@ -13,6 +11,15 @@ Vagrant.configure("2") do |config| # c.vm.box = "roboxes/freebsd14" # end + config.vm.provider "libvirt" do |qe| + # https://vagrant-libvirt.github.io/vagrant-libvirt/configuration.html + qe.cpus = 2 + qe.memory = 8192 + end + + config.disksize.size = "16GB" + config.vm.boot_timeout = 600 + config.vm.synced_folder ".", "/vagrant", disabled: true config.vm.provision "shell", inline: <<~SHELL @@ -53,41 +60,23 @@ Vagrant.configure("2") do |config| curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain 1.72.1 EOF + echo 'Cleaning up packages' pkg prime-list pkg clean + echo 'Cleaning up unneeded directories' rm -rf /usr/obj /usr/ports /usr/src /usr/tests /usr/lib/debug /var/db # Adapted from bento's minimize.sh. This writes zeroes to the disk so that the empty space is # easily compressed. - dd if=/dev/zero of=/EMPTY bs=1M || true + echo 'Zeroing out empty space' + dd if=/dev/zero of=/EMPTY bs=100M || true rm -f /EMPTY sync + echo 'Disk usage after cleanup:' df -h du -hs /home/vagrant du -ah / | sort -r -h | head -25 SHELL - - config.vm.provider "libvirt" do |qe| - # v.memory = 8192 - # v.smp = 3 - # v.qemu_dir = "/usr/share/qemu" - # v.arch = "x86_64" - # v.machine = "q35" - # v.cpu = "qemu64" - # v.net_device = "virtio-net-pci" - - # qe.arch = "x86_64" - # qe.machine = "q35" - # qe.cpu = "max" - # qe.smp = "cpus=2,sockets=1,cores=2,threads=1" - # qe.net_device = "virtio-net-pci" - # qe.extra_qemu_args = %w(-accel tcg,thread=multi,tb-size=512) - # #qe.qemu_dir = "/usr/share/qemu" - # qe.qemu_dir = "/opt/homebrew/opt/qemu/share/qemu" - # qe.no_daemonize = true - end - - config.vm.boot_timeout = 600 end