dracut/0208-no_forced_virtnet.patch
2016-01-26 16:36:55 +00:00

63 lines
2.1 KiB
Diff

From: Fabian Vogt <fvogt@suse.com>
Subject: Don't include qemu network modules without reason
virtio-net without other network tools does not make sense
and causes various bugs, like bsc#960669.
---
modules.d/90kernel-network-modules/module-setup.sh | 24 ++++++++++++++++++++-
modules.d/90qemu-net/module-setup.sh | 1
2 files changed, 24 insertions(+), 1 deletion(-)
Index: dracut-044/modules.d/90kernel-network-modules/module-setup.sh
===================================================================
--- dracut-044.orig/modules.d/90kernel-network-modules/module-setup.sh
+++ dracut-044/modules.d/90kernel-network-modules/module-setup.sh
@@ -10,6 +10,25 @@ depends() {
return 0
}
+running_in_qemu() {
+ if type -P systemd-detect-virt >/dev/null 2>&1; then
+ vm=$(systemd-detect-virt --vm >/dev/null 2>&1)
+ (($? != 0)) && return 255
+ [[ $vm = "qemu" ]] && return 0
+ [[ $vm = "kvm" ]] && return 0
+ [[ $vm = "bochs" ]] && return 0
+ fi
+
+ for i in /sys/class/dmi/id/*_vendor; do
+ [[ -f $i ]] || continue
+ read vendor < $i
+ [[ "$vendor" == "QEMU" ]] && return 0
+ [[ "$vendor" == "Bochs" ]] && return 0
+ done
+
+ return 255
+}
+
# called by dracut
installkernel() {
# Include wired net drivers, excluding wireless
@@ -63,6 +82,8 @@ installkernel() {
=drivers/net/ethernet \
ecb arc4 bridge stp llc ipv6 bonding 8021q af_packet virtio_net xennet
hostonly="" instmods iscsi_ibft crc32c iscsi_boot_sysfs
+
+ running_in_qemu && hostonly='' instmods virtio_net e1000 8139cp pcnet32 e100 ne2k_pci
}
# called by dracut
Index: dracut-044/modules.d/90qemu-net/module-setup.sh
===================================================================
--- dracut-044.orig/modules.d/90qemu-net/module-setup.sh
+++ dracut-044/modules.d/90qemu-net/module-setup.sh
@@ -2,6 +2,7 @@
# called by dracut
check() {
+ return 255
if type -P systemd-detect-virt >/dev/null 2>&1; then
vm=$(systemd-detect-virt --vm >/dev/null 2>&1)
(($? != 0)) && return 255