Changeset 106142 in vbox for trunk/src/VBox/Main
- Timestamp:
- Sep 24, 2024 3:51:42 PM (5 months ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GuestSessionImplTasks.h
r106061 r106142 459 459 460 460 int checkGuestAdditionsStatus(GuestSession *pSession, eOSType osType); 461 int waitForGuestSession(ComObjPtr<Guest> pGuest, eOSType osType );461 int waitForGuestSession(ComObjPtr<Guest> pGuest, eOSType osType, ComObjPtr<GuestSession> &pNewSession); 462 462 463 463 /** Files to handle. */ -
trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
r106141 r106142 2752 2752 && !fSilent) 2753 2753 { 2754 Utf8Str cmdLine; 2755 for (size_t iArg = 0; iArg < procInfo.mArguments.size(); iArg++) 2756 { 2757 cmdLine.append(procInfo.mArguments.at(iArg)); 2758 if (iArg < procInfo.mArguments.size() - 1) 2759 cmdLine.append(" "); 2760 } 2761 2754 2762 switch (vrc) 2755 2763 { … … 2761 2769 setUpdateErrorMsg(VBOX_E_GSTCTL_GUEST_ERROR, 2762 2770 Utf8StrFmt(tr("Running update file \"%s\" on guest failed with exit code %d"), 2763 procInfo.mExecutable.c_str(), iExitCode));2771 cmdLine.c_str(), iExitCode)); 2764 2772 break; 2765 2773 … … 2767 2775 case VERR_GSTCTL_GUEST_ERROR: 2768 2776 setUpdateErrorMsg(VBOX_E_GSTCTL_GUEST_ERROR, tr("Running update file on guest failed"), 2769 GuestErrorInfo(GuestErrorInfo::Type_Process, vrcGuest, procInfo.mExecutable.c_str()));2777 GuestErrorInfo(GuestErrorInfo::Type_Process, vrcGuest, cmdLine.c_str())); 2770 2778 break; 2771 2779 … … 2778 2786 default: 2779 2787 setUpdateErrorMsg(VBOX_E_GSTCTL_GUEST_ERROR, 2780 Utf8StrFmt(tr("Error while running update file\"%s\" on guest: %Rrc"),2781 procInfo.mExecutable.c_str(), vrc));2788 Utf8StrFmt(tr("Error while running update command \"%s\" on guest: %Rrc"), 2789 cmdLine.c_str(), vrc)); 2782 2790 break; 2783 2791 } … … 2806 2814 /* Check if Guest Additions kernel modules were loaded. */ 2807 2815 GuestProcessStartupInfo procInfo; 2816 procInfo.mName = "Kernel modules status check"; 2808 2817 procInfo.mFlags = ProcessCreateFlag_None; 2809 2818 procInfo.mExecutable = Utf8Str("/bin/sh");; … … 2817 2826 /* Replace the last argument with corresponding value and check 2818 2827 * if Guest Additions user services were started. */ 2828 procInfo.mName = "User services status check"; 2819 2829 procInfo.mArguments.pop_back(); 2820 2830 procInfo.mArguments.push_back("status-user"); … … 2838 2848 * Helper function which waits until Guest Additions services started. 2839 2849 * 2850 * Newly created guest session needs to be closed by caller. 2851 * 2840 2852 * @returns 0 on success or VERR_TIMEOUT if guest services were not 2841 2853 * started on time. 2842 * @param pGuest Guest interface to use. 2843 * @param osType Guest type. 2854 * @param pGuest Guest interface to use. 2855 * @param osType Guest type. 2856 * @param pNewSession Output parameter for newly established guest type. 2844 2857 */ 2845 int GuestSessionTaskUpdateAdditions::waitForGuestSession(ComObjPtr<Guest> pGuest, eOSType osType) 2858 int GuestSessionTaskUpdateAdditions::waitForGuestSession(ComObjPtr<Guest> pGuest, eOSType osType, 2859 ComObjPtr<GuestSession> &pNewSession) 2846 2860 { 2847 2861 int vrc = VERR_GSTCTL_GUEST_ERROR; … … 2855 2869 do 2856 2870 { 2857 ComObjPtr<GuestSession> pSession;2858 2871 GuestCredentials guestCreds; 2859 2872 GuestSessionStartupInfo startupInfo; 2860 2873 2861 startupInfo.mName = "Guest Additions connection check er";2874 startupInfo.mName = "Guest Additions connection check"; 2862 2875 startupInfo.mOpenTimeoutMS = 100; 2863 2876 2864 vrc = pGuest->i_sessionCreate(startupInfo, guestCreds, p Session);2877 vrc = pGuest->i_sessionCreate(startupInfo, guestCreds, pNewSession); 2865 2878 if (RT_SUCCESS(vrc)) 2866 2879 { 2867 Assert(!p Session.isNull());2880 Assert(!pNewSession.isNull()); 2868 2881 2869 2882 int vrcGuest = VERR_GSTCTL_GUEST_ERROR; /* unused. */ 2870 vrc = p Session->i_startSession(&vrcGuest);2883 vrc = pNewSession->i_startSession(&vrcGuest); 2871 2884 if (RT_SUCCESS(vrc)) 2872 2885 { … … 2874 2887 GuestSessionWaitResult_T enmWaitResult = GuestSessionWaitResult_None; 2875 2888 int vrcGuest2 = VINF_SUCCESS; /* unused. */ 2876 vrc = p Session->i_waitFor(GuestSessionWaitForFlag_Start, 100 /* timeout, ms */, enmWaitResult, &vrcGuest2);2889 vrc = pNewSession->i_waitFor(GuestSessionWaitForFlag_Start, 100 /* timeout, ms */, enmWaitResult, &vrcGuest2); 2877 2890 if (RT_SUCCESS(vrc)) 2878 2891 { 2879 2892 /* Make sure Guest Additions were reloaded on the guest side. */ 2880 vrc = checkGuestAdditionsStatus(p Session, osType);2893 vrc = checkGuestAdditionsStatus(pNewSession, osType); 2881 2894 if (RT_SUCCESS(vrc)) 2882 2895 LogRel(("Guest Additions Update: Guest Additions were successfully reloaded after installation\n")); … … 2884 2897 LogRel(("Guest Additions Update: Guest Additions were failed to reload after installation, please consider rebooting the guest\n")); 2885 2898 2886 vrc = pSession->Close();2887 2899 vrcRet = VINF_SUCCESS; 2888 2900 break; … … 2890 2902 } 2891 2903 2892 vrc = p Session->Close();2904 vrc = pNewSession->Close(); 2893 2905 } 2894 2906 … … 3364 3376 if (pSession->i_isTerminated()) 3365 3377 { 3378 ComObjPtr<GuestSession> pNewSession; 3379 3366 3380 LogRel(("Guest Additions Update: Old guest session has terminated, waiting updated guest services to start\n")); 3367 3381 3368 3382 /* Wait for VBoxService to restart. */ 3369 vrc = waitForGuestSession(pSession->i_getParent(), osType); 3370 if (RT_FAILURE(vrc)) 3383 vrc = waitForGuestSession(pSession->i_getParent(), osType, pNewSession); 3384 if (RT_SUCCESS(vrc)) 3385 { 3386 hrc = pNewSession->i_directoryRemove(strUpdateDir, DIRREMOVEREC_FLAG_RECURSIVE | DIRREMOVEREC_FLAG_CONTENT_AND_DIR, &vrc); 3387 LogRel(("Cleanup Guest Additions update directory '%s', hrc=%Rrc, vrc=%Rrc\n", 3388 strUpdateDir.c_str(), hrc, vrc)); 3389 pNewSession->Close(); 3390 } 3391 else 3371 3392 hrc = setUpdateErrorMsg(VBOX_E_IPRT_ERROR, 3372 3393 Utf8StrFmt(tr("Guest services were not restarted, please reinstall Guest Additions manually")));
Note:
See TracChangeset
for help on using the changeset viewer.