Add SwitchId and Suggestions to NetworkAdapter configuration#51
Closed
Vigilans wants to merge 2 commits into
Closed
Add SwitchId and Suggestions to NetworkAdapter configuration#51Vigilans wants to merge 2 commits into
Vigilans wants to merge 2 commits into
Conversation
* Each network adapter can specify different virtual switch to attach now Signed-off-by: Vigilans <vigilans@foxmail.com>
When creating a new HCN network via SwitchId, the Suggestions object provides optional parameters: SwitchName, SwitchType, SwitchSubnet for network creation, and IPAddress for endpoint IPConfigurations. These are ignored if the network already exists.
e351e7b to
80e8fd4
Compare
MouriNaruto
added a commit
that referenced
this pull request
Apr 9, 2026
…network adapter. (#51) (Contributed by Vigilans.) Co-authored-by: Vigilans <vigilans@foxmail.com>
Member
|
Have manually merged. Kenji Mouri |
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.
Summary
SwitchIdproperty toNetworkAdapterConfiguration, allowing each network adapter to connect to a different HCN network (e.g. Default Switch, Docker nat, WSL, or a custom network)Suggestionsproperty withSwitchName,SwitchType,SwitchSubnet, andIPAddressfields, used as creation parameters when the specified network does not existIPAddressis written toIPConfigurationswhen creating the endpoint. Currently ICS DHCP overrides this value, but it is included for potential use with other network types (e.g. NAT with static allocation) and for future testingHCS_E_INVALID_JSONComputeNetworkCreateEndpointfails (e.g. invalidSwitchId, network creation rejected), the exception was caught but the adapter remainedConnected = truewith an emptyMacAddress.MakeHcsNetworkAdapterConfigurationthen wrote an emptyMacAddressinto the HCS JSON, causingHcsCreateComputeSystemto fail withHCS_E_INVALID_JSON (0xC037010D). The fix setsConnected = falseon failure so the adapter is skipped in HCS JSON generationTest plan
SwitchIdpointing to non-existent network → auto-created withSuggestionsSwitchId→ gracefully skipped, VM starts with remaining adaptersSwitchId→ defaults to NanaBox ICS network,SwitchIdfilled after startupExample
NanaBox Configuration:
Windows Screenshot:
