diff options
author | chotaire <chotaire@chotaire.net> | 2020-01-29 12:05:34 +0100 |
---|---|---|
committer | chotaire <chotaire@chotaire.net> | 2020-01-29 12:05:34 +0100 |
commit | 5aa5381a281b05d283282e9d0b9359512eb1262c (patch) | |
tree | eaf867bfe62c3d204e53bc085bbea992079ac49b | |
parent | 2626e2dce2f158dbd2d3ba6bc8938c2ad042ef04 (diff) | |
download | phpvirtualbox-5aa5381a281b05d283282e9d0b9359512eb1262c.zip phpvirtualbox-5aa5381a281b05d283282e9d0b9359512eb1262c.tar.gz phpvirtualbox-5aa5381a281b05d283282e9d0b9359512eb1262c.tar.bz2 |
Merge current vboxconnector.php from develop
-rw-r--r-- | endpoints/lib/vboxconnector.php | 50 |
1 files changed, 32 insertions, 18 deletions
diff --git a/endpoints/lib/vboxconnector.php b/endpoints/lib/vboxconnector.php index 2a3f06b..86ad97c 100644 --- a/endpoints/lib/vboxconnector.php +++ b/endpoints/lib/vboxconnector.php @@ -1470,10 +1470,11 @@ class vboxconnector { $m->VRDEServer->enabled = $args['VRDEServer']['enabled'];
$m->VRDEServer->setVRDEProperty('TCP/Ports',$args['VRDEServer']['ports']);
$m->VRDEServer->setVRDEProperty('VNCPassword',$args['VRDEServer']['VNCPassword'] ? $args['VRDEServer']['VNCPassword'] : null);
- $m->VRDEServer->authType = ($args['VRDEServer']['authType'] ? $args['VRDEServer']['authType'] : null);
+ $m->VRDEServer->authType = ($args['VRDEServer']['authType'] ? $args['VRDEServer']['authType'] : 'Null');
$m->VRDEServer->authTimeout = $args['VRDEServer']['authTimeout'];
}
} catch (Exception $e) {
+ $this->errors[] = $e;
}
// Storage Controllers if machine is in a valid state
@@ -1855,7 +1856,6 @@ class vboxconnector { if($m->snapshotFolder != $args['snapshotFolder']) $m->snapshotFolder = $args['snapshotFolder'];
$m->RTCUseUTC = ($args['RTCUseUTC'] ? 1 : 0);
$m->setCpuProperty('PAE', ($args['CpuProperties']['PAE'] ? 1 : 0));
- $m->setCpuProperty('HWVirt', ($args['CpuProperties']['HWVirt'] ? 1 : 0));
$m->setCPUProperty('LongMode', (strpos($args['OSTypeId'],'_64') > - 1 ? 1 : 0));
// IOAPIC
@@ -1914,10 +1914,11 @@ class vboxconnector { $m->setExtraData('phpvb/icon', $args['customIcon']);
$m->VRAMSize = $args['VRAMSize'];
+ $m->graphicsControllerType = $args['graphicsControllerType'];
// Video
- $m->accelerate3DEnabled = $args['accelerate3DEnabled'];
- $m->accelerate2DVideoEnabled = $args['accelerate2DVideoEnabled'];
+ $m->GraphicsAdapter->accelerate3DEnabled = $args['accelerate3DEnabled'];
+ $m->GraphicsAdapter->accelerate2DVideoEnabled = $args['accelerate2DVideoEnabled'];
// VRDE settings
try {
@@ -1927,11 +1928,12 @@ class vboxconnector { if(@$this->settings->enableAdvancedConfig)
$m->VRDEServer->setVRDEProperty('TCP/Address',$args['VRDEServer']['netAddress']);
$m->VRDEServer->setVRDEProperty('VNCPassword',$args['VRDEServer']['VNCPassword'] ? $args['VRDEServer']['VNCPassword'] : null);
- $m->VRDEServer->authType = ($args['VRDEServer']['authType'] ? $args['VRDEServer']['authType'] : null);
+ $m->VRDEServer->authType = ($args['VRDEServer']['authType'] ? $args['VRDEServer']['authType'] : 'Null');
$m->VRDEServer->authTimeout = $args['VRDEServer']['authTimeout'];
$m->VRDEServer->allowMultiConnection = $args['VRDEServer']['allowMultiConnection'];
}
} catch (Exception $e) {
+ $this->errors[] = $e;
}
// Audio controller settings
@@ -1993,7 +1995,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));
@@ -2049,8 +2051,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) {
@@ -3246,7 +3256,7 @@ class vboxconnector { }
/* @var $progress IProgress */
- $progress = $machine->launchVMProcess($this->session->handle, "headless", "");
+ $progress = $machine->launchVMProcess($this->session->handle, "headless", NULL);
} catch (Exception $e) {
// Error opening session
@@ -3403,8 +3413,7 @@ class vboxconnector { * Supported CPU features?
*/
$response['cpuFeatures'] = array();
- foreach(array('HWVirtEx'=>'HWVirtEx','PAE'=>'PAE','NestedPaging'=>'Nested Paging','LongMode'=>'Long Mode (64-bit)'
- ,'UnrestrictedGuest'=>'Unrestricted Guest','NestedHWVirt'=>'Nested Virtualization') as $k=>$v) {
+ foreach(array('HWVirtEx'=>'HWVirtEx','PAE'=>'PAE','NestedPaging'=>'Nested Paging','LongMode'=>'Long Mode (64-bit)') as $k=>$v) {
$response['cpuFeatures'][$v] = $host->getProcessorFeature($k);
}
@@ -3845,6 +3854,7 @@ class vboxconnector { $this->session->machine->chipsetType = (string)$defaults->recommendedChipset;
$this->session->machine->ClipboardMode = 'Disabled';
if(intval($defaults->recommendedVRAM) > 0) $this->session->machine->VRAMSize = intval($defaults->recommendedVRAM);
+ $this->session->machine->setGraphicsControllerType((string)$defaults->recommendedGraphicsController);
$this->session->machine->setCpuProperty('PAE',$defaults->recommendedPAE);
// USB input devices
@@ -4213,10 +4223,11 @@ class vboxconnector { 'HPETEnabled' => $m->HPETEnabled,
'memorySize' => $m->memorySize,
'VRAMSize' => $m->VRAMSize,
+ 'graphicsControllerType' => (string)$m->graphicsControllerType,
'pointingHIDType' => (string)$m->pointingHIDType,
'keyboardHIDType' => (string)$m->keyboardHIDType,
- 'accelerate3DEnabled' => $m->accelerate3DEnabled,
- 'accelerate2DVideoEnabled' => $m->accelerate2DVideoEnabled,
+ 'accelerate3DEnabled' => $m->GraphicsAdapter->accelerate3DEnabled,
+ 'accelerate2DVideoEnabled' => $m->GraphicsAdapter->accelerate2DVideoEnabled,
'BIOSSettings' => array(
'ACPIEnabled' => $m->BIOSSettings->ACPIEnabled,
'IOAPICEnabled' => $m->BIOSSettings->IOAPICEnabled,
@@ -4225,7 +4236,7 @@ class vboxconnector { 'firmwareType' => (string)$m->firmwareType,
'snapshotFolder' => $m->snapshotFolder,
'ClipboardMode' => (string)$m->ClipboardMode,
- 'monitorCount' => $m->monitorCount,
+ 'monitorCount' => $m->GraphicsAdapter->monitorCount,
'pageFusionEnabled' => $m->pageFusionEnabled,
'VRDEServer' => (!$m->VRDEServer ? null : array(
'enabled' => $m->VRDEServer->enabled,
@@ -4252,7 +4263,7 @@ class vboxconnector { 'VPID' => $m->getHWVirtExProperty('VPID')
),
'CpuProperties' => array(
- 'PAE' => $m->getCpuProperty('PAE'),'HWVirt' => $m->getCpuProperty('HWVirt')
+ 'PAE' => $m->getCpuProperty('PAE')
),
'bootOrder' => $this->_machineGetBootOrder($m),
'chipsetType' => (string)$m->chipsetType,
@@ -4503,6 +4514,7 @@ class vboxconnector { 'temporaryEject' => $ma->temporaryEject,
'nonRotational' => $ma->nonRotational,
'hotPluggable' => $ma->hotPluggable,
+ 'discard' => $ma->discard,
);
}
@@ -4699,7 +4711,7 @@ class vboxconnector { $machine->lockMachine($this->session->handle, ((string)$machine->sessionState == 'Unlocked' ? 'Write' : 'Shared'));
/* @var $progress IProgress */
- list($progress, $snapshotId) = $this->session->machine->takeSnapshot($args['name'], $args['description'], null);
+ list($progress, $snapshotId) = $this->session->machine->takeSnapshot($args['name'], $args['description'], false);
// Does an exception exist?
try {
@@ -5563,7 +5575,8 @@ class vboxconnector { 'PIIX4',
'ICH6',
'I82078',
- 'USB');
+ 'USB',
+ 'NVMe');
foreach($scts as $t) {
$scs[$t] = $sp->getStorageControllerHotplugCapable($t);
@@ -5698,7 +5711,9 @@ class vboxconnector { 'intelahci' => 'ahci',
'lsilogic' => 'lsilogicscsi',
'buslogic' => 'buslogic',
- 'lsilogicsas' => 'lsilogicsas'
+ 'lsilogicsas' => 'lsilogicsas',
+ 'usb' => 'usb',
+ 'nvme' => 'nvme'
);
if(!isset($cTypes[strtolower($cType)])) {
@@ -5833,5 +5848,4 @@ class vboxconnector { return @$rcodes['0x'.strtoupper(dechex($c))] . ' (0x'.strtoupper(dechex($c)).')';
}
-}
-
+}
\ No newline at end of file |