- Timestamp:
- May 4, 2010 2:54:12 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/SnapshotImpl.cpp
r28875 r29036 23 23 #include "MachineImpl.h" 24 24 #include "MediumImpl.h" 25 #include "MediumFormatImpl.h" 25 26 #include "Global.h" 26 27 #include "ProgressImpl.h" … … 2474 2475 /* No need to hold the lock any longer. */ 2475 2476 mLock.release(); 2477 bool fNeedsSave = false; 2476 2478 rc = pMedium->deleteStorage(&aTask.pProgress, 2477 2479 true /* aWait */, 2478 &fNeedsSaveSettings); 2480 &fNeedsSave); 2481 fNeedsSaveSettings |= fNeedsSave; 2479 2482 if (FAILED(rc)) 2480 2483 throw rc; … … 2486 2489 else 2487 2490 { 2491 bool fNeedsSave = false; 2488 2492 if (it->mfNeedsOnlineMerge) 2489 2493 { … … 2504 2508 it->mpMediumLockList, 2505 2509 aTask.pProgress, 2506 &fNeedsSave Settings);2510 &fNeedsSave); 2507 2511 } 2508 2512 else … … 2516 2520 &aTask.pProgress, 2517 2521 true /* aWait */, 2518 &fNeedsSave Settings);2522 &fNeedsSave); 2519 2523 } 2520 2524 fNeedsSaveSettings |= fNeedsSave; 2525 2526 // If the merge failed, we need to do our best to have a usable 2527 // VM configuration afterwards. The return code doesn't tell 2528 // whether the merge completed and so we have to check if the 2529 // source medium (diff images are always file based at the 2530 // moment) is still there or not. Be careful not to lose the 2531 // error code below, before the "Delayed failure exit". 2521 2532 if (FAILED(rc)) 2522 throw rc; 2533 { 2534 AutoReadLock mlock(it->mpSource COMMA_LOCKVAL_SRC_POS); 2535 const ComObjPtr<MediumFormat> &sourceFormat = it->mpSource->getMediumFormat(); 2536 // No medium format description? get out of here. 2537 if (sourceFormat.isNull()) 2538 throw rc; 2539 // Diff medium not backed by a file - cannot get status so 2540 // be pessimistic. 2541 if (!(sourceFormat->capabilities() & MediumFormatCapabilities_File)) 2542 throw rc; 2543 const Utf8Str &loc = it->mpSource->getLocationFull(); 2544 // Source medium is still there, so merge failed early. 2545 if (RTFileExists(loc.raw())) 2546 throw rc; 2547 2548 // Source medium is gone. Assume the merge succeeded and 2549 // thus it's safe to remove the attachment. We use the 2550 // "Delayed failure exit" below. 2551 } 2523 2552 2524 2553 // need to change the medium attachment for backward merges … … 2583 2612 fMachineSettingsChanged = true; 2584 2613 2585 / * prevent from calling cancelDeleteSnapshotMedium() */2614 // prevent calling cancelDeleteSnapshotMedium() for this attachment 2586 2615 it = toDelete.erase(it); 2616 2617 // Delayed failure exit when the merge cleanup failed but the 2618 // merge actually succeeded. 2619 if (FAILED(rc)) 2620 throw rc; 2587 2621 } 2588 2622
Note:
See TracChangeset
for help on using the changeset viewer.