diff options
-rw-r--r-- | endpoints/lib/vboxServiceWrappers.php | 12 | ||||
-rw-r--r-- | endpoints/lib/vboxconnector.php | 20 | ||||
-rw-r--r-- | js/phpvirtualbox.js | 67 | ||||
-rw-r--r-- | panes/settingsStorage.html | 2 |
4 files changed, 75 insertions, 26 deletions
diff --git a/endpoints/lib/vboxServiceWrappers.php b/endpoints/lib/vboxServiceWrappers.php index 1ba3053..2d0c9aa 100644 --- a/endpoints/lib/vboxServiceWrappers.php +++ b/endpoints/lib/vboxServiceWrappers.php @@ -16269,8 +16269,8 @@ class DataFlagsCollection extends VBox_EnumCollection */ class MediumFormatCapabilities extends VBox_Enum { - public $NameMap = array(0x01 => 'Uuid', 0x02 => 'CreateFixed', 0x04 => 'CreateDynamic', 0x08 => 'CreateSplit2G', 0x10 => 'Differencing', 0x20 => 'Asynchronous', 0x40 => 'File', 0x80 => 'Properties', 0x100 => 'TcpNetworking', 0x200 => 'VFS', 0x3FF => 'CapabilityMask'); - public $ValueMap = array('Uuid' => 0x01, 'CreateFixed' => 0x02, 'CreateDynamic' => 0x04, 'CreateSplit2G' => 0x08, 'Differencing' => 0x10, 'Asynchronous' => 0x20, 'File' => 0x40, 'Properties' => 0x80, 'TcpNetworking' => 0x100, 'VFS' => 0x200, 'CapabilityMask' => 0x3FF); + public $NameMap = array(0x01 => 'Uuid', 0x02 => 'CreateFixed', 0x04 => 'CreateDynamic', 0x08 => 'CreateSplit2G', 0x10 => 'Differencing', 0x20 => 'Asynchronous', 0x40 => 'File', 0x80 => 'Properties', 0x100 => 'TcpNetworking', 0x200 => 'VFS', 0x400 => 'Discard', 0x800 => 'Preferred', 0xFFF => 'CapabilityMask'); + public $ValueMap = array('Uuid' => 0x01, 'CreateFixed' => 0x02, 'CreateDynamic' => 0x04, 'CreateSplit2G' => 0x08, 'Differencing' => 0x10, 'Asynchronous' => 0x20, 'File' => 0x40, 'Properties' => 0x80, 'TcpNetworking' => 0x100, 'VFS' => 0x200, 'Discard' => 0x400, 'Preferred' => 0x800, 'CapabilityMask' => 0xFFF); } /** @@ -16592,8 +16592,8 @@ class ReasonCollection extends VBox_EnumCollection */ class StorageBus extends VBox_Enum { - public $NameMap = array(0 => 'Null', 1 => 'IDE', 2 => 'SATA', 3 => 'SCSI', 4 => 'Floppy', 5 => 'SAS', 6 => 'USB'); - public $ValueMap = array('Null' => 0, 'IDE' => 1, 'SATA' => 2, 'SCSI' => 3, 'Floppy' => 4, 'SAS' => 5, 'USB' => 6); + public $NameMap = array(0 => 'Null', 1 => 'IDE', 2 => 'SATA', 3 => 'SCSI', 4 => 'Floppy', 5 => 'SAS', 6 => 'USB', 7 => 'PCIe'); + public $ValueMap = array('Null' => 0, 'IDE' => 1, 'SATA' => 2, 'SCSI' => 3, 'Floppy' => 4, 'SAS' => 5, 'USB' => 6, 'PCIe' => 7); } /** @@ -16609,8 +16609,8 @@ class StorageBusCollection extends VBox_EnumCollection */ class StorageControllerType extends VBox_Enum { - public $NameMap = array(0 => 'Null', 1 => 'LsiLogic', 2 => 'BusLogic', 3 => 'IntelAhci', 4 => 'PIIX3', 5 => 'PIIX4', 6 => 'ICH6', 7 => 'I82078', 8 => 'LsiLogicSas', 9 => 'USB'); - public $ValueMap = array('Null' => 0, 'LsiLogic' => 1, 'BusLogic' => 2, 'IntelAhci' => 3, 'PIIX3' => 4, 'PIIX4' => 5, 'ICH6' => 6, 'I82078' => 7, 'LsiLogicSas' => 8, 'USB' => 9); + public $NameMap = array(0 => 'Null', 1 => 'LsiLogic', 2 => 'BusLogic', 3 => 'IntelAhci', 4 => 'PIIX3', 5 => 'PIIX4', 6 => 'ICH6', 7 => 'I82078', 8 => 'LsiLogicSas', 9 => 'USB', 10 => 'NVMe'); + public $ValueMap = array('Null' => 0, 'LsiLogic' => 1, 'BusLogic' => 2, 'IntelAhci' => 3, 'PIIX3' => 4, 'PIIX4' => 5, 'ICH6' => 6, 'I82078' => 7, 'LsiLogicSas' => 8, 'USB' => 9, 'NVMe' => 10); } /** diff --git a/endpoints/lib/vboxconnector.php b/endpoints/lib/vboxconnector.php index c2f8804..2224d32 100644 --- a/endpoints/lib/vboxconnector.php +++ b/endpoints/lib/vboxconnector.php @@ -1992,7 +1992,7 @@ class vboxconnector { $c->useHostIOCache = $sc['useHostIOCache'];
// Set sata port count
- if($sc['bus'] == 'SATA') {
+ if(($sc['bus'] == 'SATA')||($sc['bus'] == 'PCIe')) {
$max = max(1,intval(@$sc['portCount']));
foreach($sc['mediumAttachments'] as $ma) {
$max = max($max,(intval($ma['port'])+1));
@@ -2048,8 +2048,16 @@ class vboxconnector { // HardDisk medium attachment type
} else if($ma['type'] == 'HardDisk') {
+ $ma['nonRotational']=($ma['nonRotational']?1:0);
+ $ma['discard']=($ma['discard']?1:0);
+ $ma['hotPluggable']=($ma['hotPluggable']?1:0);
$m->nonRotationalDevice($name, $ma['port'], $ma['device'], $ma['nonRotational']);
+ // Set Discard (TRIM) Option
+ if($this->settings->enableAdvancedConfig) {
+ $m->setAutoDiscardForDevice($name, $ma['port'], $ma['device'], $ma['discard']);
+ }
+
// Remove IgnoreFlush key?
if($this->settings->enableHDFlushConfig) {
@@ -4501,6 +4509,7 @@ class vboxconnector { 'temporaryEject' => $ma->temporaryEject,
'nonRotational' => $ma->nonRotational,
'hotPluggable' => $ma->hotPluggable,
+ 'discard' => $ma->discard,
);
}
@@ -5561,7 +5570,8 @@ class vboxconnector { 'PIIX4',
'ICH6',
'I82078',
- 'USB');
+ 'USB',
+ 'NVMe');
foreach($scts as $t) {
$scs[$t] = $sp->getStorageControllerHotplugCapable($t);
@@ -5696,7 +5706,8 @@ class vboxconnector { 'intelahci' => 'ahci',
'lsilogic' => 'lsilogicscsi',
'buslogic' => 'buslogic',
- 'lsilogicsas' => 'lsilogicsas'
+ 'lsilogicsas' => 'lsilogicsas',
+ 'nvme' => 'nvme'
);
if(!isset($cTypes[strtolower($cType)])) {
@@ -5831,5 +5842,4 @@ class vboxconnector { return @$rcodes['0x'.strtoupper(dechex($c))] . ' (0x'.strtoupper(dechex($c)).')';
}
-}
-
+}
\ No newline at end of file diff --git a/js/phpvirtualbox.js b/js/phpvirtualbox.js index 19fd02e..6a77f78 100644 --- a/js/phpvirtualbox.js +++ b/js/phpvirtualbox.js @@ -2430,7 +2430,7 @@ var vboxMedia = { }, /** - * Return true if a medium format supports + * Return true if a medium format supports Split2G */ formatSupportsSplit: function(format) { @@ -2445,6 +2445,23 @@ var vboxMedia = { } return false; }, + + /** + * Return true if a medium format supports Discard + */ + formatSupportsDiscard: function(format) { + + var format = format.toLowerCase(); + + var mfs = $('#vboxPane').data('vboxSystemProperties').mediumFormats; + + for(var i = 0; i < mfs.length; i++) { + if(mfs[i].id.toLowerCase() == format) { + return (jQuery.inArray('Discard',mfs[i].capabilities) > -1); + } + } + return false; + }, /** * Return printable virtual hard disk variant @@ -4747,7 +4764,13 @@ var vboxStorage = { attrib: 'ignoreFlush', runningEnabled: true, }); - } + }; + if($('#vboxPane').data('vboxConfig').enableAdvancedConfig&&vboxMedia.formatSupportsDiscard(ma.medium.format)) { + opts[opts.length]={ + label: 'Support Discard (TRIM)', + attrib: 'discard', + }; + }; return opts; case 'DVD': // Host drive @@ -4881,18 +4904,34 @@ var vboxStorage = { }, USB: { - maxPortCount: 8, - maxDevicesPerPortCount: 1, - types: ['USB'], - driveTypes: ['dvd','disk'], - slotName: function(p,d) { return trans('USB Port %1','VBoxGlobal', null, 'StorageSlot').replace('%1',p); }, - slots: function() { - var s = {}; - for(var i = 0; i < 8; i++) { - s[i+'-0'] = trans('USB Port %1','VBoxGlobal', null, 'StorageSlot').replace('%1',i); - } - return s; - } + maxPortCount: 8, + maxDevicesPerPortCount: 1, + types: ['USB'], + driveTypes: ['dvd','disk'], + slotName: function(p,d) { return trans('USB Port %1','VBoxGlobal', null, 'StorageSlot').replace('%1',p); }, + slots: function() { + var s = {}; + for(var i = 0; i < 8; i++) { + s[i+'-0'] = trans('USB Port %1','VBoxGlobal', null, 'StorageSlot').replace('%1',i); + } + return s; + } + }, + + PCIe: { + maxPortCount: 255, + maxDevicesPerPortCount: 1, + types: ['NVMe'], + driveTypes: ['disk'], + slotName: function(p,d) { return trans('NVMe Port %1','VBoxGlobal', null, 'StorageSlot').replace('%1',p); }, + slots: function() { + var s = {}; + for(var i = 0; i < 8; i++) { + s[i+'-0'] = trans('NVMe Port %1','VBoxGlobal', null, 'StorageSlot').replace('%1',i); + } + return s; + }, + displayInherit: 'IDE' } }; diff --git a/panes/settingsStorage.html b/panes/settingsStorage.html index 5e1ce54..c31cd34 100644 --- a/panes/settingsStorage.html +++ b/panes/settingsStorage.html @@ -945,7 +945,7 @@ function vboxSettingsSelectController(tbl) { $('#vboxSettingsHDInfo').css('display','none'); // Show SATA port count - if(busType == 'SATA') { + if((busType == 'SATA')||(busType == 'PCIe')) { $(document.forms['frmVboxSettings'].vboxSettingsControllerPortCount).val($(tbl).data('controller').portCount); $('#vboxSettingsControllerPortCountRow').css('display',''); } else { |