Skip to content
Open
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
39 changes: 36 additions & 3 deletions .github/workflows/jepsen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Copy link

Copilot AI Mar 1, 2026

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 (uses apt-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.

Suggested change
runs-on: [self-hosted]
runs-on: [self-hosted, linux, kvm, libvirt]

Copilot uses AI. Check for mistakes.

timeout-minutes: 120
steps:
- name: Checkout
Expand All @@ -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
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sudo chmod 666 /var/run/libvirt/libvirt-sock grants world read/write access to the libvirt control socket, which is a high-impact privilege escalation risk on self-hosted runners. Prefer a least-privilege approach (e.g., ensure the runner user is in the libvirt group and run libvirt/vagrant commands under that group via sg/newgrp, or use an ACL for just the runner user) rather than opening the socket globally.

Copilot uses AI. Check for mistakes.
# 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
Expand Down
12 changes: 10 additions & 2 deletions jepsen/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Halving the memory allocation for both VirtualBox and UTM providers is a significant change that could impact the stability of the Jepsen test environment.

  • Control Node (2GB): The control node runs Jepsen (on a JVM) and compiles Go code. Both are memory-intensive operations, and 2GB might be insufficient, leading to Out-Of-Memory errors or slow performance.
  • Worker Nodes (1GB): The worker nodes run the elastickv service. 1GB of RAM might not be enough, depending on the service's memory footprint, especially under test load.

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_MEM

Even 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|
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

override.vm.box = "generic/debian12" makes the base box differ by provider from the global config.vm.box (bento/debian-12). If this is required because bento/debian-12 lacks a libvirt build, please add a short comment explaining that constraint; otherwise, consider using a single multi-provider box to keep environments consistent across providers.

Suggested change
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 uses AI. Check for mistakes.
override.vm.box = "generic/debian12"
kvm.memory = name == :ctrl ? 4096 : 2048
kvm.cpus = 2
# 必要に応じてドライバを指定
Copy link

Copilot AI Mar 1, 2026

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.

Suggested change
# 必要に応じてドライバを指定
# Specify libvirt driver via LIBVIRT_DRIVER if needed

Copilot uses AI. Check for mistakes.
kvm.driver = ENV['LIBVIRT_DRIVER'] || 'kvm'
Comment on lines +47 to +52
Copy link

Copilot AI Mar 1, 2026

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.

Suggested change
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'

Copilot uses AI. Check for mistakes.
end

if name == :ctrl
node.vm.synced_folder "..", "/home/vagrant/elastickv",
type: "rsync",
Expand Down
Loading