Skip to content

Make DMS talk to firecracker VM

Santosh Kumar requested to merge 15-dms-should-manage-firecracker-vm into develop

Closes #15 (closed)

With this PR, DMS now has a way to interact with firecracker API.

Endpoints

We have these endpoints:

POST /init
PUT /boot-source
PUT /drives
PUT /machine-config
PUT /network-interfaces
PUT /actions

Request body for testing

Some of the endpoints will request you to pass a body.

PUT /boot-source:

Replace the kernel_image_path with you local vmlinux.bin path.

{
    "kernel_image_path": "/home/santosh/firecracker/vmlinux.bin",
    "boot_args": "console=ttyS0 reboot=k panic=1 pci=off"
}

PUT /drives

Replace the path_on_host with you local filesystem path used for the VM.

{
    "drive_id": "rootfs",
    "path_on_host": "/home/santosh/firecracker/bionic.rootfs.ext4",
    "is_root_device": true,
    "is_read_only": false
}

PUT /machine-config

{
    "vcpu_count": 2,
    "mem_size_mib": 256
}

PUT /network-interfaces

Before making request to this endpoint with the following body, make sure you have a tap device named tap1. Refer to networking docs or this post.

{
    "iface_id": "eth0",
    "guest_mac": "AA:FC:00:00:00:01",
    "host_dev_name": "tap1"
}

To actually make the internet work inside VM, you also need to do some additional steps inside the VM, as specified above mentioned link.

PUT /actions

This particular action will start the instance. To stop, you replace InstanceStart with SendCtrlAltDel

{
    "action_type": "InstanceStart"
}

In continuation to #15 (closed) is #25 (closed).

Edited by Santosh Kumar

Merge request reports