Changeset 37521 in vbox
- Timestamp:
- Jun 17, 2011 6:56:59 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp
r37502 r37521 406 406 * cloned disks called exactly as the original one or should all new disks 407 407 * get a new name with the new VM name in it. 408 * - What about log files? 408 409 */ 409 410 410 411 /* Where should all the media go? */ 412 Utf8Str strTrgSnapshotFolder; 411 413 Utf8Str strTrgMachineFolder = d->pTrgMachine->getSettingsFileFull(); 412 414 strTrgMachineFolder.stripFilename(); … … 468 470 if (FAILED(rc)) throw rc; 469 471 /* The absolute name of the snapshot folder. */ 470 Utf8StrstrTrgSnapshotFolder = Utf8StrFmt("%s%c%s%c", strTrgMachineFolder.c_str(), RTPATH_DELIMITER, trgMCF.machineUserData.strSnapshotFolder.c_str(), RTPATH_DELIMITER);472 strTrgSnapshotFolder = Utf8StrFmt("%s%c%s%c", strTrgMachineFolder.c_str(), RTPATH_DELIMITER, trgMCF.machineUserData.strSnapshotFolder.c_str(), RTPATH_DELIMITER); 471 473 472 474 /* We need to create a map with the already created medias. This is … … 602 604 if (FAILED(rc)) throw rc; 603 605 pNewParent = diff; 606 newMedias.append(diff); 604 607 } 605 608 Bstr bstrSrcId; … … 743 746 for (size_t i = newMedias.size(); i > 0; --i) 744 747 { 748 bool fFile = false; 749 Utf8Str strLoc; 745 750 ComObjPtr<Medium> &pMedium = newMedias.at(i - 1); 746 AutoCaller mac(pMedium); 747 if (FAILED(mac.rc())) { continue; rc = mac.rc(); } 748 AutoReadLock mlock(pMedium COMMA_LOCKVAL_SRC_POS); 749 bool fFile = pMedium->isMediumFormatFile(); 750 Utf8Str strLoc = pMedium->getLocationFull(); 751 mlock.release(); 752 /* Close the medium. If this succeed, delete it finally from the 753 * disk. */ 754 rc = pMedium->close(NULL, mac); 755 if (FAILED(rc)) continue; 751 { 752 AutoCaller mac(pMedium); 753 if (FAILED(mac.rc())) { continue; rc = mac.rc(); } 754 AutoReadLock mlock(pMedium COMMA_LOCKVAL_SRC_POS); 755 fFile = pMedium->isMediumFormatFile(); 756 strLoc = pMedium->getLocationFull(); 757 } 756 758 if (fFile) 757 759 { … … 761 763 } 762 764 } 765 /* Delete the snapshot folder when not empty. */ 766 if (!strTrgSnapshotFolder.isEmpty()) 767 RTDirRemove(strTrgSnapshotFolder.c_str()); 763 768 /* Delete the machine folder when not empty. */ 764 769 RTDirRemove(strTrgMachineFolder.c_str());
Note:
See TracChangeset
for help on using the changeset viewer.