@@ -36,8 +36,24 @@ func (aic addressInfoCloser) Release(_ context.Context) error {
3636 return windows .CloseHandle (aic .handle )
3737}
3838
39- func CreateAddressInfo (cid , vmid guid.GUID , passthru bool ) (resources.ResourceCloser , error ) {
40- path := fmt .Sprintf (`\\.\HvSocketSystem\AddressInfo\{%s}` , cid )
39+ // CreateContainerAddressInfo creates an address info entry in HvSocket to redirect
40+ // the calls to the container silo inside UVM.
41+ func CreateContainerAddressInfo (containerID , uvmID guid.GUID ) (resources.ResourceCloser , error ) {
42+ return CreateAddressInfo (containerID , uvmID , guid.GUID {}, true )
43+ }
44+
45+ // CreateAddressInfo creates an address info entry in the HvSocket provider to map a
46+ // compute system GUID to a virtual machine ID or compartment ID.
47+ //
48+ // `systemID` is the compute system GUID to map.
49+ // `vmID` is the virtual machine ID to which the system GUID maps to. Must be guid.GUID{} to specify
50+ // that the system GUID maps to a network compartment ID on the hosting system.
51+ // `siloID` is the silo object ID to which the system GUID maps to.
52+ // `passthru` when vmID is not guid.GUID{}, specifies whether the systemID maps to the primary
53+ // compartment of the virtual machine (set to `false`) or to another compartment within the
54+ // virtual machine (set to `true`)
55+ func CreateAddressInfo (systemID , vmID , siloID guid.GUID , passthru bool ) (resources.ResourceCloser , error ) {
56+ path := fmt .Sprintf (`\\.\HvSocketSystem\AddressInfo\{%s}` , systemID )
4157 u16 , err := windows .UTF16PtrFromString (path )
4258 if err != nil {
4359 return nil , err
@@ -56,9 +72,11 @@ func CreateAddressInfo(cid, vmid guid.GUID, passthru bool) (resources.ResourceCl
5672 }
5773
5874 addrInfo := addressInfo {
59- systemID : cid ,
60- virtualMachineID : vmid ,
75+ systemID : systemID ,
76+ virtualMachineID : vmID ,
77+ siloID : siloID ,
6178 }
79+
6280 if passthru {
6381 addrInfo .flags |= addressFlagPassthru
6482 }
0 commit comments