mirror of
https://github.com/containers/youki
synced 2024-11-23 01:11:58 +01:00
Fix youki code for procfs breaking changes
Signed-off-by: Yashodhan Joshi <yjdoc2@gmail.com>
This commit is contained in:
parent
f7ef5cf950
commit
0331e41928
@ -272,7 +272,7 @@ impl TenantContainerBuilder {
|
||||
}
|
||||
|
||||
let init_process = procfs::process::Process::new(container.pid().unwrap().as_raw())?;
|
||||
let ns = self.get_namespaces(init_process.namespaces()?)?;
|
||||
let ns = self.get_namespaces(init_process.namespaces()?.0)?;
|
||||
let linux = LinuxBuilder::default().namespaces(ns).build()?;
|
||||
|
||||
spec.set_process(Some(process)).set_linux(Some(linux));
|
||||
|
@ -95,7 +95,7 @@ pub fn find_resctrl_mount_point() -> Result<PathBuf> {
|
||||
let process = Process::myself()?;
|
||||
let mount_infos = process.mountinfo()?;
|
||||
|
||||
for mount_info in mount_infos.iter() {
|
||||
for mount_info in mount_infos.0.iter() {
|
||||
// "resctrl" type fs can be mounted only once.
|
||||
if mount_info.fs_type == "resctrl" {
|
||||
let path = mount_info.mount_point.clone().canonicalize().map_err(|err| {
|
||||
|
@ -431,7 +431,7 @@ impl Mount {
|
||||
tracing::error!("failed to get mount info: {}", err);
|
||||
MountError::Other(err.into())
|
||||
})?;
|
||||
let parent_mount = find_parent_mount(rootfs, mount_infos)?;
|
||||
let parent_mount = find_parent_mount(rootfs, mount_infos.0)?;
|
||||
|
||||
// check parent mount has 'shared' propagation type
|
||||
if parent_mount
|
||||
|
@ -6,7 +6,7 @@ use std::{fs, path::Path};
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use libcontainer::user_ns;
|
||||
use procfs::{CpuInfo, Meminfo};
|
||||
use procfs::{CpuInfo, Current, Meminfo};
|
||||
|
||||
#[cfg(feature = "v2")]
|
||||
use libcgroups::{common::CgroupSetup, v2::controller_type::ControllerType};
|
||||
@ -101,11 +101,11 @@ fn find_parameter<'a>(content: &'a str, param_name: &str) -> Option<&'a str> {
|
||||
|
||||
/// Print Hardware information of system
|
||||
pub fn print_hardware() {
|
||||
if let Ok(cpu_info) = CpuInfo::new() {
|
||||
if let Ok(cpu_info) = CpuInfo::current() {
|
||||
println!("{:<18}{}", "Cores", cpu_info.num_cores());
|
||||
}
|
||||
|
||||
if let Ok(mem_info) = Meminfo::new() {
|
||||
if let Ok(mem_info) = Meminfo::current() {
|
||||
println!(
|
||||
"{:<18}{}",
|
||||
"Total Memory",
|
||||
|
Loading…
Reference in New Issue
Block a user