Changeset 104636 in vbox for trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
- Timestamp:
- May 15, 2024 9:35:25 AM (7 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
r104178 r104636 2570 2570 if (RT_SUCCESS(vrc)) 2571 2571 { 2572 LogRel((" Copying Guest Additionsinstaller file \"%s\" to \"%s\" on guest ...\n",2572 LogRel(("Guest Additions Update: Copying installer file \"%s\" to \"%s\" on guest ...\n", 2573 2573 strFileSrc.c_str(), strFileDst.c_str())); 2574 2574 … … 2587 2587 { 2588 2588 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())); 2590 2591 break; 2591 2592 2592 2593 default: 2593 set ProgressErrorMsg(VBOX_E_IPRT_ERROR,2594 2595 2594 setUpdateErrorMsg(VBOX_E_GSTCTL_GUEST_ERROR, 2595 Utf8StrFmt(tr("Guest file \"%s\" could not be opened: %Rrc"), 2596 strFileDst.c_str(), vrc)); 2596 2597 break; 2597 2598 } … … 2613 2614 2614 2615 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 */ 2625 HRESULT 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 */ 2639 HRESULT 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); 2615 2643 } 2616 2644 … … 2631 2659 return VERR_NOT_SUPPORTED; 2632 2660 #else 2633 LogRel((" Running %s...\n", procInfo.mName.c_str()));2661 LogRel(("Guest Additions Update: Running \"%s\" ...\n", procInfo.mName.c_str())); 2634 2662 2635 2663 GuestProcessToolbox procToRun; … … 2650 2678 { 2651 2679 case VERR_GSTCTL_PROCESS_EXIT_CODE: 2652 set ProgressErrorMsg(VBOX_E_IPRT_ERROR,2653 2654 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())); 2655 2683 break; 2656 2684 2657 2685 case VERR_GSTCTL_GUEST_ERROR: 2658 set ProgressErrorMsg(VBOX_E_IPRT_ERROR, tr("Running update file on guest failed"),2659 2686 setUpdateErrorMsg(VBOX_E_GSTCTL_GUEST_ERROR, tr("Running update file on guest failed"), 2687 GuestErrorInfo(GuestErrorInfo::Type_Process, vrcGuest, procInfo.mExecutable.c_str())); 2660 2688 break; 2661 2689 2662 2690 case VERR_INVALID_STATE: /** @todo Special guest control vrc needed! */ 2663 set ProgressErrorMsg(VBOX_E_IPRT_ERROR,2664 2665 2691 setUpdateErrorMsg(VBOX_E_GSTCTL_GUEST_ERROR, 2692 Utf8StrFmt(tr("Update file \"%s\" reported invalid running state"), 2693 procInfo.mExecutable.c_str())); 2666 2694 break; 2667 2695 2668 2696 default: 2669 set ProgressErrorMsg(VBOX_E_IPRT_ERROR,2670 2671 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)); 2672 2700 break; 2673 2701 } … … 2712 2740 vrc = runFileOnGuest(pSession, procInfo, true /* fSilent */); 2713 2741 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"))); 2718 2745 } 2719 2746 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"))); 2724 2750 } 2725 2751 … … 2772 2798 vrc = checkGuestAdditionsStatus(pSession, osType); 2773 2799 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")); 2775 2801 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")); 2777 2803 2778 2804 vrc = pSession->Close(); … … 2809 2835 HRESULT hrc = S_OK; 2810 2836 2811 LogRel((" Automatic update of Guest Additionsstarted, using \"%s\"\n", mSource.c_str()));2837 LogRel(("Guest Additions Update: Automatic update started, using \"%s\"\n", mSource.c_str())); 2812 2838 2813 2839 ComObjPtr<Guest> pGuest(mSession->i_getParent()); … … 2833 2859 if (FAILED(hrc)) vrc = VERR_TIMEOUT; 2834 2860 if (vrc == VERR_TIMEOUT) 2835 hrc = set ProgressErrorMsg(VBOX_E_NOT_SUPPORTED,2836 2861 hrc = setUpdateErrorMsg(VBOX_E_NOT_SUPPORTED, 2862 Utf8StrFmt(tr("Guest Additions were not ready within time, giving up"))); 2837 2863 #else 2838 2864 /* … … 2846 2872 { 2847 2873 if (addsRunLevel == AdditionsRunLevelType_System) 2848 hrc = set ProgressErrorMsg(VBOX_E_NOT_SUPPORTED,2849 2874 hrc = setUpdateErrorMsg(VBOX_E_NOT_SUPPORTED, 2875 Utf8StrFmt(tr("Guest Additions are installed but not fully loaded yet, aborting automatic update"))); 2850 2876 else 2851 hrc = set ProgressErrorMsg(VBOX_E_NOT_SUPPORTED,2852 2877 hrc = setUpdateErrorMsg(VBOX_E_NOT_SUPPORTED, 2878 Utf8StrFmt(tr("Guest Additions not installed or ready, aborting automatic update"))); 2853 2879 vrc = VERR_NOT_SUPPORTED; 2854 2880 } … … 2866 2892 && RTStrVersionCompare(strAddsVer.c_str(), "4.1") < 0) 2867 2893 { 2868 hrc = set ProgressErrorMsg(VBOX_E_NOT_SUPPORTED,2869 2870 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())); 2871 2897 vrc = VERR_NOT_SUPPORTED; 2872 2898 } … … 2900 2926 if (RT_FAILURE(vrc)) 2901 2927 { 2902 hrc = set ProgressErrorMsg(VBOX_E_NOT_SUPPORTED,2903 2928 hrc = setUpdateErrorMsg(VBOX_E_NOT_SUPPORTED, 2929 Utf8StrFmt(tr("Unable to detected guest OS version, please update manually"))); 2904 2930 vrc = VERR_NOT_SUPPORTED; 2905 2931 } … … 2920 2946 if (!(mFlags & AdditionsUpdateFlag_WaitForUpdateStartOnly)) 2921 2947 { 2922 hrc = set ProgressErrorMsg(VBOX_E_NOT_SUPPORTED,2923 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"))); 2924 2950 vrc = VERR_NOT_SUPPORTED; 2925 2951 } … … 2928 2954 else 2929 2955 { 2930 hrc = set ProgressErrorMsg(VBOX_E_NOT_SUPPORTED,2931 2932 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())); 2933 2959 vrc = VERR_NOT_SUPPORTED; 2934 2960 } … … 2946 2972 /** @todo Support Solaris. */ 2947 2973 { 2948 hrc = set ProgressErrorMsg(VBOX_E_NOT_SUPPORTED,2949 2950 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())); 2951 2977 vrc = VERR_NOT_SUPPORTED; 2952 2978 } … … 2963 2989 if (RT_FAILURE(vrc)) 2964 2990 { 2965 hrc = set ProgressErrorMsg(VBOX_E_IPRT_ERROR,2966 2967 2991 hrc = setUpdateErrorMsg(VBOX_E_IPRT_ERROR, 2992 Utf8StrFmt(tr("Unable to open Guest Additions .ISO file \"%s\": %Rrc"), 2993 mSource.c_str(), vrc)); 2968 2994 } 2969 2995 else … … 2973 2999 if (RT_FAILURE(vrc)) 2974 3000 { 2975 hrc = set ProgressErrorMsg(VBOX_E_IPRT_ERROR,2976 3001 hrc = setUpdateErrorMsg(VBOX_E_IPRT_ERROR, 3002 Utf8StrFmt(tr("Unable to open file as ISO 9660 file system volume: %Rrc"), vrc)); 2977 3003 } 2978 3004 else … … 2999 3025 strUpdateDir.append("/"); 3000 3026 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())); 3002 3028 } 3003 3029 else … … 3006 3032 { 3007 3033 case VERR_GSTCTL_GUEST_ERROR: 3008 hrc = set ProgressErrorMsg(VBOX_E_IPRT_ERROR, tr("Creating update directory on guest failed"),3009 3034 hrc = setUpdateErrorMsg(VBOX_E_IPRT_ERROR, tr("Creating update directory on guest failed"), 3035 GuestErrorInfo(GuestErrorInfo::Type_Directory, vrcGuest, strUpdateDir.c_str())); 3010 3036 break; 3011 3037 3012 3038 default: 3013 hrc = set ProgressErrorMsg(VBOX_E_IPRT_ERROR,3014 3015 3039 hrc = setUpdateErrorMsg(VBOX_E_IPRT_ERROR, 3040 Utf8StrFmt(tr("Creating update directory \"%s\" on guest failed: %Rrc"), 3041 strUpdateDir.c_str(), vrc)); 3016 3042 break; 3017 3043 } … … 3037 3063 { 3038 3064 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")); 3040 3066 } 3041 3067 else 3042 LogRel((" Skipping installation of certificates for WHQL drivers\n"));3068 LogRel(("Guest Additions Update: Skipping installation of certificates for WHQL drivers\n")); 3043 3069 3044 3070 if (fInstallCert) … … 3185 3211 uint8_t uStep = 40 / (uint8_t)mFiles.size(); Assert(mFiles.size() <= 10); 3186 3212 3187 LogRel((" Copying over Guest Additionsupdate files to the guest ...\n"));3213 LogRel(("Guest Additions Update: Copying over update files to the guest ...\n")); 3188 3214 3189 3215 std::vector<ISOFile>::const_iterator itFiles = mFiles.begin(); … … 3198 3224 if (RT_FAILURE(vrc)) 3199 3225 { 3200 hrc = set ProgressErrorMsg(VBOX_E_IPRT_ERROR,3201 3202 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)); 3203 3229 break; 3204 3230 } … … 3224 3250 uint8_t uStep = 35 / (uint8_t)mFiles.size(); Assert(mFiles.size() <= 10); 3225 3251 3226 LogRel((" Executing Guest Additionsupdate files ...\n"));3252 LogRel(("Guest Additions Update: Executing update files ...\n")); 3227 3253 3228 3254 std::vector<ISOFile>::iterator itFiles = mFiles.begin(); … … 3256 3282 if (pSession->i_isTerminated()) 3257 3283 { 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")); 3259 3285 3260 3286 /* Wait for VBoxService to restart. */ 3261 3287 vrc = waitForGuestSession(pSession->i_getParent(), osType); 3262 3288 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"))); 3266 3291 } 3267 3292 else 3268 3293 { 3269 3294 vrc = VERR_TRY_AGAIN; 3270 hrc = set ProgressErrorMsg(VBOX_E_IPRT_ERROR,3271 3272 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"))); 3273 3298 } 3274 3299 } … … 3276 3301 if (RT_SUCCESS(vrc)) 3277 3302 { 3278 LogRel((" Automatic update of Guest Additionssucceeded\n"));3303 LogRel(("Guest Additions Update: Automatic update succeeded\n")); 3279 3304 hrc = setProgressSuccess(); 3280 3305 } … … 3290 3315 if (vrc == VERR_CANCELLED) 3291 3316 { 3292 LogRel((" Automatic update of Guest Additionswas canceled\n"));3293 3294 hrc = set ProgressErrorMsg(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"))); 3296 3321 } 3297 3322 else if (vrc == VERR_TIMEOUT) 3298 3323 { 3299 LogRel((" Automatic update of Guest Additionshas timed out\n"));3300 3301 hrc = set ProgressErrorMsg(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"))); 3303 3328 } 3304 3329 else … … 3322 3347 } 3323 3348 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")); 3329 3354 } 3330 3355 … … 3334 3359 return vrc; 3335 3360 } 3361
Note:
See TracChangeset
for help on using the changeset viewer.