#2624 closed defect (fixed)
VBoxManage does not show sata drives attached
| Reported by: | James Lucas | Owned by: | |
|---|---|---|---|
| Component: | other | Version: | VirtualBox 2.0.4 |
| Keywords: | Cc: | ||
| Guest type: | other | Host type: | other |
Description
When running
VBoxManage showvminfo <machine> [-machinereadable]
the output lists the drives attached to the ide ports [a|b|d] but does not enumerate the drives attached to a sata port.
This is an inconsistency and at a minimum VBoxManage should show the ports that have drives attached to them
eg.
sata1="/home/vdi/sata1.vdi"
Change History (3)
comment:1 by , 16 years ago
comment:2 by , 16 years ago
Hi James,
thank you very much for the patch. I applied it with minor modifications. It should appear in the public svn soon. I changed the hard coded 30 ports to make use of the sataportcount property instead.
Regarding your 2. question: I don't know if this is really required. I think the values are almost never changed and many users are confused what IDE emulation is used for anyway. But if you implement it we wouldn't reject a patch :)
comment:3 by , 16 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |


Initial patch below.
Notes on implementation:
Questions:
The patch below is complete pending the responses to the 2 questions.
Index: src/VBox/Frontends/VBoxManage/VBoxManage.cpp =================================================================== --- src/VBox/Frontends/VBoxManage/VBoxManage.cpp (revision 14276) +++ src/VBox/Frontends/VBoxManage/VBoxManage.cpp (working copy) @@ -1149,22 +1149,55 @@ /* * SATA. */ + +#ifdef VBOX_WITH_AHCI ComPtr<ISATAController> SATACtl; + BOOL fSataEnabled; rc = machine->COMGETTER(SATAController)(SATACtl.asOutParam()); if (SUCCEEDED(rc)) { - BOOL fEnabled; - rc = SATACtl->COMGETTER(Enabled)(&fEnabled); + rc = SATACtl->COMGETTER(Enabled)(&fSataEnabled); if (FAILED(rc)) - fEnabled = false; + fSataEnabled = false; if (details == VMINFO_MACHINEREADABLE) - RTPrintf("sata=\"%s\" ", fEnabled ? "on" : "off"); + RTPrintf("sata=\"%s\" ", fSataEnabled ? "on" : "off"); else - RTPrintf("SATA: %s\n", fEnabled ? "enabled" : "disabled"); + RTPrintf("SATA: %s\n", fSataEnabled ? "enabled" : "disabled"); } + /* + * SATA Hard disks + */ + if (fSataEnabled) + { + ComPtr<IHardDisk2> hardDisk; + Bstr filePath; + for (int i = 0; i < 30; ++ i) + { + rc = machine->GetHardDisk2(StorageBus_SATA, i, 0, hardDisk.asOutParam()); + if (SUCCEEDED(rc) && hardDisk) + { + hardDisk->COMGETTER(Location)(filePath.asOutParam()); + hardDisk->COMGETTER(Id)(uuid.asOutParam()); + if (details == VMINFO_MACHINEREADABLE) + { + RTPrintf("sata%d=\"%lS\" ", i, filePath.raw()); + RTPrintf("sata%dImageUUID=\"%s\" ", i, uuid.toString().raw()); + } + else + RTPrintf("SATA %d: %lS (UUID: %s)\n", i, filePath.raw(), uuid.toString().raw()); + } + else + { + if (details == VMINFO_MACHINEREADABLE) + RTPrintf("sata%d=\"none\" ",i); + } + } + } +#endif + /* - * Hard disks + * IDE Hard disks */ IDEControllerType_T ideController; const char *pszIdeController = NULL;