mirror of
https://github.com/containers/youki
synced 2024-05-25 17:06:09 +02:00
Set cgroups path for tenant containers from main container
Signed-off-by: Yashodhan Joshi <yjdoc2@gmail.com>
This commit is contained in:
parent
496d9553df
commit
629a2c75f0
|
@ -353,6 +353,10 @@ impl CgroupManager for Manager {
|
|||
if pid.as_raw() == -1 {
|
||||
return Ok(());
|
||||
}
|
||||
if self.client.transient_unit_exists(&self.unit_name) {
|
||||
tracing::debug!("Transient unit {:?} already exists", self.unit_name);
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
tracing::debug!("Starting {:?}", self.unit_name);
|
||||
self.client.start_transient_unit(
|
||||
|
|
|
@ -327,8 +327,16 @@ impl TenantContainerBuilder {
|
|||
|
||||
let init_process = procfs::process::Process::new(container_pid.as_raw())?;
|
||||
let ns = self.get_namespaces(init_process.namespaces()?.0)?;
|
||||
let linux = LinuxBuilder::default().namespaces(ns).build()?;
|
||||
|
||||
let linux = spec.linux().as_ref().unwrap();
|
||||
let linux = if linux.cgroups_path().is_some() {
|
||||
LinuxBuilder::default()
|
||||
.namespaces(ns)
|
||||
.cgroups_path(linux.cgroups_path().as_ref().unwrap().clone())
|
||||
.build()?
|
||||
} else {
|
||||
LinuxBuilder::default().namespaces(ns).build()?
|
||||
};
|
||||
spec.set_process(Some(process)).set_linux(Some(linux));
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue