mirror of
https://github.com/unraid/webgui.git
synced 2026-02-26 12:18:56 -06:00
Disable input if Virtual.
Add Support for OtherPCI Devices
This commit is contained in:
@@ -733,6 +733,11 @@
|
||||
$pcidevs='';
|
||||
$gpudevs_used=[];
|
||||
$multidevices = $multi = [] ; #Load?
|
||||
foreach ($gpus as $i => $gpu) {
|
||||
if ($gpu['guestbus'] != "") $multi[$gpu['guestbus']] = $gpu['guestbus'] ;
|
||||
#$multi[$gpu['guestbus']] = $gpu['guestbus'] ;
|
||||
}
|
||||
ksort($multi) ;
|
||||
$vmrc='';
|
||||
$channelscopypaste = '';
|
||||
if (!empty($gpus)) {
|
||||
@@ -838,8 +843,7 @@
|
||||
if ($gpu['multi'] == "on"){
|
||||
if ($gpu['guestbus'] == "") {
|
||||
# This is a new Multifunction device/VM allocate from range 0x90
|
||||
$multibus = array_key_last($multi) ;
|
||||
file_put_contents("/tmp/mbus", $multibus) ;
|
||||
$multibus = array_key_last($multi) ;
|
||||
if ($multibus == NULL) $multi_bus = "0x90" ;
|
||||
else
|
||||
{
|
||||
@@ -897,6 +901,7 @@
|
||||
}
|
||||
|
||||
$pcidevs_used=[];
|
||||
$strSpecialAddressOther = "" ;
|
||||
if (!empty($pcis)) {
|
||||
foreach ($pcis as $i => $pci_id) {
|
||||
// Skip duplicate other pci devices
|
||||
@@ -905,12 +910,18 @@
|
||||
}
|
||||
if ($vmclone) [$pci_bus, $pci_slot, $pci_function] = my_explode(":", str_replace('.', ':', $pci_id['id']), 3);
|
||||
else [$pci_bus, $pci_slot, $pci_function] = my_explode(":", str_replace('.', ':', $pci_id), 3);
|
||||
|
||||
if ($pci_function != 0) {
|
||||
if (isset($multidevices[$pci_bus])) $strSpecialAddressOther = "<address type='pci' domain='0x0000' bus='".$multidevices[$pci_bus]."' slot='0x".$pci_slot."' function='0x".$pci_function."' />" ;
|
||||
}
|
||||
|
||||
$pcidevs .= "<hostdev mode='subsystem' type='pci' managed='yes'>
|
||||
<driver name='vfio'/>
|
||||
<source>
|
||||
<address domain='0x0000' bus='0x" . $pci_bus . "' slot='0x" . $pci_slot . "' function='0x" . $pci_function . "'/>
|
||||
</source>" ;
|
||||
</source>
|
||||
$strSpecialAddressOther " ;
|
||||
|
||||
if (!empty($pciboot[$pci_id]) && !$vmclone) {
|
||||
$pcidevs .= "<boot order='".$pciboot[$pci_id]."'/>" ;
|
||||
}
|
||||
|
||||
@@ -986,18 +986,17 @@
|
||||
?>
|
||||
</select>
|
||||
<?
|
||||
#$multifunction = "hidden" ;
|
||||
if ($arrGPU['id'] != 'virtual') $multifunction = "" ;
|
||||
if ($arrGPU['id'] != 'virtual') $multifunction = "" ; else $multifunction = " disabled " ;
|
||||
?>
|
||||
<span id="GPUMulti" name="gpu[<?=$i?>][multi]" <?=$multifunction?>>_(Multifunction)_:</span>
|
||||
<span id="GPUMulti<?=$i?>" name="gpu[<?=$i?>][multi]" class="<?if ($arrGPU['id'] != 'virtual') echo 'was';?>advanced gpumultiline<?=$i?>" >_(Multifunction)_:</span>
|
||||
|
||||
<select name="gpu[<?=$i?>][multi]" class="narrow" title="_(define Multifunctiion Support)_" <?=$multifunction?> >
|
||||
<select id="GPUMultiSel<?=$i?>" name="gpu[<?=$i?>][multi]" class="<?if ($arrGPU['id'] != 'virtual') echo 'was';?>advanced narrow gpumultiselect<?=$i?>" title="_(define Multifunctiion Support)_" <?=$multifunction?> >
|
||||
<?
|
||||
echo mk_option($arrGPU['guest']['multi'], 'off', 'Off');
|
||||
echo mk_option($arrGPU['guest']['multi'], 'on', 'On');
|
||||
?>
|
||||
</select>
|
||||
<input type="hidden" name="gpu[<?=$i?>][guestbus]" id="gpuguest" value="<?=htmlspecialchars($arrGPU['guest']["bus"])?>">
|
||||
<input type="hidden" name="gpu[<?=$i?>][guestbus]" id="gpuguest<?=$i?>" value="<?=htmlspecialchars($arrGPU['guest']["bus"])?>">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1143,8 +1142,8 @@
|
||||
|
||||
<select name="gpu[{{INDEX}}][multi]" class="narrow" title="_(define Multifunctiion Support)_" <?=$multifunction?> >
|
||||
<?
|
||||
echo mk_option($arrGPU['guest']['multi'], 'off', 'Off');
|
||||
echo mk_option($arrGPU['guest']['multi'], 'on', 'On');
|
||||
echo mk_option("off", 'off', 'Off');
|
||||
echo mk_option("off", 'on', 'On');
|
||||
?>
|
||||
</select>
|
||||
<input type="hidden" name="gpu[{{INDEX}}][guestbus]" id="gpuguest" value="">
|
||||
@@ -1851,9 +1850,13 @@ $(function() {
|
||||
if (myvalue == 'virtual') {
|
||||
$vnc_sections.filter('.wasadvanced').removeClass('wasadvanced').addClass('advanced');
|
||||
slideDownRows($vnc_sections.not(isVMAdvancedMode() ? '.basic' : '.advanced'));
|
||||
var MultiSel = document.getElementById("GPUMultiSel0") ;
|
||||
MultiSel.disabled = true ;
|
||||
} else {
|
||||
slideUpRows($vnc_sections);
|
||||
$vnc_sections.filter('.advanced').removeClass('advanced').addClass('wasadvanced');
|
||||
var MultiSel = document.getElementById("GPUMultiSel0") ;
|
||||
MultiSel.disabled = false ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user