Add Hyper-V support to system_identify_specific_platform, and disable S.M.A.R.T. actions in Hyper-V guests. Ticket #6147

This commit is contained in:
Chris Buechler 2016-04-23 02:52:09 -05:00
parent 2605e6d75d
commit b4594d39ab
3 changed files with 25 additions and 4 deletions

View File

@ -2170,9 +2170,11 @@ function system_identify_specific_platform() {
$hw_model = get_single_sysctl('hw.model');
/* Try to guess from smbios strings */
unset($output);
$_gb = exec('/bin/kenv smbios.system.product 2>/dev/null', $output);
switch ($output[0]) {
unset($product);
unset($maker);
$_gb = exec('/bin/kenv smbios.system.product 2>/dev/null', $product);
$_gb = exec('/bin/kenv smbios.system.maker 2>/dev/null', $maker);
switch ($product[0]) {
case 'FW7541':
return (array('name' => 'FW7541', 'descr' => 'Netgate FW7541'));
break;
@ -2212,6 +2214,11 @@ function system_identify_specific_platform() {
case 'SYS-5018D-FN4T':
return (array('name' => 'XG-1540', 'descr' => 'Super Micro XG-1540'));
break;
case 'Virtual Machine':
if ($maker[0] == "Microsoft Corporation") {
return (array('name' => 'Hyper-V', 'descr' => 'Hyper-V Virtual Machine'));
}
break;
}
/* the rest of the code only deals with 'embedded' platforms */

View File

@ -126,6 +126,13 @@ $tab_array[0] = array(htmlspecialchars(gettext("Information & Tests")), ($action
$tab_array[1] = array(gettext("Config"), ($action == 'config'), $_SERVER['PHP_SELF'] . "?action=config");
display_top_tabs($tab_array);
$specplatform = system_identify_specific_platform();
if ($specplatform['name'] == "Hyper-V") {
echo gettext("S.M.A.R.T. is not supported in Hyper-V guests.");
include("foot.inc");
exit;
}
switch ($action) {
// Testing devices
case 'test':

View File

@ -61,6 +61,11 @@ require_once("guiconfig.inc");
require_once("pfsense-utils.inc");
require_once("functions.inc");
require_once("/usr/local/www/widgets/include/smart_status.inc");
$specplatform = system_identify_specific_platform();
if ($specplatform['name'] == "Hyper-V") {
exit;
}
?>
<table class="table table-striped table-hover">
@ -76,7 +81,9 @@ require_once("/usr/local/www/widgets/include/smart_status.inc");
<?php
$devs = array();
## Get all adX, daX, and adaX (IDE, SCSI, and AHCI) devices currently installed
$devs = get_smart_drive_list();
if ($specplatform['name'] != "Hyper-V") {
$devs = get_smart_drive_list();
}
if (count($devs) > 0) {
foreach ($devs as $dev) { ## for each found drive do