-
Notifications
You must be signed in to change notification settings - Fork 2
Update Vagrantfile #293
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
base: main
Are you sure you want to change the base?
Update Vagrantfile #293
Changes from all commits
9abefce
009324f
88db435
7816187
651320b
820031d
213c4ae
8946871
6a22399
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,8 +21,11 @@ on: | |
|
|
||
| jobs: | ||
| jepsen: | ||
| # Requires a self-hosted runner with VirtualBox + Vagrant and at least 12GB RAM free. | ||
| runs-on: [self-hosted, virtualbox] | ||
| # Requires a runner with KVM support (e.g. larger GitHub runners or metal) for decent performance. | ||
| # Standard ubuntu-latest might fall back to QEMU TCG (very slow) or fail if kvm driver is forced. | ||
| # runs-on: ubuntu-latest | ||
| runs-on: [self-hosted] | ||
|
|
||
| timeout-minutes: 120 | ||
| steps: | ||
| - name: Checkout | ||
|
|
@@ -35,9 +38,39 @@ jobs: | |
| with: | ||
| go-version: "1.26.0" | ||
|
|
||
| - name: Install Vagrant and Libvirt | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y vagrant ruby-libvirt qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils libvirt-dev gcc make | ||
|
|
||
| # Check KVM support | ||
| echo "Checking KVM support..." | ||
| if [ -r /dev/kvm ]; then | ||
| echo "KVM is available." | ||
| else | ||
| echo "WARNING: KVM is NOT available. VMs may run very slowly or fail." | ||
| fi | ||
|
|
||
| # Setup Libvirt permissions | ||
| sudo usermod -aG libvirt $USER | ||
| # Allow current session to access libvirt socket | ||
| sudo chmod 666 /var/run/libvirt/libvirt-sock | ||
|
|
||
|
Comment on lines
+54
to
+58
|
||
| # Install Vagrant plugins | ||
| vagrant plugin install vagrant-libvirt | ||
| vagrant plugin install vagrant-scp | ||
|
|
||
| - name: Bring up Jepsen VMs | ||
| working-directory: jepsen | ||
| run: vagrant up | ||
| run: | | ||
| if [ -r /dev/kvm ] && [ -w /dev/kvm ]; then | ||
| echo "KVM is available. Using kvm driver." | ||
| export LIBVIRT_DRIVER=kvm | ||
| else | ||
| echo "KVM is NOT available or not writable. Falling back to qemu driver (slow)." | ||
| export LIBVIRT_DRIVER=qemu | ||
| fi | ||
| vagrant up --provider=libvirt | ||
|
|
||
| - name: Run Jepsen workload | ||
| working-directory: jepsen | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -34,16 +34,24 @@ Vagrant.configure("2") do |config| | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # VirtualBox (Intel) defaults | ||||||||||||||||||||||||||
| node.vm.provider "virtualbox" do |vb| | ||||||||||||||||||||||||||
| vb.memory = name == :ctrl ? 4096 : 2048 | ||||||||||||||||||||||||||
| vb.memory = name == :ctrl ? 2048 : 1024 | ||||||||||||||||||||||||||
| vb.cpus = 2 | ||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # UTM (Apple Silicon) defaults | ||||||||||||||||||||||||||
| node.vm.provider "utm" do |utm| | ||||||||||||||||||||||||||
| utm.memory = name == :ctrl ? 4096 : 2048 | ||||||||||||||||||||||||||
| utm.memory = name == :ctrl ? 2048 : 1024 | ||||||||||||||||||||||||||
|
Comment on lines
+37
to
+43
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Halving the memory allocation for both VirtualBox and UTM providers is a significant change that could impact the stability of the Jepsen test environment.
This change introduces a high risk of making the test environment unreliable. For better maintainability and to avoid duplicating the memory values, consider defining them as variables at a higher scope. This would also make it easier for other developers to adjust them based on their system's resources. Example: # At the top of the Vagrantfile
CTRL_MEM = 2048
NODE_MEM = 1024
# ... then in the provider blocks
vb.memory = name == :ctrl ? CTRL_MEM : NODE_MEM
# and
utm.memory = name == :ctrl ? CTRL_MEM : NODE_MEMEven better would be to allow overriding from environment variables: CTRL_MEM = ENV.fetch('VAGRANT_CTRL_MEM', 2048)
NODE_MEM = ENV.fetch('VAGRANT_NODE_MEM', 1024) |
||||||||||||||||||||||||||
| utm.cpus = 2 | ||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| node.vm.provider "libvirt" do |kvm, override| | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
| node.vm.provider "libvirt" do |kvm, override| | |
| node.vm.provider "libvirt" do |kvm, override| | |
| # Use a separate box for libvirt because bento/debian-12 does not provide a libvirt build. |
Copilot
AI
Mar 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The inline comment # 必要に応じてドライバを指定 is the only non-English comment in this (otherwise English) Vagrantfile. Consider translating it to English for consistency so future maintainers don’t miss the purpose of LIBVIRT_DRIVER.
| # 必要に応じてドライバを指定 | |
| # Specify libvirt driver via LIBVIRT_DRIVER if needed |
Copilot
AI
Mar 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the libvirt provider block, the first block parameter is named kvm, but this object represents the libvirt provider config even when kvm.driver is set to qemu. Renaming the variable to something provider-neutral (e.g. libvirt) would avoid confusion and better match its actual meaning.
| node.vm.provider "libvirt" do |kvm, override| | |
| override.vm.box = "generic/debian12" | |
| kvm.memory = name == :ctrl ? 4096 : 2048 | |
| kvm.cpus = 2 | |
| # 必要に応じてドライバを指定 | |
| kvm.driver = ENV['LIBVIRT_DRIVER'] || 'kvm' | |
| node.vm.provider "libvirt" do |libvirt, override| | |
| override.vm.box = "generic/debian12" | |
| libvirt.memory = name == :ctrl ? 4096 : 2048 | |
| libvirt.cpus = 2 | |
| # 必要に応じてドライバを指定 | |
| libvirt.driver = ENV['LIBVIRT_DRIVER'] || 'kvm' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This job now uses
runs-on: [self-hosted], but the steps assume a Debian/Ubuntu-like host (usesapt-get) and require KVM/libvirt support. To avoid the workflow being scheduled onto an incompatible self-hosted runner, consider adding explicit runner labels (e.g.self-hosted, linux, kvm/libvirt) and/or switching to a known hosted runner image if feasible.