VirtualBox

Changeset 33318 in vbox


Ignore:
Timestamp:
Oct 21, 2010 4:16:03 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
66894
Message:

Main/Snapshot: fix live deletion of the first snapshot (regression introduced by the new code for deleting the first and only snapshot)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/SnapshotImpl.cpp

    r33307 r33318  
    26772677                    childSnapshotId = pChildSnapshot->getId();
    26782678                }
    2679                 // If this is an online deletion the attachment was updated
    2680                 // already as it is required to continue execution immediately.
    2681                 // Needs a bit of special treatment due to this difference.
    2682                 if (it->mfNeedsOnlineMerge)
     2679                pAtt = findAttachment(pMachine->mMediaData->mAttachments, it->mpSource);
     2680                if (pAtt)
    26832681                {
     2682                    AutoWriteLock attLock(pAtt COMMA_LOCKVAL_SRC_POS);
     2683                    pAtt->updateMedium(it->mpTarget);
    26842684                    it->mpTarget->addBackReference(pMachine->mData->mUuid, childSnapshotId);
    26852685                }
    26862686                else
    26872687                {
    2688                     pAtt = findAttachment(pMachine->mMediaData->mAttachments, it->mpSource);
    26892688                    // If no attachment is found do not change anything. Maybe
    26902689                    // the source medium was not attached to the snapshot.
    2691                     if (pAtt)
    2692                     {
    2693                         AutoWriteLock attLock(pAtt COMMA_LOCKVAL_SRC_POS);
    2694                         pAtt->updateMedium(it->mpTarget);
     2690                    // If this is an online deletion the attachment was updated
     2691                    // already to allow the VM continue execution immediately.
     2692                    // Needs a bit of special treatment due to this difference.
     2693                    if (it->mfNeedsOnlineMerge)
    26952694                        it->mpTarget->addBackReference(pMachine->mData->mUuid, childSnapshotId);
    2696                     }
    26972695                }
    26982696            }
     
    32603258    ComObjPtr<Medium> pTarget(static_cast<Medium *>(aTarget));
    32613259    ComObjPtr<Medium> pParentForTarget(static_cast<Medium *>(aParentForTarget));
     3260    bool fSourceHasChildren = false;
    32623261
    32633262    // all hard disks but the target were successfully deleted by
     
    33023301        if (childrenToReparent.size() > 0)
    33033302        {
     3303            fSourceHasChildren = true;
    33043304            // Fix the parent UUID of the images which needs to be moved to
    33053305            // underneath target. The running machine has the images opened,
     
    34073407    }
    34083408
    3409     /* If this is a backwards merge update the medium associated with the
    3410      * attachment, as the previously associated one is now deleted. */
    3411     if (!aMergeForward)
     3409    /* If this is a backwards merge of the only remaining snapshot (i.e. the
     3410     * source has no children) then update the medium associated with the
     3411     * attachment, as the previously associated one (source) is now deleted.
     3412     * Without the immediate update the VM could not continue running. */
     3413    if (!aMergeForward && !fSourceHasChildren)
    34123414    {
    34133415        AutoWriteLock attLock(pMediumAttachment COMMA_LOCKVAL_SRC_POS);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette