VirtualBox

Changeset 38264 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
Aug 1, 2011 2:23:57 PM (13 years ago)
Author:
vboxsync
Message:

Main-CloneVM: Respected the modified state of the source VM. Set to unmodified when a new "current state" is created in the "machineandchildren" case.

File:
1 edited

Legend:

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

    r38153 r38264  
    954954                /* Current state is under root snapshot. */
    955955                trgMCF.uuidCurrentSnapshot = sn.uuid;
     956                /* There will be created a new differencing image based on this
     957                 * snapshot. So reset the modified state. */
     958                trgMCF.fCurrentStateModified = false;
    956959            }
    957960            /* The snapshot will be the root one. */
     
    972975            trgMCF.machineUserData.strSnapshotFolder = "Snapshots";
    973976        trgMCF.strStateFile = "";
    974         /* Force writing of setting file. */
    975         trgMCF.fCurrentStateModified = true;
    976977        /* Set the new name. */
    977978        const Utf8Str strOldVMName = trgMCF.machineUserData.strName;
     
    12891290                                                             &d->pTrgMachine->mData->mUuid);
    12901291            if (FAILED(rc)) throw rc;
    1291         }
    1292 
    1293         /* Now save the new configuration to disk. */
    1294         rc = d->pTrgMachine->SaveSettings();
    1295         if (FAILED(rc)) throw rc;
    1296         trgLock.release();
     1292            /* save all VM data */
     1293            bool fNeedsGlobalSaveSettings = false;
     1294            rc = d->pTrgMachine->saveSettings(&fNeedsGlobalSaveSettings, Machine::SaveS_Force);
     1295            if (FAILED(rc)) throw rc;
     1296            /* Release all locks */
     1297            trgLock.release();
     1298            srcLock.release();
     1299            if (fNeedsGlobalSaveSettings)
     1300            {
     1301                /* save the global settings; for that we should hold only the
     1302                 * VirtualBox lock */
     1303                AutoWriteLock vlock(p->mParent COMMA_LOCKVAL_SRC_POS);
     1304                rc = p->mParent->saveSettings();
     1305                if (FAILED(rc)) throw rc;
     1306            }
     1307        }
     1308
     1309        /* Any additional machines need saving? */
    12971310        if (!llRegistriesThatNeedSaving.empty())
    12981311        {
    1299             srcLock.release();
    13001312            rc = p->mParent->saveRegistries(llRegistriesThatNeedSaving);
    13011313            if (FAILED(rc)) throw rc;
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