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
MonitorBlockArgs in types.go should include an IsRO bool field to propagate read-only mount status.
firecracker.go should parse blockArg.IsRO dynamically into FirecrackerDrive.IsRO.
- Empty host paths should be filtered out to prevent invalid JSON config generation.
- Fallback root device logic (
IsRootDev = true) should apply to the primary drive when "rootfs" ID is absent.
- Add table-driven unit tests in
firecracker_test.go to verify Firecracker JSON generation for single, multiple, and read-only block devices.
Verification
- Run
go test -v ./pkg/unikontainers/hypervisors/...
- Verify Firecracker JSON config generation with read-only and multi-drive specs.
Description
In
pkg/unikontainers/hypervisors/firecracker.go, Firecracker block drive configuration (FCDrives) currently hardcodesIsRO: falseand 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.jsonconfiguration for Firecracker microVMs.As noted by the
TODOcomment 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.gopkg/unikontainers/types/types.goExpected Behavior
MonitorBlockArgsintypes.goshould include anIsRO boolfield to propagate read-only mount status.firecracker.goshould parseblockArg.IsROdynamically intoFirecrackerDrive.IsRO.IsRootDev = true) should apply to the primary drive when"rootfs"ID is absent.firecracker_test.goto verify Firecracker JSON generation for single, multiple, and read-only block devices.Verification
go test -v ./pkg/unikontainers/hypervisors/...