VirtualBox

Changeset 73664 in vbox


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
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/manual/en_US/user_VBoxManage.xml

    r73538 r73664  
    26652665        <para>
    26662666          <computeroutput>--options
    2667           link|keepallmacs|keepnatmacs|keepdisknames</computeroutput>:
     2667          link|keepallmacs|keepnatmacs|keepdisknames|keephwuuids</computeroutput>:
    26682668          Allows additional fine tuning of the clone operation. The
    26692669          first option defines that a linked clone should be created,
     
    26772677          <computeroutput>keepdisknames</computeroutput> all new disk
    26782678          images are called like the original ones, otherwise they are
    2679           renamed.
     2679          renamed. If you add <computeroutput>keephwuuids</computeroutput>
     2680          source hardware IDs will be preserved.
    26802681        </para>
    26812682      </listitem>
     
    27612762    <para>
    27622763      Use of the <computeroutput>--options
    2763       link|keepallmacs|keepnatmacs|keepdisknames</computeroutput>:
     2764      keepallmacs|keepnatmacs|keepdisknames</computeroutput>:
    27642765      option enables additional fine tuning of the clone operation. The
    2765       first option defines that a linked clone should be created, which
    2766       is only possible for a machine clone from a snapshot. The next two
    2767       options enable specification of how the MAC addresses of every
    2768       virtual network card should be handled. They can either be
     2766      first two options enable specification of how the MAC addresses of
     2767      every virtual network card should be handled. They can either be
    27692768      reinitialized (the default), left unchanged
    27702769      (<computeroutput>keepallmacs</computeroutput>) or left unchanged
  • 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