mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-14 14:14:15 +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>
(cherry picked from commit ad8968c8d9
)
Signed-off-by: Greg Kurz <groug@kaod.org>
This commit is contained in:
parent
491b95451c
commit
12ec33d70d
@ -267,6 +267,10 @@ impl CgroupManager for Manager {
|
|||||||
fn as_any(&self) -> Result<&dyn Any> {
|
fn as_any(&self) -> Result<&dyn Any> {
|
||||||
Ok(self)
|
Ok(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn name(&self) -> &str {
|
||||||
|
"cgroupfs"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_network_resources(
|
fn set_network_resources(
|
||||||
|
@ -66,6 +66,10 @@ impl CgroupManager for Manager {
|
|||||||
fn as_any(&self) -> Result<&dyn Any> {
|
fn as_any(&self) -> Result<&dyn Any> {
|
||||||
Ok(self)
|
Ok(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn name(&self) -> &str {
|
||||||
|
"mock"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Manager {
|
impl Manager {
|
||||||
|
@ -52,10 +52,12 @@ pub trait Manager {
|
|||||||
fn as_any(&self) -> Result<&dyn Any> {
|
fn as_any(&self) -> Result<&dyn Any> {
|
||||||
Err(anyhow!("not supported!"))
|
Err(anyhow!("not supported!"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn name(&self) -> &str;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Debug for dyn Manager + Send + Sync {
|
impl Debug for dyn Manager + Send + Sync {
|
||||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
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> {
|
fn as_any(&self) -> Result<&dyn Any> {
|
||||||
Ok(self)
|
Ok(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn name(&self) -> &str {
|
||||||
|
"systemd"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Manager {
|
impl Manager {
|
||||||
|
Loading…
Reference in New Issue
Block a user