Merge pull request #382 from bergware/master

Miscellaneous fixes and updates
This commit is contained in:
tom mortensen
2018-09-12 12:37:01 -07:00
committed by GitHub
7 changed files with 49 additions and 33 deletions

View File

@@ -69,12 +69,12 @@ body{-webkit-overflow-scrolling:touch}
.advanced{display:none}
#winvirtio{display:none}
#download_status{margin-left:5px;color:#777;display:none}
#download_button{cursor:pointer;margin-left:-2px;color:#08C;font-size:14px;display:none;transform:translate(0px,2px)}
#download_button{cursor:pointer;margin-left:-2px;color:#08C;display:none;transform:translate(0px,2px)}
#download_button.fa-spin{cursor:default;color:#777}
#download_button span{font-size:14px;vertical-align:top}
#download_button.fa-spin span{display:none}
#remove_button{cursor:pointer;margin-left:-2px;color:#EF3D47;font-size:14px;display:none;transform:translate(0px,2px)}
#remove_button span{font-size:14px;vertical-align:top}
#download_button span{font-family:clear-sans}
#download_button.fa-spin span{font-family:clear-sans;display:none}
#remove_button{cursor:pointer;margin-left:-2px;color:#EF3D47;display:none;transform:translate(0px,2px)}
#remove_button span{font-family:clear-sans}
</style>
<span class="status vhshift"><input type="checkbox" class="advancedview"></span>
@@ -196,21 +196,21 @@ VM shutdown time-out:
> NOTE: It's recommended to shut down guest VMs from within the VM.
PCIe ACS override:
: <select id="pcie_acs_override" class="narrow">
: <select id="pcie_acs_override" class="narrow"<?=$safemode?' disabled':''?>>
<?= mk_option($pcie_acs_override, '', 'Disabled'); ?>
<?= mk_option($pcie_acs_override, 'downstream', 'Downstream'); ?>
<?= mk_option($pcie_acs_override, 'multifunction', 'Multifunction'); ?>
<?= mk_option($pcie_acs_override, 'downstream,multifunction', 'Both'); ?>
</select>
</select><?if($safemode):?><span>*Setting disabled in **safe mode***</span><?endif;?>
> Warning: Use of this setting could cause possible data corruption with certain hardware configurations. Please visit the Lime Technology forums for more information.
> A reboot will be required for changes to this setting to take affect.
VFIO allow unsafe interrupts:
: <select id="vfio_allow_unsafe" class="narrow">
: <select id="vfio_allow_unsafe" class="narrow"<?=$safemode?' disabled':''?>>
<?= mk_option($vfio_allow_unsafe, '', 'No'); ?>
<?= mk_option($vfio_allow_unsafe, '1', 'Yes'); ?>
</select>
</select><?if($safemode):?><span>*Setting disabled in **safe mode***</span><?endif;?>
> Warning: Use of this setting could cause possible data corruption with certain hardware configurations. Please visit the Lime Technology forums for more information.
> A reboot will be required for changes to this setting to take affect.
@@ -282,9 +282,13 @@ $(function(){
$("#removeForm").submit();
return;
}
<?if ($safemode):?>
$("#settingsForm").submit();
<?else:?>
$.post("/plugins/dynamix.vm.manager/include/VMajax.php", {action:'syslinux',pcie:$('#pcie_acs_override').val(),vfio:$('#vfio_allow_unsafe').val()}, function(data){
$("#settingsForm").submit();
});
<?endif;?>
});
$("#mediadir").on("input change", function(){

View File

@@ -1105,15 +1105,17 @@
if ($p2['bus'] && $p2['slot'] && $p2['function'] && $p2['bus']==$pci['bus'] && $p2['slot']==$pci['slot'] && $p2['function']==$function) unset($old['devices']['hostdev'][$k]);
}
}
// do not overwrite existing driver type settings
$disks = $new['devices']['disk'];
foreach ($disks as $key => $disk) unset($new['devices']['disk'][$key]['driver']['@attributes']['type']);
// preserve existing disk driver settings
foreach ($new['devices']['disk'] as $key => $disk) {
$source = $disk['source']['@attributes']['file'];
foreach ($old['devices']['disk'] as $k => $d) if ($source==$d['source']['@attributes']['file']) $new['devices']['disk'][$key]['driver']['@attributes'] = $d['driver']['@attributes'];
}
// settings not in the GUI, but maybe customized
unset($new['memoryBacking'], $new['clock'], $new['features']);
// update parent arrays
if (!$old['devices']['hostdev']) unset($old['devices']['hostdev']);
if (!$new['devices']['hostdev']) unset($new['devices']['hostdev']);
unset($old['cputune']['vcpupin'],$old['devices']['graphics'],$old['devices']['video']);
unset($old['cputune']['vcpupin'],$old['devices']['graphics'],$old['devices']['video'],$old['devices']['disk']);
// set namespace
$new['metadata']['vmtemplate']['@attributes']['xmlns'] = 'unraid';
}

View File

@@ -50,7 +50,8 @@ input.flat{margin:0}
input.lock{margin:0}
</style>
<script>
String.prototype.stripper = function(){return this.replace(/ |\(|\)|\[|\]/g,'');}
String.prototype.strip = function(){return this.replace(/ |\(|\)|\[|\]/g,'');}
String.prototype.encode = function(){return this.replace(/\./g,'%2e');}
function apply(form) {
// disable buttons
@@ -61,10 +62,10 @@ function apply(form) {
var id = $(form).prop('name');
var args = {};
args['id'] = id;
args['names'] = form.names.value;
args['names'] = form.names.value.encode();
// get the 'checked' cpus
$(form).find('input[type=checkbox]').each(function(){
if ($(this).prop('checked')) args[$(this).prop('name')] = 'on';
if ($(this).prop('checked')) args[$(this).prop('name').encode()] = 'on';
});
// show the instant wait message
$('#wait-'+id).show();
@@ -80,7 +81,7 @@ function apply(form) {
wait = data.length;
for (var i=0; i < data.length; i++) {
var name = data[i];
$('#'+id+'-'+name.stripper()).show('slow');
$('#'+id+'-'+name.strip()).show('slow');
// step 2: apply the changes by updating the vm or container
$.post('/webGui/include/UpdateTwo.php',{id:id,name:encodeURI(name)},function(reply){
if (reply.error) {
@@ -91,7 +92,7 @@ function apply(form) {
reset($('form[name="'+id+'"]'));
});
} else {
$('#'+id+'-'+reply.success.stripper()).hide('slow');
$('#'+id+'-'+reply.success.strip()).hide('slow');
// cleanup when all is done
if (!--wait) {
setTimeout(function(){$('#wait-'+id).hide();},500);

View File

@@ -92,8 +92,9 @@ function setGlue(form,reset) {
{glue:'' ,more:0,dev:0,type:''}, // scsi
{glue:',',more:1,dev:1,type:'',min1:0,max1:127}, // 3ware
{glue:',',more:3,dev:1,type:'',min1:0,max1:15,min2:0,max2:7,min3:0,max3:7}, // adaptec
{glue:',',more:1,dev:1,type:'',min1:1,max1:24}, // areca
{glue:'/',more:2,dev:1,type:'',min1:1,max1:128,min2:1,max2:8}, // areca
{glue:'/',more:3,dev:1,type:'',min1:1,max1:4,min2:1,max2:128,min3:1,max3:4}, // highpoint
{glue:'' ,more:1,dev:1,type:'',min1:0,max1:15}, // hp cciss
{glue:'' ,more:0,dev:0,type:''}, // marvell
{glue:',',more:1,dev:1,type:'',min1:0,max1:127} // megaraid
];
@@ -525,6 +526,7 @@ xfs_repair status:
<input type="hidden" name="#file" value="/boot/config/smart-one.cfg">
<input type="hidden" name="#include" value="webGui/include/update.smart.php">
<input type="hidden" name="#section" value="<?=htmlspecialchars($name)?>">
<input type="hidden" name="#cleanup" value="true">
<input type="hidden" name="smEvents" value="">
<input type="hidden" name="smGlue" value="<?=htmlspecialchars($var['smGlue'])?>">
SMART notification value:
@@ -566,6 +568,7 @@ SMART controller type:
<?=mk_option($disk['smType'], "-d aacraid", "Adaptec")?>
<?=mk_option($disk['smType'], "-d areca", "Areca")?>
<?=mk_option($disk['smType'], "-d hpt", "HighPoint")?>
<?=mk_option($disk['smType'], "-d cciss", "HP cciss")?>
<?=mk_option($disk['smType'], "-d marvell", "Marvell")?>
<?=mk_option($disk['smType'], "-d megaraid", "MegaRAID")?>
</select>

View File

@@ -226,6 +226,7 @@ Default critical disk temperature threshold (&deg;<?=$display['unit']?>):
<form markdown="1" name="smart_settings" method="POST" action="/update.php" target="progressFrame" onsubmit="prepareDiskSettings(this)">
<input type="hidden" name="#file" value="/boot/config/smart-all.cfg">
<input type="hidden" name="#include" value="webGui/include/update.smart.php">
<input type="hidden" name="#cleanup" value="true">
<input type="hidden" name="#top" value="1">
<input type="hidden" name="smEvents" value="">
<input type="hidden" name="smIndex" value="0">
@@ -256,17 +257,18 @@ Default SMART notification tolerance level:
Default SMART controller type:
: <select name="smType" size="1" onchange="setIndex(this.form)">
<?=mk_option($disk['smType'], "", "Automatic")?>
<?=mk_option($disk['smType'], "-d ata", "ATA")?>
<?=mk_option($disk['smType'], "-d nvme", "NVMe")?>
<?=mk_option($disk['smType'], "-d sat", "SAT")?>
<?=mk_option($disk['smType'], "-d scsi", "SCSI")?>
<?=mk_option($disk['smType'], "-d 3ware", "3Ware")?>
<?=mk_option($disk['smType'], "-d aacraid", "Adaptec")?>
<?=mk_option($disk['smType'], "-d areca", "Areca")?>
<?=mk_option($disk['smType'], "-d hpt", "HighPoint")?>
<?=mk_option($disk['smType'], "-d marvell", "Marvell")?>
<?=mk_option($disk['smType'], "-d megaraid", "MegaRAID")?>
<?=mk_option($var['smType'], "", "Automatic")?>
<?=mk_option($var['smType'], "-d ata", "ATA")?>
<?=mk_option($var['smType'], "-d nvme", "NVMe")?>
<?=mk_option($var['smType'], "-d sat", "SAT")?>
<?=mk_option($var['smType'], "-d scsi", "SCSI")?>
<?=mk_option($var['smType'], "-d 3ware", "3Ware")?>
<?=mk_option($var['smType'], "-d aacraid", "Adaptec")?>
<?=mk_option($var['smType'], "-d areca", "Areca")?>
<?=mk_option($var['smType'], "-d hpt", "HighPoint")?>
<?=mk_option($var['smType'], "-d cciss", "HP cciss")?>
<?=mk_option($var['smType'], "-d marvell", "Marvell")?>
<?=mk_option($var['smType'], "-d megaraid", "MegaRAID")?>
</select>
> By default automatic controller selection is done by smartctl to read the SMART information. Certain controllers however need specific settings for smartctl to work.

View File

@@ -11,14 +11,18 @@
*/
?>
<?
function decode($data) {
return str_replace('%2e','.',urldecode($data));
}
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$map = $changes = [];
foreach (array_map('urldecode',explode(';',$_POST['names'])) as $name) $map[$name] = '';
foreach (array_map('decode',explode(';',$_POST['names'])) as $name) $map[$name] = '';
foreach($_POST as $key => $val) {
if ($val != 'on') continue;
list($name,$cpu) = explode(':',$key);
$map[urldecode($name)] .= "$cpu,";
$map[decode($name)] .= "$cpu,";
}
// map holds the list of each vm, container or isolcpus and its newly proposed cpu assignments
$map = array_map(function($d){return substr($d,0,-1);},$map);

View File

@@ -27,7 +27,7 @@ if (isset($_POST['#apply'])) {
case 'W2' : $dotm = '8-14'; break;
case 'W3' : $dotm = '15-21'; break;
case 'W4' : $dotm = '22-28'; break;
case 'WL' : $dotm = '24-31'; break;
case 'WL' : $dotm = '*'; $term = '[[ $(date +%e -d +7days) -le 7 ]] && '; $echo = ' || :'; break;
}
$month = isset($_POST['month']) ? $_POST['month'] : '*';
$day = isset($_POST['day']) ? $_POST['day'] : '*';