mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-17 06:48:51 +00:00
Merge pull request #2496 from rapiz1/show-guest-protection
cli: Show available guest protection in env output
This commit is contained in:
@@ -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
|
||||||
|
@@ -177,6 +177,30 @@ const (
|
|||||||
seProtection //nolint
|
seProtection //nolint
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var guestProtectionStr = [...]string{
|
||||||
|
noneProtection: "none",
|
||||||
|
pefProtection: "pef",
|
||||||
|
seProtection: "se",
|
||||||
|
sevProtection: "sev",
|
||||||
|
tdxProtection: "tdx",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (gp guestProtection) String() string {
|
||||||
|
return guestProtectionStr[gp]
|
||||||
|
}
|
||||||
|
|
||||||
|
func genericAvailableGuestProtections() (protections []string) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func AvailableGuestProtections() (protections []string) {
|
||||||
|
gp, err := availableGuestProtection()
|
||||||
|
if err != nil || gp == noneProtection {
|
||||||
|
return genericAvailableGuestProtections()
|
||||||
|
}
|
||||||
|
return []string{gp.String()}
|
||||||
|
}
|
||||||
|
|
||||||
type qemuArchBase struct {
|
type qemuArchBase struct {
|
||||||
qemuExePath string
|
qemuExePath string
|
||||||
qemuMachine govmmQemu.Machine
|
qemuMachine govmmQemu.Machine
|
||||||
|
Reference in New Issue
Block a user