From d55913426b0f26d8c586bc1fdd0e4cdb73d77777 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Mon, 21 Mar 2022 14:01:07 +0000 Subject: host/rootfs: remove unnecessary modprobes Now that we're using a proper modprobe implementation, some of these weird modprobes we shouldn't have needed in the first place can actually be removed. Message-Id: <20220321140107.1043654-2-hi@alyssa.is> Tested-by: Ville Ilvonen --- host/rootfs/etc/mdev/net/add | 5 +---- host/start-vm/modprobe.rs | 49 -------------------------------------------- host/start-vm/start-vm.rs | 4 ---- 3 files changed, 1 insertion(+), 57 deletions(-) delete mode 100644 host/start-vm/modprobe.rs diff --git a/host/rootfs/etc/mdev/net/add b/host/rootfs/etc/mdev/net/add index 959d73a..7b282e7 100755 --- a/host/rootfs/etc/mdev/net/add +++ b/host/rootfs/etc/mdev/net/add @@ -5,10 +5,7 @@ # Assign the whole IOMMU group containing this device to the network # VM. -if { - forx -pE module { vfio-pci vfio_iommu_type1 } - modprobe $module -} +if { modprobe vfio-pci } importas -i devpath DEVPATH diff --git a/host/start-vm/modprobe.rs b/host/start-vm/modprobe.rs deleted file mode 100644 index 6186820..0000000 --- a/host/start-vm/modprobe.rs +++ /dev/null @@ -1,49 +0,0 @@ -// SPDX-License-Identifier: EUPL-1.2 -// SPDX-FileCopyrightText: 2022 Alyssa Ross - -use std::ffi::OsStr; -use std::fmt::{self, Display, Formatter}; -use std::io; -use std::os::unix::prelude::*; -use std::process::{Command, ExitStatus}; - -#[derive(Debug)] -pub enum ModprobeError { - Spawn(io::Error), - Fail(ExitStatus), -} - -impl Display for ModprobeError { - fn fmt(&self, f: &mut Formatter) -> fmt::Result { - use ModprobeError::*; - match self { - Spawn(e) => write!(f, "failed to spawn modprobe: {}", e), - Fail(status) => { - if let Some(code) = status.code() { - write!(f, "modprobe exited with status {}", code) - } else { - write!(f, "modprobe killed by signal {}", status.signal().unwrap()) - } - } - } - } -} - -pub fn modprobe(module_names: I) -> Result<(), ModprobeError> -where - I: IntoIterator, - S: AsRef, -{ - let status = Command::new("modprobe") - .arg("-q") - .arg("--") - .args(module_names) - .status() - .map_err(ModprobeError::Spawn)?; - - if status.success() { - Ok(()) - } else { - Err(ModprobeError::Fail(status)) - } -} diff --git a/host/start-vm/start-vm.rs b/host/start-vm/start-vm.rs index becbe5c..0d08eaa 100644 --- a/host/start-vm/start-vm.rs +++ b/host/start-vm/start-vm.rs @@ -2,7 +2,6 @@ // SPDX-FileCopyrightText: 2022 Alyssa Ross mod ch; -mod modprobe; mod net; use std::env::{args, current_dir}; @@ -12,7 +11,6 @@ use std::os::unix::prelude::*; use std::path::PathBuf; use std::process::{exit, Command}; -use modprobe::modprobe; use net::{format_mac, net_setup, NetConfig}; macro_rules! errx { @@ -30,8 +28,6 @@ macro_rules! err { } fn main() { - modprobe(&["kvm-intel"]).unwrap_or_else(err!(1, "modprobe kvm-intel")); - let mut command = Command::new("s6-notifyoncheck"); command.args(&["-dc", "test -S env/cloud-hypervisor.sock"]); command.arg("cloud-hypervisor"); -- cgit 1.4.1