mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-05-01 21:24:36 +00:00
kata-ctl: add check framework support for non-x86
x86 changes the check framwork. Enable them for non-x86 accordingly. Fixes: #5923 Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
This commit is contained in:
parent
1bd533f10b
commit
3480780bd8
@ -7,12 +7,21 @@
|
||||
pub use arch_specific::*;
|
||||
|
||||
mod arch_specific {
|
||||
use crate::types::*;
|
||||
use anyhow::Result;
|
||||
use std::path::Path;
|
||||
|
||||
const KVM_DEV: &str = "/dev/kvm";
|
||||
|
||||
pub fn check() -> Result<()> {
|
||||
// List of check functions
|
||||
static CHECK_LIST: &[CheckItem] = &[CheckItem {
|
||||
name: CheckType::CheckCpu,
|
||||
descr: "This parameter performs the host check",
|
||||
fp: check,
|
||||
perm: PermissionType::NonPrivileged,
|
||||
}];
|
||||
|
||||
pub fn check(_args: &str) -> Result<()> {
|
||||
println!("INFO: check: aarch64");
|
||||
if Path::new(KVM_DEV).exists() {
|
||||
println!("Kata Containers can run on this host\n");
|
||||
@ -22,4 +31,8 @@ mod arch_specific {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn get_checks() -> Option<&'static [CheckItem<'static>]> {
|
||||
Some(CHECK_LIST)
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
use crate::types::*;
|
||||
#[cfg(target_arch = "powerpc64le")]
|
||||
pub use arch_specific::*;
|
||||
|
||||
@ -12,4 +13,8 @@ mod arch_specific {
|
||||
pub fn check() -> Result<()> {
|
||||
unimplemented!("Check not implemented in powerpc64le");
|
||||
}
|
||||
|
||||
pub fn get_checks() -> Option<&'static [CheckItem<'static>]> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
@ -48,4 +48,16 @@ mod arch_specific {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// List of check functions
|
||||
static CHECK_LIST: &[CheckItem] = &[CheckItem {
|
||||
name: CheckType::CheckCpu,
|
||||
descr: "This parameter performs the cpu check",
|
||||
fp: check,
|
||||
perm: PermissionType::NonPrivileged,
|
||||
}];
|
||||
|
||||
pub fn get_checks() -> Option<&'static [CheckItem<'static>]> {
|
||||
Some(CHECK_LIST)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user