diff options
author | chotaire <chotaire@chotaire.net> | 2019-09-07 13:14:27 +0200 |
---|---|---|
committer | chotaire <chotaire@chotaire.net> | 2019-09-07 13:14:27 +0200 |
commit | 3b60ef056d6544361f91c90c05d18125118debc2 (patch) | |
tree | b822178d761b71e3df6ff473d0108c7f1bc6e1af | |
parent | 9871f2445fa8c2095cacc93a8708cc4adc495198 (diff) | |
download | phpvirtualbox-3b60ef056d6544361f91c90c05d18125118debc2.zip phpvirtualbox-3b60ef056d6544361f91c90c05d18125118debc2.tar.gz phpvirtualbox-3b60ef056d6544361f91c90c05d18125118debc2.tar.bz2 |
Added Discard (TRIM) option and NVME harddisk controller (by pasha1st)
-rw-r--r-- | endpoints/lib/vboxconnector.php | 20 |
1 files changed, 15 insertions, 5 deletions
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 |