diff options
author | h6w <tudor@tudorholton.com> | 2019-09-08 15:55:07 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-08 15:55:07 +1000 |
commit | 949534be2c20e4f82dece0a90d23b95cde297abd (patch) | |
tree | 4fa2b3452e94f10d7771a279988be0129d630119 /js/phpvirtualbox.js | |
parent | 9871f2445fa8c2095cacc93a8708cc4adc495198 (diff) | |
parent | 07566d331200f8a8e9aa50a33cb04b25c3f36b76 (diff) | |
download | phpvirtualbox-949534be2c20e4f82dece0a90d23b95cde297abd.zip phpvirtualbox-949534be2c20e4f82dece0a90d23b95cde297abd.tar.gz phpvirtualbox-949534be2c20e4f82dece0a90d23b95cde297abd.tar.bz2 |
Merge pull request #186 from chotaire/chot-discard-nvme
Add Discard (TRIM) option and NVME storage controller
Diffstat (limited to 'js/phpvirtualbox.js')
-rw-r--r-- | js/phpvirtualbox.js | 67 |
1 files changed, 53 insertions, 14 deletions
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' } }; |