Changeset 24458 in vbox
- Timestamp:
- Nov 6, 2009 4:02:24 PM (15 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/MediumImpl.cpp
r24345 r24458 3189 3189 * time when discard() is called, there must be no any attachments at all 3190 3190 * (the code calling prepareDiscard() should detach). */ 3191 AssertReturn( m->backRefs.size() == 1 3192 && !m->backRefs.front().inCurState 3193 && m->backRefs.front().llSnapshotIds.size() == 1, 3194 E_FAIL); 3191 AssertReturn(m->backRefs.size() == 1, E_FAIL); 3192 AssertReturn(!m->backRefs.front().inCurState, E_FAIL); 3193 AssertReturn(m->backRefs.front().llSnapshotIds.size() == 1, E_FAIL); 3195 3194 3196 3195 ComObjPtr<Medium> child = children().front(); … … 4071 4070 4072 4071 if (m->backRefs.size() != 0) 4072 { 4073 Utf8Str strMachines; 4074 for (BackRefList::const_iterator it = m->backRefs.begin(); 4075 it != m->backRefs.end(); 4076 ++it) 4077 { 4078 const BackRef &b = *it; 4079 if (strMachines.length()) 4080 strMachines.append(", "); 4081 strMachines.append(b.machineId.toString().c_str()); 4082 } 4083 #ifdef DEBUG 4084 dumpBackRefs(); 4085 #endif 4073 4086 return setError(VBOX_E_OBJECT_IN_USE, 4074 tr("Hard disk '%s' is attached to %d virtual machines"), 4075 m->strLocationFull.raw(), m->backRefs.size()); 4087 tr("Cannot delete storage: hard disk '%s' is still attached to the following %d virtual machine(s): %s"), 4088 m->strLocationFull.c_str(), 4089 m->backRefs.size(), 4090 strMachines.c_str()); 4091 } 4076 4092 4077 4093 HRESULT rc = canClose(); -
trunk/src/VBox/Main/SnapshotImpl.cpp
r24447 r24458 1810 1810 LogFlowThisFunc(("Detaching old current state in differencing image '%s'\n", pMedium->name().raw())); 1811 1811 1812 // we "detach" the medium by removing the attachment object1813 // from the current machine data; saveSettings() below w illthen1812 // Normally we "detach" the medium by removing the attachment object 1813 // from the current machine data; saveSettings() below would then 1814 1814 // compare the current machine data with the one in the backup 1815 // and actually call Medium::detachFrom() 1815 // and actually call Medium::detachFrom(). But that works only half 1816 // the time in our case so instead we force a detachment here: 1817 // remove from machine data 1816 1818 mMediaData->mAttachments.remove(pAttach); 1819 // remove it from the backup or else saveSettings will try to detach 1820 // it again and assert 1821 mMediaData.backedUpData()->mAttachments.remove(pAttach); 1822 // then clean up backrefs 1823 pMedium->detachFrom(mData->mUuid); 1817 1824 1818 1825 llDiffsToDelete.push_back(pMedium);
Note:
See TracChangeset
for help on using the changeset viewer.