I was looking for the right virtual box API to enable / disable 'Solid State Drive' option for VDI type of storage.
FYI, I have tried using IMachine::NonRotationalDevice("Controller", 0, 0, DeviceType.DeviceType_HardDisk, 1) but it was not setting the option. I was invoking this method before IMachine::SaveSettings() method call. In addition, IMachine::AttachDevice() and IMachine::AdoptSavedState() are also called.
Just want to understand, when underlying harddisk is solid state drive then "Solid State Drive" option helps in improving VM performance ?
How to set solid state drive option for VDI programmatically
-
- Posts: 60
- Joined: 28. Dec 2019, 08:58
- Primary OS: MS Windows 7
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows, Linux
Re: How to set solid state drive option for VDI programmatically
IMachine::NonRotationalDevice() works fine for me. Where are you getting the "DeviceType.DeviceType_HardDisk" parameter? I don't see that in the API documentation. Are you perhaps using another version? I'm on 6.1.0. Maybe IMachine::NonRotationalDevice("Controller", 0, 0, 1) would work better? My call is like this: $mutabletestmachine.NonRotationalDevice("IDE", 0, 0, 1) where IDE is the actual name of the controller and the disk is attached to the primary master (0, 0) port of the IDE controller. I'd post the full code, but there's a LOT of custom objects in mine... so it'd be messy.
Edit: Also, the documentation says
Edit: Also, the documentation says
Could you post the variant, type, format, etc. for the storage controller and virtual disk? I could try to recreate it more closely.VirtualBox Programming Guide and Reference 6.1.0 wrote:This may or may not be supported by a particular drive, and is silently ignored in the latter case.
Re: How to set solid state drive option for VDI programmatically
I am using VDI format, Controller type = StorageControllerType_IntelAhci. You are right, there is no param "DeviceType.DeviceType_HardDisk".
Unfortunately, I am bound to use virtual box 5.1.30 / 5.2.34 but not the latest due to certain limitation.
Unfortunately, I am bound to use virtual box 5.1.30 / 5.2.34 but not the latest due to certain limitation.
-
- Posts: 60
- Joined: 28. Dec 2019, 08:58
- Primary OS: MS Windows 7
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows, Linux
Re: How to set solid state drive option for VDI programmatically
I created a standard VDI disk and attached it to an IntelAhci controller and was still able to do it without a problem.Bidyut wrote:I am using VDI format, Controller type = StorageControllerType_IntelAhci.
Sorry I can't test this specific version for you right now. I'm pretty deep into working on this 6.1 module myself.Bidyut wrote:Unfortunately, I am bound to use virtual box 5.1.30 / 5.2.34 but not the latest due to certain limitation.
I'm pretty sure IMachine::NonRotationalDevice("Controller", 0, 0, 1) should work for you. Just to be sure, Controller is the actual name of your IntelAhci storage controller and the virtual disk is connected to port 0, device 0 of that controller, correct?
Re: How to set solid state drive option for VDI programmatically
You are right. "Controller" is the actual name and the virtual disk is connected to port 0, device 0 of that controller.