Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions endpoints/lib/vboxServiceWrappers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand Down
20 changes: 15 additions & 5 deletions endpoints/lib/vboxconnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -1992,7 +1992,7 @@ public function remote_machineSave($args) {
$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));
Expand Down Expand Up @@ -2048,8 +2048,16 @@ public function remote_machineSave($args) {
// 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) {

Expand Down Expand Up @@ -4501,6 +4509,7 @@ private function _machineGetMediumAttachments(&$mas) {
'temporaryEject' => $ma->temporaryEject,
'nonRotational' => $ma->nonRotational,
'hotPluggable' => $ma->hotPluggable,
'discard' => $ma->discard,
);
}

Expand Down Expand Up @@ -5561,7 +5570,8 @@ public function remote_vboxSystemPropertiesGet($args) {
'PIIX4',
'ICH6',
'I82078',
'USB');
'USB',
'NVMe');

foreach($scts as $t) {
$scs[$t] = $sp->getStorageControllerHotplugCapable($t);
Expand Down Expand Up @@ -5696,7 +5706,8 @@ private function _util_getIgnoreFlushKey($port,$device,$cType) {
'intelahci' => 'ahci',
'lsilogic' => 'lsilogicscsi',
'buslogic' => 'buslogic',
'lsilogicsas' => 'lsilogicsas'
'lsilogicsas' => 'lsilogicsas',
'nvme' => 'nvme'
);

if(!isset($cTypes[strtolower($cType)])) {
Expand Down Expand Up @@ -5831,5 +5842,4 @@ private function _util_resultCodeText($c) {

return @$rcodes['0x'.strtoupper(dechex($c))] . ' (0x'.strtoupper(dechex($c)).')';
}
}

}
67 changes: 53 additions & 14 deletions js/phpvirtualbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -2430,7 +2430,7 @@ var vboxMedia = {
},

/**
* Return true if a medium format supports
* Return true if a medium format supports Split2G
*/
formatSupportsSplit: function(format) {

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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'
}
};

Expand Down
2 changes: 1 addition & 1 deletion panes/settingsStorage.html
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@
$('#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 {
Expand Down