mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-12 21:27:02 +00:00
virtcontainers: Add func AvailableGuestProtections
Add functions to return guestProtection as a string slice, which can be then used in `kata-runtime env` output. Signed-off-by: Yujia Qiao <rapiz3142@gmail.com>
This commit is contained in:
parent
3d0fe433c6
commit
2063b13805
@ -177,6 +177,30 @@ const (
|
|||||||
seProtection //nolint
|
seProtection //nolint
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var guestProtectionStr = [...]string{
|
||||||
|
noneProtection: "none",
|
||||||
|
tdxProtection: "tdx",
|
||||||
|
sevProtection: "sev",
|
||||||
|
pefProtection: "pef",
|
||||||
|
seProtection: "se",
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user