mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vhost_user_*: Create a vhost::Listener in advance
Changes is vhost crate require VhostUserDaemon users to create and provide a vhost::Listener in advance. This allows us to adopt sandboxing strategies in the future, by being able to create the UNIX socket before switching to a restricted namespace. Update also the reference to vhost crate in Cargo.lock to point to the latest commit from the dragonball branch. Signed-off-by: Sergio Lopez <slp@redhat.com>
This commit is contained in:
committed by
Sebastien Boeuf
parent
fa844865a5
commit
c4bf383fd7
@@ -19,7 +19,7 @@ use std::sync::{Arc, Mutex, RwLock};
|
||||
use std::{convert, error, fmt, io, process};
|
||||
|
||||
use vhost_rs::vhost_user::message::*;
|
||||
use vhost_rs::vhost_user::SlaveFsCacheReq;
|
||||
use vhost_rs::vhost_user::{Listener, SlaveFsCacheReq};
|
||||
use vhost_user_backend::{VhostUserBackend, VhostUserDaemon, Vring};
|
||||
use vhost_user_fs::descriptor_utils::Error as VufDescriptorError;
|
||||
use vhost_user_fs::descriptor_utils::{Reader, Writer};
|
||||
@@ -325,8 +325,7 @@ fn main() {
|
||||
};
|
||||
let xattr: bool = !cmd_arguments.is_present("disable-xattr");
|
||||
|
||||
// Convert into appropriate types
|
||||
let sock = String::from(sock);
|
||||
let listener = Listener::new(sock, true).unwrap();
|
||||
|
||||
let fs_cfg = passthrough::Config {
|
||||
root_dir: shared_dir.to_string(),
|
||||
@@ -338,14 +337,10 @@ fn main() {
|
||||
VhostUserFsBackend::new(fs, thread_pool_size).unwrap(),
|
||||
));
|
||||
|
||||
let mut daemon = VhostUserDaemon::new(
|
||||
String::from("vhost-user-fs-backend"),
|
||||
sock,
|
||||
fs_backend.clone(),
|
||||
)
|
||||
.unwrap();
|
||||
let mut daemon =
|
||||
VhostUserDaemon::new(String::from("vhost-user-fs-backend"), fs_backend.clone()).unwrap();
|
||||
|
||||
if let Err(e) = daemon.start() {
|
||||
if let Err(e) = daemon.start(listener) {
|
||||
error!("Failed to start daemon: {:?}", e);
|
||||
process::exit(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user