VirtualBox

Opened 15 years ago

Closed 15 years ago

Last modified 14 years ago

#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 James Lucas, 15 years ago

Initial patch below.

Notes on implementation:

  1. I've wrapped existing and new SATA items in a #ifdef because SATA isn't available in the OSE edition
  2. Prints out all 30 sata devices if in machine readable mode but not in default output (Following IDE HDs as an example)

Questions:

  1. Instead of hard-coding the 30 sata ports should I instead use the "sataportcount" defined for the controller?
  2. Should the output also identify which devices are in IDE emulation mode? If so, how should this be displayed?

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;

comment:2 by aeichner, 15 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 Frank Mehnert, 15 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use