Runtime: Fix support for latest vsock version from Firecracker

Created on 4 Sep 2019  路  4Comments  路  Source: kata-containers/runtime

The latest Firecracker version merged a brand new hybrid implementation of vsock, which comes with some special constraints compared to the regular vhost-vsock version.

Here are the steps which needs to be addressed in order to reach the proper implementation:

  1. Update Firecracker client API with swagger
  2. Fix fc.go to build with the new API
  3. Move from UseVsock being a boolean into an actual choice about the type of socket connection being used. Ideally, we should have something like: unix, vsock, vsock-hybrid. Along with this change, we need to introduce a new type kataVSockHybrid that will have different fields than kataVSOCK, and in particular a path to the socket that needs to be chosen by Kata runtime as it needs to be unique across multiple instances.
  4. Implement kata_agent.go to implement the case where vsock-hybrid is picked up. This means it's not needed to rely on /dev/vhost-vsock in this case to retrieve an appropriate CID.
  5. Update fc.go to rely on the path decided earlier in the code, and use it as UdsPath. No need to close the vhostFd since there will be no vhostFd in this case.
  6. Now that kata_agent.go returns an URL with vsock-hybrid:// instead of vsock://, we need to update kata-containers/agent/protocols/client/client.go, function NewAgentClient() to handle the case of a third possibility. This client wrapper should handle both unix, vsock and vsock-hybrid. In details, the hybrid version needs to be handled by sending a special message right after the connection to the unix socket.
  7. The other consumers of this URL, that is kata-proxy and kata-shim should not need to be modified since they will receive a URL that they will use through the client wrapper code directly. For this reason, both kata-proxy and kata-shim should simply need an update of the vendored version from the kata-containers/agent repository.

The agent code doesn't require any change since the guest still sees an AF_VSOCK socket.

bug needs-review

Most helpful comment

@Pennyzct yes, I'm working on that, I hope to have it working this week

All 4 comments

/cc @egernst @devimc

Hi guys
I've been working on kata+firecracker on aarch64, v0.18 is the optimal version.
Have you guys planned a schedule for this new vsock design, in this month, or next month? ;) 馃槝
really looking forward it~~~
@devimc @egernst @sboeuf @gnawux @bergwolf @xiaobo55x

@Pennyzct yes, I'm working on that, I hope to have it working this week

@devimc thanks~

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jcvenegas picture jcvenegas  路  7Comments

gnawux picture gnawux  路  11Comments

cespo picture cespo  路  11Comments

maartenvdezz picture maartenvdezz  路  10Comments

Pennyzct picture Pennyzct  路  4Comments