mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-22 16:54:25 +01:00
runtime: Show socket path in kata-env output
Display a pseudo path to the sandbox socket in the output of
`kata-runtime env` for those hypervisors that use Hybrid VSOCK.
The path is not a real path since the command does not create a sandbox.
The output includes a `{ID}` tag which would be replaced with the real
sandbox ID (name) when the sandbox was created.
This feature is only useful for agent tracing with the trace forwarder
where the configured hypervisor uses Hybrid VSOCK.
Note that the features required a new `setConfig()` method to be added
to the `hypervisor` interface. This isn't normally needed as the
specified hypervisor configuration passed to `setConfig()` is also
passed to `createSandbox()`. However the new call is required by
`kata-runtime env` to display the correct socket path for Firecracker.
The new method isn't wholly redundant for the main code path though as
it's now used by each hypervisor's `createSandbox()` call.
Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
@@ -585,3 +585,17 @@ func TestQemuGetpids(t *testing.T) {
|
||||
assert.True(pids[0] == 100)
|
||||
assert.True(pids[1] == 200)
|
||||
}
|
||||
|
||||
func TestQemuSetConfig(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
config := newQemuConfig()
|
||||
|
||||
q := &qemu{}
|
||||
|
||||
assert.Equal(q.config, HypervisorConfig{})
|
||||
err := q.setConfig(&config)
|
||||
assert.NoError(err)
|
||||
|
||||
assert.Equal(q.config, config)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user