Skip to content

feat(hypervisors/firecracker): Add support for read-only flags and multiple block devices in Firecracker VMM #942

Description

@safiya2610

Description

In pkg/unikontainers/hypervisors/firecracker.go, Firecracker block drive configuration (FCDrives) currently hardcodes IsRO: false and only marks drives named "rootfs" as root devices. Furthermore, empty paths are not validated, and read-only volume mounts are ignored when generating the /tmp/fc.json configuration for Firecracker microVMs.

As noted by the TODO comment in line 156 (// TODO: Add support for block devices in FIrecracker), Firecracker needs dynamic block device handling to support read-only volumes and multiple attached drives.

Files

  • pkg/unikontainers/hypervisors/firecracker.go
  • pkg/unikontainers/types/types.go

Expected Behavior

  1. MonitorBlockArgs in types.go should include an IsRO bool field to propagate read-only mount status.
  2. firecracker.go should parse blockArg.IsRO dynamically into FirecrackerDrive.IsRO.
  3. Empty host paths should be filtered out to prevent invalid JSON config generation.
  4. Fallback root device logic (IsRootDev = true) should apply to the primary drive when "rootfs" ID is absent.
  5. Add table-driven unit tests in firecracker_test.go to verify Firecracker JSON generation for single, multiple, and read-only block devices.

Verification

  1. Run go test -v ./pkg/unikontainers/hypervisors/...
  2. Verify Firecracker JSON config generation with read-only and multi-drive specs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions