Changeset 35460 in vbox
- Timestamp:
- Jan 10, 2011 2:24:13 PM (14 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/VirtualBox.xidl
r35358 r35460 3 3 <!-- 4 4 5 Copyright (C) 2006-201 0Oracle Corporation5 Copyright (C) 2006-2011 Oracle Corporation 6 6 7 7 This file is part of VirtualBox Open Source Edition (OSE), as … … 2907 2907 <interface 2908 2908 name="IInternalMachineControl" extends="$unknown" 2909 uuid=" 476126af-e223-4490-a8a0-b1f1575be013"2909 uuid="8e723ab0-812c-5662-dd8e-7ebc89637acf" 2910 2910 internal="yes" 2911 2911 wsmap="suppress" … … 2957 2957 </desc> 2958 2958 <param name="result" type="long" dir="in"/> 2959 </method> 2960 2961 <method name="beginPoweringDown"> 2962 <desc> 2963 Called by the VM process to inform the server it wants to 2964 stop the VM execution and power down. 2965 </desc> 2966 <param name="progress" type="IProgress" dir="out"> 2967 <desc> 2968 Progress object created by VBoxSVC to wait until 2969 the VM is powered down. 2970 </desc> 2971 </param> 2972 </method> 2973 2974 <method name="endPoweringDown"> 2975 <desc> 2976 Called by the VM process to inform the server that powering 2977 down previously requested by #beginPoweringDown is either 2978 successfully finished or there was a failure. 2979 2980 <result name="VBOX_E_FILE_ERROR"> 2981 Settings file not accessible. 2982 </result> 2983 <result name="VBOX_E_XML_ERROR"> 2984 Could not parse the settings file. 2985 </result> 2986 2987 </desc> 2988 2989 <param name="result" type="long" dir="in"> 2990 <desc>@c S_OK to indicate success. 2991 </desc> 2992 </param> 2993 <param name="errMsg" type="wstring" dir="in"> 2994 <desc>@c human readable error message in case of failure. 2995 </desc> 2996 </param> 2959 2997 </method> 2960 2998 -
trunk/src/VBox/Main/include/ConsoleImpl.h
r35369 r35460 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2011 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 435 435 436 436 HRESULT powerUp(IProgress **aProgress, bool aPaused); 437 HRESULT powerDown( Progress *aProgress = NULL);437 HRESULT powerDown(IProgress *aProgress = NULL); 438 438 439 439 HRESULT callTapSetupApplication(bool isStatic, RTFILE tapFD, Bstr &tapDevice, -
trunk/src/VBox/Main/include/MachineImpl.h
r35358 r35460 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2011 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 927 927 STDMETHOD(BeginPowerUp)(IProgress *aProgress); 928 928 STDMETHOD(EndPowerUp)(LONG iResult); 929 STDMETHOD(BeginPoweringDown)(IProgress **aProgress); 930 STDMETHOD(EndPoweringDown)(LONG aResult, IN_BSTR aErrMsg); 929 931 STDMETHOD(RunUSBDeviceFilters)(IUSBDevice *aUSBDevice, BOOL *aMatched, ULONG *aMaskedIfs); 930 932 STDMETHOD(CaptureUSBDevice)(IN_BSTR aId); -
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r35421 r35460 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2011 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 142 142 struct VMTask 143 143 { 144 VMTask(Console *aConsole, bool aUsesVMPtr) 144 VMTask(Console *aConsole, 145 Progress *aProgress, 146 const ComPtr<IProgress> &aServerProgress, 147 bool aUsesVMPtr) 145 148 : mConsole(aConsole), 146 149 mConsoleCaller(aConsole), 150 mProgress(aProgress), 151 mServerProgress(aServerProgress), 147 152 mVMCallerAdded(false) 148 153 { … … 178 183 const ComObjPtr<Console> mConsole; 179 184 AutoCaller mConsoleCaller; 185 const ComObjPtr<Progress> mProgress; 186 Utf8Str mErrorMsg; 187 const ComPtr<IProgress> mServerProgress; 180 188 181 189 private: … … 185 193 }; 186 194 187 struct VMProgressTask : public VMTask 188 { 189 VMProgressTask(Console *aConsole, 190 Progress *aProgress, 191 bool aUsesVMPtr) 192 : VMTask(aConsole, aUsesVMPtr), 193 mProgress(aProgress) 194 {} 195 196 const ComObjPtr<Progress> mProgress; 197 198 Utf8Str mErrorMsg; 199 }; 200 201 struct VMTakeSnapshotTask : public VMProgressTask 195 struct VMTakeSnapshotTask : public VMTask 202 196 { 203 197 VMTakeSnapshotTask(Console *aConsole, … … 205 199 IN_BSTR aName, 206 200 IN_BSTR aDescription) 207 : VMProgressTask(aConsole, aProgress, false /* aUsesVMPtr */), 201 : VMTask(aConsole, aProgress, NULL /* aServerProgress */, 202 false /* aUsesVMPtr */), 208 203 bstrName(aName), 209 204 bstrDescription(aDescription), … … 219 214 }; 220 215 221 struct VMPowerUpTask : public VM ProgressTask216 struct VMPowerUpTask : public VMTask 222 217 { 223 218 VMPowerUpTask(Console *aConsole, 224 219 Progress *aProgress) 225 : VMProgressTask(aConsole, aProgress, false /* aUsesVMPtr */), 220 : VMTask(aConsole, aProgress, NULL /* aServerProgress */, 221 false /* aUsesVMPtr */), 226 222 mConfigConstructor(NULL), 227 223 mStartPaused(false), … … 242 238 }; 243 239 244 struct VMSaveTask : public VMProgressTask 245 { 246 VMSaveTask(Console *aConsole, Progress *aProgress, const ComPtr<IProgress> &aServerProgress) 247 : VMProgressTask(aConsole, aProgress, true /* aUsesVMPtr */), 248 mLastMachineState(MachineState_Null), 249 mServerProgress(aServerProgress) 240 struct VMPowerDownTask : public VMTask 241 { 242 VMPowerDownTask(Console *aConsole, 243 const ComPtr<IProgress> &aServerProgress, 244 MachineState_T aLastMachineState) 245 : VMTask(aConsole, NULL /* aProgress */, aServerProgress, 246 true /* aUsesVMPtr */), 247 mLastMachineState(aLastMachineState) 248 {} 249 250 MachineState_T mLastMachineState; 251 }; 252 253 struct VMSaveTask : public VMTask 254 { 255 VMSaveTask(Console *aConsole, 256 const ComPtr<IProgress> &aServerProgress, 257 const Utf8Str &aSavedStateFile, 258 MachineState_T aLastMachineState) 259 : VMTask(aConsole, NULL /* aProgress */, aServerProgress, 260 true /* aUsesVMPtr */), 261 mSavedStateFile(aSavedStateFile), 262 mLastMachineState(aLastMachineState) 250 263 {} 251 264 252 265 Utf8Str mSavedStateFile; 253 266 MachineState_T mLastMachineState; 254 ComPtr<IProgress> mServerProgress;255 267 }; 256 268 … … 1398 1410 { 1399 1411 LogFunc(("Console::doGuestPropNotification: hrc=%Rhrc pCBData={.pcszName=%s, .pcszValue=%s, .pcszFlags=%s}\n", 1400 pCBData->pcszName, pCBData->pcszValue, pCBData->pcszFlags));1412 hrc, pCBData->pcszName, pCBData->pcszValue, pCBData->pcszFlags)); 1401 1413 rc = Global::vboxStatusCodeFromCOM(hrc); 1402 1414 } … … 1723 1735 STDMETHODIMP Console::PowerDown(IProgress **aProgress) 1724 1736 { 1725 if (aProgress == NULL)1726 return E_POINTER;1727 1728 1737 LogFlowThisFuncEnter(); 1729 1738 LogFlowThisFunc(("mMachineState=%d\n", mMachineState)); 1739 1740 CheckComArgOutPointerValid(aProgress); 1730 1741 1731 1742 AutoCaller autoCaller(this); … … 1785 1796 LogFlowThisFunc(("Initiating SHUTDOWN request...\n")); 1786 1797 1787 /* create an IProgress object to track progress of this operation */ 1788 ComObjPtr<Progress> pProgress; 1789 pProgress.createObject(); 1790 pProgress->init(static_cast<IConsole *>(this), 1791 Bstr(tr("Stopping virtual machine")).raw(), 1792 FALSE /* aCancelable */); 1793 1794 /* setup task object and thread to carry out the operation asynchronously */ 1795 std::auto_ptr<VMProgressTask> task(new VMProgressTask(this, pProgress, true /* aUsesVMPtr */)); 1796 AssertReturn(task->isOk(), E_FAIL); 1797 1798 int vrc = RTThreadCreate(NULL, Console::powerDownThread, 1799 (void *) task.get(), 0, 1800 RTTHREADTYPE_MAIN_WORKER, 0, 1801 "VMPowerDown"); 1802 if (RT_FAILURE(vrc)) 1803 return setError(E_FAIL, "Could not create VMPowerDown thread (%Rrc)", vrc); 1804 1805 /* task is now owned by powerDownThread(), so release it */ 1806 task.release(); 1807 1808 /* go to Stopping state to forbid state-dependent operations */ 1809 setMachineState(MachineState_Stopping); 1810 1811 /* pass the progress to the caller */ 1812 pProgress.queryInterfaceTo(aProgress); 1813 1798 /* memorize the current machine state */ 1799 MachineState_T lastMachineState = mMachineState; 1800 1801 HRESULT rc = S_OK; 1802 bool fBeganPowerDown = false; 1803 1804 do 1805 { 1806 ComPtr<IProgress> pProgress; 1807 1808 /* 1809 * request a progress object from the server 1810 * (this will set the machine state to Stopping on the server to block 1811 * others from accessing this machine) 1812 */ 1813 rc = mControl->BeginPoweringDown(pProgress.asOutParam()); 1814 if (FAILED(rc)) 1815 break; 1816 1817 fBeganPowerDown = true; 1818 1819 /* sync the state with the server */ 1820 setMachineStateLocally(MachineState_Stopping); 1821 1822 /* setup task object and thread to carry out the operation asynchronously */ 1823 std::auto_ptr<VMPowerDownTask> task(new VMPowerDownTask(this, pProgress, 1824 lastMachineState)); 1825 AssertBreakStmt(task->isOk(), rc = E_FAIL); 1826 1827 int vrc = RTThreadCreate(NULL, Console::powerDownThread, 1828 (void *) task.get(), 0, 1829 RTTHREADTYPE_MAIN_WORKER, 0, 1830 "VMPowerDown"); 1831 if (RT_FAILURE(vrc)) 1832 { 1833 rc = setError(E_FAIL, "Could not create VMPowerDown thread (%Rrc)", vrc); 1834 break; 1835 } 1836 1837 /* task is now owned by powerDownThread(), so release it */ 1838 task.release(); 1839 1840 /* pass the progress to the caller */ 1841 pProgress.queryInterfaceTo(aProgress); 1842 } 1843 while (0); 1844 1845 if (FAILED(rc)) 1846 { 1847 /* preserve existing error info */ 1848 ErrorInfoKeeper eik; 1849 1850 if (fBeganPowerDown) 1851 { 1852 /* 1853 * cancel the requested power down procedure. 1854 * This will reset the machine state to the state it had right 1855 * before calling mControl->BeginPoweringDown(). 1856 */ 1857 mControl->EndPoweringDown(eik.getResultCode(), eik.getText().raw()); } 1858 1859 setMachineStateLocally(lastMachineState); 1860 } 1861 1862 LogFlowThisFunc(("rc=%Rhrc\n", rc)); 1814 1863 LogFlowThisFuncLeave(); 1815 1864 1816 return S_OK;1865 return rc; 1817 1866 } 1818 1867 … … 1848 1897 vrc); 1849 1898 1850 LogFlowThisFunc(("mMachineState=%d, rc=% 08X\n", mMachineState, rc));1899 LogFlowThisFunc(("mMachineState=%d, rc=%Rhrc\n", mMachineState, rc)); 1851 1900 LogFlowThisFuncLeave(); 1852 1901 return rc; … … 1978 2027 tr("Hot-Remove was aborted because the CPU may still be used by the guest"), VERR_RESOURCE_BUSY); 1979 2028 1980 LogFlowThisFunc(("mMachineState=%d, rc=% 08X\n", mMachineState, rc));2029 LogFlowThisFunc(("mMachineState=%d, rc=%Rhrc\n", mMachineState, rc)); 1981 2030 LogFlowThisFuncLeave(); 1982 2031 return rc; … … 2095 2144 } 2096 2145 2097 LogFlowThisFunc(("mMachineState=%d, rc=% 08X\n", mMachineState, rc));2146 LogFlowThisFunc(("mMachineState=%d, rc=%Rhrc\n", mMachineState, rc)); 2098 2147 LogFlowThisFuncLeave(); 2099 2148 return rc; … … 2186 2235 vrc); 2187 2236 2188 LogFlowThisFunc(("rc=% 08X\n", rc));2237 LogFlowThisFunc(("rc=%Rhrc\n", rc)); 2189 2238 LogFlowThisFuncLeave(); 2190 2239 return rc; … … 2224 2273 vrc); 2225 2274 2226 LogFlowThisFunc(("rc=% 08X\n", rc));2275 LogFlowThisFunc(("rc=%Rhrc\n", rc)); 2227 2276 LogFlowThisFuncLeave(); 2228 2277 return rc; … … 2268 2317 *aHandled = handled; 2269 2318 2270 LogFlowThisFunc(("rc=% 08X\n", rc));2319 LogFlowThisFunc(("rc=%Rhrc\n", rc)); 2271 2320 LogFlowThisFuncLeave(); 2272 2321 return rc; … … 2343 2392 vrc); 2344 2393 2345 LogFlowThisFunc(("rc=% 08X\n", rc));2394 LogFlowThisFunc(("rc=%Rhrc\n", rc)); 2346 2395 LogFlowThisFuncLeave(); 2347 2396 return rc; … … 2399 2448 /* sync the state with the server */ 2400 2449 setMachineStateLocally(MachineState_Saving); 2401 2402 /* create a task object early to ensure mpVM protection is successful */2403 std::auto_ptr<VMSaveTask> task(new VMSaveTask(this, NULL, pProgress));2404 rc = task->rc();2405 /*2406 * If we fail here it means a PowerDown() call happened on another2407 * thread while we were doing Pause() (which leaves the Console lock).2408 * We assign PowerDown() a higher precedence than SaveState(),2409 * therefore just return the error to the caller.2410 */2411 if (FAILED(rc))2412 {2413 fTaskCreationFailed = true;2414 break;2415 }2416 2450 2417 2451 /* ensure the directory for the saved state file exists */ … … 2432 2466 } 2433 2467 2434 /* setup task object and thread to carry out the operation asynchronously */ 2435 task->mSavedStateFile = stateFilePath; 2436 /* set the state the operation thread will restore when it is finished */ 2437 task->mLastMachineState = lastMachineState; 2468 /* create a task object early to ensure mpVM protection is successful */ 2469 std::auto_ptr<VMSaveTask> task(new VMSaveTask(this, pProgress, 2470 stateFilePath, 2471 lastMachineState)); 2472 rc = task->rc(); 2473 /* 2474 * If we fail here it means a PowerDown() call happened on another 2475 * thread while we were doing Pause() (which leaves the Console lock). 2476 * We assign PowerDown() a higher precedence than SaveState(), 2477 * therefore just return the error to the caller. 2478 */ 2479 if (FAILED(rc)) 2480 { 2481 fTaskCreationFailed = true; 2482 break; 2483 } 2438 2484 2439 2485 /* create a thread to wait until the VM state is saved */ … … 2480 2526 } 2481 2527 2482 LogFlowThisFunc(("rc=% 08X\n", rc));2528 LogFlowThisFunc(("rc=%Rhrc\n", rc)); 2483 2529 LogFlowThisFuncLeave(); 2484 2530 return rc; … … 2917 2963 { 2918 2964 LogFlowThisFuncEnter(); 2919 LogFlowThisFunc(("aName='%ls' mMachineState=% 08X\n", aName, mMachineState));2965 LogFlowThisFunc(("aName='%ls' mMachineState=%d\n", aName, mMachineState)); 2920 2966 2921 2967 CheckComArgStrNotEmptyOrNull(aName); … … 3037 3083 { 3038 3084 delete pTask; 3039 NOREF(erc);3085 rc = erc; 3040 3086 mptrCancelableProgress.setNull(); 3041 3087 } … … 5307 5353 * @param aProgress Where to return the progress object. 5308 5354 * @param aPaused true if PowerUpPaused called. 5309 *5310 * @todo move down to powerDown();5311 5355 */ 5312 5356 HRESULT Console::powerUp(IProgress **aProgress, bool aPaused) 5313 5357 { 5314 if (aProgress == NULL)5315 return E_POINTER;5316 5317 5358 LogFlowThisFuncEnter(); 5318 5359 LogFlowThisFunc(("mMachineState=%d\n", mMachineState)); 5360 5361 CheckComArgOutPointerValid(aProgress); 5319 5362 5320 5363 AutoCaller autoCaller(this); … … 5705 5748 * release(). Otherwise it will deadlock. 5706 5749 */ 5707 HRESULT Console::powerDown( Progress *aProgress /*= NULL*/)5750 HRESULT Console::powerDown(IProgress *aProgress /*= NULL*/) 5708 5751 { 5709 5752 LogFlowThisFuncEnter(); … … 5848 5891 alock.enter(); 5849 5892 } 5850 else5851 {5852 /** @todo r=bird: Doesn't make sense. Please remove after 3.1 has been branched5853 * off. */5854 /* reset the flag for future re-use */5855 mVMPoweredOff = false;5856 }5857 5893 5858 5894 /* advance percent count */ … … 5969 6005 if (SUCCEEDED(rc)) 5970 6006 mCallbackData.clear(); 5971 5972 /* complete the progress */5973 if (aProgress)5974 aProgress->notifyComplete(rc);5975 6007 5976 6008 LogFlowThisFuncLeave(); … … 6025 6057 LogFlowThisFunc(("Doing mControl->UpdateState()...\n")); 6026 6058 rc = mControl->UpdateState(aMachineState); 6027 LogFlowThisFunc(("mControl->UpdateState()=% 08X\n", rc));6059 LogFlowThisFunc(("mControl->UpdateState()=%Rhrc\n", rc)); 6028 6060 } 6029 6061 } … … 6422 6454 * deadlock). 6423 6455 */ 6424 std::auto_ptr<VMProgressTask> task(new VMProgressTask(that, NULL /* aProgress */, 6425 true /* aUsesVMPtr */)); 6456 std::auto_ptr<VMPowerDownTask> task(new VMPowerDownTask(that, 6457 NULL /* aServerProgress */, 6458 MachineState_Null)); 6426 6459 6427 6460 /* If creating a task failed, this can currently mean one of … … 6659 6692 6660 6693 #ifdef VBOX_WITH_USB 6661 6662 6694 /** 6663 6695 * Sends a request to VMM to attach the given host device. … … 6892 6924 return vrc; 6893 6925 } 6894 6895 6926 #endif /* VBOX_WITH_USB */ 6896 #if ((defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT)) || defined(RT_OS_FREEBSD)) 6897 6927 6928 #if ((defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)) && !defined(VBOX_WITH_NETFLT)) 6898 6929 /** 6899 6930 * Helper function to handle host interface device creation and attachment. … … 7130 7161 return rc; 7131 7162 } 7132 7133 7163 #endif /* (RT_OS_LINUX || RT_OS_FREEBSD) && !VBOX_WITH_NETFLT */ 7134 7164 … … 7164 7194 if (attachment == NetworkAttachmentType_Bridged) 7165 7195 { 7166 #if defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT)7196 #if ((defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)) && !defined(VBOX_WITH_NETFLT)) 7167 7197 HRESULT rc2 = detachFromTapInterface(pNetworkAdapter); 7168 7198 if (FAILED(rc2) && SUCCEEDED(rc)) 7169 7199 rc = rc2; 7170 #endif 7200 #endif /* (RT_OS_LINUX || RT_OS_FREEBSD) && !VBOX_WITH_NETFLT */ 7171 7201 } 7172 7202 } … … 7520 7550 COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE | 7521 7551 COINIT_SPEED_OVER_MEMORY); 7522 LogFlowFunc(("CoInitializeEx()=% 08X\n", hrc));7552 LogFlowFunc(("CoInitializeEx()=%Rhrc\n", hrc)); 7523 7553 } 7524 7554 #endif … … 8438 8468 LogFlowFuncEnter(); 8439 8469 8440 std::auto_ptr<VMP rogressTask> task(static_cast<VMProgressTask *>(pvUser));8470 std::auto_ptr<VMPowerDownTask> task(static_cast<VMPowerDownTask *>(pvUser)); 8441 8471 AssertReturn(task.get(), VERR_INVALID_PARAMETER); 8442 8472 8443 8473 AssertReturn(task->isOk(), VERR_GENERAL_FAILURE); 8474 8475 Assert(task->mProgress.isNull()); 8444 8476 8445 8477 const ComObjPtr<Console> &that = task->mConsole; … … 8454 8486 task->releaseVMCaller(); 8455 8487 8456 that->powerDown(task->mProgress); 8488 that->powerDown(task->mServerProgress); 8489 8490 /* complete the operation */ 8491 that->mControl->EndPoweringDown(S_OK, Bstr().raw()); 8457 8492 8458 8493 LogFlowFuncLeave(); -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r35429 r35460 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2011 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 10479 10479 } 10480 10480 10481 10482 10481 /** 10483 10482 * @note Locks this object for writing. … … 10513 10512 return S_OK; 10514 10513 } 10514 10515 /** 10516 * @note Locks this object for writing. 10517 */ 10518 STDMETHODIMP SessionMachine::BeginPoweringDown(IProgress **aProgress) 10519 { 10520 LogFlowThisFuncEnter(); 10521 10522 CheckComArgOutPointerValid(aProgress); 10523 10524 AutoCaller autoCaller(this); 10525 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 10526 10527 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 10528 10529 AssertReturn(mConsoleTaskData.mLastState == MachineState_Null, 10530 E_FAIL); 10531 10532 /* create a progress object to track operation completion */ 10533 ComObjPtr<Progress> pProgress; 10534 pProgress.createObject(); 10535 pProgress->init(getVirtualBox(), 10536 static_cast<IMachine *>(this) /* aInitiator */, 10537 Bstr(tr("Stopping the virtual machine")).raw(), 10538 FALSE /* aCancelable */); 10539 10540 /* fill in the console task data */ 10541 mConsoleTaskData.mLastState = mData->mMachineState; 10542 mConsoleTaskData.mProgress = pProgress; 10543 10544 /* set the state to Stopping (this is expected by Console::PowerDown()) */ 10545 setMachineState(MachineState_Stopping); 10546 10547 pProgress.queryInterfaceTo(aProgress); 10548 10549 return S_OK; 10550 } 10551 10552 /** 10553 * @note Locks this object for writing. 10554 */ 10555 STDMETHODIMP SessionMachine::EndPoweringDown(LONG iResult, IN_BSTR aErrMsg) 10556 { 10557 LogFlowThisFuncEnter(); 10558 10559 AutoCaller autoCaller(this); 10560 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 10561 10562 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 10563 10564 AssertReturn( ( (SUCCEEDED(iResult) && mData->mMachineState == MachineState_PoweredOff) 10565 || (FAILED(iResult) && mData->mMachineState == MachineState_Stopping)) 10566 && mConsoleTaskData.mLastState != MachineState_Null, 10567 E_FAIL); 10568 10569 /* 10570 * On failure, set the state to the state we had when BeginPoweringDown() 10571 * was called (this is expected by Console::PowerDown() and the associated 10572 * task). On success the VM process already changed the state to 10573 * MachineState_PoweredOff, so no need to do anything. 10574 */ 10575 if (FAILED(iResult)) 10576 setMachineState(mConsoleTaskData.mLastState); 10577 10578 /* notify the progress object about operation completion */ 10579 Assert(mConsoleTaskData.mProgress); 10580 if (SUCCEEDED(iResult)) 10581 mConsoleTaskData.mProgress->notifyComplete(S_OK); 10582 else 10583 { 10584 Utf8Str strErrMsg(aErrMsg); 10585 if (strErrMsg.length()) 10586 mConsoleTaskData.mProgress->notifyComplete(iResult, 10587 COM_IIDOF(ISession), 10588 getComponentName(), 10589 strErrMsg.c_str()); 10590 else 10591 mConsoleTaskData.mProgress->notifyComplete(iResult); 10592 } 10593 10594 /* clear out the temporary saved state data */ 10595 mConsoleTaskData.mLastState = MachineState_Null; 10596 mConsoleTaskData.mProgress.setNull(); 10597 10598 LogFlowThisFuncLeave(); 10599 return S_OK; 10600 } 10601 10515 10602 10516 10603 /** … … 10779 10866 } 10780 10867 10781 /* fill in the snapshotdata */10868 /* fill in the console task data */ 10782 10869 mConsoleTaskData.mLastState = mData->mMachineState; 10783 10870 mConsoleTaskData.mStateFilePath = stateFilePath; … … 11541 11628 if (aErrMsg.length()) 11542 11629 mConsoleTaskData.mProgress->notifyComplete(aRc, 11543 COM_IIDOF(ISession),11544 getComponentName(),11545 aErrMsg.c_str());11630 COM_IIDOF(ISession), 11631 getComponentName(), 11632 aErrMsg.c_str()); 11546 11633 else 11547 11634 mConsoleTaskData.mProgress->notifyComplete(aRc);
Note:
See TracChangeset
for help on using the changeset viewer.