mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-27 15:57:09 +00:00
agent: fix dead_code lint
Fixes: #1359 Signed-off-by: Tim Zhang <tim@hyper.sh>
This commit is contained in:
parent
05da23acb7
commit
e28bf7a59d
@ -26,10 +26,6 @@ const VSOCK_PORT: u16 = 1024;
|
|||||||
const SERVER_ADDR_ENV_VAR: &str = "KATA_AGENT_SERVER_ADDR";
|
const SERVER_ADDR_ENV_VAR: &str = "KATA_AGENT_SERVER_ADDR";
|
||||||
const LOG_LEVEL_ENV_VAR: &str = "KATA_AGENT_LOG_LEVEL";
|
const LOG_LEVEL_ENV_VAR: &str = "KATA_AGENT_LOG_LEVEL";
|
||||||
|
|
||||||
// FIXME: unused
|
|
||||||
const TRACE_MODE_FLAG: &str = "agent.trace";
|
|
||||||
const USE_VSOCK_FLAG: &str = "agent.use_vsock";
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct agentConfig {
|
pub struct agentConfig {
|
||||||
pub debug_console: bool,
|
pub debug_console: bool,
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#![allow(non_camel_case_types)]
|
#![allow(non_camel_case_types)]
|
||||||
#![allow(unused_parens)]
|
#![allow(unused_parens)]
|
||||||
#![allow(unused_unsafe)]
|
#![allow(unused_unsafe)]
|
||||||
#![allow(dead_code)]
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate lazy_static;
|
extern crate lazy_static;
|
||||||
extern crate oci;
|
extern crate oci;
|
||||||
|
@ -68,6 +68,7 @@ impl Namespace {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn set_root_dir(mut self, dir: &str) -> Self {
|
pub fn set_root_dir(mut self, dir: &str) -> Self {
|
||||||
self.persistent_ns_dir = dir.to_string();
|
self.persistent_ns_dir = dir.to_string();
|
||||||
self
|
self
|
||||||
|
@ -40,6 +40,7 @@ pub enum AddressFilter {
|
|||||||
/// Return addresses that belong to the given interface.
|
/// Return addresses that belong to the given interface.
|
||||||
LinkIndex(u32),
|
LinkIndex(u32),
|
||||||
/// Get addresses with the given prefix.
|
/// Get addresses with the given prefix.
|
||||||
|
#[allow(dead_code)]
|
||||||
IpAddress(IpAddr),
|
IpAddress(IpAddr),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,17 +216,6 @@ impl Handle {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn delete_links<I>(&mut self, list: I) -> Result<()>
|
|
||||||
where
|
|
||||||
I: IntoIterator<Item = u32>,
|
|
||||||
{
|
|
||||||
for index in list.into_iter() {
|
|
||||||
self.handle.link().del(index).execute().await?;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn query_routes(
|
async fn query_routes(
|
||||||
&self,
|
&self,
|
||||||
ip_version: Option<IpVersion>,
|
ip_version: Option<IpVersion>,
|
||||||
@ -742,6 +732,7 @@ impl Address {
|
|||||||
self.0.header.family == packet::constants::AF_INET6 as u8
|
self.0.header.family == packet::constants::AF_INET6 as u8
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
fn prefix(&self) -> u8 {
|
fn prefix(&self) -> u8 {
|
||||||
self.0.header.prefix_len
|
self.0.header.prefix_len
|
||||||
}
|
}
|
||||||
|
@ -150,14 +150,6 @@ impl Sandbox {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_running(&self) -> bool {
|
|
||||||
self.running
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn set_hostname(&mut self, hostname: String) {
|
|
||||||
self.hostname = hostname;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn setup_shared_namespaces(&mut self) -> Result<bool> {
|
pub async fn setup_shared_namespaces(&mut self) -> Result<bool> {
|
||||||
// Set up shared IPC namespace
|
// Set up shared IPC namespace
|
||||||
self.shared_ipcns = Namespace::new(&self.logger)
|
self.shared_ipcns = Namespace::new(&self.logger)
|
||||||
@ -732,25 +724,6 @@ mod tests {
|
|||||||
assert!(s.hooks.as_ref().unwrap().poststop.is_empty());
|
assert!(s.hooks.as_ref().unwrap().poststop.is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
|
||||||
async fn test_sandbox_is_running() {
|
|
||||||
let logger = slog::Logger::root(slog::Discard, o!());
|
|
||||||
let mut s = Sandbox::new(&logger).unwrap();
|
|
||||||
s.running = true;
|
|
||||||
assert!(s.is_running());
|
|
||||||
s.running = false;
|
|
||||||
assert!(!s.is_running());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tokio::test]
|
|
||||||
async fn test_sandbox_set_hostname() {
|
|
||||||
let logger = slog::Logger::root(slog::Discard, o!());
|
|
||||||
let mut s = Sandbox::new(&logger).unwrap();
|
|
||||||
let hostname = "abc123";
|
|
||||||
s.set_hostname(hostname.to_string());
|
|
||||||
assert_eq!(s.hostname, hostname);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_sandbox_set_destroy() {
|
async fn test_sandbox_set_destroy() {
|
||||||
let logger = slog::Logger::root(slog::Discard, o!());
|
let logger = slog::Logger::root(slog::Discard, o!());
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
// WARNING: This file is auto-generated - DO NOT EDIT!
|
// WARNING: This file is auto-generated - DO NOT EDIT!
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
pub const AGENT_VERSION: &str = "@AGENT_VERSION@";
|
pub const AGENT_VERSION: &str = "@AGENT_VERSION@";
|
||||||
pub const API_VERSION: &str = "@API_VERSION@";
|
pub const API_VERSION: &str = "@API_VERSION@";
|
||||||
pub const VERSION_COMMIT: &str = "@VERSION_COMMIT@";
|
pub const VERSION_COMMIT: &str = "@VERSION_COMMIT@";
|
||||||
|
Loading…
Reference in New Issue
Block a user