You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
petri: truncate VM names to respect Hyper-V 100-character limit (#1739)
Hyper-V limits VM names to 100 characters, but Petri's test names can
exceed this limit when combining VMM prefix, firmware type,
architecture, guest OS, and function name components.
The failing test case demonstrates this issue:
```
multiarch::openhcl_servicing::hyperv_openhcl_uefi_aarch64_ubuntu_2404_server_aarch64_openhcl_servicing
```
This 102-character name causes VM creation to fail with:
```
New-VM : Failed to create a new virtual machine.
An unexpected error occurred: The parameter is incorrect. (0x80070057).
```
## Solution
Added `make_vm_safe_name()` function that:
- Passes through names ≤ 100 characters unchanged
- Truncates longer names to 96 characters + 4-character hash suffix
- Ensures uniqueness through deterministic hash generation
- Preserves meaningful name prefixes for test identification
## Example
```rust
// Before (fails):
"multiarch::openhcl_servicing::hyperv_openhcl_uefi_aarch64_ubuntu_2404_server_aarch64_openhcl_servicing" // 102 chars
// After (succeeds):
"multiarch::openhcl_servicing::hyperv_openhcl_uefi_aarch64_ubuntu_2404_server_aarch64_openhcl_ser94cb" // 100 chars
```
The fix is applied universally in `PetriVmBuilder::new()` to prevent
similar issues with other VM backends that may have naming constraints.
Fixes#1647.
<!-- START COPILOT CODING AGENT TIPS -->
---
💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: benhillis <[email protected]>
Co-authored-by: Ben Hillis <[email protected]>
0 commit comments