VM Edit: added new qemu-xhci usb controller option; rearranged usb controller dropdown on vm edit page

This commit is contained in:
Eric Schultz
2018-03-08 00:32:10 -06:00
parent 2eefcdbb5b
commit 5e222e89d4
5 changed files with 83 additions and 67 deletions

View File

@@ -361,6 +361,12 @@
</controller>";
break;
case 'usb3-qemu':
$ctrl = "<controller type='usb' index='0' model='qemu-xhci'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</controller>";
break;
case 'usb2':
$ctrl = "<controller type='usb' index='0' model='ich9-ehci1'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x7'/>

View File

@@ -1056,6 +1056,13 @@
$medias = array_reverse($medias);
}
$strUSBMode = 'usb2';
if ($lv->_get_single_xpath_result($res, '//domain/devices/controller[@model=\'nec-xhci\']')) {
$strUSBMode = 'usb3';
} else if ($lv->_get_single_xpath_result($res, '//domain/devices/controller[@model=\'qemu-xhci\']')) {
$strUSBMode = 'usb3-qemu';
}
return [
'template' => $arrTemplateValues,
'domain' => [
@@ -1076,7 +1083,7 @@
'autostart' => ($lv->domain_get_autostart($res) ? 1 : 0),
'state' => $lv->domain_state_translate($dom['state']),
'ovmf' => ($lv->domain_get_ovmf($res) ? 1 : 0),
'usbmode' => ($lv->_get_single_xpath_result($res, '//domain/devices/controller[@model=\'nec-xhci\']') ? 'usb3' : 'usb2')
'usbmode' => $strUSBMode
],
'media' => [
'cdrom' => (!empty($medias) && !empty($medias[0]) && array_key_exists('file', $medias[0])) ? $medias[0]['file'] : '',

View File

@@ -455,6 +455,29 @@
</div>
</div>
<table>
<tr class="advanced">
<td>USB Controller:</td>
<td>
<select name="domain[usbmode]" id="usbmode" class="narrow" title="Select the USB Controller to emulate. Some OSes won't support USB3 (e.g. Windows 7/XP)">
<?php
echo mk_option($arrConfig['domain']['usbmode'], 'usb2', '2.0 (EHCI)');
echo mk_option($arrConfig['domain']['usbmode'], 'usb3', '3.0 (nec XHCI)');
echo mk_option($arrConfig['domain']['usbmode'], 'usb3-qemu', '3.0 (qemu XHCI)');
?>
</select>
</td>
</tr>
</table>
<div class="advanced">
<blockquote class="inline_help">
<p>
<b>USB Controller</b><br>
Select the USB Controller to emulate. Some OSes won't support USB3 (e.g. Windows 7). Qemu XHCI is the same code base as Nec XHCI but without several hacks applied over the years. Recommended to try qemu XHCI before resorting to nec XHCI.
</p>
</blockquote>
</div>
<table>
<tr>
<td>OS Install ISO:</td>
@@ -1023,28 +1046,6 @@
NOTE: USB hotplug support is not yet implemented, so devices must be attached before the VM is started to use them.</p>
</blockquote>
<table>
<tr class="advanced">
<td>USB Mode:</td>
<td>
<select name="domain[usbmode]" id="usbmode" class="narrow" title="Select the USB Mode to emulate. Some OSes won't support USB3 (e.g. Windows 7/XP)">
<?php
echo mk_option($arrConfig['domain']['usbmode'], 'usb2', '2.0 (EHCI)');
echo mk_option($arrConfig['domain']['usbmode'], 'usb3', '3.0 (XHCI)');
?>
</select>
</td>
</tr>
</table>
<div class="advanced">
<blockquote class="inline_help">
<p>
<b>USB Mode</b><br>
Select the USB Mode to emulate. Some OSes won't support USB3 (e.g. Windows 7).
</p>
</blockquote>
</div>
<table>
<tr>
<td>Other PCI Devices:</td>

View File

@@ -717,6 +717,29 @@
</blockquote>
</div>
<table>
<tr class="advanced">
<td>USB Controller:</td>
<td>
<select name="domain[usbmode]" id="usbmode" class="narrow" title="Select the USB Controller to emulate.">
<?php
echo mk_option($arrConfig['domain']['usbmode'], 'usb2', '2.0 (EHCI)');
echo mk_option($arrConfig['domain']['usbmode'], 'usb3', '3.0 (nec XHCI)');
echo mk_option($arrConfig['domain']['usbmode'], 'usb3-qemu', '3.0 (qemu XHCI)');
?>
</select>
</td>
</tr>
</table>
<div class="advanced">
<blockquote class="inline_help">
<p>
<b>USB Controller</b><br>
Select the USB Controller to emulate. Qemu XHCI is the same code base as Nec XHCI but without several hacks applied over the years. Recommended to try qemu XHCI before resorting to nec XHCI.
</p>
</blockquote>
</div>
<? foreach ($arrConfig['gpu'] as $i => $arrGPU) {
$strLabel = ($i > 0) ? appendOrdinalSuffix($i + 1) : '';
@@ -911,28 +934,6 @@
NOTE: USB hotplug support is not yet implemented, so devices must be attached before the VM is started to use them.</p>
</blockquote>
<table>
<tr class="advanced">
<td>USB Mode:</td>
<td>
<select name="domain[usbmode]" id="usbmode" class="narrow" title="Select the USB Mode to emulate.">
<?php
echo mk_option($arrConfig['domain']['usbmode'], 'usb2', '2.0 (EHCI)');
echo mk_option($arrConfig['domain']['usbmode'], 'usb3', '3.0 (XHCI)');
?>
</select>
</td>
</tr>
</table>
<div class="advanced">
<blockquote class="inline_help">
<p>
<b>USB Mode</b><br>
Select the USB Mode to emulate.
</p>
</blockquote>
</div>
<table>
<tr>
<td>Other PCI Devices:</td>

View File

@@ -720,6 +720,29 @@
</blockquote>
</div>
<table>
<tr class="advanced">
<td>USB Controller:</td>
<td>
<select name="domain[usbmode]" id="usbmode" class="narrow" title="Select the USB Controller to emulate.">
<?php
echo mk_option($arrConfig['domain']['usbmode'], 'usb2', '2.0 (EHCI)');
echo mk_option($arrConfig['domain']['usbmode'], 'usb3', '3.0 (nec XHCI)');
echo mk_option($arrConfig['domain']['usbmode'], 'usb3-qemu', '3.0 (qemu XHCI)');
?>
</select>
</td>
</tr>
</table>
<div class="advanced">
<blockquote class="inline_help">
<p>
<b>USB Controller</b><br>
Select the USB Controller to emulate. Qemu XHCI is the same code base as Nec XHCI but without several hacks applied over the years. Recommended to try qemu XHCI before resorting to nec XHCI.
</p>
</blockquote>
</div>
<? foreach ($arrConfig['gpu'] as $i => $arrGPU) {
$strLabel = ($i > 0) ? appendOrdinalSuffix($i + 1) : '';
@@ -914,28 +937,6 @@
NOTE: USB hotplug support is not yet implemented, so devices must be attached before the VM is started to use them.</p>
</blockquote>
<table>
<tr class="advanced">
<td>USB Mode:</td>
<td>
<select name="domain[usbmode]" id="usbmode" class="narrow" title="Select the USB Mode to emulate.">
<?php
echo mk_option($arrConfig['domain']['usbmode'], 'usb2', '2.0 (EHCI)');
echo mk_option($arrConfig['domain']['usbmode'], 'usb3', '3.0 (XHCI)');
?>
</select>
</td>
</tr>
</table>
<div class="advanced">
<blockquote class="inline_help">
<p>
<b>USB Mode</b><br>
Select the USB Mode to emulate.
</p>
</blockquote>
</div>
<table>
<tr>
<td>Other PCI Devices:</td>