Changeset 15178 in vbox
- Timestamp:
- Dec 9, 2008 2:40:31 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 40588
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/MediumImpl.cpp
r15124 r15178 238 238 ComSafeGUIDArrayOut (aSnapshotIds)) 239 239 { 240 if (Guid (aMachineId).isEmpty()) 241 return E_INVALIDARG; 242 if (ComSafeGUIDArrayOutIsNull (aSnapshotIds)) 243 return E_POINTER; 240 CheckComArgExpr(aMachineId, Guid (aMachineId).isEmpty() == false); 241 CheckComArgSafeArrayNotNull(aSnapshotIds); 244 242 245 243 AutoCaller autoCaller (this); … … 372 370 default: 373 371 { 374 rc = setError ( E_FAIL,372 rc = setError (VBOX_E_INVALID_OBJECT_STATE, 375 373 tr ("Medium '%ls' is not locked for reading"), 376 374 m.locationFull.raw()); … … 451 449 default: 452 450 { 453 rc = setError ( E_FAIL,451 rc = setError (VBOX_E_INVALID_OBJECT_STATE, 454 452 tr ("Medium '%ls' is not locked for writing"), 455 453 m.locationFull.raw()); … … 497 495 498 496 if (m.backRefs.size() != 0) 499 return setError ( E_FAIL,497 return setError (VBOX_E_OBJECT_IN_USE, 500 498 tr ("Medium '%ls' is attached to %d virtual machines"), 501 499 m.locationFull.raw(), m.backRefs.size()); … … 855 853 case MediaState_NotCreated: 856 854 { 857 rc = setError ( E_FAIL,855 rc = setError (VBOX_E_INVALID_OBJECT_STATE, 858 856 tr ("Storage for the medium '%ls' is not created"), 859 857 m.locationFull.raw()); … … 862 860 case MediaState_Created: 863 861 { 864 rc = setError ( E_FAIL,862 rc = setError (VBOX_E_INVALID_OBJECT_STATE, 865 863 tr ("Storage for the medium '%ls' is already created"), 866 864 m.locationFull.raw()); … … 869 867 case MediaState_LockedRead: 870 868 { 871 rc = setError ( E_FAIL,869 rc = setError (VBOX_E_INVALID_OBJECT_STATE, 872 870 tr ("Medium '%ls' is locked for reading by another task"), 873 871 m.locationFull.raw()); … … 876 874 case MediaState_LockedWrite: 877 875 { 878 rc = setError ( E_FAIL,876 rc = setError (VBOX_E_INVALID_OBJECT_STATE, 879 877 tr ("Medium '%ls' is locked for writing by another task"), 880 878 m.locationFull.raw()); … … 885 883 /* be in sync with Console::powerUpThread() */ 886 884 if (!m.lastAccessError.isEmpty()) 887 rc = setError ( E_FAIL,885 rc = setError (VBOX_E_INVALID_OBJECT_STATE, 888 886 tr ("Medium '%ls' is not accessible. %ls"), 889 887 m.locationFull.raw(), m.lastAccessError.raw()); 890 888 else 891 rc = setError ( E_FAIL,889 rc = setError (VBOX_E_INVALID_OBJECT_STATE, 892 890 tr ("Medium '%ls' is not accessible"), 893 891 m.locationFull.raw()); … … 896 894 case MediaState_Creating: 897 895 { 898 rc = setError ( E_FAIL,896 rc = setError (VBOX_E_INVALID_OBJECT_STATE, 899 897 tr ("Storage for the medium '%ls' is being created"), 900 898 m.locationFull.raw(), m.lastAccessError.raw()); … … 903 901 case MediaState_Deleting: 904 902 { 905 rc = setError ( E_FAIL,903 rc = setError (VBOX_E_INVALID_OBJECT_STATE, 906 904 tr ("Storage for the medium '%ls' is being deleted"), 907 905 m.locationFull.raw(), m.lastAccessError.raw()); -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r15165 r15178 7272 7272 <link to="#lockWrite()"/>) in which case an error is returned. 7273 7273 7274 When the medium is locked for reading, it cannot be modified from within 7275 VirtualBox. This means that any method that changes the properties of 7276 this medium or contents of the storage unit will return an error (unless 7277 explicitly stated otherwise) and that an attempt to start a virtual 7278 machine that wants to modify the medium will also fail. 7279 7280 When the virtual machine is started up, it locks for reading all media 7281 it uses in read-only mode. If some media cannot be locked for reading, 7282 the startup procedure will fail. 7283 7284 The medium locked for reading must be unlocked using the 7285 <link to="#unlockRead()"/> method. Calls to <link to="#lockRead()"/> can 7286 be nested and must be followed by the same number of paired 7274 When the medium is locked for reading, it cannot be modified 7275 from within VirtualBox. This means that any method that changes 7276 the properties of this medium or contents of the storage unit 7277 will return an error (unless explicitly stated otherwise) and 7278 that an attempt to start a virtual machine that wants to modify 7279 the medium will also fail. 7280 7281 When the virtual machine is started up, it locks for reading all 7282 media it uses in read-only mode. If some media cannot be locked 7283 for reading, the startup procedure will fail. 7284 7285 The medium locked for reading must be unlocked using the <link 7286 to="#unlockRead()"/> method. Calls to <link to="#lockRead()"/> 7287 can be nested and must be followed by the same number of paired 7287 7288 <link to="#unlockRead()"/> calls. 7288 7289 7289 This method sets the media state to <link to="MediaState::LockedRead"/> 7290 on success. The state prior to this call must be 7291 <link to="MediaState::Created"/>, 7292 <link to="MediaState::Inaccessible"/> or 7293 <link to="MediaState::LockedRead"/>. As you can see, inaccessible media 7294 can be locked too. This is not an error; this method performs a logical 7295 lock that prevents modifications of this media through the VirtualBox 7296 API, not a physical lock of the underlying storage unit. 7297 7298 Either on success or on failure, this method returns the current state 7299 of the medium <b>before</b> the operation. 7290 This method sets the media state to <link 7291 to="MediaState::LockedRead"/> on success. The state prior to 7292 this call must be <link to="MediaState::Created"/>, <link 7293 to="MediaState::Inaccessible"/> or <link 7294 to="MediaState::LockedRead"/>. As you can see, inaccessible 7295 media can be locked too. This is not an error; this method 7296 performs a logical lock that prevents modifications of this 7297 media through the VirtualBox API, not a physical lock of the 7298 underlying storage unit. 7299 7300 This method returns the current state of the medium 7301 <b>before</b> the operation. 7302 7303 <result name="VBOX_E_INVALID_OBJECT_STATE"> 7304 Invalid media state (e.g. not created, locked, inaccessible, 7305 creating, deleting). 7306 </result> 7307 7300 7308 </desc> 7301 7309 <param name="state" type="MediaState" dir="return"> … … 7314 7322 7315 7323 See <link to="#lockRead()"/> for more details. 7324 7325 <result name="VBOX_E_INVALID_OBJECT_STATE"> 7326 Medium not locked for reading. 7327 </result> 7328 7316 7329 </desc> 7317 7330 <param name="state" type="MediaState" dir="return"> … … 7326 7339 Locks this medium for writing. 7327 7340 7328 The write lock, as opposed to <link to="#lockRead()"/>, is exclusive: 7329 there may be only one client that holds a write lock and there may be no 7330 read locks while the write lock is held. 7331 7332 When the medium is locked for writing, it cannot be modified from within 7333 VirtualBox and it is not guaranteed that the values of its properties 7334 are up-to-date. Any method that changes the properties of this medium or 7335 contents of the storage unit will return an error ((unless explicitly 7336 stated otherwise) and an attempt to start a virtual machine that wants 7337 to modify or to read the medium will also fail. 7338 7339 When the virtual machine is started up, it locks for writing all media 7340 it uses to write data to. If some media cannot be locked for writing, 7341 the startup procedure will fail. 7342 7343 The medium locked for writing must be unlocked using the 7344 <link to="#unlockWrite()"/> method. Calls to <link to="#lockWrite()"/> 7345 can <b>not</b> be nested and must be followed by a paired 7346 <link to="#unlockWrite()"/> call. 7347 7348 This method sets the media state to <link to="MediaState::LockedWrite"/> 7349 on success. The state prior to this call must be 7350 <link to="MediaState::Created"/> or 7351 <link to="MediaState::Inaccessible"/>. As you can see, inaccessible media 7352 can be locked too. This is not an error; this method performs a logical 7353 lock that prevents modifications of this media through the VirtualBox 7354 API, not a physical lock of the underlying storage unit. 7355 7356 Either on success or on failure, this method returns the current state 7357 of the medium <b>before</b> the operation. 7341 The write lock, as opposed to <link to="#lockRead()"/>, is 7342 exclusive: there may be only one client that holds a write lock 7343 and there may be no read locks while the write lock is held. 7344 7345 When the medium is locked for writing, it cannot be modified 7346 from within VirtualBox and it is not guaranteed that the values 7347 of its properties are up-to-date. Any method that changes the 7348 properties of this medium or contents of the storage unit will 7349 return an error ((unless explicitly stated otherwise) and an 7350 attempt to start a virtual machine that wants to modify or to 7351 read the medium will also fail. 7352 7353 When the virtual machine is started up, it locks for writing all 7354 media it uses to write data to. If some media cannot be locked 7355 for writing, the startup procedure will fail. 7356 7357 The medium locked for writing must be unlocked using the <link 7358 to="#unlockWrite()"/> method. Calls to <link to="#lockWrite()"/> 7359 can <b>not</b> be nested and must be followed by a paired <link 7360 to="#unlockWrite()"/> call. 7361 7362 This method sets the media state to <link 7363 to="MediaState::LockedWrite"/> on success. The state prior to 7364 this call must be <link to="MediaState::Created"/> or <link 7365 to="MediaState::Inaccessible"/>. As you can see, inaccessible 7366 media can be locked too. This is not an error; this method 7367 performs a logical lock that prevents modifications of this 7368 media through the VirtualBox API, not a physical lock of the 7369 underlying storage unit. 7370 7371 Either on success or on failure, this method returns the current 7372 state of the medium <b>before</b> the operation. 7373 7374 <result name="VBOX_E_INVALID_OBJECT_STATE"> 7375 Invalid media state (e.g. not created, locked, inaccessible, 7376 creating, deleting). 7377 </result> 7378 7358 7379 </desc> 7359 7380 <param name="state" type="MediaState" dir="return"> … … 7368 7389 Cancels the write lock previously set by <link to="#lockWrite()"/>. 7369 7390 7370 Either on success or on failure, this method returns the current state7371 of the medium <b>after</b> the operation.7391 Either on success or on failure, this method returns the current 7392 state of the medium <b>after</b> the operation. 7372 7393 7373 7394 See <link to="#lockWrite()"/> for more details. 7395 7396 <result name="VBOX_E_INVALID_OBJECT_STATE"> 7397 Medium not locked for writing. 7398 </result> 7399 7374 7400 </desc> 7375 7401 <param name="state" type="MediaState" dir="return"> … … 7382 7408 <method name="close"> 7383 7409 <desc> 7384 Closes this media. 7385 7386 The hard disk must not be attached to any known virtual machine and must 7387 not have any known child hard disks, otherwise the operation will fail. 7388 7389 When the hard disk is successfully closed, it gets removed from the list 7390 of remembered hard disks, but its storage unit is not deleted. In 7391 particular, this means that this hard disk can be later opened again 7392 using the <link to="IVirtualBox::openHardDisk2"/> call. 7393 7394 Note that after this method successfully returns, the given hard disk 7395 object becomes uninitialized. This means that any attempt to call any of 7396 its methods or attributes will fail with the <tt>"Object not ready" 7397 (E_ACCESSDENIED)</tt> error. 7410 Closes this medium. 7411 7412 The hard disk must not be attached to any known virtual machine 7413 and must not have any known child hard disks, otherwise the 7414 operation will fail. 7415 7416 When the hard disk is successfully closed, it gets removed from 7417 the list of remembered hard disks, but its storage unit is not 7418 deleted. In particular, this means that this hard disk can be 7419 later opened again using the <link 7420 to="IVirtualBox::openHardDisk2"/> call. 7421 7422 Note that after this method successfully returns, the given hard 7423 disk object becomes uninitialized. This means that any attempt 7424 to call any of its methods or attributes will fail with the 7425 <tt>"Object not ready" (E_ACCESSDENIED)</tt> error. 7426 7427 <result name="VBOX_E_INVALID_OBJECT_STATE"> 7428 Invalid media state (other than not created, created or 7429 inaccessible). 7430 </result> 7431 <result name="VBOX_E_OBJECT_IN_USE"> 7432 Medium attached to virtual machine. 7433 </result> 7434 <result name="VBOX_E_FILE_ERROR"> 7435 Settings file not accessible. 7436 </result> 7437 <result name="VBOX_E_XML_ERROR"> 7438 Could not parse the settings file. 7439 </result> 7440 7398 7441 </desc> 7399 7442 </method>
Note:
See TracChangeset
for help on using the changeset viewer.