Changeset 37900 in vbox
- Timestamp:
- Jul 12, 2011 1:31:46 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
doc/manual/en_US/user_VBoxManage.xml (modified) (1 diff)
-
src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp (modified) (1 diff)
-
src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp (modified) (1 diff)
-
src/VBox/Main/idl/VirtualBox.xidl (modified) (2 diffs)
-
src/VBox/Main/include/MediumImpl.h (modified) (1 diff)
-
src/VBox/Main/src-server/MachineImplCloneVM.cpp (modified) (5 diffs)
-
src/VBox/Main/src-server/MediumImpl.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/manual/en_US/user_VBoxManage.xml
r37872 r37900 1118 1118 </listitem> 1119 1119 <listitem> 1120 <para><computeroutput>--options keepallmacs|keepnatmacs</computeroutput>: 1121 With this option you define how the MAC addresses of every virtual 1120 <para><computeroutput>--options keepallmacs|keepnatmacs|keepdisknames</computeroutput>: 1121 Allows additional fine tuning of the clone operation. The first two 1122 options allow to define how the MAC addresses of every virtual 1122 1123 network card should be handled. They can either be reinitialized 1123 1124 (the default), leaved unchanged 1124 1125 (<computeroutput>keepallmacs</computeroutput>) or leaved unchanged 1125 when the network type is NAT (<computeroutput>keepnatmacs</computeroutput>). 1126 </para> 1126 when the network type is NAT 1127 (<computeroutput>keepnatmacs</computeroutput>). If you add 1128 <computeroutput>keepdisknames</computeroutput> all new disk images 1129 are called like the original once, otherwise they are 1130 renamed.</para> 1127 1131 </listitem> 1128 1132 <listitem> -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r37862 r37900 336 336 " [--snapshot <uuid>|<name>]\n" 337 337 " [--mode machine|machineandchilds|all]\n" 338 " [--options keepallmacs|keepnatmacs ]\n"338 " [--options keepallmacs|keepnatmacs|keepdisknames]\n" 339 339 " [--name <name>]\n" 340 340 " [--basefolder <basefolder>]\n" -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp
r37896 r37900 309 309 else if (!RTStrNICmp(psz, "KeepNATMACs", len)) 310 310 options->push_back(CloneOptions_KeepNATMACs); 311 else if (!RTStrNICmp(psz, "KeepDiskNames", len)) 312 options->push_back(CloneOptions_KeepDiskNames); 311 313 // else if (!RTStrNICmp(psz, "Link", len)) 312 // *options.push_back(CloneOptions_Link)314 // options->push_back(CloneOptions_Link) 313 315 else 314 316 rc = VERR_PARSE_ERROR; -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r37863 r37900 3600 3600 <enum 3601 3601 name="CloneOptions" extends="$unknown" 3602 uuid=" 1be61ee1-c0ea-4942-b733-7496f27d4f28"3602 uuid="22243f8e-96ab-497c-8cf0-f40a566c630b" 3603 3603 > 3604 3604 … … 3615 3615 <const name="KeepNATMACs" value="3"> 3616 3616 <desc>Don't generate new MAC addresses of the attached network adapters when they are using NAT.</desc> 3617 </const> 3618 <const name="KeepDiskNames" value="4"> 3619 <desc>Don't change the disk names.</desc> 3617 3620 </const> 3618 3621 -
trunk/src/VBox/Main/include/MediumImpl.h
r37831 r37900 205 205 206 206 bool isReadOnly(); 207 void updateId(const Guid &id); 207 208 208 209 HRESULT saveSettings(settings::Medium &data, -
trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp
r37612 r37900 464 464 /* 465 465 * Todo: 466 * - Snapshot diffs (can) have the uuid as name. After cloning this isn't467 * right anymore. Is it worth to change to the new uuid? Or should the468 * cloned disks called exactly as the original one or should all new disks469 * get a new name with the new VM name in it.470 466 * - What about log files? 471 467 */ … … 541 537 strTrgSnapshotFolder = Utf8StrFmt("%s%c%s", strTrgMachineFolder.c_str(), RTPATH_DELIMITER, trgMCF.machineUserData.strSnapshotFolder.c_str()); 542 538 539 /* Should we rename the disk names. */ 540 bool fKeepDiskNames = d->options.contains(CloneOptions_KeepDiskNames); 541 543 542 /* We need to create a map with the already created medias. This is 544 543 * necessary, cause different snapshots could have the same … … 548 547 typedef std::pair<Utf8Str, ComObjPtr<Medium> > TStrMediumPair; 549 548 TStrMediumMap map; 549 size_t cDisks = 0; 550 550 for (size_t i = 0; i < d->llMedias.size(); ++i) 551 551 { … … 596 596 } 597 597 598 /* If the old disk name was in {uuid} format we also want 599 * the new name in this format, but with the updated id of 600 * course. For all other disks we rename them with this 601 * template: "new name-disk1.vdi". */ 602 Guid newId; 603 newId.create(); 604 Utf8Str strNewName(bstrSrcName); 605 if (!fKeepDiskNames) 606 { 607 strNewName = Utf8StrFmt("%s-disk%d%s", trgMCF.machineUserData.strName.c_str(), ++cDisks, RTPathExt(Utf8Str(bstrSrcName).c_str())); 608 Utf8Str strSrcTest = Utf8Str(bstrSrcName).stripExt(); 609 if (strSrcTest.startsWith("{") && 610 strSrcTest.endsWith("}")) 611 { 612 strSrcTest = strSrcTest.substr(1, strSrcTest.length() - 2); 613 if (isValidGuid(strSrcTest)) 614 { 615 strNewName = Utf8StrFmt("%s%s", newId.toStringCurly().c_str(), RTPathExt(strNewName.c_str())); 616 --cDisks; 617 } 618 } 619 } 620 598 621 /* Check if this medium comes from the snapshot folder, if 599 622 * so, put it there in the cloned machine as well. 600 623 * Otherwise it goes to the machine folder. */ 601 Utf8Str strFile = Utf8StrFmt("%s%c%lS", strTrgMachineFolder.c_str(), RTPATH_DELIMITER, bstrSrcName.raw());602 624 Bstr bstrSrcPath; 625 Utf8Str strFile = Utf8StrFmt("%s%c%s", strTrgMachineFolder.c_str(), RTPATH_DELIMITER, strNewName.c_str()); 603 626 rc = pMedium->COMGETTER(Location)(bstrSrcPath.asOutParam()); 604 627 if (FAILED(rc)) throw rc; 605 628 if ( !bstrSrcPath.isEmpty() 606 629 && RTPathStartsWith(Utf8Str(bstrSrcPath).c_str(), Utf8Str(bstrSrcSnapshotFolder).c_str())) 607 strFile = Utf8StrFmt("%s%c% lS", strTrgSnapshotFolder.c_str(), RTPATH_DELIMITER, bstrSrcName.raw());630 strFile = Utf8StrFmt("%s%c%s", strTrgSnapshotFolder.c_str(), RTPATH_DELIMITER, strNewName.c_str()); 608 631 else 609 strFile = Utf8StrFmt("%s%c% lS", strTrgMachineFolder.c_str(), RTPATH_DELIMITER, bstrSrcName.raw());632 strFile = Utf8StrFmt("%s%c%s", strTrgMachineFolder.c_str(), RTPATH_DELIMITER, strNewName.c_str()); 610 633 611 634 /* Start creating the clone. */ … … 620 643 NULL /* llRegistriesThatNeedSaving */); 621 644 if (FAILED(rc)) throw rc; 645 646 /* Update the new uuid. */ 647 pTarget->updateId(newId); 622 648 623 649 srcLock.release(); -
trunk/src/VBox/Main/src-server/MediumImpl.cpp
r37831 r37900 3640 3640 3641 3641 AssertFailedReturn(false); 3642 } 3643 3644 /** 3645 * Internal method to return the medium's size. Must have caller + locking! 3646 * @return 3647 */ 3648 void Medium::updateId(const Guid &id) 3649 { 3650 unconst(m->id) = id; 3642 3651 } 3643 3652
Note:
See TracChangeset
for help on using the changeset viewer.

