Changeset 97540 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Nov 14, 2022 8:26:53 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
r97538 r97540 2558 2558 2559 2559 return vrc; 2560 } 2561 2562 /** 2563 * Helper function which waits until Guest Additions services started. 2564 * 2565 * @returns 0 on success or VERR_TIMEOUT if guest services were not 2566 * started on time. 2567 * @param pGuest Guest interface to use. 2568 */ 2569 int GuestSessionTaskUpdateAdditions::waitForGuestSession(ComObjPtr<Guest> pGuest) 2570 { 2571 int vrc = VERR_GSTCTL_GUEST_ERROR; 2572 int rc = VERR_TIMEOUT; 2573 2574 uint64_t tsStart = RTTimeSystemMilliTS(); 2575 const uint64_t timeoutMs = 600 * 1000; 2576 2577 AssertReturn(!pGuest.isNull(), VERR_TIMEOUT); 2578 2579 do 2580 { 2581 ComObjPtr<GuestSession> pSession; 2582 GuestCredentials guestCreds; 2583 GuestSessionStartupInfo startupInfo; 2584 2585 startupInfo.mName = "Guest Additions connection checker"; 2586 startupInfo.mOpenTimeoutMS = 100; 2587 2588 vrc = pGuest->i_sessionCreate(startupInfo, guestCreds, pSession); 2589 if (RT_SUCCESS(vrc)) 2590 { 2591 int vrcGuest = VERR_GSTCTL_GUEST_ERROR; /* unused. */ 2592 2593 Assert(!pSession.isNull()); 2594 2595 vrc = pSession->i_startSession(&vrcGuest); 2596 if (RT_SUCCESS(vrc)) 2597 { 2598 GuestSessionWaitResult_T enmWaitResult = GuestSessionWaitResult_None; 2599 int rcGuest = 0; /* unused. */ 2600 2601 /* Wait for VBoxService to start. */ 2602 vrc = pSession->i_waitFor(GuestSessionWaitForFlag_Start, 100 /* timeout, ms */, enmWaitResult, &rcGuest); 2603 if (RT_SUCCESS(vrc)) 2604 { 2605 vrc = pSession->Close(); 2606 rc = 0; 2607 break; 2608 } 2609 } 2610 2611 vrc = pSession->Close(); 2612 } 2613 2614 RTThreadSleep(100); 2615 2616 } while ((RTTimeSystemMilliTS() - tsStart) < timeoutMs); 2617 2618 return rc; 2560 2619 } 2561 2620 … … 3046 3105 if (RT_SUCCESS(vrc)) 3047 3106 { 3048 LogRel(("Automatic update of Guest Additions succeeded\n")); 3049 vrc = setProgressSuccess(); 3107 /* Linux Guest Additions will restart VBoxService during installation process. 3108 * In this case, connection to the guest will be temporary lost until new 3109 * kernel modules will be rebuilt, loaded and new VBoxService restarted. 3110 * Handle this case here: check if old connection was terminated and 3111 * new one has started. */ 3112 if (osType == eOSType_Linux) 3113 { 3114 if (pSession->i_isTerminated()) 3115 { 3116 LogRel(("Old guest session has terminated, waiting updated guest services to start\n")); 3117 3118 /* Wait for VBoxService to restart. */ 3119 vrc = waitForGuestSession(pSession->i_getParent()); 3120 if (RT_FAILURE(vrc)) 3121 hrc = setProgressErrorMsg(VBOX_E_IPRT_ERROR, 3122 Utf8StrFmt(tr("Automatic update of Guest Additions has failed: " 3123 "guest services were not restarted, please reinstall Guest Additions"))); 3124 } 3125 else 3126 { 3127 vrc = VERR_TRY_AGAIN; 3128 hrc = setProgressErrorMsg(VBOX_E_IPRT_ERROR, 3129 Utf8StrFmt(tr("Old guest session is still active, guest services were not restarted " 3130 "after installation, please reinstall Guest Additions"))); 3131 } 3132 } 3133 3134 if (RT_SUCCESS(vrc)) 3135 { 3136 LogRel(("Automatic update of Guest Additions succeeded\n")); 3137 hrc = setProgressSuccess(); 3138 } 3050 3139 } 3051 3140 } … … 3063 3152 hrc = setProgressErrorMsg(VBOX_E_IPRT_ERROR, 3064 3153 Utf8StrFmt(tr("Installation was canceled"))); 3154 } 3155 else if (vrc == VERR_TIMEOUT) 3156 { 3157 LogRel(("Automatic update of Guest Additions has timed out\n")); 3158 3159 hrc = setProgressErrorMsg(VBOX_E_IPRT_ERROR, 3160 Utf8StrFmt(tr("Installation has timed out"))); 3065 3161 } 3066 3162 else
Note:
See TracChangeset
for help on using the changeset viewer.