Skip to content
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

Move to virtuerl (Erlang) #132

Merged
merged 51 commits into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
70809b6
virtuerl: init
verbit Aug 10, 2023
f75ef6d
virtuerl: add GET /networks endpoint
verbit Aug 28, 2023
2c74061
virtuerl: sync domains on start
verbit Aug 28, 2023
629c2df
virtuerl: add entrypoint for simplistic erl startup
verbit Aug 28, 2023
3198c68
virtuerl: setup for integration test
verbit Aug 31, 2023
90caa11
virtuerl: use proper uuid4 for ids
verbit Sep 2, 2023
cadbc04
minivirt: integrate virtuerl
verbit Sep 2, 2023
d6ba298
wait before register
verbit Sep 2, 2023
135a198
use more virtuerl networking
verbit Sep 2, 2023
fe599a3
virtuerl: fix network rest cidr -> cidr4
verbit Sep 2, 2023
659dfa6
virtuerl: rest: return network id on create
verbit Sep 2, 2023
3e809ae
don't create a libvirt net
verbit Sep 2, 2023
f597023
virtuerl: fix json response encoding
verbit Sep 2, 2023
e1fc72c
virtuerl: api: implement GET /networks/<id>
verbit Sep 3, 2023
a5f1175
virtuerl: sup: increase intensity
verbit Sep 3, 2023
7465469
minivirt: use network info from virtuerl
verbit Sep 3, 2023
8c10c50
virtuerl: api: add domain creation with fixed ip
verbit Sep 4, 2023
4dbec68
virtuerl: properly delete tap devices
verbit Sep 4, 2023
c5aa020
virtuerl: update network synchronously
verbit Sep 4, 2023
ad27c36
virtuerl: return network when creating dom with fixed ip
verbit Sep 4, 2023
097ba28
virtuerl: add support for ipv6
verbit Sep 10, 2023
17953c7
virtuerl: make compatible with OTP 24
verbit Sep 10, 2023
9553965
virtuerl: fix single-stack network handling
verbit Sep 10, 2023
59a984c
virtuerl: add test suite
verbit Sep 16, 2023
7c398aa
minivirt: fix ipv6 virtuerl handling
verbit Sep 16, 2023
00c621e
minivirt: fix virtuerl network handling
verbit Sep 17, 2023
3f5d802
virtuerl: fix net/tap sync
verbit Sep 17, 2023
be84aff
virtuerl: set bridges/taps up
verbit Sep 17, 2023
883a903
virtuerl: add mac addr handling
verbit Sep 19, 2023
555a622
virtuerl: change port
verbit Sep 21, 2023
7a095a8
virtuerl: init nftables handling
verbit Sep 24, 2023
23f5dfe
virtuerl: wip
verbit Jan 5, 2024
f967680
virtuerl: fix CI setup
verbit Jan 6, 2024
dc062c7
virtuerl: init wxwidgets ui
verbit Jan 26, 2024
8fc0b7e
virtuerl: more steps towards a MVP
verbit Feb 10, 2024
1d483e6
virtuerl: first working version with remote control
verbit Mar 8, 2024
c6efdfc
virtuerl: remove unused stuff
verbit Mar 11, 2024
672d3e0
virtuerl: add GH action
verbit Mar 20, 2024
42c5e3b
virtuerl: big move towards first MVP
verbit Jun 1, 2024
1eb63ca
build: drop restvirt build
verbit Jun 1, 2024
633eda5
build: fix virtuerl build
verbit Jun 1, 2024
368b9ba
virtuerl: improve logging
verbit Jun 14, 2024
64e5b15
virtuerl: run ghac if config is provided
verbit Jun 14, 2024
5250a2c
virtuerl: switch CPU model to host passthrough
verbit Jun 14, 2024
eb540e4
make virtuerl top-level project
verbit Jun 14, 2024
6656265
run tests on push
verbit Jun 14, 2024
dc43fb2
ghac: fix errors
verbit Jun 14, 2024
c6c2d17
gha: fix default working directory
verbit Jun 14, 2024
75d577c
gha: install nftables
verbit Jun 14, 2024
83a8208
gha: install ovmf swtpm
verbit Jun 14, 2024
60af0d6
gha: enable ip forwarding
verbit Jun 15, 2024
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
4 changes: 0 additions & 4 deletions .dockerignore

This file was deleted.

3 changes: 0 additions & 3 deletions .flake8

This file was deleted.

116 changes: 0 additions & 116 deletions .github/workflows/build.yaml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/virtuerl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build
on:
push:
branches-ignore:
- main
jobs:
virtuerl:
name: virtuerl
runs-on: self-hosted
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install prerequisites
run: |
sudo apt update
sudo apt install -y rebar3 g++ tree nftables ovmf swtpm
- name: Enable IP forwarding
run: |
sudo tee /etc/sysctl.d/99-local.conf << EOF
net.ipv4.ip_forward=1
net.ipv6.conf.all.forwarding=1
EOF
sudo service procps restart
- name: Test
run: |
sudo rebar3 ct
- name: Create tar
run: |
sudo rebar3 tar
sudo find _build/ -name '*.tar.gz' -exec hack/repack {} \;
32 changes: 25 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
.idea/
venv/
.venv/
__pycache__/
*.snap
*.egg-info
*.sqlite3
*.iml
.DS_Store
.vagrant/
khepri*/

.rebar3
_build
_checkouts
_vendor
.eunit
*.o
*.beam
*.plt
*.swp
*.swo
.erlang.cookie
ebin
log
erl_crash.dump
.rebar
logs
#.idea
#*.iml
rebar3.crashdump
*~
42 changes: 0 additions & 42 deletions Dockerfile

This file was deleted.

78 changes: 46 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,57 @@
# RESTvirt
virtuerl
=====

Manage libvirt through a REST API.
An OTP application

# Installation

```shell
apt install --no-install-recommends dnsmasq-base libvirt-daemon-system qemu-kvm qemu-utils
snap install minivirt
sudo snap connect minivirt:network-control
sudo snap connect minivirt:firewall-control
sudo snap connect minivirt:libvirt
# Required packages
```sh
sudo apt install ovmf swtpm
```

## Getting Started

```shell
git clone [email protected]:verbit/restvirt.git
cd restvirt

apt install python3-dev libvirt-dev
pip install -r requirements.txt
# Windows Guests

## Disable boot prompt
```sh
sudo mount -o loop Win11_23H2_EnglishInternational_x64v2.iso /mnt/win

genisoimage \
--allow-limited-size \
-no-emul-boot \
-b "boot/etfsboot.com" \
-boot-load-seg 0 \
-boot-load-size 8 \
-eltorito-alt-boot \
-no-emul-boot \
-e "efi/microsoft/boot/efisys_noprompt.bin" \
-boot-load-size 1 \
-iso-level 4 \
-udf \
-o "win.iso" \
/mnt/win/
```

mkdir /etc/restvirt
# Running

# start controller
python main.py controller
On the server

#start daemon
apt install libvirt-daemon-system
python main.py daemon
Make sure IP forwarding is enabled (`/etc/sysctl.conf`)
```

## Code Generation
```shell
python -m grpc_tools.protoc --python_out=. --grpc_python_out=. -Iprotos/ protos/minivirt/*.proto
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1
# Uncomment the next line to enable packet forwarding for IPv6
net.ipv6.conf.all.forwarding=1
```
Run `sysctl -w` to commit changes.

## Known Issues
```sh
sudo -s ./erts-13.1.5/bin/erl -mode embedded -boot releases/0.7.0+build.61.ref8fc0b7e/start -config releases/0.7.0+build.61.ref8fc0b7e/sys.config -proto_dist inet6_tcp -name [email protected] -setcookie abcdef
```

* AppArmor
* https://ubuntu.com/server/docs/virtualization-libvirt
* https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1677398
Locally
```sh
rebar3 compile
erl -name moi -proto_dist inet6_tcp -setcookie abcdef -pa _build/default/lib/*/ebin -hidden
([email protected])1> net_adm:ping('[email protected]').
pong
([email protected])2> virtuerl_ui:start('[email protected]').
```
9 changes: 9 additions & 0 deletions config/sys.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[{kernel,
[{logger_level, all},
{logger,
[{handler, default, logger_std_h,
#{ level => debug,
formatter => {logger_formatter, #{single_line => false}}}}
]}]},
{erlexec, [{root, true}, {user, "root"}]}
].
21 changes: 0 additions & 21 deletions examples/docker-compose.yml

This file was deleted.

Loading