Skip to content

Conversation

@xmkg
Copy link
Member

@xmkg xmkg commented Jul 2, 2025

The cached management IP address becomes stale on some operations when it happens out-of-band, like "multipass restart", where it's a SSH-induced guest reboot.

This patch fixes that by invalidating the cached IP address on every update_state() invocation.

Fixes: #3354

MULTI-2068

@xmkg xmkg requested review from Sploder12 and ricab July 2, 2025 11:56
Copy link
Collaborator

@ricab ricab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for (re-)spotting and fixing this @xmkg!

The general idea makes sense to me, although in the long run I hope we can find a way to be alerted to ACPI events in the guest. I suspect it would be possible to subscribe over a VSOCK/SSH connection, otherwise we might use a heartbeat based approach.

I have a few requests inline, but I think we should let this one simmer in main for a while either way. It's been like this forever and the fix could have effects that we're not anticipating, so I wouldn't rush to release it now.

@codecov
Copy link

codecov bot commented Jul 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.44%. Comparing base (b144a59) to head (94212fa).
⚠️ Report is 60 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4207   +/-   ##
=======================================
  Coverage   89.44%   89.44%           
=======================================
  Files         260      260           
  Lines       15818    15818           
=======================================
  Hits        14149    14149           
  Misses       1669     1669           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xmkg xmkg force-pushed the bugfix/hyperv-invalidate-cached-mgmt-ip-on-state-change branch from 732bf14 to 5088e5b Compare July 3, 2025 11:28
@xmkg xmkg requested a review from ricab July 3, 2025 11:30
xmkg added 4 commits September 9, 2025 10:09
The cached management IP address becomes stale on some operations
when it happens out-of-band, like "multipass restart", where it's
a SSH-induced guest reboot.

This patch fixes that by invalidating the cached IP address on every
update_state() invocation.

Fixes: #3354

Signed-off-by: Mustafa Kemal Gilor <mustafa.gilor@canonical.com>
Signed-off-by: Mustafa Kemal Gilor <mustafa.gilor@canonical.com>
Signed-off-by: Mustafa Kemal Gilor <mustafa.gilor@canonical.com>
Signed-off-by: Mustafa Kemal Gilor <mustafa.gilor@canonical.com>
@xmkg xmkg force-pushed the bugfix/hyperv-invalidate-cached-mgmt-ip-on-state-change branch from 5088e5b to 94212fa Compare September 9, 2025 07:10
@Sploder12
Copy link
Contributor

This is important for hostname resolution, is it done simmering?

@xmkg
Copy link
Member Author

xmkg commented Sep 18, 2025

This is important for hostname resolution, is it done simmering?

@ricab ^^ WDYT? Should we include it in 1.17?

Copy link
Collaborator

@ricab ricab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I am good with this, but I didn't test. @Sploder12 would you be willing to do that?

[Secondary review]

Copy link
Contributor

@Sploder12 Sploder12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Confirmed that running reboot inside of the VM via the Hyper-V interface (used passwd over shell first to make that possible) worked. Multipass picked up the new IP (once it was available)

@xmkg
Copy link
Member Author

xmkg commented Sep 18, 2025

Great! @ricab, we already discussed this, but still want to confirm that you're on board with the idea of ignoring commit linter for older PR's and commits. If so, I'll go ahead and merge this.

@ricab
Copy link
Collaborator

ricab commented Sep 18, 2025

Yes, it's fine. It's a transition period.

@ricab ricab added this pull request to the merge queue Sep 18, 2025
Merged via the queue into main with commit 2d1e59b Sep 18, 2025
40 of 43 checks passed
@ricab ricab deleted the bugfix/hyperv-invalidate-cached-mgmt-ip-on-state-change branch September 18, 2025 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[hyperv] multipass ls shows stale IP address after instance restart

3 participants