- Timestamp:
- Apr 29, 2015 10:16:01 AM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 99867
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r55437 r55511 9995 9995 if ( mData->mMachineState == MachineState_Saved 9996 9996 || mData->mMachineState == MachineState_Restoring 9997 // when deleting a snapshot we may or may not have a saved state in the current state, 9998 // so let's not assert here please 9999 || ( ( mData->mMachineState == MachineState_DeletingSnapshot 10000 || mData->mMachineState == MachineState_DeletingSnapshotOnline 10001 || mData->mMachineState == MachineState_DeletingSnapshotPaused) 9997 // when doing certain snapshot operations we may or may not have 9998 // a saved state in the current state, so keep everything as is 9999 || ( ( mData->mMachineState == MachineState_Snapshotting 10000 || mData->mMachineState == MachineState_DeletingSnapshot) 10002 10001 && (!mSSData->strStateFilePath.isEmpty()) 10003 10002 ) -
trunk/src/VBox/Main/src-server/SnapshotImpl.cpp
r55255 r55511 1555 1555 { 1556 1556 // @todo: at this point we have to be in the right state!!!! 1557 AssertStmt( !Global::IsOnlineOrTransient(mData->mMachineState) 1558 || mData->mMachineState == MachineState_Snapshotting 1557 AssertStmt( mData->mMachineState == MachineState_Snapshotting 1559 1558 || mData->mMachineState == MachineState_OnlineSnapshotting 1560 1559 || mData->mMachineState == MachineState_LiveSnapshotting, throw E_FAIL); … … 1570 1569 } 1571 1570 1572 if ( !task.m_fTakingSnapshotOnline 1573 && mData->mMachineState != MachineState_Saved) 1574 { 1575 /* save settings to ensure current changes are committed and 1576 * hard disks are fixed up */ 1577 rc = i_saveSettings(NULL); 1578 // no need to check for whether VirtualBox.xml needs changing since 1579 // we can't have a machine XML rename pending at this point 1580 if (FAILED(rc)) 1581 throw rc; 1582 } 1571 /* save settings to ensure current changes are committed and 1572 * hard disks are fixed up */ 1573 rc = i_saveSettings(NULL); 1574 // no need to check for whether VirtualBox.xml needs changing since 1575 // we can't have a machine XML rename pending at this point 1576 if (FAILED(rc)) 1577 throw rc; 1583 1578 1584 1579 /* task.m_strStateFilePath is "" when the machine is offline or saved */ … … 1592 1587 i_composeSavedStateFilename(task.m_strStateFilePath); 1593 1588 } 1594 else if ( mData->mMachineState== MachineState_Saved)1589 else if (task.m_machineStateBackup == MachineState_Saved) 1595 1590 // taking an offline snapshot from machine in "saved" state: use existing state file 1596 1591 task.m_strStateFilePath = mSSData->strStateFilePath; … … 1652 1647 1653 1648 fBeganTakingSnapshot = true; 1654 1655 /* Check sanity: for offline snapshots there must not be a saved state1656 * file name. All other combinations are valid (though online snapshots1657 * without saved state file seems inconsistent - there are exotic use1658 * cases, which need to be explicitly enabled, see the code above. */1659 if ( !task.m_fTakingSnapshotOnline1660 && !task.m_strStateFilePath.isEmpty())1661 throw setError(E_FAIL, "Invalid state of saved state file");1662 1649 1663 1650 // STEP 3: save the VM state (if online) … … 1729 1716 // have to postpone this to the end as i_finishTakingSnapshot() needs 1730 1717 // it for various cleanup steps 1731 task.m_pSnapshot->uninit(); 1732 task.m_pSnapshot.setNull(); 1718 if (task.m_pSnapshot) 1719 { 1720 task.m_pSnapshot->uninit(); 1721 task.m_pSnapshot.setNull(); 1722 } 1733 1723 } 1734 1724 Assert(alock.isWriteLockOnCurrentThread()); … … 1845 1835 ComObjPtr<Snapshot> pOldCurrentSnap = mData->mCurrentSnapshot; 1846 1836 1847 bool fOnline = Global::IsOnline(task.m_machineStateBackup);1848 1849 1837 HRESULT rc = S_OK; 1850 1838 … … 1860 1848 int flSaveSettings = SaveS_Force; // do not do a deep compare in machine settings, 1861 1849 // snapshots change, so we know we need to save 1862 if (! fOnline)1850 if (!task.m_fTakingSnapshotOnline) 1863 1851 /* the machine was powered off or saved when taking a snapshot, so 1864 1852 * reset the mCurrentStateModified flag */ … … 1871 1859 { 1872 1860 /* associate old hard disks with the snapshot and do locking/unlocking*/ 1873 i_commitMedia( fOnline);1861 i_commitMedia(task.m_fTakingSnapshotOnline); 1874 1862 1875 1863 /* inform callbacks */ … … 1890 1878 1891 1879 // delete the saved state file (it might have been already created) 1892 if ( fOnline)1880 if (task.m_fTakingSnapshotOnline) 1893 1881 // no need to test for whether the saved state file is shared: an online 1894 1882 // snapshot means that a new saved state file was created, which we must
Note:
See TracChangeset
for help on using the changeset viewer.