Commit Graph
21 Commits
Author SHA1 Message Date
osy 5d395abfc8 scripting: return from install before the Apple Event times out
A macOS install takes several minutes, well past the default two minute
Apple Event timeout. A plain `install` therefore failed with -1712 while
the installation kept running, and a script reacting to that error by
retrying or starting the VM would race the install.

`install` now returns as soon as the installation starts, and the new
`query install` verb reports whether it is still running and how far it
has progressed, or raises the error if it failed. The installation only
counts as finished once the VM has stopped by itself, so the VM can be
started right away.

Other verbs fail with a clear error while an installation started from
a script is in progress. This includes `start`, which would otherwise
open a window that asks to install macOS again. As in the GUI, `stop`
cancels the installation.

Assisted-by: Claude:claude-opus-5
2026-09-19 09:49:15 -05:00
osy 47eadda150 apple: make the vmnet modes predictable and simpler
Follow-up to the vmnet networking modes:

- Rename "Shared Network (VM to VM)" to "NAT Network" (config value
  "NATNetwork", scripting term "nat network") so the picker does not offer
  two "Shared" modes that differ only by a suffix.
- Request a fixed subnet per mode outside of the ranges vmnet hands out by
  default. Those ranges are also used by NAT attachments and QEMU, so guest
  addresses depended on what else was running whenever the network was
  (re)created. Fall back to a vmnet chosen subnet when ours is taken.
- Show the mode description with DetailedSection. The bare Text row widened
  the form and clipped the labels and controls in the settings window.
- Only require macOS 26 when a network is actually created, so a VM using
  one of these modes can still be edited and saved on older hosts.
- Do not apply locale digit grouping to the vmnet error code.
- Fold the validation flag into the existing one that skipped drives and
  leave the device unattached instead of using a NAT placeholder, remove
  the unused reverse mapping, key the networks by vmnet_mode_t, and isolate
  the manager to the main actor in place of a lock with no concurrent users.

Use .1 as the host-side address within each preferred /24. As reproduced
in PR #7865, vmnet accepts .0 during network creation but the interface
fails later at startup.

Assisted-by: Claude:claude-fable-5-1
Assisted-by: ChatGPT:GPT-6-Astra-Pro
2026-09-18 20:43:49 -04:00
lovon-spec 31b431f8b5 apple: let virtual machines connect to each other
Apple Virtualization's existing Shared Network uses a separate NAT
attachment per VM, so guests cannot use it to reach each other. macOS 26
adds VZVmnetNetworkDeviceAttachment, which lets multiple VMs attach to the
same process-owned vmnet network.

Add two macOS 26+ modes:

- "Shared Network (VM to VM)": guests share a NAT-backed vmnet network and
  can reach each other, the host, and external networks.
- "Host Only": guests share a host-only vmnet network and can reach each
  other and the host without external routing.

UTMAppleVmnetNetworkManager keeps a weak attachment cache per mode while
Virtualization configuration and runtime objects own the attachment and its
native network. The network therefore follows the actual VZ object lifetime
rather than UTM's presentation state, including failure paths where a VZ VM
can remain alive after UTM reports it stopped. Configuration validation uses
a side-effect-free placeholder so saving a VM does not create a live vmnet
network.

Hide both modes before macOS 26 and add matching scripting enumerators and
round-trip parsing.

Resolves #6975.
Related to #7418 and #7380.

Assisted-by: Claude:claude-fable-5-1
Assisted-by: ChatGPT:GPT-6-Pro
Assisted-by: ChatGPT:GPT-5.6-Sol
2026-09-18 13:26:24 +02:00
Greg ORIOL 47c5638356 Expose VLAN guest/DHCP addresses on the network settings 2026-05-12 22:05:42 +02:00
osy 7ec85d56a9 scripting: replace uuid with index for displays
We do not have persistent UUIDs for displays and so every time a new
config object is constructed, the UUIDs will change. We should
use index instead just like with serial and networking options.

Fixes #7145
2025-07-24 11:02:55 -07:00
osy 2b86f67d99 Merge pull request #6978 from naveenrajm7/script-display
scripting: expose display config
2025-04-07 16:06:09 -07:00
osy 3dfcddcc79 Merge pull request #6977 from naveenrajm7/script-sandbox-path
scripting : add vm registry suite
2025-04-07 16:05:44 -07:00
Naveenraj M 77a36173cc scripting: expose display config
qemu display
- All fields , except vga ram is exposed
apple display
- only dynamic resolution property is exposed.
- From GUI , the height, width and pixel of resolution is in pre-defined ratio as hence not exposed.

Both display will have id, which can be used to track and ditach the displays.
2025-01-19 02:17:17 -07:00
Naveenraj M f0cf825c22 scripting: add file urls to qemu additional arguments
* file urls is a list of file
* file urls are not saved to the disk (config.plist)
* QEMU launcher looks at file urls of args to collect required resources
* QEMU uses file URLs to access its corresponding bookmark
* The permissions of these urls is not handled as part of config update (ConfigImpl) , they should be handled at VM level(VMImpl) to update registryEntry of each VM
2025-01-17 17:30:50 -07:00
Naveenraj M 26fe0de354 scripting: expose icon in config
* Allows to get/set built-in icons
iconURL is URL in UTMConfig, but stored as string in config.plist, same is done for scripting interface.
2024-12-22 23:31:12 -07:00
Naveenraj M f101cceca0 scripting: drop file urls from qemu arguments
If file urls were be supported, handle file permissions before use (app sandbox)
2024-11-20 20:29:12 -07:00
Naveenraj M 7c8f656592 scripting: change property name
Avoid using reserved keyword in AppleScript as property name
2024-10-12 22:03:57 -06:00
Naveenraj M a4a79fea7c scripting: add qemu additional arguments
read and update qemu additional argument of vm config
2024-10-12 14:08:49 -06:00
osy e65578fe07 Merge pull request #5357 from MMP0/patch-1
Fix string format + Update Japanese localization
2023-07-03 09:16:56 -05:00
osy 37991d246f vm: rewrite UTMVirtualMachine in Swift 2023-06-28 19:45:05 -05:00
osy d498239b38 data: refactor UTMVirtualMachine to VMData for use in Views
This replaces the functionality of UTMWrappedVirtualMachine and moves some of
the presentation logic from UTMVirtualMachine.
2023-06-26 23:28:18 -05:00
MMP0 97976bd1ea Fix string format 2023-06-02 20:54:53 +09:00
osy 9db50536f9 scripting: fix target always resetting 2023-03-20 12:00:54 -07:00
osy ed1dde8822 scripting: simplified drives and support updating existing drive source 2023-03-20 12:00:11 -07:00
osy 1d42ceb7fe scripting: add make virtual machine 2023-03-19 21:11:22 -07:00
osy 4b4b33d10a scripting: add configuration suite 2023-03-19 21:11:22 -07:00