Changeset 24258 in vbox
- Timestamp:
- Nov 2, 2009 2:38:50 PM (15 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 8 edited
-
Frontends/VBoxManage/VBoxManageDisk.cpp (modified) (2 diffs)
-
Frontends/VBoxManage/VBoxManageList.cpp (modified) (3 diffs)
-
Frontends/VirtualBox/src/VBoxMedium.cpp (modified) (1 diff)
-
Main/ApplianceImpl.cpp (modified) (1 diff)
-
Main/MachineImpl.cpp (modified) (6 diffs)
-
Main/MediumImpl.cpp (modified) (5 diffs)
-
Main/idl/VirtualBox.xidl (modified) (4 diffs)
-
Main/include/MediumImpl.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp
r24184 r24258 684 684 /* Perform accessibility check now. */ 685 685 MediumState_T state; 686 CHECK_ERROR_BREAK(dstDisk, COMGETTER(State)(&state));686 CHECK_ERROR_BREAK(dstDisk, RefreshState(&state)); 687 687 } 688 688 CHECK_ERROR_BREAK(dstDisk, COMGETTER(Format) (format.asOutParam())); … … 1216 1216 /// @todo NEWMEDIA print the full state value 1217 1217 MediumState_T state; 1218 CHECK_ERROR_BREAK (hardDisk, COMGETTER(State)(&state));1218 CHECK_ERROR_BREAK (hardDisk, RefreshState(&state)); 1219 1219 RTPrintf("Accessible: %s\n", state != MediumState_Inaccessible ? "yes" : "no"); 1220 1220 -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp
r23223 r24258 527 527 /// @todo NEWMEDIA check accessibility of all parents 528 528 /// @todo NEWMEDIA print the full state value 529 hdd-> COMGETTER(State)(&enmState);529 hdd->RefreshState(&enmState); 530 530 RTPrintf("Accessible: %s\n", enmState != MediumState_Inaccessible ? "yes" : "no"); 531 531 … … 583 583 RTPrintf("Path: %lS\n", filePath.raw()); 584 584 MediumState_T enmState; 585 dvdImage-> COMGETTER(State)(&enmState);585 dvdImage->RefreshState(&enmState); 586 586 RTPrintf("Accessible: %s\n", enmState != MediumState_Inaccessible ? "yes" : "no"); 587 587 /** @todo usage */ … … 605 605 RTPrintf("Path: %lS\n", filePath.raw()); 606 606 MediumState_T enmState; 607 floppyImage-> COMGETTER(State)(&enmState);607 floppyImage->RefreshState(&enmState); 608 608 RTPrintf("Accessible: %s\n", enmState != MediumState_Inaccessible ? "yes" : "no"); 609 609 /** @todo usage */ -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxMedium.cpp
r24211 r24258 47 47 if (mMedium.isNull()) return; 48 48 49 mState = mMedium. GetState();49 mState = mMedium.RefreshState(); 50 50 51 51 /* Save the result to distinguish between inaccessible and e.g. uninitialized objects */ -
trunk/src/VBox/Main/ApplianceImpl.cpp
r24048 r24258 4477 4477 // force reading state, or else size will be returned as 0 4478 4478 MediumState_T ms; 4479 rc = pMedium-> COMGETTER(State)(&ms);4479 rc = pMedium->RefreshState(&ms); 4480 4480 if (FAILED(rc)) throw rc; 4481 4481 -
trunk/src/VBox/Main/MachineImpl.cpp
r24250 r24258 8790 8790 IProgress **aProgress) 8791 8791 { 8792 LogFlowThisFunc (("\n"));8792 LogFlowThisFuncEnter(); 8793 8793 8794 8794 Guid id(aId); … … 8870 8870 *aMachineState = mData->mMachineState; 8871 8871 8872 LogFlowThisFuncLeave(); 8873 8872 8874 return S_OK; 8873 8875 } … … 8881 8883 IProgress **aProgress) 8882 8884 { 8883 LogFlowThisFunc (("\n"));8885 LogFlowThisFuncEnter(); 8884 8886 8885 8887 AssertReturn(aInitiator, E_INVALIDARG); … … 8957 8959 RTTHREADTYPE_MAIN_WORKER, 8958 8960 0, 8959 " DiscardCurState");8961 "RestoreSnap"); 8960 8962 if (RT_FAILURE(vrc)) 8961 8963 { … … 8972 8974 /* return the new state to the caller */ 8973 8975 *aMachineState = mData->mMachineState; 8976 8977 LogFlowThisFuncLeave(); 8974 8978 8975 8979 return S_OK; … … 10308 10312 if (mediumState == MediumState_Inaccessible) 10309 10313 { 10310 rc = medium-> COMGETTER(State)(&mediumState);10314 rc = medium->RefreshState(&mediumState); 10311 10315 CheckComRCThrowRC(rc); 10312 10316 -
trunk/src/VBox/Main/MediumImpl.cpp
r24253 r24258 417 417 that the medium isn't fully initialized yet. */ 418 418 MediumState_T m; 419 rc = aMedium-> COMGETTER(State)(&m);419 rc = aMedium->RefreshState(&m); 420 420 CheckComRCReturnRC(rc); 421 421 /* go to Deleting */ … … 678 678 if (mediaState == MediumState_Inaccessible) 679 679 { 680 rc = (*it)-> COMGETTER(State)(&mediaState);680 rc = (*it)->RefreshState(&mediaState); 681 681 CheckComRCReturnRC(rc); 682 682 Assert(mediaState == MediumState_LockedRead); … … 735 735 if (mediaState == MediumState_Inaccessible) 736 736 { 737 rc = (*it)-> COMGETTER(State)(&mediaState);737 rc = (*it)->RefreshState(&mediaState); 738 738 CheckComRCReturnRC(rc); 739 739 if (it == last) … … 1371 1371 CheckComRCReturnRC(autoCaller.rc()); 1372 1372 1373 /* queryInfo() locks this for writing. */ 1374 AutoWriteLock alock(this); 1375 1376 HRESULT rc = S_OK; 1377 1378 switch (m->state) 1379 { 1380 case MediumState_Created: 1381 case MediumState_Inaccessible: 1382 case MediumState_LockedRead: 1383 case MediumState_LockedWrite: 1384 { 1385 rc = queryInfo(); 1386 break; 1387 } 1388 default: 1389 break; 1390 } 1391 1373 AutoReadLock alock(this); 1392 1374 *aState = m->state; 1393 1375 1394 return rc; 1395 } 1376 return S_OK; 1377 } 1378 1396 1379 1397 1380 STDMETHODIMP Medium::COMGETTER(Location)(BSTR *aLocation) … … 1756 1739 1757 1740 return S_OK; 1741 } 1742 1743 STDMETHODIMP Medium::RefreshState(MediumState_T *aState) 1744 { 1745 CheckComArgOutPointerValid(aState); 1746 1747 AutoCaller autoCaller(this); 1748 CheckComRCReturnRC(autoCaller.rc()); 1749 1750 /* queryInfo() locks this for writing. */ 1751 AutoWriteLock alock(this); 1752 1753 HRESULT rc = S_OK; 1754 1755 switch (m->state) 1756 { 1757 case MediumState_Created: 1758 case MediumState_Inaccessible: 1759 case MediumState_LockedRead: 1760 { 1761 rc = queryInfo(); 1762 break; 1763 } 1764 default: 1765 break; 1766 } 1767 1768 *aState = m->state; 1769 1770 return rc; 1758 1771 } 1759 1772 -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r24250 r24258 8554 8554 When the storage unit cannot be read (for example, because it is located on 8555 8555 a disconnected network resource, or was accidentally deleted outside VirtualBox), 8556 the medium is considered to be<i>inaccessible</i>, which is indicated by the8556 the medium is considered <i>inaccessible</i>, which is indicated by the 8557 8557 "Inaccessible" state. The exact reason why the medium is inaccessible can be 8558 8558 obtained by reading the <link to="#lastAccessError"/> attribute. 8559 8559 8560 A new accessibility check is performed each time the <link to="#state"/> 8561 attribute is read. This check may take long time (several seconds or even 8562 minutes, depending on the storage unit location and format), and will 8563 block the calling thread until finished. For this reason, it is recommended 8564 to never read this attribute on the main UI thread to avoid making the UI 8565 unresponsive. 8560 A new accessibility check is performed when <link to="#refreshState"/> 8561 is called; otherwise the <link to="#state"/> attribute returns the state 8562 from the last refresh. 8566 8563 8567 8564 Note that when VirtualBox starts up (e.g. the VirtualBox object gets … … 8844 8841 <attribute name="state" type="MediumState" readonly="yes"> 8845 8842 <desc> 8846 Current medium state. Inspect <link to="MediumState"/> values for details. 8847 8848 Reading this attribute may take a long time because an accessibility 8849 check of the storage unit is performed each time the attribute is read. 8850 This check may cause a significant delay if the storage unit of the 8851 given medium is, for example, a file located on a network share which is 8852 not currently accessible due to connectivity problems -- the call will 8853 not return until a timeout interval defined by the host OS for this 8854 operation expires. 8855 8856 If the last known state of the medium is <link to="MediumState_Created"/> 8857 and the accessibility check fails then the state would be set to 8858 <link to="MediumState_Inaccessible"/> and <link to="#lastAccessError"/> 8859 may be used to get more details about the failure. If the state of the 8860 medium is <link to="MediumState_LockedRead"/> or 8861 <link to="MediumState_LockedWrite"/> then it remains the same, and a 8862 non-empty value of <link to="#lastAccessError"/> will indicate a failed 8863 accessibility check in this case. 8864 8865 Note that not all medium states are applicable to all medium types. 8843 Returns the current medium state, which is the last state set by 8844 the accessibility check performed by <link to="#refreshState"/>. 8845 If that method has not yet been called on the medium, the state 8846 is "Inaccessible"; as opposed to truly inaccessible media, the 8847 value of <link to="#lastAccessError"/> will be an empty string in 8848 that case. 8849 8850 <note>As of version 3.1, this no longer performs an accessibility check 8851 automatically; call <link to="#refreshState"/> for that. 8852 </note> 8866 8853 </desc> 8867 8854 </attribute> … … 9076 9063 <desc> 9077 9064 Text message that represents the result of the last accessibility 9078 check. 9079 9080 Accessibility checks are performed each time the <link to="#state"/> 9081 attribute is read. An empty string is returned if the last 9082 accessibility check was successful. A non-empty string indicates a 9083 failure and should normally describe a reason of the failure (for 9084 example, a file read error). 9065 check performed by <link to="#refreshState"/>. 9066 9067 An empty string is returned if the last accessibility check 9068 was successful or has not yet been called. As a result, if 9069 <link to="#state" /> is "Inaccessible" and this attribute is empty, 9070 then <link to="#refreshState"/> has yet to be called; this is the 9071 default value of media after VirtualBox initialization. 9072 A non-empty string indicates a failure and should normally describe 9073 a reason of the failure (for example, a file read error). 9085 9074 </desc> 9086 9075 </attribute> … … 9101 9090 </desc> 9102 9091 </attribute> 9092 9093 <method name="refreshState"> 9094 <desc> 9095 If the current medium state (see <link to="MediumState"/> 9096 and <link to="#state" /> is one of "Created", "Inaccessible" 9097 or "LockedRead", then this performs an accessibility check on the 9098 medium and sets the value of the <link to="#state"/> attribute 9099 accordingly; that value is also returned for convenience. 9100 9101 For all other state values, this does not perform a refresh but returns 9102 the state only. 9103 9104 The refresh, if performed, may take a long time (several seconds or even 9105 minutes, depending on the storage unit location and format) because it performs an 9106 accessibility check of the storage unit. This check may cause a significant 9107 delay if the storage unit of the given medium is, for example, a file located 9108 on a network share which is not currently accessible due to connectivity 9109 problems. In that case, the call will not return until a timeout 9110 interval defined by the host OS for this operation expires. For this reason, 9111 it is recommended to never read this attribute on the main UI thread to avoid 9112 making the UI unresponsive. 9113 9114 If the last known state of the medium is "Created" and the accessibility 9115 check fails, then the state would be set to "Inaccessible", and 9116 <link to="#lastAccessError"/> may be used to get more details about the 9117 failure. If the state of the medium is "LockedRead", then it remains the 9118 same, and a non-empty value of <link to="#lastAccessError"/> will 9119 indicate a failed accessibility check in this case. 9120 9121 Note that not all medium states are applicable to all medium types. 9122 </desc> 9123 <param name="state" type="MediumState" dir="return"> 9124 <desc> 9125 New medium state. 9126 </desc> 9127 </param> 9128 </method> 9103 9129 9104 9130 <method name="getSnapshotIds"> -
trunk/src/VBox/Main/include/MediumImpl.h
r24210 r24258 122 122 123 123 // IMedium methods 124 STDMETHOD(RefreshState)(MediumState_T *aState); 124 125 STDMETHOD(GetSnapshotIds)(IN_BSTR aMachineId, 125 126 ComSafeArrayOut(BSTR, aSnapshotIds));
Note:
See TracChangeset
for help on using the changeset viewer.

