VirtualBox

Changeset 73664 in vbox for trunk/src


Ignore:
Timestamp:
Aug 14, 2018 4:40:00 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
124339
Message:

Main: bugref:8598: added "Keep hardware UUIDs" option to "clone machine" operation.

Location:
trunk/src/VBox
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp

    r72883 r73664  
    730730                     "                            [--mode machine|machineandchildren|all]\n"
    731731                     "                            [--options link|keepallmacs|keepnatmacs|\n"
    732                      "                                       keepdisknames]\n"
     732                     "                                       keepdisknames|keephwuuids]\n"
    733733                     "                            [--name <name>]\n"
    734734                     "                            [--groups <group>, ...]\n"
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp

    r71998 r73664  
    453453                     || !RTStrNICmp(psz, "Linked", len))
    454454                options->push_back(CloneOptions_Link);
     455            else if (   !RTStrNICmp(psz, "KeepHwUUIDs", len)
     456                     || !RTStrNICmp(psz, "KeepHwUUID", len))
     457                options->push_back(CloneOptions_KeepHwUUIDs);
    455458            else
    456459                rc = VERR_PARSE_ERROR;
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r73571 r73664  
    48344834      <desc>Don't change the disk names.</desc>
    48354835    </const>
     4836    <const name="KeepHwUUIDs"       value="5">
     4837      <desc>Don't change UUID of the machine hardware.</desc>
     4838    </const>
    48364839
    48374840  </enum>
  • trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp

    r73003 r73664  
    124124                                     ComObjPtr<Medium> *ppDiff) const;
    125125    static DECLCALLBACK(int) copyStateFileProgress(unsigned uPercentage, void *pvUser);
     126    static void updateSnapshotHardwareUUIDs(settings::SnapshotsList &snapshot_list, const Guid &id);
    126127
    127128    /* Private q and parent pointer */
     
    765766}
    766767
     768void MachineCloneVMPrivate::updateSnapshotHardwareUUIDs(settings::SnapshotsList &snapshot_list, const Guid &id)
     769{
     770    for (settings::SnapshotsList::iterator snapshot_it = snapshot_list.begin();
     771         snapshot_it != snapshot_list.end();
     772         ++snapshot_it)
     773    {
     774        if (!snapshot_it->hardware.uuid.isValid() || snapshot_it->hardware.uuid.isZero())
     775            snapshot_it->hardware.uuid = id;
     776        updateSnapshotHardwareUUIDs(snapshot_it->llChildSnapshots, id);
     777    }
     778}
     779
    767780// The public class
    768781/////////////////////////////////////////////////////////////////////////////
     
    10081021         * configuration dataset. */
    10091022        settings::MachineConfigFile trgMCF = *d->pSrcMachine->mData->pMachineConfigFile;
     1023
     1024        /* keep source machine hardware UUID if enabled*/
     1025        if (d->options.contains(CloneOptions_KeepHwUUIDs))
     1026        {
     1027            /* because HW UUIDs must be preserved including snapshots by the option,
     1028             * just fill zero UUIDs with corresponding machine UUID before any snapshot
     1029             * processing will take place, while all uuids are from source machine */
     1030            if (!trgMCF.hardwareMachine.uuid.isValid() || trgMCF.hardwareMachine.uuid.isZero())
     1031                trgMCF.hardwareMachine.uuid = trgMCF.uuid;
     1032
     1033            MachineCloneVMPrivate::updateSnapshotHardwareUUIDs(trgMCF.llFirstSnapshot, trgMCF.uuid);
     1034        }
     1035
    10101036
    10111037        /* Reset media registry. */
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