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

View File

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