- Timestamp:
- Jan 18, 2011 11:27:20 AM (14 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/VirtualBox.xidl
r35523 r35602 5381 5381 Returns a snapshot of this machine with the given UUID. 5382 5382 A @c null argument can be used to obtain the first snapshot 5383 taken on this machine. This is useful if you want to traverse 5384 the whole tree of snapshots starting from the root. 5383 taken on this machine. To traverse the whole tree of snapshots 5384 starting from the root, inspect the root snapshot's 5385 <link to="ISnapshot::children" /> attribute and recurse over those children. 5385 5386 5386 5387 <result name="VBOX_E_OBJECT_NOT_FOUND"> … … 8667 8668 only the differencing images need to be deleted. 8668 8669 8669 The current machine state is not changed by taking a snapshot. 8670 If the machine is running, it will resume execution after the 8671 snapshot has been taken. After calling this, 8672 <link to="IMachine::currentSnapshot" /> is set to the snapshot 8673 just created. 8670 The current machine state is not changed by taking a snapshot 8671 except that <link to="IMachine::currentSnapshot" /> is set to 8672 the newly created snapshot, which is also added to the machine's 8673 snapshots tree. 8674 8674 </li> 8675 8675 … … 8680 8680 8681 8681 This destroys the machine's current state. After calling this, 8682 <link to="IMachine::currentSnapshot" /> is set to the snapshot that was8683 restored.8682 <link to="IMachine::currentSnapshot" /> points to the snapshot 8683 that was restored. 8684 8684 </li> 8685 8685 … … 8702 8702 </ul> 8703 8703 8704 Each snapshot contains the settings of the virtual machine (hardware 8705 configuration etc.). In addition, if the machine was running when the 8704 Each snapshot contains a copy of virtual machine's settings (hardware 8705 configuration etc.). This copy is contained in an immutable (read-only) 8706 instance of <link to="IMachine" /> which is available from the snapshot's 8707 <link to="#machine" /> attribute. When restoring the snapshot, these 8708 settings are copied back to the original machine. 8709 8710 In addition, if the machine was running when the 8706 8711 snapshot was taken (<link to="IMachine::state"/> is <link to="MachineState_Running"/>), 8707 8712 the current VM state is saved in the snapshot (similarly to what happens 8708 when a VM's state is saved). The snapshot is then said to 8709 be <i>online</i> because when restoring it, the VM will be running. 8710 8711 If the machine is saved (<link to="MachineState_Saved"/>), the snapshot 8712 receives a copy of the execution state file (<link to="IMachine::stateFilePath"/>). 8713 when a VM's state is saved). The snapshot is then said to be <i>online</i> 8714 because when restoring it, the VM will be running. 8715 8716 If the machine was in <link to="MachineState_Saved">saved</link> saved, 8717 the snapshot receives a copy of the execution state file 8718 (<link to="IMachine::stateFilePath"/>). 8713 8719 8714 8720 Otherwise, if the machine was not running (<link to="MachineState_PoweredOff"/> … … 8723 8729 8724 8730 <attribute name="name" type="wstring"> 8725 <desc>Short name of the snapshot.</desc> 8731 <desc>Short name of the snapshot. 8732 <note>Setting this attribute causes <link to="IMachine::saveSettings" /> to 8733 be called implicitly.</note> 8734 </desc> 8726 8735 </attribute> 8727 8736 8728 8737 <attribute name="description" type="wstring"> 8729 <desc>Optional description of the snapshot.</desc> 8738 <desc>Optional description of the snapshot. 8739 <note>Setting this attribute causes <link to="IMachine::saveSettings" /> to 8740 be called implicitly.</note> 8741 </desc> 8730 8742 </attribute> 8731 8743 … … 8769 8781 <desc> 8770 8782 Child snapshots (all snapshots having this one as a parent). 8783 By inspecting this attribute starting with a machine's root snapshot 8784 (which can be obtained by calling <link to="IMachine::findSnapshot" /> 8785 with a @c null UUID), a machine's snapshots tree can be iterated over. 8771 8786 </desc> 8772 8787 </attribute> -
trunk/src/VBox/Main/src-server/SnapshotImpl.cpp
r35368 r35602 346 346 STDMETHODIMP Snapshot::COMSETTER(Name)(IN_BSTR aName) 347 347 { 348 HRESULT rc = S_OK; 348 349 CheckComArgStrNotEmptyOrNull(aName); 349 350 … … 358 359 { 359 360 m->strName = strName; 360 361 361 alock.leave(); /* Important! (child->parent locks are forbidden) */ 362 363 // flag the machine as dirty or change won't get saved 364 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); 365 m->pMachine->setModified(Machine::IsModified_Snapshots); 366 mlock.leave(); 367 368 return m->pMachine->onSnapshotChange(this); 369 } 370 371 return S_OK; 362 rc = m->pMachine->onSnapshotChange(this); 363 } 364 365 return rc; 372 366 } 373 367 … … 387 381 STDMETHODIMP Snapshot::COMSETTER(Description)(IN_BSTR aDescription) 388 382 { 383 HRESULT rc = S_OK; 389 384 AutoCaller autoCaller(this); 390 385 if (FAILED(autoCaller.rc())) return autoCaller.rc(); … … 397 392 { 398 393 m->strDescription = strDescription; 399 400 394 alock.leave(); /* Important! (child->parent locks are forbidden) */ 401 402 // flag the machine as dirty or change won't get saved 403 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); 404 m->pMachine->setModified(Machine::IsModified_Snapshots); 405 mlock.leave(); 406 407 return m->pMachine->onSnapshotChange(this); 408 } 409 410 return S_OK; 395 rc = m->pMachine->onSnapshotChange(this); 396 } 397 398 return rc; 411 399 } 412 400 … … 1193 1181 * snapshot data such as name or description is changed. 1194 1182 * 1195 * @ note Locks this object for writing.1183 * @warning Caller must hold no locks when calling this. 1196 1184 */ 1197 1185 HRESULT SnapshotMachine::onSnapshotChange(Snapshot *aSnapshot) 1198 1186 { 1199 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1200 1201 // mPeer->saveAllSnapshots(); @todo 1187 AutoMultiWriteLock2 mlock(this, aSnapshot COMMA_LOCKVAL_SRC_POS); 1188 Guid uuidMachine(mData->mUuid), 1189 uuidSnapshot(aSnapshot->getId()); 1190 bool fNeedsGlobalSaveSettings = false; 1191 1192 // flag the machine as dirty or change won't get saved 1193 mPeer->setModified(Machine::IsModified_Snapshots); 1194 HRESULT rc = mPeer->saveSettings(&fNeedsGlobalSaveSettings, 1195 SaveS_Force); // we know we need saving, no need to check 1196 mlock.leave(); 1197 1198 if (SUCCEEDED(rc) && fNeedsGlobalSaveSettings) 1199 { 1200 // save the global settings 1201 AutoWriteLock vboxlock(mParent COMMA_LOCKVAL_SRC_POS); 1202 rc = mParent->saveSettings(); 1203 } 1202 1204 1203 1205 /* inform callbacks */ 1204 mParent->onSnapshotChange( mData->mUuid, aSnapshot->getId());1205 1206 return S_OK;1206 mParent->onSnapshotChange(uuidMachine, uuidSnapshot); 1207 1208 return rc; 1207 1209 } 1208 1210
Note:
See TracChangeset
for help on using the changeset viewer.