forked from unikraft/catalog
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new-design: Add Firecracker run support
Add Firecracker template scripts and support in generating run scripts and configuration files (JSON). Signed-off-by: Razvan Deaconescu <[email protected]>
- Loading branch information
Showing
15 changed files
with
448 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
utils/new-design/tpl_run_firecracker_net_bridge_initrd.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{{ | ||
"boot-source": {{ | ||
"kernel_image_path": "{kernel}", | ||
"boot_args": "{name} netdev.ip=172.44.0.2/24:172.44.0.1::: vfs.fstab=[ \"initrd0:/:extract::ramfs=1:\" ] -- {cmd}", | ||
"initrd_path": "{run_dir}/initrd.cpio" | ||
}}, | ||
"drives": [], | ||
"machine-config": {{ | ||
"vcpu_count": 1, | ||
"mem_size_mib": 8, | ||
"smt": false, | ||
"track_dirty_pages": false | ||
}}, | ||
"cpu-config": null, | ||
"balloon": null, | ||
"network-interfaces": [ | ||
{{ | ||
"iface_id": "virbr0", | ||
"guest_mac": "06:00:ac:10:00:02", | ||
"host_dev_name": "virbr0@if0" | ||
}} | ||
], | ||
"vsock": null, | ||
"logger": {{ | ||
"log_path": "/tmp/firecracker.log", | ||
"level": "Debug", | ||
"show_level": true, | ||
"show_log_origin": true | ||
}}, | ||
"metrics": null, | ||
"mmds-config": null, | ||
"entropy": null | ||
}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/sh | ||
|
||
config={run_dir}/config.json | ||
|
||
{{ | ||
# Clean up any previous instances. | ||
sudo pkill -f qemu-system | ||
sudo pkill -f firecracker | ||
kraft stop --all | ||
kraft rm --all | ||
sudo KRAFTKIT_NO_WARN_SUDO=1 kraft stop --all | ||
sudo KRAFTKIT_NO_WARN_SUDO=1 kraft rm --all | ||
}} > /dev/null 2>&1 | ||
|
||
{{ | ||
# Remove previously created network interfaces. | ||
sudo ip link set dev tap0 down | ||
sudo ip link del dev tap0 | ||
sudo ip link set dev virbr0 down | ||
sudo ip link del dev virbr0 | ||
}} > /dev/null 2>&1 | ||
|
||
# Create bridge and tap interface for Firecracker networking. | ||
sudo ip link add dev virbr0 type bridge | ||
sudo ip link set dev virbr0 up | ||
sudo ip tuntap add dev virbr0@if0 mode tap | ||
sudo ip link set dev virbr0@if0 up | ||
|
||
# Add tap interface to bridge. | ||
sudo ip link set dev virbr0@if0 master virbr0 | ||
|
||
# Add IP address to bridge interface | ||
sudo ip address add 172.44.0.1/24 dev virbr0 | ||
|
||
rootfs={rootfs} | ||
|
||
# Create CPIO archive to be used as the initrd. | ||
{base}/unikraft/support/scripts/mkcpio {run_dir}/initrd.cpio "$rootfs" | ||
|
||
# Remove previously created files. | ||
sudo rm -f /tmp/firecracker.log | ||
touch /tmp/firecracker.log | ||
sudo rm -f /tmp/firecracker.socket | ||
sudo {vmm} \ | ||
--api-sock /tmp/firecracker.socket \ | ||
--config-file "$config" |
32 changes: 32 additions & 0 deletions
32
utils/new-design/tpl_run_firecracker_net_bridge_noinitrd.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{{ | ||
"boot-source": {{ | ||
"kernel_image_path": "{kernel}", | ||
"boot_args": "{name} netdev.ip=172.44.0.2/24:172.44.0.1::: -- {cmd}" | ||
}}, | ||
"drives": [], | ||
"machine-config": {{ | ||
"vcpu_count": 1, | ||
"mem_size_mib": 8, | ||
"smt": false, | ||
"track_dirty_pages": false | ||
}}, | ||
"cpu-config": null, | ||
"balloon": null, | ||
"network-interfaces": [ | ||
{{ | ||
"iface_id": "virbr0", | ||
"guest_mac": "06:00:ac:10:00:02", | ||
"host_dev_name": "virbr0@if0" | ||
}} | ||
], | ||
"vsock": null, | ||
"logger": {{ | ||
"log_path": "/tmp/firecracker.log", | ||
"level": "Debug", | ||
"show_level": true, | ||
"show_log_origin": true | ||
}}, | ||
"metrics": null, | ||
"mmds-config": null, | ||
"entropy": null | ||
}} |
41 changes: 41 additions & 0 deletions
41
utils/new-design/tpl_run_firecracker_net_bridge_noinitrd.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/sh | ||
|
||
config={run_dir}/config.json | ||
|
||
{{ | ||
# Clean up any previous instances. | ||
sudo pkill -f qemu-system | ||
sudo pkill -f firecracker | ||
kraft stop --all | ||
kraft rm --all | ||
sudo KRAFTKIT_NO_WARN_SUDO=1 kraft stop --all | ||
sudo KRAFTKIT_NO_WARN_SUDO=1 kraft rm --all | ||
}} > /dev/null 2>&1 | ||
|
||
{{ | ||
# Remove previously created network interfaces. | ||
sudo ip link set dev tap0 down | ||
sudo ip link del dev tap0 | ||
sudo ip link set dev virbr0 down | ||
sudo ip link del dev virbr0 | ||
}} > /dev/null 2>&1 | ||
|
||
# Create bridge and tap interface for Firecracker networking. | ||
sudo ip link add dev virbr0 type bridge | ||
sudo ip link set dev virbr0 up | ||
sudo ip tuntap add dev virbr0@if0 mode tap | ||
sudo ip link set dev virbr0@if0 up | ||
|
||
# Add tap interface to bridge. | ||
sudo ip link set dev virbr0@if0 master virbr0 | ||
|
||
# Add IP address to bridge interface | ||
sudo ip address add 172.44.0.1/24 dev virbr0 | ||
|
||
# Remove previously created files. | ||
sudo rm -f /tmp/firecracker.log | ||
touch /tmp/firecracker.log | ||
sudo rm -f /tmp/firecracker.socket | ||
sudo {vmm} \ | ||
--api-sock /tmp/firecracker.socket \ | ||
--config-file "$config" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{{ | ||
"boot-source": {{ | ||
"kernel_image_path": "{kernel}", | ||
"boot_args": "{name} netdev.ip=172.44.0.2/24:172.44.0.1::: vfs.fstab=[ \"initrd0:/:extract::ramfs=1:\" ] -- {cmd}", | ||
"initrd_path": "{run_dir}/initrd.cpio" | ||
}}, | ||
"drives": [], | ||
"machine-config": {{ | ||
"vcpu_count": 1, | ||
"mem_size_mib": 8, | ||
"smt": false, | ||
"track_dirty_pages": false | ||
}}, | ||
"cpu-config": null, | ||
"balloon": null, | ||
"network-interfaces": [ | ||
{{ | ||
"iface_id": "net1", | ||
"guest_mac": "06:00:ac:10:00:02", | ||
"host_dev_name": "tap0" | ||
}} | ||
], | ||
"vsock": null, | ||
"logger": {{ | ||
"log_path": "/tmp/firecracker.log", | ||
"level": "Debug", | ||
"show_level": true, | ||
"show_log_origin": true | ||
}}, | ||
"metrics": null, | ||
"mmds-config": null, | ||
"entropy": null | ||
}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/sh | ||
|
||
config={run_dir}/config.json | ||
|
||
{{ | ||
# Clean up any previous instances. | ||
sudo pkill -f qemu-system | ||
sudo pkill -f firecracker | ||
kraft stop --all | ||
kraft rm --all | ||
sudo KRAFTKIT_NO_WARN_SUDO=1 kraft stop --all | ||
sudo KRAFTKIT_NO_WARN_SUDO=1 kraft rm --all | ||
}} > /dev/null 2>&1 | ||
|
||
{{ | ||
# Remove previously created network interfaces. | ||
sudo ip link set dev tap0 down | ||
sudo ip link del dev tap0 | ||
sudo ip link set dev virbr0 down | ||
sudo ip link del dev virbr0 | ||
}} > /dev/null 2>&1 | ||
|
||
# Create tap interface for Firecracker networking. | ||
sudo ip tuntap add dev tap0 mode tap | ||
sudo ip address add 172.44.0.1/24 dev tap0 | ||
sudo ip link set dev tap0 up | ||
|
||
# Remove previously created files. | ||
sudo rm -f /tmp/firecracker.log | ||
touch /tmp/firecracker.log | ||
sudo rm -f /tmp/firecracker.socket | ||
sudo {vmm} \ | ||
--api-sock /tmp/firecracker.socket \ | ||
--config-file "$config" |
32 changes: 32 additions & 0 deletions
32
utils/new-design/tpl_run_firecracker_net_tap_noinitrd.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{{ | ||
"boot-source": {{ | ||
"kernel_image_path": "{kernel}", | ||
"boot_args": "{name} netdev.ip=172.44.0.2/24:172.44.0.1::: -- {cmd}" | ||
}}, | ||
"drives": [], | ||
"machine-config": {{ | ||
"vcpu_count": 1, | ||
"mem_size_mib": 8, | ||
"smt": false, | ||
"track_dirty_pages": false | ||
}}, | ||
"cpu-config": null, | ||
"balloon": null, | ||
"network-interfaces": [ | ||
{{ | ||
"iface_id": "net1", | ||
"guest_mac": "06:00:ac:10:00:02", | ||
"host_dev_name": "tap0" | ||
}} | ||
], | ||
"vsock": null, | ||
"logger": {{ | ||
"log_path": "/tmp/firecracker.log", | ||
"level": "Debug", | ||
"show_level": true, | ||
"show_log_origin": true | ||
}}, | ||
"metrics": null, | ||
"mmds-config": null, | ||
"entropy": null | ||
}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/sh | ||
|
||
config={run_dir}/config.json | ||
|
||
{{ | ||
# Clean up any previous instances. | ||
sudo pkill -f qemu-system | ||
sudo pkill -f firecracker | ||
kraft stop --all | ||
kraft rm --all | ||
sudo KRAFTKIT_NO_WARN_SUDO=1 kraft stop --all | ||
sudo KRAFTKIT_NO_WARN_SUDO=1 kraft rm --all | ||
}} > /dev/null 2>&1 | ||
|
||
{{ | ||
# Remove previously created network interfaces. | ||
sudo ip link set dev tap0 down | ||
sudo ip link del dev tap0 | ||
sudo ip link set dev virbr0 down | ||
sudo ip link del dev virbr0 | ||
}} > /dev/null 2>&1 | ||
|
||
# Create tap interface for Firecracker networking. | ||
sudo ip tuntap add dev tap0 mode tap | ||
sudo ip address add 172.44.0.1/24 dev tap0 | ||
sudo ip link set dev tap0 up | ||
|
||
# Remove previously created files. | ||
sudo rm -f /tmp/firecracker.log | ||
touch /tmp/firecracker.log | ||
sudo rm -f /tmp/firecracker.socket | ||
sudo {vmm} \ | ||
--api-sock /tmp/firecracker.socket \ | ||
--config-file "$config" |
Oops, something went wrong.