From 93cca46c26c2078593f663f894193053cc740d43 Mon Sep 17 00:00:00 2001 From: Arnaud Patard Date: Fri, 7 Dec 2012 13:58:36 +0000 Subject: - Add support to detect if we're running in Hyper-V vm and automatically load storage driver when probing disks in this case. --- perl-install/detect_devices.pm | 6 ++++++ perl-install/modules.pm | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'perl-install') diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index 6ba852fec..a0c6a8c23 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -1154,6 +1154,11 @@ sub isServer() { || (any { $_->{'model name'} =~ /(Xeon|Opteron)/i } getCPUs()); } +sub isHyperv() { + dmidecode_category('System')->{'Manufacturer'} =~ /Microsoft Corporation/i + && dmidecode_category('System')->{'Product Name'} =~ /Virtual Machine/i +} + sub BIGMEM() { arch() !~ /x86_64|ia64/ && $> == 0 && dmi_detect_memory() > 4 * 1024; } @@ -1231,6 +1236,7 @@ sub matching_types() { mips_ict => is_mips_ict(), mips_st_ls2f => is_mips_st_ls2f(), laptop => isLaptop(), + hyperv => isHyperv(), 'numpad' => hasNumpad(), 'touchpad' => hasTouchpad(), '64bit' => to_bool(arch() =~ /64/), diff --git a/perl-install/modules.pm b/perl-install/modules.pm index 6014c6dc6..ddcfc0268 100644 --- a/perl-install/modules.pm +++ b/perl-install/modules.pm @@ -277,8 +277,13 @@ sub when_load_category { if ($category =~ m,disk/ide,) { $conf->add_probeall('ide-controller', $name); eval { load('ide_gd_mod') }; - } elsif ($category =~ m,disk/(scsi|hardware_raid|sata|firewire),) { + } elsif ($category =~ m,disk/(scsi|hardware_raid|sata|firewire|virtual),) { $conf->add_probeall('scsi_hostadapter', $name); + if (detect_devices::isHyperv()) { + log::l("HyperV detected. Loading storvsc"); + load('hv_vmbus'); + load('hv_storvsc'); + } eval { load('sd_mod') }; } elsif ($category eq 'bus/usb') { $conf->add_probeall('usb-interface', $name); -- cgit v1.2.1