Changeset 98352 in vbox for trunk/src/VBox/Main/src-server/MachineImplMoveVM.cpp
- Timestamp:
- Jan 30, 2023 7:44:51 PM (23 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/MachineImplMoveVM.cpp
r98351 r98352 321 321 ULONG uTotalWeight = 1; 322 322 323 /* The lists m_llMedia s, m_llSaveStateFiles and m_llNVRAMFiles are filled in the queryMediasForAllStates() */324 hrc = queryMedia sForAllStates();323 /* The lists m_llMedia, m_llSaveStateFiles and m_llNVRAMFiles are filled in the queryMediaForAllStates() */ 324 hrc = queryMediaForAllStates(); 325 325 if (FAILED(hrc)) 326 326 return hrc; 327 327 328 /* Calculate the total size of images. Fill m_finalMedi umsMap */328 /* Calculate the total size of images. Fill m_finalMediaMap */ 329 329 { /** The scope here for better reading, apart from that the variables have limited scope too */ 330 uint64_t totalMedi umsSize = 0;331 332 for (size_t i = 0; i < m_llMedia s.size(); ++i)333 { 334 MEDIUMTASKCHAINMOVE &mtc = m_llMedia s.at(i);330 uint64_t totalMediaSize = 0; 331 332 for (size_t i = 0; i < m_llMedia.size(); ++i) 333 { 334 MEDIUMTASKCHAINMOVE &mtc = m_llMedia.at(i); 335 335 for (size_t a = mtc.chain.size(); a > 0; --a) 336 336 { … … 353 353 354 354 std::pair<std::map<Utf8Str, MEDIUMTASKMOVE>::iterator,bool> ret; 355 ret = m_finalMedi umsMap.insert(std::make_pair(name, mtc.chain[a - 1]));355 ret = m_finalMediaMap.insert(std::make_pair(name, mtc.chain[a - 1])); 356 356 if (ret.second == true) 357 357 { … … 359 359 ++uCount; 360 360 uTotalWeight += mtc.chain[a - 1].uWeight; 361 totalMedi umsSize += (uint64_t)cbSize;361 totalMediaSize += (uint64_t)cbSize; 362 362 Log2(("Image %s was added into the moved list\n", name.c_str())); 363 363 } … … 366 366 } 367 367 368 Log2(("Total Size of images is %lld bytes\n", totalMedi umsSize));369 neededFreeSpace += totalMedi umsSize;368 Log2(("Total Size of images is %lld bytes\n", totalMediaSize)); 369 neededFreeSpace += totalMediaSize; 370 370 } 371 371 … … 666 666 { 667 667 /* Move all disks */ 668 hrc = taskMoveVM->moveAllDisks(taskMoveVM->m_finalMedi umsMap, strTargetFolder);668 hrc = taskMoveVM->moveAllDisks(taskMoveVM->m_finalMediaMap, strTargetFolder); 669 669 if (FAILED(hrc)) 670 670 throw hrc; … … 1008 1008 taskMoveVM->m_pProgress->SetNextOperation(BstrFmt(tr("Skip the empty operation %d..."), i + 1).raw(), 1); 1009 1009 1010 hrc = taskMoveVM->moveAllDisks(taskMoveVM->m_finalMedi umsMap);1010 hrc = taskMoveVM->moveAllDisks(taskMoveVM->m_finalMediaMap); 1011 1011 if (FAILED(hrc)) 1012 1012 throw hrc; … … 1098 1098 * because we doubled the number of operations for rollback case. 1099 1099 * But if we want to update the progress object corectly it's needed to add all medium moved by standard 1100 * "move medium" logic (for us it's taskMoveVM->m_finalMedi umsMap) to the current number of operation.1100 * "move medium" logic (for us it's taskMoveVM->m_finalMediaMap) to the current number of operation. 1101 1101 */ 1102 1102 … … 1106 1106 hrc = taskMoveVM->m_pProgress->COMGETTER(Operation)(&operation); 1107 1107 1108 for (ULONG i = operation; i < operation + taskMoveVM->m_finalMedi umsMap.size() - 1; ++i)1108 for (ULONG i = operation; i < operation + taskMoveVM->m_finalMediaMap.size() - 1; ++i) 1109 1109 taskMoveVM->m_pProgress->SetNextOperation(BstrFmt(tr("Skip the empty operation %d..."), i).raw(), 1); 1110 1110 … … 1436 1436 } 1437 1437 1438 HRESULT MachineMoveVM::queryMedia sForAllStates()1438 HRESULT MachineMoveVM::queryMediaForAllStates() 1439 1439 { 1440 1440 /* In this case we create a exact copy of the original VM. This means just … … 1525 1525 } 1526 1526 1527 m_llMedia s.append(mtc);1527 m_llMedia.append(mtc); 1528 1528 } 1529 1529 … … 1540 1540 * that in the previous loop, cause there we go from child -> parent and 1541 1541 * didn't know how many are between. */ 1542 for (size_t i = 0; i < m_llMedia s.size(); ++i)1542 for (size_t i = 0; i < m_llMedia.size(); ++i) 1543 1543 { 1544 1544 uint32_t uIdx = 0; 1545 MEDIUMTASKCHAINMOVE &mtc = m_llMedia s.at(i);1545 MEDIUMTASKCHAINMOVE &mtc = m_llMedia.at(i); 1546 1546 for (size_t a = mtc.chain.size(); a > 0; --a) 1547 1547 mtc.chain[a - 1].uIdx = uIdx++;
Note:
See TracChangeset
for help on using the changeset viewer.