runtime-rs: fix typo get_contaier_type to get_container_type

Change get_contaier_type to get_container_type

Fixes: #5415

Signed-off-by: Bin Liu <bin@hyper.sh>
This commit is contained in:
Bin Liu 2022-10-13 17:12:43 +08:00
parent 2de29b6f69
commit 4d9dd8790d
2 changed files with 4 additions and 4 deletions

View File

@ -49,7 +49,7 @@ pub enum ShimIdInfo {
} }
/// get container type /// get container type
pub fn get_contaier_type(spec: &oci::Spec) -> Result<ContainerType, Error> { pub fn get_container_type(spec: &oci::Spec) -> Result<ContainerType, Error> {
for k in CRI_CONTAINER_TYPE_KEY_LIST.iter() { for k in CRI_CONTAINER_TYPE_KEY_LIST.iter() {
if let Some(type_value) = spec.annotations.get(*k) { if let Some(type_value) = spec.annotations.get(*k) {
match type_value.as_str() { match type_value.as_str() {
@ -67,7 +67,7 @@ pub fn get_contaier_type(spec: &oci::Spec) -> Result<ContainerType, Error> {
/// get shim id info /// get shim id info
pub fn get_shim_id_info() -> Result<ShimIdInfo, Error> { pub fn get_shim_id_info() -> Result<ShimIdInfo, Error> {
let spec = load_oci_spec()?; let spec = load_oci_spec()?;
match get_contaier_type(&spec)? { match get_container_type(&spec)? {
ContainerType::PodSandbox => Ok(ShimIdInfo::Sandbox), ContainerType::PodSandbox => Ok(ShimIdInfo::Sandbox),
ContainerType::PodContainer => { ContainerType::PodContainer => {
for k in CRI_SANDBOX_ID_KEY_LIST { for k in CRI_SANDBOX_ID_KEY_LIST {

View File

@ -6,7 +6,7 @@
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use containerd_shim_protos::api; use containerd_shim_protos::api;
use kata_sys_util::spec::{get_bundle_path, get_contaier_type, load_oci_spec}; use kata_sys_util::spec::{get_bundle_path, get_container_type, load_oci_spec};
use kata_types::container::ContainerType; use kata_types::container::ContainerType;
use nix::{sys::signal::kill, sys::signal::SIGKILL, unistd::Pid}; use nix::{sys::signal::kill, sys::signal::SIGKILL, unistd::Pid};
use protobuf::Message; use protobuf::Message;
@ -53,7 +53,7 @@ impl ShimExecutor {
let bundle_path = get_bundle_path().context("get bundle path")?; let bundle_path = get_bundle_path().context("get bundle path")?;
if let Ok(spec) = load_oci_spec() { if let Ok(spec) = load_oci_spec() {
if let Ok(ContainerType::PodSandbox) = get_contaier_type(&spec) { if let Ok(ContainerType::PodSandbox) = get_container_type(&spec) {
// only force shutdown for sandbox container // only force shutdown for sandbox container
if let Ok(shim_pid) = self.read_pid_file(&bundle_path) { if let Ok(shim_pid) = self.read_pid_file(&bundle_path) {
info!(sl!(), "force to shutdown shim process {}", shim_pid); info!(sl!(), "force to shutdown shim process {}", shim_pid);