Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4967 +/- ##
==========================================
+ Coverage 73.36% 73.43% +0.07%
==========================================
Files 332 334 +2
Lines 17937 17985 +48
==========================================
+ Hits 13158 13205 +47
- Misses 4779 4780 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
26b3dec to
d9829dd
Compare
d1812b3 to
5376054
Compare
xmkg
left a comment
There was a problem hiding this comment.
The code looks good. We have a regression due to missing DNS suffixes on the new AZ networks. It overlaps with the hostname resolution task on Windows, so I'll prioritize it today to unblock this.
| { | ||
| const auto& zone = i.get(); | ||
| hcn::CreateNetworkParameters network_params{ | ||
| .name = fmt::format("Multipass vNetwork ({})", zone.get_name()), |
There was a problem hiding this comment.
The default vSwitch had its DNS suffix set to .mshome.net, which allowed users to do this:
ssh test-vm.mshome.net
Also, this is how we discover the VMs assigned IP right now, and since the new AZ networks have no DNS suffix, we can't use it anymore, and VMs get stuck at start:
[2026-06-25T11:25:32.476] [debug] [HyperV-HCS-Wrapper] get_compute_system_state(...) > handle: (0x24db33f7eb0)
[2026-06-25T11:25:32.476] [trace] [HyperV-HCS-Wrapper] create_operation(...)
[2026-06-25T11:25:32.476] [debug] [HyperV-HCS-Wrapper] perform_hcs_operation(...) > result: true
[2026-06-25T11:25:32.476] [debug] [HyperV-HCS-Wrapper] wait_for_operation_result(...) > (0x24db32d8fd0), timeout: 240000 ms
[2026-06-25T11:25:32.476] [debug] [HyperV-HCS-Wrapper] wait_for_operation_result(...) > finished (0x24db32d8fd0), result_code: 0x0: The operation completed successfully.
[2026-06-25T11:25:32.476] [debug] [test-vm] set_state() -> HCS state `running`
[2026-06-25T11:25:32.476] [trace] [test-vm] ssh connection failed: 'Failed to resolve hostname test-vm.mshome.net
To support this, we need to add the DNS suffix parameter to the create_network call. It overlaps with the hostname resolution task I have. I'll update the HCN code in a separate PR to support this. It should be trivial -- I'll ping you once it's done.
There was a problem hiding this comment.
Alternatively, we can use the HCN API to query the assigned IP address to the endpoint, but it would require more work. I'd say it would be a better choice -- something to consider in the future.
There was a problem hiding this comment.
I've opted to implement querying the assigned IP from HCN instead. resolve_hostname approach is fragile since the hosts.ics file is plagued with a 25-year-old corruption bug.
There was a problem hiding this comment.
Hmm, <instance>.mshome.net works fine for me (see below). Maybe you already fixed it, or there's just some configuration difference between our systems? My test was just on a mostly-stock Windows 11 VM. (I had previously enabled HKML\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\IPEnableRouter because I think we need that for cross-zone communication, but pinging by hostname works for if I reset that value and restart.)
C:\Users\Jim\Documents\multipass\build>bin\multipass ls
Name State IPv4 Image Zone
bar Running 10.97.1.223 Ubuntu 26.04 LTS zone2
foo Running 10.97.0.53 Ubuntu 26.04 LTS zone1
C:\Users\Jim\Documents\multipass\build>ping foo.mshome.net
Pinging foo.mshome.net [10.97.0.53] with 32 bytes of data:
Reply from 10.97.0.53: bytes=32 time=1ms TTL=64
Reply from 10.97.0.53: bytes=32 time=1ms TTL=64
Reply from 10.97.0.53: bytes=32 time=1ms TTL=64
Reply from 10.97.0.53: bytes=32 time=1ms TTL=64
Ping statistics for 10.97.0.53:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 1ms, Average = 1ms
C:\Users\Jim\Documents\multipass\build>ping bar.mshome.net
Pinging bar.mshome.net [10.97.1.223] with 32 bytes of data:
Reply from 10.97.1.223: bytes=32 time=1ms TTL=64
Reply from 10.97.1.223: bytes=32 time=1ms TTL=64
Reply from 10.97.1.223: bytes=32 time=1ms TTL=64
Reply from 10.97.1.223: bytes=32 time=1ms TTL=64
Ping statistics for 10.97.1.223:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 1ms, Average = 1ms
There was a problem hiding this comment.
@jimporter Weird... I don't think it should be possible by default since the vSwitches we create don't have the mshome.net suffix on this branch -- I'll test the build on my 4 Windows VMs to confirm.
There was a problem hiding this comment.
@jimporter I've tested the branch -- the launches were successful everywhere except my dev-w11-home VM. I recall changing some registry settings during the hostname resolution experiments, which may explain why it fails on dev VM. Logs are below for completeness.
win11-hyperv-hcs-az-tests.txt
796a564 to
9410818
Compare
|
@jimporter #5097 |
|
Adding this to the milestone, as I understand this is needed in the release. Please revert if my understanding is wrong. |
sharder996
left a comment
There was a problem hiding this comment.
#5088 is also present here. The QEMU virtual machine acts differently because it returns a cached state when current_state() is called whereas the HCS and AppleVZ virtual machine query and return a state from the hypervisor. This overwrites the previous state of unavailable. Maybe we can define a default behavior for current_state() in the Base virtual machine and fix this everywhere. LDYT
Further testing proved that the AZ hostname resolution is broken in my W11 dev VM, probably due to some registry flag changes I've made during the hostname resolution experiments. The attempts in W11 pro, W10 home and pristine W11 Home succeeded. #5097 is still a valid enhancement but not a blocker for this. I'll run CLI tests for further verification. |
xmkg
left a comment
There was a problem hiding this comment.
LGTM, verified with CLI tests on Win11 Pro.
2e039a5 to
e171c5a
Compare
Hyper-V itself doesn't have a notion of whether the zone it's in is available, so when it's *un*available, we shouldn't rely on the state as reported by Hyper-V.
|
@sharder996 Ok, I've fixed the issue with the state reporting |
Description
This adds the necessary plumbing to the Hyper-V API backend to support AZs. This entails adding a new virtual network with the appropriate subnet, plus DHCP for the instances to get an IP address.
Testing
Hyper-V API VM creation unit tests updated to check for the new virtual network
Manual testing steps:
multipass launch --name foomultipass shell foomultipass launch --name bar --zone zone2 && multipass shell barChecklist