Skip to content

Commit 36a789b

Browse files
committed
doc: updated documentation and toy example...
after vhost-vsock device removal. Signed-off-by: Diana Popa <[email protected]>
1 parent 7b819a3 commit 36a789b

File tree

2 files changed

+13
-32
lines changed

2 files changed

+13
-32
lines changed

README.md

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Firecracker consists of a single micro Virtual Machine Manager binary that will
1111
* Add memory to the microVM.
1212
* Add one or more network interfaces to the microVM.
1313
* Add one or more read/write disks (block devices) to the microVM.
14-
* Add one or more vSockets to the microVM.
1514
* Start the microVM using a given kernel image and root file system.
1615
* Stop the microVM.
1716

@@ -21,7 +20,6 @@ Firecracker consists of a single micro Virtual Machine Manager binary that will
2120
* Emulated keyboard (i8042) and serial console (UART). The microVM serial console input and output are connected to those of the Firecracker process (this allows direct console access to the guest OS).
2221
* The capability of mapping an existing host tun-tap device as a virtIO/net device into the microVM.
2322
* The capability of mapping an existing host file as a virtIO/block device into the microVM.
24-
* The capability of creating a virtIO/vsock between the host and the microVM.
2523
* Default demand fault paging & CPU oversubscription.
2624

2725
## Limits and Performance
@@ -47,21 +45,19 @@ Firecracker expects network interfaces and drives to be created beforehand and p
4745

4846
## Select the Guest Kernel and RootFS
4947
To run microVMs with Firecracker, you will need to have:
50-
* a guest kernel image that boots and runs with Firecracker's minimal/VirtIO device model, and
51-
* a guest root file system that boots with that kernel.
52-
* The guest RootFS can be an image file or drive.
48+
* a guest kernel image that boots and runs with Firecracker's minimal/VirtIO device model
49+
* a guest root file system that boots with that kernel (can be an image file or drive).
5350

5451
## Runtime Dependencies
55-
* Firecracker needs rw access to `/dev/kvm`. You can grant these rights, e.g., to tall users, with: `sudo chmod a+rw /dev/kvm`
56-
* If you want to use vsocks between the Firecracker guest and host, Firecracker will need to be run with sudo rights.
52+
* Firecracker needs rw access to `/dev/kvm`. You can grant these rights, e.g., to all users, with: `sudo chmod a+rw /dev/kvm`.
5753

5854
## Start Firecracker & the Micro VM
5955

60-
The python-based toy example below will start a Firecracker microVM with 2 vCPUs, 256 MiB or RAM, two network interfaces, two disks (rootfs and temp), and a vsocket.
56+
The python-based toy example below will start a Firecracker microVM with 2 vCPUs, 256 MiB or RAM, two network interfaces and two disks (rootfs and temp).
6157

62-
Currently, only the core parts of the API (`/actions`, `/machine-config`, `/boot-source`, `/network-interfaces`, `/drives`, and `/vsocks`) are implemented. For the planned v1.0 API description see `/api/swagger/all.yaml`.
58+
Currently, only the core parts of the API (`/actions`, `/machine-config`, `/boot-source`, `/network-interfaces` and `/drives`) are implemented. For the planned v1.0 API description see `/api/swagger/firecracker-v1.0.yaml`.
6359

64-
The toy example snapshot below uses a Python script to start a Firecracker instance. The Firecracker binary, as well as compatible kernel, root file system, and temp file system images are assumed to already exist. The TUN/TAP devices passed to the networking API are also assumed to already exist. Firecracker requires root privileges to open vsock interfaces on a host.
60+
The toy example snapshot below uses a Python script to start a Firecracker instance. The Firecracker binary, as well as compatible kernel, root file system, and temp file system images are assumed to already exist. The TUN/TAP devices passed to the networking API are also assumed to already exist.
6561

6662
The full example can be found in [the examples directory](examples/hello_api/spawn_microvm.py)
6763

@@ -125,13 +121,6 @@ requests.put(
125121
}
126122
)
127123
128-
# Add a vsocket between the host and guest OSs (requiers both to be Linux).
129-
# Requires appropriate privileges, and both host and guest kernel support.
130-
requests.put(
131-
firecracker.vsocks_url + '/1',
132-
json={'vsock_id': '1', 'guest_cid': 10001, 'state': 'Attached'}
133-
)
134-
135124
# Specify a boot source: a kernel image.
136125
# Currently, only linux kernel images are supported.
137126
requests.put(
@@ -152,13 +141,12 @@ requests.put(
152141

153142
## Notes
154143
1. The Kernel and RootFS need to work together, and the Kernel needs to run with Firecracker's limited device model.
155-
2. Vsocket usage currently requires root privileges, and both host (`CONFIG_VHOST_VSOCK`) and guest (`CONFIG_VIRTIO_VSOCKETS`) kernel support.
156-
3. It is the user's responsibility to make sure that the same backing file is not added as a read-write block device to multiple Firecracker instances. A file can be safely added as a read-only block device to multiple Firecracker instances.
157-
4. Firecracker uses default values for the following parameters:
144+
2. It is the user's responsibility to make sure that the same backing file is not added as a read-write block device to multiple Firecracker instances. A file can be safely added as a read-only block device to multiple Firecracker instances.
145+
3. Firecracker uses default values for the following parameters:
158146
1. Kernel Command Line: `console=ttyS0 noapic reboot=k panic=1 pci=off nomodules`. This can be changed with a `PUT` request to `/boot-source`.
159147
2. Number of vCPUs: 1. This can be changed with a `PUT` request to `/machine-config`
160148
3. Memory Size: 128 MiB. This can be changed with a `PUT` request to `/machine-config`
161-
4. Unix domain socket: `/tmp/firecracker.socket`. This can be changed only when Firecracker is started, by using the command line parameter `--api-sock`.
162-
5. Firecracker links the microVM serial console output to its stdout, and its stdin to the microVM serial console input. Therefore, you can interact with the microVM guest in the screen session.
163-
6. Important: The unix domain socket is not deleted when Firecracker is stopped. You have to remove it yourself after stopping the Firecracker process.
164-
7. Firecracker doesn't yet emulate a power management device. This means that any shutdown/poweroff command issued by the guest OS only does partial shutdown then hangs. The linux 'reboot' command when run in the guest OS will actually cleanly shut down the guest without bringing it back up.
149+
4. Unix domain socket: `/tmp/firecracker.socket`. This can be changed only when Firecracker is started, by using the command line parameter `--api-sock`.
150+
4. Firecracker links the microVM serial console output to its stdout, and its stdin to the microVM serial console input. Therefore, you can interact with the microVM guest in the screen session.
151+
5. Important: The unix domain socket is not deleted when Firecracker is stopped. You have to remove it yourself after stopping the Firecracker process.
152+
6. Firecracker doesn't yet emulate a power management device. This means that any shutdown/poweroff command issued by the guest OS only does partial shutdown then hangs. The linux 'reboot' command when run in the guest OS will actually cleanly shut down the guest without bringing it back up.

examples/hello_api/spawn_microvm.py

100644100755
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class Firecracker:
1919
machine_config_path = '/machine-config'
2020
network_ifaces_path = '/network-interfaces'
2121
drives_path = '/drives'
22-
vsocks_path = '/vsocks'
2322
boot_source_path = '/boot-source'
2423
actions_path = '/actions'
2524

@@ -39,7 +38,6 @@ def spawn(self):
3938
self.machine_config_url = usocket_url + self.machine_config_path
4039
self.network_ifaces_url = usocket_url + self.network_ifaces_path
4140
self.drives_url = usocket_url + self.drives_path
42-
self.vsocks_url = usocket_url + self.vsocks_path
4341
self.boot_source_url = usocket_url + self.boot_source_path
4442
self.actions_url = usocket_url + self.actions_path
4543

@@ -58,6 +56,7 @@ def get_usocket_url(self):
5856
)
5957
return usocket_url
6058

59+
6160
# Spawn a new Firecracker Virtual Machine Manager process.
6261
firecracker = Firecracker('0001')
6362
firecracker.spawn()
@@ -117,12 +116,6 @@ def get_usocket_url(self):
117116
}
118117
)
119118

120-
# Add a vsocket between the host and guest OSs (requiers both to be Linux).
121-
# Requires appropriate privileges, and both host and guest kernel support.
122-
requests.put(
123-
firecracker.vsocks_url + '/1',
124-
json={'vsock_id': '1', 'guest_cid': 10001, 'state': 'Attached'}
125-
)
126119

127120
# Specify a boot source: a kernel image.
128121
# Currently, only linux kernel images are supported.

0 commit comments

Comments
 (0)