mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 04:04:45 +00:00
rustjail: print type of cgroup manager
Since the cgroup manager is wrapped in a dyn now, the print in LinuxContainer::new has been useless and just says "CgroupManager". Extend the Debug trait for 'dyn Manager' to print the type of the cgroup manager so that it's easier to debug issues. Fixes: #5779 Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
This commit is contained in:
parent
4a35d5fa6e
commit
736aae47a4
@ -267,6 +267,10 @@ impl CgroupManager for Manager {
|
||||
fn as_any(&self) -> Result<&dyn Any> {
|
||||
Ok(self)
|
||||
}
|
||||
|
||||
fn name(&self) -> &str {
|
||||
"cgroupfs"
|
||||
}
|
||||
}
|
||||
|
||||
fn set_network_resources(
|
||||
|
@ -66,6 +66,10 @@ impl CgroupManager for Manager {
|
||||
fn as_any(&self) -> Result<&dyn Any> {
|
||||
Ok(self)
|
||||
}
|
||||
|
||||
fn name(&self) -> &str {
|
||||
"mock"
|
||||
}
|
||||
}
|
||||
|
||||
impl Manager {
|
||||
|
@ -52,10 +52,12 @@ pub trait Manager {
|
||||
fn as_any(&self) -> Result<&dyn Any> {
|
||||
Err(anyhow!("not supported!"))
|
||||
}
|
||||
|
||||
fn name(&self) -> &str;
|
||||
}
|
||||
|
||||
impl Debug for dyn Manager + Send + Sync {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
write!(f, "CgroupManager")
|
||||
write!(f, "{}", self.name())
|
||||
}
|
||||
}
|
||||
|
@ -101,6 +101,10 @@ impl CgroupManager for Manager {
|
||||
fn as_any(&self) -> Result<&dyn Any> {
|
||||
Ok(self)
|
||||
}
|
||||
|
||||
fn name(&self) -> &str {
|
||||
"systemd"
|
||||
}
|
||||
}
|
||||
|
||||
impl Manager {
|
||||
|
Loading…
Reference in New Issue
Block a user