- Timestamp:
- Jul 18, 2011 7:52:09 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp
r37985 r38038 34 34 typedef struct 35 35 { 36 Utf8Str strBaseName; 36 37 ComPtr<IMedium> pMedium; 37 38 ULONG uWeight; … … 367 368 mtc.fAttachLinked = fAttachLinked; 368 369 370 /* If the current state without any snapshots is cloned, we 371 * don't need any diff images in the new clone. Add the last 372 * medium to the list of medias to create only (the clone 373 * operation of IMedium will create a merged copy 374 * automatically). */ 369 375 if (d->mode == CloneMode_MachineState) 370 376 { … … 377 383 if (FAILED(rc)) throw rc; 378 384 385 ComPtr<IMedium> pBaseMedium; 386 rc = pSrcMedium->COMGETTER(Base)(pBaseMedium.asOutParam()); 387 if (FAILED(rc)) throw rc; 388 389 MEDIUMTASK mt; 390 391 Bstr bstrBaseName; 392 rc = pBaseMedium->COMGETTER(Name)(bstrBaseName.asOutParam()); 393 if (FAILED(rc)) throw rc; 394 395 /* Save the base name. */ 396 mt.strBaseName = bstrBaseName; 397 379 398 /* Save the current medium, for later cloning. */ 380 MEDIUMTASK mt;381 399 mt.pMedium = pSrcMedium; 382 400 if (fAttachLinked) … … 679 697 if (!fKeepDiskNames) 680 698 { 699 Utf8Str strSrcTest = bstrSrcName; 700 /* Check if we have to use another name. */ 701 if (!mt.strBaseName.isEmpty()) 702 strSrcTest = mt.strBaseName; 703 strSrcTest.stripExt(); 681 704 /* If the old disk name was in {uuid} format we also 682 705 * want the new name in this format, but with the … … 685 708 * For all other disks we rename them with this 686 709 * template: "new name-disk1.vdi". */ 687 Utf8Str strSrcTest = Utf8Str(bstrSrcName).stripExt();688 710 if (strSrcTest == strOldVMName) 689 711 strNewName = Utf8StrFmt("%s%s", trgMCF.machineUserData.strName.c_str(), RTPathExt(Utf8Str(bstrSrcName).c_str())); … … 707 729 if (FAILED(rc)) throw rc; 708 730 if ( !bstrSrcPath.isEmpty() 709 && RTPathStartsWith(Utf8Str(bstrSrcPath).c_str(), Utf8Str(bstrSrcSnapshotFolder).c_str())) 731 && RTPathStartsWith(Utf8Str(bstrSrcPath).c_str(), Utf8Str(bstrSrcSnapshotFolder).c_str()) 732 && !(fKeepDiskNames || mt.strBaseName.isEmpty())) 710 733 strFile = Utf8StrFmt("%s%c%s", strTrgSnapshotFolder.c_str(), RTPATH_DELIMITER, strNewName.c_str()); 711 else712 strFile = Utf8StrFmt("%s%c%s", strTrgMachineFolder.c_str(), RTPATH_DELIMITER, strNewName.c_str());713 734 714 735 /* Start creating the clone. */
Note:
See TracChangeset
for help on using the changeset viewer.