VirtualBox

Changeset 67139 in vbox for trunk/src/VBox/ValidationKit


Ignore:
Timestamp:
May 30, 2017 11:17:28 AM (8 years ago)
Author:
vboxsync
Message:

ValidationKit/TXS: Added a configurable wait on the CD-ROM during auto upgrade to work around a solaris problem where it takes a little while before it is mounted. The wait defaults to 8 seconds on solaris and 1 second on the other OSes. Ideally, we should figure out that a medium is present before wasting time waiting, but that's probably complicated and can wait. The wait can be configured using the --wait-cdrom <secs> option. Setting it to zero disables the wait. There is no upper limit.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/utils/TestExecServ/TestExecService.cpp

    r65188 r67139  
    29752975 * @param   argc                The number of arguments.
    29762976 * @param   argv                The argument vector.
     2977 * @param   cSecsCdWait         Number of seconds to wait on the CD.
    29772978 * @param   pfExit              For indicating exit when the exit code is zero.
    29782979 */
    2979 static RTEXITCODE txsAutoUpdateStage1(int argc, char **argv, bool *pfExit)
     2980static RTEXITCODE txsAutoUpdateStage1(int argc, char **argv, uint32_t cSecsCdWait, bool *pfExit)
    29802981{
    29812982    /*
     
    30013002    /*
    30023003     * Query information about the two images and read the entire potential source file.
    3003      */
     3004     * Because the CD may take a little time to be mounted when the system boots, we
     3005     * need to do some fudging here.
     3006     */
     3007    uint64_t nsStart = RTTimeNanoTS();
    30043008    RTFSOBJINFO UpgradeInfo;
    3005     rc = RTPathQueryInfo(szUpgradePath, &UpgradeInfo, RTFSOBJATTRADD_NOTHING);
    3006     if (    rc == VERR_FILE_NOT_FOUND
    3007         ||  rc == VERR_PATH_NOT_FOUND
    3008         ||  rc == VERR_MEDIA_NOT_PRESENT
    3009         ||  rc == VERR_MEDIA_NOT_RECOGNIZED)
    3010         return RTEXITCODE_SUCCESS;
    3011     if (RT_FAILURE(rc))
    3012     {
    3013         RTMsgError("RTPathQueryInfo(\"%s\"): %Rrc (upgrade)\n", szUpgradePath, rc);
    3014         return RTEXITCODE_SUCCESS;
     3009    for (;;)
     3010    {
     3011        rc = RTPathQueryInfo(szUpgradePath, &UpgradeInfo, RTFSOBJATTRADD_NOTHING);
     3012        if (RT_SUCCESS(rc))
     3013            break;
     3014        if (   rc != VERR_FILE_NOT_FOUND
     3015            && rc != VERR_PATH_NOT_FOUND
     3016            && rc != VERR_MEDIA_NOT_PRESENT
     3017            && rc != VERR_MEDIA_NOT_RECOGNIZED)
     3018        {
     3019            RTMsgError("RTPathQueryInfo(\"%s\"): %Rrc (upgrade)\n", szUpgradePath, rc);
     3020            return RTEXITCODE_SUCCESS;
     3021        }
     3022        uint64_t cNsElapsed = RTTimeNanoTS() - nsStart;
     3023        if (cNsElapsed >= cSecsCdWait * RT_NS_1SEC_64)
     3024            return RTEXITCODE_SUCCESS;
     3025        RTThreadSleep(500);
    30153026    }
    30163027
     
    32223233                 "      version found on the CD-ROM on startup will replace the initial copy.\n"
    32233234                 "      Default: --auto-upgrade\n"
     3235                 "  --wait-cdrom <secs>\n"
     3236                 "     Number of seconds to wait for the CD-ROM to be mounted before giving up\n"
     3237                 "     on automatic upgrading.\n"
     3238                 "     Default: --wait-cdrom 1;  solaris: --wait-cdrom 8\n"
    32243239                 "  --upgrading <org-path>\n"
    32253240                 "      Internal use only.\n");
     
    32653280    bool        fDaemonized     = false;
    32663281    const char *pszUpgrading    = NULL;
     3282#ifdef RT_OS_SOLARIS
     3283    uint32_t    cSecsCdWait     = 8;
     3284#else
     3285    uint32_t    cSecsCdWait     = 1;
     3286#endif
    32673287
    32683288    /*
     
    32733293        { "--transport",        't', RTGETOPT_REQ_STRING  },
    32743294        { "--cdrom",            'c', RTGETOPT_REQ_STRING  },
     3295        { "--wait-cdrom",       'w', RTGETOPT_REQ_UINT32  },
    32753296        { "--scratch",          's', RTGETOPT_REQ_STRING  },
    32763297        { "--auto-upgrade",     'a', RTGETOPT_REQ_NOTHING },
    32773298        { "--no-auto-upgrade",  'A', RTGETOPT_REQ_NOTHING },
    32783299        { "--upgrading",        'U', RTGETOPT_REQ_STRING  },
    3279         { "--display-output",   'd', RTGETOPT_REQ_NOTHING  },
    3280         { "--no-display-output",'D', RTGETOPT_REQ_NOTHING  },
    3281         { "--foreground",       'f', RTGETOPT_REQ_NOTHING  },
    3282         { "--daemonized",       'Z', RTGETOPT_REQ_NOTHING  },
     3300        { "--display-output",   'd', RTGETOPT_REQ_NOTHING },
     3301        { "--no-display-output",'D', RTGETOPT_REQ_NOTHING },
     3302        { "--foreground",       'f', RTGETOPT_REQ_NOTHING },
     3303        { "--daemonized",       'Z', RTGETOPT_REQ_NOTHING },
    32833304    };
    32843305
     
    33663387            case 'U':
    33673388                pszUpgrading = Val.psz;
     3389                break;
     3390
     3391            case 'w':
     3392                cSecsCdWait = Val.u32;
    33683393                break;
    33693394
     
    34123437            rcExit = txsAutoUpdateStage2(argc, argv, pfExit, pszUpgrading);
    34133438        else
    3414             rcExit = txsAutoUpdateStage1(argc, argv, pfExit);
     3439            rcExit = txsAutoUpdateStage1(argc, argv, cSecsCdWait, pfExit);
    34153440        if (   *pfExit
    34163441            || rcExit != RTEXITCODE_SUCCESS)
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