Skip to content

Add libvirt support #25

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

Merged
merged 2 commits into from
Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ jobs:
vagrant-up:
runs-on: macos-10.15

strategy:
fail-fast: true
matrix:
provider: [virtualbox] # Add libvirt once available

name: Build Vagrant Box for ${{ matrix.provider }}

steps:
- uses: actions/checkout@v2
with:
Expand All @@ -21,11 +28,21 @@ jobs:
restore-keys: |
${{ runner.os }}-vagrant-

- name: Install libvirt
if: matrix.provider == 'libvirt'
run: |
# Install libvirt etc
echo "libvirt is currently not supported"
exit 1
# Install vagrant plugin
# vagrant plugin install vagrant-libvirt

- name: Show Vagrant version
run: vagrant --version

- name: Run vagrant up
run: vagrant up
run: |
vagrant up --provider=${{ matrix.provider }}

- name: Package Vagrant box
run: vagrant package --base "preCICE-VM" --output preCICE.box
Expand All @@ -36,7 +53,7 @@ jobs:
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: precice-vagrant-box
name: precice-vagrant-box-${{ matrix.provider }}
path: preCICE.box
retention-days: 7

13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ A few things you may need:

## What is included?

This box is based on the [bento/ubuntu-20.04](https://github.com/chef/bento/blob/master/packer_templates/ubuntu/ubuntu-20.04-amd64.json) base box and installs:
This box is based on the [generic/ubuntu2004](https://github.com/lavabit/robox/tree/master/scripts/ubuntu2004) base box and installs:

- Xubuntu-core (Xfce desktop environment) and related tools
- VirtualBox guest additions
Expand Down Expand Up @@ -109,3 +109,14 @@ Afterwards, you probably want to destroy everything to save storage space:
vagrant destroy
vagrant box remove test-box
```

## KVM support

If you require a more responsive experience, lower overhead, or exotic features such as GPU pass through, then the `libvirt` vagrant box is for you.
This allows you to run the vagrant box via libvirt and QEMU as a Kernerl Virtual Machine (KVM).

To use this box, first install the vagrant plugin `vagrant-libvirt` following the [official installation instructions](https://github.com/vagrant-libvirt/vagrant-libvirt#installation).
Then you follow the normal usage instructions above, but you need to tell vagrant to use the `libvirt` box by passing one additional option:
```
vagrant up --provider=libvirt
```
13 changes: 11 additions & 2 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
# The Vagrant documentation recommends the bento images instead of ubuntu (more providers, open source)
config.vm.box = "bento/ubuntu-20.04"
# The generic/ images support virtualbox as well as libvirt and hyperv.
# This allows us to create performance oriented images for Linux (libvirt) and Windows (hyperv).
config.vm.box = "generic/ubuntu2004"

# We don't want the box to automatically update every time it starts.
# We can instead handle updates internally, without destroying the machine.
Expand All @@ -25,6 +26,14 @@ Vagrant.configure("2") do |config|
vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]
end

# The libvirt provider needs to be installed using "vagrant plugin install vagrant-libvirt"
config.vm.provider :libvirt do |lv|
lv.forward_ssh_port = true
lv.title = "preCICE-VM"
lv.cpus = 2
lv.memory = 2048
end

# Install a desktop environment and basic tools
config.vm.provision "shell", path: "provisioning/install-basics.sh", privileged: false

Expand Down