Repository navigation
Conversation
A VM stored on an external drive is shown as unavailable if the drive is not connected when UTM launches. It stays unavailable after the drive is connected, because the package bookmark is only resolved when the registry is loaded and nothing refreshes the VM list when a volume is mounted. The VM only becomes available again after relaunching UTM. Refresh the VM list when a volume is mounted or unmounted, and resolve the bookmark of each unavailable VM again so it can be loaded from the newly mounted volume. Resolution does not mount volumes or show UI, so an unavailable VM on a disconnected network share does not prompt on every refresh. An unloaded VMData compares equal to a loaded one with the same registry entry, so the list did not compare as changed when a VM became available or unavailable and was never published. Track availability changes explicitly so the list updates in both directions. Addresses the first part of utmapp#7364. Limiting UTM to a single instance, the issue's second request, is not part of this change. Assisted-by: Claude:claude-opus-5-5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A VM stored on an external drive is listed as unavailable if the drive isn't connected when UTM launches, and it stays unavailable after the drive is connected until UTM is relaunched. The package bookmark is only resolved when the registry is loaded, and nothing refreshes the VM list when a volume is mounted.
This refreshes the VM list on macOS when a volume is mounted or unmounted, and resolves the bookmark of each unavailable VM again so it loads from the newly mounted volume. Resolution uses
.withoutMountingand.withoutUI, so an unavailable VM on a disconnected network share doesn't trigger a mount attempt or a prompt on every refresh.An unloaded
VMDatacompares equal to a loaded one with the same registry entry, so the list didn't compare as changed when a VM became available or unavailable, and the library never redrew. The refresh now tracks availability changes, so the list updates in both directions.Part of #7364. This covers the first request (unavailable VMs on removable media are never rechecked). It reacts to the volume being mounted instead of retrying on a timer, so no setting is needed. The second request, limiting UTM to a single instance, isn't part of this change.
Tests
Added four tests to
UTMDataListTests:The first three fail with the fix reverted (
git revert --no-commit) and pass with it restored. The error-path test passes both ways. All 16 tests inUTMDataListTestspass, andTests/Static/run_all.shreports no problems.Testing: Tested by a human on macOS 27.2.1, MacBook Pro (Apple M4 Max), with a VM stored on a Samsung T7 USB SSD.
The author acknowledges that this change has been tested and/or reviewed by a human in accordance with UTM's AI contribution guidelines.