cli: Show available guest protection in env output

Show available guest protections in the
`kata-runtime env` output. Also bump the formatVersion.

Fixes: #1982

Signed-off-by: Yujia Qiao <rapiz3142@gmail.com>
This commit is contained in:
Yujia Qiao 2021-10-25 21:44:56 +08:00
parent 2063b13805
commit 6cc8000cae
No known key found for this signature in database
GPG Key ID: DC129173B148701B
2 changed files with 20 additions and 16 deletions

View File

@ -130,13 +130,14 @@ type DistroInfo struct {
// HostInfo stores host details
type HostInfo struct {
Kernel string
Architecture string
Distro DistroInfo
CPU CPUInfo
Memory MemoryInfo
VMContainerCapable bool
SupportVSocks bool
AvailableGuestProtections []string
Kernel string
Architecture string
Distro DistroInfo
CPU CPUInfo
Memory MemoryInfo
VMContainerCapable bool
SupportVSocks bool
}
// NetmonInfo stores netmon details
@ -241,14 +242,17 @@ func getHostInfo() (HostInfo, error) {
memoryInfo := getMemoryInfo()
availableGuestProtection := vc.AvailableGuestProtections()
host := HostInfo{
Kernel: hostKernelVersion,
Architecture: arch,
Distro: hostDistro,
CPU: hostCPU,
Memory: memoryInfo,
VMContainerCapable: hostVMContainerCapable,
SupportVSocks: supportVSocks,
Kernel: hostKernelVersion,
Architecture: arch,
Distro: hostDistro,
CPU: hostCPU,
Memory: memoryInfo,
AvailableGuestProtections: availableGuestProtection,
VMContainerCapable: hostVMContainerCapable,
SupportVSocks: supportVSocks,
}
return host, nil

View File

@ -179,10 +179,10 @@ const (
var guestProtectionStr = [...]string{
noneProtection: "none",
tdxProtection: "tdx",
sevProtection: "sev",
pefProtection: "pef",
seProtection: "se",
sevProtection: "sev",
tdxProtection: "tdx",
}
func (gp guestProtection) String() string {