Changeset 58951 in vbox
- Timestamp:
- Dec 2, 2015 1:44:44 PM (9 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
-
include/ExtPackManagerImpl.h (modified) (1 diff)
-
src-all/ExtPackManagerImpl.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/ExtPackManagerImpl.h
r52596 r58951 212 212 213 213 private: 214 214 HRESULT i_isThereAnyRunningVM() const; 215 215 // wrapped IExtPackManager properties 216 216 HRESULT getInstalledExtPacks(std::vector<ComPtr<IExtPack> > &aInstalledExtPacks); -
trunk/src/VBox/Main/src-all/ExtPackManagerImpl.cpp
r58132 r58951 2082 2082 if (SUCCEEDED(hrc)) 2083 2083 { 2084 AutoWriteLock autoLock(this COMMA_LOCKVAL_SRC_POS); 2085 2084 2086 /* 2085 2087 * Run the set-uid-to-root binary that performs the cleanup. … … 2088 2090 * VBoxSVC instance. 2089 2091 */ 2090 AutoWriteLock autoLock(this COMMA_LOCKVAL_SRC_POS); 2091 hrc = i_runSetUidToRootHelper(NULL, 2092 hrc = i_runSetUidToRootHelper(NULL, 2092 2093 "cleanup", 2093 2094 "--base-dir", m->strBaseDir.c_str(), … … 2526 2527 } 2527 2528 2529 HRESULT ExtPackManager::i_isThereAnyRunningVM() const 2530 { 2531 HRESULT res = E_FAIL; 2532 Assert(m->pVirtualBox != NULL); /* Only called from VBoxSVC. */ 2533 /* 2534 * Get the list of all _running_ VMs 2535 */ 2536 com::SafeIfaceArray<IMachine> machines; 2537 com::SafeArray<MachineState_T> states; 2538 int rc = m->pVirtualBox->COMGETTER(Machines)(ComSafeArrayAsOutParam(machines)); 2539 if (SUCCEEDED(rc)) 2540 rc = m->pVirtualBox->GetMachineStates(ComSafeArrayAsInParam(machines), ComSafeArrayAsOutParam(states)); 2541 2542 if (SUCCEEDED(rc)) 2543 { 2544 /* 2545 * Iterate through the collection 2546 */ 2547 for (size_t i = 0; i < machines.size(); ++i) 2548 { 2549 if (machines[i]) 2550 { 2551 MachineState_T machineState = states[i]; 2552 switch (machineState) 2553 { 2554 case MachineState_Running: 2555 case MachineState_Teleporting: 2556 case MachineState_LiveSnapshotting: 2557 case MachineState_Paused: 2558 case MachineState_TeleportingPausedVM: 2559 res = S_OK; 2560 break; 2561 } 2562 } 2563 if (res == S_OK) 2564 break; 2565 } 2566 } 2567 2568 return res; 2569 2570 } 2571 2528 2572 /** 2529 2573 * Thread wrapper around doInstall. … … 2570 2614 { 2571 2615 AutoWriteLock autoLock(this COMMA_LOCKVAL_SRC_POS); 2572 2573 /*2574 * Refresh the data we have on the extension pack as it2575 * may be made stale by direct meddling or some other user.2576 */2577 2616 ExtPack *pExtPack; 2578 hrc = i_refreshExtPack(pStrName->c_str(), false /*a_fUnusableIsError*/, &pExtPack); 2617 2618 hrc = i_isThereAnyRunningVM(); 2619 if(SUCCEEDED(hrc)) 2620 { 2621 LogRel(("Install extension pack '%s' failed because at least one VM is still running.", pStrName->c_str())); 2622 hrc = setError(E_FAIL,tr("Install extension pack '%s' failed because at least one VM is still running"), 2623 pStrName->c_str()); 2624 } 2625 else 2626 { 2627 /* 2628 * Refresh the data we have on the extension pack as it 2629 * may be made stale by direct meddling or some other user. 2630 */ 2631 hrc = i_refreshExtPack(pStrName->c_str(), false /*a_fUnusableIsError*/, &pExtPack); 2632 } 2633 2579 2634 if (SUCCEEDED(hrc)) 2580 2635 { … … 2696 2751 { 2697 2752 AutoWriteLock autoLock(this COMMA_LOCKVAL_SRC_POS); 2698 2699 /*2700 * Refresh the data we have on the extension pack as it may be made2701 * stale by direct meddling or some other user.2702 */2703 2753 ExtPack *pExtPack; 2704 hrc = i_refreshExtPack(a_pstrName->c_str(), false /*a_fUnusableIsError*/, &pExtPack); 2754 2755 hrc = i_isThereAnyRunningVM(); 2756 if(SUCCEEDED(hrc)) 2757 { 2758 LogRel(("Uninstall extension pack '%s' failed because at least one VM is still running.", a_pstrName->c_str())); 2759 hrc = setError(E_FAIL,tr("Uninstall extension pack '%s' failed because at least one VM is still running"), 2760 a_pstrName->c_str()); 2761 } 2762 else 2763 { 2764 /* 2765 * Refresh the data we have on the extension pack as it may be made 2766 * stale by direct meddling or some other user. 2767 */ 2768 hrc = i_refreshExtPack(a_pstrName->c_str(), false /*a_fUnusableIsError*/, &pExtPack); 2769 } 2770 2705 2771 if (SUCCEEDED(hrc)) 2706 2772 {
Note:
See TracChangeset
for help on using the changeset viewer.

