-
Notifications
You must be signed in to change notification settings - Fork 157
Description
Bug Summary
The VTL2 settings processing code crashes with a divide-by-zero panic when the chunk_size_in_kb
field is missing from LUN configurations in the protobuf schema.
Error Details
Panic Location: oss/vm/devices/storage/disk_striped/src/lib.rs:281:17
Error: attempt to divide by zero
Thread: worker-UnderhillWorker
Root Cause
The disk striping code attempts to divide by the chunk size value, but when chunk_size_in_kb
is not provided in the VTL2 settings protobuf message, it defaults to 0, causing a divide-by-zero panic.
Reproduction Steps
- Create a VTL2 settings configuration with a LUN that omits the
chunk_size_in_kb
field - Apply the settings to a VM that uses OpenHCL.
- Start the VM with OpenHCL
- Observe the panic during VTL2 settings processing
Expected Behavior
The system should either:
- Provide a sensible default when
chunk_size_in_kb
is missing (e.g., 64KB) - Validate the field and return a proper error message instead of panicking
- Make the field required in the protobuf schema if it's mandatory
Impact
- Complete VM startup failure when using striped storage configurations
- Poor error reporting (cryptic divide-by-zero panic vs. clear validation error)
- Affects any tooling that generates VTL2 settings programmatically
Suggested Fix
In disk_striped/src/lib.rs
around line 281, add validation:
let chunk_size = if config.chunk_size_in_kb == 0 {
64 // Default to 64KB chunks
} else {
config.chunk_size_in_kb
};
Or add proper validation earlier in the settings processing pipeline.
Additional Context
This issue was discovered while developing PowerShell tooling for NVMe device configuration. The workaround is to explicitly set chunk_size_in_kb = 64
in all LUN configurations, but the system should handle missing values gracefully.
OpenHCL Version: 1.7.158.0
Commit: c6a30e1