Skip to content

Commit f83a23d

Browse files
committed
Remove not used deps
1 parent 9433173 commit f83a23d

File tree

4 files changed

+19
-64
lines changed

4 files changed

+19
-64
lines changed

src/daemon.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use log::{debug, error, info, warn};
1+
use log::{error, info, warn};
22
use std::net::Ipv6Addr;
33
use std::path::PathBuf;
44
use std::{env, io};
@@ -15,22 +15,18 @@ use crate::feos_grpc::{
1515
ShutdownVmRequest, ShutdownVmResponse,
1616
};
1717
use crate::host;
18-
use crate::isolated_container;
19-
use crate::radv::start_radv_server;
2018
use crate::ringbuffer::*;
2119
use crate::vm::{self};
2220
use crate::vm::{image, Manager};
2321
use crate::{container, network};
2422
use hyper_util::rt::TokioIo;
2523
use nix::libc::VMADDR_CID_ANY;
2624
use nix::unistd::Uid;
27-
use rtnetlink::new_connection;
2825
use std::sync::Arc;
2926
use tokio::fs::File;
3027
use tokio::io::AsyncReadExt;
3128
use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
3229
use tokio::net::UnixStream;
33-
use tokio::spawn;
3430
use tokio::sync::{mpsc, Mutex};
3531
use tokio::time::{sleep, Duration};
3632
use tokio_stream::wrappers::ReceiverStream;

src/isolated_container/mod.rs

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,18 @@
11
use crate::container::container_service::container_service_client::ContainerServiceClient;
2-
use crate::container::container_service::{CreateContainerRequest, RunContainerRequest, StateContainerRequest};
3-
use crate::daemon::FeOSAPI;
4-
use crate::feos_grpc::Empty;
5-
use crate::ringbuffer::RingBuffer;
2+
use crate::container::container_service::{
3+
CreateContainerRequest, RunContainerRequest, StateContainerRequest,
4+
};
65
use crate::vm::{Error, NetworkMode};
7-
use crate::{container, feos_grpc, network, vm};
8-
use flate2::read::GzDecoder;
9-
use futures::channel;
6+
use crate::{network, vm};
107
use hyper_util::rt::TokioIo;
118
use isolated_container_service::isolated_container_service_server::IsolatedContainerService;
12-
use libcontainer::container::builder::ContainerBuilder;
13-
use libcontainer::container::Container;
14-
use libcontainer::oci_spec::runtime::{LinuxNamespace, Mount, Spec};
15-
use libcontainer::signal::Signal;
16-
use libcontainer::syscall::syscall::SyscallType;
17-
use libcontainer::workload::default::DefaultExecutor;
18-
use log::{debug, error, info};
19-
use rtnetlink::new_connection;
20-
use serde_json::to_writer_pretty;
21-
use std::fs;
22-
use std::fs::File;
23-
use std::io::BufReader;
24-
use std::io::{BufWriter, Write};
25-
use std::path::Path;
9+
use log::info;
10+
use std::io::Write;
2611
use std::sync::Arc;
27-
use std::thread::sleep;
28-
use std::{collections::HashMap, num::TryFromIntError, sync::Mutex};
12+
use std::{collections::HashMap, sync::Mutex};
2913
use std::{fmt::Debug, io, path::PathBuf, time};
30-
use tar::Archive;
3114
use tokio::io::{AsyncReadExt, AsyncWriteExt};
3215
use tokio::net::UnixStream;
33-
use tokio::spawn;
34-
use tokio::sync::mpsc;
3516
use tonic::transport::{Channel, Endpoint, Uri};
3617
use tonic::{Request, Response, Status};
3718
use tower::service_fn;
@@ -255,7 +236,6 @@ impl IsolatedContainerService for IsolatedContainerAPI {
255236
) -> Result<Response<isolated_container_service::StopContainerResponse>, Status> {
256237
info!("Got stop_container request");
257238

258-
259239
let container_id: String = request.get_ref().uuid.clone();
260240
let container_id = Uuid::parse_str(&container_id)
261241
.map_err(|_| Status::invalid_argument("failed to parse uuid"))?;
@@ -301,15 +281,14 @@ impl IsolatedContainerService for IsolatedContainerAPI {
301281
let channel = get_channel(path).await.expect("abc");
302282

303283
let mut client = ContainerServiceClient::new(channel);
304-
let request = tonic::Request::new( StateContainerRequest {
284+
let request = tonic::Request::new(StateContainerRequest {
305285
uuid: container_id.to_string(),
306286
});
307287
let response = client.state_container(request).await?;
308288

309-
310289
Ok(Response::new(
311290
isolated_container_service::StateContainerResponse {
312-
state: response.get_ref().state.to_string(),
291+
state: response.get_ref().state.to_string(),
313292
pid: response.get_ref().pid,
314293
},
315294
))

src/network/mod.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
1-
use log::{debug, error, info, warn};
2-
use netlink_packet_route::link::LinkMessage;
3-
use nix::net::if_::if_nametoindex;
1+
use log::{debug, error, info};
42
use rtnetlink::new_connection;
53
use std::collections::HashMap;
64
use std::net::Ipv6Addr;
7-
use std::num::TryFromIntError;
8-
use std::path::Path;
9-
use std::process::Child;
105
use std::sync::atomic::{AtomicU16, Ordering};
116
use std::sync::{Arc, Mutex};
12-
use tokio::fs::{read_link, OpenOptions};
137
use tokio::spawn;
148
use tokio::task::JoinHandle;
15-
use tokio::time::sleep;
16-
use tonic::Status;
179
use uuid::Uuid;
1810

1911
pub mod dhcpv6;
@@ -81,7 +73,7 @@ impl Manager {
8173

8274
pub async fn stop_dhcp(&self, id: Uuid) -> Result<(), Error> {
8375
let mut instances = self.instances.lock().unwrap();
84-
if let Some(handle) = instances.remove(&id) {
76+
if let Some(handle) = instances.remove(&id) {
8577
handle.radv_handle.abort();
8678
handle.dhcpv6_handle.abort();
8779
}

src/vm/mod.rs

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use log::{error, info};
1+
use log::info;
22
use serde_json::json;
33
use std::{
44
collections::HashMap,
@@ -14,22 +14,13 @@ use uuid::Uuid;
1414
use vmm::vm_config;
1515

1616
use vmm::config::{
17-
ConsoleConfig, ConsoleOutputMode, CpusConfig, DiskConfig, MemoryConfig, NetConfig,
18-
PayloadConfig, PlatformConfig, VsockConfig,
17+
ConsoleConfig, ConsoleOutputMode, CpusConfig, DiskConfig, MemoryConfig, PayloadConfig,
18+
PlatformConfig, VsockConfig,
1919
};
2020

2121
use net_util::MacAddr;
2222

2323
use crate::network;
24-
use pelite::pe64::{Pe, PeFile};
25-
use std::fs;
26-
use std::fs::{create_dir_all, File};
27-
use std::io::{self, Write};
28-
use std::net::Ipv6Addr;
29-
use std::sync::atomic::{AtomicU16, Ordering};
30-
use std::sync::Arc;
31-
use thiserror::Error;
32-
use tokio::task::JoinHandle;
3324

3425
pub mod config;
3526
pub mod image;
@@ -197,7 +188,7 @@ impl Manager {
197188
// ..config::_default_net_cfg()
198189
// }]);
199190

200-
if disks.len() != 0 {
191+
if !disks.is_empty() {
201192
vm_config.disks = Some(disks);
202193
}
203194

@@ -281,7 +272,7 @@ impl Manager {
281272

282273
let mut socket = UnixStream::connect(id.to_string()).map_err(Error::SocketFailure)?;
283274

284-
let mut request: (String, String);
275+
let request: (String, String);
285276

286277
match config {
287278
NetworkMode::PCIAddress(pci) => {
@@ -334,7 +325,7 @@ impl Manager {
334325
)
335326
}
336327

337-
return Ok(());
328+
Ok(())
338329
}
339330

340331
pub fn ping_vmm(&self, id: Uuid) -> Result<(), Error> {
@@ -396,23 +387,20 @@ impl Manager {
396387
info!("shutdown vm: id {}, response: {}", id, x);
397388
}
398389

399-
400390
let response = api_client::simple_api_full_command_and_response(
401391
&mut socket,
402392
"PUT",
403393
"vmm.shutdown",
404394
None,
405395
)
406-
.map_err(Error::CHApiFailure)?;
396+
.map_err(Error::CHApiFailure)?;
407397

408398
if let Some(x) = &response {
409399
info!("shutdown vmm: id {}, response: {}", id, x);
410400
}
411401

412-
413402
vms.remove(&id);
414403

415404
Ok(String::new())
416405
}
417406
}
418-

0 commit comments

Comments
 (0)