VirtualBox

Changeset 28873 in vbox


Ignore:
Timestamp:
Apr 28, 2010 2:55:35 PM (15 years ago)
Author:
vboxsync
Message:

Main/Snapshot+Console: implement reparenting children as part of a live merge, and remove the corresponding blockers in the code which prevented deleting the first snapshot

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

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

    r28835 r28873  
    42914291    int vrc = VINF_SUCCESS;
    42924292    PVM pVM = mpVM;
    4293 
    4294 /// @todo handling the list of children to reparent is not yet done, get out
    4295     com::SafeIfaceArray<IMedium> sfaToReparent(ComSafeArrayInArg(aChildrenToReparent));
    4296     if (sfaToReparent.size() > 0)
    4297         return setError(E_NOTIMPL,
    4298                         tr("Cannot do online merging yet which involves adjusting the UUID of dependent media."));
    42994293
    43004294    /* We will need to release the lock before doing the actual merge */
  • trunk/src/VBox/Main/SnapshotImpl.cpp

    r28856 r28873  
    24922492// SessionMachine::FinishOnlineMergeMedium can't handle reparenting yet, block
    24932493// here. Can be removed step by step.
    2494                     if (!it->mfMergeForward)
     2494                    if (!it->mfMergeForward && it->mChildrenToReparent.size() == 0)
    24952495                        throw setError(E_NOTIMPL,
    24962496                                       tr("Snapshot '%s' of the machine '%ls' cannot be deleted while a VM is running, as this case is not implemented yet. You can delete the snapshot when the VM is powered off"),
     
    31603160        targetChild->deparent();
    31613161
    3162         // reparent source's children and disconnect the deleted
    3163         // branch at the younger end
     3162        // Update parent UUIDs of the source's children, reparent them and
     3163        // disconnect the deleted branch at the younger end
    31643164        com::SafeIfaceArray<IMedium> childrenToReparent(ComSafeArrayInArg(aChildrenToReparent));
    31653165        if (childrenToReparent.size() > 0)
    31663166        {
    3167 /// @todo this is NOT fully working, the image open/parent change is missing.
    3168 // See Medium::taskMergeHandler. Should be safe to add, as the VM is paused
    3169 // right now. Should not get here, check in Console::onlineMergeMedium.
    3170             AssertFailedReturn(E_FAIL);
     3167            // Fix the parent UUID of the images which needs to be moved to
     3168            // underneath target. The running machine has the images opened,
     3169            // but only for reading since the VM is paused. If anything fails
     3170            // we must continue. The worst possible result is that the images
     3171            // need manual fixing via VBoxManage to adjust the parent UUID.
     3172            MediaList toReparent;
     3173            for (size_t i = 0; i < childrenToReparent.size(); i++)
     3174            {
     3175                Medium *pMedium = static_cast<Medium *>(childrenToReparent[i]);
     3176                toReparent.push_back(pMedium);
     3177            }
     3178            pTarget->fixParentUuidOfChildren(toReparent);
     3179
    31713180            // obey {parent,child} lock order
    31723181            AutoWriteLock sourceLock(pSource COMMA_LOCKVAL_SRC_POS);
Note: See TracChangeset for help on using the changeset viewer.

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