mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: remove unused mutex in api
This patch removes locks in VmCreate request and VmInfo response since we needn't use a lock here and should ensure that internal implementation is transparent to the runtime. Signed-off-by: Songqian Li <sionli@tencent.com>
This commit is contained in:
committed by
Rob Bradford
parent
7eb70730d1
commit
cc9899e09d
@@ -18,7 +18,6 @@ use micro_http::{Body, Method, Request, Response, StatusCode, Version};
|
||||
use std::fs::File;
|
||||
use std::os::unix::io::IntoRawFd;
|
||||
use std::sync::mpsc::Sender;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use vmm_sys_util::eventfd::EventFd;
|
||||
|
||||
// /api/v1/vm.create handler
|
||||
@@ -36,7 +35,7 @@ impl EndpointHandler for VmCreate {
|
||||
match &req.body {
|
||||
Some(body) => {
|
||||
// Deserialize into a VmConfig
|
||||
let mut vm_config: VmConfig = match serde_json::from_slice(body.raw())
|
||||
let mut vm_config: Box<VmConfig> = match serde_json::from_slice(body.raw())
|
||||
.map_err(HttpError::SerdeJsonDeserialize)
|
||||
{
|
||||
Ok(config) => config,
|
||||
@@ -53,7 +52,7 @@ impl EndpointHandler for VmCreate {
|
||||
}
|
||||
|
||||
match crate::api::VmCreate
|
||||
.send(api_notifier, api_sender, Arc::new(Mutex::new(vm_config)))
|
||||
.send(api_notifier, api_sender, vm_config)
|
||||
.map_err(HttpError::ApiError)
|
||||
{
|
||||
Ok(_) => Response::new(Version::Http11, StatusCode::NoContent),
|
||||
|
||||
Reference in New Issue
Block a user