儲存庫 vbox 的更動 63164
- 時間撮記:
- 2016-8-8 下午01:41:39 (8 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r63147 r63164 1511 1511 return "unknown"; 1512 1512 } 1513 return NULL;1513 /* not reached */ 1514 1514 } 1515 1515 … … 3992 3992 rc = aNetworkAdapter->COMGETTER(TraceEnabled)(&fTraceEnabled); 3993 3993 AssertComRC(rc); 3994 }3995 if (SUCCEEDED(rc))3996 {3997 ULONG ulInstance;3998 rc = aNetworkAdapter->COMGETTER(Slot)(&ulInstance);3999 AssertComRC(rc);4000 3994 if (SUCCEEDED(rc)) 4001 3995 { 4002 /* 4003 * Find the adapter instance, get the config interface and update 4004 * the link state. 4005 */ 4006 NetworkAdapterType_T adapterType; 4007 rc = aNetworkAdapter->COMGETTER(AdapterType)(&adapterType); 3996 ULONG ulInstance; 3997 rc = aNetworkAdapter->COMGETTER(Slot)(&ulInstance); 4008 3998 AssertComRC(rc); 4009 const char *pszAdapterName = networkAdapterTypeToName(adapterType); 4010 4011 // prevent cross-thread deadlocks, don't need the lock any more 4012 alock.release(); 4013 4014 PPDMIBASE pBase; 4015 int vrc = PDMR3QueryDeviceLun(ptrVM.rawUVM(), pszAdapterName, ulInstance, 0, &pBase); 4016 if (RT_SUCCESS(vrc)) 3999 if (SUCCEEDED(rc)) 4017 4000 { 4018 Assert(pBase); 4019 PPDMINETWORKCONFIG pINetCfg; 4020 pINetCfg = PDMIBASE_QUERY_INTERFACE(pBase, PDMINETWORKCONFIG); 4021 if (pINetCfg) 4001 /* 4002 * Find the adapter instance, get the config interface and update 4003 * the link state. 4004 */ 4005 NetworkAdapterType_T adapterType; 4006 rc = aNetworkAdapter->COMGETTER(AdapterType)(&adapterType); 4007 AssertComRC(rc); 4008 const char *pszAdapterName = networkAdapterTypeToName(adapterType); 4009 4010 // prevent cross-thread deadlocks, don't need the lock any more 4011 alock.release(); 4012 4013 PPDMIBASE pBase; 4014 int vrc = PDMR3QueryDeviceLun(ptrVM.rawUVM(), pszAdapterName, ulInstance, 0, &pBase); 4015 if (RT_SUCCESS(vrc)) 4022 4016 { 4023 Log(("Console::onNetworkAdapterChange: setting link state to %d\n", 4024 fCableConnected)); 4025 vrc = pINetCfg->pfnSetLinkState(pINetCfg, 4026 fCableConnected ? PDMNETWORKLINKSTATE_UP 4027 : PDMNETWORKLINKSTATE_DOWN); 4028 ComAssertRC(vrc); 4029 } 4030 if (RT_SUCCESS(vrc) && changeAdapter) 4031 { 4032 VMSTATE enmVMState = VMR3GetStateU(ptrVM.rawUVM()); 4033 if ( enmVMState == VMSTATE_RUNNING /** @todo LiveMigration: Forbid or deal 4034 correctly with the _LS variants */ 4035 || enmVMState == VMSTATE_SUSPENDED) 4017 Assert(pBase); 4018 PPDMINETWORKCONFIG pINetCfg; 4019 pINetCfg = PDMIBASE_QUERY_INTERFACE(pBase, PDMINETWORKCONFIG); 4020 if (pINetCfg) 4036 4021 { 4037 if (fTraceEnabled && fCableConnected && pINetCfg) 4022 Log(("Console::onNetworkAdapterChange: setting link state to %d\n", 4023 fCableConnected)); 4024 vrc = pINetCfg->pfnSetLinkState(pINetCfg, 4025 fCableConnected ? PDMNETWORKLINKSTATE_UP 4026 : PDMNETWORKLINKSTATE_DOWN); 4027 ComAssertRC(vrc); 4028 } 4029 if (RT_SUCCESS(vrc) && changeAdapter) 4030 { 4031 VMSTATE enmVMState = VMR3GetStateU(ptrVM.rawUVM()); 4032 if ( enmVMState == VMSTATE_RUNNING /** @todo LiveMigration: Forbid or deal 4033 correctly with the _LS variants */ 4034 || enmVMState == VMSTATE_SUSPENDED) 4038 4035 { 4039 vrc = pINetCfg->pfnSetLinkState(pINetCfg, PDMNETWORKLINKSTATE_DOWN); 4040 ComAssertRC(vrc); 4041 } 4042 4043 rc = i_doNetworkAdapterChange(ptrVM.rawUVM(), pszAdapterName, ulInstance, 0, aNetworkAdapter); 4044 4045 if (fTraceEnabled && fCableConnected && pINetCfg) 4046 { 4047 vrc = pINetCfg->pfnSetLinkState(pINetCfg, PDMNETWORKLINKSTATE_UP); 4048 ComAssertRC(vrc); 4036 if (fTraceEnabled && fCableConnected && pINetCfg) 4037 { 4038 vrc = pINetCfg->pfnSetLinkState(pINetCfg, PDMNETWORKLINKSTATE_DOWN); 4039 ComAssertRC(vrc); 4040 } 4041 4042 rc = i_doNetworkAdapterChange(ptrVM.rawUVM(), pszAdapterName, ulInstance, 0, aNetworkAdapter); 4043 4044 if (fTraceEnabled && fCableConnected && pINetCfg) 4045 { 4046 vrc = pINetCfg->pfnSetLinkState(pINetCfg, PDMNETWORKLINKSTATE_UP); 4047 ComAssertRC(vrc); 4048 } 4049 4049 } 4050 4050 } 4051 4051 } 4052 else if (vrc == VERR_PDM_DEVICE_INSTANCE_NOT_FOUND) 4053 return setError(E_FAIL, 4054 tr("The network adapter #%u is not enabled"), ulInstance); 4055 else 4056 ComAssertRC(vrc); 4057 4058 if (RT_FAILURE(vrc)) 4059 rc = E_FAIL; 4060 4061 alock.acquire(); 4052 4062 } 4053 else if (vrc == VERR_PDM_DEVICE_INSTANCE_NOT_FOUND)4054 return setError(E_FAIL,4055 tr("The network adapter #%u is not enabled"), ulInstance);4056 else4057 ComAssertRC(vrc);4058 4059 if (RT_FAILURE(vrc))4060 rc = E_FAIL;4061 4062 alock.acquire();4063 4063 } 4064 4064 } … … 5633 5633 { 5634 5634 /* No need to call in the EMT thread. */ 5635 LONG64 cMax;5636 5635 Bstr strName; 5637 BandwidthGroupType_T enmType;5638 5636 rc = aBandwidthGroup->COMGETTER(Name)(strName.asOutParam()); 5639 5637 if (SUCCEEDED(rc)) 5638 { 5639 LONG64 cMax; 5640 5640 rc = aBandwidthGroup->COMGETTER(MaxBytesPerSec)(&cMax); 5641 if (SUCCEEDED(rc)) 5642 rc = aBandwidthGroup->COMGETTER(Type)(&enmType); 5643 5644 if (SUCCEEDED(rc)) 5645 { 5646 int vrc = VINF_SUCCESS; 5647 if (enmType == BandwidthGroupType_Disk) 5648 vrc = PDMR3AsyncCompletionBwMgrSetMaxForFile(ptrVM.rawUVM(), Utf8Str(strName).c_str(), (uint32_t)cMax); 5641 if (SUCCEEDED(rc)) 5642 { 5643 BandwidthGroupType_T enmType; 5644 rc = aBandwidthGroup->COMGETTER(Type)(&enmType); 5645 if (SUCCEEDED(rc)) 5646 { 5647 int vrc = VINF_SUCCESS; 5648 if (enmType == BandwidthGroupType_Disk) 5649 vrc = PDMR3AsyncCompletionBwMgrSetMaxForFile(ptrVM.rawUVM(), Utf8Str(strName).c_str(), (uint32_t)cMax); 5649 5650 #ifdef VBOX_WITH_NETSHAPER 5650 else if (enmType == BandwidthGroupType_Network) 5651 vrc = PDMR3NsBwGroupSetLimit(ptrVM.rawUVM(), Utf8Str(strName).c_str(), cMax); 5652 else 5653 rc = E_NOTIMPL; 5654 #endif /* VBOX_WITH_NETSHAPER */ 5655 AssertRC(vrc); 5651 else if (enmType == BandwidthGroupType_Network) 5652 vrc = PDMR3NsBwGroupSetLimit(ptrVM.rawUVM(), Utf8Str(strName).c_str(), cMax); 5653 else 5654 rc = E_NOTIMPL; 5655 #endif 5656 AssertRC(vrc); 5657 } 5658 } 5656 5659 } 5657 5660 } … … 9699 9702 rc = pConsole->i_captureUSBDevices(pConsole->mpUVM); 9700 9703 if (FAILED(rc)) 9704 { 9705 alock.acquire(); 9701 9706 break; 9707 } 9702 9708 9703 9709 /* Load saved state? */ … … 9759 9765 */ 9760 9766 ULONG uPort; 9761 ULONG uInterval;9762 Bstr bstrAddress, bstrPassword;9763 9764 9767 rc = pMachine->COMGETTER(FaultTolerancePort)(&uPort); 9765 9768 if (SUCCEEDED(rc)) 9766 9769 { 9770 ULONG uInterval; 9767 9771 rc = pMachine->COMGETTER(FaultToleranceSyncInterval)(&uInterval); 9768 9772 if (SUCCEEDED(rc)) 9773 { 9774 Bstr bstrAddress; 9769 9775 rc = pMachine->COMGETTER(FaultToleranceAddress)(bstrAddress.asOutParam()); 9770 if (SUCCEEDED(rc)) 9771 rc = pMachine->COMGETTER(FaultTolerancePassword)(bstrPassword.asOutParam()); 9776 if (SUCCEEDED(rc)) 9777 { 9778 Bstr bstrPassword; 9779 rc = pMachine->COMGETTER(FaultTolerancePassword)(bstrPassword.asOutParam()); 9780 if (SUCCEEDED(rc)) 9781 { 9782 if (task->mProgress->i_setCancelCallback(faultToleranceProgressCancelCallback, 9783 pConsole->mpUVM)) 9784 { 9785 if (SUCCEEDED(rc)) 9786 { 9787 Utf8Str strAddress(bstrAddress); 9788 const char *pszAddress = strAddress.isEmpty() ? NULL : strAddress.c_str(); 9789 Utf8Str strPassword(bstrPassword); 9790 const char *pszPassword = strPassword.isEmpty() ? NULL : strPassword.c_str(); 9791 9792 /* Power on the FT enabled VM. */ 9793 #ifdef VBOX_WITH_EXTPACK 9794 vrc = pConsole->mptrExtPackManager->i_callAllVmPowerOnHooks(pConsole, pVM); 9795 #endif 9796 if (RT_SUCCESS(vrc)) 9797 vrc = FTMR3PowerOn(pConsole->mpUVM, 9798 task->mEnmFaultToleranceState == FaultToleranceState_Master /* fMaster */, 9799 uInterval, 9800 pszAddress, 9801 uPort, 9802 pszPassword); 9803 AssertLogRelRC(vrc); 9804 } 9805 task->mProgress->i_setCancelCallback(NULL, NULL); 9806 } 9807 else 9808 rc = E_FAIL; 9809 9810 } 9811 } 9812 } 9772 9813 } 9773 if (task->mProgress->i_setCancelCallback(faultToleranceProgressCancelCallback, pConsole->mpUVM))9774 {9775 if (SUCCEEDED(rc))9776 {9777 Utf8Str strAddress(bstrAddress);9778 const char *pszAddress = strAddress.isEmpty() ? NULL : strAddress.c_str();9779 Utf8Str strPassword(bstrPassword);9780 const char *pszPassword = strPassword.isEmpty() ? NULL : strPassword.c_str();9781 9782 /* Power on the FT enabled VM. */9783 #ifdef VBOX_WITH_EXTPACK9784 vrc = pConsole->mptrExtPackManager->i_callAllVmPowerOnHooks(pConsole, pVM);9785 #endif9786 if (RT_SUCCESS(vrc))9787 vrc = FTMR3PowerOn(pConsole->mpUVM,9788 task->mEnmFaultToleranceState == FaultToleranceState_Master /* fMaster */,9789 uInterval,9790 pszAddress,9791 uPort,9792 pszPassword);9793 AssertLogRelRC(vrc);9794 }9795 task->mProgress->i_setCancelCallback(NULL, NULL);9796 }9797 else9798 rc = E_FAIL;9799 9814 } 9800 9815 else if (task->mStartPaused)
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器