VirtualBox

Ticket #2624 (closed defect: fixed)

Opened 5 years ago

Last modified 4 years ago

VBoxManage does not show sata drives attached

Reported by: mjlucas Owned by:
Priority: major 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

comment:1 Changed 5 years ago by mjlucas

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 Changed 5 years ago by aeichner

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 Changed 5 years ago by frank

  • Status changed from new to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.

www.oracle.com
ContactPrivacy policyTerms of Use