INNER CODE UNIT · Rust
setup_scsi_debug_device
openebs/mayastor · io-engine-tests/src/lib.rs:234
pub fn setup_scsi_debug_device(dev_size_mb: u32) -> String {
let output = Command::new("sudo")
.args([
"modprobe",
"scsi_debug",
&format!("dev_size_mb={dev_size_mb}"),
])
.output()
.expect("failed exec modprobe scsi_debug");
assert!(output.status.success(), "{:#?}", output);
// Identify the /dev/sdX node scsi_debug just created by its fixed model
// string, rather than by name -- the name depends on what else is
// already attached. Poll briefly: the block device can appear a few
// milliseconds after modprobe returns.
for _ in 0..50 {
let output = Command::new("lsblk")
.args(["-d", "-n", "-o", "NAME,MODEL"])