VirtualBox

Ignore:
Timestamp:
May 15, 2024 9:35:25 AM (7 months ago)
Author:
vboxsync
Message:

Main: Improved release logging of Guest Additions auto update. Unified logging prefix for simpler lookup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp

    r104178 r104636  
    25702570        if (RT_SUCCESS(vrc))
    25712571        {
    2572             LogRel(("Copying Guest Additions installer file \"%s\" to \"%s\" on guest ...\n",
     2572            LogRel(("Guest Additions Update: Copying installer file \"%s\" to \"%s\" on guest ...\n",
    25732573                    strFileSrc.c_str(), strFileDst.c_str()));
    25742574
     
    25872587                {
    25882588                    case VERR_GSTCTL_GUEST_ERROR:
    2589                         setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestFile::i_guestErrorToString(vrcGuest, strFileDst.c_str()));
     2589                        setUpdateErrorMsg(VBOX_E_GSTCTL_GUEST_ERROR,
     2590                                          GuestFile::i_guestErrorToString(vrcGuest, strFileDst.c_str()));
    25902591                        break;
    25912592
    25922593                    default:
    2593                         setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    2594                                             Utf8StrFmt(tr("Guest file \"%s\" could not be opened: %Rrc"),
    2595                                                        strFileDst.c_str(), vrc));
     2594                        setUpdateErrorMsg(VBOX_E_GSTCTL_GUEST_ERROR,
     2595                                          Utf8StrFmt(tr("Guest file \"%s\" could not be opened: %Rrc"),
     2596                                                     strFileDst.c_str(), vrc));
    25962597                        break;
    25972598                }
     
    26132614
    26142615    return vrc;
     2616}
     2617
     2618/**
     2619 * Sets an update error message to the current progress object + logs to release log.
     2620 *
     2621 * @returns Returns \a hrc for convenience.
     2622 * @param   hrc                 Progress operation result to set.
     2623 * @param   strMsg              Message to set.
     2624 */
     2625HRESULT GuestSessionTaskUpdateAdditions::setUpdateErrorMsg(HRESULT hrc, const Utf8Str &strMsg)
     2626{
     2627    Utf8Str const strLog = "Guest Additions Update failed: " + strMsg;
     2628    LogRel(("%s\n", strLog.c_str()));
     2629    return GuestSessionTask::setProgressErrorMsg(hrc, strLog);
     2630}
     2631
     2632/**
     2633 * Sets an update error message to the current progress object + logs to release log.
     2634 *
     2635 * @returns Returns \a hrc for convenience.
     2636 * @param   hrc                 Progress operation result to set.
     2637 * @param   strMsg              Message to set.
     2638 */
     2639HRESULT GuestSessionTaskUpdateAdditions::setUpdateErrorMsg(HRESULT hrc, const Utf8Str &strMsg, const GuestErrorInfo &guestErrorInfo)
     2640{
     2641    Utf8Str const strLog = strMsg + Utf8Str(": ") + GuestBase::getErrorAsString(guestErrorInfo);
     2642    return GuestSessionTaskUpdateAdditions::setProgressErrorMsg(hrc, strLog);
    26152643}
    26162644
     
    26312659    return VERR_NOT_SUPPORTED;
    26322660#else
    2633     LogRel(("Running %s ...\n", procInfo.mName.c_str()));
     2661    LogRel(("Guest Additions Update: Running \"%s\" ...\n", procInfo.mName.c_str()));
    26342662
    26352663    GuestProcessToolbox procToRun;
     
    26502678        {
    26512679            case VERR_GSTCTL_PROCESS_EXIT_CODE:
    2652                 setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    2653                                     Utf8StrFmt(tr("Running update file \"%s\" on guest failed: %Rrc"),
    2654                                                procInfo.mExecutable.c_str(), procToRun.getRc()));
     2680                setUpdateErrorMsg(VBOX_E_GSTCTL_GUEST_ERROR,
     2681                                  Utf8StrFmt(tr("Running update file \"%s\" on guest failed: %Rrc"),
     2682                                             procInfo.mExecutable.c_str(), procToRun.getRc()));
    26552683                break;
    26562684
    26572685            case VERR_GSTCTL_GUEST_ERROR:
    2658                 setProgressErrorMsg(VBOX_E_IPRT_ERROR, tr("Running update file on guest failed"),
    2659                                     GuestErrorInfo(GuestErrorInfo::Type_Process, vrcGuest, procInfo.mExecutable.c_str()));
     2686                setUpdateErrorMsg(VBOX_E_GSTCTL_GUEST_ERROR, tr("Running update file on guest failed"),
     2687                                  GuestErrorInfo(GuestErrorInfo::Type_Process, vrcGuest, procInfo.mExecutable.c_str()));
    26602688                break;
    26612689
    26622690            case VERR_INVALID_STATE: /** @todo Special guest control vrc needed! */
    2663                 setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    2664                                     Utf8StrFmt(tr("Update file \"%s\" reported invalid running state"),
    2665                                                procInfo.mExecutable.c_str()));
     2691                setUpdateErrorMsg(VBOX_E_GSTCTL_GUEST_ERROR,
     2692                                  Utf8StrFmt(tr("Update file \"%s\" reported invalid running state"),
     2693                                             procInfo.mExecutable.c_str()));
    26662694                break;
    26672695
    26682696            default:
    2669                 setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    2670                                     Utf8StrFmt(tr("Error while running update file \"%s\" on guest: %Rrc"),
    2671                                                procInfo.mExecutable.c_str(), vrc));
     2697                setUpdateErrorMsg(VBOX_E_GSTCTL_GUEST_ERROR,
     2698                                  Utf8StrFmt(tr("Error while running update file \"%s\" on guest: %Rrc"),
     2699                                             procInfo.mExecutable.c_str(), vrc));
    26722700                break;
    26732701        }
     
    27122740            vrc = runFileOnGuest(pSession, procInfo, true /* fSilent */);
    27132741            if (RT_FAILURE(vrc))
    2714                 hrc = setProgressErrorMsg(VBOX_E_GSTCTL_GUEST_ERROR,
    2715                                           Utf8StrFmt(tr("Automatic update of Guest Additions has failed: "
    2716                                                         "files were installed, but user services were not reloaded automatically. "
    2717                                                         "Please consider rebooting the guest")));
     2742                hrc = setUpdateErrorMsg(VBOX_E_GSTCTL_GUEST_ERROR,
     2743                                        Utf8StrFmt(tr("Files were installed, but user services were not reloaded automatically. "
     2744                                                      "Please consider rebooting the guest")));
    27182745        }
    27192746        else
    2720             hrc = setProgressErrorMsg(VBOX_E_GSTCTL_GUEST_ERROR,
    2721                                       Utf8StrFmt(tr("Automatic update of Guest Additions has failed: "
    2722                                                     "files were installed, but kernel modules were not reloaded automatically. "
    2723                                                     "Please consider rebooting the guest")));
     2747            hrc = setUpdateErrorMsg(VBOX_E_GSTCTL_GUEST_ERROR,
     2748                                    Utf8StrFmt(tr("Files were installed, but kernel modules were not reloaded automatically. "
     2749                                                  "Please consider rebooting the guest")));
    27242750    }
    27252751
     
    27722798                    vrc = checkGuestAdditionsStatus(pSession, osType);
    27732799                    if (RT_SUCCESS(vrc))
    2774                         LogRel(("Guest Additions were successfully reloaded after installation\n"));
     2800                        LogRel(("Guest Additions Update: Guest Additions were successfully reloaded after installation\n"));
    27752801                    else
    2776                         LogRel(("Guest Additions were failed to reload after installation, please consider rebooting the guest\n"));
     2802                        LogRel(("Guest Additions Update: Guest Additions were failed to reload after installation, please consider rebooting the guest\n"));
    27772803
    27782804                    vrc = pSession->Close();
     
    28092835    HRESULT hrc = S_OK;
    28102836
    2811     LogRel(("Automatic update of Guest Additions started, using \"%s\"\n", mSource.c_str()));
     2837    LogRel(("Guest Additions Update: Automatic update started, using \"%s\"\n", mSource.c_str()));
    28122838
    28132839    ComObjPtr<Guest> pGuest(mSession->i_getParent());
     
    28332859    if (FAILED(hrc)) vrc = VERR_TIMEOUT;
    28342860    if (vrc == VERR_TIMEOUT)
    2835         hrc = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED,
    2836                                   Utf8StrFmt(tr("Guest Additions were not ready within time, giving up")));
     2861        hrc = setUpdateErrorMsg(VBOX_E_NOT_SUPPORTED,
     2862                                Utf8StrFmt(tr("Guest Additions were not ready within time, giving up")));
    28372863#else
    28382864    /*
     
    28462872    {
    28472873        if (addsRunLevel == AdditionsRunLevelType_System)
    2848             hrc = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED,
    2849                                       Utf8StrFmt(tr("Guest Additions are installed but not fully loaded yet, aborting automatic update")));
     2874            hrc = setUpdateErrorMsg(VBOX_E_NOT_SUPPORTED,
     2875                                    Utf8StrFmt(tr("Guest Additions are installed but not fully loaded yet, aborting automatic update")));
    28502876        else
    2851             hrc = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED,
    2852                                       Utf8StrFmt(tr("Guest Additions not installed or ready, aborting automatic update")));
     2877            hrc = setUpdateErrorMsg(VBOX_E_NOT_SUPPORTED,
     2878                                    Utf8StrFmt(tr("Guest Additions not installed or ready, aborting automatic update")));
    28532879        vrc = VERR_NOT_SUPPORTED;
    28542880    }
     
    28662892            && RTStrVersionCompare(strAddsVer.c_str(), "4.1") < 0)
    28672893        {
    2868             hrc = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED,
    2869                                       Utf8StrFmt(tr("Guest has too old Guest Additions (%s) installed for automatic updating, please update manually"),
    2870                                                  strAddsVer.c_str()));
     2894            hrc = setUpdateErrorMsg(VBOX_E_NOT_SUPPORTED,
     2895                                    Utf8StrFmt(tr("Guest has too old Guest Additions (%s) installed for automatic updating, please update manually"),
     2896                                               strAddsVer.c_str()));
    28712897            vrc = VERR_NOT_SUPPORTED;
    28722898        }
     
    29002926                if (RT_FAILURE(vrc))
    29012927                {
    2902                     hrc = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED,
    2903                                               Utf8StrFmt(tr("Unable to detected guest OS version, please update manually")));
     2928                    hrc = setUpdateErrorMsg(VBOX_E_NOT_SUPPORTED,
     2929                                            Utf8StrFmt(tr("Unable to detected guest OS version, please update manually")));
    29042930                    vrc = VERR_NOT_SUPPORTED;
    29052931                }
     
    29202946                        if (!(mFlags & AdditionsUpdateFlag_WaitForUpdateStartOnly))
    29212947                        {
    2922                             hrc = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED,
    2923                                                       Utf8StrFmt(tr("Windows 2000 and XP are not supported for automatic updating due to WHQL interaction, please update manually")));
     2948                            hrc = setUpdateErrorMsg(VBOX_E_NOT_SUPPORTED,
     2949                                                    Utf8StrFmt(tr("Windows 2000 and XP are not supported for automatic updating due to WHQL interaction, please update manually")));
    29242950                            vrc = VERR_NOT_SUPPORTED;
    29252951                        }
     
    29282954                else
    29292955                {
    2930                     hrc = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED,
    2931                                               Utf8StrFmt(tr("%s (%s) not supported for automatic updating, please update manually"),
    2932                                                          strOSType.c_str(), strOSVer.c_str()));
     2956                    hrc = setUpdateErrorMsg(VBOX_E_NOT_SUPPORTED,
     2957                                            Utf8StrFmt(tr("%s (%s) not supported for automatic updating, please update manually"),
     2958                                                       strOSType.c_str(), strOSVer.c_str()));
    29332959                    vrc = VERR_NOT_SUPPORTED;
    29342960                }
     
    29462972                /** @todo Support Solaris. */
    29472973            {
    2948                 hrc = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED,
    2949                                           Utf8StrFmt(tr("Detected guest OS (%s) does not support automatic Guest Additions updating, please update manually"),
    2950                                                      strOSType.c_str()));
     2974                hrc = setUpdateErrorMsg(VBOX_E_NOT_SUPPORTED,
     2975                                        Utf8StrFmt(tr("Detected guest OS (%s) does not support automatic Guest Additions updating, please update manually"),
     2976                                                   strOSType.c_str()));
    29512977                vrc = VERR_NOT_SUPPORTED;
    29522978            }
     
    29632989        if (RT_FAILURE(vrc))
    29642990        {
    2965             hrc = setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    2966                                       Utf8StrFmt(tr("Unable to open Guest Additions .ISO file \"%s\": %Rrc"),
    2967                                                  mSource.c_str(), vrc));
     2991            hrc = setUpdateErrorMsg(VBOX_E_IPRT_ERROR,
     2992                                    Utf8StrFmt(tr("Unable to open Guest Additions .ISO file \"%s\": %Rrc"),
     2993                                               mSource.c_str(), vrc));
    29682994        }
    29692995        else
     
    29732999            if (RT_FAILURE(vrc))
    29743000            {
    2975                 hrc = setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    2976                                           Utf8StrFmt(tr("Unable to open file as ISO 9660 file system volume: %Rrc"), vrc));
     3001                hrc = setUpdateErrorMsg(VBOX_E_IPRT_ERROR,
     3002                                        Utf8StrFmt(tr("Unable to open file as ISO 9660 file system volume: %Rrc"), vrc));
    29773003            }
    29783004            else
     
    29993025                            strUpdateDir.append("/");
    30003026
    3001                         LogRel(("Guest Additions update directory is: %s\n", strUpdateDir.c_str()));
     3027                        LogRel(("Guest Additions Update: Update directory is '%s'\n", strUpdateDir.c_str()));
    30023028                    }
    30033029                    else
     
    30063032                        {
    30073033                            case VERR_GSTCTL_GUEST_ERROR:
    3008                                 hrc = setProgressErrorMsg(VBOX_E_IPRT_ERROR, tr("Creating update directory on guest failed"),
    3009                                                           GuestErrorInfo(GuestErrorInfo::Type_Directory, vrcGuest, strUpdateDir.c_str()));
     3034                                hrc = setUpdateErrorMsg(VBOX_E_IPRT_ERROR, tr("Creating update directory on guest failed"),
     3035                                                        GuestErrorInfo(GuestErrorInfo::Type_Directory, vrcGuest, strUpdateDir.c_str()));
    30103036                                break;
    30113037
    30123038                            default:
    3013                                 hrc = setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    3014                                                           Utf8StrFmt(tr("Creating update directory \"%s\" on guest failed: %Rrc"),
    3015                                                                      strUpdateDir.c_str(), vrc));
     3039                                hrc = setUpdateErrorMsg(VBOX_E_IPRT_ERROR,
     3040                                                        Utf8StrFmt(tr("Creating update directory \"%s\" on guest failed: %Rrc"),
     3041                                                                   strUpdateDir.c_str(), vrc));
    30163042                                break;
    30173043                        }
     
    30373063                            {
    30383064                                fInstallCert = true;
    3039                                 LogRel(("Certificates for auto updating WHQL drivers will be installed\n"));
     3065                                LogRel(("Guest Additions Update: Certificates for auto updating WHQL drivers will be installed\n"));
    30403066                            }
    30413067                            else
    3042                                 LogRel(("Skipping installation of certificates for WHQL drivers\n"));
     3068                                LogRel(("Guest Additions Update: Skipping installation of certificates for WHQL drivers\n"));
    30433069
    30443070                            if (fInstallCert)
     
    31853211                    uint8_t uStep = 40 / (uint8_t)mFiles.size(); Assert(mFiles.size() <= 10);
    31863212
    3187                     LogRel(("Copying over Guest Additions update files to the guest ...\n"));
     3213                    LogRel(("Guest Additions Update: Copying over update files to the guest ...\n"));
    31883214
    31893215                    std::vector<ISOFile>::const_iterator itFiles = mFiles.begin();
     
    31983224                            if (RT_FAILURE(vrc))
    31993225                            {
    3200                                 hrc = setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    3201                                                           Utf8StrFmt(tr("Error while copying file \"%s\" to \"%s\" on the guest: %Rrc"),
    3202                                                                      itFiles->strSource.c_str(), itFiles->strDest.c_str(), vrc));
     3226                                hrc = setUpdateErrorMsg(VBOX_E_IPRT_ERROR,
     3227                                                        Utf8StrFmt(tr("Error while copying file \"%s\" to \"%s\" on the guest: %Rrc"),
     3228                                                                   itFiles->strSource.c_str(), itFiles->strDest.c_str(), vrc));
    32033229                                break;
    32043230                            }
     
    32243250                    uint8_t uStep = 35 / (uint8_t)mFiles.size(); Assert(mFiles.size() <= 10);
    32253251
    3226                     LogRel(("Executing Guest Additions update files ...\n"));
     3252                    LogRel(("Guest Additions Update: Executing update files ...\n"));
    32273253
    32283254                    std::vector<ISOFile>::iterator itFiles = mFiles.begin();
     
    32563282                        if (pSession->i_isTerminated())
    32573283                        {
    3258                             LogRel(("Old guest session has terminated, waiting updated guest services to start\n"));
     3284                            LogRel(("Guest Additions Update: Old guest session has terminated, waiting updated guest services to start\n"));
    32593285
    32603286                            /* Wait for VBoxService to restart. */
    32613287                            vrc = waitForGuestSession(pSession->i_getParent(), osType);
    32623288                            if (RT_FAILURE(vrc))
    3263                                 hrc = setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    3264                                                           Utf8StrFmt(tr("Automatic update of Guest Additions has failed: "
    3265                                                                         "guest services were not restarted, please reinstall Guest Additions manually")));
     3289                                hrc = setUpdateErrorMsg(VBOX_E_IPRT_ERROR,
     3290                                                        Utf8StrFmt(tr("Guest services were not restarted, please reinstall Guest Additions manually")));
    32663291                        }
    32673292                        else
    32683293                        {
    32693294                            vrc = VERR_TRY_AGAIN;
    3270                             hrc = setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    3271                                                       Utf8StrFmt(tr("Old guest session is still active, guest services were not restarted "
    3272                                                                     "after installation, please reinstall Guest Additions manually")));
     3295                            hrc = setUpdateErrorMsg(VBOX_E_IPRT_ERROR,
     3296                                                    Utf8StrFmt(tr("Old guest session is still active, guest services were not restarted "
     3297                                                                  "after installation, please reinstall Guest Additions manually")));
    32733298                        }
    32743299                    }
     
    32763301                    if (RT_SUCCESS(vrc))
    32773302                    {
    3278                         LogRel(("Automatic update of Guest Additions succeeded\n"));
     3303                        LogRel(("Guest Additions Update: Automatic update succeeded\n"));
    32793304                        hrc = setProgressSuccess();
    32803305                    }
     
    32903315        if (vrc == VERR_CANCELLED)
    32913316        {
    3292             LogRel(("Automatic update of Guest Additions was canceled\n"));
    3293 
    3294             hrc = setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    3295                                       Utf8StrFmt(tr("Installation was canceled")));
     3317            LogRel(("Guest Additions Update: Automatic update was canceled\n"));
     3318
     3319            hrc = setUpdateErrorMsg(E_ABORT,
     3320                                    Utf8StrFmt(tr("Operation was canceled")));
    32963321        }
    32973322        else if (vrc == VERR_TIMEOUT)
    32983323        {
    3299             LogRel(("Automatic update of Guest Additions has timed out\n"));
    3300 
    3301             hrc = setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    3302                                       Utf8StrFmt(tr("Installation has timed out")));
     3324            LogRel(("Guest Additions Update: Automatic update has timed out\n"));
     3325
     3326            hrc = setUpdateErrorMsg(E_FAIL,
     3327                                    Utf8StrFmt(tr("Operation has timed out")));
    33033328        }
    33043329        else
     
    33223347            }
    33233348
    3324             LogRel(("Automatic update of Guest Additions failed: %s (%Rhrc)\n",
    3325                     strError.c_str(), hrc));
    3326         }
    3327 
    3328         LogRel(("Please install Guest Additions manually\n"));
     3349            LogRel(("Guest Additions Update: Automatic update failed: %s (vrc=%Rrc, hrc=%Rhrc)\n",
     3350                    strError.c_str(), vrc, hrc));
     3351        }
     3352
     3353        LogRel(("Guest Additions Update: An error has occurred (see above). Please install Guest Additions manually\n"));
    33293354    }
    33303355
     
    33343359    return vrc;
    33353360}
     3361
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