Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
cli: kata-env: show if vsocks are supported
Browse files Browse the repository at this point in the history
Add a new field in `HostInfo` structure to show if vsocks are
supported in the host.

fixes #589

Signed-off-by: Julio Montes <[email protected]>
  • Loading branch information
Julio Montes authored and Eric Ernst committed Aug 21, 2018
1 parent 4784ac7 commit bfb2e84
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cli/kata-env.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/BurntSushi/toml"
vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
vcUtils "github.com/kata-containers/runtime/virtcontainers/utils"
specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/urfave/cli"
)
Expand All @@ -24,7 +25,7 @@ import (
//
// XXX: Increment for every change to the output format
// (meaning any change to the EnvInfo type).
const formatVersion = "1.0.14"
const formatVersion = "1.0.15"

// MetaInfo stores information on the format of the output itself
type MetaInfo struct {
Expand Down Expand Up @@ -119,6 +120,7 @@ type HostInfo struct {
Distro DistroInfo
CPU CPUInfo
VMContainerCapable bool
SupportVSocks bool
}

// EnvInfo collects all information that will be displayed by the
Expand Down Expand Up @@ -212,6 +214,7 @@ func getHostInfo() (HostInfo, error) {
Distro: hostDistro,
CPU: hostCPU,
VMContainerCapable: hostVMContainerCapable,
SupportVSocks: vcUtils.SupportsVsocks(),
}

return host, nil
Expand Down
2 changes: 2 additions & 0 deletions cli/kata-env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (

"github.com/BurntSushi/toml"
vc "github.com/kata-containers/runtime/virtcontainers"
vcUtils "github.com/kata-containers/runtime/virtcontainers/utils"
specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/urfave/cli"

Expand Down Expand Up @@ -179,6 +180,7 @@ func genericGetExpectedHostDetails(tmpdir string) (HostInfo, error) {
Distro: expectedDistro,
CPU: expectedCPU,
VMContainerCapable: false,
SupportVSocks: vcUtils.SupportsVsocks(),
}

testProcCPUInfo := filepath.Join(tmpdir, "cpuinfo")
Expand Down

0 comments on commit bfb2e84

Please sign in to comment.