summaryrefslogtreecommitdiffstats
path: root/endpoints/lib
diff options
context:
space:
mode:
authorh6w <tudor@tudorholton.com>2019-09-08 15:55:07 +1000
committerGitHub <noreply@github.com>2019-09-08 15:55:07 +1000
commit949534be2c20e4f82dece0a90d23b95cde297abd (patch)
tree4fa2b3452e94f10d7771a279988be0129d630119 /endpoints/lib
parent9871f2445fa8c2095cacc93a8708cc4adc495198 (diff)
parent07566d331200f8a8e9aa50a33cb04b25c3f36b76 (diff)
downloadphpvirtualbox-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 'endpoints/lib')
-rw-r--r--endpoints/lib/vboxServiceWrappers.php12
-rw-r--r--endpoints/lib/vboxconnector.php20
2 files changed, 21 insertions, 11 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