mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-27 07:48:55 +00:00
virtcontainers: introducing HybridVSock type
This new socket type is currently supported only by the firecracker hypervisor. For more details about its internal implementation see: https://github.com/firecracker-microvm/firecracker/blob/master/docs/vsock.md Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
parent
2a8af23de6
commit
880bb2b7b8
@ -104,6 +104,10 @@ const (
|
||||
|
||||
// memoryDevice is memory device type
|
||||
memoryDev
|
||||
|
||||
// hybridVirtioVsockDev is a hybrid virtio-vsock device supported
|
||||
// only on certain hypervisors, like firecracker.
|
||||
hybridVirtioVsockDev
|
||||
)
|
||||
|
||||
type memoryDevice struct {
|
||||
|
@ -342,6 +342,8 @@ func (k *kataAgent) agentURL() (string, error) {
|
||||
return s.HostPath, nil
|
||||
case kataVSOCK:
|
||||
return s.String(), nil
|
||||
case types.HybridVSock:
|
||||
return s.String(), nil
|
||||
default:
|
||||
return "", fmt.Errorf("Invalid socket type")
|
||||
}
|
||||
@ -398,6 +400,11 @@ func (k *kataAgent) configure(h hypervisor, id, sharePath string, builtin bool,
|
||||
return err
|
||||
}
|
||||
k.vmSocket = s
|
||||
case types.HybridVSock:
|
||||
err = h.addDevice(s, hybridVirtioVsockDev)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
default:
|
||||
return vcTypes.ErrInvalidConfigType
|
||||
}
|
||||
|
@ -29,6 +29,8 @@ const (
|
||||
StateStopped StateString = "stopped"
|
||||
)
|
||||
|
||||
const HybridVSockScheme = "hvsock"
|
||||
|
||||
// SandboxState is a sandbox state structure
|
||||
type SandboxState struct {
|
||||
State StateString `json:"state"`
|
||||
@ -161,6 +163,21 @@ func (v *Volumes) String() string {
|
||||
return strings.Join(volSlice, " ")
|
||||
}
|
||||
|
||||
// HybridVSock defines a hybrid vsocket to communicate between
|
||||
// the host and any process inside the VM.
|
||||
// This is a virtio-vsock implementation based on AF_VSOCK on the
|
||||
// guest side and multiple AF_UNIX sockets on the host side.
|
||||
// This kind of socket is not supported in all hypervisors.
|
||||
// Firecracker supports it.
|
||||
type HybridVSock struct {
|
||||
UdsPath string
|
||||
Port uint32
|
||||
}
|
||||
|
||||
func (s *HybridVSock) String() string {
|
||||
return fmt.Sprintf("%s://%s:%d", HybridVSockScheme, s.UdsPath, s.Port)
|
||||
}
|
||||
|
||||
// Socket defines a socket to communicate between
|
||||
// the host and any process inside the VM.
|
||||
type Socket struct {
|
||||
|
Loading…
Reference in New Issue
Block a user