-
Notifications
You must be signed in to change notification settings - Fork 789
feat: add VZVmnetNetworkDeviceAttachment support on macOS 26+
#4394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat: add VZVmnetNetworkDeviceAttachment support on macOS 26+
#4394
Conversation
|
|
Any advantage using them? |
As far as the API is concerned, customization that is not supported by vzNAT should be possible. |
07eebec to
270556e
Compare
Obsoleted by changesAdded It shares
When the |
81d4cc6 to
57553f8
Compare
433432d to
adf5456
Compare
|
In the latest commit, the serialization of |
adf5456 to
aa15ed7
Compare
Based on `VMNET_SHARED_MODE`, and `VMNET_HOST_MODE` ```yaml networks: - vzShared: true - vzHost: true ``` But, to sharing network between multiple VMs, `VZVmnetNetworkDeviceAttachment` requires VMs are launched by same process. It depends on Code-Hex/vz#205 Signed-off-by: Norio Nomura <[email protected]>
614105f to
d560fae
Compare
It provides `VmnetNetwork` serialization to VMs.
`limactl vz-vmnet` takes flags:
- `--enable-mach-service[=true,false]`: register/unregister Mach service to `launchd`
- It creates a launchd plist under ~/Library/LaunchAgents and bootstraps it.
- The Mach service "io.lima-vm.vz.vmnet" is registered.
- The working directory is $LIMA_HOME/_networks/vz-vmnet.
- It also creates a shell script named "io.lima-vm.vz.vmnet.sh" that runs
"limactl vz-vmnet" to avoid launching "limactl" directly from launchd.
macOS System Settings (General > Login Items & Extensions) shows the first
element of `ProgramArguments` as the login item name; using a shell script with
a fixed filename makes the item easier to identify.
- There is no need to register manually because the VZ driver is registered as appropriate.
- `--mach-service=<service name>`: launched as Mach server by `launchd` via `io.lima-vm.vz.vmnet.plist`
- Launched on demand to connection from VZ driver by `launchd`.
- Receives a request payload from VZ driver with fields:
- `Network`: name of the network ("shared", "host", etc)
- `Configuration`: `[]bytes@ representing `VzNetworkConfig` in JSON.
- Validates clients are the same executable (cdhash) by using xpc_peer_requirement API.
- Create `VmnetNetwork` from provided `Configuration` if cached one does not exist.
- Replies to VZ driver with fields:
- `Configuration`: If `VmnetNetwork` is cached, it may be created by different configuration.
- `Serialization`: newly created or cached.
- Monitors changes of networks
- When the interface created by `VmnetNetwork` disappears from host, remove them from cache.
- If all `VmnetNetwork` are removed, `limactl vz-vmnet` exits.
VZ driver (hostagent) does:
- Read `.vz` VzVmnetConfig from `networks.yaml`
- Use them on `- vz: <network>` fields; "shared" and "host" network are predefined.
- Register `limactl vz-vmnet` to `launchd` if not registered.
- Request serialization to the Mach service "io.lima-vm.vz.vmnet".
- Create `VmnetNetwork` by provided serialization, then use them.
Additional changes:
- Because shutdown takes longer on using `VmnetNetwork`:
- Extend VZ driver's shutdown timeout from 5 seconds to 15 seconds
- Add `ExitTimeOut` key with 20 seconds to autostart `io.lima-vm.autostart.INSTANCE.plist`
- `lima.yaml`: `- vzShared` and `- vzHost` are renamed to `- vz: shared` and `- vz: host`
Signed-off-by: Norio Nomura <[email protected]>
d560fae to
4cd78ff
Compare
Based on
VMNET_SHARED_MODE, andVMNET_HOST_MODEBut, to sharing network between multiple VMs,
VZVmnetNetworkDeviceAttachmentrequires VMs are launched by same process.It depends on Code-Hex/vz#205