MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / prepare_vubd

Function prepare_vubd

cloud-hypervisor/tests/common/utils.rs:140–171  ·  view source on GitHub ↗
(
    tmp_dir: &TempDir,
    blk_img: &str,
    num_queues: usize,
    rdonly: bool,
    direct: bool,
)

Source from the content-addressed store, hash-verified

138}
139
140pub(crate) fn prepare_vubd(
141 tmp_dir: &TempDir,
142 blk_img: &str,
143 num_queues: usize,
144 rdonly: bool,
145 direct: bool,
146) -> (std::process::Child, String) {
147 let mut workload_path = dirs::home_dir().unwrap();
148 workload_path.push("workloads");
149
150 let mut blk_file_path = workload_path;
151 blk_file_path.push(blk_img);
152 let blk_file_path = String::from(blk_file_path.to_str().unwrap());
153
154 let vubd_socket_path = String::from(tmp_dir.as_path().join("vub.sock").to_str().unwrap());
155
156 // Start the daemon
157 let child = Command::new(clh_command("vhost_user_block"))
158 .args([
159 "--block-backend",
160 format!(
161 "path={blk_file_path},socket={vubd_socket_path},num_queues={num_queues},readonly={rdonly},direct={direct}"
162 )
163 .as_str(),
164 ])
165 .spawn()
166 .unwrap();
167
168 thread::sleep(std::time::Duration::new(10, 0));
169
170 (child, vubd_socket_path)
171}
172
173pub(crate) fn temp_vsock_path(tmp_dir: &TempDir) -> String {
174 String::from(tmp_dir.as_path().join("vsock").to_str().unwrap())

Callers

nothing calls this directly

Calls 5

newFunction · 0.85
clh_commandFunction · 0.85
spawnMethod · 0.80
argsMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected