Changeset 38420 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Aug 11, 2011 2:30:48 PM (13 years ago)
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp
r38264 r38420 39 39 Utf8Str strBaseName; 40 40 ComPtr<IMedium> pMedium; 41 uint32_t uIdx; 41 42 ULONG uWeight; 42 43 } MEDIUMTASK; … … 278 279 279 280 MEDIUMTASK mt; 281 mt.uIdx = UINT32_MAX; /* No read/write optimization possible. */ 280 282 281 283 /* Save the base name. */ … … 386 388 387 389 MEDIUMTASK mt; 390 mt.uIdx = UINT32_MAX; 388 391 mt.pMedium = pSrcMedium; 389 392 mt.uWeight = (lSize + _1M - 1) / _1M; … … 400 403 rc = addSaveState(machine, uCount, uTotalWeight); 401 404 if (FAILED(rc)) return rc; 405 } 406 /* Build up the index list of the image chain. Unfortunately we can't do 407 * that in the previous loop, cause there we go from child -> parent and 408 * didn't know how many are between. */ 409 for (size_t i = 0; i < llMedias.size(); ++i) 410 { 411 uint32_t uIdx = 0; 412 MEDIUMTASKCHAIN &mtc = llMedias.at(i); 413 for (size_t a = mtc.chain.size(); a > 0; --a) 414 mtc.chain[a - 1].uIdx = ++uIdx; 402 415 } 403 416 #ifdef DEBUG_poetzsch … … 509 522 /* Save the current medium, for later cloning. */ 510 523 MEDIUMTASK mt; 524 mt.uIdx = UINT32_MAX; 511 525 mt.pMedium = pSrcMedium; 512 526 mt.uWeight = (lSize + _1M - 1) / _1M; … … 525 539 rc = addSaveState(machine, uCount, uTotalWeight); 526 540 if (FAILED(rc)) return rc; 541 } 542 /* Build up the index list of the image chain. Unfortunately we can't do 543 * that in the previous loop, cause there we go from child -> parent and 544 * didn't know how many are between. */ 545 for (size_t i = 0; i < llMedias.size(); ++i) 546 { 547 uint32_t uIdx = 0; 548 MEDIUMTASKCHAIN &mtc = llMedias.at(i); 549 for (size_t a = mtc.chain.size(); a > 0; --a) 550 mtc.chain[a - 1].uIdx = ++uIdx; 527 551 } 528 552 … … 1002 1026 const MEDIUMTASKCHAIN &mtc = d->llMedias.at(i); 1003 1027 ComObjPtr<Medium> pNewParent; 1028 uint32_t uSrcParentIdx = UINT32_MAX; 1029 uint32_t uTrgParentIdx = UINT32_MAX; 1004 1030 for (size_t a = mtc.chain.size(); a > 0; --a) 1005 1031 { … … 1134 1160 /* Do the disk cloning. */ 1135 1161 ComPtr<IProgress> progress2; 1136 rc = pMedium->CloneTo(pTarget, 1137 srcVar, 1138 pNewParent, 1139 progress2.asOutParam()); 1162 1163 ComObjPtr<Medium> pLMedium = static_cast<Medium*>((IMedium*)pMedium); 1164 rc = pLMedium->cloneToEx(pTarget, 1165 srcVar, 1166 pNewParent, 1167 progress2.asOutParam(), 1168 uSrcParentIdx, 1169 uTrgParentIdx); 1140 1170 if (FAILED(rc)) throw rc; 1141 1171 … … 1177 1207 } 1178 1208 } 1209 /* Save the current source medium index as the new parent 1210 * medium index. */ 1211 uSrcParentIdx = mt.uIdx; 1212 /* Simply increase the target index. */ 1213 ++uTrgParentIdx; 1179 1214 } 1180 1215 -
trunk/src/VBox/Main/src-server/MediumImpl.cpp
r38397 r38420 5109 5109 */ 5110 5110 HRESULT Medium::cloneToEx(const ComObjPtr<Medium> &aTarget, ULONG aVariant, 5111 const ComObjPtr<Medium> &aParent, const ComObjPtr<Progress> &aProgress,5111 const ComObjPtr<Medium> &aParent, IProgress **aProgress, 5112 5112 uint32_t idxSrcImageSame, uint32_t idxDstImageSame) 5113 5113 { 5114 5114 CheckComArgNotNull(aTarget); 5115 AssertReturn(!aProgress.isNull(), E_INVALIDARG);5115 CheckComArgOutPointerValid(aProgress); 5116 5116 ComAssertRet(aTarget != this, E_INVALIDARG); 5117 5117 … … 5191 5191 5192 5192 /* setup task object to carry out the operation asynchronously */ 5193 pTask = new Medium::CloneTask(this, aProgress, aTarget,5193 pTask = new Medium::CloneTask(this, pProgress, aTarget, 5194 5194 (MediumVariant_T)aVariant, 5195 5195 aParent, idxSrcImageSame, … … 5207 5207 5208 5208 if (SUCCEEDED(rc)) 5209 { 5209 5210 rc = startThread(pTask); 5211 5212 if (SUCCEEDED(rc)) 5213 pProgress.queryInterfaceTo(aProgress); 5214 } 5210 5215 else if (pTask != NULL) 5211 5216 delete pTask;
Note:
See TracChangeset
for help on using the changeset viewer.