VirtualBox

Changeset 262 in vbox


Ignore:
Timestamp:
Jan 24, 2007 12:05:42 PM (18 years ago)
Author:
vboxsync
Message:

Produce a better error message if the host CD/DVD drive is not accessible.

Location:
trunk/src/VBox/Devices/Storage
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DevATA.cpp

    r113 r262  
    54075407            {
    54085408                AssertMsgFailed(("Failed to attach LUN#%d. rc=%Vrc\n", pIf->iLUN, rc));
    5409                 return PDMDEV_SET_ERROR(pDevIns, rc, N_("PIIX3 cannot attach drive."));
     5409                switch (rc)
     5410                {
     5411                    case VERR_ACCESS_DENIED:
     5412                        /* Error already catched by DrvHostBase */
     5413                        return rc;
     5414                    default:
     5415                        return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, N_(
     5416                               "PIIX3 cannot attach drive to the %s"), s_apszDescs[i][j]);
     5417                }
    54105418            }
    54115419            cbTotalBuffer += pIf->cbIOBuffer;
  • trunk/src/VBox/Devices/Storage/DrvHostBase.cpp

    r1 r262  
    9393#include <iprt/assert.h>
    9494#include <iprt/file.h>
     95#include <iprt/path.h>
    9596#include <iprt/string.h>
    9697#include <iprt/thread.h>
     
    11991200    if (VBOX_FAILURE(rc))
    12001201    {
     1202        char pszPathReal[256];
     1203        char *pszDevice = pThis->pszDevice;
     1204        if (RT_SUCCESS(RTPathReal(pszDevice, pszPathReal, sizeof(pszPathReal))))
     1205            pszDevice = pszPathReal;
    12011206        AssertMsgFailed(("Could not open host device %s, rc=%Vrc\n", pThis->pszDevice, rc));
    12021207        pThis->FileDevice = NIL_RTFILE;
    1203         return rc;
     1208        switch (rc)
     1209        {
     1210            case VERR_ACCESS_DENIED:
     1211                return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS,
     1212#ifdef __LINUX__
     1213                        N_("Cannot open host device '%s' for %s access. Check the permissions "
     1214                           "of that device ('/bin/ls -l %s'): Most probably you need to be member "
     1215                           "of the device group. Make sure that you logout/login after changing "
     1216                           "the group settings of the current user"),
     1217#else
     1218                        N_("Cannot open host device '%s' for %s access. Check the permissions "
     1219                           "of that device"),
     1220#endif
     1221                       pszPathReal, pThis->fReadOnlyConfig ? "readonly" : "read/write",
     1222                       pszPathReal);
     1223            default:
     1224                return rc;
     1225        }
    12041226    }
    12051227#ifdef __WIN__
  • trunk/src/VBox/Devices/Storage/VBoxHDD.cpp

    r150 r262  
    41994199    LogFlow(("vdiConstruct:\n"));
    42004200    PVDIDISK pData = PDMINS2DATA(pDrvIns, PVDIDISK);
     4201    char *pszName;      /**< The path of the disk image file. */
     4202    bool fReadOnly;     /**< True if the media is readonly. */
    42014203
    42024204    /*
     
    42494251         * Read the image configuration.
    42504252         */
    4251         char *pszName;
    42524253        int rc = CFGMR3QueryStringAlloc(pCurNode, "Path", &pszName);
    42534254        if (VBOX_FAILURE(rc))
     
    42894290     * Validate and read top level configuration.
    42904291     */
    4291     char *pszName;
    42924292    int rc = CFGMR3QueryStringAlloc(pCfgHandle, "Path", &pszName);
    42934293    if (VBOX_FAILURE(rc))
     
    42954295                                N_("VHDD: Configuration error: Querying \"Path\" as string failed"));
    42964296
    4297     /** True if the media is readonly. */
    4298     bool fReadOnly;
    42994297    rc = CFGMR3QueryBool(pCfgHandle, "ReadOnly", &fReadOnly);
    43004298    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
     
    43204318    pszName = NULL;
    43214319#endif
     4320
     4321    if (rc == VERR_ACCESS_DENIED)
     4322        /* This should never happen here since this case is covered by Console::PowerUp */
     4323        return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS,
     4324                                   N_("Cannot open virtual disk image '%s' for %s access"),
     4325                                   pszName, fReadOnly ? "readonly" : "read/write");
    43224326
    43234327    return rc;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette