VirtualBox

Changeset 37523 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jun 17, 2011 9:16:57 AM (14 years ago)
Author:
vboxsync
Message:

Main-CloneVM: handle a special case in input params

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp

    r37522 r37523  
    237237    try
    238238    {
     239        /* Handle the special case that someone is requesting a _full_ clone
     240         * with all snapshots (and the current state), but uses a snapshot
     241         * machine (and not the current one) as source machine. In this case we
     242         * just replace the source (snapshot) machine with the current machine. */
     243        if (   d->mode == CloneMode_AllStates
     244            && d->pSrcMachine->isSnapshotMachine())
     245        {
     246            Bstr bstrSrcMachineId;
     247            rc = d->pSrcMachine->COMGETTER(Id)(bstrSrcMachineId.asOutParam());
     248            if (FAILED(rc)) throw rc;
     249            ComPtr<IMachine> newSrcMachine;
     250            rc = d->pSrcMachine->getVirtualBox()->FindMachine(bstrSrcMachineId.raw(), newSrcMachine.asOutParam());
     251            if (FAILED(rc)) throw rc;
     252            d->pSrcMachine = (Machine*)(IMachine*)newSrcMachine;
     253        }
     254
    239255        /* Lock the target machine early (so nobody mess around with it in the meantime). */
    240256        AutoWriteLock trgLock(d->pTrgMachine COMMA_LOCKVAL_SRC_POS);
     
    248264
    249265        /* Include current state? */
    250         if (   d->mode == CloneMode_MachineState)
    251 //            || d->mode == CloneMode_AllStates)
     266        if (   d->mode == CloneMode_MachineState
     267            || d->mode == CloneMode_AllStates)
    252268            machineList.append(d->pSrcMachine);
    253269        /* Should be done a depth copy with all child snapshots? */
     
    269285                rc = d->cloneCreateMachineList(pSnapshot, machineList);
    270286                if (FAILED(rc)) throw rc;
    271                 rc = pSnapshot->COMGETTER(Machine)(d->pOldMachineState.asOutParam());
    272                 if (FAILED(rc)) throw rc;
     287                if (d->mode == CloneMode_MachineAndChildStates)
     288                {
     289                    rc = pSnapshot->COMGETTER(Machine)(d->pOldMachineState.asOutParam());
     290                    if (FAILED(rc)) throw rc;
     291                }
    273292            }
    274293        }
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