mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-10-22 12:29:49 +00:00
Merge pull request #3836 from liubin/fix/minor-fix
Enhancement: fix comments/logs and delete not used function
This commit is contained in:
@@ -215,7 +215,6 @@ pub trait BaseContainer {
|
||||
async fn start(&mut self, p: Process) -> Result<()>;
|
||||
async fn run(&mut self, p: Process) -> Result<()>;
|
||||
async fn destroy(&mut self) -> Result<()>;
|
||||
fn signal(&self, sig: Signal, all: bool) -> Result<()>;
|
||||
fn exec(&mut self) -> Result<()>;
|
||||
}
|
||||
|
||||
@@ -1057,18 +1056,6 @@ impl BaseContainer for LinuxContainer {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn signal(&self, sig: Signal, all: bool) -> Result<()> {
|
||||
if all {
|
||||
for pid in self.processes.keys() {
|
||||
signal::kill(Pid::from_raw(*pid), Some(sig))?;
|
||||
}
|
||||
}
|
||||
|
||||
signal::kill(Pid::from_raw(self.init_process_pid), Some(sig))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn exec(&mut self) -> Result<()> {
|
||||
let fifo = format!("{}/{}", &self.root, EXEC_FIFO_FILENAME);
|
||||
let fd = fcntl::open(fifo.as_str(), OFlag::O_WRONLY, Mode::from_bits_truncate(0))?;
|
||||
@@ -2049,14 +2036,6 @@ mod tests {
|
||||
assert!(ret.is_ok(), "Expecting Ok, Got {:?}", ret);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_linuxcontainer_signal() {
|
||||
let ret = new_linux_container_and_then(|c: LinuxContainer| {
|
||||
c.signal(nix::sys::signal::SIGCONT, true)
|
||||
});
|
||||
assert!(ret.is_ok(), "Expecting Ok, Got {:?}", ret);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_linuxcontainer_exec() {
|
||||
let ret = new_linux_container_and_then(|mut c: LinuxContainer| c.exec());
|
||||
|
@@ -551,7 +551,7 @@ mod tests {
|
||||
|
||||
assert!(
|
||||
s.remove_sandbox_storage(srcdir_path).is_err(),
|
||||
"Expect Err as the directory i not a mountpoint"
|
||||
"Expect Err as the directory is not a mountpoint"
|
||||
);
|
||||
|
||||
assert!(s.remove_sandbox_storage("").is_err());
|
||||
@@ -586,7 +586,6 @@ mod tests {
|
||||
let logger = slog::Logger::root(slog::Discard, o!());
|
||||
let mut s = Sandbox::new(&logger).unwrap();
|
||||
|
||||
// FIX: This test fails, not sure why yet.
|
||||
assert!(
|
||||
s.unset_and_remove_sandbox_storage("/tmp/testEphePath")
|
||||
.is_err(),
|
||||
|
@@ -22,14 +22,14 @@ func SetLogger(logger *logrus.Entry) {
|
||||
controllerLogger = logger.WithFields(fields)
|
||||
}
|
||||
|
||||
// HypervisorType describes an hypervisor type.
|
||||
// ResourceControllerType describes a resource controller type.
|
||||
type ResourceControllerType string
|
||||
|
||||
const (
|
||||
LinuxCgroups ResourceControllerType = "cgroups"
|
||||
)
|
||||
|
||||
// String converts an hypervisor type to a string.
|
||||
// String converts a resource type to a string.
|
||||
func (rType *ResourceControllerType) String() string {
|
||||
switch *rType {
|
||||
case LinuxCgroups:
|
||||
|
@@ -20,7 +20,7 @@ import (
|
||||
// DefaultResourceControllerID runtime-determined location in the cgroups hierarchy.
|
||||
const DefaultResourceControllerID = "/vc"
|
||||
|
||||
// validCgroupPath returns a valid cgroup path.
|
||||
// ValidCgroupPath returns a valid cgroup path.
|
||||
// see https://github.com/opencontainers/runtime-spec/blob/master/config-linux.md#cgroups-path
|
||||
func ValidCgroupPath(path string, systemdCgroup bool) (string, error) {
|
||||
if IsSystemdCgroup(path) {
|
||||
|
Reference in New Issue
Block a user