-
Notifications
You must be signed in to change notification settings - Fork 260
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
HvSocket support for containers #2353
base: main
Are you sure you want to change the base?
Conversation
4d40dbd
to
caf030c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does the address info ioctl have to go through before the container is created?
if not, then we could probably remove the HCSIDToGUID
code and instead add the call to CreateAddressInfo
in hcsoci.Create after the system is created and we have its GUID from HCS (so we don't rely on their internal logic for generating the GUID):
func CreateContainer(/* ... */) (_ cow.Container, _ *resources.Resources, err error) {
// ...
if gcsDocument != nil {
c, err := coi.HostingSystem.CreateContainer(ctx, coi.actualID, gcsDocument)
if err != nil {
return nil, r, err
}
if p, err := c.PropertiesV2(ctx); err != nil {
return nil, r, fmt.Errorf("retrieve created container compute system properties: %w", err)
}
hvsockAI, err := hvsocket.CreateAddressInfo(p.RuntimeId, coi.HostingSystem.RuntimeID(), true)
if err != nil {
return nil, r, fmt.Errorf("exposing container Hyper-V socket: %w", err)
}
r.Add(hvsockAI)
return c, r, nil
}
}
on a side note, how are users expected to get the runtime ID of the container for creating hv sockets? |
What is the use case here? Is user expected to connect to inside the UVM using the containerId? |
Applications connecting from the host into the container should use container-specific VMID. This ID will need to be the same as the container's VMID inside the guest, which is calculated by HCS/GCS like it's done in this PR by `HCSIDToGUID`. To allow the container ID to work with HvSocket on the host, we need to set up an AddressInfo mapping to tell HvSocket to redirect the call into the UVM, which is done in this PR by default for all WCOW containers. Add `hvsocketaddr.exe` that clients can use to generate VM ID for container. Signed-off-by: Maksim An <[email protected]>
caf030c
to
774f1a4
Compare
turned out RuntimeID is empty... I had to update the schema and explicitly ask for systemID, which is what we need. |
The use case is a client/server application running on containerd host and server/client (respectively) running in a Xenon container communicating via HvSocket. shimdiag wouldn't be able to provide this type of communication. |
Applications connecting from the host into the container should use
container-specific VMID. This ID will need to be the same as the
container's VMID inside the guest, which is calculated by HCS/GCS
like it's done in this PR by
HCSIDToGUID
.To allow the container ID to work with HvSocket on the host, we
need to set up an AddressInfo mapping to tell HvSocket to redirect
the call into the UVM, which is done in this PR by default for
all WCOW containers.