|
1 | 1 | 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 | +}; |
6 | 5 | 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}; |
10 | 7 | use hyper_util::rt::TokioIo; |
11 | 8 | 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; |
26 | 11 | 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}; |
29 | 13 | use std::{fmt::Debug, io, path::PathBuf, time}; |
30 | | -use tar::Archive; |
31 | 14 | use tokio::io::{AsyncReadExt, AsyncWriteExt}; |
32 | 15 | use tokio::net::UnixStream; |
33 | | -use tokio::spawn; |
34 | | -use tokio::sync::mpsc; |
35 | 16 | use tonic::transport::{Channel, Endpoint, Uri}; |
36 | 17 | use tonic::{Request, Response, Status}; |
37 | 18 | use tower::service_fn; |
@@ -255,7 +236,6 @@ impl IsolatedContainerService for IsolatedContainerAPI { |
255 | 236 | ) -> Result<Response<isolated_container_service::StopContainerResponse>, Status> { |
256 | 237 | info!("Got stop_container request"); |
257 | 238 |
|
258 | | - |
259 | 239 | let container_id: String = request.get_ref().uuid.clone(); |
260 | 240 | let container_id = Uuid::parse_str(&container_id) |
261 | 241 | .map_err(|_| Status::invalid_argument("failed to parse uuid"))?; |
@@ -301,15 +281,14 @@ impl IsolatedContainerService for IsolatedContainerAPI { |
301 | 281 | let channel = get_channel(path).await.expect("abc"); |
302 | 282 |
|
303 | 283 | let mut client = ContainerServiceClient::new(channel); |
304 | | - let request = tonic::Request::new( StateContainerRequest { |
| 284 | + let request = tonic::Request::new(StateContainerRequest { |
305 | 285 | uuid: container_id.to_string(), |
306 | 286 | }); |
307 | 287 | let response = client.state_container(request).await?; |
308 | 288 |
|
309 | | - |
310 | 289 | Ok(Response::new( |
311 | 290 | isolated_container_service::StateContainerResponse { |
312 | | - state: response.get_ref().state.to_string(), |
| 291 | + state: response.get_ref().state.to_string(), |
313 | 292 | pid: response.get_ref().pid, |
314 | 293 | }, |
315 | 294 | )) |
|
0 commit comments